import type { CustomMessage } from "@caupulican/pi-agent-core"; import type { LaneTerminalStatus } from "./autonomy/lane-tracker.ts"; import { type BackgroundToolTaskRecord } from "./background-tool-task-controller.ts"; import type { WorkerClaimSnapshotPayload } from "./delegation/session-worker-claim.ts"; import type { WorkerTerminalHandoffRecord } from "./delegation/worker-notification-coordinator.ts"; import type { ForegroundRecoveryController, ForegroundSubmissionLease } from "./foreground-recovery-controller.ts"; import { type GoalState } from "./goals/goal-state.ts"; import type { ArtifactContract, WorkerResultContract } from "./orchestration/contracts.ts"; export type BackgroundActivitySummaryKind = "agent" | "task"; export type BackgroundActivitySummaryStatus = "success" | "attention" | "failed" | "canceled"; export interface BackgroundActivitySummaryItem { id: string; status: BackgroundActivitySummaryStatus; } /** Provider-neutral counts retained when the detailed handoff is bounded. */ export interface BackgroundActivitySummaryContract { kind: BackgroundActivitySummaryKind; totalCount: number; attentionCount: number; failedCount: number; canceledCount: number; } export declare function createBackgroundActivitySummaryContract(kind: BackgroundActivitySummaryKind, items: readonly BackgroundActivitySummaryItem[]): BackgroundActivitySummaryContract; export declare function isBackgroundActivitySummaryContract(value: unknown): value is BackgroundActivitySummaryContract; interface ForegroundTerminalHandoffControllerDeps { foreground: ForegroundRecoveryController; isDisposed(): boolean; getGoalStateSnapshot(): Pick | undefined; getWorkerClaimSnapshot?(laneId: string): WorkerClaimSnapshotPayload | undefined; getWorkerResult?(laneId: string): Pick | undefined; startCustomMessageTurn(message: Pick, "customType" | "content" | "display" | "details">, lease: ForegroundSubmissionLease, goalId?: string): Promise<{ completion: Promise; }>; enqueueCustomMessageTurn(message: Pick, "customType" | "content" | "display" | "details">): Promise; sendCustomMessage(message: Pick, "customType" | "content" | "display" | "details">, options: { triggerTurn: false; deliverAs: "followUp"; }, lease: ForegroundSubmissionLease): Promise; warn(message: string): void; } export declare function buildForegroundWorkerTerminalHandoffContent(records: readonly { laneId: string; status: LaneTerminalStatus; reasonCode?: string; outputArtifact?: ArtifactContract; claim?: { summary?: string; status?: string; changedFiles?: readonly string[]; blockers?: readonly string[]; parentReviewRequired?: boolean; }; }[], options?: { wakeParent?: boolean; totalCount?: number; }): string; /** Serializes durable background terminal delivery through the foreground submission owner. */ export declare class ForegroundTerminalHandoffController { private readonly deps; private readonly pending; private readonly terminalDeliveries; private readonly deliveredTerminalIdentities; constructor(deps: ForegroundTerminalHandoffControllerDeps); notifyWorkers(records: readonly WorkerTerminalHandoffRecord[]): Promise; notifyTools(records: readonly BackgroundToolTaskRecord[], wakeParent: boolean): Promise; /** Deliver queued terminals immediately before the agent loop polls its steering inbox. */ flushProviderBoundary(): void; private schedule; private scheduleUnique; private rememberDeliveredTerminal; private deliverWhenIdle; private deliverWithLease; private prepareWorkerDelivery; private prepareToolDelivery; private resolveWake; private releaseAfterTurn; private assertLive; } export {}; //# sourceMappingURL=foreground-terminal-handoff-controller.d.ts.map