@getpaseo/client 0.1.100 → 0.1.102-beta.2

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.
@@ -1,6 +1,6 @@
1
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, FileUploadResponse, FileExplorerResponse, FetchAgentTimelineResponseMessage, 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, AgentRewindResponseMessage, ListTerminalsResponse, CreateTerminalResponse, SubscribeTerminalResponse, SubscribeTerminalRequest, CloseItemsResponse, KillTerminalResponse, CaptureTerminalResponse, TerminalInput, SessionInboundMessage, SessionOutboundMessage, SendAgentMessageRequest, PaseoConfigRaw, PaseoConfigRevision, WorkspaceCreateRequest } from "@getpaseo/protocol/messages";
2
+ import { AgentRefreshedStatusPayloadSchema, CheckoutRenameBranchResponseSchema, RenameTerminalResponseSchema, RestartRequestedStatusPayloadSchema, ShutdownRequestedStatusPayloadSchema, DaemonUpdateResponseSchema, type ServerInfoStatusPayload } from "@getpaseo/protocol/messages";
3
+ import type { AgentStreamEventPayload, AgentSnapshotPayload, ProjectPlacementPayload, AgentPermissionResolvedMessage, CreateAgentRequestMessage, CreatePaseoWorktreeRequest, FileDownloadTokenResponse, FileUploadResponse, 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, WorkspaceCreateRequest } from "@getpaseo/protocol/messages";
4
4
  import type { AgentPermissionRequest, AgentPermissionResponse, AgentPersistenceHandle, AgentProviderNotice, AgentProvider, AgentSessionConfig } from "@getpaseo/protocol/agent-types";
5
5
  import type { MutableDaemonConfig, MutableDaemonConfigPatch } from "@getpaseo/protocol/messages";
6
6
  import { type DaemonTransportFactory, type WebSocketFactory } from "./daemon-client-transport.js";
@@ -208,6 +208,7 @@ type ProviderDiagnosticPayload = ProviderDiagnosticResponseMessage["payload"];
208
208
  type ProviderUsageListPayload = ProviderUsageListResponseMessage["payload"];
209
209
  type DaemonStatusPayload = DaemonGetStatusResponse["payload"];
210
210
  type DaemonPairingOfferPayload = DaemonGetPairingOfferResponse["payload"];
211
+ type DiagnosticsPayload = DiagnosticsResponse["payload"];
211
212
  type ReadProjectConfigPayload = Extract<SessionOutboundMessage, {
212
213
  type: "read_project_config_response";
213
214
  }>["payload"];
@@ -223,9 +224,11 @@ export interface WriteProjectConfigInput {
223
224
  requestId?: string;
224
225
  }
225
226
  interface ListCommandsOptions {
227
+ agentId: string;
226
228
  requestId?: string;
227
229
  draftConfig?: ListCommandsDraftConfig;
228
230
  }
231
+ type LegacyListCommandsOptions = Omit<ListCommandsOptions, "agentId">;
229
232
  type SetVoiceModePayload = Extract<SessionOutboundMessage, {
230
233
  type: "set_voice_mode_response";
231
234
  }>["payload"];
@@ -301,19 +304,44 @@ type ScheduleUpdatePayload = Extract<SessionOutboundMessage, {
301
304
  type: "schedule/update/response";
302
305
  }>["payload"];
303
306
  export type FetchAgentTimelinePayload = FetchAgentTimelineResponseMessage["payload"];
307
+ export type AgentForkContextPayload = AgentForkContextResponseMessage["payload"];
304
308
  export type FetchAgentTimelineDirection = FetchAgentTimelinePayload["direction"];
305
309
  export type FetchAgentTimelineProjection = FetchAgentTimelinePayload["projection"];
306
310
  export type FetchAgentTimelineCursor = NonNullable<FetchAgentTimelinePayload["startCursor"]>;
311
+ export interface FetchAgentOptions {
312
+ agentId: string;
313
+ requestId?: string;
314
+ timeout?: number;
315
+ }
316
+ type LegacyFetchAgentOptions = Omit<FetchAgentOptions, "agentId">;
307
317
  export interface FetchAgentTimelineOptions {
308
318
  direction?: FetchAgentTimelineDirection;
309
319
  cursor?: FetchAgentTimelineCursor;
310
320
  limit?: number;
311
321
  projection?: FetchAgentTimelineProjection;
312
322
  requestId?: string;
323
+ timeout?: number;
324
+ }
325
+ export interface AgentForkContextOptions {
326
+ boundaryMessageId?: string;
327
+ requestId?: string;
313
328
  }
314
329
  type AgentRefreshedStatusPayload = z.infer<typeof AgentRefreshedStatusPayloadSchema>;
315
330
  type RestartRequestedStatusPayload = z.infer<typeof RestartRequestedStatusPayloadSchema>;
316
331
  type ShutdownRequestedStatusPayload = z.infer<typeof ShutdownRequestedStatusPayloadSchema>;
332
+ export interface ShutdownServerOptions {
333
+ requestId?: string;
334
+ timeout?: number;
335
+ }
336
+ export interface DaemonStatusOptions {
337
+ requestId?: string;
338
+ timeout?: number;
339
+ }
340
+ export interface DaemonPairingOfferOptions {
341
+ requestId?: string;
342
+ timeout?: number;
343
+ }
344
+ type DaemonUpdateResponse = z.infer<typeof DaemonUpdateResponseSchema>;
317
345
  type FetchAgentsPayload = Extract<SessionOutboundMessage, {
318
346
  type: "fetch_agents_response";
319
347
  }>["payload"];
@@ -322,6 +350,7 @@ type FetchAgentsRequest = Extract<SessionInboundMessage, {
322
350
  }>;
323
351
  export type FetchAgentsOptions = Omit<FetchAgentsRequest, "type" | "requestId"> & {
324
352
  requestId?: string;
353
+ timeout?: number;
325
354
  };
326
355
  export type FetchAgentsEntry = FetchAgentsPayload["entries"][number];
327
356
  export type FetchAgentsPageInfo = FetchAgentsPayload["pageInfo"];
@@ -383,6 +412,7 @@ export interface ReadChatMessagesOptions {
383
412
  since?: string;
384
413
  authorAgentId?: string;
385
414
  requestId?: string;
415
+ timeout?: number;
386
416
  }
