linkshell-cli 0.5.42 → 0.6.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 (135) hide show
  1. package/dist/cli/src/commands/host.d.ts +23 -0
  2. package/dist/cli/src/commands/host.js +264 -0
  3. package/dist/cli/src/commands/host.js.map +1 -0
  4. package/dist/cli/src/commands/pair.d.ts +1 -0
  5. package/dist/cli/src/commands/pair.js +48 -0
  6. package/dist/cli/src/commands/pair.js.map +1 -0
  7. package/dist/cli/src/index.js +68 -0
  8. package/dist/cli/src/index.js.map +1 -1
  9. package/dist/cli/src/utils/daemon.d.ts +1 -1
  10. package/dist/cli/src/utils/daemon.js +3 -2
  11. package/dist/cli/src/utils/daemon.js.map +1 -1
  12. package/dist/cli/tsconfig.tsbuildinfo +1 -1
  13. package/dist/host/src/drivers/acp/connection.d.ts +61 -0
  14. package/dist/host/src/drivers/acp/connection.js +121 -0
  15. package/dist/host/src/drivers/acp/connection.js.map +1 -0
  16. package/dist/host/src/drivers/acp/driver.d.ts +110 -0
  17. package/dist/host/src/drivers/acp/driver.js +438 -0
  18. package/dist/host/src/drivers/acp/driver.js.map +1 -0
  19. package/dist/host/src/drivers/acp/mapper.d.ts +49 -0
  20. package/dist/host/src/drivers/acp/mapper.js +411 -0
  21. package/dist/host/src/drivers/acp/mapper.js.map +1 -0
  22. package/dist/host/src/drivers/auth.d.ts +7 -0
  23. package/dist/host/src/drivers/auth.js +57 -0
  24. package/dist/host/src/drivers/auth.js.map +1 -0
  25. package/dist/host/src/drivers/claude/driver.d.ts +76 -0
  26. package/dist/host/src/drivers/claude/driver.js +331 -0
  27. package/dist/host/src/drivers/claude/driver.js.map +1 -0
  28. package/dist/host/src/drivers/claude/transcript.d.ts +335 -0
  29. package/dist/host/src/drivers/claude/transcript.js +516 -0
  30. package/dist/host/src/drivers/claude/transcript.js.map +1 -0
  31. package/dist/host/src/drivers/codex/app-server.d.ts +36 -0
  32. package/dist/host/src/drivers/codex/app-server.js +144 -0
  33. package/dist/host/src/drivers/codex/app-server.js.map +1 -0
  34. package/dist/host/src/drivers/codex/driver.d.ts +89 -0
  35. package/dist/host/src/drivers/codex/driver.js +452 -0
  36. package/dist/host/src/drivers/codex/driver.js.map +1 -0
  37. package/dist/host/src/drivers/codex/mapper.d.ts +61 -0
  38. package/dist/host/src/drivers/codex/mapper.js +623 -0
  39. package/dist/host/src/drivers/codex/mapper.js.map +1 -0
  40. package/dist/host/src/drivers/codex/settings.d.ts +51 -0
  41. package/dist/host/src/drivers/codex/settings.js +107 -0
  42. package/dist/host/src/drivers/codex/settings.js.map +1 -0
  43. package/dist/host/src/drivers/images.d.ts +11 -0
  44. package/dist/host/src/drivers/images.js +34 -0
  45. package/dist/host/src/drivers/images.js.map +1 -0
  46. package/dist/host/src/drivers/nesting.d.ts +6 -0
  47. package/dist/host/src/drivers/nesting.js +25 -0
  48. package/dist/host/src/drivers/nesting.js.map +1 -0
  49. package/dist/host/src/drivers/registry.d.ts +21 -0
  50. package/dist/host/src/drivers/registry.js +30 -0
  51. package/dist/host/src/drivers/registry.js.map +1 -0
  52. package/dist/host/src/drivers/types.d.ts +105 -0
  53. package/dist/host/src/drivers/types.js +2 -0
  54. package/dist/host/src/drivers/types.js.map +1 -0
  55. package/dist/host/src/fs.d.ts +69 -0
  56. package/dist/host/src/fs.js +198 -0
  57. package/dist/host/src/fs.js.map +1 -0
  58. package/dist/host/src/gateway.d.ts +55 -0
  59. package/dist/host/src/gateway.js +263 -0
  60. package/dist/host/src/gateway.js.map +1 -0
  61. package/dist/host/src/host.d.ts +51 -0
  62. package/dist/host/src/host.js +133 -0
  63. package/dist/host/src/host.js.map +1 -0
  64. package/dist/host/src/hub.d.ts +89 -0
  65. package/dist/host/src/hub.js +592 -0
  66. package/dist/host/src/hub.js.map +1 -0
  67. package/dist/host/src/index.d.ts +10 -0
  68. package/dist/host/src/index.js +10 -0
  69. package/dist/host/src/index.js.map +1 -0
  70. package/dist/host/src/ports.d.ts +24 -0
  71. package/dist/host/src/ports.js +201 -0
  72. package/dist/host/src/ports.js.map +1 -0
  73. package/dist/host/src/rpc/client.d.ts +9 -0
  74. package/dist/host/src/rpc/client.js +42 -0
  75. package/dist/host/src/rpc/client.js.map +1 -0
  76. package/dist/host/src/rpc/server.d.ts +52 -0
  77. package/dist/host/src/rpc/server.js +293 -0
  78. package/dist/host/src/rpc/server.js.map +1 -0
  79. package/dist/host/src/screen.d.ts +30 -0
  80. package/dist/host/src/screen.js +230 -0
  81. package/dist/host/src/screen.js.map +1 -0
  82. package/dist/host/src/shell-env.d.ts +8 -0
  83. package/dist/host/src/shell-env.js +39 -0
  84. package/dist/host/src/shell-env.js.map +1 -0
  85. package/dist/host/src/store.d.ts +75 -0
  86. package/dist/host/src/store.js +265 -0
  87. package/dist/host/src/store.js.map +1 -0
  88. package/dist/host/src/terminals.d.ts +55 -0
  89. package/dist/host/src/terminals.js +367 -0
  90. package/dist/host/src/terminals.js.map +1 -0
  91. package/dist/shared-protocol/src/index.d.ts +3345 -3345
  92. package/dist/wire/src/crypto.d.ts +65 -0
  93. package/dist/wire/src/crypto.js +253 -0
  94. package/dist/wire/src/crypto.js.map +1 -0
  95. package/dist/wire/src/index.d.ts +8 -0
  96. package/dist/wire/src/index.js +9 -0
  97. package/dist/wire/src/index.js.map +1 -0
  98. package/dist/wire/src/model.d.ts +704 -0
  99. package/dist/wire/src/model.js +163 -0
  100. package/dist/wire/src/model.js.map +1 -0
  101. package/dist/wire/src/peer.d.ts +42 -0
  102. package/dist/wire/src/peer.js +143 -0
  103. package/dist/wire/src/peer.js.map +1 -0
  104. package/dist/wire/src/relay-client.d.ts +82 -0
  105. package/dist/wire/src/relay-client.js +259 -0
  106. package/dist/wire/src/relay-client.js.map +1 -0
  107. package/dist/wire/src/relay.d.ts +481 -0
  108. package/dist/wire/src/relay.js +129 -0
  109. package/dist/wire/src/relay.js.map +1 -0
  110. package/dist/wire/src/rpc.d.ts +4170 -0
  111. package/dist/wire/src/rpc.js +332 -0
  112. package/dist/wire/src/rpc.js.map +1 -0
  113. package/dist/wire/src/shell.d.ts +2 -0
  114. package/dist/wire/src/shell.js +62 -0
  115. package/dist/wire/src/shell.js.map +1 -0
  116. package/dist/wire/src/updates.d.ts +3325 -0
  117. package/dist/wire/src/updates.js +210 -0
  118. package/dist/wire/src/updates.js.map +1 -0
  119. package/package.json +8 -3
  120. package/src/commands/host.ts +283 -0
  121. package/src/commands/pair.ts +47 -0
  122. package/src/index.ts +73 -0
  123. package/src/utils/daemon.ts +4 -3
  124. package/dist/cli/src/commands/hook.d.ts +0 -6
  125. package/dist/cli/src/commands/hook.js +0 -120
  126. package/dist/cli/src/commands/hook.js.map +0 -1
  127. package/dist/cli/src/runtime/acp/agent-workspace-git.d.ts +0 -63
  128. package/dist/cli/src/runtime/acp/agent-workspace-git.js +0 -297
  129. package/dist/cli/src/runtime/acp/agent-workspace-git.js.map +0 -1
  130. package/dist/cli/src/runtime/acp-relay.d.ts +0 -23
  131. package/dist/cli/src/runtime/acp-relay.js +0 -73
  132. package/dist/cli/src/runtime/acp-relay.js.map +0 -1
  133. package/dist/cli/src/runtime/hook-permission-server.d.ts +0 -36
  134. package/dist/cli/src/runtime/hook-permission-server.js +0 -147
  135. package/dist/cli/src/runtime/hook-permission-server.js.map +0 -1
