@yaklabs-ai/plugin-sdk 0.53.0 → 0.54.1

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, unknown, z.core.$ZodTypeInternals<RunFailureOccurrence, 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.
@@ -1338,6 +2699,21 @@ declare class EncodeBuilder<Type extends TSchema, Encoded extends unknown, Decod
1338
2699
  Encode(callback: TEncodeCallback<Encoded, Decoded>): TCodec<Type, Decoded>;
1339
2700
  }
1340
2701
 
2702
+ export declare const EndpointContribution: z.ZodObject<{
2703
+ localId: z.ZodString;
2704
+ displayName: z.ZodOptional<z.ZodString>;
2705
+ requestSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>>;
2706
+ responseSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>>;
2707
+ auth: z.ZodOptional<z.ZodObject<{
2708
+ service: z.ZodString;
2709
+ schemes: z.ZodArray<z.ZodString>;
2710
+ purpose: z.ZodString;
2711
+ }, z.core.$strict>>;
2712
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
2713
+ }, z.core.$strict>;
2714
+
2715
+ export declare type EndpointContribution = z.infer<typeof EndpointContribution>;
2716
+
1341
2717
  declare interface EntryBase {
1342
2718
  id: string;
1343
2719
  parentId: string | null;
@@ -2183,6 +3559,12 @@ declare type JsonValue_4 = JsonPrimitive | {
2183
3559
  readonly [key: string]: JsonValue_4;
2184
3560
  } | readonly JsonValue_4[];
2185
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
+
2186
3568
  /**
2187
3569
  * Every condition kind an automation can be created with, as runtime data.
2188
3570
  *
@@ -2915,11 +4297,48 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2915
4297
  * 0.53.0 adds declared working-content layouts, family-root authority, draft projection discovery
2916
4298
  * and session-bound page references. Older customized Whiteboard copies must accept the plugin
2917
4299
  * update before using these interfaces.
4300
+ *
4301
+ * 0.54.0 adds named UI host grants for shared configuration/auth/account reads, retained connection
4302
+ * progress/dismissal and support. Built-in-only page capability scopes are removed; executable
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.
2918
4307
  */
2919
- declare const KAY_PLUGIN_SDK_VERSION: "0.53.0";
4308
+ declare const KAY_PLUGIN_SDK_VERSION: "0.54.1";
2920
4309
 
2921
4310
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2922
4311
 
4312
+ /**
4313
+ * One process the plugin asks the host to run.
4314
+ *
4315
+ * `argvClass` is required and is NOT decoration: it names the class of argument vector this
4316
+ * invocation belongs to, and it must match a class the plugin declared alongside `command` in its
4317
+ * manifest. Declaring a command alone would authorize `git log` and `git push --force` identically;
4318
+ * the class is what a user can be shown and asked to consent to. The host judges the real `args`
4319
+ * against the named class and refuses with `argv-outside-class` when they do not belong to it.
4320
+ */
4321
+ declare interface KayAgentProcessRunRequest {
4322
+ readonly command: string;
4323
+ readonly argvClass: string;
4324
+ readonly args: readonly string[];
4325
+ /** Abort the run; the host kills the DIRECT child and rejects - a forked descendant may outlive it (#6153). */
4326
+ readonly signal?: AbortSignal;
4327
+ }
4328
+
4329
+ /**
4330
+ * A finished run. `stdout`/`stderr` are decoded text, and the host CAPS them - a truncation flag is
4331
+ * set rather than the output silently ending, so a plugin parsing the stream can tell "the command
4332
+ * printed this" apart from "the command printed more than we kept".
4333
+ */
4334
+ declare interface KayAgentProcessRunResult {
4335
+ readonly exitCode: number;
4336
+ readonly stdout: string;
4337
+ readonly stderr: string;
4338
+ readonly stdoutTruncated?: boolean;
4339
+ readonly stderrTruncated?: boolean;
4340
+ }
4341
+
2923
4342
  declare interface KayAgentWhiteboardCreateInput {
2924
4343
  readonly name: string;
2925
4344
  readonly title: string;
@@ -3334,13 +4753,7 @@ export declare interface KayAppAgentDefinitionConfig {
3334
4753
  }
3335
4754
 
3336
4755
  /** A plugin-authored definition's structured-output contract (the wire's final-output shape). */
3337
- export declare interface KayAppAgentDefinitionFinalOutput {
3338
- /** JSON Schema for the structured value a matching turn submits. */
3339
- readonly schema: JsonSchema;
3340
- readonly required?: boolean | "per-run";
3341
- readonly sessionTitle?: boolean;
3342
- readonly whenToSubmit?: string;
3343
- }
4756
+ export declare type KayAppAgentDefinitionFinalOutput = ReadonlyContract<AgentRuntimeFinalOutputContract>;
3344
4757
 
3345
4758
  /**
3346
4759
  * An opaque handle to one definition THIS plugin registered. `define` returns it; `sessions.run`
@@ -3438,16 +4851,7 @@ export declare interface KayAppAgents {
3438
4851
  }): Promise<KayAppSessionRunOutcome>;
3439
4852
  }
3440
4853
 
3441
- export declare interface KayAppArtifact {
3442
- readonly uri: string;
3443
- readonly kind: string;
3444
- readonly name: string;
3445
- readonly title: string;
3446
- readonly updatedAtMs: number;
3447
- readonly mimeType?: string | undefined;
3448
- readonly sizeBytes?: number | undefined;
3449
- readonly committedVersionState?: KayAppArtifactCommittedVersionState | undefined;
3450
- }
4854
+ export declare type KayAppArtifact = ReadonlyContract<AgentRuntimeArtifact>;
3451
4855
 
3452
4856
  export declare type KayAppArtifactCommittedVersionState = {
3453
4857
  readonly state: "draft";
@@ -3479,6 +4883,16 @@ export declare type KayAppArtifactOutputFile = {
3479
4883
  };
3480
4884
 
3481
4885
  export declare interface KayAppArtifactOutputs extends Omit<KayAppKnowledgeSource, "watchRoots"> {
4886
+ /**
4887
+ * One page of canonical output URIs across every chat or, with `sessionId`,
4888
+ * only that chat's outputs. A cursor continues the enumeration it came from.
4889
+ */
4890
+ enumerate(options: {
4891
+ readonly cursor?: JsonValue;
4892
+ readonly limit: number;
4893
+ readonly signal: AbortSignal;
4894
+ readonly sessionId?: string;
4895
+ }): ReturnType<KayAppKnowledgeSource["enumerate"]>;
3482
4896
  subscribe(listener: (change: ArtifactOutputChange) => void): () => void;
3483
4897
  /**
3484
4898
  * The exact bytes of one canonical `output://<session>/<name>` file, at most `maxBytes`
@@ -3494,6 +4908,13 @@ export declare interface KayAppArtifactOutputs extends Omit<KayAppKnowledgeSourc
3494
4908
  export declare interface KayAppArtifacts {
3495
4909
  /** Activation-only request for the public artifacts.read {kind: output} capability. */
3496
4910
  outputs(): KayAppArtifactOutputs;
4911
+ /**
4912
+ * Private API: only plugins Bonsai ships; refused for any other. The absolute path of the file
4913
+ * an address names as `sessionId`'s agent would see it (`output://`, `file://` and the other
4914
+ * file-backed schemes), or `undefined` when it names no readable file. Checked against
4915
+ * `artifacts.resolve-file`; a refused call rejects.
4916
+ */
4917
+ resolveFile?(sessionId: string, uri: string): Promise<string | undefined>;
3497
4918
  }
3498
4919
 
3499
4920
  /** A persisted assistant message, published without waiting for its subscribers. */
@@ -3548,44 +4969,15 @@ export declare interface KayAppAuth {
3548
4969
  * run had more than one admitted input at that point; it does not choose a
3549
4970
  * winner.
3550
4971
  */
3551
- export declare interface KayAppAutomationActivityItem {
3552
- readonly sessionId: string;
3553
- readonly sessionRunId: string;
3554
- /**
3555
- * `direct`: the automation run's own input admitted this session run.
3556
- * `child`: this session was created by a session run the automation run
3557
- * started, and its first run is reported.
3558
- */
3559
- readonly kind: "direct" | "child";
3560
- readonly shared: boolean;
4972
+ export declare type KayAppAutomationActivityItem = Omit<Readonly<AutomationActivityItem>, "session"> & {
3561
4973
  readonly session: KayAppSessionSummary;
3562
- }
4974
+ };
3563
4975
 
3564
4976
  /**
3565
4977
  * One Git-backed artifact TARGET a run-detail read reports (R3 populated):
3566
4978
  * the thing produced or changed, with its revisions collapsed behind it.
3567
4979
  */
3568
- export declare interface KayAppAutomationArtifactItem {
3569
- readonly uri: string;
3570
- readonly moduleId: string;
3571
- /**
3572
- * The authoring session. Required on the wire, and load-bearing rather than
3573
- * decorative: it is the session an `app:artifact:output` uri must be
3574
- * resolved against to open at all.
3575
- */
3576
- readonly sessionId: string;
3577
- /** Collapsed by precedence: `deleted` > `created` > `updated`. */
3578
- readonly action: "created" | "updated" | "deleted";
3579
- /**
3580
- * One real revision of the group, carrying the action above. Not
3581
- * necessarily the newest revision of the target.
3582
- */
3583
- readonly revision: string;
3584
- /** How many revisions this row collapsed. Always at least 1. */
3585
- readonly revisionCount: number;
3586
- readonly offBranch: boolean;
3587
- readonly shared: boolean;
3588
- }
4980
+ export declare type KayAppAutomationArtifactItem = Readonly<AutomationArtifactItem>;
3589
4981
 
3590
4982
  export declare interface KayAppAutomationBinding {
3591
4983
  readonly id: string;
@@ -3754,17 +5146,9 @@ export declare type KayAppAutomationEffectInput = {
3754
5146
  * abandoned transcript branch does not un-open a pull request, so branch
3755
5147
  * membership is never consulted for these facts.
3756
5148
  */
3757
- export declare interface KayAppAutomationExternalResourceItem {
3758
- /** The canonical resource URL the session's own transcript printed. */
3759
- readonly url: string;
3760
- readonly kind: "github-pr";
3761
- /** The session whose run created it. */
3762
- readonly sessionId: string;
3763
- /** That session run had more than one admitted input at the time. */
3764
- readonly shared: boolean;
3765
- }
5149
+ export declare type KayAppAutomationExternalResourceItem = Readonly<AutomationExternalResourceItem>;
3766
5150
 
3767
- export declare type KayAppAutomationFactSource = "run-settled" | "tool-used" | "tool-failed";
5151
+ export declare type KayAppAutomationFactSource = AgentRuntimeAutomationFactSource;
3768
5152
 
3769
5153
  export declare type KayAppAutomationMatch = {
3770
5154
  readonly kind: "plugin-event";
@@ -3844,20 +5228,7 @@ export declare interface KayAppAutomationPluginEventCondition {
3844
5228
  * resource's canonical https URL. Stated action evidence wins over inferred
3845
5229
  * verb evidence; within the same certainty, action precedence decides.
3846
5230
  */
3847
- export declare interface KayAppAutomationProducedResourceItem {
3848
- readonly uri: string;
3849
- /** Stated evidence beats inferred evidence; within one certainty, `deleted` > `created` > `updated`. Only an artifact receipt reports `deleted`. */
3850
- readonly action: "created" | "updated" | "deleted";
3851
- /** The first activity-ordered session carrying the winning certainty and action; for a session-scoped URI, the session it resolves against. */
3852
- readonly sessionId: string;
3853
- /** 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. */
3854
- readonly revision?: {
3855
- readonly id: string;
3856
- readonly count: number;
3857
- } | undefined;
3858
- readonly offBranch: boolean;
3859
- readonly shared: boolean;
3860
- }
5231
+ export declare type KayAppAutomationProducedResourceItem = ReadonlyContract<AutomationProducedResourceItem>;
3861
5232
 
3862
5233
  /** Every URI one run produced, served whole: at most 1,000 rows, `truncated` when there were more. */
3863
5234
  export declare interface KayAppAutomationProducedResources {
@@ -3880,37 +5251,16 @@ export declare interface KayAppAutomationRun {
3880
5251
  }
3881
5252
 
3882
5253
  /** Projection coverage state: how current the read model is for this answer. */
3883
- export declare interface KayAppAutomationRunCoverage {
3884
- readonly state: "complete" | "partial" | "rebuilding";
3885
- readonly asOfMs: number;
3886
- /**
3887
- * An opaque token over ONE materialized root's product-visible state;
3888
- * present only when this answer describes exactly one materialized root,
3889
- * absent otherwise (synthesized, `rebuilding`, or an aggregate over more
3890
- * than one root - a stamp is inherently single-root). Compare for
3891
- * equality only - never parse, order, or decompose it. Equal means that
3892
- * root has not moved; a missing stamp means unknown, so treat it as moved.
3893
- */
3894
- readonly stamp?: string | undefined;
3895
- readonly gaps: readonly KayAppProvenanceGapSummary[];
3896
- }
5254
+ export declare type KayAppAutomationRunCoverage = Omit<ReadonlyContract<AutomationRunCoverage>, "state"> & {
5255
+ readonly state: AutomationRunCoverage["state"] | "rebuilding";
5256
+ };
3897
5257
 
3898
5258
  /** One automation run's provenance detail (RFC Release 2). */
3899
- export declare interface KayAppAutomationRunDetail {
5259
+ export declare type KayAppAutomationRunDetail = ReadonlyContract<Omit<AgentRuntimeAutomationRunDetail, "run" | "activity" | "coverage">> & {
3900
5260
  readonly run: KayAppAutomationRun;
3901
5261
  readonly activity: KayAppProvenancePage<KayAppAutomationActivityItem>;
3902
- readonly artifacts: KayAppProvenancePage<KayAppAutomationArtifactItem>;
3903
- /**
3904
- * What the run created off this machine. Its own page because it pages on
3905
- * its own cursor; one section with the artifacts wherever it is rendered,
3906
- * because a pull request is something the run produced.
3907
- */
3908
- readonly externalResources: KayAppProvenancePage<KayAppAutomationExternalResourceItem>;
3909
- /** The one list of everything the run produced; it includes every row of the two lists above. */
3910
- readonly producedResources: KayAppAutomationProducedResources;
3911
- readonly suggestions: KayAppProvenancePage<KayAppAutomationSuggestionItem>;
3912
5262
  readonly coverage: KayAppAutomationRunCoverage;
3913
- }
5263
+ };
3914
5264
 
3915
5265
  export declare interface KayAppAutomationRunDetailOptions {
3916
5266
  readonly activityLimit?: number | undefined;
@@ -4915,27 +6265,10 @@ export declare type KayAppModelCompleteOutcome = {
4915
6265
  };
4916
6266
 
4917
6267
  /** Per-million-token model prices projected by the host. */
4918
- export declare interface KayAppModelCost {
4919
- readonly input: number;
4920
- readonly output: number;
4921
- readonly cacheRead: number;
4922
- readonly cacheWrite: number;
4923
- }
6268
+ export declare type KayAppModelCost = Readonly<AgentRuntimeModelCost>;
4924
6269
 
4925
6270
  /** Model capabilities safe for plugin policy and presentation. */
4926
- export declare interface KayAppModelFeatures {
4927
- readonly thinking: boolean;
4928
- readonly vision: boolean;
4929
- readonly toolUse: boolean;
4930
- readonly streaming: boolean;
4931
- readonly reasoning?: boolean;
4932
- readonly inputModalities: readonly KayAppModelModality[];
4933
- readonly outputModalities: readonly KayAppModelModality[];
4934
- readonly structuredOutput?: boolean;
4935
- readonly promptCaching?: boolean;
4936
- readonly contextWindow?: number;
4937
- readonly maxOutputTokens?: number;
4938
- }
6271
+ export declare type KayAppModelFeatures = ReadonlyContract<AgentRuntimeModelFeatures>;
4939
6272
 
4940
6273
  /** The plugin-safe projection of one model in Bonsai's live model catalog. */
4941
6274
  export declare interface KayAppModelInfo {
@@ -4966,7 +6299,7 @@ export declare interface KayAppModelInfo {
4966
6299
  }
4967
6300
 
4968
6301
  /** Input or output modality advertised by a model. */
4969
- export declare type KayAppModelModality = "text" | "image" | "audio" | "video" | "pdf" | "embedding";
6302
+ export declare type KayAppModelModality = AgentRuntimeModality;
4970
6303
 
4971
6304
  /** Safe model catalog plus an optional, consented direct-completion broker. */
4972
6305
  export declare interface KayAppModels {
@@ -4998,14 +6331,7 @@ export declare interface KayAppModelScore {
4998
6331
  }
4999
6332
 
5000
6333
  /** Optional host-curated scores and their provenance. */
5001
- export declare interface KayAppModelScores {
5002
- readonly intelligence?: KayAppModelScore;
5003
- readonly coding?: KayAppModelScore;
5004
- readonly speedTps?: KayAppModelScore;
5005
- readonly categories?: Readonly<Record<string, KayAppModelScore>>;
5006
- readonly source?: string;
5007
- readonly asOf?: string;
5008
- }
6334
+ export declare type KayAppModelScores = ReadonlyContract<AgentRuntimeModelScores>;
5009
6335
 
5010
6336
  export declare type KayAppModelSelection = {
5011
6337
  readonly kind: "specific";
@@ -5132,7 +6458,7 @@ export declare interface KayAppModelSelectionSessionFacts {
5132
6458
  }
5133
6459
 
5134
6460
  /** Bonsai's canonical task-difficulty tier vocabulary at the plugin boundary. */
5135
- export declare type KayAppModelTierId = "small" | "medium" | "large" | "ultra";
6461
+ export declare type KayAppModelTierId = AgentRuntimeModelTierId;
5136
6462
 
5137
6463
  /**
5138
6464
  * The plugin-safe projection of one product model tier (small/medium/large/ultra -
@@ -5142,17 +6468,7 @@ export declare type KayAppModelTierId = "small" | "medium" | "large" | "ultra";
5142
6468
  * something derivable from the model alone (the same model can be curated onto two
5143
6469
  * different tiers), so `listTiers()` is the only seam a plugin reads it through.
5144
6470
  */
5145
- export declare interface KayAppModelTierInfo {
5146
- readonly id: KayAppModelTierId;
5147
- readonly displayName: string;
5148
- readonly description: string;
5149
- readonly resolved?: {
5150
- readonly provider: string;
5151
- readonly modelId: string;
5152
- readonly modelReference: string;
5153
- readonly displayName?: string;
5154
- };
5155
- }
6471
+ export declare type KayAppModelTierInfo = ReadonlyContract<AgentRuntimeModelTierInfo>;
5156
6472
 
5157
6473
  export declare type KayAppOpenOutcome = {
5158
6474
  readonly status: "opened";
@@ -5198,6 +6514,13 @@ export declare interface KayAppPaths {
5198
6514
  * empty directory rather than an error.
5199
6515
  */
5200
6516
  readonly sessionsRoot?: string;
6517
+ /**
6518
+ * Absolute path to the folder holding the scratch working folders of chats started without a
6519
+ * folder of their own (`<chatsRoot>/<id>`). Files written there belong to that one chat. Ask for
6520
+ * this rather than deriving it: Desktop keeps it under the app's user-data root, not beside
6521
+ * {@link sessionsRoot}. Absent when the host composed none.
6522
+ */
6523
+ readonly chatsRoot?: string;
5201
6524
  /**
5202
6525
  * Absolute path to Bonsai's local telemetry directory. The live telemetry lane itself is a
5203
6526
  * Postgres table (`telemetry.usage_events`), not anything under this path; it is never a
@@ -5337,6 +6660,11 @@ export declare interface KayAppPluginApi {
5337
6660
  * which blocks the daemon; see {@link KayAppRepos}.
5338
6661
  */
5339
6662
  readonly repos: KayAppRepos;
6663
+ /**
6664
+ * Private API: only plugins Bonsai ships; refused for any other. Runs a program the host bound
6665
+ * for this plugin; see {@link KayAppProcess}. Absent when the host composed no program bindings.
6666
+ */
6667
+ readonly process?: KayAppProcess;
5340
6668
  /**
5341
6669
  * File I/O in user folders (stat, read, list, walk, realpath, write, mkdir, rename), run by the
5342
6670
  * host on its own worker threads under a deadline and answered as a typed result. Always present
@@ -5344,6 +6672,8 @@ export declare interface KayAppPluginApi {
5344
6672
  * daemon; see {@link KayAppUserFiles}.
5345
6673
  */
5346
6674
  readonly userFiles: KayAppUserFiles;
6675
+ /** Always present; only modules declared by this plugin may run. SDK 0.54.1. */
6676
+ readonly workers: KayPluginWorkers;
5347
6677
  /**
5348
6678
  * Read/arrange access to the live desktop workspace. Present whenever the host has a workspace
5349
6679
  * (a headless daemon may not); absence is a host fact, never a grant signal. Reading the snapshot
@@ -5601,18 +6931,31 @@ export declare interface KayAppPollResult<Cursor extends JsonValue> {
5601
6931
  readonly summary?: string;
5602
6932
  }
5603
6933
 
6934
+ /**
6935
+ * Private API: only plugins Bonsai ships; refused for any other. Run a program the host bound
6936
+ * for this plugin, the way {@link import("../kay-agent/index.ts").KayAgentProcess} does for an
6937
+ * agent tool: the plugin names a command and an argument class, the host owns the executable,
6938
+ * which arguments belong to the class, the time limit, the output cap, the working directory and
6939
+ * the environment. Each run is checked against `process.run` and then the exact
6940
+ * `process.spawn {command, argvClass}` claim; a refusal rejects with `KayAgentCapabilityError`,
6941
+ * a timeout resolves with exit code 124.
6942
+ */
6943
+ export declare interface KayAppProcess {
6944
+ run(request: KayAppProcessRunRequest): Promise<KayAppProcessRunResult>;
6945
+ }
6946
+
5604
6947
  export declare type KayAppProcessingSpeed = "standard" | "fast";
5605
6948
 
6949
+ export declare type KayAppProcessRunRequest = KayAgentProcessRunRequest;
6950
+
6951
+ export declare type KayAppProcessRunResult = KayAgentProcessRunResult;
6952
+
5606
6953
  /**
5607
6954
  * A gap reason on the run-detail wire: something about the run's work the
5608
6955
  * daemon could not establish from its session transcripts. The vocabulary is
5609
6956
  * closed; a daemon may emit only some of these codes.
5610
6957
  */
5611
- export declare type KayAppProvenanceGapCode = "legacy-run-id-missing" | "mutation-revision-missing" | "partial-git-provenance" | "git-session-stamp-missing"
5612
- /** A run created something off this machine that the transcript cannot name. */
5613
- | "external-resource-unnamed"
5614
- /** A run's write or edit succeeded and the transcript cannot name the URI it changed. */
5615
- | "produced-resource-unnamed" | "skill-suggestion-unattributable" | "malformed-source-record" | "source-unreadable" | "git-revision-unavailable" | "automation-history-unavailable" | "session-history-unavailable" | "required-evidence-missing";
6958
+ export declare type KayAppProvenanceGapCode = ProvenanceGapCode;
5616
6959
 
5617
6960
  /** One gap, with enum-specific bounded detail; never a raw payload. */
5618
6961
  export declare interface KayAppProvenanceGapSummary {
@@ -5621,12 +6964,9 @@ export declare interface KayAppProvenanceGapSummary {
5621
6964
  }
5622
6965
 
5623
6966
  /** One bounded, coverage-explicit page of run-detail items. */
5624
- export declare interface KayAppProvenancePage<T> {
5625
- readonly items: readonly T[];
5626
- readonly totalCount: number;
6967
+ export declare type KayAppProvenancePage<T> = Omit<ProvenancePage<T>, "nextCursor"> & {
5627
6968
  readonly nextCursor?: string | undefined;
5628
- readonly truncated: boolean;
5629
- }
6969
+ };
5630
6970
 
5631
6971
  /** Options for an app-scoped URI module registration. Only `app` scope exists at this tier. */
5632
6972
  export declare interface KayAppRegisterUriModuleOptions {
@@ -5799,8 +7139,7 @@ export declare interface KayAppRunSummary {
5799
7139
 
5800
7140
  /**
5801
7141
  * The session provenance vocabulary, as the plugin protocol declares it. These used to be spelled
5802
- * out here because the canonical schemas lived in `@bonsai/agent-runtime-protocol`, which this
5803
- * package may not import; they now live in `@bonsai/plugin-protocol` (so artifact writers and the
7142
+ * out here when the canonical schemas lived in `@bonsai/agent-runtime-protocol`; they now live in `@bonsai/plugin-protocol` (so artifact writers and the
5804
7143
  * daemon share one shape), and a mirror here would be exactly the second declaration the
5805
7144
  * placement law forbids. Each name is kept as an alias so existing plugin code keeps compiling.
5806
7145
  */
@@ -5850,33 +7189,7 @@ export declare interface KayAppSessionAgentDefinition {
5850
7189
  * optional field follows one rule: OMITTED says nothing and leaves the standing value alone, while
5851
7190
  * an explicit value replaces it (`[]` withdraws the next steps, `false` clears a compaction offer).
5852
7191
  */
5853
- export declare interface KayAppSessionAnnotation {
5854
- readonly titleChange: string | null;
5855
- readonly summaryAddition: string | null;
5856
- readonly nextSteps?: readonly string[] | undefined;
5857
- /** A one-line label for the closed work block {@link workBlock} names. */
5858
- readonly workHeadline?: string;
5859
- readonly workHeadlineReview?: readonly ({
5860
- readonly labelKind: "result" | "purpose";
5861
- readonly text: string;
5862
- readonly faultProbability: number | null;
5863
- readonly accepted: boolean;
5864
- readonly reason?: string;
5865
- } | {
5866
- readonly attempt: {
5867
- readonly outcome: "none" | "rejected" | "error";
5868
- };
5869
- })[];
5870
- readonly workBlock?: WorkBlockCoverage;
5871
- readonly goodCompactionOpportunity?: boolean;
5872
- /** The last entry the annotation reviewed: the transcript marker's anchor. */
5873
- readonly reviewedThroughEntryId?: string;
5874
- /** A tier the remaining work suits better, or null when the current one still fits. */
5875
- readonly suggestedModelTier?: KayAppModelTierId | null;
5876
- readonly outcomeVerdict?: KayAppSessionOutcomeVerdict | null;
5877
- /** At most three; a verdict naming the annotated session itself is dropped. */
5878
- readonly deferredVerdicts?: readonly KayAppSessionDeferredVerdict[];
5879
- }
7192
+ export declare type KayAppSessionAnnotation = ReadonlyContract<AgentRuntimeSessionStewardEntry>;
5880
7193
 
5881
7194
  /**
5882
7195
  * The generic session-event run door's own cause detail (G1, 2026-09; widened G5, 2026-09).
@@ -5954,12 +7267,7 @@ export declare interface KayAppSessionCostModelBreakdown {
5954
7267
  }
5955
7268
 
5956
7269
  /** Token counts across a set of model calls. */
5957
- export declare interface KayAppSessionCostTokens {
5958
- readonly input: number;
5959
- readonly output: number;
5960
- readonly cacheRead: number;
5961
- readonly cacheWrite: number;
5962
- }
7270
+ export declare type KayAppSessionCostTokens = Readonly<AgentRuntimeSpendWindow["tokens"]>;
5963
7271
 
5964
7272
  export declare type KayAppSessionCreator = SessionCreator;
5965
7273
 
@@ -6174,7 +7482,7 @@ export declare type KayAppSessionListRequest = {
6174
7482
  readonly sessionIds: readonly string[];
6175
7483
  };
6176
7484
 
6177
- export declare type KayAppSessionMode = "default" | "ask" | "allow" | "auto";
7485
+ export declare type KayAppSessionMode = AgentRuntimeSessionMode;
6178
7486
 
6179
7487
  export declare type KayAppSessionOrigin = {
6180
7488
  readonly kind: "user";
@@ -6265,6 +7573,18 @@ export declare type KayAppSessionPageItem = (Omit<Extract<TranscriptPageItem, {
6265
7573
  readonly unreadable: unknown;
6266
7574
  }>;
6267
7575
 
7576
+ /** One write for {@link KayAppSessions.assignProject}. */
7577
+ export declare interface KayAppSessionProjectAssignment {
7578
+ readonly sessionId: string;
7579
+ /**
7580
+ * The project the session must still hold for the write to land: a project id, `null` for "no
7581
+ * project" chosen on purpose, or absent for a session whose project was never decided.
7582
+ */
7583
+ readonly expectedProjectId?: string | null;
7584
+ /** The project to set; `null` sets "no project". */
7585
+ readonly projectId: string | null;
7586
+ }
7587
+
6268
7588
  export declare type KayAppSessionProvenanceRecord = SessionProvenanceRecord;
6269
7589
 
6270
7590
  export declare type KayAppSessionRelationship = SessionRelationship;
@@ -6438,7 +7758,7 @@ export declare type KayAppSessionRunOutcome = (KayAppSessionRunBase & {
6438
7758
  readonly existingSessionId: string;
6439
7759
  };
6440
7760
 
6441
- export declare type KayAppSessionRunState = "running" | "interrupted" | "cancelled" | "failed" | "completed";
7761
+ export declare type KayAppSessionRunState = AgentRuntimeSessionRunState;
6442
7762
 
6443
7763
  /** Settled run outcomes of one session, tallied from its log. */
6444
7764
  export declare interface KayAppSessionRunTally {
@@ -6605,6 +7925,15 @@ export declare interface KayAppSessions {
6605
7925
  } | {
6606
7926
  readonly kind: "unavailable";
6607
7927
  }>;
7928
+ /**
7929
+ * Private API: only plugins Bonsai ships; refused for any other. Set the project of any stored
7930
+ * sessions, each only while it still holds the project the caller last saw (a compare-and-set,
7931
+ * so a person's own choice made meanwhile always wins). Answers one boolean per assignment, in
7932
+ * order: `false` when the session is gone or its project changed. A written session's project
7933
+ * folder and prompt block are refreshed. Checked against `sessions.assign-project`; a refused
7934
+ * call rejects.
7935
+ */
7936
+ assignProject?(assignments: readonly KayAppSessionProjectAssignment[]): Promise<readonly boolean[]>;
6608
7937
  /**
6609
7938
  * Run one hidden headless system session through Bonsai's harness and resolve
6610
7939
  * with its final output - the sole sanctioned way for a `kay.app` plugin to
@@ -6763,10 +8092,10 @@ export declare interface KayAppSessionSummaryResult {
6763
8092
  }
6764
8093
 
6765
8094
  /** How a session's work is judged to have served the user. `"unclear"` is a real answer, not a failure. */
6766
- export declare type KayAppSessionVerdict = "good" | "mixed" | "bad" | "unclear";
8095
+ export declare type KayAppSessionVerdict = AgentRuntimeSessionOutcomeVerdict;
6767
8096
 
6768
8097
  /** The judge's own certainty: a tuning filter, never a weight the reader applies. */
6769
- export declare type KayAppSessionVerdictConfidence = "low" | "medium" | "high";
8098
+ export declare type KayAppSessionVerdictConfidence = AgentRuntimeSessionOutcomeConfidence;
6770
8099
 
6771
8100
  export declare interface KayAppSessionWorkSummary {
6772
8101
  readonly goal: string;
@@ -7692,6 +9021,12 @@ export declare interface KayAppSystemPromptFragment {
7692
9021
  * KayAppSystemPromptRegistration.refresh}.
7693
9022
  */
7694
9023
  readonly maxAgeMs?: number;
9024
+ /**
9025
+ * For text about the chat's project. A forked chat starts with its parent's texts unchanged, so
9026
+ * the model's prompt cache still matches; when set, a fork whose project is then chosen drops the
9027
+ * parent's copy of this text and renders its own. Absent: a fork keeps the parent's text.
9028
+ */
9029
+ readonly forksFollowProject?: boolean;
7695
9030
  /** The text, or `undefined` for none. A rejection leaves the text out and is logged. */
7696
9031
  render(request: KayAppSystemPromptRenderRequest): Promise<string | undefined>;
7697
9032
  }
@@ -7722,7 +9057,7 @@ export declare interface KayAppSystemPromptRenderRequest {
7722
9057
  }
7723
9058
 
7724
9059
  /** Bonsai's reasoning-effort ladder, in ascending order. */
7725
- export declare type KayAppThinkingLevel = "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
9060
+ export declare type KayAppThinkingLevel = AgentRuntimeThinkingLevel;
7726
9061
 
7727
9062
  /**
7728
9063
  * `app.time` / `api.time`: host facts about time. Added to `kay.app` in SDK 0.12.1 and to
@@ -8673,7 +10008,7 @@ export declare type KayAppWorkspaceCommand = {
8673
10008
  * The one outcome grammar every {@link KayAppWorkspaceCommand} resolves to. A JSON-safe twin of
8674
10009
  * `WorkspaceCommandOutcome` in `@bonsai/agent-runtime-protocol`.
8675
10010
  */
8676
- export declare type KayAppWorkspaceCommandOutcome = "applied" | "opened" | "focused-existing" | "no-room" | "no-window" | "not-found" | "invalid";
10011
+ export declare type KayAppWorkspaceCommandOutcome = WorkspaceCommandOutcome;
8677
10012
 
8678
10013
  /** Session attribution required on every {@link KayAppWorkspace.execute} call; see the host type's doc comment. */
8679
10014
  export declare interface KayAppWorkspaceExecuteContext {
@@ -8682,14 +10017,12 @@ export declare interface KayAppWorkspaceExecuteContext {
8682
10017
 
8683
10018
  /**
8684
10019
  * The plugin-facing `kay.app` workspace contract (`app.workspace`): the desktop workspace snapshot
8685
- * and the arrangement commands a plugin may run. This package does not import
8686
- * `@bonsai/agent-runtime-protocol`, so these types are JSON-safe, hand-copied twins of that
8687
- * package's workspace shapes. Changes to this contract belong in this module.
10020
+ * and the arrangement commands a plugin may run. Snapshot tabs and command outcomes reuse the
10021
+ * runtime protocol; command inputs retain the plugin's narrower arrangement authority.
8688
10022
  */
8689
10023
  /**
8690
10024
  * What one pane item shows. A JSON-safe, hand-copied twin of `WorkspacePaneContent` in
8691
- * `@bonsai/agent-runtime-protocol` - this package cannot import that protocol package (see this
8692
- * module's own doc comment), so the shape is re-declared here. A parity check in `@bonsai/agent-runtime`
10025
+ * `@bonsai/agent-runtime-protocol`. A parity check in `@bonsai/agent-runtime`
8693
10026
  * asserts `app.workspace` (the runtime's `KayWorkspaceCapability`, built from the protocol types)
8694
10027
  * stays structurally assignable to {@link KayAppWorkspace} below.
8695
10028
  *
@@ -8777,15 +10110,7 @@ export declare interface KayAppWorkspaceSnapshot {
8777
10110
  /** The tab-group colour palette, by name (Chrome's nine); mirrors the wire schema's enum. */
8778
10111
  export declare type KayAppWorkspaceTabGroupColor = "grey" | "blue" | "red" | "yellow" | "green" | "pink" | "purple" | "cyan" | "orange";
8779
10112
 
8780
- export declare interface KayAppWorkspaceTabSnapshot {
8781
- readonly id: string;
8782
- readonly label: string;
8783
- readonly active: boolean;
8784
- readonly variable?: boolean | undefined;
8785
- readonly focusedPaneId: string;
8786
- readonly maximizedPaneId: string | null;
8787
- readonly root: KayAppWorkspacePaneNode;
8788
- }
10113
+ export declare type KayAppWorkspaceTabSnapshot = ReadonlyContract<WorkspaceTabSnapshot>;
8789
10114
 
8790
10115
  /**
8791
10116
  * Each method writes one line. `name` is a stable event name (`sync-failed`), the same for every
@@ -8866,6 +10191,20 @@ export declare interface KayPluginSimulatorOptions {
8866
10191
  readonly stateRoot: string;
8867
10192
  }
8868
10193
 
10194
+ /** A declared module exports this function; input and output must be JSON values. */
10195
+ export declare interface KayPluginWorkerModule {
10196
+ run(input: unknown): unknown | Promise<unknown>;
10197
+ }
10198
+
10199
+ /** Run only this plugin's declared modules in a fresh child owned by its hosting process. */
10200
+ export declare interface KayPluginWorkers {
10201
+ /** The host terminates the child on deadline, caller abort or plugin disposal. */
10202
+ run<T = unknown>(workerId: string, input: unknown, options: {
10203
+ readonly timeoutMs: number;
10204
+ readonly signal?: AbortSignal;
10205
+ }): Promise<T>;
10206
+ }
10207
+
8869
10208
  /** Applies a KeyOf action to the given type. */
8870
10209
  declare function KeyOf<Type extends TSchema>(type: Type, options?: TSchemaOptions): TKeyOf_2<Type>;
8871
10210
 
@@ -9012,6 +10351,90 @@ declare type MatchTrueLike = (inferred: TProperties) => unknown;
9012
10351
  /** The most labels a recorded choice question may offer, and so the most one filter names. */
9013
10352
  export declare const MAX_CHOICE_LABELS = 64;
9014
10353
 
10354
+ /** The connection state published for one configured MCP server. */
10355
+ export declare type McpServerConnectionState = "disconnected" | "connecting" | "connected" | "needs-auth" | "failed";
10356
+
10357
+ /** A server mark already resolved into a data URI by its publisher. */
10358
+ export declare interface McpServerIcon {
10359
+ /** A `data:` URI. Consumers may render it directly in an `<img src>`. */
10360
+ readonly src: string;
10361
+ /**
10362
+ * Where the mark came from, because the two are not equally trustworthy.
10363
+ *
10364
+ * `declared` is the server's own `serverInfo.icons` (MCP spec 2025-11-25, SEP-973): evidence.
10365
+ * `favicon` is derived from an HTTP server's origin: still evidence, one step removed.
10366
+ * A name match against Bonsai's brand table is neither, and deliberately does not appear here -
10367
+ * that guess lives in the renderer's existing `BrandIcon` fallback, below both of these.
10368
+ */
10369
+ readonly source: "declared" | "favicon";
10370
+ /** The theme the server nominated this variant for, when it declared more than one. */
10371
+ readonly theme?: "light" | "dark";
10372
+ }
10373
+
10374
+ /** One keyed change to the MCP inventory. */
10375
+ export declare type McpServerInventoryChange = {
10376
+ readonly kind: "upsert";
10377
+ readonly server: McpServerRecord;
10378
+ } | {
10379
+ readonly kind: "remove";
10380
+ readonly name: string;
10381
+ };
10382
+
10383
+ /** One configured MCP server in the app-facing inventory. */
10384
+ export declare interface McpServerRecord {
10385
+ /** The config key, and the id the `mcp.<name>` auth service keys on. */
10386
+ readonly name: string;
10387
+ /**
10388
+ * The auth service that connects this server, when it has one: `mcp.<name>` for a plugins.mcp
10389
+ * server, the shipping plugin's own service for a vendored one. The Plugins page joins a
10390
+ * connection row to its server on THIS id - never by deriving a name from the service id,
10391
+ * which only ever fit the user-config namespace and left every vendored server toolless.
10392
+ */
10393
+ readonly authServiceId?: string;
10394
+ /** The server's own `serverInfo.title`, when it sent one. Display prefers it over `name`. */
10395
+ readonly title?: string;
10396
+ readonly transport: "stdio" | "http";
10397
+ /** What the server launches or connects to: joined command for stdio, url for http. */
10398
+ readonly target: string;
10399
+ /** The config-level switch (`enabled: false` in `plugins.mcp`), not the connection. */
10400
+ readonly enabled: boolean;
10401
+ readonly state: McpServerConnectionState;
10402
+ /** Live when connected, else from the persisted metadata cache. Zero is ordinary. */
10403
+ readonly toolCount: number;
10404
+ /**
10405
+ * What this server offers, for a surface that lists it. Live when connected, else from the
10406
+ * persisted metadata cache, so a server names its tools before it has connected this session
10407
+ * and after a restart.
10408
+ *
10409
+ * NAMES AND DESCRIPTIONS ONLY. The JSON-Schema input declarations stay out: they are by far the
10410
+ * biggest part of a tool list, nothing on this surface renders them, and this snapshot is
10411
+ * re-encoded whenever any server changes state. A surface that genuinely needs a schema is
10412
+ * asking a different question and should ask the agent bridge, which owns tool detail.
10413
+ *
10414
+ * Bounded by the publisher's tool-list limit - {@link toolCount} remains the true count, so a
10415
+ * server past the bound still reports honestly even though the list is clipped.
10416
+ */
10417
+ readonly tools?: readonly McpServerToolSummary[];
10418
+ readonly icon?: McpServerIcon;
10419
+ /**
10420
+ * Why a `failed` server failed, in one human-legible line, when the host knows. A broken row can
10421
+ * then say what went wrong instead of only offering Retry.
10422
+ */
10423
+ readonly failure?: string;
10424
+ }
10425
+
10426
+ /** A complete MCP inventory snapshot. */
10427
+ export declare interface McpServersSnapshot {
10428
+ readonly servers: readonly McpServerRecord[];
10429
+ }
10430
+
10431
+ /** A tool name and optional description for inventory presentation. */
10432
+ export declare interface McpServerToolSummary {
10433
+ readonly name: string;
10434
+ /** The server's own one-line description, trimmed to the publisher's summary limit. */
10435
+ readonly description?: string;
10436
+ }
10437
+
9015
10438
  export declare namespace Memory {
9016
10439
  export {
9017
10440
  Assign,
@@ -10241,6 +11664,15 @@ export declare interface PluginUriWriteOptions extends PluginUriMutationOptions
10241
11664
  readonly writeSource?: UriSourceDescriptor;
10242
11665
  }
10243
11666
 
11667
+ /** A worker refusal or failure; the code is safe to record without its input or output. */
11668
+ export declare class PluginWorkerError extends Error {
11669
+ readonly code: PluginWorkerErrorCode;
11670
+ constructor(code: PluginWorkerErrorCode, message?: string);
11671
+ }
11672
+
11673
+ /** Stable, content-free failure classes for a plugin worker request. */
11674
+ export declare type PluginWorkerErrorCode = "undeclared" | "invalid_module" | "invalid_input" | "input_too_large" | "output_too_large" | "timeout" | "aborted" | "spawn_failed" | "child_failed" | "invalid_output";
11675
+
10244
11676
  export declare interface PreparedAccessApproval {
10245
11677
  readonly uri: string;
10246
11678
  readonly content: Record<string, unknown>;
@@ -10256,6 +11688,33 @@ export declare interface PreparedAccessApproval {
10256
11688
  readonly binding?: unknown;
10257
11689
  }
10258
11690
 
11691
+ export declare const ProjectDirectory: z.ZodObject<{
11692
+ id: z.ZodString;
11693
+ path: z.ZodString;
11694
+ defaultCwd: z.ZodString;
11695
+ ancestorIds: z.ZodArray<z.ZodString>;
11696
+ }, z.core.$strict>;
11697
+
11698
+ export declare type ProjectDirectory = z.infer<typeof ProjectDirectory>;
11699
+
11700
+ export declare const ProjectDirectoryRequest: z.ZodObject<{
11701
+ id: z.ZodString;
11702
+ }, z.core.$strict>;
11703
+
11704
+ export declare type ProjectDirectoryRequest = z.infer<typeof ProjectDirectoryRequest>;
11705
+
11706
+ /** `project` is null when no project has the requested id. */
11707
+ export declare const ProjectDirectoryResponse: z.ZodObject<{
11708
+ project: z.ZodNullable<z.ZodObject<{
11709
+ id: z.ZodString;
11710
+ path: z.ZodString;
11711
+ defaultCwd: z.ZodString;
11712
+ ancestorIds: z.ZodArray<z.ZodString>;
11713
+ }, z.core.$strict>>;
11714
+ }, z.core.$strict>;
11715
+
11716
+ export declare type ProjectDirectoryResponse = z.infer<typeof ProjectDirectoryResponse>;
11717
+
10259
11718
  declare const Properties: (input: string) => [unknown, string] | [];
10260
11719
 
10261
11720
  declare function PropertiesMapping(input: [unknown, unknown, unknown]): unknown;
@@ -10300,6 +11759,31 @@ declare function PropertyMapping(input: [unknown, unknown, unknown, unknown, unk
10300
11759
  /** Extracts a tuple of property values from a TProperties value. */
10301
11760
  declare function PropertyValues<Properties extends TProperties>(properties: Properties): TPropertyValues<Properties>;
10302
11761
 
11762
+ declare const ProvenanceGapCode: z.ZodEnum<{
11763
+ "legacy-run-id-missing": "legacy-run-id-missing";
11764
+ "mutation-revision-missing": "mutation-revision-missing";
11765
+ "partial-git-provenance": "partial-git-provenance";
11766
+ "git-session-stamp-missing": "git-session-stamp-missing";
11767
+ "external-resource-unnamed": "external-resource-unnamed";
11768
+ "produced-resource-unnamed": "produced-resource-unnamed";
11769
+ "skill-suggestion-unattributable": "skill-suggestion-unattributable";
11770
+ "malformed-source-record": "malformed-source-record";
11771
+ "source-unreadable": "source-unreadable";
11772
+ "git-revision-unavailable": "git-revision-unavailable";
11773
+ "automation-history-unavailable": "automation-history-unavailable";
11774
+ "session-history-unavailable": "session-history-unavailable";
11775
+ "required-evidence-missing": "required-evidence-missing";
11776
+ }>;
11777
+
11778
+ declare type ProvenanceGapCode = z.infer<typeof ProvenanceGapCode>;
11779
+
11780
+ declare type ProvenancePage<T> = {
11781
+ readonly items: readonly T[];
11782
+ readonly totalCount: number;
11783
+ readonly nextCursor?: string;
11784
+ readonly truncated: boolean;
11785
+ };
11786
+
10303
11787
  declare type ProviderId = KnownProvider | string;
10304
11788
 
10305
11789
  /**
@@ -10409,6 +11893,10 @@ declare function Readonly_2<Type extends TSchema>(type: Type): TAddReadonly<Type
10409
11893
 
10410
11894
  declare const Readonly_3: (input: string) => [unknown, string] | [];
10411
11895
 
11896
+ declare type ReadonlyContract<T> = T extends readonly (infer Item)[] ? readonly ReadonlyContract<Item>[] : T extends object ? {
11897
+ readonly [Key in keyof T]: ReadonlyContract<T[Key]>;
11898
+ } : T;
11899
+
10412
11900
  declare type ReadonlyKeys<Properties extends TProperties, Result extends PropertyKey = {
10413
11901
  [Key in keyof Properties]: Properties[Key] extends TReadonly<TSchema> ? (Properties[Key] extends TOptional<Properties[Key]> ? never : Key) : never;
10414
11902
  }[keyof Properties]> = Result;
@@ -17466,18 +18954,78 @@ declare const WithValue: (input: string) => [unknown, string] | [];
17466
18954
 
17467
18955
  declare function WithValueMapping(input: unknown): unknown;
17468
18956
 
17469
- declare type WorkBlockCoverage = z.infer<typeof WorkBlockCoverageSchema>;
18957
+ declare const WorkspaceCommandOutcome: z.ZodEnum<{
18958
+ invalid: "invalid";
18959
+ opened: "opened";
18960
+ "focused-existing": "focused-existing";
18961
+ "no-room": "no-room";
18962
+ "no-window": "no-window";
18963
+ "not-found": "not-found";
18964
+ applied: "applied";
18965
+ }>;
18966
+
18967
+ declare type WorkspaceCommandOutcome = z.infer<typeof WorkspaceCommandOutcome>;
18968
+
18969
+ declare const WorkspacePaneItem: z.ZodObject<{
18970
+ id: z.ZodString;
18971
+ content: z.ZodDiscriminatedUnion<[z.ZodObject<{
18972
+ kind: z.ZodLiteral<"session">;
18973
+ sessionId: z.ZodString;
18974
+ title: z.ZodString;
18975
+ }, z.core.$strict>, z.ZodObject<{
18976
+ kind: z.ZodLiteral<"browser">;
18977
+ url: z.ZodOptional<z.ZodString>;
18978
+ }, z.core.$strict>, z.ZodObject<{
18979
+ kind: z.ZodLiteral<"artifact">;
18980
+ uri: z.ZodString;
18981
+ name: z.ZodOptional<z.ZodString>;
18982
+ }, z.core.$strict>, z.ZodObject<{
18983
+ kind: z.ZodLiteral<"page">;
18984
+ pageId: z.ZodString;
18985
+ title: z.ZodOptional<z.ZodString>;
18986
+ sessionId: z.ZodOptional<z.ZodString>;
18987
+ objectId: z.ZodOptional<z.ZodString>;
18988
+ }, z.core.$strict>, z.ZodObject<{
18989
+ kind: z.ZodLiteral<"launcher">;
18990
+ }, z.core.$strict>, z.ZodObject<{
18991
+ kind: z.ZodLiteral<"terminal">;
18992
+ }, z.core.$strict>], "kind">;
18993
+ }, z.core.$strict>;
18994
+
18995
+ declare type WorkspacePaneItem = z.infer<typeof WorkspacePaneItem>;
17470
18996
 
17471
18997
  /**
17472
- * Exact ordered completed executions, addressed by persisted tool-result entry IDs.
17473
- * Provider call IDs can repeat across retries and turns; they are never ownership keys.
18998
+ * One node in a tab's pane tree: a leaf holding pane items, or a split dividing space between children.
18999
+ * Recursive - declared as a hand-written TS type first (the standard zod recursive pattern), then
19000
+ * tied to a `z.lazy` schema whose inferred shape the type annotation holds to.
17474
19001
  */
17475
- declare const WorkBlockCoverageSchema: z.ZodObject<{
17476
- firstToolResultEntryId: z.ZodString;
17477
- lastToolResultEntryId: z.ZodString;
17478
- toolResultEntryIds: z.ZodArray<z.ZodString>;
19002
+ declare type WorkspacePaneNode = {
19003
+ type: "leaf";
19004
+ id: string;
19005
+ items: readonly WorkspacePaneItem[];
19006
+ activeItemId: string;
19007
+ } | {
19008
+ type: "split";
19009
+ id: string;
19010
+ orientation: "row" | "column";
19011
+ weights: readonly number[];
19012
+ children: readonly WorkspacePaneNode[];
19013
+ };
19014
+
19015
+ declare const WorkspacePaneNode: z.ZodType<WorkspacePaneNode>;
19016
+
19017
+ declare const WorkspaceTabSnapshot: z.ZodObject<{
19018
+ id: z.ZodString;
19019
+ label: z.ZodString;
19020
+ active: z.ZodBoolean;
19021
+ variable: z.ZodOptional<z.ZodBoolean>;
19022
+ focusedPaneId: z.ZodString;
19023
+ maximizedPaneId: z.ZodNullable<z.ZodString>;
19024
+ root: z.ZodType<WorkspacePaneNode, unknown, z.core.$ZodTypeInternals<WorkspacePaneNode, unknown>>;
17479
19025
  }, z.core.$strict>;
17480
19026
 
19027
+ declare type WorkspaceTabSnapshot = z.infer<typeof WorkspaceTabSnapshot>;
19028
+
17481
19029
  declare interface XAdditionalItems<AdditionalItems extends XSchema = XSchema> {
17482
19030
  additionalItems: AdditionalItems;
17483
19031
  }