@getpaseo/server 0.1.13 → 0.1.15

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 -77
  2. package/dist/server/client/daemon-client.d.ts.map +1 -1
  3. package/dist/server/client/daemon-client.js +252 -265
  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 +263 -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 +20 -20
  37. package/dist/server/server/session.d.ts.map +1 -1
  38. package/dist/server/server/session.js +871 -798
  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 +886 -410
  49. package/dist/server/shared/messages.d.ts.map +1 -1
  50. package/dist/server/shared/messages.js +272 -267
  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 +2 -2
@@ -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,16 +339,16 @@ 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
354
  const AgentDirectoryFilterSchema = z.object({
@@ -352,49 +359,51 @@ const AgentDirectoryFilterSchema = z.object({
352
359
  requiresAttention: z.boolean().optional(),
353
360
  });
354
361
  export const DeleteAgentRequestMessageSchema = z.object({
355
- type: z.literal("delete_agent_request"),
362
+ type: z.literal('delete_agent_request'),
356
363
  agentId: z.string(),
357
364
  requestId: z.string(),
358
365
  });
359
366
  export const ArchiveAgentRequestMessageSchema = z.object({
360
- type: z.literal("archive_agent_request"),
367
+ type: z.literal('archive_agent_request'),
361
368
  agentId: z.string(),
362
369
  requestId: z.string(),
363
370
  });
364
371
  export const UpdateAgentRequestMessageSchema = z.object({
365
- type: z.literal("update_agent_request"),
372
+ type: z.literal('update_agent_request'),
366
373
  agentId: z.string(),
367
374
  name: z.string().optional(),
368
375
  labels: z.record(z.string()).optional(),
369
376
  requestId: z.string(),
370
377
  });
371
378
  export const SetVoiceModeMessageSchema = z.object({
372
- type: z.literal("set_voice_mode"),
379
+ type: z.literal('set_voice_mode'),
373
380
  enabled: z.boolean(),
374
381
  agentId: z.string().optional(),
375
382
  requestId: z.string().optional(),
376
383
  });
377
384
  export const SendAgentMessageSchema = z.object({
378
- type: z.literal("send_agent_message"),
385
+ type: z.literal('send_agent_message'),
379
386
  agentId: z.string(),
380
387
  text: z.string(),
381
388
  messageId: z.string().optional(), // Client-provided ID for deduplication
382
- images: z.array(z.object({
389
+ images: z
390
+ .array(z.object({
383
391
  data: z.string(), // base64 encoded image
384
392
  mimeType: z.string(), // e.g., "image/jpeg", "image/png"
385
- })).optional(),
393
+ }))
394
+ .optional(),
386
395
  });
387
396
  // ============================================================================
388
397
  // Agent RPCs (requestId-correlated)
389
398
  // ============================================================================
390
399
  export const FetchAgentsRequestMessageSchema = z.object({
391
- type: z.literal("fetch_agents_request"),
400
+ type: z.literal('fetch_agents_request'),
392
401
  requestId: z.string(),
393
402
  filter: AgentDirectoryFilterSchema.optional(),
394
403
  sort: z
395
404
  .array(z.object({
396
- key: z.enum(["status_priority", "created_at", "updated_at", "title"]),
397
- direction: z.enum(["asc", "desc"]),
405
+ key: z.enum(['status_priority', 'created_at', 'updated_at', 'title']),
406
+ direction: z.enum(['asc', 'desc']),
398
407
  }))
399
408
  .optional(),
400
409
  page: z
@@ -410,13 +419,13 @@ export const FetchAgentsRequestMessageSchema = z.object({
410
419
  .optional(),
411
420
  });
412
421
  export const FetchAgentRequestMessageSchema = z.object({
413
- type: z.literal("fetch_agent_request"),
422
+ type: z.literal('fetch_agent_request'),
414
423
  requestId: z.string(),
415
424
  /** Accepts full ID, unique prefix, or exact full title (server resolves). */
416
425
  agentId: z.string(),
417
426
  });
418
427
  export const SendAgentMessageRequestSchema = z.object({
419
- type: z.literal("send_agent_message_request"),
428
+ type: z.literal('send_agent_message_request'),
420
429
  requestId: z.string(),
421
430
  /** Accepts full ID, unique prefix, or exact full title (server resolves). */
422
431
  agentId: z.string(),
@@ -430,7 +439,7 @@ export const SendAgentMessageRequestSchema = z.object({
430
439
  .optional(),
431
440
  });
432
441
  export const WaitForFinishRequestSchema = z.object({
433
- type: z.literal("wait_for_finish_request"),
442
+ type: z.literal('wait_for_finish_request'),
434
443
  requestId: z.string(),
435
444
  /** Accepts full ID, unique prefix, or exact full title (server resolves). */
436
445
  agentId: z.string(),
@@ -440,24 +449,24 @@ export const WaitForFinishRequestSchema = z.object({
440
449
  // Dictation Streaming (lossless, resumable)
441
450
  // ============================================================================
442
451
  export const DictationStreamStartMessageSchema = z.object({
443
- type: z.literal("dictation_stream_start"),
452
+ type: z.literal('dictation_stream_start'),
444
453
  dictationId: z.string(),
445
454
  format: z.string(), // e.g. "audio/pcm;rate=16000;bits=16"
446
455
  });
447
456
  export const DictationStreamChunkMessageSchema = z.object({
448
- type: z.literal("dictation_stream_chunk"),
457
+ type: z.literal('dictation_stream_chunk'),
449
458
  dictationId: z.string(),
450
459
  seq: z.number().int().nonnegative(),
451
460
  audio: z.string(), // base64 encoded chunk
452
461
  format: z.string(), // e.g. "audio/pcm;rate=16000;bits=16"
453
462
  });
454
463
  export const DictationStreamFinishMessageSchema = z.object({
455
- type: z.literal("dictation_stream_finish"),
464
+ type: z.literal('dictation_stream_finish'),
456
465
  dictationId: z.string(),
457
466
  finalSeq: z.number().int().nonnegative(),
458
467
  });
459
468
  export const DictationStreamCancelMessageSchema = z.object({
460
- type: z.literal("dictation_stream_cancel"),
469
+ type: z.literal('dictation_stream_cancel'),
461
470
  dictationId: z.string(),
462
471
  });
463
472
  const GitSetupOptionsSchema = z.object({
@@ -468,55 +477,57 @@ const GitSetupOptionsSchema = z.object({
468
477
  worktreeSlug: z.string().optional(),
469
478
  });
470
479
  export const CreateAgentRequestMessageSchema = z.object({
471
- type: z.literal("create_agent_request"),
480
+ type: z.literal('create_agent_request'),
472
481
  config: AgentSessionConfigSchema,
473
482
  worktreeName: z.string().optional(),
474
483
  initialPrompt: z.string().optional(),
475
484
  outputSchema: z.record(z.unknown()).optional(),
476
- images: z.array(z.object({
485
+ images: z
486
+ .array(z.object({
477
487
  data: z.string(), // base64 encoded image
478
488
  mimeType: z.string(), // e.g., "image/jpeg", "image/png"
479
- })).optional(),
489
+ }))
490
+ .optional(),
480
491
  git: GitSetupOptionsSchema.optional(),
481
492
  labels: z.record(z.string()).default({}),
482
493
  requestId: z.string(),
483
494
  });
484
495
  export const ListProviderModelsRequestMessageSchema = z.object({
485
- type: z.literal("list_provider_models_request"),
496
+ type: z.literal('list_provider_models_request'),
486
497
  provider: AgentProviderSchema,
487
498
  cwd: z.string().optional(),
488
499
  requestId: z.string(),
489
500
  });
490
501
  export const ListAvailableProvidersRequestMessageSchema = z.object({
491
- type: z.literal("list_available_providers_request"),
502
+ type: z.literal('list_available_providers_request'),
492
503
  requestId: z.string(),
493
504
  });
494
505
  export const SpeechModelsListRequestSchema = z.object({
495
- type: z.literal("speech_models_list_request"),
506
+ type: z.literal('speech_models_list_request'),
496
507
  requestId: z.string(),
497
508
  });
498
509
  export const SpeechModelsDownloadRequestSchema = z.object({
499
- type: z.literal("speech_models_download_request"),
510
+ type: z.literal('speech_models_download_request'),
500
511
  modelIds: z.array(z.string()).optional(),
501
512
  requestId: z.string(),
502
513
  });
503
514
  export const ResumeAgentRequestMessageSchema = z.object({
504
- type: z.literal("resume_agent_request"),
515
+ type: z.literal('resume_agent_request'),
505
516
  handle: AgentPersistenceHandleSchema,
506
517
  overrides: AgentSessionConfigSchema.partial().optional(),
507
518
  requestId: z.string(),
508
519
  });
509
520
  export const RefreshAgentRequestMessageSchema = z.object({
510
- type: z.literal("refresh_agent_request"),
521
+ type: z.literal('refresh_agent_request'),
511
522
  agentId: z.string(),
512
523
  requestId: z.string(),
513
524
  });
514
525
  export const CancelAgentRequestMessageSchema = z.object({
515
- type: z.literal("cancel_agent_request"),
526
+ type: z.literal('cancel_agent_request'),
516
527
  agentId: z.string(),
517
528
  });
518
529
  export const RestartServerRequestMessageSchema = z.object({
519
- type: z.literal("restart_server_request"),
530
+ type: z.literal('restart_server_request'),
520
531
  reason: z.string().optional(),
521
532
  requestId: z.string(),
522
533
  });
@@ -525,24 +536,24 @@ export const AgentTimelineCursorSchema = z.object({
525
536
  seq: z.number().int().nonnegative(),
526
537
  });
527
538
  export const FetchAgentTimelineRequestMessageSchema = z.object({
528
- type: z.literal("fetch_agent_timeline_request"),
539
+ type: z.literal('fetch_agent_timeline_request'),
529
540
  agentId: z.string(),
530
541
  requestId: z.string(),
531
- direction: z.enum(["tail", "before", "after"]).optional(),
542
+ direction: z.enum(['tail', 'before', 'after']).optional(),
532
543
  cursor: AgentTimelineCursorSchema.optional(),
533
544
  // 0 means "all matching rows for this query window".
534
545
  limit: z.number().int().nonnegative().optional(),
535
546
  // Default should be projected for app timeline loading.
536
- projection: z.enum(["projected", "canonical"]).optional(),
547
+ projection: z.enum(['projected', 'canonical']).optional(),
537
548
  });
538
549
  export const SetAgentModeRequestMessageSchema = z.object({
539
- type: z.literal("set_agent_mode_request"),
550
+ type: z.literal('set_agent_mode_request'),
540
551
  agentId: z.string(),
541
552
  modeId: z.string(),
542
553
  requestId: z.string(),
543
554
  });
544
555
  export const SetAgentModeResponseMessageSchema = z.object({
545
- type: z.literal("set_agent_mode_response"),
556
+ type: z.literal('set_agent_mode_response'),
546
557
  payload: z.object({
547
558
  requestId: z.string(),
548
559
  agentId: z.string(),
@@ -551,13 +562,13 @@ export const SetAgentModeResponseMessageSchema = z.object({
551
562
  }),
552
563
  });
553
564
  export const SetAgentModelRequestMessageSchema = z.object({
554
- type: z.literal("set_agent_model_request"),
565
+ type: z.literal('set_agent_model_request'),
555
566
  agentId: z.string(),
556
567
  modelId: z.string().nullable(),
557
568
  requestId: z.string(),
558
569
  });
559
570
  export const SetAgentModelResponseMessageSchema = z.object({
560
- type: z.literal("set_agent_model_response"),
571
+ type: z.literal('set_agent_model_response'),
561
572
  payload: z.object({
562
573
  requestId: z.string(),
563
574
  agentId: z.string(),
@@ -566,13 +577,13 @@ export const SetAgentModelResponseMessageSchema = z.object({
566
577
  }),
567
578
  });
568
579
  export const SetAgentThinkingRequestMessageSchema = z.object({
569
- type: z.literal("set_agent_thinking_request"),
580
+ type: z.literal('set_agent_thinking_request'),
570
581
  agentId: z.string(),
571
582
  thinkingOptionId: z.string().nullable(),
572
583
  requestId: z.string(),
573
584
  });
574
585
  export const SetAgentThinkingResponseMessageSchema = z.object({
575
- type: z.literal("set_agent_thinking_response"),
586
+ type: z.literal('set_agent_thinking_response'),
576
587
  payload: z.object({
577
588
  requestId: z.string(),
578
589
  agentId: z.string(),
@@ -581,7 +592,7 @@ export const SetAgentThinkingResponseMessageSchema = z.object({
581
592
  }),
582
593
  });
583
594
  export const UpdateAgentResponseMessageSchema = z.object({
584
- type: z.literal("update_agent_response"),
595
+ type: z.literal('update_agent_response'),
585
596
  payload: z.object({
586
597
  requestId: z.string(),
587
598
  agentId: z.string(),
@@ -590,7 +601,7 @@ export const UpdateAgentResponseMessageSchema = z.object({
590
601
  }),
591
602
  });
592
603
  export const SetVoiceModeResponseMessageSchema = z.object({
593
- type: z.literal("set_voice_mode_response"),
604
+ type: z.literal('set_voice_mode_response'),
594
605
  payload: z.object({
595
606
  requestId: z.string(),
596
607
  enabled: z.boolean(),
@@ -603,70 +614,65 @@ export const SetVoiceModeResponseMessageSchema = z.object({
603
614
  }),
604
615
  });
605
616
  export const AgentPermissionResponseMessageSchema = z.object({
606
- type: z.literal("agent_permission_response"),
617
+ type: z.literal('agent_permission_response'),
607
618
  agentId: z.string(),
608
619
  requestId: z.string(),
609
620
  response: AgentPermissionResponseSchema,
610
621
  });
611
- const CheckoutErrorCodeSchema = z.enum([
612
- "NOT_GIT_REPO",
613
- "NOT_ALLOWED",
614
- "MERGE_CONFLICT",
615
- "UNKNOWN",
616
- ]);
622
+ const CheckoutErrorCodeSchema = z.enum(['NOT_GIT_REPO', 'NOT_ALLOWED', 'MERGE_CONFLICT', 'UNKNOWN']);
617
623
  const CheckoutErrorSchema = z.object({
618
624
  code: CheckoutErrorCodeSchema,
619
625
  message: z.string(),
620
626
  });
621
627
  const CheckoutDiffCompareSchema = z.object({
622
- mode: z.enum(["uncommitted", "base"]),
628
+ mode: z.enum(['uncommitted', 'base']),
623
629
  baseRef: z.string().optional(),
624
630
  });
625
631
  export const CheckoutStatusRequestSchema = z.object({
626
- type: z.literal("checkout_status_request"),
632
+ type: z.literal('checkout_status_request'),
627
633
  cwd: z.string(),
628
634
  requestId: z.string(),
629
635
  });
630
636
  export const SubscribeCheckoutDiffRequestSchema = z.object({
631
- type: z.literal("subscribe_checkout_diff_request"),
637
+ type: z.literal('subscribe_checkout_diff_request'),
632
638
  subscriptionId: z.string(),
633
639
  cwd: z.string(),
634
640
  compare: CheckoutDiffCompareSchema,
635
641
  requestId: z.string(),
636
642
  });
637
643
  export const UnsubscribeCheckoutDiffRequestSchema = z.object({
638
- type: z.literal("unsubscribe_checkout_diff_request"),
644
+ type: z.literal('unsubscribe_checkout_diff_request'),
639
645
  subscriptionId: z.string(),
640
646
  });
641
647
  export const CheckoutCommitRequestSchema = z.object({
642
- type: z.literal("checkout_commit_request"),
648
+ type: z.literal('checkout_commit_request'),
643
649
  cwd: z.string(),
644
650
  message: z.string().optional(),
645
651
  addAll: z.boolean().optional(),
646
652
  requestId: z.string(),
647
653
  });
648
654
  export const CheckoutMergeRequestSchema = z.object({
649
- type: z.literal("checkout_merge_request"),
655
+ type: z.literal('checkout_merge_request'),
650
656
  cwd: z.string(),
651
657
  baseRef: z.string().optional(),
652
- strategy: z.enum(["merge", "squash"]).optional(),
658
+ strategy: z.enum(['merge', 'squash']).optional(),
653
659
  requireCleanTarget: z.boolean().optional(),
654
660
  requestId: z.string(),
655
661
  });
656
662
  export const CheckoutMergeFromBaseRequestSchema = z.object({
657
- type: z.literal("checkout_merge_from_base_request"),
663
+ type: z.literal('checkout_merge_from_base_request'),
658
664
  cwd: z.string(),
659
665
  baseRef: z.string().optional(),
660
666
  requireCleanTarget: z.boolean().optional(),
661
667
  requestId: z.string(),
662
668
  });
663
669
  export const CheckoutPushRequestSchema = z.object({
664
- type: z.literal("checkout_push_request"),
670
+ type: z.literal('checkout_push_request'),
665
671
  cwd: z.string(),
666
672
  requestId: z.string(),
667
673
  });
668
674
  export const CheckoutPrCreateRequestSchema = z.object({
669
- type: z.literal("checkout_pr_create_request"),
675
+ type: z.literal('checkout_pr_create_request'),
670
676
  cwd: z.string(),
671
677
  title: z.string().optional(),
672
678
  body: z.string().optional(),
@@ -674,37 +680,40 @@ export const CheckoutPrCreateRequestSchema = z.object({
674
680
  requestId: z.string(),
675
681
  });
676
682
  export const CheckoutPrStatusRequestSchema = z.object({
677
- type: z.literal("checkout_pr_status_request"),
683
+ type: z.literal('checkout_pr_status_request'),
678
684
  cwd: z.string(),
679
685
  requestId: z.string(),
680
686
  });
681
687
  export const ValidateBranchRequestSchema = z.object({
682
- type: z.literal("validate_branch_request"),
688
+ type: z.literal('validate_branch_request'),
683
689
  cwd: z.string(),
684
690
  branchName: z.string(),
685
691
  requestId: z.string(),
686
692
  });
687
693
  export const BranchSuggestionsRequestSchema = z.object({
688
- type: z.literal("branch_suggestions_request"),
694
+ type: z.literal('branch_suggestions_request'),
689
695
  cwd: z.string(),
690
696
  query: z.string().optional(),
691
697
  limit: z.number().int().min(1).max(200).optional(),
692
698
  requestId: z.string(),
693
699
  });
694
700
  export const DirectorySuggestionsRequestSchema = z.object({
695
- type: z.literal("directory_suggestions_request"),
701
+ type: z.literal('directory_suggestions_request'),
696
702
  query: z.string(),
703
+ cwd: z.string().optional(),
704
+ includeFiles: z.boolean().optional(),
705
+ includeDirectories: z.boolean().optional(),
697
706
  limit: z.number().int().min(1).max(100).optional(),
698
707
  requestId: z.string(),
699
708
  });
700
709
  export const PaseoWorktreeListRequestSchema = z.object({
701
- type: z.literal("paseo_worktree_list_request"),
710
+ type: z.literal('paseo_worktree_list_request'),
702
711
  cwd: z.string().optional(),
703
712
  repoRoot: z.string().optional(),
704
713
  requestId: z.string(),
705
714
  });
706
715
  export const PaseoWorktreeArchiveRequestSchema = z.object({
707
- type: z.literal("paseo_worktree_archive_request"),
716
+ type: z.literal('paseo_worktree_archive_request'),
708
717
  worktreePath: z.string().optional(),
709
718
  repoRoot: z.string().optional(),
710
719
  branchName: z.string().optional(),
@@ -717,7 +726,7 @@ const HighlightTokenSchema = z.object({
717
726
  style: z.string().nullable(),
718
727
  });
719
728
  const DiffLineSchema = z.object({
720
- type: z.enum(["add", "remove", "context", "header"]),
729
+ type: z.enum(['add', 'remove', 'context', 'header']),
721
730
  content: z.string(),
722
731
  tokens: z.array(HighlightTokenSchema).optional(),
723
732
  });
@@ -735,19 +744,19 @@ const ParsedDiffFileSchema = z.object({
735
744
  additions: z.number(),
736
745
  deletions: z.number(),
737
746
  hunks: z.array(DiffHunkSchema),
738
- status: z.enum(["ok", "too_large", "binary"]).optional(),
747
+ status: z.enum(['ok', 'too_large', 'binary']).optional(),
739
748
  });
740
749
  const FileExplorerEntrySchema = z.object({
741
750
  name: z.string(),
742
751
  path: z.string(),
743
- kind: z.enum(["file", "directory"]),
752
+ kind: z.enum(['file', 'directory']),
744
753
  size: z.number(),
745
754
  modifiedAt: z.string(),
746
755
  });
747
756
  const FileExplorerFileSchema = z.object({
748
757
  path: z.string(),
749
- kind: z.enum(["text", "image", "binary"]),
750
- encoding: z.enum(["utf-8", "base64", "none"]),
758
+ kind: z.enum(['text', 'image', 'binary']),
759
+ encoding: z.enum(['utf-8', 'base64', 'none']),
751
760
  content: z.string().optional(),
752
761
  mimeType: z.string().optional(),
753
762
  size: z.number(),
@@ -758,110 +767,111 @@ const FileExplorerDirectorySchema = z.object({
758
767
  entries: z.array(FileExplorerEntrySchema),
759
768
  });
760
769
  export const FileExplorerRequestSchema = z.object({
761
- type: z.literal("file_explorer_request"),
770
+ type: z.literal('file_explorer_request'),
762
771
  agentId: z.string(),
763
772
  path: z.string().optional(),
764
- mode: z.enum(["list", "file"]),
773
+ mode: z.enum(['list', 'file']),
765
774
  requestId: z.string(),
766
775
  });
767
776
  export const ProjectIconRequestSchema = z.object({
768
- type: z.literal("project_icon_request"),
777
+ type: z.literal('project_icon_request'),
769
778
  cwd: z.string(),
770
779
  requestId: z.string(),
771
780
  });
772
781
  export const FileDownloadTokenRequestSchema = z.object({
773
- type: z.literal("file_download_token_request"),
782
+ type: z.literal('file_download_token_request'),
774
783
  agentId: z.string(),
775
784
  path: z.string(),
776
785
  requestId: z.string(),
777
786
  });
778
787
  export const ClearAgentAttentionMessageSchema = z.object({
779
- type: z.literal("clear_agent_attention"),
788
+ type: z.literal('clear_agent_attention'),
780
789
  agentId: z.union([z.string(), z.array(z.string())]),
781
790
  });
782
791
  export const ClientHeartbeatMessageSchema = z.object({
783
- type: z.literal("client_heartbeat"),
784
- deviceType: z.enum(["web", "mobile"]),
792
+ type: z.literal('client_heartbeat'),
793
+ deviceType: z.enum(['web', 'mobile']),
785
794
  focusedAgentId: z.string().nullable(),
786
795
  lastActivityAt: z.string(),
787
796
  appVisible: z.boolean(),
788
797
  appVisibilityChangedAt: z.string().optional(),
789
798
  });
790
799
  export const PingMessageSchema = z.object({
791
- type: z.literal("ping"),
800
+ type: z.literal('ping'),
792
801
  requestId: z.string(),
793
802
  clientSentAt: z.number().int().optional(),
794
803
  });
795
- export const ListCommandsRequestSchema = z.object({
796
- type: z.literal("list_commands_request"),
797
- agentId: z.string(),
798
- 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(),
799
810
  });
800
- export const ExecuteCommandRequestSchema = z.object({
801
- type: z.literal("execute_command_request"),
811
+ export const ListCommandsRequestSchema = z.object({
812
+ type: z.literal('list_commands_request'),
802
813
  agentId: z.string(),
803
- commandName: z.string(),
804
- args: z.string().optional(),
814
+ draftConfig: ListCommandsDraftConfigSchema.optional(),
805
815
  requestId: z.string(),
806
816
  });
807
817
  export const RegisterPushTokenMessageSchema = z.object({
808
- type: z.literal("register_push_token"),
818
+ type: z.literal('register_push_token'),
809
819
  token: z.string(),
810
820
  });
811
821
  // ============================================================================
812
822
  // Terminal Messages
813
823
  // ============================================================================
814
824
  export const ListTerminalsRequestSchema = z.object({
815
- type: z.literal("list_terminals_request"),
825
+ type: z.literal('list_terminals_request'),
816
826
  cwd: z.string(),
817
827
  requestId: z.string(),
818
828
  });
819
829
  export const SubscribeTerminalsRequestSchema = z.object({
820
- type: z.literal("subscribe_terminals_request"),
830
+ type: z.literal('subscribe_terminals_request'),
821
831
  cwd: z.string(),
822
832
  });
823
833
  export const UnsubscribeTerminalsRequestSchema = z.object({
824
- type: z.literal("unsubscribe_terminals_request"),
834
+ type: z.literal('unsubscribe_terminals_request'),
825
835
  cwd: z.string(),
826
836
  });
827
837
  export const CreateTerminalRequestSchema = z.object({
828
- type: z.literal("create_terminal_request"),
838
+ type: z.literal('create_terminal_request'),
829
839
  cwd: z.string(),
830
840
  name: z.string().optional(),
831
841
  requestId: z.string(),
832
842
  });
833
843
  export const SubscribeTerminalRequestSchema = z.object({
834
- type: z.literal("subscribe_terminal_request"),
844
+ type: z.literal('subscribe_terminal_request'),
835
845
  terminalId: z.string(),
836
846
  requestId: z.string(),
837
847
  });
838
848
  export const UnsubscribeTerminalRequestSchema = z.object({
839
- type: z.literal("unsubscribe_terminal_request"),
849
+ type: z.literal('unsubscribe_terminal_request'),
840
850
  terminalId: z.string(),
841
851
  });
842
- const TerminalClientMessageSchema = z.discriminatedUnion("type", [
843
- z.object({ type: z.literal("input"), data: z.string() }),
844
- 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() }),
845
855
  z.object({
846
- type: z.literal("mouse"),
856
+ type: z.literal('mouse'),
847
857
  row: z.number(),
848
858
  col: z.number(),
849
859
  button: z.number(),
850
- action: z.enum(["down", "up", "move"]),
860
+ action: z.enum(['down', 'up', 'move']),
851
861
  }),
852
862
  ]);
853
863
  export const TerminalInputSchema = z.object({
854
- type: z.literal("terminal_input"),
864
+ type: z.literal('terminal_input'),
855
865
  terminalId: z.string(),
856
866
  message: TerminalClientMessageSchema,
857
867
  });
858
868
  export const KillTerminalRequestSchema = z.object({
859
- type: z.literal("kill_terminal_request"),
869
+ type: z.literal('kill_terminal_request'),
860
870
  terminalId: z.string(),
861
871
  requestId: z.string(),
862
872
  });
863
873
  export const AttachTerminalStreamRequestSchema = z.object({
864
- type: z.literal("attach_terminal_stream_request"),
874
+ type: z.literal('attach_terminal_stream_request'),
865
875
  terminalId: z.string(),
866
876
  resumeOffset: z.number().int().nonnegative().optional(),
867
877
  rows: z.number().int().positive().optional(),
@@ -869,11 +879,11 @@ export const AttachTerminalStreamRequestSchema = z.object({
869
879
  requestId: z.string(),
870
880
  });
871
881
  export const DetachTerminalStreamRequestSchema = z.object({
872
- type: z.literal("detach_terminal_stream_request"),
882
+ type: z.literal('detach_terminal_stream_request'),
873
883
  streamId: z.number().int().nonnegative(),
874
884
  requestId: z.string(),
875
885
  });
876
- export const SessionInboundMessageSchema = z.discriminatedUnion("type", [
886
+ export const SessionInboundMessageSchema = z.discriminatedUnion('type', [
877
887
  VoiceAudioChunkMessageSchema,
878
888
  AbortRequestMessageSchema,
879
889
  AudioPlayedMessageSchema,
@@ -924,7 +934,6 @@ export const SessionInboundMessageSchema = z.discriminatedUnion("type", [
924
934
  ClientHeartbeatMessageSchema,
925
935
  PingMessageSchema,
926
936
  ListCommandsRequestSchema,
927
- ExecuteCommandRequestSchema,
928
937
  RegisterPushTokenMessageSchema,
929
938
  ListTerminalsRequestSchema,
930
939
  SubscribeTerminalsRequestSchema,
@@ -943,29 +952,22 @@ export const SessionInboundMessageSchema = z.discriminatedUnion("type", [
943
952
  export const ActivityLogPayloadSchema = z.object({
944
953
  id: z.string(),
945
954
  timestamp: z.coerce.date(),
946
- type: z.enum([
947
- "transcript",
948
- "assistant",
949
- "tool_call",
950
- "tool_result",
951
- "error",
952
- "system",
953
- ]),
955
+ type: z.enum(['transcript', 'assistant', 'tool_call', 'tool_result', 'error', 'system']),
954
956
  content: z.string(),
955
957
  metadata: z.record(z.unknown()).optional(),
956
958
  });
957
959
  export const ActivityLogMessageSchema = z.object({
958
- type: z.literal("activity_log"),
960
+ type: z.literal('activity_log'),
959
961
  payload: ActivityLogPayloadSchema,
960
962
  });
961
963
  export const AssistantChunkMessageSchema = z.object({
962
- type: z.literal("assistant_chunk"),
964
+ type: z.literal('assistant_chunk'),
963
965
  payload: z.object({
964
966
  chunk: z.string(),
965
967
  }),
966
968
  });
967
969
  export const AudioOutputMessageSchema = z.object({
968
- type: z.literal("audio_output"),
970
+ type: z.literal('audio_output'),
969
971
  payload: z.object({
970
972
  audio: z.string(), // base64 encoded
971
973
  format: z.string(),
@@ -977,7 +979,7 @@ export const AudioOutputMessageSchema = z.object({
977
979
  }),
978
980
  });
979
981
  export const TranscriptionResultMessageSchema = z.object({
980
- type: z.literal("transcription_result"),
982
+ type: z.literal('transcription_result'),
981
983
  payload: z.object({
982
984
  text: z.string(),
983
985
  language: z.string().optional(),
@@ -991,28 +993,28 @@ export const TranscriptionResultMessageSchema = z.object({
991
993
  }),
992
994
  });
993
995
  export const DictationStreamAckMessageSchema = z.object({
994
- type: z.literal("dictation_stream_ack"),
996
+ type: z.literal('dictation_stream_ack'),
995
997
  payload: z.object({
996
998
  dictationId: z.string(),
997
999
  ackSeq: z.number().int(),
998
1000
  }),
999
1001
  });
1000
1002
  export const DictationStreamFinishAcceptedMessageSchema = z.object({
1001
- type: z.literal("dictation_stream_finish_accepted"),
1003
+ type: z.literal('dictation_stream_finish_accepted'),
1002
1004
  payload: z.object({
1003
1005
  dictationId: z.string(),
1004
1006
  timeoutMs: z.number().int().positive(),
1005
1007
  }),
1006
1008
  });
1007
1009
  export const DictationStreamPartialMessageSchema = z.object({
1008
- type: z.literal("dictation_stream_partial"),
1010
+ type: z.literal('dictation_stream_partial'),
1009
1011
  payload: z.object({
1010
1012
  dictationId: z.string(),
1011
1013
  text: z.string(),
1012
1014
  }),
1013
1015
  });
1014
1016
  export const DictationStreamFinalMessageSchema = z.object({
1015
- type: z.literal("dictation_stream_final"),
1017
+ type: z.literal('dictation_stream_final'),
1016
1018
  payload: z.object({
1017
1019
  dictationId: z.string(),
1018
1020
  text: z.string(),
@@ -1020,7 +1022,7 @@ export const DictationStreamFinalMessageSchema = z.object({
1020
1022
  }),
1021
1023
  });
1022
1024
  export const DictationStreamErrorMessageSchema = z.object({
1023
- type: z.literal("dictation_stream_error"),
1025
+ type: z.literal('dictation_stream_error'),
1024
1026
  payload: z.object({
1025
1027
  dictationId: z.string(),
1026
1028
  error: z.string(),
@@ -1043,10 +1045,15 @@ export const ServerCapabilitiesSchema = z
1043
1045
  voice: ServerVoiceCapabilitiesSchema.optional(),
1044
1046
  })
1045
1047
  .passthrough();
1046
- const ServerInfoHostnameSchema = z
1047
- .unknown()
1048
- .transform((value) => {
1049
- 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') {
1050
1057
  return null;
1051
1058
  }
1052
1059
  const trimmed = value.trim();
@@ -1067,18 +1074,20 @@ const ServerCapabilitiesFromUnknownSchema = z
1067
1074
  });
1068
1075
  export const ServerInfoStatusPayloadSchema = z
1069
1076
  .object({
1070
- status: z.literal("server_info"),
1077
+ status: z.literal('server_info'),
1071
1078
  serverId: z.string().trim().min(1),
1072
1079
  hostname: ServerInfoHostnameSchema.optional(),
1080
+ version: ServerInfoVersionSchema.optional(),
1073
1081
  capabilities: ServerCapabilitiesFromUnknownSchema,
1074
1082
  })
1075
1083
  .passthrough()
1076
1084
  .transform((payload) => ({
1077
1085
  ...payload,
1078
1086
  hostname: payload.hostname ?? null,
1087
+ version: payload.version ?? null,
1079
1088
  }));
1080
1089
  export const StatusMessageSchema = z.object({
1081
- type: z.literal("status"),
1090
+ type: z.literal('status'),
1082
1091
  payload: z
1083
1092
  .object({
1084
1093
  status: z.string(),
@@ -1086,7 +1095,7 @@ export const StatusMessageSchema = z.object({
1086
1095
  .passthrough(), // Allow additional fields
1087
1096
  });
1088
1097
  export const PongMessageSchema = z.object({
1089
- type: z.literal("pong"),
1098
+ type: z.literal('pong'),
1090
1099
  payload: z.object({
1091
1100
  requestId: z.string(),
1092
1101
  clientSentAt: z.number().int().optional(),
@@ -1095,7 +1104,7 @@ export const PongMessageSchema = z.object({
1095
1104
  }),
1096
1105
  });
1097
1106
  export const RpcErrorMessageSchema = z.object({
1098
- type: z.literal("rpc_error"),
1107
+ type: z.literal('rpc_error'),
1099
1108
  payload: z.object({
1100
1109
  requestId: z.string(),
1101
1110
  requestType: z.string().optional(),
@@ -1112,33 +1121,33 @@ const AgentStatusWithTimelineSchema = AgentStatusWithRequestSchema.extend({
1112
1121
  });
1113
1122
  export const AgentCreatedStatusPayloadSchema = z
1114
1123
  .object({
1115
- status: z.literal("agent_created"),
1124
+ status: z.literal('agent_created'),
1116
1125
  agent: AgentSnapshotPayloadSchema,
1117
1126
  })
1118
1127
  .extend(AgentStatusWithRequestSchema.shape);
1119
1128
  export const AgentCreateFailedStatusPayloadSchema = z.object({
1120
- status: z.literal("agent_create_failed"),
1129
+ status: z.literal('agent_create_failed'),
1121
1130
  requestId: z.string(),
1122
1131
  error: z.string(),
1123
1132
  });
1124
1133
  export const AgentResumedStatusPayloadSchema = z
1125
1134
  .object({
1126
- status: z.literal("agent_resumed"),
1135
+ status: z.literal('agent_resumed'),
1127
1136
  agent: AgentSnapshotPayloadSchema,
1128
1137
  })
1129
1138
  .extend(AgentStatusWithTimelineSchema.shape);
1130
1139
  export const AgentRefreshedStatusPayloadSchema = z
1131
1140
  .object({
1132
- status: z.literal("agent_refreshed"),
1141
+ status: z.literal('agent_refreshed'),
1133
1142
  })
1134
1143
  .extend(AgentStatusWithTimelineSchema.shape);
1135
1144
  export const RestartRequestedStatusPayloadSchema = z.object({
1136
- status: z.literal("restart_requested"),
1145
+ status: z.literal('restart_requested'),
1137
1146
  clientId: z.string(),
1138
1147
  reason: z.string().optional(),
1139
1148
  requestId: z.string(),
1140
1149
  });
1141
- export const KnownStatusPayloadSchema = z.discriminatedUnion("status", [
1150
+ export const KnownStatusPayloadSchema = z.discriminatedUnion('status', [
1142
1151
  AgentCreatedStatusPayloadSchema,
1143
1152
  AgentCreateFailedStatusPayloadSchema,
1144
1153
  AgentResumedStatusPayloadSchema,
@@ -1146,9 +1155,9 @@ export const KnownStatusPayloadSchema = z.discriminatedUnion("status", [
1146
1155
  RestartRequestedStatusPayloadSchema,
1147
1156
  ]);
1148
1157
  export const ArtifactMessageSchema = z.object({
1149
- type: z.literal("artifact"),
1158
+ type: z.literal('artifact'),
1150
1159
  payload: z.object({
1151
- type: z.enum(["markdown", "diff", "image", "code"]),
1160
+ type: z.enum(['markdown', 'diff', 'image', 'code']),
1152
1161
  id: z.string(),
1153
1162
  title: z.string(),
1154
1163
  content: z.string(),
@@ -1190,21 +1199,21 @@ export const ProjectPlacementPayloadSchema = z.object({
1190
1199
  checkout: ProjectCheckoutLitePayloadSchema,
1191
1200
  });
1192
1201
  export const AgentUpdateMessageSchema = z.object({
1193
- type: z.literal("agent_update"),
1194
- payload: z.discriminatedUnion("kind", [
1202
+ type: z.literal('agent_update'),
1203
+ payload: z.discriminatedUnion('kind', [
1195
1204
  z.object({
1196
- kind: z.literal("upsert"),
1205
+ kind: z.literal('upsert'),
1197
1206
  agent: AgentSnapshotPayloadSchema,
1198
1207
  project: ProjectPlacementPayloadSchema,
1199
1208
  }),
1200
1209
  z.object({
1201
- kind: z.literal("remove"),
1210
+ kind: z.literal('remove'),
1202
1211
  agentId: z.string(),
1203
1212
  }),
1204
1213
  ]),
1205
1214
  });
1206
1215
  export const AgentStreamMessageSchema = z.object({
1207
- type: z.literal("agent_stream"),
1216
+ type: z.literal('agent_stream'),
1208
1217
  payload: z.object({
1209
1218
  agentId: z.string(),
1210
1219
  event: AgentStreamEventPayloadSchema,
@@ -1215,7 +1224,7 @@ export const AgentStreamMessageSchema = z.object({
1215
1224
  }),
1216
1225
  });
1217
1226
  export const AgentStatusMessageSchema = z.object({
1218
- type: z.literal("agent_status"),
1227
+ type: z.literal('agent_status'),
1219
1228
  payload: z.object({
1220
1229
  agentId: z.string(),
1221
1230
  status: z.string(),
@@ -1223,13 +1232,13 @@ export const AgentStatusMessageSchema = z.object({
1223
1232
  }),
1224
1233
  });
1225
1234
  export const AgentListMessageSchema = z.object({
1226
- type: z.literal("agent_list"),
1235
+ type: z.literal('agent_list'),
1227
1236
  payload: z.object({
1228
1237
  agents: z.array(AgentSnapshotPayloadSchema),
1229
1238
  }),
1230
1239
  });
1231
1240
  export const FetchAgentsResponseMessageSchema = z.object({
1232
- type: z.literal("fetch_agents_response"),
1241
+ type: z.literal('fetch_agents_response'),
1233
1242
  payload: z.object({
1234
1243
  requestId: z.string(),
1235
1244
  subscriptionId: z.string().nullable().optional(),
@@ -1245,7 +1254,7 @@ export const FetchAgentsResponseMessageSchema = z.object({
1245
1254
  }),
1246
1255
  });
1247
1256
  export const FetchAgentResponseMessageSchema = z.object({
1248
- type: z.literal("fetch_agent_response"),
1257
+ type: z.literal('fetch_agent_response'),
1249
1258
  payload: z.object({
1250
1259
  requestId: z.string(),
1251
1260
  agent: AgentSnapshotPayloadSchema.nullable(),
@@ -1263,15 +1272,15 @@ export const AgentTimelineEntryPayloadSchema = z.object({
1263
1272
  seqStart: z.number().int().nonnegative(),
1264
1273
  seqEnd: z.number().int().nonnegative(),
1265
1274
  sourceSeqRanges: z.array(AgentTimelineSeqRangeSchema),
1266
- collapsed: z.array(z.enum(["assistant_merge", "tool_lifecycle"])),
1275
+ collapsed: z.array(z.enum(['assistant_merge', 'tool_lifecycle'])),
1267
1276
  });
1268
1277
  export const FetchAgentTimelineResponseMessageSchema = z.object({
1269
- type: z.literal("fetch_agent_timeline_response"),
1278
+ type: z.literal('fetch_agent_timeline_response'),
1270
1279
  payload: z.object({
1271
1280
  requestId: z.string(),
1272
1281
  agentId: z.string(),
1273
- direction: z.enum(["tail", "before", "after"]),
1274
- projection: z.enum(["projected", "canonical"]),
1282
+ direction: z.enum(['tail', 'before', 'after']),
1283
+ projection: z.enum(['projected', 'canonical']),
1275
1284
  epoch: z.string(),
1276
1285
  reset: z.boolean(),
1277
1286
  staleCursor: z.boolean(),
@@ -1290,7 +1299,7 @@ export const FetchAgentTimelineResponseMessageSchema = z.object({
1290
1299
  }),
1291
1300
  });
1292
1301
  export const SendAgentMessageResponseMessageSchema = z.object({
1293
- type: z.literal("send_agent_message_response"),
1302
+ type: z.literal('send_agent_message_response'),
1294
1303
  payload: z.object({
1295
1304
  requestId: z.string(),
1296
1305
  agentId: z.string(),
@@ -1299,24 +1308,24 @@ export const SendAgentMessageResponseMessageSchema = z.object({
1299
1308
  }),
1300
1309
  });
1301
1310
  export const WaitForFinishResponseMessageSchema = z.object({
1302
- type: z.literal("wait_for_finish_response"),
1311
+ type: z.literal('wait_for_finish_response'),
1303
1312
  payload: z.object({
1304
1313
  requestId: z.string(),
1305
- status: z.enum(["idle", "error", "permission", "timeout"]),
1314
+ status: z.enum(['idle', 'error', 'permission', 'timeout']),
1306
1315
  final: AgentSnapshotPayloadSchema.nullable(),
1307
1316
  error: z.string().nullable(),
1308
1317
  lastMessage: z.string().nullable(),
1309
1318
  }),
1310
1319
  });
1311
1320
  export const AgentPermissionRequestMessageSchema = z.object({
1312
- type: z.literal("agent_permission_request"),
1321
+ type: z.literal('agent_permission_request'),
1313
1322
  payload: z.object({
1314
1323
  agentId: z.string(),
1315
1324
  request: AgentPermissionRequestPayloadSchema,
1316
1325
  }),
1317
1326
  });
1318
1327
  export const AgentPermissionResolvedMessageSchema = z.object({
1319
- type: z.literal("agent_permission_resolved"),
1328
+ type: z.literal('agent_permission_resolved'),
1320
1329
  payload: z.object({
1321
1330
  agentId: z.string(),
1322
1331
  requestId: z.string(),
@@ -1324,14 +1333,14 @@ export const AgentPermissionResolvedMessageSchema = z.object({
1324
1333
  }),
1325
1334
  });
1326
1335
  export const AgentDeletedMessageSchema = z.object({
1327
- type: z.literal("agent_deleted"),
1336
+ type: z.literal('agent_deleted'),
1328
1337
  payload: z.object({
1329
1338
  agentId: z.string(),
1330
1339
  requestId: z.string(),
1331
1340
  }),
1332
1341
  });
1333
1342
  export const AgentArchivedMessageSchema = z.object({
1334
- type: z.literal("agent_archived"),
1343
+ type: z.literal('agent_archived'),
1335
1344
  payload: z.object({
1336
1345
  agentId: z.string(),
1337
1346
  archivedAt: z.string(),
@@ -1356,6 +1365,7 @@ const CheckoutStatusNotGitSchema = CheckoutStatusCommonSchema.extend({
1356
1365
  baseRef: z.null(),
1357
1366
  aheadBehind: z.null(),
1358
1367
  aheadOfOrigin: z.null(),
1368
+ behindOfOrigin: z.null(),
1359
1369
  hasRemote: z.boolean(),
1360
1370
  remoteUrl: z.null(),
1361
1371
  });
@@ -1368,6 +1378,7 @@ const CheckoutStatusGitNonPaseoSchema = CheckoutStatusCommonSchema.extend({
1368
1378
  baseRef: z.string().nullable(),
1369
1379
  aheadBehind: AheadBehindSchema.nullable(),
1370
1380
  aheadOfOrigin: z.number().nullable(),
1381
+ behindOfOrigin: z.number().nullable(),
1371
1382
  hasRemote: z.boolean(),
1372
1383
  remoteUrl: z.string().nullable(),
1373
1384
  });
@@ -1381,11 +1392,12 @@ const CheckoutStatusGitPaseoSchema = CheckoutStatusCommonSchema.extend({
1381
1392
  baseRef: z.string(),
1382
1393
  aheadBehind: AheadBehindSchema.nullable(),
1383
1394
  aheadOfOrigin: z.number().nullable(),
1395
+ behindOfOrigin: z.number().nullable(),
1384
1396
  hasRemote: z.boolean(),
1385
1397
  remoteUrl: z.string().nullable(),
1386
1398
  });
1387
1399
  export const CheckoutStatusResponseSchema = z.object({
1388
- type: z.literal("checkout_status_response"),
1400
+ type: z.literal('checkout_status_response'),
1389
1401
  payload: z.union([
1390
1402
  CheckoutStatusNotGitSchema,
1391
1403
  CheckoutStatusGitNonPaseoSchema,
@@ -1399,17 +1411,17 @@ const CheckoutDiffSubscriptionPayloadSchema = z.object({
1399
1411
  error: CheckoutErrorSchema.nullable(),
1400
1412
  });
1401
1413
  export const SubscribeCheckoutDiffResponseSchema = z.object({
1402
- type: z.literal("subscribe_checkout_diff_response"),
1414
+ type: z.literal('subscribe_checkout_diff_response'),
1403
1415
  payload: CheckoutDiffSubscriptionPayloadSchema.extend({
1404
1416
  requestId: z.string(),
1405
1417
  }),
1406
1418
  });
1407
1419
  export const CheckoutDiffUpdateSchema = z.object({
1408
- type: z.literal("checkout_diff_update"),
1420
+ type: z.literal('checkout_diff_update'),
1409
1421
  payload: CheckoutDiffSubscriptionPayloadSchema,
1410
1422
  });
1411
1423
  export const CheckoutCommitResponseSchema = z.object({
1412
- type: z.literal("checkout_commit_response"),
1424
+ type: z.literal('checkout_commit_response'),
1413
1425
  payload: z.object({
1414
1426
  cwd: z.string(),
1415
1427
  success: z.boolean(),
@@ -1418,7 +1430,7 @@ export const CheckoutCommitResponseSchema = z.object({
1418
1430
  }),
1419
1431
  });
1420
1432
  export const CheckoutMergeResponseSchema = z.object({
1421
- type: z.literal("checkout_merge_response"),
1433
+ type: z.literal('checkout_merge_response'),
1422
1434
  payload: z.object({
1423
1435
  cwd: z.string(),
1424
1436
  success: z.boolean(),
@@ -1427,7 +1439,7 @@ export const CheckoutMergeResponseSchema = z.object({
1427
1439
  }),
1428
1440
  });
1429
1441
  export const CheckoutMergeFromBaseResponseSchema = z.object({
1430
- type: z.literal("checkout_merge_from_base_response"),
1442
+ type: z.literal('checkout_merge_from_base_response'),
1431
1443
  payload: z.object({
1432
1444
  cwd: z.string(),
1433
1445
  success: z.boolean(),
@@ -1436,7 +1448,7 @@ export const CheckoutMergeFromBaseResponseSchema = z.object({
1436
1448
  }),
1437
1449
  });
1438
1450
  export const CheckoutPushResponseSchema = z.object({
1439
- type: z.literal("checkout_push_response"),
1451
+ type: z.literal('checkout_push_response'),
1440
1452
  payload: z.object({
1441
1453
  cwd: z.string(),
1442
1454
  success: z.boolean(),
@@ -1445,7 +1457,7 @@ export const CheckoutPushResponseSchema = z.object({
1445
1457
  }),
1446
1458
  });
1447
1459
  export const CheckoutPrCreateResponseSchema = z.object({
1448
- type: z.literal("checkout_pr_create_response"),
1460
+ type: z.literal('checkout_pr_create_response'),
1449
1461
  payload: z.object({
1450
1462
  cwd: z.string(),
1451
1463
  url: z.string().nullable(),
@@ -1460,9 +1472,10 @@ const CheckoutPrStatusSchema = z.object({
1460
1472
  state: z.string(),
1461
1473
  baseRefName: z.string(),
1462
1474
  headRefName: z.string(),
1475
+ isMerged: z.boolean(),
1463
1476
  });
1464
1477
  export const CheckoutPrStatusResponseSchema = z.object({
1465
- type: z.literal("checkout_pr_status_response"),
1478
+ type: z.literal('checkout_pr_status_response'),
1466
1479
  payload: z.object({
1467
1480
  cwd: z.string(),
1468
1481
  status: CheckoutPrStatusSchema.nullable(),
@@ -1472,7 +1485,7 @@ export const CheckoutPrStatusResponseSchema = z.object({
1472
1485
  }),
1473
1486
  });
1474
1487
  export const ValidateBranchResponseSchema = z.object({
1475
- type: z.literal("validate_branch_response"),
1488
+ type: z.literal('validate_branch_response'),
1476
1489
  payload: z.object({
1477
1490
  exists: z.boolean(),
1478
1491
  resolvedRef: z.string().nullable(),
@@ -1482,7 +1495,7 @@ export const ValidateBranchResponseSchema = z.object({
1482
1495
  }),
1483
1496
  });
1484
1497
  export const BranchSuggestionsResponseSchema = z.object({
1485
- type: z.literal("branch_suggestions_response"),
1498
+ type: z.literal('branch_suggestions_response'),
1486
1499
  payload: z.object({
1487
1500
  branches: z.array(z.string()),
1488
1501
  error: z.string().nullable(),
@@ -1490,9 +1503,16 @@ export const BranchSuggestionsResponseSchema = z.object({
1490
1503
  }),
1491
1504
  });
1492
1505
  export const DirectorySuggestionsResponseSchema = z.object({
1493
- type: z.literal("directory_suggestions_response"),
1506
+ type: z.literal('directory_suggestions_response'),
1494
1507
  payload: z.object({
1495
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([]),
1496
1516
  error: z.string().nullable(),
1497
1517
  requestId: z.string(),
1498
1518
  }),
@@ -1503,7 +1523,7 @@ const PaseoWorktreeSchema = z.object({
1503
1523
  head: z.string().nullable().optional(),
1504
1524
  });
1505
1525
  export const PaseoWorktreeListResponseSchema = z.object({
1506
- type: z.literal("paseo_worktree_list_response"),
1526
+ type: z.literal('paseo_worktree_list_response'),
1507
1527
  payload: z.object({
1508
1528
  worktrees: z.array(PaseoWorktreeSchema),
1509
1529
  error: CheckoutErrorSchema.nullable(),
@@ -1511,7 +1531,7 @@ export const PaseoWorktreeListResponseSchema = z.object({
1511
1531
  }),
1512
1532
  });
1513
1533
  export const PaseoWorktreeArchiveResponseSchema = z.object({
1514
- type: z.literal("paseo_worktree_archive_response"),
1534
+ type: z.literal('paseo_worktree_archive_response'),
1515
1535
  payload: z.object({
1516
1536
  success: z.boolean(),
1517
1537
  removedAgents: z.array(z.string()).optional(),
@@ -1520,11 +1540,11 @@ export const PaseoWorktreeArchiveResponseSchema = z.object({
1520
1540
  }),
1521
1541
  });
1522
1542
  export const FileExplorerResponseSchema = z.object({
1523
- type: z.literal("file_explorer_response"),
1543
+ type: z.literal('file_explorer_response'),
1524
1544
  payload: z.object({
1525
1545
  agentId: z.string(),
1526
1546
  path: z.string(),
1527
- mode: z.enum(["list", "file"]),
1547
+ mode: z.enum(['list', 'file']),
1528
1548
  directory: FileExplorerDirectorySchema.nullable(),
1529
1549
  file: FileExplorerFileSchema.nullable(),
1530
1550
  error: z.string().nullable(),
@@ -1536,7 +1556,7 @@ const ProjectIconSchema = z.object({
1536
1556
  mimeType: z.string(),
1537
1557
  });
1538
1558
  export const ProjectIconResponseSchema = z.object({
1539
- type: z.literal("project_icon_response"),
1559
+ type: z.literal('project_icon_response'),
1540
1560
  payload: z.object({
1541
1561
  cwd: z.string(),
1542
1562
  icon: ProjectIconSchema.nullable(),
@@ -1545,7 +1565,7 @@ export const ProjectIconResponseSchema = z.object({
1545
1565
  }),
1546
1566
  });
1547
1567
  export const FileDownloadTokenResponseSchema = z.object({
1548
- type: z.literal("file_download_token_response"),
1568
+ type: z.literal('file_download_token_response'),
1549
1569
  payload: z.object({
1550
1570
  agentId: z.string(),
1551
1571
  path: z.string(),
@@ -1558,7 +1578,7 @@ export const FileDownloadTokenResponseSchema = z.object({
1558
1578
  }),
1559
1579
  });
1560
1580
  export const ListProviderModelsResponseMessageSchema = z.object({
1561
- type: z.literal("list_provider_models_response"),
1581
+ type: z.literal('list_provider_models_response'),
1562
1582
  payload: z.object({
1563
1583
  provider: AgentProviderSchema,
1564
1584
  models: z.array(AgentModelDefinitionSchema).optional(),
@@ -1573,7 +1593,7 @@ const ProviderAvailabilitySchema = z.object({
1573
1593
  error: z.string().nullable().optional(),
1574
1594
  });
1575
1595
  export const ListAvailableProvidersResponseSchema = z.object({
1576
- type: z.literal("list_available_providers_response"),
1596
+ type: z.literal('list_available_providers_response'),
1577
1597
  payload: z.object({
1578
1598
  providers: z.array(ProviderAvailabilitySchema),
1579
1599
  error: z.string().nullable().optional(),
@@ -1582,7 +1602,7 @@ export const ListAvailableProvidersResponseSchema = z.object({
1582
1602
  }),
1583
1603
  });
1584
1604
  export const SpeechModelsListResponseSchema = z.object({
1585
- type: z.literal("speech_models_list_response"),
1605
+ type: z.literal('speech_models_list_response'),
1586
1606
  payload: z.object({
1587
1607
  modelsDir: z.string(),
1588
1608
  models: z.array(z.object({
@@ -1597,7 +1617,7 @@ export const SpeechModelsListResponseSchema = z.object({
1597
1617
  }),
1598
1618
  });
1599
1619
  export const SpeechModelsDownloadResponseSchema = z.object({
1600
- type: z.literal("speech_models_download_response"),
1620
+ type: z.literal('speech_models_download_response'),
1601
1621
  payload: z.object({
1602
1622
  modelsDir: z.string(),
1603
1623
  downloadedModelIds: z.array(z.string()),
@@ -1611,7 +1631,7 @@ const AgentSlashCommandSchema = z.object({
1611
1631
  argumentHint: z.string(),
1612
1632
  });
1613
1633
  export const ListCommandsResponseSchema = z.object({
1614
- type: z.literal("list_commands_response"),
1634
+ type: z.literal('list_commands_response'),
1615
1635
  payload: z.object({
1616
1636
  agentId: z.string(),
1617
1637
  commands: z.array(AgentSlashCommandSchema),
@@ -1619,20 +1639,6 @@ export const ListCommandsResponseSchema = z.object({
1619
1639
  requestId: z.string(),
1620
1640
  }),
1621
1641
  });
1622
- const AgentCommandResultSchema = z.object({
1623
- text: z.string(),
1624
- timeline: z.array(AgentTimelineItemPayloadSchema),
1625
- usage: AgentUsageSchema.optional(),
1626
- });
1627
- export const ExecuteCommandResponseSchema = z.object({
1628
- type: z.literal("execute_command_response"),
1629
- payload: z.object({
1630
- agentId: z.string(),
1631
- result: AgentCommandResultSchema.nullable(),
1632
- error: z.string().nullable(),
1633
- requestId: z.string(),
1634
- }),
1635
- });
1636
1642
  // ============================================================================
1637
1643
  // Terminal Outbound Messages
1638
1644
  // ============================================================================
@@ -1659,7 +1665,7 @@ const TerminalStateSchema = z.object({
1659
1665
  cursor: z.object({ row: z.number(), col: z.number() }),
1660
1666
  });
1661
1667
  export const ListTerminalsResponseSchema = z.object({
1662
- type: z.literal("list_terminals_response"),
1668
+ type: z.literal('list_terminals_response'),
1663
1669
  payload: z.object({
1664
1670
  cwd: z.string(),
1665
1671
  terminals: z.array(TerminalInfoSchema.omit({ cwd: true })),
@@ -1667,14 +1673,14 @@ export const ListTerminalsResponseSchema = z.object({
1667
1673
  }),
1668
1674
  });
1669
1675
  export const TerminalsChangedSchema = z.object({
1670
- type: z.literal("terminals_changed"),
1676
+ type: z.literal('terminals_changed'),
1671
1677
  payload: z.object({
1672
1678
  cwd: z.string(),
1673
1679
  terminals: z.array(TerminalInfoSchema.omit({ cwd: true })),
1674
1680
  }),
1675
1681
  });
1676
1682
  export const CreateTerminalResponseSchema = z.object({
1677
- type: z.literal("create_terminal_response"),
1683
+ type: z.literal('create_terminal_response'),
1678
1684
  payload: z.object({
1679
1685
  terminal: TerminalInfoSchema.nullable(),
1680
1686
  error: z.string().nullable(),
@@ -1682,7 +1688,7 @@ export const CreateTerminalResponseSchema = z.object({
1682
1688
  }),
1683
1689
  });
1684
1690
  export const SubscribeTerminalResponseSchema = z.object({
1685
- type: z.literal("subscribe_terminal_response"),
1691
+ type: z.literal('subscribe_terminal_response'),
1686
1692
  payload: z.object({
1687
1693
  terminalId: z.string(),
1688
1694
  state: TerminalStateSchema.nullable(),
@@ -1691,14 +1697,14 @@ export const SubscribeTerminalResponseSchema = z.object({
1691
1697
  }),
1692
1698
  });
1693
1699
  export const TerminalOutputSchema = z.object({
1694
- type: z.literal("terminal_output"),
1700
+ type: z.literal('terminal_output'),
1695
1701
  payload: z.object({
1696
1702
  terminalId: z.string(),
1697
1703
  state: TerminalStateSchema,
1698
1704
  }),
1699
1705
  });
1700
1706
  export const KillTerminalResponseSchema = z.object({
1701
- type: z.literal("kill_terminal_response"),
1707
+ type: z.literal('kill_terminal_response'),
1702
1708
  payload: z.object({
1703
1709
  terminalId: z.string(),
1704
1710
  success: z.boolean(),
@@ -1706,7 +1712,7 @@ export const KillTerminalResponseSchema = z.object({
1706
1712
  }),
1707
1713
  });
1708
1714
  export const AttachTerminalStreamResponseSchema = z.object({
1709
- type: z.literal("attach_terminal_stream_response"),
1715
+ type: z.literal('attach_terminal_stream_response'),
1710
1716
  payload: z.object({
1711
1717
  terminalId: z.string(),
1712
1718
  streamId: z.number().int().nonnegative().nullable(),
@@ -1719,7 +1725,7 @@ export const AttachTerminalStreamResponseSchema = z.object({
1719
1725
  }),
1720
1726
  });
1721
1727
  export const DetachTerminalStreamResponseSchema = z.object({
1722
- type: z.literal("detach_terminal_stream_response"),
1728
+ type: z.literal('detach_terminal_stream_response'),
1723
1729
  payload: z.object({
1724
1730
  streamId: z.number().int().nonnegative(),
1725
1731
  success: z.boolean(),
@@ -1727,13 +1733,13 @@ export const DetachTerminalStreamResponseSchema = z.object({
1727
1733
  }),
1728
1734
  });
1729
1735
  export const TerminalStreamExitSchema = z.object({
1730
- type: z.literal("terminal_stream_exit"),
1736
+ type: z.literal('terminal_stream_exit'),
1731
1737
  payload: z.object({
1732
1738
  streamId: z.number().int().nonnegative(),
1733
1739
  terminalId: z.string(),
1734
1740
  }),
1735
1741
  });
1736
- export const SessionOutboundMessageSchema = z.discriminatedUnion("type", [
1742
+ export const SessionOutboundMessageSchema = z.discriminatedUnion('type', [
1737
1743
  ActivityLogMessageSchema,
1738
1744
  AssistantChunkMessageSchema,
1739
1745
  AudioOutputMessageSchema,
@@ -1786,7 +1792,6 @@ export const SessionOutboundMessageSchema = z.discriminatedUnion("type", [
1786
1792
  SpeechModelsListResponseSchema,
1787
1793
  SpeechModelsDownloadResponseSchema,
1788
1794
  ListCommandsResponseSchema,
1789
- ExecuteCommandResponseSchema,
1790
1795
  ListTerminalsResponseSchema,
1791
1796
  TerminalsChangedSchema,
1792
1797
  CreateTerminalResponseSchema,
@@ -1802,31 +1807,31 @@ export const SessionOutboundMessageSchema = z.discriminatedUnion("type", [
1802
1807
  // ============================================================================
1803
1808
  // WebSocket-only messages (not session messages)
1804
1809
  export const WSPingMessageSchema = z.object({
1805
- type: z.literal("ping"),
1810
+ type: z.literal('ping'),
1806
1811
  });
1807
1812
  export const WSPongMessageSchema = z.object({
1808
- type: z.literal("pong"),
1813
+ type: z.literal('pong'),
1809
1814
  });
1810
1815
  export const WSRecordingStateMessageSchema = z.object({
1811
- type: z.literal("recording_state"),
1816
+ type: z.literal('recording_state'),
1812
1817
  isRecording: z.boolean(),
1813
1818
  });
1814
1819
  // Wrapped session message
1815
1820
  export const WSSessionInboundSchema = z.object({
1816
- type: z.literal("session"),
1821
+ type: z.literal('session'),
1817
1822
  message: SessionInboundMessageSchema,
1818
1823
  });
1819
1824
  export const WSSessionOutboundSchema = z.object({
1820
- type: z.literal("session"),
1825
+ type: z.literal('session'),
1821
1826
  message: SessionOutboundMessageSchema,
1822
1827
  });
1823
1828
  // Complete WebSocket message schemas
1824
- export const WSInboundMessageSchema = z.discriminatedUnion("type", [
1829
+ export const WSInboundMessageSchema = z.discriminatedUnion('type', [
1825
1830
  WSPingMessageSchema,
1826
1831
  WSRecordingStateMessageSchema,
1827
1832
  WSSessionInboundSchema,
1828
1833
  ]);
1829
- export const WSOutboundMessageSchema = z.discriminatedUnion("type", [
1834
+ export const WSOutboundMessageSchema = z.discriminatedUnion('type', [
1830
1835
  WSPongMessageSchema,
1831
1836
  WSSessionOutboundSchema,
1832
1837
  ]);
@@ -1838,7 +1843,7 @@ export const WSOutboundMessageSchema = z.discriminatedUnion("type", [
1838
1843
  * Returns null if message should be handled at WS level only
1839
1844
  */
1840
1845
  export function extractSessionMessage(wsMsg) {
1841
- if (wsMsg.type === "session") {
1846
+ if (wsMsg.type === 'session') {
1842
1847
  return wsMsg.message;
1843
1848
  }
1844
1849
  // Ping and recording_state are WS-level only
@@ -1849,7 +1854,7 @@ export function extractSessionMessage(wsMsg) {
1849
1854
  */
1850
1855
  export function wrapSessionMessage(sessionMsg) {
1851
1856
  return {
1852
- type: "session",
1857
+ type: 'session',
1853
1858
  message: sessionMsg,
1854
1859
  };
1855
1860
  }