@get-bb/plugin-sdk 0.4.56 → 0.4.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,20 +1,47 @@
1
+ // ../domain/src/context-snapshot.ts
2
+ import { z } from "zod";
3
+ var tokenCountSchema = z.number().int().nonnegative();
4
+ var contextEntrySchema = z.object({
5
+ id: z.string().min(1),
6
+ label: z.string().min(1),
7
+ tokens: tokenCountSchema
8
+ });
9
+ var contextCategorySchema = z.object({
10
+ id: z.string().min(1),
11
+ label: z.string().min(1),
12
+ kind: z.enum(["used", "free", "reserved", "deferred"]),
13
+ tokens: tokenCountSchema,
14
+ entries: z.array(contextEntrySchema)
15
+ });
16
+ var contextSnapshotSchema = z.object({
17
+ capturedAt: z.iso.datetime(),
18
+ providerSessionId: z.string().min(1),
19
+ providerTurnId: z.string().min(1).nullable(),
20
+ model: z.string().min(1),
21
+ usedTokens: tokenCountSchema,
22
+ contextWindowTokens: z.number().int().positive(),
23
+ autoCompactAtTokens: z.number().int().positive().nullable(),
24
+ estimated: z.boolean(),
25
+ categories: z.array(contextCategorySchema)
26
+ });
27
+
1
28
  // ../domain/src/shared-types.ts
2
- import { z as z2 } from "zod";
29
+ import { z as z3 } from "zod";
3
30
 
4
31
  // ../domain/src/json-value.ts
