import { AsyncSerialQueue } from '../utils/async-serial-queue.js'; export interface AdoptQueuedWriteSequence { queue: AsyncSerialQueue; /** Rechecked at the actual dequeue/execution point, not at IPC receipt. */ isCurrent: () => boolean; write: () => Promise; /** Requeue the exact untouched input when its captured backend generation * became stale before the task ever started writing. */ onStale: () => void | Promise; } export type AdoptQueuedWriteResult = { status: 'ran'; value: T; } | { status: 'stale-before-write'; }; /** Fence a process-lifetime serial queue task to the backend generation that * accepted it. AsyncSerialQueue intentionally survives CLI restarts; without * this dequeue-time check an old task can mark with backend=null or write into * a replacement CLI before its prompt is ready. */ export declare function runAdoptQueuedWriteSequence(input: AdoptQueuedWriteSequence): Promise>; export interface AdoptRawInputSequence { queue: AsyncSerialQueue; /** Resolves true only after the literal command's submit key has landed. */ writeRawInput: () => Promise; /** Resolves only after the bundled follow-up's complete adapter lifecycle. */ writeFollowUp?: () => Promise; /** Same generation/backend fence used by ordinary adopt writes. */ isCurrent?: () => boolean; onStaleBeforeWrite?: () => void | Promise; onStaleBeforeFollowUp?: () => void | Promise; } /** * Keep an adopt slash command and its bundled follow-up in one serial-queue * transaction. The follow-up callback must cover the complete adapter write, * history verification and lifecycle settlement; awaiting it here prevents a * later process-message listener from sharing or overwriting the TUI composer. */ export declare function runAdoptRawInputSequence(input: AdoptRawInputSequence): Promise; export interface AdoptSessionRenameSequence { queue: AsyncSerialQueue; /** Rechecked after every earlier adopt composer write has settled. */ isPromptReady: () => boolean; /** Resolves only after the rename command's literal text and Enter land. */ writeRename: () => Promise; } /** Serialize native rename with every adopt composer write. A readiness check * made before waiting on the queue can become stale when an earlier adopt * message starts first, so recheck inside the queue and let the worker retry * the rename at the next genuine prompt instead of steering it into a turn. */ export declare function runAdoptSessionRenameSequence(input: AdoptSessionRenameSequence): Promise; //# sourceMappingURL=adopt-input-sequence.d.ts.map