/** * Completion notification delivery. * * Async result files call this notifier directly and are deleted only after * `sendMessage()` accepts the notification. The event bus remains an * observation channel, not a delivery acknowledgement. */ import type { ExtensionAPI } from "@lpb-work/pi-coding-agent"; import { type ParallelHandoffReference, type SubagentState } from "../../shared/types.ts"; import { type CompletionBatchConfig } from "./completion-batcher.ts"; export interface SubagentNotifyDetails { agent: string; status: "completed" | "failed" | "paused" | "stopped"; source?: "async" | "foreground"; taskInfo?: string; resultPreview: string; durationMs?: number; sessionLabel?: string; sessionValue?: string; handoffPath?: string; } export interface CompletionNotification { [key: string]: unknown; id?: string | null; source?: "async" | "foreground"; agent?: string | null; success?: boolean; summary?: string; exitCode?: number; state?: string; processSignal?: string | null; interrupted?: boolean; timedOut?: boolean; stopped?: boolean; turnBudgetExceeded?: boolean; results?: Array<{ status?: string; success?: boolean; exitCode?: number | null; processSignal?: string | null; interrupted?: boolean; timedOut?: boolean; stopped?: boolean; turnBudgetExceeded?: boolean; }>; timestamp?: number; durationMs?: number; cwd?: string; sessionFile?: string; shareUrl?: string; gistUrl?: string; shareError?: string; taskIndex?: number; totalTasks?: number; sessionId?: string | null; triggerTurn?: boolean; /** True when an acknowledged grouped intercom relay already delivered this run. */ intercomDelivered?: boolean; parallelHandoff?: ParallelHandoffReference; } interface NotifyTimerApi { setTimeout(handler: () => void, delayMs: number): unknown; clearTimeout(handle: unknown): void; } export interface RegisterSubagentNotifyOptions { batchConfig?: CompletionBatchConfig; timers?: NotifyTimerApi; now?: () => number; } export interface CompletionNotifier { deliver(result: CompletionNotification): Promise; dispose(): void; } export declare function formatSingleCompletion(details: SubagentNotifyDetails): string; export declare function parseSubagentNotifyContent(content: string): SubagentNotifyDetails | undefined; export declare function formatGroupedCompletion(details: SubagentNotifyDetails[]): string; export declare function buildCompletionDetails(result: CompletionNotification): SubagentNotifyDetails; export default function registerSubagentNotify(pi: ExtensionAPI, state: Pick, options?: RegisterSubagentNotifyOptions): CompletionNotifier; export {}; //# sourceMappingURL=notify.d.ts.map