import type { SqlExecutor, OrchestrationState } from './types.js'; /** * Lightweight store for AriaFlow orchestration state, keyed by session id. * * This is NOT a SessionStore. CF owns message persistence via its * cf_ai_chat_agent_messages table. This store only tracks the state * AriaFlow needs for multi-agent orchestration within a specific call / * logical session: * * - currentAgent: which agent is active * - workingMemory: key-value context injected into prompts * - agentStates: per-agent state (flow node, extraction data, etc.) * - handoffHistory: agent-to-agent transfer log * * Keyed by `sessionId`, so multiple calls into the same DO get isolated * orchestration state (fresh flow node per call, independent handoff history). * DO-scoped state that should survive across calls (Gemini resumption handle, * long-term memory facts) belongs in `this.state`, not here. * * Earlier versions used a hardcoded `'default'` sentinel, collapsing every * call in a DO into the same row. That was fine for single-call demos but * caused cross-call state leaks (flow stuck at `confirm` on the 2nd call). */ export declare class OrchestrationStore { private sql; private initialized; constructor(sql: SqlExecutor); private ensureTable; get(id: string): Promise; save(id: string, state: OrchestrationState): Promise; clear(id: string): Promise; /** * Garbage-collect rows older than `maxAgeMs`. Call from an alarm or on * DO wake to keep the table bounded when users don't explicitly end calls. */ cleanup(maxAgeMs: number): Promise; }