import type { AgentEvent as KoiEvent } from "@mariozechner/pi-agent-core"; import type { EmbeddedPiSubscribeContext } from "./pi-embedded-subscribe.handlers.types.js"; /** * The run's terminal lifecycle event: a successful turn ends `phase:"end"`; * a failed turn (last assistant `stopReason:"error"`) ends `phase:"error"` * carrying a stable `errorClass` and a user-facing message. * * This is the ONE place a run's success/failure is decided for delivery. A * bare `phase:"end"` on a failed turn made the web render an empty "done" and * suppressed the downstream error backstops — so failures must surface here. * * Pure + exported for unit testing (no side effects). */ export declare function resolveRunTerminal(state: { lastTurnStopReason?: string; lastTurnError?: string; }): { phase: "end" | "error"; error?: string; errorClass?: string; }; export declare function handleKoiStart(ctx: EmbeddedPiSubscribeContext): void; export declare function handleAutoCompactionStart(ctx: EmbeddedPiSubscribeContext): void; export declare function handleAutoCompactionEnd(ctx: EmbeddedPiSubscribeContext, evt: KoiEvent & { willRetry?: unknown; }): void; export declare function handleKoiEnd(ctx: EmbeddedPiSubscribeContext): void;