import type { Agent, AgentMessage } from "@caupulican/pi-agent-core"; import type { SessionManager } from "@caupulican/pi-agent-core/session"; import type { ModelRouterController } from "./model-router-controller.ts"; interface ForegroundLifecycleControllerDeps { agent: Agent; sessionManager: SessionManager; modelRouter: ModelRouterController; emitWarning(message: string): void; } /** * Foreground persistence boundary for provider requests and tool execution. * * Agent-core deliberately owns provider/tool ordering while coding-agent owns the session log. This * controller is the adapter between those lifecycles: request snapshots are written before transport, * cheap routed messages are committed before a prepared tool body starts, and canonical result message * ids are linked to one bounded terminal record. It never persists request content, tool arguments, or * tool results in lifecycle metadata. */ export declare class ForegroundLifecycleController { private readonly deps; private readonly persistedMessages; private readonly startedTools; private readonly pendingToolsByCall; private readonly completedResultMessages; constructor(deps: ForegroundLifecycleControllerDeps); /** Install the two agent-core callbacks at the host-owned durability boundary. */ install(): void; notePersistedMessage(message: AgentMessage, entryId: string): void; /** Drop in-flight associations when the host swaps/reloads the active session branch. */ resetForSessionReload(): void; private findPersistedMessageEntryId; private requestReason; private onProviderRequestSnapshot; private appendMessage; private onToolCallStart; private toolKey; private callKey; /** Called after the canonical message entry has been appended by AgentSession. */ onMessagePersisted(message: AgentMessage, entryId: string): void; /** * Repair incomplete lifecycle records on construction/reload. The active branch is inspected first; * duplicate, mismatched, or out-of-order records are left untouched and reported rather than guessed. */ repair(): string[]; private appendRepairResult; } export {}; //# sourceMappingURL=foreground-lifecycle-controller.d.ts.map