@@ -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?: "file" | "agent" | "skill" | undefined;
37
+ }, {
38
+ type: "resource_link";
39
+ name: string;
40
+ uri: string;
41
+ kind?: "file" | "agent" | "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?: "file" | "agent" | "skill" | undefined;
83
+ }, {
84
+ type: "resource_link";
85
+ name: string;
86
+ uri: string;
87
+ kind?: "file" | "agent" | "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?: "file" | "agent" | "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?: "file" | "agent" | "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: "add" | "update" | "delete";
147
+ movePath?: string | undefined;
148
+ }, {
149
+ path: string;
150
+ type: "patch";
151
+ diff: string;
152
+ change: "add" | "update" | "delete";
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" | "resume" | "stop" | "wait" | "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" | "resume" | "stop" | "wait" | "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: "finished" | "started";
255
+ }, {
256
+ type: "review";
257
+ phase: "finished" | "started";
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" | "completed" | "in_progress";
266
+ content: string;
267
+ priority: "low" | "medium" | "high";
268
+ }, {
269
+ status: "pending" | "completed" | "in_progress";
270
+ content: string;
271
+ priority?: "low" | "medium" | "high" | 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: "mode" | "other" | "model" | "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?: "mode" | "other" | "model" | "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?: "file" | "agent" | "skill" | undefined;
355
+ }, {
356
+ type: "resource_link";
357
+ name: string;
358
+ uri: string;
359
+ kind?: "file" | "agent" | "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?: "file" | "agent" | "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?: "file" | "agent" | "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?: "file" | "agent" | "skill" | undefined;
434
+ }, {
435
+ type: "resource_link";
436
+ name: string;
437
+ uri: string;
438
+ kind?: "file" | "agent" | "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?: "file" | "agent" | "skill" | undefined;
454
+ };
455
+ messageId: string;
456
+ sessionUpdate: "agent_message_chunk";
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?: "file" | "agent" | "skill" | undefined;
472
+ };
473
+ messageId: string;
474
+ sessionUpdate: "agent_message_chunk";
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?: "file" | "agent" | "skill" | undefined;
515
+ }, {
516
+ type: "resource_link";
517
+ name: string;
518
+ uri: string;
519
+ kind?: "file" | "agent" | "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?: "file" | "agent" | "skill" | undefined;
535
+ };
536
+ messageId: string;
537
+ sessionUpdate: "agent_thought_chunk";
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?: "file" | "agent" | "skill" | undefined;
553
+ };
554
+ messageId: string;
555
+ sessionUpdate: "agent_thought_chunk";
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?: "file" | "agent" | "skill" | undefined;
603
+ }, {
604
+ type: "resource_link";
605
+ name: string;
606
+ uri: string;
607
+ kind?: "file" | "agent" | "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?: "file" | "agent" | "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?: "file" | "agent" | "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: "add" | "update" | "delete";
667
+ movePath?: string | undefined;
668
+ }, {
669
+ path: string;
670
+ type: "patch";
671
+ diff: string;
672
+ change: "add" | "update" | "delete";
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" | "resume" | "stop" | "wait" | "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" | "resume" | "stop" | "wait" | "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: "finished" | "started";
768
+ }, {
769
+ type: "review";
770
+ phase: "finished" | "started";
771
+ }>]>>;
772
+ }, "strip", z.ZodTypeAny, {
773
+ status: "pending" | "completed" | "failed" | "in_progress";
774
+ kind: "search" | "other" | "read" | "edit" | "delete" | "move" | "execute" | "think" | "fetch";
775
+ title: string;
776
+ toolCallId: string;
777
+ sessionUpdate: "tool_call";
778
+ content?: ({
779
+ type: "content";
780
+ content: {
781
+ type: "text";
782
+ text: string;
783
+ } | {
784
+ type: "image";
785
+ mimeType: string;
786
+ data?: string | undefined;
787
+ uri?: string | undefined;
788
+ } | {
789
+ type: "resource_link";
790
+ name: string;
791
+ uri: string;
792
+ kind?: "file" | "agent" | "skill" | undefined;
793
+ };
794
+ } | {
795
+ path: string;
796
+ type: "diff";
797
+ newText: string;
798
+ oldText?: string | null | undefined;
799
+ } | {
800
+ path: string;
801
+ type: "patch";
802
+ diff: string;
803
+ change: "add" | "update" | "delete";
804
+ movePath?: string | undefined;
805
+ } | {
806
+ type: "terminal";
807
+ terminalId: string;
808
+ })[] | undefined;
809
+ detail?: {
810
+ type: "mcp";
811
+ tool: string;
812
+ server: string;
813
+ } | {
814
+ type: "subagent";
815
+ action: "message" | "spawn" | "resume" | "stop" | "wait" | "list";
816
+ model?: string | undefined;
817
+ task?: string | undefined;
818
+ agentType?: string | undefined;
819
+ } | {
820
+ type: "skill";
821
+ name: string;
822
+ description?: string | undefined;
823
+ } | {
824
+ type: "web_search";
825
+ query?: string | undefined;
826
+ } | {
827
+ type: "image_generation";
828
+ prompt?: string | undefined;
829
+ } | {
830
+ type: "compaction";
831
+ } | {
832
+ type: "review";
833
+ phase: "finished" | "started";
834
+ } | undefined;
835
+ rawInput?: unknown;
836
+ parentToolCallId?: string | undefined;
837
+ locations?: {
838
+ path: string;
839
+ line?: number | undefined;
840
+ }[] | undefined;
841
+ }, {
842
+ status: "pending" | "completed" | "failed" | "in_progress";
843
+ kind: "search" | "other" | "read" | "edit" | "delete" | "move" | "execute" | "think" | "fetch";
844
+ title: string;
845
+ toolCallId: string;
846
+ sessionUpdate: "tool_call";
847
+ content?: ({
848
+ type: "content";
849
+ content: {
850
+ type: "text";
851
+ text: string;
852
+ } | {
853
+ type: "image";
854
+ mimeType: string;
855
+ data?: string | undefined;
856
+ uri?: string | undefined;
857
+ } | {
858
+ type: "resource_link";
859
+ name: string;
860
+ uri: string;
861
+ kind?: "file" | "agent" | "skill" | undefined;
862
+ };
863
+ } | {
864
+ path: string;
865
+ type: "diff";
866
+ newText: string;
867
+ oldText?: string | null | undefined;
868
+ } | {
869
+ path: string;
870
+ type: "patch";
871
+ diff: string;
872
+ change: "add" | "update" | "delete";
873
+ movePath?: string | undefined;
874
+ } | {
875
+ type: "terminal";
876
+ terminalId: string;
877
+ })[] | undefined;
878
+ detail?: {
879
+ type: "mcp";
880
+ tool: string;
881
+ server: string;
882
+ } | {
883
+ type: "subagent";
884
+ model?: string | undefined;
885
+ action?: "message" | "spawn" | "resume" | "stop" | "wait" | "list" | undefined;
886
+ task?: string | undefined;
887
+ agentType?: string | undefined;
888
+ } | {
889
+ type: "skill";
890
+ name: string;
891
+ description?: string | undefined;
892
+ } | {
893
+ type: "web_search";
894
+ query?: string | undefined;
895
+ } | {
896
+ type: "image_generation";
897
+ prompt?: string | undefined;
898
+ } | {
899
+ type: "compaction";
900
+ } | {
901
+ type: "review";
902
+ phase: "finished" | "started";
903
+ } | undefined;
904
+ rawInput?: unknown;
905
+ parentToolCallId?: string | undefined;
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" | "resume" | "stop" | "wait" | "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" | "resume" | "stop" | "wait" | "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: "finished" | "started";
990
+ }, {
991
+ type: "review";
992
+ phase: "finished" | "started";
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?: "file" | "agent" | "skill" | undefined;
1032
+ }, {
1033
+ type: "resource_link";
1034
+ name: string;
1035
+ uri: string;
1036
+ kind?: "file" | "agent" | "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?: "file" | "agent" | "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?: "file" | "agent" | "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: "add" | "update" | "delete";
1096
+ movePath?: string | undefined;
1097
+ }, {
1098
+ path: string;
1099
+ type: "patch";
1100
+ diff: string;
1101
+ change: "add" | "update" | "delete";
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" | "completed" | "failed" | "in_progress" | undefined;
1120
+ content?: ({
1121
+ type: "content";
1122
+ content: {
1123
+ type: "text";
1124
+ text: string;
1125
+ } | {
1126
+ type: "image";
1127
+ mimeType: string;
1128
+ data?: string | undefined;
1129
+ uri?: string | undefined;
1130
+ } | {
1131
+ type: "resource_link";
1132
+ name: string;
1133
+ uri: string;
1134
+ kind?: "file" | "agent" | "skill" | undefined;
1135
+ };
1136
+ } | {
1137
+ path: string;
1138
+ type: "diff";
1139
+ newText: string;
1140
+ oldText?: string | null | undefined;
1141
+ } | {
1142
+ path: string;
1143
+ type: "patch";
1144
+ diff: string;
1145
+ change: "add" | "update" | "delete";
1146
+ movePath?: string | undefined;
1147
+ } | {
1148
+ type: "terminal";
1149
+ terminalId: string;
1150
+ })[] | undefined;
1151
+ title?: string | undefined;
1152
+ detail?: {
1153
+ type: "mcp";
1154
+ tool: string;
1155
+ server: string;
1156
+ } | {
1157
+ type: "subagent";
1158
+ action: "message" | "spawn" | "resume" | "stop" | "wait" | "list";
1159
+ model?: string | undefined;
1160
+ task?: string | undefined;
1161
+ agentType?: string | undefined;
1162
+ } | {
1163
+ type: "skill";
1164
+ name: string;
1165
+ description?: string | undefined;
1166
+ } | {
1167
+ type: "web_search";
1168
+ query?: string | undefined;
1169
+ } | {
1170
+ type: "image_generation";
1171
+ prompt?: string | undefined;
1172
+ } | {
1173
+ type: "compaction";
1174
+ } | {
1175
+ type: "review";
1176
+ phase: "finished" | "started";
1177
+ } | undefined;
1178
+ rawOutput?: unknown;
1179
+ parentToolCallId?: string | undefined;
1180
+ appendOutput?: string | undefined;
1181
+ }, {
1182
+ toolCallId: string;
1183
+ sessionUpdate: "tool_call_update";
1184
+ status?: "pending" | "completed" | "failed" | "in_progress" | undefined;
1185
+ content?: ({
1186
+ type: "content";
1187
+ content: {
1188
+ type: "text";
1189
+ text: string;
1190
+ } | {
1191
+ type: "image";
1192
+ mimeType: string;
1193
+ data?: string | undefined;
1194
+ uri?: string | undefined;
1195
+ } | {
1196
+ type: "resource_link";
1197
+ name: string;
1198
+ uri: string;
1199
+ kind?: "file" | "agent" | "skill" | undefined;
1200
+ };
1201
+ } | {
1202
+ path: string;
1203
+ type: "diff";
1204
+ newText: string;
1205
+ oldText?: string | null | undefined;
1206
+ } | {
1207
+ path: string;
1208
+ type: "patch";
1209
+ diff: string;
1210
+ change: "add" | "update" | "delete";
1211
+ movePath?: string | undefined;
1212
+ } | {
1213
+ type: "terminal";
1214
+ terminalId: string;
1215
+ })[] | undefined;
1216
+ title?: string | undefined;
1217
+ detail?: {
1218
+ type: "mcp";
1219
+ tool: string;
1220
+ server: string;
1221
+ } | {
1222
+ type: "subagent";
1223
+ model?: string | undefined;
1224
+ action?: "message" | "spawn" | "resume" | "stop" | "wait" | "list" | undefined;
1225
+ task?: string | undefined;
1226
+ agentType?: string | undefined;
1227
+ } | {
1228
+ type: "skill";
1229
+ name: string;
1230
+ description?: string | undefined;
1231
+ } | {
1232
+ type: "web_search";
1233
+ query?: string | undefined;
1234
+ } | {
1235
+ type: "image_generation";
1236
+ prompt?: string | undefined;
1237
+ } | {
1238
+ type: "compaction";
1239
+ } | {
1240
+ type: "review";
1241
+ phase: "finished" | "started";
1242
+ } | undefined;
1243
+ rawOutput?: unknown;
1244
+ parentToolCallId?: string | undefined;
1245
+ appendOutput?: string | undefined;
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" | "completed" | "in_progress";
1254
+ content: string;
1255
+ priority: "low" | "medium" | "high";
1256
+ }, {
1257
+ status: "pending" | "completed" | "in_progress";
1258
+ content: string;
1259
+ priority?: "low" | "medium" | "high" | undefined;
1260
+ }>, "many">;
1261
+ }, "strip", z.ZodTypeAny, {
1262
+ entries: {
1263
+ status: "pending" | "completed" | "in_progress";
1264
+ content: string;
1265
+ priority: "low" | "medium" | "high";
1266
+ }[];
1267
+ sessionUpdate: "plan";
1268
+ }, {
1269
+ entries: {
1270
+ status: "pending" | "completed" | "in_progress";
1271
+ content: string;
1272
+ priority?: "low" | "medium" | "high" | 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
+ contextWindow?: number | undefined;
1332
+ usedTokens?: number | undefined;
1333
+ }, {
1334
+ sessionUpdate: "usage_update";
1335
+ contextWindow?: number | undefined;
1336
+ usedTokens?: 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
+ role: "user" | "agent" | "thought";
1344
+ messageId: string;
1345
+ sessionUpdate: "ls_message_done";
1346
+ parentToolCallId?: string | undefined;
1347
+ }, {
1348
+ role: "user" | "agent" | "thought";
1349
+ messageId: string;
1350
+ sessionUpdate: "ls_message_done";
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: "mode" | "other" | "model" | "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?: "mode" | "other" | "model" | "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: "mode" | "other" | "model" | "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?: "mode" | "other" | "model" | "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
+ turnId?: string | undefined;
1446
+ parentToolCallId?: string | undefined;
1447
+ stopReason?: "error" | "cancelled" | "end_turn" | "max_tokens" | "refusal" | undefined;
1448
+ }, {
1449
+ state: "started" | "ended";
1450
+ sessionUpdate: "ls_turn";
1451
+ turnId?: string | undefined;
1452
+ parentToolCallId?: string | undefined;
1453
+ stopReason?: "error" | "cancelled" | "end_turn" | "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
+ name: string;
1466
+ kind: "allow_once" | "allow_always" | "reject_once" | "reject_always";
1467
+ optionId: string;
1468
+ }, {
1469
+ name: string;
1470
+ kind: "allow_once" | "allow_always" | "reject_once" | "reject_always";
1471
+ optionId: string;
1472
+ }>, "many">;
1473
+ }, "strip", z.ZodTypeAny, {
1474
+ options: {
1475
+ name: string;
1476
+ kind: "allow_once" | "allow_always" | "reject_once" | "reject_always";
1477
+ optionId: string;
1478
+ }[];
1479
+ requestId: string;
1480
+ title: string;
1481
+ sessionUpdate: "ls_permission";
1482
+ detail?: string | undefined;
1483
+ toolCallId?: string | undefined;
1484
+ }, {
1485
+ options: {
1486
+ name: string;
1487
+ kind: "allow_once" | "allow_always" | "reject_once" | "reject_always";
1488
+ optionId: string;
1489
+ }[];
1490
+ requestId: string;
1491
+ title: string;
1492
+ sessionUpdate: "ls_permission";
1493
+ detail?: string | undefined;
1494
+ toolCallId?: 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
+ sessionUpdate: "ls_driver";
1513
+ driver: "none" | "desktop" | "remote";
1514
+ deviceId?: string | undefined;
1515
+ }, {
1516
+ sessionUpdate: "ls_driver";
1517
+ driver: "none" | "desktop" | "remote";
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" | "error" | "running" | "waiting" | "offline";
1524
+ sessionUpdate: "ls_status";
1525
+ }, {
1526
+ state: "idle" | "error" | "running" | "waiting" | "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?: "file" | "agent" | "skill" | undefined;
1589
+ }, {
1590
+ type: "resource_link";
1591
+ name: string;
1592
+ uri: string;
1593
+ kind?: "file" | "agent" | "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?: "file" | "agent" | "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?: "file" | "agent" | "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?: "file" | "agent" | "skill" | undefined;
1668
+ }, {
1669
+ type: "resource_link";
1670
+ name: string;
1671
+ uri: string;
1672
+ kind?: "file" | "agent" | "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?: "file" | "agent" | "skill" | undefined;
1688
+ };
1689
+ messageId: string;
1690
+ sessionUpdate: "agent_message_chunk";
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?: "file" | "agent" | "skill" | undefined;
1706
+ };
1707
+ messageId: string;
1708
+ sessionUpdate: "agent_message_chunk";
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?: "file" | "agent" | "skill" | undefined;
1749
+ }, {
1750
+ type: "resource_link";
1751
+ name: string;
1752
+ uri: string;
1753
+ kind?: "file" | "agent" | "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?: "file" | "agent" | "skill" | undefined;
1769
+ };
1770
+ messageId: string;
1771
+ sessionUpdate: "agent_thought_chunk";
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?: "file" | "agent" | "skill" | undefined;
1787
+ };
1788
+ messageId: string;
1789
+ sessionUpdate: "agent_thought_chunk";
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?: "file" | "agent" | "skill" | undefined;
1837
+ }, {
1838
+ type: "resource_link";
1839
+ name: string;
1840
+ uri: string;
1841
+ kind?: "file" | "agent" | "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?: "file" | "agent" | "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?: "file" | "agent" | "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: "add" | "update" | "delete";
1901
+ movePath?: string | undefined;
1902
+ }, {
1903
+ path: string;
1904
+ type: "patch";
1905
+ diff: string;
1906
+ change: "add" | "update" | "delete";
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" | "resume" | "stop" | "wait" | "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" | "resume" | "stop" | "wait" | "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: "finished" | "started";
2002
+ }, {
2003
+ type: "review";
2004
+ phase: "finished" | "started";
2005
+ }>]>>;
2006
+ }, "strip", z.ZodTypeAny, {
2007
+ status: "pending" | "completed" | "failed" | "in_progress";
2008
+ kind: "search" | "other" | "read" | "edit" | "delete" | "move" | "execute" | "think" | "fetch";
2009
+ title: string;
2010
+ toolCallId: string;
2011
+ sessionUpdate: "tool_call";
2012
+ content?: ({
2013
+ type: "content";
2014
+ content: {
2015
+ type: "text";
2016
+ text: string;
2017
+ } | {
2018
+ type: "image";
2019
+ mimeType: string;
2020
+ data?: string | undefined;
2021
+ uri?: string | undefined;
2022
+ } | {
2023
+ type: "resource_link";
2024
+ name: string;
2025
+ uri: string;
2026
+ kind?: "file" | "agent" | "skill" | undefined;
2027
+ };
2028
+ } | {
2029
+ path: string;
2030
+ type: "diff";
2031
+ newText: string;
2032
+ oldText?: string | null | undefined;
2033
+ } | {
2034
+ path: string;
2035
+ type: "patch";
2036
+ diff: string;
2037
+ change: "add" | "update" | "delete";
2038
+ movePath?: string | undefined;
2039
+ } | {
2040
+ type: "terminal";
2041
+ terminalId: string;
2042
+ })[] | undefined;
2043
+ detail?: {
2044
+ type: "mcp";
2045
+ tool: string;
2046
+ server: string;
2047
+ } | {
2048
+ type: "subagent";
2049
+ action: "message" | "spawn" | "resume" | "stop" | "wait" | "list";
2050
+ model?: string | undefined;
2051
+ task?: string | undefined;
2052
+ agentType?: string | undefined;
2053
+ } | {
2054
+ type: "skill";
2055
+ name: string;
2056
+ description?: string | undefined;
2057
+ } | {
2058
+ type: "web_search";
2059
+ query?: string | undefined;
2060
+ } | {
2061
+ type: "image_generation";
2062
+ prompt?: string | undefined;
2063
+ } | {
2064
+ type: "compaction";
2065
+ } | {
2066
+ type: "review";
2067
+ phase: "finished" | "started";
2068
+ } | undefined;
2069
+ rawInput?: unknown;
2070
+ parentToolCallId?: string | undefined;
2071
+ locations?: {
2072
+ path: string;
2073
+ line?: number | undefined;
2074
+ }[] | undefined;
2075
+ }, {
2076
+ status: "pending" | "completed" | "failed" | "in_progress";
2077
+ kind: "search" | "other" | "read" | "edit" | "delete" | "move" | "execute" | "think" | "fetch";
2078
+ title: string;
2079
+ toolCallId: string;
2080
+ sessionUpdate: "tool_call";
2081
+ content?: ({
2082
+ type: "content";
2083
+ content: {
2084
+ type: "text";
2085
+ text: string;
2086
+ } | {
2087
+ type: "image";
2088
+ mimeType: string;
2089
+ data?: string | undefined;
2090
+ uri?: string | undefined;
2091
+ } | {
2092
+ type: "resource_link";
2093
+ name: string;
2094
+ uri: string;
2095
+ kind?: "file" | "agent" | "skill" | undefined;
2096
+ };
2097
+ } | {
2098
+ path: string;
2099
+ type: "diff";
2100
+ newText: string;
2101
+ oldText?: string | null | undefined;
2102
+ } | {
2103
+ path: string;
2104
+ type: "patch";
2105
+ diff: string;
2106
+ change: "add" | "update" | "delete";
2107
+ movePath?: string | undefined;
2108
+ } | {
2109
+ type: "terminal";
2110
+ terminalId: string;
2111
+ })[] | undefined;
2112
+ detail?: {
2113
+ type: "mcp";
2114
+ tool: string;
2115
+ server: string;
2116
+ } | {
2117
+ type: "subagent";
2118
+ model?: string | undefined;
2119
+ action?: "message" | "spawn" | "resume" | "stop" | "wait" | "list" | undefined;
2120
+ task?: string | undefined;
2121
+ agentType?: string | undefined;
2122
+ } | {
2123
+ type: "skill";
2124
+ name: string;
2125
+ description?: string | undefined;
2126
+ } | {
2127
+ type: "web_search";
2128
+ query?: string | undefined;
2129
+ } | {
2130
+ type: "image_generation";
2131
+ prompt?: string | undefined;
2132
+ } | {
2133
+ type: "compaction";
2134
+ } | {
2135
+ type: "review";
2136
+ phase: "finished" | "started";
2137
+ } | undefined;
2138
+ rawInput?: unknown;
2139
+ parentToolCallId?: string | undefined;
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" | "resume" | "stop" | "wait" | "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" | "resume" | "stop" | "wait" | "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: "finished" | "started";
2224
+ }, {
2225
+ type: "review";
2226
+ phase: "finished" | "started";
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?: "file" | "agent" | "skill" | undefined;
2266
+ }, {
2267
+ type: "resource_link";
2268
+ name: string;
2269
+ uri: string;
2270
+ kind?: "file" | "agent" | "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?: "file" | "agent" | "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?: "file" | "agent" | "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: "add" | "update" | "delete";
2330
+ movePath?: string | undefined;
2331
+ }, {
2332
+ path: string;
2333
+ type: "patch";
2334
+ diff: string;
2335
+ change: "add" | "update" | "delete";
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" | "completed" | "failed" | "in_progress" | undefined;
2354
+ content?: ({
2355
+ type: "content";
2356
+ content: {
2357
+ type: "text";
2358
+ text: string;
2359
+ } | {
2360
+ type: "image";
2361
+ mimeType: string;
2362
+ data?: string | undefined;
2363
+ uri?: string | undefined;
2364
+ } | {
2365
+ type: "resource_link";
2366
+ name: string;
2367
+ uri: string;
2368
+ kind?: "file" | "agent" | "skill" | undefined;
2369
+ };
2370
+ } | {
2371
+ path: string;
2372
+ type: "diff";
2373
+ newText: string;
2374
+ oldText?: string | null | undefined;
2375
+ } | {
2376
+ path: string;
2377
+ type: "patch";
2378
+ diff: string;
2379
+ change: "add" | "update" | "delete";
2380
+ movePath?: string | undefined;
2381
+ } | {
2382
+ type: "terminal";
2383
+ terminalId: string;
2384
+ })[] | undefined;
2385
+ title?: string | undefined;
2386
+ detail?: {
2387
+ type: "mcp";
2388
+ tool: string;
2389
+ server: string;
2390
+ } | {
2391
+ type: "subagent";
2392
+ action: "message" | "spawn" | "resume" | "stop" | "wait" | "list";
2393
+ model?: string | undefined;
2394
+ task?: string | undefined;
2395
+ agentType?: string | undefined;
2396
+ } | {
2397
+ type: "skill";
2398
+ name: string;
2399
+ description?: string | undefined;
2400
+ } | {
2401
+ type: "web_search";
2402
+ query?: string | undefined;
2403
+ } | {
2404
+ type: "image_generation";
2405
+ prompt?: string | undefined;
2406
+ } | {
2407
+ type: "compaction";
2408
+ } | {
2409
+ type: "review";
2410
+ phase: "finished" | "started";
2411
+ } | undefined;
2412
+ rawOutput?: unknown;
2413
+ parentToolCallId?: string | undefined;
2414
+ appendOutput?: string | undefined;
2415
+ }, {
2416
+ toolCallId: string;
2417
+ sessionUpdate: "tool_call_update";
2418
+ status?: "pending" | "completed" | "failed" | "in_progress" | undefined;
2419
+ content?: ({
2420
+ type: "content";
2421
+ content: {
2422
+ type: "text";
2423
+ text: string;
2424
+ } | {
2425
+ type: "image";
2426
+ mimeType: string;
2427
+ data?: string | undefined;
2428
+ uri?: string | undefined;
2429
+ } | {
2430
+ type: "resource_link";
2431
+ name: string;
2432
+ uri: string;
2433
+ kind?: "file" | "agent" | "skill" | undefined;
2434
+ };
2435
+ } | {
2436
+ path: string;
2437
+ type: "diff";
2438
+ newText: string;
2439
+ oldText?: string | null | undefined;
2440
+ } | {
2441
+ path: string;
2442
+ type: "patch";
2443
+ diff: string;
2444
+ change: "add" | "update" | "delete";
2445
+ movePath?: string | undefined;
2446
+ } | {
2447
+ type: "terminal";
2448
+ terminalId: string;
2449
+ })[] | undefined;
2450
+ title?: string | undefined;
2451
+ detail?: {
2452
+ type: "mcp";
2453
+ tool: string;
2454
+ server: string;
2455
+ } | {
2456
+ type: "subagent";
2457
+ model?: string | undefined;
2458
+ action?: "message" | "spawn" | "resume" | "stop" | "wait" | "list" | undefined;
2459
+ task?: string | undefined;
2460
+ agentType?: string | undefined;
2461
+ } | {
2462
+ type: "skill";
2463
+ name: string;
2464
+ description?: string | undefined;
2465
+ } | {
2466
+ type: "web_search";
2467
+ query?: string | undefined;
2468
+ } | {
2469
+ type: "image_generation";
2470
+ prompt?: string | undefined;
2471
+ } | {
2472
+ type: "compaction";
2473
+ } | {
2474
+ type: "review";
2475
+ phase: "finished" | "started";
2476
+ } | undefined;
2477
+ rawOutput?: unknown;
2478
+ parentToolCallId?: string | undefined;
2479
+ appendOutput?: string | undefined;
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" | "completed" | "in_progress";
2488
+ content: string;
2489
+ priority: "low" | "medium" | "high";
2490
+ }, {
2491
+ status: "pending" | "completed" | "in_progress";
2492
+ content: string;
2493
+ priority?: "low" | "medium" | "high" | undefined;
2494
+ }>, "many">;
2495
+ }, "strip", z.ZodTypeAny, {
2496
+ entries: {
2497
+ status: "pending" | "completed" | "in_progress";
2498
+ content: string;
2499
+ priority: "low" | "medium" | "high";
2500
+ }[];
2501
+ sessionUpdate: "plan";
2502
+ }, {
2503
+ entries: {
2504
+ status: "pending" | "completed" | "in_progress";
2505
+ content: string;
2506
+ priority?: "low" | "medium" | "high" | 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
+ contextWindow?: number | undefined;
2566
+ usedTokens?: number | undefined;
2567
+ }, {
2568
+ sessionUpdate: "usage_update";
2569
+ contextWindow?: number | undefined;
2570
+ usedTokens?: 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
+ role: "user" | "agent" | "thought";
2578
+ messageId: string;
2579
+ sessionUpdate: "ls_message_done";
2580
+ parentToolCallId?: string | undefined;
2581
+ }, {
2582
+ role: "user" | "agent" | "thought";
2583
+ messageId: string;
2584
+ sessionUpdate: "ls_message_done";
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: "mode" | "other" | "model" | "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?: "mode" | "other" | "model" | "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: "mode" | "other" | "model" | "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?: "mode" | "other" | "model" | "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
+ turnId?: string | undefined;
2680
+ parentToolCallId?: string | undefined;
2681
+ stopReason?: "error" | "cancelled" | "end_turn" | "max_tokens" | "refusal" | undefined;
2682
+ }, {
2683
+ state: "started" | "ended";
2684
+ sessionUpdate: "ls_turn";
2685
+ turnId?: string | undefined;
2686
+ parentToolCallId?: string | undefined;
2687
+ stopReason?: "error" | "cancelled" | "end_turn" | "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
+ name: string;
2700
+ kind: "allow_once" | "allow_always" | "reject_once" | "reject_always";
2701
+ optionId: string;
2702
+ }, {
2703
+ name: string;
2704
+ kind: "allow_once" | "allow_always" | "reject_once" | "reject_always";
2705
+ optionId: string;
2706
+ }>, "many">;
2707
+ }, "strip", z.ZodTypeAny, {
2708
+ options: {
2709
+ name: string;
2710
+ kind: "allow_once" | "allow_always" | "reject_once" | "reject_always";
2711
+ optionId: string;
2712
+ }[];
2713
+ requestId: string;
2714
+ title: string;
2715
+ sessionUpdate: "ls_permission";
2716
+ detail?: string | undefined;
2717
+ toolCallId?: string | undefined;
2718
+ }, {
2719
+ options: {
2720
+ name: string;
2721
+ kind: "allow_once" | "allow_always" | "reject_once" | "reject_always";
2722
+ optionId: string;
2723
+ }[];
2724
+ requestId: string;
2725
+ title: string;
2726
+ sessionUpdate: "ls_permission";
2727
+ detail?: string | undefined;
2728
+ toolCallId?: 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
+ sessionUpdate: "ls_driver";
2747
+ driver: "none" | "desktop" | "remote";
2748
+ deviceId?: string | undefined;
2749
+ }, {
2750
+ sessionUpdate: "ls_driver";
2751
+ driver: "none" | "desktop" | "remote";
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" | "error" | "running" | "waiting" | "offline";
2758
+ sessionUpdate: "ls_status";
2759
+ }, {
2760
+ state: "idle" | "error" | "running" | "waiting" | "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
+ sessionId: string;
2780
+ seq: number;
2781
+ ts: number;
2782
+ update: {
2783
+ content: {
2784
+ type: "text";
2785
+ text: string;
2786
+ } | {
2787
+ type: "image";
2788
+ mimeType: string;
2789
+ data?: string | undefined;
2790
+ uri?: string | undefined;
2791
+ } | {
2792
+ type: "resource_link";
2793
+ name: string;
2794
+ uri: string;
2795
+ kind?: "file" | "agent" | "skill" | undefined;
2796
+ };
2797
+ sessionUpdate: "user_message_chunk";
2798
+ messageId?: string | undefined;
2799
+ } | {
2800
+ content: {
2801
+ type: "text";
2802
+ text: string;
2803
+ } | {
2804
+ type: "image";
2805
+ mimeType: string;
2806
+ data?: string | undefined;
2807
+ uri?: string | undefined;
2808
+ } | {
2809
+ type: "resource_link";
2810
+ name: string;
2811
+ uri: string;
2812
+ kind?: "file" | "agent" | "skill" | undefined;
2813
+ };
2814
+ messageId: string;
2815
+ sessionUpdate: "agent_message_chunk";
2816
+ parentToolCallId?: string | undefined;
2817
+ } | {
2818
+ content: {
2819
+ type: "text";
2820
+ text: string;
2821
+ } | {
2822
+ type: "image";
2823
+ mimeType: string;
2824
+ data?: string | undefined;
2825
+ uri?: string | undefined;
2826
+ } | {
2827
+ type: "resource_link";
2828
+ name: string;
2829
+ uri: string;
2830
+ kind?: "file" | "agent" | "skill" | undefined;
2831
+ };
2832
+ messageId: string;
2833
+ sessionUpdate: "agent_thought_chunk";
2834
+ parentToolCallId?: string | undefined;
2835
+ } | {
2836
+ status: "pending" | "completed" | "failed" | "in_progress";
2837
+ kind: "search" | "other" | "read" | "edit" | "delete" | "move" | "execute" | "think" | "fetch";
2838
+ title: string;
2839
+ toolCallId: string;
2840
+ sessionUpdate: "tool_call";
2841
+ content?: ({
2842
+ type: "content";
2843
+ content: {
2844
+ type: "text";
2845
+ text: string;
2846
+ } | {
2847
+ type: "image";
2848
+ mimeType: string;
2849
+ data?: string | undefined;
2850
+ uri?: string | undefined;
2851
+ } | {
2852
+ type: "resource_link";
2853
+ name: string;
2854
+ uri: string;
2855
+ kind?: "file" | "agent" | "skill" | undefined;
2856
+ };
2857
+ } | {
2858
+ path: string;
2859
+ type: "diff";
2860
+ newText: string;
2861
+ oldText?: string | null | undefined;
2862
+ } | {
2863
+ path: string;
2864
+ type: "patch";
2865
+ diff: string;
2866
+ change: "add" | "update" | "delete";
2867
+ movePath?: string | undefined;
2868
+ } | {
2869
+ type: "terminal";
2870
+ terminalId: string;
2871
+ })[] | undefined;
2872
+ detail?: {
2873
+ type: "mcp";
2874
+ tool: string;
2875
+ server: string;
2876
+ } | {
2877
+ type: "subagent";
2878
+ action: "message" | "spawn" | "resume" | "stop" | "wait" | "list";
2879
+ model?: string | undefined;
2880
+ task?: string | undefined;
2881
+ agentType?: string | undefined;
2882
+ } | {
2883
+ type: "skill";
2884
+ name: string;
2885
+ description?: string | undefined;
2886
+ } | {
2887
+ type: "web_search";
2888
+ query?: string | undefined;
2889
+ } | {
2890
+ type: "image_generation";
2891
+ prompt?: string | undefined;
2892
+ } | {
2893
+ type: "compaction";
2894
+ } | {
2895
+ type: "review";
2896
+ phase: "finished" | "started";
2897
+ } | undefined;
2898
+ rawInput?: unknown;
2899
+ parentToolCallId?: string | undefined;
2900
+ locations?: {
2901
+ path: string;
2902
+ line?: number | undefined;
2903
+ }[] | undefined;
2904
+ } | {
2905
+ toolCallId: string;
2906
+ sessionUpdate: "tool_call_update";
2907
+ status?: "pending" | "completed" | "failed" | "in_progress" | undefined;
2908
+ content?: ({
2909
+ type: "content";
2910
+ content: {
2911
+ type: "text";
2912
+ text: string;
2913
+ } | {
2914
+ type: "image";
2915
+ mimeType: string;
2916
+ data?: string | undefined;
2917
+ uri?: string | undefined;
2918
+ } | {
2919
+ type: "resource_link";
2920
+ name: string;
2921
+ uri: string;
2922
+ kind?: "file" | "agent" | "skill" | undefined;
2923
+ };
2924
+ } | {
2925
+ path: string;
2926
+ type: "diff";
2927
+ newText: string;
2928
+ oldText?: string | null | undefined;
2929
+ } | {
2930
+ path: string;
2931
+ type: "patch";
2932
+ diff: string;
2933
+ change: "add" | "update" | "delete";
2934
+ movePath?: string | undefined;
2935
+ } | {
2936
+ type: "terminal";
2937
+ terminalId: string;
2938
+ })[] | undefined;
2939
+ title?: string | undefined;
2940
+ detail?: {
2941
+ type: "mcp";
2942
+ tool: string;
2943
+ server: string;
2944
+ } | {
2945
+ type: "subagent";
2946
+ action: "message" | "spawn" | "resume" | "stop" | "wait" | "list";
2947
+ model?: string | undefined;
2948
+ task?: string | undefined;
2949
+ agentType?: string | undefined;
2950
+ } | {
2951
+ type: "skill";
2952
+ name: string;
2953
+ description?: string | undefined;
2954
+ } | {
2955
+ type: "web_search";
2956
+ query?: string | undefined;
2957
+ } | {
2958
+ type: "image_generation";
2959
+ prompt?: string | undefined;
2960
+ } | {
2961
+ type: "compaction";
2962
+ } | {
2963
+ type: "review";
2964
+ phase: "finished" | "started";
2965
+ } | undefined;
2966
+ rawOutput?: unknown;
2967
+ parentToolCallId?: string | undefined;
2968
+ appendOutput?: string | undefined;
2969
+ } | {
2970
+ entries: {
2971
+ status: "pending" | "completed" | "in_progress";
2972
+ content: string;
2973
+ priority: "low" | "medium" | "high";
2974
+ }[];
2975
+ sessionUpdate: "plan";
2976
+ } | {
2977
+ sessionUpdate: "available_commands_update";
2978
+ availableCommands: {
2979
+ name: string;
2980
+ description: string;
2981
+ hint?: string | undefined;
2982
+ }[];
2983
+ } | {
2984
+ sessionUpdate: "current_mode_update";
2985
+ currentModeId: string;
2986
+ } | {
2987
+ sessionUpdate: "session_info_update";
2988
+ title?: string | undefined;
2989
+ model?: string | undefined;
2990
+ } | {
2991
+ sessionUpdate: "usage_update";
2992
+ contextWindow?: number | undefined;
2993
+ usedTokens?: number | undefined;
2994
+ } | {
2995
+ role: "user" | "agent" | "thought";
2996
+ messageId: string;
2997
+ sessionUpdate: "ls_message_done";
2998
+ parentToolCallId?: string | undefined;
2999
+ } | {
3000
+ options: {
3001
+ values: {
3002
+ value: string;
3003
+ name: string;
3004
+ description?: string | undefined;
3005
+ }[];
3006
+ id: string;
3007
+ name: string;
3008
+ category: "mode" | "other" | "model" | "effort";
3009
+ current: string;
3010
+ }[];
3011
+ sessionUpdate: "ls_config";
3012
+ } | {
3013
+ title: string;
3014
+ sessionUpdate: "ls_notice";
3015
+ level: "info" | "warning";
3016
+ detail?: string | undefined;
3017
+ } | {
3018
+ state: "started" | "ended";
3019
+ sessionUpdate: "ls_turn";
3020
+ turnId?: string | undefined;
3021
+ parentToolCallId?: string | undefined;
3022
+ stopReason?: "error" | "cancelled" | "end_turn" | "max_tokens" | "refusal" | undefined;
3023
+ } | {
3024
+ options: {
3025
+ name: string;
3026
+ kind: "allow_once" | "allow_always" | "reject_once" | "reject_always";
3027
+ optionId: string;
3028
+ }[];
3029
+ requestId: string;
3030
+ title: string;
3031
+ sessionUpdate: "ls_permission";
3032
+ detail?: string | undefined;
3033
+ toolCallId?: string | undefined;
3034
+ } | {
3035
+ requestId: string;
3036
+ sessionUpdate: "ls_permission_resolved";
3037
+ optionId?: string | undefined;
3038
+ } | {
3039
+ sessionUpdate: "ls_driver";
3040
+ driver: "none" | "desktop" | "remote";
3041
+ deviceId?: string | undefined;
3042
+ } | {
3043
+ state: "idle" | "error" | "running" | "waiting" | "offline";
3044
+ sessionUpdate: "ls_status";
3045
+ } | {
3046
+ code: string;
3047
+ message: string;
3048
+ sessionUpdate: "ls_error";
3049
+ hint?: string | undefined;
3050
+ };
3051
+ }, {
3052
+ sessionId: string;
3053
+ seq: number;
3054
+ ts: number;
3055
+ update: {
3056
+ content: {
3057
+ type: "text";
3058
+ text: string;
3059
+ } | {
3060
+ type: "image";
3061
+ mimeType: string;
3062
+ data?: string | undefined;
3063
+ uri?: string | undefined;
3064
+ } | {
3065
+ type: "resource_link";
3066
+ name: string;
3067
+ uri: string;
3068
+ kind?: "file" | "agent" | "skill" | undefined;
3069
+ };
3070
+ sessionUpdate: "user_message_chunk";
3071
+ messageId?: string | undefined;
3072
+ } | {
3073
+ content: {
3074
+ type: "text";
3075
+ text: string;
3076
+ } | {
3077
+ type: "image";
3078
+ mimeType: string;
3079
+ data?: string | undefined;
3080
+ uri?: string | undefined;
3081
+ } | {
3082
+ type: "resource_link";
3083
+ name: string;
3084
+ uri: string;
3085
+ kind?: "file" | "agent" | "skill" | undefined;
3086
+ };
3087
+ messageId: string;
3088
+ sessionUpdate: "agent_message_chunk";
3089
+ parentToolCallId?: string | undefined;
3090
+ } | {
3091
+ content: {
3092
+ type: "text";
3093
+ text: string;
3094
+ } | {
3095
+ type: "image";
3096
+ mimeType: string;
3097
+ data?: string | undefined;
3098
+ uri?: string | undefined;
3099
+ } | {
3100
+ type: "resource_link";
3101
+ name: string;
3102
+ uri: string;
3103
+ kind?: "file" | "agent" | "skill" | undefined;
3104
+ };
3105
+ messageId: string;
3106
+ sessionUpdate: "agent_thought_chunk";
3107
+ parentToolCallId?: string | undefined;
3108
+ } | {
3109
+ status: "pending" | "completed" | "failed" | "in_progress";
3110
+ kind: "search" | "other" | "read" | "edit" | "delete" | "move" | "execute" | "think" | "fetch";
3111
+ title: string;
3112
+ toolCallId: string;
3113
+ sessionUpdate: "tool_call";
3114
+ content?: ({
3115
+ type: "content";
3116
+ content: {
3117
+ type: "text";
3118
+ text: string;
3119
+ } | {
3120
+ type: "image";
3121
+ mimeType: string;
3122
+ data?: string | undefined;
3123
+ uri?: string | undefined;
3124
+ } | {
3125
+ type: "resource_link";
3126
+ name: string;
3127
+ uri: string;
3128
+ kind?: "file" | "agent" | "skill" | undefined;
3129
+ };
3130
+ } | {
3131
+ path: string;
3132
+ type: "diff";
3133
+ newText: string;
3134
+ oldText?: string | null | undefined;
3135
+ } | {
3136
+ path: string;
3137
+ type: "patch";
3138
+ diff: string;
3139
+ change: "add" | "update" | "delete";
3140
+ movePath?: string | undefined;
3141
+ } | {
3142
+ type: "terminal";
3143
+ terminalId: string;
3144
+ })[] | undefined;
3145
+ detail?: {
3146
+ type: "mcp";
3147
+ tool: string;
3148
+ server: string;
3149
+ } | {
3150
+ type: "subagent";
3151
+ model?: string | undefined;
3152
+ action?: "message" | "spawn" | "resume" | "stop" | "wait" | "list" | undefined;
3153
+ task?: string | undefined;
3154
+ agentType?: string | undefined;
3155
+ } | {
3156
+ type: "skill";
3157
+ name: string;
3158
+ description?: string | undefined;
3159
+ } | {
3160
+ type: "web_search";
3161
+ query?: string | undefined;
3162
+ } | {
3163
+ type: "image_generation";
3164
+ prompt?: string | undefined;
3165
+ } | {
3166
+ type: "compaction";
3167
+ } | {
3168
+ type: "review";
3169
+ phase: "finished" | "started";
3170
+ } | undefined;
3171
+ rawInput?: unknown;
3172
+ parentToolCallId?: string | undefined;
3173
+ locations?: {
3174
+ path: string;
3175
+ line?: number | undefined;
3176
+ }[] | undefined;
3177
+ } | {
3178
+ toolCallId: string;
3179
+ sessionUpdate: "tool_call_update";
3180
+ status?: "pending" | "completed" | "failed" | "in_progress" | undefined;
3181
+ content?: ({
3182
+ type: "content";
3183
+ content: {
3184
+ type: "text";
3185
+ text: string;
3186
+ } | {
3187
+ type: "image";
3188
+ mimeType: string;
3189
+ data?: string | undefined;
3190
+ uri?: string | undefined;
3191
+ } | {
3192
+ type: "resource_link";
3193
+ name: string;
3194
+ uri: string;
3195
+ kind?: "file" | "agent" | "skill" | undefined;
3196
+ };
3197
+ } | {
3198
+ path: string;
3199
+ type: "diff";
3200
+ newText: string;
3201
+ oldText?: string | null | undefined;
3202
+ } | {
3203
+ path: string;
3204
+ type: "patch";
3205
+ diff: string;
3206
+ change: "add" | "update" | "delete";
3207
+ movePath?: string | undefined;
3208
+ } | {
3209
+ type: "terminal";
3210
+ terminalId: string;
3211
+ })[] | undefined;
3212
+ title?: string | undefined;
3213
+ detail?: {
3214
+ type: "mcp";
3215
+ tool: string;
3216
+ server: string;
3217
+ } | {
3218
+ type: "subagent";
3219
+ model?: string | undefined;
3220
+ action?: "message" | "spawn" | "resume" | "stop" | "wait" | "list" | undefined;
3221
+ task?: string | undefined;
3222
+ agentType?: string | undefined;
3223
+ } | {
3224
+ type: "skill";
3225
+ name: string;
3226
+ description?: string | undefined;
3227
+ } | {
3228
+ type: "web_search";
3229
+ query?: string | undefined;
3230
+ } | {
3231
+ type: "image_generation";
3232
+ prompt?: string | undefined;
3233
+ } | {
3234
+ type: "compaction";
3235
+ } | {
3236
+ type: "review";
3237
+ phase: "finished" | "started";
3238
+ } | undefined;
3239
+ rawOutput?: unknown;
3240
+ parentToolCallId?: string | undefined;
3241
+ appendOutput?: string | undefined;
3242
+ } | {
3243
+ entries: {
3244
+ status: "pending" | "completed" | "in_progress";
3245
+ content: string;
3246
+ priority?: "low" | "medium" | "high" | undefined;
3247
+ }[];
3248
+ sessionUpdate: "plan";
3249
+ } | {
3250
+ sessionUpdate: "available_commands_update";
3251
+ availableCommands: {
3252
+ name: string;
3253
+ description: string;
3254
+ hint?: string | undefined;
3255
+ }[];
3256
+ } | {
3257
+ sessionUpdate: "current_mode_update";
3258
+ currentModeId: string;
3259
+ } | {
3260
+ sessionUpdate: "session_info_update";
3261
+ title?: string | undefined;
3262
+ model?: string | undefined;
3263
+ } | {
3264
+ sessionUpdate: "usage_update";
3265
+ contextWindow?: number | undefined;
3266
+ usedTokens?: number | undefined;
3267
+ } | {
3268
+ role: "user" | "agent" | "thought";
3269
+ messageId: string;
3270
+ sessionUpdate: "ls_message_done";
3271
+ parentToolCallId?: string | undefined;
3272
+ } | {
3273
+ options: {
3274
+ values: {
3275
+ value: string;
3276
+ name: string;
3277
+ description?: string | undefined;
3278
+ }[];
3279
+ id: string;
3280
+ name: string;
3281
+ current: string;
3282
+ category?: "mode" | "other" | "model" | "effort" | undefined;
3283
+ }[];
3284
+ sessionUpdate: "ls_config";
3285
+ } | {
3286
+ title: string;
3287
+ sessionUpdate: "ls_notice";
3288
+ level: "info" | "warning";
3289
+ detail?: string | undefined;
3290
+ } | {
3291
+ state: "started" | "ended";
3292
+ sessionUpdate: "ls_turn";
3293
+ turnId?: string | undefined;
3294
+ parentToolCallId?: string | undefined;
3295
+ stopReason?: "error" | "cancelled" | "end_turn" | "max_tokens" | "refusal" | undefined;
3296
+ } | {
3297
+ options: {
3298
+ name: string;
3299
+ kind: "allow_once" | "allow_always" | "reject_once" | "reject_always";
3300
+ optionId: string;
3301
+ }[];
3302
+ requestId: string;
3303
+ title: string;
3304
+ sessionUpdate: "ls_permission";
3305
+ detail?: string | undefined;
3306
+ toolCallId?: string | undefined;
3307
+ } | {
3308
+ requestId: string;
3309
+ sessionUpdate: "ls_permission_resolved";
3310
+ optionId?: string | undefined;
3311
+ } | {
3312
+ sessionUpdate: "ls_driver";
3313
+ driver: "none" | "desktop" | "remote";
3314
+ deviceId?: string | undefined;
3315
+ } | {
3316
+ state: "idle" | "error" | "running" | "waiting" | "offline";
3317
+ sessionUpdate: "ls_status";
3318
+ } | {
3319
+ code: string;
3320
+ message: string;
3321
+ sessionUpdate: "ls_error";
3322
+ hint?: string | undefined;
3323
+ };
3324
+ }>;
3325
+ export type SessionEvent = z.infer<typeof sessionEventSchema>;