import type { InteractiveModeBase } from "./interactive-mode-base.ts"; /** * True when the prompt never reached an agent turn because the transport * rejected it, so the typed text is still user-owned. * * Admission is the only input, and it is decisive. Every rejection `RpcClient` * raises is built through `rpcTransportError`, and an accepted request is * re-marked per request, so the classification already knows whether the child * took ownership. * * Message text is deliberately not consulted. A provider, extension, or command * error is free to contain a phrase like `Agent process stopped` after the * engine admitted and ran the submission; restoring the draft there would hide * a real failure and invite a duplicate run. Node also documents `error.message` * as free to change in any release. */ export declare function isEngineSendFailure(error: unknown): boolean; /** Separator between a restored submission and text typed while it was pending. */ export declare const RESTORED_DRAFT_SEPARATOR = "\n\n"; /** * Merge a rejected submission back into the live editor buffer in temporal * order: the failed submission first, then whatever the user typed while the * send was still pending. * * Presence is measured on the raw string, never on `trim()`, so whitespace-only * typing is preserved too. Neither side is trimmed or normalized here. */ export declare function mergeRestoredDraft(draft: string, currentText: string): string; export interface PromptDraftRestoreTarget { /** True once the submission reached an agent turn (`agent_start` observed). */ turnStarted: boolean; refused?: boolean; /** Text to put back, exactly as the editor handed it to the submit callback. */ draft: string; getEditorText(): string; setEditorText(text: string): void; editorOwnsInput(): boolean; focusEditor(): void; requestRender(): void; } /** * Put a rejected submission back in the editor instead of discarding it. * * Only for a send that never landed: once the agent turn has started, the text * belongs to the transcript and a mid-turn failure must not resurrect it. * Returns true when the draft was restored. */ export declare function restoreUnsentPromptDraft(error: unknown, target: PromptDraftRestoreTarget): boolean; /** * Host-bound restore used by every submit path (the prompt loop and the direct * dispatch branches that bypass it). * * Returns true when the failure was a send the engine never accepted and the * draft is back in the editor; false means the caller owns the error. */ export declare function restoreFailedSubmissionDraft(mode: InteractiveModeBase, error: unknown, draft: string, options?: { turnStarted?: boolean; refused?: boolean; }): boolean; export declare function restoreRefusedSubmission(mode: InteractiveModeBase, error: unknown, draft: string): void; //# sourceMappingURL=interactive-prompt-restore.d.ts.map