/** * companion-chat-broker-sync.ts * * Owns the live mirror of companion sessions into the shared * `SharedSessionBroker` store (S1 item D: companion registers into the * broker at write time), chaining register/close/delete ops per session so * they never race (order = call order), and exposing `flush()` so the * companion HTTP routes can await in-flight ops before responding * (deterministic for tests). * * Split out of CompanionChatManager (see CHANGELOG 1.0.0) to stay under the repo's * grandfathered line-cap ceiling (see scripts/check-line-cap.ts), a pure * file-organization move, not a behavior change: same chaining, same * best-effort swallow-and-log-on-failure semantics. */ import type { CompanionChatSession } from './companion-chat-types.js'; import type { CompanionSessionBrokerBridge } from './companion-chat-broker-bridge.js'; export declare class CompanionBrokerSync { private readonly broker; private readonly pendingOps; constructor(broker: CompanionSessionBrokerBridge | null); /** * Await all in-flight best-effort broker-sync operations. The daemon's * companion HTTP routes call this before responding so `/api/sessions` * reflects the change synchronously; tests use it to make the mirror * deterministic. A no-op when no broker bridge is configured. */ flush(): Promise; /** Chain a broker op AFTER any prior op for the same session so register and * close/delete never race (order = call order). Best-effort; errors are * swallowed (logged, never thrown into the caller's write path). */ track(sessionId: string, run: () => Promise): void; registerSession(meta: CompanionChatSession): Promise; closeSession(sessionId: string): Promise; /** Hard-remove the mirrored shared-session record (see CHANGELOG 1.0.0: companion delete is a real removal). */ deleteSession(sessionId: string): Promise; } //# sourceMappingURL=companion-chat-broker-sync.d.ts.map