5
- import { z } from "zod";
6
- var jsonValueSchema = z.lazy(
7
- () => z.union([
8
- z.string(),
9
- z.number(),
10
- z.boolean(),
11
- z.null(),
12
- z.array(jsonValueSchema),
13
- z.record(z.string(), jsonValueSchema)
32
+ import { z as z2 } from "zod";
33
+ var jsonValueSchema = z2.lazy(
34
+ () => z2.union([
35
+ z2.string(),
36
+ z2.number(),
37
+ z2.boolean(),
38
+ z2.null(),
39
+ z2.array(jsonValueSchema),
40
+ z2.record(z2.string(), jsonValueSchema)
14
41
  ])
15
42
  );
16
- var jsonObjectSchema = z.record(
17
- z.string(),
43
+ var jsonObjectSchema = z2.record(
44
+ z2.string(),
18
45
  jsonValueSchema
19
46
  );
20
47
 
@@ -29,42 +56,42 @@ var reasoningLevelValues = [
29
56
  "max",
30
57
  "ultra"
31
58
  ];
32
- var reasoningLevelSchema = z2.enum(reasoningLevelValues);
33
- var serviceTierSchema = z2.enum(["fast", "default"]);
59
+ var reasoningLevelSchema = z3.enum(reasoningLevelValues);
60
+ var serviceTierSchema = z3.enum(["fast", "default"]);
34
61
  var instructionModeValues = ["append", "replace"];
35
- var instructionModeSchema = z2.enum(instructionModeValues);
62
+ var instructionModeSchema = z3.enum(instructionModeValues);
36
63
  var permissionModeValues = ["accept-edits", "auto", "full"];
37
- var permissionModeSchema = z2.enum(permissionModeValues);
38
- var permissionModeInputSchema = z2.union([permissionModeSchema, z2.literal("workspace-write")]).transform(
64
+ var permissionModeSchema = z3.enum(permissionModeValues);
65
+ var permissionModeInputSchema = z3.union([permissionModeSchema, z3.literal("workspace-write")]).transform(
39
66
  (permissionMode) => permissionMode === "workspace-write" ? "accept-edits" : permissionMode
40
67
  );
41
68
  var legacyRecordedPermissionModeValues = [
42
69
  "workspace-write",
43
70
  "readonly"
44
71
  ];
45
- var recordedPermissionModeSchema = z2.enum([
72
+ var recordedPermissionModeSchema = z3.enum([
46
73
  ...permissionModeValues,
47
74
  ...legacyRecordedPermissionModeValues
48
75
  ]);
49
76
  var permissionEscalationValues = ["ask", "deny"];
50
- var permissionEscalationSchema = z2.enum(permissionEscalationValues);
77
+ var permissionEscalationSchema = z3.enum(permissionEscalationValues);
51
78
  var promptInputVisibilityValues = ["agent-only"];
52
- var promptInputVisibilitySchema = z2.enum(promptInputVisibilityValues);
79
+ var promptInputVisibilitySchema = z3.enum(promptInputVisibilityValues);
53
80
  var promptInputVisibilityFields = {
54
81
  visibility: promptInputVisibilitySchema.optional()
55
82
  };
56
83
  var promptMentionPathSourceValues = ["workspace", "thread-storage"];
57
- var promptMentionPathSourceSchema = z2.enum(promptMentionPathSourceValues);
84
+ var promptMentionPathSourceSchema = z3.enum(promptMentionPathSourceValues);
58
85
  var promptMentionPathEntryKindValues = ["file", "directory"];
59
- var promptMentionPathEntryKindSchema = z2.enum(
86
+ var promptMentionPathEntryKindSchema = z3.enum(
60
87
  promptMentionPathEntryKindValues
61
88
  );
62
89
  var promptMentionCommandTriggerValues = ["/"];
63
- var promptMentionCommandTriggerSchema = z2.enum(
90
+ var promptMentionCommandTriggerSchema = z3.enum(
64
91
  promptMentionCommandTriggerValues
65
92
  );
66
93
  var promptMentionCommandSourceValues = ["skill", "command"];
67
- var promptMentionCommandSourceSchema = z2.enum(
94
+ var promptMentionCommandSourceSchema = z3.enum(
68
95
  promptMentionCommandSourceValues
69
96
  );
70
97
  var promptMentionCommandOriginValues = [
@@ -72,48 +99,48 @@ var promptMentionCommandOriginValues = [
72
99
  "project",
73
100
  "user"
74
101
  ];
75
- var promptMentionCommandOriginSchema = z2.enum(
102
+ var promptMentionCommandOriginSchema = z3.enum(
76
103
  promptMentionCommandOriginValues
77
104
  );
78
- var canonicalPromptMentionResourceSchema = z2.discriminatedUnion("kind", [
79
- z2.object({
80
- kind: z2.literal("thread"),
81
- threadId: z2.string(),
82
- projectId: z2.string().optional(),
83
- label: z2.string()
105
+ var canonicalPromptMentionResourceSchema = z3.discriminatedUnion("kind", [
106
+ z3.object({
107
+ kind: z3.literal("thread"),
108
+ threadId: z3.string(),
109
+ projectId: z3.string().optional(),
110
+ label: z3.string()
84
111
  }),
85
- z2.object({
86
- kind: z2.literal("project"),
87
- projectId: z2.string(),
88
- label: z2.string()
112
+ z3.object({
113
+ kind: z3.literal("project"),
114
+ projectId: z3.string(),
115
+ label: z3.string()
89
116
  }),
90
- z2.object({
91
- kind: z2.literal("section"),
92
- sectionId: z2.string(),
93
- label: z2.string()
117
+ z3.object({
118
+ kind: z3.literal("section"),
119
+ sectionId: z3.string(),
120
+ label: z3.string()
94
121
  }),
95
- z2.object({
96
- kind: z2.literal("path"),
122
+ z3.object({
123
+ kind: z3.literal("path"),
97
124
  source: promptMentionPathSourceSchema,
98
125
  entryKind: promptMentionPathEntryKindSchema,
99
- path: z2.string(),
100
- label: z2.string()
126
+ path: z3.string(),
127
+ label: z3.string()
101
128
  }),
102
- z2.object({
103
- kind: z2.literal("command"),
129
+ z3.object({
130
+ kind: z3.literal("command"),
104
131
  trigger: promptMentionCommandTriggerSchema,
105
- name: z2.string(),
132
+ name: z3.string(),
106
133
  source: promptMentionCommandSourceSchema,
107
134
  origin: promptMentionCommandOriginSchema,
108
- label: z2.string(),
109
- argumentHint: z2.string().nullable()
135
+ label: z3.string(),
136
+ argumentHint: z3.string().nullable()
110
137
  }),
111
- z2.object({
112
- kind: z2.literal("plugin"),
113
- pluginId: z2.string(),
114
- icon: z2.string().nullable().optional(),
115
- itemId: z2.string(),
116
- label: z2.string()
138
+ z3.object({
139
+ kind: z3.literal("plugin"),
140
+ pluginId: z3.string(),
141
+ icon: z3.string().nullable().optional(),
142
+ itemId: z3.string(),
143
+ label: z3.string()
117
144
  })
118
145
  ]);
119
146
  function normalizeLegacyPromptMentionResource(value) {
@@ -127,42 +154,42 @@ function normalizeLegacyPromptMentionResource(value) {
127
154
  const { folderId, ...rest } = record;
128
155
  return { ...rest, kind: "section", sectionId: folderId };
129
156
  }
130
- var promptMentionResourceSchema = z2.preprocess(
157
+ var promptMentionResourceSchema = z3.preprocess(
131
158
  normalizeLegacyPromptMentionResource,
132
159
  canonicalPromptMentionResourceSchema
133
160
  );
134
- var promptTextMentionSchema = z2.object({
135
- start: z2.number().int().nonnegative(),
136
- end: z2.number().int().nonnegative(),
161
+ var promptTextMentionSchema = z3.object({
162
+ start: z3.number().int().nonnegative(),
163
+ end: z3.number().int().nonnegative(),
137
164
  resource: promptMentionResourceSchema
138
165
  });
139
- var promptInputSchema = z2.discriminatedUnion("type", [
140
- z2.object({
141
- type: z2.literal("text"),
142
- text: z2.string(),
143
- mentions: z2.array(promptTextMentionSchema).default([]),
166
+ var promptInputSchema = z3.discriminatedUnion("type", [
167
+ z3.object({
168
+ type: z3.literal("text"),
169
+ text: z3.string(),
170
+ mentions: z3.array(promptTextMentionSchema).default([]),
144
171
  ...promptInputVisibilityFields
145
172
  }),
146
- z2.object({
147
- type: z2.literal("image"),
148
- url: z2.string().url(),
173
+ z3.object({
174
+ type: z3.literal("image"),
175
+ url: z3.string().url(),
149
176
  ...promptInputVisibilityFields
150
177
  }),
151
- z2.object({
152
- type: z2.literal("localImage"),
153
- path: z2.string(),
178
+ z3.object({
179
+ type: z3.literal("localImage"),
180
+ path: z3.string(),
154
181
  ...promptInputVisibilityFields
155
182
  }),
156
- z2.object({
157
- type: z2.literal("localFile"),
158
- path: z2.string(),
159
- name: z2.string().optional(),
160
- sizeBytes: z2.number().int().nonnegative().optional(),
161
- mimeType: z2.string().optional(),
183
+ z3.object({
184
+ type: z3.literal("localFile"),
185
+ path: z3.string(),
186
+ name: z3.string().optional(),
187
+ sizeBytes: z3.number().int().nonnegative().optional(),
188
+ mimeType: z3.string().optional(),
162
189
  ...promptInputVisibilityFields
163
190
  })
164
191
  ]);
165
- var threadExecutionSourceSchema = z2.enum([
192
+ var threadExecutionSourceSchema = z3.enum([
166
193
  "client/thread/start",
167
194
  "client/turn/requested",
168
195
  "client/turn/start"
@@ -171,19 +198,19 @@ var callerExecutionInputSourceValues = [
171
198
  "explicit",
172
199
  "client-preference"
173
200
  ];
174
- var callerExecutionInputSourceSchema = z2.enum(
201
+ var callerExecutionInputSourceSchema = z3.enum(
175
202
  callerExecutionInputSourceValues
176
203
  );
177
- var threadExecutionOptionsSchema = z2.object({
178
- model: z2.string().optional(),
204
+ var threadExecutionOptionsSchema = z3.object({
205
+ model: z3.string().optional(),
179
206
  serviceTier: serviceTierSchema.optional(),
180
207
  reasoningLevel: reasoningLevelSchema.optional(),
181
208
  permissionMode: permissionModeSchema.optional(),
182
209
  source: threadExecutionSourceSchema.optional(),
183
- seq: z2.number().int().optional()
210
+ seq: z3.number().int().optional()
184
211
  });
185
212
  var resolvedThreadExecutionOptionsSchema = threadExecutionOptionsSchema.extend({
186
- model: z2.string().min(1),
213
+ model: z3.string().min(1),
187
214
  serviceTier: serviceTierSchema,
188
215
  reasoningLevel: reasoningLevelSchema,
189
216
  permissionMode: permissionModeSchema,
@@ -193,49 +220,49 @@ var recordedThreadExecutionOptionsSchema = resolvedThreadExecutionOptionsSchema.
193
220
  permissionMode: recordedPermissionModeSchema
194
221
  });
195
222
  var runtimePermissionScopeValues = ["workspace", "full"];
196
- var runtimePermissionScopeSchema = z2.enum(runtimePermissionScopeValues);
197
- var runtimePermissionPolicySchema = z2.discriminatedUnion(
223
+ var runtimePermissionScopeSchema = z3.enum(runtimePermissionScopeValues);
224
+ var runtimePermissionPolicySchema = z3.discriminatedUnion(
198
225
  "permissionMode",
199
226
  [
200
- z2.object({
201
- permissionMode: z2.literal("accept-edits"),
202
- permissionScope: z2.literal("workspace"),
203
- approvalReviewer: z2.literal("user"),
227
+ z3.object({
228
+ permissionMode: z3.literal("accept-edits"),
229
+ permissionScope: z3.literal("workspace"),
230
+ approvalReviewer: z3.literal("user"),
204
231
  permissionEscalation: permissionEscalationSchema
205
232
  }),
206
- z2.object({
207
- permissionMode: z2.literal("auto"),
208
- permissionScope: z2.literal("workspace"),
209
- approvalReviewer: z2.literal("automatic"),
233
+ z3.object({
234
+ permissionMode: z3.literal("auto"),
235
+ permissionScope: z3.literal("workspace"),
236
+ approvalReviewer: z3.literal("automatic"),
210
237
  permissionEscalation: permissionEscalationSchema
211
238
  }),
212
- z2.object({
213
- permissionMode: z2.literal("full"),
214
- permissionScope: z2.literal("full"),
215
- approvalReviewer: z2.null(),
216
- permissionEscalation: z2.null()
239
+ z3.object({
240
+ permissionMode: z3.literal("full"),
241
+ permissionScope: z3.literal("full"),
242
+ approvalReviewer: z3.null(),
243
+ permissionEscalation: z3.null()
217
244
  })
218
245
  ]
219
246
  );
220
- var promptModeSchema = z2.literal("plan");
221
- var runtimeThreadExecutionBaseOptionsSchema = z2.object({
222
- model: z2.string().min(1),
247
+ var promptModeSchema = z3.literal("plan");
248
+ var runtimeThreadExecutionBaseOptionsSchema = z3.object({
249
+ model: z3.string().min(1),
223
250
  serviceTier: serviceTierSchema,
224
251
  reasoningLevel: reasoningLevelSchema,
225
252
  promptMode: promptModeSchema.optional(),
226
253
  providerOptions: jsonObjectSchema
227
254
  });
228
255
  var runtimeThreadExecutionOptionsSchema = runtimeThreadExecutionBaseOptionsSchema.and(runtimePermissionPolicySchema);
229
- var projectExecutionDefaultsSchema = z2.object({
230
- providerId: z2.string().min(1),
231
- model: z2.string().min(1),
256
+ var projectExecutionDefaultsSchema = z3.object({
257
+ providerId: z3.string().min(1),
258
+ model: z3.string().min(1),
232
259
  serviceTier: serviceTierSchema,
233
260
  reasoningLevel: reasoningLevelSchema,
234
261
  permissionMode: permissionModeSchema
235
262
  });
236
263
 
237
264
  // ../domain/src/background-task.ts
238
- import { z as z3 } from "zod";
265
+ import { z as z4 } from "zod";
239
266
  var backgroundTaskStatusValues = [
240
267
  "pending",
241
268
  "running",
@@ -245,7 +272,7 @@ var backgroundTaskStatusValues = [
245
272
  "killed",
246
273
  "stopped"
247
274
  ];
248
- var backgroundTaskStatusSchema = z3.enum(backgroundTaskStatusValues);
275
+ var backgroundTaskStatusSchema = z4.enum(backgroundTaskStatusValues);
249
276
  var workflowAgentStateValues = [
250
277
  "queued",
251
278
  "running",
@@ -253,53 +280,53 @@ var workflowAgentStateValues = [
253
280
  "failed",
254
281
  "skipped"
255
282
  ];
256
- var workflowAgentStateSchema = z3.enum(workflowAgentStateValues);
257
- var workflowAgentSnapshotSchema = z3.object({
258
- index: z3.number().int().positive(),
259
- label: z3.string(),
283
+ var workflowAgentStateSchema = z4.enum(workflowAgentStateValues);
284
+ var workflowAgentSnapshotSchema = z4.object({
285
+ index: z4.number().int().positive(),
286
+ label: z4.string(),
260
287
  state: workflowAgentStateSchema,
261
- model: z3.string(),
262
- attempt: z3.number().int().positive(),
263
- cached: z3.boolean(),
264
- lastProgressAt: z3.number(),
265
- phaseIndex: z3.number().int().positive().optional(),
266
- phaseTitle: z3.string().optional(),
267
- agentType: z3.string().optional(),
268
- isolation: z3.string().optional(),
269
- queuedAt: z3.number().optional(),
270
- startedAt: z3.number().optional(),
271
- lastToolName: z3.string().optional(),
272
- lastToolSummary: z3.string().optional(),
273
- promptPreview: z3.string().optional(),
274
- resultPreview: z3.string().optional(),
275
- error: z3.string().optional(),
276
- tokens: z3.number().optional(),
277
- toolCalls: z3.number().optional(),
278
- durationMs: z3.number().optional()
279
- });
280
- var workflowPhaseSnapshotSchema = z3.object({
281
- index: z3.number().int().positive(),
282
- title: z3.string(),
283
- kind: z3.string().optional()
284
- });
285
- var workflowProgressSnapshotSchema = z3.object({
286
- phases: z3.array(workflowPhaseSnapshotSchema),
287
- agents: z3.array(workflowAgentSnapshotSchema)
288
- });
289
- var backgroundTaskUsageSchema = z3.object({
290
- totalTokens: z3.number(),
291
- toolUses: z3.number(),
292
- durationMs: z3.number()
288
+ model: z4.string(),
289
+ attempt: z4.number().int().positive(),
290
+ cached: z4.boolean(),
291
+ lastProgressAt: z4.number(),
292
+ phaseIndex: z4.number().int().positive().optional(),
293
+ phaseTitle: z4.string().optional(),
294
+ agentType: z4.string().optional(),
295
+ isolation: z4.string().optional(),
296
+ queuedAt: z4.number().optional(),
297
+ startedAt: z4.number().optional(),
298
+ lastToolName: z4.string().optional(),
299
+ lastToolSummary: z4.string().optional(),
300
+ promptPreview: z4.string().optional(),
301
+ resultPreview: z4.string().optional(),
302
+ error: z4.string().optional(),
303
+ tokens: z4.number().optional(),
304
+ toolCalls: z4.number().optional(),
305
+ durationMs: z4.number().optional()
306
+ });
307
+ var workflowPhaseSnapshotSchema = z4.object({
308
+ index: z4.number().int().positive(),
309
+ title: z4.string(),
310
+ kind: z4.string().optional()
311
+ });
312
+ var workflowProgressSnapshotSchema = z4.object({
313
+ phases: z4.array(workflowPhaseSnapshotSchema),
314
+ agents: z4.array(workflowAgentSnapshotSchema)
315
+ });
316
+ var backgroundTaskUsageSchema = z4.object({
317
+ totalTokens: z4.number(),
318
+ toolUses: z4.number(),
319
+ durationMs: z4.number()
293
320
  });
294
321
 
295
322
  // ../domain/src/provider-event.ts
296
- import { z as z12 } from "zod";
323
+ import { z as z13 } from "zod";
297
324
 
298
325
  // ../domain/src/thread-events.ts
299
- import { z as z9 } from "zod";
326
+ import { z as z10 } from "zod";
300
327
 
301
328
  // ../domain/src/pending-interactions.ts
302
- import { z as z6 } from "zod";
329
+ import { z as z7 } from "zod";
303
330
 
304
331
  // ../domain/src/plugin-interaction-limits.ts
305
332
  var PLUGIN_INTERACTION_MAX_TITLE_LENGTH = 160;
@@ -309,223 +336,223 @@ function jsonByteLength(value) {
309
336
  }
310
337
 
311
338
  // ../domain/src/item-presentation.ts
312
- import { z as z4 } from "zod";
339
+ import { z as z5 } from "zod";
313
340
  var THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH = 280;
314
- var threadEventItemPresentationLabelSchema = z4.object({
315
- pending: z4.string().min(1),
316
- completed: z4.string().min(1)
341
+ var threadEventItemPresentationLabelSchema = z5.object({
342
+ pending: z5.string().min(1),
343
+ completed: z5.string().min(1)
317
344
  });
318
- var threadEventItemPresentationIconSchema = z4.object({
319
- glyph: z4.string().min(1)
345
+ var threadEventItemPresentationIconSchema = z5.object({
346
+ glyph: z5.string().min(1)
320
347
  });
321
- var threadEventItemPresentationTintSchema = z4.object({
322
- light: z4.string().min(1),
323
- dark: z4.string().min(1)
348
+ var threadEventItemPresentationTintSchema = z5.object({
349
+ light: z5.string().min(1),
350
+ dark: z5.string().min(1)
324
351
  });
325
352
  var THREAD_EVENT_ITEM_PRESENTATION_BADGE_LABEL_MAX_LENGTH = 80;
326
- var threadEventItemPresentationBadgeSchema = z4.object({
327
- glyph: z4.string().min(1),
328
- label: z4.string().min(1).max(THREAD_EVENT_ITEM_PRESENTATION_BADGE_LABEL_MAX_LENGTH),
329
- hint: z4.string().min(1).max(THREAD_EVENT_ITEM_PRESENTATION_BADGE_LABEL_MAX_LENGTH),
330
- tone: z4.enum(["neutral", "destructive"])
353
+ var threadEventItemPresentationBadgeSchema = z5.object({
354
+ glyph: z5.string().min(1),
355
+ label: z5.string().min(1).max(THREAD_EVENT_ITEM_PRESENTATION_BADGE_LABEL_MAX_LENGTH),
356
+ hint: z5.string().min(1).max(THREAD_EVENT_ITEM_PRESENTATION_BADGE_LABEL_MAX_LENGTH),
357
+ tone: z5.enum(["neutral", "destructive"])
331
358
  });
332
- var threadEventItemPresentationSchema = z4.object({
359
+ var threadEventItemPresentationSchema = z5.object({
333
360
  label: threadEventItemPresentationLabelSchema,
334
361
  icon: threadEventItemPresentationIconSchema,
335
- title: z4.string().optional(),
336
- detail: z4.string().max(THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH).optional(),
337
- suppress: z4.boolean().optional(),
362
+ title: z5.string().optional(),
363
+ detail: z5.string().max(THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH).optional(),
364
+ suppress: z5.boolean().optional(),
338
365
  tint: threadEventItemPresentationTintSchema.optional(),
339
366
  badge: threadEventItemPresentationBadgeSchema.optional()
340
367
  });
341
368
 
342
369
  // ../domain/src/provider-extension-kind.ts
343
- import { z as z5 } from "zod";
370
+ import { z as z6 } from "zod";
344
371
  var EXTENSION_KIND_PATTERN = /^[a-z0-9-]+\/[a-z0-9-]+$/u;
345
372
  function isExtensionKind(value) {
346
373
  return EXTENSION_KIND_PATTERN.test(value);
347
374
  }
348
- var extensionKindSchema = z5.string().refine(isExtensionKind, {
375
+ var extensionKindSchema = z6.string().refine(isExtensionKind, {
349
376
  message: 'extension kinds are "<pluginId>/<name>" (lowercase letters, digits, and "-")'
350
377
  });
351
378
 
352
379
  // ../domain/src/pending-interactions.ts
353
- var pendingInteractionStatusSchema = z6.enum([
380
+ var pendingInteractionStatusSchema = z7.enum([
354
381
  "pending",
355
382
  "resolving",
356
383
  "resolved",
357
384
  "interrupted"
358
385
  ]);
359
- var pendingInteractionCommandActionSchema = z6.discriminatedUnion(
386
+ var pendingInteractionCommandActionSchema = z7.discriminatedUnion(
360
387
  "type",
361
388
  [
362
- z6.object({
363
- type: z6.literal("read"),
364
- command: z6.string(),
365
- name: z6.string(),
366
- path: z6.string()
389
+ z7.object({
390
+ type: z7.literal("read"),
391
+ command: z7.string(),
392
+ name: z7.string(),
393
+ path: z7.string()
367
394
  }),
368
- z6.object({
369
- type: z6.literal("listFiles"),
370
- command: z6.string(),
371
- path: z6.string().nullable()
395
+ z7.object({
396
+ type: z7.literal("listFiles"),
397
+ command: z7.string(),
398
+ path: z7.string().nullable()
372
399
  }),
373
- z6.object({
374
- type: z6.literal("search"),
375
- command: z6.string(),
376
- query: z6.string().nullable(),
377
- path: z6.string().nullable()
400
+ z7.object({
401
+ type: z7.literal("search"),
402
+ command: z7.string(),
403
+ query: z7.string().nullable(),
404
+ path: z7.string().nullable()
378
405
  }),
379
- z6.object({
380
- type: z6.literal("unknown"),
381
- command: z6.string()
406
+ z7.object({
407
+ type: z7.literal("unknown"),
408
+ command: z7.string()
382
409
  })
383
410
  ]
384
411
  );
385
- var pendingInteractionNetworkPermissionsSchema = z6.object({
386
- enabled: z6.boolean().nullable()
412
+ var pendingInteractionNetworkPermissionsSchema = z7.object({
413
+ enabled: z7.boolean().nullable()
387
414
  });
388
- var pendingInteractionFileSystemPermissionsSchema = z6.object({
389
- read: z6.array(z6.string()),
390
- write: z6.array(z6.string())
415
+ var pendingInteractionFileSystemPermissionsSchema = z7.object({
416
+ read: z7.array(z7.string()),
417
+ write: z7.array(z7.string())
391
418
  });
392
- var pendingInteractionMacOsPreferencesPermissionSchema = z6.enum([
419
+ var pendingInteractionMacOsPreferencesPermissionSchema = z7.enum([
393
420
  "none",
394
421
  "read_only",
395
422
  "read_write"
396
423
  ]);
397
- var pendingInteractionMacOsContactsPermissionSchema = z6.enum([
424
+ var pendingInteractionMacOsContactsPermissionSchema = z7.enum([
398
425
  "none",
399
426
  "read_only",
400
427
  "read_write"
401
428
  ]);
402
- var pendingInteractionMacOsAutomationPermissionSchema = z6.union([
403
- z6.literal("none"),
404
- z6.literal("all"),
405
- z6.object({
406
- kind: z6.literal("bundle_ids"),
407
- bundleIds: z6.array(z6.string())
429
+ var pendingInteractionMacOsAutomationPermissionSchema = z7.union([
430
+ z7.literal("none"),
431
+ z7.literal("all"),
432
+ z7.object({
433
+ kind: z7.literal("bundle_ids"),
434
+ bundleIds: z7.array(z7.string())
408
435
  })
409
436
  ]);
410
- var pendingInteractionMacOsPermissionsSchema = z6.object({
437
+ var pendingInteractionMacOsPermissionsSchema = z7.object({
411
438
  preferences: pendingInteractionMacOsPreferencesPermissionSchema,
412
439
  automations: pendingInteractionMacOsAutomationPermissionSchema,
413
- launchServices: z6.boolean(),
414
- accessibility: z6.boolean(),
415
- calendar: z6.boolean(),
416
- reminders: z6.boolean(),
440
+ launchServices: z7.boolean(),
441
+ accessibility: z7.boolean(),
442
+ calendar: z7.boolean(),
443
+ reminders: z7.boolean(),
417
444
  contacts: pendingInteractionMacOsContactsPermissionSchema
418
445
  });
419
- var pendingInteractionRequestedPermissionProfileSchema = z6.object({
446
+ var pendingInteractionRequestedPermissionProfileSchema = z7.object({
420
447
  network: pendingInteractionNetworkPermissionsSchema.nullable(),
421
448
  fileSystem: pendingInteractionFileSystemPermissionsSchema.nullable(),
422
449
  macos: pendingInteractionMacOsPermissionsSchema.nullable()
423
450
  });
424
- var pendingInteractionGrantablePermissionProfileSchema = z6.object({
451
+ var pendingInteractionGrantablePermissionProfileSchema = z7.object({
425
452
  network: pendingInteractionNetworkPermissionsSchema.nullable(),
426
453
  fileSystem: pendingInteractionFileSystemPermissionsSchema.nullable()
427
454
  }).strict();
428
455
  var pendingInteractionGrantedPermissionProfileSchema = pendingInteractionGrantablePermissionProfileSchema;
429
- var pendingInteractionApprovalDecisionSchema = z6.enum([
456
+ var pendingInteractionApprovalDecisionSchema = z7.enum([
430
457
  "allow_once",
431
458
  "allow_for_session",
432
459
  "deny"
433
460
  ]);
434
- var pendingInteractionFileChangeWriteScopeSchema = z6.string().min(1);
435
- var pendingInteractionCommandApprovalSubjectSchema = z6.object({
436
- kind: z6.literal("command"),
437
- itemId: z6.string().min(1),
438
- command: z6.string().min(1),
439
- cwd: z6.string().nullable(),
440
- actions: z6.array(pendingInteractionCommandActionSchema),
461
+ var pendingInteractionFileChangeWriteScopeSchema = z7.string().min(1);
462
+ var pendingInteractionCommandApprovalSubjectSchema = z7.object({
463
+ kind: z7.literal("command"),
464
+ itemId: z7.string().min(1),
465
+ command: z7.string().min(1),
466
+ cwd: z7.string().nullable(),
467
+ actions: z7.array(pendingInteractionCommandActionSchema),
441
468
  sessionGrant: pendingInteractionGrantablePermissionProfileSchema.nullable()
442
469
  });
443
- var pendingInteractionFileChangeApprovalSubjectSchema = z6.object({
444
- kind: z6.literal("file_change"),
445
- itemId: z6.string().min(1),
470
+ var pendingInteractionFileChangeApprovalSubjectSchema = z7.object({
471
+ kind: z7.literal("file_change"),
472
+ itemId: z7.string().min(1),
446
473
  writeScope: pendingInteractionFileChangeWriteScopeSchema.nullable(),
447
474
  sessionGrant: pendingInteractionGrantablePermissionProfileSchema.nullable()
448
475
  });
449
- var pendingInteractionPermissionGrantApprovalSubjectSchema = z6.object({
450
- kind: z6.literal("permission_grant"),
451
- itemId: z6.string().min(1),
452
- toolName: z6.string().nullable(),
476
+ var pendingInteractionPermissionGrantApprovalSubjectSchema = z7.object({
477
+ kind: z7.literal("permission_grant"),
478
+ itemId: z7.string().min(1),
479
+ toolName: z7.string().nullable(),
453
480
  permissions: pendingInteractionGrantablePermissionProfileSchema
454
481
  });
455
- var pendingInteractionPlanApprovalSubjectSchema = z6.object({
456
- kind: z6.literal("plan"),
457
- itemId: z6.string().min(1),
458
- plan: z6.string().min(1),
459
- planFilePath: z6.string().min(1).nullable()
482
+ var pendingInteractionPlanApprovalSubjectSchema = z7.object({
483
+ kind: z7.literal("plan"),
484
+ itemId: z7.string().min(1),
485
+ plan: z7.string().min(1),
486
+ planFilePath: z7.string().min(1).nullable()
460
487
  });
461
- var pendingInteractionToolUseApprovalSubjectSchema = z6.object({
462
- kind: z6.literal("tool_use"),
463
- itemId: z6.string().min(1),
464
- tool: z6.string().min(1),
488
+ var pendingInteractionToolUseApprovalSubjectSchema = z7.object({
489
+ kind: z7.literal("tool_use"),
490
+ itemId: z7.string().min(1),
491
+ tool: z7.string().min(1),
465
492
  presentation: threadEventItemPresentationSchema
466
493
  });
467
- var pendingInteractionApprovalSubjectSchema = z6.discriminatedUnion("kind", [
494
+ var pendingInteractionApprovalSubjectSchema = z7.discriminatedUnion("kind", [
468
495
  pendingInteractionCommandApprovalSubjectSchema,
469
496
  pendingInteractionFileChangeApprovalSubjectSchema,
470
497
  pendingInteractionPermissionGrantApprovalSubjectSchema,
471
498
  pendingInteractionPlanApprovalSubjectSchema,
472
499
  pendingInteractionToolUseApprovalSubjectSchema
473
500
  ]);
474
- var approvalPendingInteractionPayloadSchema = z6.object({
475
- kind: z6.literal("approval"),
501
+ var approvalPendingInteractionPayloadSchema = z7.object({
502
+ kind: z7.literal("approval"),
476
503
  subject: pendingInteractionApprovalSubjectSchema,
477
- reason: z6.string().nullable(),
478
- availableDecisions: z6.array(pendingInteractionApprovalDecisionSchema).min(1)
504
+ reason: z7.string().nullable(),
505
+ availableDecisions: z7.array(pendingInteractionApprovalDecisionSchema).min(1)
479
506
  });
480
507
  var USER_QUESTION_MAX_QUESTIONS = 4;
481
508
  var USER_QUESTION_MAX_OPTIONS = 4;
482
509
  var USER_QUESTION_MAX_SELECTED = 4;
483
510
  var USER_QUESTION_MAX_FREE_TEXT_LENGTH = 4096;
484
- var pendingInteractionUserQuestionIdSchema = z6.string().min(1).refine((value) => value.trim().length > 0, {
511
+ var pendingInteractionUserQuestionIdSchema = z7.string().min(1).refine((value) => value.trim().length > 0, {
485
512
  message: "User question ids cannot be blank"
486
513
  });
487
- var pendingInteractionUserQuestionPromptSchema = z6.string().min(1).refine((value) => value.trim().length > 0, {
514
+ var pendingInteractionUserQuestionPromptSchema = z7.string().min(1).refine((value) => value.trim().length > 0, {
488
515
  message: "User question prompts cannot be blank"
489
516
  });
490
- var pendingInteractionUserQuestionShortLabelSchema = z6.string().min(1).refine((value) => value.trim().length > 0, {
517
+ var pendingInteractionUserQuestionShortLabelSchema = z7.string().min(1).refine((value) => value.trim().length > 0, {
491
518
  message: "User question short labels cannot be blank"
492
519
  });
493
- var pendingInteractionUserQuestionOptionValueSchema = z6.string().min(1).refine((value) => value.trim().length > 0, {
520
+ var pendingInteractionUserQuestionOptionValueSchema = z7.string().min(1).refine((value) => value.trim().length > 0, {
494
521
  message: "User question option values cannot be blank"
495
522
  });
496
- var pendingInteractionUserQuestionOptionLabelSchema = z6.string().min(1).refine((value) => value.trim().length > 0, {
523
+ var pendingInteractionUserQuestionOptionLabelSchema = z7.string().min(1).refine((value) => value.trim().length > 0, {
497
524
  message: "User question option labels cannot be blank"
498
525
  });
499
- var pendingInteractionUserQuestionOptionDescriptionSchema = z6.string().min(1).refine((value) => value.trim().length > 0, {
526
+ var pendingInteractionUserQuestionOptionDescriptionSchema = z7.string().min(1).refine((value) => value.trim().length > 0, {
500
527
  message: "User question option descriptions cannot be blank"
501
528
  });
502
- var pendingInteractionUserQuestionFreeTextSchema = z6.string().min(1).max(
529
+ var pendingInteractionUserQuestionFreeTextSchema = z7.string().min(1).max(
503
530
  USER_QUESTION_MAX_FREE_TEXT_LENGTH,
504
531
  `User question free text cannot exceed ${USER_QUESTION_MAX_FREE_TEXT_LENGTH} characters`
505
532
  ).refine((value) => value.trim().length > 0, {
506
533
  message: "User question free text cannot be blank"
507
534
  });
508
- var pendingInteractionUserQuestionOptionSchema = z6.object({
535
+ var pendingInteractionUserQuestionOptionSchema = z7.object({
509
536
  value: pendingInteractionUserQuestionOptionValueSchema,
510
537
  label: pendingInteractionUserQuestionOptionLabelSchema,
511
538
  description: pendingInteractionUserQuestionOptionDescriptionSchema.optional()
512
539
  });
513
- var pendingInteractionUserQuestionQuestionSchema = z6.object({
540
+ var pendingInteractionUserQuestionQuestionSchema = z7.object({
514
541
  id: pendingInteractionUserQuestionIdSchema,
515
542
  prompt: pendingInteractionUserQuestionPromptSchema,
516
543
  shortLabel: pendingInteractionUserQuestionShortLabelSchema.optional(),
517
- multiSelect: z6.boolean(),
518
- options: z6.array(pendingInteractionUserQuestionOptionSchema).max(
544
+ multiSelect: z7.boolean(),
545
+ options: z7.array(pendingInteractionUserQuestionOptionSchema).max(
519
546
  USER_QUESTION_MAX_OPTIONS,
520
547
  `User questions cannot include more than ${USER_QUESTION_MAX_OPTIONS} options`
521
548
  ).optional(),
522
- allowFreeText: z6.boolean()
549
+ allowFreeText: z7.boolean()
523
550
  }).superRefine((question, context) => {
524
551
  const optionValues = /* @__PURE__ */ new Set();
525
552
  question.options?.forEach((option, index) => {
526
553
  if (optionValues.has(option.value)) {
527
554
  context.addIssue({
528
- code: z6.ZodIssueCode.custom,
555
+ code: z7.ZodIssueCode.custom,
529
556
  message: "User question option values must be unique",
530
557
  path: ["options", index, "value"]
531
558
  });
@@ -540,9 +567,9 @@ var pendingInteractionUserQuestionQuestionSchema = z6.object({
540
567
  path: ["options"]
541
568
  }
542
569
  );
543
- var userQuestionPendingInteractionPayloadSchema = z6.object({
544
- kind: z6.literal("user_question"),
545
- questions: z6.array(pendingInteractionUserQuestionQuestionSchema).min(1).max(
570
+ var userQuestionPendingInteractionPayloadSchema = z7.object({
571
+ kind: z7.literal("user_question"),
572
+ questions: z7.array(pendingInteractionUserQuestionQuestionSchema).min(1).max(
546
573
  USER_QUESTION_MAX_QUESTIONS,
547
574
  `User questions cannot include more than ${USER_QUESTION_MAX_QUESTIONS} questions`
548
575
  )
@@ -551,7 +578,7 @@ var userQuestionPendingInteractionPayloadSchema = z6.object({
551
578
  payload.questions.forEach((question, index) => {
552
579
  if (questionIds.has(question.id)) {
553
580
  context.addIssue({
554
- code: z6.ZodIssueCode.custom,
581
+ code: z7.ZodIssueCode.custom,
555
582
  message: "User question ids must be unique",
556
583
  path: ["questions", index, "id"]
557
584
  });
@@ -560,65 +587,65 @@ var userQuestionPendingInteractionPayloadSchema = z6.object({
560
587
  questionIds.add(question.id);
561
588
  });
562
589
  });
563
- var pluginPendingInteractionPayloadSchema = z6.object({
564
- kind: z6.literal("plugin"),
565
- title: z6.string().trim().min(1).max(PLUGIN_INTERACTION_MAX_TITLE_LENGTH),
590
+ var pluginPendingInteractionPayloadSchema = z7.object({
591
+ kind: z7.literal("plugin"),
592
+ title: z7.string().trim().min(1).max(PLUGIN_INTERACTION_MAX_TITLE_LENGTH),
566
593
  data: jsonValueSchema
567
594
  });
568
- var pluginExtensionInteractionRequestPayloadSchema = z6.object({
595
+ var pluginExtensionInteractionRequestPayloadSchema = z7.object({
569
596
  kind: extensionKindSchema,
570
- title: z6.string().trim().min(1).max(PLUGIN_INTERACTION_MAX_TITLE_LENGTH),
597
+ title: z7.string().trim().min(1).max(PLUGIN_INTERACTION_MAX_TITLE_LENGTH),
571
598
  data: jsonValueSchema.refine(
572
599
  (value) => jsonByteLength(value) <= PLUGIN_INTERACTION_MAX_PAYLOAD_BYTES,
573
600
  { message: "Plugin request data exceeds 64 KiB" }
574
601
  )
575
602
  });
576
- var interactionRequestPayloadSchema = z6.union([
603
+ var interactionRequestPayloadSchema = z7.union([
577
604
  userQuestionPendingInteractionPayloadSchema,
578
605
  pluginExtensionInteractionRequestPayloadSchema
579
606
  ]);
580
- var pendingInteractionPayloadSchema = z6.union([
607
+ var pendingInteractionPayloadSchema = z7.union([
581
608
  approvalPendingInteractionPayloadSchema,
582
609
  userQuestionPendingInteractionPayloadSchema,
583
610
  pluginExtensionInteractionRequestPayloadSchema
584
611
  ]);
585
612
  var approvalDecisionDiscriminatorError = "Invalid discriminator value. Expected 'allow_once' | 'allow_for_session' | 'deny'";
586
- var approvalPendingInteractionResolutionSchema = z6.discriminatedUnion(
613
+ var approvalPendingInteractionResolutionSchema = z7.discriminatedUnion(
587
614
  "decision",
588
615
  [
589
- z6.object({
590
- decision: z6.literal("allow_once"),
616
+ z7.object({
617
+ decision: z7.literal("allow_once"),
591
618
  grantedPermissions: pendingInteractionGrantedPermissionProfileSchema.nullable()
592
619
  }),
593
- z6.object({
594
- decision: z6.literal("allow_for_session"),
620
+ z7.object({
621
+ decision: z7.literal("allow_for_session"),
595
622
  grantedPermissions: pendingInteractionGrantedPermissionProfileSchema.nullable()
596
623
  }),
597
- z6.object({
598
- decision: z6.literal("deny")
624
+ z7.object({
625
+ decision: z7.literal("deny")
599
626
  })
600
627
  ],
601
628
  approvalDecisionDiscriminatorError
602
629
  );
603
- var pendingInteractionUserAnswerSchema = z6.object({
604
- selected: z6.array(z6.string().min(1)).max(
630
+ var pendingInteractionUserAnswerSchema = z7.object({
631
+ selected: z7.array(z7.string().min(1)).max(
605
632
  USER_QUESTION_MAX_SELECTED,
606
633
  `User question selected choices cannot exceed ${USER_QUESTION_MAX_SELECTED}`
607
634
  ),
608
635
  freeText: pendingInteractionUserQuestionFreeTextSchema.optional()
609
636
  });
610
- var userQuestionPendingInteractionResolutionSchema = z6.object({
611
- kind: z6.literal("user_answer"),
612
- answers: z6.record(z6.string().min(1), pendingInteractionUserAnswerSchema)
637
+ var userQuestionPendingInteractionResolutionSchema = z7.object({
638
+ kind: z7.literal("user_answer"),
639
+ answers: z7.record(z7.string().min(1), pendingInteractionUserAnswerSchema)
613
640
  });
614
- var pluginPendingInteractionResolutionSchema = z6.object({
615
- kind: z6.literal("plugin_submitted")
641
+ var pluginPendingInteractionResolutionSchema = z7.object({
642
+ kind: z7.literal("plugin_submitted")
616
643
  });
617
- var pluginExtensionInteractionResolutionSchema = z6.object({
618
- kind: z6.literal("request_answer"),
644
+ var pluginExtensionInteractionResolutionSchema = z7.object({
645
+ kind: z7.literal("request_answer"),
619
646
  value: jsonValueSchema
620
647
  });
621
- var pendingInteractionResolutionSchema = z6.union(
648
+ var pendingInteractionResolutionSchema = z7.union(
622
649
  [
623
650
  approvalPendingInteractionResolutionSchema,
624
651
  userQuestionPendingInteractionResolutionSchema,
@@ -627,56 +654,56 @@ var pendingInteractionResolutionSchema = z6.union(
627
654
  ],
628
655
  approvalDecisionDiscriminatorError
629
656
  );
630
- var approvalInteractionOutcomeSchema = z6.object({
657
+ var approvalInteractionOutcomeSchema = z7.object({
631
658
  payload: approvalPendingInteractionPayloadSchema,
632
659
  resolution: approvalPendingInteractionResolutionSchema
633
660
  });
634
- var userQuestionInteractionOutcomeSchema = z6.object({
661
+ var userQuestionInteractionOutcomeSchema = z7.object({
635
662
  payload: userQuestionPendingInteractionPayloadSchema,
636
663
  resolution: userQuestionPendingInteractionResolutionSchema
637
664
  });
638
- var pluginExtensionInteractionOutcomeSchema = z6.object({
665
+ var pluginExtensionInteractionOutcomeSchema = z7.object({
639
666
  payload: pluginExtensionInteractionRequestPayloadSchema,
640
667
  resolution: pluginExtensionInteractionResolutionSchema
641
668
  });
642
- var providerInteractionOutcomeSchema = z6.union([
669
+ var providerInteractionOutcomeSchema = z7.union([
643
670
  approvalInteractionOutcomeSchema,
644
671
  userQuestionInteractionOutcomeSchema,
645
672
  pluginExtensionInteractionOutcomeSchema
646
673
  ]);
647
- var pendingInteractionProviderOriginSchema = z6.object({
648
- kind: z6.literal("provider"),
649
- providerId: z6.string().min(1),
650
- providerThreadId: z6.string().min(1),
651
- providerRequestId: z6.string().min(1)
652
- });
653
- var pendingInteractionPluginOriginSchema = z6.object({
654
- kind: z6.literal("plugin"),
655
- pluginId: z6.string().min(1),
656
- rendererId: z6.string().min(1)
657
- });
658
- var pendingInteractionCreateSchema = z6.object({
659
- threadId: z6.string().min(1),
660
- turnId: z6.string().min(1),
661
- providerId: z6.string().min(1),
662
- providerThreadId: z6.string().min(1),
663
- providerRequestId: z6.string().min(1),
674
+ var pendingInteractionProviderOriginSchema = z7.object({
675
+ kind: z7.literal("provider"),
676
+ providerId: z7.string().min(1),
677
+ providerThreadId: z7.string().min(1),
678
+ providerRequestId: z7.string().min(1)
679
+ });
680
+ var pendingInteractionPluginOriginSchema = z7.object({
681
+ kind: z7.literal("plugin"),
682
+ pluginId: z7.string().min(1),
683
+ rendererId: z7.string().min(1)
684
+ });
685
+ var pendingInteractionCreateSchema = z7.object({
686
+ threadId: z7.string().min(1),
687
+ turnId: z7.string().min(1),
688
+ providerId: z7.string().min(1),
689
+ providerThreadId: z7.string().min(1),
690
+ providerRequestId: z7.string().min(1),
664
691
  payload: pendingInteractionPayloadSchema
665
692
  });
666
- var pendingInteractionBaseSchema = z6.object({
667
- id: z6.string().min(1),
668
- threadId: z6.string().min(1),
693
+ var pendingInteractionBaseSchema = z7.object({
694
+ id: z7.string().min(1),
695
+ threadId: z7.string().min(1),
669
696
  status: pendingInteractionStatusSchema,
670
- statusReason: z6.string().nullable(),
671
- createdAt: z6.number().int().nonnegative(),
672
- expiresAt: z6.number().int().nonnegative().nullable().optional(),
673
- resolvedAt: z6.number().int().nonnegative().nullable()
697
+ statusReason: z7.string().nullable(),
698
+ createdAt: z7.number().int().nonnegative(),
699
+ expiresAt: z7.number().int().nonnegative().nullable().optional(),
700
+ resolvedAt: z7.number().int().nonnegative().nullable()
674
701
  });
675
702
  var providerPendingInteractionBaseSchema = pendingInteractionBaseSchema.extend({
676
- turnId: z6.string().min(1),
677
- providerId: z6.string().min(1),
678
- providerThreadId: z6.string().min(1),
679
- providerRequestId: z6.string().min(1),
703
+ turnId: z7.string().min(1),
704
+ providerId: z7.string().min(1),
705
+ providerThreadId: z7.string().min(1),
706
+ providerRequestId: z7.string().min(1),
680
707
  origin: pendingInteractionProviderOriginSchema.optional()
681
708
  });
682
709
  var approvalPendingInteractionSchema = providerPendingInteractionBaseSchema.extend({
@@ -691,30 +718,30 @@ var pluginExtensionPendingInteractionSchema = providerPendingInteractionBaseSche
691
718
  payload: pluginExtensionInteractionRequestPayloadSchema,
692
719
  resolution: pluginExtensionInteractionResolutionSchema.nullable()
693
720
  });
694
- var providerPendingInteractionSchema = z6.union([
721
+ var providerPendingInteractionSchema = z7.union([
695
722
  approvalPendingInteractionSchema,
696
723
  userQuestionPendingInteractionSchema,
697
724
  pluginExtensionPendingInteractionSchema
698
725
  ]);
699
726
  var pluginPendingInteractionSchema = pendingInteractionBaseSchema.extend({
700
- turnId: z6.string().min(1).nullable(),
727
+ turnId: z7.string().min(1).nullable(),
701
728
  origin: pendingInteractionPluginOriginSchema,
702
729
  payload: pluginPendingInteractionPayloadSchema,
703
730
  resolution: pluginPendingInteractionResolutionSchema.nullable()
704
731
  });
705
- var pendingInteractionSchema = z6.union([
732
+ var pendingInteractionSchema = z7.union([
706
733
  providerPendingInteractionSchema,
707
734
  pluginPendingInteractionSchema
708
735
  ]);
709
- var interactionLifecycleRecordBaseSchema = z6.object({
710
- id: z6.string().min(1),
736
+ var interactionLifecycleRecordBaseSchema = z7.object({
737
+ id: z7.string().min(1),
711
738
  status: pendingInteractionStatusSchema,
712
- statusReason: z6.string().nullable()
739
+ statusReason: z7.string().nullable()
713
740
  });
714
- var interactionLifecycleProviderOriginSchema = z6.object({
715
- kind: z6.literal("provider"),
716
- providerId: z6.string().min(1),
717
- providerRequestId: z6.string().min(1)
741
+ var interactionLifecycleProviderOriginSchema = z7.object({
742
+ kind: z7.literal("provider"),
743
+ providerId: z7.string().min(1),
744
+ providerRequestId: z7.string().min(1)
718
745
  });
719
746
  var approvalInteractionLifecycleRecordPayloadSchema = approvalPendingInteractionPayloadSchema.omit({ availableDecisions: true });
720
747
  var approvalInteractionLifecycleSchema = interactionLifecycleRecordBaseSchema.extend({
@@ -739,7 +766,7 @@ var pluginExtensionInteractionLifecycleSchema = interactionLifecycleRecordBaseSc
739
766
  }),
740
767
  resolution: pluginExtensionInteractionResolutionSchema.omit({ value: true }).nullable()
741
768
  });
742
- var interactionLifecycleSchema = z6.union([
769
+ var interactionLifecycleSchema = z7.union([
743
770
  approvalInteractionLifecycleSchema,
744
771
  userQuestionInteractionLifecycleSchema,
745
772
  pluginInteractionLifecycleSchema,
@@ -747,11 +774,11 @@ var interactionLifecycleSchema = z6.union([
747
774
  ]);
748
775
 
749
776
  // ../domain/src/protocol-ids.ts
750
- import { z as z7 } from "zod";
751
- var clientTurnRequestIdSchema = z7.string().regex(/^creq_[23456789abcdefghijkmnpqrstuvwxyz]{10}$/u);
777
+ import { z as z8 } from "zod";
778
+ var clientTurnRequestIdSchema = z8.string().regex(/^creq_[23456789abcdefghijkmnpqrstuvwxyz]{10}$/u);
752
779
 
753
780
  // ../domain/src/system-message.ts
754
- import { z as z8 } from "zod";
781
+ import { z as z9 } from "zod";
755
782
  var systemMessageKindValues = [
756
783
  "ownership-assigned",
757
784
  "ownership-removed",
@@ -762,16 +789,16 @@ var systemMessageKindValues = [
762
789
  "child-outcome-batch",
763
790
  "unlabeled"
764
791
  ];
765
- var systemMessageKindSchema = z8.enum(systemMessageKindValues);
766
- var systemMessageSubjectSchema = z8.discriminatedUnion("kind", [
767
- z8.object({
768
- kind: z8.literal("thread"),
769
- threadId: z8.string(),
770
- threadName: z8.string()
792
+ var systemMessageKindSchema = z9.enum(systemMessageKindValues);
793
+ var systemMessageSubjectSchema = z9.discriminatedUnion("kind", [
794
+ z9.object({
795
+ kind: z9.literal("thread"),
796
+ threadId: z9.string(),
797
+ threadName: z9.string()
771
798
  }),
772
- z8.object({
773
- kind: z8.literal("thread-batch"),
774
- count: z8.number()
799
+ z9.object({
800
+ kind: z9.literal("thread-batch"),
801
+ count: z9.number()
775
802
  })
776
803
  ]);
777
804
 
@@ -794,31 +821,31 @@ var systemEventTypeValues = [
794
821
  "system/provider-turn-watchdog"
795
822
  ];
796
823
  var threadTurnInitiatorValues = ["user", "agent", "system"];
797
- var threadTurnInitiatorSchema = z9.enum(threadTurnInitiatorValues);
824
+ var threadTurnInitiatorSchema = z10.enum(threadTurnInitiatorValues);
798
825
  var turnRequestOptionsSchema = recordedThreadExecutionOptionsSchema;
799
- var turnRequestTargetSchema = z9.discriminatedUnion("kind", [
800
- z9.object({ kind: z9.literal("thread-start") }),
801
- z9.object({ kind: z9.literal("new-turn") }),
802
- z9.object({
803
- kind: z9.literal("auto"),
804
- expectedTurnId: z9.string().nullable()
826
+ var turnRequestTargetSchema = z10.discriminatedUnion("kind", [
827
+ z10.object({ kind: z10.literal("thread-start") }),
828
+ z10.object({ kind: z10.literal("new-turn") }),
829
+ z10.object({
830
+ kind: z10.literal("auto"),
831
+ expectedTurnId: z10.string().nullable()
805
832
  }),
806
- z9.object({
807
- kind: z9.literal("steer"),
808
- expectedTurnId: z9.string().nullable()
833
+ z10.object({
834
+ kind: z10.literal("steer"),
835
+ expectedTurnId: z10.string().nullable()
809
836
  })
810
837
  ]);
811
- var clientTurnLifecycleEventDataSchema = z9.object({
812
- direction: z9.literal("outbound"),
813
- source: z9.enum(["spawn", "tell"]),
838
+ var clientTurnLifecycleEventDataSchema = z10.object({
839
+ direction: z10.literal("outbound"),
840
+ source: z10.enum(["spawn", "tell"]),
814
841
  initiator: threadTurnInitiatorSchema,
815
- request: z9.object({
816
- method: z9.enum(["thread/start", "turn/start"]),
817
- params: z9.record(z9.string(), z9.unknown())
842
+ request: z10.object({
843
+ method: z10.enum(["thread/start", "turn/start"]),
844
+ params: z10.record(z10.string(), z10.unknown())
818
845
  })
819
846
  });
820
- var turnRequestEventDataSchema = z9.object({
821
- direction: z9.literal("outbound"),
847
+ var turnRequestEventDataSchema = z10.object({
848
+ direction: z10.literal("outbound"),
822
849
  requestId: clientTurnRequestIdSchema,
823
850
  // Retry provenance, written only when a `turn.failed` gate's retry row
824
851
  // dispatches. Both fields are present together or not at all: absence means
@@ -828,45 +855,45 @@ var turnRequestEventDataSchema = z9.object({
828
855
  /** The original request this attempt re-submits, unchanged across attempts. */
829
856
  retryOfRequestId: clientTurnRequestIdSchema.optional(),
830
857
  /** Which attempt this is: 2 is the first retry of the original request. */
831
- retryAttempt: z9.number().int().min(2).optional(),
832
- source: z9.enum(["spawn", "tell"]),
858
+ retryAttempt: z10.number().int().min(2).optional(),
859
+ source: z10.enum(["spawn", "tell"]),
833
860
  initiator: threadTurnInitiatorSchema,
834
- senderThreadId: z9.string().nullable(),
861
+ senderThreadId: z10.string().nullable(),
835
862
  systemMessageKind: systemMessageKindSchema.optional(),
836
863
  systemMessageSubject: systemMessageSubjectSchema.nullable().optional(),
837
- input: z9.array(promptInputSchema),
838
- inputGroups: z9.array(z9.array(promptInputSchema).min(1)).min(1).optional(),
864
+ input: z10.array(promptInputSchema),
865
+ inputGroups: z10.array(z10.array(promptInputSchema).min(1)).min(1).optional(),
839
866
  target: turnRequestTargetSchema,
840
- request: z9.object({
841
- method: z9.enum(["thread/start", "turn/start"]),
842
- params: z9.record(z9.string(), z9.unknown())
867
+ request: z10.object({
868
+ method: z10.enum(["thread/start", "turn/start"]),
869
+ params: z10.record(z10.string(), z10.unknown())
843
870
  }),
844
871
  execution: turnRequestOptionsSchema
845
872
  });
846
- var turnRequestRejectedEventDataSchema = z9.object({
873
+ var turnRequestRejectedEventDataSchema = z10.object({
847
874
  requestId: clientTurnRequestIdSchema,
848
- reason: z9.string().min(1),
849
- message: z9.string().min(1)
850
- });
851
- var systemErrorEventDataSchema = z9.object({
852
- code: z9.string().optional(),
853
- message: z9.string(),
854
- detail: z9.string().optional(),
855
- reconnectAttempt: z9.number().int().positive().optional(),
856
- reconnectTotal: z9.number().int().positive().optional()
875
+ reason: z10.string().min(1),
876
+ message: z10.string().min(1)
877
+ });
878
+ var systemErrorEventDataSchema = z10.object({
879
+ code: z10.string().optional(),
880
+ message: z10.string(),
881
+ detail: z10.string().optional(),
882
+ reconnectAttempt: z10.number().int().positive().optional(),
883
+ reconnectTotal: z10.number().int().positive().optional()
857
884
  }).superRefine((value, ctx) => {
858
885
  const hasReconnectAttempt = value.reconnectAttempt !== void 0;
859
886
  const hasReconnectTotal = value.reconnectTotal !== void 0;
860
887
  if (hasReconnectAttempt !== hasReconnectTotal) {
861
888
  ctx.addIssue({
862
- code: z9.ZodIssueCode.custom,
889
+ code: z10.ZodIssueCode.custom,
863
890
  message: "system/error reconnectAttempt and reconnectTotal must be provided together"
864
891
  });
865
892
  return;
866
893
  }
867
894
  if (value.reconnectAttempt !== void 0 && value.reconnectTotal !== void 0 && value.reconnectAttempt > value.reconnectTotal) {
868
895
  ctx.addIssue({
869
- code: z9.ZodIssueCode.custom,
896
+ code: z10.ZodIssueCode.custom,
870
897
  message: "system/error reconnectAttempt cannot be greater than reconnectTotal"
871
898
  });
872
899
  }
@@ -876,42 +903,42 @@ var ownershipChangeOperationActionValues = [
876
903
  "release",
877
904
  "transfer"
878
905
  ];
879
- var ownershipChangeOperationActionSchema = z9.enum(
906
+ var ownershipChangeOperationActionSchema = z10.enum(
880
907
  ownershipChangeOperationActionValues
881
908
  );
882
- var ownershipChangeOperationMetadataSchema = z9.object({
909
+ var ownershipChangeOperationMetadataSchema = z10.object({
883
910
  action: ownershipChangeOperationActionSchema,
884
- nextParentThreadId: z9.string().nullable(),
885
- nextParentThreadTitle: z9.string().nullable(),
886
- previousParentThreadId: z9.string().nullable(),
887
- previousParentThreadTitle: z9.string().nullable()
888
- });
889
- var systemOperationEventDataSchema = z9.object({
890
- operation: z9.string(),
891
- status: z9.string(),
892
- message: z9.string(),
893
- operationId: z9.string(),
894
- metadata: z9.record(z9.string(), jsonValueSchema).optional()
895
- });
896
- var systemInteractionLifecycleEventDataSchema = z9.object({
911
+ nextParentThreadId: z10.string().nullable(),
912
+ nextParentThreadTitle: z10.string().nullable(),
913
+ previousParentThreadId: z10.string().nullable(),
914
+ previousParentThreadTitle: z10.string().nullable()
915
+ });
916
+ var systemOperationEventDataSchema = z10.object({
917
+ operation: z10.string(),
918
+ status: z10.string(),
919
+ message: z10.string(),
920
+ operationId: z10.string(),
921
+ metadata: z10.record(z10.string(), jsonValueSchema).optional()
922
+ });
923
+ var systemInteractionLifecycleEventDataSchema = z10.object({
897
924
  interaction: interactionLifecycleSchema
898
925
  });
899
- var systemPermissionGrantLifecycleEventDataSchema = z9.object({
900
- interactionId: z9.string(),
901
- providerId: z9.string(),
902
- providerRequestId: z9.string(),
926
+ var systemPermissionGrantLifecycleEventDataSchema = z10.object({
927
+ interactionId: z10.string(),
928
+ providerId: z10.string(),
929
+ providerRequestId: z10.string(),
903
930
  status: pendingInteractionStatusSchema,
904
931
  resolution: approvalPendingInteractionResolutionSchema.nullable().default(null),
905
- statusReason: z9.string().nullable().default(null),
932
+ statusReason: z10.string().nullable().default(null),
906
933
  subject: pendingInteractionPermissionGrantApprovalSubjectSchema
907
934
  });
908
- var systemUserQuestionLifecycleEventDataSchema = z9.object({
909
- interactionId: z9.string(),
910
- providerId: z9.string(),
911
- providerRequestId: z9.string(),
935
+ var systemUserQuestionLifecycleEventDataSchema = z10.object({
936
+ interactionId: z10.string(),
937
+ providerId: z10.string(),
938
+ providerRequestId: z10.string(),
912
939
  status: pendingInteractionStatusSchema,
913
940
  resolution: userQuestionPendingInteractionResolutionSchema.nullable().default(null),
914
- statusReason: z9.string().nullable().default(null),
941
+ statusReason: z10.string().nullable().default(null),
915
942
  payload: userQuestionPendingInteractionPayloadSchema
916
943
  });
917
944
  var systemThreadInterruptedReasonValues = [
@@ -919,20 +946,20 @@ var systemThreadInterruptedReasonValues = [
919
946
  "host-daemon-restarted",
920
947
  "provider-turn-idle"
921
948
  ];
922
- var systemThreadInterruptedReasonSchema = z9.enum(
949
+ var systemThreadInterruptedReasonSchema = z10.enum(
923
950
  systemThreadInterruptedReasonValues
924
951
  );
925
- var systemThreadInterruptedEventDataSchema = z9.object({
952
+ var systemThreadInterruptedEventDataSchema = z10.object({
926
953
  reason: systemThreadInterruptedReasonSchema,
927
- cause: z9.literal("host-connection-lost").optional()
954
+ cause: z10.literal("host-connection-lost").optional()
928
955
  });
929
- var provisioningTranscriptEntrySchema = z9.object({
930
- type: z9.enum(["step", "output"]),
931
- key: z9.string(),
932
- text: z9.string(),
933
- startedAt: z9.number().optional(),
934
- status: z9.enum(["started", "completed", "failed"]).optional(),
935
- metadata: z9.record(z9.string(), z9.unknown()).optional()
956
+ var provisioningTranscriptEntrySchema = z10.object({
957
+ type: z10.enum(["step", "output"]),
958
+ key: z10.string(),
959
+ text: z10.string(),
960
+ startedAt: z10.number().optional(),
961
+ status: z10.enum(["started", "completed", "failed"]).optional(),
962
+ metadata: z10.record(z10.string(), z10.unknown()).optional()
936
963
  });
937
964
  var systemThreadProvisioningStatusValues = [
938
965
  "active",
@@ -940,48 +967,48 @@ var systemThreadProvisioningStatusValues = [
940
967
  "failed",
941
968
  "cancelled"
942
969
  ];
943
- var systemThreadProvisioningStatusSchema = z9.enum(
970
+ var systemThreadProvisioningStatusSchema = z10.enum(
944
971
  systemThreadProvisioningStatusValues
945
972
  );
946
- var systemThreadProvisioningEventDataSchema = z9.object({
947
- provisioningId: z9.string(),
973
+ var systemThreadProvisioningEventDataSchema = z10.object({
974
+ provisioningId: z10.string(),
948
975
  status: systemThreadProvisioningStatusSchema,
949
- environmentId: z9.string().nullable(),
950
- entries: z9.array(provisioningTranscriptEntrySchema)
951
- });
952
- var systemLegacyUserMessageEventDataSchema = z9.object({
953
- text: z9.string(),
954
- toolCallId: z9.string().optional(),
955
- turnId: z9.string().optional()
956
- });
957
- var systemProviderTurnWatchdogEventDataSchema = z9.object({
958
- reason: z9.literal("provider-turn-idle"),
959
- thresholdMs: z9.number().int().positive(),
960
- elapsedMs: z9.number().int().nonnegative(),
961
- activeTurnId: z9.string().min(1),
962
- activeTurnStartedAt: z9.number().int().nonnegative(),
963
- lastActivityEventSequence: z9.number().int().positive(),
964
- lastActivityEventType: z9.string().min(1),
965
- lastActivityEventAt: z9.number().int().nonnegative(),
966
- providerId: z9.string().min(1),
967
- providerThreadId: z9.string().min(1).nullable(),
968
- firedAt: z9.number().int().nonnegative()
976
+ environmentId: z10.string().nullable(),
977
+ entries: z10.array(provisioningTranscriptEntrySchema)
978
+ });
979
+ var systemLegacyUserMessageEventDataSchema = z10.object({
980
+ text: z10.string(),
981
+ toolCallId: z10.string().optional(),
982
+ turnId: z10.string().optional()
983
+ });
984
+ var systemProviderTurnWatchdogEventDataSchema = z10.object({
985
+ reason: z10.literal("provider-turn-idle"),
986
+ thresholdMs: z10.number().int().positive(),
987
+ elapsedMs: z10.number().int().nonnegative(),
988
+ activeTurnId: z10.string().min(1),
989
+ activeTurnStartedAt: z10.number().int().nonnegative(),
990
+ lastActivityEventSequence: z10.number().int().positive(),
991
+ lastActivityEventType: z10.string().min(1),
992
+ lastActivityEventAt: z10.number().int().nonnegative(),
993
+ providerId: z10.string().min(1),
994
+ providerThreadId: z10.string().min(1).nullable(),
995
+ firedAt: z10.number().int().nonnegative()
969
996
  });
970
997
 
971
998
  // ../domain/src/thread-event-scope.ts
972
- import { z as z10 } from "zod";
999
+ import { z as z11 } from "zod";
973
1000
  var threadEventScopeKindValues = ["thread", "turn"];
974
- var threadEventScopeKindSchema = z10.enum(threadEventScopeKindValues);
975
- var threadEventScopeSchema = z10.discriminatedUnion("kind", [
976
- z10.object({ kind: z10.literal("thread") }),
977
- z10.object({ kind: z10.literal("turn"), turnId: z10.string().min(1) })
1001
+ var threadEventScopeKindSchema = z11.enum(threadEventScopeKindValues);
1002
+ var threadEventScopeSchema = z11.discriminatedUnion("kind", [
1003
+ z11.object({ kind: z11.literal("thread") }),
1004
+ z11.object({ kind: z11.literal("turn"), turnId: z11.string().min(1) })
978
1005
  ]);
979
1006
  var threadEventScopePolicyValues = [
980
1007
  "thread",
981
1008
  "turn",
982
1009
  "thread-or-turn"
983
1010
  ];
984
- var threadEventScopePolicySchema = z10.enum(threadEventScopePolicyValues);
1011
+ var threadEventScopePolicySchema = z11.enum(threadEventScopePolicyValues);
985
1012
  var threadEventScopeDefinitionByType = {
986
1013
  "thread/started": {
987
1014
  policy: "thread",
@@ -1124,9 +1151,6 @@ function getThreadEventScopePolicyDefinitionEntries() {
1124
1151
  })
1125
1152
  );
1126
1153
  }
1127
- function getThreadEventTypesForScopePolicy(policy) {
1128
- return getThreadEventScopePolicyDefinitionEntries().filter((entry) => entry.definition.policy === policy).map((entry) => entry.type);
1129
- }
1130
1154
  function buildThreadEventScopePolicyByType() {
1131
1155
  const policies = {};
1132
1156
  for (const entry of getThreadEventScopePolicyDefinitionEntries()) {
@@ -1134,20 +1158,7 @@ function buildThreadEventScopePolicyByType() {
1134
1158
  }
1135
1159
  return policies;
1136
1160
  }
1137
- function buildThreadScopeRationaleByType() {
1138
- const rationales = {};
1139
- for (const entry of getThreadEventScopePolicyDefinitionEntries()) {
1140
- if (entry.definition.rationale) {
1141
- rationales[entry.type] = entry.definition.rationale;
1142
- }
1143
- }
1144
- return rationales;
1145
- }
1146
- var turnOnlyThreadEventTypes = getThreadEventTypesForScopePolicy("turn");
1147
- var threadOnlyThreadEventTypes = getThreadEventTypesForScopePolicy("thread");
1148
- var threadOrTurnThreadEventTypes = getThreadEventTypesForScopePolicy("thread-or-turn");
1149
1161
  var threadEventScopePolicyByType = buildThreadEventScopePolicyByType();
1150
- var threadScopeRationaleByType = buildThreadScopeRationaleByType();
1151
1162
  function threadScope() {
1152
1163
  return { kind: "thread" };
1153
1164
  }
@@ -1172,32 +1183,32 @@ function validateThreadEventScope(args) {
1172
1183
  }
1173
1184
 
1174
1185
  // ../domain/src/thread-timeline-goal.ts
1175
- import { z as z11 } from "zod";
1176
- var threadTimelineGoalStatusSchema = z11.enum([
1186
+ import { z as z12 } from "zod";
1187
+ var threadTimelineGoalStatusSchema = z12.enum([
1177
1188
  "active",
1178
1189
  "paused",
1179
1190
  "budgetLimited",
1180
1191
  "complete"
1181
1192
  ]);
1182
- var threadTimelineGoalSchema = z11.object({
1183
- sourceSeq: z11.number().int().nonnegative(),
1184
- updatedAt: z11.number(),
1185
- objective: z11.string(),
1193
+ var threadTimelineGoalSchema = z12.object({
1194
+ sourceSeq: z12.number().int().nonnegative(),
1195
+ updatedAt: z12.number(),
1196
+ objective: z12.string(),
1186
1197
  status: threadTimelineGoalStatusSchema,
1187
- tokenBudget: z11.number().nullable(),
1188
- tokensUsed: z11.number(),
1189
- timeUsedSeconds: z11.number()
1198
+ tokenBudget: z12.number().nullable(),
1199
+ tokensUsed: z12.number(),
1200
+ timeUsedSeconds: z12.number()
1190
1201
  });
1191
1202
 
1192
1203
  // ../domain/src/provider-event.ts
1193
- var threadEventItemStatusSchema = z12.enum([
1204
+ var threadEventItemStatusSchema = z13.enum([
1194
1205
  "pending",
1195
1206
  "completed",
1196
1207
  "failed",
1197
1208
  "interrupted"
1198
1209
  ]);
1199
- var threadEventItemApprovalStatusSchema = z12.enum(["waiting_for_approval", "denied"]).nullable();
1200
- var threadEventTurnStatusSchema = z12.enum([
1210
+ var threadEventItemApprovalStatusSchema = z13.enum(["waiting_for_approval", "denied"]).nullable();
1211
+ var threadEventTurnStatusSchema = z13.enum([
1201
1212
  "completed",
1202
1213
  "failed",
1203
1214
  "interrupted"
@@ -1223,259 +1234,260 @@ var providerErrorCategoryValues = [
1223
1234
  "unauthorized",
1224
1235
  "unknown"
1225
1236
  ];
1226
- var providerErrorCategorySchema = z12.enum(providerErrorCategoryValues);
1227
- var providerErrorInfoSchema = z12.object({
1237
+ var providerErrorCategorySchema = z13.enum(providerErrorCategoryValues);
1238
+ var providerErrorInfoSchema = z13.object({
1228
1239
  category: providerErrorCategorySchema,
1229
- providerCode: z12.string().nullable(),
1230
- httpStatusCode: z12.number().nullable()
1240
+ providerCode: z13.string().nullable(),
1241
+ httpStatusCode: z13.number().nullable()
1231
1242
  });
1232
- var providerRateLimitStatusSchema = z12.enum([
1243
+ var providerRateLimitStatusSchema = z13.enum([
1233
1244
  "allowed",
1234
1245
  "warning",
1235
1246
  "blocked",
1236
1247
  "unknown"
1237
1248
  ]);
1238
- var providerRateLimitWindowSchema = z12.object({
1239
- providerKey: z12.string().min(1).nullable(),
1240
- label: z12.string().min(1).nullable(),
1249
+ var providerRateLimitWindowSchema = z13.object({
1250
+ providerKey: z13.string().min(1).nullable(),
1251
+ label: z13.string().min(1).nullable(),
1241
1252
  status: providerRateLimitStatusSchema,
1242
- resetsAtMs: z12.number().int().nonnegative().nullable()
1253
+ resetsAtMs: z13.number().int().nonnegative().nullable()
1243
1254
  });
1244
- var providerRateLimitStateSchema = z12.object({
1245
- providerId: z12.string().min(1),
1255
+ var providerRateLimitStateSchema = z13.object({
1256
+ providerId: z13.string().min(1),
1246
1257
  status: providerRateLimitStatusSchema,
1247
- kind: z12.enum(["subscription-window", "credits", "spend-control", "unknown"]),
1248
- windows: z12.array(providerRateLimitWindowSchema),
1249
- reachedReason: z12.string().min(1).nullable(),
1250
- overageStatus: z12.enum(["allowed", "warning", "rejected", "unavailable"]).nullable(),
1251
- overageReason: z12.string().min(1).nullable()
1252
- });
1253
- var threadEventFileChangeKindSchema = z12.enum(["add", "delete", "update"]);
1254
- var threadEventFileChangeSchema = z12.object({
1255
- path: z12.string(),
1258
+ kind: z13.enum(["subscription-window", "credits", "spend-control", "unknown"]),
1259
+ windows: z13.array(providerRateLimitWindowSchema),
1260
+ reachedReason: z13.string().min(1).nullable(),
1261
+ overageStatus: z13.enum(["allowed", "warning", "rejected", "unavailable"]).nullable(),
1262
+ overageReason: z13.string().min(1).nullable()
1263
+ });
1264
+ var threadEventFileChangeKindSchema = z13.enum(["add", "delete", "update"]);
1265
+ var threadEventFileChangeSchema = z13.object({
1266
+ path: z13.string(),
1256
1267
  kind: threadEventFileChangeKindSchema,
1257
- movePath: z12.string().optional(),
1258
- diff: z12.string().optional()
1268
+ movePath: z13.string().optional(),
1269
+ diff: z13.string().optional()
1259
1270
  });
1260
- var threadEventPlanStepStatusSchema = z12.enum([
1271
+ var threadEventPlanStepStatusSchema = z13.enum([
1261
1272
  "pending",
1262
1273
  "active",
1263
1274
  "completed",
1264
1275
  "failed"
1265
1276
  ]);
1266
- var threadEventPlanStepSchema = z12.object({
1267
- step: z12.string(),
1277
+ var threadEventPlanStepSchema = z13.object({
1278
+ step: z13.string(),
1268
1279
  status: threadEventPlanStepStatusSchema.optional()
1269
1280
  });
1270
1281
  var itemPresentationField = {
1271
1282
  presentation: threadEventItemPresentationSchema.optional()
1272
1283
  };
1273
- var threadEventWebSearchItemSchema = z12.object({
1274
- type: z12.literal("webSearch"),
1275
- id: z12.string(),
1276
- queries: z12.array(z12.string()).min(1),
1277
- resultText: z12.string().nullable(),
1284
+ var threadEventWebSearchItemSchema = z13.object({
1285
+ type: z13.literal("webSearch"),
1286
+ id: z13.string(),
1287
+ queries: z13.array(z13.string()).min(1),
1288
+ resultText: z13.string().nullable(),
1278
1289
  ...itemPresentationField,
1279
- parentToolCallId: z12.string().optional()
1280
- });
1281
- var threadEventWebFetchItemSchema = z12.object({
1282
- type: z12.literal("webFetch"),
1283
- id: z12.string(),
1284
- url: z12.string(),
1285
- prompt: z12.string().nullable(),
1286
- pattern: z12.string().nullable(),
1287
- resultText: z12.string().nullable(),
1290
+ parentToolCallId: z13.string().optional()
1291
+ });
1292
+ var threadEventWebFetchItemSchema = z13.object({
1293
+ type: z13.literal("webFetch"),
1294
+ id: z13.string(),
1295
+ url: z13.string(),
1296
+ prompt: z13.string().nullable(),
1297
+ pattern: z13.string().nullable(),
1298
+ resultText: z13.string().nullable(),
1288
1299
  ...itemPresentationField,
1289
- parentToolCallId: z12.string().optional()
1300
+ parentToolCallId: z13.string().optional()
1290
1301
  });
1291
- var threadEventImageViewItemSchema = z12.object({
1292
- type: z12.literal("imageView"),
1293
- id: z12.string(),
1294
- path: z12.string(),
1302
+ var threadEventImageViewItemSchema = z13.object({
1303
+ type: z13.literal("imageView"),
1304
+ id: z13.string(),
1305
+ path: z13.string(),
1295
1306
  ...itemPresentationField,
1296
- parentToolCallId: z12.string().optional()
1307
+ parentToolCallId: z13.string().optional()
1297
1308
  });
1298
- var threadEventFileReadItemSchema = z12.object({
1299
- type: z12.literal("fileRead"),
1300
- id: z12.string(),
1301
- path: z12.string(),
1302
- cmd: z12.string().optional(),
1309
+ var threadEventFileReadItemSchema = z13.object({
1310
+ type: z13.literal("fileRead"),
1311
+ id: z13.string(),
1312
+ path: z13.string(),
1313
+ cmd: z13.string().optional(),
1303
1314
  status: threadEventItemStatusSchema,
1304
1315
  ...itemPresentationField,
1305
- parentToolCallId: z12.string().optional()
1316
+ parentToolCallId: z13.string().optional()
1306
1317
  });
1307
- var threadEventSearchModeSchema = z12.enum(["content", "path", "list"]);
1308
- var threadEventSearchItemSchema = z12.object({
1309
- type: z12.literal("search"),
1310
- id: z12.string(),
1318
+ var threadEventSearchModeSchema = z13.enum(["content", "path", "list"]);
1319
+ var threadEventSearchItemSchema = z13.object({
1320
+ type: z13.literal("search"),
1321
+ id: z13.string(),
1311
1322
  mode: threadEventSearchModeSchema,
1312
- query: z12.string(),
1313
- path: z12.string().optional(),
1314
- cmd: z12.string().optional(),
1323
+ query: z13.string(),
1324
+ path: z13.string().optional(),
1325
+ cmd: z13.string().optional(),
1315
1326
  status: threadEventItemStatusSchema,
1316
1327
  ...itemPresentationField,
1317
- parentToolCallId: z12.string().optional()
1328
+ parentToolCallId: z13.string().optional()
1318
1329
  });
1319
- var threadEventDelegationItemSchema = z12.object({
1320
- type: z12.literal("delegation"),
1321
- id: z12.string(),
1322
- childRef: z12.string().min(1),
1323
- label: z12.string(),
1330
+ var threadEventDelegationItemSchema = z13.object({
1331
+ type: z13.literal("delegation"),
1332
+ id: z13.string(),
1333
+ childRef: z13.string().min(1),
1334
+ label: z13.string(),
1324
1335
  status: threadEventItemStatusSchema,
1325
- background: z12.boolean(),
1326
- summary: z12.string().optional(),
1336
+ background: z13.boolean(),
1337
+ summary: z13.string().optional(),
1327
1338
  ...itemPresentationField,
1328
- parentToolCallId: z12.string().optional()
1339
+ parentToolCallId: z13.string().optional()
1329
1340
  });
1330
- var threadEventPlanStepsItemSchema = z12.object({
1331
- type: z12.literal("planSteps"),
1332
- id: z12.string(),
1333
- steps: z12.array(threadEventPlanStepSchema),
1334
- explanation: z12.string().optional(),
1341
+ var threadEventPlanStepsItemSchema = z13.object({
1342
+ type: z13.literal("planSteps"),
1343
+ id: z13.string(),
1344
+ steps: z13.array(threadEventPlanStepSchema),
1345
+ explanation: z13.string().optional(),
1335
1346
  status: threadEventItemStatusSchema,
1336
1347
  ...itemPresentationField,
1337
- parentToolCallId: z12.string().optional()
1348
+ parentToolCallId: z13.string().optional()
1338
1349
  });
1339
- var threadEventExtensionItemSchema = z12.object({
1340
- type: z12.literal("extension"),
1341
- id: z12.string(),
1350
+ var threadEventExtensionItemSchema = z13.object({
1351
+ type: z13.literal("extension"),
1352
+ id: z13.string(),
1342
1353
  kind: extensionKindSchema,
1343
1354
  payload: jsonValueSchema,
1344
1355
  status: threadEventItemStatusSchema,
1345
1356
  presentation: threadEventItemPresentationSchema,
1346
- parentToolCallId: z12.string().optional()
1357
+ parentToolCallId: z13.string().optional()
1347
1358
  });
1348
- var threadEventTextTruncationSchema = z12.object({
1349
- originalLength: z12.number(),
1350
- retainedHeadLength: z12.number(),
1351
- retainedTailLength: z12.number(),
1352
- truncatedAt: z12.number()
1359
+ var threadEventTextTruncationSchema = z13.object({
1360
+ originalLength: z13.number(),
1361
+ retainedHeadLength: z13.number(),
1362
+ retainedTailLength: z13.number(),
1363
+ truncatedAt: z13.number()
1353
1364
  });
1354
- var threadEventItemTruncationSchema = z12.object({
1365
+ var threadEventItemTruncationSchema = z13.object({
1355
1366
  aggregatedOutput: threadEventTextTruncationSchema.optional(),
1356
1367
  result: threadEventTextTruncationSchema.optional(),
1357
1368
  resultText: threadEventTextTruncationSchema.optional()
1358
1369
  });
1359
- var threadEventImageGenerationItemSchema = z12.object({
1360
- type: z12.literal("imageGeneration"),
1361
- id: z12.string(),
1370
+ var threadEventImageGenerationItemSchema = z13.object({
1371
+ type: z13.literal("imageGeneration"),
1372
+ id: z13.string(),
1362
1373
  status: threadEventItemStatusSchema,
1363
- prompt: z12.string().nullable(),
1364
- path: z12.string().nullable(),
1365
- result: z12.string().optional(),
1366
- error: z12.string().nullable(),
1367
- transparentBackground: z12.boolean(),
1374
+ prompt: z13.string().nullable(),
1375
+ path: z13.string().nullable(),
1376
+ result: z13.string().optional(),
1377
+ error: z13.string().nullable(),
1378
+ transparentBackground: z13.boolean(),
1368
1379
  truncation: threadEventItemTruncationSchema.optional(),
1369
1380
  ...itemPresentationField,
1370
- parentToolCallId: z12.string().optional()
1381
+ parentToolCallId: z13.string().optional()
1371
1382
  });
1372
- var threadEventUserContentSchema = z12.discriminatedUnion("type", [
1373
- z12.object({ type: z12.literal("text"), text: z12.string() }),
1374
- z12.object({ type: z12.literal("image"), url: z12.string() }),
1375
- z12.object({ type: z12.literal("localImage"), path: z12.string() }),
1376
- z12.object({ type: z12.literal("localFile"), path: z12.string() })
1383
+ var threadEventUserContentSchema = z13.discriminatedUnion("type", [
1384
+ z13.object({ type: z13.literal("text"), text: z13.string() }),
1385
+ z13.object({ type: z13.literal("image"), url: z13.string() }),
1386
+ z13.object({ type: z13.literal("localImage"), path: z13.string() }),
1387
+ z13.object({ type: z13.literal("localFile"), path: z13.string() })
1377
1388
  ]);
1378
- var threadEventTokenUsageBreakdownSchema = z12.object({
1379
- totalTokens: z12.number(),
1380
- inputTokens: z12.number(),
1381
- cachedInputTokens: z12.number(),
1382
- outputTokens: z12.number(),
1383
- reasoningOutputTokens: z12.number()
1384
- });
1385
- var threadEventContextWindowUsageSchema = z12.object({
1386
- usedTokens: z12.number().nullable(),
1387
- modelContextWindow: z12.number().nullable(),
1388
- estimated: z12.boolean()
1389
- });
1390
- var threadEventTokenUsageSchema = z12.object({
1389
+ var threadEventTokenUsageBreakdownSchema = z13.object({
1390
+ totalTokens: z13.number(),
1391
+ inputTokens: z13.number(),
1392
+ cachedInputTokens: z13.number(),
1393
+ outputTokens: z13.number(),
1394
+ reasoningOutputTokens: z13.number()
1395
+ });
1396
+ var threadEventContextWindowUsageSchema = z13.object({
1397
+ snapshot: contextSnapshotSchema.optional(),
1398
+ usedTokens: z13.number().nullable(),
1399
+ modelContextWindow: z13.number().nullable(),
1400
+ estimated: z13.boolean()
1401
+ });
1402
+ var threadEventTokenUsageSchema = z13.object({
1391
1403
  total: threadEventTokenUsageBreakdownSchema,
1392
1404
  last: threadEventTokenUsageBreakdownSchema,
1393
- modelContextWindow: z12.number().nullable()
1405
+ modelContextWindow: z13.number().nullable()
1394
1406
  });
1395
- var threadEventWarningCategorySchema = z12.enum([
1407
+ var threadEventWarningCategorySchema = z13.enum([
1396
1408
  "deprecation",
1397
1409
  "config",
1398
1410
  "general",
1399
1411
  "compaction-skipped"
1400
1412
  ]);
1401
- var providerRawEventSchema = z12.object({
1402
- jsonrpc: z12.literal("2.0"),
1403
- id: z12.union([z12.string(), z12.number()]).optional(),
1404
- method: z12.string(),
1413
+ var providerRawEventSchema = z13.object({
1414
+ jsonrpc: z13.literal("2.0"),
1415
+ id: z13.union([z13.string(), z13.number()]).optional(),
1416
+ method: z13.string(),
1405
1417
  params: jsonValueSchema.optional()
1406
1418
  });
1407
- var providerUnhandledEventSchema = z12.object({
1408
- type: z12.literal("provider/unhandled"),
1409
- threadId: z12.string(),
1410
- providerThreadId: z12.string(),
1411
- providerId: z12.string(),
1412
- rawType: z12.string(),
1419
+ var providerUnhandledEventSchema = z13.object({
1420
+ type: z13.literal("provider/unhandled"),
1421
+ threadId: z13.string(),
1422
+ providerThreadId: z13.string(),
1423
+ providerId: z13.string(),
1424
+ rawType: z13.string(),
1413
1425
  rawEvent: providerRawEventSchema,
1414
- parentToolCallId: z12.string().optional()
1415
- });
1416
- var toolCallProgressEventSchema = z12.object({
1417
- type: z12.literal("item/toolCall/progress"),
1418
- threadId: z12.string(),
1419
- providerThreadId: z12.string(),
1420
- itemId: z12.string(),
1421
- message: z12.string().optional(),
1422
- parentToolCallId: z12.string().optional()
1423
- });
1424
- var threadEventBackgroundTaskItemSchema = z12.object({
1425
- type: z12.literal("backgroundTask"),
1426
- id: z12.string(),
1427
- familyId: z12.string().optional(),
1428
- taskType: z12.string(),
1429
- description: z12.string(),
1426
+ parentToolCallId: z13.string().optional()
1427
+ });
1428
+ var toolCallProgressEventSchema = z13.object({
1429
+ type: z13.literal("item/toolCall/progress"),
1430
+ threadId: z13.string(),
1431
+ providerThreadId: z13.string(),
1432
+ itemId: z13.string(),
1433
+ message: z13.string().optional(),
1434
+ parentToolCallId: z13.string().optional()
1435
+ });
1436
+ var threadEventBackgroundTaskItemSchema = z13.object({
1437
+ type: z13.literal("backgroundTask"),
1438
+ id: z13.string(),
1439
+ familyId: z13.string().optional(),
1440
+ taskType: z13.string(),
1441
+ description: z13.string(),
1430
1442
  status: threadEventItemStatusSchema,
1431
1443
  taskStatus: backgroundTaskStatusSchema,
1432
- skipTranscript: z12.boolean(),
1433
- workflowName: z12.string().optional(),
1444
+ skipTranscript: z13.boolean(),
1445
+ workflowName: z13.string().optional(),
1434
1446
  workflow: workflowProgressSnapshotSchema.optional(),
1435
1447
  usage: backgroundTaskUsageSchema.optional(),
1436
- summary: z12.string().optional(),
1437
- error: z12.string().optional(),
1438
- outputFile: z12.string().optional(),
1448
+ summary: z13.string().optional(),
1449
+ error: z13.string().optional(),
1450
+ outputFile: z13.string().optional(),
1439
1451
  ...itemPresentationField,
1440
- parentToolCallId: z12.string().optional()
1452
+ parentToolCallId: z13.string().optional()
1441
1453
  });
1442
- var threadEventItemSchema = z12.discriminatedUnion("type", [
1443
- z12.object({
1444
- type: z12.literal("userMessage"),
1445
- id: z12.string(),
1446
- content: z12.array(threadEventUserContentSchema),
1454
+ var threadEventItemSchema = z13.discriminatedUnion("type", [
1455
+ z13.object({
1456
+ type: z13.literal("userMessage"),
1457
+ id: z13.string(),
1458
+ content: z13.array(threadEventUserContentSchema),
1447
1459
  clientRequestId: clientTurnRequestIdSchema.optional(),
1448
- parentToolCallId: z12.string().optional()
1460
+ parentToolCallId: z13.string().optional()
1449
1461
  }).strict(),
1450
- z12.object({
1451
- type: z12.literal("agentMessage"),
1452
- id: z12.string(),
1453
- text: z12.string(),
1462
+ z13.object({
1463
+ type: z13.literal("agentMessage"),
1464
+ id: z13.string(),
1465
+ text: z13.string(),
1454
1466
  ...itemPresentationField,
1455
- parentToolCallId: z12.string().optional()
1467
+ parentToolCallId: z13.string().optional()
1456
1468
  }),
1457
- z12.object({
1458
- type: z12.literal("commandExecution"),
1459
- id: z12.string(),
1460
- command: z12.string(),
1461
- cwd: z12.string(),
1469
+ z13.object({
1470
+ type: z13.literal("commandExecution"),
1471
+ id: z13.string(),
1472
+ command: z13.string(),
1473
+ cwd: z13.string(),
1462
1474
  status: threadEventItemStatusSchema,
1463
1475
  approvalStatus: threadEventItemApprovalStatusSchema,
1464
- aggregatedOutput: z12.string().optional(),
1465
- exitCode: z12.number().optional(),
1466
- durationMs: z12.number().optional(),
1476
+ aggregatedOutput: z13.string().optional(),
1477
+ exitCode: z13.number().optional(),
1478
+ durationMs: z13.number().optional(),
1467
1479
  truncation: threadEventItemTruncationSchema.optional(),
1468
1480
  ...itemPresentationField,
1469
- parentToolCallId: z12.string().optional()
1481
+ parentToolCallId: z13.string().optional()
1470
1482
  }),
1471
- z12.object({
1472
- type: z12.literal("fileChange"),
1473
- id: z12.string(),
1474
- changes: z12.array(threadEventFileChangeSchema),
1483
+ z13.object({
1484
+ type: z13.literal("fileChange"),
1485
+ id: z13.string(),
1486
+ changes: z13.array(threadEventFileChangeSchema),
1475
1487
  status: threadEventItemStatusSchema,
1476
1488
  approvalStatus: threadEventItemApprovalStatusSchema,
1477
1489
  ...itemPresentationField,
1478
- parentToolCallId: z12.string().optional()
1490
+ parentToolCallId: z13.string().optional()
1479
1491
  }),
1480
1492
  threadEventWebSearchItemSchema,
1481
1493
  threadEventWebFetchItemSchema,
@@ -1483,288 +1495,264 @@ var threadEventItemSchema = z12.discriminatedUnion("type", [
1483
1495
  threadEventImageGenerationItemSchema,
1484
1496
  threadEventFileReadItemSchema,
1485
1497
  threadEventSearchItemSchema,
1486
- z12.object({
1487
- type: z12.literal("toolCall"),
1488
- id: z12.string(),
1489
- server: z12.string().optional(),
1490
- tool: z12.string(),
1491
- arguments: z12.record(z12.string(), z12.unknown()).optional(),
1498
+ z13.object({
1499
+ type: z13.literal("toolCall"),
1500
+ id: z13.string(),
1501
+ server: z13.string().optional(),
1502
+ tool: z13.string(),
1503
+ arguments: z13.record(z13.string(), z13.unknown()).optional(),
1492
1504
  status: threadEventItemStatusSchema,
1493
- result: z12.unknown().optional(),
1494
- error: z12.string().optional(),
1495
- durationMs: z12.number().optional(),
1505
+ result: z13.unknown().optional(),
1506
+ error: z13.string().optional(),
1507
+ durationMs: z13.number().optional(),
1496
1508
  truncation: threadEventItemTruncationSchema.optional(),
1497
1509
  ...itemPresentationField,
1498
- parentToolCallId: z12.string().optional()
1510
+ parentToolCallId: z13.string().optional()
1499
1511
  }),
1500
- z12.object({
1501
- type: z12.literal("reasoning"),
1502
- id: z12.string(),
1503
- summary: z12.array(z12.string()),
1504
- content: z12.array(z12.string()),
1512
+ z13.object({
1513
+ type: z13.literal("reasoning"),
1514
+ id: z13.string(),
1515
+ summary: z13.array(z13.string()),
1516
+ content: z13.array(z13.string()),
1505
1517
  ...itemPresentationField,
1506
- parentToolCallId: z12.string().optional()
1518
+ parentToolCallId: z13.string().optional()
1507
1519
  }),
1508
- z12.object({
1509
- type: z12.literal("plan"),
1510
- id: z12.string(),
1511
- text: z12.string(),
1520
+ z13.object({
1521
+ type: z13.literal("plan"),
1522
+ id: z13.string(),
1523
+ text: z13.string(),
1512
1524
  ...itemPresentationField,
1513
- parentToolCallId: z12.string().optional()
1525
+ parentToolCallId: z13.string().optional()
1514
1526
  }),
1515
1527
  threadEventPlanStepsItemSchema,
1516
- z12.object({
1517
- type: z12.literal("contextCompaction"),
1518
- id: z12.string(),
1528
+ z13.object({
1529
+ type: z13.literal("contextCompaction"),
1530
+ id: z13.string(),
1519
1531
  ...itemPresentationField,
1520
- parentToolCallId: z12.string().optional()
1532
+ parentToolCallId: z13.string().optional()
1521
1533
  }),
1522
1534
  threadEventBackgroundTaskItemSchema,
1523
1535
  threadEventDelegationItemSchema,
1524
1536
  threadEventExtensionItemSchema
1525
1537
  ]);
1526
- var unscopedProviderEventSchema = z12.discriminatedUnion("type", [
1527
- z12.object({
1528
- type: z12.literal("thread/started"),
1529
- threadId: z12.string()
1538
+ function itemTextDeltaEventSchema(type) {
1539
+ return z13.object({
1540
+ type: z13.literal(type),
1541
+ threadId: z13.string(),
1542
+ providerThreadId: z13.string(),
1543
+ itemId: z13.string(),
1544
+ delta: z13.string(),
1545
+ parentToolCallId: z13.string().optional()
1546
+ });
1547
+ }
1548
+ var unscopedProviderEventSchema = z13.discriminatedUnion("type", [
1549
+ z13.object({
1550
+ type: z13.literal("thread/started"),
1551
+ threadId: z13.string()
1530
1552
  }),
1531
- z12.object({
1532
- type: z12.literal("thread/identity"),
1533
- threadId: z12.string(),
1534
- providerThreadId: z12.string()
1553
+ z13.object({
1554
+ type: z13.literal("thread/identity"),
1555
+ threadId: z13.string(),
1556
+ providerThreadId: z13.string()
1535
1557
  }),
1536
- z12.object({
1537
- type: z12.literal("turn/started"),
1538
- threadId: z12.string(),
1539
- providerThreadId: z12.string(),
1540
- parentToolCallId: z12.string().optional()
1558
+ z13.object({
1559
+ type: z13.literal("turn/started"),
1560
+ threadId: z13.string(),
1561
+ providerThreadId: z13.string(),
1562
+ parentToolCallId: z13.string().optional()
1541
1563
  }),
1542
- z12.object({
1543
- type: z12.literal("turn/completed"),
1544
- threadId: z12.string(),
1545
- providerThreadId: z12.string().nullable(),
1564
+ z13.object({
1565
+ type: z13.literal("turn/completed"),
1566
+ threadId: z13.string(),
1567
+ providerThreadId: z13.string().nullable(),
1546
1568
  status: threadEventTurnStatusSchema,
1547
- error: z12.object({ message: z12.string() }).optional(),
1548
- providerCheckpointId: z12.string().min(1).optional()
1569
+ error: z13.object({ message: z13.string() }).optional(),
1570
+ providerCheckpointId: z13.string().min(1).optional()
1549
1571
  }),
1550
- z12.object({
1551
- type: z12.literal("turn/input/accepted"),
1552
- threadId: z12.string(),
1553
- providerThreadId: z12.string(),
1572
+ z13.object({
1573
+ type: z13.literal("turn/input/accepted"),
1574
+ threadId: z13.string(),
1575
+ providerThreadId: z13.string(),
1554
1576
  clientRequestId: clientTurnRequestIdSchema,
1555
1577
  scope: threadEventScopeSchema
1556
1578
  }).strict(),
1557
- z12.object({
1558
- type: z12.literal("thread/name/updated"),
1559
- threadId: z12.string(),
1560
- providerThreadId: z12.string(),
1561
- threadName: z12.string()
1579
+ z13.object({
1580
+ type: z13.literal("thread/name/updated"),
1581
+ threadId: z13.string(),
1582
+ providerThreadId: z13.string(),
1583
+ threadName: z13.string()
1562
1584
  }),
1563
- z12.object({
1564
- type: z12.literal("thread/compacted"),
1565
- threadId: z12.string(),
1566
- providerThreadId: z12.string()
1585
+ z13.object({
1586
+ type: z13.literal("thread/compacted"),
1587
+ threadId: z13.string(),
1588
+ providerThreadId: z13.string()
1567
1589
  }),
1568
- z12.object({
1569
- type: z12.literal("thread/context/cleared"),
1570
- threadId: z12.string(),
1571
- providerThreadId: z12.string()
1590
+ z13.object({
1591
+ type: z13.literal("thread/context/cleared"),
1592
+ threadId: z13.string(),
1593
+ providerThreadId: z13.string()
1572
1594
  }),
1573
- z12.object({
1574
- type: z12.literal("thread/goal/updated"),
1575
- threadId: z12.string(),
1576
- providerThreadId: z12.string(),
1577
- objective: z12.string(),
1595
+ z13.object({
1596
+ type: z13.literal("thread/goal/updated"),
1597
+ threadId: z13.string(),
1598
+ providerThreadId: z13.string(),
1599
+ objective: z13.string(),
1578
1600
  status: threadTimelineGoalStatusSchema,
1579
- tokenBudget: z12.number().nullable(),
1580
- tokensUsed: z12.number(),
1581
- timeUsedSeconds: z12.number()
1601
+ tokenBudget: z13.number().nullable(),
1602
+ tokensUsed: z13.number(),
1603
+ timeUsedSeconds: z13.number()
1582
1604
  }),
1583
- z12.object({
1584
- type: z12.literal("thread/goal/cleared"),
1585
- threadId: z12.string(),
1586
- providerThreadId: z12.string()
1605
+ z13.object({
1606
+ type: z13.literal("thread/goal/cleared"),
1607
+ threadId: z13.string(),
1608
+ providerThreadId: z13.string()
1587
1609
  }),
1588
- z12.object({
1589
- type: z12.literal("item/started"),
1590
- threadId: z12.string(),
1591
- providerThreadId: z12.string(),
1610
+ z13.object({
1611
+ type: z13.literal("item/started"),
1612
+ threadId: z13.string(),
1613
+ providerThreadId: z13.string(),
1592
1614
  item: threadEventItemSchema
1593
1615
  }),
1594
- z12.object({
1595
- type: z12.literal("item/completed"),
1596
- threadId: z12.string(),
1597
- providerThreadId: z12.string(),
1616
+ z13.object({
1617
+ type: z13.literal("item/completed"),
1618
+ threadId: z13.string(),
1619
+ providerThreadId: z13.string(),
1598
1620
  item: threadEventItemSchema
1599
1621
  }),
1600
- z12.object({
1601
- type: z12.literal("item/agentMessage/delta"),
1602
- threadId: z12.string(),
1603
- providerThreadId: z12.string(),
1604
- itemId: z12.string(),
1605
- delta: z12.string(),
1606
- parentToolCallId: z12.string().optional()
1607
- }),
1608
- z12.object({
1609
- type: z12.literal("item/commandExecution/outputDelta"),
1610
- threadId: z12.string(),
1611
- providerThreadId: z12.string(),
1612
- itemId: z12.string(),
1613
- delta: z12.string(),
1614
- reset: z12.boolean().optional(),
1615
- parentToolCallId: z12.string().optional()
1616
- }),
1617
- z12.object({
1618
- type: z12.literal("item/fileChange/outputDelta"),
1619
- threadId: z12.string(),
1620
- providerThreadId: z12.string(),
1621
- itemId: z12.string(),
1622
- delta: z12.string(),
1623
- parentToolCallId: z12.string().optional()
1624
- }),
1625
- z12.object({
1626
- type: z12.literal("item/reasoning/summaryTextDelta"),
1627
- threadId: z12.string(),
1628
- providerThreadId: z12.string(),
1629
- itemId: z12.string(),
1630
- delta: z12.string(),
1631
- parentToolCallId: z12.string().optional()
1632
- }),
1633
- z12.object({
1634
- type: z12.literal("item/reasoning/textDelta"),
1635
- threadId: z12.string(),
1636
- providerThreadId: z12.string(),
1637
- itemId: z12.string(),
1638
- delta: z12.string(),
1639
- parentToolCallId: z12.string().optional()
1640
- }),
1641
- z12.object({
1642
- type: z12.literal("item/plan/delta"),
1643
- threadId: z12.string(),
1644
- providerThreadId: z12.string(),
1645
- itemId: z12.string(),
1646
- delta: z12.string(),
1647
- parentToolCallId: z12.string().optional()
1622
+ itemTextDeltaEventSchema("item/agentMessage/delta"),
1623
+ z13.object({
1624
+ type: z13.literal("item/commandExecution/outputDelta"),
1625
+ threadId: z13.string(),
1626
+ providerThreadId: z13.string(),
1627
+ itemId: z13.string(),
1628
+ delta: z13.string(),
1629
+ reset: z13.boolean().optional(),
1630
+ parentToolCallId: z13.string().optional()
1648
1631
  }),
1649
- z12.object({
1650
- type: z12.literal("item/mcpToolCall/progress"),
1651
- threadId: z12.string(),
1652
- providerThreadId: z12.string(),
1653
- itemId: z12.string(),
1654
- message: z12.string().optional(),
1655
- parentToolCallId: z12.string().optional()
1632
+ itemTextDeltaEventSchema("item/fileChange/outputDelta"),
1633
+ itemTextDeltaEventSchema("item/reasoning/summaryTextDelta"),
1634
+ itemTextDeltaEventSchema("item/reasoning/textDelta"),
1635
+ itemTextDeltaEventSchema("item/plan/delta"),
1636
+ z13.object({
1637
+ type: z13.literal("item/mcpToolCall/progress"),
1638
+ threadId: z13.string(),
1639
+ providerThreadId: z13.string(),
1640
+ itemId: z13.string(),
1641
+ message: z13.string().optional(),
1642
+ parentToolCallId: z13.string().optional()
1656
1643
  }),
1657
1644
  toolCallProgressEventSchema,
1658
- z12.object({
1659
- type: z12.literal("item/backgroundTask/progress"),
1660
- threadId: z12.string(),
1661
- providerThreadId: z12.string(),
1645
+ z13.object({
1646
+ type: z13.literal("item/backgroundTask/progress"),
1647
+ threadId: z13.string(),
1648
+ providerThreadId: z13.string(),
1662
1649
  item: threadEventBackgroundTaskItemSchema
1663
1650
  }),
1664
- z12.object({
1665
- type: z12.literal("item/backgroundTask/completed"),
1666
- threadId: z12.string(),
1667
- providerThreadId: z12.string(),
1651
+ z13.object({
1652
+ type: z13.literal("item/backgroundTask/completed"),
1653
+ threadId: z13.string(),
1654
+ providerThreadId: z13.string(),
1668
1655
  item: threadEventBackgroundTaskItemSchema
1669
1656
  }),
1670
- z12.object({
1671
- type: z12.literal("item/delegation/progress"),
1672
- threadId: z12.string(),
1673
- providerThreadId: z12.string(),
1657
+ z13.object({
1658
+ type: z13.literal("item/delegation/progress"),
1659
+ threadId: z13.string(),
1660
+ providerThreadId: z13.string(),
1674
1661
  item: threadEventDelegationItemSchema
1675
1662
  }),
1676
- z12.object({
1677
- type: z12.literal("item/delegation/completed"),
1678
- threadId: z12.string(),
1679
- providerThreadId: z12.string(),
1663
+ z13.object({
1664
+ type: z13.literal("item/delegation/completed"),
1665
+ threadId: z13.string(),
1666
+ providerThreadId: z13.string(),
1680
1667
  item: threadEventDelegationItemSchema
1681
1668
  }),
1682
- z12.object({
1683
- type: z12.literal("thread/tokenUsage/updated"),
1684
- threadId: z12.string(),
1685
- providerThreadId: z12.string(),
1669
+ z13.object({
1670
+ type: z13.literal("thread/tokenUsage/updated"),
1671
+ threadId: z13.string(),
1672
+ providerThreadId: z13.string(),
1686
1673
  tokenUsage: threadEventTokenUsageSchema
1687
1674
  }),
1688
- z12.object({
1689
- type: z12.literal("thread/contextWindowUsage/updated"),
1690
- threadId: z12.string(),
1691
- providerThreadId: z12.string(),
1675
+ z13.object({
1676
+ type: z13.literal("thread/contextWindowUsage/updated"),
1677
+ threadId: z13.string(),
1678
+ providerThreadId: z13.string(),
1692
1679
  contextWindowUsage: threadEventContextWindowUsageSchema
1693
1680
  }),
1694
- z12.object({
1695
- type: z12.literal("turn/plan/updated"),
1696
- threadId: z12.string(),
1697
- providerThreadId: z12.string(),
1698
- plan: z12.array(threadEventPlanStepSchema),
1699
- explanation: z12.string().optional()
1681
+ z13.object({
1682
+ type: z13.literal("turn/plan/updated"),
1683
+ threadId: z13.string(),
1684
+ providerThreadId: z13.string(),
1685
+ plan: z13.array(threadEventPlanStepSchema),
1686
+ explanation: z13.string().optional()
1700
1687
  }),
1701
- z12.object({
1702
- type: z12.literal("turn/diff/updated"),
1703
- threadId: z12.string(),
1704
- providerThreadId: z12.string(),
1705
- diff: z12.string().optional()
1688
+ z13.object({
1689
+ type: z13.literal("turn/diff/updated"),
1690
+ threadId: z13.string(),
1691
+ providerThreadId: z13.string(),
1692
+ diff: z13.string().optional()
1706
1693
  }),
1707
- z12.object({
1708
- type: z12.literal("provider/error"),
1709
- threadId: z12.string(),
1710
- providerThreadId: z12.string(),
1711
- message: z12.string(),
1712
- detail: z12.string().optional(),
1713
- willRetry: z12.boolean().optional(),
1694
+ z13.object({
1695
+ type: z13.literal("provider/error"),
1696
+ threadId: z13.string(),
1697
+ providerThreadId: z13.string(),
1698
+ message: z13.string(),
1699
+ detail: z13.string().optional(),
1700
+ willRetry: z13.boolean().optional(),
1714
1701
  errorInfo: providerErrorInfoSchema.optional()
1715
1702
  }),
1716
- z12.object({
1717
- type: z12.literal("provider/rateLimits/updated"),
1718
- threadId: z12.string(),
1719
- providerThreadId: z12.string(),
1703
+ z13.object({
1704
+ type: z13.literal("provider/rateLimits/updated"),
1705
+ threadId: z13.string(),
1706
+ providerThreadId: z13.string(),
1720
1707
  rateLimits: providerRateLimitStateSchema
1721
1708
  }),
1722
- z12.object({
1723
- type: z12.literal("provider.env-resolved"),
1724
- threadId: z12.string(),
1725
- providerThreadId: z12.string(),
1726
- entries: z12.array(
1727
- z12.object({
1728
- name: z12.string(),
1729
- source: z12.union([
1730
- z12.literal("shell"),
1731
- z12.object({ plugin: z12.string() }).strict()
1709
+ z13.object({
1710
+ type: z13.literal("provider.env-resolved"),
1711
+ threadId: z13.string(),
1712
+ providerThreadId: z13.string(),
1713
+ entries: z13.array(
1714
+ z13.object({
1715
+ name: z13.string(),
1716
+ source: z13.union([
1717
+ z13.literal("shell"),
1718
+ z13.object({ plugin: z13.string() }).strict(),
1719
+ z13.object({ core: z13.enum(["machine-git", "machine-environment"]) }).strict()
1732
1720
  ]),
1733
- value: z12.union([
1734
- z12.string(),
1735
- z12.object({ masked: z12.literal(true) }).strict()
1721
+ value: z13.union([
1722
+ z13.string(),
1723
+ z13.object({ masked: z13.literal(true) }).strict()
1736
1724
  ]),
1737
- reason: z12.string().optional()
1725
+ reason: z13.string().optional()
1738
1726
  }).strict()
1739
1727
  )
1740
1728
  }),
1741
- z12.object({
1742
- type: z12.literal("thread/extensionState/updated"),
1743
- threadId: z12.string(),
1744
- providerThreadId: z12.string(),
1729
+ z13.object({
1730
+ type: z13.literal("thread/extensionState/updated"),
1731
+ threadId: z13.string(),
1732
+ providerThreadId: z13.string(),
1745
1733
  kind: extensionKindSchema,
1746
1734
  payload: jsonValueSchema
1747
1735
  }),
1748
- z12.object({
1749
- type: z12.literal("provider/warning"),
1750
- threadId: z12.string(),
1751
- providerThreadId: z12.string(),
1736
+ z13.object({
1737
+ type: z13.literal("provider/warning"),
1738
+ threadId: z13.string(),
1739
+ providerThreadId: z13.string(),
1752
1740
  category: threadEventWarningCategorySchema,
1753
- summary: z12.string().optional(),
1754
- details: z12.string().optional()
1741
+ summary: z13.string().optional(),
1742
+ details: z13.string().optional()
1755
1743
  }),
1756
- z12.object({
1757
- type: z12.literal("provider/modelFallback"),
1758
- threadId: z12.string(),
1759
- providerThreadId: z12.string(),
1760
- originalModel: z12.string().min(1),
1761
- fallbackModel: z12.string().min(1),
1762
- reason: z12.enum(["refusal", "provider"]),
1763
- message: z12.string()
1744
+ z13.object({
1745
+ type: z13.literal("provider/modelFallback"),
1746
+ threadId: z13.string(),
1747
+ providerThreadId: z13.string(),
1748
+ originalModel: z13.string().min(1),
1749
+ fallbackModel: z13.string().min(1),
1750
+ reason: z13.enum(["refusal", "provider"]),
1751
+ message: z13.string()
1764
1752
  }),
1765
1753
  providerUnhandledEventSchema
1766
1754
  ]);
1767
- var scopedEventDataSchema = z12.object({
1755
+ var scopedEventDataSchema = z13.object({
1768
1756
  scope: threadEventScopeSchema
1769
1757
  });
1770
1758
  var providerEventSchema = unscopedProviderEventSchema.and(
@@ -1773,58 +1761,58 @@ var providerEventSchema = unscopedProviderEventSchema.and(
1773
1761
  var providerEventTypeValues = unscopedProviderEventSchema.options.map(
1774
1762
  (option) => option.shape.type.value
1775
1763
  );
1776
- var unscopedSystemEventSchema = z12.discriminatedUnion("type", [
1777
- z12.object({
1778
- type: z12.literal("client/thread/start"),
1779
- threadId: z12.string()
1764
+ var unscopedSystemEventSchema = z13.discriminatedUnion("type", [
1765
+ z13.object({
1766
+ type: z13.literal("client/thread/start"),
1767
+ threadId: z13.string()
1780
1768
  }).merge(clientTurnLifecycleEventDataSchema),
1781
- z12.object({
1782
- type: z12.literal("client/turn/requested"),
1783
- threadId: z12.string()
1769
+ z13.object({
1770
+ type: z13.literal("client/turn/requested"),
1771
+ threadId: z13.string()
1784
1772
  }).merge(turnRequestEventDataSchema),
1785
- z12.object({
1786
- type: z12.literal("client/turn/rejected"),
1787
- threadId: z12.string()
1773
+ z13.object({
1774
+ type: z13.literal("client/turn/rejected"),
1775
+ threadId: z13.string()
1788
1776
  }).merge(turnRequestRejectedEventDataSchema),
1789
- z12.object({
1790
- type: z12.literal("client/turn/start"),
1791
- threadId: z12.string()
1777
+ z13.object({
1778
+ type: z13.literal("client/turn/start"),
1779
+ threadId: z13.string()
1792
1780
  }).merge(clientTurnLifecycleEventDataSchema),
1793
- z12.object({
1794
- type: z12.literal("system/error"),
1795
- threadId: z12.string()
1781
+ z13.object({
1782
+ type: z13.literal("system/error"),
1783
+ threadId: z13.string()
1796
1784
  }).merge(systemErrorEventDataSchema),
1797
- z12.object({
1798
- type: z12.literal("system/manager/user_message"),
1799
- threadId: z12.string()
1785
+ z13.object({
1786
+ type: z13.literal("system/manager/user_message"),
1787
+ threadId: z13.string()
1800
1788
  }).merge(systemLegacyUserMessageEventDataSchema),
1801
- z12.object({
1802
- type: z12.literal("system/thread/interrupted"),
1803
- threadId: z12.string()
1789
+ z13.object({
1790
+ type: z13.literal("system/thread/interrupted"),
1791
+ threadId: z13.string()
1804
1792
  }).merge(systemThreadInterruptedEventDataSchema),
1805
- z12.object({
1806
- type: z12.literal("system/operation"),
1807
- threadId: z12.string()
1793
+ z13.object({
1794
+ type: z13.literal("system/operation"),
1795
+ threadId: z13.string()
1808
1796
  }).merge(systemOperationEventDataSchema),
1809
- z12.object({
1810
- type: z12.literal("system/interaction/lifecycle"),
1811
- threadId: z12.string()
1797
+ z13.object({
1798
+ type: z13.literal("system/interaction/lifecycle"),
1799
+ threadId: z13.string()
1812
1800
  }).merge(systemInteractionLifecycleEventDataSchema),
1813
- z12.object({
1814
- type: z12.literal("system/permissionGrant/lifecycle"),
1815
- threadId: z12.string()
1801
+ z13.object({
1802
+ type: z13.literal("system/permissionGrant/lifecycle"),
1803
+ threadId: z13.string()
1816
1804
  }).merge(systemPermissionGrantLifecycleEventDataSchema),
1817
- z12.object({
1818
- type: z12.literal("system/userQuestion/lifecycle"),
1819
- threadId: z12.string()
1805
+ z13.object({
1806
+ type: z13.literal("system/userQuestion/lifecycle"),
1807
+ threadId: z13.string()
1820
1808
  }).merge(systemUserQuestionLifecycleEventDataSchema),
1821
- z12.object({
1822
- type: z12.literal("system/thread-provisioning"),
1823
- threadId: z12.string()
1809
+ z13.object({
1810
+ type: z13.literal("system/thread-provisioning"),
1811
+ threadId: z13.string()
1824
1812
  }).merge(systemThreadProvisioningEventDataSchema),
1825
- z12.object({
1826
- type: z12.literal("system/provider-turn-watchdog"),
1827
- threadId: z12.string()
1813
+ z13.object({
1814
+ type: z13.literal("system/provider-turn-watchdog"),
1815
+ threadId: z13.string()
1828
1816
  }).merge(systemProviderTurnWatchdogEventDataSchema)
1829
1817
  ]);
1830
1818
  var systemEventSchema = unscopedSystemEventSchema.and(scopedEventDataSchema);
@@ -1832,13 +1820,13 @@ var legacyClientRequestKey = ["clientRequest", "Sequence"].join("");
1832
1820
  function isEventPropertyBag(value) {
1833
1821
  return typeof value === "object" && value !== null && !Array.isArray(value);
1834
1822
  }
1835
- var rejectLegacyClientRequestSequenceSchema = z12.unknown().superRefine((value, ctx) => {
1823
+ var rejectLegacyClientRequestSequenceSchema = z13.unknown().superRefine((value, ctx) => {
1836
1824
  if (!isEventPropertyBag(value)) {
1837
1825
  return;
1838
1826
  }
1839
1827
  if (Object.hasOwn(value, legacyClientRequestKey)) {
1840
1828
  ctx.addIssue({
1841
- code: z12.ZodIssueCode.custom,
1829
+ code: z13.ZodIssueCode.custom,
1842
1830
  message: "legacy request sequence field is no longer accepted",
1843
1831
  path: [legacyClientRequestKey]
1844
1832
  });
@@ -1846,21 +1834,21 @@ var rejectLegacyClientRequestSequenceSchema = z12.unknown().superRefine((value,
1846
1834
  const item = value.item;
1847
1835
  if (isEventPropertyBag(item) && item.type === "userMessage" && Object.hasOwn(item, legacyClientRequestKey)) {
1848
1836
  ctx.addIssue({
1849
- code: z12.ZodIssueCode.custom,
1837
+ code: z13.ZodIssueCode.custom,
1850
1838
  message: "legacy user-message request sequence field is no longer accepted",
1851
1839
  path: ["item", legacyClientRequestKey]
1852
1840
  });
1853
1841
  }
1854
1842
  });
1855
1843
  var threadEventSchema = rejectLegacyClientRequestSequenceSchema.pipe(
1856
- z12.union([providerEventSchema, systemEventSchema]).superRefine((event, ctx) => {
1844
+ z13.union([providerEventSchema, systemEventSchema]).superRefine((event, ctx) => {
1857
1845
  const result2 = validateThreadEventScope({
1858
1846
  type: event.type,
1859
1847
  scope: event.scope
1860
1848
  });
1861
1849
  if (!result2.valid) {
1862
1850
  ctx.addIssue({
1863
- code: z12.ZodIssueCode.custom,
1851
+ code: z13.ZodIssueCode.custom,
1864
1852
  message: result2.message ?? "Invalid thread event scope",
1865
1853
  path: ["scope"]
1866
1854
  });
@@ -1886,7 +1874,7 @@ var threadEventTypeValues = [
1886
1874
  ...systemEventTypeValues
1887
1875
  ];
1888
1876
  var threadEventTypeSet = new Set(threadEventTypeValues);
1889
- var threadEventTypeSchema = z12.string().refine(
1877
+ var threadEventTypeSchema = z13.string().refine(
1890
1878
  (value) => threadEventTypeSet.has(value),
1891
1879
  "Invalid thread event type"
1892
1880
  );
@@ -1909,95 +1897,95 @@ function parseNamespacedGlyph(glyph) {
1909
1897
  }
1910
1898
 
1911
1899
  // ../domain/src/provider-fork.ts
1912
- import { z as z13 } from "zod";
1900
+ import { z as z14 } from "zod";
1913
1901
  var PROVIDER_FORK_VALUES = ["none", "tip", "checkpoint"];
1914
- var providerForkSchema = z13.enum(PROVIDER_FORK_VALUES);
1902
+ var providerForkSchema = z14.enum(PROVIDER_FORK_VALUES);
1915
1903
 
1916
1904
  // ../domain/src/provider-types.ts
1917
- import { z as z14 } from "zod";
1918
- var modelReasoningEffortSchema = z14.object({
1905
+ import { z as z15 } from "zod";
1906
+ var modelReasoningEffortSchema = z15.object({
1919
1907
  reasoningEffort: reasoningLevelSchema,
1920
- description: z14.string()
1921
- });
1922
- var availableModelSchema = z14.object({
1923
- id: z14.string(),
1924
- model: z14.string(),
1925
- displayName: z14.string(),
1926
- routeProviderId: z14.string().min(1).optional(),
1927
- description: z14.string(),
1928
- supportedReasoningEfforts: z14.array(modelReasoningEffortSchema),
1908
+ description: z15.string()
1909
+ });
1910
+ var availableModelSchema = z15.object({
1911
+ id: z15.string(),
1912
+ model: z15.string(),
1913
+ displayName: z15.string(),
1914
+ routeProviderId: z15.string().min(1).optional(),
1915
+ description: z15.string(),
1916
+ supportedReasoningEfforts: z15.array(modelReasoningEffortSchema),
1929
1917
  defaultReasoningEffort: reasoningLevelSchema,
1930
- isDefault: z14.boolean()
1931
- });
1932
- var providerModelCatalogScopeSchema = z14.enum(["host", "workspace"]);
1933
- var providerCapabilitiesSchema = z14.object({
1934
- supportsThreadArchive: z14.boolean(),
1935
- supportsThreadRename: z14.boolean(),
1936
- supportsServiceTier: z14.boolean(),
1937
- supportsNativeUserQuestion: z14.boolean(),
1938
- supportsFork: z14.boolean(),
1939
- supportsSessionRewind: z14.boolean(),
1940
- permissionModes: z14.array(permissionModeSchema).min(1),
1918
+ isDefault: z15.boolean()
1919
+ });
1920
+ var providerModelCatalogScopeSchema = z15.enum(["host", "workspace"]);
1921
+ var providerCapabilitiesSchema = z15.object({
1922
+ supportsThreadArchive: z15.boolean(),
1923
+ supportsThreadRename: z15.boolean(),
1924
+ supportsServiceTier: z15.boolean(),
1925
+ supportsNativeUserQuestion: z15.boolean(),
1926
+ supportsFork: z15.boolean(),
1927
+ supportsSessionRewind: z15.boolean(),
1928
+ permissionModes: z15.array(permissionModeSchema).min(1),
1941
1929
  modelCatalogScope: providerModelCatalogScopeSchema
1942
1930
  });
1943
- var providerComposerCommandSchema = z14.object({
1931
+ var providerComposerCommandSchema = z15.object({
1944
1932
  trigger: promptMentionCommandTriggerSchema,
1945
- name: z14.string().min(1).regex(/^[^\s/$]+$/u),
1946
- trailingText: z14.string().regex(/^\s*$/u)
1933
+ name: z15.string().min(1).regex(/^[^\s/$]+$/u),
1934
+ trailingText: z15.string().regex(/^\s*$/u)
1947
1935
  });
1948
- var providerComposerActionSchema = z14.discriminatedUnion("kind", [
1949
- z14.object({
1950
- kind: z14.literal("skills"),
1936
+ var providerComposerActionSchema = z15.discriminatedUnion("kind", [
1937
+ z15.object({
1938
+ kind: z15.literal("skills"),
1951
1939
  trigger: promptMentionCommandTriggerSchema
1952
1940
  }),
1953
- z14.object({
1954
- kind: z14.literal("plan"),
1941
+ z15.object({
1942
+ kind: z15.literal("plan"),
1955
1943
  command: providerComposerCommandSchema
1956
1944
  }),
1957
- z14.object({
1958
- kind: z14.literal("goal"),
1945
+ z15.object({
1946
+ kind: z15.literal("goal"),
1959
1947
  command: providerComposerCommandSchema
1960
1948
  })
1961
1949
  ]);
1962
- var providerStringsSchema = z14.object({
1963
- signInHint: z14.string().min(1),
1964
- expiredHint: z14.string().min(1),
1965
- installUrl: z14.string().min(1),
1966
- brandPrefix: z14.string().min(1).optional(),
1967
- planModeCopy: z14.string().min(1).optional(),
1968
- iconTint: z14.object({ light: z14.string().min(1), dark: z14.string().min(1) }).optional()
1969
- });
1970
- var providerOptionDescriptorSchema = z14.object({
1971
- id: z14.string().min(1),
1972
- label: z14.string().min(1),
1973
- description: z14.string().min(1).optional()
1974
- });
1975
- var providerExtensionKindInfoSchema = z14.object({
1976
- item: z14.boolean(),
1977
- state: z14.boolean()
1978
- });
1979
- var providerExtensionKindsSchema = z14.record(
1950
+ var providerStringsSchema = z15.object({
1951
+ signInHint: z15.string().min(1),
1952
+ expiredHint: z15.string().min(1),
1953
+ installUrl: z15.string().min(1),
1954
+ brandPrefix: z15.string().min(1).optional(),
1955
+ planModeCopy: z15.string().min(1).optional(),
1956
+ iconTint: z15.object({ light: z15.string().min(1), dark: z15.string().min(1) }).optional()
1957
+ });
1958
+ var providerOptionDescriptorSchema = z15.object({
1959
+ id: z15.string().min(1),
1960
+ label: z15.string().min(1),
1961
+ description: z15.string().min(1).optional()
1962
+ });
1963
+ var providerExtensionKindInfoSchema = z15.object({
1964
+ item: z15.boolean(),
1965
+ state: z15.boolean()
1966
+ });
1967
+ var providerExtensionKindsSchema = z15.record(
1980
1968
  extensionKindSchema,
1981
1969
  providerExtensionKindInfoSchema
1982
1970
  );
1983
- var providerInfoSchema = z14.object({
1984
- id: z14.string(),
1985
- pluginId: z14.string().min(1),
1986
- displayName: z14.string(),
1987
- family: z14.string().min(1).optional(),
1988
- icon: z14.object({ glyph: z14.string().min(1) }).optional(),
1989
- logoUrl: z14.string().min(1).nullable(),
1990
- maintenance: z14.object({
1991
- health: z14.boolean(),
1992
- usage: z14.boolean(),
1993
- installation: z14.boolean()
1971
+ var providerInfoSchema = z15.object({
1972
+ id: z15.string(),
1973
+ pluginId: z15.string().min(1),
1974
+ displayName: z15.string(),
1975
+ family: z15.string().min(1).optional(),
1976
+ icon: z15.object({ glyph: z15.string().min(1) }).optional(),
1977
+ logoUrl: z15.string().min(1).nullable(),
1978
+ maintenance: z15.object({
1979
+ health: z15.boolean(),
1980
+ usage: z15.boolean(),
1981
+ installation: z15.boolean()
1994
1982
  }),
1995
1983
  capabilities: providerCapabilitiesSchema,
1996
- composerActions: z14.array(providerComposerActionSchema),
1997
- available: z14.boolean(),
1984
+ composerActions: z15.array(providerComposerActionSchema),
1985
+ available: z15.boolean(),
1998
1986
  strings: providerStringsSchema.optional(),
1999
- serviceTiers: z14.array(providerOptionDescriptorSchema).optional(),
2000
- reasoningLevels: z14.array(providerOptionDescriptorSchema).optional(),
1987
+ serviceTiers: z15.array(providerOptionDescriptorSchema).optional(),
1988
+ reasoningLevels: z15.array(providerOptionDescriptorSchema).optional(),
2001
1989
  extensionKinds: providerExtensionKindsSchema.optional()
2002
1990
  });
2003
1991
  var providerRecoveryKindValues = [
@@ -2007,151 +1995,151 @@ var providerRecoveryKindValues = [
2007
1995
  "staleTurn",
2008
1996
  "rateLimited"
2009
1997
  ];
2010
- var providerRecoveryKindSchema = z14.enum(providerRecoveryKindValues);
2011
- var toolCallOutputItemSchema = z14.discriminatedUnion("type", [
2012
- z14.object({
2013
- type: z14.literal("inputText"),
2014
- text: z14.string()
1998
+ var providerRecoveryKindSchema = z15.enum(providerRecoveryKindValues);
1999
+ var toolCallOutputItemSchema = z15.discriminatedUnion("type", [
2000
+ z15.object({
2001
+ type: z15.literal("inputText"),
2002
+ text: z15.string()
2015
2003
  }),
2016
- z14.object({
2017
- type: z14.literal("inputImage"),
2018
- imageUrl: z14.string()
2004
+ z15.object({
2005
+ type: z15.literal("inputImage"),
2006
+ imageUrl: z15.string()
2019
2007
  })
2020
2008
  ]);
2021
- var toolCallRequestSchema = z14.object({
2022
- requestId: z14.union([z14.string().min(1), z14.number()]),
2023
- threadId: z14.string().min(1),
2024
- providerThreadId: z14.string().min(1),
2025
- turnId: z14.string().min(1),
2026
- callId: z14.string().min(1),
2027
- tool: z14.string().min(1),
2028
- arguments: z14.unknown().optional()
2029
- });
2030
- var toolCallResponseSchema = z14.object({
2031
- contentItems: z14.array(toolCallOutputItemSchema),
2032
- success: z14.boolean()
2033
- });
2034
- var dynamicToolSchema = z14.object({
2035
- name: z14.string(),
2036
- description: z14.string(),
2037
- inputSchema: z14.unknown(),
2009
+ var toolCallRequestSchema = z15.object({
2010
+ requestId: z15.union([z15.string().min(1), z15.number()]),
2011
+ threadId: z15.string().min(1),
2012
+ providerThreadId: z15.string().min(1),
2013
+ turnId: z15.string().min(1),
2014
+ callId: z15.string().min(1),
2015
+ tool: z15.string().min(1),
2016
+ arguments: z15.unknown().optional()
2017
+ });
2018
+ var toolCallResponseSchema = z15.object({
2019
+ contentItems: z15.array(toolCallOutputItemSchema),
2020
+ success: z15.boolean()
2021
+ });
2022
+ var dynamicToolSchema = z15.object({
2023
+ name: z15.string(),
2024
+ description: z15.string(),
2025
+ inputSchema: z15.unknown(),
2038
2026
  presentation: threadEventItemPresentationSchema.optional()
2039
2027
  });
2040
2028
 
2041
2029
  // ../provider-bridge-protocol/src/thread-delta.ts
2042
- import { z as z15 } from "zod";
2030
+ import { z as z16 } from "zod";
2043
2031
  var THREAD_DELTA_NOTIFICATION_METHOD = "thread/delta";
2044
2032
  var deltaPresentationSchema = threadEventItemPresentationSchema;
2045
2033
  var THREAD_DELTA_KEY_SEPARATOR = "";
2046
- var deltaKeyPartSchema = z15.string().min(1).refine((value) => !value.includes(THREAD_DELTA_KEY_SEPARATOR), {
2034
+ var deltaKeyPartSchema = z16.string().min(1).refine((value) => !value.includes(THREAD_DELTA_KEY_SEPARATOR), {
2047
2035
  message: "provider keys must not contain the internal key separator (\\u001f)"
2048
2036
  });
2049
- var deltaItemKeySchema = z15.object({
2037
+ var deltaItemKeySchema = z16.object({
2050
2038
  providerItemId: deltaKeyPartSchema.optional(),
2051
2039
  channel: deltaKeyPartSchema.optional(),
2052
2040
  parentRef: deltaKeyPartSchema.optional()
2053
2041
  });
2054
2042
  var providerTurnIdSchema = deltaKeyPartSchema;
2055
- var deltaFileChangeSchema = z15.object({
2056
- path: z15.string(),
2057
- kind: z15.enum(["add", "update", "delete"]),
2058
- movePath: z15.string().optional(),
2059
- diff: z15.string().optional(),
2060
- oldText: z15.string().optional(),
2061
- newText: z15.string().optional()
2062
- });
2063
- var deltaBackgroundTaskShapeSchema = z15.object({
2064
- type: z15.literal("backgroundTask"),
2065
- familyId: z15.string().min(1),
2066
- taskType: z15.string(),
2067
- description: z15.string(),
2043
+ var deltaFileChangeSchema = z16.object({
2044
+ path: z16.string(),
2045
+ kind: z16.enum(["add", "update", "delete"]),
2046
+ movePath: z16.string().optional(),
2047
+ diff: z16.string().optional(),
2048
+ oldText: z16.string().optional(),
2049
+ newText: z16.string().optional()
2050
+ });
2051
+ var deltaBackgroundTaskShapeSchema = z16.object({
2052
+ type: z16.literal("backgroundTask"),
2053
+ familyId: z16.string().min(1),
2054
+ taskType: z16.string(),
2055
+ description: z16.string(),
2068
2056
  status: threadEventItemStatusSchema,
2069
2057
  taskStatus: backgroundTaskStatusSchema,
2070
- skipTranscript: z15.boolean(),
2071
- workflowName: z15.string().optional(),
2058
+ skipTranscript: z16.boolean(),
2059
+ workflowName: z16.string().optional(),
2072
2060
  workflow: workflowProgressSnapshotSchema.optional(),
2073
2061
  usage: backgroundTaskUsageSchema.optional(),
2074
- summary: z15.string().optional(),
2075
- error: z15.string().optional(),
2076
- outputFile: z15.string().optional()
2062
+ summary: z16.string().optional(),
2063
+ error: z16.string().optional(),
2064
+ outputFile: z16.string().optional()
2077
2065
  });
2078
- var deltaFileReadShapeSchema = z15.object({
2079
- type: z15.literal("fileRead"),
2080
- path: z15.string(),
2081
- cmd: z15.string().optional()
2066
+ var deltaFileReadShapeSchema = z16.object({
2067
+ type: z16.literal("fileRead"),
2068
+ path: z16.string(),
2069
+ cmd: z16.string().optional()
2082
2070
  });
2083
- var deltaSearchShapeSchema = z15.object({
2084
- type: z15.literal("search"),
2071
+ var deltaSearchShapeSchema = z16.object({
2072
+ type: z16.literal("search"),
2085
2073
  mode: threadEventSearchModeSchema,
2086
- query: z15.string(),
2087
- path: z15.string().optional(),
2088
- cmd: z15.string().optional()
2074
+ query: z16.string(),
2075
+ path: z16.string().optional(),
2076
+ cmd: z16.string().optional()
2089
2077
  });
2090
- var deltaDelegationShapeSchema = z15.object({
2091
- type: z15.literal("delegation"),
2078
+ var deltaDelegationShapeSchema = z16.object({
2079
+ type: z16.literal("delegation"),
2092
2080
  childRef: deltaKeyPartSchema,
2093
- label: z15.string(),
2094
- background: z15.boolean(),
2095
- summary: z15.string().optional()
2081
+ label: z16.string(),
2082
+ background: z16.boolean(),
2083
+ summary: z16.string().optional()
2096
2084
  });
2097
- var deltaPlanStepsShapeSchema = z15.object({
2098
- type: z15.literal("planSteps"),
2099
- steps: z15.array(threadEventPlanStepSchema),
2100
- explanation: z15.string().optional()
2085
+ var deltaPlanStepsShapeSchema = z16.object({
2086
+ type: z16.literal("planSteps"),
2087
+ steps: z16.array(threadEventPlanStepSchema),
2088
+ explanation: z16.string().optional()
2101
2089
  });
2102
- var deltaExtensionShapeSchema = z15.object({
2103
- type: z15.literal("extension"),
2090
+ var deltaExtensionShapeSchema = z16.object({
2091
+ type: z16.literal("extension"),
2104
2092
  kind: extensionKindSchema,
2105
2093
  payload: jsonValueSchema
2106
2094
  });
2107
- var deltaItemShapeSchema = z15.discriminatedUnion("type", [
2108
- z15.object({
2109
- type: z15.literal("command"),
2110
- command: z15.string(),
2111
- cwd: z15.string(),
2112
- aggregatedOutput: z15.string().optional(),
2113
- exitCode: z15.number().optional(),
2114
- durationMs: z15.number().optional()
2095
+ var deltaItemShapeSchema = z16.discriminatedUnion("type", [
2096
+ z16.object({
2097
+ type: z16.literal("command"),
2098
+ command: z16.string(),
2099
+ cwd: z16.string(),
2100
+ aggregatedOutput: z16.string().optional(),
2101
+ exitCode: z16.number().optional(),
2102
+ durationMs: z16.number().optional()
2115
2103
  }),
2116
- z15.object({
2117
- type: z15.literal("fileChange"),
2118
- changes: z15.array(deltaFileChangeSchema)
2104
+ z16.object({
2105
+ type: z16.literal("fileChange"),
2106
+ changes: z16.array(deltaFileChangeSchema)
2119
2107
  }),
2120
- z15.object({
2121
- type: z15.literal("tool"),
2122
- tool: z15.string(),
2123
- server: z15.string().optional(),
2124
- args: z15.unknown().optional(),
2125
- result: z15.unknown().optional(),
2126
- error: z15.string().optional(),
2127
- durationMs: z15.number().optional()
2108
+ z16.object({
2109
+ type: z16.literal("tool"),
2110
+ tool: z16.string(),
2111
+ server: z16.string().optional(),
2112
+ args: z16.unknown().optional(),
2113
+ result: z16.unknown().optional(),
2114
+ error: z16.string().optional(),
2115
+ durationMs: z16.number().optional()
2128
2116
  }),
2129
- z15.object({ type: z15.literal("compaction") }),
2130
- z15.object({ type: z15.literal("agentMessage"), text: z15.string() }),
2131
- z15.object({
2132
- type: z15.literal("reasoning"),
2133
- summary: z15.array(z15.string()),
2134
- content: z15.array(z15.string())
2117
+ z16.object({ type: z16.literal("compaction") }),
2118
+ z16.object({ type: z16.literal("agentMessage"), text: z16.string() }),
2119
+ z16.object({
2120
+ type: z16.literal("reasoning"),
2121
+ summary: z16.array(z16.string()),
2122
+ content: z16.array(z16.string())
2135
2123
  }),
2136
- z15.object({ type: z15.literal("plan"), text: z15.string() }),
2137
- z15.object({
2138
- type: z15.literal("webSearch"),
2139
- queries: z15.array(z15.string()).min(1)
2124
+ z16.object({ type: z16.literal("plan"), text: z16.string() }),
2125
+ z16.object({
2126
+ type: z16.literal("webSearch"),
2127
+ queries: z16.array(z16.string()).min(1)
2140
2128
  }),
2141
- z15.object({
2142
- type: z15.literal("webFetch"),
2143
- url: z15.string(),
2144
- prompt: z15.string().nullable().optional(),
2145
- pattern: z15.string().nullable()
2129
+ z16.object({
2130
+ type: z16.literal("webFetch"),
2131
+ url: z16.string(),
2132
+ prompt: z16.string().nullable().optional(),
2133
+ pattern: z16.string().nullable()
2146
2134
  }),
2147
- z15.object({ type: z15.literal("imageView"), path: z15.string() }),
2148
- z15.object({
2149
- type: z15.literal("imageGeneration"),
2150
- prompt: z15.string().nullable(),
2151
- path: z15.string().nullable(),
2152
- result: z15.string().optional(),
2153
- error: z15.string().nullable(),
2154
- transparentBackground: z15.boolean()
2135
+ z16.object({ type: z16.literal("imageView"), path: z16.string() }),
2136
+ z16.object({
2137
+ type: z16.literal("imageGeneration"),
2138
+ prompt: z16.string().nullable(),
2139
+ path: z16.string().nullable(),
2140
+ result: z16.string().optional(),
2141
+ error: z16.string().nullable(),
2142
+ transparentBackground: z16.boolean()
2155
2143
  }),
2156
2144
  deltaBackgroundTaskShapeSchema,
2157
2145
  deltaFileReadShapeSchema,
@@ -2160,22 +2148,22 @@ var deltaItemShapeSchema = z15.discriminatedUnion("type", [
2160
2148
  deltaPlanStepsShapeSchema,
2161
2149
  deltaExtensionShapeSchema
2162
2150
  ]);
2163
- var deltaProgressSnapshotSchema = z15.discriminatedUnion("type", [
2151
+ var deltaProgressSnapshotSchema = z16.discriminatedUnion("type", [
2164
2152
  deltaBackgroundTaskShapeSchema,
2165
2153
  deltaDelegationShapeSchema
2166
2154
  ]);
2167
- var deltaTextChannelSchema = z15.enum([
2155
+ var deltaTextChannelSchema = z16.enum([
2168
2156
  "agentMessage",
2169
2157
  "reasoningSummary",
2170
2158
  "reasoningText",
2171
2159
  "plan"
2172
2160
  ]);
2173
- var deltaOutputChannelSchema = z15.enum(["command", "fileChange"]);
2174
- var deltaErrorSchema = z15.object({ message: z15.string() });
2175
- var deltaAttachSchema = z15.enum(["open", "currentOrLast"]);
2176
- var deltaNoTurnFallbackSchema = z15.object({
2161
+ var deltaOutputChannelSchema = z16.enum(["command", "fileChange"]);
2162
+ var deltaErrorSchema = z16.object({ message: z16.string() });
2163
+ var deltaAttachSchema = z16.enum(["open", "currentOrLast"]);
2164
+ var deltaNoTurnFallbackSchema = z16.object({
2177
2165
  raw: providerRawEventSchema,
2178
- rawType: z15.string()
2166
+ rawType: z16.string()
2179
2167
  });
2180
2168
  function requireExtensionPresentation(delta, ctx) {
2181
2169
  if (delta.item.type === "extension" && delta.presentation === void 0) {
@@ -2186,32 +2174,32 @@ function requireExtensionPresentation(delta, ctx) {
2186
2174
  });
2187
2175
  }
2188
2176
  }
2189
- var threadDeltaSchema = z15.discriminatedUnion("kind", [
2190
- z15.object({
2191
- kind: z15.literal("input.accepted"),
2177
+ var threadDeltaSchema = z16.discriminatedUnion("kind", [
2178
+ z16.object({
2179
+ kind: z16.literal("input.accepted"),
2192
2180
  clientRequestId: clientTurnRequestIdSchema,
2193
2181
  providerTurnId: providerTurnIdSchema.optional()
2194
2182
  }),
2195
- z15.object({
2196
- kind: z15.literal("input.provider"),
2197
- text: z15.string().min(1),
2183
+ z16.object({
2184
+ kind: z16.literal("input.provider"),
2185
+ text: z16.string().min(1),
2198
2186
  parentRef: deltaKeyPartSchema.optional()
2199
2187
  }),
2200
- z15.object({
2201
- kind: z15.literal("turn.open"),
2188
+ z16.object({
2189
+ kind: z16.literal("turn.open"),
2202
2190
  providerTurnId: providerTurnIdSchema.optional(),
2203
2191
  parentRef: deltaKeyPartSchema.optional()
2204
2192
  }),
2205
- z15.object({
2206
- kind: z15.literal("turn.boundary"),
2193
+ z16.object({
2194
+ kind: z16.literal("turn.boundary"),
2207
2195
  status: threadEventTurnStatusSchema,
2208
2196
  error: deltaErrorSchema.optional(),
2209
- providerCheckpointId: z15.string().min(1).optional(),
2210
- claimIfIdle: z15.boolean().optional(),
2197
+ providerCheckpointId: z16.string().min(1).optional(),
2198
+ claimIfIdle: z16.boolean().optional(),
2211
2199
  providerTurnId: providerTurnIdSchema.optional()
2212
2200
  }),
2213
- z15.object({
2214
- kind: z15.literal("item.open"),
2201
+ z16.object({
2202
+ kind: z16.literal("item.open"),
2215
2203
  key: deltaItemKeySchema,
2216
2204
  item: deltaItemShapeSchema,
2217
2205
  presentation: deltaPresentationSchema.optional(),
@@ -2219,139 +2207,140 @@ var threadDeltaSchema = z15.discriminatedUnion("kind", [
2219
2207
  providerTurnId: providerTurnIdSchema.optional(),
2220
2208
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
2221
2209
  }).superRefine(requireExtensionPresentation),
2222
- z15.object({
2223
- kind: z15.literal("item.close"),
2210
+ z16.object({
2211
+ kind: z16.literal("item.close"),
2224
2212
  key: deltaItemKeySchema,
2225
2213
  status: threadEventItemStatusSchema,
2226
- resultText: z15.string().optional(),
2227
- exitCode: z15.number().optional(),
2228
- aggregatedOutput: z15.string().optional(),
2229
- approvalStatus: z15.literal("denied").optional(),
2214
+ resultText: z16.string().optional(),
2215
+ exitCode: z16.number().optional(),
2216
+ aggregatedOutput: z16.string().optional(),
2217
+ approvalStatus: z16.literal("denied").optional(),
2230
2218
  item: deltaItemShapeSchema,
2231
2219
  presentation: deltaPresentationSchema.optional(),
2232
2220
  providerTurnId: providerTurnIdSchema.optional(),
2233
2221
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
2234
2222
  }).superRefine(requireExtensionPresentation),
2235
- z15.object({
2236
- kind: z15.literal("item.progress"),
2223
+ z16.object({
2224
+ kind: z16.literal("item.progress"),
2237
2225
  key: deltaItemKeySchema,
2238
- message: z15.string().optional(),
2226
+ message: z16.string().optional(),
2239
2227
  snapshot: deltaProgressSnapshotSchema.optional(),
2240
- flush: z15.boolean().optional(),
2228
+ flush: z16.boolean().optional(),
2241
2229
  providerTurnId: providerTurnIdSchema.optional(),
2242
2230
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
2243
2231
  }),
2244
- z15.object({
2245
- kind: z15.literal("item.textDelta"),
2232
+ z16.object({
2233
+ kind: z16.literal("item.textDelta"),
2246
2234
  key: deltaItemKeySchema,
2247
2235
  channel: deltaTextChannelSchema,
2248
- text: z15.string(),
2236
+ text: z16.string(),
2249
2237
  providerTurnId: providerTurnIdSchema.optional(),
2250
2238
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
2251
2239
  }),
2252
- z15.object({
2253
- kind: z15.literal("item.textClose"),
2240
+ z16.object({
2241
+ kind: z16.literal("item.textClose"),
2254
2242
  key: deltaItemKeySchema,
2255
2243
  channel: deltaTextChannelSchema,
2256
- text: z15.string().optional(),
2244
+ text: z16.string().optional(),
2257
2245
  providerTurnId: providerTurnIdSchema.optional(),
2258
2246
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
2259
2247
  }),
2260
- z15.object({
2261
- kind: z15.literal("item.outputDelta"),
2248
+ z16.object({
2249
+ kind: z16.literal("item.outputDelta"),
2262
2250
  key: deltaItemKeySchema,
2263
2251
  channel: deltaOutputChannelSchema,
2264
- text: z15.string(),
2252
+ text: z16.string(),
2265
2253
  providerTurnId: providerTurnIdSchema.optional(),
2266
2254
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
2267
2255
  }),
2268
- z15.object({
2269
- kind: z15.literal("command.outputSnapshot"),
2256
+ z16.object({
2257
+ kind: z16.literal("command.outputSnapshot"),
2270
2258
  key: deltaItemKeySchema,
2271
- text: z15.string(),
2259
+ text: z16.string(),
2272
2260
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
2273
2261
  }),
2274
- z15.object({
2275
- kind: z15.literal("usage"),
2262
+ z16.object({
2263
+ kind: z16.literal("usage"),
2276
2264
  total: threadEventTokenUsageBreakdownSchema,
2277
2265
  last: threadEventTokenUsageBreakdownSchema,
2278
- modelContextWindow: z15.number().nullable(),
2266
+ modelContextWindow: z16.number().nullable(),
2279
2267
  providerTurnId: providerTurnIdSchema.optional()
2280
2268
  }),
2281
- z15.object({
2282
- kind: z15.literal("contextWindow"),
2283
- used: z15.number().nullable(),
2284
- size: z15.number().nullable().optional(),
2285
- estimated: z15.boolean(),
2269
+ z16.object({
2270
+ kind: z16.literal("contextWindow"),
2271
+ snapshot: contextSnapshotSchema.optional(),
2272
+ used: z16.number().nullable(),
2273
+ size: z16.number().nullable().optional(),
2274
+ estimated: z16.boolean(),
2286
2275
  attach: deltaAttachSchema,
2287
2276
  providerTurnId: providerTurnIdSchema.optional()
2288
2277
  }),
2289
- z15.object({
2290
- kind: z15.literal("context.compacted"),
2278
+ z16.object({
2279
+ kind: z16.literal("context.compacted"),
2291
2280
  providerTurnId: providerTurnIdSchema.optional(),
2292
2281
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
2293
2282
  }),
2294
- z15.object({ kind: z15.literal("context.cleared") }),
2295
- z15.object({
2296
- kind: z15.literal("turn.diff"),
2297
- diff: z15.string(),
2283
+ z16.object({ kind: z16.literal("context.cleared") }),
2284
+ z16.object({
2285
+ kind: z16.literal("turn.diff"),
2286
+ diff: z16.string(),
2298
2287
  providerTurnId: providerTurnIdSchema.optional()
2299
2288
  }),
2300
- z15.object({ kind: z15.literal("thread.started") }),
2301
- z15.object({
2302
- kind: z15.literal("thread.identity"),
2303
- providerThreadId: z15.string().min(1)
2289
+ z16.object({ kind: z16.literal("thread.started") }),
2290
+ z16.object({
2291
+ kind: z16.literal("thread.identity"),
2292
+ providerThreadId: z16.string().min(1)
2304
2293
  }),
2305
- z15.object({ kind: z15.literal("thread.name"), name: z15.string().min(1) }),
2306
- z15.object({
2307
- kind: z15.literal("extension.state"),
2294
+ z16.object({ kind: z16.literal("thread.name"), name: z16.string().min(1) }),
2295
+ z16.object({
2296
+ kind: z16.literal("extension.state"),
2308
2297
  extensionKind: extensionKindSchema,
2309
2298
  payload: jsonValueSchema
2310
2299
  }),
2311
- z15.object({
2312
- kind: z15.literal("provider.rateLimits"),
2300
+ z16.object({
2301
+ kind: z16.literal("provider.rateLimits"),
2313
2302
  rateLimits: providerRateLimitStateSchema
2314
2303
  }),
2315
- z15.object({
2316
- kind: z15.literal("provider.error"),
2317
- message: z15.string(),
2318
- detail: z15.string().optional(),
2319
- willRetry: z15.boolean().optional(),
2304
+ z16.object({
2305
+ kind: z16.literal("provider.error"),
2306
+ message: z16.string(),
2307
+ detail: z16.string().optional(),
2308
+ willRetry: z16.boolean().optional(),
2320
2309
  category: providerErrorCategorySchema.optional(),
2321
2310
  errorInfo: providerErrorInfoSchema.optional(),
2322
- settlesTurn: z15.boolean().optional(),
2311
+ settlesTurn: z16.boolean().optional(),
2323
2312
  providerTurnId: providerTurnIdSchema.optional(),
2324
- threadScoped: z15.boolean().optional()
2313
+ threadScoped: z16.boolean().optional()
2325
2314
  }),
2326
- z15.object({
2327
- kind: z15.literal("provider.modelFallback"),
2328
- originalModel: z15.string().min(1),
2329
- fallbackModel: z15.string().min(1),
2330
- reason: z15.enum(["refusal", "provider"]),
2331
- message: z15.string()
2315
+ z16.object({
2316
+ kind: z16.literal("provider.modelFallback"),
2317
+ originalModel: z16.string().min(1),
2318
+ fallbackModel: z16.string().min(1),
2319
+ reason: z16.enum(["refusal", "provider"]),
2320
+ message: z16.string()
2332
2321
  }),
2333
- z15.object({
2334
- kind: z15.literal("provider.warning"),
2335
- summary: z15.string().optional(),
2336
- details: z15.string().optional(),
2322
+ z16.object({
2323
+ kind: z16.literal("provider.warning"),
2324
+ summary: z16.string().optional(),
2325
+ details: z16.string().optional(),
2337
2326
  category: threadEventWarningCategorySchema.optional(),
2338
- vouchedTurn: z15.boolean().optional()
2327
+ vouchedTurn: z16.boolean().optional()
2339
2328
  }),
2340
- z15.object({
2341
- kind: z15.literal("unhandled"),
2329
+ z16.object({
2330
+ kind: z16.literal("unhandled"),
2342
2331
  raw: providerRawEventSchema,
2343
- rawType: z15.string(),
2344
- vouchedTurn: z15.boolean(),
2345
- onlyIfNoTurn: z15.boolean().optional(),
2332
+ rawType: z16.string(),
2333
+ vouchedTurn: z16.boolean(),
2334
+ onlyIfNoTurn: z16.boolean().optional(),
2346
2335
  parentRef: deltaKeyPartSchema.optional(),
2347
2336
  providerTurnId: providerTurnIdSchema.optional()
2348
2337
  }),
2349
- z15.object({ kind: z15.literal("session.ended") }),
2350
- z15.object({ kind: z15.literal("session.reset") })
2338
+ z16.object({ kind: z16.literal("session.ended") }),
2339
+ z16.object({ kind: z16.literal("session.reset") })
2351
2340
  ]);
2352
- var threadDeltaNotificationParamsSchema = z15.object({
2353
- threadId: z15.string().min(1),
2354
- deltas: z15.array(threadDeltaSchema)
2341
+ var threadDeltaNotificationParamsSchema = z16.object({
2342
+ threadId: z16.string().min(1),
2343
+ deltas: z16.array(threadDeltaSchema)
2355
2344
  }).passthrough();
2356
2345
 
2357
2346
  // ../provider-bridge-protocol/src/assembler/delta-assembler.ts
@@ -2362,17 +2351,17 @@ var PROVIDER_BRIDGE_PROTOCOL_VERSION = 2;
2362
2351
  var THREAD_DELTA_GRAMMAR_V3 = 3;
2363
2352
 
2364
2353
  // ../provider-bridge-protocol/src/bridge-kit/adapter-utils.ts
2365
- import { z as z17 } from "zod";
2354
+ import { z as z18 } from "zod";
2366
2355
 
2367
2356
  // ../provider-bridge-protocol/src/bridge-kit/tool-arg-schemas.ts
2368
- import { z as z16 } from "zod";
2369
- var bashArgsSchema = z16.object({
2370
- command: z16.string().optional(),
2371
- cwd: z16.string().optional()
2357
+ import { z as z17 } from "zod";
2358
+ var bashArgsSchema = z17.object({
2359
+ command: z17.string().optional(),
2360
+ cwd: z17.string().optional()
2372
2361
  }).passthrough();
2373
- var textBlockSchema = z16.object({
2374
- type: z16.literal("text"),
2375
- text: z16.string()
2362
+ var textBlockSchema = z17.object({
2363
+ type: z17.literal("text"),
2364
+ text: z17.string()
2376
2365
  });
2377
2366
 
2378
2367
  // ../provider-bridge-protocol/src/bridge-kit/provider-visibility-helpers.ts
@@ -2381,10 +2370,10 @@ function isRecord(value) {
2381
2370
  }
2382
2371
 
2383
2372
  // ../provider-bridge-protocol/src/bridge-kit/adapter-utils.ts
2384
- var contentWrapperSchema = z17.object({
2385
- content: z17.array(z17.unknown())
2373
+ var contentWrapperSchema = z18.object({
2374
+ content: z18.array(z18.unknown())
2386
2375
  }).passthrough();
2387
- var shellEnvironmentVariableKeySchema = z17.string().regex(/^[A-Z_][A-Z0-9_]*$/i);
2376
+ var shellEnvironmentVariableKeySchema = z18.string().regex(/^[A-Z_][A-Z0-9_]*$/i);
2388
2377
  var MAX_EXACT_LINE_DIFF_CELLS = 1e6;
2389
2378
  function splitComparableLines(text) {
2390
2379
  const normalized = text.replace(/\r\n?/gu, "\n");
@@ -3923,9 +3912,10 @@ function createDeltaAssembler(options) {
3923
3912
  providerThreadId: "",
3924
3913
  scope: turnId === void 0 ? threadScope() : turnScope(turnId),
3925
3914
  contextWindowUsage: {
3926
- usedTokens: delta.used,
3927
- modelContextWindow: delta.size ?? null,
3928
- estimated: delta.estimated
3915
+ usedTokens: delta.snapshot?.usedTokens ?? delta.used,
3916
+ modelContextWindow: delta.snapshot?.contextWindowTokens ?? delta.size ?? null,
3917
+ estimated: delta.snapshot?.estimated ?? delta.estimated,
3918
+ ...delta.snapshot ? { snapshot: delta.snapshot } : {}
3929
3919
  }
3930
3920
  });
3931
3921
  return;
@@ -4230,11 +4220,11 @@ function toConformanceMessages() {
4230
4220
  }
4231
4221
 
4232
4222
  // ../provider-bridge-protocol/src/conformance/client.ts
4233
- import { z as z18 } from "zod";
4223
+ import { z as z19 } from "zod";
4234
4224
  function isWireMessage(value) {
4235
4225
  return typeof value === "object" && value !== null && !Array.isArray(value);
4236
4226
  }
4237
- var threadDeltaAddressSchema = z18.object({ threadId: z18.string() }).passthrough();
4227
+ var threadDeltaAddressSchema = z19.object({ threadId: z19.string() }).passthrough();
4238
4228
  var ConformanceClient = class {
4239
4229
  constructor(transport, timeoutMs, collector) {
4240
4230
  this.transport = transport;
@@ -4343,11 +4333,11 @@ function nextConformanceClientRequestId() {
4343
4333
  }
4344
4334
 
4345
4335
  // ../provider-bridge-protocol/src/conformance/scenarios.ts
4346
- import { z as z26 } from "zod";
4336
+ import { z as z27 } from "zod";
4347
4337
 
4348
4338
  // ../provider-bridge-protocol/src/handshake.ts
4349
- import { z as z19 } from "zod";
4350
- var bridgeGrammarVersionsSchema = z19.tuple([z19.number().int().positive(), z19.number().int().positive()]).refine(([min, max]) => min <= max, {
4339
+ import { z as z20 } from "zod";
4340
+ var bridgeGrammarVersionsSchema = z20.tuple([z20.number().int().positive(), z20.number().int().positive()]).refine(([min, max]) => min <= max, {
4351
4341
  message: "grammarVersions must be an ascending [min, max] range"
4352
4342
  });
4353
4343
  function negotiateGrammarVersion(runtime, bridge) {
@@ -4355,62 +4345,62 @@ function negotiateGrammarVersion(runtime, bridge) {
4355
4345
  const max = Math.min(runtime[1], bridge[1]);
4356
4346
  return min <= max ? max : null;
4357
4347
  }
4358
- var bridgeSteerModeSchema = z19.enum(["inject", "queue"]);
4359
- var bridgeCapabilitiesSchema = z19.object({
4360
- sessionRestore: z19.boolean().default(false),
4361
- threadArchive: z19.boolean().default(false),
4362
- threadRename: z19.boolean().default(false),
4363
- threadGoalClear: z19.boolean().default(false),
4348
+ var bridgeSteerModeSchema = z20.enum(["inject", "queue"]);
4349
+ var bridgeCapabilitiesSchema = z20.object({
4350
+ sessionRestore: z20.boolean().default(false),
4351
+ threadArchive: z20.boolean().default(false),
4352
+ threadRename: z20.boolean().default(false),
4353
+ threadGoalClear: z20.boolean().default(false),
4364
4354
  fork: providerForkSchema.default("none"),
4365
- approvalEnforcedBy: z19.enum(["runtime", "provider"]).default("runtime"),
4355
+ approvalEnforcedBy: z20.enum(["runtime", "provider"]).default("runtime"),
4366
4356
  grammarVersions: bridgeGrammarVersionsSchema.default([
4367
4357
  PROVIDER_BRIDGE_PROTOCOL_VERSION,
4368
4358
  PROVIDER_BRIDGE_PROTOCOL_VERSION
4369
4359
  ]),
4370
4360
  steerMode: bridgeSteerModeSchema.default("queue"),
4371
- skills: z19.object({ configure: z19.boolean().default(false) }).default({ configure: false })
4361
+ skills: z20.object({ configure: z20.boolean().default(false) }).default({ configure: false })
4372
4362
  }).passthrough();
4373
- var initializeParamsSchema = z19.object({
4374
- protocolVersion: z19.number().int().positive(),
4375
- client: z19.object({ name: z19.string().min(1), version: z19.string().min(1) }),
4363
+ var initializeParamsSchema = z20.object({
4364
+ protocolVersion: z20.number().int().positive(),
4365
+ client: z20.object({ name: z20.string().min(1), version: z20.string().min(1) }),
4376
4366
  grammarVersions: bridgeGrammarVersionsSchema.default([
4377
4367
  PROVIDER_BRIDGE_PROTOCOL_VERSION,
4378
4368
  PROVIDER_BRIDGE_PROTOCOL_VERSION
4379
4369
  ])
4380
4370
  }).passthrough();
4381
- var initializeResultSchema = z19.object({
4382
- protocolVersion: z19.number().int().positive(),
4383
- capabilities: z19.preprocess(
4371
+ var initializeResultSchema = z20.object({
4372
+ protocolVersion: z20.number().int().positive(),
4373
+ capabilities: z20.preprocess(
4384
4374
  (value) => value ?? {},
4385
4375
  bridgeCapabilitiesSchema
4386
4376
  )
4387
4377
  }).passthrough();
4388
4378
 
4389
4379
  // ../provider-bridge-protocol/src/execution-options.ts
4390
- import { z as z20 } from "zod";
4391
- var bridgeExecutionOptionsSchema = z20.object({
4392
- model: z20.string().min(1).optional(),
4380
+ import { z as z21 } from "zod";
4381
+ var bridgeExecutionOptionsSchema = z21.object({
4382
+ model: z21.string().min(1).optional(),
4393
4383
  serviceTier: serviceTierSchema.optional(),
4394
4384
  reasoningLevel: reasoningLevelSchema.optional(),
4395
4385
  promptMode: promptModeSchema.optional(),
4396
- instructions: z20.string().optional(),
4397
- envVars: z20.record(z20.string(), z20.string()).optional(),
4398
- providerOptions: z20.record(z20.string(), z20.unknown()).optional()
4386
+ instructions: z21.string().optional(),
4387
+ envVars: z21.record(z21.string(), z21.string()).optional(),
4388
+ providerOptions: z21.record(z21.string(), z21.unknown()).optional()
4399
4389
  }).and(runtimePermissionPolicySchema);
4400
4390
 
4401
4391
  // ../provider-bridge-protocol/src/provider-maintenance.ts
4402
- import { z as z21 } from "zod";
4403
- var providerMaintenanceParamsSchema = z21.object({
4404
- providerId: z21.string().min(1),
4405
- cwd: z21.string().min(1).optional(),
4406
- providerOptions: z21.record(z21.string(), z21.unknown()).optional()
4392
+ import { z as z22 } from "zod";
4393
+ var providerMaintenanceParamsSchema = z22.object({
4394
+ providerId: z22.string().min(1),
4395
+ cwd: z22.string().min(1).optional(),
4396
+ providerOptions: z22.record(z22.string(), z22.unknown()).optional()
4407
4397
  }).passthrough();
4408
- var providerInstallationRequirementSchema = z21.enum(["thread_rewind"]);
4398
+ var providerInstallationRequirementSchema = z22.enum(["thread_rewind"]);
4409
4399
  var providerInstallationStatusParamsSchema = providerMaintenanceParamsSchema.extend({
4410
4400
  requirement: providerInstallationRequirementSchema.optional()
4411
4401
  });
4412
- var providerHealthSchema = z21.object({
4413
- status: z21.enum([
4402
+ var providerHealthSchema = z22.object({
4403
+ status: z22.enum([
4414
4404
  "ready",
4415
4405
  "not_installed",
4416
4406
  "unauthenticated",
@@ -4418,114 +4408,114 @@ var providerHealthSchema = z21.object({
4418
4408
  "unsupported_version",
4419
4409
  "unknown"
4420
4410
  ]),
4421
- statusMessage: z21.string().min(1).nullable(),
4422
- accountEmail: z21.string().nullable(),
4423
- planLabel: z21.string().min(1).nullable(),
4424
- installedVersion: z21.string().min(1).nullable(),
4425
- minimumSupportedVersion: z21.string().min(1).nullable(),
4426
- canInstall: z21.boolean(),
4427
- canUpdate: z21.boolean(),
4428
- loginCommand: z21.string().min(1).nullable()
4411
+ statusMessage: z22.string().min(1).nullable(),
4412
+ accountEmail: z22.string().nullable(),
4413
+ planLabel: z22.string().min(1).nullable(),
4414
+ installedVersion: z22.string().min(1).nullable(),
4415
+ minimumSupportedVersion: z22.string().min(1).nullable(),
4416
+ canInstall: z22.boolean(),
4417
+ canUpdate: z22.boolean(),
4418
+ loginCommand: z22.string().min(1).nullable()
4429
4419
  }).passthrough();
4430
- var providerUsageWindowSchema = z21.object({
4431
- label: z21.string().min(1),
4432
- usedPercent: z21.number().min(0).max(100),
4433
- resetsAt: z21.string().min(1).nullable(),
4434
- cost: z21.object({
4435
- usedUsdCents: z21.number().int().nonnegative(),
4436
- limitUsdCents: z21.number().int().positive()
4420
+ var providerUsageWindowSchema = z22.object({
4421
+ label: z22.string().min(1),
4422
+ usedPercent: z22.number().min(0).max(100),
4423
+ resetsAt: z22.string().min(1).nullable(),
4424
+ cost: z22.object({
4425
+ usedUsdCents: z22.number().int().nonnegative(),
4426
+ limitUsdCents: z22.number().int().positive()
4437
4427
  }).optional()
4438
4428
  }).passthrough();
4439
- var providerUsageSchema = z21.discriminatedUnion("status", [
4440
- z21.object({
4441
- status: z21.literal("ok"),
4442
- accountEmail: z21.string().email().nullable(),
4443
- planLabel: z21.string().min(1).nullable(),
4444
- windows: z21.array(providerUsageWindowSchema)
4429
+ var providerUsageSchema = z22.discriminatedUnion("status", [
4430
+ z22.object({
4431
+ status: z22.literal("ok"),
4432
+ accountEmail: z22.string().email().nullable(),
4433
+ planLabel: z22.string().min(1).nullable(),
4434
+ windows: z22.array(providerUsageWindowSchema)
4445
4435
  }).passthrough(),
4446
- z21.object({ status: z21.literal("not_installed") }).passthrough(),
4447
- z21.object({ status: z21.literal("unauthenticated") }).passthrough(),
4448
- z21.object({ status: z21.literal("expired") }).passthrough(),
4449
- z21.object({
4450
- status: z21.literal("error"),
4451
- message: z21.string().min(1),
4452
- planLabel: z21.string().min(1).nullable().default(null),
4453
- accountEmail: z21.string().nullable().default(null)
4436
+ z22.object({ status: z22.literal("not_installed") }).passthrough(),
4437
+ z22.object({ status: z22.literal("unauthenticated") }).passthrough(),
4438
+ z22.object({ status: z22.literal("expired") }).passthrough(),
4439
+ z22.object({
4440
+ status: z22.literal("error"),
4441
+ message: z22.string().min(1),
4442
+ planLabel: z22.string().min(1).nullable().default(null),
4443
+ accountEmail: z22.string().nullable().default(null)
4454
4444
  }).passthrough()
4455
4445
  ]);
4456
- var providerHealthResultSchema = z21.discriminatedUnion("supported", [
4457
- z21.object({ supported: z21.literal(false) }).passthrough(),
4458
- z21.object({
4459
- supported: z21.literal(true),
4446
+ var providerHealthResultSchema = z22.discriminatedUnion("supported", [
4447
+ z22.object({ supported: z22.literal(false) }).passthrough(),
4448
+ z22.object({
4449
+ supported: z22.literal(true),
4460
4450
  health: providerHealthSchema
4461
4451
  }).passthrough()
4462
4452
  ]);
4463
- var providerUsageResultSchema = z21.discriminatedUnion("supported", [
4464
- z21.object({ supported: z21.literal(false) }).passthrough(),
4465
- z21.object({
4466
- supported: z21.literal(true),
4453
+ var providerUsageResultSchema = z22.discriminatedUnion("supported", [
4454
+ z22.object({ supported: z22.literal(false) }).passthrough(),
4455
+ z22.object({
4456
+ supported: z22.literal(true),
4467
4457
  usage: providerUsageSchema
4468
4458
  }).passthrough()
4469
4459
  ]);
4470
- var providerInstallationActionKindSchema = z21.enum([
4460
+ var providerInstallationActionKindSchema = z22.enum([
4471
4461
  "install",
4472
4462
  "update"
4473
4463
  ]);
4474
- var providerInstallationActionSchema = z21.object({
4464
+ var providerInstallationActionSchema = z22.object({
4475
4465
  kind: providerInstallationActionKindSchema,
4476
- label: z21.enum(["Install", "Update"]),
4477
- command: z21.string().min(1)
4466
+ label: z22.enum(["Install", "Update"]),
4467
+ command: z22.string().min(1)
4478
4468
  }).passthrough();
4479
- var providerInstallationSourceSchema = z21.enum([
4469
+ var providerInstallationSourceSchema = z22.enum([
4480
4470
  "notInstalled",
4481
4471
  "npmGlobal",
4482
4472
  "external"
4483
4473
  ]);
4484
- var providerInstallationStatusSchema = z21.object({
4485
- executableName: z21.string().min(1),
4486
- executablePath: z21.string().min(1).nullable(),
4487
- installed: z21.boolean(),
4474
+ var providerInstallationStatusSchema = z22.object({
4475
+ executableName: z22.string().min(1),
4476
+ executablePath: z22.string().min(1).nullable(),
4477
+ installed: z22.boolean(),
4488
4478
  installSource: providerInstallationSourceSchema,
4489
- currentVersion: z21.string().min(1).nullable(),
4490
- latestVersion: z21.string().min(1).nullable(),
4491
- minimumSupportedVersion: z21.string().min(1).nullable(),
4492
- npmPackageName: z21.string().min(1).nullable(),
4493
- npmGlobalPackageVersion: z21.string().min(1).nullable(),
4479
+ currentVersion: z22.string().min(1).nullable(),
4480
+ latestVersion: z22.string().min(1).nullable(),
4481
+ minimumSupportedVersion: z22.string().min(1).nullable(),
4482
+ npmPackageName: z22.string().min(1).nullable(),
4483
+ npmGlobalPackageVersion: z22.string().min(1).nullable(),
4494
4484
  installAction: providerInstallationActionSchema.nullable(),
4495
- needsUpdate: z21.boolean(),
4496
- versionUnsupported: z21.boolean()
4485
+ needsUpdate: z22.boolean(),
4486
+ versionUnsupported: z22.boolean()
4497
4487
  }).passthrough();
4498
4488
  var providerInstallationRunParamsSchema = providerMaintenanceParamsSchema.extend({
4499
4489
  action: providerInstallationActionKindSchema
4500
4490
  });
4501
- var providerInstallationCommandSchema = z21.object({
4502
- command: z21.string().min(1),
4503
- args: z21.array(z21.string()).max(64),
4504
- displayCommand: z21.string().min(1)
4491
+ var providerInstallationCommandSchema = z22.object({
4492
+ command: z22.string().min(1),
4493
+ args: z22.array(z22.string()).max(64),
4494
+ displayCommand: z22.string().min(1)
4505
4495
  }).passthrough();
4506
- var providerInstallationVerificationSchema = z21.discriminatedUnion(
4496
+ var providerInstallationVerificationSchema = z22.discriminatedUnion(
4507
4497
  "kind",
4508
4498
  [
4509
- z21.object({ kind: z21.literal("installed") }).passthrough(),
4510
- z21.object({
4511
- kind: z21.literal("version_changed"),
4512
- previousVersion: z21.string().min(1)
4499
+ z22.object({ kind: z22.literal("installed") }).passthrough(),
4500
+ z22.object({
4501
+ kind: z22.literal("version_changed"),
4502
+ previousVersion: z22.string().min(1)
4513
4503
  }).passthrough(),
4514
- z21.object({
4515
- kind: z21.literal("version_at_least"),
4516
- version: z21.string().min(1)
4504
+ z22.object({
4505
+ kind: z22.literal("version_at_least"),
4506
+ version: z22.string().min(1)
4517
4507
  }).passthrough()
4518
4508
  ]
4519
4509
  );
4520
- var providerInstallationRunResultSchema = z21.discriminatedUnion(
4510
+ var providerInstallationRunResultSchema = z22.discriminatedUnion(
4521
4511
  "available",
4522
4512
  [
4523
- z21.object({
4524
- available: z21.literal(false),
4525
- message: z21.string().min(1)
4513
+ z22.object({
4514
+ available: z22.literal(false),
4515
+ message: z22.string().min(1)
4526
4516
  }).passthrough(),
4527
- z21.object({
4528
- available: z21.literal(true),
4517
+ z22.object({
4518
+ available: z22.literal(true),
4529
4519
  command: providerInstallationCommandSchema,
4530
4520
  verification: providerInstallationVerificationSchema
4531
4521
  }).passthrough()
@@ -4533,7 +4523,7 @@ var providerInstallationRunResultSchema = z21.discriminatedUnion(
4533
4523
  );
4534
4524
 
4535
4525
  // ../provider-bridge-protocol/src/requests.ts
4536
- import { z as z22 } from "zod";
4526
+ import { z as z23 } from "zod";
4537
4527
  var BRIDGE_REQUEST_METHODS = {
4538
4528
  initialize: "initialize",
4539
4529
  modelList: "model/list",
@@ -4555,81 +4545,77 @@ var BRIDGE_REQUEST_METHODS = {
4555
4545
  skillsConfigure: "skills/configure"
4556
4546
  };
4557
4547
  var sessionConstructionFields = {
4558
- threadId: z22.string().min(1),
4559
- cwd: z22.string().min(1),
4548
+ threadId: z23.string().min(1),
4549
+ cwd: z23.string().min(1),
4560
4550
  options: bridgeExecutionOptionsSchema,
4561
- dynamicTools: z22.array(dynamicToolSchema).optional(),
4562
- disallowedTools: z22.array(z22.string().min(1)).optional(),
4551
+ dynamicTools: z23.array(dynamicToolSchema).optional(),
4552
+ disallowedTools: z23.array(z23.string().min(1)).optional(),
4563
4553
  instructionMode: instructionModeSchema
4564
4554
  };
4565
- var modelListParamsSchema = z22.object({ cwd: z22.string().min(1).optional() }).passthrough();
4566
- var threadStartParamsSchema = z22.object({
4555
+ var modelListParamsSchema = z23.object({ cwd: z23.string().min(1).optional() }).passthrough();
4556
+ var threadStartParamsSchema = z23.object({
4567
4557
  ...sessionConstructionFields,
4568
- input: z22.array(promptInputSchema).optional()
4558
+ input: z23.array(promptInputSchema).optional()
4569
4559
  }).passthrough();
4570
- var threadResumeParamsSchema = z22.object({
4560
+ var threadResumeParamsSchema = z23.object({
4571
4561
  ...sessionConstructionFields,
4572
- providerThreadId: z22.string().min(1)
4562
+ providerThreadId: z23.string().min(1)
4573
4563
  }).passthrough();
4574
- var threadForkParamsSchema = z22.object({
4564
+ var threadForkParamsSchema = z23.object({
4575
4565
  ...sessionConstructionFields,
4576
- sourceProviderThreadId: z22.string().min(1),
4577
- sourceProviderCheckpointId: z22.string().min(1).optional()
4566
+ sourceProviderThreadId: z23.string().min(1),
4567
+ sourceProviderCheckpointId: z23.string().min(1).optional()
4578
4568
  }).passthrough();
4579
- var threadStopParamsSchema = z22.object({
4580
- threadId: z22.string().min(1),
4581
- providerThreadId: z22.string().min(1),
4582
- intent: z22.enum(["interrupt", "release"]),
4583
- activeTurnId: z22.string().min(1).nullable()
4569
+ var threadStopParamsSchema = z23.object({
4570
+ threadId: z23.string().min(1),
4571
+ providerThreadId: z23.string().min(1),
4572
+ intent: z23.enum(["interrupt", "release"]),
4573
+ activeTurnId: z23.string().min(1).nullable()
4584
4574
  }).passthrough();
4585
- var threadRefParams = z22.object({
4586
- threadId: z22.string().min(1),
4587
- providerThreadId: z22.string().min(1)
4575
+ var threadRefParams = z23.object({
4576
+ threadId: z23.string().min(1),
4577
+ providerThreadId: z23.string().min(1)
4588
4578
  }).passthrough();
4589
- var threadNameSetParamsSchema = z22.object({
4590
- threadId: z22.string().min(1),
4591
- providerThreadId: z22.string().min(1),
4592
- title: z22.string().min(1)
4579
+ var threadNameSetParamsSchema = z23.object({
4580
+ threadId: z23.string().min(1),
4581
+ providerThreadId: z23.string().min(1),
4582
+ title: z23.string().min(1)
4593
4583
  }).passthrough();
4594
4584
  var turnInputFields = {
4595
- threadId: z22.string().min(1),
4596
- providerThreadId: z22.string().min(1),
4597
- input: z22.array(promptInputSchema),
4585
+ threadId: z23.string().min(1),
4586
+ providerThreadId: z23.string().min(1),
4587
+ input: z23.array(promptInputSchema),
4598
4588
  clientRequestId: clientTurnRequestIdSchema,
4599
4589
  options: bridgeExecutionOptionsSchema
4600
4590
  };
4601
- var turnStartParamsSchema = z22.object(turnInputFields).passthrough();
4602
- var turnSteerParamsSchema = z22.object({
4591
+ var turnStartParamsSchema = z23.object(turnInputFields).passthrough();
4592
+ var turnSteerParamsSchema = z23.object({
4603
4593
  ...turnInputFields,
4604
- expectedTurnId: z22.string().min(1)
4594
+ expectedTurnId: z23.string().min(1)
4605
4595
  }).passthrough();
4606
- var skillsConfigureRootSchema = z22.object({
4607
- id: z22.string().min(1),
4608
- path: z22.string().min(1),
4609
- skills: z22.array(
4610
- z22.object({
4611
- name: z22.string().min(1),
4612
- description: z22.string()
4596
+ var skillsConfigureRootSchema = z23.object({
4597
+ id: z23.string().min(1),
4598
+ path: z23.string().min(1),
4599
+ skills: z23.array(
4600
+ z23.object({
4601
+ name: z23.string().min(1),
4602
+ description: z23.string()
4613
4603
  }).passthrough()
4614
4604
  )
4615
4605
  }).passthrough();
4616
- var skillsConfigureParamsSchema = z22.object({
4617
- roots: z22.array(skillsConfigureRootSchema)
4618
- }).passthrough();
4619
- var threadIdentityResultSchema = z22.object({
4620
- providerThreadId: z22.string().min(1),
4621
- sessionRestorable: z22.boolean().optional()
4606
+ var skillsConfigureParamsSchema = z23.object({
4607
+ roots: z23.array(skillsConfigureRootSchema)
4622
4608
  }).passthrough();
4623
- var modelListResultSchema = z22.object({
4624
- models: z22.array(availableModelSchema),
4625
- selectedOnlyModels: z22.array(availableModelSchema).default([])
4609
+ var threadIdentityResultSchema = z23.object({
4610
+ providerThreadId: z23.string().min(1),
4611
+ sessionRestorable: z23.boolean().optional()
4626
4612
  }).passthrough();
4627
4613
 
4628
4614
  // ../provider-bridge-protocol/src/notifications.ts
4629
- import { z as z24 } from "zod";
4615
+ import { z as z25 } from "zod";
4630
4616
 
4631
4617
  // ../provider-bridge-protocol/src/errors.ts
4632
- import { z as z23 } from "zod";
4618
+ import { z as z24 } from "zod";
4633
4619
  var BRIDGE_JSON_RPC_ERRORS = {
4634
4620
  INVALID_PARAMS: -32602,
4635
4621
  METHOD_NOT_FOUND: -32601,
@@ -4638,68 +4624,65 @@ var BRIDGE_JSON_RPC_ERRORS = {
4638
4624
  SESSION_NOT_RESTORABLE: -32002,
4639
4625
  FORK_CHECKPOINT_UNSUPPORTED: -32003
4640
4626
  };
4641
- var providerRecoveryHintSchema = z23.object({
4627
+ var providerRecoveryHintSchema = z24.object({
4642
4628
  kind: providerRecoveryKindSchema,
4643
- message: z23.string().min(1),
4644
- retryable: z23.boolean()
4629
+ message: z24.string().min(1),
4630
+ retryable: z24.boolean()
4645
4631
  });
4646
- var bridgeErrorDataSchema = z23.object({ recovery: providerRecoveryHintSchema.optional() }).passthrough();
4632
+ var bridgeErrorDataSchema = z24.object({ recovery: providerRecoveryHintSchema.optional() }).passthrough();
4647
4633
 
4648
4634
  // ../provider-bridge-protocol/src/notifications.ts
4649
- var threadIdentityNotificationSchema = z24.object({
4650
- threadId: z24.string().min(1),
4651
- providerThreadId: z24.string().min(1),
4652
- sessionRestorable: z24.boolean().optional()
4653
- }).passthrough();
4654
- var sessionReplacedNotificationSchema = z24.object({
4655
- threadId: z24.string().min(1),
4656
- providerThreadId: z24.string().min(1).nullable(),
4657
- reason: z24.string().min(1),
4658
- contextLost: z24.boolean().default(false),
4659
- showRuntimeNote: z24.boolean().default(false)
4635
+ var threadIdentityNotificationSchema = z25.object({
4636
+ threadId: z25.string().min(1),
4637
+ providerThreadId: z25.string().min(1),
4638
+ sessionRestorable: z25.boolean().optional()
4660
4639
  }).passthrough();
4661
- var providerRawNotificationSchema = z24.object({
4662
- threadId: z24.string().min(1).optional(),
4663
- coverage: z24.enum(["noise", "unknown"]),
4664
- payload: z24.unknown()
4640
+ var sessionReplacedNotificationSchema = z25.object({
4641
+ threadId: z25.string().min(1),
4642
+ providerThreadId: z25.string().min(1).nullable(),
4643
+ reason: z25.string().min(1),
4644
+ contextLost: z25.boolean().default(false),
4645
+ showRuntimeNote: z25.boolean().default(false)
4665
4646
  }).passthrough();
4666
- var providerRecoveryNotificationSchema = z24.object({
4667
- threadId: z24.string().min(1).optional(),
4647
+ var providerRecoveryNotificationSchema = z25.object({
4648
+ threadId: z25.string().min(1).optional(),
4668
4649
  ...providerRecoveryHintSchema.shape
4669
4650
  }).passthrough();
4670
- var errorNotificationSchema = z24.object({
4671
- threadId: z24.string().min(1).optional(),
4672
- message: z24.string().min(1)
4651
+ var errorNotificationSchema = z25.object({
4652
+ threadId: z25.string().min(1).optional(),
4653
+ providerThreadId: z25.string().min(1).optional(),
4654
+ message: z25.string().min(1)
4673
4655
  }).passthrough();
4674
4656
 
4675
4657
  // ../provider-bridge-protocol/src/bridge-requests.ts
4676
- import { z as z25 } from "zod";
4677
- var toolCallRequestParamsSchema = z25.object({
4678
- providerThreadId: z25.string().min(1),
4679
- threadId: z25.string().min(1).optional(),
4680
- turnId: z25.union([z25.string().min(1), z25.null()]),
4681
- callId: z25.string().min(1),
4682
- tool: z25.string().min(1),
4683
- arguments: z25.unknown()
4658
+ import { z as z26 } from "zod";
4659
+ var toolCallRequestParamsSchema = z26.object({
4660
+ providerThreadId: z26.string().min(1),
4661
+ threadId: z26.string().min(1).optional(),
4662
+ turnId: z26.union([z26.string().min(1), z26.null()]),
4663
+ callId: z26.string().min(1),
4664
+ tool: z26.string().min(1),
4665
+ arguments: z26.unknown(),
4666
+ providerNativeIds: z26.boolean().optional()
4684
4667
  }).passthrough();
4685
- var toolCallResultSchema = z25.object({
4686
- success: z25.boolean(),
4687
- contentItems: z25.array(
4688
- z25.discriminatedUnion("type", [
4689
- z25.object({ type: z25.literal("inputText"), text: z25.string() }),
4690
- z25.object({
4691
- type: z25.literal("inputImage"),
4692
- imageUrl: z25.string().min(1)
4668
+ var toolCallResultSchema = z26.object({
4669
+ success: z26.boolean(),
4670
+ contentItems: z26.array(
4671
+ z26.discriminatedUnion("type", [
4672
+ z26.object({ type: z26.literal("inputText"), text: z26.string() }),
4673
+ z26.object({
4674
+ type: z26.literal("inputImage"),
4675
+ imageUrl: z26.string().min(1)
4693
4676
  })
4694
4677
  ])
4695
4678
  )
4696
4679
  }).passthrough();
4697
- var interactionRequestParamsSchema = z25.object({
4698
- providerThreadId: z25.string().min(1),
4699
- threadId: z25.string().min(1).optional(),
4700
- turnId: z25.union([z25.string().min(1), z25.null()]),
4680
+ var interactionRequestParamsSchema = z26.object({
4681
+ providerThreadId: z26.string().min(1),
4682
+ threadId: z26.string().min(1).optional(),
4683
+ turnId: z26.union([z26.string().min(1), z26.null()]),
4701
4684
  payload: pendingInteractionPayloadSchema,
4702
- providerNativeIds: z25.boolean().optional()
4685
+ providerNativeIds: z26.boolean().optional()
4703
4686
  }).passthrough();
4704
4687
 
4705
4688
  // ../provider-bridge-protocol/src/thread-event-grammar.ts
@@ -4876,7 +4859,7 @@ function threadEvents(context, threadId) {
4876
4859
  context.client.drainIntoLog();
4877
4860
  return context.client.events.filter((entry) => entry.threadId === threadId).map((entry) => entry.event);
4878
4861
  }
4879
- var persistedEventSchema = z26.preprocess(
4862
+ var persistedEventSchema = z27.preprocess(
4880
4863
  (event) => JSON.parse(JSON.stringify(event)),
4881
4864
  threadEventSchema
4882
4865
  );
@@ -5971,26 +5954,26 @@ function formatConformanceReport(report) {
5971
5954
  }
5972
5955
 
5973
5956
  // ../provider-bridge-protocol/src/testing/bridge-json-rpc-test-helpers.ts
5974
- import { z as z27 } from "zod";
5975
- var bridgeJsonRpcValueSchema = z27.lazy(
5976
- () => z27.union([
5977
- z27.string(),
5978
- z27.number(),
5979
- z27.boolean(),
5980
- z27.null(),
5981
- z27.array(bridgeJsonRpcValueSchema),
5982
- z27.record(z27.string(), bridgeJsonRpcValueSchema)
5957
+ import { z as z28 } from "zod";
5958
+ var bridgeJsonRpcValueSchema = z28.lazy(
5959
+ () => z28.union([
5960
+ z28.string(),
5961
+ z28.number(),
5962
+ z28.boolean(),
5963
+ z28.null(),
5964
+ z28.array(bridgeJsonRpcValueSchema),
5965
+ z28.record(z28.string(), bridgeJsonRpcValueSchema)
5983
5966
  ])
5984
5967
  );
5985
- var bridgeJsonRpcOutputSchema = z27.object({
5986
- jsonrpc: z27.literal("2.0"),
5987
- id: z27.union([z27.string(), z27.number()]).optional(),
5988
- method: z27.string().optional(),
5968
+ var bridgeJsonRpcOutputSchema = z28.object({
5969
+ jsonrpc: z28.literal("2.0"),
5970
+ id: z28.union([z28.string(), z28.number()]).optional(),
5971
+ method: z28.string().optional(),
5989
5972
  params: bridgeJsonRpcValueSchema.optional(),
5990
5973
  result: bridgeJsonRpcValueSchema.optional(),
5991
- error: z27.object({
5992
- code: z27.number(),
5993
- message: z27.string(),
5974
+ error: z28.object({
5975
+ code: z28.number(),
5976
+ message: z28.string(),
5994
5977
  data: bridgeJsonRpcValueSchema.optional()
5995
5978
  }).optional()
5996
5979
  });
@@ -6279,11 +6262,7 @@ function parseEntry(raw, file, lineNumber) {
6279
6262
  const entry = parsed;
6280
6263
  return { ...entry, run: typeof entry.run === "number" ? entry.run : 0 };
6281
6264
  }
6282
- function readBridgeRecordingLane(dir, direction) {
6283
- const file = join(dir, bridgeRecordingFileName(direction));
6284
- if (!existsSync(file)) {
6285
- return [];
6286
- }
6265
+ function readLaneEntries(file, direction, laneLabel) {
6287
6266
  const entries = [];
6288
6267
  const lines = readFileSync(file, "utf8").split("\n");
6289
6268
  for (const [index, raw] of lines.entries()) {
@@ -6291,32 +6270,27 @@ function readBridgeRecordingLane(dir, direction) {
6291
6270
  const entry = parseEntry(raw, file, index + 1);
6292
6271
  if (entry.dir !== direction) {
6293
6272
  throw new Error(
6294
- `${file}:${index + 1}: entry direction ${entry.dir} in the ${direction} lane`
6273
+ `${file}:${index + 1}: entry direction ${entry.dir} in the ${laneLabel}`
6295
6274
  );
6296
6275
  }
6297
6276
  entries.push(entry);
6298
6277
  }
6299
6278
  return entries;
6300
6279
  }
6280
+ function readBridgeRecordingLane(dir, direction) {
6281
+ const file = join(dir, bridgeRecordingFileName(direction));
6282
+ if (!existsSync(file)) {
6283
+ return [];
6284
+ }
6285
+ return readLaneEntries(file, direction, `${direction} lane`);
6286
+ }
6301
6287
  var CURRENT_BRIDGE_LANE_FILE = "bridge\u2192runtime.current.ndjson";
6302
6288
  function readCurrentBridgeLane(dir) {
6303
6289
  const file = join(dir, CURRENT_BRIDGE_LANE_FILE);
6304
6290
  if (!existsSync(file)) {
6305
6291
  return null;
6306
6292
  }
6307
- const entries = [];
6308
- const lines = readFileSync(file, "utf8").split("\n");
6309
- for (const [index, raw] of lines.entries()) {
6310
- if (raw.length === 0) continue;
6311
- const entry = parseEntry(raw, file, index + 1);
6312
- if (entry.dir !== "bridge\u2192runtime") {
6313
- throw new Error(
6314
- `${file}:${index + 1}: entry direction ${entry.dir} in the current bridge lane`
6315
- );
6316
- }
6317
- entries.push(entry);
6318
- }
6319
- return entries;
6293
+ return readLaneEntries(file, "bridge\u2192runtime", "current bridge lane");
6320
6294
  }
6321
6295
  function withCurrentBridgeLane(recording) {
6322
6296
  const current = readCurrentBridgeLane(recording.dir);