@yaklabs-ai/plugin-sdk 0.54.0 → 0.54.2

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.
package/dist/kay-app.d.ts CHANGED
@@ -124,6 +124,1006 @@ declare function AddReadonlyDeferred<Type extends TSchema>(type: Type, options?:
124
124
  */
125
125
  declare type AgentMessage = Message | CustomAgentMessages[keyof CustomAgentMessages];
126
126
 
127
+ declare const AgentRuntimeArtifact: z.ZodObject<{
128
+ uri: z.ZodString;
129
+ kind: z.ZodString;
130
+ name: z.ZodString;
131
+ title: z.ZodString;
132
+ updatedAtMs: z.ZodNumber;
133
+ mimeType: z.ZodOptional<z.ZodString>;
134
+ sizeBytes: z.ZodOptional<z.ZodNumber>;
135
+ committedVersionState: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
136
+ state: z.ZodLiteral<"draft">;
137
+ }, z.core.$strict>, z.ZodObject<{
138
+ state: z.ZodLiteral<"clean">;
139
+ committedVersion: z.ZodNumber;
140
+ }, z.core.$strict>, z.ZodObject<{
141
+ state: z.ZodLiteral<"edited">;
142
+ committedVersion: z.ZodNumber;
143
+ }, z.core.$strict>], "state">>;
144
+ }, z.core.$strict>;
145
+
146
+ declare type AgentRuntimeArtifact = z.infer<typeof AgentRuntimeArtifact>;
147
+
148
+ declare const AgentRuntimeAutomationFactSource: z.ZodEnum<{
149
+ "run-settled": "run-settled";
150
+ "tool-used": "tool-used";
151
+ "tool-failed": "tool-failed";
152
+ }>;
153
+
154
+ declare type AgentRuntimeAutomationFactSource = z.infer<typeof AgentRuntimeAutomationFactSource>;
155
+
156
+ /** One automation run's provenance detail (RFC Release 2). */
157
+ declare const AgentRuntimeAutomationRunDetail: z.ZodObject<{
158
+ run: z.ZodObject<{
159
+ id: z.ZodString;
160
+ bindingId: z.ZodString;
161
+ logicalKey: z.ZodString;
162
+ status: z.ZodEnum<{
163
+ failed: "failed";
164
+ running: "running";
165
+ succeeded: "succeeded";
166
+ queued: "queued";
167
+ skipped: "skipped";
168
+ claimed: "claimed";
169
+ }>;
170
+ match: z.ZodDiscriminatedUnion<[z.ZodObject<{
171
+ kind: z.ZodLiteral<"plugin-event">;
172
+ event: z.ZodObject<{
173
+ type: z.ZodString;
174
+ id: z.ZodString;
175
+ version: z.ZodNumber;
176
+ uri: z.ZodString;
177
+ occurredAt: z.ZodISODateTime;
178
+ publishedAt: z.ZodISODateTime;
179
+ source: z.ZodObject<{
180
+ layer: z.ZodLiteral<"runtime">;
181
+ runId: z.ZodOptional<z.ZodString>;
182
+ pluginId: z.ZodString;
183
+ poller: z.ZodOptional<z.ZodString>;
184
+ }, z.core.$strict>;
185
+ }, z.core.$strict>;
186
+ }, z.core.$strict>, z.ZodObject<{
187
+ kind: z.ZodLiteral<"time">;
188
+ scheduledAtMs: z.ZodNumber;
189
+ zone: z.ZodOptional<z.ZodString>;
190
+ }, z.core.$strict>, z.ZodObject<{
191
+ factId: z.ZodString;
192
+ source: z.ZodEnum<{
193
+ "run-settled": "run-settled";
194
+ "tool-used": "tool-used";
195
+ "tool-failed": "tool-failed";
196
+ }>;
197
+ sessionId: z.ZodString;
198
+ occurredAtMs: z.ZodNumber;
199
+ toolName: z.ZodOptional<z.ZodString>;
200
+ uriScheme: z.ZodOptional<z.ZodString>;
201
+ kind: z.ZodLiteral<"occurrence">;
202
+ }, z.core.$strict>, z.ZodObject<{
203
+ dueAtMs: z.ZodNumber;
204
+ factId: z.ZodString;
205
+ source: z.ZodEnum<{
206
+ "run-settled": "run-settled";
207
+ "tool-used": "tool-used";
208
+ "tool-failed": "tool-failed";
209
+ }>;
210
+ sessionId: z.ZodString;
211
+ occurredAtMs: z.ZodNumber;
212
+ toolName: z.ZodOptional<z.ZodString>;
213
+ uriScheme: z.ZodOptional<z.ZodString>;
214
+ kind: z.ZodLiteral<"delayed-occurrence">;
215
+ }, z.core.$strict>, z.ZodObject<{
216
+ kind: z.ZodLiteral<"uri-change">;
217
+ scheduledAtMs: z.ZodNumber;
218
+ uri: z.ZodString;
219
+ digest: z.ZodString;
220
+ previousDigest: z.ZodOptional<z.ZodString>;
221
+ }, z.core.$strict>, z.ZodObject<{
222
+ kind: z.ZodLiteral<"manual">;
223
+ requestedAtMs: z.ZodNumber;
224
+ referenceAtMs: z.ZodOptional<z.ZodNumber>;
225
+ requestId: z.ZodOptional<z.ZodString>;
226
+ requestedBy: z.ZodOptional<z.ZodEnum<{
227
+ user: "user";
228
+ agent: "agent";
229
+ }>>;
230
+ }, z.core.$strict>], "kind">;
231
+ generation: z.ZodString;
232
+ claimedAtMs: z.ZodNumber;
233
+ startedAtMs: z.ZodOptional<z.ZodNumber>;
234
+ settledAtMs: z.ZodOptional<z.ZodNumber>;
235
+ outcome: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
236
+ status: z.ZodLiteral<"succeeded">;
237
+ summary: z.ZodOptional<z.ZodObject<{
238
+ headline: z.ZodString;
239
+ details: z.ZodOptional<z.ZodString>;
240
+ author: z.ZodEnum<{
241
+ automation: "automation";
242
+ kay: "kay";
243
+ }>;
244
+ }, z.core.$strict>>;
245
+ daemonRunId: z.ZodOptional<z.ZodString>;
246
+ sessionId: z.ZodOptional<z.ZodString>;
247
+ script: z.ZodOptional<z.ZodObject<{
248
+ sourceDigest: z.ZodString;
249
+ }, z.core.$strict>>;
250
+ tries: z.ZodOptional<z.ZodNumber>;
251
+ }, z.core.$strict>, z.ZodObject<{
252
+ status: z.ZodLiteral<"failed">;
253
+ summary: z.ZodOptional<z.ZodObject<{
254
+ headline: z.ZodString;
255
+ details: z.ZodOptional<z.ZodString>;
256
+ author: z.ZodEnum<{
257
+ automation: "automation";
258
+ kay: "kay";
259
+ }>;
260
+ }, z.core.$strict>>;
261
+ reason: z.ZodOptional<z.ZodEnum<{
262
+ surface_unavailable: "surface_unavailable";
263
+ owner_missing: "owner_missing";
264
+ target_missing: "target_missing";
265
+ declaration_gone: "declaration_gone";
266
+ executor_failed: "executor_failed";
267
+ permission_denied: "permission_denied";
268
+ }>>;
269
+ message: z.ZodOptional<z.ZodString>;
270
+ classification: z.ZodOptional<z.ZodObject<{
271
+ code: z.ZodEnum<{
272
+ runtime_interrupted: "runtime_interrupted";
273
+ surface_unavailable: "surface_unavailable";
274
+ provider_auth_failed: "provider_auth_failed";
275
+ provider_rate_limited: "provider_rate_limited";
276
+ provider_unavailable: "provider_unavailable";
277
+ provider_stream_terminated: "provider_stream_terminated";
278
+ provider_unreachable: "provider_unreachable";
279
+ provider_quota_exhausted: "provider_quota_exhausted";
280
+ provider_seat_unpaid: "provider_seat_unpaid";
281
+ provider_model_disabled: "provider_model_disabled";
282
+ bonsai_sign_in_required: "bonsai_sign_in_required";
283
+ bonsai_organization_unavailable: "bonsai_organization_unavailable";
284
+ bonsai_account_unreachable: "bonsai_account_unreachable";
285
+ run_cancelled: "run_cancelled";
286
+ provider_request_rejected: "provider_request_rejected";
287
+ run_final_output_missing: "run_final_output_missing";
288
+ turn_failed: "turn_failed";
289
+ workflow_failed: "workflow_failed";
290
+ turn_delivery_failed: "turn_delivery_failed";
291
+ handler_failed: "handler_failed";
292
+ network_unreachable: "network_unreachable";
293
+ surface_starting: "surface_starting";
294
+ script_unreadable: "script_unreadable";
295
+ owner_missing: "owner_missing";
296
+ owner_unsupported: "owner_unsupported";
297
+ turn_target_missing: "turn_target_missing";
298
+ target_missing: "target_missing";
299
+ declaration_gone: "declaration_gone";
300
+ script_timed_out: "script_timed_out";
301
+ script_killed: "script_killed";
302
+ script_crashed: "script_crashed";
303
+ script_tool_call_failed: "script_tool_call_failed";
304
+ script_tool_call_aborted: "script_tool_call_aborted";
305
+ script_tool_call_blocked: "script_tool_call_blocked";
306
+ script_tool_response_not_json: "script_tool_response_not_json";
307
+ script_exited_nonzero: "script_exited_nonzero";
308
+ script_runtime_missing: "script_runtime_missing";
309
+ script_cwd_missing: "script_cwd_missing";
310
+ script_cwd_unset: "script_cwd_unset";
311
+ script_cwd_deleted: "script_cwd_deleted";
312
+ script_process_failed: "script_process_failed";
313
+ script_result_invalid: "script_result_invalid";
314
+ script_failed: "script_failed";
315
+ }>;
316
+ category: z.ZodEnum<{
317
+ unknown: "unknown";
318
+ cancelled: "cancelled";
319
+ auth: "auth";
320
+ network: "network";
321
+ rate_limit: "rate_limit";
322
+ provider: "provider";
323
+ }>;
324
+ retryable: z.ZodBoolean;
325
+ retryAfterMs: z.ZodOptional<z.ZodNumber>;
326
+ }, z.core.$strict>>;
327
+ failure: z.ZodOptional<z.ZodType<RunFailureOccurrence<string, string>, unknown, z.core.$ZodTypeInternals<RunFailureOccurrence<string, string>, unknown>>>;
328
+ sessionId: z.ZodOptional<z.ZodString>;
329
+ retryAtMs: z.ZodOptional<z.ZodNumber>;
330
+ tries: z.ZodOptional<z.ZodNumber>;
331
+ }, z.core.$strict>, z.ZodObject<{
332
+ status: z.ZodLiteral<"skipped">;
333
+ reason: z.ZodEnum<{
334
+ already_running: "already_running";
335
+ binding_inactive: "binding_inactive";
336
+ guard_not_satisfied: "guard_not_satisfied";
337
+ missed_window: "missed_window";
338
+ timer_cancelled: "timer_cancelled";
339
+ }>;
340
+ }, z.core.$strict>], "status">>;
341
+ resumes: z.ZodOptional<z.ZodString>;
342
+ attempt: z.ZodOptional<z.ZodNumber>;
343
+ economics: z.ZodOptional<z.ZodObject<{
344
+ attempt: z.ZodDiscriminatedUnion<[z.ZodObject<{
345
+ amountUsd: z.ZodNumber;
346
+ coverage: z.ZodObject<{
347
+ attributedTurns: z.ZodNumber;
348
+ pricedTurns: z.ZodNumber;
349
+ attributedDirectCalls: z.ZodOptional<z.ZodNumber>;
350
+ pricedDirectCalls: z.ZodOptional<z.ZodNumber>;
351
+ }, z.core.$strict>;
352
+ state: z.ZodLiteral<"exact">;
353
+ }, z.core.$strict>, z.ZodObject<{
354
+ amountUsd: z.ZodNumber;
355
+ coverage: z.ZodObject<{
356
+ attributedTurns: z.ZodNumber;
357
+ pricedTurns: z.ZodNumber;
358
+ attributedDirectCalls: z.ZodOptional<z.ZodNumber>;
359
+ pricedDirectCalls: z.ZodOptional<z.ZodNumber>;
360
+ }, z.core.$strict>;
361
+ state: z.ZodLiteral<"lower_bound">;
362
+ }, z.core.$strict>, z.ZodObject<{
363
+ state: z.ZodLiteral<"rebuilding">;
364
+ coverage: z.ZodObject<{
365
+ attributedTurns: z.ZodNumber;
366
+ pricedTurns: z.ZodNumber;
367
+ attributedDirectCalls: z.ZodOptional<z.ZodNumber>;
368
+ pricedDirectCalls: z.ZodOptional<z.ZodNumber>;
369
+ }, z.core.$strict>;
370
+ }, z.core.$strict>, z.ZodObject<{
371
+ state: z.ZodLiteral<"unavailable">;
372
+ coverage: z.ZodObject<{
373
+ attributedTurns: z.ZodNumber;
374
+ pricedTurns: z.ZodNumber;
375
+ attributedDirectCalls: z.ZodOptional<z.ZodNumber>;
376
+ pricedDirectCalls: z.ZodOptional<z.ZodNumber>;
377
+ }, z.core.$strict>;
378
+ }, z.core.$strict>], "state">;
379
+ chain: z.ZodDiscriminatedUnion<[z.ZodObject<{
380
+ amountUsd: z.ZodNumber;
381
+ coverage: z.ZodObject<{
382
+ attributedTurns: z.ZodNumber;
383
+ pricedTurns: z.ZodNumber;
384
+ attributedDirectCalls: z.ZodOptional<z.ZodNumber>;
385
+ pricedDirectCalls: z.ZodOptional<z.ZodNumber>;
386
+ }, z.core.$strict>;
387
+ state: z.ZodLiteral<"exact">;
388
+ }, z.core.$strict>, z.ZodObject<{
389
+ amountUsd: z.ZodNumber;
390
+ coverage: z.ZodObject<{
391
+ attributedTurns: z.ZodNumber;
392
+ pricedTurns: z.ZodNumber;
393
+ attributedDirectCalls: z.ZodOptional<z.ZodNumber>;
394
+ pricedDirectCalls: z.ZodOptional<z.ZodNumber>;
395
+ }, z.core.$strict>;
396
+ state: z.ZodLiteral<"lower_bound">;
397
+ }, z.core.$strict>, z.ZodObject<{
398
+ state: z.ZodLiteral<"rebuilding">;
399
+ coverage: z.ZodObject<{
400
+ attributedTurns: z.ZodNumber;
401
+ pricedTurns: z.ZodNumber;
402
+ attributedDirectCalls: z.ZodOptional<z.ZodNumber>;
403
+ pricedDirectCalls: z.ZodOptional<z.ZodNumber>;
404
+ }, z.core.$strict>;
405
+ }, z.core.$strict>, z.ZodObject<{
406
+ state: z.ZodLiteral<"unavailable">;
407
+ coverage: z.ZodObject<{
408
+ attributedTurns: z.ZodNumber;
409
+ pricedTurns: z.ZodNumber;
410
+ attributedDirectCalls: z.ZodOptional<z.ZodNumber>;
411
+ pricedDirectCalls: z.ZodOptional<z.ZodNumber>;
412
+ }, z.core.$strict>;
413
+ }, z.core.$strict>], "state">;
414
+ }, z.core.$strict>>;
415
+ changes: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
416
+ state: z.ZodLiteral<"exact">;
417
+ artifactTargetCount: z.ZodNumber;
418
+ producedResourceCount: z.ZodNumber;
419
+ asOfMs: z.ZodNumber;
420
+ gaps: z.ZodArray<z.ZodObject<{
421
+ code: z.ZodEnum<{
422
+ "legacy-run-id-missing": "legacy-run-id-missing";
423
+ "mutation-revision-missing": "mutation-revision-missing";
424
+ "partial-git-provenance": "partial-git-provenance";
425
+ "git-session-stamp-missing": "git-session-stamp-missing";
426
+ "external-resource-unnamed": "external-resource-unnamed";
427
+ "produced-resource-unnamed": "produced-resource-unnamed";
428
+ "skill-suggestion-unattributable": "skill-suggestion-unattributable";
429
+ "malformed-source-record": "malformed-source-record";
430
+ "source-unreadable": "source-unreadable";
431
+ "git-revision-unavailable": "git-revision-unavailable";
432
+ "automation-history-unavailable": "automation-history-unavailable";
433
+ "session-history-unavailable": "session-history-unavailable";
434
+ "required-evidence-missing": "required-evidence-missing";
435
+ }>;
436
+ detail: z.ZodOptional<z.ZodString>;
437
+ }, z.core.$strict>>;
438
+ }, z.core.$strict>, z.ZodObject<{
439
+ state: z.ZodEnum<{
440
+ partial: "partial";
441
+ rebuilding: "rebuilding";
442
+ }>;
443
+ asOfMs: z.ZodNumber;
444
+ gaps: z.ZodArray<z.ZodObject<{
445
+ code: z.ZodEnum<{
446
+ "legacy-run-id-missing": "legacy-run-id-missing";
447
+ "mutation-revision-missing": "mutation-revision-missing";
448
+ "partial-git-provenance": "partial-git-provenance";
449
+ "git-session-stamp-missing": "git-session-stamp-missing";
450
+ "external-resource-unnamed": "external-resource-unnamed";
451
+ "produced-resource-unnamed": "produced-resource-unnamed";
452
+ "skill-suggestion-unattributable": "skill-suggestion-unattributable";
453
+ "malformed-source-record": "malformed-source-record";
454
+ "source-unreadable": "source-unreadable";
455
+ "git-revision-unavailable": "git-revision-unavailable";
456
+ "automation-history-unavailable": "automation-history-unavailable";
457
+ "session-history-unavailable": "session-history-unavailable";
458
+ "required-evidence-missing": "required-evidence-missing";
459
+ }>;
460
+ detail: z.ZodOptional<z.ZodString>;
461
+ }, z.core.$strict>>;
462
+ }, z.core.$strict>, z.ZodObject<{
463
+ state: z.ZodLiteral<"unavailable">;
464
+ }, z.core.$strict>], "state">>;
465
+ }, z.core.$strict>;
466
+ activity: z.ZodObject<{
467
+ items: z.ZodArray<z.ZodObject<{
468
+ sessionId: z.ZodString;
469
+ sessionRunId: z.ZodString;
470
+ kind: z.ZodEnum<{
471
+ direct: "direct";
472
+ child: "child";
473
+ }>;
474
+ shared: z.ZodBoolean;
475
+ session: z.ZodObject<{
476
+ sessionId: z.ZodString;
477
+ agentId: z.ZodOptional<z.ZodString>;
478
+ parentSessionId: z.ZodNullable<z.ZodString>;
479
+ predecessorSessionId: z.ZodNullable<z.ZodString>;
480
+ openedBySessionId: z.ZodNullable<z.ZodString>;
481
+ rootSessionId: z.ZodString;
482
+ spawnDepth: z.ZodNumber;
483
+ cwd: z.ZodOptional<z.ZodString>;
484
+ displayTitle: z.ZodOptional<z.ZodString>;
485
+ userTitle: z.ZodOptional<z.ZodString>;
486
+ stewardTitle: z.ZodOptional<z.ZodString>;
487
+ stewardCommentary: z.ZodOptional<z.ZodArray<z.ZodString>>;
488
+ stewardNextSteps: z.ZodOptional<z.ZodArray<z.ZodString>>;
489
+ stewardCompactionSuggested: z.ZodOptional<z.ZodLiteral<true>>;
490
+ stewardSuggestedModelTier: z.ZodOptional<z.ZodEnum<{
491
+ small: "small";
492
+ medium: "medium";
493
+ large: "large";
494
+ ultra: "ultra";
495
+ }>>;
496
+ provider: z.ZodOptional<z.ZodString>;
497
+ modelReference: z.ZodOptional<z.ZodString>;
498
+ modelAccountName: z.ZodOptional<z.ZodString>;
499
+ modelSelection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
500
+ kind: z.ZodLiteral<"specific">;
501
+ modelReference: z.ZodString;
502
+ }, z.core.$strict>, z.ZodObject<{
503
+ kind: z.ZodLiteral<"tier">;
504
+ tierId: z.ZodEnum<{
505
+ small: "small";
506
+ medium: "medium";
507
+ large: "large";
508
+ ultra: "ultra";
509
+ }>;
510
+ provider: z.ZodOptional<z.ZodString>;
511
+ constraints: z.ZodOptional<z.ZodObject<{
512
+ provider: z.ZodOptional<z.ZodString>;
513
+ vendor: z.ZodOptional<z.ZodString>;
514
+ notVendor: z.ZodOptional<z.ZodString>;
515
+ }, z.core.$strict>>;
516
+ }, z.core.$strict>, z.ZodObject<{
517
+ kind: z.ZodLiteral<"model">;
518
+ model: z.ZodString;
519
+ constraints: z.ZodOptional<z.ZodObject<{
520
+ provider: z.ZodOptional<z.ZodString>;
521
+ vendor: z.ZodOptional<z.ZodString>;
522
+ notVendor: z.ZodOptional<z.ZodString>;
523
+ }, z.core.$strict>>;
524
+ }, z.core.$strict>], "kind">>;
525
+ activeToolNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
526
+ mode: z.ZodOptional<z.ZodEnum<{
527
+ default: "default";
528
+ auto: "auto";
529
+ ask: "ask";
530
+ allow: "allow";
531
+ }>>;
532
+ thinkingLevel: z.ZodOptional<z.ZodEnum<{
533
+ max: "max";
534
+ off: "off";
535
+ minimal: "minimal";
536
+ low: "low";
537
+ medium: "medium";
538
+ high: "high";
539
+ xhigh: "xhigh";
540
+ }>>;
541
+ processingSpeed: z.ZodOptional<z.ZodEnum<{
542
+ standard: "standard";
543
+ fast: "fast";
544
+ }>>;
545
+ artifacts: z.ZodOptional<z.ZodArray<z.ZodObject<{
546
+ uri: z.ZodString;
547
+ kind: z.ZodString;
548
+ name: z.ZodString;
549
+ title: z.ZodString;
550
+ updatedAtMs: z.ZodNumber;
551
+ mimeType: z.ZodOptional<z.ZodString>;
552
+ sizeBytes: z.ZodOptional<z.ZodNumber>;
553
+ committedVersionState: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
554
+ state: z.ZodLiteral<"draft">;
555
+ }, z.core.$strict>, z.ZodObject<{
556
+ state: z.ZodLiteral<"clean">;
557
+ committedVersion: z.ZodNumber;
558
+ }, z.core.$strict>, z.ZodObject<{
559
+ state: z.ZodLiteral<"edited">;
560
+ committedVersion: z.ZodNumber;
561
+ }, z.core.$strict>], "state">>;
562
+ }, z.core.$strict>>>;
563
+ running: z.ZodBoolean;
564
+ runState: z.ZodOptional<z.ZodEnum<{
565
+ interrupted: "interrupted";
566
+ cancelled: "cancelled";
567
+ completed: "completed";
568
+ failed: "failed";
569
+ running: "running";
570
+ }>>;
571
+ origin: z.ZodDiscriminatedUnion<[z.ZodObject<{
572
+ kind: z.ZodLiteral<"user">;
573
+ surface: z.ZodOptional<z.ZodString>;
574
+ onboardingAttemptId: z.ZodOptional<z.ZodUUID>;
575
+ }, z.core.$strict>, z.ZodObject<{
576
+ kind: z.ZodLiteral<"subagent">;
577
+ }, z.core.$strict>, z.ZodObject<{
578
+ kind: z.ZodLiteral<"system">;
579
+ surface: z.ZodString;
580
+ }, z.core.$strict>, z.ZodObject<{
581
+ kind: z.ZodLiteral<"followup">;
582
+ parentSessionId: z.ZodString;
583
+ surface: z.ZodString;
584
+ forkedAtEntryId: z.ZodOptional<z.ZodString>;
585
+ }, z.core.$strict>], "kind">;
586
+ createdAt: z.ZodOptional<z.ZodISODateTime>;
587
+ updatedAt: z.ZodOptional<z.ZodISODateTime>;
588
+ runStartedAt: z.ZodOptional<z.ZodNumber>;
589
+ runSettledAt: z.ZodOptional<z.ZodNumber>;
590
+ detachedWorkStartedAt: z.ZodOptional<z.ZodNumber>;
591
+ state: z.ZodOptional<z.ZodObject<{
592
+ value: z.ZodEnum<{
593
+ failed: "failed";
594
+ running: "running";
595
+ needs_you: "needs_you";
596
+ waiting: "waiting";
597
+ idle: "idle";
598
+ }>;
599
+ since: z.ZodISODateTime;
600
+ }, z.core.$strict>>;
601
+ lastSeenAt: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
602
+ archivedAtMs: z.ZodOptional<z.ZodNumber>;
603
+ pinnedAtMs: z.ZodOptional<z.ZodNumber>;
604
+ deletedAtMs: z.ZodOptional<z.ZodNumber>;
605
+ remotePeerId: z.ZodOptional<z.ZodString>;
606
+ provenance: z.ZodOptional<z.ZodObject<{
607
+ relationships: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
608
+ kind: z.ZodLiteral<"child-of">;
609
+ sessionId: z.ZodString;
610
+ }, z.core.$strict>, z.ZodObject<{
611
+ kind: z.ZodLiteral<"forked-from">;
612
+ sessionId: z.ZodString;
613
+ atEntryId: z.ZodOptional<z.ZodString>;
614
+ }, z.core.$strict>], "kind">>;
615
+ createdBy: z.ZodDiscriminatedUnion<[z.ZodObject<{
616
+ kind: z.ZodLiteral<"human">;
617
+ surface: z.ZodOptional<z.ZodString>;
618
+ }, z.core.$strict>, z.ZodObject<{
619
+ kind: z.ZodLiteral<"agent">;
620
+ sessionId: z.ZodString;
621
+ tool: z.ZodString;
622
+ runId: z.ZodOptional<z.ZodString>;
623
+ toolCallId: z.ZodOptional<z.ZodString>;
624
+ }, z.core.$strict>, z.ZodObject<{
625
+ kind: z.ZodLiteral<"plugin">;
626
+ pluginId: z.ZodString;
627
+ door: z.ZodEnum<{
628
+ "sessions.create": "sessions.create";
629
+ "sessions.run": "sessions.run";
630
+ "hindsight.runFollowup": "hindsight.runFollowup";
631
+ "agents.run": "agents.run";
632
+ }>;
633
+ callerSessionId: z.ZodOptional<z.ZodString>;
634
+ }, z.core.$strict>, z.ZodObject<{
635
+ kind: z.ZodLiteral<"trigger">;
636
+ automationId: z.ZodString;
637
+ runId: z.ZodOptional<z.ZodString>;
638
+ bindingName: z.ZodString;
639
+ triggerKind: z.ZodEnum<{
640
+ time: "time";
641
+ cron: "cron";
642
+ occurrence: "occurrence";
643
+ "uri-change": "uri-change";
644
+ "plugin-event": "plugin-event";
645
+ manual: "manual";
646
+ }>;
647
+ }, z.core.$strict>, z.ZodObject<{
648
+ kind: z.ZodLiteral<"daemon">;
649
+ capability: z.ZodString;
650
+ }, z.core.$strict>], "kind">;
651
+ definedBy: z.ZodDiscriminatedUnion<[z.ZodObject<{
652
+ layer: z.ZodLiteral<"plugin">;
653
+ pluginId: z.ZodString;
654
+ capability: z.ZodString;
655
+ version: z.ZodOptional<z.ZodString>;
656
+ }, z.core.$strict>, z.ZodObject<{
657
+ layer: z.ZodLiteral<"host">;
658
+ capability: z.ZodString;
659
+ }, z.core.$strict>], "layer">;
660
+ intent: z.ZodEnum<{
661
+ interactive: "interactive";
662
+ headless: "headless";
663
+ }>;
664
+ causedByEvent: z.ZodOptional<z.ZodObject<{
665
+ handler: z.ZodString;
666
+ kind: z.ZodOptional<z.ZodEnum<{
667
+ "session-event": "session-event";
668
+ backfill: "backfill";
669
+ }>>;
670
+ event: z.ZodOptional<z.ZodObject<{
671
+ type: z.ZodEnum<{
672
+ "turn-settled": "turn-settled";
673
+ "phase-shift": "phase-shift";
674
+ "human-message": "human-message";
675
+ "assistant-message": "assistant-message";
676
+ "ui-action": "ui-action";
677
+ }>;
678
+ entryId: z.ZodString;
679
+ runId: z.ZodOptional<z.ZodString>;
680
+ throughEntryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
681
+ }, z.core.$strict>>;
682
+ dedupeKey: z.ZodOptional<z.ZodString>;
683
+ }, z.core.$strict>>;
684
+ }, z.core.$strict>>;
685
+ projectId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
686
+ }, z.core.$strict>;
687
+ }, z.core.$strict>>;
688
+ totalCount: z.ZodNumber;
689
+ nextCursor: z.ZodOptional<z.ZodString>;
690
+ truncated: z.ZodBoolean;
691
+ }, z.core.$strict>;
692
+ artifacts: z.ZodObject<{
693
+ items: z.ZodArray<z.ZodObject<{
694
+ uri: z.ZodString;
695
+ moduleId: z.ZodString;
696
+ sessionId: z.ZodString;
697
+ action: z.ZodEnum<{
698
+ created: "created";
699
+ updated: "updated";
700
+ deleted: "deleted";
701
+ }>;
702
+ revision: z.ZodString;
703
+ revisionCount: z.ZodNumber;
704
+ offBranch: z.ZodBoolean;
705
+ shared: z.ZodBoolean;
706
+ }, z.core.$strict>>;
707
+ totalCount: z.ZodNumber;
708
+ nextCursor: z.ZodOptional<z.ZodString>;
709
+ truncated: z.ZodBoolean;
710
+ }, z.core.$strict>;
711
+ externalResources: z.ZodObject<{
712
+ items: z.ZodArray<z.ZodObject<{
713
+ url: z.ZodString;
714
+ kind: z.ZodEnum<{
715
+ "github-pr": "github-pr";
716
+ }>;
717
+ sessionId: z.ZodString;
718
+ shared: z.ZodBoolean;
719
+ }, z.core.$strict>>;
720
+ totalCount: z.ZodNumber;
721
+ nextCursor: z.ZodOptional<z.ZodString>;
722
+ truncated: z.ZodBoolean;
723
+ }, z.core.$strict>;
724
+ producedResources: z.ZodObject<{
725
+ items: z.ZodArray<z.ZodObject<{
726
+ uri: z.ZodString;
727
+ action: z.ZodEnum<{
728
+ created: "created";
729
+ updated: "updated";
730
+ deleted: "deleted";
731
+ }>;
732
+ sessionId: z.ZodString;
733
+ revision: z.ZodOptional<z.ZodObject<{
734
+ id: z.ZodString;
735
+ count: z.ZodNumber;
736
+ }, z.core.$strict>>;
737
+ offBranch: z.ZodBoolean;
738
+ shared: z.ZodBoolean;
739
+ }, z.core.$strict>>;
740
+ totalCount: z.ZodNumber;
741
+ truncated: z.ZodBoolean;
742
+ }, z.core.$strict>;
743
+ suggestions: z.ZodObject<{
744
+ items: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
745
+ sourceId: z.ZodString;
746
+ skillName: z.ZodString;
747
+ suggestionId: z.ZodString;
748
+ kind: z.ZodEnum<{
749
+ new: "new";
750
+ improvement: "improvement";
751
+ }>;
752
+ status: z.ZodEnum<{
753
+ pending: "pending";
754
+ declined: "declined";
755
+ accepted: "accepted";
756
+ }>;
757
+ baseLocalRevision: z.ZodString;
758
+ candidateRevision: z.ZodString;
759
+ reason: z.ZodOptional<z.ZodString>;
760
+ evidence: z.ZodOptional<z.ZodUnknown>;
761
+ summary: z.ZodOptional<z.ZodString>;
762
+ why: z.ZodOptional<z.ZodString>;
763
+ createdAt: z.ZodISODateTime;
764
+ updatedAt: z.ZodISODateTime;
765
+ locatorVersion: z.ZodOptional<z.ZodUnknown>;
766
+ sessionId: z.ZodString;
767
+ shared: z.ZodBoolean;
768
+ }, z.core.$strict>, z.ZodObject<{
769
+ locatorVersion: z.ZodOptional<z.ZodUnknown>;
770
+ sessionId: z.ZodString;
771
+ shared: z.ZodBoolean;
772
+ sourceId: z.ZodString;
773
+ skillName: z.ZodString;
774
+ suggestionId: z.ZodString;
775
+ kind: z.ZodEnum<{
776
+ new: "new";
777
+ improvement: "improvement";
778
+ }>;
779
+ status: z.ZodLiteral<"unavailable">;
780
+ candidateRevision: z.ZodString;
781
+ }, z.core.$strict>]>>;
782
+ totalCount: z.ZodNumber;
783
+ nextCursor: z.ZodOptional<z.ZodString>;
784
+ truncated: z.ZodBoolean;
785
+ }, z.core.$strict>;
786
+ coverage: z.ZodObject<{
787
+ state: z.ZodEnum<{
788
+ complete: "complete";
789
+ partial: "partial";
790
+ }>;
791
+ asOfMs: z.ZodNumber;
792
+ stamp: z.ZodOptional<z.ZodString>;
793
+ gaps: z.ZodArray<z.ZodObject<{
794
+ code: z.ZodEnum<{
795
+ "legacy-run-id-missing": "legacy-run-id-missing";
796
+ "mutation-revision-missing": "mutation-revision-missing";
797
+ "partial-git-provenance": "partial-git-provenance";
798
+ "git-session-stamp-missing": "git-session-stamp-missing";
799
+ "external-resource-unnamed": "external-resource-unnamed";
800
+ "produced-resource-unnamed": "produced-resource-unnamed";
801
+ "skill-suggestion-unattributable": "skill-suggestion-unattributable";
802
+ "malformed-source-record": "malformed-source-record";
803
+ "source-unreadable": "source-unreadable";
804
+ "git-revision-unavailable": "git-revision-unavailable";
805
+ "automation-history-unavailable": "automation-history-unavailable";
806
+ "session-history-unavailable": "session-history-unavailable";
807
+ "required-evidence-missing": "required-evidence-missing";
808
+ }>;
809
+ detail: z.ZodOptional<z.ZodString>;
810
+ }, z.core.$strict>>;
811
+ }, z.core.$strict>;
812
+ }, z.core.$strict>;
813
+
814
+ declare type AgentRuntimeAutomationRunDetail = z.infer<typeof AgentRuntimeAutomationRunDetail>;
815
+
816
+ /**
817
+ * The optional schema-validated terminal output contract a session may declare
818
+ * (issue #2234). `schema` is a bounded JSON object (a JSON Schema); `required`
819
+ * (default off) decides whether a text-only completion settles the turn -
820
+ * `true` holds every run to a submission, while the `"per-run"` literal defers
821
+ * the decision to each run's driver (a reused subagent session's assignment
822
+ * runs are stamped; its internal wake turns are not);
823
+ * `sessionTitle` (default off) adds the reserved `submit_final` field a turn
824
+ * uses to rename its own session; `whenToSubmit` is the one sentence telling the
825
+ * model when an OPTIONAL submission is worth making (ignored when `required`
826
+ * is `true` or `"per-run"`).
827
+ * The wire enforces the size caps and the credential-key tripwire; the herd
828
+ * kernel enforces the full acceptance policy (JSON-only, depth, non-local
829
+ * `$ref`).
830
+ *
831
+ * STRICT on purpose, which makes this schema a required stop for every new
832
+ * contract field: an unmirrored one is not merely absent on the wire, it fails
833
+ * the whole contract's parse, and the consumer that reads a stored session drops
834
+ * the contract entirely rather than reporting anything.
835
+ */
836
+ declare const AgentRuntimeFinalOutputContract: z.ZodObject<{
837
+ schema: z.ZodType<{
838
+ [key: string]: JsonValue_5;
839
+ }, unknown, z.core.$ZodTypeInternals<{
840
+ [key: string]: JsonValue_5;
841
+ }, unknown>>;
842
+ required: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodLiteral<"per-run">]>>;
843
+ sessionTitle: z.ZodOptional<z.ZodBoolean>;
844
+ whenToSubmit: z.ZodOptional<z.ZodString>;
845
+ }, z.core.$strict>;
846
+
847
+ declare type AgentRuntimeFinalOutputContract = z.infer<typeof AgentRuntimeFinalOutputContract>;
848
+
849
+ declare const AgentRuntimeModality: z.ZodEnum<{
850
+ text: "text";
851
+ image: "image";
852
+ audio: "audio";
853
+ video: "video";
854
+ pdf: "pdf";
855
+ embedding: "embedding";
856
+ }>;
857
+
858
+ declare type AgentRuntimeModality = z.infer<typeof AgentRuntimeModality>;
859
+
860
+ /** Model pricing in USD per one million tokens. */
861
+ declare const AgentRuntimeModelCost: z.ZodObject<{
862
+ input: z.ZodNumber;
863
+ output: z.ZodNumber;
864
+ cacheRead: z.ZodNumber;
865
+ cacheWrite: z.ZodNumber;
866
+ }, z.core.$strict>;
867
+
868
+ declare type AgentRuntimeModelCost = z.infer<typeof AgentRuntimeModelCost>;
869
+
870
+ declare const AgentRuntimeModelFeatures: z.ZodObject<{
871
+ thinking: z.ZodBoolean;
872
+ vision: z.ZodBoolean;
873
+ toolUse: z.ZodBoolean;
874
+ streaming: z.ZodBoolean;
875
+ reasoning: z.ZodOptional<z.ZodBoolean>;
876
+ inputModalities: z.ZodArray<z.ZodEnum<{
877
+ text: "text";
878
+ image: "image";
879
+ audio: "audio";
880
+ video: "video";
881
+ pdf: "pdf";
882
+ embedding: "embedding";
883
+ }>>;
884
+ outputModalities: z.ZodArray<z.ZodEnum<{
885
+ text: "text";
886
+ image: "image";
887
+ audio: "audio";
888
+ video: "video";
889
+ pdf: "pdf";
890
+ embedding: "embedding";
891
+ }>>;
892
+ structuredOutput: z.ZodOptional<z.ZodBoolean>;
893
+ promptCaching: z.ZodOptional<z.ZodBoolean>;
894
+ contextWindow: z.ZodOptional<z.ZodNumber>;
895
+ maxOutputTokens: z.ZodOptional<z.ZodNumber>;
896
+ }, z.core.$strict>;
897
+
898
+ declare type AgentRuntimeModelFeatures = z.infer<typeof AgentRuntimeModelFeatures>;
899
+
900
+ declare const AgentRuntimeModelScores: z.ZodObject<{
901
+ intelligence: z.ZodOptional<z.ZodObject<{
902
+ value: z.ZodNumber;
903
+ }, z.core.$strict>>;
904
+ coding: z.ZodOptional<z.ZodObject<{
905
+ value: z.ZodNumber;
906
+ }, z.core.$strict>>;
907
+ speedTps: z.ZodOptional<z.ZodObject<{
908
+ value: z.ZodNumber;
909
+ }, z.core.$strict>>;
910
+ categories: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
911
+ value: z.ZodNumber;
912
+ }, z.core.$strict>>>;
913
+ source: z.ZodOptional<z.ZodString>;
914
+ asOf: z.ZodOptional<z.ZodString>;
915
+ }, z.core.$strict>;
916
+
917
+ declare type AgentRuntimeModelScores = z.infer<typeof AgentRuntimeModelScores>;
918
+
919
+ declare const AgentRuntimeModelTierId: z.ZodEnum<{
920
+ small: "small";
921
+ medium: "medium";
922
+ large: "large";
923
+ ultra: "ultra";
924
+ }>;
925
+
926
+ declare type AgentRuntimeModelTierId = z.infer<typeof AgentRuntimeModelTierId>;
927
+
928
+ /**
929
+ * One product model tier (resolved through the provider tier tables), projected with the
930
+ * model the tier RESOLVES TO for this runtime right now. `resolved` is absent
931
+ * when nothing - pin or floor - is currently eligible; the preview is
932
+ * point-in-time (checked-strength, never minting), so surfaces re-fetch rather
933
+ * than cache it across auth changes.
934
+ */
935
+ declare const AgentRuntimeModelTierInfo: z.ZodObject<{
936
+ id: z.ZodEnum<{
937
+ small: "small";
938
+ medium: "medium";
939
+ large: "large";
940
+ ultra: "ultra";
941
+ }>;
942
+ displayName: z.ZodString;
943
+ description: z.ZodString;
944
+ resolved: z.ZodOptional<z.ZodObject<{
945
+ provider: z.ZodString;
946
+ modelId: z.ZodString;
947
+ modelReference: z.ZodString;
948
+ displayName: z.ZodOptional<z.ZodString>;
949
+ }, z.core.$strict>>;
950
+ }, z.core.$strict>;
951
+
952
+ declare type AgentRuntimeModelTierInfo = z.infer<typeof AgentRuntimeModelTierInfo>;
953
+
954
+ declare const AgentRuntimeSessionMode: z.ZodEnum<{
955
+ default: "default";
956
+ auto: "auto";
957
+ ask: "ask";
958
+ allow: "allow";
959
+ }>;
960
+
961
+ declare type AgentRuntimeSessionMode = z.infer<typeof AgentRuntimeSessionMode>;
962
+
963
+ /** The judge's own certainty in its verdict - a tuning filter, never a weight applied for the reader. */
964
+ declare const AgentRuntimeSessionOutcomeConfidence: z.ZodEnum<{
965
+ low: "low";
966
+ medium: "medium";
967
+ high: "high";
968
+ }>;
969
+
970
+ declare type AgentRuntimeSessionOutcomeConfidence = z.infer<typeof AgentRuntimeSessionOutcomeConfidence>;
971
+
972
+ /**
973
+ * How a session's work is judged to have served the user (telemetry lane
974
+ * PR 5, `docs/telemetry-lane-pr5-contracts.md` §2.1).
975
+ *
976
+ * `"unclear"` is a FIRST-CLASS verdict, not an error code: a judge that cannot
977
+ * tell must say so rather than guess, and the share of `unclear` is itself a
978
+ * tuning metric for the rubric that produced it.
979
+ */
980
+ declare const AgentRuntimeSessionOutcomeVerdict: z.ZodEnum<{
981
+ bad: "bad";
982
+ good: "good";
983
+ mixed: "mixed";
984
+ unclear: "unclear";
985
+ }>;
986
+
987
+ declare type AgentRuntimeSessionOutcomeVerdict = z.infer<typeof AgentRuntimeSessionOutcomeVerdict>;
988
+
989
+ /**
990
+ * A session's live or last durable run state. `interrupted` and `cancelled` are
991
+ * distinct terminal states, not synonyms: INTERRUPTED means the turn was stopped
992
+ * and the session's detached work kept running; CANCELLED means the run and all
993
+ * of that work ended together. Records written before this split stored every
994
+ * user stop as `cancelled`, and are mapped forward on read.
995
+ */
996
+ declare const AgentRuntimeSessionRunState: z.ZodEnum<{
997
+ interrupted: "interrupted";
998
+ cancelled: "cancelled";
999
+ completed: "completed";
1000
+ failed: "failed";
1001
+ running: "running";
1002
+ }>;
1003
+
1004
+ declare type AgentRuntimeSessionRunState = z.infer<typeof AgentRuntimeSessionRunState>;
1005
+
1006
+ /**
1007
+ * One session-steward observation (hindsight): structured FACTS, never
1008
+ * actions - appended to the session's log as a `session_steward` custom entry,
1009
+ * from which summary state derives (`stewardTitle` / `stewardCommentary` /
1010
+ * `stewardNextSteps` / `stewardCompactionSuggested`). Derivation is
1011
+ * side-effect-free by contract. The compaction flag has two consumers:
1012
+ * auto-compaction taken once at append time behind the
1013
+ * `kayLoop.hindsight.stewardAutoCompact` flag, and - when auto-compact is
1014
+ * off - the standing `stewardCompactionSuggested` summary field that backs
1015
+ * the UI's "compact now" affordance. NOT itself a wire payload - it
1016
+ * lives here as the ONE shared source of the summary's steward fields (the
1017
+ * entry on disk, the backend fold, and the stored-state reader all validate
1018
+ * against it); only the derived summary fields ever cross the wire.
1019
+ */
1020
+ declare const AgentRuntimeSessionStewardEntry: z.ZodObject<{
1021
+ titleChange: z.ZodNullable<z.ZodString>;
1022
+ summaryAddition: z.ZodNullable<z.ZodString>;
1023
+ nextSteps: z.ZodOptional<z.ZodArray<z.ZodString>>;
1024
+ workHeadline: z.ZodOptional<z.ZodString>;
1025
+ workHeadlineReview: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1026
+ labelKind: z.ZodEnum<{
1027
+ purpose: "purpose";
1028
+ result: "result";
1029
+ }>;
1030
+ text: z.ZodString;
1031
+ faultProbability: z.ZodNullable<z.ZodNumber>;
1032
+ accepted: z.ZodBoolean;
1033
+ reason: z.ZodOptional<z.ZodString>;
1034
+ }, z.core.$strict>, z.ZodObject<{
1035
+ attempt: z.ZodObject<{
1036
+ outcome: z.ZodEnum<{
1037
+ error: "error";
1038
+ none: "none";
1039
+ rejected: "rejected";
1040
+ }>;
1041
+ }, z.core.$strict>;
1042
+ }, z.core.$strict>]>>>;
1043
+ workBlock: z.ZodOptional<z.ZodObject<{
1044
+ firstToolResultEntryId: z.ZodString;
1045
+ lastToolResultEntryId: z.ZodString;
1046
+ toolResultEntryIds: z.ZodArray<z.ZodString>;
1047
+ }, z.core.$strict>>;
1048
+ goodCompactionOpportunity: z.ZodOptional<z.ZodBoolean>;
1049
+ suggestedModelTier: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
1050
+ small: "small";
1051
+ medium: "medium";
1052
+ large: "large";
1053
+ ultra: "ultra";
1054
+ }>>>;
1055
+ reviewedThroughEntryId: z.ZodOptional<z.ZodString>;
1056
+ outcomeVerdict: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1057
+ verdict: z.ZodEnum<{
1058
+ bad: "bad";
1059
+ good: "good";
1060
+ mixed: "mixed";
1061
+ unclear: "unclear";
1062
+ }>;
1063
+ confidence: z.ZodEnum<{
1064
+ low: "low";
1065
+ medium: "medium";
1066
+ high: "high";
1067
+ }>;
1068
+ basis: z.ZodString;
1069
+ correctionsObserved: z.ZodNumber;
1070
+ retriesObserved: z.ZodNumber;
1071
+ rubricVersion: z.ZodNumber;
1072
+ }, z.core.$strict>>>;
1073
+ deferredVerdicts: z.ZodOptional<z.ZodArray<z.ZodObject<{
1074
+ subjectSessionId: z.ZodString;
1075
+ verdict: z.ZodEnum<{
1076
+ bad: "bad";
1077
+ good: "good";
1078
+ mixed: "mixed";
1079
+ unclear: "unclear";
1080
+ }>;
1081
+ confidence: z.ZodEnum<{
1082
+ low: "low";
1083
+ medium: "medium";
1084
+ high: "high";
1085
+ }>;
1086
+ basis: z.ZodString;
1087
+ rubricVersion: z.ZodNumber;
1088
+ }, z.core.$strict>>>;
1089
+ }, z.core.$strict>;
1090
+
1091
+ declare type AgentRuntimeSessionStewardEntry = z.infer<typeof AgentRuntimeSessionStewardEntry>;
1092
+
1093
+ /** One trailing-window spend view (mirrors `SpendWindowView`). */
1094
+ declare const AgentRuntimeSpendWindow: z.ZodObject<{
1095
+ window: z.ZodEnum<{
1096
+ trailing24h: "trailing24h";
1097
+ trailing7d: "trailing7d";
1098
+ trailing30d: "trailing30d";
1099
+ trailing90d: "trailing90d";
1100
+ }>;
1101
+ measuredUsd: z.ZodNumber;
1102
+ estimatedUsd: z.ZodNumber;
1103
+ unknownTurns: z.ZodNumber;
1104
+ tokens: z.ZodObject<{
1105
+ input: z.ZodNumber;
1106
+ output: z.ZodNumber;
1107
+ cacheRead: z.ZodNumber;
1108
+ cacheWrite: z.ZodNumber;
1109
+ }, z.core.$strict>;
1110
+ effectiveUsdPerMTok: z.ZodOptional<z.ZodNumber>;
1111
+ }, z.core.$strict>;
1112
+
1113
+ declare type AgentRuntimeSpendWindow = z.infer<typeof AgentRuntimeSpendWindow>;
1114
+
1115
+ declare const AgentRuntimeThinkingLevel: z.ZodEnum<{
1116
+ max: "max";
1117
+ off: "off";
1118
+ minimal: "minimal";
1119
+ low: "low";
1120
+ medium: "medium";
1121
+ high: "high";
1122
+ xhigh: "xhigh";
1123
+ }>;
1124
+
1125
+ declare type AgentRuntimeThinkingLevel = z.infer<typeof AgentRuntimeThinkingLevel>;
1126
+
127
1127
  /** Final or partial result produced by a tool. */
