@hyperdrive.bot/paseo-client 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1153 @@
1
+ import type { z } from "zod";
2
+ import { type ClientCapability } from "@hyperdrive.bot/paseo-protocol/client-capabilities";
3
+ import { AgentRefreshedStatusPayloadSchema, CheckoutRenameBranchResponseSchema, RenameTerminalResponseSchema, RestartRequestedStatusPayloadSchema, ShutdownRequestedStatusPayloadSchema, DaemonUpdateResponseSchema, type ServerInfoStatusPayload } from "@hyperdrive.bot/paseo-protocol/messages";
4
+ import type { AgentStreamEventPayload, InstalledExtension, AgentSnapshotPayload, ProjectPlacementPayload, AgentPermissionResolvedMessage, CreateAgentRequestMessage, CreatePaseoWorktreeRequest, FileDownloadTokenResponse, FileExplorerResponse, FetchAgentTimelineResponseMessage, AgentForkContextResponseMessage, GitSetupOptions, CheckoutStatusResponse, CheckoutCommitResponse, CheckoutMergeResponse, CheckoutMergeFromBaseResponse, CheckoutPullResponse, CheckoutPushResponse, CheckoutRefreshResponse, CheckoutPrCreateResponse, CheckoutPrMergeResponse, CheckoutPrMergeMethod, CheckoutGithubSetAutoMergeResponse, CheckoutGithubGetCheckDetailsResponse, CheckoutPrStatusResponse, PullRequestTimelineResponse, CheckoutSwitchBranchResponse, StashSaveResponse, StashPopResponse, StashListResponse, ValidateBranchResponse, BranchSuggestionsResponse, GitHubSearchResponse, GitHubSearchRequest, DirectorySuggestionsResponse, PaseoWorktreeListResponse, PaseoWorktreeArchiveResponse, ProjectIconResponse, ProjectAddResponse, OpenProjectResponseMessage, ArchiveWorkspaceResponseMessage, WorkspaceSetupStatusResponseMessage, ListCommandsResponse, ListProviderFeaturesResponseMessage, ListProviderModelsResponseMessage, ListProviderModesResponseMessage, ListAvailableProvidersResponse, GetProvidersSnapshotResponseMessage, RefreshProvidersSnapshotResponseMessage, ProviderDiagnosticResponseMessage, ProviderUsageListResponseMessage, DaemonGetStatusResponse, DaemonGetPairingOfferResponse, DiagnosticsResponse, AgentRewindResponseMessage, ListTerminalsResponse, CreateTerminalResponse, SubscribeTerminalResponse, SubscribeTerminalRequest, CloseItemsResponse, KillTerminalResponse, CaptureTerminalResponse, TerminalInput, SessionInboundMessage, SessionOutboundMessage, SendAgentMessageRequest, PaseoConfigRaw, PaseoConfigRevision, ProjectRenameResponse, WatchNotificationActionMessage, WatchSessionSearchMessage, WatchComposerDictateMessage, WorkflowSnapshot, WorkflowStatus, WorkflowTaskGraph, WorkspaceCreateRequest } from "@hyperdrive.bot/paseo-protocol/messages";
5
+ import type { AgentPermissionRequest, AgentPermissionResponse, AgentPersistenceHandle, AgentProviderNotice, AgentProvider, AgentSessionConfig } from "@hyperdrive.bot/paseo-protocol/agent-types";
6
+ import type { MutableDaemonConfig, MutableDaemonConfigPatch } from "@hyperdrive.bot/paseo-protocol/messages";
7
+ import type { FileUploadErrorCode } from "@hyperdrive.bot/paseo-protocol/messages";
8
+ import { type DaemonTransportFactory, type WebSocketFactory } from "./daemon-client-transport.js";
9
+ import { type TerminalStreamEvent } from "./terminal-stream-router.js";
10
+ import type { BrowserAutomationExecuteRequest, BrowserAutomationExecuteResponse } from "@hyperdrive.bot/paseo-protocol/browser-automation/rpc-schemas";
11
+ export interface Logger {
12
+ debug(obj: object, msg?: string): void;
13
+ info(obj: object, msg?: string): void;
14
+ warn(obj: object, msg?: string): void;
15
+ error(obj: object, msg?: string): void;
16
+ }
17
+ interface ImportAgentInputBase {
18
+ cwd?: string;
19
+ labels?: Record<string, string>;
20
+ }
21
+ export type ImportAgentInput = (ImportAgentInputBase & {
22
+ providerId: string;
23
+ providerHandleId: string;
24
+ }) | (ImportAgentInputBase & {
25
+ provider: AgentProvider;
26
+ sessionId: string;
27
+ });
28
+ export type { DaemonTransport, DaemonTransportFactory, WebSocketFactory, WebSocketLike, } from "./daemon-client-transport.js";
29
+ export type { TerminalStreamEvent };
30
+ export type ConnectionState = {
31
+ status: "idle";
32
+ } | {
33
+ status: "connecting";
34
+ attempt: number;
35
+ } | {
36
+ status: "connected";
37
+ } | {
38
+ status: "disconnected";
39
+ reason?: string;
40
+ } | {
41
+ status: "disposed";
42
+ };
43
+ export type DaemonEvent = {
44
+ type: "agent_update";
45
+ agentId: string;
46
+ payload: Extract<SessionOutboundMessage, {
47
+ type: "agent_update";
48
+ }>["payload"];
49
+ } | {
50
+ type: "workspace_update";
51
+ workspaceId: string;
52
+ payload: Extract<SessionOutboundMessage, {
53
+ type: "workspace_update";
54
+ }>["payload"];
55
+ } | {
56
+ type: "workspace_setup_progress";
57
+ workspaceId: string;
58
+ payload: Extract<SessionOutboundMessage, {
59
+ type: "workspace_setup_progress";
60
+ }>["payload"];
61
+ } | {
62
+ type: "agent_stream";
63
+ agentId: string;
64
+ event: AgentStreamEventPayload;
65
+ timestamp: string;
66
+ seq?: number;
67
+ epoch?: string;
68
+ } | {
69
+ type: "status";
70
+ payload: {
71
+ status: string;
72
+ } & Record<string, unknown>;
73
+ } | {
74
+ type: "agent_deleted";
75
+ agentId: string;
76
+ } | {
77
+ type: "agent_permission_request";
78
+ agentId: string;
79
+ request: AgentPermissionRequest;
80
+ } | {
81
+ type: "agent_permission_resolved";
82
+ agentId: string;
83
+ requestId: string;
84
+ resolution: AgentPermissionResponse;
85
+ } | {
86
+ type: "providers_snapshot_update";
87
+ payload: Extract<SessionOutboundMessage, {
88
+ type: "providers_snapshot_update";
89
+ }>["payload"];
90
+ } | {
91
+ type: "error";
92
+ message: string;
93
+ };
94
+ export type DaemonEventHandler = (event: DaemonEvent) => void;
95
+ export type BrowserAutomationExecuteRequestMessage = BrowserAutomationExecuteRequest;
96
+ export type BrowserAutomationExecuteResponseMessage = BrowserAutomationExecuteResponse;
97
+ export interface DaemonClientConfig {
98
+ url: string;
99
+ clientId: string;
100
+ clientType?: "mobile" | "browser" | "cli" | "mcp";
101
+ appVersion?: string;
102
+ runtimeGeneration?: number | null;
103
+ password?: string;
104
+ authHeader?: string;
105
+ suppressSendErrors?: boolean;
106
+ transportFactory?: DaemonTransportFactory;
107
+ webSocketFactory?: WebSocketFactory;
108
+ logger?: Logger;
109
+ connectTimeoutMs?: number;
110
+ e2ee?: {
111
+ enabled?: boolean;
112
+ daemonPublicKeyB64?: string;
113
+ };
114
+ reconnect?: {
115
+ enabled?: boolean;
116
+ baseDelayMs?: number;
117
+ maxDelayMs?: number;
118
+ };
119
+ runtimeMetricsIntervalMs?: number;
120
+ runtimeMetricsWindowMs?: number;
121
+ /**
122
+ * Override for how long a queued message waits for the WebSocket connection
123
+ * before its send is rejected with "Timed out waiting for connection".
124
+ * Defaults to {@link DEFAULT_SEND_QUEUE_TIMEOUT_MS} (10s). The mobile/host
125
+ * runtime ships a 2s override (Story B.2 / FR2.2) so the UI can render a
126
+ * "Reconnecting to daemon…" Suspense fallback quickly when the daemon is
127
+ * unreachable, instead of blocking the JS thread for ~10s per failing RPC.
128
+ */
129
+ defaultSendQueueTimeoutMs?: number;
130
+ capabilities?: Partial<Record<ClientCapability, unknown>>;
131
+ }
132
+ export interface SendMessageOptions {
133
+ messageId?: string;
134
+ images?: Array<{
135
+ data: string;
136
+ mimeType: string;
137
+ }>;
138
+ attachments?: SendAgentMessageRequest["attachments"];
139
+ }
140
+ type AgentConfigOverrides = Partial<Omit<AgentSessionConfig, "provider" | "cwd">>;
141
+ export interface CreateAgentRequestOptions extends AgentConfigOverrides {
142
+ config?: AgentSessionConfig;
143
+ provider?: AgentProvider;
144
+ cwd?: string;
145
+ env?: CreateAgentRequestMessage["env"];
146
+ workspaceId?: string;
147
+ initialPrompt?: string;
148
+ clientMessageId?: string;
149
+ outputSchema?: Record<string, unknown>;
150
+ images?: CreateAgentRequestMessage["images"];
151
+ attachments?: CreateAgentRequestMessage["attachments"];
152
+ git?: GitSetupOptions;
153
+ worktree?: CreateAgentRequestMessage["worktree"];
154
+ autoArchive?: CreateAgentRequestMessage["autoArchive"];
155
+ worktreeName?: string;
156
+ requestId?: string;
157
+ labels?: Record<string, string>;
158
+ resumeSessionId?: string;
159
+ }
160
+ export interface CreatePaseoWorktreeInput extends Pick<CreatePaseoWorktreeRequest, "cwd" | "projectId" | "worktreeSlug" | "firstAgentContext" | "refName" | "action" | "githubPrNumber"> {
161
+ }
162
+ type CheckoutStatusPayload = CheckoutStatusResponse["payload"];
163
+ type SubscribeCheckoutDiffPayload = Extract<SessionOutboundMessage, {
164
+ type: "subscribe_checkout_diff_response";
165
+ }>["payload"];
166
+ type CheckoutDiffPayload = Omit<SubscribeCheckoutDiffPayload, "subscriptionId">;
167
+ type CheckoutCommitPayload = CheckoutCommitResponse["payload"];
168
+ type CheckoutMergePayload = CheckoutMergeResponse["payload"];
169
+ type CheckoutMergeFromBasePayload = CheckoutMergeFromBaseResponse["payload"];
170
+ type CheckoutPullPayload = CheckoutPullResponse["payload"];
171
+ type CheckoutPushPayload = CheckoutPushResponse["payload"];
172
+ type CheckoutRefreshPayload = CheckoutRefreshResponse["payload"];
173
+ type CheckoutPrCreatePayload = CheckoutPrCreateResponse["payload"];
174
+ type CheckoutPrMergePayload = CheckoutPrMergeResponse["payload"];
175
+ type CheckoutGithubSetAutoMergePayload = CheckoutGithubSetAutoMergeResponse["payload"];
176
+ type CheckoutGithubGetCheckDetailsPayload = CheckoutGithubGetCheckDetailsResponse["payload"];
177
+ type CheckoutPrStatusPayload = CheckoutPrStatusResponse["payload"];
178
+ type PullRequestTimelinePayload = PullRequestTimelineResponse["payload"];
179
+ type CheckoutSwitchBranchPayload = CheckoutSwitchBranchResponse["payload"];
180
+ export type RenameBranchResult = z.infer<typeof CheckoutRenameBranchResponseSchema>["payload"];
181
+ type StashSavePayload = StashSaveResponse["payload"];
182
+ type StashPopPayload = StashPopResponse["payload"];
183
+ type StashListPayload = StashListResponse["payload"];
184
+ type ValidateBranchPayload = ValidateBranchResponse["payload"];
185
+ type BranchSuggestionsPayload = BranchSuggestionsResponse["payload"];
186
+ type GitHubSearchPayload = GitHubSearchResponse["payload"];
187
+ type DirectorySuggestionsPayload = DirectorySuggestionsResponse["payload"];
188
+ type PaseoWorktreeListPayload = PaseoWorktreeListResponse["payload"];
189
+ type PaseoWorktreeArchivePayload = PaseoWorktreeArchiveResponse["payload"];
190
+ type CreatePaseoWorktreePayload = Extract<SessionOutboundMessage, {
191
+ type: "create_paseo_worktree_response";
192
+ }>["payload"];
193
+ type WorkspaceCreatePayload = Extract<SessionOutboundMessage, {
194
+ type: "workspace.create.response";
195
+ }>["payload"];
196
+ type FileExplorerPayload = FileExplorerResponse["payload"];
197
+ export type FileExplorerDirectoryPayload = NonNullable<FileExplorerPayload["directory"]>;
198
+ type LegacyFileExplorerFilePayload = NonNullable<FileExplorerPayload["file"]>;
199
+ export interface FileReadResult {
200
+ bytes: Uint8Array;
201
+ mime: string;
202
+ size: number;
203
+ path: string;
204
+ kind: LegacyFileExplorerFilePayload["kind"];
205
+ modifiedAt: string;
206
+ }
207
+ type FileDownloadTokenPayload = FileDownloadTokenResponse["payload"];
208
+ type ListProviderFeaturesPayload = ListProviderFeaturesResponseMessage["payload"];
209
+ type ListProviderModelsPayload = ListProviderModelsResponseMessage["payload"];
210
+ type ListProviderModesPayload = ListProviderModesResponseMessage["payload"];
211
+ type ListAvailableProvidersPayload = ListAvailableProvidersResponse["payload"];
212
+ type GetProvidersSnapshotPayload = GetProvidersSnapshotResponseMessage["payload"];
213
+ type RefreshProvidersSnapshotPayload = RefreshProvidersSnapshotResponseMessage["payload"];
214
+ type ProviderDiagnosticPayload = ProviderDiagnosticResponseMessage["payload"];
215
+ type ProviderUsageListPayload = ProviderUsageListResponseMessage["payload"];
216
+ type DaemonStatusPayload = DaemonGetStatusResponse["payload"];
217
+ type DaemonPairingOfferPayload = DaemonGetPairingOfferResponse["payload"];
218
+ type DiagnosticsPayload = DiagnosticsResponse["payload"];
219
+ type ReadProjectConfigPayload = Extract<SessionOutboundMessage, {
220
+ type: "read_project_config_response";
221
+ }>["payload"];
222
+ type WriteProjectConfigPayload = Extract<SessionOutboundMessage, {
223
+ type: "write_project_config_response";
224
+ }>["payload"];
225
+ type ListCommandsPayload = ListCommandsResponse["payload"];
226
+ type ListCommandsDraftConfig = Pick<AgentSessionConfig, "provider" | "cwd" | "modeId" | "model" | "thinkingOptionId" | "featureValues">;
227
+ export interface WriteProjectConfigInput {
228
+ repoRoot: string;
229
+ config: PaseoConfigRaw;
230
+ expectedRevision: PaseoConfigRevision | null;
231
+ requestId?: string;
232
+ }
233
+ interface ListCommandsOptions {
234
+ agentId: string;
235
+ requestId?: string;
236
+ draftConfig?: ListCommandsDraftConfig;
237
+ }
238
+ type LegacyListCommandsOptions = Omit<ListCommandsOptions, "agentId">;
239
+ type SetVoiceModePayload = Extract<SessionOutboundMessage, {
240
+ type: "set_voice_mode_response";
241
+ }>["payload"];
242
+ type AgentPermissionResolvedPayload = AgentPermissionResolvedMessage["payload"];
243
+ type ListTerminalsPayload = ListTerminalsResponse["payload"];
244
+ type CreateTerminalPayload = CreateTerminalResponse["payload"];
245
+ export type RenameTerminalResult = z.infer<typeof RenameTerminalResponseSchema>["payload"];
246
+ type SubscribeTerminalPayload = SubscribeTerminalResponse["payload"];
247
+ type CloseItemsPayload = CloseItemsResponse["payload"];
248
+ type KillTerminalPayload = KillTerminalResponse["payload"];
249
+ type CaptureTerminalPayload = CaptureTerminalResponse["payload"];
250
+ type ChatCreatePayload = Extract<SessionOutboundMessage, {
251
+ type: "chat/create/response";
252
+ }>["payload"];
253
+ type ChatListPayload = Extract<SessionOutboundMessage, {
254
+ type: "chat/list/response";
255
+ }>["payload"];
256
+ type ChatInspectPayload = Extract<SessionOutboundMessage, {
257
+ type: "chat/inspect/response";
258
+ }>["payload"];
259
+ type ChatDeletePayload = Extract<SessionOutboundMessage, {
260
+ type: "chat/delete/response";
261
+ }>["payload"];
262
+ type ChatPostPayload = Extract<SessionOutboundMessage, {
263
+ type: "chat/post/response";
264
+ }>["payload"];
265
+ type ChatReadPayload = Extract<SessionOutboundMessage, {
266
+ type: "chat/read/response";
267
+ }>["payload"];
268
+ type ChatWaitPayload = Extract<SessionOutboundMessage, {
269
+ type: "chat/wait/response";
270
+ }>["payload"];
271
+ type LoopRunPayload = Extract<SessionOutboundMessage, {
272
+ type: "loop/run/response";
273
+ }>["payload"];
274
+ type LoopListPayload = Extract<SessionOutboundMessage, {
275
+ type: "loop/list/response";
276
+ }>["payload"];
277
+ type LoopInspectPayload = Extract<SessionOutboundMessage, {
278
+ type: "loop/inspect/response";
279
+ }>["payload"];
280
+ type LoopLogsPayload = Extract<SessionOutboundMessage, {
281
+ type: "loop/logs/response";
282
+ }>["payload"];
283
+ type LoopStopPayload = Extract<SessionOutboundMessage, {
284
+ type: "loop/stop/response";
285
+ }>["payload"];
286
+ type ScheduleCreatePayload = Extract<SessionOutboundMessage, {
287
+ type: "schedule/create/response";
288
+ }>["payload"];
289
+ type ScheduleListPayload = Extract<SessionOutboundMessage, {
290
+ type: "schedule/list/response";
291
+ }>["payload"];
292
+ type ScheduleInspectPayload = Extract<SessionOutboundMessage, {
293
+ type: "schedule/inspect/response";
294
+ }>["payload"];
295
+ type ScheduleLogsPayload = Extract<SessionOutboundMessage, {
296
+ type: "schedule/logs/response";
297
+ }>["payload"];
298
+ type SchedulePausePayload = Extract<SessionOutboundMessage, {
299
+ type: "schedule/pause/response";
300
+ }>["payload"];
301
+ type ScheduleResumePayload = Extract<SessionOutboundMessage, {
302
+ type: "schedule/resume/response";
303
+ }>["payload"];
304
+ type ScheduleDeletePayload = Extract<SessionOutboundMessage, {
305
+ type: "schedule/delete/response";
306
+ }>["payload"];
307
+ type ScheduleRunOncePayload = Extract<SessionOutboundMessage, {
308
+ type: "schedule/run-once/response";
309
+ }>["payload"];
310
+ type ScheduleUpdatePayload = Extract<SessionOutboundMessage, {
311
+ type: "schedule/update/response";
312
+ }>["payload"];
313
+ export type FetchAgentTimelinePayload = FetchAgentTimelineResponseMessage["payload"];
314
+ export type AgentForkContextPayload = AgentForkContextResponseMessage["payload"];
315
+ export type FetchAgentTimelineDirection = FetchAgentTimelinePayload["direction"];
316
+ export type FetchAgentTimelineProjection = FetchAgentTimelinePayload["projection"];
317
+ export type FetchAgentTimelineCursor = NonNullable<FetchAgentTimelinePayload["startCursor"]>;
318
+ export interface FetchAgentOptions {
319
+ agentId: string;
320
+ requestId?: string;
321
+ timeout?: number;
322
+ }
323
+ type LegacyFetchAgentOptions = Omit<FetchAgentOptions, "agentId">;
324
+ export interface FetchAgentTimelineOptions {
325
+ direction?: FetchAgentTimelineDirection;
326
+ cursor?: FetchAgentTimelineCursor;
327
+ limit?: number;
328
+ projection?: FetchAgentTimelineProjection;
329
+ requestId?: string;
330
+ timeout?: number;
331
+ }
332
+ export interface AgentForkContextOptions {
333
+ boundaryMessageId?: string;
334
+ requestId?: string;
335
+ }
336
+ type AgentRefreshedStatusPayload = z.infer<typeof AgentRefreshedStatusPayloadSchema>;
337
+ type RestartRequestedStatusPayload = z.infer<typeof RestartRequestedStatusPayloadSchema>;
338
+ type ShutdownRequestedStatusPayload = z.infer<typeof ShutdownRequestedStatusPayloadSchema>;
339
+ export interface ShutdownServerOptions {
340
+ requestId?: string;
341
+ timeout?: number;
342
+ }
343
+ export interface DaemonStatusOptions {
344
+ requestId?: string;
345
+ timeout?: number;
346
+ }
347
+ export interface DaemonPairingOfferOptions {
348
+ requestId?: string;
349
+ timeout?: number;
350
+ }
351
+ type DaemonUpdateResponse = z.infer<typeof DaemonUpdateResponseSchema>;
352
+ type FetchAgentsPayload = Extract<SessionOutboundMessage, {
353
+ type: "fetch_agents_response";
354
+ }>["payload"];
355
+ type FetchAgentsRequest = Extract<SessionInboundMessage, {
356
+ type: "fetch_agents_request";
357
+ }>;
358
+ export type FetchAgentsOptions = Omit<FetchAgentsRequest, "type" | "requestId"> & {
359
+ requestId?: string;
360
+ timeout?: number;
361
+ };
362
+ export type FetchAgentsEntry = FetchAgentsPayload["entries"][number];
363
+ export type FetchAgentsPageInfo = FetchAgentsPayload["pageInfo"];
364
+ type FetchAgentHistoryPayload = Extract<SessionOutboundMessage, {
365
+ type: "fetch_agent_history_response";
366
+ }>["payload"];
367
+ type FetchAgentHistoryRequest = Extract<SessionInboundMessage, {
368
+ type: "fetch_agent_history_request";
369
+ }>;
370
+ export type FetchAgentHistoryOptions = Omit<FetchAgentHistoryRequest, "type" | "requestId"> & {
371
+ requestId?: string;
372
+ };
373
+ export type FetchAgentHistoryEntry = FetchAgentHistoryPayload["entries"][number];
374
+ export type FetchAgentHistoryPageInfo = FetchAgentHistoryPayload["pageInfo"];
375
+ type FetchRecentProviderSessionsPayload = Extract<SessionOutboundMessage, {
376
+ type: "fetch_recent_provider_sessions_response";
377
+ }>["payload"];
378
+ type FetchRecentProviderSessionsRequest = Extract<SessionInboundMessage, {
379
+ type: "fetch_recent_provider_sessions_request";
380
+ }>;
381
+ export type FetchRecentProviderSessionsOptions = Omit<FetchRecentProviderSessionsRequest, "type" | "requestId"> & {
382
+ requestId?: string;
383
+ };
384
+ export type FetchRecentProviderSessionEntry = FetchRecentProviderSessionsPayload["entries"][number];
385
+ type FetchWorkspacesPayload = Extract<SessionOutboundMessage, {
386
+ type: "fetch_workspaces_response";
387
+ }>["payload"];
388
+ type FetchWorkspacesRequest = Extract<SessionInboundMessage, {
389
+ type: "fetch_workspaces_request";
390
+ }>;
391
+ export type FetchWorkspacesOptions = Omit<FetchWorkspacesRequest, "type" | "requestId"> & {
392
+ requestId?: string;
393
+ };
394
+ export type FetchWorkspacesEntry = FetchWorkspacesPayload["entries"][number];
395
+ export type FetchWorkspacesPageInfo = FetchWorkspacesPayload["pageInfo"];
396
+ export interface CreateChatRoomOptions {
397
+ name: string;
398
+ purpose?: string | null;
399
+ requestId?: string;
400
+ }
401
+ export interface InspectChatRoomOptions {
402
+ room: string;
403
+ requestId?: string;
404
+ }
405
+ export interface DeleteChatRoomOptions {
406
+ room: string;
407
+ requestId?: string;
408
+ }
409
+ export interface PostChatMessageOptions {
410
+ room: string;
411
+ body: string;
412
+ authorAgentId?: string;
413
+ replyToMessageId?: string | null;
414
+ requestId?: string;
415
+ }
416
+ export interface ReadChatMessagesOptions {
417
+ room: string;
418
+ limit?: number;
419
+ since?: string;
420
+ authorAgentId?: string;
421
+ requestId?: string;
422
+ timeout?: number;
423
+ }
424
+ export interface WaitForChatMessagesOptions {
425
+ room: string;
426
+ afterMessageId?: string | null;
427
+ timeoutMs?: number;
428
+ requestId?: string;
429
+ }
430
+ export interface RunLoopOptions {
431
+ prompt: string;
432
+ cwd: string;
433
+ provider?: string;
434
+ model?: string;
435
+ modeId?: string;
436
+ verifierProvider?: string;
437
+ verifierModel?: string;
438
+ verifierModeId?: string;
439
+ verifyPrompt?: string | null;
440
+ verifyChecks?: string[];
441
+ name?: string | null;
442
+ sleepMs?: number;
443
+ maxIterations?: number;
444
+ maxTimeMs?: number;
445
+ requestId?: string;
446
+ }
447
+ export interface InspectLoopOptions {
448
+ id: string;
449
+ requestId?: string;
450
+ }
451
+ export interface LoopLogsOptions {
452
+ id: string;
453
+ afterSeq?: number;
454
+ requestId?: string;
455
+ }
456
+ export interface StopLoopOptions {
457
+ id: string;
458
+ requestId?: string;
459
+ }
460
+ export interface CreateScheduleOptions {
461
+ prompt: string;
462
+ name?: string | null;
463
+ cadence: {
464
+ type: "every";
465
+ everyMs: number;
466
+ } | {
467
+ type: "cron";
468
+ expression: string;
469
+ timezone?: string;
470
+ };
471
+ target: {
472
+ type: "self";
473
+ agentId: string;
474
+ } | {
475
+ type: "agent";
476
+ agentId: string;
477
+ } | {
478
+ type: "new-agent";
479
+ config: {
480
+ provider: AgentProvider;
481
+ cwd: string;
482
+ modeId?: string;
483
+ model?: string;
484
+ thinkingOptionId?: string;
485
+ title?: string | null;
486
+ approvalPolicy?: string;
487
+ sandboxMode?: string;
488
+ networkAccess?: boolean;
489
+ webSearch?: boolean;
490
+ extra?: AgentSessionConfig["extra"];
491
+ systemPrompt?: string;
492
+ mcpServers?: AgentSessionConfig["mcpServers"];
493
+ };
494
+ };
495
+ maxRuns?: number;
496
+ expiresAt?: string;
497
+ runOnCreate?: boolean;
498
+ requestId?: string;
499
+ }
500
+ export interface InspectScheduleOptions {
501
+ id: string;
502
+ requestId?: string;
503
+ }
504
+ export interface UpdateScheduleNewAgentConfig {
505
+ provider?: string;
506
+ model?: string | null;
507
+ modeId?: string | null;
508
+ cwd?: string;
509
+ }
510
+ export interface UpdateScheduleOptions {
511
+ id: string;
512
+ name?: string | null;
513
+ prompt?: string;
514
+ cadence?: {
515
+ type: "every";
516
+ everyMs: number;
517
+ } | {
518
+ type: "cron";
519
+ expression: string;
520
+ timezone?: string;
521
+ };
522
+ newAgentConfig?: UpdateScheduleNewAgentConfig;
523
+ maxRuns?: number | null;
524
+ expiresAt?: string | null;
525
+ requestId?: string;
526
+ }
527
+ export interface RenameBranchInput {
528
+ cwd: string;
529
+ branch: string;
530
+ requestId?: string;
531
+ }
532
+ export interface RenameTerminalInput {
533
+ terminalId: string;
534
+ title: string;
535
+ requestId?: string;
536
+ }
537
+ type OpenProjectPayload = OpenProjectResponseMessage["payload"];
538
+ type ProjectAddPayload = ProjectAddResponse["payload"];
539
+ type ArchiveWorkspacePayload = ArchiveWorkspaceResponseMessage["payload"];
540
+ type WorkspaceSetupStatusPayload = WorkspaceSetupStatusResponseMessage["payload"];
541
+ export interface FetchAgentResult {
542
+ agent: AgentSnapshotPayload;
543
+ project: ProjectPlacementPayload | null;
544
+ }
545
+ export interface WaitForFinishResult {
546
+ status: "idle" | "error" | "permission" | "timeout";
547
+ final: AgentSnapshotPayload | null;
548
+ error: string | null;
549
+ lastMessage: string | null;
550
+ }
551
+ /**
552
+ * Thrown when an in-flight `uploadFile()` is cancelled via its `AbortSignal`.
553
+ * Distinct from {@link UploadCapExceededError} and {@link UploadFailedError} so
554
+ * Epic 5's attachment-chip UI can render the "cancelled" state specifically.
555
+ */
556
+ export declare class UploadCancelledError extends Error {
557
+ readonly uploadId: string;
558
+ constructor(uploadId: string);
559
+ }
560
+ /**
561
+ * Thrown when the daemon rejects an upload because it exceeds the size cap —
562
+ * either the declared-size early reject at begin, or an incremental reject
563
+ * mid-stream (story 2.2). Carries the `too_large` code and any daemon detail.
564
+ */
565
+ export declare class UploadCapExceededError extends Error {
566
+ readonly uploadId: string;
567
+ readonly code: Extract<FileUploadErrorCode, "too_large">;
568
+ constructor(uploadId: string, detail?: string);
569
+ }
570
+ /**
571
+ * Thrown for any other upload failure — transport error, `write_failed`,
572
+ * `checksum_mismatch`, or an unexpected daemon error. The third distinguishable
573
+ * reject path alongside cancelled and cap-exceeded.
574
+ */
575
+ export declare class UploadFailedError extends Error {
576
+ readonly uploadId: string;
577
+ readonly code?: FileUploadErrorCode;
578
+ constructor(uploadId: string, message: string, code?: FileUploadErrorCode);
579
+ }
580
+ export declare class DaemonClient {
581
+ private config;
582
+ private transport;
583
+ private transportCleanup;
584
+ private rawMessageListeners;
585
+ private messageHandlers;
586
+ private eventListeners;
587
+ private waiters;
588
+ private checkoutStatusInFlight;
589
+ private connectionListeners;
590
+ private reconnectTimeout;
591
+ private connectTimeout;
592
+ private pendingGenericTransportErrorTimeout;
593
+ private reconnectAttempt;
594
+ private shouldReconnect;
595
+ private connectPromise;
596
+ private connectResolve;
597
+ private connectReject;
598
+ private lastErrorValue;
599
+ private connectionState;
600
+ private checkoutDiffSubscriptions;
601
+ private terminalDirectorySubscriptions;
602
+ private readonly terminalStreams;
603
+ private pendingBinaryFileReads;
604
+ private activeBinaryFileTransfers;
605
+ private completedBinaryFileReads;
606
+ private logger;
607
+ private pendingSendQueue;
608
+ private readonly logConnectionPath;
609
+ private readonly logServerId;
610
+ private readonly logClientIdHash;
611
+ private readonly logGeneration;
612
+ private lastServerInfoMessage;
613
+ private runtimeMetricsInterval;
614
+ private runtimeMetrics;
615
+ private pingProbe;
616
+ private livenessHeartbeatTimer;
617
+ private lastLivenessRttMs;
618
+ private consecutiveLivenessFailures;
619
+ constructor(config: DaemonClientConfig);
620
+ connect(): Promise<void>;
621
+ private attemptConnect;
622
+ private resolveConnect;
623
+ private rejectConnect;
624
+ close(): Promise<void>;
625
+ ensureConnected(): void;
626
+ getConnectionState(): ConnectionState;
627
+ subscribeConnectionStatus(listener: (status: ConnectionState) => void): () => void;
628
+ get isConnected(): boolean;
629
+ get isConnecting(): boolean;
630
+ get lastError(): string | null;
631
+ getLastLivenessRttMs(): number | null;
632
+ subscribe(handler: DaemonEventHandler): () => void;
633
+ subscribeRawMessages(handler: (message: SessionOutboundMessage) => void): () => void;
634
+ on<TType extends SessionOutboundMessage["type"]>(type: TType, handler: (message: Extract<SessionOutboundMessage, {
635
+ type: TType;
636
+ }>) => void): () => void;
637
+ on(handler: DaemonEventHandler): () => void;
638
+ /**
639
+ * Send a session message. For fire-and-forget messages (heartbeats, etc.),
640
+ * failures are suppressed if `suppressSendErrors` is configured.
641
+ * For RPC methods that wait for responses, use `sendSessionMessageOrThrow` instead.
642
+ */
643
+ private sendSessionMessage;
644
+ private sendBinaryFrame;
645
+ /**
646
+ * Send a session message for RPC methods that create waiters.
647
+ * If the connection is still being established ("connecting"), the message
648
+ * is queued and will be sent once connected (or rejected after timeout).
649
+ * This prevents waiters from hanging forever when called during connection.
650
+ */
651
+ private sendSessionMessageOrThrow;
652
+ /**
653
+ * Flush pending send queue - called when connection is established.
654
+ */
655
+ private flushPendingSendQueue;
656
+ /**
657
+ * Reject all pending sends - called when connection fails or is closed.
658
+ */
659
+ private rejectPendingSendQueue;
660
+ protected sendRequest<T>(params: {
661
+ requestId: string;
662
+ message: SessionInboundMessage;
663
+ timeout?: number;
664
+ select: (msg: SessionOutboundMessage) => T | null;
665
+ options?: {
666
+ skipQueue?: boolean;
667
+ };
668
+ }): Promise<T>;
669
+ private sendCorrelatedRequest;
670
+ private sendCorrelatedSessionRequest;
671
+ private sendNamespacedCorrelatedSessionRequest;
672
+ private sendSessionMessageStrict;
673
+ clearAgentAttention(agentId: string | string[]): Promise<void>;
674
+ clearWorkspaceAttention(workspaceId: string | string[]): Promise<void>;
675
+ sendHeartbeat(params: {
676
+ deviceType: "web" | "mobile";
677
+ focusedAgentId: string | null;
678
+ focusedTerminalId?: string | null;
679
+ lastActivityAt: string;
680
+ appVisible: boolean;
681
+ appVisibilityChangedAt?: string;
682
+ }): void;
683
+ registerPushToken(token: string): void;
684
+ /**
685
+ * Relay a watch-originated action (`watch.*`) over the existing WebSocket
686
+ * session transport. Fire-and-forget: the watch message types are already
687
+ * members of `SessionInboundMessageSchema`, so this forwards straight to the
688
+ * private `sendSessionMessage` path (`{ type: "session", message }`) — never
689
+ * an HTTP route, never a response-waiting RPC.
690
+ */
691
+ sendWatchAction(message: WatchNotificationActionMessage | WatchSessionSearchMessage | WatchComposerDictateMessage): void;
692
+ ping(params?: {
693
+ requestId?: string;
694
+ timeoutMs?: number;
695
+ }): Promise<{
696
+ requestId: string;
697
+ clientSentAt: number;
698
+ serverReceivedAt: number;
699
+ serverSentAt: number;
700
+ rttMs: number;
701
+ }>;
702
+ measureLatency(params?: {
703
+ timeoutMs?: number;
704
+ }): Promise<number>;
705
+ private livenessPing;
706
+ private sendPingAwaitRtt;
707
+ private startLivenessHeartbeat;
708
+ private stopLivenessHeartbeat;
709
+ private scheduleNextLivenessHeartbeat;
710
+ fetchAgents(options?: FetchAgentsOptions): Promise<FetchAgentsPayload>;
711
+ fetchAgentHistory(options?: FetchAgentHistoryOptions): Promise<FetchAgentHistoryPayload>;
712
+ fetchRecentProviderSessions(options?: FetchRecentProviderSessionsOptions): Promise<FetchRecentProviderSessionsPayload>;
713
+ fetchWorkspaces(options?: FetchWorkspacesOptions): Promise<FetchWorkspacesPayload>;
714
+ openProject(cwd: string, requestId?: string): Promise<OpenProjectPayload>;
715
+ addProject(cwd: string, requestId?: string): Promise<ProjectAddPayload>;
716
+ startWorkspaceScript(workspaceId: string, scriptName: string, requestId?: string): Promise<Extract<SessionOutboundMessage, {
717
+ type: "start_workspace_script_response";
718
+ }>["payload"]>;
719
+ archiveWorkspace(workspaceId: string, requestId?: string): Promise<ArchiveWorkspacePayload>;
720
+ /**
721
+ * Set or clear the user's custom project name override. Pass `null` (or an
722
+ * empty/whitespace string, which the server normalizes to `null`) to clear
723
+ * the override and fall back to the derived project name.
724
+ */
725
+ renameProject(projectId: string, customName: string | null, requestId?: string): Promise<ProjectRenameResponse["payload"]>;
726
+ fetchWorkspaceSetupStatus(workspaceId: string, requestId?: string): Promise<WorkspaceSetupStatusPayload>;
727
+ fetchAgent(options: FetchAgentOptions): Promise<FetchAgentResult | null>;
728
+ fetchAgent(agentId: string, requestId?: string): Promise<FetchAgentResult | null>;
729
+ fetchAgent(agentId: string, options?: LegacyFetchAgentOptions): Promise<FetchAgentResult | null>;
730
+ private resubscribeCheckoutDiffSubscriptions;
731
+ private resubscribeTerminalDirectorySubscriptions;
732
+ createAgent(options: CreateAgentRequestOptions): Promise<AgentSnapshotPayload>;
733
+ deleteAgent(agentId: string): Promise<void>;
734
+ archiveAgent(agentId: string): Promise<{
735
+ archivedAt: string;
736
+ }>;
737
+ /**
738
+ * Dismiss a live background shell. For Claude Code agents this drives the
739
+ * CLI's own `ctrl+x ctrl+k` kill chord over the PTY (kills it inside Claude
740
+ * Code). Resolves to whether the dismiss was delivered.
741
+ */
742
+ dismissBackgroundTask(agentId: string, taskId: string): Promise<{
743
+ dismissed: boolean;
744
+ }>;
745
+ detachAgent(agentId: string): Promise<void>;
746
+ updateAgent(agentId: string, updates: {
747
+ name?: string;
748
+ labels?: Record<string, string>;
749
+ }): Promise<void>;
750
+ rewindSession(agentId: string, turnId: string): Promise<{
751
+ newSessionId: string;
752
+ }>;
753
+ editMessage(agentId: string, turnId: string, newContent: string): Promise<{
754
+ newSessionId: string;
755
+ }>;
756
+ listWorkspaceSessions(workspaceId: string, options?: {
757
+ signal?: AbortSignal;
758
+ }): Promise<Array<{
759
+ sid: string;
760
+ title: string | null;
761
+ lastActivity: string;
762
+ cwd: string;
763
+ agentName: string | null;
764
+ }>>;
765
+ subscribePush(subscription: {
766
+ type: "expo";
767
+ token: string;
768
+ } | {
769
+ type: "web";
770
+ subscription: {
771
+ endpoint: string;
772
+ keys: {
773
+ p256dh: string;
774
+ auth: string;
775
+ };
776
+ expirationTime?: number | null;
777
+ };
778
+ }): Promise<{
779
+ ok: boolean;
780
+ vapidPublicKey?: string;
781
+ }>;
782
+ getVapidPublicKey(): Promise<string | null>;
783
+ listAllSessions(options?: {
784
+ signal?: AbortSignal;
785
+ }): Promise<Array<{
786
+ sid: string;
787
+ title: string | null;
788
+ lastActivity: string;
789
+ cwd: string;
790
+ agentName: string | null;
791
+ }>>;
792
+ listWorkflows(): Promise<WorkflowSnapshot[]>;
793
+ getWorkflow(workflowId: string): Promise<WorkflowSnapshot | null>;
794
+ cancelWorkflow(workflowId: string): Promise<WorkflowSnapshot>;
795
+ startWorkflow(input: {
796
+ graph: WorkflowTaskGraph;
797
+ provider: string;
798
+ cwd: string;
799
+ model?: string;
800
+ title?: string;
801
+ labels?: Record<string, string>;
802
+ }): Promise<{
803
+ workflowId: string;
804
+ childAgentIds: string[];
805
+ status: WorkflowStatus;
806
+ }>;
807
+ listExtensions(): Promise<InstalledExtension[]>;
808
+ executeExtensionCommand(commandId: string, args?: unknown[]): Promise<unknown>;
809
+ searchSessions(params: {
810
+ query: string;
811
+ limit?: number;
812
+ sources?: readonly string[];
813
+ signal?: AbortSignal;
814
+ }): Promise<Array<{
815
+ sid: string;
816
+ source: string;
817
+ cwd: string;
818
+ timestamp: string;
819
+ snippet: string;
820
+ resumeCommand: string;
821
+ }>>;
822
+ /**
823
+ * Derive the daemon's HTTP base URL from the WebSocket URL we connected with.
824
+ * Works for direct (ws://host:port/ws) and same-origin (web served by
825
+ * daemon). For relay-mode (wss://relay.../ws), HTTP routes against the
826
+ * daemon are not addressable — throws so callers fall back gracefully.
827
+ */
828
+ private getHttpBaseUrl;
829
+ private buildAuthHeader;
830
+ private daemonHttpJson;
831
+ removeProject(projectId: string, requestId?: string): Promise<{
832
+ removedWorkspaceIds: string[];
833
+ }>;
834
+ setWorkspaceTitle(workspaceId: string, title: string | null, requestId?: string): Promise<{
835
+ title: string | null;
836
+ }>;
837
+ resumeAgent(handle: AgentPersistenceHandle, overrides?: Partial<AgentSessionConfig>): Promise<AgentSnapshotPayload>;
838
+ importAgent(input: ImportAgentInput): Promise<AgentSnapshotPayload>;
839
+ refreshAgent(agentId: string, requestId?: string): Promise<AgentRefreshedStatusPayload>;
840
+ fetchAgentTimeline(agentId: string, options?: FetchAgentTimelineOptions): Promise<FetchAgentTimelinePayload>;
841
+ buildAgentForkContext(agentId: string, options?: AgentForkContextOptions): Promise<AgentForkContextPayload>;
842
+ sendAgentMessage(agentId: string, text: string, options?: SendMessageOptions): Promise<void>;
843
+ sendMessage(agentId: string, text: string, options?: SendMessageOptions): Promise<void>;
844
+ rewindAgent(agentId: string, messageId: string, mode: "conversation" | "files" | "both"): Promise<AgentRewindResponseMessage["payload"]>;
845
+ cancelAgent(agentId: string): Promise<void>;
846
+ setAgentMode(agentId: string, modeId: string): Promise<AgentProviderNotice | null>;
847
+ setAgentModel(agentId: string, modelId: string | null): Promise<void>;
848
+ /**
849
+ * Hot-swap a running agent's provider to a compatible one (e.g. Claude →
850
+ * Claude (Pool)). Throws if the swap is rejected by the daemon (incompatible
851
+ * wireFamily, target not in compatibleProviders list, target unavailable).
852
+ */
853
+ swapAgentProvider(agentId: string, newProviderId: string, overrides?: {
854
+ model?: string | null;
855
+ modeId?: string;
856
+ }): Promise<void>;
857
+ setAgentFeature(agentId: string, featureId: string, value: unknown): Promise<void>;
858
+ setAgentThinkingOption(agentId: string, thinkingOptionId: string | null): Promise<AgentProviderNotice | null>;
859
+ restartServer(reason?: string, requestId?: string): Promise<RestartRequestedStatusPayload>;
860
+ shutdownServer(options?: ShutdownServerOptions): Promise<ShutdownRequestedStatusPayload>;
861
+ updateDaemon(requestId?: string): Promise<DaemonUpdateResponse["payload"]>;
862
+ setVoiceMode(enabled: boolean, agentId?: string): Promise<SetVoiceModePayload>;
863
+ sendVoiceAudioChunk(audio: string, format: string, isLast?: boolean): Promise<void>;
864
+ startDictationStream(dictationId: string, format: string): Promise<void>;
865
+ sendDictationStreamChunk(dictationId: string, seq: number, audio: string, format: string): void;
866
+ finishDictationStream(dictationId: string, finalSeq: number): Promise<{
867
+ dictationId: string;
868
+ text: string;
869
+ }>;
870
+ cancelDictationStream(dictationId: string): void;
871
+ abortRequest(): Promise<void>;
872
+ audioPlayed(id: string): Promise<void>;
873
+ getCheckoutStatus(cwd: string, options?: {
874
+ requestId?: string;
875
+ }): Promise<CheckoutStatusPayload>;
876
+ private normalizeCheckoutDiffCompare;
877
+ getCheckoutDiff(cwd: string, compare: {
878
+ mode: "uncommitted" | "base";
879
+ baseRef?: string;
880
+ ignoreWhitespace?: boolean;
881
+ }, requestId?: string): Promise<CheckoutDiffPayload>;
882
+ subscribeCheckoutDiff(cwd: string, compare: {
883
+ mode: "uncommitted" | "base";
884
+ baseRef?: string;
885
+ ignoreWhitespace?: boolean;
886
+ }, options?: {
887
+ subscriptionId?: string;
888
+ requestId?: string;
889
+ }): Promise<SubscribeCheckoutDiffPayload>;
890
+ unsubscribeCheckoutDiff(subscriptionId: string): void;
891
+ checkoutCommit(cwd: string, input: {
892
+ message?: string;
893
+ addAll?: boolean;
894
+ }, requestId?: string): Promise<CheckoutCommitPayload>;
895
+ checkoutMerge(cwd: string, input: {
896
+ baseRef?: string;
897
+ strategy?: "merge" | "squash";
898
+ requireCleanTarget?: boolean;
899
+ }, requestId?: string): Promise<CheckoutMergePayload>;
900
+ checkoutMergeFromBase(cwd: string, input: {
901
+ baseRef?: string;
902
+ requireCleanTarget?: boolean;
903
+ }, requestId?: string): Promise<CheckoutMergeFromBasePayload>;
904
+ checkoutPull(cwd: string, requestId?: string): Promise<CheckoutPullPayload>;
905
+ checkoutPush(cwd: string, requestId?: string): Promise<CheckoutPushPayload>;
906
+ checkoutRefresh(cwd: string, requestId?: string): Promise<CheckoutRefreshPayload>;
907
+ checkoutPrCreate(cwd: string, input: {
908
+ title?: string;
909
+ body?: string;
910
+ baseRef?: string;
911
+ }, requestId?: string): Promise<CheckoutPrCreatePayload>;
912
+ checkoutPrMerge(cwd: string, input: {
913
+ method: CheckoutPrMergeMethod;
914
+ }, requestId?: string): Promise<CheckoutPrMergePayload>;
915
+ checkoutGithubSetAutoMerge(cwd: string, input: {
916
+ enabled: true;
917
+ method: CheckoutPrMergeMethod;
918
+ } | {
919
+ enabled: false;
920
+ }, requestId?: string): Promise<CheckoutGithubSetAutoMergePayload>;
921
+ checkoutGithubGetCheckDetails(input: {
922
+ cwd: string;
923
+ repoOwner: string;
924
+ repoName: string;
925
+ checkRunId: number;
926
+ workflowRunId?: number;
927
+ }, requestId?: string): Promise<CheckoutGithubGetCheckDetailsPayload>;
928
+ checkoutPrStatus(cwd: string, requestId?: string): Promise<CheckoutPrStatusPayload>;
929
+ pullRequestTimeline(input: {
930
+ cwd: string;
931
+ prNumber: number;
932
+ repoOwner: string;
933
+ repoName: string;
934
+ }, requestId?: string): Promise<PullRequestTimelinePayload>;
935
+ checkoutSwitchBranch(cwd: string, branch: string, requestId?: string): Promise<CheckoutSwitchBranchPayload>;
936
+ renameBranch(input: RenameBranchInput): Promise<RenameBranchResult>;
937
+ stashSave(cwd: string, options?: {
938
+ branch?: string;
939
+ }, requestId?: string): Promise<StashSavePayload>;
940
+ stashPop(cwd: string, stashIndex: number, requestId?: string): Promise<StashPopPayload>;
941
+ stashList(cwd: string, options?: {
942
+ paseoOnly?: boolean;
943
+ }, requestId?: string): Promise<StashListPayload>;
944
+ getPaseoWorktreeList(input: {
945
+ cwd?: string;
946
+ repoRoot?: string;
947
+ }, requestId?: string): Promise<PaseoWorktreeListPayload>;
948
+ archivePaseoWorktree(input: {
949
+ worktreePath?: string;
950
+ repoRoot?: string;
951
+ branchName?: string;
952
+ workspaceId?: string;
953
+ scope?: "workspace" | "worktree";
954
+ }, requestId?: string): Promise<PaseoWorktreeArchivePayload>;
955
+ createPaseoWorktree(input: CreatePaseoWorktreeInput, requestId?: string): Promise<CreatePaseoWorktreePayload>;
956
+ createWorkspace(input: {
957
+ source: WorkspaceCreateRequest["source"];
958
+ title?: string;
959
+ firstAgentContext?: WorkspaceCreateRequest["firstAgentContext"];
960
+ }, requestId?: string): Promise<WorkspaceCreatePayload>;
961
+ validateBranch(options: {
962
+ cwd: string;
963
+ branchName: string;
964
+ }, requestId?: string): Promise<ValidateBranchPayload>;
965
+ getBranchSuggestions(options: {
966
+ cwd: string;
967
+ query?: string;
968
+ limit?: number;
969
+ }, requestId?: string): Promise<BranchSuggestionsPayload>;
970
+ searchGitHub(options: {
971
+ cwd: string;
972
+ query: string;
973
+ limit?: number;
974
+ kinds?: GitHubSearchRequest["kinds"];
975
+ }, requestId?: string): Promise<GitHubSearchPayload>;
976
+ getDirectorySuggestions(options: {
977
+ query: string;
978
+ limit?: number;
979
+ cwd?: string;
980
+ includeFiles?: boolean;
981
+ includeDirectories?: boolean;
982
+ matchMode?: "fuzzy" | "suffix";
983
+ }, requestId?: string): Promise<DirectorySuggestionsPayload>;
984
+ private requestFileExplorer;
985
+ listDirectory(cwd: string, path: string, requestId?: string): Promise<FileExplorerDirectoryPayload>;
986
+ readFile(cwd: string, path: string, requestId?: string): Promise<FileReadResult>;
987
+ requestDownloadToken(cwd: string, path: string, requestId?: string): Promise<FileDownloadTokenPayload>;
988
+ requestProjectIcon(cwd: string, requestId?: string): Promise<ProjectIconResponse["payload"]>;
989
+ listProviderModels(provider: AgentProvider, options?: {
990
+ cwd?: string;
991
+ requestId?: string;
992
+ }): Promise<ListProviderModelsPayload>;
993
+ listProviderModes(provider: AgentProvider, options?: {
994
+ cwd?: string;
995
+ requestId?: string;
996
+ }): Promise<ListProviderModesPayload>;
997
+ listProviderFeatures(draftConfig: ListCommandsDraftConfig, options?: {
998
+ requestId?: string;
999
+ }): Promise<ListProviderFeaturesPayload>;
1000
+ listAvailableProviders(options?: {
1001
+ requestId?: string;
1002
+ }): Promise<ListAvailableProvidersPayload>;
1003
+ getProvidersSnapshot(options?: {
1004
+ cwd?: string;
1005
+ requestId?: string;
1006
+ }): Promise<GetProvidersSnapshotPayload>;
1007
+ getDaemonConfig(requestId?: string): Promise<{
1008
+ requestId: string;
1009
+ config: MutableDaemonConfig;
1010
+ }>;
1011
+ getDaemonStatus(options?: DaemonStatusOptions): Promise<DaemonStatusPayload>;
1012
+ getDaemonPairingOffer(options?: DaemonPairingOfferOptions): Promise<DaemonPairingOfferPayload>;
1013
+ collectDiagnostics(requestId?: string): Promise<DiagnosticsPayload>;
1014
+ patchDaemonConfig(config: MutableDaemonConfigPatch, requestId?: string): Promise<{
1015
+ requestId: string;
1016
+ config: MutableDaemonConfig;
1017
+ }>;
1018
+ sendBrowserAutomationExecuteResponse(response: BrowserAutomationExecuteResponse): void;
1019
+ readProjectConfig(repoRoot: string, requestId?: string): Promise<ReadProjectConfigPayload>;
1020
+ writeProjectConfig(input: WriteProjectConfigInput): Promise<WriteProjectConfigPayload>;
1021
+ refreshProvidersSnapshot(options?: {
1022
+ cwd?: string;
1023
+ providers?: AgentProvider[];
1024
+ requestId?: string;
1025
+ }): Promise<RefreshProvidersSnapshotPayload>;
1026
+ getProviderDiagnostic(provider: AgentProvider, options?: {
1027
+ requestId?: string;
1028
+ }): Promise<ProviderDiagnosticPayload>;
1029
+ listProviderUsage(options?: {
1030
+ requestId?: string;
1031
+ }): Promise<ProviderUsageListPayload>;
1032
+ listCommands(options: ListCommandsOptions): Promise<ListCommandsPayload>;
1033
+ listCommands(agentId: string, requestId?: string): Promise<ListCommandsPayload>;
1034
+ listCommands(agentId: string, options?: LegacyListCommandsOptions): Promise<ListCommandsPayload>;
1035
+ respondToPermission(agentId: string, requestId: string, response: AgentPermissionResponse): Promise<void>;
1036
+ respondToPermissionAndWait(agentId: string, requestId: string, response: AgentPermissionResponse, timeout?: number): Promise<AgentPermissionResolvedPayload>;
1037
+ waitForAgentUpsert(agentId: string, predicate: (snapshot: AgentSnapshotPayload) => boolean, timeout?: number): Promise<AgentSnapshotPayload>;
1038
+ waitForFinish(agentId: string, timeout?: number): Promise<WaitForFinishResult>;
1039
+ subscribeTerminals(input: {
1040
+ cwd: string;
1041
+ workspaceId?: string;
1042
+ }): void;
1043
+ unsubscribeTerminals(input: {
1044
+ cwd: string;
1045
+ workspaceId?: string;
1046
+ }): void;
1047
+ listTerminals(cwd?: string, requestId?: string, options?: {
1048
+ workspaceId?: string;
1049
+ }): Promise<ListTerminalsPayload>;
1050
+ createTerminal(cwd: string, name?: string, requestId?: string, options?: {
1051
+ agentId?: string;
1052
+ command?: string;
1053
+ args?: string[];
1054
+ workspaceId?: string;
1055
+ }): Promise<CreateTerminalPayload>;
1056
+ renameTerminal(input: RenameTerminalInput): Promise<RenameTerminalResult>;
1057
+ subscribeTerminal(terminalId: string, optionsOrRequestId?: {
1058
+ restore?: SubscribeTerminalRequest["restore"];
1059
+ requestId?: string;
1060
+ } | string): Promise<SubscribeTerminalPayload>;
1061
+ unsubscribeTerminal(terminalId: string): void;
1062
+ sendTerminalInput(terminalId: string, message: TerminalInput["message"]): void;
1063
+ killTerminal(terminalId: string, requestId?: string): Promise<KillTerminalPayload>;
1064
+ closeItems(input: {
1065
+ agentIds?: string[];
1066
+ terminalIds?: string[];
1067
+ }, requestId?: string): Promise<CloseItemsPayload>;
1068
+ captureTerminal(terminalId: string, options?: {
1069
+ start?: number;
1070
+ end?: number;
1071
+ stripAnsi?: boolean;
1072
+ }, requestId?: string): Promise<CaptureTerminalPayload>;
1073
+ createChatRoom(options: CreateChatRoomOptions): Promise<ChatCreatePayload>;
1074
+ listChatRooms(requestId?: string): Promise<ChatListPayload>;
1075
+ inspectChatRoom(options: InspectChatRoomOptions): Promise<ChatInspectPayload>;
1076
+ deleteChatRoom(options: DeleteChatRoomOptions): Promise<ChatDeletePayload>;
1077
+ postChatMessage(options: PostChatMessageOptions): Promise<ChatPostPayload>;
1078
+ readChatMessages(options: ReadChatMessagesOptions): Promise<ChatReadPayload>;
1079
+ waitForChatMessages(options: WaitForChatMessagesOptions): Promise<ChatWaitPayload>;
1080
+ scheduleCreate(options: CreateScheduleOptions): Promise<ScheduleCreatePayload>;
1081
+ scheduleList(requestId?: string): Promise<ScheduleListPayload>;
1082
+ scheduleInspect(options: InspectScheduleOptions): Promise<ScheduleInspectPayload>;
1083
+ scheduleLogs(options: InspectScheduleOptions): Promise<ScheduleLogsPayload>;
1084
+ schedulePause(options: InspectScheduleOptions): Promise<SchedulePausePayload>;
1085
+ scheduleResume(options: InspectScheduleOptions): Promise<ScheduleResumePayload>;
1086
+ scheduleDelete(options: InspectScheduleOptions): Promise<ScheduleDeletePayload>;
1087
+ scheduleRunOnce(options: InspectScheduleOptions): Promise<ScheduleRunOncePayload>;
1088
+ scheduleUpdate(options: UpdateScheduleOptions): Promise<ScheduleUpdatePayload>;
1089
+ loopRun(options: RunLoopOptions): Promise<LoopRunPayload>;
1090
+ loopList(requestId?: string): Promise<LoopListPayload>;
1091
+ loopInspect(options: string | InspectLoopOptions): Promise<LoopInspectPayload>;
1092
+ loopLogs(options: string | LoopLogsOptions, afterSeq?: number): Promise<LoopLogsPayload>;
1093
+ loopStop(options: string | StopLoopOptions): Promise<LoopStopPayload>;
1094
+ onTerminalStreamEvent(handler: (event: TerminalStreamEvent) => void): () => void;
1095
+ waitForTerminalStreamEvent(predicate: (event: TerminalStreamEvent) => boolean, timeout?: number): Promise<TerminalStreamEvent>;
1096
+ /**
1097
+ * Upload a file to an agent's workspace as a windowed, cancellable,
1098
+ * progress-reporting stream of {@link UPLOAD_CHUNK_SIZE_BYTES} `FileChunk`
1099
+ * frames with ack-based flow control. Resolves `{ fileId, path, size,
1100
+ * mimeType }` once the daemon finalizes the file.
1101
+ *
1102
+ * Purely additive over the receive path (`activeBinaryFileTransfers`): this
1103
+ * method only sends. It never buffers more than {@link UPLOAD_WINDOW_SIZE}
1104
+ * chunks in flight, so it cannot approach the relay's `MAX_PENDING_SENDS`
1105
+ * ceiling.
1106
+ *
1107
+ * @throws {UploadCancelledError} when `opts.signal` aborts
1108
+ * @throws {UploadCapExceededError} when the daemon rejects on the size cap
1109
+ * @throws {UploadFailedError} for any other transfer failure
1110
+ */
1111
+ uploadFile(file: {
1112
+ bytes: Uint8Array;
1113
+ path: string;
1114
+ mime: string;
1115
+ modifiedAt: string;
1116
+ }, opts: {
1117
+ agentId: string;
1118
+ onProgress?: (bytesSent: number, totalBytes: number) => void;
1119
+ signal?: AbortSignal;
1120
+ }): Promise<{
1121
+ fileId: string;
1122
+ path: string;
1123
+ size: number;
1124
+ mimeType: string;
1125
+ }>;
1126
+ protected createRequestId(requestId?: string): string;
1127
+ getLastServerInfoMessage(): ServerInfoStatusPayload | null;
1128
+ getFileUploadsCapability(): boolean;
1129
+ private resolveTransportUrlForAttempt;
1130
+ private sendHelloMessage;
1131
+ private disposeTransport;
1132
+ private cleanupTransport;
1133
+ private resetConnectTimeout;
1134
+ private handleTransportMessage;
1135
+ private handleJsonPayload;
1136
+ private tryHandleBinaryFrame;
1137
+ private handleFileTransferFrame;
1138
+ private updateConnectionState;
1139
+ setReconnectEnabled(enabled: boolean): void;
1140
+ private scheduleReconnect;
1141
+ private emitDisconnectedStateForReconnect;
1142
+ private armReconnectTimer;
1143
+ private resolvePingProbe;
1144
+ private clearPingProbe;
1145
+ private rejectPingProbe;
1146
+ private recordLivenessFailure;
1147
+ private handleSessionMessage;
1148
+ private resolveWaiters;
1149
+ private clearWaiters;
1150
+ private toEvent;
1151
+ private waitForWithCancel;
1152
+ }
1153
+ //# sourceMappingURL=daemon-client.d.ts.map