@getpaseo/server 0.1.12 → 0.1.14

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.
Files changed (65) hide show
  1. package/dist/server/client/daemon-client.d.ts +84 -87
  2. package/dist/server/client/daemon-client.d.ts.map +1 -1
  3. package/dist/server/client/daemon-client.js +253 -299
  4. package/dist/server/client/daemon-client.js.map +1 -1
  5. package/dist/server/server/agent/agent-manager.d.ts +2 -1
  6. package/dist/server/server/agent/agent-manager.d.ts.map +1 -1
  7. package/dist/server/server/agent/agent-manager.js +23 -0
  8. package/dist/server/server/agent/agent-manager.js.map +1 -1
  9. package/dist/server/server/agent/agent-sdk-types.d.ts +0 -15
  10. package/dist/server/server/agent/agent-sdk-types.d.ts.map +1 -1
  11. package/dist/server/server/agent/providers/claude-agent.d.ts.map +1 -1
  12. package/dist/server/server/agent/providers/claude-agent.js +268 -35
  13. package/dist/server/server/agent/providers/claude-agent.js.map +1 -1
  14. package/dist/server/server/agent/providers/codex-app-server-agent.d.ts.map +1 -1
  15. package/dist/server/server/agent/providers/codex-app-server-agent.js +85 -36
  16. package/dist/server/server/agent/providers/codex-app-server-agent.js.map +1 -1
  17. package/dist/server/server/bootstrap.d.ts.map +1 -1
  18. package/dist/server/server/bootstrap.js +3 -1
  19. package/dist/server/server/bootstrap.js.map +1 -1
  20. package/dist/server/server/daemon-version.d.ts +5 -0
  21. package/dist/server/server/daemon-version.d.ts.map +1 -0
  22. package/dist/server/server/daemon-version.js +22 -0
  23. package/dist/server/server/daemon-version.js.map +1 -0
  24. package/dist/server/server/dictation/dictation-stream-manager.d.ts +1 -0
  25. package/dist/server/server/dictation/dictation-stream-manager.d.ts.map +1 -1
  26. package/dist/server/server/dictation/dictation-stream-manager.js +32 -1
  27. package/dist/server/server/dictation/dictation-stream-manager.js.map +1 -1
  28. package/dist/server/server/package-version.d.ts +13 -0
  29. package/dist/server/server/package-version.d.ts.map +1 -0
  30. package/dist/server/server/package-version.js +47 -0
  31. package/dist/server/server/package-version.js.map +1 -0
  32. package/dist/server/server/persisted-config.d.ts +2 -2
  33. package/dist/server/server/pid-lock.d.ts.map +1 -1
  34. package/dist/server/server/pid-lock.js +16 -2
  35. package/dist/server/server/pid-lock.js.map +1 -1
  36. package/dist/server/server/session.d.ts +23 -21
  37. package/dist/server/server/session.d.ts.map +1 -1
  38. package/dist/server/server/session.js +975 -850
  39. package/dist/server/server/session.js.map +1 -1
  40. package/dist/server/server/websocket-server.d.ts +5 -1
  41. package/dist/server/server/websocket-server.d.ts.map +1 -1
  42. package/dist/server/server/websocket-server.js +27 -16
  43. package/dist/server/server/websocket-server.js.map +1 -1
  44. package/dist/server/shared/agent-attention-notification.d.ts +40 -0
  45. package/dist/server/shared/agent-attention-notification.d.ts.map +1 -0
  46. package/dist/server/shared/agent-attention-notification.js +130 -0
  47. package/dist/server/shared/agent-attention-notification.js.map +1 -0
  48. package/dist/server/shared/messages.d.ts +974 -619
  49. package/dist/server/shared/messages.d.ts.map +1 -1
  50. package/dist/server/shared/messages.js +285 -296
  51. package/dist/server/shared/messages.js.map +1 -1
  52. package/dist/server/utils/checkout-git.d.ts +3 -0
  53. package/dist/server/utils/checkout-git.d.ts.map +1 -1
  54. package/dist/server/utils/checkout-git.js +102 -23
  55. package/dist/server/utils/checkout-git.js.map +1 -1
  56. package/dist/server/utils/directory-suggestions.d.ts +15 -0
  57. package/dist/server/utils/directory-suggestions.d.ts.map +1 -1
  58. package/dist/server/utils/directory-suggestions.js +348 -21
  59. package/dist/server/utils/directory-suggestions.js.map +1 -1
  60. package/dist/server/utils/worktree-metadata.d.ts +4 -4
  61. package/dist/server/utils/worktree.d.ts +1 -0
  62. package/dist/server/utils/worktree.d.ts.map +1 -1
  63. package/dist/server/utils/worktree.js +41 -77
  64. package/dist/server/utils/worktree.js.map +1 -1
  65. package/package.json +5 -5
@@ -1,6 +1,6 @@
1
- import { z } from "zod";
2
- import { AGENT_LIFECYCLE_STATUSES } from "./agent-lifecycle.js";
3
- import { AgentProviderSchema } from "../server/agent/provider-manifest.js";
1
+ import { z } from 'zod';
2
+ import { AGENT_LIFECYCLE_STATUSES } from './agent-lifecycle.js';
3
+ import { AgentProviderSchema } from '../server/agent/provider-manifest.js';
4
4
  export const AgentStatusSchema = z.enum(AGENT_LIFECYCLE_STATUSES);
