refactor(agent): share the SQLite session cache (#526)

This commit is contained in:
Yiling-J
2026-11-11 17:05:34 +08:00
committed by GitHub
parent 35a0e82284
commit 00fa5fed75
8 changed files with 509 additions and 98 deletions
+3 -2
View File
@@ -14,8 +14,9 @@ const root = join(
instance,
)
export async function openSessionCache(sessionId: string, mode: 'read' | 'write') {
const directory = join(root, mode, encodeURIComponent(sessionId))
// Call only while the session has no open connections; live readers borrow the writer's storage.
export async function openSessionCache(sessionId: string) {
const directory = join(root, encodeURIComponent(sessionId))
await mkdir(directory, { recursive: true, mode: 0o700 })
const path = join(directory, 'session.sqlite')
const marker = join(directory, 'sync.json')