@get-bb/plugin-sdk 0.4.6 → 0.4.9

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.
@@ -0,0 +1,4042 @@
1
+ // Portable type declarations for `@get-bb/plugin-sdk`. Unpublished BB
2
+ // workspace contracts are flattened; public subpaths may reuse the
3
+ // package root without requiring any other @bb/* package.
4
+ //
5
+ // Confused by the API, or need a symbol that isn't here? Clone the BB repo
6
+ // and read the real source: https://github.com/get-bb/bb
7
+
8
+ import { z } from 'zod';
9
+
10
+ declare const acpReasoningCliSchema: z.ZodObject<{
11
+ defaultLevel: z.ZodOptional<z.ZodEnum<{
12
+ high: "high";
13
+ low: "low";
14
+ max: "max";
15
+ medium: "medium";
16
+ none: "none";
17
+ ultra: "ultra";
18
+ ultracode: "ultracode";
19
+ xhigh: "xhigh";
20
+ }>>;
21
+ flag: z.ZodString;
22
+ levelValues: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
23
+ high: "high";
24
+ low: "low";
25
+ max: "max";
26
+ medium: "medium";
27
+ none: "none";
28
+ ultra: "ultra";
29
+ ultracode: "ultracode";
30
+ xhigh: "xhigh";
31
+ }> & z.core.$partial, z.ZodString>>;
32
+ supportedLevels: z.ZodArray<z.ZodEnum<{
33
+ high: "high";
34
+ low: "low";
35
+ max: "max";
36
+ medium: "medium";
37
+ none: "none";
38
+ ultra: "ultra";
39
+ ultracode: "ultracode";
40
+ xhigh: "xhigh";
41
+ }>>;
42
+ }, z.core.$strict>;
43
+ declare const acpNativeReasoningSchema: z.ZodObject<{
44
+ configId: z.ZodString;
45
+ defaultLevel: z.ZodOptional<z.ZodEnum<{
46
+ high: "high";
47
+ low: "low";
48
+ max: "max";
49
+ medium: "medium";
50
+ none: "none";
51
+ ultra: "ultra";
52
+ ultracode: "ultracode";
53
+ xhigh: "xhigh";
54
+ }>>;
55
+ levelValues: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
56
+ high: "high";
57
+ low: "low";
58
+ max: "max";
59
+ medium: "medium";
60
+ none: "none";
61
+ ultra: "ultra";
62
+ ultracode: "ultracode";
63
+ xhigh: "xhigh";
64
+ }> & z.core.$partial, z.ZodString>>;
65
+ supportedLevels: z.ZodArray<z.ZodEnum<{
66
+ high: "high";
67
+ low: "low";
68
+ max: "max";
69
+ medium: "medium";
70
+ none: "none";
71
+ ultra: "ultra";
72
+ ultracode: "ultracode";
73
+ xhigh: "xhigh";
74
+ }>>;
75
+ }, z.core.$strict>;
76
+ declare const acpPermissionCliSchema: z.ZodObject<{
77
+ full: z.ZodOptional<z.ZodArray<z.ZodString>>;
78
+ insertAfterArgs: z.ZodOptional<z.ZodNumber>;
79
+ readonly: z.ZodOptional<z.ZodArray<z.ZodString>>;
80
+ workspaceWrite: z.ZodOptional<z.ZodArray<z.ZodString>>;
81
+ }, z.core.$strict>;
82
+
83
+ interface JsonObject {
84
+ [key: string]: JsonValue;
85
+ }
86
+ type JsonValue = string | number | boolean | null | JsonValue[] | JsonObject;
87
+ declare const jsonValueSchema: z.ZodType<JsonValue>;
88
+
89
+ /**
90
+ * Raw SDK task-type discriminants for the background tasks bb materializes as
91
+ * timeline rows: dynamic workflows (the Workflow tool), backgrounded shell
92
+ * commands (Bash with run_in_background), and backgrounded subagents. They
93
+ * share the provider task event family (task_started / task_progress /
94
+ * task_updated / task_notification). Other task types such as monitors share
95
+ * the family too but are not materialized.
96
+ */
97
+ declare const LOCAL_WORKFLOW_TASK_TYPE = "local_workflow";
98
+ declare const LOCAL_BASH_TASK_TYPE = "local_bash";
99
+ declare function isBackgroundAgentTaskType(taskType: string): boolean;
100
+ declare const backgroundTaskStatusSchema: z.ZodEnum<{
101
+ completed: "completed";
102
+ failed: "failed";
103
+ killed: "killed";
104
+ paused: "paused";
105
+ pending: "pending";
106
+ running: "running";
107
+ stopped: "stopped";
108
+ }>;
109
+ type BackgroundTaskStatus = z.infer<typeof backgroundTaskStatusSchema>;
110
+ declare const workflowAgentStateSchema: z.ZodEnum<{
111
+ done: "done";
112
+ failed: "failed";
113
+ queued: "queued";
114
+ running: "running";
115
+ skipped: "skipped";
116
+ }>;
117
+ type WorkflowAgentState = z.infer<typeof workflowAgentStateSchema>;
118
+ declare const workflowAgentSnapshotSchema: z.ZodObject<{
119
+ agentType: z.ZodOptional<z.ZodString>;
120
+ attempt: z.ZodNumber;
121
+ cached: z.ZodBoolean;
122
+ durationMs: z.ZodOptional<z.ZodNumber>;
123
+ error: z.ZodOptional<z.ZodString>;
124
+ index: z.ZodNumber;
125
+ isolation: z.ZodOptional<z.ZodString>;
126
+ label: z.ZodString;
127
+ lastProgressAt: z.ZodNumber;
128
+ lastToolName: z.ZodOptional<z.ZodString>;
129
+ lastToolSummary: z.ZodOptional<z.ZodString>;
130
+ model: z.ZodString;
131
+ phaseIndex: z.ZodOptional<z.ZodNumber>;
132
+ phaseTitle: z.ZodOptional<z.ZodString>;
133
+ promptPreview: z.ZodOptional<z.ZodString>;
134
+ queuedAt: z.ZodOptional<z.ZodNumber>;
135
+ resultPreview: z.ZodOptional<z.ZodString>;
136
+ startedAt: z.ZodOptional<z.ZodNumber>;
137
+ state: z.ZodEnum<{
138
+ done: "done";
139
+ failed: "failed";
140
+ queued: "queued";
141
+ running: "running";
142
+ skipped: "skipped";
143
+ }>;
144
+ tokens: z.ZodOptional<z.ZodNumber>;
145
+ toolCalls: z.ZodOptional<z.ZodNumber>;
146
+ }, z.core.$strip>;
147
+ type WorkflowAgentSnapshot = z.infer<typeof workflowAgentSnapshotSchema>;
148
+ declare const workflowPhaseSnapshotSchema: z.ZodObject<{
149
+ index: z.ZodNumber;
150
+ kind: z.ZodOptional<z.ZodString>;
151
+ title: z.ZodString;
152
+ }, z.core.$strip>;
153
+ type WorkflowPhaseSnapshot = z.infer<typeof workflowPhaseSnapshotSchema>;
154
+ /**
155
+ * Full merged workflow state at a point in time. Providers emit progress as
156
+ * delta batches; the adapter folds them by (record type, index) so every
157
+ * persisted snapshot supersedes the previous one.
158
+ */
159
+ declare const workflowProgressSnapshotSchema: z.ZodObject<{
160
+ agents: z.ZodArray<z.ZodObject<{
161
+ agentType: z.ZodOptional<z.ZodString>;
162
+ attempt: z.ZodNumber;
163
+ cached: z.ZodBoolean;
164
+ durationMs: z.ZodOptional<z.ZodNumber>;
165
+ error: z.ZodOptional<z.ZodString>;
166
+ index: z.ZodNumber;
167
+ isolation: z.ZodOptional<z.ZodString>;
168
+ label: z.ZodString;
169
+ lastProgressAt: z.ZodNumber;
170
+ lastToolName: z.ZodOptional<z.ZodString>;
171
+ lastToolSummary: z.ZodOptional<z.ZodString>;
172
+ model: z.ZodString;
173
+ phaseIndex: z.ZodOptional<z.ZodNumber>;
174
+ phaseTitle: z.ZodOptional<z.ZodString>;
175
+ promptPreview: z.ZodOptional<z.ZodString>;
176
+ queuedAt: z.ZodOptional<z.ZodNumber>;
177
+ resultPreview: z.ZodOptional<z.ZodString>;
178
+ startedAt: z.ZodOptional<z.ZodNumber>;
179
+ state: z.ZodEnum<{
180
+ done: "done";
181
+ failed: "failed";
182
+ queued: "queued";
183
+ running: "running";
184
+ skipped: "skipped";
185
+ }>;
186
+ tokens: z.ZodOptional<z.ZodNumber>;
187
+ toolCalls: z.ZodOptional<z.ZodNumber>;
188
+ }, z.core.$strip>>;
189
+ phases: z.ZodArray<z.ZodObject<{
190
+ index: z.ZodNumber;
191
+ kind: z.ZodOptional<z.ZodString>;
192
+ title: z.ZodString;
193
+ }, z.core.$strip>>;
194
+ }, z.core.$strip>;
195
+ type WorkflowProgressSnapshot = z.infer<typeof workflowProgressSnapshotSchema>;
196
+ declare const backgroundTaskUsageSchema: z.ZodObject<{
197
+ durationMs: z.ZodNumber;
198
+ toolUses: z.ZodNumber;
199
+ totalTokens: z.ZodNumber;
200
+ }, z.core.$strip>;
201
+ type BackgroundTaskUsage = z.infer<typeof backgroundTaskUsageSchema>;
202
+ /**
203
+ * Canonical derivation from the provider-reported task status to the shared
204
+ * item-status machinery: paused stays pending because a paused workflow is
205
+ * resumable; stopped maps to interrupted (user/system stop, not a failure).
206
+ */
207
+ declare function backgroundTaskItemStatus(taskStatus: BackgroundTaskStatus): "completed" | "failed" | "interrupted" | "pending";
208
+ /**
209
+ * Whether the provider-reported status already describes a finished task.
210
+ * Settle backstops (thread restart, daemon crash, lease expiry) must preserve
211
+ * these statuses instead of rewriting them to "stopped": a workflow whose
212
+ * completion patch arrived before its terminal notification is completed, not
213
+ * interrupted.
214
+ */
215
+ declare function isSettledBackgroundTaskStatus(taskStatus: BackgroundTaskStatus): boolean;
216
+
217
+ declare const claudeTaskToolNameSchema: z.ZodEnum<{
218
+ TaskCreate: "TaskCreate";
219
+ TaskGet: "TaskGet";
220
+ TaskList: "TaskList";
221
+ TaskUpdate: "TaskUpdate";
222
+ }>;
223
+ declare const claudeTaskToolOutputSchema: z.ZodUnion<readonly [z.ZodObject<{
224
+ task: z.ZodObject<{
225
+ id: z.ZodString;
226
+ subject: z.ZodString;
227
+ }, z.core.$loose>;
228
+ }, z.core.$loose>, z.ZodObject<{
229
+ task: z.ZodNullable<z.ZodObject<{
230
+ id: z.ZodString;
231
+ status: z.ZodEnum<{
232
+ completed: "completed";
233
+ in_progress: "in_progress";
234
+ pending: "pending";
235
+ }>;
236
+ subject: z.ZodString;
237
+ }, z.core.$loose>>;
238
+ }, z.core.$loose>, z.ZodObject<{
239
+ tasks: z.ZodArray<z.ZodUnknown>;
240
+ }, z.core.$loose>, z.ZodObject<{
241
+ success: z.ZodBoolean;
242
+ taskId: z.ZodString;
243
+ }, z.core.$loose>]>;
244
+ type ClaudeTaskToolOutput = z.infer<typeof claudeTaskToolOutputSchema>;
245
+
246
+ declare function toPositiveNumber(value: unknown): number | undefined;
247
+
248
+ declare const pendingInteractionCommandActionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
249
+ command: z.ZodString;
250
+ name: z.ZodString;
251
+ path: z.ZodString;
252
+ type: z.ZodLiteral<"read">;
253
+ }, z.core.$strip>, z.ZodObject<{
254
+ command: z.ZodString;
255
+ path: z.ZodNullable<z.ZodString>;
256
+ type: z.ZodLiteral<"listFiles">;
257
+ }, z.core.$strip>, z.ZodObject<{
258
+ command: z.ZodString;
259
+ path: z.ZodNullable<z.ZodString>;
260
+ query: z.ZodNullable<z.ZodString>;
261
+ type: z.ZodLiteral<"search">;
262
+ }, z.core.$strip>, z.ZodObject<{
263
+ command: z.ZodString;
264
+ type: z.ZodLiteral<"unknown">;
265
+ }, z.core.$strip>], "type">;
266
+ type PendingInteractionCommandAction = z.infer<typeof pendingInteractionCommandActionSchema>;
267
+ declare const pendingInteractionNetworkPermissionsSchema: z.ZodObject<{
268
+ enabled: z.ZodNullable<z.ZodBoolean>;
269
+ }, z.core.$strip>;
270
+ declare const pendingInteractionFileSystemPermissionsSchema: z.ZodObject<{
271
+ read: z.ZodArray<z.ZodString>;
272
+ write: z.ZodArray<z.ZodString>;
273
+ }, z.core.$strip>;
274
+ declare const pendingInteractionMacOsPermissionsSchema: z.ZodObject<{
275
+ accessibility: z.ZodBoolean;
276
+ automations: z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodLiteral<"all">, z.ZodObject<{
277
+ bundleIds: z.ZodArray<z.ZodString>;
278
+ kind: z.ZodLiteral<"bundle_ids">;
279
+ }, z.core.$strip>]>;
280
+ calendar: z.ZodBoolean;
281
+ contacts: z.ZodEnum<{
282
+ none: "none";
283
+ read_only: "read_only";
284
+ read_write: "read_write";
285
+ }>;
286
+ launchServices: z.ZodBoolean;
287
+ preferences: z.ZodEnum<{
288
+ none: "none";
289
+ read_only: "read_only";
290
+ read_write: "read_write";
291
+ }>;
292
+ reminders: z.ZodBoolean;
293
+ }, z.core.$strip>;
294
+ declare const pendingInteractionRequestedPermissionProfileSchema: z.ZodObject<{
295
+ fileSystem: z.ZodNullable<z.ZodObject<{
296
+ read: z.ZodArray<z.ZodString>;
297
+ write: z.ZodArray<z.ZodString>;
298
+ }, z.core.$strip>>;
299
+ macos: z.ZodNullable<z.ZodObject<{
300
+ accessibility: z.ZodBoolean;
301
+ automations: z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodLiteral<"all">, z.ZodObject<{
302
+ bundleIds: z.ZodArray<z.ZodString>;
303
+ kind: z.ZodLiteral<"bundle_ids">;
304
+ }, z.core.$strip>]>;
305
+ calendar: z.ZodBoolean;
306
+ contacts: z.ZodEnum<{
307
+ none: "none";
308
+ read_only: "read_only";
309
+ read_write: "read_write";
310
+ }>;
311
+ launchServices: z.ZodBoolean;
312
+ preferences: z.ZodEnum<{
313
+ none: "none";
314
+ read_only: "read_only";
315
+ read_write: "read_write";
316
+ }>;
317
+ reminders: z.ZodBoolean;
318
+ }, z.core.$strip>>;
319
+ network: z.ZodNullable<z.ZodObject<{
320
+ enabled: z.ZodNullable<z.ZodBoolean>;
321
+ }, z.core.$strip>>;
322
+ }, z.core.$strip>;
323
+ type PendingInteractionRequestedPermissionProfile = z.infer<typeof pendingInteractionRequestedPermissionProfileSchema>;
324
+ declare const pendingInteractionGrantablePermissionProfileSchema: z.ZodObject<{
325
+ fileSystem: z.ZodNullable<z.ZodObject<{
326
+ read: z.ZodArray<z.ZodString>;
327
+ write: z.ZodArray<z.ZodString>;
328
+ }, z.core.$strip>>;
329
+ network: z.ZodNullable<z.ZodObject<{
330
+ enabled: z.ZodNullable<z.ZodBoolean>;
331
+ }, z.core.$strip>>;
332
+ }, z.core.$strict>;
333
+ type PendingInteractionGrantablePermissionProfile = z.infer<typeof pendingInteractionGrantablePermissionProfileSchema>;
334
+ declare const pendingInteractionGrantedPermissionProfileSchema: z.ZodObject<{
335
+ fileSystem: z.ZodNullable<z.ZodObject<{
336
+ read: z.ZodArray<z.ZodString>;
337
+ write: z.ZodArray<z.ZodString>;
338
+ }, z.core.$strip>>;
339
+ network: z.ZodNullable<z.ZodObject<{
340
+ enabled: z.ZodNullable<z.ZodBoolean>;
341
+ }, z.core.$strip>>;
342
+ }, z.core.$strict>;
343
+ type PendingInteractionGrantedPermissionProfile = z.infer<typeof pendingInteractionGrantedPermissionProfileSchema>;
344
+ declare const pendingInteractionApprovalDecisionSchema: z.ZodEnum<{
345
+ allow_for_session: "allow_for_session";
346
+ allow_once: "allow_once";
347
+ deny: "deny";
348
+ }>;
349
+ type PendingInteractionApprovalDecision = z.infer<typeof pendingInteractionApprovalDecisionSchema>;
350
+ declare const pendingInteractionApprovalSubjectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
351
+ actions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
352
+ command: z.ZodString;
353
+ name: z.ZodString;
354
+ path: z.ZodString;
355
+ type: z.ZodLiteral<"read">;
356
+ }, z.core.$strip>, z.ZodObject<{
357
+ command: z.ZodString;
358
+ path: z.ZodNullable<z.ZodString>;
359
+ type: z.ZodLiteral<"listFiles">;
360
+ }, z.core.$strip>, z.ZodObject<{
361
+ command: z.ZodString;
362
+ path: z.ZodNullable<z.ZodString>;
363
+ query: z.ZodNullable<z.ZodString>;
364
+ type: z.ZodLiteral<"search">;
365
+ }, z.core.$strip>, z.ZodObject<{
366
+ command: z.ZodString;
367
+ type: z.ZodLiteral<"unknown">;
368
+ }, z.core.$strip>], "type">>;
369
+ command: z.ZodString;
370
+ cwd: z.ZodNullable<z.ZodString>;
371
+ itemId: z.ZodString;
372
+ kind: z.ZodLiteral<"command">;
373
+ sessionGrant: z.ZodNullable<z.ZodObject<{
374
+ fileSystem: z.ZodNullable<z.ZodObject<{
375
+ read: z.ZodArray<z.ZodString>;
376
+ write: z.ZodArray<z.ZodString>;
377
+ }, z.core.$strip>>;
378
+ network: z.ZodNullable<z.ZodObject<{
379
+ enabled: z.ZodNullable<z.ZodBoolean>;
380
+ }, z.core.$strip>>;
381
+ }, z.core.$strict>>;
382
+ }, z.core.$strip>, z.ZodObject<{
383
+ itemId: z.ZodString;
384
+ kind: z.ZodLiteral<"file_change">;
385
+ sessionGrant: z.ZodNullable<z.ZodObject<{
386
+ fileSystem: z.ZodNullable<z.ZodObject<{
387
+ read: z.ZodArray<z.ZodString>;
388
+ write: z.ZodArray<z.ZodString>;
389
+ }, z.core.$strip>>;
390
+ network: z.ZodNullable<z.ZodObject<{
391
+ enabled: z.ZodNullable<z.ZodBoolean>;
392
+ }, z.core.$strip>>;
393
+ }, z.core.$strict>>;
394
+ writeScope: z.ZodNullable<z.ZodString>;
395
+ }, z.core.$strip>, z.ZodObject<{
396
+ itemId: z.ZodString;
397
+ kind: z.ZodLiteral<"permission_grant">;
398
+ permissions: z.ZodObject<{
399
+ fileSystem: z.ZodNullable<z.ZodObject<{
400
+ read: z.ZodArray<z.ZodString>;
401
+ write: z.ZodArray<z.ZodString>;
402
+ }, z.core.$strip>>;
403
+ network: z.ZodNullable<z.ZodObject<{
404
+ enabled: z.ZodNullable<z.ZodBoolean>;
405
+ }, z.core.$strip>>;
406
+ }, z.core.$strict>;
407
+ toolName: z.ZodNullable<z.ZodString>;
408
+ }, z.core.$strip>, z.ZodObject<{
409
+ itemId: z.ZodString;
410
+ kind: z.ZodLiteral<"plan">;
411
+ plan: z.ZodString;
412
+ planFilePath: z.ZodNullable<z.ZodString>;
413
+ }, z.core.$strip>], "kind">;
414
+ type PendingInteractionApprovalSubject = z.infer<typeof pendingInteractionApprovalSubjectSchema>;
415
+ declare const approvalPendingInteractionPayloadSchema: z.ZodObject<{
416
+ availableDecisions: z.ZodArray<z.ZodEnum<{
417
+ allow_for_session: "allow_for_session";
418
+ allow_once: "allow_once";
419
+ deny: "deny";
420
+ }>>;
421
+ kind: z.ZodLiteral<"approval">;
422
+ reason: z.ZodNullable<z.ZodString>;
423
+ subject: z.ZodDiscriminatedUnion<[z.ZodObject<{
424
+ actions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
425
+ command: z.ZodString;
426
+ name: z.ZodString;
427
+ path: z.ZodString;
428
+ type: z.ZodLiteral<"read">;
429
+ }, z.core.$strip>, z.ZodObject<{
430
+ command: z.ZodString;
431
+ path: z.ZodNullable<z.ZodString>;
432
+ type: z.ZodLiteral<"listFiles">;
433
+ }, z.core.$strip>, z.ZodObject<{
434
+ command: z.ZodString;
435
+ path: z.ZodNullable<z.ZodString>;
436
+ query: z.ZodNullable<z.ZodString>;
437
+ type: z.ZodLiteral<"search">;
438
+ }, z.core.$strip>, z.ZodObject<{
439
+ command: z.ZodString;
440
+ type: z.ZodLiteral<"unknown">;
441
+ }, z.core.$strip>], "type">>;
442
+ command: z.ZodString;
443
+ cwd: z.ZodNullable<z.ZodString>;
444
+ itemId: z.ZodString;
445
+ kind: z.ZodLiteral<"command">;
446
+ sessionGrant: z.ZodNullable<z.ZodObject<{
447
+ fileSystem: z.ZodNullable<z.ZodObject<{
448
+ read: z.ZodArray<z.ZodString>;
449
+ write: z.ZodArray<z.ZodString>;
450
+ }, z.core.$strip>>;
451
+ network: z.ZodNullable<z.ZodObject<{
452
+ enabled: z.ZodNullable<z.ZodBoolean>;
453
+ }, z.core.$strip>>;
454
+ }, z.core.$strict>>;
455
+ }, z.core.$strip>, z.ZodObject<{
456
+ itemId: z.ZodString;
457
+ kind: z.ZodLiteral<"file_change">;
458
+ sessionGrant: z.ZodNullable<z.ZodObject<{
459
+ fileSystem: z.ZodNullable<z.ZodObject<{
460
+ read: z.ZodArray<z.ZodString>;
461
+ write: z.ZodArray<z.ZodString>;
462
+ }, z.core.$strip>>;
463
+ network: z.ZodNullable<z.ZodObject<{
464
+ enabled: z.ZodNullable<z.ZodBoolean>;
465
+ }, z.core.$strip>>;
466
+ }, z.core.$strict>>;
467
+ writeScope: z.ZodNullable<z.ZodString>;
468
+ }, z.core.$strip>, z.ZodObject<{
469
+ itemId: z.ZodString;
470
+ kind: z.ZodLiteral<"permission_grant">;
471
+ permissions: z.ZodObject<{
472
+ fileSystem: z.ZodNullable<z.ZodObject<{
473
+ read: z.ZodArray<z.ZodString>;
474
+ write: z.ZodArray<z.ZodString>;
475
+ }, z.core.$strip>>;
476
+ network: z.ZodNullable<z.ZodObject<{
477
+ enabled: z.ZodNullable<z.ZodBoolean>;
478
+ }, z.core.$strip>>;
479
+ }, z.core.$strict>;
480
+ toolName: z.ZodNullable<z.ZodString>;
481
+ }, z.core.$strip>, z.ZodObject<{
482
+ itemId: z.ZodString;
483
+ kind: z.ZodLiteral<"plan">;
484
+ plan: z.ZodString;
485
+ planFilePath: z.ZodNullable<z.ZodString>;
486
+ }, z.core.$strip>], "kind">;
487
+ }, z.core.$strip>;
488
+ type ApprovalPendingInteractionPayload = z.infer<typeof approvalPendingInteractionPayloadSchema>;
489
+ declare const USER_QUESTION_MAX_QUESTIONS = 4;
490
+ declare const USER_QUESTION_MAX_OPTIONS = 4;
491
+ declare const pendingInteractionUserQuestionQuestionSchema: z.ZodObject<{
492
+ allowFreeText: z.ZodBoolean;
493
+ id: z.ZodString;
494
+ multiSelect: z.ZodBoolean;
495
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
496
+ description: z.ZodOptional<z.ZodString>;
497
+ label: z.ZodString;
498
+ value: z.ZodString;
499
+ }, z.core.$strip>>>;
500
+ prompt: z.ZodString;
501
+ shortLabel: z.ZodOptional<z.ZodString>;
502
+ }, z.core.$strip>;
503
+ type PendingInteractionUserQuestionQuestion = z.infer<typeof pendingInteractionUserQuestionQuestionSchema>;
504
+ declare const userQuestionPendingInteractionPayloadSchema: z.ZodObject<{
505
+ kind: z.ZodLiteral<"user_question">;
506
+ questions: z.ZodArray<z.ZodObject<{
507
+ allowFreeText: z.ZodBoolean;
508
+ id: z.ZodString;
509
+ multiSelect: z.ZodBoolean;
510
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
511
+ description: z.ZodOptional<z.ZodString>;
512
+ label: z.ZodString;
513
+ value: z.ZodString;
514
+ }, z.core.$strip>>>;
515
+ prompt: z.ZodString;
516
+ shortLabel: z.ZodOptional<z.ZodString>;
517
+ }, z.core.$strip>>;
518
+ }, z.core.$strip>;
519
+ type UserQuestionPendingInteractionPayload = z.infer<typeof userQuestionPendingInteractionPayloadSchema>;
520
+ declare const pluginPendingInteractionPayloadSchema: z.ZodObject<{
521
+ data: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
522
+ kind: z.ZodLiteral<"plugin">;
523
+ title: z.ZodString;
524
+ }, z.core.$strip>;
525
+ type PluginPendingInteractionPayload = z.infer<typeof pluginPendingInteractionPayloadSchema>;
526
+ declare const pendingInteractionPayloadSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
527
+ availableDecisions: z.ZodArray<z.ZodEnum<{
528
+ allow_for_session: "allow_for_session";
529
+ allow_once: "allow_once";
530
+ deny: "deny";
531
+ }>>;
532
+ kind: z.ZodLiteral<"approval">;
533
+ reason: z.ZodNullable<z.ZodString>;
534
+ subject: z.ZodDiscriminatedUnion<[z.ZodObject<{
535
+ actions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
536
+ command: z.ZodString;
537
+ name: z.ZodString;
538
+ path: z.ZodString;
539
+ type: z.ZodLiteral<"read">;
540
+ }, z.core.$strip>, z.ZodObject<{
541
+ command: z.ZodString;
542
+ path: z.ZodNullable<z.ZodString>;
543
+ type: z.ZodLiteral<"listFiles">;
544
+ }, z.core.$strip>, z.ZodObject<{
545
+ command: z.ZodString;
546
+ path: z.ZodNullable<z.ZodString>;
547
+ query: z.ZodNullable<z.ZodString>;
548
+ type: z.ZodLiteral<"search">;
549
+ }, z.core.$strip>, z.ZodObject<{
550
+ command: z.ZodString;
551
+ type: z.ZodLiteral<"unknown">;
552
+ }, z.core.$strip>], "type">>;
553
+ command: z.ZodString;
554
+ cwd: z.ZodNullable<z.ZodString>;
555
+ itemId: z.ZodString;
556
+ kind: z.ZodLiteral<"command">;
557
+ sessionGrant: z.ZodNullable<z.ZodObject<{
558
+ fileSystem: z.ZodNullable<z.ZodObject<{
559
+ read: z.ZodArray<z.ZodString>;
560
+ write: z.ZodArray<z.ZodString>;
561
+ }, z.core.$strip>>;
562
+ network: z.ZodNullable<z.ZodObject<{
563
+ enabled: z.ZodNullable<z.ZodBoolean>;
564
+ }, z.core.$strip>>;
565
+ }, z.core.$strict>>;
566
+ }, z.core.$strip>, z.ZodObject<{
567
+ itemId: z.ZodString;
568
+ kind: z.ZodLiteral<"file_change">;
569
+ sessionGrant: z.ZodNullable<z.ZodObject<{
570
+ fileSystem: z.ZodNullable<z.ZodObject<{
571
+ read: z.ZodArray<z.ZodString>;
572
+ write: z.ZodArray<z.ZodString>;
573
+ }, z.core.$strip>>;
574
+ network: z.ZodNullable<z.ZodObject<{
575
+ enabled: z.ZodNullable<z.ZodBoolean>;
576
+ }, z.core.$strip>>;
577
+ }, z.core.$strict>>;
578
+ writeScope: z.ZodNullable<z.ZodString>;
579
+ }, z.core.$strip>, z.ZodObject<{
580
+ itemId: z.ZodString;
581
+ kind: z.ZodLiteral<"permission_grant">;
582
+ permissions: z.ZodObject<{
583
+ fileSystem: z.ZodNullable<z.ZodObject<{
584
+ read: z.ZodArray<z.ZodString>;
585
+ write: z.ZodArray<z.ZodString>;
586
+ }, z.core.$strip>>;
587
+ network: z.ZodNullable<z.ZodObject<{
588
+ enabled: z.ZodNullable<z.ZodBoolean>;
589
+ }, z.core.$strip>>;
590
+ }, z.core.$strict>;
591
+ toolName: z.ZodNullable<z.ZodString>;
592
+ }, z.core.$strip>, z.ZodObject<{
593
+ itemId: z.ZodString;
594
+ kind: z.ZodLiteral<"plan">;
595
+ plan: z.ZodString;
596
+ planFilePath: z.ZodNullable<z.ZodString>;
597
+ }, z.core.$strip>], "kind">;
598
+ }, z.core.$strip>, z.ZodObject<{
599
+ kind: z.ZodLiteral<"user_question">;
600
+ questions: z.ZodArray<z.ZodObject<{
601
+ allowFreeText: z.ZodBoolean;
602
+ id: z.ZodString;
603
+ multiSelect: z.ZodBoolean;
604
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
605
+ description: z.ZodOptional<z.ZodString>;
606
+ label: z.ZodString;
607
+ value: z.ZodString;
608
+ }, z.core.$strip>>>;
609
+ prompt: z.ZodString;
610
+ shortLabel: z.ZodOptional<z.ZodString>;
611
+ }, z.core.$strip>>;
612
+ }, z.core.$strip>], "kind">;
613
+ type PendingInteractionPayload = z.infer<typeof pendingInteractionPayloadSchema>;
614
+ type AnyPendingInteractionPayload = PendingInteractionPayload | PluginPendingInteractionPayload;
615
+ declare function isApprovalPendingInteractionPayload(payload: AnyPendingInteractionPayload): payload is ApprovalPendingInteractionPayload;
616
+ declare function isUserQuestionPendingInteractionPayload(payload: AnyPendingInteractionPayload): payload is UserQuestionPendingInteractionPayload;
617
+ declare const approvalPendingInteractionResolutionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
618
+ decision: z.ZodLiteral<"allow_once">;
619
+ grantedPermissions: z.ZodNullable<z.ZodObject<{
620
+ fileSystem: z.ZodNullable<z.ZodObject<{
621
+ read: z.ZodArray<z.ZodString>;
622
+ write: z.ZodArray<z.ZodString>;
623
+ }, z.core.$strip>>;
624
+ network: z.ZodNullable<z.ZodObject<{
625
+ enabled: z.ZodNullable<z.ZodBoolean>;
626
+ }, z.core.$strip>>;
627
+ }, z.core.$strict>>;
628
+ }, z.core.$strip>, z.ZodObject<{
629
+ decision: z.ZodLiteral<"allow_for_session">;
630
+ grantedPermissions: z.ZodNullable<z.ZodObject<{
631
+ fileSystem: z.ZodNullable<z.ZodObject<{
632
+ read: z.ZodArray<z.ZodString>;
633
+ write: z.ZodArray<z.ZodString>;
634
+ }, z.core.$strip>>;
635
+ network: z.ZodNullable<z.ZodObject<{
636
+ enabled: z.ZodNullable<z.ZodBoolean>;
637
+ }, z.core.$strip>>;
638
+ }, z.core.$strict>>;
639
+ }, z.core.$strip>, z.ZodObject<{
640
+ decision: z.ZodLiteral<"deny">;
641
+ }, z.core.$strip>], "decision">;
642
+ type ApprovalPendingInteractionResolution = z.infer<typeof approvalPendingInteractionResolutionSchema>;
643
+ declare const userQuestionPendingInteractionResolutionSchema: z.ZodObject<{
644
+ answers: z.ZodRecord<z.ZodString, z.ZodObject<{
645
+ freeText: z.ZodOptional<z.ZodString>;
646
+ selected: z.ZodArray<z.ZodString>;
647
+ }, z.core.$strip>>;
648
+ kind: z.ZodLiteral<"user_answer">;
649
+ }, z.core.$strip>;
650
+ type UserQuestionPendingInteractionResolution = z.infer<typeof userQuestionPendingInteractionResolutionSchema>;
651
+ declare const pendingInteractionResolutionSchema: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
652
+ decision: z.ZodLiteral<"allow_once">;
653
+ grantedPermissions: z.ZodNullable<z.ZodObject<{
654
+ fileSystem: z.ZodNullable<z.ZodObject<{
655
+ read: z.ZodArray<z.ZodString>;
656
+ write: z.ZodArray<z.ZodString>;
657
+ }, z.core.$strip>>;
658
+ network: z.ZodNullable<z.ZodObject<{
659
+ enabled: z.ZodNullable<z.ZodBoolean>;
660
+ }, z.core.$strip>>;
661
+ }, z.core.$strict>>;
662
+ }, z.core.$strip>, z.ZodObject<{
663
+ decision: z.ZodLiteral<"allow_for_session">;
664
+ grantedPermissions: z.ZodNullable<z.ZodObject<{
665
+ fileSystem: z.ZodNullable<z.ZodObject<{
666
+ read: z.ZodArray<z.ZodString>;
667
+ write: z.ZodArray<z.ZodString>;
668
+ }, z.core.$strip>>;
669
+ network: z.ZodNullable<z.ZodObject<{
670
+ enabled: z.ZodNullable<z.ZodBoolean>;
671
+ }, z.core.$strip>>;
672
+ }, z.core.$strict>>;
673
+ }, z.core.$strip>, z.ZodObject<{
674
+ decision: z.ZodLiteral<"deny">;
675
+ }, z.core.$strip>], "decision">, z.ZodObject<{
676
+ answers: z.ZodRecord<z.ZodString, z.ZodObject<{
677
+ freeText: z.ZodOptional<z.ZodString>;
678
+ selected: z.ZodArray<z.ZodString>;
679
+ }, z.core.$strip>>;
680
+ kind: z.ZodLiteral<"user_answer">;
681
+ }, z.core.$strip>, z.ZodObject<{
682
+ kind: z.ZodLiteral<"plugin_submitted">;
683
+ }, z.core.$strip>]>;
684
+ type PendingInteractionResolution = z.infer<typeof pendingInteractionResolutionSchema>;
685
+ declare function isApprovalPendingInteractionResolution(resolution: PendingInteractionResolution): resolution is ApprovalPendingInteractionResolution;
686
+ declare function isUserQuestionPendingInteractionResolution(resolution: PendingInteractionResolution): resolution is UserQuestionPendingInteractionResolution;
687
+
688
+ /**
689
+ * Order is load-bearing: `reasoningRank` (index) drives model-switch
690
+ * reconciliation. "none" (no extended thinking) sits at the bottom — only
691
+ * providers that expose a thinking-off variant list it (currently Cursor and
692
+ * Pi models whose `thinkingLevelMap` advertises `off`).
693
+ * "ultracode" sits between "xhigh" and "max" because its underlying effort IS
694
+ * xhigh (plus standing workflow orchestration) — a model without ultracode
695
+ * support should reconcile down to xhigh, not up to max.
696
+ * "ultra" is a Codex-native top tier (max effort plus automatic task
697
+ * delegation) exposed only by some models; it ranks above "max".
698
+ */
699
+ declare const reasoningLevelValues: readonly ["none", "low", "medium", "high", "xhigh", "ultracode", "max", "ultra"];
700
+ declare const reasoningLevelSchema: z.ZodEnum<{
701
+ high: "high";
702
+ low: "low";
703
+ max: "max";
704
+ medium: "medium";
705
+ none: "none";
706
+ ultra: "ultra";
707
+ ultracode: "ultracode";
708
+ xhigh: "xhigh";
709
+ }>;
710
+ type ReasoningLevel = z.infer<typeof reasoningLevelSchema>;
711
+ declare const serviceTierSchema: z.ZodEnum<{
712
+ default: "default";
713
+ fast: "fast";
714
+ }>;
715
+ type ServiceTier = z.infer<typeof serviceTierSchema>;
716
+ /**
717
+ * Controls how a provider should incorporate server-owned instructions into its
718
+ * system prompt.
719
+ *
720
+ * - `append`: keep the provider's preset system prompt and append instructions.
721
+ * - `replace`: use the provided instructions as the full system prompt.
722
+ */
723
+ declare const instructionModeValues: readonly ["append", "replace"];
724
+ declare const instructionModeSchema: z.ZodEnum<{
725
+ append: "append";
726
+ replace: "replace";
727
+ }>;
728
+ type InstructionMode = z.infer<typeof instructionModeSchema>;
729
+ declare const permissionModeSchema: z.ZodEnum<{
730
+ "accept-edits": "accept-edits";
731
+ auto: "auto";
732
+ full: "full";
733
+ }>;
734
+ type PermissionMode = z.infer<typeof permissionModeSchema>;
735
+ declare const permissionEscalationValues: readonly ["ask", "deny"];
736
+ declare const permissionEscalationSchema: z.ZodEnum<{
737
+ ask: "ask";
738
+ deny: "deny";
739
+ }>;
740
+ type PermissionEscalation = z.infer<typeof permissionEscalationSchema>;
741
+ declare const promptMentionCommandTriggerSchema: z.ZodEnum<{
742
+ "/": "/";
743
+ }>;
744
+ type PromptMentionCommandTrigger = z.infer<typeof promptMentionCommandTriggerSchema>;
745
+ declare const promptInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
746
+ mentions: z.ZodDefault<z.ZodArray<z.ZodObject<{
747
+ end: z.ZodNumber;
748
+ resource: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDiscriminatedUnion<[z.ZodObject<{
749
+ kind: z.ZodLiteral<"thread">;
750
+ label: z.ZodString;
751
+ projectId: z.ZodOptional<z.ZodString>;
752
+ threadId: z.ZodString;
753
+ }, z.core.$strip>, z.ZodObject<{
754
+ kind: z.ZodLiteral<"project">;
755
+ label: z.ZodString;
756
+ projectId: z.ZodString;
757
+ }, z.core.$strip>, z.ZodObject<{
758
+ kind: z.ZodLiteral<"section">;
759
+ label: z.ZodString;
760
+ sectionId: z.ZodString;
761
+ }, z.core.$strip>, z.ZodObject<{
762
+ entryKind: z.ZodEnum<{
763
+ directory: "directory";
764
+ file: "file";
765
+ }>;
766
+ kind: z.ZodLiteral<"path">;
767
+ label: z.ZodString;
768
+ path: z.ZodString;
769
+ source: z.ZodEnum<{
770
+ "thread-storage": "thread-storage";
771
+ workspace: "workspace";
772
+ }>;
773
+ }, z.core.$strip>, z.ZodObject<{
774
+ argumentHint: z.ZodNullable<z.ZodString>;
775
+ kind: z.ZodLiteral<"command">;
776
+ label: z.ZodString;
777
+ name: z.ZodString;
778
+ origin: z.ZodEnum<{
779
+ builtin: "builtin";
780
+ project: "project";
781
+ user: "user";
782
+ }>;
783
+ source: z.ZodEnum<{
784
+ command: "command";
785
+ skill: "skill";
786
+ }>;
787
+ trigger: z.ZodEnum<{
788
+ "/": "/";
789
+ }>;
790
+ }, z.core.$strip>, z.ZodObject<{
791
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
792
+ itemId: z.ZodString;
793
+ kind: z.ZodLiteral<"plugin">;
794
+ label: z.ZodString;
795
+ pluginId: z.ZodString;
796
+ }, z.core.$strip>], "kind">>;
797
+ start: z.ZodNumber;
798
+ }, z.core.$strip>>>;
799
+ text: z.ZodString;
800
+ type: z.ZodLiteral<"text">;
801
+ visibility: z.ZodOptional<z.ZodEnum<{
802
+ "agent-only": "agent-only";
803
+ }>>;
804
+ }, z.core.$strip>, z.ZodObject<{
805
+ type: z.ZodLiteral<"image">;
806
+ url: z.ZodString;
807
+ visibility: z.ZodOptional<z.ZodEnum<{
808
+ "agent-only": "agent-only";
809
+ }>>;
810
+ }, z.core.$strip>, z.ZodObject<{
811
+ path: z.ZodString;
812
+ type: z.ZodLiteral<"localImage">;
813
+ visibility: z.ZodOptional<z.ZodEnum<{
814
+ "agent-only": "agent-only";
815
+ }>>;
816
+ }, z.core.$strip>, z.ZodObject<{
817
+ mimeType: z.ZodOptional<z.ZodString>;
818
+ name: z.ZodOptional<z.ZodString>;
819
+ path: z.ZodString;
820
+ sizeBytes: z.ZodOptional<z.ZodNumber>;
821
+ type: z.ZodLiteral<"localFile">;
822
+ visibility: z.ZodOptional<z.ZodEnum<{
823
+ "agent-only": "agent-only";
824
+ }>>;
825
+ }, z.core.$strip>], "type">;
826
+ type PromptInput = z.infer<typeof promptInputSchema>;
827
+ interface PromptCommandSelector {
828
+ trigger: PromptMentionCommandTrigger;
829
+ name: string;
830
+ }
831
+ /**
832
+ * Whether input consists solely of one selected built-in `/compact` mention.
833
+ * Raw matching text and project/user commands intentionally do not qualify.
834
+ */
835
+ declare function isStandaloneBuiltinCompactCommand(input: readonly PromptInput[]): boolean;
836
+ declare function removeCommandMentionsFromPromptInput(input: readonly PromptInput[], selector: PromptCommandSelector): PromptInput[];
837
+ declare const runtimePermissionScopeValues: readonly ["workspace", "full"];
838
+ declare const runtimePermissionScopeSchema: z.ZodEnum<{
839
+ full: "full";
840
+ workspace: "workspace";
841
+ }>;
842
+ type RuntimePermissionScope = z.infer<typeof runtimePermissionScopeSchema>;
843
+ declare const runtimePermissionPolicySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
844
+ approvalReviewer: z.ZodLiteral<"user">;
845
+ permissionEscalation: z.ZodEnum<{
846
+ ask: "ask";
847
+ deny: "deny";
848
+ }>;
849
+ permissionMode: z.ZodLiteral<"accept-edits">;
850
+ permissionScope: z.ZodLiteral<"workspace">;
851
+ }, z.core.$strip>, z.ZodObject<{
852
+ approvalReviewer: z.ZodLiteral<"automatic">;
853
+ permissionEscalation: z.ZodEnum<{
854
+ ask: "ask";
855
+ deny: "deny";
856
+ }>;
857
+ permissionMode: z.ZodLiteral<"auto">;
858
+ permissionScope: z.ZodLiteral<"workspace">;
859
+ }, z.core.$strip>, z.ZodObject<{
860
+ approvalReviewer: z.ZodNull;
861
+ permissionEscalation: z.ZodNull;
862
+ permissionMode: z.ZodLiteral<"full">;
863
+ permissionScope: z.ZodLiteral<"full">;
864
+ }, z.core.$strip>], "permissionMode">;
865
+ type RuntimePermissionPolicy = z.infer<typeof runtimePermissionPolicySchema>;
866
+
867
+ declare const clientTurnRequestIdSchema: z.ZodString;
868
+ type ClientTurnRequestId = z.infer<typeof clientTurnRequestIdSchema>;
869
+
870
+ declare const threadEventItemStatusSchema: z.ZodEnum<{
871
+ completed: "completed";
872
+ failed: "failed";
873
+ interrupted: "interrupted";
874
+ pending: "pending";
875
+ }>;
876
+ type ThreadEventItemStatus = z.infer<typeof threadEventItemStatusSchema>;
877
+ declare const threadEventTurnStatusSchema: z.ZodEnum<{
878
+ completed: "completed";
879
+ failed: "failed";
880
+ interrupted: "interrupted";
881
+ }>;
882
+ type ThreadEventTurnStatus = z.infer<typeof threadEventTurnStatusSchema>;
883
+ declare const providerErrorCategorySchema: z.ZodEnum<{
884
+ "active-turn-not-steerable": "active-turn-not-steerable";
885
+ "bad-request": "bad-request";
886
+ "budget-exceeded": "budget-exceeded";
887
+ "connection-failed": "connection-failed";
888
+ "context-window-exceeded": "context-window-exceeded";
889
+ "max-output-tokens": "max-output-tokens";
890
+ "max-turns": "max-turns";
891
+ "rate-limit": "rate-limit";
892
+ "stream-disconnected": "stream-disconnected";
893
+ "structured-output-retries": "structured-output-retries";
894
+ "thread-rollback-failed": "thread-rollback-failed";
895
+ "too-many-failed-attempts": "too-many-failed-attempts";
896
+ billing: "billing";
897
+ internal: "internal";
898
+ overloaded: "overloaded";
899
+ policy: "policy";
900
+ sandbox: "sandbox";
901
+ unauthorized: "unauthorized";
902
+ unknown: "unknown";
903
+ }>;
904
+ type ProviderErrorCategory = z.infer<typeof providerErrorCategorySchema>;
905
+ declare const providerErrorInfoSchema: z.ZodObject<{
906
+ category: z.ZodEnum<{
907
+ "active-turn-not-steerable": "active-turn-not-steerable";
908
+ "bad-request": "bad-request";
909
+ "budget-exceeded": "budget-exceeded";
910
+ "connection-failed": "connection-failed";
911
+ "context-window-exceeded": "context-window-exceeded";
912
+ "max-output-tokens": "max-output-tokens";
913
+ "max-turns": "max-turns";
914
+ "rate-limit": "rate-limit";
915
+ "stream-disconnected": "stream-disconnected";
916
+ "structured-output-retries": "structured-output-retries";
917
+ "thread-rollback-failed": "thread-rollback-failed";
918
+ "too-many-failed-attempts": "too-many-failed-attempts";
919
+ billing: "billing";
920
+ internal: "internal";
921
+ overloaded: "overloaded";
922
+ policy: "policy";
923
+ sandbox: "sandbox";
924
+ unauthorized: "unauthorized";
925
+ unknown: "unknown";
926
+ }>;
927
+ httpStatusCode: z.ZodNullable<z.ZodNumber>;
928
+ providerCode: z.ZodNullable<z.ZodString>;
929
+ }, z.core.$strip>;
930
+ type ProviderErrorInfo = z.infer<typeof providerErrorInfoSchema>;
931
+ declare const providerRateLimitStatusSchema: z.ZodEnum<{
932
+ allowed: "allowed";
933
+ blocked: "blocked";
934
+ unknown: "unknown";
935
+ warning: "warning";
936
+ }>;
937
+ type ProviderRateLimitStatus = z.infer<typeof providerRateLimitStatusSchema>;
938
+ declare const providerRateLimitWindowSchema: z.ZodObject<{
939
+ label: z.ZodNullable<z.ZodString>;
940
+ providerKey: z.ZodNullable<z.ZodString>;
941
+ resetsAtMs: z.ZodNullable<z.ZodNumber>;
942
+ status: z.ZodEnum<{
943
+ allowed: "allowed";
944
+ blocked: "blocked";
945
+ unknown: "unknown";
946
+ warning: "warning";
947
+ }>;
948
+ }, z.core.$strip>;
949
+ type ProviderRateLimitWindow = z.infer<typeof providerRateLimitWindowSchema>;
950
+ declare const providerRateLimitStateSchema: z.ZodObject<{
951
+ kind: z.ZodEnum<{
952
+ "spend-control": "spend-control";
953
+ "subscription-window": "subscription-window";
954
+ credits: "credits";
955
+ unknown: "unknown";
956
+ }>;
957
+ overageReason: z.ZodNullable<z.ZodString>;
958
+ overageStatus: z.ZodNullable<z.ZodEnum<{
959
+ allowed: "allowed";
960
+ rejected: "rejected";
961
+ unavailable: "unavailable";
962
+ warning: "warning";
963
+ }>>;
964
+ providerId: z.ZodString;
965
+ reachedReason: z.ZodNullable<z.ZodString>;
966
+ status: z.ZodEnum<{
967
+ allowed: "allowed";
968
+ blocked: "blocked";
969
+ unknown: "unknown";
970
+ warning: "warning";
971
+ }>;
972
+ windows: z.ZodArray<z.ZodObject<{
973
+ label: z.ZodNullable<z.ZodString>;
974
+ providerKey: z.ZodNullable<z.ZodString>;
975
+ resetsAtMs: z.ZodNullable<z.ZodNumber>;
976
+ status: z.ZodEnum<{
977
+ allowed: "allowed";
978
+ blocked: "blocked";
979
+ unknown: "unknown";
980
+ warning: "warning";
981
+ }>;
982
+ }, z.core.$strip>>;
983
+ }, z.core.$strip>;
984
+ type ProviderRateLimitState = z.infer<typeof providerRateLimitStateSchema>;
985
+ declare const threadEventPlanStepSchema: z.ZodObject<{
986
+ status: z.ZodOptional<z.ZodEnum<{
987
+ active: "active";
988
+ completed: "completed";
989
+ failed: "failed";
990
+ pending: "pending";
991
+ }>>;
992
+ step: z.ZodString;
993
+ }, z.core.$strip>;
994
+ type ThreadEventPlanStep = z.infer<typeof threadEventPlanStepSchema>;
995
+ declare const threadEventUserContentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
996
+ text: z.ZodString;
997
+ type: z.ZodLiteral<"text">;
998
+ }, z.core.$strip>, z.ZodObject<{
999
+ type: z.ZodLiteral<"image">;
1000
+ url: z.ZodString;
1001
+ }, z.core.$strip>, z.ZodObject<{
1002
+ path: z.ZodString;
1003
+ type: z.ZodLiteral<"localImage">;
1004
+ }, z.core.$strip>, z.ZodObject<{
1005
+ path: z.ZodString;
1006
+ type: z.ZodLiteral<"localFile">;
1007
+ }, z.core.$strip>], "type">;
1008
+ type ThreadEventUserContent = z.infer<typeof threadEventUserContentSchema>;
1009
+ declare const threadEventTokenUsageBreakdownSchema: z.ZodObject<{
1010
+ cachedInputTokens: z.ZodNumber;
1011
+ inputTokens: z.ZodNumber;
1012
+ outputTokens: z.ZodNumber;
1013
+ reasoningOutputTokens: z.ZodNumber;
1014
+ totalTokens: z.ZodNumber;
1015
+ }, z.core.$strip>;
1016
+ type ThreadEventTokenUsageBreakdown = z.infer<typeof threadEventTokenUsageBreakdownSchema>;
1017
+ declare const threadEventContextWindowUsageSchema: z.ZodObject<{
1018
+ estimated: z.ZodBoolean;
1019
+ modelContextWindow: z.ZodNullable<z.ZodNumber>;
1020
+ usedTokens: z.ZodNullable<z.ZodNumber>;
1021
+ }, z.core.$strip>;
1022
+ type ThreadEventContextWindowUsage = z.infer<typeof threadEventContextWindowUsageSchema>;
1023
+ declare const providerRawEventSchema: z.ZodObject<{
1024
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
1025
+ jsonrpc: z.ZodLiteral<"2.0">;
1026
+ method: z.ZodString;
1027
+ params: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
1028
+ }, z.core.$strip>;
1029
+ type ProviderRawEvent = z.infer<typeof providerRawEventSchema>;
1030
+
1031
+ declare const modelReasoningEffortSchema: z.ZodObject<{
1032
+ description: z.ZodString;
1033
+ reasoningEffort: z.ZodEnum<{
1034
+ high: "high";
1035
+ low: "low";
1036
+ max: "max";
1037
+ medium: "medium";
1038
+ none: "none";
1039
+ ultra: "ultra";
1040
+ ultracode: "ultracode";
1041
+ xhigh: "xhigh";
1042
+ }>;
1043
+ }, z.core.$strip>;
1044
+ type ModelReasoningEffort = z.infer<typeof modelReasoningEffortSchema>;
1045
+ declare const availableModelSchema: z.ZodObject<{
1046
+ defaultReasoningEffort: z.ZodEnum<{
1047
+ high: "high";
1048
+ low: "low";
1049
+ max: "max";
1050
+ medium: "medium";
1051
+ none: "none";
1052
+ ultra: "ultra";
1053
+ ultracode: "ultracode";
1054
+ xhigh: "xhigh";
1055
+ }>;
1056
+ description: z.ZodString;
1057
+ displayName: z.ZodString;
1058
+ id: z.ZodString;
1059
+ isDefault: z.ZodBoolean;
1060
+ model: z.ZodString;
1061
+ routeProviderId: z.ZodOptional<z.ZodString>;
1062
+ supportedReasoningEfforts: z.ZodArray<z.ZodObject<{
1063
+ description: z.ZodString;
1064
+ reasoningEffort: z.ZodEnum<{
1065
+ high: "high";
1066
+ low: "low";
1067
+ max: "max";
1068
+ medium: "medium";
1069
+ none: "none";
1070
+ ultra: "ultra";
1071
+ ultracode: "ultracode";
1072
+ xhigh: "xhigh";
1073
+ }>;
1074
+ }, z.core.$strip>>;
1075
+ }, z.core.$strip>;
1076
+ type AvailableModel = z.infer<typeof availableModelSchema>;
1077
+ declare const dynamicToolSchema: z.ZodObject<{
1078
+ description: z.ZodString;
1079
+ inputSchema: z.ZodUnknown;
1080
+ name: z.ZodString;
1081
+ }, z.core.$strip>;
1082
+ type DynamicTool = z.infer<typeof dynamicToolSchema>;
1083
+
1084
+ declare const LOW_REASONING_EFFORT: ModelReasoningEffort;
1085
+ declare const MEDIUM_REASONING_EFFORT: ModelReasoningEffort;
1086
+ declare const HIGH_REASONING_EFFORT: ModelReasoningEffort;
1087
+ declare const XHIGH_REASONING_EFFORT: ModelReasoningEffort;
1088
+ declare const ULTRACODE_REASONING_EFFORT: ModelReasoningEffort;
1089
+ declare const MAX_REASONING_EFFORT: ModelReasoningEffort;
1090
+ declare function reasoningEffortsForLevels(levels: readonly ReasoningLevel[]): ModelReasoningEffort[];
1091
+
1092
+ /**
1093
+ * Shared adapter utilities.
1094
+ *
1095
+ * Functions and constants duplicated across the claude-code, pi, and codex
1096
+ * adapters are extracted here so each adapter imports from one place.
1097
+ */
1098
+
1099
+ declare function toOptionalString(value: unknown): string | undefined;
1100
+ declare function toOptionalRecord(value: unknown): Record<string, unknown> | undefined;
1101
+ /**
1102
+ * The environment overrides a bridge may hand its provider: the requested
1103
+ * variables minus any name a shell would refuse. A rejected name is dropped,
1104
+ * never passed through — a provider that inherits an unquotable name can fail
1105
+ * its whole session on one bad key.
1106
+ */
1107
+ declare function buildShellEnvOverrides(envVars?: Record<string, string>): Record<string, string>;
1108
+ declare function toNonNegativeNumber(value: unknown): number;
1109
+ declare function normalizeProviderCommandOutput(args: {
1110
+ emptyPlaceholders: readonly string[];
1111
+ text: string;
1112
+ }): string | undefined;
1113
+ /**
1114
+ * Extracts text from tool result content.
1115
+ * Handles strings, arrays of text blocks, and `{ content: [...] }` wrappers.
1116
+ */
1117
+ declare function extractResultText(content: unknown): string;
1118
+
1119
+ type BridgeJsonRpcId = string | number;
1120
+ type BridgeJsonRpcResponse$1 = {
1121
+ jsonrpc: "2.0";
1122
+ id: BridgeJsonRpcId;
1123
+ result: unknown;
1124
+ } | {
1125
+ jsonrpc: "2.0";
1126
+ id: BridgeJsonRpcId;
1127
+ error: {
1128
+ code: number;
1129
+ message: string;
1130
+ };
1131
+ };
1132
+ interface CreateBridgeIoArgs {
1133
+ write?: (line: string) => void;
1134
+ }
1135
+ declare function createBridgeIo<TMessage>({ write, }?: CreateBridgeIoArgs): {
1136
+ send: (message: TMessage | BridgeJsonRpcResponse$1) => void;
1137
+ sendError: (id: BridgeJsonRpcId, code: number, message: string) => void;
1138
+ sendResult: (id: BridgeJsonRpcId, result: unknown) => void;
1139
+ };
1140
+ declare function createBridgeLineHandler(args: {
1141
+ handleParsedMessage: (message: unknown) => void;
1142
+ }): (line: string) => void;
1143
+ declare function runBridgeRequest<TRequest extends {
1144
+ id: BridgeJsonRpcId;
1145
+ }>(args: {
1146
+ handleRequest: (request: TRequest) => Promise<void>;
1147
+ request: TRequest;
1148
+ sendError: (id: BridgeJsonRpcId, code: number, message: string) => void;
1149
+ }): void;
1150
+
1151
+ declare function withoutBridgeRuntimeEnv(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
1152
+
1153
+ /**
1154
+ * Shared tool call helpers for bridge processes.
1155
+ *
1156
+ * Both claude-code and pi bridges forward tool calls from the provider SDK
1157
+ * to the host-daemon and feed responses back. This module provides:
1158
+ * - The JSON-RPC request type for forwarding tool calls
1159
+ * - Response decoding for tool call results from the host-daemon
1160
+ * - Generic JSON-RPC response decoding (for matching tool call responses)
1161
+ */
1162
+
1163
+ interface BridgeToolCallRequest {
1164
+ jsonrpc: "2.0";
1165
+ id: string | number;
1166
+ method: "item/tool/call";
1167
+ params: {
1168
+ providerThreadId: string;
1169
+ threadId?: string;
1170
+ turnId: string | null;
1171
+ callId: string;
1172
+ tool: string;
1173
+ arguments: Record<string, unknown>;
1174
+ };
1175
+ }
1176
+ declare const bridgeRequestEnvelopeSchema: z.ZodObject<{
1177
+ id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
1178
+ jsonrpc: z.ZodLiteral<"2.0">;
1179
+ method: z.ZodString;
1180
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1181
+ }, z.core.$strip>;
1182
+ declare const jsonRpcSuccessResponseSchema: z.ZodObject<{
1183
+ id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
1184
+ jsonrpc: z.ZodLiteral<"2.0">;
1185
+ result: z.ZodUnknown;
1186
+ }, z.core.$strip>;
1187
+ declare const jsonRpcErrorResponseSchema: z.ZodObject<{
1188
+ error: z.ZodObject<{
1189
+ code: z.ZodNumber;
1190
+ data: z.ZodOptional<z.ZodUnknown>;
1191
+ message: z.ZodOptional<z.ZodString>;
1192
+ }, z.core.$strip>;
1193
+ id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
1194
+ jsonrpc: z.ZodLiteral<"2.0">;
1195
+ }, z.core.$strip>;
1196
+ type BridgeJsonRpcResponse = z.infer<typeof jsonRpcSuccessResponseSchema> | z.infer<typeof jsonRpcErrorResponseSchema>;
1197
+ declare function decodeBridgeJsonRpcResponse(input: unknown): BridgeJsonRpcResponse | null;
1198
+ declare function decodeToolCallResponsePayload(result: unknown): {
1199
+ content: string;
1200
+ isError: boolean;
1201
+ };
1202
+
1203
+ /**
1204
+ * Structural contracts shared by the runtime's generic adapter and the bridge
1205
+ * implementations that translate a provider's native protocol.
1206
+ *
1207
+ * These are the shapes a bridge produces or consumes while it maps its
1208
+ * provider onto the canonical protocol. They live in the kit (rather than in
1209
+ * `@bb/agent-runtime`) so a bridge shipped from a plugin never depends on the
1210
+ * runtime package.
1211
+ */
1212
+
1213
+ interface ProviderRequestCommandPlan {
1214
+ kind: "request";
1215
+ method: string;
1216
+ params?: object;
1217
+ }
1218
+ interface ProviderPostInitializeRequest {
1219
+ plan: ProviderRequestCommandPlan;
1220
+ required: boolean;
1221
+ onResult(result: unknown): void;
1222
+ }
1223
+ interface DecodedInteractiveRequest {
1224
+ requestId: string | number;
1225
+ method: string;
1226
+ providerThreadId: string;
1227
+ /**
1228
+ * Non-empty BB turn id when known. Use null as the canonical unresolved
1229
+ * value so the runtime can resolve from the active turn; empty strings are
1230
+ * malformed adapter output.
1231
+ */
1232
+ turnId: string | null;
1233
+ payload: PendingInteractionPayload;
1234
+ threadId?: string;
1235
+ }
1236
+ interface PreparedProviderCommandDispatch {
1237
+ rollback(): void;
1238
+ /**
1239
+ * Claims the prepared correlation if no provider event has consumed it yet,
1240
+ * proving this dispatch still owns unstarted work. Returns true (and drops
1241
+ * the correlation, so nothing can consume it twice) when the provider never
1242
+ * started a turn for this dispatch; false once it did. Callers use it to
1243
+ * settle a prompt the provider accepted and finished without emitting any
1244
+ * turn activity, without fabricating a turn from a late signal.
1245
+ */
1246
+ claim(): boolean;
1247
+ }
1248
+ interface BuildInteractiveResponseArgs {
1249
+ request: DecodedInteractiveRequest;
1250
+ resolution: PendingInteractionResolution;
1251
+ }
1252
+
1253
+ declare const jsonRpcEnvelopeSchema: z.ZodObject<{
1254
+ jsonrpc: z.ZodLiteral<"2.0">;
1255
+ method: z.ZodString;
1256
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1257
+ }, z.core.$loose>;
1258
+ declare const sdkMessageEnvelopeSchema: z.ZodObject<{
1259
+ jsonrpc: z.ZodLiteral<"2.0">;
1260
+ method: z.ZodLiteral<"sdk/message">;
1261
+ params: z.ZodObject<{
1262
+ message: z.ZodUnknown;
1263
+ parent_tool_use_id: z.ZodOptional<z.ZodString>;
1264
+ threadId: z.ZodOptional<z.ZodString>;
1265
+ }, z.core.$loose>;
1266
+ }, z.core.$loose>;
1267
+ declare const threadIdentityEnvelopeSchema: z.ZodObject<{
1268
+ jsonrpc: z.ZodLiteral<"2.0">;
1269
+ method: z.ZodLiteral<"thread/identity">;
1270
+ params: z.ZodObject<{
1271
+ providerThreadId: z.ZodOptional<z.ZodString>;
1272
+ threadId: z.ZodOptional<z.ZodString>;
1273
+ }, z.core.$loose>;
1274
+ }, z.core.$loose>;
1275
+ declare const threadContextWindowUsageEnvelopeSchema: z.ZodObject<{
1276
+ jsonrpc: z.ZodLiteral<"2.0">;
1277
+ method: z.ZodLiteral<"thread/contextWindowUsage/updated">;
1278
+ params: z.ZodObject<{
1279
+ contextWindowUsage: z.ZodObject<{
1280
+ estimated: z.ZodBoolean;
1281
+ modelContextWindow: z.ZodNullable<z.ZodNumber>;
1282
+ usedTokens: z.ZodNullable<z.ZodNumber>;
1283
+ }, z.core.$strip>;
1284
+ threadId: z.ZodOptional<z.ZodString>;
1285
+ }, z.core.$loose>;
1286
+ }, z.core.$loose>;
1287
+ declare const errorEnvelopeSchema: z.ZodObject<{
1288
+ jsonrpc: z.ZodLiteral<"2.0">;
1289
+ method: z.ZodLiteral<"error">;
1290
+ params: z.ZodOptional<z.ZodObject<{
1291
+ message: z.ZodOptional<z.ZodString>;
1292
+ }, z.core.$loose>>;
1293
+ }, z.core.$loose>;
1294
+
1295
+ declare function mimeTypeFromExtension(filePath: string): string;
1296
+
1297
+ interface BridgeToolCallResult {
1298
+ content: string;
1299
+ isError?: boolean;
1300
+ }
1301
+ interface ForwardBridgeToolCallArgs {
1302
+ arguments: Record<string, unknown>;
1303
+ providerThreadId: string;
1304
+ /**
1305
+ * The session the pending call belongs to. `resolvePendingToolCalls`
1306
+ * error-resolves by scope identity, so a bridge passes its own session
1307
+ * object and settles that session's calls on close/replace without touching
1308
+ * calls minted by a successor session under the same thread id.
1309
+ */
1310
+ scope: object;
1311
+ threadId: string;
1312
+ toolName: string;
1313
+ }
1314
+ interface PendingToolCallTracker {
1315
+ /**
1316
+ * Mints an `item/tool/call` JSON-RPC request toward the runtime and returns
1317
+ * a promise settled by the matching response (or by
1318
+ * `resolvePendingToolCalls`). Never rejects: failures resolve as
1319
+ * `isError: true` results.
1320
+ */
1321
+ forwardToolCall: (args: ForwardBridgeToolCallArgs) => Promise<BridgeToolCallResult>;
1322
+ /** Returns true when the response settled a pending tool call. */
1323
+ handleToolCallResponse: (response: BridgeJsonRpcResponse) => boolean;
1324
+ /** Error-resolves every pending call minted under `scope`. */
1325
+ resolvePendingToolCalls: (scope: object, message: string) => void;
1326
+ }
1327
+ /**
1328
+ * Tracks the bridge's outgoing tool-call requests: mints request ids, sends
1329
+ * the `item/tool/call` envelope, and matches responses back to their waiting
1330
+ * promise via `decodeToolCallResponsePayload`.
1331
+ */
1332
+ declare function createPendingToolCallTracker(options: {
1333
+ sendToolCall: (request: BridgeToolCallRequest) => void;
1334
+ }): PendingToolCallTracker;
1335
+
1336
+ /**
1337
+ * The single statement of when an interactive provider request is answered
1338
+ * without ever reaching the user.
1339
+ *
1340
+ * Both sides of the bridge boundary enforce it and they must agree: a bridge
1341
+ * auto-denies its provider's own permission prompts, and the runtime
1342
+ * auto-denies the inbound requests that still arrive (a bridge whose provider
1343
+ * only learns the policy after the prompt is already in flight). Stating it
1344
+ * twice is how the two sides drift, so it lives in the kit — the one place a
1345
+ * plugin-shipped bridge and `@bb/agent-runtime` can both import from.
1346
+ */
1347
+
1348
+ interface InteractiveRequestPolicyInput {
1349
+ permissionEscalation: PermissionEscalation | null;
1350
+ }
1351
+ declare function shouldAutoDenyInteractiveRequest(policy: InteractiveRequestPolicyInput): boolean;
1352
+
1353
+ /**
1354
+ * The bridge export shape.
1355
+ *
1356
+ * A provider bridge is a module inside its plugin's `bb.host` artifact that
1357
+ * *exports* its surface instead of starting itself: the daemon-side bootstrap
1358
+ * imports the artifact, finds this export, and owns the process boundary
1359
+ * (argv, plugin-scoped directories, stdin framing, signals). That inversion is
1360
+ * what lets one artifact carry both a bridge and a host RPC entry, and what
1361
+ * lets a bridge be imported by tests without taking over stdio.
1362
+ */
1363
+ /** The name a bridge must export from its plugin's host artifact. */
1364
+ declare const PROVIDER_BRIDGE_EXPORT_NAME = "experimental_providerBridge";
1365
+ /** Where this bridge process may keep files, scoped to the owning plugin. */
1366
+ interface ProviderBridgeContext {
1367
+ /** The plugin that ships this bridge. */
1368
+ pluginId: string;
1369
+ /** Persistent, per-plugin, survives daemon restarts and plugin updates. */
1370
+ dataDir: string;
1371
+ /** This process only; removed when it exits. */
1372
+ tempDir: string;
1373
+ }
1374
+ interface ProviderBridgeDefinition {
1375
+ /** One decoded stdin line of the Provider Bridge Protocol. */
1376
+ handleLine: (line: string) => void;
1377
+ /**
1378
+ * Called once before the first line is read, with the process's
1379
+ * plugin-scoped directories. Omit it when the bridge keeps no files.
1380
+ */
1381
+ start?: (context: ProviderBridgeContext) => void;
1382
+ /** Stdin closed: the runtime is gone and the bridge must shut down. */
1383
+ onClose?: () => void;
1384
+ onSigterm?: () => void;
1385
+ onSigint?: () => void;
1386
+ }
1387
+ interface ProviderBridgeEntry extends ProviderBridgeDefinition {
1388
+ /** Bumped when the bootstrap↔bridge contract changes incompatibly. */
1389
+ experimental_apiVersion: 1;
1390
+ }
1391
+ declare function experimental_defineProviderBridge(definition: ProviderBridgeDefinition): ProviderBridgeEntry;
1392
+
1393
+ type JsonRpcObject = Record<string, unknown>;
1394
+ interface JsonRpcMessage extends JsonRpcObject {
1395
+ jsonrpc: "2.0";
1396
+ id?: string | number;
1397
+ method: string;
1398
+ params?: unknown;
1399
+ }
1400
+ interface ProviderInboundRequest {
1401
+ id?: string | number;
1402
+ method: string;
1403
+ params?: unknown;
1404
+ }
1405
+ type ProviderRuntimeEvent = JsonRpcObject;
1406
+ declare class ProviderRequestDecodeError extends Error {
1407
+ readonly code = -32602;
1408
+ constructor(message: string);
1409
+ }
1410
+ declare class ProviderResponseEncodeError extends Error {
1411
+ readonly code = -32602;
1412
+ constructor(message: string);
1413
+ }
1414
+
1415
+ type ProviderRawEventCoverage = "noise" | "normalized" | "unknown";
1416
+ interface ProviderRawEventDescription {
1417
+ kind: string;
1418
+ coverage: ProviderRawEventCoverage;
1419
+ }
1420
+ interface ProviderParsedRawEvent {
1421
+ kind: string;
1422
+ }
1423
+ interface ProviderVisibilityMetadata<TRawEvent extends ProviderParsedRawEvent = ProviderParsedRawEvent> {
1424
+ parseRawEvent(event: JsonRpcMessage): TRawEvent;
1425
+ describeParsedRawEvent(event: TRawEvent): ProviderRawEventDescription;
1426
+ describeRawEvent(event: JsonRpcMessage): ProviderRawEventDescription;
1427
+ }
1428
+ interface CreateProviderVisibilityMetadataArgs<TRawEvent extends ProviderParsedRawEvent> {
1429
+ parseRawEvent(event: JsonRpcMessage): TRawEvent;
1430
+ describeParsedRawEvent(event: TRawEvent): ProviderRawEventDescription;
1431
+ }
1432
+ declare function createProviderVisibilityMetadata<TRawEvent extends ProviderParsedRawEvent>(args: CreateProviderVisibilityMetadataArgs<TRawEvent>): ProviderVisibilityMetadata<TRawEvent>;
1433
+
1434
+ interface StringRecord {
1435
+ [key: string]: unknown;
1436
+ }
1437
+ declare function isRecord(value: unknown): value is StringRecord;
1438
+ declare function getRecordProperty(value: StringRecord, key: string): StringRecord | null;
1439
+ declare function getStringProperty(value: StringRecord, key: string): string | undefined;
1440
+ declare function getRawSdkMessage(event: JsonRpcMessage): StringRecord | null;
1441
+
1442
+ /**
1443
+ * Zod schemas for well-known tool arguments used by both Claude Code and Pi
1444
+ * bridges.
1445
+ *
1446
+ * These tools genuinely use different arg names across SDK versions, so the
1447
+ * schemas express the real variants rather than picking one.
1448
+ */
1449
+ declare const bashArgsSchema: z.ZodObject<{
1450
+ command: z.ZodOptional<z.ZodString>;
1451
+ cwd: z.ZodOptional<z.ZodString>;
1452
+ }, z.core.$loose>;
1453
+ declare const textBlockSchema: z.ZodObject<{
1454
+ text: z.ZodString;
1455
+ type: z.ZodLiteral<"text">;
1456
+ }, z.core.$strip>;
1457
+
1458
+ /**
1459
+ * The bb Provider Bridge Protocol version.
1460
+ *
1461
+ * Negotiated in both directions during `initialize`. Bump only for changes an
1462
+ * older bridge or runtime cannot tolerate: removing a method, changing the
1463
+ * meaning of an existing field, or tightening a previously lenient parse.
1464
+ * Additive changes (new optional capability, new method a bridge may not
1465
+ * implement, new notification the runtime may not understand) do NOT bump the
1466
+ * version — unknown methods answer -32601, unknown notifications are ignored,
1467
+ * and unknown capability fields pass through. That tolerance is the point of
1468
+ * the protocol: bridges version with their plugin, not with the daemon.
1469
+ *
1470
+ * Version history:
1471
+ * - 2 (2026-08): the narrow-grammar cutover. `thread/event` is gone; the
1472
+ * timeline rides `thread/delta` exclusively and the runtime assembles
1473
+ * canonical events. A version-1 bridge still emits `thread/event`
1474
+ * notifications the runtime no longer understands, so the runtime rejects
1475
+ * a mismatched handshake instead of silently showing an empty timeline.
1476
+ * - 1: the original dialect — bridges emitted finished `ThreadEvent`s on
1477
+ * `thread/event`.
1478
+ */
1479
+ declare const PROVIDER_BRIDGE_PROTOCOL_VERSION: 2;
1480
+
1481
+ /** Runtime → bridge `initialize` params. */
1482
+ declare const initializeParamsSchema: z.ZodObject<{
1483
+ client: z.ZodObject<{
1484
+ name: z.ZodString;
1485
+ version: z.ZodString;
1486
+ }, z.core.$strip>;
1487
+ protocolVersion: z.ZodNumber;
1488
+ }, z.core.$loose>;
1489
+ /** Bridge → runtime `initialize` result. */
1490
+ declare const initializeResultSchema: z.ZodObject<{
1491
+ capabilities: z.ZodPipe<z.ZodTransform<{}, unknown>, z.ZodObject<{
1492
+ approvalEnforcedBy: z.ZodDefault<z.ZodEnum<{
1493
+ provider: "provider";
1494
+ runtime: "runtime";
1495
+ }>>;
1496
+ fork: z.ZodDefault<z.ZodEnum<{
1497
+ checkpoint: "checkpoint";
1498
+ none: "none";
1499
+ tip: "tip";
1500
+ }>>;
1501
+ sessionRestore: z.ZodDefault<z.ZodBoolean>;
1502
+ threadArchive: z.ZodDefault<z.ZodBoolean>;
1503
+ threadGoalClear: z.ZodDefault<z.ZodBoolean>;
1504
+ threadRename: z.ZodDefault<z.ZodBoolean>;
1505
+ }, z.core.$loose>>;
1506
+ protocolVersion: z.ZodNumber;
1507
+ }, z.core.$loose>;
1508
+ type InitializeResult = z.infer<typeof initializeResultSchema>;
1509
+
1510
+ /**
1511
+ * The canonical execution options carried on session and turn commands.
1512
+ *
1513
+ * Deliberately provider-agnostic: there are no provider-specific fields here
1514
+ * and none may be added. Provider-flavored knobs (Claude's plan mode, memory
1515
+ * and subagent toggles, mock-CLI traffic, …) travel in `providerOptions` — an
1516
+ * opaque bag the provider's own plugin derives from its settings and only its
1517
+ * bridge interprets. The runtime and server pass it through untouched.
1518
+ *
1519
+ * The runtime never diffs these options. They ride every command; the bridge
1520
+ * reconciles internally (apply live where it can, rebuild its provider
1521
+ * session where it must) and a rebuild is always reported via the
1522
+ * `session/replaced` notification — never silent.
1523
+ */
1524
+ declare const bridgeExecutionOptionsSchema: z.ZodIntersection<z.ZodObject<{
1525
+ envVars: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1526
+ instructions: z.ZodOptional<z.ZodString>;
1527
+ model: z.ZodOptional<z.ZodString>;
1528
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1529
+ reasoningLevel: z.ZodOptional<z.ZodEnum<{
1530
+ high: "high";
1531
+ low: "low";
1532
+ max: "max";
1533
+ medium: "medium";
1534
+ none: "none";
1535
+ ultra: "ultra";
1536
+ ultracode: "ultracode";
1537
+ xhigh: "xhigh";
1538
+ }>>;
1539
+ serviceTier: z.ZodOptional<z.ZodEnum<{
1540
+ default: "default";
1541
+ fast: "fast";
1542
+ }>>;
1543
+ }, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
1544
+ approvalReviewer: z.ZodLiteral<"user">;
1545
+ permissionEscalation: z.ZodEnum<{
1546
+ ask: "ask";
1547
+ deny: "deny";
1548
+ }>;
1549
+ permissionMode: z.ZodLiteral<"accept-edits">;
1550
+ permissionScope: z.ZodLiteral<"workspace">;
1551
+ }, z.core.$strip>, z.ZodObject<{
1552
+ approvalReviewer: z.ZodLiteral<"automatic">;
1553
+ permissionEscalation: z.ZodEnum<{
1554
+ ask: "ask";
1555
+ deny: "deny";
1556
+ }>;
1557
+ permissionMode: z.ZodLiteral<"auto">;
1558
+ permissionScope: z.ZodLiteral<"workspace">;
1559
+ }, z.core.$strip>, z.ZodObject<{
1560
+ approvalReviewer: z.ZodNull;
1561
+ permissionEscalation: z.ZodNull;
1562
+ permissionMode: z.ZodLiteral<"full">;
1563
+ permissionScope: z.ZodLiteral<"full">;
1564
+ }, z.core.$strip>], "permissionMode">>;
1565
+ type BridgeExecutionOptions = z.infer<typeof bridgeExecutionOptionsSchema>;
1566
+
1567
+ /**
1568
+ * Canonical runtime → bridge request methods. One vocabulary for every
1569
+ * provider: a bridge maps these to its provider's native dialect internally
1570
+ * (codex `thread/stop` → `turn/interrupt`, `thread/discard` →
1571
+ * `thread/archive`, …). Methods gated by a handshake capability are simply
1572
+ * never sent to a bridge that did not advertise them.
1573
+ */
1574
+ declare const BRIDGE_REQUEST_METHODS: {
1575
+ readonly initialize: "initialize";
1576
+ readonly modelList: "model/list";
1577
+ readonly threadStart: "thread/start";
1578
+ readonly threadResume: "thread/resume";
1579
+ readonly threadFork: "thread/fork";
1580
+ readonly threadStop: "thread/stop";
1581
+ readonly threadDiscard: "thread/discard";
1582
+ readonly threadNameSet: "thread/name/set";
1583
+ readonly threadArchive: "thread/archive";
1584
+ readonly threadUnarchive: "thread/unarchive";
1585
+ readonly threadGoalClear: "thread/goal/clear";
1586
+ readonly turnStart: "turn/start";
1587
+ readonly turnSteer: "turn/steer";
1588
+ readonly skillsConfigure: "skills/configure";
1589
+ };
1590
+ declare const modelListParamsSchema: z.ZodObject<{
1591
+ cwd: z.ZodOptional<z.ZodString>;
1592
+ }, z.core.$loose>;
1593
+ declare const threadStartParamsSchema: z.ZodObject<{
1594
+ cwd: z.ZodString;
1595
+ disallowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
1596
+ dynamicTools: z.ZodOptional<z.ZodArray<z.ZodObject<{
1597
+ description: z.ZodString;
1598
+ inputSchema: z.ZodUnknown;
1599
+ name: z.ZodString;
1600
+ }, z.core.$strip>>>;
1601
+ input: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1602
+ mentions: z.ZodDefault<z.ZodArray<z.ZodObject<{
1603
+ end: z.ZodNumber;
1604
+ resource: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDiscriminatedUnion<[z.ZodObject<{
1605
+ kind: z.ZodLiteral<"thread">;
1606
+ label: z.ZodString;
1607
+ projectId: z.ZodOptional<z.ZodString>;
1608
+ threadId: z.ZodString;
1609
+ }, z.core.$strip>, z.ZodObject<{
1610
+ kind: z.ZodLiteral<"project">;
1611
+ label: z.ZodString;
1612
+ projectId: z.ZodString;
1613
+ }, z.core.$strip>, z.ZodObject<{
1614
+ kind: z.ZodLiteral<"section">;
1615
+ label: z.ZodString;
1616
+ sectionId: z.ZodString;
1617
+ }, z.core.$strip>, z.ZodObject<{
1618
+ entryKind: z.ZodEnum<{
1619
+ directory: "directory";
1620
+ file: "file";
1621
+ }>;
1622
+ kind: z.ZodLiteral<"path">;
1623
+ label: z.ZodString;
1624
+ path: z.ZodString;
1625
+ source: z.ZodEnum<{
1626
+ "thread-storage": "thread-storage";
1627
+ workspace: "workspace";
1628
+ }>;
1629
+ }, z.core.$strip>, z.ZodObject<{
1630
+ argumentHint: z.ZodNullable<z.ZodString>;
1631
+ kind: z.ZodLiteral<"command">;
1632
+ label: z.ZodString;
1633
+ name: z.ZodString;
1634
+ origin: z.ZodEnum<{
1635
+ builtin: "builtin";
1636
+ project: "project";
1637
+ user: "user";
1638
+ }>;
1639
+ source: z.ZodEnum<{
1640
+ command: "command";
1641
+ skill: "skill";
1642
+ }>;
1643
+ trigger: z.ZodEnum<{
1644
+ "/": "/";
1645
+ }>;
1646
+ }, z.core.$strip>, z.ZodObject<{
1647
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1648
+ itemId: z.ZodString;
1649
+ kind: z.ZodLiteral<"plugin">;
1650
+ label: z.ZodString;
1651
+ pluginId: z.ZodString;
1652
+ }, z.core.$strip>], "kind">>;
1653
+ start: z.ZodNumber;
1654
+ }, z.core.$strip>>>;
1655
+ text: z.ZodString;
1656
+ type: z.ZodLiteral<"text">;
1657
+ visibility: z.ZodOptional<z.ZodEnum<{
1658
+ "agent-only": "agent-only";
1659
+ }>>;
1660
+ }, z.core.$strip>, z.ZodObject<{
1661
+ type: z.ZodLiteral<"image">;
1662
+ url: z.ZodString;
1663
+ visibility: z.ZodOptional<z.ZodEnum<{
1664
+ "agent-only": "agent-only";
1665
+ }>>;
1666
+ }, z.core.$strip>, z.ZodObject<{
1667
+ path: z.ZodString;
1668
+ type: z.ZodLiteral<"localImage">;
1669
+ visibility: z.ZodOptional<z.ZodEnum<{
1670
+ "agent-only": "agent-only";
1671
+ }>>;
1672
+ }, z.core.$strip>, z.ZodObject<{
1673
+ mimeType: z.ZodOptional<z.ZodString>;
1674
+ name: z.ZodOptional<z.ZodString>;
1675
+ path: z.ZodString;
1676
+ sizeBytes: z.ZodOptional<z.ZodNumber>;
1677
+ type: z.ZodLiteral<"localFile">;
1678
+ visibility: z.ZodOptional<z.ZodEnum<{
1679
+ "agent-only": "agent-only";
1680
+ }>>;
1681
+ }, z.core.$strip>], "type">>>;
1682
+ instructionMode: z.ZodEnum<{
1683
+ append: "append";
1684
+ replace: "replace";
1685
+ }>;
1686
+ options: z.ZodIntersection<z.ZodObject<{
1687
+ envVars: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1688
+ instructions: z.ZodOptional<z.ZodString>;
1689
+ model: z.ZodOptional<z.ZodString>;
1690
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1691
+ reasoningLevel: z.ZodOptional<z.ZodEnum<{
1692
+ high: "high";
1693
+ low: "low";
1694
+ max: "max";
1695
+ medium: "medium";
1696
+ none: "none";
1697
+ ultra: "ultra";
1698
+ ultracode: "ultracode";
1699
+ xhigh: "xhigh";
1700
+ }>>;
1701
+ serviceTier: z.ZodOptional<z.ZodEnum<{
1702
+ default: "default";
1703
+ fast: "fast";
1704
+ }>>;
1705
+ }, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
1706
+ approvalReviewer: z.ZodLiteral<"user">;
1707
+ permissionEscalation: z.ZodEnum<{
1708
+ ask: "ask";
1709
+ deny: "deny";
1710
+ }>;
1711
+ permissionMode: z.ZodLiteral<"accept-edits">;
1712
+ permissionScope: z.ZodLiteral<"workspace">;
1713
+ }, z.core.$strip>, z.ZodObject<{
1714
+ approvalReviewer: z.ZodLiteral<"automatic">;
1715
+ permissionEscalation: z.ZodEnum<{
1716
+ ask: "ask";
1717
+ deny: "deny";
1718
+ }>;
1719
+ permissionMode: z.ZodLiteral<"auto">;
1720
+ permissionScope: z.ZodLiteral<"workspace">;
1721
+ }, z.core.$strip>, z.ZodObject<{
1722
+ approvalReviewer: z.ZodNull;
1723
+ permissionEscalation: z.ZodNull;
1724
+ permissionMode: z.ZodLiteral<"full">;
1725
+ permissionScope: z.ZodLiteral<"full">;
1726
+ }, z.core.$strip>], "permissionMode">>;
1727
+ threadId: z.ZodString;
1728
+ }, z.core.$loose>;
1729
+ declare const threadResumeParamsSchema: z.ZodObject<{
1730
+ cwd: z.ZodString;
1731
+ disallowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
1732
+ dynamicTools: z.ZodOptional<z.ZodArray<z.ZodObject<{
1733
+ description: z.ZodString;
1734
+ inputSchema: z.ZodUnknown;
1735
+ name: z.ZodString;
1736
+ }, z.core.$strip>>>;
1737
+ instructionMode: z.ZodEnum<{
1738
+ append: "append";
1739
+ replace: "replace";
1740
+ }>;
1741
+ options: z.ZodIntersection<z.ZodObject<{
1742
+ envVars: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1743
+ instructions: z.ZodOptional<z.ZodString>;
1744
+ model: z.ZodOptional<z.ZodString>;
1745
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1746
+ reasoningLevel: z.ZodOptional<z.ZodEnum<{
1747
+ high: "high";
1748
+ low: "low";
1749
+ max: "max";
1750
+ medium: "medium";
1751
+ none: "none";
1752
+ ultra: "ultra";
1753
+ ultracode: "ultracode";
1754
+ xhigh: "xhigh";
1755
+ }>>;
1756
+ serviceTier: z.ZodOptional<z.ZodEnum<{
1757
+ default: "default";
1758
+ fast: "fast";
1759
+ }>>;
1760
+ }, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
1761
+ approvalReviewer: z.ZodLiteral<"user">;
1762
+ permissionEscalation: z.ZodEnum<{
1763
+ ask: "ask";
1764
+ deny: "deny";
1765
+ }>;
1766
+ permissionMode: z.ZodLiteral<"accept-edits">;
1767
+ permissionScope: z.ZodLiteral<"workspace">;
1768
+ }, z.core.$strip>, z.ZodObject<{
1769
+ approvalReviewer: z.ZodLiteral<"automatic">;
1770
+ permissionEscalation: z.ZodEnum<{
1771
+ ask: "ask";
1772
+ deny: "deny";
1773
+ }>;
1774
+ permissionMode: z.ZodLiteral<"auto">;
1775
+ permissionScope: z.ZodLiteral<"workspace">;
1776
+ }, z.core.$strip>, z.ZodObject<{
1777
+ approvalReviewer: z.ZodNull;
1778
+ permissionEscalation: z.ZodNull;
1779
+ permissionMode: z.ZodLiteral<"full">;
1780
+ permissionScope: z.ZodLiteral<"full">;
1781
+ }, z.core.$strip>], "permissionMode">>;
1782
+ providerThreadId: z.ZodString;
1783
+ threadId: z.ZodString;
1784
+ }, z.core.$loose>;
1785
+ declare const threadForkParamsSchema: z.ZodObject<{
1786
+ cwd: z.ZodString;
1787
+ disallowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
1788
+ dynamicTools: z.ZodOptional<z.ZodArray<z.ZodObject<{
1789
+ description: z.ZodString;
1790
+ inputSchema: z.ZodUnknown;
1791
+ name: z.ZodString;
1792
+ }, z.core.$strip>>>;
1793
+ instructionMode: z.ZodEnum<{
1794
+ append: "append";
1795
+ replace: "replace";
1796
+ }>;
1797
+ options: z.ZodIntersection<z.ZodObject<{
1798
+ envVars: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1799
+ instructions: z.ZodOptional<z.ZodString>;
1800
+ model: z.ZodOptional<z.ZodString>;
1801
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1802
+ reasoningLevel: z.ZodOptional<z.ZodEnum<{
1803
+ high: "high";
1804
+ low: "low";
1805
+ max: "max";
1806
+ medium: "medium";
1807
+ none: "none";
1808
+ ultra: "ultra";
1809
+ ultracode: "ultracode";
1810
+ xhigh: "xhigh";
1811
+ }>>;
1812
+ serviceTier: z.ZodOptional<z.ZodEnum<{
1813
+ default: "default";
1814
+ fast: "fast";
1815
+ }>>;
1816
+ }, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
1817
+ approvalReviewer: z.ZodLiteral<"user">;
1818
+ permissionEscalation: z.ZodEnum<{
1819
+ ask: "ask";
1820
+ deny: "deny";
1821
+ }>;
1822
+ permissionMode: z.ZodLiteral<"accept-edits">;
1823
+ permissionScope: z.ZodLiteral<"workspace">;
1824
+ }, z.core.$strip>, z.ZodObject<{
1825
+ approvalReviewer: z.ZodLiteral<"automatic">;
1826
+ permissionEscalation: z.ZodEnum<{
1827
+ ask: "ask";
1828
+ deny: "deny";
1829
+ }>;
1830
+ permissionMode: z.ZodLiteral<"auto">;
1831
+ permissionScope: z.ZodLiteral<"workspace">;
1832
+ }, z.core.$strip>, z.ZodObject<{
1833
+ approvalReviewer: z.ZodNull;
1834
+ permissionEscalation: z.ZodNull;
1835
+ permissionMode: z.ZodLiteral<"full">;
1836
+ permissionScope: z.ZodLiteral<"full">;
1837
+ }, z.core.$strip>], "permissionMode">>;
1838
+ sourceProviderCheckpointId: z.ZodOptional<z.ZodString>;
1839
+ sourceProviderThreadId: z.ZodString;
1840
+ threadId: z.ZodString;
1841
+ }, z.core.$loose>;
1842
+ declare const threadStopParamsSchema: z.ZodObject<{
1843
+ activeTurnId: z.ZodNullable<z.ZodString>;
1844
+ intent: z.ZodEnum<{
1845
+ interrupt: "interrupt";
1846
+ release: "release";
1847
+ }>;
1848
+ providerThreadId: z.ZodString;
1849
+ threadId: z.ZodString;
1850
+ }, z.core.$loose>;
1851
+ declare const threadDiscardParamsSchema: z.ZodObject<{
1852
+ providerThreadId: z.ZodString;
1853
+ threadId: z.ZodString;
1854
+ }, z.core.$loose>;
1855
+ declare const threadArchiveParamsSchema: z.ZodObject<{
1856
+ providerThreadId: z.ZodString;
1857
+ threadId: z.ZodString;
1858
+ }, z.core.$loose>;
1859
+ declare const threadUnarchiveParamsSchema: z.ZodObject<{
1860
+ providerThreadId: z.ZodString;
1861
+ threadId: z.ZodString;
1862
+ }, z.core.$loose>;
1863
+ declare const threadGoalClearParamsSchema: z.ZodObject<{
1864
+ providerThreadId: z.ZodString;
1865
+ threadId: z.ZodString;
1866
+ }, z.core.$loose>;
1867
+ declare const threadNameSetParamsSchema: z.ZodObject<{
1868
+ providerThreadId: z.ZodString;
1869
+ threadId: z.ZodString;
1870
+ title: z.ZodString;
1871
+ }, z.core.$loose>;
1872
+ declare const turnStartParamsSchema: z.ZodObject<{
1873
+ clientRequestId: z.ZodString;
1874
+ input: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1875
+ mentions: z.ZodDefault<z.ZodArray<z.ZodObject<{
1876
+ end: z.ZodNumber;
1877
+ resource: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDiscriminatedUnion<[z.ZodObject<{
1878
+ kind: z.ZodLiteral<"thread">;
1879
+ label: z.ZodString;
1880
+ projectId: z.ZodOptional<z.ZodString>;
1881
+ threadId: z.ZodString;
1882
+ }, z.core.$strip>, z.ZodObject<{
1883
+ kind: z.ZodLiteral<"project">;
1884
+ label: z.ZodString;
1885
+ projectId: z.ZodString;
1886
+ }, z.core.$strip>, z.ZodObject<{
1887
+ kind: z.ZodLiteral<"section">;
1888
+ label: z.ZodString;
1889
+ sectionId: z.ZodString;
1890
+ }, z.core.$strip>, z.ZodObject<{
1891
+ entryKind: z.ZodEnum<{
1892
+ directory: "directory";
1893
+ file: "file";
1894
+ }>;
1895
+ kind: z.ZodLiteral<"path">;
1896
+ label: z.ZodString;
1897
+ path: z.ZodString;
1898
+ source: z.ZodEnum<{
1899
+ "thread-storage": "thread-storage";
1900
+ workspace: "workspace";
1901
+ }>;
1902
+ }, z.core.$strip>, z.ZodObject<{
1903
+ argumentHint: z.ZodNullable<z.ZodString>;
1904
+ kind: z.ZodLiteral<"command">;
1905
+ label: z.ZodString;
1906
+ name: z.ZodString;
1907
+ origin: z.ZodEnum<{
1908
+ builtin: "builtin";
1909
+ project: "project";
1910
+ user: "user";
1911
+ }>;
1912
+ source: z.ZodEnum<{
1913
+ command: "command";
1914
+ skill: "skill";
1915
+ }>;
1916
+ trigger: z.ZodEnum<{
1917
+ "/": "/";
1918
+ }>;
1919
+ }, z.core.$strip>, z.ZodObject<{
1920
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1921
+ itemId: z.ZodString;
1922
+ kind: z.ZodLiteral<"plugin">;
1923
+ label: z.ZodString;
1924
+ pluginId: z.ZodString;
1925
+ }, z.core.$strip>], "kind">>;
1926
+ start: z.ZodNumber;
1927
+ }, z.core.$strip>>>;
1928
+ text: z.ZodString;
1929
+ type: z.ZodLiteral<"text">;
1930
+ visibility: z.ZodOptional<z.ZodEnum<{
1931
+ "agent-only": "agent-only";
1932
+ }>>;
1933
+ }, z.core.$strip>, z.ZodObject<{
1934
+ type: z.ZodLiteral<"image">;
1935
+ url: z.ZodString;
1936
+ visibility: z.ZodOptional<z.ZodEnum<{
1937
+ "agent-only": "agent-only";
1938
+ }>>;
1939
+ }, z.core.$strip>, z.ZodObject<{
1940
+ path: z.ZodString;
1941
+ type: z.ZodLiteral<"localImage">;
1942
+ visibility: z.ZodOptional<z.ZodEnum<{
1943
+ "agent-only": "agent-only";
1944
+ }>>;
1945
+ }, z.core.$strip>, z.ZodObject<{
1946
+ mimeType: z.ZodOptional<z.ZodString>;
1947
+ name: z.ZodOptional<z.ZodString>;
1948
+ path: z.ZodString;
1949
+ sizeBytes: z.ZodOptional<z.ZodNumber>;
1950
+ type: z.ZodLiteral<"localFile">;
1951
+ visibility: z.ZodOptional<z.ZodEnum<{
1952
+ "agent-only": "agent-only";
1953
+ }>>;
1954
+ }, z.core.$strip>], "type">>;
1955
+ options: z.ZodIntersection<z.ZodObject<{
1956
+ envVars: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1957
+ instructions: z.ZodOptional<z.ZodString>;
1958
+ model: z.ZodOptional<z.ZodString>;
1959
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1960
+ reasoningLevel: z.ZodOptional<z.ZodEnum<{
1961
+ high: "high";
1962
+ low: "low";
1963
+ max: "max";
1964
+ medium: "medium";
1965
+ none: "none";
1966
+ ultra: "ultra";
1967
+ ultracode: "ultracode";
1968
+ xhigh: "xhigh";
1969
+ }>>;
1970
+ serviceTier: z.ZodOptional<z.ZodEnum<{
1971
+ default: "default";
1972
+ fast: "fast";
1973
+ }>>;
1974
+ }, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
1975
+ approvalReviewer: z.ZodLiteral<"user">;
1976
+ permissionEscalation: z.ZodEnum<{
1977
+ ask: "ask";
1978
+ deny: "deny";
1979
+ }>;
1980
+ permissionMode: z.ZodLiteral<"accept-edits">;
1981
+ permissionScope: z.ZodLiteral<"workspace">;
1982
+ }, z.core.$strip>, z.ZodObject<{
1983
+ approvalReviewer: z.ZodLiteral<"automatic">;
1984
+ permissionEscalation: z.ZodEnum<{
1985
+ ask: "ask";
1986
+ deny: "deny";
1987
+ }>;
1988
+ permissionMode: z.ZodLiteral<"auto">;
1989
+ permissionScope: z.ZodLiteral<"workspace">;
1990
+ }, z.core.$strip>, z.ZodObject<{
1991
+ approvalReviewer: z.ZodNull;
1992
+ permissionEscalation: z.ZodNull;
1993
+ permissionMode: z.ZodLiteral<"full">;
1994
+ permissionScope: z.ZodLiteral<"full">;
1995
+ }, z.core.$strip>], "permissionMode">>;
1996
+ providerThreadId: z.ZodString;
1997
+ threadId: z.ZodString;
1998
+ }, z.core.$loose>;
1999
+ declare const turnSteerParamsSchema: z.ZodObject<{
2000
+ clientRequestId: z.ZodString;
2001
+ expectedTurnId: z.ZodString;
2002
+ input: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2003
+ mentions: z.ZodDefault<z.ZodArray<z.ZodObject<{
2004
+ end: z.ZodNumber;
2005
+ resource: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDiscriminatedUnion<[z.ZodObject<{
2006
+ kind: z.ZodLiteral<"thread">;
2007
+ label: z.ZodString;
2008
+ projectId: z.ZodOptional<z.ZodString>;
2009
+ threadId: z.ZodString;
2010
+ }, z.core.$strip>, z.ZodObject<{
2011
+ kind: z.ZodLiteral<"project">;
2012
+ label: z.ZodString;
2013
+ projectId: z.ZodString;
2014
+ }, z.core.$strip>, z.ZodObject<{
2015
+ kind: z.ZodLiteral<"section">;
2016
+ label: z.ZodString;
2017
+ sectionId: z.ZodString;
2018
+ }, z.core.$strip>, z.ZodObject<{
2019
+ entryKind: z.ZodEnum<{
2020
+ directory: "directory";
2021
+ file: "file";
2022
+ }>;
2023
+ kind: z.ZodLiteral<"path">;
2024
+ label: z.ZodString;
2025
+ path: z.ZodString;
2026
+ source: z.ZodEnum<{
2027
+ "thread-storage": "thread-storage";
2028
+ workspace: "workspace";
2029
+ }>;
2030
+ }, z.core.$strip>, z.ZodObject<{
2031
+ argumentHint: z.ZodNullable<z.ZodString>;
2032
+ kind: z.ZodLiteral<"command">;
2033
+ label: z.ZodString;
2034
+ name: z.ZodString;
2035
+ origin: z.ZodEnum<{
2036
+ builtin: "builtin";
2037
+ project: "project";
2038
+ user: "user";
2039
+ }>;
2040
+ source: z.ZodEnum<{
2041
+ command: "command";
2042
+ skill: "skill";
2043
+ }>;
2044
+ trigger: z.ZodEnum<{
2045
+ "/": "/";
2046
+ }>;
2047
+ }, z.core.$strip>, z.ZodObject<{
2048
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2049
+ itemId: z.ZodString;
2050
+ kind: z.ZodLiteral<"plugin">;
2051
+ label: z.ZodString;
2052
+ pluginId: z.ZodString;
2053
+ }, z.core.$strip>], "kind">>;
2054
+ start: z.ZodNumber;
2055
+ }, z.core.$strip>>>;
2056
+ text: z.ZodString;
2057
+ type: z.ZodLiteral<"text">;
2058
+ visibility: z.ZodOptional<z.ZodEnum<{
2059
+ "agent-only": "agent-only";
2060
+ }>>;
2061
+ }, z.core.$strip>, z.ZodObject<{
2062
+ type: z.ZodLiteral<"image">;
2063
+ url: z.ZodString;
2064
+ visibility: z.ZodOptional<z.ZodEnum<{
2065
+ "agent-only": "agent-only";
2066
+ }>>;
2067
+ }, z.core.$strip>, z.ZodObject<{
2068
+ path: z.ZodString;
2069
+ type: z.ZodLiteral<"localImage">;
2070
+ visibility: z.ZodOptional<z.ZodEnum<{
2071
+ "agent-only": "agent-only";
2072
+ }>>;
2073
+ }, z.core.$strip>, z.ZodObject<{
2074
+ mimeType: z.ZodOptional<z.ZodString>;
2075
+ name: z.ZodOptional<z.ZodString>;
2076
+ path: z.ZodString;
2077
+ sizeBytes: z.ZodOptional<z.ZodNumber>;
2078
+ type: z.ZodLiteral<"localFile">;
2079
+ visibility: z.ZodOptional<z.ZodEnum<{
2080
+ "agent-only": "agent-only";
2081
+ }>>;
2082
+ }, z.core.$strip>], "type">>;
2083
+ options: z.ZodIntersection<z.ZodObject<{
2084
+ envVars: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2085
+ instructions: z.ZodOptional<z.ZodString>;
2086
+ model: z.ZodOptional<z.ZodString>;
2087
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2088
+ reasoningLevel: z.ZodOptional<z.ZodEnum<{
2089
+ high: "high";
2090
+ low: "low";
2091
+ max: "max";
2092
+ medium: "medium";
2093
+ none: "none";
2094
+ ultra: "ultra";
2095
+ ultracode: "ultracode";
2096
+ xhigh: "xhigh";
2097
+ }>>;
2098
+ serviceTier: z.ZodOptional<z.ZodEnum<{
2099
+ default: "default";
2100
+ fast: "fast";
2101
+ }>>;
2102
+ }, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
2103
+ approvalReviewer: z.ZodLiteral<"user">;
2104
+ permissionEscalation: z.ZodEnum<{
2105
+ ask: "ask";
2106
+ deny: "deny";
2107
+ }>;
2108
+ permissionMode: z.ZodLiteral<"accept-edits">;
2109
+ permissionScope: z.ZodLiteral<"workspace">;
2110
+ }, z.core.$strip>, z.ZodObject<{
2111
+ approvalReviewer: z.ZodLiteral<"automatic">;
2112
+ permissionEscalation: z.ZodEnum<{
2113
+ ask: "ask";
2114
+ deny: "deny";
2115
+ }>;
2116
+ permissionMode: z.ZodLiteral<"auto">;
2117
+ permissionScope: z.ZodLiteral<"workspace">;
2118
+ }, z.core.$strip>, z.ZodObject<{
2119
+ approvalReviewer: z.ZodNull;
2120
+ permissionEscalation: z.ZodNull;
2121
+ permissionMode: z.ZodLiteral<"full">;
2122
+ permissionScope: z.ZodLiteral<"full">;
2123
+ }, z.core.$strip>], "permissionMode">>;
2124
+ providerThreadId: z.ZodString;
2125
+ threadId: z.ZodString;
2126
+ }, z.core.$loose>;
2127
+ /**
2128
+ * The canonical skill-injection payload. One shape for every provider: the
2129
+ * staged roots plus their skills. Each bridge transforms a root into its
2130
+ * provider's native form (a Claude local plugin, a codex extra skills root, a
2131
+ * pi additional skill path, an ACP prompt listing) — the per-provider shapes
2132
+ * never cross the wire.
2133
+ */
2134
+ declare const skillsConfigureParamsSchema: z.ZodObject<{
2135
+ roots: z.ZodArray<z.ZodObject<{
2136
+ id: z.ZodString;
2137
+ path: z.ZodString;
2138
+ skills: z.ZodArray<z.ZodObject<{
2139
+ description: z.ZodString;
2140
+ name: z.ZodString;
2141
+ }, z.core.$loose>>;
2142
+ }, z.core.$loose>>;
2143
+ }, z.core.$loose>;
2144
+
2145
+ /**
2146
+ * Bridge → runtime notifications. Everything timeline-bound (assistant text,
2147
+ * tool calls, token usage, context-window usage, …) rides `thread/delta`
2148
+ * (see thread-delta.ts) as parsed semantic deltas the runtime's assembler
2149
+ * turns into canonical `ThreadEvent`s. The notifications here are runtime
2150
+ * signals that are not timeline events.
2151
+ */
2152
+ declare const BRIDGE_NOTIFICATION_METHODS: {
2153
+ readonly threadIdentity: "thread/identity";
2154
+ readonly sessionReplaced: "session/replaced";
2155
+ readonly threadOpenWork: "thread/openWork";
2156
+ readonly providerRaw: "provider/raw";
2157
+ readonly error: "error";
2158
+ };
2159
+
2160
+ /**
2161
+ * Bridge → runtime requests: the two channels where the provider needs an
2162
+ * answer from bb mid-turn. Both carry canonical bb shapes — the bridge maps
2163
+ * its provider's native forms in both directions.
2164
+ */
2165
+ declare const BRIDGE_INBOUND_REQUEST_METHODS: {
2166
+ readonly toolCall: "item/tool/call";
2167
+ readonly interactionRequest: "interaction/request";
2168
+ };
2169
+
2170
+ /**
2171
+ * JSON-RPC error codes on the bridge wire.
2172
+ *
2173
+ * The hygiene rules these back (from #853): an undecodable request is
2174
+ * answered with `INVALID_PARAMS` carrying the validation issues — never
2175
+ * silently dropped; an unrecognized method is answered with
2176
+ * `METHOD_NOT_FOUND`; request vs response is discriminated on the presence of
2177
+ * `method`, never on result-shape guessing.
2178
+ */
2179
+ declare const BRIDGE_JSON_RPC_ERRORS: {
2180
+ /** Standard JSON-RPC: params failed schema validation. */
2181
+ readonly INVALID_PARAMS: -32602;
2182
+ /** Standard JSON-RPC: method not implemented by this bridge. */
2183
+ readonly METHOD_NOT_FOUND: -32601;
2184
+ /** Generic bridge failure. */
2185
+ readonly BRIDGE_ERROR: -32000;
2186
+ /** A turn/steer arrived but the session has no active turn. */
2187
+ readonly NO_ACTIVE_TURN: -32001;
2188
+ /** thread/resume for a session the provider can no longer restore. */
2189
+ readonly SESSION_NOT_RESTORABLE: -32002;
2190
+ /** thread/fork with a checkpoint on a bridge that only forks at the tip. */
2191
+ readonly FORK_CHECKPOINT_UNSUPPORTED: -32003;
2192
+ };
2193
+
2194
+ declare const THREAD_DELTA_NOTIFICATION_METHOD = "thread/delta";
2195
+ /**
2196
+ * Provider-native join key for an item. `providerItemId` is the provider's
2197
+ * own id (a tool-call id); `channel` distinguishes provider-anonymous item
2198
+ * families (e.g. compaction); `parentRef` is the provider-native id of the
2199
+ * parent tool call for nested items. The assembler translates all of these to
2200
+ * bb-minted ids.
2201
+ */
2202
+ declare const deltaItemKeySchema: z.ZodObject<{
2203
+ channel: z.ZodOptional<z.ZodString>;
2204
+ parentRef: z.ZodOptional<z.ZodString>;
2205
+ providerItemId: z.ZodOptional<z.ZodString>;
2206
+ }, z.core.$strip>;
2207
+ type DeltaItemKey = z.infer<typeof deltaItemKeySchema>;
2208
+ /**
2209
+ * The parsed item shapes a bridge classifies its provider's tool traffic
2210
+ * into. Everything richer (diffs, pending statuses, echoed fields on close)
2211
+ * is assembler-owned construction. Output-ish optional fields (aggregated
2212
+ * output, exit code, results) exist for providers whose native item payloads
2213
+ * carry them wholesale (codex). When both a shape field and its generic close
2214
+ * counterpart are present, precedence is per-shape: for `command` the generic
2215
+ * close fields (`aggregatedOutput`, `exitCode`) win over the shape's, but for
2216
+ * `tool` the shape's `result` wins over the close's `resultText`. The
2217
+ * asymmetry is deliberate — it preserves byte-equivalence with the original
2218
+ * codex-vs-pi translator conversions.
2219
+ */
2220
+ declare const deltaFileChangeSchema: z.ZodObject<{
2221
+ diff: z.ZodOptional<z.ZodString>;
2222
+ kind: z.ZodEnum<{
2223
+ add: "add";
2224
+ delete: "delete";
2225
+ update: "update";
2226
+ }>;
2227
+ movePath: z.ZodOptional<z.ZodString>;
2228
+ newText: z.ZodOptional<z.ZodString>;
2229
+ oldText: z.ZodOptional<z.ZodString>;
2230
+ path: z.ZodString;
2231
+ }, z.core.$strip>;
2232
+ type DeltaFileChange = z.infer<typeof deltaFileChangeSchema>;
2233
+ /**
2234
+ * A provider background task (claude workflows, backgrounded shells and
2235
+ * subagents). The full snapshot is re-embedded per event — the bridge owns the
2236
+ * dialect fold (per-index workflow records, generation counting) and the
2237
+ * assembler only re-emits it. The family's canonical events are structurally
2238
+ * thread-scoped by the domain grammar (`item/backgroundTask/progress` and
2239
+ * `item/backgroundTask/completed`), so its progress/close deltas need no open
2240
+ * turn; only the spawning `item.open` (→ `item/started`) is turn-scoped.
2241
+ */
2242
+ declare const deltaBackgroundTaskShapeSchema: z.ZodObject<{
2243
+ description: z.ZodString;
2244
+ error: z.ZodOptional<z.ZodString>;
2245
+ familyId: z.ZodString;
2246
+ outputFile: z.ZodOptional<z.ZodString>;
2247
+ skipTranscript: z.ZodBoolean;
2248
+ status: z.ZodEnum<{
2249
+ completed: "completed";
2250
+ failed: "failed";
2251
+ interrupted: "interrupted";
2252
+ pending: "pending";
2253
+ }>;
2254
+ summary: z.ZodOptional<z.ZodString>;
2255
+ taskStatus: z.ZodEnum<{
2256
+ completed: "completed";
2257
+ failed: "failed";
2258
+ killed: "killed";
2259
+ paused: "paused";
2260
+ pending: "pending";
2261
+ running: "running";
2262
+ stopped: "stopped";
2263
+ }>;
2264
+ taskType: z.ZodString;
2265
+ type: z.ZodLiteral<"backgroundTask">;
2266
+ usage: z.ZodOptional<z.ZodObject<{
2267
+ durationMs: z.ZodNumber;
2268
+ toolUses: z.ZodNumber;
2269
+ totalTokens: z.ZodNumber;
2270
+ }, z.core.$strip>>;
2271
+ workflow: z.ZodOptional<z.ZodObject<{
2272
+ agents: z.ZodArray<z.ZodObject<{
2273
+ agentType: z.ZodOptional<z.ZodString>;
2274
+ attempt: z.ZodNumber;
2275
+ cached: z.ZodBoolean;
2276
+ durationMs: z.ZodOptional<z.ZodNumber>;
2277
+ error: z.ZodOptional<z.ZodString>;
2278
+ index: z.ZodNumber;
2279
+ isolation: z.ZodOptional<z.ZodString>;
2280
+ label: z.ZodString;
2281
+ lastProgressAt: z.ZodNumber;
2282
+ lastToolName: z.ZodOptional<z.ZodString>;
2283
+ lastToolSummary: z.ZodOptional<z.ZodString>;
2284
+ model: z.ZodString;
2285
+ phaseIndex: z.ZodOptional<z.ZodNumber>;
2286
+ phaseTitle: z.ZodOptional<z.ZodString>;
2287
+ promptPreview: z.ZodOptional<z.ZodString>;
2288
+ queuedAt: z.ZodOptional<z.ZodNumber>;
2289
+ resultPreview: z.ZodOptional<z.ZodString>;
2290
+ startedAt: z.ZodOptional<z.ZodNumber>;
2291
+ state: z.ZodEnum<{
2292
+ done: "done";
2293
+ failed: "failed";
2294
+ queued: "queued";
2295
+ running: "running";
2296
+ skipped: "skipped";
2297
+ }>;
2298
+ tokens: z.ZodOptional<z.ZodNumber>;
2299
+ toolCalls: z.ZodOptional<z.ZodNumber>;
2300
+ }, z.core.$strip>>;
2301
+ phases: z.ZodArray<z.ZodObject<{
2302
+ index: z.ZodNumber;
2303
+ kind: z.ZodOptional<z.ZodString>;
2304
+ title: z.ZodString;
2305
+ }, z.core.$strip>>;
2306
+ }, z.core.$strip>>;
2307
+ workflowName: z.ZodOptional<z.ZodString>;
2308
+ }, z.core.$strip>;
2309
+ type DeltaBackgroundTaskShape = z.infer<typeof deltaBackgroundTaskShapeSchema>;
2310
+ declare const deltaItemShapeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2311
+ aggregatedOutput: z.ZodOptional<z.ZodString>;
2312
+ command: z.ZodString;
2313
+ cwd: z.ZodString;
2314
+ durationMs: z.ZodOptional<z.ZodNumber>;
2315
+ exitCode: z.ZodOptional<z.ZodNumber>;
2316
+ type: z.ZodLiteral<"command">;
2317
+ }, z.core.$strip>, z.ZodObject<{
2318
+ changes: z.ZodArray<z.ZodObject<{
2319
+ diff: z.ZodOptional<z.ZodString>;
2320
+ kind: z.ZodEnum<{
2321
+ add: "add";
2322
+ delete: "delete";
2323
+ update: "update";
2324
+ }>;
2325
+ movePath: z.ZodOptional<z.ZodString>;
2326
+ newText: z.ZodOptional<z.ZodString>;
2327
+ oldText: z.ZodOptional<z.ZodString>;
2328
+ path: z.ZodString;
2329
+ }, z.core.$strip>>;
2330
+ type: z.ZodLiteral<"fileChange">;
2331
+ }, z.core.$strip>, z.ZodObject<{
2332
+ args: z.ZodOptional<z.ZodUnknown>;
2333
+ durationMs: z.ZodOptional<z.ZodNumber>;
2334
+ error: z.ZodOptional<z.ZodString>;
2335
+ result: z.ZodOptional<z.ZodUnknown>;
2336
+ server: z.ZodOptional<z.ZodString>;
2337
+ tool: z.ZodString;
2338
+ type: z.ZodLiteral<"tool">;
2339
+ }, z.core.$strip>, z.ZodObject<{
2340
+ type: z.ZodLiteral<"compaction">;
2341
+ }, z.core.$strip>, z.ZodObject<{
2342
+ text: z.ZodString;
2343
+ type: z.ZodLiteral<"agentMessage">;
2344
+ }, z.core.$strip>, z.ZodObject<{
2345
+ content: z.ZodArray<z.ZodString>;
2346
+ summary: z.ZodArray<z.ZodString>;
2347
+ type: z.ZodLiteral<"reasoning">;
2348
+ }, z.core.$strip>, z.ZodObject<{
2349
+ text: z.ZodString;
2350
+ type: z.ZodLiteral<"plan">;
2351
+ }, z.core.$strip>, z.ZodObject<{
2352
+ queries: z.ZodArray<z.ZodString>;
2353
+ type: z.ZodLiteral<"webSearch">;
2354
+ }, z.core.$strip>, z.ZodObject<{
2355
+ pattern: z.ZodNullable<z.ZodString>;
2356
+ prompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2357
+ type: z.ZodLiteral<"webFetch">;
2358
+ url: z.ZodString;
2359
+ }, z.core.$strip>, z.ZodObject<{
2360
+ path: z.ZodString;
2361
+ type: z.ZodLiteral<"imageView">;
2362
+ }, z.core.$strip>, z.ZodObject<{
2363
+ description: z.ZodString;
2364
+ error: z.ZodOptional<z.ZodString>;
2365
+ familyId: z.ZodString;
2366
+ outputFile: z.ZodOptional<z.ZodString>;
2367
+ skipTranscript: z.ZodBoolean;
2368
+ status: z.ZodEnum<{
2369
+ completed: "completed";
2370
+ failed: "failed";
2371
+ interrupted: "interrupted";
2372
+ pending: "pending";
2373
+ }>;
2374
+ summary: z.ZodOptional<z.ZodString>;
2375
+ taskStatus: z.ZodEnum<{
2376
+ completed: "completed";
2377
+ failed: "failed";
2378
+ killed: "killed";
2379
+ paused: "paused";
2380
+ pending: "pending";
2381
+ running: "running";
2382
+ stopped: "stopped";
2383
+ }>;
2384
+ taskType: z.ZodString;
2385
+ type: z.ZodLiteral<"backgroundTask">;
2386
+ usage: z.ZodOptional<z.ZodObject<{
2387
+ durationMs: z.ZodNumber;
2388
+ toolUses: z.ZodNumber;
2389
+ totalTokens: z.ZodNumber;
2390
+ }, z.core.$strip>>;
2391
+ workflow: z.ZodOptional<z.ZodObject<{
2392
+ agents: z.ZodArray<z.ZodObject<{
2393
+ agentType: z.ZodOptional<z.ZodString>;
2394
+ attempt: z.ZodNumber;
2395
+ cached: z.ZodBoolean;
2396
+ durationMs: z.ZodOptional<z.ZodNumber>;
2397
+ error: z.ZodOptional<z.ZodString>;
2398
+ index: z.ZodNumber;
2399
+ isolation: z.ZodOptional<z.ZodString>;
2400
+ label: z.ZodString;
2401
+ lastProgressAt: z.ZodNumber;
2402
+ lastToolName: z.ZodOptional<z.ZodString>;
2403
+ lastToolSummary: z.ZodOptional<z.ZodString>;
2404
+ model: z.ZodString;
2405
+ phaseIndex: z.ZodOptional<z.ZodNumber>;
2406
+ phaseTitle: z.ZodOptional<z.ZodString>;
2407
+ promptPreview: z.ZodOptional<z.ZodString>;
2408
+ queuedAt: z.ZodOptional<z.ZodNumber>;
2409
+ resultPreview: z.ZodOptional<z.ZodString>;
2410
+ startedAt: z.ZodOptional<z.ZodNumber>;
2411
+ state: z.ZodEnum<{
2412
+ done: "done";
2413
+ failed: "failed";
2414
+ queued: "queued";
2415
+ running: "running";
2416
+ skipped: "skipped";
2417
+ }>;
2418
+ tokens: z.ZodOptional<z.ZodNumber>;
2419
+ toolCalls: z.ZodOptional<z.ZodNumber>;
2420
+ }, z.core.$strip>>;
2421
+ phases: z.ZodArray<z.ZodObject<{
2422
+ index: z.ZodNumber;
2423
+ kind: z.ZodOptional<z.ZodString>;
2424
+ title: z.ZodString;
2425
+ }, z.core.$strip>>;
2426
+ }, z.core.$strip>>;
2427
+ workflowName: z.ZodOptional<z.ZodString>;
2428
+ }, z.core.$strip>], "type">;
2429
+ type DeltaItemShape = z.infer<typeof deltaItemShapeSchema>;
2430
+ declare const deltaMessageChannelSchema: z.ZodEnum<{
2431
+ assistant: "assistant";
2432
+ reasoning: "reasoning";
2433
+ }>;
2434
+ type DeltaMessageChannel = z.infer<typeof deltaMessageChannelSchema>;
2435
+ /**
2436
+ * Item-keyed text channels (codex): channels that synthesize a delta-first
2437
+ * `item/started` for an unknown item id.
2438
+ */
2439
+ declare const deltaTextChannelSchema: z.ZodEnum<{
2440
+ agentMessage: "agentMessage";
2441
+ plan: "plan";
2442
+ reasoningSummary: "reasoningSummary";
2443
+ reasoningText: "reasoningText";
2444
+ }>;
2445
+ type DeltaTextChannel = z.infer<typeof deltaTextChannelSchema>;
2446
+ /**
2447
+ * Item-keyed output channels (codex): channels that NEVER synthesize an open
2448
+ * — fabricating a commandExecution without its command would be worse than
2449
+ * the anomaly. The structural split between `item.textDelta` and
2450
+ * `item.outputDelta` is what encodes that rule.
2451
+ */
2452
+ declare const deltaOutputChannelSchema: z.ZodEnum<{
2453
+ command: "command";
2454
+ fileChange: "fileChange";
2455
+ }>;
2456
+ type DeltaOutputChannel = z.infer<typeof deltaOutputChannelSchema>;
2457
+ /**
2458
+ * Turnless fallback: item/stream deltas never open turns — only `turn.open`,
2459
+ * a claiming `turn.boundary`, and accepted-input lifecycle settlement do.
2460
+ * When a turn-scoped delta arrives with no turn to attach to, the assembler
2461
+ * surfaces this raw payload as a thread-scoped `provider/unhandled` (the
2462
+ * bridges' old "no active turn" guard, applied centrally). Absent, the
2463
+ * turnless delta is dropped silently. Irrelevant for deltas carrying a
2464
+ * `providerTurnId` (a vouched turn always resolves).
2465
+ */
2466
+ declare const deltaNoTurnFallbackSchema: z.ZodObject<{
2467
+ raw: z.ZodObject<{
2468
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
2469
+ jsonrpc: z.ZodLiteral<"2.0">;
2470
+ method: z.ZodString;
2471
+ params: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
2472
+ }, z.core.$strip>;
2473
+ rawType: z.ZodString;
2474
+ }, z.core.$strip>;
2475
+ type DeltaNoTurnFallback = z.infer<typeof deltaNoTurnFallbackSchema>;
2476
+ declare const threadDeltaSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2477
+ clientRequestId: z.ZodString;
2478
+ kind: z.ZodLiteral<"input.accepted">;
2479
+ providerTurnId: z.ZodOptional<z.ZodString>;
2480
+ }, z.core.$strip>, z.ZodObject<{
2481
+ kind: z.ZodLiteral<"turn.open">;
2482
+ parentRef: z.ZodOptional<z.ZodString>;
2483
+ providerTurnId: z.ZodOptional<z.ZodString>;
2484
+ }, z.core.$strip>, z.ZodObject<{
2485
+ claimIfIdle: z.ZodOptional<z.ZodBoolean>;
2486
+ error: z.ZodOptional<z.ZodObject<{
2487
+ message: z.ZodString;
2488
+ }, z.core.$strip>>;
2489
+ kind: z.ZodLiteral<"turn.boundary">;
2490
+ providerCheckpointId: z.ZodOptional<z.ZodString>;
2491
+ providerTurnId: z.ZodOptional<z.ZodString>;
2492
+ status: z.ZodEnum<{
2493
+ completed: "completed";
2494
+ failed: "failed";
2495
+ interrupted: "interrupted";
2496
+ }>;
2497
+ }, z.core.$strip>, z.ZodObject<{
2498
+ attach: z.ZodOptional<z.ZodEnum<{
2499
+ currentOrLast: "currentOrLast";
2500
+ open: "open";
2501
+ }>>;
2502
+ item: z.ZodDiscriminatedUnion<[z.ZodObject<{
2503
+ aggregatedOutput: z.ZodOptional<z.ZodString>;
2504
+ command: z.ZodString;
2505
+ cwd: z.ZodString;
2506
+ durationMs: z.ZodOptional<z.ZodNumber>;
2507
+ exitCode: z.ZodOptional<z.ZodNumber>;
2508
+ type: z.ZodLiteral<"command">;
2509
+ }, z.core.$strip>, z.ZodObject<{
2510
+ changes: z.ZodArray<z.ZodObject<{
2511
+ diff: z.ZodOptional<z.ZodString>;
2512
+ kind: z.ZodEnum<{
2513
+ add: "add";
2514
+ delete: "delete";
2515
+ update: "update";
2516
+ }>;
2517
+ movePath: z.ZodOptional<z.ZodString>;
2518
+ newText: z.ZodOptional<z.ZodString>;
2519
+ oldText: z.ZodOptional<z.ZodString>;
2520
+ path: z.ZodString;
2521
+ }, z.core.$strip>>;
2522
+ type: z.ZodLiteral<"fileChange">;
2523
+ }, z.core.$strip>, z.ZodObject<{
2524
+ args: z.ZodOptional<z.ZodUnknown>;
2525
+ durationMs: z.ZodOptional<z.ZodNumber>;
2526
+ error: z.ZodOptional<z.ZodString>;
2527
+ result: z.ZodOptional<z.ZodUnknown>;
2528
+ server: z.ZodOptional<z.ZodString>;
2529
+ tool: z.ZodString;
2530
+ type: z.ZodLiteral<"tool">;
2531
+ }, z.core.$strip>, z.ZodObject<{
2532
+ type: z.ZodLiteral<"compaction">;
2533
+ }, z.core.$strip>, z.ZodObject<{
2534
+ text: z.ZodString;
2535
+ type: z.ZodLiteral<"agentMessage">;
2536
+ }, z.core.$strip>, z.ZodObject<{
2537
+ content: z.ZodArray<z.ZodString>;
2538
+ summary: z.ZodArray<z.ZodString>;
2539
+ type: z.ZodLiteral<"reasoning">;
2540
+ }, z.core.$strip>, z.ZodObject<{
2541
+ text: z.ZodString;
2542
+ type: z.ZodLiteral<"plan">;
2543
+ }, z.core.$strip>, z.ZodObject<{
2544
+ queries: z.ZodArray<z.ZodString>;
2545
+ type: z.ZodLiteral<"webSearch">;
2546
+ }, z.core.$strip>, z.ZodObject<{
2547
+ pattern: z.ZodNullable<z.ZodString>;
2548
+ prompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2549
+ type: z.ZodLiteral<"webFetch">;
2550
+ url: z.ZodString;
2551
+ }, z.core.$strip>, z.ZodObject<{
2552
+ path: z.ZodString;
2553
+ type: z.ZodLiteral<"imageView">;
2554
+ }, z.core.$strip>, z.ZodObject<{
2555
+ description: z.ZodString;
2556
+ error: z.ZodOptional<z.ZodString>;
2557
+ familyId: z.ZodString;
2558
+ outputFile: z.ZodOptional<z.ZodString>;
2559
+ skipTranscript: z.ZodBoolean;
2560
+ status: z.ZodEnum<{
2561
+ completed: "completed";
2562
+ failed: "failed";
2563
+ interrupted: "interrupted";
2564
+ pending: "pending";
2565
+ }>;
2566
+ summary: z.ZodOptional<z.ZodString>;
2567
+ taskStatus: z.ZodEnum<{
2568
+ completed: "completed";
2569
+ failed: "failed";
2570
+ killed: "killed";
2571
+ paused: "paused";
2572
+ pending: "pending";
2573
+ running: "running";
2574
+ stopped: "stopped";
2575
+ }>;
2576
+ taskType: z.ZodString;
2577
+ type: z.ZodLiteral<"backgroundTask">;
2578
+ usage: z.ZodOptional<z.ZodObject<{
2579
+ durationMs: z.ZodNumber;
2580
+ toolUses: z.ZodNumber;
2581
+ totalTokens: z.ZodNumber;
2582
+ }, z.core.$strip>>;
2583
+ workflow: z.ZodOptional<z.ZodObject<{
2584
+ agents: z.ZodArray<z.ZodObject<{
2585
+ agentType: z.ZodOptional<z.ZodString>;
2586
+ attempt: z.ZodNumber;
2587
+ cached: z.ZodBoolean;
2588
+ durationMs: z.ZodOptional<z.ZodNumber>;
2589
+ error: z.ZodOptional<z.ZodString>;
2590
+ index: z.ZodNumber;
2591
+ isolation: z.ZodOptional<z.ZodString>;
2592
+ label: z.ZodString;
2593
+ lastProgressAt: z.ZodNumber;
2594
+ lastToolName: z.ZodOptional<z.ZodString>;
2595
+ lastToolSummary: z.ZodOptional<z.ZodString>;
2596
+ model: z.ZodString;
2597
+ phaseIndex: z.ZodOptional<z.ZodNumber>;
2598
+ phaseTitle: z.ZodOptional<z.ZodString>;
2599
+ promptPreview: z.ZodOptional<z.ZodString>;
2600
+ queuedAt: z.ZodOptional<z.ZodNumber>;
2601
+ resultPreview: z.ZodOptional<z.ZodString>;
2602
+ startedAt: z.ZodOptional<z.ZodNumber>;
2603
+ state: z.ZodEnum<{
2604
+ done: "done";
2605
+ failed: "failed";
2606
+ queued: "queued";
2607
+ running: "running";
2608
+ skipped: "skipped";
2609
+ }>;
2610
+ tokens: z.ZodOptional<z.ZodNumber>;
2611
+ toolCalls: z.ZodOptional<z.ZodNumber>;
2612
+ }, z.core.$strip>>;
2613
+ phases: z.ZodArray<z.ZodObject<{
2614
+ index: z.ZodNumber;
2615
+ kind: z.ZodOptional<z.ZodString>;
2616
+ title: z.ZodString;
2617
+ }, z.core.$strip>>;
2618
+ }, z.core.$strip>>;
2619
+ workflowName: z.ZodOptional<z.ZodString>;
2620
+ }, z.core.$strip>], "type">;
2621
+ key: z.ZodObject<{
2622
+ channel: z.ZodOptional<z.ZodString>;
2623
+ parentRef: z.ZodOptional<z.ZodString>;
2624
+ providerItemId: z.ZodOptional<z.ZodString>;
2625
+ }, z.core.$strip>;
2626
+ kind: z.ZodLiteral<"item.open">;
2627
+ noTurnFallback: z.ZodOptional<z.ZodObject<{
2628
+ raw: z.ZodObject<{
2629
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
2630
+ jsonrpc: z.ZodLiteral<"2.0">;
2631
+ method: z.ZodString;
2632
+ params: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
2633
+ }, z.core.$strip>;
2634
+ rawType: z.ZodString;
2635
+ }, z.core.$strip>>;
2636
+ providerTurnId: z.ZodOptional<z.ZodString>;
2637
+ }, z.core.$strip>, z.ZodObject<{
2638
+ aggregatedOutput: z.ZodOptional<z.ZodString>;
2639
+ approvalStatus: z.ZodOptional<z.ZodLiteral<"denied">>;
2640
+ exitCode: z.ZodOptional<z.ZodNumber>;
2641
+ item: z.ZodDiscriminatedUnion<[z.ZodObject<{
2642
+ aggregatedOutput: z.ZodOptional<z.ZodString>;
2643
+ command: z.ZodString;
2644
+ cwd: z.ZodString;
2645
+ durationMs: z.ZodOptional<z.ZodNumber>;
2646
+ exitCode: z.ZodOptional<z.ZodNumber>;
2647
+ type: z.ZodLiteral<"command">;
2648
+ }, z.core.$strip>, z.ZodObject<{
2649
+ changes: z.ZodArray<z.ZodObject<{
2650
+ diff: z.ZodOptional<z.ZodString>;
2651
+ kind: z.ZodEnum<{
2652
+ add: "add";
2653
+ delete: "delete";
2654
+ update: "update";
2655
+ }>;
2656
+ movePath: z.ZodOptional<z.ZodString>;
2657
+ newText: z.ZodOptional<z.ZodString>;
2658
+ oldText: z.ZodOptional<z.ZodString>;
2659
+ path: z.ZodString;
2660
+ }, z.core.$strip>>;
2661
+ type: z.ZodLiteral<"fileChange">;
2662
+ }, z.core.$strip>, z.ZodObject<{
2663
+ args: z.ZodOptional<z.ZodUnknown>;
2664
+ durationMs: z.ZodOptional<z.ZodNumber>;
2665
+ error: z.ZodOptional<z.ZodString>;
2666
+ result: z.ZodOptional<z.ZodUnknown>;
2667
+ server: z.ZodOptional<z.ZodString>;
2668
+ tool: z.ZodString;
2669
+ type: z.ZodLiteral<"tool">;
2670
+ }, z.core.$strip>, z.ZodObject<{
2671
+ type: z.ZodLiteral<"compaction">;
2672
+ }, z.core.$strip>, z.ZodObject<{
2673
+ text: z.ZodString;
2674
+ type: z.ZodLiteral<"agentMessage">;
2675
+ }, z.core.$strip>, z.ZodObject<{
2676
+ content: z.ZodArray<z.ZodString>;
2677
+ summary: z.ZodArray<z.ZodString>;
2678
+ type: z.ZodLiteral<"reasoning">;
2679
+ }, z.core.$strip>, z.ZodObject<{
2680
+ text: z.ZodString;
2681
+ type: z.ZodLiteral<"plan">;
2682
+ }, z.core.$strip>, z.ZodObject<{
2683
+ queries: z.ZodArray<z.ZodString>;
2684
+ type: z.ZodLiteral<"webSearch">;
2685
+ }, z.core.$strip>, z.ZodObject<{
2686
+ pattern: z.ZodNullable<z.ZodString>;
2687
+ prompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2688
+ type: z.ZodLiteral<"webFetch">;
2689
+ url: z.ZodString;
2690
+ }, z.core.$strip>, z.ZodObject<{
2691
+ path: z.ZodString;
2692
+ type: z.ZodLiteral<"imageView">;
2693
+ }, z.core.$strip>, z.ZodObject<{
2694
+ description: z.ZodString;
2695
+ error: z.ZodOptional<z.ZodString>;
2696
+ familyId: z.ZodString;
2697
+ outputFile: z.ZodOptional<z.ZodString>;
2698
+ skipTranscript: z.ZodBoolean;
2699
+ status: z.ZodEnum<{
2700
+ completed: "completed";
2701
+ failed: "failed";
2702
+ interrupted: "interrupted";
2703
+ pending: "pending";
2704
+ }>;
2705
+ summary: z.ZodOptional<z.ZodString>;
2706
+ taskStatus: z.ZodEnum<{
2707
+ completed: "completed";
2708
+ failed: "failed";
2709
+ killed: "killed";
2710
+ paused: "paused";
2711
+ pending: "pending";
2712
+ running: "running";
2713
+ stopped: "stopped";
2714
+ }>;
2715
+ taskType: z.ZodString;
2716
+ type: z.ZodLiteral<"backgroundTask">;
2717
+ usage: z.ZodOptional<z.ZodObject<{
2718
+ durationMs: z.ZodNumber;
2719
+ toolUses: z.ZodNumber;
2720
+ totalTokens: z.ZodNumber;
2721
+ }, z.core.$strip>>;
2722
+ workflow: z.ZodOptional<z.ZodObject<{
2723
+ agents: z.ZodArray<z.ZodObject<{
2724
+ agentType: z.ZodOptional<z.ZodString>;
2725
+ attempt: z.ZodNumber;
2726
+ cached: z.ZodBoolean;
2727
+ durationMs: z.ZodOptional<z.ZodNumber>;
2728
+ error: z.ZodOptional<z.ZodString>;
2729
+ index: z.ZodNumber;
2730
+ isolation: z.ZodOptional<z.ZodString>;
2731
+ label: z.ZodString;
2732
+ lastProgressAt: z.ZodNumber;
2733
+ lastToolName: z.ZodOptional<z.ZodString>;
2734
+ lastToolSummary: z.ZodOptional<z.ZodString>;
2735
+ model: z.ZodString;
2736
+ phaseIndex: z.ZodOptional<z.ZodNumber>;
2737
+ phaseTitle: z.ZodOptional<z.ZodString>;
2738
+ promptPreview: z.ZodOptional<z.ZodString>;
2739
+ queuedAt: z.ZodOptional<z.ZodNumber>;
2740
+ resultPreview: z.ZodOptional<z.ZodString>;
2741
+ startedAt: z.ZodOptional<z.ZodNumber>;
2742
+ state: z.ZodEnum<{
2743
+ done: "done";
2744
+ failed: "failed";
2745
+ queued: "queued";
2746
+ running: "running";
2747
+ skipped: "skipped";
2748
+ }>;
2749
+ tokens: z.ZodOptional<z.ZodNumber>;
2750
+ toolCalls: z.ZodOptional<z.ZodNumber>;
2751
+ }, z.core.$strip>>;
2752
+ phases: z.ZodArray<z.ZodObject<{
2753
+ index: z.ZodNumber;
2754
+ kind: z.ZodOptional<z.ZodString>;
2755
+ title: z.ZodString;
2756
+ }, z.core.$strip>>;
2757
+ }, z.core.$strip>>;
2758
+ workflowName: z.ZodOptional<z.ZodString>;
2759
+ }, z.core.$strip>], "type">;
2760
+ key: z.ZodObject<{
2761
+ channel: z.ZodOptional<z.ZodString>;
2762
+ parentRef: z.ZodOptional<z.ZodString>;
2763
+ providerItemId: z.ZodOptional<z.ZodString>;
2764
+ }, z.core.$strip>;
2765
+ kind: z.ZodLiteral<"item.close">;
2766
+ noTurnFallback: z.ZodOptional<z.ZodObject<{
2767
+ raw: z.ZodObject<{
2768
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
2769
+ jsonrpc: z.ZodLiteral<"2.0">;
2770
+ method: z.ZodString;
2771
+ params: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
2772
+ }, z.core.$strip>;
2773
+ rawType: z.ZodString;
2774
+ }, z.core.$strip>>;
2775
+ providerTurnId: z.ZodOptional<z.ZodString>;
2776
+ resultText: z.ZodOptional<z.ZodString>;
2777
+ status: z.ZodEnum<{
2778
+ completed: "completed";
2779
+ failed: "failed";
2780
+ interrupted: "interrupted";
2781
+ pending: "pending";
2782
+ }>;
2783
+ }, z.core.$strip>, z.ZodObject<{
2784
+ explanation: z.ZodOptional<z.ZodString>;
2785
+ kind: z.ZodLiteral<"turn.plan">;
2786
+ noTurnFallback: z.ZodOptional<z.ZodObject<{
2787
+ raw: z.ZodObject<{
2788
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
2789
+ jsonrpc: z.ZodLiteral<"2.0">;
2790
+ method: z.ZodString;
2791
+ params: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
2792
+ }, z.core.$strip>;
2793
+ rawType: z.ZodString;
2794
+ }, z.core.$strip>>;
2795
+ providerTurnId: z.ZodOptional<z.ZodString>;
2796
+ steps: z.ZodArray<z.ZodObject<{
2797
+ status: z.ZodOptional<z.ZodEnum<{
2798
+ active: "active";
2799
+ completed: "completed";
2800
+ failed: "failed";
2801
+ pending: "pending";
2802
+ }>>;
2803
+ step: z.ZodString;
2804
+ }, z.core.$strip>>;
2805
+ }, z.core.$strip>, z.ZodObject<{
2806
+ flush: z.ZodOptional<z.ZodBoolean>;
2807
+ key: z.ZodObject<{
2808
+ channel: z.ZodOptional<z.ZodString>;
2809
+ parentRef: z.ZodOptional<z.ZodString>;
2810
+ providerItemId: z.ZodOptional<z.ZodString>;
2811
+ }, z.core.$strip>;
2812
+ kind: z.ZodLiteral<"item.progress">;
2813
+ message: z.ZodOptional<z.ZodString>;
2814
+ noTurnFallback: z.ZodOptional<z.ZodObject<{
2815
+ raw: z.ZodObject<{
2816
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
2817
+ jsonrpc: z.ZodLiteral<"2.0">;
2818
+ method: z.ZodString;
2819
+ params: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
2820
+ }, z.core.$strip>;
2821
+ rawType: z.ZodString;
2822
+ }, z.core.$strip>>;
2823
+ providerTurnId: z.ZodOptional<z.ZodString>;
2824
+ snapshot: z.ZodOptional<z.ZodObject<{
2825
+ description: z.ZodString;
2826
+ error: z.ZodOptional<z.ZodString>;
2827
+ familyId: z.ZodString;
2828
+ outputFile: z.ZodOptional<z.ZodString>;
2829
+ skipTranscript: z.ZodBoolean;
2830
+ status: z.ZodEnum<{
2831
+ completed: "completed";
2832
+ failed: "failed";
2833
+ interrupted: "interrupted";
2834
+ pending: "pending";
2835
+ }>;
2836
+ summary: z.ZodOptional<z.ZodString>;
2837
+ taskStatus: z.ZodEnum<{
2838
+ completed: "completed";
2839
+ failed: "failed";
2840
+ killed: "killed";
2841
+ paused: "paused";
2842
+ pending: "pending";
2843
+ running: "running";
2844
+ stopped: "stopped";
2845
+ }>;
2846
+ taskType: z.ZodString;
2847
+ type: z.ZodLiteral<"backgroundTask">;
2848
+ usage: z.ZodOptional<z.ZodObject<{
2849
+ durationMs: z.ZodNumber;
2850
+ toolUses: z.ZodNumber;
2851
+ totalTokens: z.ZodNumber;
2852
+ }, z.core.$strip>>;
2853
+ workflow: z.ZodOptional<z.ZodObject<{
2854
+ agents: z.ZodArray<z.ZodObject<{
2855
+ agentType: z.ZodOptional<z.ZodString>;
2856
+ attempt: z.ZodNumber;
2857
+ cached: z.ZodBoolean;
2858
+ durationMs: z.ZodOptional<z.ZodNumber>;
2859
+ error: z.ZodOptional<z.ZodString>;
2860
+ index: z.ZodNumber;
2861
+ isolation: z.ZodOptional<z.ZodString>;
2862
+ label: z.ZodString;
2863
+ lastProgressAt: z.ZodNumber;
2864
+ lastToolName: z.ZodOptional<z.ZodString>;
2865
+ lastToolSummary: z.ZodOptional<z.ZodString>;
2866
+ model: z.ZodString;
2867
+ phaseIndex: z.ZodOptional<z.ZodNumber>;
2868
+ phaseTitle: z.ZodOptional<z.ZodString>;
2869
+ promptPreview: z.ZodOptional<z.ZodString>;
2870
+ queuedAt: z.ZodOptional<z.ZodNumber>;
2871
+ resultPreview: z.ZodOptional<z.ZodString>;
2872
+ startedAt: z.ZodOptional<z.ZodNumber>;
2873
+ state: z.ZodEnum<{
2874
+ done: "done";
2875
+ failed: "failed";
2876
+ queued: "queued";
2877
+ running: "running";
2878
+ skipped: "skipped";
2879
+ }>;
2880
+ tokens: z.ZodOptional<z.ZodNumber>;
2881
+ toolCalls: z.ZodOptional<z.ZodNumber>;
2882
+ }, z.core.$strip>>;
2883
+ phases: z.ZodArray<z.ZodObject<{
2884
+ index: z.ZodNumber;
2885
+ kind: z.ZodOptional<z.ZodString>;
2886
+ title: z.ZodString;
2887
+ }, z.core.$strip>>;
2888
+ }, z.core.$strip>>;
2889
+ workflowName: z.ZodOptional<z.ZodString>;
2890
+ }, z.core.$strip>>;
2891
+ }, z.core.$strip>, z.ZodObject<{
2892
+ channel: z.ZodEnum<{
2893
+ assistant: "assistant";
2894
+ reasoning: "reasoning";
2895
+ }>;
2896
+ kind: z.ZodLiteral<"message.delta">;
2897
+ noTurnFallback: z.ZodOptional<z.ZodObject<{
2898
+ raw: z.ZodObject<{
2899
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
2900
+ jsonrpc: z.ZodLiteral<"2.0">;
2901
+ method: z.ZodString;
2902
+ params: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
2903
+ }, z.core.$strip>;
2904
+ rawType: z.ZodString;
2905
+ }, z.core.$strip>>;
2906
+ parentRef: z.ZodOptional<z.ZodString>;
2907
+ streamKey: z.ZodString;
2908
+ text: z.ZodString;
2909
+ }, z.core.$strip>, z.ZodObject<{
2910
+ channel: z.ZodEnum<{
2911
+ assistant: "assistant";
2912
+ reasoning: "reasoning";
2913
+ }>;
2914
+ kind: z.ZodLiteral<"message.close">;
2915
+ noTurnFallback: z.ZodOptional<z.ZodObject<{
2916
+ raw: z.ZodObject<{
2917
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
2918
+ jsonrpc: z.ZodLiteral<"2.0">;
2919
+ method: z.ZodString;
2920
+ params: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
2921
+ }, z.core.$strip>;
2922
+ rawType: z.ZodString;
2923
+ }, z.core.$strip>>;
2924
+ parentRef: z.ZodOptional<z.ZodString>;
2925
+ streamKey: z.ZodOptional<z.ZodString>;
2926
+ text: z.ZodOptional<z.ZodString>;
2927
+ }, z.core.$strip>, z.ZodObject<{
2928
+ channel: z.ZodEnum<{
2929
+ agentMessage: "agentMessage";
2930
+ plan: "plan";
2931
+ reasoningSummary: "reasoningSummary";
2932
+ reasoningText: "reasoningText";
2933
+ }>;
2934
+ key: z.ZodObject<{
2935
+ channel: z.ZodOptional<z.ZodString>;
2936
+ parentRef: z.ZodOptional<z.ZodString>;
2937
+ providerItemId: z.ZodOptional<z.ZodString>;
2938
+ }, z.core.$strip>;
2939
+ kind: z.ZodLiteral<"item.textDelta">;
2940
+ noTurnFallback: z.ZodOptional<z.ZodObject<{
2941
+ raw: z.ZodObject<{
2942
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
2943
+ jsonrpc: z.ZodLiteral<"2.0">;
2944
+ method: z.ZodString;
2945
+ params: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
2946
+ }, z.core.$strip>;
2947
+ rawType: z.ZodString;
2948
+ }, z.core.$strip>>;
2949
+ providerTurnId: z.ZodOptional<z.ZodString>;
2950
+ text: z.ZodString;
2951
+ }, z.core.$strip>, z.ZodObject<{
2952
+ channel: z.ZodEnum<{
2953
+ command: "command";
2954
+ fileChange: "fileChange";
2955
+ }>;
2956
+ key: z.ZodObject<{
2957
+ channel: z.ZodOptional<z.ZodString>;
2958
+ parentRef: z.ZodOptional<z.ZodString>;
2959
+ providerItemId: z.ZodOptional<z.ZodString>;
2960
+ }, z.core.$strip>;
2961
+ kind: z.ZodLiteral<"item.outputDelta">;
2962
+ noTurnFallback: z.ZodOptional<z.ZodObject<{
2963
+ raw: z.ZodObject<{
2964
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
2965
+ jsonrpc: z.ZodLiteral<"2.0">;
2966
+ method: z.ZodString;
2967
+ params: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
2968
+ }, z.core.$strip>;
2969
+ rawType: z.ZodString;
2970
+ }, z.core.$strip>>;
2971
+ providerTurnId: z.ZodOptional<z.ZodString>;
2972
+ text: z.ZodString;
2973
+ }, z.core.$strip>, z.ZodObject<{
2974
+ key: z.ZodObject<{
2975
+ channel: z.ZodOptional<z.ZodString>;
2976
+ parentRef: z.ZodOptional<z.ZodString>;
2977
+ providerItemId: z.ZodOptional<z.ZodString>;
2978
+ }, z.core.$strip>;
2979
+ kind: z.ZodLiteral<"command.outputSnapshot">;
2980
+ noTurnFallback: z.ZodOptional<z.ZodObject<{
2981
+ raw: z.ZodObject<{
2982
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
2983
+ jsonrpc: z.ZodLiteral<"2.0">;
2984
+ method: z.ZodString;
2985
+ params: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
2986
+ }, z.core.$strip>;
2987
+ rawType: z.ZodString;
2988
+ }, z.core.$strip>>;
2989
+ text: z.ZodString;
2990
+ }, z.core.$strip>, z.ZodObject<{
2991
+ kind: z.ZodLiteral<"usage.turn">;
2992
+ modelContextWindow: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2993
+ tokens: z.ZodObject<{
2994
+ cachedInputTokens: z.ZodNumber;
2995
+ inputTokens: z.ZodNumber;
2996
+ outputTokens: z.ZodNumber;
2997
+ reasoningOutputTokens: z.ZodNumber;
2998
+ totalTokens: z.ZodNumber;
2999
+ }, z.core.$strip>;
3000
+ }, z.core.$strip>, z.ZodObject<{
3001
+ kind: z.ZodLiteral<"usage.exact">;
3002
+ last: z.ZodObject<{
3003
+ cachedInputTokens: z.ZodNumber;
3004
+ inputTokens: z.ZodNumber;
3005
+ outputTokens: z.ZodNumber;
3006
+ reasoningOutputTokens: z.ZodNumber;
3007
+ totalTokens: z.ZodNumber;
3008
+ }, z.core.$strip>;
3009
+ modelContextWindow: z.ZodNullable<z.ZodNumber>;
3010
+ providerTurnId: z.ZodOptional<z.ZodString>;
3011
+ total: z.ZodObject<{
3012
+ cachedInputTokens: z.ZodNumber;
3013
+ inputTokens: z.ZodNumber;
3014
+ outputTokens: z.ZodNumber;
3015
+ reasoningOutputTokens: z.ZodNumber;
3016
+ totalTokens: z.ZodNumber;
3017
+ }, z.core.$strip>;
3018
+ }, z.core.$strip>, z.ZodObject<{
3019
+ attach: z.ZodEnum<{
3020
+ currentOrLast: "currentOrLast";
3021
+ open: "open";
3022
+ }>;
3023
+ estimated: z.ZodBoolean;
3024
+ kind: z.ZodLiteral<"contextWindow">;
3025
+ size: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
3026
+ used: z.ZodNullable<z.ZodNumber>;
3027
+ }, z.core.$strip>, z.ZodObject<{
3028
+ kind: z.ZodLiteral<"context.compacted">;
3029
+ noTurnFallback: z.ZodOptional<z.ZodObject<{
3030
+ raw: z.ZodObject<{
3031
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
3032
+ jsonrpc: z.ZodLiteral<"2.0">;
3033
+ method: z.ZodString;
3034
+ params: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
3035
+ }, z.core.$strip>;
3036
+ rawType: z.ZodString;
3037
+ }, z.core.$strip>>;
3038
+ providerTurnId: z.ZodOptional<z.ZodString>;
3039
+ }, z.core.$strip>, z.ZodObject<{
3040
+ kind: z.ZodLiteral<"context.cleared">;
3041
+ }, z.core.$strip>, z.ZodObject<{
3042
+ diff: z.ZodString;
3043
+ kind: z.ZodLiteral<"turn.diff">;
3044
+ providerTurnId: z.ZodOptional<z.ZodString>;
3045
+ }, z.core.$strip>, z.ZodObject<{
3046
+ kind: z.ZodLiteral<"thread.started">;
3047
+ }, z.core.$strip>, z.ZodObject<{
3048
+ kind: z.ZodLiteral<"thread.identity">;
3049
+ providerThreadId: z.ZodString;
3050
+ }, z.core.$strip>, z.ZodObject<{
3051
+ kind: z.ZodLiteral<"thread.name">;
3052
+ name: z.ZodString;
3053
+ }, z.core.$strip>, z.ZodObject<{
3054
+ kind: z.ZodLiteral<"thread.goal">;
3055
+ objective: z.ZodString;
3056
+ status: z.ZodEnum<{
3057
+ active: "active";
3058
+ budgetLimited: "budgetLimited";
3059
+ complete: "complete";
3060
+ paused: "paused";
3061
+ }>;
3062
+ timeUsedSeconds: z.ZodNumber;
3063
+ tokenBudget: z.ZodNullable<z.ZodNumber>;
3064
+ tokensUsed: z.ZodNumber;
3065
+ }, z.core.$strip>, z.ZodObject<{
3066
+ kind: z.ZodLiteral<"thread.goalCleared">;
3067
+ }, z.core.$strip>, z.ZodObject<{
3068
+ kind: z.ZodLiteral<"provider.rateLimits">;
3069
+ rateLimits: z.ZodObject<{
3070
+ kind: z.ZodEnum<{
3071
+ "spend-control": "spend-control";
3072
+ "subscription-window": "subscription-window";
3073
+ credits: "credits";
3074
+ unknown: "unknown";
3075
+ }>;
3076
+ overageReason: z.ZodNullable<z.ZodString>;
3077
+ overageStatus: z.ZodNullable<z.ZodEnum<{
3078
+ allowed: "allowed";
3079
+ rejected: "rejected";
3080
+ unavailable: "unavailable";
3081
+ warning: "warning";
3082
+ }>>;
3083
+ providerId: z.ZodString;
3084
+ reachedReason: z.ZodNullable<z.ZodString>;
3085
+ status: z.ZodEnum<{
3086
+ allowed: "allowed";
3087
+ blocked: "blocked";
3088
+ unknown: "unknown";
3089
+ warning: "warning";
3090
+ }>;
3091
+ windows: z.ZodArray<z.ZodObject<{
3092
+ label: z.ZodNullable<z.ZodString>;
3093
+ providerKey: z.ZodNullable<z.ZodString>;
3094
+ resetsAtMs: z.ZodNullable<z.ZodNumber>;
3095
+ status: z.ZodEnum<{
3096
+ allowed: "allowed";
3097
+ blocked: "blocked";
3098
+ unknown: "unknown";
3099
+ warning: "warning";
3100
+ }>;
3101
+ }, z.core.$strip>>;
3102
+ }, z.core.$strip>;
3103
+ }, z.core.$strip>, z.ZodObject<{
3104
+ category: z.ZodOptional<z.ZodEnum<{
3105
+ "active-turn-not-steerable": "active-turn-not-steerable";
3106
+ "bad-request": "bad-request";
3107
+ "budget-exceeded": "budget-exceeded";
3108
+ "connection-failed": "connection-failed";
3109
+ "context-window-exceeded": "context-window-exceeded";
3110
+ "max-output-tokens": "max-output-tokens";
3111
+ "max-turns": "max-turns";
3112
+ "rate-limit": "rate-limit";
3113
+ "stream-disconnected": "stream-disconnected";
3114
+ "structured-output-retries": "structured-output-retries";
3115
+ "thread-rollback-failed": "thread-rollback-failed";
3116
+ "too-many-failed-attempts": "too-many-failed-attempts";
3117
+ billing: "billing";
3118
+ internal: "internal";
3119
+ overloaded: "overloaded";
3120
+ policy: "policy";
3121
+ sandbox: "sandbox";
3122
+ unauthorized: "unauthorized";
3123
+ unknown: "unknown";
3124
+ }>>;
3125
+ detail: z.ZodOptional<z.ZodString>;
3126
+ errorInfo: z.ZodOptional<z.ZodObject<{
3127
+ category: z.ZodEnum<{
3128
+ "active-turn-not-steerable": "active-turn-not-steerable";
3129
+ "bad-request": "bad-request";
3130
+ "budget-exceeded": "budget-exceeded";
3131
+ "connection-failed": "connection-failed";
3132
+ "context-window-exceeded": "context-window-exceeded";
3133
+ "max-output-tokens": "max-output-tokens";
3134
+ "max-turns": "max-turns";
3135
+ "rate-limit": "rate-limit";
3136
+ "stream-disconnected": "stream-disconnected";
3137
+ "structured-output-retries": "structured-output-retries";
3138
+ "thread-rollback-failed": "thread-rollback-failed";
3139
+ "too-many-failed-attempts": "too-many-failed-attempts";
3140
+ billing: "billing";
3141
+ internal: "internal";
3142
+ overloaded: "overloaded";
3143
+ policy: "policy";
3144
+ sandbox: "sandbox";
3145
+ unauthorized: "unauthorized";
3146
+ unknown: "unknown";
3147
+ }>;
3148
+ httpStatusCode: z.ZodNullable<z.ZodNumber>;
3149
+ providerCode: z.ZodNullable<z.ZodString>;
3150
+ }, z.core.$strip>>;
3151
+ kind: z.ZodLiteral<"provider.error">;
3152
+ message: z.ZodString;
3153
+ providerTurnId: z.ZodOptional<z.ZodString>;
3154
+ settlesTurn: z.ZodOptional<z.ZodBoolean>;
3155
+ threadScoped: z.ZodOptional<z.ZodBoolean>;
3156
+ willRetry: z.ZodOptional<z.ZodBoolean>;
3157
+ }, z.core.$strip>, z.ZodObject<{
3158
+ fallbackModel: z.ZodString;
3159
+ kind: z.ZodLiteral<"provider.modelFallback">;
3160
+ message: z.ZodString;
3161
+ originalModel: z.ZodString;
3162
+ reason: z.ZodEnum<{
3163
+ provider: "provider";
3164
+ refusal: "refusal";
3165
+ }>;
3166
+ }, z.core.$strip>, z.ZodObject<{
3167
+ category: z.ZodOptional<z.ZodEnum<{
3168
+ "compaction-skipped": "compaction-skipped";
3169
+ config: "config";
3170
+ deprecation: "deprecation";
3171
+ general: "general";
3172
+ }>>;
3173
+ details: z.ZodOptional<z.ZodString>;
3174
+ kind: z.ZodLiteral<"provider.warning">;
3175
+ summary: z.ZodOptional<z.ZodString>;
3176
+ vouchedTurn: z.ZodOptional<z.ZodBoolean>;
3177
+ }, z.core.$strip>, z.ZodObject<{
3178
+ kind: z.ZodLiteral<"unhandled">;
3179
+ onlyIfNoTurn: z.ZodOptional<z.ZodBoolean>;
3180
+ parentRef: z.ZodOptional<z.ZodString>;
3181
+ providerTurnId: z.ZodOptional<z.ZodString>;
3182
+ raw: z.ZodObject<{
3183
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
3184
+ jsonrpc: z.ZodLiteral<"2.0">;
3185
+ method: z.ZodString;
3186
+ params: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
3187
+ }, z.core.$strip>;
3188
+ rawType: z.ZodString;
3189
+ vouchedTurn: z.ZodBoolean;
3190
+ }, z.core.$strip>, z.ZodObject<{
3191
+ kind: z.ZodLiteral<"session.ended">;
3192
+ }, z.core.$strip>, z.ZodObject<{
3193
+ kind: z.ZodLiteral<"session.reset">;
3194
+ }, z.core.$strip>], "kind">;
3195
+ type ThreadDelta = z.infer<typeof threadDeltaSchema>;
3196
+ type ThreadDeltaKind = ThreadDelta["kind"];
3197
+ /** `thread/delta` notification params: batched deltas for one thread. */
3198
+ declare const threadDeltaNotificationParamsSchema: z.ZodObject<{
3199
+ deltas: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
3200
+ clientRequestId: z.ZodString;
3201
+ kind: z.ZodLiteral<"input.accepted">;
3202
+ providerTurnId: z.ZodOptional<z.ZodString>;
3203
+ }, z.core.$strip>, z.ZodObject<{
3204
+ kind: z.ZodLiteral<"turn.open">;
3205
+ parentRef: z.ZodOptional<z.ZodString>;
3206
+ providerTurnId: z.ZodOptional<z.ZodString>;
3207
+ }, z.core.$strip>, z.ZodObject<{
3208
+ claimIfIdle: z.ZodOptional<z.ZodBoolean>;
3209
+ error: z.ZodOptional<z.ZodObject<{
3210
+ message: z.ZodString;
3211
+ }, z.core.$strip>>;
3212
+ kind: z.ZodLiteral<"turn.boundary">;
3213
+ providerCheckpointId: z.ZodOptional<z.ZodString>;
3214
+ providerTurnId: z.ZodOptional<z.ZodString>;
3215
+ status: z.ZodEnum<{
3216
+ completed: "completed";
3217
+ failed: "failed";
3218
+ interrupted: "interrupted";
3219
+ }>;
3220
+ }, z.core.$strip>, z.ZodObject<{
3221
+ attach: z.ZodOptional<z.ZodEnum<{
3222
+ currentOrLast: "currentOrLast";
3223
+ open: "open";
3224
+ }>>;
3225
+ item: z.ZodDiscriminatedUnion<[z.ZodObject<{
3226
+ aggregatedOutput: z.ZodOptional<z.ZodString>;
3227
+ command: z.ZodString;
3228
+ cwd: z.ZodString;
3229
+ durationMs: z.ZodOptional<z.ZodNumber>;
3230
+ exitCode: z.ZodOptional<z.ZodNumber>;
3231
+ type: z.ZodLiteral<"command">;
3232
+ }, z.core.$strip>, z.ZodObject<{
3233
+ changes: z.ZodArray<z.ZodObject<{
3234
+ diff: z.ZodOptional<z.ZodString>;
3235
+ kind: z.ZodEnum<{
3236
+ add: "add";
3237
+ delete: "delete";
3238
+ update: "update";
3239
+ }>;
3240
+ movePath: z.ZodOptional<z.ZodString>;
3241
+ newText: z.ZodOptional<z.ZodString>;
3242
+ oldText: z.ZodOptional<z.ZodString>;
3243
+ path: z.ZodString;
3244
+ }, z.core.$strip>>;
3245
+ type: z.ZodLiteral<"fileChange">;
3246
+ }, z.core.$strip>, z.ZodObject<{
3247
+ args: z.ZodOptional<z.ZodUnknown>;
3248
+ durationMs: z.ZodOptional<z.ZodNumber>;
3249
+ error: z.ZodOptional<z.ZodString>;
3250
+ result: z.ZodOptional<z.ZodUnknown>;
3251
+ server: z.ZodOptional<z.ZodString>;
3252
+ tool: z.ZodString;
3253
+ type: z.ZodLiteral<"tool">;
3254
+ }, z.core.$strip>, z.ZodObject<{
3255
+ type: z.ZodLiteral<"compaction">;
3256
+ }, z.core.$strip>, z.ZodObject<{
3257
+ text: z.ZodString;
3258
+ type: z.ZodLiteral<"agentMessage">;
3259
+ }, z.core.$strip>, z.ZodObject<{
3260
+ content: z.ZodArray<z.ZodString>;
3261
+ summary: z.ZodArray<z.ZodString>;
3262
+ type: z.ZodLiteral<"reasoning">;
3263
+ }, z.core.$strip>, z.ZodObject<{
3264
+ text: z.ZodString;
3265
+ type: z.ZodLiteral<"plan">;
3266
+ }, z.core.$strip>, z.ZodObject<{
3267
+ queries: z.ZodArray<z.ZodString>;
3268
+ type: z.ZodLiteral<"webSearch">;
3269
+ }, z.core.$strip>, z.ZodObject<{
3270
+ pattern: z.ZodNullable<z.ZodString>;
3271
+ prompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3272
+ type: z.ZodLiteral<"webFetch">;
3273
+ url: z.ZodString;
3274
+ }, z.core.$strip>, z.ZodObject<{
3275
+ path: z.ZodString;
3276
+ type: z.ZodLiteral<"imageView">;
3277
+ }, z.core.$strip>, z.ZodObject<{
3278
+ description: z.ZodString;
3279
+ error: z.ZodOptional<z.ZodString>;
3280
+ familyId: z.ZodString;
3281
+ outputFile: z.ZodOptional<z.ZodString>;
3282
+ skipTranscript: z.ZodBoolean;
3283
+ status: z.ZodEnum<{
3284
+ completed: "completed";
3285
+ failed: "failed";
3286
+ interrupted: "interrupted";
3287
+ pending: "pending";
3288
+ }>;
3289
+ summary: z.ZodOptional<z.ZodString>;
3290
+ taskStatus: z.ZodEnum<{
3291
+ completed: "completed";
3292
+ failed: "failed";
3293
+ killed: "killed";
3294
+ paused: "paused";
3295
+ pending: "pending";
3296
+ running: "running";
3297
+ stopped: "stopped";
3298
+ }>;
3299
+ taskType: z.ZodString;
3300
+ type: z.ZodLiteral<"backgroundTask">;
3301
+ usage: z.ZodOptional<z.ZodObject<{
3302
+ durationMs: z.ZodNumber;
3303
+ toolUses: z.ZodNumber;
3304
+ totalTokens: z.ZodNumber;
3305
+ }, z.core.$strip>>;
3306
+ workflow: z.ZodOptional<z.ZodObject<{
3307
+ agents: z.ZodArray<z.ZodObject<{
3308
+ agentType: z.ZodOptional<z.ZodString>;
3309
+ attempt: z.ZodNumber;
3310
+ cached: z.ZodBoolean;
3311
+ durationMs: z.ZodOptional<z.ZodNumber>;
3312
+ error: z.ZodOptional<z.ZodString>;
3313
+ index: z.ZodNumber;
3314
+ isolation: z.ZodOptional<z.ZodString>;
3315
+ label: z.ZodString;
3316
+ lastProgressAt: z.ZodNumber;
3317
+ lastToolName: z.ZodOptional<z.ZodString>;
3318
+ lastToolSummary: z.ZodOptional<z.ZodString>;
3319
+ model: z.ZodString;
3320
+ phaseIndex: z.ZodOptional<z.ZodNumber>;
3321
+ phaseTitle: z.ZodOptional<z.ZodString>;
3322
+ promptPreview: z.ZodOptional<z.ZodString>;
3323
+ queuedAt: z.ZodOptional<z.ZodNumber>;
3324
+ resultPreview: z.ZodOptional<z.ZodString>;
3325
+ startedAt: z.ZodOptional<z.ZodNumber>;
3326
+ state: z.ZodEnum<{
3327
+ done: "done";
3328
+ failed: "failed";
3329
+ queued: "queued";
3330
+ running: "running";
3331
+ skipped: "skipped";
3332
+ }>;
3333
+ tokens: z.ZodOptional<z.ZodNumber>;
3334
+ toolCalls: z.ZodOptional<z.ZodNumber>;
3335
+ }, z.core.$strip>>;
3336
+ phases: z.ZodArray<z.ZodObject<{
3337
+ index: z.ZodNumber;
3338
+ kind: z.ZodOptional<z.ZodString>;
3339
+ title: z.ZodString;
3340
+ }, z.core.$strip>>;
3341
+ }, z.core.$strip>>;
3342
+ workflowName: z.ZodOptional<z.ZodString>;
3343
+ }, z.core.$strip>], "type">;
3344
+ key: z.ZodObject<{
3345
+ channel: z.ZodOptional<z.ZodString>;
3346
+ parentRef: z.ZodOptional<z.ZodString>;
3347
+ providerItemId: z.ZodOptional<z.ZodString>;
3348
+ }, z.core.$strip>;
3349
+ kind: z.ZodLiteral<"item.open">;
3350
+ noTurnFallback: z.ZodOptional<z.ZodObject<{
3351
+ raw: z.ZodObject<{
3352
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
3353
+ jsonrpc: z.ZodLiteral<"2.0">;
3354
+ method: z.ZodString;
3355
+ params: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
3356
+ }, z.core.$strip>;
3357
+ rawType: z.ZodString;
3358
+ }, z.core.$strip>>;
3359
+ providerTurnId: z.ZodOptional<z.ZodString>;
3360
+ }, z.core.$strip>, z.ZodObject<{
3361
+ aggregatedOutput: z.ZodOptional<z.ZodString>;
3362
+ approvalStatus: z.ZodOptional<z.ZodLiteral<"denied">>;
3363
+ exitCode: z.ZodOptional<z.ZodNumber>;
3364
+ item: z.ZodDiscriminatedUnion<[z.ZodObject<{
3365
+ aggregatedOutput: z.ZodOptional<z.ZodString>;
3366
+ command: z.ZodString;
3367
+ cwd: z.ZodString;
3368
+ durationMs: z.ZodOptional<z.ZodNumber>;
3369
+ exitCode: z.ZodOptional<z.ZodNumber>;
3370
+ type: z.ZodLiteral<"command">;
3371
+ }, z.core.$strip>, z.ZodObject<{
3372
+ changes: z.ZodArray<z.ZodObject<{
3373
+ diff: z.ZodOptional<z.ZodString>;
3374
+ kind: z.ZodEnum<{
3375
+ add: "add";
3376
+ delete: "delete";
3377
+ update: "update";
3378
+ }>;
3379
+ movePath: z.ZodOptional<z.ZodString>;
3380
+ newText: z.ZodOptional<z.ZodString>;
3381
+ oldText: z.ZodOptional<z.ZodString>;
3382
+ path: z.ZodString;
3383
+ }, z.core.$strip>>;
3384
+ type: z.ZodLiteral<"fileChange">;
3385
+ }, z.core.$strip>, z.ZodObject<{
3386
+ args: z.ZodOptional<z.ZodUnknown>;
3387
+ durationMs: z.ZodOptional<z.ZodNumber>;
3388
+ error: z.ZodOptional<z.ZodString>;
3389
+ result: z.ZodOptional<z.ZodUnknown>;
3390
+ server: z.ZodOptional<z.ZodString>;
3391
+ tool: z.ZodString;
3392
+ type: z.ZodLiteral<"tool">;
3393
+ }, z.core.$strip>, z.ZodObject<{
3394
+ type: z.ZodLiteral<"compaction">;
3395
+ }, z.core.$strip>, z.ZodObject<{
3396
+ text: z.ZodString;
3397
+ type: z.ZodLiteral<"agentMessage">;
3398
+ }, z.core.$strip>, z.ZodObject<{
3399
+ content: z.ZodArray<z.ZodString>;
3400
+ summary: z.ZodArray<z.ZodString>;
3401
+ type: z.ZodLiteral<"reasoning">;
3402
+ }, z.core.$strip>, z.ZodObject<{
3403
+ text: z.ZodString;
3404
+ type: z.ZodLiteral<"plan">;
3405
+ }, z.core.$strip>, z.ZodObject<{
3406
+ queries: z.ZodArray<z.ZodString>;
3407
+ type: z.ZodLiteral<"webSearch">;
3408
+ }, z.core.$strip>, z.ZodObject<{
3409
+ pattern: z.ZodNullable<z.ZodString>;
3410
+ prompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3411
+ type: z.ZodLiteral<"webFetch">;
3412
+ url: z.ZodString;
3413
+ }, z.core.$strip>, z.ZodObject<{
3414
+ path: z.ZodString;
3415
+ type: z.ZodLiteral<"imageView">;
3416
+ }, z.core.$strip>, z.ZodObject<{
3417
+ description: z.ZodString;
3418
+ error: z.ZodOptional<z.ZodString>;
3419
+ familyId: z.ZodString;
3420
+ outputFile: z.ZodOptional<z.ZodString>;
3421
+ skipTranscript: z.ZodBoolean;
3422
+ status: z.ZodEnum<{
3423
+ completed: "completed";
3424
+ failed: "failed";
3425
+ interrupted: "interrupted";
3426
+ pending: "pending";
3427
+ }>;
3428
+ summary: z.ZodOptional<z.ZodString>;
3429
+ taskStatus: z.ZodEnum<{
3430
+ completed: "completed";
3431
+ failed: "failed";
3432
+ killed: "killed";
3433
+ paused: "paused";
3434
+ pending: "pending";
3435
+ running: "running";
3436
+ stopped: "stopped";
3437
+ }>;
3438
+ taskType: z.ZodString;
3439
+ type: z.ZodLiteral<"backgroundTask">;
3440
+ usage: z.ZodOptional<z.ZodObject<{
3441
+ durationMs: z.ZodNumber;
3442
+ toolUses: z.ZodNumber;
3443
+ totalTokens: z.ZodNumber;
3444
+ }, z.core.$strip>>;
3445
+ workflow: z.ZodOptional<z.ZodObject<{
3446
+ agents: z.ZodArray<z.ZodObject<{
3447
+ agentType: z.ZodOptional<z.ZodString>;
3448
+ attempt: z.ZodNumber;
3449
+ cached: z.ZodBoolean;
3450
+ durationMs: z.ZodOptional<z.ZodNumber>;
3451
+ error: z.ZodOptional<z.ZodString>;
3452
+ index: z.ZodNumber;
3453
+ isolation: z.ZodOptional<z.ZodString>;
3454
+ label: z.ZodString;
3455
+ lastProgressAt: z.ZodNumber;
3456
+ lastToolName: z.ZodOptional<z.ZodString>;
3457
+ lastToolSummary: z.ZodOptional<z.ZodString>;
3458
+ model: z.ZodString;
3459
+ phaseIndex: z.ZodOptional<z.ZodNumber>;
3460
+ phaseTitle: z.ZodOptional<z.ZodString>;
3461
+ promptPreview: z.ZodOptional<z.ZodString>;
3462
+ queuedAt: z.ZodOptional<z.ZodNumber>;
3463
+ resultPreview: z.ZodOptional<z.ZodString>;
3464
+ startedAt: z.ZodOptional<z.ZodNumber>;
3465
+ state: z.ZodEnum<{
3466
+ done: "done";
3467
+ failed: "failed";
3468
+ queued: "queued";
3469
+ running: "running";
3470
+ skipped: "skipped";
3471
+ }>;
3472
+ tokens: z.ZodOptional<z.ZodNumber>;
3473
+ toolCalls: z.ZodOptional<z.ZodNumber>;
3474
+ }, z.core.$strip>>;
3475
+ phases: z.ZodArray<z.ZodObject<{
3476
+ index: z.ZodNumber;
3477
+ kind: z.ZodOptional<z.ZodString>;
3478
+ title: z.ZodString;
3479
+ }, z.core.$strip>>;
3480
+ }, z.core.$strip>>;
3481
+ workflowName: z.ZodOptional<z.ZodString>;
3482
+ }, z.core.$strip>], "type">;
3483
+ key: z.ZodObject<{
3484
+ channel: z.ZodOptional<z.ZodString>;
3485
+ parentRef: z.ZodOptional<z.ZodString>;
3486
+ providerItemId: z.ZodOptional<z.ZodString>;
3487
+ }, z.core.$strip>;
3488
+ kind: z.ZodLiteral<"item.close">;
3489
+ noTurnFallback: z.ZodOptional<z.ZodObject<{
3490
+ raw: z.ZodObject<{
3491
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
3492
+ jsonrpc: z.ZodLiteral<"2.0">;
3493
+ method: z.ZodString;
3494
+ params: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
3495
+ }, z.core.$strip>;
3496
+ rawType: z.ZodString;
3497
+ }, z.core.$strip>>;
3498
+ providerTurnId: z.ZodOptional<z.ZodString>;
3499
+ resultText: z.ZodOptional<z.ZodString>;
3500
+ status: z.ZodEnum<{
3501
+ completed: "completed";
3502
+ failed: "failed";
3503
+ interrupted: "interrupted";
3504
+ pending: "pending";
3505
+ }>;
3506
+ }, z.core.$strip>, z.ZodObject<{
3507
+ explanation: z.ZodOptional<z.ZodString>;
3508
+ kind: z.ZodLiteral<"turn.plan">;
3509
+ noTurnFallback: z.ZodOptional<z.ZodObject<{
3510
+ raw: z.ZodObject<{
3511
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
3512
+ jsonrpc: z.ZodLiteral<"2.0">;
3513
+ method: z.ZodString;
3514
+ params: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
3515
+ }, z.core.$strip>;
3516
+ rawType: z.ZodString;
3517
+ }, z.core.$strip>>;
3518
+ providerTurnId: z.ZodOptional<z.ZodString>;
3519
+ steps: z.ZodArray<z.ZodObject<{
3520
+ status: z.ZodOptional<z.ZodEnum<{
3521
+ active: "active";
3522
+ completed: "completed";
3523
+ failed: "failed";
3524
+ pending: "pending";
3525
+ }>>;
3526
+ step: z.ZodString;
3527
+ }, z.core.$strip>>;
3528
+ }, z.core.$strip>, z.ZodObject<{
3529
+ flush: z.ZodOptional<z.ZodBoolean>;
3530
+ key: z.ZodObject<{
3531
+ channel: z.ZodOptional<z.ZodString>;
3532
+ parentRef: z.ZodOptional<z.ZodString>;
3533
+ providerItemId: z.ZodOptional<z.ZodString>;
3534
+ }, z.core.$strip>;
3535
+ kind: z.ZodLiteral<"item.progress">;
3536
+ message: z.ZodOptional<z.ZodString>;
3537
+ noTurnFallback: z.ZodOptional<z.ZodObject<{
3538
+ raw: z.ZodObject<{
3539
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
3540
+ jsonrpc: z.ZodLiteral<"2.0">;
3541
+ method: z.ZodString;
3542
+ params: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
3543
+ }, z.core.$strip>;
3544
+ rawType: z.ZodString;
3545
+ }, z.core.$strip>>;
3546
+ providerTurnId: z.ZodOptional<z.ZodString>;
3547
+ snapshot: z.ZodOptional<z.ZodObject<{
3548
+ description: z.ZodString;
3549
+ error: z.ZodOptional<z.ZodString>;
3550
+ familyId: z.ZodString;
3551
+ outputFile: z.ZodOptional<z.ZodString>;
3552
+ skipTranscript: z.ZodBoolean;
3553
+ status: z.ZodEnum<{
3554
+ completed: "completed";
3555
+ failed: "failed";
3556
+ interrupted: "interrupted";
3557
+ pending: "pending";
3558
+ }>;
3559
+ summary: z.ZodOptional<z.ZodString>;
3560
+ taskStatus: z.ZodEnum<{
3561
+ completed: "completed";
3562
+ failed: "failed";
3563
+ killed: "killed";
3564
+ paused: "paused";
3565
+ pending: "pending";
3566
+ running: "running";
3567
+ stopped: "stopped";
3568
+ }>;
3569
+ taskType: z.ZodString;
3570
+ type: z.ZodLiteral<"backgroundTask">;
3571
+ usage: z.ZodOptional<z.ZodObject<{
3572
+ durationMs: z.ZodNumber;
3573
+ toolUses: z.ZodNumber;
3574
+ totalTokens: z.ZodNumber;
3575
+ }, z.core.$strip>>;
3576
+ workflow: z.ZodOptional<z.ZodObject<{
3577
+ agents: z.ZodArray<z.ZodObject<{
3578
+ agentType: z.ZodOptional<z.ZodString>;
3579
+ attempt: z.ZodNumber;
3580
+ cached: z.ZodBoolean;
3581
+ durationMs: z.ZodOptional<z.ZodNumber>;
3582
+ error: z.ZodOptional<z.ZodString>;
3583
+ index: z.ZodNumber;
3584
+ isolation: z.ZodOptional<z.ZodString>;
3585
+ label: z.ZodString;
3586
+ lastProgressAt: z.ZodNumber;
3587
+ lastToolName: z.ZodOptional<z.ZodString>;
3588
+ lastToolSummary: z.ZodOptional<z.ZodString>;
3589
+ model: z.ZodString;
3590
+ phaseIndex: z.ZodOptional<z.ZodNumber>;
3591
+ phaseTitle: z.ZodOptional<z.ZodString>;
3592
+ promptPreview: z.ZodOptional<z.ZodString>;
3593
+ queuedAt: z.ZodOptional<z.ZodNumber>;
3594
+ resultPreview: z.ZodOptional<z.ZodString>;
3595
+ startedAt: z.ZodOptional<z.ZodNumber>;
3596
+ state: z.ZodEnum<{
3597
+ done: "done";
3598
+ failed: "failed";
3599
+ queued: "queued";
3600
+ running: "running";
3601
+ skipped: "skipped";
3602
+ }>;
3603
+ tokens: z.ZodOptional<z.ZodNumber>;
3604
+ toolCalls: z.ZodOptional<z.ZodNumber>;
3605
+ }, z.core.$strip>>;
3606
+ phases: z.ZodArray<z.ZodObject<{
3607
+ index: z.ZodNumber;
3608
+ kind: z.ZodOptional<z.ZodString>;
3609
+ title: z.ZodString;
3610
+ }, z.core.$strip>>;
3611
+ }, z.core.$strip>>;
3612
+ workflowName: z.ZodOptional<z.ZodString>;
3613
+ }, z.core.$strip>>;
3614
+ }, z.core.$strip>, z.ZodObject<{
3615
+ channel: z.ZodEnum<{
3616
+ assistant: "assistant";
3617
+ reasoning: "reasoning";
3618
+ }>;
3619
+ kind: z.ZodLiteral<"message.delta">;
3620
+ noTurnFallback: z.ZodOptional<z.ZodObject<{
3621
+ raw: z.ZodObject<{
3622
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
3623
+ jsonrpc: z.ZodLiteral<"2.0">;
3624
+ method: z.ZodString;
3625
+ params: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
3626
+ }, z.core.$strip>;
3627
+ rawType: z.ZodString;
3628
+ }, z.core.$strip>>;
3629
+ parentRef: z.ZodOptional<z.ZodString>;
3630
+ streamKey: z.ZodString;
3631
+ text: z.ZodString;
3632
+ }, z.core.$strip>, z.ZodObject<{
3633
+ channel: z.ZodEnum<{
3634
+ assistant: "assistant";
3635
+ reasoning: "reasoning";
3636
+ }>;
3637
+ kind: z.ZodLiteral<"message.close">;
3638
+ noTurnFallback: z.ZodOptional<z.ZodObject<{
3639
+ raw: z.ZodObject<{
3640
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
3641
+ jsonrpc: z.ZodLiteral<"2.0">;
3642
+ method: z.ZodString;
3643
+ params: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
3644
+ }, z.core.$strip>;
3645
+ rawType: z.ZodString;
3646
+ }, z.core.$strip>>;
3647
+ parentRef: z.ZodOptional<z.ZodString>;
3648
+ streamKey: z.ZodOptional<z.ZodString>;
3649
+ text: z.ZodOptional<z.ZodString>;
3650
+ }, z.core.$strip>, z.ZodObject<{
3651
+ channel: z.ZodEnum<{
3652
+ agentMessage: "agentMessage";
3653
+ plan: "plan";
3654
+ reasoningSummary: "reasoningSummary";
3655
+ reasoningText: "reasoningText";
3656
+ }>;
3657
+ key: z.ZodObject<{
3658
+ channel: z.ZodOptional<z.ZodString>;
3659
+ parentRef: z.ZodOptional<z.ZodString>;
3660
+ providerItemId: z.ZodOptional<z.ZodString>;
3661
+ }, z.core.$strip>;
3662
+ kind: z.ZodLiteral<"item.textDelta">;
3663
+ noTurnFallback: z.ZodOptional<z.ZodObject<{
3664
+ raw: z.ZodObject<{
3665
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
3666
+ jsonrpc: z.ZodLiteral<"2.0">;
3667
+ method: z.ZodString;
3668
+ params: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
3669
+ }, z.core.$strip>;
3670
+ rawType: z.ZodString;
3671
+ }, z.core.$strip>>;
3672
+ providerTurnId: z.ZodOptional<z.ZodString>;
3673
+ text: z.ZodString;
3674
+ }, z.core.$strip>, z.ZodObject<{
3675
+ channel: z.ZodEnum<{
3676
+ command: "command";
3677
+ fileChange: "fileChange";
3678
+ }>;
3679
+ key: z.ZodObject<{
3680
+ channel: z.ZodOptional<z.ZodString>;
3681
+ parentRef: z.ZodOptional<z.ZodString>;
3682
+ providerItemId: z.ZodOptional<z.ZodString>;
3683
+ }, z.core.$strip>;
3684
+ kind: z.ZodLiteral<"item.outputDelta">;
3685
+ noTurnFallback: z.ZodOptional<z.ZodObject<{
3686
+ raw: z.ZodObject<{
3687
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
3688
+ jsonrpc: z.ZodLiteral<"2.0">;
3689
+ method: z.ZodString;
3690
+ params: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
3691
+ }, z.core.$strip>;
3692
+ rawType: z.ZodString;
3693
+ }, z.core.$strip>>;
3694
+ providerTurnId: z.ZodOptional<z.ZodString>;
3695
+ text: z.ZodString;
3696
+ }, z.core.$strip>, z.ZodObject<{
3697
+ key: z.ZodObject<{
3698
+ channel: z.ZodOptional<z.ZodString>;
3699
+ parentRef: z.ZodOptional<z.ZodString>;
3700
+ providerItemId: z.ZodOptional<z.ZodString>;
3701
+ }, z.core.$strip>;
3702
+ kind: z.ZodLiteral<"command.outputSnapshot">;
3703
+ noTurnFallback: z.ZodOptional<z.ZodObject<{
3704
+ raw: z.ZodObject<{
3705
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
3706
+ jsonrpc: z.ZodLiteral<"2.0">;
3707
+ method: z.ZodString;
3708
+ params: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
3709
+ }, z.core.$strip>;
3710
+ rawType: z.ZodString;
3711
+ }, z.core.$strip>>;
3712
+ text: z.ZodString;
3713
+ }, z.core.$strip>, z.ZodObject<{
3714
+ kind: z.ZodLiteral<"usage.turn">;
3715
+ modelContextWindow: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
3716
+ tokens: z.ZodObject<{
3717
+ cachedInputTokens: z.ZodNumber;
3718
+ inputTokens: z.ZodNumber;
3719
+ outputTokens: z.ZodNumber;
3720
+ reasoningOutputTokens: z.ZodNumber;
3721
+ totalTokens: z.ZodNumber;
3722
+ }, z.core.$strip>;
3723
+ }, z.core.$strip>, z.ZodObject<{
3724
+ kind: z.ZodLiteral<"usage.exact">;
3725
+ last: z.ZodObject<{
3726
+ cachedInputTokens: z.ZodNumber;
3727
+ inputTokens: z.ZodNumber;
3728
+ outputTokens: z.ZodNumber;
3729
+ reasoningOutputTokens: z.ZodNumber;
3730
+ totalTokens: z.ZodNumber;
3731
+ }, z.core.$strip>;
3732
+ modelContextWindow: z.ZodNullable<z.ZodNumber>;
3733
+ providerTurnId: z.ZodOptional<z.ZodString>;
3734
+ total: z.ZodObject<{
3735
+ cachedInputTokens: z.ZodNumber;
3736
+ inputTokens: z.ZodNumber;
3737
+ outputTokens: z.ZodNumber;
3738
+ reasoningOutputTokens: z.ZodNumber;
3739
+ totalTokens: z.ZodNumber;
3740
+ }, z.core.$strip>;
3741
+ }, z.core.$strip>, z.ZodObject<{
3742
+ attach: z.ZodEnum<{
3743
+ currentOrLast: "currentOrLast";
3744
+ open: "open";
3745
+ }>;
3746
+ estimated: z.ZodBoolean;
3747
+ kind: z.ZodLiteral<"contextWindow">;
3748
+ size: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
3749
+ used: z.ZodNullable<z.ZodNumber>;
3750
+ }, z.core.$strip>, z.ZodObject<{
3751
+ kind: z.ZodLiteral<"context.compacted">;
3752
+ noTurnFallback: z.ZodOptional<z.ZodObject<{
3753
+ raw: z.ZodObject<{
3754
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
3755
+ jsonrpc: z.ZodLiteral<"2.0">;
3756
+ method: z.ZodString;
3757
+ params: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
3758
+ }, z.core.$strip>;
3759
+ rawType: z.ZodString;
3760
+ }, z.core.$strip>>;
3761
+ providerTurnId: z.ZodOptional<z.ZodString>;
3762
+ }, z.core.$strip>, z.ZodObject<{
3763
+ kind: z.ZodLiteral<"context.cleared">;
3764
+ }, z.core.$strip>, z.ZodObject<{
3765
+ diff: z.ZodString;
3766
+ kind: z.ZodLiteral<"turn.diff">;
3767
+ providerTurnId: z.ZodOptional<z.ZodString>;
3768
+ }, z.core.$strip>, z.ZodObject<{
3769
+ kind: z.ZodLiteral<"thread.started">;
3770
+ }, z.core.$strip>, z.ZodObject<{
3771
+ kind: z.ZodLiteral<"thread.identity">;
3772
+ providerThreadId: z.ZodString;
3773
+ }, z.core.$strip>, z.ZodObject<{
3774
+ kind: z.ZodLiteral<"thread.name">;
3775
+ name: z.ZodString;
3776
+ }, z.core.$strip>, z.ZodObject<{
3777
+ kind: z.ZodLiteral<"thread.goal">;
3778
+ objective: z.ZodString;
3779
+ status: z.ZodEnum<{
3780
+ active: "active";
3781
+ budgetLimited: "budgetLimited";
3782
+ complete: "complete";
3783
+ paused: "paused";
3784
+ }>;
3785
+ timeUsedSeconds: z.ZodNumber;
3786
+ tokenBudget: z.ZodNullable<z.ZodNumber>;
3787
+ tokensUsed: z.ZodNumber;
3788
+ }, z.core.$strip>, z.ZodObject<{
3789
+ kind: z.ZodLiteral<"thread.goalCleared">;
3790
+ }, z.core.$strip>, z.ZodObject<{
3791
+ kind: z.ZodLiteral<"provider.rateLimits">;
3792
+ rateLimits: z.ZodObject<{
3793
+ kind: z.ZodEnum<{
3794
+ "spend-control": "spend-control";
3795
+ "subscription-window": "subscription-window";
3796
+ credits: "credits";
3797
+ unknown: "unknown";
3798
+ }>;
3799
+ overageReason: z.ZodNullable<z.ZodString>;
3800
+ overageStatus: z.ZodNullable<z.ZodEnum<{
3801
+ allowed: "allowed";
3802
+ rejected: "rejected";
3803
+ unavailable: "unavailable";
3804
+ warning: "warning";
3805
+ }>>;
3806
+ providerId: z.ZodString;
3807
+ reachedReason: z.ZodNullable<z.ZodString>;
3808
+ status: z.ZodEnum<{
3809
+ allowed: "allowed";
3810
+ blocked: "blocked";
3811
+ unknown: "unknown";
3812
+ warning: "warning";
3813
+ }>;
3814
+ windows: z.ZodArray<z.ZodObject<{
3815
+ label: z.ZodNullable<z.ZodString>;
3816
+ providerKey: z.ZodNullable<z.ZodString>;
3817
+ resetsAtMs: z.ZodNullable<z.ZodNumber>;
3818
+ status: z.ZodEnum<{
3819
+ allowed: "allowed";
3820
+ blocked: "blocked";
3821
+ unknown: "unknown";
3822
+ warning: "warning";
3823
+ }>;
3824
+ }, z.core.$strip>>;
3825
+ }, z.core.$strip>;
3826
+ }, z.core.$strip>, z.ZodObject<{
3827
+ category: z.ZodOptional<z.ZodEnum<{
3828
+ "active-turn-not-steerable": "active-turn-not-steerable";
3829
+ "bad-request": "bad-request";
3830
+ "budget-exceeded": "budget-exceeded";
3831
+ "connection-failed": "connection-failed";
3832
+ "context-window-exceeded": "context-window-exceeded";
3833
+ "max-output-tokens": "max-output-tokens";
3834
+ "max-turns": "max-turns";
3835
+ "rate-limit": "rate-limit";
3836
+ "stream-disconnected": "stream-disconnected";
3837
+ "structured-output-retries": "structured-output-retries";
3838
+ "thread-rollback-failed": "thread-rollback-failed";
3839
+ "too-many-failed-attempts": "too-many-failed-attempts";
3840
+ billing: "billing";
3841
+ internal: "internal";
3842
+ overloaded: "overloaded";
3843
+ policy: "policy";
3844
+ sandbox: "sandbox";
3845
+ unauthorized: "unauthorized";
3846
+ unknown: "unknown";
3847
+ }>>;
3848
+ detail: z.ZodOptional<z.ZodString>;
3849
+ errorInfo: z.ZodOptional<z.ZodObject<{
3850
+ category: z.ZodEnum<{
3851
+ "active-turn-not-steerable": "active-turn-not-steerable";
3852
+ "bad-request": "bad-request";
3853
+ "budget-exceeded": "budget-exceeded";
3854
+ "connection-failed": "connection-failed";
3855
+ "context-window-exceeded": "context-window-exceeded";
3856
+ "max-output-tokens": "max-output-tokens";
3857
+ "max-turns": "max-turns";
3858
+ "rate-limit": "rate-limit";
3859
+ "stream-disconnected": "stream-disconnected";
3860
+ "structured-output-retries": "structured-output-retries";
3861
+ "thread-rollback-failed": "thread-rollback-failed";
3862
+ "too-many-failed-attempts": "too-many-failed-attempts";
3863
+ billing: "billing";
3864
+ internal: "internal";
3865
+ overloaded: "overloaded";
3866
+ policy: "policy";
3867
+ sandbox: "sandbox";
3868
+ unauthorized: "unauthorized";
3869
+ unknown: "unknown";
3870
+ }>;
3871
+ httpStatusCode: z.ZodNullable<z.ZodNumber>;
3872
+ providerCode: z.ZodNullable<z.ZodString>;
3873
+ }, z.core.$strip>>;
3874
+ kind: z.ZodLiteral<"provider.error">;
3875
+ message: z.ZodString;
3876
+ providerTurnId: z.ZodOptional<z.ZodString>;
3877
+ settlesTurn: z.ZodOptional<z.ZodBoolean>;
3878
+ threadScoped: z.ZodOptional<z.ZodBoolean>;
3879
+ willRetry: z.ZodOptional<z.ZodBoolean>;
3880
+ }, z.core.$strip>, z.ZodObject<{
3881
+ fallbackModel: z.ZodString;
3882
+ kind: z.ZodLiteral<"provider.modelFallback">;
3883
+ message: z.ZodString;
3884
+ originalModel: z.ZodString;
3885
+ reason: z.ZodEnum<{
3886
+ provider: "provider";
3887
+ refusal: "refusal";
3888
+ }>;
3889
+ }, z.core.$strip>, z.ZodObject<{
3890
+ category: z.ZodOptional<z.ZodEnum<{
3891
+ "compaction-skipped": "compaction-skipped";
3892
+ config: "config";
3893
+ deprecation: "deprecation";
3894
+ general: "general";
3895
+ }>>;
3896
+ details: z.ZodOptional<z.ZodString>;
3897
+ kind: z.ZodLiteral<"provider.warning">;
3898
+ summary: z.ZodOptional<z.ZodString>;
3899
+ vouchedTurn: z.ZodOptional<z.ZodBoolean>;
3900
+ }, z.core.$strip>, z.ZodObject<{
3901
+ kind: z.ZodLiteral<"unhandled">;
3902
+ onlyIfNoTurn: z.ZodOptional<z.ZodBoolean>;
3903
+ parentRef: z.ZodOptional<z.ZodString>;
3904
+ providerTurnId: z.ZodOptional<z.ZodString>;
3905
+ raw: z.ZodObject<{
3906
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
3907
+ jsonrpc: z.ZodLiteral<"2.0">;
3908
+ method: z.ZodString;
3909
+ params: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
3910
+ }, z.core.$strip>;
3911
+ rawType: z.ZodString;
3912
+ vouchedTurn: z.ZodBoolean;
3913
+ }, z.core.$strip>, z.ZodObject<{
3914
+ kind: z.ZodLiteral<"session.ended">;
3915
+ }, z.core.$strip>, z.ZodObject<{
3916
+ kind: z.ZodLiteral<"session.reset">;
3917
+ }, z.core.$strip>], "kind">>;
3918
+ threadId: z.ZodString;
3919
+ }, z.core.$loose>;
3920
+ type ThreadDeltaNotificationParams = z.infer<typeof threadDeltaNotificationParamsSchema>;
3921
+
3922
+ interface SanitizeInheritedChildProcessEnvArgs {
3923
+ env: NodeJS.ProcessEnv;
3924
+ /**
3925
+ * The user's login-shell PATH, substituted for the inherited one. Omit to
3926
+ * keep the parent's PATH: that is a real distinction, not a default. A
3927
+ * daemon started by launchd or systemd inherits a minimal PATH that finds
3928
+ * none of the user's tools, so anything spawning user-facing executables
3929
+ * (plugin hosts, provider bridges) passes the resolved shell PATH, while a
3930
+ * child that must run exactly what the parent runs must not.
3931
+ */
3932
+ shellPath?: string;
3933
+ }
3934
+ /**
3935
+ * The one answer to "what does a bb-spawned child process inherit": the
3936
+ * parent's env minus bb runtime-owned variables (`BB_*`) and `NODE_ENV`,
3937
+ * optionally with the user's login-shell PATH substituted. Callers overlay
3938
+ * only the child-specific bb env they intentionally expose afterward.
3939
+ */
3940
+ declare function sanitizeInheritedChildProcessEnv(args: SanitizeInheritedChildProcessEnvArgs): NodeJS.ProcessEnv;
3941
+
3942
+ declare const hostDaemonAcpLaunchSpecSchema: z.ZodObject<{
3943
+ args: z.ZodArray<z.ZodString>;
3944
+ command: z.ZodString;
3945
+ cwd: z.ZodOptional<z.ZodString>;
3946
+ displayName: z.ZodString;
3947
+ env: z.ZodRecord<z.ZodString, z.ZodString>;
3948
+ modelCli: z.ZodOptional<z.ZodPipe<z.ZodObject<{
3949
+ listArgs: z.ZodArray<z.ZodString>;
3950
+ primaryModels: z.ZodArray<z.ZodString>;
3951
+ selectFlag: z.ZodOptional<z.ZodString>;
3952
+ }, z.core.$strict>, z.ZodTransform<{
3953
+ listArgs: string[];
3954
+ primaryModels: string[];
3955
+ selectFlag?: string | undefined;
3956
+ } | undefined, {
3957
+ listArgs: string[];
3958
+ primaryModels: string[];
3959
+ selectFlag?: string | undefined;
3960
+ }>>>;
3961
+ nativeReasoning: z.ZodOptional<z.ZodObject<{
3962
+ configId: z.ZodString;
3963
+ defaultLevel: z.ZodOptional<z.ZodEnum<{
3964
+ high: "high";
3965
+ low: "low";
3966
+ max: "max";
3967
+ medium: "medium";
3968
+ none: "none";
3969
+ ultra: "ultra";
3970
+ ultracode: "ultracode";
3971
+ xhigh: "xhigh";
3972
+ }>>;
3973
+ levelValues: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
3974
+ high: "high";
3975
+ low: "low";
3976
+ max: "max";
3977
+ medium: "medium";
3978
+ none: "none";
3979
+ ultra: "ultra";
3980
+ ultracode: "ultracode";
3981
+ xhigh: "xhigh";
3982
+ }> & z.core.$partial, z.ZodString>>;
3983
+ supportedLevels: z.ZodArray<z.ZodEnum<{
3984
+ high: "high";
3985
+ low: "low";
3986
+ max: "max";
3987
+ medium: "medium";
3988
+ none: "none";
3989
+ ultra: "ultra";
3990
+ ultracode: "ultracode";
3991
+ xhigh: "xhigh";
3992
+ }>>;
3993
+ }, z.core.$strict>>;
3994
+ nativeSkillRoots: z.ZodOptional<z.ZodObject<{
3995
+ project: z.ZodDefault<z.ZodArray<z.ZodString>>;
3996
+ user: z.ZodDefault<z.ZodArray<z.ZodString>>;
3997
+ }, z.core.$strict>>;
3998
+ permissionCli: z.ZodOptional<z.ZodObject<{
3999
+ full: z.ZodOptional<z.ZodArray<z.ZodString>>;
4000
+ insertAfterArgs: z.ZodOptional<z.ZodNumber>;
4001
+ readonly: z.ZodOptional<z.ZodArray<z.ZodString>>;
4002
+ workspaceWrite: z.ZodOptional<z.ZodArray<z.ZodString>>;
4003
+ }, z.core.$strict>>;
4004
+ reasoningCli: z.ZodOptional<z.ZodObject<{
4005
+ defaultLevel: z.ZodOptional<z.ZodEnum<{
4006
+ high: "high";
4007
+ low: "low";
4008
+ max: "max";
4009
+ medium: "medium";
4010
+ none: "none";
4011
+ ultra: "ultra";
4012
+ ultracode: "ultracode";
4013
+ xhigh: "xhigh";
4014
+ }>>;
4015
+ flag: z.ZodString;
4016
+ levelValues: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
4017
+ high: "high";
4018
+ low: "low";
4019
+ max: "max";
4020
+ medium: "medium";
4021
+ none: "none";
4022
+ ultra: "ultra";
4023
+ ultracode: "ultracode";
4024
+ xhigh: "xhigh";
4025
+ }> & z.core.$partial, z.ZodString>>;
4026
+ supportedLevels: z.ZodArray<z.ZodEnum<{
4027
+ high: "high";
4028
+ low: "low";
4029
+ max: "max";
4030
+ medium: "medium";
4031
+ none: "none";
4032
+ ultra: "ultra";
4033
+ ultracode: "ultracode";
4034
+ xhigh: "xhigh";
4035
+ }>>;
4036
+ }, z.core.$strict>>;
4037
+ }, z.core.$strict>;
4038
+ type HostDaemonAcpLaunchSpec = z.infer<typeof hostDaemonAcpLaunchSpecSchema>;
4039
+ declare function normalizeHostDaemonAcpLaunchSpec(spec: HostDaemonAcpLaunchSpec): HostDaemonAcpLaunchSpec;
4040
+
4041
+ export { BRIDGE_INBOUND_REQUEST_METHODS, BRIDGE_JSON_RPC_ERRORS, BRIDGE_NOTIFICATION_METHODS, BRIDGE_REQUEST_METHODS, HIGH_REASONING_EFFORT, LOCAL_BASH_TASK_TYPE, LOCAL_WORKFLOW_TASK_TYPE, LOW_REASONING_EFFORT, MAX_REASONING_EFFORT, MEDIUM_REASONING_EFFORT, PROVIDER_BRIDGE_EXPORT_NAME, PROVIDER_BRIDGE_PROTOCOL_VERSION, ProviderRequestDecodeError, ProviderResponseEncodeError, THREAD_DELTA_NOTIFICATION_METHOD, ULTRACODE_REASONING_EFFORT, USER_QUESTION_MAX_OPTIONS, USER_QUESTION_MAX_QUESTIONS, XHIGH_REASONING_EFFORT, acpNativeReasoningSchema, acpPermissionCliSchema, acpReasoningCliSchema, backgroundTaskItemStatus, bashArgsSchema, bridgeRequestEnvelopeSchema, buildShellEnvOverrides, claudeTaskToolNameSchema, claudeTaskToolOutputSchema, createBridgeIo, createBridgeLineHandler, createPendingToolCallTracker, createProviderVisibilityMetadata, decodeBridgeJsonRpcResponse, decodeToolCallResponsePayload, deltaBackgroundTaskShapeSchema, deltaFileChangeSchema, deltaItemKeySchema, deltaItemShapeSchema, deltaMessageChannelSchema, deltaNoTurnFallbackSchema, deltaOutputChannelSchema, deltaTextChannelSchema, dynamicToolSchema, errorEnvelopeSchema, experimental_defineProviderBridge, extractResultText, getRawSdkMessage, getRecordProperty, getStringProperty, hostDaemonAcpLaunchSpecSchema, initializeParamsSchema, instructionModeValues, isApprovalPendingInteractionPayload, isApprovalPendingInteractionResolution, isBackgroundAgentTaskType, isRecord, isSettledBackgroundTaskStatus, isStandaloneBuiltinCompactCommand, isUserQuestionPendingInteractionPayload, isUserQuestionPendingInteractionResolution, jsonRpcEnvelopeSchema, jsonValueSchema, mimeTypeFromExtension, modelListParamsSchema, normalizeHostDaemonAcpLaunchSpec, normalizeProviderCommandOutput, pendingInteractionCommandActionSchema, pendingInteractionFileSystemPermissionsSchema, pendingInteractionMacOsPermissionsSchema, pendingInteractionNetworkPermissionsSchema, pendingInteractionRequestedPermissionProfileSchema, pendingInteractionResolutionSchema, permissionEscalationValues, providerRawEventSchema, reasoningEffortsForLevels, reasoningLevelSchema, reasoningLevelValues, removeCommandMentionsFromPromptInput, runBridgeRequest, runtimePermissionScopeValues, sanitizeInheritedChildProcessEnv, sdkMessageEnvelopeSchema, shouldAutoDenyInteractiveRequest, skillsConfigureParamsSchema, textBlockSchema, threadArchiveParamsSchema, threadContextWindowUsageEnvelopeSchema, threadDeltaNotificationParamsSchema, threadDeltaSchema, threadDiscardParamsSchema, threadForkParamsSchema, threadGoalClearParamsSchema, threadIdentityEnvelopeSchema, threadNameSetParamsSchema, threadResumeParamsSchema, threadStartParamsSchema, threadStopParamsSchema, threadUnarchiveParamsSchema, toNonNegativeNumber, toOptionalRecord, toOptionalString, toPositiveNumber, turnStartParamsSchema, turnSteerParamsSchema, withoutBridgeRuntimeEnv };
4042
+ export type { ApprovalPendingInteractionPayload, AvailableModel, BackgroundTaskStatus, BackgroundTaskUsage, BridgeExecutionOptions, BridgeJsonRpcResponse, BridgeToolCallRequest, BuildInteractiveResponseArgs, ClaudeTaskToolOutput, ClientTurnRequestId, DecodedInteractiveRequest, DeltaBackgroundTaskShape, DeltaFileChange, DeltaItemKey, DeltaItemShape, DeltaMessageChannel, DeltaNoTurnFallback, DeltaOutputChannel, DeltaTextChannel, DynamicTool, HostDaemonAcpLaunchSpec, InitializeResult, InstructionMode, JsonObject, JsonRpcMessage, JsonValue, ModelReasoningEffort, PendingInteractionApprovalDecision, PendingInteractionApprovalSubject, PendingInteractionCommandAction, PendingInteractionGrantablePermissionProfile, PendingInteractionGrantedPermissionProfile, PendingInteractionPayload, PendingInteractionRequestedPermissionProfile, PendingInteractionResolution, PendingInteractionUserQuestionQuestion, PermissionEscalation, PermissionMode, PreparedProviderCommandDispatch, PromptInput, ProviderBridgeContext, ProviderBridgeDefinition, ProviderBridgeEntry, ProviderErrorCategory, ProviderErrorInfo, ProviderInboundRequest, ProviderPostInitializeRequest, ProviderRateLimitState, ProviderRateLimitStatus, ProviderRateLimitWindow, ProviderRawEvent, ProviderRawEventCoverage, ProviderRawEventDescription, ProviderRuntimeEvent, ProviderVisibilityMetadata, ReasoningLevel, RuntimePermissionPolicy, RuntimePermissionScope, ServiceTier, ThreadDelta, ThreadDeltaKind, ThreadDeltaNotificationParams, ThreadEventContextWindowUsage, ThreadEventItemStatus, ThreadEventPlanStep, ThreadEventTokenUsageBreakdown, ThreadEventTurnStatus, ThreadEventUserContent, UserQuestionPendingInteractionPayload, UserQuestionPendingInteractionResolution, WorkflowAgentSnapshot, WorkflowAgentState, WorkflowPhaseSnapshot, WorkflowProgressSnapshot };