5
5
  const AgentModeSchema = z.object({
6
6
  id: z.string(),
@@ -39,22 +39,22 @@ const AgentUsageSchema = z.object({
39
39
  totalCostUsd: z.number().optional(),
40
40
  });
41
41
  const McpStdioServerConfigSchema = z.object({
42
- type: z.literal("stdio"),
42
+ type: z.literal('stdio'),
43
43
  command: z.string(),
44
44
  args: z.array(z.string()).optional(),
45
45
  env: z.record(z.string()).optional(),
46
46
  });
47
47
  const McpHttpServerConfigSchema = z.object({
48
- type: z.literal("http"),
48
+ type: z.literal('http'),
49
49
  url: z.string(),
50
50
  headers: z.record(z.string()).optional(),
51
51
  });
52
52
  const McpSseServerConfigSchema = z.object({
53
- type: z.literal("sse"),
53
+ type: z.literal('sse'),
54
54
  url: z.string(),
55
55
  headers: z.record(z.string()).optional(),
56
56
  });
57
- const McpServerConfigSchema = z.discriminatedUnion("type", [
57
+ const McpServerConfigSchema = z.discriminatedUnion('type', [
58
58
  McpStdioServerConfigSchema,
59
59
  McpHttpServerConfigSchema,
60
60
  McpSseServerConfigSchema,
@@ -65,13 +65,7 @@ const AgentSessionConfigSchema = z.object({
65
65
  modeId: z.string().optional(),
66
66
  model: z.string().optional(),
67
67
  thinkingOptionId: z.string().optional(),
68
- title: z
69
- .string()
70
- .trim()
71
- .min(1)
72
- .max(40)
73
- .optional()
74
- .nullable(),
68
+ title: z.string().trim().min(1).max(40).optional().nullable(),
75
69
  approvalPolicy: z.string().optional(),
76
70
  sandboxMode: z.string().optional(),
77
71
  networkAccess: z.boolean().optional(),
@@ -89,12 +83,12 @@ const AgentSessionConfigSchema = z.object({
89
83
  const AgentPermissionUpdateSchema = z.record(z.unknown());
90
84
  export const AgentPermissionResponseSchema = z.union([
91
85
  z.object({
92
- behavior: z.literal("allow"),
86
+ behavior: z.literal('allow'),
93
87
  updatedInput: z.record(z.unknown()).optional(),
94
88
  updatedPermissions: z.array(AgentPermissionUpdateSchema).optional(),
95
89
  }),
96
90
  z.object({
97
- behavior: z.literal("deny"),
91
+ behavior: z.literal('deny'),
98
92
  message: z.string().optional(),
99
93
  interrupt: z.boolean().optional(),
100
94
  }),
@@ -103,7 +97,7 @@ export const AgentPermissionRequestPayloadSchema = z.object({
103
97
  id: z.string(),
104
98
  provider: AgentProviderSchema,
105
99
  name: z.string(),
106
- kind: z.enum(["tool", "plan", "question", "mode", "other"]),
100
+ kind: z.enum(['tool', 'plan', 'question', 'mode', 'other']),
107
101
  title: z.string().optional(),
108
102
  description: z.string().optional(),
109
103
  input: z.record(z.unknown()).optional(),
@@ -125,39 +119,39 @@ const NonNullUnknownSchema = z.union([
125
119
  z.array(z.unknown()),
126
120
  z.object({}).passthrough(),
127
121
  ]);
128
- const ToolCallDetailPayloadSchema = z.discriminatedUnion("type", [
122
+ const ToolCallDetailPayloadSchema = z.discriminatedUnion('type', [
129
123
  z.object({
130
- type: z.literal("shell"),
124
+ type: z.literal('shell'),
131
125
  command: z.string(),
132
126
  cwd: z.string().optional(),
133
127
  output: z.string().optional(),
134
128
  exitCode: z.number().nullable().optional(),
135
129
  }),
136
130
  z.object({
137
- type: z.literal("read"),
131
+ type: z.literal('read'),
138
132
  filePath: z.string(),
139
133
  content: z.string().optional(),
140
134
  offset: z.number().optional(),
141
135
  limit: z.number().optional(),
142
136
  }),
143
137
  z.object({
144
- type: z.literal("edit"),
138
+ type: z.literal('edit'),
145
139
  filePath: z.string(),
146
140
  oldString: z.string().optional(),
147
141
  newString: z.string().optional(),
148
142
  unifiedDiff: z.string().optional(),
149
143
  }),
150
144
  z.object({
151
- type: z.literal("write"),
145
+ type: z.literal('write'),
152
146
  filePath: z.string(),
153
147
  content: z.string().optional(),
154
148
  }),
155
149
  z.object({
156
- type: z.literal("search"),
150
+ type: z.literal('search'),
157
151
  query: z.string(),
158
152
  }),
159
153
  z.object({
160
- type: z.literal("worktree_setup"),
154
+ type: z.literal('worktree_setup'),
161
155
  worktreePath: z.string(),
162
156
  branchName: z.string(),
163
157
  log: z.string(),
@@ -165,39 +159,41 @@ const ToolCallDetailPayloadSchema = z.discriminatedUnion("type", [
165
159
  index: z.number().int().positive(),
166
160
  command: z.string(),
167
161
  cwd: z.string(),
168
- status: z.enum(["running", "completed", "failed"]),
162
+ status: z.enum(['running', 'completed', 'failed']),
169
163
  exitCode: z.number().nullable(),
170
164
  durationMs: z.number().nonnegative().optional(),
171
165
  })),
172
166
  truncated: z.boolean().optional(),
173
167
  }),
174
168
  z.object({
175
- type: z.literal("unknown"),
169
+ type: z.literal('unknown'),
176
170
  input: UnknownValueSchema,
177
171
  output: UnknownValueSchema,
178
172
  }),
179
173
  ]);
180
- const ToolCallBasePayloadSchema = z.object({
181
- type: z.literal("tool_call"),
174
+ const ToolCallBasePayloadSchema = z
175
+ .object({
176
+ type: z.literal('tool_call'),
182
177
  callId: z.string(),
183
178
  name: z.string(),
184
179
  detail: ToolCallDetailPayloadSchema,
185
180
  metadata: z.record(z.unknown()).optional(),
186
- }).strict();
181
+ })
182
+ .strict();
187
183
  const ToolCallRunningPayloadSchema = ToolCallBasePayloadSchema.extend({
188
- status: z.literal("running"),
184
+ status: z.literal('running'),
189
185
  error: z.null(),
190
186
  });
191
187
  const ToolCallCompletedPayloadSchema = ToolCallBasePayloadSchema.extend({
192
- status: z.literal("completed"),
188
+ status: z.literal('completed'),
193
189
  error: z.null(),
194
190
  });
195
191
  const ToolCallFailedPayloadSchema = ToolCallBasePayloadSchema.extend({
196
- status: z.literal("failed"),
192
+ status: z.literal('failed'),
197
193
  error: NonNullUnknownSchema,
198
194
  });
199
195
  const ToolCallCanceledPayloadSchema = ToolCallBasePayloadSchema.extend({
200
- status: z.literal("canceled"),
196
+ status: z.literal('canceled'),
201
197
  error: z.null(),
202
198
  });
203
199
  const ToolCallTimelineItemPayloadSchema = z.union([
@@ -208,84 +204,95 @@ const ToolCallTimelineItemPayloadSchema = z.union([
208
204
  ]);
209
205
  export const AgentTimelineItemPayloadSchema = z.union([
210
206
  z.object({
211
- type: z.literal("user_message"),
207
+ type: z.literal('user_message'),
212
208
  text: z.string(),
213
209
  messageId: z.string().optional(),
214
210
  }),
215
211
  z.object({
216
- type: z.literal("assistant_message"),
212
+ type: z.literal('assistant_message'),
217
213
  text: z.string(),
218
214
  }),
219
215
  z.object({
220
- type: z.literal("reasoning"),
216
+ type: z.literal('reasoning'),
221
217
  text: z.string(),
222
218
  }),
223
219
  ToolCallTimelineItemPayloadSchema,
224
220
  z.object({
225
- type: z.literal("todo"),
221
+ type: z.literal('todo'),
226
222
  items: z.array(z.object({
227
223
  text: z.string(),
228
224
  completed: z.boolean(),
229
225
  })),
230
226
  }),
231
227
  z.object({
232
- type: z.literal("error"),
228
+ type: z.literal('error'),
233
229
  message: z.string(),
234
230
  }),
235
231
  z.object({
236
- type: z.literal("compaction"),
237
- status: z.enum(["loading", "completed"]),
238
- trigger: z.enum(["auto", "manual"]).optional(),
232
+ type: z.literal('compaction'),
233
+ status: z.enum(['loading', 'completed']),
234
+ trigger: z.enum(['auto', 'manual']).optional(),
239
235
  preTokens: z.number().optional(),
240
236
  }),
241
237
  ]);
242
- export const AgentStreamEventPayloadSchema = z.discriminatedUnion("type", [
238
+ export const AgentStreamEventPayloadSchema = z.discriminatedUnion('type', [
243
239
  z.object({
244
- type: z.literal("thread_started"),
240
+ type: z.literal('thread_started'),
245
241
  sessionId: z.string(),
246
242
  provider: AgentProviderSchema,
247
243
  }),
248
244
  z.object({
249
- type: z.literal("turn_started"),
245
+ type: z.literal('turn_started'),
250
246
  provider: AgentProviderSchema,
251
247
  }),
252
248
  z.object({
253
- type: z.literal("turn_completed"),
249
+ type: z.literal('turn_completed'),
254
250
  provider: AgentProviderSchema,
255
251
  usage: AgentUsageSchema.optional(),
256
252
  }),
257
253
  z.object({
258
- type: z.literal("turn_failed"),
254
+ type: z.literal('turn_failed'),
259
255
  provider: AgentProviderSchema,
260
256
  error: z.string(),
261
257
  }),
262
258
  z.object({
263
- type: z.literal("turn_canceled"),
259
+ type: z.literal('turn_canceled'),
264
260
  provider: AgentProviderSchema,
265
261
  reason: z.string(),
266
262
  }),
267
263
  z.object({
268
- type: z.literal("timeline"),
264
+ type: z.literal('timeline'),
269
265
  provider: AgentProviderSchema,
270
266
  item: AgentTimelineItemPayloadSchema,
271
267
  }),
272
268
  z.object({
273
- type: z.literal("permission_requested"),
269
+ type: z.literal('permission_requested'),
274
270
  provider: AgentProviderSchema,
275
271
  request: AgentPermissionRequestPayloadSchema,
276
272
  }),
277
273
  z.object({
278
- type: z.literal("permission_resolved"),
274
+ type: z.literal('permission_resolved'),
279
275
  provider: AgentProviderSchema,
280
276
  requestId: z.string(),
281
277
  resolution: AgentPermissionResponseSchema,
282
278
  }),
283
279
  z.object({
284
- type: z.literal("attention_required"),
280
+ type: z.literal('attention_required'),
285
281
  provider: AgentProviderSchema,
286
- reason: z.enum(["finished", "error", "permission"]),
282
+ reason: z.enum(['finished', 'error', 'permission']),
287
283
  timestamp: z.string(),
288
284
  shouldNotify: z.boolean(),
285
+ notification: z
286
+ .object({
287
+ title: z.string(),
288
+ body: z.string(),
289
+ data: z.object({
290
+ serverId: z.string(),
291
+ agentId: z.string(),
292
+ reason: z.enum(['finished', 'error', 'permission']),
293
+ }),
294
+ })
295
+ .optional(),
289
296
  }),
290
297
  ]);
291
298
  const AgentPersistenceHandleSchema = z
@@ -324,7 +331,7 @@ export const AgentSnapshotPayloadSchema = z.object({
324
331
  title: z.string().nullable(),
325
332
  labels: z.record(z.string()).default({}),
326
333
  requiresAttention: z.boolean().optional(),
327
- attentionReason: z.enum(["finished", "error", "permission"]).nullable().optional(),
334
+ attentionReason: z.enum(['finished', 'error', 'permission']).nullable().optional(),
328
335
  attentionTimestamp: z.string().nullable().optional(),
329
336
  archivedAt: z.string().nullable().optional(),
330
337
  });
@@ -332,89 +339,71 @@ export const AgentSnapshotPayloadSchema = z.object({
332
339
  // Session Inbound Messages (Session receives these)
333
340
  // ============================================================================
334
341
  export const VoiceAudioChunkMessageSchema = z.object({
335
- type: z.literal("voice_audio_chunk"),
342
+ type: z.literal('voice_audio_chunk'),
336
343
  audio: z.string(), // base64 encoded
337
344
  format: z.string(),
338
345
  isLast: z.boolean(),
339
346
  });
340
347
  export const AbortRequestMessageSchema = z.object({
341
- type: z.literal("abort_request"),
348
+ type: z.literal('abort_request'),
342
349
  });
343
350
  export const AudioPlayedMessageSchema = z.object({
344
- type: z.literal("audio_played"),
351
+ type: z.literal('audio_played'),
345
352
  id: z.string(),
346
353
  });
347
- export const RequestAgentListMessageSchema = z.object({
348
- type: z.literal("request_agent_list"),
349
- requestId: z.string(),
350
- filter: z.object({
351
- labels: z.record(z.string()).optional(),
352
- }).optional(),
353
- });
354
- export const SubscribeAgentUpdatesMessageSchema = z.object({
355
- type: z.literal("subscribe_agent_updates"),
356
- subscriptionId: z.string(),
357
- filter: z.object({
358
- labels: z.record(z.string()).optional(),
359
- agentId: z.string().optional(),
360
- }).optional(),
361
- });
362
- export const UnsubscribeAgentUpdatesMessageSchema = z.object({
363
- type: z.literal("unsubscribe_agent_updates"),
364
- subscriptionId: z.string(),
354
+ const AgentDirectoryFilterSchema = z.object({
355
+ labels: z.record(z.string()).optional(),
356
+ projectKeys: z.array(z.string()).optional(),
357
+ statuses: z.array(AgentStatusSchema).optional(),
358
+ includeArchived: z.boolean().optional(),
359
+ requiresAttention: z.boolean().optional(),
365
360
  });
366
361
  export const DeleteAgentRequestMessageSchema = z.object({
367
- type: z.literal("delete_agent_request"),
362
+ type: z.literal('delete_agent_request'),
368
363
  agentId: z.string(),
369
364
  requestId: z.string(),
370
365
  });
371
366
  export const ArchiveAgentRequestMessageSchema = z.object({
372
- type: z.literal("archive_agent_request"),
367
+ type: z.literal('archive_agent_request'),
373
368
  agentId: z.string(),
374
369
  requestId: z.string(),
375
370
  });
376
371
  export const UpdateAgentRequestMessageSchema = z.object({
377
- type: z.literal("update_agent_request"),
372
+ type: z.literal('update_agent_request'),
378
373
  agentId: z.string(),
379
374
  name: z.string().optional(),
380
375
  labels: z.record(z.string()).optional(),
381
376
  requestId: z.string(),
382
377
  });
383
378
  export const SetVoiceModeMessageSchema = z.object({
384
- type: z.literal("set_voice_mode"),
379
+ type: z.literal('set_voice_mode'),
385
380
  enabled: z.boolean(),
386
381
  agentId: z.string().optional(),
387
382
  requestId: z.string().optional(),
388
383
  });
389
384
  export const SendAgentMessageSchema = z.object({
390
- type: z.literal("send_agent_message"),
385
+ type: z.literal('send_agent_message'),
391
386
  agentId: z.string(),
392
387
  text: z.string(),
393
388
  messageId: z.string().optional(), // Client-provided ID for deduplication
394
- images: z.array(z.object({
389
+ images: z
390
+ .array(z.object({
395
391
  data: z.string(), // base64 encoded image
396
392
  mimeType: z.string(), // e.g., "image/jpeg", "image/png"
397
- })).optional(),
393
+ }))
394
+ .optional(),
398
395
  });
399
396
  // ============================================================================
400
397
  // Agent RPCs (requestId-correlated)
401
398
  // ============================================================================
402
399
  export const FetchAgentsRequestMessageSchema = z.object({
403
- type: z.literal("fetch_agents_request"),
400
+ type: z.literal('fetch_agents_request'),
404
401
  requestId: z.string(),
405
- filter: z
406
- .object({
407
- labels: z.record(z.string()).optional(),
408
- projectKeys: z.array(z.string()).optional(),
409
- statuses: z.array(AgentStatusSchema).optional(),
410
- includeArchived: z.boolean().optional(),
411
- requiresAttention: z.boolean().optional(),
412
- })
413
- .optional(),
402
+ filter: AgentDirectoryFilterSchema.optional(),
414
403
  sort: z
415
404
  .array(z.object({
416
- key: z.enum(["status_priority", "created_at", "updated_at", "title"]),
417
- direction: z.enum(["asc", "desc"]),
405
+ key: z.enum(['status_priority', 'created_at', 'updated_at', 'title']),
406
+ direction: z.enum(['asc', 'desc']),
418
407
  }))
419
408
  .optional(),
420
409
  page: z
@@ -423,15 +412,20 @@ export const FetchAgentsRequestMessageSchema = z.object({
423
412
  cursor: z.string().min(1).optional(),
424
413
  })
425
414
  .optional(),
415
+ subscribe: z
416
+ .object({
417
+ subscriptionId: z.string().optional(),
418
+ })
419
+ .optional(),
426
420
  });
427
421
  export const FetchAgentRequestMessageSchema = z.object({
428
- type: z.literal("fetch_agent_request"),
422
+ type: z.literal('fetch_agent_request'),
429
423
  requestId: z.string(),
430
424
  /** Accepts full ID, unique prefix, or exact full title (server resolves). */
431
425
  agentId: z.string(),
432
426
  });
433
427
  export const SendAgentMessageRequestSchema = z.object({
434
- type: z.literal("send_agent_message_request"),
428
+ type: z.literal('send_agent_message_request'),
435
429
  requestId: z.string(),
436
430
  /** Accepts full ID, unique prefix, or exact full title (server resolves). */
437
431
  agentId: z.string(),
@@ -445,7 +439,7 @@ export const SendAgentMessageRequestSchema = z.object({
445
439
  .optional(),
446
440
  });
447
441
  export const WaitForFinishRequestSchema = z.object({
448
- type: z.literal("wait_for_finish_request"),
442
+ type: z.literal('wait_for_finish_request'),
449
443
  requestId: z.string(),
450
444
  /** Accepts full ID, unique prefix, or exact full title (server resolves). */
451
445
  agentId: z.string(),
@@ -455,24 +449,24 @@ export const WaitForFinishRequestSchema = z.object({
455
449
  // Dictation Streaming (lossless, resumable)
456
450
  // ============================================================================
457
451
  export const DictationStreamStartMessageSchema = z.object({
458
- type: z.literal("dictation_stream_start"),
452
+ type: z.literal('dictation_stream_start'),
459
453
  dictationId: z.string(),
460
454
  format: z.string(), // e.g. "audio/pcm;rate=16000;bits=16"
461
455
  });
462
456
  export const DictationStreamChunkMessageSchema = z.object({
463
- type: z.literal("dictation_stream_chunk"),
457
+ type: z.literal('dictation_stream_chunk'),
464
458
  dictationId: z.string(),
465
459
  seq: z.number().int().nonnegative(),
466
460
  audio: z.string(), // base64 encoded chunk
467
461
  format: z.string(), // e.g. "audio/pcm;rate=16000;bits=16"
468
462
  });
469
463
  export const DictationStreamFinishMessageSchema = z.object({
470
- type: z.literal("dictation_stream_finish"),
464
+ type: z.literal('dictation_stream_finish'),
471
465
  dictationId: z.string(),
472
466
  finalSeq: z.number().int().nonnegative(),
473
467
  });
474
468
  export const DictationStreamCancelMessageSchema = z.object({
475
- type: z.literal("dictation_stream_cancel"),
469
+ type: z.literal('dictation_stream_cancel'),
476
470
  dictationId: z.string(),
477
471
  });
478
472
  const GitSetupOptionsSchema = z.object({
@@ -483,55 +477,57 @@ const GitSetupOptionsSchema = z.object({
483
477
  worktreeSlug: z.string().optional(),
484
478
  });
485
479
  export const CreateAgentRequestMessageSchema = z.object({
486
- type: z.literal("create_agent_request"),
480
+ type: z.literal('create_agent_request'),
487
481
  config: AgentSessionConfigSchema,
488
482
  worktreeName: z.string().optional(),
489
483
  initialPrompt: z.string().optional(),
490
484
  outputSchema: z.record(z.unknown()).optional(),
491
- images: z.array(z.object({
485
+ images: z
486
+ .array(z.object({
492
487
  data: z.string(), // base64 encoded image
493
488
  mimeType: z.string(), // e.g., "image/jpeg", "image/png"
494
- })).optional(),
489
+ }))
490
+ .optional(),
495
491
  git: GitSetupOptionsSchema.optional(),
496
492
  labels: z.record(z.string()).default({}),
497
493
  requestId: z.string(),
498
494
  });
499
495
  export const ListProviderModelsRequestMessageSchema = z.object({
500
- type: z.literal("list_provider_models_request"),
496
+ type: z.literal('list_provider_models_request'),
501
497
  provider: AgentProviderSchema,
502
498
  cwd: z.string().optional(),
503
499
  requestId: z.string(),
504
500
  });
505
501
  export const ListAvailableProvidersRequestMessageSchema = z.object({
506
- type: z.literal("list_available_providers_request"),
502
+ type: z.literal('list_available_providers_request'),
507
503
  requestId: z.string(),
508
504
  });
509
505
  export const SpeechModelsListRequestSchema = z.object({
510
- type: z.literal("speech_models_list_request"),
506
+ type: z.literal('speech_models_list_request'),
511
507
  requestId: z.string(),
512
508
  });
513
509
  export const SpeechModelsDownloadRequestSchema = z.object({
514
- type: z.literal("speech_models_download_request"),
510
+ type: z.literal('speech_models_download_request'),
515
511
  modelIds: z.array(z.string()).optional(),
516
512
  requestId: z.string(),
517
513
  });
518
514
  export const ResumeAgentRequestMessageSchema = z.object({
519
- type: z.literal("resume_agent_request"),
515
+ type: z.literal('resume_agent_request'),
520
516
  handle: AgentPersistenceHandleSchema,
521
517
  overrides: AgentSessionConfigSchema.partial().optional(),
522
518
  requestId: z.string(),
523
519
  });
524
520
  export const RefreshAgentRequestMessageSchema = z.object({
525
- type: z.literal("refresh_agent_request"),
521
+ type: z.literal('refresh_agent_request'),
526
522
  agentId: z.string(),
527
523
  requestId: z.string(),
528
524
  });
529
525
  export const CancelAgentRequestMessageSchema = z.object({
530
- type: z.literal("cancel_agent_request"),
526
+ type: z.literal('cancel_agent_request'),
531
527
  agentId: z.string(),
532
528
  });
533
529
  export const RestartServerRequestMessageSchema = z.object({
534
- type: z.literal("restart_server_request"),
530
+ type: z.literal('restart_server_request'),
535
531
  reason: z.string().optional(),
536
532
  requestId: z.string(),
537
533
  });
@@ -540,24 +536,24 @@ export const AgentTimelineCursorSchema = z.object({
540
536
  seq: z.number().int().nonnegative(),
541
537
  });
542
538
  export const FetchAgentTimelineRequestMessageSchema = z.object({
543
- type: z.literal("fetch_agent_timeline_request"),
539
+ type: z.literal('fetch_agent_timeline_request'),
544
540
  agentId: z.string(),
545
541
  requestId: z.string(),
546
- direction: z.enum(["tail", "before", "after"]).optional(),
542
+ direction: z.enum(['tail', 'before', 'after']).optional(),
547
543
  cursor: AgentTimelineCursorSchema.optional(),
548
544
  // 0 means "all matching rows for this query window".
549
545
  limit: z.number().int().nonnegative().optional(),
550
546
  // Default should be projected for app timeline loading.
551
- projection: z.enum(["projected", "canonical"]).optional(),
547
+ projection: z.enum(['projected', 'canonical']).optional(),
552
548
  });
553
549
  export const SetAgentModeRequestMessageSchema = z.object({
554
- type: z.literal("set_agent_mode_request"),
550
+ type: z.literal('set_agent_mode_request'),
555
551
  agentId: z.string(),
556
552
  modeId: z.string(),
557
553
  requestId: z.string(),
558
554
  });
559
555
  export const SetAgentModeResponseMessageSchema = z.object({
560
- type: z.literal("set_agent_mode_response"),
556
+ type: z.literal('set_agent_mode_response'),
561
557
  payload: z.object({
562
558
  requestId: z.string(),
563
559
  agentId: z.string(),
@@ -566,13 +562,13 @@ export const SetAgentModeResponseMessageSchema = z.object({
566
562
  }),
567
563
  });
568
564
  export const SetAgentModelRequestMessageSchema = z.object({
569
- type: z.literal("set_agent_model_request"),
565
+ type: z.literal('set_agent_model_request'),
570
566
  agentId: z.string(),
571
567
  modelId: z.string().nullable(),
572
568
  requestId: z.string(),
573
569
  });
574
570
  export const SetAgentModelResponseMessageSchema = z.object({
575
- type: z.literal("set_agent_model_response"),
571
+ type: z.literal('set_agent_model_response'),
576
572
  payload: z.object({
577
573
  requestId: z.string(),
578
574
  agentId: z.string(),
@@ -581,13 +577,13 @@ export const SetAgentModelResponseMessageSchema = z.object({
581
577
  }),
582
578
  });
583
579
  export const SetAgentThinkingRequestMessageSchema = z.object({
584
- type: z.literal("set_agent_thinking_request"),
580
+ type: z.literal('set_agent_thinking_request'),
585
581
  agentId: z.string(),
586
582
  thinkingOptionId: z.string().nullable(),
587
583
  requestId: z.string(),
588
584
  });
589
585
  export const SetAgentThinkingResponseMessageSchema = z.object({
590
- type: z.literal("set_agent_thinking_response"),
586
+ type: z.literal('set_agent_thinking_response'),
591
587
  payload: z.object({
592
588
  requestId: z.string(),
593
589
  agentId: z.string(),
@@ -596,7 +592,7 @@ export const SetAgentThinkingResponseMessageSchema = z.object({
596
592
  }),
597
593
  });
598
594
  export const UpdateAgentResponseMessageSchema = z.object({
599
- type: z.literal("update_agent_response"),
595
+ type: z.literal('update_agent_response'),
600
596
  payload: z.object({
601
597
  requestId: z.string(),
602
598
  agentId: z.string(),
@@ -605,7 +601,7 @@ export const UpdateAgentResponseMessageSchema = z.object({
605
601
  }),
606
602
  });
607
603
  export const SetVoiceModeResponseMessageSchema = z.object({
608
- type: z.literal("set_voice_mode_response"),
604
+ type: z.literal('set_voice_mode_response'),
609
605
  payload: z.object({
610
606
  requestId: z.string(),
611
607
  enabled: z.boolean(),
@@ -618,70 +614,65 @@ export const SetVoiceModeResponseMessageSchema = z.object({
618
614
  }),
619
615
  });
620
616
  export const AgentPermissionResponseMessageSchema = z.object({
621
- type: z.literal("agent_permission_response"),
617
+ type: z.literal('agent_permission_response'),
622
618
  agentId: z.string(),
623
619
  requestId: z.string(),
624
620
  response: AgentPermissionResponseSchema,
625
621
  });
626
- const CheckoutErrorCodeSchema = z.enum([
627
- "NOT_GIT_REPO",
628
- "NOT_ALLOWED",
629
- "MERGE_CONFLICT",
630
- "UNKNOWN",
631
- ]);
622
+ const CheckoutErrorCodeSchema = z.enum(['NOT_GIT_REPO', 'NOT_ALLOWED', 'MERGE_CONFLICT', 'UNKNOWN']);
632
623
  const CheckoutErrorSchema = z.object({
633
624
  code: CheckoutErrorCodeSchema,
634
625
  message: z.string(),
635
626
  });
636
627
  const CheckoutDiffCompareSchema = z.object({
637
- mode: z.enum(["uncommitted", "base"]),
628
+ mode: z.enum(['uncommitted', 'base']),
638
629
  baseRef: z.string().optional(),
639
630
  });
640
631
  export const CheckoutStatusRequestSchema = z.object({
641
- type: z.literal("checkout_status_request"),
632
+ type: z.literal('checkout_status_request'),
642
633
  cwd: z.string(),
643
634
  requestId: z.string(),
644
635
  });
645
636
  export const SubscribeCheckoutDiffRequestSchema = z.object({
646
- type: z.literal("subscribe_checkout_diff_request"),
637
+ type: z.literal('subscribe_checkout_diff_request'),
647
638
  subscriptionId: z.string(),
648
639
  cwd: z.string(),
649
640
  compare: CheckoutDiffCompareSchema,
650
641
  requestId: z.string(),
651
642
  });
652
643
  export const UnsubscribeCheckoutDiffRequestSchema = z.object({
653
- type: z.literal("unsubscribe_checkout_diff_request"),
644
+ type: z.literal('unsubscribe_checkout_diff_request'),
654
645
  subscriptionId: z.string(),
655
646
  });
656
647
  export const CheckoutCommitRequestSchema = z.object({
657
- type: z.literal("checkout_commit_request"),
648
+ type: z.literal('checkout_commit_request'),
658
649
  cwd: z.string(),
659
650
  message: z.string().optional(),
660
651
  addAll: z.boolean().optional(),
661
652
  requestId: z.string(),
662
653
  });
663
654
  export const CheckoutMergeRequestSchema = z.object({
664
- type: z.literal("checkout_merge_request"),
655
+ type: z.literal('checkout_merge_request'),
665
656
  cwd: z.string(),
666
657
  baseRef: z.string().optional(),
667
- strategy: z.enum(["merge", "squash"]).optional(),
658
+ strategy: z.enum(['merge', 'squash']).optional(),
668
659
  requireCleanTarget: z.boolean().optional(),
669
660
  requestId: z.string(),
670
661
  });
671
662
  export const CheckoutMergeFromBaseRequestSchema = z.object({
672
- type: z.literal("checkout_merge_from_base_request"),
663
+ type: z.literal('checkout_merge_from_base_request'),
673
664
  cwd: z.string(),
674
665
  baseRef: z.string().optional(),
675
666
  requireCleanTarget: z.boolean().optional(),
676
667
  requestId: z.string(),
677
668
  });
678
669
  export const CheckoutPushRequestSchema = z.object({
679
- type: z.literal("checkout_push_request"),
670
+ type: z.literal('checkout_push_request'),
680
671
  cwd: z.string(),
681
672
  requestId: z.string(),
682
673
  });
683
674
  export const CheckoutPrCreateRequestSchema = z.object({
684
- type: z.literal("checkout_pr_create_request"),
675
+ type: z.literal('checkout_pr_create_request'),
685
676
  cwd: z.string(),
686
677
  title: z.string().optional(),
687
678
  body: z.string().optional(),
@@ -689,37 +680,40 @@ export const CheckoutPrCreateRequestSchema = z.object({
689
680
  requestId: z.string(),
690
681
  });
691
682
  export const CheckoutPrStatusRequestSchema = z.object({
692
- type: z.literal("checkout_pr_status_request"),
683
+ type: z.literal('checkout_pr_status_request'),
693
684
  cwd: z.string(),
694
685
  requestId: z.string(),
695
686
  });
696
687
  export const ValidateBranchRequestSchema = z.object({
697
- type: z.literal("validate_branch_request"),
688
+ type: z.literal('validate_branch_request'),
698
689
  cwd: z.string(),
699
690
  branchName: z.string(),
700
691
  requestId: z.string(),
701
692
  });
702
693
  export const BranchSuggestionsRequestSchema = z.object({
703
- type: z.literal("branch_suggestions_request"),
694
+ type: z.literal('branch_suggestions_request'),
704
695
  cwd: z.string(),
705
696
  query: z.string().optional(),
706
697
  limit: z.number().int().min(1).max(200).optional(),
707
698
  requestId: z.string(),
708
699
  });
709
700
  export const DirectorySuggestionsRequestSchema = z.object({
710
- type: z.literal("directory_suggestions_request"),
701
+ type: z.literal('directory_suggestions_request'),
711
702
  query: z.string(),
703
+ cwd: z.string().optional(),
704
+ includeFiles: z.boolean().optional(),
705
+ includeDirectories: z.boolean().optional(),
712
706
  limit: z.number().int().min(1).max(100).optional(),
713
707
  requestId: z.string(),
714
708
  });
715
709
  export const PaseoWorktreeListRequestSchema = z.object({
716
- type: z.literal("paseo_worktree_list_request"),
710
+ type: z.literal('paseo_worktree_list_request'),
717
711
  cwd: z.string().optional(),
718
712
  repoRoot: z.string().optional(),
719
713
  requestId: z.string(),
720
714
  });
721
715
  export const PaseoWorktreeArchiveRequestSchema = z.object({
722
- type: z.literal("paseo_worktree_archive_request"),
716
+ type: z.literal('paseo_worktree_archive_request'),
723
717
  worktreePath: z.string().optional(),
724
718
  repoRoot: z.string().optional(),
725
719
  branchName: z.string().optional(),
@@ -732,7 +726,7 @@ const HighlightTokenSchema = z.object({
732
726
  style: z.string().nullable(),
733
727
  });
734
728
  const DiffLineSchema = z.object({
735
- type: z.enum(["add", "remove", "context", "header"]),
729
+ type: z.enum(['add', 'remove', 'context', 'header']),
736
730
  content: z.string(),
737
731
  tokens: z.array(HighlightTokenSchema).optional(),
738
732
  });
@@ -750,19 +744,19 @@ const ParsedDiffFileSchema = z.object({
750
744
  additions: z.number(),
751
745
  deletions: z.number(),
752
746
  hunks: z.array(DiffHunkSchema),
753
- status: z.enum(["ok", "too_large", "binary"]).optional(),
747
+ status: z.enum(['ok', 'too_large', 'binary']).optional(),
754
748
  });
755
749
  const FileExplorerEntrySchema = z.object({
756
750
  name: z.string(),
757
751
  path: z.string(),
758
- kind: z.enum(["file", "directory"]),
752
+ kind: z.enum(['file', 'directory']),
759
753
  size: z.number(),
760
754
  modifiedAt: z.string(),
761
755
  });
762
756
  const FileExplorerFileSchema = z.object({
763
757
  path: z.string(),
764
- kind: z.enum(["text", "image", "binary"]),
765
- encoding: z.enum(["utf-8", "base64", "none"]),
758
+ kind: z.enum(['text', 'image', 'binary']),
759
+ encoding: z.enum(['utf-8', 'base64', 'none']),
766
760
  content: z.string().optional(),
767
761
  mimeType: z.string().optional(),
768
762
  size: z.number(),
@@ -773,110 +767,111 @@ const FileExplorerDirectorySchema = z.object({
773
767
  entries: z.array(FileExplorerEntrySchema),
774
768
  });
775
769
  export const FileExplorerRequestSchema = z.object({
776
- type: z.literal("file_explorer_request"),
770
+ type: z.literal('file_explorer_request'),
777
771
  agentId: z.string(),
778
772
  path: z.string().optional(),
779
- mode: z.enum(["list", "file"]),
773
+ mode: z.enum(['list', 'file']),
780
774
  requestId: z.string(),
781
775
  });
782
776
  export const ProjectIconRequestSchema = z.object({
783
- type: z.literal("project_icon_request"),
777
+ type: z.literal('project_icon_request'),
784
778
  cwd: z.string(),
785
779
  requestId: z.string(),
786
780
  });
787
781
  export const FileDownloadTokenRequestSchema = z.object({
788
- type: z.literal("file_download_token_request"),
782
+ type: z.literal('file_download_token_request'),
789
783
  agentId: z.string(),
790
784
  path: z.string(),
791
785
  requestId: z.string(),
792
786
  });
793
787
  export const ClearAgentAttentionMessageSchema = z.object({
794
- type: z.literal("clear_agent_attention"),
788
+ type: z.literal('clear_agent_attention'),
795
789
  agentId: z.union([z.string(), z.array(z.string())]),
796
790
  });
797
791
  export const ClientHeartbeatMessageSchema = z.object({
798
- type: z.literal("client_heartbeat"),
799
- deviceType: z.enum(["web", "mobile"]),
792
+ type: z.literal('client_heartbeat'),
793
+ deviceType: z.enum(['web', 'mobile']),
800
794
  focusedAgentId: z.string().nullable(),
801
795
  lastActivityAt: z.string(),
802
796
  appVisible: z.boolean(),
803
797
  appVisibilityChangedAt: z.string().optional(),
804
798
  });
805
799
  export const PingMessageSchema = z.object({
806
- type: z.literal("ping"),
800
+ type: z.literal('ping'),
807
801
  requestId: z.string(),
808
802
  clientSentAt: z.number().int().optional(),
809
803
  });
810
- export const ListCommandsRequestSchema = z.object({
811
- type: z.literal("list_commands_request"),
812
- agentId: z.string(),
813
- requestId: z.string(),
804
+ const ListCommandsDraftConfigSchema = z.object({
805
+ provider: AgentProviderSchema,
806
+ cwd: z.string(),
807
+ modeId: z.string().optional(),
808
+ model: z.string().optional(),
809
+ thinkingOptionId: z.string().optional(),
814
810
  });
815
- export const ExecuteCommandRequestSchema = z.object({
816
- type: z.literal("execute_command_request"),
811
+ export const ListCommandsRequestSchema = z.object({
812
+ type: z.literal('list_commands_request'),
817
813
  agentId: z.string(),
818
- commandName: z.string(),
819
- args: z.string().optional(),
814
+ draftConfig: ListCommandsDraftConfigSchema.optional(),
820
815
  requestId: z.string(),
821
816
  });
822
817
  export const RegisterPushTokenMessageSchema = z.object({
823
- type: z.literal("register_push_token"),
818
+ type: z.literal('register_push_token'),
824
819
  token: z.string(),
825
820
  });
826
821
  // ============================================================================
827
822
  // Terminal Messages
828
823
  // ============================================================================
829
824
  export const ListTerminalsRequestSchema = z.object({
830
- type: z.literal("list_terminals_request"),
825
+ type: z.literal('list_terminals_request'),
831
826
  cwd: z.string(),
832
827
  requestId: z.string(),
833
828
  });
834
829
  export const SubscribeTerminalsRequestSchema = z.object({
835
- type: z.literal("subscribe_terminals_request"),
830
+ type: z.literal('subscribe_terminals_request'),
836
831
  cwd: z.string(),
837
832
  });
838
833
  export const UnsubscribeTerminalsRequestSchema = z.object({
839
- type: z.literal("unsubscribe_terminals_request"),
834
+ type: z.literal('unsubscribe_terminals_request'),
840
835
  cwd: z.string(),
841
836
  });
842
837
  export const CreateTerminalRequestSchema = z.object({
843
- type: z.literal("create_terminal_request"),
838
+ type: z.literal('create_terminal_request'),
844
839
  cwd: z.string(),
845
840
  name: z.string().optional(),
846
841
  requestId: z.string(),
847
842
  });
848
843
  export const SubscribeTerminalRequestSchema = z.object({
849
- type: z.literal("subscribe_terminal_request"),
844
+ type: z.literal('subscribe_terminal_request'),
850
845
  terminalId: z.string(),
851
846
  requestId: z.string(),
852
847
  });
853
848
  export const UnsubscribeTerminalRequestSchema = z.object({
854
- type: z.literal("unsubscribe_terminal_request"),
849
+ type: z.literal('unsubscribe_terminal_request'),
855
850
  terminalId: z.string(),
856
851
  });
857
- const TerminalClientMessageSchema = z.discriminatedUnion("type", [
858
- z.object({ type: z.literal("input"), data: z.string() }),
859
- z.object({ type: z.literal("resize"), rows: z.number(), cols: z.number() }),
852
+ const TerminalClientMessageSchema = z.discriminatedUnion('type', [
853
+ z.object({ type: z.literal('input'), data: z.string() }),
854
+ z.object({ type: z.literal('resize'), rows: z.number(), cols: z.number() }),
860
855
  z.object({
861
- type: z.literal("mouse"),
856
+ type: z.literal('mouse'),
862
857
  row: z.number(),
863
858
  col: z.number(),
864
859
  button: z.number(),
865
- action: z.enum(["down", "up", "move"]),
860
+ action: z.enum(['down', 'up', 'move']),
866
861
  }),
867
862
  ]);
868
863
  export const TerminalInputSchema = z.object({
869
- type: z.literal("terminal_input"),
864
+ type: z.literal('terminal_input'),
870
865
  terminalId: z.string(),
871
866
  message: TerminalClientMessageSchema,
872
867
  });
873
868
  export const KillTerminalRequestSchema = z.object({
874
- type: z.literal("kill_terminal_request"),
869
+ type: z.literal('kill_terminal_request'),
875
870
  terminalId: z.string(),
876
871
  requestId: z.string(),
877
872
  });
878
873
  export const AttachTerminalStreamRequestSchema = z.object({
879
- type: z.literal("attach_terminal_stream_request"),
874
+ type: z.literal('attach_terminal_stream_request'),
880
875
  terminalId: z.string(),
881
876
  resumeOffset: z.number().int().nonnegative().optional(),
882
877
  rows: z.number().int().positive().optional(),
@@ -884,18 +879,16 @@ export const AttachTerminalStreamRequestSchema = z.object({
884
879
  requestId: z.string(),
885
880
  });
886
881
  export const DetachTerminalStreamRequestSchema = z.object({
887
- type: z.literal("detach_terminal_stream_request"),
882
+ type: z.literal('detach_terminal_stream_request'),
888
883
  streamId: z.number().int().nonnegative(),
889
884
  requestId: z.string(),
890
885
  });
891
- export const SessionInboundMessageSchema = z.discriminatedUnion("type", [
886
+ export const SessionInboundMessageSchema = z.discriminatedUnion('type', [
892
887
  VoiceAudioChunkMessageSchema,
893
888
  AbortRequestMessageSchema,
894
889
  AudioPlayedMessageSchema,
895
890
  FetchAgentsRequestMessageSchema,
896
891
  FetchAgentRequestMessageSchema,
897
- SubscribeAgentUpdatesMessageSchema,
898
- UnsubscribeAgentUpdatesMessageSchema,
899
892
  DeleteAgentRequestMessageSchema,
900
893
  ArchiveAgentRequestMessageSchema,
901
894
  UpdateAgentRequestMessageSchema,
@@ -941,7 +934,6 @@ export const SessionInboundMessageSchema = z.discriminatedUnion("type", [
941
934
  ClientHeartbeatMessageSchema,
942
935
  PingMessageSchema,
943
936
  ListCommandsRequestSchema,
944
- ExecuteCommandRequestSchema,
945
937
  RegisterPushTokenMessageSchema,
946
938
  ListTerminalsRequestSchema,
947
939
  SubscribeTerminalsRequestSchema,
@@ -960,29 +952,22 @@ export const SessionInboundMessageSchema = z.discriminatedUnion("type", [
960
952
  export const ActivityLogPayloadSchema = z.object({
961
953
  id: z.string(),
962
954
  timestamp: z.coerce.date(),
963
- type: z.enum([
964
- "transcript",
965
- "assistant",
966
- "tool_call",
967
- "tool_result",
968
- "error",
969
- "system",
970
- ]),
955
+ type: z.enum(['transcript', 'assistant', 'tool_call', 'tool_result', 'error', 'system']),
971
956
  content: z.string(),
972
957
  metadata: z.record(z.unknown()).optional(),
973
958
  });
974
959
  export const ActivityLogMessageSchema = z.object({
975
- type: z.literal("activity_log"),
960
+ type: z.literal('activity_log'),
976
961
  payload: ActivityLogPayloadSchema,
977
962
  });
978
963
  export const AssistantChunkMessageSchema = z.object({
979
- type: z.literal("assistant_chunk"),
964
+ type: z.literal('assistant_chunk'),
980
965
  payload: z.object({
981
966
  chunk: z.string(),
982
967
  }),
983
968
  });
984
969
  export const AudioOutputMessageSchema = z.object({
985
- type: z.literal("audio_output"),
970
+ type: z.literal('audio_output'),
986
971
  payload: z.object({
987
972
  audio: z.string(), // base64 encoded
988
973
  format: z.string(),
@@ -994,7 +979,7 @@ export const AudioOutputMessageSchema = z.object({
994
979
  }),
995
980
  });
996
981
  export const TranscriptionResultMessageSchema = z.object({
997
- type: z.literal("transcription_result"),
982
+ type: z.literal('transcription_result'),
998
983
  payload: z.object({
999
984
  text: z.string(),
1000
985
  language: z.string().optional(),
@@ -1008,28 +993,28 @@ export const TranscriptionResultMessageSchema = z.object({
1008
993
  }),
1009
994
  });
1010
995
  export const DictationStreamAckMessageSchema = z.object({
1011
- type: z.literal("dictation_stream_ack"),
996
+ type: z.literal('dictation_stream_ack'),
1012
997
  payload: z.object({
1013
998
  dictationId: z.string(),
1014
999
  ackSeq: z.number().int(),
1015
1000
  }),
1016
1001
  });
1017
1002
  export const DictationStreamFinishAcceptedMessageSchema = z.object({
1018
- type: z.literal("dictation_stream_finish_accepted"),
1003
+ type: z.literal('dictation_stream_finish_accepted'),
1019
1004
  payload: z.object({
1020
1005
  dictationId: z.string(),
1021
1006
  timeoutMs: z.number().int().positive(),
1022
1007
  }),
1023
1008
  });
1024
1009
  export const DictationStreamPartialMessageSchema = z.object({
1025
- type: z.literal("dictation_stream_partial"),
1010
+ type: z.literal('dictation_stream_partial'),
1026
1011
  payload: z.object({
1027
1012
  dictationId: z.string(),
1028
1013
  text: z.string(),
1029
1014
  }),
1030
1015
  });
1031
1016
  export const DictationStreamFinalMessageSchema = z.object({
1032
- type: z.literal("dictation_stream_final"),
1017
+ type: z.literal('dictation_stream_final'),
1033
1018
  payload: z.object({
1034
1019
  dictationId: z.string(),
1035
1020
  text: z.string(),
@@ -1037,7 +1022,7 @@ export const DictationStreamFinalMessageSchema = z.object({
1037
1022
  }),
1038
1023
  });
1039
1024
  export const DictationStreamErrorMessageSchema = z.object({
1040
- type: z.literal("dictation_stream_error"),
1025
+ type: z.literal('dictation_stream_error'),
1041
1026
  payload: z.object({
1042
1027
  dictationId: z.string(),
1043
1028
  error: z.string(),
@@ -1060,10 +1045,15 @@ export const ServerCapabilitiesSchema = z
1060
1045
  voice: ServerVoiceCapabilitiesSchema.optional(),
1061
1046
  })
1062
1047
  .passthrough();
1063
- const ServerInfoHostnameSchema = z
1064
- .unknown()
1065
- .transform((value) => {
1066
- if (typeof value !== "string") {
1048
+ const ServerInfoHostnameSchema = z.unknown().transform((value) => {
1049
+ if (typeof value !== 'string') {
1050
+ return null;
1051
+ }
1052
+ const trimmed = value.trim();
1053
+ return trimmed.length > 0 ? trimmed : null;
1054
+ });
1055
+ const ServerInfoVersionSchema = z.unknown().transform((value) => {
1056
+ if (typeof value !== 'string') {
1067
1057
  return null;
1068
1058
  }
1069
1059
  const trimmed = value.trim();
@@ -1084,18 +1074,20 @@ const ServerCapabilitiesFromUnknownSchema = z
1084
1074
  });
1085
1075
  export const ServerInfoStatusPayloadSchema = z
1086
1076
  .object({
1087
- status: z.literal("server_info"),
1077
+ status: z.literal('server_info'),
1088
1078
  serverId: z.string().trim().min(1),
1089
1079
  hostname: ServerInfoHostnameSchema.optional(),
1080
+ version: ServerInfoVersionSchema.optional(),
1090
1081
  capabilities: ServerCapabilitiesFromUnknownSchema,
1091
1082
  })
1092
1083
  .passthrough()
1093
1084
  .transform((payload) => ({
1094
1085
  ...payload,
1095
1086
  hostname: payload.hostname ?? null,
1087
+ version: payload.version ?? null,
1096
1088
  }));
1097
1089
  export const StatusMessageSchema = z.object({
1098
- type: z.literal("status"),
1090
+ type: z.literal('status'),
1099
1091
  payload: z
1100
1092
  .object({
1101
1093
  status: z.string(),
@@ -1103,7 +1095,7 @@ export const StatusMessageSchema = z.object({
1103
1095
  .passthrough(), // Allow additional fields
1104
1096
  });
1105
1097
  export const PongMessageSchema = z.object({
1106
- type: z.literal("pong"),
1098
+ type: z.literal('pong'),
1107
1099
  payload: z.object({
1108
1100
  requestId: z.string(),
1109
1101
  clientSentAt: z.number().int().optional(),
@@ -1112,7 +1104,7 @@ export const PongMessageSchema = z.object({
1112
1104
  }),
1113
1105
  });
1114
1106
  export const RpcErrorMessageSchema = z.object({
1115
- type: z.literal("rpc_error"),
1107
+ type: z.literal('rpc_error'),
1116
1108
  payload: z.object({
1117
1109
  requestId: z.string(),
1118
1110
  requestType: z.string().optional(),
@@ -1129,33 +1121,33 @@ const AgentStatusWithTimelineSchema = AgentStatusWithRequestSchema.extend({
1129
1121
  });
1130
1122
  export const AgentCreatedStatusPayloadSchema = z
1131
1123
  .object({
1132
- status: z.literal("agent_created"),
1124
+ status: z.literal('agent_created'),
1133
1125
  agent: AgentSnapshotPayloadSchema,
1134
1126
  })
1135
1127
  .extend(AgentStatusWithRequestSchema.shape);
1136
1128
  export const AgentCreateFailedStatusPayloadSchema = z.object({
1137
- status: z.literal("agent_create_failed"),
1129
+ status: z.literal('agent_create_failed'),
1138
1130
  requestId: z.string(),
1139
1131
  error: z.string(),
1140
1132
  });
1141
1133
  export const AgentResumedStatusPayloadSchema = z
1142
1134
  .object({
1143
- status: z.literal("agent_resumed"),
1135
+ status: z.literal('agent_resumed'),
1144
1136
  agent: AgentSnapshotPayloadSchema,
1145
1137
  })
1146
1138
  .extend(AgentStatusWithTimelineSchema.shape);
1147
1139
  export const AgentRefreshedStatusPayloadSchema = z
1148
1140
  .object({
1149
- status: z.literal("agent_refreshed"),
1141
+ status: z.literal('agent_refreshed'),
1150
1142
  })
1151
1143
  .extend(AgentStatusWithTimelineSchema.shape);
1152
1144
  export const RestartRequestedStatusPayloadSchema = z.object({
1153
- status: z.literal("restart_requested"),
1145
+ status: z.literal('restart_requested'),
1154
1146
  clientId: z.string(),
1155
1147
  reason: z.string().optional(),
1156
1148
  requestId: z.string(),
1157
1149
  });
1158
- export const KnownStatusPayloadSchema = z.discriminatedUnion("status", [
1150
+ export const KnownStatusPayloadSchema = z.discriminatedUnion('status', [
1159
1151
  AgentCreatedStatusPayloadSchema,
1160
1152
  AgentCreateFailedStatusPayloadSchema,
1161
1153
  AgentResumedStatusPayloadSchema,
@@ -1163,9 +1155,9 @@ export const KnownStatusPayloadSchema = z.discriminatedUnion("status", [
1163
1155
  RestartRequestedStatusPayloadSchema,
1164
1156
  ]);
1165
1157
  export const ArtifactMessageSchema = z.object({
1166
- type: z.literal("artifact"),
1158
+ type: z.literal('artifact'),
1167
1159
  payload: z.object({
1168
- type: z.enum(["markdown", "diff", "image", "code"]),
1160
+ type: z.enum(['markdown', 'diff', 'image', 'code']),
1169
1161
  id: z.string(),
1170
1162
  title: z.string(),
1171
1163
  content: z.string(),
@@ -1207,21 +1199,21 @@ export const ProjectPlacementPayloadSchema = z.object({
1207
1199
  checkout: ProjectCheckoutLitePayloadSchema,
1208
1200
  });
1209
1201
  export const AgentUpdateMessageSchema = z.object({
1210
- type: z.literal("agent_update"),
1211
- payload: z.discriminatedUnion("kind", [
1202
+ type: z.literal('agent_update'),
1203
+ payload: z.discriminatedUnion('kind', [
1212
1204
  z.object({
1213
- kind: z.literal("upsert"),
1205
+ kind: z.literal('upsert'),
1214
1206
  agent: AgentSnapshotPayloadSchema,
1215
1207
  project: ProjectPlacementPayloadSchema,
1216
1208
  }),
1217
1209
  z.object({
1218
- kind: z.literal("remove"),
1210
+ kind: z.literal('remove'),
1219
1211
  agentId: z.string(),
1220
1212
  }),
1221
1213
  ]),
1222
1214
  });
1223
1215
  export const AgentStreamMessageSchema = z.object({
1224
- type: z.literal("agent_stream"),
1216
+ type: z.literal('agent_stream'),
1225
1217
  payload: z.object({
1226
1218
  agentId: z.string(),
1227
1219
  event: AgentStreamEventPayloadSchema,
@@ -1232,7 +1224,7 @@ export const AgentStreamMessageSchema = z.object({
1232
1224
  }),
1233
1225
  });
1234
1226
  export const AgentStatusMessageSchema = z.object({
1235
- type: z.literal("agent_status"),
1227
+ type: z.literal('agent_status'),
1236
1228
  payload: z.object({
1237
1229
  agentId: z.string(),
1238
1230
  status: z.string(),
@@ -1240,15 +1232,16 @@ export const AgentStatusMessageSchema = z.object({
1240
1232
  }),
1241
1233
  });
1242
1234
  export const AgentListMessageSchema = z.object({
1243
- type: z.literal("agent_list"),
1235
+ type: z.literal('agent_list'),
1244
1236
  payload: z.object({
1245
1237
  agents: z.array(AgentSnapshotPayloadSchema),
1246
1238
  }),
1247
1239
  });
1248
1240
  export const FetchAgentsResponseMessageSchema = z.object({
1249
- type: z.literal("fetch_agents_response"),
1241
+ type: z.literal('fetch_agents_response'),
1250
1242
  payload: z.object({
1251
1243
  requestId: z.string(),
1244
+ subscriptionId: z.string().nullable().optional(),
1252
1245
  entries: z.array(z.object({
1253
1246
  agent: AgentSnapshotPayloadSchema,
1254
1247
  project: ProjectPlacementPayloadSchema,
@@ -1261,7 +1254,7 @@ export const FetchAgentsResponseMessageSchema = z.object({
1261
1254
  }),
1262
1255
  });
1263
1256
  export const FetchAgentResponseMessageSchema = z.object({
1264
- type: z.literal("fetch_agent_response"),
1257
+ type: z.literal('fetch_agent_response'),
1265
1258
  payload: z.object({
1266
1259
  requestId: z.string(),
1267
1260
  agent: AgentSnapshotPayloadSchema.nullable(),
@@ -1279,15 +1272,15 @@ export const AgentTimelineEntryPayloadSchema = z.object({
1279
1272
  seqStart: z.number().int().nonnegative(),
1280
1273
  seqEnd: z.number().int().nonnegative(),
1281
1274
  sourceSeqRanges: z.array(AgentTimelineSeqRangeSchema),
1282
- collapsed: z.array(z.enum(["assistant_merge", "tool_lifecycle"])),
1275
+ collapsed: z.array(z.enum(['assistant_merge', 'tool_lifecycle'])),
1283
1276
  });
1284
1277
  export const FetchAgentTimelineResponseMessageSchema = z.object({
1285
- type: z.literal("fetch_agent_timeline_response"),
1278
+ type: z.literal('fetch_agent_timeline_response'),
1286
1279
  payload: z.object({
1287
1280
  requestId: z.string(),
1288
1281
  agentId: z.string(),
1289
- direction: z.enum(["tail", "before", "after"]),
1290
- projection: z.enum(["projected", "canonical"]),
1282
+ direction: z.enum(['tail', 'before', 'after']),
1283
+ projection: z.enum(['projected', 'canonical']),
1291
1284
  epoch: z.string(),
1292
1285
  reset: z.boolean(),
1293
1286
  staleCursor: z.boolean(),
@@ -1306,7 +1299,7 @@ export const FetchAgentTimelineResponseMessageSchema = z.object({
1306
1299
  }),
1307
1300
  });
1308
1301
  export const SendAgentMessageResponseMessageSchema = z.object({
1309
- type: z.literal("send_agent_message_response"),
1302
+ type: z.literal('send_agent_message_response'),
1310
1303
  payload: z.object({
1311
1304
  requestId: z.string(),
1312
1305
  agentId: z.string(),
@@ -1315,24 +1308,24 @@ export const SendAgentMessageResponseMessageSchema = z.object({
1315
1308
  }),
1316
1309
  });
1317
1310
  export const WaitForFinishResponseMessageSchema = z.object({
1318
- type: z.literal("wait_for_finish_response"),
1311
+ type: z.literal('wait_for_finish_response'),
1319
1312
  payload: z.object({
1320
1313
  requestId: z.string(),
1321
- status: z.enum(["idle", "error", "permission", "timeout"]),
1314
+ status: z.enum(['idle', 'error', 'permission', 'timeout']),
1322
1315
  final: AgentSnapshotPayloadSchema.nullable(),
1323
1316
  error: z.string().nullable(),
1324
1317
  lastMessage: z.string().nullable(),
1325
1318
  }),
1326
1319
  });
1327
1320
  export const AgentPermissionRequestMessageSchema = z.object({
1328
- type: z.literal("agent_permission_request"),
1321
+ type: z.literal('agent_permission_request'),
1329
1322
  payload: z.object({
1330
1323
  agentId: z.string(),
1331
1324
  request: AgentPermissionRequestPayloadSchema,
1332
1325
  }),
1333
1326
  });
1334
1327
  export const AgentPermissionResolvedMessageSchema = z.object({
1335
- type: z.literal("agent_permission_resolved"),
1328
+ type: z.literal('agent_permission_resolved'),
1336
1329
  payload: z.object({
1337
1330
  agentId: z.string(),
1338
1331
  requestId: z.string(),
@@ -1340,14 +1333,14 @@ export const AgentPermissionResolvedMessageSchema = z.object({
1340
1333
  }),
1341
1334
  });
1342
1335
  export const AgentDeletedMessageSchema = z.object({
1343
- type: z.literal("agent_deleted"),
1336
+ type: z.literal('agent_deleted'),
1344
1337
  payload: z.object({
1345
1338
  agentId: z.string(),
1346
1339
  requestId: z.string(),
1347
1340
  }),
1348
1341
  });
1349
1342
  export const AgentArchivedMessageSchema = z.object({
1350
- type: z.literal("agent_archived"),
1343
+ type: z.literal('agent_archived'),
1351
1344
  payload: z.object({
1352
1345
  agentId: z.string(),
1353
1346
  archivedAt: z.string(),
@@ -1372,6 +1365,7 @@ const CheckoutStatusNotGitSchema = CheckoutStatusCommonSchema.extend({
1372
1365
  baseRef: z.null(),
1373
1366
  aheadBehind: z.null(),
1374
1367
  aheadOfOrigin: z.null(),
1368
+ behindOfOrigin: z.null(),
1375
1369
  hasRemote: z.boolean(),
1376
1370
  remoteUrl: z.null(),
1377
1371
  });
@@ -1384,6 +1378,7 @@ const CheckoutStatusGitNonPaseoSchema = CheckoutStatusCommonSchema.extend({
1384
1378
  baseRef: z.string().nullable(),
1385
1379
  aheadBehind: AheadBehindSchema.nullable(),
1386
1380
  aheadOfOrigin: z.number().nullable(),
1381
+ behindOfOrigin: z.number().nullable(),
1387
1382
  hasRemote: z.boolean(),
1388
1383
  remoteUrl: z.string().nullable(),
1389
1384
  });
@@ -1397,11 +1392,12 @@ const CheckoutStatusGitPaseoSchema = CheckoutStatusCommonSchema.extend({
1397
1392
  baseRef: z.string(),
1398
1393
  aheadBehind: AheadBehindSchema.nullable(),
1399
1394
  aheadOfOrigin: z.number().nullable(),
1395
+ behindOfOrigin: z.number().nullable(),
1400
1396
  hasRemote: z.boolean(),
1401
1397
  remoteUrl: z.string().nullable(),
1402
1398
  });
1403
1399
  export const CheckoutStatusResponseSchema = z.object({
1404
- type: z.literal("checkout_status_response"),
1400
+ type: z.literal('checkout_status_response'),
1405
1401
  payload: z.union([
1406
1402
  CheckoutStatusNotGitSchema,
1407
1403
  CheckoutStatusGitNonPaseoSchema,
@@ -1415,17 +1411,17 @@ const CheckoutDiffSubscriptionPayloadSchema = z.object({
1415
1411
  error: CheckoutErrorSchema.nullable(),
1416
1412
  });
1417
1413
  export const SubscribeCheckoutDiffResponseSchema = z.object({
1418
- type: z.literal("subscribe_checkout_diff_response"),
1414
+ type: z.literal('subscribe_checkout_diff_response'),
1419
1415
  payload: CheckoutDiffSubscriptionPayloadSchema.extend({
1420
1416
  requestId: z.string(),
1421
1417
  }),
1422
1418
  });
1423
1419
  export const CheckoutDiffUpdateSchema = z.object({
1424
- type: z.literal("checkout_diff_update"),
1420
+ type: z.literal('checkout_diff_update'),
1425
1421
  payload: CheckoutDiffSubscriptionPayloadSchema,
1426
1422
  });
1427
1423
  export const CheckoutCommitResponseSchema = z.object({
1428
- type: z.literal("checkout_commit_response"),
1424
+ type: z.literal('checkout_commit_response'),
1429
1425
  payload: z.object({
1430
1426
  cwd: z.string(),
1431
1427
  success: z.boolean(),
@@ -1434,7 +1430,7 @@ export const CheckoutCommitResponseSchema = z.object({
1434
1430
  }),
1435
1431
  });
1436
1432
  export const CheckoutMergeResponseSchema = z.object({
1437
- type: z.literal("checkout_merge_response"),
1433
+ type: z.literal('checkout_merge_response'),
1438
1434
  payload: z.object({
1439
1435
  cwd: z.string(),
1440
1436
  success: z.boolean(),
@@ -1443,7 +1439,7 @@ export const CheckoutMergeResponseSchema = z.object({
1443
1439
  }),
1444
1440
  });
1445
1441
  export const CheckoutMergeFromBaseResponseSchema = z.object({
1446
- type: z.literal("checkout_merge_from_base_response"),
1442
+ type: z.literal('checkout_merge_from_base_response'),
1447
1443
  payload: z.object({
1448
1444
  cwd: z.string(),
1449
1445
  success: z.boolean(),
@@ -1452,7 +1448,7 @@ export const CheckoutMergeFromBaseResponseSchema = z.object({
1452
1448
  }),
1453
1449
  });
1454
1450
  export const CheckoutPushResponseSchema = z.object({
1455
- type: z.literal("checkout_push_response"),
1451
+ type: z.literal('checkout_push_response'),
1456
1452
  payload: z.object({
1457
1453
  cwd: z.string(),
1458
1454
  success: z.boolean(),
@@ -1461,7 +1457,7 @@ export const CheckoutPushResponseSchema = z.object({
1461
1457
  }),
1462
1458
  });
1463
1459
  export const CheckoutPrCreateResponseSchema = z.object({
1464
- type: z.literal("checkout_pr_create_response"),
1460
+ type: z.literal('checkout_pr_create_response'),
1465
1461
  payload: z.object({
1466
1462
  cwd: z.string(),
1467
1463
  url: z.string().nullable(),
@@ -1476,9 +1472,10 @@ const CheckoutPrStatusSchema = z.object({
1476
1472
  state: z.string(),
1477
1473
  baseRefName: z.string(),
1478
1474
  headRefName: z.string(),
1475
+ isMerged: z.boolean(),
1479
1476
  });
1480
1477
  export const CheckoutPrStatusResponseSchema = z.object({
1481
- type: z.literal("checkout_pr_status_response"),
1478
+ type: z.literal('checkout_pr_status_response'),
1482
1479
  payload: z.object({
1483
1480
  cwd: z.string(),
1484
1481
  status: CheckoutPrStatusSchema.nullable(),
@@ -1488,7 +1485,7 @@ export const CheckoutPrStatusResponseSchema = z.object({
1488
1485
  }),
1489
1486
  });
1490
1487
  export const ValidateBranchResponseSchema = z.object({
1491
- type: z.literal("validate_branch_response"),
1488
+ type: z.literal('validate_branch_response'),
1492
1489
  payload: z.object({
1493
1490
  exists: z.boolean(),
1494
1491
  resolvedRef: z.string().nullable(),
@@ -1498,7 +1495,7 @@ export const ValidateBranchResponseSchema = z.object({
1498
1495
  }),
1499
1496
  });
1500
1497
  export const BranchSuggestionsResponseSchema = z.object({
1501
- type: z.literal("branch_suggestions_response"),
1498
+ type: z.literal('branch_suggestions_response'),
1502
1499
  payload: z.object({
1503
1500
  branches: z.array(z.string()),
1504
1501
  error: z.string().nullable(),
@@ -1506,9 +1503,16 @@ export const BranchSuggestionsResponseSchema = z.object({
1506
1503
  }),
1507
1504
  });
1508
1505
  export const DirectorySuggestionsResponseSchema = z.object({
1509
- type: z.literal("directory_suggestions_response"),
1506
+ type: z.literal('directory_suggestions_response'),
1510
1507
  payload: z.object({
1511
1508
  directories: z.array(z.string()),
1509
+ entries: z
1510
+ .array(z.object({
1511
+ path: z.string(),
1512
+ kind: z.enum(['file', 'directory']),
1513
+ }))
1514
+ .optional()
1515
+ .default([]),
1512
1516
  error: z.string().nullable(),
1513
1517
  requestId: z.string(),
1514
1518
  }),
@@ -1519,7 +1523,7 @@ const PaseoWorktreeSchema = z.object({
1519
1523
  head: z.string().nullable().optional(),
1520
1524
  });
1521
1525
  export const PaseoWorktreeListResponseSchema = z.object({
1522
- type: z.literal("paseo_worktree_list_response"),
1526
+ type: z.literal('paseo_worktree_list_response'),
1523
1527
  payload: z.object({
1524
1528
  worktrees: z.array(PaseoWorktreeSchema),
1525
1529
  error: CheckoutErrorSchema.nullable(),
@@ -1527,7 +1531,7 @@ export const PaseoWorktreeListResponseSchema = z.object({
1527
1531
  }),
1528
1532
  });
1529
1533
  export const PaseoWorktreeArchiveResponseSchema = z.object({
1530
- type: z.literal("paseo_worktree_archive_response"),
1534
+ type: z.literal('paseo_worktree_archive_response'),
1531
1535
  payload: z.object({
1532
1536
  success: z.boolean(),
1533
1537
  removedAgents: z.array(z.string()).optional(),
@@ -1536,11 +1540,11 @@ export const PaseoWorktreeArchiveResponseSchema = z.object({
1536
1540
  }),
1537
1541
  });
1538
1542
  export const FileExplorerResponseSchema = z.object({
1539
- type: z.literal("file_explorer_response"),
1543
+ type: z.literal('file_explorer_response'),
1540
1544
  payload: z.object({
1541
1545
  agentId: z.string(),
1542
1546
  path: z.string(),
1543
- mode: z.enum(["list", "file"]),
1547
+ mode: z.enum(['list', 'file']),
1544
1548
  directory: FileExplorerDirectorySchema.nullable(),
1545
1549
  file: FileExplorerFileSchema.nullable(),
1546
1550
  error: z.string().nullable(),
@@ -1552,7 +1556,7 @@ const ProjectIconSchema = z.object({
1552
1556
  mimeType: z.string(),
1553
1557
  });
1554
1558
  export const ProjectIconResponseSchema = z.object({
1555
- type: z.literal("project_icon_response"),
1559
+ type: z.literal('project_icon_response'),
1556
1560
  payload: z.object({
1557
1561
  cwd: z.string(),
1558
1562
  icon: ProjectIconSchema.nullable(),
@@ -1561,7 +1565,7 @@ export const ProjectIconResponseSchema = z.object({
1561
1565
  }),
1562
1566
  });
1563
1567
  export const FileDownloadTokenResponseSchema = z.object({
1564
- type: z.literal("file_download_token_response"),
1568
+ type: z.literal('file_download_token_response'),
1565
1569
  payload: z.object({
1566
1570
  agentId: z.string(),
1567
1571
  path: z.string(),
@@ -1574,7 +1578,7 @@ export const FileDownloadTokenResponseSchema = z.object({
1574
1578
  }),
1575
1579
  });
1576
1580
  export const ListProviderModelsResponseMessageSchema = z.object({
1577
- type: z.literal("list_provider_models_response"),
1581
+ type: z.literal('list_provider_models_response'),
1578
1582
  payload: z.object({
1579
1583
  provider: AgentProviderSchema,
1580
1584
  models: z.array(AgentModelDefinitionSchema).optional(),
@@ -1589,7 +1593,7 @@ const ProviderAvailabilitySchema = z.object({
1589
1593
  error: z.string().nullable().optional(),
1590
1594
  });
1591
1595
  export const ListAvailableProvidersResponseSchema = z.object({
1592
- type: z.literal("list_available_providers_response"),
1596
+ type: z.literal('list_available_providers_response'),
1593
1597
  payload: z.object({
1594
1598
  providers: z.array(ProviderAvailabilitySchema),
1595
1599
  error: z.string().nullable().optional(),
@@ -1598,7 +1602,7 @@ export const ListAvailableProvidersResponseSchema = z.object({
1598
1602
  }),
1599
1603
  });
1600
1604
  export const SpeechModelsListResponseSchema = z.object({
1601
- type: z.literal("speech_models_list_response"),
1605
+ type: z.literal('speech_models_list_response'),
1602
1606
  payload: z.object({
1603
1607
  modelsDir: z.string(),
1604
1608
  models: z.array(z.object({
@@ -1613,7 +1617,7 @@ export const SpeechModelsListResponseSchema = z.object({
1613
1617
  }),
1614
1618
  });
1615
1619
  export const SpeechModelsDownloadResponseSchema = z.object({
1616
- type: z.literal("speech_models_download_response"),
1620
+ type: z.literal('speech_models_download_response'),
1617
1621
  payload: z.object({
1618
1622
  modelsDir: z.string(),
1619
1623
  downloadedModelIds: z.array(z.string()),
@@ -1627,7 +1631,7 @@ const AgentSlashCommandSchema = z.object({
1627
1631
  argumentHint: z.string(),
1628
1632
  });
1629
1633
  export const ListCommandsResponseSchema = z.object({
1630
- type: z.literal("list_commands_response"),
1634
+ type: z.literal('list_commands_response'),
1631
1635
  payload: z.object({
1632
1636
  agentId: z.string(),
1633
1637
  commands: z.array(AgentSlashCommandSchema),
@@ -1635,20 +1639,6 @@ export const ListCommandsResponseSchema = z.object({
1635
1639
  requestId: z.string(),
1636
1640
  }),
1637
1641
  });
1638
- const AgentCommandResultSchema = z.object({
1639
- text: z.string(),
1640
- timeline: z.array(AgentTimelineItemPayloadSchema),
1641
- usage: AgentUsageSchema.optional(),
1642
- });
1643
- export const ExecuteCommandResponseSchema = z.object({
1644
- type: z.literal("execute_command_response"),
1645
- payload: z.object({
1646
- agentId: z.string(),
1647
- result: AgentCommandResultSchema.nullable(),
1648
- error: z.string().nullable(),
1649
- requestId: z.string(),
1650
- }),
1651
- });
1652
1642
  // ============================================================================
1653
1643
  // Terminal Outbound Messages
1654
1644
  // ============================================================================
@@ -1675,7 +1665,7 @@ const TerminalStateSchema = z.object({
1675
1665
  cursor: z.object({ row: z.number(), col: z.number() }),
1676
1666
  });
1677
1667
  export const ListTerminalsResponseSchema = z.object({
1678
- type: z.literal("list_terminals_response"),
1668
+ type: z.literal('list_terminals_response'),
1679
1669
  payload: z.object({
1680
1670
  cwd: z.string(),
1681
1671
  terminals: z.array(TerminalInfoSchema.omit({ cwd: true })),
@@ -1683,14 +1673,14 @@ export const ListTerminalsResponseSchema = z.object({
1683
1673
  }),
1684
1674
  });
1685
1675
  export const TerminalsChangedSchema = z.object({
1686
- type: z.literal("terminals_changed"),
1676
+ type: z.literal('terminals_changed'),
1687
1677
  payload: z.object({
1688
1678
  cwd: z.string(),
1689
1679
  terminals: z.array(TerminalInfoSchema.omit({ cwd: true })),
1690
1680
  }),
1691
1681
  });
1692
1682
  export const CreateTerminalResponseSchema = z.object({
1693
- type: z.literal("create_terminal_response"),
1683
+ type: z.literal('create_terminal_response'),
1694
1684
  payload: z.object({
1695
1685
  terminal: TerminalInfoSchema.nullable(),
1696
1686
  error: z.string().nullable(),
@@ -1698,7 +1688,7 @@ export const CreateTerminalResponseSchema = z.object({
1698
1688
  }),
1699
1689
  });
1700
1690
  export const SubscribeTerminalResponseSchema = z.object({
1701
- type: z.literal("subscribe_terminal_response"),
1691
+ type: z.literal('subscribe_terminal_response'),
1702
1692
  payload: z.object({
1703
1693
  terminalId: z.string(),
1704
1694
  state: TerminalStateSchema.nullable(),
@@ -1707,14 +1697,14 @@ export const SubscribeTerminalResponseSchema = z.object({
1707
1697
  }),
1708
1698
  });
1709
1699
  export const TerminalOutputSchema = z.object({
1710
- type: z.literal("terminal_output"),
1700
+ type: z.literal('terminal_output'),
1711
1701
  payload: z.object({
1712
1702
  terminalId: z.string(),
1713
1703
  state: TerminalStateSchema,
1714
1704
  }),
1715
1705
  });
1716
1706
  export const KillTerminalResponseSchema = z.object({
1717
- type: z.literal("kill_terminal_response"),
1707
+ type: z.literal('kill_terminal_response'),
1718
1708
  payload: z.object({
1719
1709
  terminalId: z.string(),
1720
1710
  success: z.boolean(),
@@ -1722,7 +1712,7 @@ export const KillTerminalResponseSchema = z.object({
1722
1712
  }),
1723
1713
  });
1724
1714
  export const AttachTerminalStreamResponseSchema = z.object({
1725
- type: z.literal("attach_terminal_stream_response"),
1715
+ type: z.literal('attach_terminal_stream_response'),
1726
1716
  payload: z.object({
1727
1717
  terminalId: z.string(),
1728
1718
  streamId: z.number().int().nonnegative().nullable(),
@@ -1735,7 +1725,7 @@ export const AttachTerminalStreamResponseSchema = z.object({
1735
1725
  }),
1736
1726
  });
1737
1727
  export const DetachTerminalStreamResponseSchema = z.object({
1738
- type: z.literal("detach_terminal_stream_response"),
1728
+ type: z.literal('detach_terminal_stream_response'),
1739
1729
  payload: z.object({
1740
1730
  streamId: z.number().int().nonnegative(),
1741
1731
  success: z.boolean(),
@@ -1743,13 +1733,13 @@ export const DetachTerminalStreamResponseSchema = z.object({
1743
1733
  }),
1744
1734
  });
1745
1735
  export const TerminalStreamExitSchema = z.object({
1746
- type: z.literal("terminal_stream_exit"),
1736
+ type: z.literal('terminal_stream_exit'),
1747
1737
  payload: z.object({
1748
1738
  streamId: z.number().int().nonnegative(),
1749
1739
  terminalId: z.string(),
1750
1740
  }),
1751
1741
  });
1752
- export const SessionOutboundMessageSchema = z.discriminatedUnion("type", [
1742
+ export const SessionOutboundMessageSchema = z.discriminatedUnion('type', [
1753
1743
  ActivityLogMessageSchema,
1754
1744
  AssistantChunkMessageSchema,
1755
1745
  AudioOutputMessageSchema,
@@ -1802,7 +1792,6 @@ export const SessionOutboundMessageSchema = z.discriminatedUnion("type", [
1802
1792
  SpeechModelsListResponseSchema,
1803
1793
  SpeechModelsDownloadResponseSchema,
1804
1794
  ListCommandsResponseSchema,
1805
- ExecuteCommandResponseSchema,
1806
1795
  ListTerminalsResponseSchema,
1807
1796
  TerminalsChangedSchema,
1808
1797
  CreateTerminalResponseSchema,
@@ -1818,31 +1807,31 @@ export const SessionOutboundMessageSchema = z.discriminatedUnion("type", [
1818
1807
  // ============================================================================
1819
1808
  // WebSocket-only messages (not session messages)
1820
1809
  export const WSPingMessageSchema = z.object({
1821
- type: z.literal("ping"),
1810
+ type: z.literal('ping'),
1822
1811
  });
1823
1812
  export const WSPongMessageSchema = z.object({
1824
- type: z.literal("pong"),
1813
+ type: z.literal('pong'),
1825
1814
  });
1826
1815
  export const WSRecordingStateMessageSchema = z.object({
1827
- type: z.literal("recording_state"),
1816
+ type: z.literal('recording_state'),
1828
1817
  isRecording: z.boolean(),
1829
1818
  });
1830
1819
  // Wrapped session message
1831
1820
  export const WSSessionInboundSchema = z.object({
1832
- type: z.literal("session"),
1821
+ type: z.literal('session'),
1833
1822
  message: SessionInboundMessageSchema,
1834
1823
  });
1835
1824
  export const WSSessionOutboundSchema = z.object({
1836
- type: z.literal("session"),
1825
+ type: z.literal('session'),
1837
1826
  message: SessionOutboundMessageSchema,
1838
1827
  });
1839
1828
  // Complete WebSocket message schemas
1840
- export const WSInboundMessageSchema = z.discriminatedUnion("type", [
1829
+ export const WSInboundMessageSchema = z.discriminatedUnion('type', [
1841
1830
  WSPingMessageSchema,
1842
1831
  WSRecordingStateMessageSchema,
1843
1832
  WSSessionInboundSchema,
1844
1833
  ]);
1845
- export const WSOutboundMessageSchema = z.discriminatedUnion("type", [
1834
+ export const WSOutboundMessageSchema = z.discriminatedUnion('type', [
1846
1835
  WSPongMessageSchema,
1847
1836
  WSSessionOutboundSchema,
1848
1837
  ]);
@@ -1854,7 +1843,7 @@ export const WSOutboundMessageSchema = z.discriminatedUnion("type", [
1854
1843
  * Returns null if message should be handled at WS level only
1855
1844
  */
1856
1845
  export function extractSessionMessage(wsMsg) {
1857
- if (wsMsg.type === "session") {
1846
+ if (wsMsg.type === 'session') {
1858
1847
  return wsMsg.message;
1859
1848
  }
1860
1849
  // Ping and recording_state are WS-level only
@@ -1865,7 +1854,7 @@ export function extractSessionMessage(wsMsg) {
1865
1854
  */
1866
1855
  export function wrapSessionMessage(sessionMsg) {
1867
1856
  return {
1868
- type: "session",
1857
+ type: 'session',
1869
1858
  message: sessionMsg,
1870
1859
  };
1871
1860
  }