128
1128
  export declare interface AgentToolResult<T = JsonValue_2 | undefined> {
129
1129
  /** Text or image content returned to the model. */
@@ -379,6 +1379,364 @@ declare const AuthServiceReference: z.ZodString;
379
1379
 
380
1380
  declare type AuthServiceReference = z.infer<typeof AuthServiceReference>;
381
1381
 
1382
+ /**
1383
+ * One session run a getRun read reports. `shared: true` means that session
1384
+ * run had more than one admitted input at that point; it does not choose a
1385
+ * winner. The embedded session summary reuses the wire's own display shape.
1386
+ */
1387
+ declare const AutomationActivityItem: z.ZodObject<{
1388
+ sessionId: z.ZodString;
1389
+ sessionRunId: z.ZodString;
1390
+ kind: z.ZodEnum<{
1391
+ direct: "direct";
1392
+ child: "child";
1393
+ }>;
1394
+ shared: z.ZodBoolean;
1395
+ session: z.ZodObject<{
1396
+ sessionId: z.ZodString;
1397
+ agentId: z.ZodOptional<z.ZodString>;
1398
+ parentSessionId: z.ZodNullable<z.ZodString>;
1399
+ predecessorSessionId: z.ZodNullable<z.ZodString>;
1400
+ openedBySessionId: z.ZodNullable<z.ZodString>;
1401
+ rootSessionId: z.ZodString;
1402
+ spawnDepth: z.ZodNumber;
1403
+ cwd: z.ZodOptional<z.ZodString>;
1404
+ displayTitle: z.ZodOptional<z.ZodString>;
1405
+ userTitle: z.ZodOptional<z.ZodString>;
1406
+ stewardTitle: z.ZodOptional<z.ZodString>;
1407
+ stewardCommentary: z.ZodOptional<z.ZodArray<z.ZodString>>;
1408
+ stewardNextSteps: z.ZodOptional<z.ZodArray<z.ZodString>>;
1409
+ stewardCompactionSuggested: z.ZodOptional<z.ZodLiteral<true>>;
1410
+ stewardSuggestedModelTier: z.ZodOptional<z.ZodEnum<{
1411
+ small: "small";
1412
+ medium: "medium";
1413
+ large: "large";
1414
+ ultra: "ultra";
1415
+ }>>;
1416
+ provider: z.ZodOptional<z.ZodString>;
1417
+ modelReference: z.ZodOptional<z.ZodString>;
1418
+ modelAccountName: z.ZodOptional<z.ZodString>;
1419
+ modelSelection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
1420
+ kind: z.ZodLiteral<"specific">;
1421
+ modelReference: z.ZodString;
1422
+ }, z.core.$strict>, z.ZodObject<{
1423
+ kind: z.ZodLiteral<"tier">;
1424
+ tierId: z.ZodEnum<{
1425
+ small: "small";
1426
+ medium: "medium";
1427
+ large: "large";
1428
+ ultra: "ultra";
1429
+ }>;
1430
+ provider: z.ZodOptional<z.ZodString>;
1431
+ constraints: z.ZodOptional<z.ZodObject<{
1432
+ provider: z.ZodOptional<z.ZodString>;
1433
+ vendor: z.ZodOptional<z.ZodString>;
1434
+ notVendor: z.ZodOptional<z.ZodString>;
1435
+ }, z.core.$strict>>;
1436
+ }, z.core.$strict>, z.ZodObject<{
1437
+ kind: z.ZodLiteral<"model">;
1438
+ model: z.ZodString;
1439
+ constraints: z.ZodOptional<z.ZodObject<{
1440
+ provider: z.ZodOptional<z.ZodString>;
1441
+ vendor: z.ZodOptional<z.ZodString>;
1442
+ notVendor: z.ZodOptional<z.ZodString>;
1443
+ }, z.core.$strict>>;
1444
+ }, z.core.$strict>], "kind">>;
1445
+ activeToolNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
1446
+ mode: z.ZodOptional<z.ZodEnum<{
1447
+ default: "default";
1448
+ auto: "auto";
1449
+ ask: "ask";
1450
+ allow: "allow";
1451
+ }>>;
1452
+ thinkingLevel: z.ZodOptional<z.ZodEnum<{
1453
+ max: "max";
1454
+ off: "off";
1455
+ minimal: "minimal";
1456
+ low: "low";
1457
+ medium: "medium";
1458
+ high: "high";
1459
+ xhigh: "xhigh";
1460
+ }>>;
1461
+ processingSpeed: z.ZodOptional<z.ZodEnum<{
1462
+ standard: "standard";
1463
+ fast: "fast";
1464
+ }>>;
1465
+ artifacts: z.ZodOptional<z.ZodArray<z.ZodObject<{
1466
+ uri: z.ZodString;
1467
+ kind: z.ZodString;
1468
+ name: z.ZodString;
1469
+ title: z.ZodString;
1470
+ updatedAtMs: z.ZodNumber;
1471
+ mimeType: z.ZodOptional<z.ZodString>;
1472
+ sizeBytes: z.ZodOptional<z.ZodNumber>;
1473
+ committedVersionState: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
1474
+ state: z.ZodLiteral<"draft">;
1475
+ }, z.core.$strict>, z.ZodObject<{
1476
+ state: z.ZodLiteral<"clean">;
1477
+ committedVersion: z.ZodNumber;
1478
+ }, z.core.$strict>, z.ZodObject<{
1479
+ state: z.ZodLiteral<"edited">;
1480
+ committedVersion: z.ZodNumber;
1481
+ }, z.core.$strict>], "state">>;
1482
+ }, z.core.$strict>>>;
1483
+ running: z.ZodBoolean;
1484
+ runState: z.ZodOptional<z.ZodEnum<{
1485
+ interrupted: "interrupted";
1486
+ cancelled: "cancelled";
1487
+ completed: "completed";
1488
+ failed: "failed";
1489
+ running: "running";
1490
+ }>>;
1491
+ origin: z.ZodDiscriminatedUnion<[z.ZodObject<{
1492
+ kind: z.ZodLiteral<"user">;
1493
+ surface: z.ZodOptional<z.ZodString>;
1494
+ onboardingAttemptId: z.ZodOptional<z.ZodUUID>;
1495
+ }, z.core.$strict>, z.ZodObject<{
1496
+ kind: z.ZodLiteral<"subagent">;
1497
+ }, z.core.$strict>, z.ZodObject<{
1498
+ kind: z.ZodLiteral<"system">;
1499
+ surface: z.ZodString;
1500
+ }, z.core.$strict>, z.ZodObject<{
1501
+ kind: z.ZodLiteral<"followup">;
1502
+ parentSessionId: z.ZodString;
1503
+ surface: z.ZodString;
1504
+ forkedAtEntryId: z.ZodOptional<z.ZodString>;
1505
+ }, z.core.$strict>], "kind">;
1506
+ createdAt: z.ZodOptional<z.ZodISODateTime>;
1507
+ updatedAt: z.ZodOptional<z.ZodISODateTime>;
1508
+ runStartedAt: z.ZodOptional<z.ZodNumber>;
1509
+ runSettledAt: z.ZodOptional<z.ZodNumber>;
1510
+ detachedWorkStartedAt: z.ZodOptional<z.ZodNumber>;
1511
+ state: z.ZodOptional<z.ZodObject<{
1512
+ value: z.ZodEnum<{
1513
+ failed: "failed";
1514
+ running: "running";
1515
+ needs_you: "needs_you";
1516
+ waiting: "waiting";
1517
+ idle: "idle";
1518
+ }>;
1519
+ since: z.ZodISODateTime;
1520
+ }, z.core.$strict>>;
1521
+ lastSeenAt: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
1522
+ archivedAtMs: z.ZodOptional<z.ZodNumber>;
1523
+ pinnedAtMs: z.ZodOptional<z.ZodNumber>;
1524
+ deletedAtMs: z.ZodOptional<z.ZodNumber>;
1525
+ remotePeerId: z.ZodOptional<z.ZodString>;
1526
+ provenance: z.ZodOptional<z.ZodObject<{
1527
+ relationships: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1528
+ kind: z.ZodLiteral<"child-of">;
1529
+ sessionId: z.ZodString;
1530
+ }, z.core.$strict>, z.ZodObject<{
1531
+ kind: z.ZodLiteral<"forked-from">;
1532
+ sessionId: z.ZodString;
1533
+ atEntryId: z.ZodOptional<z.ZodString>;
1534
+ }, z.core.$strict>], "kind">>;
1535
+ createdBy: z.ZodDiscriminatedUnion<[z.ZodObject<{
1536
+ kind: z.ZodLiteral<"human">;
1537
+ surface: z.ZodOptional<z.ZodString>;
1538
+ }, z.core.$strict>, z.ZodObject<{
1539
+ kind: z.ZodLiteral<"agent">;
1540
+ sessionId: z.ZodString;
1541
+ tool: z.ZodString;
1542
+ runId: z.ZodOptional<z.ZodString>;
1543
+ toolCallId: z.ZodOptional<z.ZodString>;
1544
+ }, z.core.$strict>, z.ZodObject<{
1545
+ kind: z.ZodLiteral<"plugin">;
1546
+ pluginId: z.ZodString;
1547
+ door: z.ZodEnum<{
1548
+ "sessions.create": "sessions.create";
1549
+ "sessions.run": "sessions.run";
1550
+ "hindsight.runFollowup": "hindsight.runFollowup";
1551
+ "agents.run": "agents.run";
1552
+ }>;
1553
+ callerSessionId: z.ZodOptional<z.ZodString>;
1554
+ }, z.core.$strict>, z.ZodObject<{
1555
+ kind: z.ZodLiteral<"trigger">;
1556
+ automationId: z.ZodString;
1557
+ runId: z.ZodOptional<z.ZodString>;
1558
+ bindingName: z.ZodString;
1559
+ triggerKind: z.ZodEnum<{
1560
+ time: "time";
1561
+ cron: "cron";
1562
+ occurrence: "occurrence";
1563
+ "uri-change": "uri-change";
1564
+ "plugin-event": "plugin-event";
1565
+ manual: "manual";
1566
+ }>;
1567
+ }, z.core.$strict>, z.ZodObject<{
1568
+ kind: z.ZodLiteral<"daemon">;
1569
+ capability: z.ZodString;
1570
+ }, z.core.$strict>], "kind">;
1571
+ definedBy: z.ZodDiscriminatedUnion<[z.ZodObject<{
1572
+ layer: z.ZodLiteral<"plugin">;
1573
+ pluginId: z.ZodString;
1574
+ capability: z.ZodString;
1575
+ version: z.ZodOptional<z.ZodString>;
1576
+ }, z.core.$strict>, z.ZodObject<{
1577
+ layer: z.ZodLiteral<"host">;
1578
+ capability: z.ZodString;
1579
+ }, z.core.$strict>], "layer">;
1580
+ intent: z.ZodEnum<{
1581
+ interactive: "interactive";
1582
+ headless: "headless";
1583
+ }>;
1584
+ causedByEvent: z.ZodOptional<z.ZodObject<{
1585
+ handler: z.ZodString;
1586
+ kind: z.ZodOptional<z.ZodEnum<{
1587
+ "session-event": "session-event";
1588
+ backfill: "backfill";
1589
+ }>>;
1590
+ event: z.ZodOptional<z.ZodObject<{
1591
+ type: z.ZodEnum<{
1592
+ "turn-settled": "turn-settled";
1593
+ "phase-shift": "phase-shift";
1594
+ "human-message": "human-message";
1595
+ "assistant-message": "assistant-message";
1596
+ "ui-action": "ui-action";
1597
+ }>;
1598
+ entryId: z.ZodString;
1599
+ runId: z.ZodOptional<z.ZodString>;
1600
+ throughEntryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1601
+ }, z.core.$strict>>;
1602
+ dedupeKey: z.ZodOptional<z.ZodString>;
1603
+ }, z.core.$strict>>;
1604
+ }, z.core.$strict>>;
1605
+ projectId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1606
+ }, z.core.$strict>;
1607
+ }, z.core.$strict>;
1608
+
1609
+ declare type AutomationActivityItem = z.infer<typeof AutomationActivityItem>;
1610
+
1611
+ /**
1612
+ * One Git-backed artifact TARGET a getRun read reports: the thing produced or
1613
+ * changed, not one change to it. A run that edited a skill twice reports one
1614
+ * row with `revisionCount: 2`, because two rows differing only by sha read as
1615
+ * duplicates. The grouping key is (artifact, authoring session), so two
1616
+ * sessions that touched the same uri in one run stay two rows.
1617
+ *
1618
+ * `sessionId` is the authoring session; an `app:artifact:output` URI is only
1619
+ * unique within it. `offBranch` marks a revision whose source tool-result left the
1620
+ * session branch; the change is still attributable because the external side
1621
+ * effect landed. `shared` means the authoring session run had more than one
1622
+ * admitted input at that point. Both are true when ANY revision in the group
1623
+ * is.
1624
+ */
1625
+ declare const AutomationArtifactItem: z.ZodObject<{
1626
+ uri: z.ZodString;
1627
+ moduleId: z.ZodString;
1628
+ sessionId: z.ZodString;
1629
+ action: z.ZodEnum<{
1630
+ created: "created";
1631
+ updated: "updated";
1632
+ deleted: "deleted";
1633
+ }>;
1634
+ revision: z.ZodString;
1635
+ revisionCount: z.ZodNumber;
1636
+ offBranch: z.ZodBoolean;
1637
+ shared: z.ZodBoolean;
1638
+ }, z.core.$strict>;
1639
+
1640
+ declare type AutomationArtifactItem = z.infer<typeof AutomationArtifactItem>;
1641
+
1642
+ /**
1643
+ * One thing a run created off this machine - today a GitHub pull request its
1644
+ * session opened with `gh pr create`. A sibling of `AutomationArtifactItem`
1645
+ * rather than a widening of it: that type's non-empty `revision` and closed
1646
+ * `moduleId` are guarantees git-backed consumers rely on, and an external
1647
+ * resource has neither. It is not revision-backed, not addressed by a Bonsai uri
1648
+ * module, and not a thing this machine can re-read.
1649
+ *
1650
+ * `url` is the canonical resource URL the transcript itself printed, which is
1651
+ * also the entity's own identity. `sessionId` is the session whose run created
1652
+ * it, and `shared` means that session run had more than one admitted input at
1653
+ * that point - the same meaning both other run-detail lists give the word.
1654
+ *
1655
+ * There is deliberately NO `offBranch` here, unlike an artifact row. Branch
1656
+ * membership is not consulted when this fact is projected and could not be
1657
+ * honest if it were: an abandoned transcript branch does not un-open a pull
1658
+ * request. A field that can only ever be
1659
+ * `false` is a guarantee nothing is making.
1660
+ */
1661
+ declare const AutomationExternalResourceItem: z.ZodObject<{
1662
+ url: z.ZodString;
1663
+ kind: z.ZodEnum<{
1664
+ "github-pr": "github-pr";
1665
+ }>;
1666
+ sessionId: z.ZodString;
1667
+ shared: z.ZodBoolean;
1668
+ }, z.core.$strict>;
1669
+
1670
+ declare type AutomationExternalResourceItem = z.infer<typeof AutomationExternalResourceItem>;
1671
+
1672
+ /**
1673
+ * One URI a run produced: every URI its successful `write` and `edit` calls
1674
+ * changed, every URI a tool declared it created or updated (the
1675
+ * `producedResources` tool-result contract in `@herd/uri`), and every row
1676
+ * `artifacts` and `externalResources` report, deduplicated by exact URI
1677
+ * string. A session-scoped URI (`output://`) names a different resource in
1678
+ * each session, so it is one row per session.
1679
+ *
1680
+ * `uri` is a `scheme://` URI, an absolute local file path, or the canonical
1681
+ * https URL of an external resource. `sessionId` is the session that produced
1682
+ * it; when several did, the first in activity order that carries the winning
1683
+ * certainty and action. Stated action evidence wins over inferred verb
1684
+ * evidence; within the same certainty, action precedence decides.
1685
+ * `offBranch` and `shared` mean what they mean on an artifact row, and are
1686
+ * true when any contribution is.
1687
+ */
1688
+ declare const AutomationProducedResourceItem: z.ZodObject<{
1689
+ uri: z.ZodString;
1690
+ action: z.ZodEnum<{
1691
+ created: "created";
1692
+ updated: "updated";
1693
+ deleted: "deleted";
1694
+ }>;
1695
+ sessionId: z.ZodString;
1696
+ revision: z.ZodOptional<z.ZodObject<{
1697
+ id: z.ZodString;
1698
+ count: z.ZodNumber;
1699
+ }, z.core.$strict>>;
1700
+ offBranch: z.ZodBoolean;
1701
+ shared: z.ZodBoolean;
1702
+ }, z.core.$strict>;
1703
+
1704
+ declare type AutomationProducedResourceItem = z.infer<typeof AutomationProducedResourceItem>;
1705
+
1706
+ /**
1707
+ * How much of one run's work a read could establish. `partial` carries the
1708
+ * gaps that make it so; each gap bears on this run only. The daemon reads a
1709
+ * run's transcripts on demand, so there is no settling state to report.
1710
+ */
1711
+ declare const AutomationRunCoverage: z.ZodObject<{
1712
+ state: z.ZodEnum<{
1713
+ complete: "complete";
1714
+ partial: "partial";
1715
+ }>;
1716
+ asOfMs: z.ZodNumber;
1717
+ stamp: z.ZodOptional<z.ZodString>;
1718
+ gaps: z.ZodArray<z.ZodObject<{
1719
+ code: z.ZodEnum<{
1720
+ "legacy-run-id-missing": "legacy-run-id-missing";
1721
+ "mutation-revision-missing": "mutation-revision-missing";
1722
+ "partial-git-provenance": "partial-git-provenance";
1723
+ "git-session-stamp-missing": "git-session-stamp-missing";
1724
+ "external-resource-unnamed": "external-resource-unnamed";
1725
+ "produced-resource-unnamed": "produced-resource-unnamed";
1726
+ "skill-suggestion-unattributable": "skill-suggestion-unattributable";
1727
+ "malformed-source-record": "malformed-source-record";
1728
+ "source-unreadable": "source-unreadable";
1729
+ "git-revision-unavailable": "git-revision-unavailable";
1730
+ "automation-history-unavailable": "automation-history-unavailable";
1731
+ "session-history-unavailable": "session-history-unavailable";
1732
+ "required-evidence-missing": "required-evidence-missing";
1733
+ }>;
1734
+ detail: z.ZodOptional<z.ZodString>;
1735
+ }, z.core.$strict>>;
1736
+ }, z.core.$strict>;
1737
+
1738
+ declare type AutomationRunCoverage = z.infer<typeof AutomationRunCoverage>;
1739
+
382
1740
  declare interface Availability {
383
1741
  readonly available: boolean;
384
1742
  readonly reason?: string;
@@ -954,6 +2312,9 @@ export declare function createKayPluginLog(write: (line: KayPluginLogLine) => vo
954
2312
 
955
2313
  export declare function createUnavailablePluginEndpointCaller(message: string): PluginEndpointCaller;
956
2314
 
2315
+ /** A refusal handle for hosts that have not composed plugin worker execution. */
2316
+ export declare function createUnavailablePluginWorkers(): KayPluginWorkers;
2317
+
957
2318
  /**
958
2319
  * A `KayAppSealing` that answers `unavailable` to every call: what a host with no vault binds, so
959
2320
  * `app.sealing` stays present on every host.
@@ -2198,6 +3559,12 @@ declare type JsonValue_4 = JsonPrimitive | {
2198
3559
  readonly [key: string]: JsonValue_4;
2199
3560
  } | readonly JsonValue_4[];
2200
3561
 
3562
+ declare type JsonValue_5 = string | number | boolean | null | JsonValue_5[] | {
3563
+ [key: string]: JsonValue_5;
3564
+ };
3565
+
3566
+ declare const JsonValue_5: z.ZodType<JsonValue_5>;
3567
+
2201
3568
  /**
2202
3569
  * Every condition kind an automation can be created with, as runtime data.
2203
3570
  *
@@ -2934,8 +4301,16 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2934
4301
  * 0.54.0 adds named UI host grants for shared configuration/auth/account reads, retained connection
2935
4302
  * progress/dismissal and support. Built-in-only page capability scopes are removed; executable
2936
4303
  * pages declare capabilities on apps[].
4304
+ *
4305
+ * 0.54.1 adds manifest-declared plugin workers on both backend targets and exposes the canonical
4306
+ * transcript placement and answer-stretch rules through the SDK.
4307
+ *
4308
+ * 0.54.2 lets a signal list the files that came with it (epic #15668). `PluginSignal` gains an
4309
+ * optional `attachments`: each file's name, media type, size and the address its bytes are read
4310
+ * from, never the bytes. Gmail lists a mail's attachments there, so Flows can file them. Additive:
4311
+ * a plugin that publishes attachments declares ^0.54.2.
2937
4312
  */
2938
- declare const KAY_PLUGIN_SDK_VERSION: "0.54.0";
4313
+ declare const KAY_PLUGIN_SDK_VERSION: "0.54.2";
2939
4314
 
2940
4315
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2941
4316
 
@@ -3383,13 +4758,7 @@ export declare interface KayAppAgentDefinitionConfig {
3383
4758
  }
3384
4759
 
3385
4760
  /** A plugin-authored definition's structured-output contract (the wire's final-output shape). */
3386
- export declare interface KayAppAgentDefinitionFinalOutput {
3387
- /** JSON Schema for the structured value a matching turn submits. */
3388
- readonly schema: JsonSchema;
3389
- readonly required?: boolean | "per-run";
3390
- readonly sessionTitle?: boolean;
3391
- readonly whenToSubmit?: string;
3392
- }
4761
+ export declare type KayAppAgentDefinitionFinalOutput = ReadonlyContract<AgentRuntimeFinalOutputContract>;
3393
4762
 
3394
4763
  /**
3395
4764
  * An opaque handle to one definition THIS plugin registered. `define` returns it; `sessions.run`
@@ -3487,16 +4856,7 @@ export declare interface KayAppAgents {
3487
4856
  }): Promise<KayAppSessionRunOutcome>;
3488
4857
  }
3489
4858
 
3490
- export declare interface KayAppArtifact {
3491
- readonly uri: string;
3492
- readonly kind: string;
3493
- readonly name: string;
3494
- readonly title: string;
3495
- readonly updatedAtMs: number;
3496
- readonly mimeType?: string | undefined;
3497
- readonly sizeBytes?: number | undefined;
3498
- readonly committedVersionState?: KayAppArtifactCommittedVersionState | undefined;
3499
- }
4859
+ export declare type KayAppArtifact = ReadonlyContract<AgentRuntimeArtifact>;
3500
4860
 
3501
4861
  export declare type KayAppArtifactCommittedVersionState = {
3502
4862
  readonly state: "draft";
@@ -3614,44 +4974,15 @@ export declare interface KayAppAuth {
3614
4974
  * run had more than one admitted input at that point; it does not choose a
3615
4975
  * winner.
3616
4976
  */
3617
- export declare interface KayAppAutomationActivityItem {
3618
- readonly sessionId: string;
3619
- readonly sessionRunId: string;
3620
- /**
3621
- * `direct`: the automation run's own input admitted this session run.
3622
- * `child`: this session was created by a session run the automation run
3623
- * started, and its first run is reported.
3624
- */
3625
- readonly kind: "direct" | "child";
3626
- readonly shared: boolean;
4977
+ export declare type KayAppAutomationActivityItem = Omit<Readonly<AutomationActivityItem>, "session"> & {
3627
4978
  readonly session: KayAppSessionSummary;
3628
- }
4979
+ };
3629
4980
 
3630
4981
  /**
3631
4982
  * One Git-backed artifact TARGET a run-detail read reports (R3 populated):
3632
4983
  * the thing produced or changed, with its revisions collapsed behind it.
3633
4984
  */
3634
- export declare interface KayAppAutomationArtifactItem {
3635
- readonly uri: string;
3636
- readonly moduleId: string;
3637
- /**
3638
- * The authoring session. Required on the wire, and load-bearing rather than
3639
- * decorative: it is the session an `app:artifact:output` uri must be
3640
- * resolved against to open at all.
3641
- */
3642
- readonly sessionId: string;
3643
- /** Collapsed by precedence: `deleted` > `created` > `updated`. */
3644
- readonly action: "created" | "updated" | "deleted";
3645
- /**
3646
- * One real revision of the group, carrying the action above. Not
3647
- * necessarily the newest revision of the target.
3648
- */
3649
- readonly revision: string;
3650
- /** How many revisions this row collapsed. Always at least 1. */
3651
- readonly revisionCount: number;
3652
- readonly offBranch: boolean;
3653
- readonly shared: boolean;
3654
- }
4985
+ export declare type KayAppAutomationArtifactItem = Readonly<AutomationArtifactItem>;
3655
4986
 
3656
4987
  export declare interface KayAppAutomationBinding {
3657
4988
  readonly id: string;
@@ -3820,17 +5151,9 @@ export declare type KayAppAutomationEffectInput = {
3820
5151
  * abandoned transcript branch does not un-open a pull request, so branch
3821
5152
  * membership is never consulted for these facts.
3822
5153
  */
3823
- export declare interface KayAppAutomationExternalResourceItem {
3824
- /** The canonical resource URL the session's own transcript printed. */
3825
- readonly url: string;
3826
- readonly kind: "github-pr";
3827
- /** The session whose run created it. */
3828
- readonly sessionId: string;
3829
- /** That session run had more than one admitted input at the time. */
3830
- readonly shared: boolean;
3831
- }
5154
+ export declare type KayAppAutomationExternalResourceItem = Readonly<AutomationExternalResourceItem>;
3832
5155
 
3833
- export declare type KayAppAutomationFactSource = "run-settled" | "tool-used" | "tool-failed";
5156
+ export declare type KayAppAutomationFactSource = AgentRuntimeAutomationFactSource;
3834
5157
 
3835
5158
  export declare type KayAppAutomationMatch = {
3836
5159
  readonly kind: "plugin-event";
@@ -3910,20 +5233,7 @@ export declare interface KayAppAutomationPluginEventCondition {
3910
5233
  * resource's canonical https URL. Stated action evidence wins over inferred
3911
5234
  * verb evidence; within the same certainty, action precedence decides.
3912
5235
  */
3913
- export declare interface KayAppAutomationProducedResourceItem {
3914
- readonly uri: string;
3915
- /** Stated evidence beats inferred evidence; within one certainty, `deleted` > `created` > `updated`. Only an artifact receipt reports `deleted`. */
3916
- readonly action: "created" | "updated" | "deleted";
3917
- /** The first activity-ordered session carrying the winning certainty and action; for a session-scoped URI, the session it resolves against. */
3918
- readonly sessionId: string;
3919
- /** The last revision recorded for the winning certainty/action, or the last revision of the highest-ranked revision-bearing contribution (stated before inferred, then action precedence), and how many distinct revisions there were; ordered by activity, not time. */
3920
- readonly revision?: {
3921
- readonly id: string;
3922
- readonly count: number;
3923
- } | undefined;
3924
- readonly offBranch: boolean;
3925
- readonly shared: boolean;
3926
- }
5236
+ export declare type KayAppAutomationProducedResourceItem = ReadonlyContract<AutomationProducedResourceItem>;
3927
5237
 
3928
5238
  /** Every URI one run produced, served whole: at most 1,000 rows, `truncated` when there were more. */
3929
5239
  export declare interface KayAppAutomationProducedResources {
@@ -3946,37 +5256,16 @@ export declare interface KayAppAutomationRun {
3946
5256
  }
3947
5257
 
3948
5258
  /** Projection coverage state: how current the read model is for this answer. */
3949
- export declare interface KayAppAutomationRunCoverage {
3950
- readonly state: "complete" | "partial" | "rebuilding";
3951
- readonly asOfMs: number;
3952
- /**
3953
- * An opaque token over ONE materialized root's product-visible state;
3954
- * present only when this answer describes exactly one materialized root,
3955
- * absent otherwise (synthesized, `rebuilding`, or an aggregate over more
3956
- * than one root - a stamp is inherently single-root). Compare for
3957
- * equality only - never parse, order, or decompose it. Equal means that
3958
- * root has not moved; a missing stamp means unknown, so treat it as moved.
3959
- */
3960
- readonly stamp?: string | undefined;
3961
- readonly gaps: readonly KayAppProvenanceGapSummary[];
3962
- }
5259
+ export declare type KayAppAutomationRunCoverage = Omit<ReadonlyContract<AutomationRunCoverage>, "state"> & {
5260
+ readonly state: AutomationRunCoverage["state"] | "rebuilding";
5261
+ };
3963
5262
 
3964
5263
  /** One automation run's provenance detail (RFC Release 2). */
3965
- export declare interface KayAppAutomationRunDetail {
5264
+ export declare type KayAppAutomationRunDetail = ReadonlyContract<Omit<AgentRuntimeAutomationRunDetail, "run" | "activity" | "coverage">> & {
3966
5265
  readonly run: KayAppAutomationRun;
3967
5266
  readonly activity: KayAppProvenancePage<KayAppAutomationActivityItem>;
3968
- readonly artifacts: KayAppProvenancePage<KayAppAutomationArtifactItem>;
3969
- /**
3970
- * What the run created off this machine. Its own page because it pages on
3971
- * its own cursor; one section with the artifacts wherever it is rendered,
3972
- * because a pull request is something the run produced.
3973
- */
3974
- readonly externalResources: KayAppProvenancePage<KayAppAutomationExternalResourceItem>;
3975
- /** The one list of everything the run produced; it includes every row of the two lists above. */
3976
- readonly producedResources: KayAppAutomationProducedResources;
3977
- readonly suggestions: KayAppProvenancePage<KayAppAutomationSuggestionItem>;
3978
5267
  readonly coverage: KayAppAutomationRunCoverage;
3979
- }
5268
+ };
3980
5269
 
3981
5270
  export declare interface KayAppAutomationRunDetailOptions {
3982
5271
  readonly activityLimit?: number | undefined;
@@ -4981,27 +6270,10 @@ export declare type KayAppModelCompleteOutcome = {
4981
6270
  };
4982
6271
 
4983
6272
  /** Per-million-token model prices projected by the host. */
4984
- export declare interface KayAppModelCost {
4985
- readonly input: number;
4986
- readonly output: number;
4987
- readonly cacheRead: number;
4988
- readonly cacheWrite: number;
4989
- }
6273
+ export declare type KayAppModelCost = Readonly<AgentRuntimeModelCost>;
4990
6274
 
4991
6275
  /** Model capabilities safe for plugin policy and presentation. */
4992
- export declare interface KayAppModelFeatures {
4993
- readonly thinking: boolean;
4994
- readonly vision: boolean;
4995
- readonly toolUse: boolean;
4996
- readonly streaming: boolean;
4997
- readonly reasoning?: boolean;
4998
- readonly inputModalities: readonly KayAppModelModality[];
4999
- readonly outputModalities: readonly KayAppModelModality[];
5000
- readonly structuredOutput?: boolean;
5001
- readonly promptCaching?: boolean;
5002
- readonly contextWindow?: number;
5003
- readonly maxOutputTokens?: number;
5004
- }
6276
+ export declare type KayAppModelFeatures = ReadonlyContract<AgentRuntimeModelFeatures>;
5005
6277
 
5006
6278
  /** The plugin-safe projection of one model in Bonsai's live model catalog. */
5007
6279
  export declare interface KayAppModelInfo {
@@ -5032,7 +6304,7 @@ export declare interface KayAppModelInfo {
5032
6304
  }
5033
6305
 
5034
6306
  /** Input or output modality advertised by a model. */
5035
- export declare type KayAppModelModality = "text" | "image" | "audio" | "video" | "pdf" | "embedding";
6307
+ export declare type KayAppModelModality = AgentRuntimeModality;
5036
6308
 
5037
6309
  /** Safe model catalog plus an optional, consented direct-completion broker. */
5038
6310
  export declare interface KayAppModels {
@@ -5064,14 +6336,7 @@ export declare interface KayAppModelScore {
5064
6336
  }
5065
6337
 
5066
6338
  /** Optional host-curated scores and their provenance. */
5067
- export declare interface KayAppModelScores {
5068
- readonly intelligence?: KayAppModelScore;
5069
- readonly coding?: KayAppModelScore;
5070
- readonly speedTps?: KayAppModelScore;
5071
- readonly categories?: Readonly<Record<string, KayAppModelScore>>;
5072
- readonly source?: string;
5073
- readonly asOf?: string;
5074
- }
6339
+ export declare type KayAppModelScores = ReadonlyContract<AgentRuntimeModelScores>;
5075
6340
 
5076
6341
  export declare type KayAppModelSelection = {
5077
6342
  readonly kind: "specific";
@@ -5198,7 +6463,7 @@ export declare interface KayAppModelSelectionSessionFacts {
5198
6463
  }
5199
6464
 
5200
6465
  /** Bonsai's canonical task-difficulty tier vocabulary at the plugin boundary. */
5201
- export declare type KayAppModelTierId = "small" | "medium" | "large" | "ultra";
6466
+ export declare type KayAppModelTierId = AgentRuntimeModelTierId;
5202
6467
 
5203
6468
  /**
5204
6469
  * The plugin-safe projection of one product model tier (small/medium/large/ultra -
@@ -5208,17 +6473,7 @@ export declare type KayAppModelTierId = "small" | "medium" | "large" | "ultra";
5208
6473
  * something derivable from the model alone (the same model can be curated onto two
5209
6474
  * different tiers), so `listTiers()` is the only seam a plugin reads it through.
5210
6475
  */
5211
- export declare interface KayAppModelTierInfo {
5212
- readonly id: KayAppModelTierId;
5213
- readonly displayName: string;
5214
- readonly description: string;
5215
- readonly resolved?: {
5216
- readonly provider: string;
5217
- readonly modelId: string;
5218
- readonly modelReference: string;
5219
- readonly displayName?: string;
5220
- };
5221
- }
6476
+ export declare type KayAppModelTierInfo = ReadonlyContract<AgentRuntimeModelTierInfo>;
5222
6477
 
5223
6478
  export declare type KayAppOpenOutcome = {
5224
6479
  readonly status: "opened";
@@ -5354,6 +6609,11 @@ export declare interface KayAppPluginApi {
5354
6609
  readonly resourcePicks?: {
5355
6610
  registerCompletion(moduleId: string, handler: PluginResourcePickHandler): void;
5356
6611
  };
6612
+ /**
6613
+ * Working-document providers. Present when the manifest declares `workingDocumentProviders`;
6614
+ * each registration must name one of them.
6615
+ */
6616
+ readonly workingDocuments?: KayAppWorkingDocuments;
5357
6617
  readonly mcp: KayAppMcp;
5358
6618
  /** This plugin's canonical id (already validated by the host registry). */
5359
6619
  readonly id: string;
@@ -5422,6 +6682,8 @@ export declare interface KayAppPluginApi {
5422
6682
  * daemon; see {@link KayAppUserFiles}.
5423
6683
  */
5424
6684
  readonly userFiles: KayAppUserFiles;
6685
+ /** Always present; only modules declared by this plugin may run. SDK 0.54.1. */
6686
+ readonly workers: KayPluginWorkers;
5425
6687
  /**
5426
6688
  * Read/arrange access to the live desktop workspace. Present whenever the host has a workspace
5427
6689
  * (a headless daemon may not); absence is a host fact, never a grant signal. Reading the snapshot
@@ -5703,11 +6965,7 @@ export declare type KayAppProcessRunResult = KayAgentProcessRunResult;
5703
6965
  * daemon could not establish from its session transcripts. The vocabulary is
5704
6966
  * closed; a daemon may emit only some of these codes.
5705
6967
  */
5706
- export declare type KayAppProvenanceGapCode = "legacy-run-id-missing" | "mutation-revision-missing" | "partial-git-provenance" | "git-session-stamp-missing"
5707
- /** A run created something off this machine that the transcript cannot name. */
5708
- | "external-resource-unnamed"
5709
- /** A run's write or edit succeeded and the transcript cannot name the URI it changed. */
5710
- | "produced-resource-unnamed" | "skill-suggestion-unattributable" | "malformed-source-record" | "source-unreadable" | "git-revision-unavailable" | "automation-history-unavailable" | "session-history-unavailable" | "required-evidence-missing";
6968
+ export declare type KayAppProvenanceGapCode = ProvenanceGapCode;
5711
6969
 
5712
6970
  /** One gap, with enum-specific bounded detail; never a raw payload. */
5713
6971
  export declare interface KayAppProvenanceGapSummary {
@@ -5716,12 +6974,9 @@ export declare interface KayAppProvenanceGapSummary {
5716
6974
  }
5717
6975
 
5718
6976
  /** One bounded, coverage-explicit page of run-detail items. */
5719
- export declare interface KayAppProvenancePage<T> {
5720
- readonly items: readonly T[];
5721
- readonly totalCount: number;
6977
+ export declare type KayAppProvenancePage<T> = Omit<ProvenancePage<T>, "nextCursor"> & {
5722
6978
  readonly nextCursor?: string | undefined;
5723
- readonly truncated: boolean;
5724
- }
6979
+ };
5725
6980
 
5726
6981
  /** Options for an app-scoped URI module registration. Only `app` scope exists at this tier. */
5727
6982
  export declare interface KayAppRegisterUriModuleOptions {
@@ -5894,8 +7149,7 @@ export declare interface KayAppRunSummary {
5894
7149
 
5895
7150
  /**
5896
7151
  * The session provenance vocabulary, as the plugin protocol declares it. These used to be spelled
5897
- * out here because the canonical schemas lived in `@bonsai/agent-runtime-protocol`, which this
5898
- * package may not import; they now live in `@bonsai/plugin-protocol` (so artifact writers and the
7152
+ * out here when the canonical schemas lived in `@bonsai/agent-runtime-protocol`; they now live in `@bonsai/plugin-protocol` (so artifact writers and the
5899
7153
  * daemon share one shape), and a mirror here would be exactly the second declaration the
5900
7154
  * placement law forbids. Each name is kept as an alias so existing plugin code keeps compiling.
5901
7155
  */
@@ -5945,33 +7199,7 @@ export declare interface KayAppSessionAgentDefinition {
5945
7199
  * optional field follows one rule: OMITTED says nothing and leaves the standing value alone, while
5946
7200
  * an explicit value replaces it (`[]` withdraws the next steps, `false` clears a compaction offer).
5947
7201
  */
5948
- export declare interface KayAppSessionAnnotation {
5949
- readonly titleChange: string | null;
5950
- readonly summaryAddition: string | null;
5951
- readonly nextSteps?: readonly string[] | undefined;
5952
- /** A one-line label for the closed work block {@link workBlock} names. */
5953
- readonly workHeadline?: string;
5954
- readonly workHeadlineReview?: readonly ({
5955
- readonly labelKind: "result" | "purpose";
5956
- readonly text: string;
5957
- readonly faultProbability: number | null;
5958
- readonly accepted: boolean;
5959
- readonly reason?: string;
5960
- } | {
5961
- readonly attempt: {
5962
- readonly outcome: "none" | "rejected" | "error";
5963
- };
5964
- })[];
5965
- readonly workBlock?: WorkBlockCoverage;
5966
- readonly goodCompactionOpportunity?: boolean;
5967
- /** The last entry the annotation reviewed: the transcript marker's anchor. */
5968
- readonly reviewedThroughEntryId?: string;
5969
- /** A tier the remaining work suits better, or null when the current one still fits. */
5970
- readonly suggestedModelTier?: KayAppModelTierId | null;
5971
- readonly outcomeVerdict?: KayAppSessionOutcomeVerdict | null;
5972
- /** At most three; a verdict naming the annotated session itself is dropped. */
5973
- readonly deferredVerdicts?: readonly KayAppSessionDeferredVerdict[];
5974
- }
7202
+ export declare type KayAppSessionAnnotation = ReadonlyContract<AgentRuntimeSessionStewardEntry>;
5975
7203
 
5976
7204
  /**
5977
7205
  * The generic session-event run door's own cause detail (G1, 2026-09; widened G5, 2026-09).
@@ -6049,12 +7277,7 @@ export declare interface KayAppSessionCostModelBreakdown {
6049
7277
  }
6050
7278
 
6051
7279
  /** Token counts across a set of model calls. */
6052
- export declare interface KayAppSessionCostTokens {
6053
- readonly input: number;
6054
- readonly output: number;
6055
- readonly cacheRead: number;
6056
- readonly cacheWrite: number;
6057
- }
7280
+ export declare type KayAppSessionCostTokens = Readonly<AgentRuntimeSpendWindow["tokens"]>;
6058
7281
 
6059
7282
  export declare type KayAppSessionCreator = SessionCreator;
6060
7283
 
@@ -6269,7 +7492,7 @@ export declare type KayAppSessionListRequest = {
6269
7492
  readonly sessionIds: readonly string[];
6270
7493
  };
6271
7494
 
6272
- export declare type KayAppSessionMode = "default" | "ask" | "allow" | "auto";
7495
+ export declare type KayAppSessionMode = AgentRuntimeSessionMode;
6273
7496
 
6274
7497
  export declare type KayAppSessionOrigin = {
6275
7498
  readonly kind: "user";
@@ -6545,7 +7768,7 @@ export declare type KayAppSessionRunOutcome = (KayAppSessionRunBase & {
6545
7768
  readonly existingSessionId: string;
6546
7769
  };
6547
7770
 
6548
- export declare type KayAppSessionRunState = "running" | "interrupted" | "cancelled" | "failed" | "completed";
7771
+ export declare type KayAppSessionRunState = AgentRuntimeSessionRunState;
6549
7772
 
6550
7773
  /** Settled run outcomes of one session, tallied from its log. */
6551
7774
  export declare interface KayAppSessionRunTally {
@@ -6879,10 +8102,10 @@ export declare interface KayAppSessionSummaryResult {
6879
8102
  }
6880
8103
 
6881
8104
  /** How a session's work is judged to have served the user. `"unclear"` is a real answer, not a failure. */
6882
- export declare type KayAppSessionVerdict = "good" | "mixed" | "bad" | "unclear";
8105
+ export declare type KayAppSessionVerdict = AgentRuntimeSessionOutcomeVerdict;
6883
8106
 
6884
8107
  /** The judge's own certainty: a tuning filter, never a weight the reader applies. */
6885
- export declare type KayAppSessionVerdictConfidence = "low" | "medium" | "high";
8108
+ export declare type KayAppSessionVerdictConfidence = AgentRuntimeSessionOutcomeConfidence;
6886
8109
 
6887
8110
  export declare interface KayAppSessionWorkSummary {
6888
8111
  readonly goal: string;
@@ -7844,7 +9067,7 @@ export declare interface KayAppSystemPromptRenderRequest {
7844
9067
  }
7845
9068
 
7846
9069
  /** Bonsai's reasoning-effort ladder, in ascending order. */
7847
- export declare type KayAppThinkingLevel = "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
9070
+ export declare type KayAppThinkingLevel = AgentRuntimeThinkingLevel;
7848
9071
 
7849
9072
  /**
7850
9073
  * `app.time` / `api.time`: host facts about time. Added to `kay.app` in SDK 0.12.1 and to
@@ -8669,6 +9892,73 @@ export declare type KayAppWorkflowTimeTrigger = Extract<KayAppAutomationConditio
8669
9892
  */
8670
9893
  export declare type KayAppWorkflowTrigger = KayAppWorkflowTimeTrigger | KayAppAutomationPluginEventCondition | KayAppWorkflowSignalsTrigger;
8671
9894
 
9895
+ /** One binary asset pulled with a document (an image, an embed). */
9896
+ export declare interface KayAppWorkingDocumentAsset {
9897
+ /** A file-safe suggested name; the daemon dedupes it. */
9898
+ readonly suggestedName: string;
9899
+ readonly bytes: Uint8Array;
9900
+ readonly mime: string;
9901
+ /** Where it was downloaded from, so a push can put the upstream URL back. */
9902
+ readonly sourceUrl?: string;
9903
+ }
9904
+
9905
+ /**
9906
+ * What one working-document call receives. The daemon owns the local copy, the base text and the
9907
+ * revision guard; a provider only talks to its document source. `auth` is the token the daemon
9908
+ * resolved from the provider's declared `authService`, absent for a provider that declares none.
9909
+ */
9910
+ export declare interface KayAppWorkingDocumentContext {
9911
+ /** The source the person named, as the daemon parsed it: a web link or a URI. */
9912
+ readonly sourceUrl: string;
9913
+ readonly auth?: {
9914
+ readonly accessToken: string;
9915
+ readonly accountId?: string;
9916
+ };
9917
+ readonly signal: AbortSignal;
9918
+ }
9919
+
9920
+ /**
9921
+ * A document source's code, registered for a `workingDocumentProviders` entry the manifest
9922
+ * declares. Which URLs it serves, its display name and its sign-in are manifest data.
9923
+ */
9924
+ export declare interface KayAppWorkingDocumentProvider {
9925
+ pull(ctx: KayAppWorkingDocumentContext): Promise<KayAppWorkingDocumentPull>;
9926
+ push(ctx: KayAppWorkingDocumentContext, input: KayAppWorkingDocumentPushInput): Promise<KayAppWorkingDocumentPushResult>;
9927
+ /** The live upstream revision, which the daemon compares before a push. */
9928
+ checkRevision(ctx: KayAppWorkingDocumentContext): Promise<string>;
9929
+ }
9930
+
9931
+ /** What a pull returns: the document as Markdown, its title, its upstream revision and assets. */
9932
+ export declare interface KayAppWorkingDocumentPull {
9933
+ readonly markdown: string;
9934
+ readonly title: string;
9935
+ readonly revision: string;
9936
+ readonly assets: readonly KayAppWorkingDocumentAsset[];
9937
+ /** Notes for the person who pulled it (blocks that did not convert, rewrites). */
9938
+ readonly notes: readonly string[];
9939
+ }
9940
+
9941
+ /** What a push receives: the text the copy was pulled at and the edited text to write upstream. */
9942
+ export declare interface KayAppWorkingDocumentPushInput {
9943
+ readonly baseText: string;
9944
+ readonly nextText: string;
9945
+ /** The person forced past a changed upstream: overwrite the whole body. */
9946
+ readonly force?: boolean;
9947
+ /** A snippet naming the block to scroll to afterwards; return `anchor` if you can resolve it. */
9948
+ readonly anchorHint?: string;
9949
+ }
9950
+
9951
+ export declare interface KayAppWorkingDocumentPushResult {
9952
+ readonly revision: string;
9953
+ readonly warnings: readonly string[];
9954
+ readonly anchor?: string;
9955
+ }
9956
+
9957
+ export declare interface KayAppWorkingDocuments {
9958
+ /** Register the code for the declared provider `localId`, once, during activation. */
9959
+ registerProvider(localId: string, provider: KayAppWorkingDocumentProvider): void;
9960
+ }
9961
+
8672
9962
  /**
8673
9963
  * Read/arrange access to the live desktop workspace (tabs, panes, the shell chrome). Always
8674
9964
  * present. `snapshot` is ungated; `execute` is checked per call against the `workspace.command`
@@ -8795,7 +10085,7 @@ export declare type KayAppWorkspaceCommand = {
8795
10085
  * The one outcome grammar every {@link KayAppWorkspaceCommand} resolves to. A JSON-safe twin of
8796
10086
  * `WorkspaceCommandOutcome` in `@bonsai/agent-runtime-protocol`.
8797
10087
  */
8798
- export declare type KayAppWorkspaceCommandOutcome = "applied" | "opened" | "focused-existing" | "no-room" | "no-window" | "not-found" | "invalid";
10088
+ export declare type KayAppWorkspaceCommandOutcome = WorkspaceCommandOutcome;
8799
10089
 
8800
10090
  /** Session attribution required on every {@link KayAppWorkspace.execute} call; see the host type's doc comment. */
8801
10091
  export declare interface KayAppWorkspaceExecuteContext {
@@ -8804,14 +10094,12 @@ export declare interface KayAppWorkspaceExecuteContext {
8804
10094
 
8805
10095
  /**
8806
10096
  * The plugin-facing `kay.app` workspace contract (`app.workspace`): the desktop workspace snapshot
8807
- * and the arrangement commands a plugin may run. This package does not import
8808
- * `@bonsai/agent-runtime-protocol`, so these types are JSON-safe, hand-copied twins of that
8809
- * package's workspace shapes. Changes to this contract belong in this module.
10097
+ * and the arrangement commands a plugin may run. Snapshot tabs and command outcomes reuse the
10098
+ * runtime protocol; command inputs retain the plugin's narrower arrangement authority.
8810
10099
  */
8811
10100
  /**
8812
10101
  * What one pane item shows. A JSON-safe, hand-copied twin of `WorkspacePaneContent` in
8813
- * `@bonsai/agent-runtime-protocol` - this package cannot import that protocol package (see this
8814
- * module's own doc comment), so the shape is re-declared here. A parity check in `@bonsai/agent-runtime`
10102
+ * `@bonsai/agent-runtime-protocol`. A parity check in `@bonsai/agent-runtime`
8815
10103
  * asserts `app.workspace` (the runtime's `KayWorkspaceCapability`, built from the protocol types)
8816
10104
  * stays structurally assignable to {@link KayAppWorkspace} below.
8817
10105
  *
@@ -8899,15 +10187,7 @@ export declare interface KayAppWorkspaceSnapshot {
8899
10187
  /** The tab-group colour palette, by name (Chrome's nine); mirrors the wire schema's enum. */
8900
10188
  export declare type KayAppWorkspaceTabGroupColor = "grey" | "blue" | "red" | "yellow" | "green" | "pink" | "purple" | "cyan" | "orange";
8901
10189
 
8902
- export declare interface KayAppWorkspaceTabSnapshot {
8903
- readonly id: string;
8904
- readonly label: string;
8905
- readonly active: boolean;
8906
- readonly variable?: boolean | undefined;
8907
- readonly focusedPaneId: string;
8908
- readonly maximizedPaneId: string | null;
8909
- readonly root: KayAppWorkspacePaneNode;
8910
- }
10190
+ export declare type KayAppWorkspaceTabSnapshot = ReadonlyContract<WorkspaceTabSnapshot>;
8911
10191
 
8912
10192
  /**
8913
10193
  * Each method writes one line. `name` is a stable event name (`sync-failed`), the same for every
@@ -8988,6 +10268,20 @@ export declare interface KayPluginSimulatorOptions {
8988
10268
  readonly stateRoot: string;
8989
10269
  }
8990
10270
 
10271
+ /** A declared module exports this function; input and output must be JSON values. */
10272
+ export declare interface KayPluginWorkerModule {
10273
+ run(input: unknown): unknown | Promise<unknown>;
10274
+ }
10275
+
10276
+ /** Run only this plugin's declared modules in a fresh child owned by its hosting process. */
10277
+ export declare interface KayPluginWorkers {
10278
+ /** The host terminates the child on deadline, caller abort or plugin disposal. */
10279
+ run<T = unknown>(workerId: string, input: unknown, options: {
10280
+ readonly timeoutMs: number;
10281
+ readonly signal?: AbortSignal;
10282
+ }): Promise<T>;
10283
+ }
10284
+
8991
10285
  /** Applies a KeyOf action to the given type. */
8992
10286
  declare function KeyOf<Type extends TSchema>(type: Type, options?: TSchemaOptions): TKeyOf_2<Type>;
8993
10287
 
@@ -10146,6 +11440,15 @@ declare function PickDeferred<Type extends TSchema, Indexer extends TSchema>(typ
10146
11440
  */
10147
11441
  export declare const PLUGIN_EVENT_REFUSED_ERROR_NAME = "PluginEventRefusedError";
10148
11442
 
11443
+ /** An attachment's file name, at most this many characters. */
11444
+ export declare const PLUGIN_SIGNAL_ATTACHMENT_NAME_MAX = 255;
11445
+
11446
+ /** An attachment's media type (`application/pdf`), at most this many characters. */
11447
+ export declare const PLUGIN_SIGNAL_ATTACHMENT_TYPE_MAX = 127;
11448
+
11449
+ /** At most this many entries in a signal's `attachments`; a source lists the first ones. */
11450
+ export declare const PLUGIN_SIGNAL_ATTACHMENTS_MAX = 10;
11451
+
10149
11452
  /** The `kind` values of `PluginSignal` v1. `status` is system state that clears itself. */
10150
11453
  export declare const PLUGIN_SIGNAL_KINDS: readonly ["message", "request", "mention", "invite", "status"];
10151
11454
 
@@ -10344,6 +11647,12 @@ export declare const PluginSignal: z.ZodObject<{
10344
11647
  open: "open";
10345
11648
  resolved: "resolved";
10346
11649
  }>>;
11650
+ attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
11651
+ name: z.ZodString;
11652
+ type: z.ZodString;
11653
+ size: z.ZodNumber;
11654
+ uri: z.ZodString;
11655
+ }, z.core.$strict>>>;
10347
11656
  }, z.core.$strict>;
10348
11657
 
10349
11658
  export declare type PluginSignal = z.infer<typeof PluginSignal>;
@@ -10382,6 +11691,12 @@ export declare const PluginSignalPublish: z.ZodObject<{
10382
11691
  open: "open";
10383
11692
  resolved: "resolved";
10384
11693
  }>>;
11694
+ attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
11695
+ name: z.ZodString;
11696
+ type: z.ZodString;
11697
+ size: z.ZodNumber;
11698
+ uri: z.ZodString;
11699
+ }, z.core.$strict>>>;
10385
11700
  }, z.core.$strict>;
10386
11701
  related: z.ZodObject<{
10387
11702
  thread: z.ZodString;
@@ -10447,6 +11762,15 @@ export declare interface PluginUriWriteOptions extends PluginUriMutationOptions
10447
11762
  readonly writeSource?: UriSourceDescriptor;
10448
11763
  }
10449
11764
 
11765
+ /** A worker refusal or failure; the code is safe to record without its input or output. */
11766
+ export declare class PluginWorkerError extends Error {
11767
+ readonly code: PluginWorkerErrorCode;
11768
+ constructor(code: PluginWorkerErrorCode, message?: string);
11769
+ }
11770
+
11771
+ /** Stable, content-free failure classes for a plugin worker request. */
11772
+ export declare type PluginWorkerErrorCode = "undeclared" | "invalid_module" | "invalid_input" | "input_too_large" | "output_too_large" | "timeout" | "aborted" | "spawn_failed" | "child_failed" | "invalid_output";
11773
+
10450
11774
  export declare interface PreparedAccessApproval {
10451
11775
  readonly uri: string;
10452
11776
  readonly content: Record<string, unknown>;
@@ -10533,6 +11857,31 @@ declare function PropertyMapping(input: [unknown, unknown, unknown, unknown, unk
10533
11857
  /** Extracts a tuple of property values from a TProperties value. */
10534
11858
  declare function PropertyValues<Properties extends TProperties>(properties: Properties): TPropertyValues<Properties>;
10535
11859
 
11860
+ declare const ProvenanceGapCode: z.ZodEnum<{
11861
+ "legacy-run-id-missing": "legacy-run-id-missing";
11862
+ "mutation-revision-missing": "mutation-revision-missing";
11863
+ "partial-git-provenance": "partial-git-provenance";
11864
+ "git-session-stamp-missing": "git-session-stamp-missing";
11865
+ "external-resource-unnamed": "external-resource-unnamed";
11866
+ "produced-resource-unnamed": "produced-resource-unnamed";
11867
+ "skill-suggestion-unattributable": "skill-suggestion-unattributable";
11868
+ "malformed-source-record": "malformed-source-record";
11869
+ "source-unreadable": "source-unreadable";
11870
+ "git-revision-unavailable": "git-revision-unavailable";
11871
+ "automation-history-unavailable": "automation-history-unavailable";
11872
+ "session-history-unavailable": "session-history-unavailable";
11873
+ "required-evidence-missing": "required-evidence-missing";
11874
+ }>;
11875
+
11876
+ declare type ProvenanceGapCode = z.infer<typeof ProvenanceGapCode>;
11877
+
11878
+ declare type ProvenancePage<T> = {
11879
+ readonly items: readonly T[];
11880
+ readonly totalCount: number;
11881
+ readonly nextCursor?: string;
11882
+ readonly truncated: boolean;
11883
+ };
11884
+
10536
11885
  declare type ProviderId = KnownProvider | string;
10537
11886
 
10538
11887
  /**
@@ -10642,6 +11991,10 @@ declare function Readonly_2<Type extends TSchema>(type: Type): TAddReadonly<Type
10642
11991
 
10643
11992
  declare const Readonly_3: (input: string) => [unknown, string] | [];
10644
11993
 
11994
+ declare type ReadonlyContract<T> = T extends readonly (infer Item)[] ? readonly ReadonlyContract<Item>[] : T extends object ? {
11995
+ readonly [Key in keyof T]: ReadonlyContract<T[Key]>;
11996
+ } : T;
11997
+
10645
11998
  declare type ReadonlyKeys<Properties extends TProperties, Result extends PropertyKey = {
10646
11999
  [Key in keyof Properties]: Properties[Key] extends TReadonly<TSchema> ? (Properties[Key] extends TOptional<Properties[Key]> ? never : Key) : never;
10647
12000
  }[keyof Properties]> = Result;
@@ -11015,14 +12368,20 @@ declare const runFailureCauseSchema: z.ZodObject<{
11015
12368
  credentialRef: z.ZodOptional<z.ZodString>;
11016
12369
  }, z.core.$strict>;
11017
12370
 
11018
- declare type RunFailureOccurrence = FailureOccurrence<RunFailureCause>;
12371
+ /**
12372
+ * One run failure record. `Code` and `Domain` default to `string`, as every
12373
+ * reader takes them; a producer passes `RunFailureCode` and
12374
+ * `RunFailureDomain` on the record it makes, so an undeclared code fails to
12375
+ * compile.
12376
+ */
12377
+ declare type RunFailureOccurrence<Code extends string = string, Domain extends string = string> = FailureOccurrence<RunFailureCause, Code, Domain>;
11019
12378
 
11020
12379
  declare type RunFailureReason = (typeof RUN_FAILURE_REASONS)[number];
11021
12380
 
11022
12381
  declare type RunFailureRecord = z.infer<typeof runFailureRecordSchema>;
11023
12382
 
11024
12383
  declare const runFailureRecordSchema: z.ZodObject<{
11025
- failure: z.ZodType<RunFailureOccurrence, unknown, z.core.$ZodTypeInternals<RunFailureOccurrence, unknown>>;
12384
+ failure: z.ZodType<RunFailureOccurrence<string, string>, unknown, z.core.$ZodTypeInternals<RunFailureOccurrence<string, string>, unknown>>;
11026
12385
  errorText: z.ZodString;
11027
12386
  }, z.core.$strict>;
11028
12387
 
@@ -17699,18 +19058,78 @@ declare const WithValue: (input: string) => [unknown, string] | [];
17699
19058
 
17700
19059
  declare function WithValueMapping(input: unknown): unknown;
17701
19060
 
17702
- declare type WorkBlockCoverage = z.infer<typeof WorkBlockCoverageSchema>;
19061
+ declare const WorkspaceCommandOutcome: z.ZodEnum<{
19062
+ invalid: "invalid";
19063
+ opened: "opened";
19064
+ "focused-existing": "focused-existing";
19065
+ "no-room": "no-room";
19066
+ "no-window": "no-window";
19067
+ "not-found": "not-found";
19068
+ applied: "applied";
19069
+ }>;
19070
+
19071
+ declare type WorkspaceCommandOutcome = z.infer<typeof WorkspaceCommandOutcome>;
19072
+
19073
+ declare const WorkspacePaneItem: z.ZodObject<{
19074
+ id: z.ZodString;
19075
+ content: z.ZodDiscriminatedUnion<[z.ZodObject<{
19076
+ kind: z.ZodLiteral<"session">;
19077
+ sessionId: z.ZodString;
19078
+ title: z.ZodString;
19079
+ }, z.core.$strict>, z.ZodObject<{
19080
+ kind: z.ZodLiteral<"browser">;
19081
+ url: z.ZodOptional<z.ZodString>;
19082
+ }, z.core.$strict>, z.ZodObject<{
19083
+ kind: z.ZodLiteral<"artifact">;
19084
+ uri: z.ZodString;
19085
+ name: z.ZodOptional<z.ZodString>;
19086
+ }, z.core.$strict>, z.ZodObject<{
19087
+ kind: z.ZodLiteral<"page">;
19088
+ pageId: z.ZodString;
19089
+ title: z.ZodOptional<z.ZodString>;
19090
+ sessionId: z.ZodOptional<z.ZodString>;
19091
+ objectId: z.ZodOptional<z.ZodString>;
19092
+ }, z.core.$strict>, z.ZodObject<{
19093
+ kind: z.ZodLiteral<"launcher">;
19094
+ }, z.core.$strict>, z.ZodObject<{
19095
+ kind: z.ZodLiteral<"terminal">;
19096
+ }, z.core.$strict>], "kind">;
19097
+ }, z.core.$strict>;
19098
+
19099
+ declare type WorkspacePaneItem = z.infer<typeof WorkspacePaneItem>;
17703
19100
 
17704
19101
  /**
17705
- * Exact ordered completed executions, addressed by persisted tool-result entry IDs.
17706
- * Provider call IDs can repeat across retries and turns; they are never ownership keys.
19102
+ * One node in a tab's pane tree: a leaf holding pane items, or a split dividing space between children.
19103
+ * Recursive - declared as a hand-written TS type first (the standard zod recursive pattern), then
19104
+ * tied to a `z.lazy` schema whose inferred shape the type annotation holds to.
17707
19105
  */
17708
- declare const WorkBlockCoverageSchema: z.ZodObject<{
17709
- firstToolResultEntryId: z.ZodString;
17710
- lastToolResultEntryId: z.ZodString;
17711
- toolResultEntryIds: z.ZodArray<z.ZodString>;
19106
+ declare type WorkspacePaneNode = {
19107
+ type: "leaf";
19108
+ id: string;
19109
+ items: readonly WorkspacePaneItem[];
19110
+ activeItemId: string;
19111
+ } | {
19112
+ type: "split";
19113
+ id: string;
19114
+ orientation: "row" | "column";
19115
+ weights: readonly number[];
19116
+ children: readonly WorkspacePaneNode[];
19117
+ };
19118
+
19119
+ declare const WorkspacePaneNode: z.ZodType<WorkspacePaneNode>;
19120
+
19121
+ declare const WorkspaceTabSnapshot: z.ZodObject<{
19122
+ id: z.ZodString;
19123
+ label: z.ZodString;
19124
+ active: z.ZodBoolean;
19125
+ variable: z.ZodOptional<z.ZodBoolean>;
19126
+ focusedPaneId: z.ZodString;
19127
+ maximizedPaneId: z.ZodNullable<z.ZodString>;
19128
+ root: z.ZodType<WorkspacePaneNode, unknown, z.core.$ZodTypeInternals<WorkspacePaneNode, unknown>>;
17712
19129
  }, z.core.$strict>;
17713
19130
 
19131
+ declare type WorkspaceTabSnapshot = z.infer<typeof WorkspaceTabSnapshot>;
19132
+
17714
19133
  declare interface XAdditionalItems<AdditionalItems extends XSchema = XSchema> {
17715
19134
  additionalItems: AdditionalItems;
17716
19135
  }