/** * Reliability Session Controller — production wiring between a live AgentSession * and the Reliability Kernel. * * The controller owns the MissionRuntime, ReliabilitySessionBridge, and the * deterministic verification executor. AgentSession delegates its * beforeToolCall / afterToolCall / onTurnEnd hooks here so that: * * - every real tool call is validated against mission policy (boundary, * forbidden, permission) before execution — schema validation remains the * agent loop's responsibility and is not duplicated here; * - every real tool outcome is recorded as authoritative evidence; * - a model that "thinks it is done" is routed through the Completion Gate; * - mission state persists with the session and restores on resume. * * Tool governance (policy + evidence) is active for every session. The * completion gate only applies while a mission is active; plain chat sessions * without a mission stop normally. */ import type { AgentMessage, AgentTool, AgentToolCall } from "@apholdings/jensen-agent-core"; import type { SessionManager } from "../session-manager.js"; import type { MissionDefinitionInput } from "./mission-contract-factory.js"; import { MissionRuntime } from "./mission-runtime.js"; import { type VerificationExecutor } from "./verifier.js"; export interface ReliabilitySessionControllerOptions { /** Session working directory (the workspace boundary root). */ cwd: string; /** Session manager used to persist/restore the mission document. */ sessionManager: SessionManager; /** Deterministic verification executor bound to the workspace. */ verificationExecutor: VerificationExecutor; /** Returns the currently active tools (used for mission schema validation). */ getTools: () => readonly AgentTool[]; /** Tool names always forbidden for reliability-governed tool calls. */ forbiddenTools?: readonly string[]; /** Maximum consecutive finalization rejections before the run ends (bounded loop guard). */ maxFinalizationRejections?: number; } export interface ReliabilityBeforeResult { block: boolean; reason?: string; } export interface ReliabilityTurnEndResult { continue: boolean; message?: AgentMessage; } export declare class ReliabilitySessionController { private readonly _cwd; private readonly _sessionManager; private readonly _verificationExecutor; private readonly _getTools; private readonly _policy; private readonly _maxFinalizationRejections; private _runtime?; private _bridge?; private _corruptPersistedState; private _rejectionsThisRun; constructor(options: ReliabilitySessionControllerOptions); get isActive(): boolean; get missionId(): string | undefined; get phase(): MissionRuntime["phase"] | undefined; get runtime(): MissionRuntime | undefined; get corruptPersistedState(): boolean; criterionView(): ReturnType; summarizeForModel(): string | undefined; /** Create and attach a new governed mission from an explicit definition. */ startMission(definition: MissionDefinitionInput): void; /** Reset the per-run rejection counter (call when a new run begins). */ resetRun(): void; private _restore; private _attach; private _buildPolicy; /** Validate a real tool call against mission policy before execution. */ beforeToolCall(toolCall: AgentToolCall): ReliabilityBeforeResult; /** Record a real tool outcome as authoritative evidence. */ afterToolCall(toolCall: AgentToolCall, isError: boolean, summary?: string): void; private _toToolCallAction; private _reject; /** * Called when the model finished its turn without further tool calls. * * Runs automatic deterministic verification for outstanding criteria, then * routes the model's implicit "I am done" through the Completion Gate. */ onTurnEnd(): Promise; /** Apply an execution transition, ignoring transitions the state machine already passed. */ private _advanceTo; private _runAutomaticFinalVerification; private _persist; } //# sourceMappingURL=session-controller.d.ts.map