refactor: remove dead session code
This commit is contained in:
1 parent
0128191ac3
commit
a7827b2fa6
5 files changed
+27
-84
No files matched your search
@@ -1,9 +1,15 @@
|
||||
"""SQLModel tables — see PRD §9.
|
||||
"""SQLModel tables.
|
||||
|
||||
Three tables, all flat, no relationships modelled yet (Phase 4 talks
|
||||
about ``actor`` and ``agent_name`` as strings — joining audit→token by
|
||||
name is fine at this volume; we'll introduce FKs when the admin UI
|
||||
actually demands them).
|
||||
Two tables, both flat, no relationships modelled yet (``actor`` and
|
||||
``agent_name`` are stored as strings — joining audit→token by name is
|
||||
fine at this volume; we'll introduce FKs when the admin UI actually
|
||||
demands them).
|
||||
|
||||
A ``Session`` table originally lived here for live-session
|
||||
observability. It was dropped after we decided the gateway stays
|
||||
stateless about identity (claude-code-api's in-memory fingerprint pool
|
||||
is the source of truth) and that conversation persistence belongs in a
|
||||
future Obsidian-sync frontend, not a sessions table.
|
||||
|
||||
Datetimes are stored UTC; we set ``default_factory`` rather than relying
|
||||
on DB defaults so SQLite + Postgres behave identically. Every row that
|
||||
@@ -39,23 +45,6 @@ class Token(SQLModel, table=True):
|
||||
revoked_at: datetime | None = Field(default=None)
|
||||
|
||||
|
||||
class Session(SQLModel, table=True):
|
||||
"""Mirror of one live ``claude-code-api`` session.
|
||||
|
||||
The id is the ``session_id`` claude itself assigns on the first
|
||||
turn; we don't generate it. Rows here are for admin observability
|
||||
(live count, last activity) — the actual pool lives in
|
||||
``claude_code_api.ClaudeCodeBackend`` and is the source of truth.
|
||||
"""
|
||||
|
||||
id: str = Field(primary_key=True)
|
||||
agent_name: str = Field(index=True)
|
||||
fingerprint: str = Field(index=True)
|
||||
created_at: datetime = Field(default_factory=_utcnow)
|
||||
last_active_at: datetime = Field(default_factory=_utcnow)
|
||||
closed_at: datetime | None = Field(default=None)
|
||||
|
||||
|
||||
class AuditLog(SQLModel, table=True):
|
||||
"""Append-only record of who-did-what.
|
||||
|
||||
@@ -77,4 +66,4 @@ class AuditLog(SQLModel, table=True):
|
||||
detail_json: str = Field(default="{}")
|
||||
|
||||
|
||||
__all__ = ["AuditLog", "Session", "Token"]
|
||||
__all__ = ["AuditLog", "Token"]
|
||||
Reference in new issue
Block a user