import { type ParseResult, type VisualDiagnostic, type VisualHandoff, type VisualResponse, type VisualSessionDescriptor, type VisualStatus } from './protocol.js'; import { type VisualEventDelivery, type VisualResponseAcceptance } from './session-server.js'; /** * Document name reported by diagnostics the client itself raises — an * unreadable descriptor, an unreachable session server, or an answer that is * not the document the route promises. */ export declare const VISUAL_CLIENT_DOCUMENT = "visual-session-client"; export declare const VISUAL_CLIENT_LIMITS: { /** * Ceiling on one agent request. It has to outlast the server's long poll, * which answers "still idle" only once its own window closes, or every idle * wait would be reported as a transport failure. */ readonly requestTimeoutMs: number; /** How much of a refusal the diagnostic explaining it quotes back. */ readonly refusalBytes: 512; }; /** * `pointer` is an RFC 6901 pointer into the document being refused; a refusal * the client raised about the transport itself is rooted at `/`. */ export declare const visualClientDiagnostic: (code: string, message: string, pointer?: string) => VisualDiagnostic; export declare const visualFailureDiagnostics: (cause: unknown) => readonly VisualDiagnostic[]; /** * Whether an unreadable descriptor belongs to a session this client already * removed. Absence alone is not evidence: the stopped marker is written before * teardown and names the vanished session directory. */ export declare const visualSessionAlreadyStopped: (uri: string) => Promise; /** * The agent's entry point into one live session, read the way a hostile file * has to be read. The descriptor is the only file carrying the agent * capability, so a redirected or planted one must never be spent. */ export declare const readVisualSessionDescriptor: (uri: string) => Promise>; /** One JSON document the agent hands to a command, read from the filesystem. */ export declare const readVisualJsonDocument: (path: string, cwd?: string) => Promise>; /** * Long-polls for the next actionable event past `after`. The server holds the * request for its whole poll window before answering that the session is still * idle, which is why this is the client's longest-running call. */ export declare const waitForVisualEvent: (descriptor: VisualSessionDescriptor, after: number) => Promise>; /** * Delivers one agent response. A response the runtime already journaled is * accepted again as a duplicate, so a retried delivery is never a second turn. */ export declare const sendVisualResponse: (descriptor: VisualSessionDescriptor, response: VisualResponse) => Promise>>; /** * Asks the runtime for its status, falling back to the local one when nothing * is listening: a session whose server died still has a status, and it is * stopped. A server that answers and refuses does not fall back — that is a * capability fault, not a dead session. */ export declare const fetchVisualStatus: (descriptor: VisualSessionDescriptor) => Promise>; /** * Recovers the handoff from the journal. Recovery never asks the server: the * journal is the record, and it is written to outlive the runtime that kept it. */ export declare const recoverVisualSessionClient: (descriptor: VisualSessionDescriptor, includeTranscript?: boolean) => Promise>; /** * Converges one session on stopped, whatever is left of it. Recovery runs * first, so no later step can be the one that loses confirmed state; the stop * request only returns once the runtime has journaled its terminal event, * drained, and removed the session it owns; and the local removal converges * the case where nothing was listening. * * `undefined` means the session was already gone, which is what makes a * repeated stop idempotent. */ export declare const stopVisualSessionClient: (descriptor: VisualSessionDescriptor, includeTranscript?: boolean) => Promise>;