@linkshell/host 0.1.0

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 (109) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -0
  3. package/dist/host/src/drivers/acp/connection.d.ts +61 -0
  4. package/dist/host/src/drivers/acp/connection.js +121 -0
  5. package/dist/host/src/drivers/acp/connection.js.map +1 -0
  6. package/dist/host/src/drivers/acp/driver.d.ts +110 -0
  7. package/dist/host/src/drivers/acp/driver.js +438 -0
  8. package/dist/host/src/drivers/acp/driver.js.map +1 -0
  9. package/dist/host/src/drivers/acp/mapper.d.ts +49 -0
  10. package/dist/host/src/drivers/acp/mapper.js +411 -0
  11. package/dist/host/src/drivers/acp/mapper.js.map +1 -0
  12. package/dist/host/src/drivers/auth.d.ts +7 -0
  13. package/dist/host/src/drivers/auth.js +57 -0
  14. package/dist/host/src/drivers/auth.js.map +1 -0
  15. package/dist/host/src/drivers/claude/driver.d.ts +76 -0
  16. package/dist/host/src/drivers/claude/driver.js +331 -0
  17. package/dist/host/src/drivers/claude/driver.js.map +1 -0
  18. package/dist/host/src/drivers/claude/transcript.d.ts +335 -0
  19. package/dist/host/src/drivers/claude/transcript.js +516 -0
  20. package/dist/host/src/drivers/claude/transcript.js.map +1 -0
  21. package/dist/host/src/drivers/codex/app-server.d.ts +36 -0
  22. package/dist/host/src/drivers/codex/app-server.js +144 -0
  23. package/dist/host/src/drivers/codex/app-server.js.map +1 -0
  24. package/dist/host/src/drivers/codex/driver.d.ts +89 -0
  25. package/dist/host/src/drivers/codex/driver.js +452 -0
  26. package/dist/host/src/drivers/codex/driver.js.map +1 -0
  27. package/dist/host/src/drivers/codex/mapper.d.ts +61 -0
  28. package/dist/host/src/drivers/codex/mapper.js +623 -0
  29. package/dist/host/src/drivers/codex/mapper.js.map +1 -0
  30. package/dist/host/src/drivers/codex/settings.d.ts +51 -0
  31. package/dist/host/src/drivers/codex/settings.js +107 -0
  32. package/dist/host/src/drivers/codex/settings.js.map +1 -0
  33. package/dist/host/src/drivers/images.d.ts +11 -0
  34. package/dist/host/src/drivers/images.js +34 -0
  35. package/dist/host/src/drivers/images.js.map +1 -0
  36. package/dist/host/src/drivers/nesting.d.ts +6 -0
  37. package/dist/host/src/drivers/nesting.js +25 -0
  38. package/dist/host/src/drivers/nesting.js.map +1 -0
  39. package/dist/host/src/drivers/registry.d.ts +21 -0
  40. package/dist/host/src/drivers/registry.js +30 -0
  41. package/dist/host/src/drivers/registry.js.map +1 -0
  42. package/dist/host/src/drivers/types.d.ts +105 -0
  43. package/dist/host/src/drivers/types.js +2 -0
  44. package/dist/host/src/drivers/types.js.map +1 -0
  45. package/dist/host/src/fs.d.ts +69 -0
  46. package/dist/host/src/fs.js +198 -0
  47. package/dist/host/src/fs.js.map +1 -0
  48. package/dist/host/src/gateway.d.ts +55 -0
  49. package/dist/host/src/gateway.js +263 -0
  50. package/dist/host/src/gateway.js.map +1 -0
  51. package/dist/host/src/host.d.ts +51 -0
  52. package/dist/host/src/host.js +133 -0
  53. package/dist/host/src/host.js.map +1 -0
  54. package/dist/host/src/hub.d.ts +89 -0
  55. package/dist/host/src/hub.js +592 -0
  56. package/dist/host/src/hub.js.map +1 -0
  57. package/dist/host/src/index.d.ts +10 -0
  58. package/dist/host/src/index.js +10 -0
  59. package/dist/host/src/index.js.map +1 -0
  60. package/dist/host/src/ports.d.ts +24 -0
  61. package/dist/host/src/ports.js +201 -0
  62. package/dist/host/src/ports.js.map +1 -0
  63. package/dist/host/src/rpc/client.d.ts +9 -0
  64. package/dist/host/src/rpc/client.js +42 -0
  65. package/dist/host/src/rpc/client.js.map +1 -0
  66. package/dist/host/src/rpc/server.d.ts +52 -0
  67. package/dist/host/src/rpc/server.js +293 -0
  68. package/dist/host/src/rpc/server.js.map +1 -0
  69. package/dist/host/src/screen.d.ts +30 -0
  70. package/dist/host/src/screen.js +230 -0
  71. package/dist/host/src/screen.js.map +1 -0
  72. package/dist/host/src/shell-env.d.ts +8 -0
  73. package/dist/host/src/shell-env.js +39 -0
  74. package/dist/host/src/shell-env.js.map +1 -0
  75. package/dist/host/src/store.d.ts +75 -0
  76. package/dist/host/src/store.js +265 -0
  77. package/dist/host/src/store.js.map +1 -0
  78. package/dist/host/src/terminals.d.ts +55 -0
  79. package/dist/host/src/terminals.js +367 -0
  80. package/dist/host/src/terminals.js.map +1 -0
  81. package/dist/host/tsconfig.tsbuildinfo +1 -0
  82. package/dist/wire/src/crypto.d.ts +65 -0
  83. package/dist/wire/src/crypto.js +253 -0
  84. package/dist/wire/src/crypto.js.map +1 -0
  85. package/dist/wire/src/index.d.ts +8 -0
  86. package/dist/wire/src/index.js +9 -0
  87. package/dist/wire/src/index.js.map +1 -0
  88. package/dist/wire/src/model.d.ts +704 -0
  89. package/dist/wire/src/model.js +163 -0
  90. package/dist/wire/src/model.js.map +1 -0
  91. package/dist/wire/src/peer.d.ts +42 -0
  92. package/dist/wire/src/peer.js +143 -0
  93. package/dist/wire/src/peer.js.map +1 -0
  94. package/dist/wire/src/relay-client.d.ts +82 -0
  95. package/dist/wire/src/relay-client.js +259 -0
  96. package/dist/wire/src/relay-client.js.map +1 -0
  97. package/dist/wire/src/relay.d.ts +481 -0
  98. package/dist/wire/src/relay.js +129 -0
  99. package/dist/wire/src/relay.js.map +1 -0
  100. package/dist/wire/src/rpc.d.ts +4170 -0
  101. package/dist/wire/src/rpc.js +332 -0
  102. package/dist/wire/src/rpc.js.map +1 -0
  103. package/dist/wire/src/shell.d.ts +2 -0
  104. package/dist/wire/src/shell.js +62 -0
  105. package/dist/wire/src/shell.js.map +1 -0
  106. package/dist/wire/src/updates.d.ts +3325 -0
  107. package/dist/wire/src/updates.js +210 -0
  108. package/dist/wire/src/updates.js.map +1 -0
  109. package/package.json +53 -0
