perf(webui): reuse versioned history navigation snapshots
This commit is contained in:
1 parent
103840171b
commit
af68da3280
6 files changed
+288
-103
No files matched your search
@@ -597,6 +597,10 @@ class SessionManager:
|
||||
"""Load a detached session snapshot without populating the runtime cache."""
|
||||
return self._store.load(key)
|
||||
|
||||
def read_session_version(self, key: str) -> tuple[str, int] | None:
|
||||
"""Return a cheap committed version, including delete/recreate identity."""
|
||||
return self._store.read_version(key)
|
||||
|
||||
def read_session_metadata(self, key: str) -> dict[str, Any] | None:
|
||||
"""Read session metadata without loading the transcript."""
|
||||
return cast(dict[str, Any] | None, self._store.read_metadata(key))
|
||||
|
||||
@@ -369,6 +369,12 @@ class SqliteSessionStore:
|
||||
if updated_at is not None:
|
||||
db.execute("UPDATE sessions SET updated_at=? WHERE key=?", (updated_at.isoformat(), key))
|
||||
|
||||
def read_version(self, key: str) -> tuple[str, int] | None:
|
||||
"""Read the committed lifecycle and revision without decoding history or metadata."""
|
||||
with self.transaction(write=False) as db:
|
||||
row = db.execute("SELECT generation, revision FROM sessions WHERE key=?", (key,)).fetchone()
|
||||
return (str(row[0]), int(row[1])) if row is not None else None
|
||||
|
||||
def read_metadata(self, key: str) -> SessionMetadataPayload | None:
|
||||
with self.transaction(write=False) as db:
|
||||
row = db.execute("SELECT created_at, updated_at, metadata FROM sessions WHERE key=?", (key,)).fetchone()
|
||||
|
||||
Reference in new issue
Block a user