import type { ISessionClient } from "../platform/ports/session-client.ts"; import type { DispatchManager } from "../dispatch/core/manager.ts"; /** * Narrow contract the loop coordinator uses to drive rounds through * DispatchManager. The coordinator must NOT know dispatch internals. */ export interface IDispatchAdapter { /** Submit a round to a worker agent via DispatchManager. */ dispatchRound(input: { originSessionId: string; agent: string; prompt: string; description?: string; /** Per-round hard timeout (ms), forwarded to the dispatch watchdog as `timeout_ms`. */ timeoutMs?: number; }): Promise<{ workerTaskId: string; workerSessionId: string; }>; /** Retrieve the result of a completed worker round. */ getRoundResult(workerTaskId: string): Promise<{ text: string; hadError: boolean; errorReason?: string; }>; /** Cancel a running worker round. */ cancelRound(workerTaskId: string): Promise; /** * Read the latest assistant output from the origin session, up to * SUMMARY_INPUT_CHAR_CAP characters. If `sinceMessageId` is provided, * only messages after that ID are considered. */ readOriginSummary(originSessionId: string, sinceMessageId?: string): Promise; /** Return the ID of the most recent message in a session, or undefined if empty. */ getLastMessageId(originSessionId: string): Promise; /** Inject a silent progress note into the origin session (noReply:true). */ injectNote(sessionId: string, text: string): Promise; /** * Register a one-time listener for when a dispatched worker task enters a * terminal state. The callback is invoked at most once with the task ID and * its final status string. Returns the same callback for convenience. */ registerTerminatedListener(taskId: string, callback: (taskId: string, status: string) => void): (taskId: string, status: string) => void; /** Remove a previously registered task-terminated listener. */ removeTerminatedListener(taskId: string, callback: (taskId: string, status: string) => void): void; /** * Read-only query: returns the current lifecycle status of a dispatched task. * Returns the status string or undefined if the task ID is unknown. */ getTaskStatus(taskId: string): Promise; } export declare class DispatchAdapter implements IDispatchAdapter { private readonly dispatchManager; private readonly client; private readonly directory?; constructor(dispatchManager: DispatchManager, client: ISessionClient, directory?: string | undefined); /** Tracks the last message ID processed by readOriginSummary for incremental reads. */ lastProcessedMessageId?: string; dispatchRound(input: { originSessionId: string; agent: string; prompt: string; description?: string; timeoutMs?: number; }): Promise<{ workerTaskId: string; workerSessionId: string; }>; getRoundResult(workerTaskId: string): Promise<{ text: string; hadError: boolean; errorReason?: string; }>; cancelRound(workerTaskId: string): Promise; readOriginSummary(originSessionId: string, sinceMessageId?: string): Promise; getLastMessageId(originSessionId: string): Promise; injectNote(sessionId: string, text: string): Promise; registerTerminatedListener(taskId: string, callback: (taskId: string, status: string) => void): (taskId: string, status: string) => void; removeTerminatedListener(taskId: string, callback: (taskId: string, status: string) => void): void; getTaskStatus(taskId: string): Promise; } //# sourceMappingURL=dispatch-adapter.d.ts.map