387
417
  export interface WaitForChatMessagesOptions {
388
418
  room: string;
@@ -636,7 +666,9 @@ export declare class DaemonClient {
636
666
  }>["payload"]>;
637
667
  archiveWorkspace(workspaceId: string, requestId?: string): Promise<ArchiveWorkspacePayload>;
638
668
  fetchWorkspaceSetupStatus(workspaceId: string, requestId?: string): Promise<WorkspaceSetupStatusPayload>;
669
+ fetchAgent(options: FetchAgentOptions): Promise<FetchAgentResult | null>;
639
670
  fetchAgent(agentId: string, requestId?: string): Promise<FetchAgentResult | null>;
671
+ fetchAgent(agentId: string, options?: LegacyFetchAgentOptions): Promise<FetchAgentResult | null>;
640
672
  private resubscribeCheckoutDiffSubscriptions;
641
673
  private resubscribeTerminalDirectorySubscriptions;
642
674
  createAgent(options: CreateAgentRequestOptions): Promise<AgentSnapshotPayload>;
@@ -662,6 +694,7 @@ export declare class DaemonClient {
662
694
  importAgent(input: ImportAgentInput): Promise<AgentSnapshotPayload>;
663
695
  refreshAgent(agentId: string, requestId?: string): Promise<AgentRefreshedStatusPayload>;
664
696
  fetchAgentTimeline(agentId: string, options?: FetchAgentTimelineOptions): Promise<FetchAgentTimelinePayload>;
697
+ buildAgentForkContext(agentId: string, options?: AgentForkContextOptions): Promise<AgentForkContextPayload>;
665
698
  sendAgentMessage(agentId: string, text: string, options?: SendMessageOptions): Promise<void>;
666
699
  sendMessage(agentId: string, text: string, options?: SendMessageOptions): Promise<void>;
667
700
  rewindAgent(agentId: string, messageId: string, mode: "conversation" | "files" | "both"): Promise<AgentRewindResponseMessage["payload"]>;
@@ -671,7 +704,8 @@ export declare class DaemonClient {
671
704
  setAgentFeature(agentId: string, featureId: string, value: unknown): Promise<void>;
672
705
  setAgentThinkingOption(agentId: string, thinkingOptionId: string | null): Promise<AgentProviderNotice | null>;
673
706
  restartServer(reason?: string, requestId?: string): Promise<RestartRequestedStatusPayload>;
674
- shutdownServer(requestId?: string): Promise<ShutdownRequestedStatusPayload>;
707
+ shutdownServer(options?: ShutdownServerOptions): Promise<ShutdownRequestedStatusPayload>;
708
+ updateDaemon(requestId?: string): Promise<DaemonUpdateResponse["payload"]>;
675
709
  setVoiceMode(enabled: boolean, agentId?: string): Promise<SetVoiceModePayload>;
676
710
  sendVoiceAudioChunk(audio: string, format: string, isLast?: boolean): Promise<void>;
677
711
  startDictationStream(dictationId: string, format: string): Promise<void>;
@@ -822,8 +856,9 @@ export declare class DaemonClient {
822
856
  requestId: string;
823
857
  config: MutableDaemonConfig;
824
858
  }>;
825
- getDaemonStatus(requestId?: string): Promise<DaemonStatusPayload>;
826
- getDaemonPairingOffer(requestId?: string): Promise<DaemonPairingOfferPayload>;
859
+ getDaemonStatus(options?: DaemonStatusOptions): Promise<DaemonStatusPayload>;
860
+ getDaemonPairingOffer(options?: DaemonPairingOfferOptions): Promise<DaemonPairingOfferPayload>;
861
+ collectDiagnostics(requestId?: string): Promise<DiagnosticsPayload>;
827
862
  patchDaemonConfig(config: MutableDaemonConfigPatch, requestId?: string): Promise<{
828
863
  requestId: string;
829
864
  config: MutableDaemonConfig;
@@ -841,8 +876,9 @@ export declare class DaemonClient {
841
876
  listProviderUsage(options?: {
842
877
  requestId?: string;
843
878
  }): Promise<ProviderUsageListPayload>;
879
+ listCommands(options: ListCommandsOptions): Promise<ListCommandsPayload>;
844
880
  listCommands(agentId: string, requestId?: string): Promise<ListCommandsPayload>;
845
- listCommands(agentId: string, options?: ListCommandsOptions): Promise<ListCommandsPayload>;
881
+ listCommands(agentId: string, options?: LegacyListCommandsOptions): Promise<ListCommandsPayload>;
846
882
  respondToPermission(agentId: string, requestId: string, response: AgentPermissionResponse): Promise<void>;
847
883
  respondToPermissionAndWait(agentId: string, requestId: string, response: AgentPermissionResponse, timeout?: number): Promise<AgentPermissionResolvedPayload>;
848
884
  waitForAgentUpsert(agentId: string, predicate: (snapshot: AgentSnapshotPayload) => boolean, timeout?: number): Promise<AgentSnapshotPayload>;
@@ -1,5 +1,5 @@
1
1
  import { CLIENT_CAPS } from "@getpaseo/protocol/client-capabilities";
2
- import { AgentCreateFailedStatusPayloadSchema, AgentCreatedStatusPayloadSchema, AgentRefreshedStatusPayloadSchema, AgentResumedStatusPayloadSchema, parseServerInfoStatusPayload, RestartRequestedStatusPayloadSchema, ShutdownRequestedStatusPayloadSchema, SessionInboundMessageSchema, WSOutboundMessageSchema, } from "@getpaseo/protocol/messages";
2
+ import { AgentCreateFailedStatusPayloadSchema, AgentCreatedStatusPayloadSchema, AgentRefreshedStatusPayloadSchema, AgentResumedStatusPayloadSchema, parseServerInfoStatusPayload, RestartRequestedStatusPayloadSchema, ShutdownRequestedStatusPayloadSchema, DaemonUpdateResponseSchema, SessionInboundMessageSchema, WSOutboundMessageSchema, } from "@getpaseo/protocol/messages";
3
3
  import { isRelayClientWebSocketUrl } from "@getpaseo/protocol/daemon-endpoints";
4
4
  import { terminalSubscriptionKey } from "@getpaseo/protocol/terminal-subscription-key";
5
5
  import { asUint8Array, decodeFileTransferFrame, encodeFileTransferFrame, decodeTerminalStreamFrame, FileTransferOpcode, TerminalStreamOpcode, } from "@getpaseo/protocol/binary-frames/index";
@@ -21,6 +21,26 @@ function normalizePassword(value) {
21
21
  }
22
22
  return value.length > 0 ? value : null;
23
23
  }
24
+ // COMPAT(daemon-client-object-options): added in v0.1.102; remove after
25
+ // 2026-12-29 once SDK callers have migrated to object parameters.
26
+ function normalizeFetchAgentOptions(input, legacyOptions) {
27
+ if (typeof input !== "string") {
28
+ return input;
29
+ }
30
+ if (typeof legacyOptions === "string") {
31
+ return { agentId: input, requestId: legacyOptions };
32
+ }
33
+ return { agentId: input, ...legacyOptions };
34
+ }
35
+ function normalizeListCommandsOptions(input, legacyOptions) {
36
+ if (typeof input !== "string") {
37
+ return input;
38
+ }
39
+ if (typeof legacyOptions === "string") {
40
+ return { agentId: input, requestId: legacyOptions };
41
+ }
42
+ return { agentId: input, ...legacyOptions };
43
+ }
24
44
  class DaemonRpcError extends Error {
25
45
  constructor(params) {
26
46
  const parts = [params.error];
@@ -50,14 +70,15 @@ function toTimeoutError(error, label, timeoutMs) {
50
70
  }
51
71
  const DEFAULT_RECONNECT_BASE_DELAY_MS = 1500;
52
72
  const DEFAULT_RECONNECT_MAX_DELAY_MS = 30000;
73
+ const DEFAULT_SESSION_RPC_TIMEOUT_MS = 60000;
53
74
  const DEFAULT_CONNECT_TIMEOUT_MS = 15000;
54
75
  const DEFAULT_LIVENESS_TIMEOUT_MS = 5000;
55
76
  const LIVENESS_HEARTBEAT_INTERVAL_MS = 10000;
56
77
  const LIVENESS_HEARTBEAT_TIMEOUT_MS = 15000;
57
78
  const LIVENESS_FAILURE_RECONNECT_THRESHOLD = 2;
58
79
  /** Default timeout for waiting for connection before sending queued messages */
59
- const DEFAULT_SEND_QUEUE_TIMEOUT_MS = 10000;
60
- const DEFAULT_DICTATION_FINISH_ACCEPT_TIMEOUT_MS = 15000;
80
+ const DEFAULT_SEND_QUEUE_TIMEOUT_MS = DEFAULT_SESSION_RPC_TIMEOUT_MS;
81
+ const DEFAULT_DICTATION_FINISH_ACCEPT_TIMEOUT_MS = DEFAULT_SESSION_RPC_TIMEOUT_MS;
61
82
  const DEFAULT_DICTATION_FINISH_FALLBACK_TIMEOUT_MS = 5 * 60 * 1000;
62
83
  const DEFAULT_DICTATION_FINISH_TIMEOUT_GRACE_MS = 5000;
63
84
  function isWaiterTimeoutError(error) {
@@ -603,6 +624,7 @@ export class DaemonClient {
603
624
  }
604
625
  }
605
626
  async sendRequest(params) {
627
+ const timeout = params.timeout ?? DEFAULT_SESSION_RPC_TIMEOUT_MS;
606
628
  const { promise, cancel } = this.waitForWithCancel((msg) => {
607
629
  if (msg.type === "rpc_error" && msg.payload.requestId === params.requestId) {
608
630
  return {
@@ -620,7 +642,7 @@ export class DaemonClient {
620
642
  return null;
621
643
  }
622
644
  return { kind: "ok", value };
623
- }, params.timeout, params.options);
645
+ }, timeout, params.options);
624
646
  try {
625
647
  await this.sendSessionMessageOrThrow(params.message);
626
648
  }
@@ -702,7 +724,6 @@ export class DaemonClient {
702
724
  await this.sendRequest({
703
725
  requestId,
704
726
  message,
705
- timeout: 15000,
706
727
  options: { skipQueue: true },
707
728
  select: (msg) => {
708
729
  if (msg.type !== "clear_agent_attention_response") {
@@ -725,7 +746,6 @@ export class DaemonClient {
725
746
  const response = await this.sendRequest({
726
747
  requestId,
727
748
  message,
728
- timeout: 15000,
729
749
  options: { skipQueue: true },
730
750
  select: (msg) => {
731
751
  if (msg.type !== "workspace.clear_attention.response") {
@@ -891,7 +911,7 @@ export class DaemonClient {
891
911
  return this.sendRequest({
892
912
  requestId: resolvedRequestId,
893
913
  message,
894
- timeout: 10000,
914
+ timeout: options?.timeout,
895
915
  options: { skipQueue: true },
896
916
  select: (msg) => {
897
917
  if (msg.type !== "fetch_agents_response") {
@@ -916,7 +936,6 @@ export class DaemonClient {
916
936
  return this.sendRequest({
917
937
  requestId: resolvedRequestId,
918
938
  message,
919
- timeout: 10000,
920
939
  options: { skipQueue: true },
921
940
  select: (msg) => {
922
941
  if (msg.type !== "fetch_agent_history_response") {
@@ -942,7 +961,6 @@ export class DaemonClient {
942
961
  return this.sendRequest({
943
962
  requestId: resolvedRequestId,
944
963
  message,
945
- timeout: 10000,
946
964
  options: { skipQueue: true },
947
965
  select: (msg) => {
948
966
  if (msg.type !== "fetch_recent_provider_sessions_response") {
@@ -968,7 +986,6 @@ export class DaemonClient {
968
986
  return this.sendRequest({
969
987
  requestId: resolvedRequestId,
970
988
  message,
971
- timeout: 10000,
972
989
  options: { skipQueue: true },
973
990
  select: (msg) => {
974
991
  if (msg.type !== "fetch_workspaces_response") {
@@ -989,7 +1006,6 @@ export class DaemonClient {
989
1006
  cwd,
990
1007
  },
991
1008
  responseType: "open_project_response",
992
- timeout: 10000,
993
1009
  });
994
1010
  }
995
1011
  async addProject(cwd, requestId) {
@@ -1000,7 +1016,6 @@ export class DaemonClient {
1000
1016
  cwd,
1001
1017
  },
1002
1018
  responseType: "project.add.response",
1003
- timeout: 10000,
1004
1019
  });
1005
1020
  }
1006
1021
  async startWorkspaceScript(workspaceId, scriptName, requestId) {
@@ -1012,7 +1027,6 @@ export class DaemonClient {
1012
1027
  scriptName,
1013
1028
  },
1014
1029
  responseType: "start_workspace_script_response",
1015
- timeout: 10000,
1016
1030
  });
1017
1031
  }
1018
1032
  async archiveWorkspace(workspaceId, requestId) {
@@ -1023,7 +1037,6 @@ export class DaemonClient {
1023
1037
  workspaceId,
1024
1038
  },
1025
1039
  responseType: "archive_workspace_response",
1026
- timeout: 10000,
1027
1040
  });
1028
1041
  }
1029
1042
  async fetchWorkspaceSetupStatus(workspaceId, requestId) {
@@ -1034,20 +1047,20 @@ export class DaemonClient {
1034
1047
  workspaceId,
1035
1048
  },
1036
1049
  responseType: "workspace_setup_status_response",
1037
- timeout: 10000,
1038
1050
  });
1039
1051
  }
1040
- async fetchAgent(agentId, requestId) {
1041
- const resolvedRequestId = this.createRequestId(requestId);
1052
+ async fetchAgent(input, legacyOptions) {
1053
+ const options = normalizeFetchAgentOptions(input, legacyOptions);
1054
+ const resolvedRequestId = this.createRequestId(options.requestId);
1042
1055
  const message = SessionInboundMessageSchema.parse({
1043
1056
  type: "fetch_agent_request",
1044
1057
  requestId: resolvedRequestId,
1045
- agentId,
1058
+ agentId: options.agentId,
1046
1059
  });
1047
1060
  const payload = await this.sendRequest({
1048
1061
  requestId: resolvedRequestId,
1049
1062
  message,
1050
- timeout: 10000,
1063
+ timeout: options.timeout,
1051
1064
  options: { skipQueue: true },
1052
1065
  select: (msg) => {
1053
1066
  if (msg.type !== "fetch_agent_response") {
@@ -1126,7 +1139,6 @@ export class DaemonClient {
1126
1139
  const status = await this.sendRequest({
1127
1140
  requestId,
1128
1141
  message,
1129
- timeout: 60000,
1130
1142
  options: { skipQueue: true },
1131
1143
  select: (msg) => {
1132
1144
  if (msg.type !== "status") {
@@ -1158,7 +1170,6 @@ export class DaemonClient {
1158
1170
  await this.sendRequest({
1159
1171
  requestId,
1160
1172
  message,
1161
- timeout: 10000,
1162
1173
  options: { skipQueue: true },
1163
1174
  select: (msg) => {
1164
1175
  if (msg.type !== "agent_deleted") {
@@ -1181,7 +1192,6 @@ export class DaemonClient {
1181
1192
  const result = await this.sendRequest({
1182
1193
  requestId,
1183
1194
  message,
1184
- timeout: 10000,
1185
1195
  options: { skipQueue: true },
1186
1196
  select: (msg) => {
1187
1197
  if (msg.type !== "agent_archived") {
@@ -1201,7 +1211,6 @@ export class DaemonClient {
1201
1211
  type: "agent.detach.request",
1202
1212
  agentId,
1203
1213
  },
1204
- timeout: 10000,
1205
1214
  });
1206
1215
  if (!payload.accepted) {
1207
1216
  throw new Error(payload.error ?? "detachAgent rejected");
@@ -1221,7 +1230,6 @@ export class DaemonClient {
1221
1230
  const payload = await this.sendRequest({
1222
1231
  requestId,
1223
1232
  message,
1224
- timeout: 10000,
1225
1233
  options: { skipQueue: true },
1226
1234
  select: (msg) => {
1227
1235
  if (msg.type !== "update_agent_response") {
@@ -1246,7 +1254,6 @@ export class DaemonClient {
1246
1254
  customName,
1247
1255
  },
1248
1256
  responseType: "project.rename.response",
1249
- timeout: 10000,
1250
1257
  });
1251
1258
  if (!payload.accepted) {
1252
1259
  throw new Error(payload.error ?? "renameProject rejected");
@@ -1260,7 +1267,6 @@ export class DaemonClient {
1260
1267
  type: "project.remove.request",
1261
1268
  projectId,
1262
1269
  },
1263
- timeout: 10000,
1264
1270
  });
1265
1271
  if (!payload.accepted) {
1266
1272
  throw new Error(payload.error ?? "removeProject rejected");
@@ -1276,7 +1282,6 @@ export class DaemonClient {
1276
1282
  title,
1277
1283
  },
1278
1284
  responseType: "workspace.title.set.response",
1279
- timeout: 10000,
1280
1285
  });
1281
1286
  if (!payload.accepted) {
1282
1287
  throw new Error(payload.error ?? "setWorkspaceTitle rejected");
@@ -1294,7 +1299,6 @@ export class DaemonClient {
1294
1299
  const status = await this.sendRequest({
1295
1300
  requestId,
1296
1301
  message,
1297
- timeout: 15000,
1298
1302
  options: { skipQueue: true },
1299
1303
  select: (msg) => {
1300
1304
  if (msg.type !== "status") {
@@ -1323,7 +1327,6 @@ export class DaemonClient {
1323
1327
  const status = await this.sendRequest({
1324
1328
  requestId,
1325
1329
  message,
1326
- timeout: 15000,
1327
1330
  options: { skipQueue: true },
1328
1331
  select: (msg) => {
1329
1332
  if (msg.type !== "status") {
@@ -1355,7 +1358,6 @@ export class DaemonClient {
1355
1358
  return this.sendRequest({
1356
1359
  requestId: resolvedRequestId,
1357
1360
  message,
1358
- timeout: 15000,
1359
1361
  options: { skipQueue: true },
1360
1362
  select: (msg) => {
1361
1363
  if (msg.type !== "status") {
@@ -1383,7 +1385,7 @@ export class DaemonClient {
1383
1385
  const payload = await this.sendRequest({
1384
1386
  requestId: resolvedRequestId,
1385
1387
  message,
1386
- timeout: 15000,
1388
+ timeout: options.timeout,
1387
1389
  options: { skipQueue: true },
1388
1390
  select: (msg) => {
1389
1391
  if (msg.type !== "fetch_agent_timeline_response") {
@@ -1400,6 +1402,34 @@ export class DaemonClient {
1400
1402
  }
1401
1403
  return payload;
1402
1404
  }
1405
+ async buildAgentForkContext(agentId, options = {}) {
1406
+ const resolvedRequestId = this.createRequestId(options.requestId);
1407
+ const message = SessionInboundMessageSchema.parse({
1408
+ type: "agent.fork_context.request",
1409
+ agentId,
1410
+ requestId: resolvedRequestId,
1411
+ ...(options.boundaryMessageId ? { boundaryMessageId: options.boundaryMessageId } : {}),
1412
+ });
1413
+ const payload = await this.sendRequest({
1414
+ requestId: resolvedRequestId,
1415
+ message,
1416
+ timeout: 15000,
1417
+ options: { skipQueue: true },
1418
+ select: (msg) => {
1419
+ if (msg.type !== "agent.fork_context.response") {
1420
+ return null;
1421
+ }
1422
+ if (msg.payload.requestId !== resolvedRequestId) {
1423
+ return null;
1424
+ }
1425
+ return msg.payload;
1426
+ },
1427
+ });
1428
+ if (payload.error) {
1429
+ throw new Error(payload.error);
1430
+ }
1431
+ return payload;
1432
+ }
1403
1433
  // ============================================================================
1404
1434
  // Agent Interaction
1405
1435
  // ============================================================================
@@ -1418,7 +1448,6 @@ export class DaemonClient {
1418
1448
  const payload = await this.sendRequest({
1419
1449
  requestId,
1420
1450
  message,
1421
- timeout: 15000,
1422
1451
  options: { skipQueue: true },
1423
1452
  select: (msg) => {
1424
1453
  if (msg.type !== "send_agent_message_response") {
@@ -1449,7 +1478,6 @@ export class DaemonClient {
1449
1478
  const payload = await this.sendRequest({
1450
1479
  requestId,
1451
1480
  message,
1452
- timeout: 15000,
1453
1481
  options: { skipQueue: true },
1454
1482
  select: (msg) => {
1455
1483
  if (msg.type !== "agent.rewind.response") {
@@ -1476,7 +1504,6 @@ export class DaemonClient {
1476
1504
  await this.sendRequest({
1477
1505
  requestId,
1478
1506
  message,
1479
- timeout: 15000,
1480
1507
  options: { skipQueue: true },
1481
1508
  select: (msg) => {
1482
1509
  if (msg.type !== "cancel_agent_response") {
@@ -1500,7 +1527,6 @@ export class DaemonClient {
1500
1527
  const payload = await this.sendRequest({
1501
1528
  requestId,
1502
1529
  message,
1503
- timeout: 15000,
1504
1530
  options: { skipQueue: true },
1505
1531
  select: (msg) => {
1506
1532
  if (msg.type !== "set_agent_mode_response") {
@@ -1528,7 +1554,6 @@ export class DaemonClient {
1528
1554
  const payload = await this.sendRequest({
1529
1555
  requestId,
1530
1556
  message,
1531
- timeout: 15000,
1532
1557
  options: { skipQueue: true },
1533
1558
  select: (msg) => {
1534
1559
  if (msg.type !== "set_agent_model_response") {
@@ -1556,7 +1581,6 @@ export class DaemonClient {
1556
1581
  const payload = await this.sendRequest({
1557
1582
  requestId,
1558
1583
  message,
1559
- timeout: 15000,
1560
1584
  options: { skipQueue: true },
1561
1585
  select: (msg) => {
1562
1586
  if (msg.type !== "set_agent_feature_response") {
@@ -1583,7 +1607,6 @@ export class DaemonClient {
1583
1607
  const payload = await this.sendRequest({
1584
1608
  requestId,
1585
1609
  message,
1586
- timeout: 15000,
1587
1610
  options: { skipQueue: true },
1588
1611
  select: (msg) => {
1589
1612
  if (msg.type !== "set_agent_thinking_response") {
@@ -1610,7 +1633,6 @@ export class DaemonClient {
1610
1633
  return this.sendRequest({
1611
1634
  requestId: resolvedRequestId,
1612
1635
  message,
1613
- timeout: 10000,
1614
1636
  options: { skipQueue: true },
1615
1637
  select: (msg) => {
1616
1638
  if (msg.type !== "status") {
@@ -1627,8 +1649,8 @@ export class DaemonClient {
1627
1649
  },
1628
1650
  });
1629
1651
  }
1630
- async shutdownServer(requestId) {
1631
- const resolvedRequestId = this.createRequestId(requestId);
1652
+ async shutdownServer(options) {
1653
+ const resolvedRequestId = this.createRequestId(options?.requestId);
1632
1654
  const message = SessionInboundMessageSchema.parse({
1633
1655
  type: "shutdown_server_request",
1634
1656
  requestId: resolvedRequestId,
@@ -1636,7 +1658,7 @@ export class DaemonClient {
1636
1658
  return this.sendRequest({
1637
1659
  requestId: resolvedRequestId,
1638
1660
  message,
1639
- timeout: 10000,
1661
+ timeout: options?.timeout,
1640
1662
  options: { skipQueue: true },
1641
1663
  select: (msg) => {
1642
1664
  if (msg.type !== "status") {
@@ -1653,6 +1675,29 @@ export class DaemonClient {
1653
1675
  },
1654
1676
  });
1655
1677
  }
1678
+ async updateDaemon(requestId) {
1679
+ const resolvedRequestId = this.createRequestId(requestId);
1680
+ const message = SessionInboundMessageSchema.parse({
1681
+ type: "daemon.update.request",
1682
+ requestId: resolvedRequestId,
1683
+ });
1684
+ return this.sendRequest({
1685
+ requestId: resolvedRequestId,
1686
+ message,
1687
+ timeout: 300000, // 5 minutes — npm update can be slow on remote machines
1688
+ options: { skipQueue: true },
1689
+ select: (msg) => {
1690
+ const parsed = DaemonUpdateResponseSchema.safeParse(msg);
1691
+ if (!parsed.success) {
1692
+ return null;
1693
+ }
1694
+ if (parsed.data.payload.requestId !== resolvedRequestId) {
1695
+ return null;
1696
+ }
1697
+ return parsed.data.payload;
1698
+ },
1699
+ });
1700
+ }
1656
1701
  // ============================================================================
1657
1702
  // Audio / Voice
1658
1703
  // ============================================================================
@@ -1667,7 +1712,6 @@ export class DaemonClient {
1667
1712
  const response = await this.sendRequest({
1668
1713
  requestId,
1669
1714
  message,
1670
- timeout: 10000,
1671
1715
  select: (msg) => {
1672
1716
  if (msg.type !== "set_voice_mode_response") {
1673
1717
  return null;
@@ -1874,7 +1918,6 @@ export class DaemonClient {
1874
1918
  const responsePromise = this.sendRequest({
1875
1919
  requestId: resolvedRequestId,
1876
1920
  message,
1877
- timeout: 60000,
1878
1921
  options: { skipQueue: true },
1879
1922
  select: (msg) => {
1880
1923
  if (msg.type !== "checkout_status_response") {
@@ -1958,7 +2001,6 @@ export class DaemonClient {
1958
2001
  requestId: resolvedRequestId,
1959
2002
  message,
1960
2003
  responseType: "subscribe_checkout_diff_response",
1961
- timeout: 60000,
1962
2004
  options: { skipQueue: true },
1963
2005
  selectPayload: (payload) => {
1964
2006
  if (payload.subscriptionId !== subscriptionId) {
@@ -1995,7 +2037,6 @@ export class DaemonClient {
1995
2037
  addAll: input.addAll,
1996
2038
  },
1997
2039
  responseType: "checkout_commit_response",
1998
- timeout: 60000,
1999
2040
  });
2000
2041
  }
2001
2042
  async checkoutMerge(cwd, input, requestId) {
@@ -2009,7 +2050,6 @@ export class DaemonClient {
2009
2050
  requireCleanTarget: input.requireCleanTarget,
2010
2051
  },
2011
2052
  responseType: "checkout_merge_response",
2012
- timeout: 60000,
2013
2053
  });
2014
2054
  }
2015
2055
  async checkoutMergeFromBase(cwd, input, requestId) {
@@ -2022,7 +2062,6 @@ export class DaemonClient {
2022
2062
  requireCleanTarget: input.requireCleanTarget,
2023
2063
  },
2024
2064
  responseType: "checkout_merge_from_base_response",
2025
- timeout: 60000,
2026
2065
  });
2027
2066
  }
2028
2067
  async checkoutPull(cwd, requestId) {
@@ -2033,7 +2072,6 @@ export class DaemonClient {
2033
2072
  cwd,
2034
2073
  },
2035
2074
  responseType: "checkout_pull_response",
2036
- timeout: 60000,
2037
2075
  });
2038
2076
  }
2039
2077
  async checkoutPush(cwd, requestId) {
@@ -2044,7 +2082,6 @@ export class DaemonClient {
2044
2082
  cwd,
2045
2083
  },
2046
2084
  responseType: "checkout_push_response",
2047
- timeout: 60000,
2048
2085
  });
2049
2086
  }
2050
2087
  async checkoutRefresh(cwd, requestId) {
@@ -2055,7 +2092,6 @@ export class DaemonClient {
2055
2092
  cwd,
2056
2093
  },
2057
2094
  responseType: "checkout.refresh.response",
2058
- timeout: 60000,
2059
2095
  });
2060
2096
  }
2061
2097
  async checkoutPrCreate(cwd, input, requestId) {
@@ -2069,7 +2105,6 @@ export class DaemonClient {
2069
2105
  baseRef: input.baseRef,
2070
2106
  },
2071
2107
  responseType: "checkout_pr_create_response",
2072
- timeout: 60000,
2073
2108
  });
2074
2109
  }
2075
2110
  async checkoutPrMerge(cwd, input, requestId) {
@@ -2081,7 +2116,6 @@ export class DaemonClient {
2081
2116
  mergeMethod: input.method,
2082
2117
  },
2083
2118
  responseType: "checkout_pr_merge_response",
2084
- timeout: 60000,
2085
2119
  });
2086
2120
  }
2087
2121
  async checkoutGithubSetAutoMerge(cwd, input, requestId) {
@@ -2093,7 +2127,6 @@ export class DaemonClient {
2093
2127
  enabled: input.enabled,
2094
2128
  ...(input.enabled ? { mergeMethod: input.method } : {}),
2095
2129
  },
2096
- timeout: 60000,
2097
2130
  });
2098
2131
  }
2099
2132
  async checkoutGithubGetCheckDetails(input, requestId) {
@@ -2107,7 +2140,6 @@ export class DaemonClient {
2107
2140
  checkRunId: input.checkRunId,
2108
2141
  workflowRunId: input.workflowRunId,
2109
2142
  },
2110
- timeout: 60000,
2111
2143
  });
2112
2144
  }
2113
2145
  async checkoutPrStatus(cwd, requestId) {
@@ -2118,7 +2150,6 @@ export class DaemonClient {
2118
2150
  cwd,
2119
2151
  },
2120
2152
  responseType: "checkout_pr_status_response",
2121
- timeout: 60000,
2122
2153
  });
2123
2154
  }
2124
2155
  async pullRequestTimeline(input, requestId) {
@@ -2132,7 +2163,6 @@ export class DaemonClient {
2132
2163
  repoName: input.repoName,
2133
2164
  },
2134
2165
  responseType: "pull_request_timeline_response",
2135
- timeout: 60000,
2136
2166
  });
2137
2167
  }
2138
2168
  async checkoutSwitchBranch(cwd, branch, requestId) {
@@ -2144,7 +2174,6 @@ export class DaemonClient {
2144
2174
  branch,
2145
2175
  },
2146
2176
  responseType: "checkout_switch_branch_response",
2147
- timeout: 30000,
2148
2177
  });
2149
2178
  }
2150
2179
  async renameBranch(input) {
@@ -2156,7 +2185,6 @@ export class DaemonClient {
2156
2185
  branch: input.branch,
2157
2186
  },
2158
2187
  responseType: "checkout.rename_branch.response",
2159
- timeout: 30000,
2160
2188
  });
2161
2189
  }
2162
2190
  async stashSave(cwd, options, requestId) {
@@ -2168,7 +2196,6 @@ export class DaemonClient {
2168
2196
  branch: options?.branch,
2169
2197
  },
2170
2198
  responseType: "stash_save_response",
2171
- timeout: 30000,
2172
2199
  });
2173
2200
  }
2174
2201
  async stashPop(cwd, stashIndex, requestId) {
@@ -2180,7 +2207,6 @@ export class DaemonClient {
2180
2207
  stashIndex,
2181
2208
  },
2182
2209
  responseType: "stash_pop_response",
2183
- timeout: 30000,
2184
2210
  });
2185
2211
  }
2186
2212
  async stashList(cwd, options, requestId) {
@@ -2192,7 +2218,6 @@ export class DaemonClient {
2192
2218
  paseoOnly: options?.paseoOnly,
2193
2219
  },
2194
2220
  responseType: "stash_list_response",
2195
- timeout: 10000,
2196
2221
  });
2197
2222
  }
2198
2223
  async getPaseoWorktreeList(input, requestId) {
@@ -2204,7 +2229,6 @@ export class DaemonClient {
2204
2229
  repoRoot: input.repoRoot,
2205
2230
  },
2206
2231
  responseType: "paseo_worktree_list_response",
2207
- timeout: 60000,
2208
2232
  });
2209
2233
  }
2210
2234
  async archivePaseoWorktree(input, requestId) {
@@ -2219,7 +2243,6 @@ export class DaemonClient {
2219
2243
  ...(input.scope !== undefined ? { scope: input.scope } : {}),
2220
2244
  },
2221
2245
  responseType: "paseo_worktree_archive_response",
2222
- timeout: 60000,
2223
2246
  });
2224
2247
  }
2225
2248
  async createPaseoWorktree(input, requestId) {
@@ -2238,7 +2261,6 @@ export class DaemonClient {
2238
2261
  ...(input.githubPrNumber !== undefined ? { githubPrNumber: input.githubPrNumber } : {}),
2239
2262
  },
2240
2263
  responseType: "create_paseo_worktree_response",
2241
- timeout: 60000,
2242
2264
  });
2243
2265
  }
2244
2266
  async createWorkspace(input, requestId) {
@@ -2253,7 +2275,6 @@ export class DaemonClient {
2253
2275
  : {}),
2254
2276
  },
2255
2277
  responseType: "workspace.create.response",
2256
- timeout: 60000,
2257
2278
  });
2258
2279
  }
2259
2280
  async validateBranch(options, requestId) {
@@ -2265,7 +2286,6 @@ export class DaemonClient {
2265
2286
  branchName: options.branchName,
2266
2287
  },
2267
2288
  responseType: "validate_branch_response",
2268
- timeout: 10000,
2269
2289
  });
2270
2290
  }
2271
2291
  async getBranchSuggestions(options, requestId) {
@@ -2278,7 +2298,6 @@ export class DaemonClient {
2278
2298
  limit: options.limit,
2279
2299
  },
2280
2300
  responseType: "branch_suggestions_response",
2281
- timeout: 10000,
2282
2301
  });
2283
2302
  }
2284
2303
  async searchGitHub(options, requestId) {
@@ -2292,7 +2311,6 @@ export class DaemonClient {
2292
2311
  kinds: options.kinds,
2293
2312
  },
2294
2313
  responseType: "github_search_response",
2295
- timeout: 15000,
2296
2314
  });
2297
2315
  }
2298
2316
  async getDirectorySuggestions(options, requestId) {
@@ -2308,7 +2326,8 @@ export class DaemonClient {
2308
2326
  limit: options.limit,
2309
2327
  },
2310
2328
  responseType: "directory_suggestions_response",
2311
- timeout: 10000,
2329
+ // Home-tree scans on large home dirs can take several seconds; don't cut
2330
+ // the suggestion request off early (it would surface as an empty list).
2312
2331
  });
2313
2332
  }
2314
2333
  // ============================================================================
@@ -2325,7 +2344,6 @@ export class DaemonClient {
2325
2344
  ...(acceptBinary ? { acceptBinary: true } : {}),
2326
2345
  },
2327
2346
  responseType: "file_explorer_response",
2328
- timeout: 10000,
2329
2347
  });
2330
2348
  }
2331
2349
  async listDirectory(cwd, path, requestId) {
@@ -2379,7 +2397,6 @@ export class DaemonClient {
2379
2397
  requestId: resolvedRequestId,
2380
2398
  },
2381
2399
  responseType: "file.upload.response",
2382
- timeout: 60000,
2383
2400
  options: { skipQueue: true },
2384
2401
  });
2385
2402
  this.sendBinaryFrame(encodeFileTransferFrame({
@@ -2416,7 +2433,6 @@ export class DaemonClient {
2416
2433
  path,
2417
2434
  },
2418
2435
  responseType: "file_download_token_response",
2419
- timeout: 10000,
2420
2436
  });
2421
2437
  }
2422
2438
  async requestProjectIcon(cwd, requestId) {
@@ -2427,7 +2443,6 @@ export class DaemonClient {
2427
2443
  cwd,
2428
2444
  },
2429
2445
  responseType: "project_icon_response",
2430
- timeout: 10000,
2431
2446
  });
2432
2447
  }
2433
2448
  // ============================================================================
@@ -2442,8 +2457,8 @@ export class DaemonClient {
2442
2457
  cwd: options?.cwd,
2443
2458
  },
2444
2459
  responseType: "list_provider_models_response",
2445
- // Provider SDK cold starts (especially model discovery) can exceed 30s.
2446
- timeout: 45000,
2460
+ // Provider SDK cold starts (especially model discovery) can exceed 60s.
2461
+ timeout: 90000,
2447
2462
  });
2448
2463
  }
2449
2464
  async listProviderModes(provider, options) {
@@ -2455,7 +2470,7 @@ export class DaemonClient {
2455
2470
  cwd: options?.cwd,
2456
2471
  },
2457
2472
  responseType: "list_provider_modes_response",
2458
- timeout: 45000,
2473
+ timeout: 90000,
2459
2474
  });
2460
2475
  }
2461
2476
  async listProviderFeatures(draftConfig, options) {
@@ -2466,7 +2481,7 @@ export class DaemonClient {
2466
2481
  draftConfig,
2467
2482
  },
2468
2483
  responseType: "list_provider_features_response",
2469
- timeout: 45000,
2484
+ timeout: 90000,
2470
2485
  });
2471
2486
  }
2472
2487
  async listAvailableProviders(options) {
@@ -2476,7 +2491,6 @@ export class DaemonClient {
2476
2491
  type: "list_available_providers_request",
2477
2492
  },
2478
2493
  responseType: "list_available_providers_response",
2479
- timeout: 30000,
2480
2494
  });
2481
2495
  }
2482
2496
  async getProvidersSnapshot(options) {
@@ -2487,7 +2501,6 @@ export class DaemonClient {
2487
2501
  cwd: options?.cwd,
2488
2502
  },
2489
2503
  responseType: "get_providers_snapshot_response",
2490
- timeout: 10000,
2491
2504
  });
2492
2505
  }
2493
2506
  async getDaemonConfig(requestId) {
@@ -2497,27 +2510,34 @@ export class DaemonClient {
2497
2510
  type: "get_daemon_config_request",
2498
2511
  },
2499
2512
  responseType: "get_daemon_config_response",
2500
- timeout: 10000,
2501
2513
  });
2502
2514
  }
2503
- async getDaemonStatus(requestId) {
2515
+ async getDaemonStatus(options) {
2504
2516
  return this.sendCorrelatedSessionRequest({
2505
- requestId,
2517
+ requestId: options?.requestId,
2506
2518
  message: {
2507
2519
  type: "daemon.get_status.request",
2508
2520
  },
2509
2521
  responseType: "daemon.get_status.response",
2510
- timeout: 10000,
2522
+ timeout: options?.timeout,
2511
2523
  });
2512
2524
  }
2513
- async getDaemonPairingOffer(requestId) {
2525
+ async getDaemonPairingOffer(options) {
2514
2526
  return this.sendCorrelatedSessionRequest({
2515
- requestId,
2527
+ requestId: options?.requestId,
2516
2528
  message: {
2517
2529
  type: "daemon.get_pairing_offer.request",
2518
2530
  },
2519
2531
  responseType: "daemon.get_pairing_offer.response",
2520
- timeout: 10000,
2532
+ timeout: options?.timeout,
2533
+ });
2534
+ }
2535
+ async collectDiagnostics(requestId) {
2536
+ return this.sendNamespacedCorrelatedSessionRequest({
2537
+ requestId,
2538
+ message: {
2539
+ type: "diagnostics.request",
2540
+ },
2521
2541
  });
2522
2542
  }
2523
2543
  async patchDaemonConfig(config, requestId) {
@@ -2528,7 +2548,6 @@ export class DaemonClient {
2528
2548
  config,
2529
2549
  },
2530
2550
  responseType: "set_daemon_config_response",
2531
- timeout: 10000,
2532
2551
  });
2533
2552
  }
2534
2553
  async readProjectConfig(repoRoot, requestId) {
@@ -2539,7 +2558,6 @@ export class DaemonClient {
2539
2558
  repoRoot,
2540
2559
  },
2541
2560
  responseType: "read_project_config_response",
2542
- timeout: 10000,
2543
2561
  });
2544
2562
  }
2545
2563
  async writeProjectConfig(input) {
@@ -2552,7 +2570,6 @@ export class DaemonClient {
2552
2570
  expectedRevision: input.expectedRevision,
2553
2571
  },
2554
2572
  responseType: "write_project_config_response",
2555
- timeout: 10000,
2556
2573
  });
2557
2574
  }
2558
2575
  async refreshProvidersSnapshot(options) {
@@ -2564,7 +2581,7 @@ export class DaemonClient {
2564
2581
  providers: options?.providers,
2565
2582
  },
2566
2583
  responseType: "refresh_providers_snapshot_response",
2567
- timeout: 60000,
2584
+ timeout: 120000,
2568
2585
  });
2569
2586
  }
2570
2587
  async getProviderDiagnostic(provider, options) {
@@ -2575,7 +2592,7 @@ export class DaemonClient {
2575
2592
  provider,
2576
2593
  },
2577
2594
  responseType: "provider_diagnostic_response",
2578
- timeout: 30000,
2595
+ timeout: 180000,
2579
2596
  });
2580
2597
  }
2581
2598
  async listProviderUsage(options) {
@@ -2584,21 +2601,18 @@ export class DaemonClient {
2584
2601
  message: {
2585
2602
  type: "provider.usage.list.request",
2586
2603
  },
2587
- timeout: 30000,
2588
2604
  });
2589
2605
  }
2590
- async listCommands(agentId, requestIdOrOptions) {
2591
- const requestId = typeof requestIdOrOptions === "string" ? requestIdOrOptions : requestIdOrOptions?.requestId;
2592
- const draftConfig = typeof requestIdOrOptions === "string" ? undefined : requestIdOrOptions?.draftConfig;
2606
+ async listCommands(input, legacyOptions) {
2607
+ const options = normalizeListCommandsOptions(input, legacyOptions);
2593
2608
  return this.sendCorrelatedSessionRequest({
2594
- requestId,
2609
+ requestId: options.requestId,
2595
2610
  message: {
2596
2611
  type: "list_commands_request",
2597
- agentId,
2598
- ...(draftConfig ? { draftConfig } : {}),
2612
+ agentId: options.agentId,
2613
+ ...(options.draftConfig ? { draftConfig: options.draftConfig } : {}),
2599
2614
  },
2600
2615
  responseType: "list_commands_response",
2601
- timeout: 30000,
2602
2616
  });
2603
2617
  }
2604
2618
  // ============================================================================
@@ -2642,11 +2656,17 @@ export class DaemonClient {
2642
2656
  // Waiting / Streaming Helpers
2643
2657
  // ============================================================================
2644
2658
  async waitForAgentUpsert(agentId, predicate, timeout = 60000) {
2645
- const initialResult = await this.fetchAgent(agentId).catch(() => null);
2659
+ const deadline = Date.now() + timeout;
2660
+ const remainingTimeoutMs = () => Math.max(1, deadline - Date.now());
2661
+ const timeoutError = () => new Error(`Timed out waiting for agent ${agentId}`);
2662
+ const fetchAgentWithinDeadline = () => this.fetchAgent({ agentId, timeout: remainingTimeoutMs() }).catch(() => null);
2663
+ const initialResult = await fetchAgentWithinDeadline();
2646
2664
  if (initialResult && predicate(initialResult.agent)) {
2647
2665
  return initialResult.agent;
2648
2666
  }
2649
- const deadline = Date.now() + timeout;
2667
+ if (Date.now() >= deadline) {
2668
+ throw timeoutError();
2669
+ }
2650
2670
  return await new Promise((resolve, reject) => {
2651
2671
  let settled = false;
2652
2672
  let pollInFlight = false;
@@ -2692,7 +2712,7 @@ export class DaemonClient {
2692
2712
  }
2693
2713
  pollInFlight = true;
2694
2714
  try {
2695
- const result = await this.fetchAgent(agentId).catch(() => null);
2715
+ const result = await fetchAgentWithinDeadline();
2696
2716
  maybeResolve(result?.agent ?? null);
2697
2717
  }
2698
2718
  finally {
@@ -2716,7 +2736,7 @@ export class DaemonClient {
2716
2736
  timeoutTimer = setTimeout(() => {
2717
2737
  finish({
2718
2738
  kind: "error",
2719
- error: new Error(`Timed out waiting for agent ${agentId}`),
2739
+ error: timeoutError(),
2720
2740
  });
2721
2741
  }, remaining);
2722
2742
  pollTimer = setInterval(() => {
@@ -2788,7 +2808,6 @@ export class DaemonClient {
2788
2808
  requestId: resolvedRequestId,
2789
2809
  message,
2790
2810
  responseType: "list_terminals_response",
2791
- timeout: 10000,
2792
2811
  options: { skipQueue: true },
2793
2812
  });
2794
2813
  }
@@ -2808,7 +2827,6 @@ export class DaemonClient {
2808
2827
  requestId: resolvedRequestId,
2809
2828
  message,
2810
2829
  responseType: "create_terminal_response",
2811
- timeout: 10000,
2812
2830
  options: { skipQueue: true },
2813
2831
  });
2814
2832
  }
@@ -2821,7 +2839,6 @@ export class DaemonClient {
2821
2839
  title: input.title,
2822
2840
  },
2823
2841
  responseType: "terminal.rename.response",
2824
- timeout: 10000,
2825
2842
  });
2826
2843
  }
2827
2844
  async subscribeTerminal(terminalId, optionsOrRequestId) {
@@ -2838,7 +2855,6 @@ export class DaemonClient {
2838
2855
  requestId: resolvedRequestId,
2839
2856
  message,
2840
2857
  responseType: "subscribe_terminal_response",
2841
- timeout: 10000,
2842
2858
  options: { skipQueue: true },
2843
2859
  });
2844
2860
  if (payload.error === null) {
@@ -2876,7 +2892,6 @@ export class DaemonClient {
2876
2892
  requestId: resolvedRequestId,
2877
2893
  message,
2878
2894
  responseType: "kill_terminal_response",
2879
- timeout: 10000,
2880
2895
  options: { skipQueue: true },
2881
2896
  });
2882
2897
  }
@@ -2892,7 +2907,6 @@ export class DaemonClient {
2892
2907
  requestId: resolvedRequestId,
2893
2908
  message,
2894
2909
  responseType: "close_items_response",
2895
- timeout: 10000,
2896
2910
  options: { skipQueue: true },
2897
2911
  });
2898
2912
  }
@@ -2910,7 +2924,6 @@ export class DaemonClient {
2910
2924
  requestId: resolvedRequestId,
2911
2925
  message,
2912
2926
  responseType: "capture_terminal_response",
2913
- timeout: 10000,
2914
2927
  options: { skipQueue: true },
2915
2928
  });
2916
2929
  }
@@ -2923,7 +2936,6 @@ export class DaemonClient {
2923
2936
  ...(options.purpose ? { purpose: options.purpose } : {}),
2924
2937
  },
2925
2938
  responseType: "chat/create/response",
2926
- timeout: 10000,
2927
2939
  });
2928
2940
  }
2929
2941
  async listChatRooms(requestId) {
@@ -2933,7 +2945,6 @@ export class DaemonClient {
2933
2945
  type: "chat/list",
2934
2946
  },
2935
2947
  responseType: "chat/list/response",
2936
- timeout: 10000,
2937
2948
  });
2938
2949
  }
2939
2950
  async inspectChatRoom(options) {
@@ -2944,7 +2955,6 @@ export class DaemonClient {
2944
2955
  room: options.room,
2945
2956
  },
2946
2957
  responseType: "chat/inspect/response",
2947
- timeout: 10000,
2948
2958
  });
2949
2959
  }
2950
2960
  async deleteChatRoom(options) {
@@ -2955,7 +2965,6 @@ export class DaemonClient {
2955
2965
  room: options.room,
2956
2966
  },
2957
2967
  responseType: "chat/delete/response",
2958
- timeout: 10000,
2959
2968
  });
2960
2969
  }
2961
2970
  async postChatMessage(options) {
@@ -2969,7 +2978,6 @@ export class DaemonClient {
2969
2978
  ...(options.replyToMessageId ? { replyToMessageId: options.replyToMessageId } : {}),
2970
2979
  },
2971
2980
  responseType: "chat/post/response",
2972
- timeout: 10000,
2973
2981
  });
2974
2982
  }
2975
2983
  async readChatMessages(options) {
@@ -2983,7 +2991,7 @@ export class DaemonClient {
2983
2991
  ...(options.authorAgentId ? { authorAgentId: options.authorAgentId } : {}),
2984
2992
  },
2985
2993
  responseType: "chat/read/response",
2986
- timeout: 10000,
2994
+ timeout: options.timeout,
2987
2995
  });
2988
2996
  }
2989
2997
  async waitForChatMessages(options) {
@@ -3013,7 +3021,6 @@ export class DaemonClient {
3013
3021
  ...(typeof options.runOnCreate === "boolean" ? { runOnCreate: options.runOnCreate } : {}),
3014
3022
  },
3015
3023
  responseType: "schedule/create/response",
3016
- timeout: 10000,
3017
3024
  });
3018
3025
  }
3019
3026
  async scheduleList(requestId) {
@@ -3023,7 +3030,6 @@ export class DaemonClient {
3023
3030
  type: "schedule/list",
3024
3031
  },
3025
3032
  responseType: "schedule/list/response",
3026
- timeout: 10000,
3027
3033
  });
3028
3034
  }
3029
3035
  async scheduleInspect(options) {
@@ -3034,7 +3040,6 @@ export class DaemonClient {
3034
3040
  scheduleId: options.id,
3035
3041
  },
3036
3042
  responseType: "schedule/inspect/response",
3037
- timeout: 10000,
3038
3043
  });
3039
3044
  }
3040
3045
  async scheduleLogs(options) {
@@ -3045,7 +3050,6 @@ export class DaemonClient {
3045
3050
  scheduleId: options.id,
3046
3051
  },
3047
3052
  responseType: "schedule/logs/response",
3048
- timeout: 10000,
3049
3053
  });
3050
3054
  }
3051
3055
  async schedulePause(options) {
@@ -3056,7 +3060,6 @@ export class DaemonClient {
3056
3060
  scheduleId: options.id,
3057
3061
  },
3058
3062
  responseType: "schedule/pause/response",
3059
- timeout: 10000,
3060
3063
  });
3061
3064
  }
3062
3065
  async scheduleResume(options) {
@@ -3067,7 +3070,6 @@ export class DaemonClient {
3067
3070
  scheduleId: options.id,
3068
3071
  },
3069
3072
  responseType: "schedule/resume/response",
3070
- timeout: 10000,
3071
3073
  });
3072
3074
  }
3073
3075
  async scheduleDelete(options) {
@@ -3078,7 +3080,6 @@ export class DaemonClient {
3078
3080
  scheduleId: options.id,
3079
3081
  },
3080
3082
  responseType: "schedule/delete/response",
3081
- timeout: 10000,
3082
3083
  });
3083
3084
  }
3084
3085
  async scheduleRunOnce(options) {
@@ -3089,7 +3090,6 @@ export class DaemonClient {
3089
3090
  scheduleId: options.id,
3090
3091
  },
3091
3092
  responseType: "schedule/run-once/response",
3092
- timeout: 10000,
3093
3093
  });
3094
3094
  }
3095
3095
  async scheduleUpdate(options) {
@@ -3106,7 +3106,6 @@ export class DaemonClient {
3106
3106
  ...(options.expiresAt !== undefined ? { expiresAt: options.expiresAt } : {}),
3107
3107
  },
3108
3108
  responseType: "schedule/update/response",
3109
- timeout: 10000,
3110
3109
  });
3111
3110
  }
3112
3111
  async loopRun(options) {
@@ -3134,7 +3133,6 @@ export class DaemonClient {
3134
3133
  ...(typeof options.maxTimeMs === "number" ? { maxTimeMs: options.maxTimeMs } : {}),
3135
3134
  },
3136
3135
  responseType: "loop/run/response",
3137
- timeout: 15000,
3138
3136
  });
3139
3137
  }
3140
3138
  async loopList(requestId) {
@@ -3144,7 +3142,6 @@ export class DaemonClient {
3144
3142
  type: "loop/list",
3145
3143
  },
3146
3144
  responseType: "loop/list/response",
3147
- timeout: 10000,
3148
3145
  });
3149
3146
  }
3150
3147
  async loopInspect(options) {
@@ -3156,7 +3153,6 @@ export class DaemonClient {
3156
3153
  id: normalized.id,
3157
3154
  },
3158
3155
  responseType: "loop/inspect/response",
3159
- timeout: 10000,
3160
3156
  });
3161
3157
  }
3162
3158
  async loopLogs(options, afterSeq) {
@@ -3169,7 +3165,6 @@ export class DaemonClient {
3169
3165
  ...(typeof normalized.afterSeq === "number" ? { afterSeq: normalized.afterSeq } : {}),
3170
3166
  },
3171
3167
  responseType: "loop/logs/response",
3172
- timeout: 10000,
3173
3168
  });
3174
3169
  }
3175
3170
  async loopStop(options) {
@@ -3181,7 +3176,6 @@ export class DaemonClient {
3181
3176
  id: normalized.id,
3182
3177
  },
3183
3178
  responseType: "loop/stop/response",
3184
- timeout: 10000,
3185
3179
  });
3186
3180
  }
3187
3181
  onTerminalStreamEvent(handler) {
package/dist/index.js CHANGED
@@ -117,7 +117,7 @@ function createAgentHandleFactory(daemonClient) {
117
117
  },
118
118
  latest: () => latest,
119
119
  refetch: async (requestId) => {
120
- const result = await daemonClient.fetchAgent(id, requestId);
120
+ const result = await daemonClient.fetchAgent({ agentId: id, requestId });
121
121
  latest = result?.agent ?? null;
122
122
  return result;
123
123
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpaseo/client",
3
- "version": "0.1.100",
3
+ "version": "0.1.102-beta.2",
4
4
  "description": "Paseo client SDK package",
5
5
  "files": [
6
6
  "dist",
@@ -35,8 +35,8 @@
35
35
  "test": "vitest run"
36
36
  },
37
37
  "dependencies": {
38
- "@getpaseo/protocol": "0.1.100",
39
- "@getpaseo/relay": "0.1.100",
38
+ "@getpaseo/protocol": "0.1.102-beta.2",
39
+ "@getpaseo/relay": "0.1.102-beta.2",
40
40
  "zod": "^4.4.3"
41
41
  },
42
42
  "devDependencies": {