@@ -0,0 +1,3325 @@
1
+ import { z } from "zod";
2
+ export declare const contentBlockSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
3
+ type: z.ZodLiteral<"text">;
4
+ text: z.ZodString;
5
+ }, "strip", z.ZodTypeAny, {
6
+ type: "text";
7
+ text: string;
8
+ }, {
9
+ type: "text";
10
+ text: string;
11
+ }>, z.ZodObject<{
12
+ type: z.ZodLiteral<"image">;
13
+ mimeType: z.ZodString;
14
+ data: z.ZodOptional<z.ZodString>;
15
+ uri: z.ZodOptional<z.ZodString>;
16
+ }, "strip", z.ZodTypeAny, {
17
+ type: "image";
18
+ mimeType: string;
19
+ data?: string | undefined;
20
+ uri?: string | undefined;
21
+ }, {
22
+ type: "image";
23
+ mimeType: string;
24
+ data?: string | undefined;
25
+ uri?: string | undefined;
26
+ }>, z.ZodObject<{
27
+ type: z.ZodLiteral<"resource_link">;
28
+ uri: z.ZodString;
29
+ name: z.ZodString;
30
+ /** What the link names: a file (default), a skill the user invoked, or another agent. */
31
+ kind: z.ZodOptional<z.ZodEnum<["file", "skill", "agent"]>>;
32
+ }, "strip", z.ZodTypeAny, {
33
+ type: "resource_link";
34
+ name: string;
35
+ uri: string;
36
+ kind?: "agent" | "file" | "skill" | undefined;
37
+ }, {
38
+ type: "resource_link";
39
+ name: string;
40
+ uri: string;
41
+ kind?: "agent" | "file" | "skill" | undefined;
42
+ }>]>;
43
+ export type ContentBlock = z.infer<typeof contentBlockSchema>;
44
+ export declare const toolCallStatusSchema: z.ZodEnum<["pending", "in_progress", "completed", "failed"]>;
45
+ export type ToolCallStatus = z.infer<typeof toolCallStatusSchema>;
46
+ export declare const toolCallContentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
47
+ type: z.ZodLiteral<"content">;
48
+ content: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
49
+ type: z.ZodLiteral<"text">;
50
+ text: z.ZodString;
51
+ }, "strip", z.ZodTypeAny, {
52
+ type: "text";
53
+ text: string;
54
+ }, {
55
+ type: "text";
56
+ text: string;
57
+ }>, z.ZodObject<{
58
+ type: z.ZodLiteral<"image">;
59
+ mimeType: z.ZodString;
60
+ data: z.ZodOptional<z.ZodString>;
61
+ uri: z.ZodOptional<z.ZodString>;
62
+ }, "strip", z.ZodTypeAny, {
63
+ type: "image";
64
+ mimeType: string;
65
+ data?: string | undefined;
66
+ uri?: string | undefined;
67
+ }, {
68
+ type: "image";
69
+ mimeType: string;
70
+ data?: string | undefined;
71
+ uri?: string | undefined;
72
+ }>, z.ZodObject<{
73
+ type: z.ZodLiteral<"resource_link">;
74
+ uri: z.ZodString;
75
+ name: z.ZodString;
76
+ /** What the link names: a file (default), a skill the user invoked, or another agent. */
77
+ kind: z.ZodOptional<z.ZodEnum<["file", "skill", "agent"]>>;
78
+ }, "strip", z.ZodTypeAny, {
79
+ type: "resource_link";
80
+ name: string;
81
+ uri: string;
82
+ kind?: "agent" | "file" | "skill" | undefined;
83
+ }, {
84
+ type: "resource_link";
85
+ name: string;
86
+ uri: string;
87
+ kind?: "agent" | "file" | "skill" | undefined;
88
+ }>]>;
89
+ }, "strip", z.ZodTypeAny, {
90
+ type: "content";
91
+ content: {
92
+ type: "text";
93
+ text: string;
94
+ } | {
95
+ type: "image";
96
+ mimeType: string;
97
+ data?: string | undefined;
98
+ uri?: string | undefined;
99
+ } | {
100
+ type: "resource_link";
101
+ name: string;
102
+ uri: string;
103
+ kind?: "agent" | "file" | "skill" | undefined;
104
+ };
105
+ }, {
106
+ type: "content";
107
+ content: {
108
+ type: "text";
109
+ text: string;
110
+ } | {
111
+ type: "image";
112
+ mimeType: string;
113
+ data?: string | undefined;
114
+ uri?: string | undefined;
115
+ } | {
116
+ type: "resource_link";
117
+ name: string;
118
+ uri: string;
119
+ kind?: "agent" | "file" | "skill" | undefined;
120
+ };
121
+ }>, z.ZodObject<{
122
+ type: z.ZodLiteral<"diff">;
123
+ path: z.ZodString;
124
+ oldText: z.ZodOptional<z.ZodNullable<z.ZodString>>;
125
+ newText: z.ZodString;
126
+ }, "strip", z.ZodTypeAny, {
127
+ path: string;
128
+ type: "diff";
129
+ newText: string;
130
+ oldText?: string | null | undefined;
131
+ }, {
132
+ path: string;
133
+ type: "diff";
134
+ newText: string;
135
+ oldText?: string | null | undefined;
136
+ }>, z.ZodObject<{
137
+ type: z.ZodLiteral<"patch">;
138
+ path: z.ZodString;
139
+ change: z.ZodEnum<["add", "delete", "update"]>;
140
+ movePath: z.ZodOptional<z.ZodString>;
141
+ diff: z.ZodString;
142
+ }, "strip", z.ZodTypeAny, {
143
+ path: string;
144
+ type: "patch";
145
+ diff: string;
146
+ change: "delete" | "add" | "update";
147
+ movePath?: string | undefined;
148
+ }, {
149
+ path: string;
150
+ type: "patch";
151
+ diff: string;
152
+ change: "delete" | "add" | "update";
153
+ movePath?: string | undefined;
154
+ }>, z.ZodObject<{
155
+ type: z.ZodLiteral<"terminal">;
156
+ terminalId: z.ZodString;
157
+ }, "strip", z.ZodTypeAny, {
158
+ type: "terminal";
159
+ terminalId: string;
160
+ }, {
161
+ type: "terminal";
162
+ terminalId: string;
163
+ }>]>;
164
+ export type ToolCallContent = z.infer<typeof toolCallContentSchema>;
165
+ export declare const toolCallLocationSchema: z.ZodObject<{
166
+ path: z.ZodString;
167
+ line: z.ZodOptional<z.ZodNumber>;
168
+ }, "strip", z.ZodTypeAny, {
169
+ path: string;
170
+ line?: number | undefined;
171
+ }, {
172
+ path: string;
173
+ line?: number | undefined;
174
+ }>;
175
+ export type ToolCallLocation = z.infer<typeof toolCallLocationSchema>;
176
+ /**
177
+ * What a tool call is, when the agent tells us more than ACP's coarse `kind`.
178
+ * Host drivers fill it from each agent's own tool names; clients render it the
179
+ * same way for every agent and fall back to `title` + `kind` without it.
180
+ */
181
+ export declare const toolDetailSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
182
+ type: z.ZodLiteral<"mcp">;
183
+ server: z.ZodString;
184
+ tool: z.ZodString;
185
+ }, "strip", z.ZodTypeAny, {
186
+ type: "mcp";
187
+ tool: string;
188
+ server: string;
189
+ }, {
190
+ type: "mcp";
191
+ tool: string;
192
+ server: string;
193
+ }>, z.ZodObject<{
194
+ type: z.ZodLiteral<"subagent">;
195
+ /** spawn starts a sub-agent (its work nests under this call); the rest talk to one. */
196
+ action: z.ZodDefault<z.ZodEnum<["spawn", "message", "wait", "stop", "resume", "list"]>>;
197
+ task: z.ZodOptional<z.ZodString>;
198
+ /** The sub-agent's role or type, e.g. "Explore". */
199
+ agentType: z.ZodOptional<z.ZodString>;
200
+ model: z.ZodOptional<z.ZodString>;
201
+ }, "strip", z.ZodTypeAny, {
202
+ type: "subagent";
203
+ action: "message" | "spawn" | "wait" | "stop" | "resume" | "list";
204
+ model?: string | undefined;
205
+ task?: string | undefined;
206
+ agentType?: string | undefined;
207
+ }, {
208
+ type: "subagent";
209
+ model?: string | undefined;
210
+ action?: "message" | "spawn" | "wait" | "stop" | "resume" | "list" | undefined;
211
+ task?: string | undefined;
212
+ agentType?: string | undefined;
213
+ }>, z.ZodObject<{
214
+ type: z.ZodLiteral<"skill">;
215
+ name: z.ZodString;
216
+ description: z.ZodOptional<z.ZodString>;
217
+ }, "strip", z.ZodTypeAny, {
218
+ type: "skill";
219
+ name: string;
220
+ description?: string | undefined;
221
+ }, {
222
+ type: "skill";
223
+ name: string;
224
+ description?: string | undefined;
225
+ }>, z.ZodObject<{
226
+ type: z.ZodLiteral<"web_search">;
227
+ query: z.ZodOptional<z.ZodString>;
228
+ }, "strip", z.ZodTypeAny, {
229
+ type: "web_search";
230
+ query?: string | undefined;
231
+ }, {
232
+ type: "web_search";
233
+ query?: string | undefined;
234
+ }>, z.ZodObject<{
235
+ type: z.ZodLiteral<"image_generation">;
236
+ prompt: z.ZodOptional<z.ZodString>;
237
+ }, "strip", z.ZodTypeAny, {
238
+ type: "image_generation";
239
+ prompt?: string | undefined;
240
+ }, {
241
+ type: "image_generation";
242
+ prompt?: string | undefined;
243
+ }>, z.ZodObject<{
244
+ type: z.ZodLiteral<"compaction">;
245
+ }, "strip", z.ZodTypeAny, {
246
+ type: "compaction";
247
+ }, {
248
+ type: "compaction";
249
+ }>, z.ZodObject<{
250
+ type: z.ZodLiteral<"review">;
251
+ phase: z.ZodEnum<["started", "finished"]>;
252
+ }, "strip", z.ZodTypeAny, {
253
+ type: "review";
254
+ phase: "started" | "finished";
255
+ }, {
256
+ type: "review";
257
+ phase: "started" | "finished";
258
+ }>]>;
259
+ export type ToolDetail = z.infer<typeof toolDetailSchema>;
260
+ export declare const planEntrySchema: z.ZodObject<{
261
+ content: z.ZodString;
262
+ priority: z.ZodDefault<z.ZodEnum<["high", "medium", "low"]>>;
263
+ status: z.ZodEnum<["pending", "in_progress", "completed"]>;
264
+ }, "strip", z.ZodTypeAny, {
265
+ status: "pending" | "in_progress" | "completed";
266
+ content: string;
267
+ priority: "high" | "medium" | "low";
268
+ }, {
269
+ status: "pending" | "in_progress" | "completed";
270
+ content: string;
271
+ priority?: "high" | "medium" | "low" | undefined;
272
+ }>;
273
+ export type PlanEntry = z.infer<typeof planEntrySchema>;
274
+ export declare const stopReasonSchema: z.ZodEnum<["end_turn", "cancelled", "error", "max_tokens", "refusal"]>;
275
+ export type StopReason = z.infer<typeof stopReasonSchema>;
276
+ export declare const sessionConfigOptionSchema: z.ZodObject<{
277
+ /** Agent-defined id; "model" and "mode" are the common ones. */
278
+ id: z.ZodString;
279
+ name: z.ZodString;
280
+ category: z.ZodDefault<z.ZodEnum<["model", "mode", "effort", "other"]>>;
281
+ current: z.ZodString;
282
+ values: z.ZodArray<z.ZodObject<{
283
+ value: z.ZodString;
284
+ name: z.ZodString;
285
+ description: z.ZodOptional<z.ZodString>;
286
+ }, "strip", z.ZodTypeAny, {
287
+ value: string;
288
+ name: string;
289
+ description?: string | undefined;
290
+ }, {
291
+ value: string;
292
+ name: string;
293
+ description?: string | undefined;
294
+ }>, "many">;
295
+ }, "strip", z.ZodTypeAny, {
296
+ values: {
297
+ value: string;
298
+ name: string;
299
+ description?: string | undefined;
300
+ }[];
301
+ id: string;
302
+ name: string;
303
+ category: "other" | "model" | "mode" | "effort";
304
+ current: string;
305
+ }, {
306
+ values: {
307
+ value: string;
308
+ name: string;
309
+ description?: string | undefined;
310
+ }[];
311
+ id: string;
312
+ name: string;
313
+ current: string;
314
+ category?: "other" | "model" | "mode" | "effort" | undefined;
315
+ }>;
316
+ export type SessionConfigOption = z.infer<typeof sessionConfigOptionSchema>;
317
+ export declare const sessionUpdateSchema: z.ZodDiscriminatedUnion<"sessionUpdate", [z.ZodObject<{
318
+ sessionUpdate: z.ZodLiteral<"user_message_chunk">;
319
+ messageId: z.ZodOptional<z.ZodString>;
320
+ content: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
321
+ type: z.ZodLiteral<"text">;
322
+ text: z.ZodString;
323
+ }, "strip", z.ZodTypeAny, {
324
+ type: "text";
325
+ text: string;
326
+ }, {
327
+ type: "text";
328
+ text: string;
329
+ }>, z.ZodObject<{
330
+ type: z.ZodLiteral<"image">;
331
+ mimeType: z.ZodString;
332
+ data: z.ZodOptional<z.ZodString>;
333
+ uri: z.ZodOptional<z.ZodString>;
334
+ }, "strip", z.ZodTypeAny, {
335
+ type: "image";
336
+ mimeType: string;
337
+ data?: string | undefined;
338
+ uri?: string | undefined;
339
+ }, {
340
+ type: "image";
341
+ mimeType: string;
342
+ data?: string | undefined;
343
+ uri?: string | undefined;
344
+ }>, z.ZodObject<{
345
+ type: z.ZodLiteral<"resource_link">;
346
+ uri: z.ZodString;
347
+ name: z.ZodString;
348
+ /** What the link names: a file (default), a skill the user invoked, or another agent. */
349
+ kind: z.ZodOptional<z.ZodEnum<["file", "skill", "agent"]>>;
350
+ }, "strip", z.ZodTypeAny, {
351
+ type: "resource_link";
352
+ name: string;
353
+ uri: string;
354
+ kind?: "agent" | "file" | "skill" | undefined;
355
+ }, {
356
+ type: "resource_link";
357
+ name: string;
358
+ uri: string;
359
+ kind?: "agent" | "file" | "skill" | undefined;
360
+ }>]>;
361
+ }, "strip", z.ZodTypeAny, {
362
+ content: {
363
+ type: "text";
364
+ text: string;
365
+ } | {
366
+ type: "image";
367
+ mimeType: string;
368
+ data?: string | undefined;
369
+ uri?: string | undefined;
370
+ } | {
371
+ type: "resource_link";
372
+ name: string;
373
+ uri: string;
374
+ kind?: "agent" | "file" | "skill" | undefined;
375
+ };
376
+ sessionUpdate: "user_message_chunk";
377
+ messageId?: string | undefined;
378
+ }, {
379
+ content: {
380
+ type: "text";
381
+ text: string;
382
+ } | {
383
+ type: "image";
384
+ mimeType: string;
385
+ data?: string | undefined;
386
+ uri?: string | undefined;
387
+ } | {
388
+ type: "resource_link";
389
+ name: string;
390
+ uri: string;
391
+ kind?: "agent" | "file" | "skill" | undefined;
392
+ };
393
+ sessionUpdate: "user_message_chunk";
394
+ messageId?: string | undefined;
395
+ }>, z.ZodObject<{
396
+ sessionUpdate: z.ZodLiteral<"agent_message_chunk">;
397
+ parentToolCallId: z.ZodOptional<z.ZodString>;
398
+ messageId: z.ZodString;
399
+ content: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
400
+ type: z.ZodLiteral<"text">;
401
+ text: z.ZodString;
402
+ }, "strip", z.ZodTypeAny, {
403
+ type: "text";
404
+ text: string;
405
+ }, {
406
+ type: "text";
407
+ text: string;
408
+ }>, z.ZodObject<{
409
+ type: z.ZodLiteral<"image">;
410
+ mimeType: z.ZodString;
411
+ data: z.ZodOptional<z.ZodString>;
412
+ uri: z.ZodOptional<z.ZodString>;
413
+ }, "strip", z.ZodTypeAny, {
414
+ type: "image";
415
+ mimeType: string;
416
+ data?: string | undefined;
417
+ uri?: string | undefined;
418
+ }, {
419
+ type: "image";
420
+ mimeType: string;
421
+ data?: string | undefined;
422
+ uri?: string | undefined;
423
+ }>, z.ZodObject<{
424
+ type: z.ZodLiteral<"resource_link">;
425
+ uri: z.ZodString;
426
+ name: z.ZodString;
427
+ /** What the link names: a file (default), a skill the user invoked, or another agent. */
428
+ kind: z.ZodOptional<z.ZodEnum<["file", "skill", "agent"]>>;
429
+ }, "strip", z.ZodTypeAny, {
430
+ type: "resource_link";
431
+ name: string;
432
+ uri: string;
433
+ kind?: "agent" | "file" | "skill" | undefined;
434
+ }, {
435
+ type: "resource_link";
436
+ name: string;
437
+ uri: string;
438
+ kind?: "agent" | "file" | "skill" | undefined;
439
+ }>]>;
440
+ }, "strip", z.ZodTypeAny, {
441
+ content: {
442
+ type: "text";
443
+ text: string;
444
+ } | {
445
+ type: "image";
446
+ mimeType: string;
447
+ data?: string | undefined;
448
+ uri?: string | undefined;
449
+ } | {
450
+ type: "resource_link";
451
+ name: string;
452
+ uri: string;
453
+ kind?: "agent" | "file" | "skill" | undefined;
454
+ };
455
+ sessionUpdate: "agent_message_chunk";
456
+ messageId: string;
457
+ parentToolCallId?: string | undefined;
458
+ }, {
459
+ content: {
460
+ type: "text";
461
+ text: string;
462
+ } | {
463
+ type: "image";
464
+ mimeType: string;
465
+ data?: string | undefined;
466
+ uri?: string | undefined;
467
+ } | {
468
+ type: "resource_link";
469
+ name: string;
470
+ uri: string;
471
+ kind?: "agent" | "file" | "skill" | undefined;
472
+ };
473
+ sessionUpdate: "agent_message_chunk";
474
+ messageId: string;
475
+ parentToolCallId?: string | undefined;
476
+ }>, z.ZodObject<{
477
+ sessionUpdate: z.ZodLiteral<"agent_thought_chunk">;
478
+ parentToolCallId: z.ZodOptional<z.ZodString>;
479
+ messageId: z.ZodString;
480
+ content: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
481
+ type: z.ZodLiteral<"text">;
482
+ text: z.ZodString;
483
+ }, "strip", z.ZodTypeAny, {
484
+ type: "text";
485
+ text: string;
486
+ }, {
487
+ type: "text";
488
+ text: string;
489
+ }>, z.ZodObject<{
490
+ type: z.ZodLiteral<"image">;
491
+ mimeType: z.ZodString;
492
+ data: z.ZodOptional<z.ZodString>;
493
+ uri: z.ZodOptional<z.ZodString>;
494
+ }, "strip", z.ZodTypeAny, {
495
+ type: "image";
496
+ mimeType: string;
497
+ data?: string | undefined;
498
+ uri?: string | undefined;
499
+ }, {
500
+ type: "image";
501
+ mimeType: string;
502
+ data?: string | undefined;
503
+ uri?: string | undefined;
504
+ }>, z.ZodObject<{
505
+ type: z.ZodLiteral<"resource_link">;
506
+ uri: z.ZodString;
507
+ name: z.ZodString;
508
+ /** What the link names: a file (default), a skill the user invoked, or another agent. */
509
+ kind: z.ZodOptional<z.ZodEnum<["file", "skill", "agent"]>>;
510
+ }, "strip", z.ZodTypeAny, {
511
+ type: "resource_link";
512
+ name: string;
513
+ uri: string;
514
+ kind?: "agent" | "file" | "skill" | undefined;
515
+ }, {
516
+ type: "resource_link";
517
+ name: string;
518
+ uri: string;
519
+ kind?: "agent" | "file" | "skill" | undefined;
520
+ }>]>;
521
+ }, "strip", z.ZodTypeAny, {
522
+ content: {
523
+ type: "text";
524
+ text: string;
525
+ } | {
526
+ type: "image";
527
+ mimeType: string;
528
+ data?: string | undefined;
529
+ uri?: string | undefined;
530
+ } | {
531
+ type: "resource_link";
532
+ name: string;
533
+ uri: string;
534
+ kind?: "agent" | "file" | "skill" | undefined;
535
+ };
536
+ sessionUpdate: "agent_thought_chunk";
537
+ messageId: string;
538
+ parentToolCallId?: string | undefined;
539
+ }, {
540
+ content: {
541
+ type: "text";
542
+ text: string;
543
+ } | {
544
+ type: "image";
545
+ mimeType: string;
546
+ data?: string | undefined;
547
+ uri?: string | undefined;
548
+ } | {
549
+ type: "resource_link";
550
+ name: string;
551
+ uri: string;
552
+ kind?: "agent" | "file" | "skill" | undefined;
553
+ };
554
+ sessionUpdate: "agent_thought_chunk";
555
+ messageId: string;
556
+ parentToolCallId?: string | undefined;
557
+ }>, z.ZodObject<{
558
+ sessionUpdate: z.ZodLiteral<"tool_call">;
559
+ toolCallId: z.ZodString;
560
+ /** Set when a sub-agent made this call: the sub-agent's own (spawn) tool call. */
561
+ parentToolCallId: z.ZodOptional<z.ZodString>;
562
+ title: z.ZodString;
563
+ kind: z.ZodEnum<["read", "edit", "delete", "move", "search", "execute", "think", "fetch", "other"]>;
564
+ status: z.ZodEnum<["pending", "in_progress", "completed", "failed"]>;
565
+ rawInput: z.ZodOptional<z.ZodUnknown>;
566
+ content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
567
+ type: z.ZodLiteral<"content">;
568
+ content: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
569
+ type: z.ZodLiteral<"text">;
570
+ text: z.ZodString;
571
+ }, "strip", z.ZodTypeAny, {
572
+ type: "text";
573
+ text: string;
574
+ }, {
575
+ type: "text";
576
+ text: string;
577
+ }>, z.ZodObject<{
578
+ type: z.ZodLiteral<"image">;
579
+ mimeType: z.ZodString;
580
+ data: z.ZodOptional<z.ZodString>;
581
+ uri: z.ZodOptional<z.ZodString>;
582
+ }, "strip", z.ZodTypeAny, {
583
+ type: "image";
584
+ mimeType: string;
585
+ data?: string | undefined;
586
+ uri?: string | undefined;
587
+ }, {
588
+ type: "image";
589
+ mimeType: string;
590
+ data?: string | undefined;
591
+ uri?: string | undefined;
592
+ }>, z.ZodObject<{
593
+ type: z.ZodLiteral<"resource_link">;
594
+ uri: z.ZodString;
595
+ name: z.ZodString;
596
+ /** What the link names: a file (default), a skill the user invoked, or another agent. */
597
+ kind: z.ZodOptional<z.ZodEnum<["file", "skill", "agent"]>>;
598
+ }, "strip", z.ZodTypeAny, {
599
+ type: "resource_link";
600
+ name: string;
601
+ uri: string;
602
+ kind?: "agent" | "file" | "skill" | undefined;
603
+ }, {
604
+ type: "resource_link";
605
+ name: string;
606
+ uri: string;
607
+ kind?: "agent" | "file" | "skill" | undefined;
608
+ }>]>;
609
+ }, "strip", z.ZodTypeAny, {
610
+ type: "content";
611
+ content: {
612
+ type: "text";
613
+ text: string;
614
+ } | {
615
+ type: "image";
616
+ mimeType: string;
617
+ data?: string | undefined;
618
+ uri?: string | undefined;
619
+ } | {
620
+ type: "resource_link";
621
+ name: string;
622
+ uri: string;
623
+ kind?: "agent" | "file" | "skill" | undefined;
624
+ };
625
+ }, {
626
+ type: "content";
627
+ content: {
628
+ type: "text";
629
+ text: string;
630
+ } | {
631
+ type: "image";
632
+ mimeType: string;
633
+ data?: string | undefined;
634
+ uri?: string | undefined;
635
+ } | {
636
+ type: "resource_link";
637
+ name: string;
638
+ uri: string;
639
+ kind?: "agent" | "file" | "skill" | undefined;
640
+ };
641
+ }>, z.ZodObject<{
642
+ type: z.ZodLiteral<"diff">;
643
+ path: z.ZodString;
644
+ oldText: z.ZodOptional<z.ZodNullable<z.ZodString>>;
645
+ newText: z.ZodString;
646
+ }, "strip", z.ZodTypeAny, {
647
+ path: string;
648
+ type: "diff";
649
+ newText: string;
650
+ oldText?: string | null | undefined;
651
+ }, {
652
+ path: string;
653
+ type: "diff";
654
+ newText: string;
655
+ oldText?: string | null | undefined;
656
+ }>, z.ZodObject<{
657
+ type: z.ZodLiteral<"patch">;
658
+ path: z.ZodString;
659
+ change: z.ZodEnum<["add", "delete", "update"]>;
660
+ movePath: z.ZodOptional<z.ZodString>;
661
+ diff: z.ZodString;
662
+ }, "strip", z.ZodTypeAny, {
663
+ path: string;
664
+ type: "patch";
665
+ diff: string;
666
+ change: "delete" | "add" | "update";
667
+ movePath?: string | undefined;
668
+ }, {
669
+ path: string;
670
+ type: "patch";
671
+ diff: string;
672
+ change: "delete" | "add" | "update";
673
+ movePath?: string | undefined;
674
+ }>, z.ZodObject<{
675
+ type: z.ZodLiteral<"terminal">;
676
+ terminalId: z.ZodString;
677
+ }, "strip", z.ZodTypeAny, {
678
+ type: "terminal";
679
+ terminalId: string;
680
+ }, {
681
+ type: "terminal";
682
+ terminalId: string;
683
+ }>]>, "many">>;
684
+ locations: z.ZodOptional<z.ZodArray<z.ZodObject<{
685
+ path: z.ZodString;
686
+ line: z.ZodOptional<z.ZodNumber>;
687
+ }, "strip", z.ZodTypeAny, {
688
+ path: string;
689
+ line?: number | undefined;
690
+ }, {
691
+ path: string;
692
+ line?: number | undefined;
693
+ }>, "many">>;
694
+ detail: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
695
+ type: z.ZodLiteral<"mcp">;
696
+ server: z.ZodString;
697
+ tool: z.ZodString;
698
+ }, "strip", z.ZodTypeAny, {
699
+ type: "mcp";
700
+ tool: string;
701
+ server: string;
702
+ }, {
703
+ type: "mcp";
704
+ tool: string;
705
+ server: string;
706
+ }>, z.ZodObject<{
707
+ type: z.ZodLiteral<"subagent">;
708
+ /** spawn starts a sub-agent (its work nests under this call); the rest talk to one. */
709
+ action: z.ZodDefault<z.ZodEnum<["spawn", "message", "wait", "stop", "resume", "list"]>>;
710
+ task: z.ZodOptional<z.ZodString>;
711
+ /** The sub-agent's role or type, e.g. "Explore". */
712
+ agentType: z.ZodOptional<z.ZodString>;
713
+ model: z.ZodOptional<z.ZodString>;
714
+ }, "strip", z.ZodTypeAny, {
715
+ type: "subagent";
716
+ action: "message" | "spawn" | "wait" | "stop" | "resume" | "list";
717
+ model?: string | undefined;
718
+ task?: string | undefined;
719
+ agentType?: string | undefined;
720
+ }, {
721
+ type: "subagent";
722
+ model?: string | undefined;
723
+ action?: "message" | "spawn" | "wait" | "stop" | "resume" | "list" | undefined;
724
+ task?: string | undefined;
725
+ agentType?: string | undefined;
726
+ }>, z.ZodObject<{
727
+ type: z.ZodLiteral<"skill">;
728
+ name: z.ZodString;
729
+ description: z.ZodOptional<z.ZodString>;
730
+ }, "strip", z.ZodTypeAny, {
731
+ type: "skill";
732
+ name: string;
733
+ description?: string | undefined;
734
+ }, {
735
+ type: "skill";
736
+ name: string;
737
+ description?: string | undefined;
738
+ }>, z.ZodObject<{
739
+ type: z.ZodLiteral<"web_search">;
740
+ query: z.ZodOptional<z.ZodString>;
741
+ }, "strip", z.ZodTypeAny, {
742
+ type: "web_search";
743
+ query?: string | undefined;
744
+ }, {
745
+ type: "web_search";
746
+ query?: string | undefined;
747
+ }>, z.ZodObject<{
748
+ type: z.ZodLiteral<"image_generation">;
749
+ prompt: z.ZodOptional<z.ZodString>;
750
+ }, "strip", z.ZodTypeAny, {
751
+ type: "image_generation";
752
+ prompt?: string | undefined;
753
+ }, {
754
+ type: "image_generation";
755
+ prompt?: string | undefined;
756
+ }>, z.ZodObject<{
757
+ type: z.ZodLiteral<"compaction">;
758
+ }, "strip", z.ZodTypeAny, {
759
+ type: "compaction";
760
+ }, {
761
+ type: "compaction";
762
+ }>, z.ZodObject<{
763
+ type: z.ZodLiteral<"review">;
764
+ phase: z.ZodEnum<["started", "finished"]>;
765
+ }, "strip", z.ZodTypeAny, {
766
+ type: "review";
767
+ phase: "started" | "finished";
768
+ }, {
769
+ type: "review";
770
+ phase: "started" | "finished";
771
+ }>]>>;
772
+ }, "strip", z.ZodTypeAny, {
773
+ status: "pending" | "in_progress" | "completed" | "failed";
774
+ kind: "read" | "edit" | "delete" | "move" | "search" | "execute" | "think" | "fetch" | "other";
775
+ title: string;
776
+ toolCallId: string;
777
+ sessionUpdate: "tool_call";
778
+ detail?: {
779
+ type: "mcp";
780
+ tool: string;
781
+ server: string;
782
+ } | {
783
+ type: "subagent";
784
+ action: "message" | "spawn" | "wait" | "stop" | "resume" | "list";
785
+ model?: string | undefined;
786
+ task?: string | undefined;
787
+ agentType?: string | undefined;
788
+ } | {
789
+ type: "skill";
790
+ name: string;
791
+ description?: string | undefined;
792
+ } | {
793
+ type: "web_search";
794
+ query?: string | undefined;
795
+ } | {
796
+ type: "image_generation";
797
+ prompt?: string | undefined;
798
+ } | {
799
+ type: "compaction";
800
+ } | {
801
+ type: "review";
802
+ phase: "started" | "finished";
803
+ } | undefined;
804
+ content?: ({
805
+ type: "content";
806
+ content: {
807
+ type: "text";
808
+ text: string;
809
+ } | {
810
+ type: "image";
811
+ mimeType: string;
812
+ data?: string | undefined;
813
+ uri?: string | undefined;
814
+ } | {
815
+ type: "resource_link";
816
+ name: string;
817
+ uri: string;
818
+ kind?: "agent" | "file" | "skill" | undefined;
819
+ };
820
+ } | {
821
+ path: string;
822
+ type: "diff";
823
+ newText: string;
824
+ oldText?: string | null | undefined;
825
+ } | {
826
+ path: string;
827
+ type: "patch";
828
+ diff: string;
829
+ change: "delete" | "add" | "update";
830
+ movePath?: string | undefined;
831
+ } | {
832
+ type: "terminal";
833
+ terminalId: string;
834
+ })[] | undefined;
835
+ parentToolCallId?: string | undefined;
836
+ rawInput?: unknown;
837
+ locations?: {
838
+ path: string;
839
+ line?: number | undefined;
840
+ }[] | undefined;
841
+ }, {
842
+ status: "pending" | "in_progress" | "completed" | "failed";
843
+ kind: "read" | "edit" | "delete" | "move" | "search" | "execute" | "think" | "fetch" | "other";
844
+ title: string;
845
+ toolCallId: string;
846
+ sessionUpdate: "tool_call";
847
+ detail?: {
848
+ type: "mcp";
849
+ tool: string;
850
+ server: string;
851
+ } | {
852
+ type: "subagent";
853
+ model?: string | undefined;
854
+ action?: "message" | "spawn" | "wait" | "stop" | "resume" | "list" | undefined;
855
+ task?: string | undefined;
856
+ agentType?: string | undefined;
857
+ } | {
858
+ type: "skill";
859
+ name: string;
860
+ description?: string | undefined;
861
+ } | {
862
+ type: "web_search";
863
+ query?: string | undefined;
864
+ } | {
865
+ type: "image_generation";
866
+ prompt?: string | undefined;
867
+ } | {
868
+ type: "compaction";
869
+ } | {
870
+ type: "review";
871
+ phase: "started" | "finished";
872
+ } | undefined;
873
+ content?: ({
874
+ type: "content";
875
+ content: {
876
+ type: "text";
877
+ text: string;
878
+ } | {
879
+ type: "image";
880
+ mimeType: string;
881
+ data?: string | undefined;
882
+ uri?: string | undefined;
883
+ } | {
884
+ type: "resource_link";
885
+ name: string;
886
+ uri: string;
887
+ kind?: "agent" | "file" | "skill" | undefined;
888
+ };
889
+ } | {
890
+ path: string;
891
+ type: "diff";
892
+ newText: string;
893
+ oldText?: string | null | undefined;
894
+ } | {
895
+ path: string;
896
+ type: "patch";
897
+ diff: string;
898
+ change: "delete" | "add" | "update";
899
+ movePath?: string | undefined;
900
+ } | {
901
+ type: "terminal";
902
+ terminalId: string;
903
+ })[] | undefined;
904
+ parentToolCallId?: string | undefined;
905
+ rawInput?: unknown;
906
+ locations?: {
907
+ path: string;
908
+ line?: number | undefined;
909
+ }[] | undefined;
910
+ }>, z.ZodObject<{
911
+ sessionUpdate: z.ZodLiteral<"tool_call_update">;
912
+ toolCallId: z.ZodString;
913
+ parentToolCallId: z.ZodOptional<z.ZodString>;
914
+ status: z.ZodOptional<z.ZodEnum<["pending", "in_progress", "completed", "failed"]>>;
915
+ title: z.ZodOptional<z.ZodString>;
916
+ detail: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
917
+ type: z.ZodLiteral<"mcp">;
918
+ server: z.ZodString;
919
+ tool: z.ZodString;
920
+ }, "strip", z.ZodTypeAny, {
921
+ type: "mcp";
922
+ tool: string;
923
+ server: string;
924
+ }, {
925
+ type: "mcp";
926
+ tool: string;
927
+ server: string;
928
+ }>, z.ZodObject<{
929
+ type: z.ZodLiteral<"subagent">;
930
+ /** spawn starts a sub-agent (its work nests under this call); the rest talk to one. */
931
+ action: z.ZodDefault<z.ZodEnum<["spawn", "message", "wait", "stop", "resume", "list"]>>;
932
+ task: z.ZodOptional<z.ZodString>;
933
+ /** The sub-agent's role or type, e.g. "Explore". */
934
+ agentType: z.ZodOptional<z.ZodString>;
935
+ model: z.ZodOptional<z.ZodString>;
936
+ }, "strip", z.ZodTypeAny, {
937
+ type: "subagent";
938
+ action: "message" | "spawn" | "wait" | "stop" | "resume" | "list";
939
+ model?: string | undefined;
940
+ task?: string | undefined;
941
+ agentType?: string | undefined;
942
+ }, {
943
+ type: "subagent";
944
+ model?: string | undefined;
945
+ action?: "message" | "spawn" | "wait" | "stop" | "resume" | "list" | undefined;
946
+ task?: string | undefined;
947
+ agentType?: string | undefined;
948
+ }>, z.ZodObject<{
949
+ type: z.ZodLiteral<"skill">;
950
+ name: z.ZodString;
951
+ description: z.ZodOptional<z.ZodString>;
952
+ }, "strip", z.ZodTypeAny, {
953
+ type: "skill";
954
+ name: string;
955
+ description?: string | undefined;
956
+ }, {
957
+ type: "skill";
958
+ name: string;
959
+ description?: string | undefined;
960
+ }>, z.ZodObject<{
961
+ type: z.ZodLiteral<"web_search">;
962
+ query: z.ZodOptional<z.ZodString>;
963
+ }, "strip", z.ZodTypeAny, {
964
+ type: "web_search";
965
+ query?: string | undefined;
966
+ }, {
967
+ type: "web_search";
968
+ query?: string | undefined;
969
+ }>, z.ZodObject<{
970
+ type: z.ZodLiteral<"image_generation">;
971
+ prompt: z.ZodOptional<z.ZodString>;
972
+ }, "strip", z.ZodTypeAny, {
973
+ type: "image_generation";
974
+ prompt?: string | undefined;
975
+ }, {
976
+ type: "image_generation";
977
+ prompt?: string | undefined;
978
+ }>, z.ZodObject<{
979
+ type: z.ZodLiteral<"compaction">;
980
+ }, "strip", z.ZodTypeAny, {
981
+ type: "compaction";
982
+ }, {
983
+ type: "compaction";
984
+ }>, z.ZodObject<{
985
+ type: z.ZodLiteral<"review">;
986
+ phase: z.ZodEnum<["started", "finished"]>;
987
+ }, "strip", z.ZodTypeAny, {
988
+ type: "review";
989
+ phase: "started" | "finished";
990
+ }, {
991
+ type: "review";
992
+ phase: "started" | "finished";
993
+ }>]>>;
994
+ /** Replaces the tool call's content when present. */
995
+ content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
996
+ type: z.ZodLiteral<"content">;
997
+ content: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
998
+ type: z.ZodLiteral<"text">;
999
+ text: z.ZodString;
1000
+ }, "strip", z.ZodTypeAny, {
1001
+ type: "text";
1002
+ text: string;
1003
+ }, {
1004
+ type: "text";
1005
+ text: string;
1006
+ }>, z.ZodObject<{
1007
+ type: z.ZodLiteral<"image">;
1008
+ mimeType: z.ZodString;
1009
+ data: z.ZodOptional<z.ZodString>;
1010
+ uri: z.ZodOptional<z.ZodString>;
1011
+ }, "strip", z.ZodTypeAny, {
1012
+ type: "image";
1013
+ mimeType: string;
1014
+ data?: string | undefined;
1015
+ uri?: string | undefined;
1016
+ }, {
1017
+ type: "image";
1018
+ mimeType: string;
1019
+ data?: string | undefined;
1020
+ uri?: string | undefined;
1021
+ }>, z.ZodObject<{
1022
+ type: z.ZodLiteral<"resource_link">;
1023
+ uri: z.ZodString;
1024
+ name: z.ZodString;
1025
+ /** What the link names: a file (default), a skill the user invoked, or another agent. */
1026
+ kind: z.ZodOptional<z.ZodEnum<["file", "skill", "agent"]>>;
1027
+ }, "strip", z.ZodTypeAny, {
1028
+ type: "resource_link";
1029
+ name: string;
1030
+ uri: string;
1031
+ kind?: "agent" | "file" | "skill" | undefined;
1032
+ }, {
1033
+ type: "resource_link";
1034
+ name: string;
1035
+ uri: string;
1036
+ kind?: "agent" | "file" | "skill" | undefined;
1037
+ }>]>;
1038
+ }, "strip", z.ZodTypeAny, {
1039
+ type: "content";
1040
+ content: {
1041
+ type: "text";
1042
+ text: string;
1043
+ } | {
1044
+ type: "image";
1045
+ mimeType: string;
1046
+ data?: string | undefined;
1047
+ uri?: string | undefined;
1048
+ } | {
1049
+ type: "resource_link";
1050
+ name: string;
1051
+ uri: string;
1052
+ kind?: "agent" | "file" | "skill" | undefined;
1053
+ };
1054
+ }, {
1055
+ type: "content";
1056
+ content: {
1057
+ type: "text";
1058
+ text: string;
1059
+ } | {
1060
+ type: "image";
1061
+ mimeType: string;
1062
+ data?: string | undefined;
1063
+ uri?: string | undefined;
1064
+ } | {
1065
+ type: "resource_link";
1066
+ name: string;
1067
+ uri: string;
1068
+ kind?: "agent" | "file" | "skill" | undefined;
1069
+ };
1070
+ }>, z.ZodObject<{
1071
+ type: z.ZodLiteral<"diff">;
1072
+ path: z.ZodString;
1073
+ oldText: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1074
+ newText: z.ZodString;
1075
+ }, "strip", z.ZodTypeAny, {
1076
+ path: string;
1077
+ type: "diff";
1078
+ newText: string;
1079
+ oldText?: string | null | undefined;
1080
+ }, {
1081
+ path: string;
1082
+ type: "diff";
1083
+ newText: string;
1084
+ oldText?: string | null | undefined;
1085
+ }>, z.ZodObject<{
1086
+ type: z.ZodLiteral<"patch">;
1087
+ path: z.ZodString;
1088
+ change: z.ZodEnum<["add", "delete", "update"]>;
1089
+ movePath: z.ZodOptional<z.ZodString>;
1090
+ diff: z.ZodString;
1091
+ }, "strip", z.ZodTypeAny, {
1092
+ path: string;
1093
+ type: "patch";
1094
+ diff: string;
1095
+ change: "delete" | "add" | "update";
1096
+ movePath?: string | undefined;
1097
+ }, {
1098
+ path: string;
1099
+ type: "patch";
1100
+ diff: string;
1101
+ change: "delete" | "add" | "update";
1102
+ movePath?: string | undefined;
1103
+ }>, z.ZodObject<{
1104
+ type: z.ZodLiteral<"terminal">;
1105
+ terminalId: z.ZodString;
1106
+ }, "strip", z.ZodTypeAny, {
1107
+ type: "terminal";
1108
+ terminalId: string;
1109
+ }, {
1110
+ type: "terminal";
1111
+ terminalId: string;
1112
+ }>]>, "many">>;
1113
+ /** Streamed output appended to the tool call's running output. */
1114
+ appendOutput: z.ZodOptional<z.ZodString>;
1115
+ rawOutput: z.ZodOptional<z.ZodUnknown>;
1116
+ }, "strip", z.ZodTypeAny, {
1117
+ toolCallId: string;
1118
+ sessionUpdate: "tool_call_update";
1119
+ status?: "pending" | "in_progress" | "completed" | "failed" | undefined;
1120
+ title?: string | undefined;
1121
+ detail?: {
1122
+ type: "mcp";
1123
+ tool: string;
1124
+ server: string;
1125
+ } | {
1126
+ type: "subagent";
1127
+ action: "message" | "spawn" | "wait" | "stop" | "resume" | "list";
1128
+ model?: string | undefined;
1129
+ task?: string | undefined;
1130
+ agentType?: string | undefined;
1131
+ } | {
1132
+ type: "skill";
1133
+ name: string;
1134
+ description?: string | undefined;
1135
+ } | {
1136
+ type: "web_search";
1137
+ query?: string | undefined;
1138
+ } | {
1139
+ type: "image_generation";
1140
+ prompt?: string | undefined;
1141
+ } | {
1142
+ type: "compaction";
1143
+ } | {
1144
+ type: "review";
1145
+ phase: "started" | "finished";
1146
+ } | undefined;
1147
+ content?: ({
1148
+ type: "content";
1149
+ content: {
1150
+ type: "text";
1151
+ text: string;
1152
+ } | {
1153
+ type: "image";
1154
+ mimeType: string;
1155
+ data?: string | undefined;
1156
+ uri?: string | undefined;
1157
+ } | {
1158
+ type: "resource_link";
1159
+ name: string;
1160
+ uri: string;
1161
+ kind?: "agent" | "file" | "skill" | undefined;
1162
+ };
1163
+ } | {
1164
+ path: string;
1165
+ type: "diff";
1166
+ newText: string;
1167
+ oldText?: string | null | undefined;
1168
+ } | {
1169
+ path: string;
1170
+ type: "patch";
1171
+ diff: string;
1172
+ change: "delete" | "add" | "update";
1173
+ movePath?: string | undefined;
1174
+ } | {
1175
+ type: "terminal";
1176
+ terminalId: string;
1177
+ })[] | undefined;
1178
+ parentToolCallId?: string | undefined;
1179
+ appendOutput?: string | undefined;
1180
+ rawOutput?: unknown;
1181
+ }, {
1182
+ toolCallId: string;
1183
+ sessionUpdate: "tool_call_update";
1184
+ status?: "pending" | "in_progress" | "completed" | "failed" | undefined;
1185
+ title?: string | undefined;
1186
+ detail?: {
1187
+ type: "mcp";
1188
+ tool: string;
1189
+ server: string;
1190
+ } | {
1191
+ type: "subagent";
1192
+ model?: string | undefined;
1193
+ action?: "message" | "spawn" | "wait" | "stop" | "resume" | "list" | undefined;
1194
+ task?: string | undefined;
1195
+ agentType?: string | undefined;
1196
+ } | {
1197
+ type: "skill";
1198
+ name: string;
1199
+ description?: string | undefined;
1200
+ } | {
1201
+ type: "web_search";
1202
+ query?: string | undefined;
1203
+ } | {
1204
+ type: "image_generation";
1205
+ prompt?: string | undefined;
1206
+ } | {
1207
+ type: "compaction";
1208
+ } | {
1209
+ type: "review";
1210
+ phase: "started" | "finished";
1211
+ } | undefined;
1212
+ content?: ({
1213
+ type: "content";
1214
+ content: {
1215
+ type: "text";
1216
+ text: string;
1217
+ } | {
1218
+ type: "image";
1219
+ mimeType: string;
1220
+ data?: string | undefined;
1221
+ uri?: string | undefined;
1222
+ } | {
1223
+ type: "resource_link";
1224
+ name: string;
1225
+ uri: string;
1226
+ kind?: "agent" | "file" | "skill" | undefined;
1227
+ };
1228
+ } | {
1229
+ path: string;
1230
+ type: "diff";
1231
+ newText: string;
1232
+ oldText?: string | null | undefined;
1233
+ } | {
1234
+ path: string;
1235
+ type: "patch";
1236
+ diff: string;
1237
+ change: "delete" | "add" | "update";
1238
+ movePath?: string | undefined;
1239
+ } | {
1240
+ type: "terminal";
1241
+ terminalId: string;
1242
+ })[] | undefined;
1243
+ parentToolCallId?: string | undefined;
1244
+ appendOutput?: string | undefined;
1245
+ rawOutput?: unknown;
1246
+ }>, z.ZodObject<{
1247
+ sessionUpdate: z.ZodLiteral<"plan">;
1248
+ entries: z.ZodArray<z.ZodObject<{
1249
+ content: z.ZodString;
1250
+ priority: z.ZodDefault<z.ZodEnum<["high", "medium", "low"]>>;
1251
+ status: z.ZodEnum<["pending", "in_progress", "completed"]>;
1252
+ }, "strip", z.ZodTypeAny, {
1253
+ status: "pending" | "in_progress" | "completed";
1254
+ content: string;
1255
+ priority: "high" | "medium" | "low";
1256
+ }, {
1257
+ status: "pending" | "in_progress" | "completed";
1258
+ content: string;
1259
+ priority?: "high" | "medium" | "low" | undefined;
1260
+ }>, "many">;
1261
+ }, "strip", z.ZodTypeAny, {
1262
+ entries: {
1263
+ status: "pending" | "in_progress" | "completed";
1264
+ content: string;
1265
+ priority: "high" | "medium" | "low";
1266
+ }[];
1267
+ sessionUpdate: "plan";
1268
+ }, {
1269
+ entries: {
1270
+ status: "pending" | "in_progress" | "completed";
1271
+ content: string;
1272
+ priority?: "high" | "medium" | "low" | undefined;
1273
+ }[];
1274
+ sessionUpdate: "plan";
1275
+ }>, z.ZodObject<{
1276
+ sessionUpdate: z.ZodLiteral<"available_commands_update">;
1277
+ availableCommands: z.ZodArray<z.ZodObject<{
1278
+ name: z.ZodString;
1279
+ description: z.ZodString;
1280
+ hint: z.ZodOptional<z.ZodString>;
1281
+ }, "strip", z.ZodTypeAny, {
1282
+ name: string;
1283
+ description: string;
1284
+ hint?: string | undefined;
1285
+ }, {
1286
+ name: string;
1287
+ description: string;
1288
+ hint?: string | undefined;
1289
+ }>, "many">;
1290
+ }, "strip", z.ZodTypeAny, {
1291
+ sessionUpdate: "available_commands_update";
1292
+ availableCommands: {
1293
+ name: string;
1294
+ description: string;
1295
+ hint?: string | undefined;
1296
+ }[];
1297
+ }, {
1298
+ sessionUpdate: "available_commands_update";
1299
+ availableCommands: {
1300
+ name: string;
1301
+ description: string;
1302
+ hint?: string | undefined;
1303
+ }[];
1304
+ }>, z.ZodObject<{
1305
+ sessionUpdate: z.ZodLiteral<"current_mode_update">;
1306
+ currentModeId: z.ZodString;
1307
+ }, "strip", z.ZodTypeAny, {
1308
+ sessionUpdate: "current_mode_update";
1309
+ currentModeId: string;
1310
+ }, {
1311
+ sessionUpdate: "current_mode_update";
1312
+ currentModeId: string;
1313
+ }>, z.ZodObject<{
1314
+ sessionUpdate: z.ZodLiteral<"session_info_update">;
1315
+ title: z.ZodOptional<z.ZodString>;
1316
+ model: z.ZodOptional<z.ZodString>;
1317
+ }, "strip", z.ZodTypeAny, {
1318
+ sessionUpdate: "session_info_update";
1319
+ title?: string | undefined;
1320
+ model?: string | undefined;
1321
+ }, {
1322
+ sessionUpdate: "session_info_update";
1323
+ title?: string | undefined;
1324
+ model?: string | undefined;
1325
+ }>, z.ZodObject<{
1326
+ sessionUpdate: z.ZodLiteral<"usage_update">;
1327
+ usedTokens: z.ZodOptional<z.ZodNumber>;
1328
+ contextWindow: z.ZodOptional<z.ZodNumber>;
1329
+ }, "strip", z.ZodTypeAny, {
1330
+ sessionUpdate: "usage_update";
1331
+ usedTokens?: number | undefined;
1332
+ contextWindow?: number | undefined;
1333
+ }, {
1334
+ sessionUpdate: "usage_update";
1335
+ usedTokens?: number | undefined;
1336
+ contextWindow?: number | undefined;
1337
+ }>, z.ZodObject<{
1338
+ sessionUpdate: z.ZodLiteral<"ls_message_done">;
1339
+ parentToolCallId: z.ZodOptional<z.ZodString>;
1340
+ messageId: z.ZodString;
1341
+ role: z.ZodEnum<["agent", "thought", "user"]>;
1342
+ }, "strip", z.ZodTypeAny, {
1343
+ sessionUpdate: "ls_message_done";
1344
+ messageId: string;
1345
+ role: "agent" | "thought" | "user";
1346
+ parentToolCallId?: string | undefined;
1347
+ }, {
1348
+ sessionUpdate: "ls_message_done";
1349
+ messageId: string;
1350
+ role: "agent" | "thought" | "user";
1351
+ parentToolCallId?: string | undefined;
1352
+ }>, z.ZodObject<{
1353
+ sessionUpdate: z.ZodLiteral<"ls_config">;
1354
+ options: z.ZodArray<z.ZodObject<{
1355
+ /** Agent-defined id; "model" and "mode" are the common ones. */
1356
+ id: z.ZodString;
1357
+ name: z.ZodString;
1358
+ category: z.ZodDefault<z.ZodEnum<["model", "mode", "effort", "other"]>>;
1359
+ current: z.ZodString;
1360
+ values: z.ZodArray<z.ZodObject<{
1361
+ value: z.ZodString;
1362
+ name: z.ZodString;
1363
+ description: z.ZodOptional<z.ZodString>;
1364
+ }, "strip", z.ZodTypeAny, {
1365
+ value: string;
1366
+ name: string;
1367
+ description?: string | undefined;
1368
+ }, {
1369
+ value: string;
1370
+ name: string;
1371
+ description?: string | undefined;
1372
+ }>, "many">;
1373
+ }, "strip", z.ZodTypeAny, {
1374
+ values: {
1375
+ value: string;
1376
+ name: string;
1377
+ description?: string | undefined;
1378
+ }[];
1379
+ id: string;
1380
+ name: string;
1381
+ category: "other" | "model" | "mode" | "effort";
1382
+ current: string;
1383
+ }, {
1384
+ values: {
1385
+ value: string;
1386
+ name: string;
1387
+ description?: string | undefined;
1388
+ }[];
1389
+ id: string;
1390
+ name: string;
1391
+ current: string;
1392
+ category?: "other" | "model" | "mode" | "effort" | undefined;
1393
+ }>, "many">;
1394
+ }, "strip", z.ZodTypeAny, {
1395
+ options: {
1396
+ values: {
1397
+ value: string;
1398
+ name: string;
1399
+ description?: string | undefined;
1400
+ }[];
1401
+ id: string;
1402
+ name: string;
1403
+ category: "other" | "model" | "mode" | "effort";
1404
+ current: string;
1405
+ }[];
1406
+ sessionUpdate: "ls_config";
1407
+ }, {
1408
+ options: {
1409
+ values: {
1410
+ value: string;
1411
+ name: string;
1412
+ description?: string | undefined;
1413
+ }[];
1414
+ id: string;
1415
+ name: string;
1416
+ current: string;
1417
+ category?: "other" | "model" | "mode" | "effort" | undefined;
1418
+ }[];
1419
+ sessionUpdate: "ls_config";
1420
+ }>, z.ZodObject<{
1421
+ sessionUpdate: z.ZodLiteral<"ls_notice">;
1422
+ level: z.ZodEnum<["info", "warning"]>;
1423
+ title: z.ZodString;
1424
+ detail: z.ZodOptional<z.ZodString>;
1425
+ }, "strip", z.ZodTypeAny, {
1426
+ title: string;
1427
+ sessionUpdate: "ls_notice";
1428
+ level: "info" | "warning";
1429
+ detail?: string | undefined;
1430
+ }, {
1431
+ title: string;
1432
+ sessionUpdate: "ls_notice";
1433
+ level: "info" | "warning";
1434
+ detail?: string | undefined;
1435
+ }>, z.ZodObject<{
1436
+ sessionUpdate: z.ZodLiteral<"ls_turn">;
1437
+ /** A sub-agent's turn: whether the sub-agent under this call is working. */
1438
+ parentToolCallId: z.ZodOptional<z.ZodString>;
1439
+ state: z.ZodEnum<["started", "ended"]>;
1440
+ turnId: z.ZodOptional<z.ZodString>;
1441
+ stopReason: z.ZodOptional<z.ZodEnum<["end_turn", "cancelled", "error", "max_tokens", "refusal"]>>;
1442
+ }, "strip", z.ZodTypeAny, {
1443
+ state: "started" | "ended";
1444
+ sessionUpdate: "ls_turn";
1445
+ parentToolCallId?: string | undefined;
1446
+ turnId?: string | undefined;
1447
+ stopReason?: "error" | "end_turn" | "cancelled" | "max_tokens" | "refusal" | undefined;
1448
+ }, {
1449
+ state: "started" | "ended";
1450
+ sessionUpdate: "ls_turn";
1451
+ parentToolCallId?: string | undefined;
1452
+ turnId?: string | undefined;
1453
+ stopReason?: "error" | "end_turn" | "cancelled" | "max_tokens" | "refusal" | undefined;
1454
+ }>, z.ZodObject<{
1455
+ sessionUpdate: z.ZodLiteral<"ls_permission">;
1456
+ requestId: z.ZodString;
1457
+ toolCallId: z.ZodOptional<z.ZodString>;
1458
+ title: z.ZodString;
1459
+ detail: z.ZodOptional<z.ZodString>;
1460
+ options: z.ZodArray<z.ZodObject<{
1461
+ optionId: z.ZodString;
1462
+ name: z.ZodString;
1463
+ kind: z.ZodEnum<["allow_once", "allow_always", "reject_once", "reject_always"]>;
1464
+ }, "strip", z.ZodTypeAny, {
1465
+ optionId: string;
1466
+ name: string;
1467
+ kind: "allow_once" | "allow_always" | "reject_once" | "reject_always";
1468
+ }, {
1469
+ optionId: string;
1470
+ name: string;
1471
+ kind: "allow_once" | "allow_always" | "reject_once" | "reject_always";
1472
+ }>, "many">;
1473
+ }, "strip", z.ZodTypeAny, {
1474
+ options: {
1475
+ optionId: string;
1476
+ name: string;
1477
+ kind: "allow_once" | "allow_always" | "reject_once" | "reject_always";
1478
+ }[];
1479
+ title: string;
1480
+ requestId: string;
1481
+ sessionUpdate: "ls_permission";
1482
+ toolCallId?: string | undefined;
1483
+ detail?: string | undefined;
1484
+ }, {
1485
+ options: {
1486
+ optionId: string;
1487
+ name: string;
1488
+ kind: "allow_once" | "allow_always" | "reject_once" | "reject_always";
1489
+ }[];
1490
+ title: string;
1491
+ requestId: string;
1492
+ sessionUpdate: "ls_permission";
1493
+ toolCallId?: string | undefined;
1494
+ detail?: string | undefined;
1495
+ }>, z.ZodObject<{
1496
+ sessionUpdate: z.ZodLiteral<"ls_permission_resolved">;
1497
+ requestId: z.ZodString;
1498
+ optionId: z.ZodOptional<z.ZodString>;
1499
+ }, "strip", z.ZodTypeAny, {
1500
+ requestId: string;
1501
+ sessionUpdate: "ls_permission_resolved";
1502
+ optionId?: string | undefined;
1503
+ }, {
1504
+ requestId: string;
1505
+ sessionUpdate: "ls_permission_resolved";
1506
+ optionId?: string | undefined;
1507
+ }>, z.ZodObject<{
1508
+ sessionUpdate: z.ZodLiteral<"ls_driver">;
1509
+ driver: z.ZodEnum<["desktop", "remote", "none"]>;
1510
+ deviceId: z.ZodOptional<z.ZodString>;
1511
+ }, "strip", z.ZodTypeAny, {
1512
+ driver: "remote" | "desktop" | "none";
1513
+ sessionUpdate: "ls_driver";
1514
+ deviceId?: string | undefined;
1515
+ }, {
1516
+ driver: "remote" | "desktop" | "none";
1517
+ sessionUpdate: "ls_driver";
1518
+ deviceId?: string | undefined;
1519
+ }>, z.ZodObject<{
1520
+ sessionUpdate: z.ZodLiteral<"ls_status">;
1521
+ state: z.ZodEnum<["idle", "running", "waiting", "error", "offline"]>;
1522
+ }, "strip", z.ZodTypeAny, {
1523
+ state: "idle" | "running" | "waiting" | "error" | "offline";
1524
+ sessionUpdate: "ls_status";
1525
+ }, {
1526
+ state: "idle" | "running" | "waiting" | "error" | "offline";
1527
+ sessionUpdate: "ls_status";
1528
+ }>, z.ZodObject<{
1529
+ sessionUpdate: z.ZodLiteral<"ls_error">;
1530
+ code: z.ZodString;
1531
+ message: z.ZodString;
1532
+ hint: z.ZodOptional<z.ZodString>;
1533
+ }, "strip", z.ZodTypeAny, {
1534
+ code: string;
1535
+ message: string;
1536
+ sessionUpdate: "ls_error";
1537
+ hint?: string | undefined;
1538
+ }, {
1539
+ code: string;
1540
+ message: string;
1541
+ sessionUpdate: "ls_error";
1542
+ hint?: string | undefined;
1543
+ }>]>;
1544
+ export type SessionUpdate = z.infer<typeof sessionUpdateSchema>;
1545
+ export type SessionUpdateKind = SessionUpdate["sessionUpdate"];
1546
+ /** One entry in a session's append-only event log. */
1547
+ export declare const sessionEventSchema: z.ZodObject<{
1548
+ sessionId: z.ZodString;
1549
+ seq: z.ZodNumber;
1550
+ ts: z.ZodNumber;
1551
+ update: z.ZodDiscriminatedUnion<"sessionUpdate", [z.ZodObject<{
1552
+ sessionUpdate: z.ZodLiteral<"user_message_chunk">;
1553
+ messageId: z.ZodOptional<z.ZodString>;
1554
+ content: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1555
+ type: z.ZodLiteral<"text">;
1556
+ text: z.ZodString;
1557
+ }, "strip", z.ZodTypeAny, {
1558
+ type: "text";
1559
+ text: string;
1560
+ }, {
1561
+ type: "text";
1562
+ text: string;
1563
+ }>, z.ZodObject<{
1564
+ type: z.ZodLiteral<"image">;
1565
+ mimeType: z.ZodString;
1566
+ data: z.ZodOptional<z.ZodString>;
1567
+ uri: z.ZodOptional<z.ZodString>;
1568
+ }, "strip", z.ZodTypeAny, {
1569
+ type: "image";
1570
+ mimeType: string;
1571
+ data?: string | undefined;
1572
+ uri?: string | undefined;
1573
+ }, {
1574
+ type: "image";
1575
+ mimeType: string;
1576
+ data?: string | undefined;
1577
+ uri?: string | undefined;
1578
+ }>, z.ZodObject<{
1579
+ type: z.ZodLiteral<"resource_link">;
1580
+ uri: z.ZodString;
1581
+ name: z.ZodString;
1582
+ /** What the link names: a file (default), a skill the user invoked, or another agent. */
1583
+ kind: z.ZodOptional<z.ZodEnum<["file", "skill", "agent"]>>;
1584
+ }, "strip", z.ZodTypeAny, {
1585
+ type: "resource_link";
1586
+ name: string;
1587
+ uri: string;
1588
+ kind?: "agent" | "file" | "skill" | undefined;
1589
+ }, {
1590
+ type: "resource_link";
1591
+ name: string;
1592
+ uri: string;
1593
+ kind?: "agent" | "file" | "skill" | undefined;
1594
+ }>]>;
1595
+ }, "strip", z.ZodTypeAny, {
1596
+ content: {
1597
+ type: "text";
1598
+ text: string;
1599
+ } | {
1600
+ type: "image";
1601
+ mimeType: string;
1602
+ data?: string | undefined;
1603
+ uri?: string | undefined;
1604
+ } | {
1605
+ type: "resource_link";
1606
+ name: string;
1607
+ uri: string;
1608
+ kind?: "agent" | "file" | "skill" | undefined;
1609
+ };
1610
+ sessionUpdate: "user_message_chunk";
1611
+ messageId?: string | undefined;
1612
+ }, {
1613
+ content: {
1614
+ type: "text";
1615
+ text: string;
1616
+ } | {
1617
+ type: "image";
1618
+ mimeType: string;
1619
+ data?: string | undefined;
1620
+ uri?: string | undefined;
1621
+ } | {
1622
+ type: "resource_link";
1623
+ name: string;
1624
+ uri: string;
1625
+ kind?: "agent" | "file" | "skill" | undefined;
1626
+ };
1627
+ sessionUpdate: "user_message_chunk";
1628
+ messageId?: string | undefined;
1629
+ }>, z.ZodObject<{
1630
+ sessionUpdate: z.ZodLiteral<"agent_message_chunk">;
1631
+ parentToolCallId: z.ZodOptional<z.ZodString>;
1632
+ messageId: z.ZodString;
1633
+ content: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1634
+ type: z.ZodLiteral<"text">;
1635
+ text: z.ZodString;
1636
+ }, "strip", z.ZodTypeAny, {
1637
+ type: "text";
1638
+ text: string;
1639
+ }, {
1640
+ type: "text";
1641
+ text: string;
1642
+ }>, z.ZodObject<{
1643
+ type: z.ZodLiteral<"image">;
1644
+ mimeType: z.ZodString;
1645
+ data: z.ZodOptional<z.ZodString>;
1646
+ uri: z.ZodOptional<z.ZodString>;
1647
+ }, "strip", z.ZodTypeAny, {
1648
+ type: "image";
1649
+ mimeType: string;
1650
+ data?: string | undefined;
1651
+ uri?: string | undefined;
1652
+ }, {
1653
+ type: "image";
1654
+ mimeType: string;
1655
+ data?: string | undefined;
1656
+ uri?: string | undefined;
1657
+ }>, z.ZodObject<{
1658
+ type: z.ZodLiteral<"resource_link">;
1659
+ uri: z.ZodString;
1660
+ name: z.ZodString;
1661
+ /** What the link names: a file (default), a skill the user invoked, or another agent. */
1662
+ kind: z.ZodOptional<z.ZodEnum<["file", "skill", "agent"]>>;
1663
+ }, "strip", z.ZodTypeAny, {
1664
+ type: "resource_link";
1665
+ name: string;
1666
+ uri: string;
1667
+ kind?: "agent" | "file" | "skill" | undefined;
1668
+ }, {
1669
+ type: "resource_link";
1670
+ name: string;
1671
+ uri: string;
1672
+ kind?: "agent" | "file" | "skill" | undefined;
1673
+ }>]>;
1674
+ }, "strip", z.ZodTypeAny, {
1675
+ content: {
1676
+ type: "text";
1677
+ text: string;
1678
+ } | {
1679
+ type: "image";
1680
+ mimeType: string;
1681
+ data?: string | undefined;
1682
+ uri?: string | undefined;
1683
+ } | {
1684
+ type: "resource_link";
1685
+ name: string;
1686
+ uri: string;
1687
+ kind?: "agent" | "file" | "skill" | undefined;
1688
+ };
1689
+ sessionUpdate: "agent_message_chunk";
1690
+ messageId: string;
1691
+ parentToolCallId?: string | undefined;
1692
+ }, {
1693
+ content: {
1694
+ type: "text";
1695
+ text: string;
1696
+ } | {
1697
+ type: "image";
1698
+ mimeType: string;
1699
+ data?: string | undefined;
1700
+ uri?: string | undefined;
1701
+ } | {
1702
+ type: "resource_link";
1703
+ name: string;
1704
+ uri: string;
1705
+ kind?: "agent" | "file" | "skill" | undefined;
1706
+ };
1707
+ sessionUpdate: "agent_message_chunk";
1708
+ messageId: string;
1709
+ parentToolCallId?: string | undefined;
1710
+ }>, z.ZodObject<{
1711
+ sessionUpdate: z.ZodLiteral<"agent_thought_chunk">;
1712
+ parentToolCallId: z.ZodOptional<z.ZodString>;
1713
+ messageId: z.ZodString;
1714
+ content: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1715
+ type: z.ZodLiteral<"text">;
1716
+ text: z.ZodString;
1717
+ }, "strip", z.ZodTypeAny, {
1718
+ type: "text";
1719
+ text: string;
1720
+ }, {
1721
+ type: "text";
1722
+ text: string;
1723
+ }>, z.ZodObject<{
1724
+ type: z.ZodLiteral<"image">;
1725
+ mimeType: z.ZodString;
1726
+ data: z.ZodOptional<z.ZodString>;
1727
+ uri: z.ZodOptional<z.ZodString>;
1728
+ }, "strip", z.ZodTypeAny, {
1729
+ type: "image";
1730
+ mimeType: string;
1731
+ data?: string | undefined;
1732
+ uri?: string | undefined;
1733
+ }, {
1734
+ type: "image";
1735
+ mimeType: string;
1736
+ data?: string | undefined;
1737
+ uri?: string | undefined;
1738
+ }>, z.ZodObject<{
1739
+ type: z.ZodLiteral<"resource_link">;
1740
+ uri: z.ZodString;
1741
+ name: z.ZodString;
1742
+ /** What the link names: a file (default), a skill the user invoked, or another agent. */
1743
+ kind: z.ZodOptional<z.ZodEnum<["file", "skill", "agent"]>>;
1744
+ }, "strip", z.ZodTypeAny, {
1745
+ type: "resource_link";
1746
+ name: string;
1747
+ uri: string;
1748
+ kind?: "agent" | "file" | "skill" | undefined;
1749
+ }, {
1750
+ type: "resource_link";
1751
+ name: string;
1752
+ uri: string;
1753
+ kind?: "agent" | "file" | "skill" | undefined;
1754
+ }>]>;
1755
+ }, "strip", z.ZodTypeAny, {
1756
+ content: {
1757
+ type: "text";
1758
+ text: string;
1759
+ } | {
1760
+ type: "image";
1761
+ mimeType: string;
1762
+ data?: string | undefined;
1763
+ uri?: string | undefined;
1764
+ } | {
1765
+ type: "resource_link";
1766
+ name: string;
1767
+ uri: string;
1768
+ kind?: "agent" | "file" | "skill" | undefined;
1769
+ };
1770
+ sessionUpdate: "agent_thought_chunk";
1771
+ messageId: string;
1772
+ parentToolCallId?: string | undefined;
1773
+ }, {
1774
+ content: {
1775
+ type: "text";
1776
+ text: string;
1777
+ } | {
1778
+ type: "image";
1779
+ mimeType: string;
1780
+ data?: string | undefined;
1781
+ uri?: string | undefined;
1782
+ } | {
1783
+ type: "resource_link";
1784
+ name: string;
1785
+ uri: string;
1786
+ kind?: "agent" | "file" | "skill" | undefined;
1787
+ };
1788
+ sessionUpdate: "agent_thought_chunk";
1789
+ messageId: string;
1790
+ parentToolCallId?: string | undefined;
1791
+ }>, z.ZodObject<{
1792
+ sessionUpdate: z.ZodLiteral<"tool_call">;
1793
+ toolCallId: z.ZodString;
1794
+ /** Set when a sub-agent made this call: the sub-agent's own (spawn) tool call. */
1795
+ parentToolCallId: z.ZodOptional<z.ZodString>;
1796
+ title: z.ZodString;
1797
+ kind: z.ZodEnum<["read", "edit", "delete", "move", "search", "execute", "think", "fetch", "other"]>;
1798
+ status: z.ZodEnum<["pending", "in_progress", "completed", "failed"]>;
1799
+ rawInput: z.ZodOptional<z.ZodUnknown>;
1800
+ content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1801
+ type: z.ZodLiteral<"content">;
1802
+ content: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1803
+ type: z.ZodLiteral<"text">;
1804
+ text: z.ZodString;
1805
+ }, "strip", z.ZodTypeAny, {
1806
+ type: "text";
1807
+ text: string;
1808
+ }, {
1809
+ type: "text";
1810
+ text: string;
1811
+ }>, z.ZodObject<{
1812
+ type: z.ZodLiteral<"image">;
1813
+ mimeType: z.ZodString;
1814
+ data: z.ZodOptional<z.ZodString>;
1815
+ uri: z.ZodOptional<z.ZodString>;
1816
+ }, "strip", z.ZodTypeAny, {
1817
+ type: "image";
1818
+ mimeType: string;
1819
+ data?: string | undefined;
1820
+ uri?: string | undefined;
1821
+ }, {
1822
+ type: "image";
1823
+ mimeType: string;
1824
+ data?: string | undefined;
1825
+ uri?: string | undefined;
1826
+ }>, z.ZodObject<{
1827
+ type: z.ZodLiteral<"resource_link">;
1828
+ uri: z.ZodString;
1829
+ name: z.ZodString;
1830
+ /** What the link names: a file (default), a skill the user invoked, or another agent. */
1831
+ kind: z.ZodOptional<z.ZodEnum<["file", "skill", "agent"]>>;
1832
+ }, "strip", z.ZodTypeAny, {
1833
+ type: "resource_link";
1834
+ name: string;
1835
+ uri: string;
1836
+ kind?: "agent" | "file" | "skill" | undefined;
1837
+ }, {
1838
+ type: "resource_link";
1839
+ name: string;
1840
+ uri: string;
1841
+ kind?: "agent" | "file" | "skill" | undefined;
1842
+ }>]>;
1843
+ }, "strip", z.ZodTypeAny, {
1844
+ type: "content";
1845
+ content: {
1846
+ type: "text";
1847
+ text: string;
1848
+ } | {
1849
+ type: "image";
1850
+ mimeType: string;
1851
+ data?: string | undefined;
1852
+ uri?: string | undefined;
1853
+ } | {
1854
+ type: "resource_link";
1855
+ name: string;
1856
+ uri: string;
1857
+ kind?: "agent" | "file" | "skill" | undefined;
1858
+ };
1859
+ }, {
1860
+ type: "content";
1861
+ content: {
1862
+ type: "text";
1863
+ text: string;
1864
+ } | {
1865
+ type: "image";
1866
+ mimeType: string;
1867
+ data?: string | undefined;
1868
+ uri?: string | undefined;
1869
+ } | {
1870
+ type: "resource_link";
1871
+ name: string;
1872
+ uri: string;
1873
+ kind?: "agent" | "file" | "skill" | undefined;
1874
+ };
1875
+ }>, z.ZodObject<{
1876
+ type: z.ZodLiteral<"diff">;
1877
+ path: z.ZodString;
1878
+ oldText: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1879
+ newText: z.ZodString;
1880
+ }, "strip", z.ZodTypeAny, {
1881
+ path: string;
1882
+ type: "diff";
1883
+ newText: string;
1884
+ oldText?: string | null | undefined;
1885
+ }, {
1886
+ path: string;
1887
+ type: "diff";
1888
+ newText: string;
1889
+ oldText?: string | null | undefined;
1890
+ }>, z.ZodObject<{
1891
+ type: z.ZodLiteral<"patch">;
1892
+ path: z.ZodString;
1893
+ change: z.ZodEnum<["add", "delete", "update"]>;
1894
+ movePath: z.ZodOptional<z.ZodString>;
1895
+ diff: z.ZodString;
1896
+ }, "strip", z.ZodTypeAny, {
1897
+ path: string;
1898
+ type: "patch";
1899
+ diff: string;
1900
+ change: "delete" | "add" | "update";
1901
+ movePath?: string | undefined;
1902
+ }, {
1903
+ path: string;
1904
+ type: "patch";
1905
+ diff: string;
1906
+ change: "delete" | "add" | "update";
1907
+ movePath?: string | undefined;
1908
+ }>, z.ZodObject<{
1909
+ type: z.ZodLiteral<"terminal">;
1910
+ terminalId: z.ZodString;
1911
+ }, "strip", z.ZodTypeAny, {
1912
+ type: "terminal";
1913
+ terminalId: string;
1914
+ }, {
1915
+ type: "terminal";
1916
+ terminalId: string;
1917
+ }>]>, "many">>;
1918
+ locations: z.ZodOptional<z.ZodArray<z.ZodObject<{
1919
+ path: z.ZodString;
1920
+ line: z.ZodOptional<z.ZodNumber>;
1921
+ }, "strip", z.ZodTypeAny, {
1922
+ path: string;
1923
+ line?: number | undefined;
1924
+ }, {
1925
+ path: string;
1926
+ line?: number | undefined;
1927
+ }>, "many">>;
1928
+ detail: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1929
+ type: z.ZodLiteral<"mcp">;
1930
+ server: z.ZodString;
1931
+ tool: z.ZodString;
1932
+ }, "strip", z.ZodTypeAny, {
1933
+ type: "mcp";
1934
+ tool: string;
1935
+ server: string;
1936
+ }, {
1937
+ type: "mcp";
1938
+ tool: string;
1939
+ server: string;
1940
+ }>, z.ZodObject<{
1941
+ type: z.ZodLiteral<"subagent">;
1942
+ /** spawn starts a sub-agent (its work nests under this call); the rest talk to one. */
1943
+ action: z.ZodDefault<z.ZodEnum<["spawn", "message", "wait", "stop", "resume", "list"]>>;
1944
+ task: z.ZodOptional<z.ZodString>;
1945
+ /** The sub-agent's role or type, e.g. "Explore". */
1946
+ agentType: z.ZodOptional<z.ZodString>;
1947
+ model: z.ZodOptional<z.ZodString>;
1948
+ }, "strip", z.ZodTypeAny, {
1949
+ type: "subagent";
1950
+ action: "message" | "spawn" | "wait" | "stop" | "resume" | "list";
1951
+ model?: string | undefined;
1952
+ task?: string | undefined;
1953
+ agentType?: string | undefined;
1954
+ }, {
1955
+ type: "subagent";
1956
+ model?: string | undefined;
1957
+ action?: "message" | "spawn" | "wait" | "stop" | "resume" | "list" | undefined;
1958
+ task?: string | undefined;
1959
+ agentType?: string | undefined;
1960
+ }>, z.ZodObject<{
1961
+ type: z.ZodLiteral<"skill">;
1962
+ name: z.ZodString;
1963
+ description: z.ZodOptional<z.ZodString>;
1964
+ }, "strip", z.ZodTypeAny, {
1965
+ type: "skill";
1966
+ name: string;
1967
+ description?: string | undefined;
1968
+ }, {
1969
+ type: "skill";
1970
+ name: string;
1971
+ description?: string | undefined;
1972
+ }>, z.ZodObject<{
1973
+ type: z.ZodLiteral<"web_search">;
1974
+ query: z.ZodOptional<z.ZodString>;
1975
+ }, "strip", z.ZodTypeAny, {
1976
+ type: "web_search";
1977
+ query?: string | undefined;
1978
+ }, {
1979
+ type: "web_search";
1980
+ query?: string | undefined;
1981
+ }>, z.ZodObject<{
1982
+ type: z.ZodLiteral<"image_generation">;
1983
+ prompt: z.ZodOptional<z.ZodString>;
1984
+ }, "strip", z.ZodTypeAny, {
1985
+ type: "image_generation";
1986
+ prompt?: string | undefined;
1987
+ }, {
1988
+ type: "image_generation";
1989
+ prompt?: string | undefined;
1990
+ }>, z.ZodObject<{
1991
+ type: z.ZodLiteral<"compaction">;
1992
+ }, "strip", z.ZodTypeAny, {
1993
+ type: "compaction";
1994
+ }, {
1995
+ type: "compaction";
1996
+ }>, z.ZodObject<{
1997
+ type: z.ZodLiteral<"review">;
1998
+ phase: z.ZodEnum<["started", "finished"]>;
1999
+ }, "strip", z.ZodTypeAny, {
2000
+ type: "review";
2001
+ phase: "started" | "finished";
2002
+ }, {
2003
+ type: "review";
2004
+ phase: "started" | "finished";
2005
+ }>]>>;
2006
+ }, "strip", z.ZodTypeAny, {
2007
+ status: "pending" | "in_progress" | "completed" | "failed";
2008
+ kind: "read" | "edit" | "delete" | "move" | "search" | "execute" | "think" | "fetch" | "other";
2009
+ title: string;
2010
+ toolCallId: string;
2011
+ sessionUpdate: "tool_call";
2012
+ detail?: {
2013
+ type: "mcp";
2014
+ tool: string;
2015
+ server: string;
2016
+ } | {
2017
+ type: "subagent";
2018
+ action: "message" | "spawn" | "wait" | "stop" | "resume" | "list";
2019
+ model?: string | undefined;
2020
+ task?: string | undefined;
2021
+ agentType?: string | undefined;
2022
+ } | {
2023
+ type: "skill";
2024
+ name: string;
2025
+ description?: string | undefined;
2026
+ } | {
2027
+ type: "web_search";
2028
+ query?: string | undefined;
2029
+ } | {
2030
+ type: "image_generation";
2031
+ prompt?: string | undefined;
2032
+ } | {
2033
+ type: "compaction";
2034
+ } | {
2035
+ type: "review";
2036
+ phase: "started" | "finished";
2037
+ } | undefined;
2038
+ content?: ({
2039
+ type: "content";
2040
+ content: {
2041
+ type: "text";
2042
+ text: string;
2043
+ } | {
2044
+ type: "image";
2045
+ mimeType: string;
2046
+ data?: string | undefined;
2047
+ uri?: string | undefined;
2048
+ } | {
2049
+ type: "resource_link";
2050
+ name: string;
2051
+ uri: string;
2052
+ kind?: "agent" | "file" | "skill" | undefined;
2053
+ };
2054
+ } | {
2055
+ path: string;
2056
+ type: "diff";
2057
+ newText: string;
2058
+ oldText?: string | null | undefined;
2059
+ } | {
2060
+ path: string;
2061
+ type: "patch";
2062
+ diff: string;
2063
+ change: "delete" | "add" | "update";
2064
+ movePath?: string | undefined;
2065
+ } | {
2066
+ type: "terminal";
2067
+ terminalId: string;
2068
+ })[] | undefined;
2069
+ parentToolCallId?: string | undefined;
2070
+ rawInput?: unknown;
2071
+ locations?: {
2072
+ path: string;
2073
+ line?: number | undefined;
2074
+ }[] | undefined;
2075
+ }, {
2076
+ status: "pending" | "in_progress" | "completed" | "failed";
2077
+ kind: "read" | "edit" | "delete" | "move" | "search" | "execute" | "think" | "fetch" | "other";
2078
+ title: string;
2079
+ toolCallId: string;
2080
+ sessionUpdate: "tool_call";
2081
+ detail?: {
2082
+ type: "mcp";
2083
+ tool: string;
2084
+ server: string;
2085
+ } | {
2086
+ type: "subagent";
2087
+ model?: string | undefined;
2088
+ action?: "message" | "spawn" | "wait" | "stop" | "resume" | "list" | undefined;
2089
+ task?: string | undefined;
2090
+ agentType?: string | undefined;
2091
+ } | {
2092
+ type: "skill";
2093
+ name: string;
2094
+ description?: string | undefined;
2095
+ } | {
2096
+ type: "web_search";
2097
+ query?: string | undefined;
2098
+ } | {
2099
+ type: "image_generation";
2100
+ prompt?: string | undefined;
2101
+ } | {
2102
+ type: "compaction";
2103
+ } | {
2104
+ type: "review";
2105
+ phase: "started" | "finished";
2106
+ } | undefined;
2107
+ content?: ({
2108
+ type: "content";
2109
+ content: {
2110
+ type: "text";
2111
+ text: string;
2112
+ } | {
2113
+ type: "image";
2114
+ mimeType: string;
2115
+ data?: string | undefined;
2116
+ uri?: string | undefined;
2117
+ } | {
2118
+ type: "resource_link";
2119
+ name: string;
2120
+ uri: string;
2121
+ kind?: "agent" | "file" | "skill" | undefined;
2122
+ };
2123
+ } | {
2124
+ path: string;
2125
+ type: "diff";
2126
+ newText: string;
2127
+ oldText?: string | null | undefined;
2128
+ } | {
2129
+ path: string;
2130
+ type: "patch";
2131
+ diff: string;
2132
+ change: "delete" | "add" | "update";
2133
+ movePath?: string | undefined;
2134
+ } | {
2135
+ type: "terminal";
2136
+ terminalId: string;
2137
+ })[] | undefined;
2138
+ parentToolCallId?: string | undefined;
2139
+ rawInput?: unknown;
2140
+ locations?: {
2141
+ path: string;
2142
+ line?: number | undefined;
2143
+ }[] | undefined;
2144
+ }>, z.ZodObject<{
2145
+ sessionUpdate: z.ZodLiteral<"tool_call_update">;
2146
+ toolCallId: z.ZodString;
2147
+ parentToolCallId: z.ZodOptional<z.ZodString>;
2148
+ status: z.ZodOptional<z.ZodEnum<["pending", "in_progress", "completed", "failed"]>>;
2149
+ title: z.ZodOptional<z.ZodString>;
2150
+ detail: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2151
+ type: z.ZodLiteral<"mcp">;
2152
+ server: z.ZodString;
2153
+ tool: z.ZodString;
2154
+ }, "strip", z.ZodTypeAny, {
2155
+ type: "mcp";
2156
+ tool: string;
2157
+ server: string;
2158
+ }, {
2159
+ type: "mcp";
2160
+ tool: string;
2161
+ server: string;
2162
+ }>, z.ZodObject<{
2163
+ type: z.ZodLiteral<"subagent">;
2164
+ /** spawn starts a sub-agent (its work nests under this call); the rest talk to one. */
2165
+ action: z.ZodDefault<z.ZodEnum<["spawn", "message", "wait", "stop", "resume", "list"]>>;
2166
+ task: z.ZodOptional<z.ZodString>;
2167
+ /** The sub-agent's role or type, e.g. "Explore". */
2168
+ agentType: z.ZodOptional<z.ZodString>;
2169
+ model: z.ZodOptional<z.ZodString>;
2170
+ }, "strip", z.ZodTypeAny, {
2171
+ type: "subagent";
2172
+ action: "message" | "spawn" | "wait" | "stop" | "resume" | "list";
2173
+ model?: string | undefined;
2174
+ task?: string | undefined;
2175
+ agentType?: string | undefined;
2176
+ }, {
2177
+ type: "subagent";
2178
+ model?: string | undefined;
2179
+ action?: "message" | "spawn" | "wait" | "stop" | "resume" | "list" | undefined;
2180
+ task?: string | undefined;
2181
+ agentType?: string | undefined;
2182
+ }>, z.ZodObject<{
2183
+ type: z.ZodLiteral<"skill">;
2184
+ name: z.ZodString;
2185
+ description: z.ZodOptional<z.ZodString>;
2186
+ }, "strip", z.ZodTypeAny, {
2187
+ type: "skill";
2188
+ name: string;
2189
+ description?: string | undefined;
2190
+ }, {
2191
+ type: "skill";
2192
+ name: string;
2193
+ description?: string | undefined;
2194
+ }>, z.ZodObject<{
2195
+ type: z.ZodLiteral<"web_search">;
2196
+ query: z.ZodOptional<z.ZodString>;
2197
+ }, "strip", z.ZodTypeAny, {
2198
+ type: "web_search";
2199
+ query?: string | undefined;
2200
+ }, {
2201
+ type: "web_search";
2202
+ query?: string | undefined;
2203
+ }>, z.ZodObject<{
2204
+ type: z.ZodLiteral<"image_generation">;
2205
+ prompt: z.ZodOptional<z.ZodString>;
2206
+ }, "strip", z.ZodTypeAny, {
2207
+ type: "image_generation";
2208
+ prompt?: string | undefined;
2209
+ }, {
2210
+ type: "image_generation";
2211
+ prompt?: string | undefined;
2212
+ }>, z.ZodObject<{
2213
+ type: z.ZodLiteral<"compaction">;
2214
+ }, "strip", z.ZodTypeAny, {
2215
+ type: "compaction";
2216
+ }, {
2217
+ type: "compaction";
2218
+ }>, z.ZodObject<{
2219
+ type: z.ZodLiteral<"review">;
2220
+ phase: z.ZodEnum<["started", "finished"]>;
2221
+ }, "strip", z.ZodTypeAny, {
2222
+ type: "review";
2223
+ phase: "started" | "finished";
2224
+ }, {
2225
+ type: "review";
2226
+ phase: "started" | "finished";
2227
+ }>]>>;
2228
+ /** Replaces the tool call's content when present. */
2229
+ content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2230
+ type: z.ZodLiteral<"content">;
2231
+ content: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2232
+ type: z.ZodLiteral<"text">;
2233
+ text: z.ZodString;
2234
+ }, "strip", z.ZodTypeAny, {
2235
+ type: "text";
2236
+ text: string;
2237
+ }, {
2238
+ type: "text";
2239
+ text: string;
2240
+ }>, z.ZodObject<{
2241
+ type: z.ZodLiteral<"image">;
2242
+ mimeType: z.ZodString;
2243
+ data: z.ZodOptional<z.ZodString>;
2244
+ uri: z.ZodOptional<z.ZodString>;
2245
+ }, "strip", z.ZodTypeAny, {
2246
+ type: "image";
2247
+ mimeType: string;
2248
+ data?: string | undefined;
2249
+ uri?: string | undefined;
2250
+ }, {
2251
+ type: "image";
2252
+ mimeType: string;
2253
+ data?: string | undefined;
2254
+ uri?: string | undefined;
2255
+ }>, z.ZodObject<{
2256
+ type: z.ZodLiteral<"resource_link">;
2257
+ uri: z.ZodString;
2258
+ name: z.ZodString;
2259
+ /** What the link names: a file (default), a skill the user invoked, or another agent. */
2260
+ kind: z.ZodOptional<z.ZodEnum<["file", "skill", "agent"]>>;
2261
+ }, "strip", z.ZodTypeAny, {
2262
+ type: "resource_link";
2263
+ name: string;
2264
+ uri: string;
2265
+ kind?: "agent" | "file" | "skill" | undefined;
2266
+ }, {
2267
+ type: "resource_link";
2268
+ name: string;
2269
+ uri: string;
2270
+ kind?: "agent" | "file" | "skill" | undefined;
2271
+ }>]>;
2272
+ }, "strip", z.ZodTypeAny, {
2273
+ type: "content";
2274
+ content: {
2275
+ type: "text";
2276
+ text: string;
2277
+ } | {
2278
+ type: "image";
2279
+ mimeType: string;
2280
+ data?: string | undefined;
2281
+ uri?: string | undefined;
2282
+ } | {
2283
+ type: "resource_link";
2284
+ name: string;
2285
+ uri: string;
2286
+ kind?: "agent" | "file" | "skill" | undefined;
2287
+ };
2288
+ }, {
2289
+ type: "content";
2290
+ content: {
2291
+ type: "text";
2292
+ text: string;
2293
+ } | {
2294
+ type: "image";
2295
+ mimeType: string;
2296
+ data?: string | undefined;
2297
+ uri?: string | undefined;
2298
+ } | {
2299
+ type: "resource_link";
2300
+ name: string;
2301
+ uri: string;
2302
+ kind?: "agent" | "file" | "skill" | undefined;
2303
+ };
2304
+ }>, z.ZodObject<{
2305
+ type: z.ZodLiteral<"diff">;
2306
+ path: z.ZodString;
2307
+ oldText: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2308
+ newText: z.ZodString;
2309
+ }, "strip", z.ZodTypeAny, {
2310
+ path: string;
2311
+ type: "diff";
2312
+ newText: string;
2313
+ oldText?: string | null | undefined;
2314
+ }, {
2315
+ path: string;
2316
+ type: "diff";
2317
+ newText: string;
2318
+ oldText?: string | null | undefined;
2319
+ }>, z.ZodObject<{
2320
+ type: z.ZodLiteral<"patch">;
2321
+ path: z.ZodString;
2322
+ change: z.ZodEnum<["add", "delete", "update"]>;
2323
+ movePath: z.ZodOptional<z.ZodString>;
2324
+ diff: z.ZodString;
2325
+ }, "strip", z.ZodTypeAny, {
2326
+ path: string;
2327
+ type: "patch";
2328
+ diff: string;
2329
+ change: "delete" | "add" | "update";
2330
+ movePath?: string | undefined;
2331
+ }, {
2332
+ path: string;
2333
+ type: "patch";
2334
+ diff: string;
2335
+ change: "delete" | "add" | "update";
2336
+ movePath?: string | undefined;
2337
+ }>, z.ZodObject<{
2338
+ type: z.ZodLiteral<"terminal">;
2339
+ terminalId: z.ZodString;
2340
+ }, "strip", z.ZodTypeAny, {
2341
+ type: "terminal";
2342
+ terminalId: string;
2343
+ }, {
2344
+ type: "terminal";
2345
+ terminalId: string;
2346
+ }>]>, "many">>;
2347
+ /** Streamed output appended to the tool call's running output. */
2348
+ appendOutput: z.ZodOptional<z.ZodString>;
2349
+ rawOutput: z.ZodOptional<z.ZodUnknown>;
2350
+ }, "strip", z.ZodTypeAny, {
2351
+ toolCallId: string;
2352
+ sessionUpdate: "tool_call_update";
2353
+ status?: "pending" | "in_progress" | "completed" | "failed" | undefined;
2354
+ title?: string | undefined;
2355
+ detail?: {
2356
+ type: "mcp";
2357
+ tool: string;
2358
+ server: string;
2359
+ } | {
2360
+ type: "subagent";
2361
+ action: "message" | "spawn" | "wait" | "stop" | "resume" | "list";
2362
+ model?: string | undefined;
2363
+ task?: string | undefined;
2364
+ agentType?: string | undefined;
2365
+ } | {
2366
+ type: "skill";
2367
+ name: string;
2368
+ description?: string | undefined;
2369
+ } | {
2370
+ type: "web_search";
2371
+ query?: string | undefined;
2372
+ } | {
2373
+ type: "image_generation";
2374
+ prompt?: string | undefined;
2375
+ } | {
2376
+ type: "compaction";
2377
+ } | {
2378
+ type: "review";
2379
+ phase: "started" | "finished";
2380
+ } | undefined;
2381
+ content?: ({
2382
+ type: "content";
2383
+ content: {
2384
+ type: "text";
2385
+ text: string;
2386
+ } | {
2387
+ type: "image";
2388
+ mimeType: string;
2389
+ data?: string | undefined;
2390
+ uri?: string | undefined;
2391
+ } | {
2392
+ type: "resource_link";
2393
+ name: string;
2394
+ uri: string;
2395
+ kind?: "agent" | "file" | "skill" | undefined;
2396
+ };
2397
+ } | {
2398
+ path: string;
2399
+ type: "diff";
2400
+ newText: string;
2401
+ oldText?: string | null | undefined;
2402
+ } | {
2403
+ path: string;
2404
+ type: "patch";
2405
+ diff: string;
2406
+ change: "delete" | "add" | "update";
2407
+ movePath?: string | undefined;
2408
+ } | {
2409
+ type: "terminal";
2410
+ terminalId: string;
2411
+ })[] | undefined;
2412
+ parentToolCallId?: string | undefined;
2413
+ appendOutput?: string | undefined;
2414
+ rawOutput?: unknown;
2415
+ }, {
2416
+ toolCallId: string;
2417
+ sessionUpdate: "tool_call_update";
2418
+ status?: "pending" | "in_progress" | "completed" | "failed" | undefined;
2419
+ title?: string | undefined;
2420
+ detail?: {
2421
+ type: "mcp";
2422
+ tool: string;
2423
+ server: string;
2424
+ } | {
2425
+ type: "subagent";
2426
+ model?: string | undefined;
2427
+ action?: "message" | "spawn" | "wait" | "stop" | "resume" | "list" | undefined;
2428
+ task?: string | undefined;
2429
+ agentType?: string | undefined;
2430
+ } | {
2431
+ type: "skill";
2432
+ name: string;
2433
+ description?: string | undefined;
2434
+ } | {
2435
+ type: "web_search";
2436
+ query?: string | undefined;
2437
+ } | {
2438
+ type: "image_generation";
2439
+ prompt?: string | undefined;
2440
+ } | {
2441
+ type: "compaction";
2442
+ } | {
2443
+ type: "review";
2444
+ phase: "started" | "finished";
2445
+ } | undefined;
2446
+ content?: ({
2447
+ type: "content";
2448
+ content: {
2449
+ type: "text";
2450
+ text: string;
2451
+ } | {
2452
+ type: "image";
2453
+ mimeType: string;
2454
+ data?: string | undefined;
2455
+ uri?: string | undefined;
2456
+ } | {
2457
+ type: "resource_link";
2458
+ name: string;
2459
+ uri: string;
2460
+ kind?: "agent" | "file" | "skill" | undefined;
2461
+ };
2462
+ } | {
2463
+ path: string;
2464
+ type: "diff";
2465
+ newText: string;
2466
+ oldText?: string | null | undefined;
2467
+ } | {
2468
+ path: string;
2469
+ type: "patch";
2470
+ diff: string;
2471
+ change: "delete" | "add" | "update";
2472
+ movePath?: string | undefined;
2473
+ } | {
2474
+ type: "terminal";
2475
+ terminalId: string;
2476
+ })[] | undefined;
2477
+ parentToolCallId?: string | undefined;
2478
+ appendOutput?: string | undefined;
2479
+ rawOutput?: unknown;
2480
+ }>, z.ZodObject<{
2481
+ sessionUpdate: z.ZodLiteral<"plan">;
2482
+ entries: z.ZodArray<z.ZodObject<{
2483
+ content: z.ZodString;
2484
+ priority: z.ZodDefault<z.ZodEnum<["high", "medium", "low"]>>;
2485
+ status: z.ZodEnum<["pending", "in_progress", "completed"]>;
2486
+ }, "strip", z.ZodTypeAny, {
2487
+ status: "pending" | "in_progress" | "completed";
2488
+ content: string;
2489
+ priority: "high" | "medium" | "low";
2490
+ }, {
2491
+ status: "pending" | "in_progress" | "completed";
2492
+ content: string;
2493
+ priority?: "high" | "medium" | "low" | undefined;
2494
+ }>, "many">;
2495
+ }, "strip", z.ZodTypeAny, {
2496
+ entries: {
2497
+ status: "pending" | "in_progress" | "completed";
2498
+ content: string;
2499
+ priority: "high" | "medium" | "low";
2500
+ }[];
2501
+ sessionUpdate: "plan";
2502
+ }, {
2503
+ entries: {
2504
+ status: "pending" | "in_progress" | "completed";
2505
+ content: string;
2506
+ priority?: "high" | "medium" | "low" | undefined;
2507
+ }[];
2508
+ sessionUpdate: "plan";
2509
+ }>, z.ZodObject<{
2510
+ sessionUpdate: z.ZodLiteral<"available_commands_update">;
2511
+ availableCommands: z.ZodArray<z.ZodObject<{
2512
+ name: z.ZodString;
2513
+ description: z.ZodString;
2514
+ hint: z.ZodOptional<z.ZodString>;
2515
+ }, "strip", z.ZodTypeAny, {
2516
+ name: string;
2517
+ description: string;
2518
+ hint?: string | undefined;
2519
+ }, {
2520
+ name: string;
2521
+ description: string;
2522
+ hint?: string | undefined;
2523
+ }>, "many">;
2524
+ }, "strip", z.ZodTypeAny, {
2525
+ sessionUpdate: "available_commands_update";
2526
+ availableCommands: {
2527
+ name: string;
2528
+ description: string;
2529
+ hint?: string | undefined;
2530
+ }[];
2531
+ }, {
2532
+ sessionUpdate: "available_commands_update";
2533
+ availableCommands: {
2534
+ name: string;
2535
+ description: string;
2536
+ hint?: string | undefined;
2537
+ }[];
2538
+ }>, z.ZodObject<{
2539
+ sessionUpdate: z.ZodLiteral<"current_mode_update">;
2540
+ currentModeId: z.ZodString;
2541
+ }, "strip", z.ZodTypeAny, {
2542
+ sessionUpdate: "current_mode_update";
2543
+ currentModeId: string;
2544
+ }, {
2545
+ sessionUpdate: "current_mode_update";
2546
+ currentModeId: string;
2547
+ }>, z.ZodObject<{
2548
+ sessionUpdate: z.ZodLiteral<"session_info_update">;
2549
+ title: z.ZodOptional<z.ZodString>;
2550
+ model: z.ZodOptional<z.ZodString>;
2551
+ }, "strip", z.ZodTypeAny, {
2552
+ sessionUpdate: "session_info_update";
2553
+ title?: string | undefined;
2554
+ model?: string | undefined;
2555
+ }, {
2556
+ sessionUpdate: "session_info_update";
2557
+ title?: string | undefined;
2558
+ model?: string | undefined;
2559
+ }>, z.ZodObject<{
2560
+ sessionUpdate: z.ZodLiteral<"usage_update">;
2561
+ usedTokens: z.ZodOptional<z.ZodNumber>;
2562
+ contextWindow: z.ZodOptional<z.ZodNumber>;
2563
+ }, "strip", z.ZodTypeAny, {
2564
+ sessionUpdate: "usage_update";
2565
+ usedTokens?: number | undefined;
2566
+ contextWindow?: number | undefined;
2567
+ }, {
2568
+ sessionUpdate: "usage_update";
2569
+ usedTokens?: number | undefined;
2570
+ contextWindow?: number | undefined;
2571
+ }>, z.ZodObject<{
2572
+ sessionUpdate: z.ZodLiteral<"ls_message_done">;
2573
+ parentToolCallId: z.ZodOptional<z.ZodString>;
2574
+ messageId: z.ZodString;
2575
+ role: z.ZodEnum<["agent", "thought", "user"]>;
2576
+ }, "strip", z.ZodTypeAny, {
2577
+ sessionUpdate: "ls_message_done";
2578
+ messageId: string;
2579
+ role: "agent" | "thought" | "user";
2580
+ parentToolCallId?: string | undefined;
2581
+ }, {
2582
+ sessionUpdate: "ls_message_done";
2583
+ messageId: string;
2584
+ role: "agent" | "thought" | "user";
2585
+ parentToolCallId?: string | undefined;
2586
+ }>, z.ZodObject<{
2587
+ sessionUpdate: z.ZodLiteral<"ls_config">;
2588
+ options: z.ZodArray<z.ZodObject<{
2589
+ /** Agent-defined id; "model" and "mode" are the common ones. */
2590
+ id: z.ZodString;
2591
+ name: z.ZodString;
2592
+ category: z.ZodDefault<z.ZodEnum<["model", "mode", "effort", "other"]>>;
2593
+ current: z.ZodString;
2594
+ values: z.ZodArray<z.ZodObject<{
2595
+ value: z.ZodString;
2596
+ name: z.ZodString;
2597
+ description: z.ZodOptional<z.ZodString>;
2598
+ }, "strip", z.ZodTypeAny, {
2599
+ value: string;
2600
+ name: string;
2601
+ description?: string | undefined;
2602
+ }, {
2603
+ value: string;
2604
+ name: string;
2605
+ description?: string | undefined;
2606
+ }>, "many">;
2607
+ }, "strip", z.ZodTypeAny, {
2608
+ values: {
2609
+ value: string;
2610
+ name: string;
2611
+ description?: string | undefined;
2612
+ }[];
2613
+ id: string;
2614
+ name: string;
2615
+ category: "other" | "model" | "mode" | "effort";
2616
+ current: string;
2617
+ }, {
2618
+ values: {
2619
+ value: string;
2620
+ name: string;
2621
+ description?: string | undefined;
2622
+ }[];
2623
+ id: string;
2624
+ name: string;
2625
+ current: string;
2626
+ category?: "other" | "model" | "mode" | "effort" | undefined;
2627
+ }>, "many">;
2628
+ }, "strip", z.ZodTypeAny, {
2629
+ options: {
2630
+ values: {
2631
+ value: string;
2632
+ name: string;
2633
+ description?: string | undefined;
2634
+ }[];
2635
+ id: string;
2636
+ name: string;
2637
+ category: "other" | "model" | "mode" | "effort";
2638
+ current: string;
2639
+ }[];
2640
+ sessionUpdate: "ls_config";
2641
+ }, {
2642
+ options: {
2643
+ values: {
2644
+ value: string;
2645
+ name: string;
2646
+ description?: string | undefined;
2647
+ }[];
2648
+ id: string;
2649
+ name: string;
2650
+ current: string;
2651
+ category?: "other" | "model" | "mode" | "effort" | undefined;
2652
+ }[];
2653
+ sessionUpdate: "ls_config";
2654
+ }>, z.ZodObject<{
2655
+ sessionUpdate: z.ZodLiteral<"ls_notice">;
2656
+ level: z.ZodEnum<["info", "warning"]>;
2657
+ title: z.ZodString;
2658
+ detail: z.ZodOptional<z.ZodString>;
2659
+ }, "strip", z.ZodTypeAny, {
2660
+ title: string;
2661
+ sessionUpdate: "ls_notice";
2662
+ level: "info" | "warning";
2663
+ detail?: string | undefined;
2664
+ }, {
2665
+ title: string;
2666
+ sessionUpdate: "ls_notice";
2667
+ level: "info" | "warning";
2668
+ detail?: string | undefined;
2669
+ }>, z.ZodObject<{
2670
+ sessionUpdate: z.ZodLiteral<"ls_turn">;
2671
+ /** A sub-agent's turn: whether the sub-agent under this call is working. */
2672
+ parentToolCallId: z.ZodOptional<z.ZodString>;
2673
+ state: z.ZodEnum<["started", "ended"]>;
2674
+ turnId: z.ZodOptional<z.ZodString>;
2675
+ stopReason: z.ZodOptional<z.ZodEnum<["end_turn", "cancelled", "error", "max_tokens", "refusal"]>>;
2676
+ }, "strip", z.ZodTypeAny, {
2677
+ state: "started" | "ended";
2678
+ sessionUpdate: "ls_turn";
2679
+ parentToolCallId?: string | undefined;
2680
+ turnId?: string | undefined;
2681
+ stopReason?: "error" | "end_turn" | "cancelled" | "max_tokens" | "refusal" | undefined;
2682
+ }, {
2683
+ state: "started" | "ended";
2684
+ sessionUpdate: "ls_turn";
2685
+ parentToolCallId?: string | undefined;
2686
+ turnId?: string | undefined;
2687
+ stopReason?: "error" | "end_turn" | "cancelled" | "max_tokens" | "refusal" | undefined;
2688
+ }>, z.ZodObject<{
2689
+ sessionUpdate: z.ZodLiteral<"ls_permission">;
2690
+ requestId: z.ZodString;
2691
+ toolCallId: z.ZodOptional<z.ZodString>;
2692
+ title: z.ZodString;
2693
+ detail: z.ZodOptional<z.ZodString>;
2694
+ options: z.ZodArray<z.ZodObject<{
2695
+ optionId: z.ZodString;
2696
+ name: z.ZodString;
2697
+ kind: z.ZodEnum<["allow_once", "allow_always", "reject_once", "reject_always"]>;
2698
+ }, "strip", z.ZodTypeAny, {
2699
+ optionId: string;
2700
+ name: string;
2701
+ kind: "allow_once" | "allow_always" | "reject_once" | "reject_always";
2702
+ }, {
2703
+ optionId: string;
2704
+ name: string;
2705
+ kind: "allow_once" | "allow_always" | "reject_once" | "reject_always";
2706
+ }>, "many">;
2707
+ }, "strip", z.ZodTypeAny, {
2708
+ options: {
2709
+ optionId: string;
2710
+ name: string;
2711
+ kind: "allow_once" | "allow_always" | "reject_once" | "reject_always";
2712
+ }[];
2713
+ title: string;
2714
+ requestId: string;
2715
+ sessionUpdate: "ls_permission";
2716
+ toolCallId?: string | undefined;
2717
+ detail?: string | undefined;
2718
+ }, {
2719
+ options: {
2720
+ optionId: string;
2721
+ name: string;
2722
+ kind: "allow_once" | "allow_always" | "reject_once" | "reject_always";
2723
+ }[];
2724
+ title: string;
2725
+ requestId: string;
2726
+ sessionUpdate: "ls_permission";
2727
+ toolCallId?: string | undefined;
2728
+ detail?: string | undefined;
2729
+ }>, z.ZodObject<{
2730
+ sessionUpdate: z.ZodLiteral<"ls_permission_resolved">;
2731
+ requestId: z.ZodString;
2732
+ optionId: z.ZodOptional<z.ZodString>;
2733
+ }, "strip", z.ZodTypeAny, {
2734
+ requestId: string;
2735
+ sessionUpdate: "ls_permission_resolved";
2736
+ optionId?: string | undefined;
2737
+ }, {
2738
+ requestId: string;
2739
+ sessionUpdate: "ls_permission_resolved";
2740
+ optionId?: string | undefined;
2741
+ }>, z.ZodObject<{
2742
+ sessionUpdate: z.ZodLiteral<"ls_driver">;
2743
+ driver: z.ZodEnum<["desktop", "remote", "none"]>;
2744
+ deviceId: z.ZodOptional<z.ZodString>;
2745
+ }, "strip", z.ZodTypeAny, {
2746
+ driver: "remote" | "desktop" | "none";
2747
+ sessionUpdate: "ls_driver";
2748
+ deviceId?: string | undefined;
2749
+ }, {
2750
+ driver: "remote" | "desktop" | "none";
2751
+ sessionUpdate: "ls_driver";
2752
+ deviceId?: string | undefined;
2753
+ }>, z.ZodObject<{
2754
+ sessionUpdate: z.ZodLiteral<"ls_status">;
2755
+ state: z.ZodEnum<["idle", "running", "waiting", "error", "offline"]>;
2756
+ }, "strip", z.ZodTypeAny, {
2757
+ state: "idle" | "running" | "waiting" | "error" | "offline";
2758
+ sessionUpdate: "ls_status";
2759
+ }, {
2760
+ state: "idle" | "running" | "waiting" | "error" | "offline";
2761
+ sessionUpdate: "ls_status";
2762
+ }>, z.ZodObject<{
2763
+ sessionUpdate: z.ZodLiteral<"ls_error">;
2764
+ code: z.ZodString;
2765
+ message: z.ZodString;
2766
+ hint: z.ZodOptional<z.ZodString>;
2767
+ }, "strip", z.ZodTypeAny, {
2768
+ code: string;
2769
+ message: string;
2770
+ sessionUpdate: "ls_error";
2771
+ hint?: string | undefined;
2772
+ }, {
2773
+ code: string;
2774
+ message: string;
2775
+ sessionUpdate: "ls_error";
2776
+ hint?: string | undefined;
2777
+ }>]>;
2778
+ }, "strip", z.ZodTypeAny, {
2779
+ update: {
2780
+ content: {
2781
+ type: "text";
2782
+ text: string;
2783
+ } | {
2784
+ type: "image";
2785
+ mimeType: string;
2786
+ data?: string | undefined;
2787
+ uri?: string | undefined;
2788
+ } | {
2789
+ type: "resource_link";
2790
+ name: string;
2791
+ uri: string;
2792
+ kind?: "agent" | "file" | "skill" | undefined;
2793
+ };
2794
+ sessionUpdate: "user_message_chunk";
2795
+ messageId?: string | undefined;
2796
+ } | {
2797
+ content: {
2798
+ type: "text";
2799
+ text: string;
2800
+ } | {
2801
+ type: "image";
2802
+ mimeType: string;
2803
+ data?: string | undefined;
2804
+ uri?: string | undefined;
2805
+ } | {
2806
+ type: "resource_link";
2807
+ name: string;
2808
+ uri: string;
2809
+ kind?: "agent" | "file" | "skill" | undefined;
2810
+ };
2811
+ sessionUpdate: "agent_message_chunk";
2812
+ messageId: string;
2813
+ parentToolCallId?: string | undefined;
2814
+ } | {
2815
+ content: {
2816
+ type: "text";
2817
+ text: string;
2818
+ } | {
2819
+ type: "image";
2820
+ mimeType: string;
2821
+ data?: string | undefined;
2822
+ uri?: string | undefined;
2823
+ } | {
2824
+ type: "resource_link";
2825
+ name: string;
2826
+ uri: string;
2827
+ kind?: "agent" | "file" | "skill" | undefined;
2828
+ };
2829
+ sessionUpdate: "agent_thought_chunk";
2830
+ messageId: string;
2831
+ parentToolCallId?: string | undefined;
2832
+ } | {
2833
+ status: "pending" | "in_progress" | "completed" | "failed";
2834
+ kind: "read" | "edit" | "delete" | "move" | "search" | "execute" | "think" | "fetch" | "other";
2835
+ title: string;
2836
+ toolCallId: string;
2837
+ sessionUpdate: "tool_call";
2838
+ detail?: {
2839
+ type: "mcp";
2840
+ tool: string;
2841
+ server: string;
2842
+ } | {
2843
+ type: "subagent";
2844
+ action: "message" | "spawn" | "wait" | "stop" | "resume" | "list";
2845
+ model?: string | undefined;
2846
+ task?: string | undefined;
2847
+ agentType?: string | undefined;
2848
+ } | {
2849
+ type: "skill";
2850
+ name: string;
2851
+ description?: string | undefined;
2852
+ } | {
2853
+ type: "web_search";
2854
+ query?: string | undefined;
2855
+ } | {
2856
+ type: "image_generation";
2857
+ prompt?: string | undefined;
2858
+ } | {
2859
+ type: "compaction";
2860
+ } | {
2861
+ type: "review";
2862
+ phase: "started" | "finished";
2863
+ } | undefined;
2864
+ content?: ({
2865
+ type: "content";
2866
+ content: {
2867
+ type: "text";
2868
+ text: string;
2869
+ } | {
2870
+ type: "image";
2871
+ mimeType: string;
2872
+ data?: string | undefined;
2873
+ uri?: string | undefined;
2874
+ } | {
2875
+ type: "resource_link";
2876
+ name: string;
2877
+ uri: string;
2878
+ kind?: "agent" | "file" | "skill" | undefined;
2879
+ };
2880
+ } | {
2881
+ path: string;
2882
+ type: "diff";
2883
+ newText: string;
2884
+ oldText?: string | null | undefined;
2885
+ } | {
2886
+ path: string;
2887
+ type: "patch";
2888
+ diff: string;
2889
+ change: "delete" | "add" | "update";
2890
+ movePath?: string | undefined;
2891
+ } | {
2892
+ type: "terminal";
2893
+ terminalId: string;
2894
+ })[] | undefined;
2895
+ parentToolCallId?: string | undefined;
2896
+ rawInput?: unknown;
2897
+ locations?: {
2898
+ path: string;
2899
+ line?: number | undefined;
2900
+ }[] | undefined;
2901
+ } | {
2902
+ toolCallId: string;
2903
+ sessionUpdate: "tool_call_update";
2904
+ status?: "pending" | "in_progress" | "completed" | "failed" | undefined;
2905
+ title?: string | undefined;
2906
+ detail?: {
2907
+ type: "mcp";
2908
+ tool: string;
2909
+ server: string;
2910
+ } | {
2911
+ type: "subagent";
2912
+ action: "message" | "spawn" | "wait" | "stop" | "resume" | "list";
2913
+ model?: string | undefined;
2914
+ task?: string | undefined;
2915
+ agentType?: string | undefined;
2916
+ } | {
2917
+ type: "skill";
2918
+ name: string;
2919
+ description?: string | undefined;
2920
+ } | {
2921
+ type: "web_search";
2922
+ query?: string | undefined;
2923
+ } | {
2924
+ type: "image_generation";
2925
+ prompt?: string | undefined;
2926
+ } | {
2927
+ type: "compaction";
2928
+ } | {
2929
+ type: "review";
2930
+ phase: "started" | "finished";
2931
+ } | undefined;
2932
+ content?: ({
2933
+ type: "content";
2934
+ content: {
2935
+ type: "text";
2936
+ text: string;
2937
+ } | {
2938
+ type: "image";
2939
+ mimeType: string;
2940
+ data?: string | undefined;
2941
+ uri?: string | undefined;
2942
+ } | {
2943
+ type: "resource_link";
2944
+ name: string;
2945
+ uri: string;
2946
+ kind?: "agent" | "file" | "skill" | undefined;
2947
+ };
2948
+ } | {
2949
+ path: string;
2950
+ type: "diff";
2951
+ newText: string;
2952
+ oldText?: string | null | undefined;
2953
+ } | {
2954
+ path: string;
2955
+ type: "patch";
2956
+ diff: string;
2957
+ change: "delete" | "add" | "update";
2958
+ movePath?: string | undefined;
2959
+ } | {
2960
+ type: "terminal";
2961
+ terminalId: string;
2962
+ })[] | undefined;
2963
+ parentToolCallId?: string | undefined;
2964
+ appendOutput?: string | undefined;
2965
+ rawOutput?: unknown;
2966
+ } | {
2967
+ entries: {
2968
+ status: "pending" | "in_progress" | "completed";
2969
+ content: string;
2970
+ priority: "high" | "medium" | "low";
2971
+ }[];
2972
+ sessionUpdate: "plan";
2973
+ } | {
2974
+ sessionUpdate: "available_commands_update";
2975
+ availableCommands: {
2976
+ name: string;
2977
+ description: string;
2978
+ hint?: string | undefined;
2979
+ }[];
2980
+ } | {
2981
+ sessionUpdate: "current_mode_update";
2982
+ currentModeId: string;
2983
+ } | {
2984
+ sessionUpdate: "session_info_update";
2985
+ title?: string | undefined;
2986
+ model?: string | undefined;
2987
+ } | {
2988
+ sessionUpdate: "usage_update";
2989
+ usedTokens?: number | undefined;
2990
+ contextWindow?: number | undefined;
2991
+ } | {
2992
+ sessionUpdate: "ls_message_done";
2993
+ messageId: string;
2994
+ role: "agent" | "thought" | "user";
2995
+ parentToolCallId?: string | undefined;
2996
+ } | {
2997
+ options: {
2998
+ values: {
2999
+ value: string;
3000
+ name: string;
3001
+ description?: string | undefined;
3002
+ }[];
3003
+ id: string;
3004
+ name: string;
3005
+ category: "other" | "model" | "mode" | "effort";
3006
+ current: string;
3007
+ }[];
3008
+ sessionUpdate: "ls_config";
3009
+ } | {
3010
+ title: string;
3011
+ sessionUpdate: "ls_notice";
3012
+ level: "info" | "warning";
3013
+ detail?: string | undefined;
3014
+ } | {
3015
+ state: "started" | "ended";
3016
+ sessionUpdate: "ls_turn";
3017
+ parentToolCallId?: string | undefined;
3018
+ turnId?: string | undefined;
3019
+ stopReason?: "error" | "end_turn" | "cancelled" | "max_tokens" | "refusal" | undefined;
3020
+ } | {
3021
+ options: {
3022
+ optionId: string;
3023
+ name: string;
3024
+ kind: "allow_once" | "allow_always" | "reject_once" | "reject_always";
3025
+ }[];
3026
+ title: string;
3027
+ requestId: string;
3028
+ sessionUpdate: "ls_permission";
3029
+ toolCallId?: string | undefined;
3030
+ detail?: string | undefined;
3031
+ } | {
3032
+ requestId: string;
3033
+ sessionUpdate: "ls_permission_resolved";
3034
+ optionId?: string | undefined;
3035
+ } | {
3036
+ driver: "remote" | "desktop" | "none";
3037
+ sessionUpdate: "ls_driver";
3038
+ deviceId?: string | undefined;
3039
+ } | {
3040
+ state: "idle" | "running" | "waiting" | "error" | "offline";
3041
+ sessionUpdate: "ls_status";
3042
+ } | {
3043
+ code: string;
3044
+ message: string;
3045
+ sessionUpdate: "ls_error";
3046
+ hint?: string | undefined;
3047
+ };
3048
+ sessionId: string;
3049
+ seq: number;
3050
+ ts: number;
3051
+ }, {
3052
+ update: {
3053
+ content: {
3054
+ type: "text";
3055
+ text: string;
3056
+ } | {
3057
+ type: "image";
3058
+ mimeType: string;
3059
+ data?: string | undefined;
3060
+ uri?: string | undefined;
3061
+ } | {
3062
+ type: "resource_link";
3063
+ name: string;
3064
+ uri: string;
3065
+ kind?: "agent" | "file" | "skill" | undefined;
3066
+ };
3067
+ sessionUpdate: "user_message_chunk";
3068
+ messageId?: string | undefined;
3069
+ } | {
3070
+ content: {
3071
+ type: "text";
3072
+ text: string;
3073
+ } | {
3074
+ type: "image";
3075
+ mimeType: string;
3076
+ data?: string | undefined;
3077
+ uri?: string | undefined;
3078
+ } | {
3079
+ type: "resource_link";
3080
+ name: string;
3081
+ uri: string;
3082
+ kind?: "agent" | "file" | "skill" | undefined;
3083
+ };
3084
+ sessionUpdate: "agent_message_chunk";
3085
+ messageId: string;
3086
+ parentToolCallId?: string | undefined;
3087
+ } | {
3088
+ content: {
3089
+ type: "text";
3090
+ text: string;
3091
+ } | {
3092
+ type: "image";
3093
+ mimeType: string;
3094
+ data?: string | undefined;
3095
+ uri?: string | undefined;
3096
+ } | {
3097
+ type: "resource_link";
3098
+ name: string;
3099
+ uri: string;
3100
+ kind?: "agent" | "file" | "skill" | undefined;
3101
+ };
3102
+ sessionUpdate: "agent_thought_chunk";
3103
+ messageId: string;
3104
+ parentToolCallId?: string | undefined;
3105
+ } | {
3106
+ status: "pending" | "in_progress" | "completed" | "failed";
3107
+ kind: "read" | "edit" | "delete" | "move" | "search" | "execute" | "think" | "fetch" | "other";
3108
+ title: string;
3109
+ toolCallId: string;
3110
+ sessionUpdate: "tool_call";
3111
+ detail?: {
3112
+ type: "mcp";
3113
+ tool: string;
3114
+ server: string;
3115
+ } | {
3116
+ type: "subagent";
3117
+ model?: string | undefined;
3118
+ action?: "message" | "spawn" | "wait" | "stop" | "resume" | "list" | undefined;
3119
+ task?: string | undefined;
3120
+ agentType?: string | undefined;
3121
+ } | {
3122
+ type: "skill";
3123
+ name: string;
3124
+ description?: string | undefined;
3125
+ } | {
3126
+ type: "web_search";
3127
+ query?: string | undefined;
3128
+ } | {
3129
+ type: "image_generation";
3130
+ prompt?: string | undefined;
3131
+ } | {
3132
+ type: "compaction";
3133
+ } | {
3134
+ type: "review";
3135
+ phase: "started" | "finished";
3136
+ } | undefined;
3137
+ content?: ({
3138
+ type: "content";
3139
+ content: {
3140
+ type: "text";
3141
+ text: string;
3142
+ } | {
3143
+ type: "image";
3144
+ mimeType: string;
3145
+ data?: string | undefined;
3146
+ uri?: string | undefined;
3147
+ } | {
3148
+ type: "resource_link";
3149
+ name: string;
3150
+ uri: string;
3151
+ kind?: "agent" | "file" | "skill" | undefined;
3152
+ };
3153
+ } | {
3154
+ path: string;
3155
+ type: "diff";
3156
+ newText: string;
3157
+ oldText?: string | null | undefined;
3158
+ } | {
3159
+ path: string;
3160
+ type: "patch";
3161
+ diff: string;
3162
+ change: "delete" | "add" | "update";
3163
+ movePath?: string | undefined;
3164
+ } | {
3165
+ type: "terminal";
3166
+ terminalId: string;
3167
+ })[] | undefined;
3168
+ parentToolCallId?: string | undefined;
3169
+ rawInput?: unknown;
3170
+ locations?: {
3171
+ path: string;
3172
+ line?: number | undefined;
3173
+ }[] | undefined;
3174
+ } | {
3175
+ toolCallId: string;
3176
+ sessionUpdate: "tool_call_update";
3177
+ status?: "pending" | "in_progress" | "completed" | "failed" | undefined;
3178
+ title?: string | undefined;
3179
+ detail?: {
3180
+ type: "mcp";
3181
+ tool: string;
3182
+ server: string;
3183
+ } | {
3184
+ type: "subagent";
3185
+ model?: string | undefined;
3186
+ action?: "message" | "spawn" | "wait" | "stop" | "resume" | "list" | undefined;
3187
+ task?: string | undefined;
3188
+ agentType?: string | undefined;
3189
+ } | {
3190
+ type: "skill";
3191
+ name: string;
3192
+ description?: string | undefined;
3193
+ } | {
3194
+ type: "web_search";
3195
+ query?: string | undefined;
3196
+ } | {
3197
+ type: "image_generation";
3198
+ prompt?: string | undefined;
3199
+ } | {
3200
+ type: "compaction";
3201
+ } | {
3202
+ type: "review";
3203
+ phase: "started" | "finished";
3204
+ } | undefined;
3205
+ content?: ({
3206
+ type: "content";
3207
+ content: {
3208
+ type: "text";
3209
+ text: string;
3210
+ } | {
3211
+ type: "image";
3212
+ mimeType: string;
3213
+ data?: string | undefined;
3214
+ uri?: string | undefined;
3215
+ } | {
3216
+ type: "resource_link";
3217
+ name: string;
3218
+ uri: string;
3219
+ kind?: "agent" | "file" | "skill" | undefined;
3220
+ };
3221
+ } | {
3222
+ path: string;
3223
+ type: "diff";
3224
+ newText: string;
3225
+ oldText?: string | null | undefined;
3226
+ } | {
3227
+ path: string;
3228
+ type: "patch";
3229
+ diff: string;
3230
+ change: "delete" | "add" | "update";
3231
+ movePath?: string | undefined;
3232
+ } | {
3233
+ type: "terminal";
3234
+ terminalId: string;
3235
+ })[] | undefined;
3236
+ parentToolCallId?: string | undefined;
3237
+ appendOutput?: string | undefined;
3238
+ rawOutput?: unknown;
3239
+ } | {
3240
+ entries: {
3241
+ status: "pending" | "in_progress" | "completed";
3242
+ content: string;
3243
+ priority?: "high" | "medium" | "low" | undefined;
3244
+ }[];
3245
+ sessionUpdate: "plan";
3246
+ } | {
3247
+ sessionUpdate: "available_commands_update";
3248
+ availableCommands: {
3249
+ name: string;
3250
+ description: string;
3251
+ hint?: string | undefined;
3252
+ }[];
3253
+ } | {
3254
+ sessionUpdate: "current_mode_update";
3255
+ currentModeId: string;
3256
+ } | {
3257
+ sessionUpdate: "session_info_update";
3258
+ title?: string | undefined;
3259
+ model?: string | undefined;
3260
+ } | {
3261
+ sessionUpdate: "usage_update";
3262
+ usedTokens?: number | undefined;
3263
+ contextWindow?: number | undefined;
3264
+ } | {
3265
+ sessionUpdate: "ls_message_done";
3266
+ messageId: string;
3267
+ role: "agent" | "thought" | "user";
3268
+ parentToolCallId?: string | undefined;
3269
+ } | {
3270
+ options: {
3271
+ values: {
3272
+ value: string;
3273
+ name: string;
3274
+ description?: string | undefined;
3275
+ }[];
3276
+ id: string;
3277
+ name: string;
3278
+ current: string;
3279
+ category?: "other" | "model" | "mode" | "effort" | undefined;
3280
+ }[];
3281
+ sessionUpdate: "ls_config";
3282
+ } | {
3283
+ title: string;
3284
+ sessionUpdate: "ls_notice";
3285
+ level: "info" | "warning";
3286
+ detail?: string | undefined;
3287
+ } | {
3288
+ state: "started" | "ended";
3289
+ sessionUpdate: "ls_turn";
3290
+ parentToolCallId?: string | undefined;
3291
+ turnId?: string | undefined;
3292
+ stopReason?: "error" | "end_turn" | "cancelled" | "max_tokens" | "refusal" | undefined;
3293
+ } | {
3294
+ options: {
3295
+ optionId: string;
3296
+ name: string;
3297
+ kind: "allow_once" | "allow_always" | "reject_once" | "reject_always";
3298
+ }[];
3299
+ title: string;
3300
+ requestId: string;
3301
+ sessionUpdate: "ls_permission";
3302
+ toolCallId?: string | undefined;
3303
+ detail?: string | undefined;
3304
+ } | {
3305
+ requestId: string;
3306
+ sessionUpdate: "ls_permission_resolved";
3307
+ optionId?: string | undefined;
3308
+ } | {
3309
+ driver: "remote" | "desktop" | "none";
3310
+ sessionUpdate: "ls_driver";
3311
+ deviceId?: string | undefined;
3312
+ } | {
3313
+ state: "idle" | "running" | "waiting" | "error" | "offline";
3314
+ sessionUpdate: "ls_status";
3315
+ } | {
3316
+ code: string;
3317
+ message: string;
3318
+ sessionUpdate: "ls_error";
3319
+ hint?: string | undefined;
3320
+ };
3321
+ sessionId: string;
3322
+ seq: number;
3323
+ ts: number;
3324
+ }>;
3325
+ export type SessionEvent = z.infer<typeof sessionEventSchema>;