@getpaseo/client 0.1.84

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,880 @@
1
+ import type { z } from "zod";
2
+ import { AgentRefreshedStatusPayloadSchema, CheckoutRenameBranchResponseSchema, RenameTerminalResponseSchema, RestartRequestedStatusPayloadSchema, ShutdownRequestedStatusPayloadSchema, type ServerInfoStatusPayload } from "@getpaseo/protocol/messages";
3
+ import type { AgentStreamEventPayload, AgentSnapshotPayload, ProjectPlacementPayload, AgentPermissionResolvedMessage, CreateAgentRequestMessage, CreatePaseoWorktreeRequest, FileDownloadTokenResponse, FileExplorerResponse, FetchAgentTimelineResponseMessage, GitSetupOptions, CheckoutStatusResponse, CheckoutCommitResponse, CheckoutMergeResponse, CheckoutMergeFromBaseResponse, CheckoutPullResponse, CheckoutPushResponse, CheckoutPrCreateResponse, CheckoutPrMergeResponse, CheckoutPrMergeMethod, CheckoutGithubSetAutoMergeResponse, CheckoutPrStatusResponse, PullRequestTimelineResponse, CheckoutSwitchBranchResponse, StashSaveResponse, StashPopResponse, StashListResponse, ValidateBranchResponse, BranchSuggestionsResponse, GitHubSearchResponse, GitHubSearchRequest, DirectorySuggestionsResponse, PaseoWorktreeListResponse, PaseoWorktreeArchiveResponse, ProjectIconResponse, ListAvailableEditorsResponseMessage, OpenInEditorResponseMessage, OpenProjectResponseMessage, ArchiveWorkspaceResponseMessage, WorkspaceSetupStatusResponseMessage, ListCommandsResponse, ListProviderFeaturesResponseMessage, ListProviderModelsResponseMessage, ListProviderModesResponseMessage, ListAvailableProvidersResponse, GetProvidersSnapshotResponseMessage, RefreshProvidersSnapshotResponseMessage, ProviderDiagnosticResponseMessage, DaemonGetStatusResponse, DaemonGetPairingOfferResponse, AgentRewindResponseMessage, ListTerminalsResponse, CreateTerminalResponse, SubscribeTerminalResponse, SubscribeTerminalRequest, CloseItemsResponse, KillTerminalResponse, CaptureTerminalResponse, TerminalInput, SessionInboundMessage, SessionOutboundMessage, SendAgentMessageRequest, EditorTargetId, PaseoConfigRaw, PaseoConfigRevision } from "@getpaseo/protocol/messages";
4
+ import type { AgentPermissionRequest, AgentPermissionResponse, AgentPersistenceHandle, AgentProvider, AgentSessionConfig } from "@getpaseo/protocol/agent-types";
5
+ import type { MutableDaemonConfig, MutableDaemonConfigPatch } from "@getpaseo/protocol/messages";
6
+ import { type DaemonTransportFactory, type WebSocketFactory } from "./daemon-client-transport.js";
7
+ import { type TerminalStreamEvent } from "./terminal-stream-router.js";
8
+ export interface Logger {
9
+ debug(obj: object, msg?: string): void;
10
+ info(obj: object, msg?: string): void;
11
+ warn(obj: object, msg?: string): void;
12
+ error(obj: object, msg?: string): void;
13
+ }
14
+ interface ImportAgentInputBase {
15
+ cwd?: string;
16
+ labels?: Record<string, string>;
17
+ }
18
+ export type ImportAgentInput = (ImportAgentInputBase & {
19
+ providerId: string;
20
+ providerHandleId: string;
21
+ }) | (ImportAgentInputBase & {
22
+ provider: AgentProvider;
23
+ sessionId: string;
24
+ });
25
+ export type { DaemonTransport, DaemonTransportFactory, WebSocketFactory, WebSocketLike, } from "./daemon-client-transport.js";
26
+ export type { TerminalStreamEvent };
27
+ export type ConnectionState = {
28
+ status: "idle";
29
+ } | {
30
+ status: "connecting";
31
+ attempt: number;
32
+ } | {
33
+ status: "connected";
34
+ } | {
35
+ status: "disconnected";
36
+ reason?: string;
37
+ } | {
38
+ status: "disposed";
39
+ };
40
+ export type DaemonEvent = {
41
+ type: "agent_update";
42
+ agentId: string;
43
+ payload: Extract<SessionOutboundMessage, {
44
+ type: "agent_update";
45
+ }>["payload"];
46
+ } | {
47
+ type: "workspace_update";
48
+ workspaceId: string;
49
+ payload: Extract<SessionOutboundMessage, {
50
+ type: "workspace_update";
51
+ }>["payload"];
52
+ } | {
53
+ type: "workspace_setup_progress";
54
+ workspaceId: string;
55
+ payload: Extract<SessionOutboundMessage, {
56
+ type: "workspace_setup_progress";
57
+ }>["payload"];
58
+ } | {
59
+ type: "agent_stream";
60
+ agentId: string;
61
+ event: AgentStreamEventPayload;
62
+ timestamp: string;
63
+ seq?: number;
64
+ epoch?: string;
65
+ } | {
66
+ type: "status";
67
+ payload: {
68
+ status: string;
69
+ } & Record<string, unknown>;
70
+ } | {
71
+ type: "agent_deleted";
72
+ agentId: string;
73
+ } | {
74
+ type: "agent_permission_request";
75
+ agentId: string;
76
+ request: AgentPermissionRequest;
77
+ } | {
78
+ type: "agent_permission_resolved";
79
+ agentId: string;
80
+ requestId: string;
81
+ resolution: AgentPermissionResponse;
82
+ } | {
83
+ type: "providers_snapshot_update";
84
+ payload: Extract<SessionOutboundMessage, {
85
+ type: "providers_snapshot_update";
86
+ }>["payload"];
87
+ } | {
88
+ type: "error";
89
+ message: string;
90
+ };
91
+ export type DaemonEventHandler = (event: DaemonEvent) => void;
92
+ export interface DaemonClientConfig {
93
+ url: string;
94
+ clientId: string;
95
+ clientType?: "mobile" | "browser" | "cli" | "mcp";
96
+ appVersion?: string;
97
+ runtimeGeneration?: number | null;
98
+ password?: string;
99
+ authHeader?: string;
100
+ suppressSendErrors?: boolean;
101
+ transportFactory?: DaemonTransportFactory;
102
+ webSocketFactory?: WebSocketFactory;
103
+ logger?: Logger;
104
+ connectTimeoutMs?: number;
105
+ e2ee?: {
106
+ enabled?: boolean;
107
+ daemonPublicKeyB64?: string;
108
+ };
109
+ reconnect?: {
110
+ enabled?: boolean;
111
+ baseDelayMs?: number;
112
+ maxDelayMs?: number;
113
+ };
114
+ runtimeMetricsIntervalMs?: number;
115
+ runtimeMetricsWindowMs?: number;
116
+ }
117
+ export interface SendMessageOptions {
118
+ messageId?: string;
119
+ images?: Array<{
120
+ data: string;
121
+ mimeType: string;
122
+ }>;
123
+ attachments?: SendAgentMessageRequest["attachments"];
124
+ }
125
+ type AgentConfigOverrides = Partial<Omit<AgentSessionConfig, "provider" | "cwd">>;
126
+ export interface CreateAgentRequestOptions extends AgentConfigOverrides {
127
+ config?: AgentSessionConfig;
128
+ provider?: AgentProvider;
129
+ cwd?: string;
130
+ env?: CreateAgentRequestMessage["env"];
131
+ workspaceId?: string;
132
+ initialPrompt?: string;
133
+ clientMessageId?: string;
134
+ outputSchema?: Record<string, unknown>;
135
+ images?: CreateAgentRequestMessage["images"];
136
+ attachments?: CreateAgentRequestMessage["attachments"];
137
+ git?: GitSetupOptions;
138
+ worktree?: CreateAgentRequestMessage["worktree"];
139
+ autoArchive?: CreateAgentRequestMessage["autoArchive"];
140
+ worktreeName?: string;
141
+ requestId?: string;
142
+ labels?: Record<string, string>;
143
+ }
144
+ export interface CreatePaseoWorktreeInput extends Pick<CreatePaseoWorktreeRequest, "cwd" | "projectId" | "worktreeSlug" | "firstAgentContext" | "refName" | "action" | "githubPrNumber"> {
145
+ }
146
+ type CheckoutStatusPayload = CheckoutStatusResponse["payload"];
147
+ type SubscribeCheckoutDiffPayload = Extract<SessionOutboundMessage, {
148
+ type: "subscribe_checkout_diff_response";
149
+ }>["payload"];
150
+ type CheckoutDiffPayload = Omit<SubscribeCheckoutDiffPayload, "subscriptionId">;
151
+ type CheckoutCommitPayload = CheckoutCommitResponse["payload"];
152
+ type CheckoutMergePayload = CheckoutMergeResponse["payload"];
153
+ type CheckoutMergeFromBasePayload = CheckoutMergeFromBaseResponse["payload"];
154
+ type CheckoutPullPayload = CheckoutPullResponse["payload"];
155
+ type CheckoutPushPayload = CheckoutPushResponse["payload"];
156
+ type CheckoutPrCreatePayload = CheckoutPrCreateResponse["payload"];
157
+ type CheckoutPrMergePayload = CheckoutPrMergeResponse["payload"];
158
+ type CheckoutGithubSetAutoMergePayload = CheckoutGithubSetAutoMergeResponse["payload"];
159
+ type CheckoutPrStatusPayload = CheckoutPrStatusResponse["payload"];
160
+ type PullRequestTimelinePayload = PullRequestTimelineResponse["payload"];
161
+ type CheckoutSwitchBranchPayload = CheckoutSwitchBranchResponse["payload"];
162
+ export type RenameBranchResult = z.infer<typeof CheckoutRenameBranchResponseSchema>["payload"];
163
+ type StashSavePayload = StashSaveResponse["payload"];
164
+ type StashPopPayload = StashPopResponse["payload"];
165
+ type StashListPayload = StashListResponse["payload"];
166
+ type ValidateBranchPayload = ValidateBranchResponse["payload"];
167
+ type BranchSuggestionsPayload = BranchSuggestionsResponse["payload"];
168
+ type GitHubSearchPayload = GitHubSearchResponse["payload"];
169
+ type DirectorySuggestionsPayload = DirectorySuggestionsResponse["payload"];
170
+ type PaseoWorktreeListPayload = PaseoWorktreeListResponse["payload"];
171
+ type PaseoWorktreeArchivePayload = PaseoWorktreeArchiveResponse["payload"];
172
+ type CreatePaseoWorktreePayload = Extract<SessionOutboundMessage, {
173
+ type: "create_paseo_worktree_response";
174
+ }>["payload"];
175
+ type FileExplorerPayload = FileExplorerResponse["payload"];
176
+ export type FileExplorerDirectoryPayload = NonNullable<FileExplorerPayload["directory"]>;
177
+ type LegacyFileExplorerFilePayload = NonNullable<FileExplorerPayload["file"]>;
178
+ export interface FileReadResult {
179
+ bytes: Uint8Array;
180
+ mime: string;
181
+ size: number;
182
+ path: string;
183
+ kind: LegacyFileExplorerFilePayload["kind"];
184
+ modifiedAt: string;
185
+ }
186
+ type FileDownloadTokenPayload = FileDownloadTokenResponse["payload"];
187
+ type ListProviderFeaturesPayload = ListProviderFeaturesResponseMessage["payload"];
188
+ type ListProviderModelsPayload = ListProviderModelsResponseMessage["payload"];
189
+ type ListProviderModesPayload = ListProviderModesResponseMessage["payload"];
190
+ type ListAvailableProvidersPayload = ListAvailableProvidersResponse["payload"];
191
+ type GetProvidersSnapshotPayload = GetProvidersSnapshotResponseMessage["payload"];
192
+ type RefreshProvidersSnapshotPayload = RefreshProvidersSnapshotResponseMessage["payload"];
193
+ type ProviderDiagnosticPayload = ProviderDiagnosticResponseMessage["payload"];
194
+ type DaemonStatusPayload = DaemonGetStatusResponse["payload"];
195
+ type DaemonPairingOfferPayload = DaemonGetPairingOfferResponse["payload"];
196
+ type ReadProjectConfigPayload = Extract<SessionOutboundMessage, {
197
+ type: "read_project_config_response";
198
+ }>["payload"];
199
+ type WriteProjectConfigPayload = Extract<SessionOutboundMessage, {
200
+ type: "write_project_config_response";
201
+ }>["payload"];
202
+ type ListCommandsPayload = ListCommandsResponse["payload"];
203
+ type ListCommandsDraftConfig = Pick<AgentSessionConfig, "provider" | "cwd" | "modeId" | "model" | "thinkingOptionId" | "featureValues">;
204
+ export interface WriteProjectConfigInput {
205
+ repoRoot: string;
206
+ config: PaseoConfigRaw;
207
+ expectedRevision: PaseoConfigRevision | null;
208
+ requestId?: string;
209
+ }
210
+ interface ListCommandsOptions {
211
+ requestId?: string;
212
+ draftConfig?: ListCommandsDraftConfig;
213
+ }
214
+ type SetVoiceModePayload = Extract<SessionOutboundMessage, {
215
+ type: "set_voice_mode_response";
216
+ }>["payload"];
217
+ type AgentPermissionResolvedPayload = AgentPermissionResolvedMessage["payload"];
218
+ type ListTerminalsPayload = ListTerminalsResponse["payload"];
219
+ type CreateTerminalPayload = CreateTerminalResponse["payload"];
220
+ export type RenameTerminalResult = z.infer<typeof RenameTerminalResponseSchema>["payload"];
221
+ type SubscribeTerminalPayload = SubscribeTerminalResponse["payload"];
222
+ type CloseItemsPayload = CloseItemsResponse["payload"];
223
+ type KillTerminalPayload = KillTerminalResponse["payload"];
224
+ type CaptureTerminalPayload = CaptureTerminalResponse["payload"];
225
+ type ChatCreatePayload = Extract<SessionOutboundMessage, {
226
+ type: "chat/create/response";
227
+ }>["payload"];
228
+ type ChatListPayload = Extract<SessionOutboundMessage, {
229
+ type: "chat/list/response";
230
+ }>["payload"];
231
+ type ChatInspectPayload = Extract<SessionOutboundMessage, {
232
+ type: "chat/inspect/response";
233
+ }>["payload"];
234
+ type ChatDeletePayload = Extract<SessionOutboundMessage, {
235
+ type: "chat/delete/response";
236
+ }>["payload"];
237
+ type ChatPostPayload = Extract<SessionOutboundMessage, {
238
+ type: "chat/post/response";
239
+ }>["payload"];
240
+ type ChatReadPayload = Extract<SessionOutboundMessage, {
241
+ type: "chat/read/response";
242
+ }>["payload"];
243
+ type ChatWaitPayload = Extract<SessionOutboundMessage, {
244
+ type: "chat/wait/response";
245
+ }>["payload"];
246
+ type LoopRunPayload = Extract<SessionOutboundMessage, {
247
+ type: "loop/run/response";
248
+ }>["payload"];
249
+ type LoopListPayload = Extract<SessionOutboundMessage, {
250
+ type: "loop/list/response";
251
+ }>["payload"];
252
+ type LoopInspectPayload = Extract<SessionOutboundMessage, {
253
+ type: "loop/inspect/response";
254
+ }>["payload"];
255
+ type LoopLogsPayload = Extract<SessionOutboundMessage, {
256
+ type: "loop/logs/response";
257
+ }>["payload"];
258
+ type LoopStopPayload = Extract<SessionOutboundMessage, {
259
+ type: "loop/stop/response";
260
+ }>["payload"];
261
+ type ScheduleCreatePayload = Extract<SessionOutboundMessage, {
262
+ type: "schedule/create/response";
263
+ }>["payload"];
264
+ type ScheduleListPayload = Extract<SessionOutboundMessage, {
265
+ type: "schedule/list/response";
266
+ }>["payload"];
267
+ type ScheduleInspectPayload = Extract<SessionOutboundMessage, {
268
+ type: "schedule/inspect/response";
269
+ }>["payload"];
270
+ type ScheduleLogsPayload = Extract<SessionOutboundMessage, {
271
+ type: "schedule/logs/response";
272
+ }>["payload"];
273
+ type SchedulePausePayload = Extract<SessionOutboundMessage, {
274
+ type: "schedule/pause/response";
275
+ }>["payload"];
276
+ type ScheduleResumePayload = Extract<SessionOutboundMessage, {
277
+ type: "schedule/resume/response";
278
+ }>["payload"];
279
+ type ScheduleDeletePayload = Extract<SessionOutboundMessage, {
280
+ type: "schedule/delete/response";
281
+ }>["payload"];
282
+ type ScheduleRunOncePayload = Extract<SessionOutboundMessage, {
283
+ type: "schedule/run-once/response";
284
+ }>["payload"];
285
+ type ScheduleUpdatePayload = Extract<SessionOutboundMessage, {
286
+ type: "schedule/update/response";
287
+ }>["payload"];
288
+ export type FetchAgentTimelinePayload = FetchAgentTimelineResponseMessage["payload"];
289
+ export type FetchAgentTimelineDirection = FetchAgentTimelinePayload["direction"];
290
+ export type FetchAgentTimelineProjection = FetchAgentTimelinePayload["projection"];
291
+ export type FetchAgentTimelineCursor = NonNullable<FetchAgentTimelinePayload["startCursor"]>;
292
+ export interface FetchAgentTimelineOptions {
293
+ direction?: FetchAgentTimelineDirection;
294
+ cursor?: FetchAgentTimelineCursor;
295
+ limit?: number;
296
+ projection?: FetchAgentTimelineProjection;
297
+ requestId?: string;
298
+ }
299
+ type AgentRefreshedStatusPayload = z.infer<typeof AgentRefreshedStatusPayloadSchema>;
300
+ type RestartRequestedStatusPayload = z.infer<typeof RestartRequestedStatusPayloadSchema>;
301
+ type ShutdownRequestedStatusPayload = z.infer<typeof ShutdownRequestedStatusPayloadSchema>;
302
+ type FetchAgentsPayload = Extract<SessionOutboundMessage, {
303
+ type: "fetch_agents_response";
304
+ }>["payload"];
305
+ type FetchAgentsRequest = Extract<SessionInboundMessage, {
306
+ type: "fetch_agents_request";
307
+ }>;
308
+ export type FetchAgentsOptions = Omit<FetchAgentsRequest, "type" | "requestId"> & {
309
+ requestId?: string;
310
+ };
311
+ export type FetchAgentsEntry = FetchAgentsPayload["entries"][number];
312
+ export type FetchAgentsPageInfo = FetchAgentsPayload["pageInfo"];
313
+ type FetchAgentHistoryPayload = Extract<SessionOutboundMessage, {
314
+ type: "fetch_agent_history_response";
315
+ }>["payload"];
316
+ type FetchAgentHistoryRequest = Extract<SessionInboundMessage, {
317
+ type: "fetch_agent_history_request";
318
+ }>;
319
+ export type FetchAgentHistoryOptions = Omit<FetchAgentHistoryRequest, "type" | "requestId"> & {
320
+ requestId?: string;
321
+ };
322
+ export type FetchAgentHistoryEntry = FetchAgentHistoryPayload["entries"][number];
323
+ export type FetchAgentHistoryPageInfo = FetchAgentHistoryPayload["pageInfo"];
324
+ type FetchRecentProviderSessionsPayload = Extract<SessionOutboundMessage, {
325
+ type: "fetch_recent_provider_sessions_response";
326
+ }>["payload"];
327
+ type FetchRecentProviderSessionsRequest = Extract<SessionInboundMessage, {
328
+ type: "fetch_recent_provider_sessions_request";
329
+ }>;
330
+ export type FetchRecentProviderSessionsOptions = Omit<FetchRecentProviderSessionsRequest, "type" | "requestId"> & {
331
+ requestId?: string;
332
+ };
333
+ export type FetchRecentProviderSessionEntry = FetchRecentProviderSessionsPayload["entries"][number];
334
+ type FetchWorkspacesPayload = Extract<SessionOutboundMessage, {
335
+ type: "fetch_workspaces_response";
336
+ }>["payload"];
337
+ type FetchWorkspacesRequest = Extract<SessionInboundMessage, {
338
+ type: "fetch_workspaces_request";
339
+ }>;
340
+ export type FetchWorkspacesOptions = Omit<FetchWorkspacesRequest, "type" | "requestId"> & {
341
+ requestId?: string;
342
+ };
343
+ export type FetchWorkspacesEntry = FetchWorkspacesPayload["entries"][number];
344
+ export type FetchWorkspacesPageInfo = FetchWorkspacesPayload["pageInfo"];
345
+ export interface CreateChatRoomOptions {
346
+ name: string;
347
+ purpose?: string | null;
348
+ requestId?: string;
349
+ }
350
+ export interface InspectChatRoomOptions {
351
+ room: string;
352
+ requestId?: string;
353
+ }
354
+ export interface DeleteChatRoomOptions {
355
+ room: string;
356
+ requestId?: string;
357
+ }
358
+ export interface PostChatMessageOptions {
359
+ room: string;
360
+ body: string;
361
+ authorAgentId?: string;
362
+ replyToMessageId?: string | null;
363
+ requestId?: string;
364
+ }
365
+ export interface ReadChatMessagesOptions {
366
+ room: string;
367
+ limit?: number;
368
+ since?: string;
369
+ authorAgentId?: string;
370
+ requestId?: string;
371
+ }
372
+ export interface WaitForChatMessagesOptions {
373
+ room: string;
374
+ afterMessageId?: string | null;
375
+ timeoutMs?: number;
376
+ requestId?: string;
377
+ }
378
+ export interface RunLoopOptions {
379
+ prompt: string;
380
+ cwd: string;
381
+ provider?: string;
382
+ model?: string;
383
+ modeId?: string;
384
+ verifierProvider?: string;
385
+ verifierModel?: string;
386
+ verifierModeId?: string;
387
+ verifyPrompt?: string | null;
388
+ verifyChecks?: string[];
389
+ name?: string | null;
390
+ sleepMs?: number;
391
+ maxIterations?: number;
392
+ maxTimeMs?: number;
393
+ requestId?: string;
394
+ }
395
+ export interface InspectLoopOptions {
396
+ id: string;
397
+ requestId?: string;
398
+ }
399
+ export interface LoopLogsOptions {
400
+ id: string;
401
+ afterSeq?: number;
402
+ requestId?: string;
403
+ }
404
+ export interface StopLoopOptions {
405
+ id: string;
406
+ requestId?: string;
407
+ }
408
+ export interface CreateScheduleOptions {
409
+ prompt: string;
410
+ name?: string | null;
411
+ cadence: {
412
+ type: "every";
413
+ everyMs: number;
414
+ } | {
415
+ type: "cron";
416
+ expression: string;
417
+ };
418
+ target: {
419
+ type: "self";
420
+ agentId: string;
421
+ } | {
422
+ type: "agent";
423
+ agentId: string;
424
+ } | {
425
+ type: "new-agent";
426
+ config: {
427
+ provider: AgentProvider;
428
+ cwd: string;
429
+ modeId?: string;
430
+ model?: string;
431
+ thinkingOptionId?: string;
432
+ title?: string | null;
433
+ approvalPolicy?: string;
434
+ sandboxMode?: string;
435
+ networkAccess?: boolean;
436
+ webSearch?: boolean;
437
+ extra?: AgentSessionConfig["extra"];
438
+ systemPrompt?: string;
439
+ mcpServers?: AgentSessionConfig["mcpServers"];
440
+ };
441
+ };
442
+ maxRuns?: number;
443
+ expiresAt?: string;
444
+ runOnCreate?: boolean;
445
+ requestId?: string;
446
+ }
447
+ export interface InspectScheduleOptions {
448
+ id: string;
449
+ requestId?: string;
450
+ }
451
+ export interface UpdateScheduleNewAgentConfig {
452
+ provider?: string;
453
+ model?: string | null;
454
+ modeId?: string | null;
455
+ cwd?: string;
456
+ }
457
+ export interface UpdateScheduleOptions {
458
+ id: string;
459
+ name?: string | null;
460
+ prompt?: string;
461
+ cadence?: {
462
+ type: "every";
463
+ everyMs: number;
464
+ } | {
465
+ type: "cron";
466
+ expression: string;
467
+ };
468
+ newAgentConfig?: UpdateScheduleNewAgentConfig;
469
+ maxRuns?: number | null;
470
+ expiresAt?: string | null;
471
+ requestId?: string;
472
+ }
473
+ export interface RenameBranchInput {
474
+ cwd: string;
475
+ branch: string;
476
+ requestId?: string;
477
+ }
478
+ export interface RenameTerminalInput {
479
+ terminalId: string;
480
+ title: string;
481
+ requestId?: string;
482
+ }
483
+ type ListAvailableEditorsPayload = ListAvailableEditorsResponseMessage["payload"];
484
+ type OpenInEditorPayload = OpenInEditorResponseMessage["payload"];
485
+ type OpenProjectPayload = OpenProjectResponseMessage["payload"];
486
+ type ArchiveWorkspacePayload = ArchiveWorkspaceResponseMessage["payload"];
487
+ type WorkspaceSetupStatusPayload = WorkspaceSetupStatusResponseMessage["payload"];
488
+ export type EditorTargetDescriptor = ListAvailableEditorsPayload["editors"][number];
489
+ export interface FetchAgentResult {
490
+ agent: AgentSnapshotPayload;
491
+ project: ProjectPlacementPayload | null;
492
+ }
493
+ export interface WaitForFinishResult {
494
+ status: "idle" | "error" | "permission" | "timeout";
495
+ final: AgentSnapshotPayload | null;
496
+ error: string | null;
497
+ lastMessage: string | null;
498
+ }
499
+ export declare class DaemonClient {
500
+ private config;
501
+ private transport;
502
+ private transportCleanup;
503
+ private rawMessageListeners;
504
+ private messageHandlers;
505
+ private eventListeners;
506
+ private waiters;
507
+ private checkoutStatusInFlight;
508
+ private connectionListeners;
509
+ private reconnectTimeout;
510
+ private connectTimeout;
511
+ private pendingGenericTransportErrorTimeout;
512
+ private reconnectAttempt;
513
+ private shouldReconnect;
514
+ private connectPromise;
515
+ private connectResolve;
516
+ private connectReject;
517
+ private lastErrorValue;
518
+ private connectionState;
519
+ private checkoutDiffSubscriptions;
520
+ private terminalDirectorySubscriptions;
521
+ private readonly terminalStreams;
522
+ private pendingBinaryFileReads;
523
+ private activeBinaryFileTransfers;
524
+ private completedBinaryFileReads;
525
+ private logger;
526
+ private pendingSendQueue;
527
+ private readonly logConnectionPath;
528
+ private readonly logServerId;
529
+ private readonly logClientIdHash;
530
+ private readonly logGeneration;
531
+ private lastServerInfoMessage;
532
+ private runtimeMetricsInterval;
533
+ private runtimeMetrics;
534
+ private livenessProbe;
535
+ private consecutiveLivenessFailures;
536
+ constructor(config: DaemonClientConfig);
537
+ connect(): Promise<void>;
538
+ private attemptConnect;
539
+ private resolveConnect;
540
+ private rejectConnect;
541
+ close(): Promise<void>;
542
+ ensureConnected(): void;
543
+ getConnectionState(): ConnectionState;
544
+ subscribeConnectionStatus(listener: (status: ConnectionState) => void): () => void;
545
+ get isConnected(): boolean;
546
+ get isConnecting(): boolean;
547
+ get lastError(): string | null;
548
+ subscribe(handler: DaemonEventHandler): () => void;
549
+ subscribeRawMessages(handler: (message: SessionOutboundMessage) => void): () => void;
550
+ on<TType extends SessionOutboundMessage["type"]>(type: TType, handler: (message: Extract<SessionOutboundMessage, {
551
+ type: TType;
552
+ }>) => void): () => void;
553
+ on(handler: DaemonEventHandler): () => void;
554
+ /**
555
+ * Send a session message. For fire-and-forget messages (heartbeats, etc.),
556
+ * failures are suppressed if `suppressSendErrors` is configured.
557
+ * For RPC methods that wait for responses, use `sendSessionMessageOrThrow` instead.
558
+ */
559
+ private sendSessionMessage;
560
+ private sendBinaryFrame;
561
+ /**
562
+ * Send a session message for RPC methods that create waiters.
563
+ * If the connection is still being established ("connecting"), the message
564
+ * is queued and will be sent once connected (or rejected after timeout).
565
+ * This prevents waiters from hanging forever when called during connection.
566
+ */
567
+ private sendSessionMessageOrThrow;
568
+ /**
569
+ * Flush pending send queue - called when connection is established.
570
+ */
571
+ private flushPendingSendQueue;
572
+ /**
573
+ * Reject all pending sends - called when connection fails or is closed.
574
+ */
575
+ private rejectPendingSendQueue;
576
+ private sendRequest;
577
+ private sendCorrelatedRequest;
578
+ private sendCorrelatedSessionRequest;
579
+ private sendNamespacedCorrelatedSessionRequest;
580
+ private sendSessionMessageStrict;
581
+ clearAgentAttention(agentId: string | string[]): Promise<void>;
582
+ sendHeartbeat(params: {
583
+ deviceType: "web" | "mobile";
584
+ focusedAgentId: string | null;
585
+ lastActivityAt: string;
586
+ appVisible: boolean;
587
+ appVisibilityChangedAt?: string;
588
+ }): void;
589
+ registerPushToken(token: string): void;
590
+ ping(params?: {
591
+ requestId?: string;
592
+ timeoutMs?: number;
593
+ }): Promise<{
594
+ requestId: string;
595
+ clientSentAt: number;
596
+ serverReceivedAt: number;
597
+ serverSentAt: number;
598
+ rttMs: number;
599
+ }>;
600
+ checkLiveness(params?: {
601
+ timeoutMs?: number;
602
+ }): Promise<{
603
+ rttMs: number;
604
+ }>;
605
+ fetchAgents(options?: FetchAgentsOptions): Promise<FetchAgentsPayload>;
606
+ fetchAgentHistory(options?: FetchAgentHistoryOptions): Promise<FetchAgentHistoryPayload>;
607
+ fetchRecentProviderSessions(options?: FetchRecentProviderSessionsOptions): Promise<FetchRecentProviderSessionsPayload>;
608
+ fetchWorkspaces(options?: FetchWorkspacesOptions): Promise<FetchWorkspacesPayload>;
609
+ openProject(cwd: string, requestId?: string): Promise<OpenProjectPayload>;
610
+ startWorkspaceScript(workspaceId: string, scriptName: string, requestId?: string): Promise<Extract<SessionOutboundMessage, {
611
+ type: "start_workspace_script_response";
612
+ }>["payload"]>;
613
+ listAvailableEditors(requestId?: string): Promise<ListAvailableEditorsPayload>;
614
+ openInEditor(path: string, editorId: EditorTargetId, requestId?: string): Promise<OpenInEditorPayload>;
615
+ archiveWorkspace(workspaceId: string, requestId?: string): Promise<ArchiveWorkspacePayload>;
616
+ fetchWorkspaceSetupStatus(workspaceId: string, requestId?: string): Promise<WorkspaceSetupStatusPayload>;
617
+ fetchAgent(agentId: string, requestId?: string): Promise<FetchAgentResult | null>;
618
+ private resubscribeCheckoutDiffSubscriptions;
619
+ private resubscribeTerminalDirectorySubscriptions;
620
+ createAgent(options: CreateAgentRequestOptions): Promise<AgentSnapshotPayload>;
621
+ deleteAgent(agentId: string): Promise<void>;
622
+ archiveAgent(agentId: string): Promise<{
623
+ archivedAt: string;
624
+ }>;
625
+ updateAgent(agentId: string, updates: {
626
+ name?: string;
627
+ labels?: Record<string, string>;
628
+ }): Promise<void>;
629
+ renameProject(projectId: string, customName: string | null, requestId?: string): Promise<{
630
+ customName: string | null;
631
+ }>;
632
+ resumeAgent(handle: AgentPersistenceHandle, overrides?: Partial<AgentSessionConfig>): Promise<AgentSnapshotPayload>;
633
+ importAgent(input: ImportAgentInput): Promise<AgentSnapshotPayload>;
634
+ refreshAgent(agentId: string, requestId?: string): Promise<AgentRefreshedStatusPayload>;
635
+ fetchAgentTimeline(agentId: string, options?: FetchAgentTimelineOptions): Promise<FetchAgentTimelinePayload>;
636
+ sendAgentMessage(agentId: string, text: string, options?: SendMessageOptions): Promise<void>;
637
+ sendMessage(agentId: string, text: string, options?: SendMessageOptions): Promise<void>;
638
+ rewindAgent(agentId: string, messageId: string, mode: "conversation" | "files" | "both"): Promise<AgentRewindResponseMessage["payload"]>;
639
+ cancelAgent(agentId: string): Promise<void>;
640
+ setAgentMode(agentId: string, modeId: string): Promise<void>;
641
+ setAgentModel(agentId: string, modelId: string | null): Promise<void>;
642
+ setAgentFeature(agentId: string, featureId: string, value: unknown): Promise<void>;
643
+ setAgentThinkingOption(agentId: string, thinkingOptionId: string | null): Promise<void>;
644
+ restartServer(reason?: string, requestId?: string): Promise<RestartRequestedStatusPayload>;
645
+ shutdownServer(requestId?: string): Promise<ShutdownRequestedStatusPayload>;
646
+ setVoiceMode(enabled: boolean, agentId?: string): Promise<SetVoiceModePayload>;
647
+ sendVoiceAudioChunk(audio: string, format: string, isLast?: boolean): Promise<void>;
648
+ startDictationStream(dictationId: string, format: string): Promise<void>;
649
+ sendDictationStreamChunk(dictationId: string, seq: number, audio: string, format: string): void;
650
+ finishDictationStream(dictationId: string, finalSeq: number): Promise<{
651
+ dictationId: string;
652
+ text: string;
653
+ }>;
654
+ cancelDictationStream(dictationId: string): void;
655
+ abortRequest(): Promise<void>;
656
+ audioPlayed(id: string): Promise<void>;
657
+ getCheckoutStatus(cwd: string, options?: {
658
+ requestId?: string;
659
+ }): Promise<CheckoutStatusPayload>;
660
+ private normalizeCheckoutDiffCompare;
661
+ getCheckoutDiff(cwd: string, compare: {
662
+ mode: "uncommitted" | "base";
663
+ baseRef?: string;
664
+ ignoreWhitespace?: boolean;
665
+ }, requestId?: string): Promise<CheckoutDiffPayload>;
666
+ subscribeCheckoutDiff(cwd: string, compare: {
667
+ mode: "uncommitted" | "base";
668
+ baseRef?: string;
669
+ ignoreWhitespace?: boolean;
670
+ }, options?: {
671
+ subscriptionId?: string;
672
+ requestId?: string;
673
+ }): Promise<SubscribeCheckoutDiffPayload>;
674
+ unsubscribeCheckoutDiff(subscriptionId: string): void;
675
+ checkoutCommit(cwd: string, input: {
676
+ message?: string;
677
+ addAll?: boolean;
678
+ }, requestId?: string): Promise<CheckoutCommitPayload>;
679
+ checkoutMerge(cwd: string, input: {
680
+ baseRef?: string;
681
+ strategy?: "merge" | "squash";
682
+ requireCleanTarget?: boolean;
683
+ }, requestId?: string): Promise<CheckoutMergePayload>;
684
+ checkoutMergeFromBase(cwd: string, input: {
685
+ baseRef?: string;
686
+ requireCleanTarget?: boolean;
687
+ }, requestId?: string): Promise<CheckoutMergeFromBasePayload>;
688
+ checkoutPull(cwd: string, requestId?: string): Promise<CheckoutPullPayload>;
689
+ checkoutPush(cwd: string, requestId?: string): Promise<CheckoutPushPayload>;
690
+ checkoutPrCreate(cwd: string, input: {
691
+ title?: string;
692
+ body?: string;
693
+ baseRef?: string;
694
+ }, requestId?: string): Promise<CheckoutPrCreatePayload>;
695
+ checkoutPrMerge(cwd: string, input: {
696
+ method: CheckoutPrMergeMethod;
697
+ }, requestId?: string): Promise<CheckoutPrMergePayload>;
698
+ checkoutGithubSetAutoMerge(cwd: string, input: {
699
+ enabled: true;
700
+ method: CheckoutPrMergeMethod;
701
+ } | {
702
+ enabled: false;
703
+ }, requestId?: string): Promise<CheckoutGithubSetAutoMergePayload>;
704
+ checkoutPrStatus(cwd: string, requestId?: string): Promise<CheckoutPrStatusPayload>;
705
+ pullRequestTimeline(input: {
706
+ cwd: string;
707
+ prNumber: number;
708
+ repoOwner: string;
709
+ repoName: string;
710
+ }, requestId?: string): Promise<PullRequestTimelinePayload>;
711
+ checkoutSwitchBranch(cwd: string, branch: string, requestId?: string): Promise<CheckoutSwitchBranchPayload>;
712
+ renameBranch(input: RenameBranchInput): Promise<RenameBranchResult>;
713
+ stashSave(cwd: string, options?: {
714
+ branch?: string;
715
+ }, requestId?: string): Promise<StashSavePayload>;
716
+ stashPop(cwd: string, stashIndex: number, requestId?: string): Promise<StashPopPayload>;
717
+ stashList(cwd: string, options?: {
718
+ paseoOnly?: boolean;
719
+ }, requestId?: string): Promise<StashListPayload>;
720
+ getPaseoWorktreeList(input: {
721
+ cwd?: string;
722
+ repoRoot?: string;
723
+ }, requestId?: string): Promise<PaseoWorktreeListPayload>;
724
+ archivePaseoWorktree(input: {
725
+ worktreePath?: string;
726
+ repoRoot?: string;
727
+ branchName?: string;
728
+ }, requestId?: string): Promise<PaseoWorktreeArchivePayload>;
729
+ createPaseoWorktree(input: CreatePaseoWorktreeInput, requestId?: string): Promise<CreatePaseoWorktreePayload>;
730
+ validateBranch(options: {
731
+ cwd: string;
732
+ branchName: string;
733
+ }, requestId?: string): Promise<ValidateBranchPayload>;
734
+ getBranchSuggestions(options: {
735
+ cwd: string;
736
+ query?: string;
737
+ limit?: number;
738
+ }, requestId?: string): Promise<BranchSuggestionsPayload>;
739
+ searchGitHub(options: {
740
+ cwd: string;
741
+ query: string;
742
+ limit?: number;
743
+ kinds?: GitHubSearchRequest["kinds"];
744
+ }, requestId?: string): Promise<GitHubSearchPayload>;
745
+ getDirectorySuggestions(options: {
746
+ query: string;
747
+ limit?: number;
748
+ cwd?: string;
749
+ includeFiles?: boolean;
750
+ includeDirectories?: boolean;
751
+ matchMode?: "fuzzy" | "suffix";
752
+ }, requestId?: string): Promise<DirectorySuggestionsPayload>;
753
+ private requestFileExplorer;
754
+ listDirectory(cwd: string, path: string, requestId?: string): Promise<FileExplorerDirectoryPayload>;
755
+ readFile(cwd: string, path: string, requestId?: string): Promise<FileReadResult>;
756
+ requestDownloadToken(cwd: string, path: string, requestId?: string): Promise<FileDownloadTokenPayload>;
757
+ requestProjectIcon(cwd: string, requestId?: string): Promise<ProjectIconResponse["payload"]>;
758
+ listProviderModels(provider: AgentProvider, options?: {
759
+ cwd?: string;
760
+ requestId?: string;
761
+ }): Promise<ListProviderModelsPayload>;
762
+ listProviderModes(provider: AgentProvider, options?: {
763
+ cwd?: string;
764
+ requestId?: string;
765
+ }): Promise<ListProviderModesPayload>;
766
+ listProviderFeatures(draftConfig: ListCommandsDraftConfig, options?: {
767
+ requestId?: string;
768
+ }): Promise<ListProviderFeaturesPayload>;
769
+ listAvailableProviders(options?: {
770
+ requestId?: string;
771
+ }): Promise<ListAvailableProvidersPayload>;
772
+ getProvidersSnapshot(options?: {
773
+ cwd?: string;
774
+ requestId?: string;
775
+ }): Promise<GetProvidersSnapshotPayload>;
776
+ getDaemonConfig(requestId?: string): Promise<{
777
+ requestId: string;
778
+ config: MutableDaemonConfig;
779
+ }>;
780
+ getDaemonStatus(requestId?: string): Promise<DaemonStatusPayload>;
781
+ getDaemonPairingOffer(requestId?: string): Promise<DaemonPairingOfferPayload>;
782
+ patchDaemonConfig(config: MutableDaemonConfigPatch, requestId?: string): Promise<{
783
+ requestId: string;
784
+ config: MutableDaemonConfig;
785
+ }>;
786
+ readProjectConfig(repoRoot: string, requestId?: string): Promise<ReadProjectConfigPayload>;
787
+ writeProjectConfig(input: WriteProjectConfigInput): Promise<WriteProjectConfigPayload>;
788
+ refreshProvidersSnapshot(options?: {
789
+ cwd?: string;
790
+ providers?: AgentProvider[];
791
+ requestId?: string;
792
+ }): Promise<RefreshProvidersSnapshotPayload>;
793
+ getProviderDiagnostic(provider: AgentProvider, options?: {
794
+ requestId?: string;
795
+ }): Promise<ProviderDiagnosticPayload>;
796
+ listCommands(agentId: string, requestId?: string): Promise<ListCommandsPayload>;
797
+ listCommands(agentId: string, options?: ListCommandsOptions): Promise<ListCommandsPayload>;
798
+ respondToPermission(agentId: string, requestId: string, response: AgentPermissionResponse): Promise<void>;
799
+ respondToPermissionAndWait(agentId: string, requestId: string, response: AgentPermissionResponse, timeout?: number): Promise<AgentPermissionResolvedPayload>;
800
+ waitForAgentUpsert(agentId: string, predicate: (snapshot: AgentSnapshotPayload) => boolean, timeout?: number): Promise<AgentSnapshotPayload>;
801
+ waitForFinish(agentId: string, timeout?: number): Promise<WaitForFinishResult>;
802
+ subscribeTerminals(input: {
803
+ cwd: string;
804
+ }): void;
805
+ unsubscribeTerminals(input: {
806
+ cwd: string;
807
+ }): void;
808
+ listTerminals(cwd?: string, requestId?: string): Promise<ListTerminalsPayload>;
809
+ createTerminal(cwd: string, name?: string, requestId?: string, options?: {
810
+ agentId?: string;
811
+ command?: string;
812
+ args?: string[];
813
+ }): Promise<CreateTerminalPayload>;
814
+ renameTerminal(input: RenameTerminalInput): Promise<RenameTerminalResult>;
815
+ subscribeTerminal(terminalId: string, optionsOrRequestId?: {
816
+ restore?: SubscribeTerminalRequest["restore"];
817
+ requestId?: string;
818
+ } | string): Promise<SubscribeTerminalPayload>;
819
+ unsubscribeTerminal(terminalId: string): void;
820
+ sendTerminalInput(terminalId: string, message: TerminalInput["message"]): void;
821
+ killTerminal(terminalId: string, requestId?: string): Promise<KillTerminalPayload>;
822
+ closeItems(input: {
823
+ agentIds?: string[];
824
+ terminalIds?: string[];
825
+ }, requestId?: string): Promise<CloseItemsPayload>;
826
+ captureTerminal(terminalId: string, options?: {
827
+ start?: number;
828
+ end?: number;
829
+ stripAnsi?: boolean;
830
+ }, requestId?: string): Promise<CaptureTerminalPayload>;
831
+ createChatRoom(options: CreateChatRoomOptions): Promise<ChatCreatePayload>;
832
+ listChatRooms(requestId?: string): Promise<ChatListPayload>;
833
+ inspectChatRoom(options: InspectChatRoomOptions): Promise<ChatInspectPayload>;
834
+ deleteChatRoom(options: DeleteChatRoomOptions): Promise<ChatDeletePayload>;
835
+ postChatMessage(options: PostChatMessageOptions): Promise<ChatPostPayload>;
836
+ readChatMessages(options: ReadChatMessagesOptions): Promise<ChatReadPayload>;
837
+ waitForChatMessages(options: WaitForChatMessagesOptions): Promise<ChatWaitPayload>;
838
+ scheduleCreate(options: CreateScheduleOptions): Promise<ScheduleCreatePayload>;
839
+ scheduleList(requestId?: string): Promise<ScheduleListPayload>;
840
+ scheduleInspect(options: InspectScheduleOptions): Promise<ScheduleInspectPayload>;
841
+ scheduleLogs(options: InspectScheduleOptions): Promise<ScheduleLogsPayload>;
842
+ schedulePause(options: InspectScheduleOptions): Promise<SchedulePausePayload>;
843
+ scheduleResume(options: InspectScheduleOptions): Promise<ScheduleResumePayload>;
844
+ scheduleDelete(options: InspectScheduleOptions): Promise<ScheduleDeletePayload>;
845
+ scheduleRunOnce(options: InspectScheduleOptions): Promise<ScheduleRunOncePayload>;
846
+ scheduleUpdate(options: UpdateScheduleOptions): Promise<ScheduleUpdatePayload>;
847
+ loopRun(options: RunLoopOptions): Promise<LoopRunPayload>;
848
+ loopList(requestId?: string): Promise<LoopListPayload>;
849
+ loopInspect(options: string | InspectLoopOptions): Promise<LoopInspectPayload>;
850
+ loopLogs(options: string | LoopLogsOptions, afterSeq?: number): Promise<LoopLogsPayload>;
851
+ loopStop(options: string | StopLoopOptions): Promise<LoopStopPayload>;
852
+ onTerminalStreamEvent(handler: (event: TerminalStreamEvent) => void): () => void;
853
+ waitForTerminalStreamEvent(predicate: (event: TerminalStreamEvent) => boolean, timeout?: number): Promise<TerminalStreamEvent>;
854
+ private createRequestId;
855
+ getLastServerInfoMessage(): ServerInfoStatusPayload | null;
856
+ private resolveTransportUrlForAttempt;
857
+ private sendHelloMessage;
858
+ private disposeTransport;
859
+ private cleanupTransport;
860
+ private resetConnectTimeout;
861
+ private handleTransportMessage;
862
+ private handleJsonPayload;
863
+ private tryHandleBinaryFrame;
864
+ private handleFileTransferFrame;
865
+ private updateConnectionState;
866
+ setReconnectEnabled(enabled: boolean): void;
867
+ private scheduleReconnect;
868
+ private emitDisconnectedStateForReconnect;
869
+ private armReconnectTimer;
870
+ private resolveLivenessProbe;
871
+ private clearLivenessProbe;
872
+ private rejectLivenessProbe;
873
+ private recordLivenessFailure;
874
+ private handleSessionMessage;
875
+ private resolveWaiters;
876
+ private clearWaiters;
877
+ private toEvent;
878
+ private waitForWithCancel;
879
+ }
880
+ //# sourceMappingURL=daemon-client.d.ts.map