import { AgentFace, AgentInfo, AgentResponse, AttachedFrame, CompleteAccountRequest, CompleteAccountResponse, ConnectAccountResponse, ConversationHistoryResponse, ConversationsResponse, CreateAgentRequest, CreateJobRequest, CreateProfileRequest, CreateSessionRequest, DiscardAndCutRequest, EraseConversationResponse, FindHostFilesResponse, GatewayMeta, GatewayRelayMeta, GetProfileResponse, GoalResponse, HostEntryResponse, HostSearchEvent, HostSearchRequest, JobEvent, JobInfo, ListHostDirResponse, ListHostRootsResponse, ListProfilesResponse, McpServerActionRequest, McpServerStatusInfo, MessageAttachment, NewConversationRequest, NewConversationResponse, PeerSessionSummary, PermissionMode, ProfileInfo, QueueStats, ReadHostFileResponse, RenameOwnerRequest, RenameOwnerResponse, ResolvePermissionRequest, RetireAgentRequest, RetiredAgentInfo, SdkSessionSummary, SessionAgentRequest, SessionEvent, SessionFileInfo, SessionInfo, SessionSettingsPatch, SetGoalRequest, ShellInfo, SubmitExecutionResultRequest, SubmitExecutionResultResponse, ToolCallRequestFrame, ToolExecutionOutput, ToolResultBlock, UnconfirmedInputRefusal, UpdateAgentRequest, UpdateProfileRequest, UpdateSessionRequest, UpdateSessionResponse, WriteHostFileRequest, WriteHostFileResponse } from "@workerdeck/protocol"; type Listener = (payload: T) => void; type AttachOptions = { afterSeq?: number; reconnect?: boolean; truncateResults?: boolean; imageRefs?: boolean; conversation?: number; }; type SessionHandleEvents = { attached: AttachedFrame; event: SessionEvent; protocolError: string; connectionChange: boolean; reconnectAttempt: number; toolCallRequest: ToolCallRequestFrame; toolCallCanceled: { executionId: string; reason: string; }; shellAttached: { shellId: string; shell: ShellInfo; cols: number; rows: number; scrollback: string; }; shellOutput: { shellId: string; data: string; }; shellDetached: { shellId: string; reason: string; }; undeliveredPrompt: { clientId: string; text: string; attachmentIds?: string[]; uncertain?: true; }; }; export declare class SessionHandle { #private; readonly sessionId: string; constructor(client: WorkerDeckClient, sessionId: string, options?: AttachOptions); get lastSeq(): number; get everConnected(): boolean; on(kind: K, listener: Listener): () => void; send(text: string, attachmentIds?: string[]): void; approve(requestId: string, updatedInput?: Record): void; deny(requestId: string, message?: string, interrupt?: boolean): void; interrupt(): void; sleep(): void; backgroundTask(toolUseId?: string): void; runShell(command: string): void; attachShell(shellId: string, size: { cols: number; rows: number; }): void; writeShell(shellId: string, data: string): void; resizeShell(shellId: string, size: { cols: number; rows: number; }): void; detachShell(shellId: string): void; clearContext(): void; setPermissionMode(mode: PermissionMode): void; setModel(model?: string): void; setEffort(effort?: string): void; setGoal(goal: SetGoalRequest): void; clearGoal(): void; pauseGoal(paused: boolean): void; sendToolCallResult(executionId: string, output: ToolExecutionOutput, logs?: string[]): void; sendToolCallError(executionId: string, reason: string, error: string, logs?: string[]): void; closeSession(): void; reconnectNow(): void; detach(): void; get conversation(): number | undefined; } type QueueHandleEvents = { attached: QueueStats; event: JobEvent; stats: QueueStats; connectionChange: boolean; }; export declare class QueueHandle { #private; constructor(client: WorkerDeckClient, options?: { reconnect?: boolean; }); on(kind: K, listener: Listener): () => void; detach(): void; } type HostUrl = { baseUrl: string; }; export declare function apiUrl(host: HostUrl): string | undefined; export declare function isLoopbackHost(host: HostUrl): boolean; export declare function hostAuth(options: { baseUrl: string; key: string; }): Pick; type TeamMovePlan = { mover: { hostId: string; sessionId: string; agentId?: string; owner?: string; }; lead: { hostId: string; agentId: string; } | null; order?: number; siblings?: Array<{ hostId: string; agentId: string; order: number; }>; crossOwner?: true; }; type TeamInvitation = { hostId: string; leadAgentId: string; member: string; invite?: string; state: 'withdrawn' | 'open' | 'unknown'; }; type TeamMoveOutcome = { committed: 'yes' | 'no' | 'unknown'; error?: string; adopted?: { hostId: string; agentId: string; }; invitation?: TeamInvitation; unordered?: Array<{ hostId: string; agentId: string; }>; }; export declare function runTeamMove(plan: TeamMovePlan, clientOf: (hostId: string) => WorkerDeckClient | undefined, relayOf?: (hostId: string) => GatewayRelayMeta | undefined): Promise; export declare function withdrawTeamInvitation(invitation: TeamInvitation, clientOf: (hostId: string) => WorkerDeckClient | undefined): Promise; export declare function teamMoveMessage(outcome: TeamMoveOutcome): string | undefined; type ToolResultResponse = { seq: number; toolUseId: string; content: ToolResultBlock['content']; isError: boolean; }; export type FetchBody = NonNullable[1]>['body']>; export type ClientOptions = { baseUrl: string; headers?: Record; buildWsUrl?: (sessionId: string, afterSeq: number, truncateResults?: boolean, imageRefs?: boolean, conversation?: number) => string; buildQueueWsUrl?: () => string; WebSocketImpl?: typeof WebSocket; fetchImpl?: typeof fetch; }; export declare class WorkerDeckError extends Error { readonly status: number; readonly code: string | undefined; readonly body: Record | undefined; constructor(message: string, status: number, body?: Record); } export declare function unconfirmedInputOf(error: unknown): UnconfirmedInputRefusal | undefined; export declare class WorkerDeckClient { #private; constructor(options: ClientOptions); get identityKey(): string; createSession(request: CreateSessionRequest): Promise; listSessions(): Promise; getSession(id: string): Promise; updateSession(id: string, patch: UpdateSessionRequest): Promise; nameSession(id: string, agent: SessionAgentRequest): Promise; unnameSession(id: string): Promise; updateSessionSettings(id: string, config: SessionSettingsPatch): Promise; conversations(id: string): Promise; conversationHistory(id: string, conversation: number): Promise; eraseConversation(id: string, conversation: number): Promise; newConversation(id: string, request: NewConversationRequest): Promise; discardAndCut(id: string, request: DiscardAndCutRequest): Promise; retryConversationStart(id: string, expectedGeneration: number, failureAt?: number): Promise; settlePendingPrompt(id: string, send: boolean, expectedGeneration: number): Promise; sleepSession(id: string): Promise; setGoal(id: string, goal: SetGoalRequest, conversation?: number): Promise; clearGoal(id: string, conversation?: number): Promise; pauseGoal(id: string, paused: boolean, conversation?: number): Promise; deleteSession(id: string): Promise; listSessionFiles(sessionId: string): Promise; fetchSessionFile(sessionId: string, path: string): Promise; uploadAttachment(sessionId: string, file: { name: string; mediaType: string; data: FetchBody; }): Promise; attachmentUrl(sessionId: string, attachmentId: string): string; producedFileUrl(sessionId: string, fileId: string): string; readProducedFile(sessionId: string, fileId: string): Promise; projectIconUrl(sessionId: string): string; projectIcon(sessionId: string): Promise; listAgents(): Promise; retiredAgents(): Promise; createAgent(request: CreateAgentRequest): Promise; getAgent(id: string): Promise; updateAgent(id: string, patch: UpdateAgentRequest): Promise; inviteRemoteMember(id: string, agent: string, owner?: string): Promise; withdrawInvitation(id: string, agent: string, invite: string): Promise; removeRemoteMember(id: string, agent: string): Promise; retireAgent(id: string, request: RetireAgentRequest): Promise<{ retired: string[]; released: string[]; }>; changeAgentAvatar(id: string, change?: { seed?: string; face?: AgentFace; }): Promise; listPeers(sessionId: string): Promise; listMcpServers(sessionId: string): Promise; mcpServerAction(sessionId: string, serverName: string, action: McpServerActionRequest['action']): Promise; sessionFileUrl(sessionId: string, path: string): string; resolvePermission(sessionId: string, requestId: string, decision: ResolvePermissionRequest): Promise; submitExecutionResult(executionId: string, result: SubmitExecutionResultRequest): Promise; listProfiles(): Promise; getProfile(name: string): Promise; createProfile(profile: CreateProfileRequest): Promise; updateProfile(name: string, patch: UpdateProfileRequest): Promise; deleteProfile(name: string): Promise; connectAccount(profile: string): Promise; completeAccount(profile: string, request: CompleteAccountRequest): Promise; awaitAccount(profile: string, attemptId: string): Promise; disconnectAccount(profile: string): Promise; renameOwner(request: RenameOwnerRequest): Promise; listSdkSessions(params?: { dir?: string; limit?: number; offset?: number; profile?: string; }): Promise; listHostRoots(): Promise; meta(): Promise; listHostDir(path: string): Promise; findHostFiles(path: string, q?: string, limit?: number): Promise; searchHostFiles(request: HostSearchRequest, options?: { signal?: AbortSignal; }): AsyncGenerator; readHostFile(path: string): Promise; writeHostFile(request: WriteHostFileRequest): Promise; makeHostDir(path: string): Promise; deleteHostEntry(path: string, recursive?: boolean): Promise; renameHostEntry(from: string, to: string): Promise; createJob(request: CreateJobRequest): Promise; listJobs(): Promise; getJob(id: string): Promise; cancelJob(id: string): Promise; queueStats(): Promise; listShells(sessionId: string): Promise; getShell(sessionId: string, shellId: string): Promise; shellOutput(sessionId: string, shellId: string, options?: { view?: 'text' | 'raw' | 'screen'; tail?: number; }): Promise; killShell(sessionId: string, shellId: string): Promise; stopTask(sessionId: string, toolUseId: string): Promise; backgroundTask(sessionId: string, toolUseId?: string): Promise; setShellAgentWrite(sessionId: string, shellId: string, enabled: boolean): Promise; conversationOf(sessionId: string): number | undefined; noteConversation(sessionId: string, conversation: number): void; attach(sessionId: string, options?: AttachOptions): SessionHandle; attachQueue(options?: { reconnect?: boolean; }): QueueHandle; openSocket(sessionId: string, afterSeq: number, truncateResults?: boolean, imageRefs?: boolean, conversation?: number): WebSocket; toolResult(sessionId: string, seq: number, toolUseId: string, options?: { imageRefs?: boolean; }): Promise; toolResultImage(sessionId: string, seq: number, toolUseId: string, partIndex: number): Promise; openQueueSocket(): WebSocket; } export type { AttachOptions, HostUrl, QueueHandleEvents, SessionHandleEvents, TeamInvitation, TeamMoveOutcome, TeamMovePlan };