@goodtiming/baton-sdk 0.4.1 → 0.5.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/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
 
3
- declare const SDK_VERSION = "ts-0.4.1";
3
+ declare const SDK_VERSION = "ts-0.5.1";
4
4
 
5
5
  /**
6
6
  * Zod schemas + TS types for the Baton event stream per SPEC §11.4.
@@ -42,6 +42,7 @@ declare const ToolCallEndPayloadSchema: z.ZodObject<{
42
42
  tool_name: z.ZodString;
43
43
  result: z.ZodDefault<z.ZodNullable<z.ZodUnknown>>;
44
44
  duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
45
+ result_capture: z.ZodOptional<z.ZodNullable<z.ZodString>>;
45
46
  }, z.core.$strict>;
46
47
  type ToolCallEndPayload = z.infer<typeof ToolCallEndPayloadSchema>;
47
48
  /** Emitted when the call FAILED, which MCP expresses two ways (SPEC §11.4.3):
@@ -85,6 +86,8 @@ declare const ToolCallErrorPayloadSchema: z.ZodObject<{
85
86
  error_body: z.ZodString;
86
87
  duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
87
88
  result: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
89
+ result_capture: z.ZodOptional<z.ZodNullable<z.ZodString>>;
90
+ failure_kind: z.ZodOptional<z.ZodNullable<z.ZodString>>;
88
91
  }, z.core.$strict>;
89
92
  type ToolCallErrorPayload = z.infer<typeof ToolCallErrorPayloadSchema>;
90
93
  /** Agent-supplied context. All fields nullable per SPEC §5.1.1 — the agent
@@ -130,7 +133,8 @@ type SurfaceSnapshotPayload = z.infer<typeof SurfaceSnapshotPayloadSchema>;
130
133
  */
131
134
  declare const DEFAULT_CONSENT_TOKEN = "customer-consented";
132
135
  /** The principal as emitted — `{id, source, form}`, all three REQUIRED
133
- * together (SPEC §11.4). The runtime shape of `identity.PrincipalWire`.
136
+ * together, plus an optional `display_name` (SPEC §11.4). The runtime shape
137
+ * of `identity.PrincipalWire`.
134
138
  *
135
139
  * `.strict()` mirrors Python's `extra="forbid"`: a member this producer does
136
140
  * not know about is a malformed object, not a richer one.
@@ -149,6 +153,7 @@ declare const PrincipalWireSchema: z.ZodObject<{
149
153
  id: z.ZodString;
150
154
  source: z.ZodString;
151
155
  form: z.ZodString;
156
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
152
157
  }, z.core.$strict>;
153
158
  declare const EventTypeSchema: z.ZodEnum<{
154
159
  tool_call_start: "tool_call_start";
@@ -156,8 +161,137 @@ declare const EventTypeSchema: z.ZodEnum<{
156
161
  tool_call_error: "tool_call_error";
157
162
  annotation: "annotation";
158
163
  surface_snapshot: "surface_snapshot";
164
+ resource_list_start: "resource_list_start";
165
+ resource_list_end: "resource_list_end";
166
+ resource_list_error: "resource_list_error";
167
+ resource_read_start: "resource_read_start";
168
+ resource_read_end: "resource_read_end";
169
+ resource_read_error: "resource_read_error";
170
+ prompt_list_start: "prompt_list_start";
171
+ prompt_list_end: "prompt_list_end";
172
+ prompt_list_error: "prompt_list_error";
173
+ prompt_get_start: "prompt_get_start";
174
+ prompt_get_end: "prompt_get_end";
175
+ prompt_get_error: "prompt_get_error";
159
176
  }>;
160
177
  type EventType = z.infer<typeof EventTypeSchema>;
178
+ /** `resources/list` reached the server. Deliberately EMPTY — a list request
179
+ * has no subject, and the envelope already names the session, the tenant and
180
+ * the vendor. `.strict()` with no members is the claim, not an oversight. */
181
+ declare const ResourceListStartPayloadSchema: z.ZodObject<{}, z.core.$strict>;
182
+ type ResourceListStartPayload = z.infer<typeof ResourceListStartPayloadSchema>;
183
+ /** `resources/list` returned.
184
+ *
185
+ * ⚠ `count` counts the `resources` array ALONE. Resource TEMPLATES are a
186
+ * separate MCP method with their own result array and are not added in, so a
187
+ * template-only server reports `0` — correctly — and a consumer MUST NOT read
188
+ * that as "this server has no resources". */
189
+ declare const ResourceListEndPayloadSchema: z.ZodObject<{
190
+ duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
191
+ count: z.ZodNumber;
192
+ }, z.core.$strict>;
193
+ type ResourceListEndPayload = z.infer<typeof ResourceListEndPayloadSchema>;
194
+ /** `resources/list` failed. See `ResourceReadErrorPayloadSchema` for how
195
+ * `error_type` is spelled across producers and why `error_body` is kept. */
196
+ declare const ResourceListErrorPayloadSchema: z.ZodObject<{
197
+ duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
198
+ error_type: z.ZodString;
199
+ error_body: z.ZodString;
200
+ }, z.core.$strict>;
201
+ type ResourceListErrorPayload = z.infer<typeof ResourceListErrorPayloadSchema>;
202
+ /** `resources/read` reached the server.
203
+ *
204
+ * ⚠ **`uri` is ALSO inside `params`.** The proxy builds `params` by removing
205
+ * `_meta` from the request's params and nothing else, and `uri` is one of
206
+ * them — so the subject appears twice. Recorded rather than deduplicated: the
207
+ * dedicated member is what a consumer reads, the bag is what the caller
208
+ * actually sent, and a producer that stripped `uri` out of it would stop being
209
+ * able to say that. */
210
+ declare const ResourceReadStartPayloadSchema: z.ZodObject<{
211
+ uri: z.ZodString;
212
+ params: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
213
+ }, z.core.$strict>;
214
+ type ResourceReadStartPayload = z.infer<typeof ResourceReadStartPayloadSchema>;
215
+ /** `resources/read` returned.
216
+ *
217
+ * ⚠ **No content member, and that is the design.** The resource BODY is
218
+ * customer data of exactly the kind the response-capture switch exists to keep
219
+ * off the wire, and the only producer there was never sent it. URI plus timing
220
+ * is what makes a failing or slow read visible without it. */
221
+ declare const ResourceReadEndPayloadSchema: z.ZodObject<{
222
+ duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
223
+ uri: z.ZodString;
224
+ }, z.core.$strict>;
225
+ type ResourceReadEndPayload = z.infer<typeof ResourceReadEndPayloadSchema>;
226
+ /** `resources/read` failed.
227
+ *
228
+ * ⚠ **`error_type` is an unconstrained string and the producers do NOT agree
229
+ * on how to spell it** — stated here for all six error payloads.
230
+ * `baton-proxy` reads the WIRE, so it holds the upstream's JSON-RPC error and
231
+ * files the numeric `code` as a string; this package holds a live exception
232
+ * and files its class name, the way §11.4.3's RAISE shape already does for
233
+ * tools. Both conform — §11.4.3 says this member separates SHAPES and is not a
234
+ * closed set of values — and a consumer MUST NOT read one producer's spelling
235
+ * as the vocabulary.
236
+ *
237
+ * ⚠ **`error_body` is KEPT under every capture mode.** It is a failed FETCH's
238
+ * message, not anything a resource returned, so nothing here is
239
+ * result-derived. */
240
+ declare const ResourceReadErrorPayloadSchema: z.ZodObject<{
241
+ duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
242
+ error_type: z.ZodString;
243
+ error_body: z.ZodString;
244
+ uri: z.ZodString;
245
+ }, z.core.$strict>;
246
+ type ResourceReadErrorPayload = z.infer<typeof ResourceReadErrorPayloadSchema>;
247
+ /** `prompts/list` reached the server. Empty, for the reason
248
+ * `ResourceListStartPayloadSchema` carries. */
249
+ declare const PromptListStartPayloadSchema: z.ZodObject<{}, z.core.$strict>;
250
+ type PromptListStartPayload = z.infer<typeof PromptListStartPayloadSchema>;
251
+ /** `prompts/list` returned. `count` counts the `prompts` array. */
252
+ declare const PromptListEndPayloadSchema: z.ZodObject<{
253
+ duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
254
+ count: z.ZodNumber;
255
+ }, z.core.$strict>;
256
+ type PromptListEndPayload = z.infer<typeof PromptListEndPayloadSchema>;
257
+ /** `prompts/list` failed. See `ResourceReadErrorPayloadSchema`. */
258
+ declare const PromptListErrorPayloadSchema: z.ZodObject<{
259
+ duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
260
+ error_type: z.ZodString;
261
+ error_body: z.ZodString;
262
+ }, z.core.$strict>;
263
+ type PromptListErrorPayload = z.infer<typeof PromptListErrorPayloadSchema>;
264
+ /** `prompts/get` reached the server.
265
+ *
266
+ * ⚠ **`params` is the request's `arguments` member ALONE, not the whole params
267
+ * bag** — the opposite of `ResourceReadStartPayloadSchema`'s choice, measured
268
+ * in the proxy. The two are inconsistent in the only producer that existed;
269
+ * the inconsistency is recorded so a reader does not expect `name` inside
270
+ * `params` the way `uri` does appear there. */
271
+ declare const PromptGetStartPayloadSchema: z.ZodObject<{
272
+ name: z.ZodString;
273
+ params: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
274
+ }, z.core.$strict>;
275
+ type PromptGetStartPayload = z.infer<typeof PromptGetStartPayloadSchema>;
276
+ /** `prompts/get` returned.
277
+ *
278
+ * ⚠ **No rendered messages.** A prompt's text is authored by the SERVER rather
279
+ * than fetched by a tool, so whether it is customer content at all is a
280
+ * decision nobody has taken — and the standing answer, from the only producer,
281
+ * is that it does not egress. */
282
+ declare const PromptGetEndPayloadSchema: z.ZodObject<{
283
+ duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
284
+ name: z.ZodString;
285
+ }, z.core.$strict>;
286
+ type PromptGetEndPayload = z.infer<typeof PromptGetEndPayloadSchema>;
287
+ /** `prompts/get` failed. See `ResourceReadErrorPayloadSchema`. */
288
+ declare const PromptGetErrorPayloadSchema: z.ZodObject<{
289
+ duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
290
+ error_type: z.ZodString;
291
+ error_body: z.ZodString;
292
+ name: z.ZodString;
293
+ }, z.core.$strict>;
294
+ type PromptGetErrorPayload = z.infer<typeof PromptGetErrorPayloadSchema>;
161
295
  declare const ToolCallStartEventSchema: z.ZodObject<{
162
296
  event_type: z.ZodDefault<z.ZodLiteral<"tool_call_start">>;
163
297
  payload: z.ZodObject<{
@@ -181,18 +315,481 @@ declare const ToolCallStartEventSchema: z.ZodObject<{
181
315
  id: z.ZodString;
182
316
  source: z.ZodString;
183
317
  form: z.ZodString;
318
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
319
+ }, z.core.$strict>>>;
320
+ transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
321
+ call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
322
+ runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
323
+ }, z.core.$strict>;
324
+ type ToolCallStartEvent = z.infer<typeof ToolCallStartEventSchema>;
325
+ declare const ToolCallEndEventSchema: z.ZodObject<{
326
+ event_type: z.ZodDefault<z.ZodLiteral<"tool_call_end">>;
327
+ payload: z.ZodObject<{
328
+ tool_name: z.ZodString;
329
+ result: z.ZodDefault<z.ZodNullable<z.ZodUnknown>>;
330
+ duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
331
+ result_capture: z.ZodOptional<z.ZodNullable<z.ZodString>>;
332
+ }, z.core.$strict>;
333
+ event_id: z.ZodDefault<z.ZodUUID>;
334
+ tenant_id: z.ZodString;
335
+ vendor_id: z.ZodString;
336
+ session_id: z.ZodString;
337
+ sequence_number: z.ZodNumber;
338
+ captured_at: z.ZodString;
339
+ consent_token: z.ZodString;
340
+ sdk_version: z.ZodDefault<z.ZodString>;
341
+ agent_runtime: z.ZodDefault<z.ZodString>;
342
+ principal: z.ZodDefault<z.ZodNullable<z.ZodObject<{
343
+ id: z.ZodString;
344
+ source: z.ZodString;
345
+ form: z.ZodString;
346
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
347
+ }, z.core.$strict>>>;
348
+ transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
349
+ call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
350
+ runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
351
+ }, z.core.$strict>;
352
+ type ToolCallEndEvent = z.infer<typeof ToolCallEndEventSchema>;
353
+ declare const ToolCallErrorEventSchema: z.ZodObject<{
354
+ event_type: z.ZodDefault<z.ZodLiteral<"tool_call_error">>;
355
+ payload: z.ZodObject<{
356
+ tool_name: z.ZodString;
357
+ error_type: z.ZodString;
358
+ error_body: z.ZodString;
359
+ duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
360
+ result: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
361
+ result_capture: z.ZodOptional<z.ZodNullable<z.ZodString>>;
362
+ failure_kind: z.ZodOptional<z.ZodNullable<z.ZodString>>;
363
+ }, z.core.$strict>;
364
+ event_id: z.ZodDefault<z.ZodUUID>;
365
+ tenant_id: z.ZodString;
366
+ vendor_id: z.ZodString;
367
+ session_id: z.ZodString;
368
+ sequence_number: z.ZodNumber;
369
+ captured_at: z.ZodString;
370
+ consent_token: z.ZodString;
371
+ sdk_version: z.ZodDefault<z.ZodString>;
372
+ agent_runtime: z.ZodDefault<z.ZodString>;
373
+ principal: z.ZodDefault<z.ZodNullable<z.ZodObject<{
374
+ id: z.ZodString;
375
+ source: z.ZodString;
376
+ form: z.ZodString;
377
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
378
+ }, z.core.$strict>>>;
379
+ transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
380
+ call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
381
+ runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
382
+ }, z.core.$strict>;
383
+ type ToolCallErrorEvent = z.infer<typeof ToolCallErrorEventSchema>;
384
+ declare const AnnotationEventSchema: z.ZodObject<{
385
+ event_type: z.ZodDefault<z.ZodLiteral<"annotation">>;
386
+ payload: z.ZodObject<{
387
+ intent: z.ZodDefault<z.ZodNullable<z.ZodString>>;
388
+ expected_outcome: z.ZodDefault<z.ZodNullable<z.ZodString>>;
389
+ signal_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
390
+ workflow: z.ZodDefault<z.ZodNullable<z.ZodString>>;
391
+ suggested_improvement: z.ZodDefault<z.ZodNullable<z.ZodString>>;
392
+ context: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
393
+ intent_source: z.ZodDefault<z.ZodNullable<z.ZodString>>;
394
+ tool_name: z.ZodDefault<z.ZodNullable<z.ZodString>>;
395
+ }, z.core.$strict>;
396
+ event_id: z.ZodDefault<z.ZodUUID>;
397
+ tenant_id: z.ZodString;
398
+ vendor_id: z.ZodString;
399
+ session_id: z.ZodString;
400
+ sequence_number: z.ZodNumber;
401
+ captured_at: z.ZodString;
402
+ consent_token: z.ZodString;
403
+ sdk_version: z.ZodDefault<z.ZodString>;
404
+ agent_runtime: z.ZodDefault<z.ZodString>;
405
+ principal: z.ZodDefault<z.ZodNullable<z.ZodObject<{
406
+ id: z.ZodString;
407
+ source: z.ZodString;
408
+ form: z.ZodString;
409
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
410
+ }, z.core.$strict>>>;
411
+ transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
412
+ call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
413
+ runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
414
+ }, z.core.$strict>;
415
+ type AnnotationEvent = z.infer<typeof AnnotationEventSchema>;
416
+ declare const SurfaceSnapshotEventSchema: z.ZodObject<{
417
+ event_type: z.ZodDefault<z.ZodLiteral<"surface_snapshot">>;
418
+ payload: z.ZodObject<{
419
+ surface_hash: z.ZodString;
420
+ server_info: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
421
+ capabilities: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
422
+ instructions: z.ZodDefault<z.ZodNullable<z.ZodString>>;
423
+ tools: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
424
+ seam_augmentations: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
425
+ }, z.core.$strict>;
426
+ event_id: z.ZodDefault<z.ZodUUID>;
427
+ tenant_id: z.ZodString;
428
+ vendor_id: z.ZodString;
429
+ session_id: z.ZodString;
430
+ sequence_number: z.ZodNumber;
431
+ captured_at: z.ZodString;
432
+ consent_token: z.ZodString;
433
+ sdk_version: z.ZodDefault<z.ZodString>;
434
+ agent_runtime: z.ZodDefault<z.ZodString>;
435
+ principal: z.ZodDefault<z.ZodNullable<z.ZodObject<{
436
+ id: z.ZodString;
437
+ source: z.ZodString;
438
+ form: z.ZodString;
439
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
440
+ }, z.core.$strict>>>;
441
+ transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
442
+ call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
443
+ runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
444
+ }, z.core.$strict>;
445
+ type SurfaceSnapshotEvent = z.infer<typeof SurfaceSnapshotEventSchema>;
446
+ declare const ResourceListStartEventSchema: z.ZodObject<{
447
+ event_type: z.ZodDefault<z.ZodLiteral<"resource_list_start">>;
448
+ payload: z.ZodObject<{}, z.core.$strict>;
449
+ event_id: z.ZodDefault<z.ZodUUID>;
450
+ tenant_id: z.ZodString;
451
+ vendor_id: z.ZodString;
452
+ session_id: z.ZodString;
453
+ sequence_number: z.ZodNumber;
454
+ captured_at: z.ZodString;
455
+ consent_token: z.ZodString;
456
+ sdk_version: z.ZodDefault<z.ZodString>;
457
+ agent_runtime: z.ZodDefault<z.ZodString>;
458
+ principal: z.ZodDefault<z.ZodNullable<z.ZodObject<{
459
+ id: z.ZodString;
460
+ source: z.ZodString;
461
+ form: z.ZodString;
462
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
463
+ }, z.core.$strict>>>;
464
+ transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
465
+ call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
466
+ runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
467
+ }, z.core.$strict>;
468
+ type ResourceListStartEvent = z.infer<typeof ResourceListStartEventSchema>;
469
+ declare const ResourceListEndEventSchema: z.ZodObject<{
470
+ event_type: z.ZodDefault<z.ZodLiteral<"resource_list_end">>;
471
+ payload: z.ZodObject<{
472
+ duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
473
+ count: z.ZodNumber;
474
+ }, z.core.$strict>;
475
+ event_id: z.ZodDefault<z.ZodUUID>;
476
+ tenant_id: z.ZodString;
477
+ vendor_id: z.ZodString;
478
+ session_id: z.ZodString;
479
+ sequence_number: z.ZodNumber;
480
+ captured_at: z.ZodString;
481
+ consent_token: z.ZodString;
482
+ sdk_version: z.ZodDefault<z.ZodString>;
483
+ agent_runtime: z.ZodDefault<z.ZodString>;
484
+ principal: z.ZodDefault<z.ZodNullable<z.ZodObject<{
485
+ id: z.ZodString;
486
+ source: z.ZodString;
487
+ form: z.ZodString;
488
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
489
+ }, z.core.$strict>>>;
490
+ transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
491
+ call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
492
+ runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
493
+ }, z.core.$strict>;
494
+ type ResourceListEndEvent = z.infer<typeof ResourceListEndEventSchema>;
495
+ declare const ResourceListErrorEventSchema: z.ZodObject<{
496
+ event_type: z.ZodDefault<z.ZodLiteral<"resource_list_error">>;
497
+ payload: z.ZodObject<{
498
+ duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
499
+ error_type: z.ZodString;
500
+ error_body: z.ZodString;
501
+ }, z.core.$strict>;
502
+ event_id: z.ZodDefault<z.ZodUUID>;
503
+ tenant_id: z.ZodString;
504
+ vendor_id: z.ZodString;
505
+ session_id: z.ZodString;
506
+ sequence_number: z.ZodNumber;
507
+ captured_at: z.ZodString;
508
+ consent_token: z.ZodString;
509
+ sdk_version: z.ZodDefault<z.ZodString>;
510
+ agent_runtime: z.ZodDefault<z.ZodString>;
511
+ principal: z.ZodDefault<z.ZodNullable<z.ZodObject<{
512
+ id: z.ZodString;
513
+ source: z.ZodString;
514
+ form: z.ZodString;
515
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
516
+ }, z.core.$strict>>>;
517
+ transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
518
+ call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
519
+ runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
520
+ }, z.core.$strict>;
521
+ type ResourceListErrorEvent = z.infer<typeof ResourceListErrorEventSchema>;
522
+ declare const ResourceReadStartEventSchema: z.ZodObject<{
523
+ event_type: z.ZodDefault<z.ZodLiteral<"resource_read_start">>;
524
+ payload: z.ZodObject<{
525
+ uri: z.ZodString;
526
+ params: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
527
+ }, z.core.$strict>;
528
+ event_id: z.ZodDefault<z.ZodUUID>;
529
+ tenant_id: z.ZodString;
530
+ vendor_id: z.ZodString;
531
+ session_id: z.ZodString;
532
+ sequence_number: z.ZodNumber;
533
+ captured_at: z.ZodString;
534
+ consent_token: z.ZodString;
535
+ sdk_version: z.ZodDefault<z.ZodString>;
536
+ agent_runtime: z.ZodDefault<z.ZodString>;
537
+ principal: z.ZodDefault<z.ZodNullable<z.ZodObject<{
538
+ id: z.ZodString;
539
+ source: z.ZodString;
540
+ form: z.ZodString;
541
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
542
+ }, z.core.$strict>>>;
543
+ transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
544
+ call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
545
+ runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
546
+ }, z.core.$strict>;
547
+ type ResourceReadStartEvent = z.infer<typeof ResourceReadStartEventSchema>;
548
+ declare const ResourceReadEndEventSchema: z.ZodObject<{
549
+ event_type: z.ZodDefault<z.ZodLiteral<"resource_read_end">>;
550
+ payload: z.ZodObject<{
551
+ duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
552
+ uri: z.ZodString;
553
+ }, z.core.$strict>;
554
+ event_id: z.ZodDefault<z.ZodUUID>;
555
+ tenant_id: z.ZodString;
556
+ vendor_id: z.ZodString;
557
+ session_id: z.ZodString;
558
+ sequence_number: z.ZodNumber;
559
+ captured_at: z.ZodString;
560
+ consent_token: z.ZodString;
561
+ sdk_version: z.ZodDefault<z.ZodString>;
562
+ agent_runtime: z.ZodDefault<z.ZodString>;
563
+ principal: z.ZodDefault<z.ZodNullable<z.ZodObject<{
564
+ id: z.ZodString;
565
+ source: z.ZodString;
566
+ form: z.ZodString;
567
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
568
+ }, z.core.$strict>>>;
569
+ transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
570
+ call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
571
+ runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
572
+ }, z.core.$strict>;
573
+ type ResourceReadEndEvent = z.infer<typeof ResourceReadEndEventSchema>;
574
+ declare const ResourceReadErrorEventSchema: z.ZodObject<{
575
+ event_type: z.ZodDefault<z.ZodLiteral<"resource_read_error">>;
576
+ payload: z.ZodObject<{
577
+ duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
578
+ error_type: z.ZodString;
579
+ error_body: z.ZodString;
580
+ uri: z.ZodString;
581
+ }, z.core.$strict>;
582
+ event_id: z.ZodDefault<z.ZodUUID>;
583
+ tenant_id: z.ZodString;
584
+ vendor_id: z.ZodString;
585
+ session_id: z.ZodString;
586
+ sequence_number: z.ZodNumber;
587
+ captured_at: z.ZodString;
588
+ consent_token: z.ZodString;
589
+ sdk_version: z.ZodDefault<z.ZodString>;
590
+ agent_runtime: z.ZodDefault<z.ZodString>;
591
+ principal: z.ZodDefault<z.ZodNullable<z.ZodObject<{
592
+ id: z.ZodString;
593
+ source: z.ZodString;
594
+ form: z.ZodString;
595
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
596
+ }, z.core.$strict>>>;
597
+ transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
598
+ call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
599
+ runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
600
+ }, z.core.$strict>;
601
+ type ResourceReadErrorEvent = z.infer<typeof ResourceReadErrorEventSchema>;
602
+ declare const PromptListStartEventSchema: z.ZodObject<{
603
+ event_type: z.ZodDefault<z.ZodLiteral<"prompt_list_start">>;
604
+ payload: z.ZodObject<{}, z.core.$strict>;
605
+ event_id: z.ZodDefault<z.ZodUUID>;
606
+ tenant_id: z.ZodString;
607
+ vendor_id: z.ZodString;
608
+ session_id: z.ZodString;
609
+ sequence_number: z.ZodNumber;
610
+ captured_at: z.ZodString;
611
+ consent_token: z.ZodString;
612
+ sdk_version: z.ZodDefault<z.ZodString>;
613
+ agent_runtime: z.ZodDefault<z.ZodString>;
614
+ principal: z.ZodDefault<z.ZodNullable<z.ZodObject<{
615
+ id: z.ZodString;
616
+ source: z.ZodString;
617
+ form: z.ZodString;
618
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
619
+ }, z.core.$strict>>>;
620
+ transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
621
+ call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
622
+ runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
623
+ }, z.core.$strict>;
624
+ type PromptListStartEvent = z.infer<typeof PromptListStartEventSchema>;
625
+ declare const PromptListEndEventSchema: z.ZodObject<{
626
+ event_type: z.ZodDefault<z.ZodLiteral<"prompt_list_end">>;
627
+ payload: z.ZodObject<{
628
+ duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
629
+ count: z.ZodNumber;
630
+ }, z.core.$strict>;
631
+ event_id: z.ZodDefault<z.ZodUUID>;
632
+ tenant_id: z.ZodString;
633
+ vendor_id: z.ZodString;
634
+ session_id: z.ZodString;
635
+ sequence_number: z.ZodNumber;
636
+ captured_at: z.ZodString;
637
+ consent_token: z.ZodString;
638
+ sdk_version: z.ZodDefault<z.ZodString>;
639
+ agent_runtime: z.ZodDefault<z.ZodString>;
640
+ principal: z.ZodDefault<z.ZodNullable<z.ZodObject<{
641
+ id: z.ZodString;
642
+ source: z.ZodString;
643
+ form: z.ZodString;
644
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
645
+ }, z.core.$strict>>>;
646
+ transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
647
+ call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
648
+ runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
649
+ }, z.core.$strict>;
650
+ type PromptListEndEvent = z.infer<typeof PromptListEndEventSchema>;
651
+ declare const PromptListErrorEventSchema: z.ZodObject<{
652
+ event_type: z.ZodDefault<z.ZodLiteral<"prompt_list_error">>;
653
+ payload: z.ZodObject<{
654
+ duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
655
+ error_type: z.ZodString;
656
+ error_body: z.ZodString;
657
+ }, z.core.$strict>;
658
+ event_id: z.ZodDefault<z.ZodUUID>;
659
+ tenant_id: z.ZodString;
660
+ vendor_id: z.ZodString;
661
+ session_id: z.ZodString;
662
+ sequence_number: z.ZodNumber;
663
+ captured_at: z.ZodString;
664
+ consent_token: z.ZodString;
665
+ sdk_version: z.ZodDefault<z.ZodString>;
666
+ agent_runtime: z.ZodDefault<z.ZodString>;
667
+ principal: z.ZodDefault<z.ZodNullable<z.ZodObject<{
668
+ id: z.ZodString;
669
+ source: z.ZodString;
670
+ form: z.ZodString;
671
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
672
+ }, z.core.$strict>>>;
673
+ transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
674
+ call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
675
+ runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
676
+ }, z.core.$strict>;
677
+ type PromptListErrorEvent = z.infer<typeof PromptListErrorEventSchema>;
678
+ declare const PromptGetStartEventSchema: z.ZodObject<{
679
+ event_type: z.ZodDefault<z.ZodLiteral<"prompt_get_start">>;
680
+ payload: z.ZodObject<{
681
+ name: z.ZodString;
682
+ params: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
683
+ }, z.core.$strict>;
684
+ event_id: z.ZodDefault<z.ZodUUID>;
685
+ tenant_id: z.ZodString;
686
+ vendor_id: z.ZodString;
687
+ session_id: z.ZodString;
688
+ sequence_number: z.ZodNumber;
689
+ captured_at: z.ZodString;
690
+ consent_token: z.ZodString;
691
+ sdk_version: z.ZodDefault<z.ZodString>;
692
+ agent_runtime: z.ZodDefault<z.ZodString>;
693
+ principal: z.ZodDefault<z.ZodNullable<z.ZodObject<{
694
+ id: z.ZodString;
695
+ source: z.ZodString;
696
+ form: z.ZodString;
697
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
698
+ }, z.core.$strict>>>;
699
+ transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
700
+ call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
701
+ runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
702
+ }, z.core.$strict>;
703
+ type PromptGetStartEvent = z.infer<typeof PromptGetStartEventSchema>;
704
+ declare const PromptGetEndEventSchema: z.ZodObject<{
705
+ event_type: z.ZodDefault<z.ZodLiteral<"prompt_get_end">>;
706
+ payload: z.ZodObject<{
707
+ duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
708
+ name: z.ZodString;
709
+ }, z.core.$strict>;
710
+ event_id: z.ZodDefault<z.ZodUUID>;
711
+ tenant_id: z.ZodString;
712
+ vendor_id: z.ZodString;
713
+ session_id: z.ZodString;
714
+ sequence_number: z.ZodNumber;
715
+ captured_at: z.ZodString;
716
+ consent_token: z.ZodString;
717
+ sdk_version: z.ZodDefault<z.ZodString>;
718
+ agent_runtime: z.ZodDefault<z.ZodString>;
719
+ principal: z.ZodDefault<z.ZodNullable<z.ZodObject<{
720
+ id: z.ZodString;
721
+ source: z.ZodString;
722
+ form: z.ZodString;
723
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
724
+ }, z.core.$strict>>>;
725
+ transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
726
+ call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
727
+ runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
728
+ }, z.core.$strict>;
729
+ type PromptGetEndEvent = z.infer<typeof PromptGetEndEventSchema>;
730
+ declare const PromptGetErrorEventSchema: z.ZodObject<{
731
+ event_type: z.ZodDefault<z.ZodLiteral<"prompt_get_error">>;
732
+ payload: z.ZodObject<{
733
+ duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
734
+ error_type: z.ZodString;
735
+ error_body: z.ZodString;
736
+ name: z.ZodString;
737
+ }, z.core.$strict>;
738
+ event_id: z.ZodDefault<z.ZodUUID>;
739
+ tenant_id: z.ZodString;
740
+ vendor_id: z.ZodString;
741
+ session_id: z.ZodString;
742
+ sequence_number: z.ZodNumber;
743
+ captured_at: z.ZodString;
744
+ consent_token: z.ZodString;
745
+ sdk_version: z.ZodDefault<z.ZodString>;
746
+ agent_runtime: z.ZodDefault<z.ZodString>;
747
+ principal: z.ZodDefault<z.ZodNullable<z.ZodObject<{
748
+ id: z.ZodString;
749
+ source: z.ZodString;
750
+ form: z.ZodString;
751
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
752
+ }, z.core.$strict>>>;
753
+ transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
754
+ call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
755
+ runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
756
+ }, z.core.$strict>;
757
+ type PromptGetErrorEvent = z.infer<typeof PromptGetErrorEventSchema>;
758
+ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
759
+ event_type: z.ZodDefault<z.ZodLiteral<"tool_call_start">>;
760
+ payload: z.ZodObject<{
761
+ tool_name: z.ZodString;
762
+ params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
763
+ call_intent: z.ZodDefault<z.ZodNullable<z.ZodString>>;
764
+ call_expected: z.ZodDefault<z.ZodNullable<z.ZodString>>;
765
+ call_workflow: z.ZodDefault<z.ZodNullable<z.ZodString>>;
766
+ intent_source: z.ZodDefault<z.ZodNullable<z.ZodString>>;
767
+ }, z.core.$strict>;
768
+ event_id: z.ZodDefault<z.ZodUUID>;
769
+ tenant_id: z.ZodString;
770
+ vendor_id: z.ZodString;
771
+ session_id: z.ZodString;
772
+ sequence_number: z.ZodNumber;
773
+ captured_at: z.ZodString;
774
+ consent_token: z.ZodString;
775
+ sdk_version: z.ZodDefault<z.ZodString>;
776
+ agent_runtime: z.ZodDefault<z.ZodString>;
777
+ principal: z.ZodDefault<z.ZodNullable<z.ZodObject<{
778
+ id: z.ZodString;
779
+ source: z.ZodString;
780
+ form: z.ZodString;
781
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
184
782
  }, z.core.$strict>>>;
185
783
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
186
784
  call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
187
785
  runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
188
- }, z.core.$strict>;
189
- type ToolCallStartEvent = z.infer<typeof ToolCallStartEventSchema>;
190
- declare const ToolCallEndEventSchema: z.ZodObject<{
786
+ }, z.core.$strict>, z.ZodObject<{
191
787
  event_type: z.ZodDefault<z.ZodLiteral<"tool_call_end">>;
192
788
  payload: z.ZodObject<{
193
789
  tool_name: z.ZodString;
194
790
  result: z.ZodDefault<z.ZodNullable<z.ZodUnknown>>;
195
791
  duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
792
+ result_capture: z.ZodOptional<z.ZodNullable<z.ZodString>>;
196
793
  }, z.core.$strict>;
197
794
  event_id: z.ZodDefault<z.ZodUUID>;
198
795
  tenant_id: z.ZodString;
@@ -207,13 +804,12 @@ declare const ToolCallEndEventSchema: z.ZodObject<{
207
804
  id: z.ZodString;
208
805
  source: z.ZodString;
209
806
  form: z.ZodString;
807
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
210
808
  }, z.core.$strict>>>;
211
809
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
212
810
  call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
213
811
  runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
214
- }, z.core.$strict>;
215
- type ToolCallEndEvent = z.infer<typeof ToolCallEndEventSchema>;
216
- declare const ToolCallErrorEventSchema: z.ZodObject<{
812
+ }, z.core.$strict>, z.ZodObject<{
217
813
  event_type: z.ZodDefault<z.ZodLiteral<"tool_call_error">>;
218
814
  payload: z.ZodObject<{
219
815
  tool_name: z.ZodString;
@@ -221,6 +817,8 @@ declare const ToolCallErrorEventSchema: z.ZodObject<{
221
817
  error_body: z.ZodString;
222
818
  duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
223
819
  result: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
820
+ result_capture: z.ZodOptional<z.ZodNullable<z.ZodString>>;
821
+ failure_kind: z.ZodOptional<z.ZodNullable<z.ZodString>>;
224
822
  }, z.core.$strict>;
225
823
  event_id: z.ZodDefault<z.ZodUUID>;
226
824
  tenant_id: z.ZodString;
@@ -235,13 +833,12 @@ declare const ToolCallErrorEventSchema: z.ZodObject<{
235
833
  id: z.ZodString;
236
834
  source: z.ZodString;
237
835
  form: z.ZodString;
836
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
238
837
  }, z.core.$strict>>>;
239
838
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
240
839
  call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
241
840
  runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
242
- }, z.core.$strict>;
243
- type ToolCallErrorEvent = z.infer<typeof ToolCallErrorEventSchema>;
244
- declare const AnnotationEventSchema: z.ZodObject<{
841
+ }, z.core.$strict>, z.ZodObject<{
245
842
  event_type: z.ZodDefault<z.ZodLiteral<"annotation">>;
246
843
  payload: z.ZodObject<{
247
844
  intent: z.ZodDefault<z.ZodNullable<z.ZodString>>;
@@ -266,13 +863,12 @@ declare const AnnotationEventSchema: z.ZodObject<{
266
863
  id: z.ZodString;
267
864
  source: z.ZodString;
268
865
  form: z.ZodString;
866
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
269
867
  }, z.core.$strict>>>;
270
868
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
271
869
  call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
272
870
  runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
273
- }, z.core.$strict>;
274
- type AnnotationEvent = z.infer<typeof AnnotationEventSchema>;
275
- declare const SurfaceSnapshotEventSchema: z.ZodObject<{
871
+ }, z.core.$strict>, z.ZodObject<{
276
872
  event_type: z.ZodDefault<z.ZodLiteral<"surface_snapshot">>;
277
873
  payload: z.ZodObject<{
278
874
  surface_hash: z.ZodString;
@@ -295,21 +891,37 @@ declare const SurfaceSnapshotEventSchema: z.ZodObject<{
295
891
  id: z.ZodString;
296
892
  source: z.ZodString;
297
893
  form: z.ZodString;
894
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
298
895
  }, z.core.$strict>>>;
299
896
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
300
897
  call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
301
898
  runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
302
- }, z.core.$strict>;
303
- type SurfaceSnapshotEvent = z.infer<typeof SurfaceSnapshotEventSchema>;
304
- declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
305
- event_type: z.ZodDefault<z.ZodLiteral<"tool_call_start">>;
899
+ }, z.core.$strict>, z.ZodObject<{
900
+ event_type: z.ZodDefault<z.ZodLiteral<"resource_list_start">>;
901
+ payload: z.ZodObject<{}, z.core.$strict>;
902
+ event_id: z.ZodDefault<z.ZodUUID>;
903
+ tenant_id: z.ZodString;
904
+ vendor_id: z.ZodString;
905
+ session_id: z.ZodString;
906
+ sequence_number: z.ZodNumber;
907
+ captured_at: z.ZodString;
908
+ consent_token: z.ZodString;
909
+ sdk_version: z.ZodDefault<z.ZodString>;
910
+ agent_runtime: z.ZodDefault<z.ZodString>;
911
+ principal: z.ZodDefault<z.ZodNullable<z.ZodObject<{
912
+ id: z.ZodString;
913
+ source: z.ZodString;
914
+ form: z.ZodString;
915
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
916
+ }, z.core.$strict>>>;
917
+ transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
918
+ call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
919
+ runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
920
+ }, z.core.$strict>, z.ZodObject<{
921
+ event_type: z.ZodDefault<z.ZodLiteral<"resource_list_end">>;
306
922
  payload: z.ZodObject<{
307
- tool_name: z.ZodString;
308
- params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
309
- call_intent: z.ZodDefault<z.ZodNullable<z.ZodString>>;
310
- call_expected: z.ZodDefault<z.ZodNullable<z.ZodString>>;
311
- call_workflow: z.ZodDefault<z.ZodNullable<z.ZodString>>;
312
- intent_source: z.ZodDefault<z.ZodNullable<z.ZodString>>;
923
+ duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
924
+ count: z.ZodNumber;
313
925
  }, z.core.$strict>;
314
926
  event_id: z.ZodDefault<z.ZodUUID>;
315
927
  tenant_id: z.ZodString;
@@ -324,16 +936,17 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
324
936
  id: z.ZodString;
325
937
  source: z.ZodString;
326
938
  form: z.ZodString;
939
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
327
940
  }, z.core.$strict>>>;
328
941
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
329
942
  call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
330
943
  runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
331
944
  }, z.core.$strict>, z.ZodObject<{
332
- event_type: z.ZodDefault<z.ZodLiteral<"tool_call_end">>;
945
+ event_type: z.ZodDefault<z.ZodLiteral<"resource_list_error">>;
333
946
  payload: z.ZodObject<{
334
- tool_name: z.ZodString;
335
- result: z.ZodDefault<z.ZodNullable<z.ZodUnknown>>;
336
947
  duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
948
+ error_type: z.ZodString;
949
+ error_body: z.ZodString;
337
950
  }, z.core.$strict>;
338
951
  event_id: z.ZodDefault<z.ZodUUID>;
339
952
  tenant_id: z.ZodString;
@@ -348,18 +961,111 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
348
961
  id: z.ZodString;
349
962
  source: z.ZodString;
350
963
  form: z.ZodString;
964
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
351
965
  }, z.core.$strict>>>;
352
966
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
353
967
  call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
354
968
  runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
355
969
  }, z.core.$strict>, z.ZodObject<{
356
- event_type: z.ZodDefault<z.ZodLiteral<"tool_call_error">>;
970
+ event_type: z.ZodDefault<z.ZodLiteral<"resource_read_start">>;
357
971
  payload: z.ZodObject<{
358
- tool_name: z.ZodString;
972
+ uri: z.ZodString;
973
+ params: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
974
+ }, z.core.$strict>;
975
+ event_id: z.ZodDefault<z.ZodUUID>;
976
+ tenant_id: z.ZodString;
977
+ vendor_id: z.ZodString;
978
+ session_id: z.ZodString;
979
+ sequence_number: z.ZodNumber;
980
+ captured_at: z.ZodString;
981
+ consent_token: z.ZodString;
982
+ sdk_version: z.ZodDefault<z.ZodString>;
983
+ agent_runtime: z.ZodDefault<z.ZodString>;
984
+ principal: z.ZodDefault<z.ZodNullable<z.ZodObject<{
985
+ id: z.ZodString;
986
+ source: z.ZodString;
987
+ form: z.ZodString;
988
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
989
+ }, z.core.$strict>>>;
990
+ transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
991
+ call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
992
+ runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
993
+ }, z.core.$strict>, z.ZodObject<{
994
+ event_type: z.ZodDefault<z.ZodLiteral<"resource_read_end">>;
995
+ payload: z.ZodObject<{
996
+ duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
997
+ uri: z.ZodString;
998
+ }, z.core.$strict>;
999
+ event_id: z.ZodDefault<z.ZodUUID>;
1000
+ tenant_id: z.ZodString;
1001
+ vendor_id: z.ZodString;
1002
+ session_id: z.ZodString;
1003
+ sequence_number: z.ZodNumber;
1004
+ captured_at: z.ZodString;
1005
+ consent_token: z.ZodString;
1006
+ sdk_version: z.ZodDefault<z.ZodString>;
1007
+ agent_runtime: z.ZodDefault<z.ZodString>;
1008
+ principal: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1009
+ id: z.ZodString;
1010
+ source: z.ZodString;
1011
+ form: z.ZodString;
1012
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1013
+ }, z.core.$strict>>>;
1014
+ transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1015
+ call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1016
+ runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
1017
+ }, z.core.$strict>, z.ZodObject<{
1018
+ event_type: z.ZodDefault<z.ZodLiteral<"resource_read_error">>;
1019
+ payload: z.ZodObject<{
1020
+ duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
359
1021
  error_type: z.ZodString;
360
1022
  error_body: z.ZodString;
1023
+ uri: z.ZodString;
1024
+ }, z.core.$strict>;
1025
+ event_id: z.ZodDefault<z.ZodUUID>;
1026
+ tenant_id: z.ZodString;
1027
+ vendor_id: z.ZodString;
1028
+ session_id: z.ZodString;
1029
+ sequence_number: z.ZodNumber;
1030
+ captured_at: z.ZodString;
1031
+ consent_token: z.ZodString;
1032
+ sdk_version: z.ZodDefault<z.ZodString>;
1033
+ agent_runtime: z.ZodDefault<z.ZodString>;
1034
+ principal: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1035
+ id: z.ZodString;
1036
+ source: z.ZodString;
1037
+ form: z.ZodString;
1038
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1039
+ }, z.core.$strict>>>;
1040
+ transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1041
+ call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1042
+ runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
1043
+ }, z.core.$strict>, z.ZodObject<{
1044
+ event_type: z.ZodDefault<z.ZodLiteral<"prompt_list_start">>;
1045
+ payload: z.ZodObject<{}, z.core.$strict>;
1046
+ event_id: z.ZodDefault<z.ZodUUID>;
1047
+ tenant_id: z.ZodString;
1048
+ vendor_id: z.ZodString;
1049
+ session_id: z.ZodString;
1050
+ sequence_number: z.ZodNumber;
1051
+ captured_at: z.ZodString;
1052
+ consent_token: z.ZodString;
1053
+ sdk_version: z.ZodDefault<z.ZodString>;
1054
+ agent_runtime: z.ZodDefault<z.ZodString>;
1055
+ principal: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1056
+ id: z.ZodString;
1057
+ source: z.ZodString;
1058
+ form: z.ZodString;
1059
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1060
+ }, z.core.$strict>>>;
1061
+ transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1062
+ call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1063
+ runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
1064
+ }, z.core.$strict>, z.ZodObject<{
1065
+ event_type: z.ZodDefault<z.ZodLiteral<"prompt_list_end">>;
1066
+ payload: z.ZodObject<{
361
1067
  duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
362
- result: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
1068
+ count: z.ZodNumber;
363
1069
  }, z.core.$strict>;
364
1070
  event_id: z.ZodDefault<z.ZodUUID>;
365
1071
  tenant_id: z.ZodString;
@@ -374,21 +1080,17 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
374
1080
  id: z.ZodString;
375
1081
  source: z.ZodString;
376
1082
  form: z.ZodString;
1083
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
377
1084
  }, z.core.$strict>>>;
378
1085
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
379
1086
  call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
380
1087
  runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
381
1088
  }, z.core.$strict>, z.ZodObject<{
382
- event_type: z.ZodDefault<z.ZodLiteral<"annotation">>;
1089
+ event_type: z.ZodDefault<z.ZodLiteral<"prompt_list_error">>;
383
1090
  payload: z.ZodObject<{
384
- intent: z.ZodDefault<z.ZodNullable<z.ZodString>>;
385
- expected_outcome: z.ZodDefault<z.ZodNullable<z.ZodString>>;
386
- signal_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
387
- workflow: z.ZodDefault<z.ZodNullable<z.ZodString>>;
388
- suggested_improvement: z.ZodDefault<z.ZodNullable<z.ZodString>>;
389
- context: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
390
- intent_source: z.ZodDefault<z.ZodNullable<z.ZodString>>;
391
- tool_name: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1091
+ duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1092
+ error_type: z.ZodString;
1093
+ error_body: z.ZodString;
392
1094
  }, z.core.$strict>;
393
1095
  event_id: z.ZodDefault<z.ZodUUID>;
394
1096
  tenant_id: z.ZodString;
@@ -403,19 +1105,66 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
403
1105
  id: z.ZodString;
404
1106
  source: z.ZodString;
405
1107
  form: z.ZodString;
1108
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
406
1109
  }, z.core.$strict>>>;
407
1110
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
408
1111
  call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
409
1112
  runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
410
1113
  }, z.core.$strict>, z.ZodObject<{
411
- event_type: z.ZodDefault<z.ZodLiteral<"surface_snapshot">>;
1114
+ event_type: z.ZodDefault<z.ZodLiteral<"prompt_get_start">>;
412
1115
  payload: z.ZodObject<{
413
- surface_hash: z.ZodString;
414
- server_info: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
415
- capabilities: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
416
- instructions: z.ZodDefault<z.ZodNullable<z.ZodString>>;
417
- tools: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
418
- seam_augmentations: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1116
+ name: z.ZodString;
1117
+ params: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
1118
+ }, z.core.$strict>;
1119
+ event_id: z.ZodDefault<z.ZodUUID>;
1120
+ tenant_id: z.ZodString;
1121
+ vendor_id: z.ZodString;
1122
+ session_id: z.ZodString;
1123
+ sequence_number: z.ZodNumber;
1124
+ captured_at: z.ZodString;
1125
+ consent_token: z.ZodString;
1126
+ sdk_version: z.ZodDefault<z.ZodString>;
1127
+ agent_runtime: z.ZodDefault<z.ZodString>;
1128
+ principal: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1129
+ id: z.ZodString;
1130
+ source: z.ZodString;
1131
+ form: z.ZodString;
1132
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1133
+ }, z.core.$strict>>>;
1134
+ transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1135
+ call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1136
+ runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
1137
+ }, z.core.$strict>, z.ZodObject<{
1138
+ event_type: z.ZodDefault<z.ZodLiteral<"prompt_get_end">>;
1139
+ payload: z.ZodObject<{
1140
+ duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1141
+ name: z.ZodString;
1142
+ }, z.core.$strict>;
1143
+ event_id: z.ZodDefault<z.ZodUUID>;
1144
+ tenant_id: z.ZodString;
1145
+ vendor_id: z.ZodString;
1146
+ session_id: z.ZodString;
1147
+ sequence_number: z.ZodNumber;
1148
+ captured_at: z.ZodString;
1149
+ consent_token: z.ZodString;
1150
+ sdk_version: z.ZodDefault<z.ZodString>;
1151
+ agent_runtime: z.ZodDefault<z.ZodString>;
1152
+ principal: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1153
+ id: z.ZodString;
1154
+ source: z.ZodString;
1155
+ form: z.ZodString;
1156
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1157
+ }, z.core.$strict>>>;
1158
+ transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1159
+ call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1160
+ runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
1161
+ }, z.core.$strict>, z.ZodObject<{
1162
+ event_type: z.ZodDefault<z.ZodLiteral<"prompt_get_error">>;
1163
+ payload: z.ZodObject<{
1164
+ duration_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1165
+ error_type: z.ZodString;
1166
+ error_body: z.ZodString;
1167
+ name: z.ZodString;
419
1168
  }, z.core.$strict>;
420
1169
  event_id: z.ZodDefault<z.ZodUUID>;
421
1170
  tenant_id: z.ZodString;
@@ -430,12 +1179,23 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
430
1179
  id: z.ZodString;
431
1180
  source: z.ZodString;
432
1181
  form: z.ZodString;
1182
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
433
1183
  }, z.core.$strict>>>;
434
1184
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
435
1185
  call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
436
1186
  runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
437
1187
  }, z.core.$strict>], "event_type">;
438
- type Event = ToolCallStartEvent | ToolCallEndEvent | ToolCallErrorEvent | AnnotationEvent | SurfaceSnapshotEvent;
1188
+ /** ⚠ DERIVED, not hand-listed. It used to be a third list of the same
1189
+ * seventeen members, after `EventTypeSchema` and `EventSchema`'s own branches,
1190
+ * and the twelve lifecycle types made that visible: three lists to keep in
1191
+ * step. `EventSchema` is the discriminated union over exactly these schemas,
1192
+ * so its inferred output type IS this union — verified mutually assignable
1193
+ * against the hand-written version before the switch.
1194
+ *
1195
+ * `EventTypeSchema` stays hand-written on purpose: `test/packaging.test.ts`
1196
+ * derives its export guard FROM it, which makes it the source of truth rather
1197
+ * than a fourth copy. */
1198
+ type Event = z.infer<typeof EventSchema>;
439
1199
 
440
1200
  /**
441
1201
  * Source-side PII scrubbing for event payloads (SPEC §7).
@@ -689,6 +1449,12 @@ interface Principal {
689
1449
  * it, so two identity providers behind one vendor can hand the same subject
690
1450
  * to different people. */
691
1451
  issuer?: string | null | undefined;
1452
+ /** What a page shows for this principal — `principalFromOAuthEmail` puts
1453
+ * the part of the address before the last `@` here. **Sent verbatim, in
1454
+ * every mode, hashed included, and never through the scrubber** (SPEC
1455
+ * §11.4): the vendor chooses what is safe to show. An unusable value is
1456
+ * dropped alone — see `wireDisplayName`. */
1457
+ displayName?: string | null | undefined;
692
1458
  }
693
1459
  /** HMAC-SHA256 a raw principal into a console-safe, per-tenant `principal.id`.
694
1460
  *
@@ -708,32 +1474,34 @@ declare function hashPrincipalId(rawPrincipal: string, options: {
708
1474
  issuer?: string | null | undefined;
709
1475
  }): string;
710
1476
 
711
- /** `BatonConfig.resolvePrincipal` — the ASSERTED identity provenance.
1477
+ /** A validated access token, as both majors declare it
1478
+ * (`@modelcontextprotocol/sdk` 1.x `server/auth/types.d.ts`,
1479
+ * `@modelcontextprotocol/server` 2.0.0 `createMcpHandler-*.d.mts:751` — the
1480
+ * same six members). Declared structurally for the reason {@link Extra} is.
1481
+ *
1482
+ * ⚠ **There is no `claims` member.** Whatever a verifier knows about the
1483
+ * subject goes in the free-form `extra` bag, and only the vendor's verifier
1484
+ * decides what is there. */
1485
+ interface AuthInfo {
1486
+ token: string;
1487
+ clientId: string;
1488
+ scopes: string[];
1489
+ expiresAt?: number | undefined;
1490
+ resource?: URL | undefined;
1491
+ extra?: Record<string, unknown> | undefined;
1492
+ }
1493
+
1494
+ /** `BatonConfig.resolvePrincipal` — the ONLY identity provenance (SPEC §11.4).
1495
+ *
1496
+ * **The producer never reads the token itself** (SPEC §11.4, §13 2026-10-02 —
1497
+ * Python's own token rung was removed the same day), so every principal this
1498
+ * SDK emits is `source: "asserted"`. The hook's context carries the validated
1499
+ * `authInfo`, and `oauthHooks.ts` ships the two ready-made OAuth hooks.
712
1500
  *
713
1501
  * The TypeScript half of Python's `integrations/identity_adapter.py`, built to
714
1502
  * close register D6: the field (`user_id` until 0.3.5) had been on this SDK's
715
1503
  * envelope since 0.3.0 and NOTHING could populate it, so a partition that
716
1504
  * works on one of two SDKs is not a partition.
717
- *
718
- * **Hook only — there is deliberately no ATTESTED rung here yet**, so every
719
- * principal this SDK emits carries `source: "asserted"`.
720
- *
721
- * ⚠ **The missing rung has no shape on the value, and never will again.** This
722
- * note said "saying `no h1: rung` would be false, because this SDK does emit
723
- * `h1:`" — true until 0.4.1, when the tag came off the value entirely (SPEC
724
- * §11.4, §13 entry 0.8.11). A hashed principal is now the bare digest, so there
725
- * is no prefix to be right or wrong about: the missing thing is the
726
- * `source: "attested"` VALUE, and a consumer reads `source` to learn it. SPEC
727
- * §11.4 forbids presenting an asserted principal as verified, and this arm has
728
- * only asserted to present.
729
- *
730
- * Python reads `claims["sub"]` off a verified access token; TypeScript's
731
- * `AuthInfo` has no `claims` field at all (it is
732
- * `{token, clientId, scopes, expiresAt?, resource?, extra?}`), so the nearest
733
- * carrier is the untyped `extra` bag and nothing specifies that `sub` lives
734
- * there. Reading it would mean guessing where a subject lives, vendor by
735
- * vendor — and a wrong guess is how two people end up as one actor. Recorded
736
- * as a divergence rather than filled with a guess.
737
1505
  */
738
1506
 
739
1507
  /** What a vendor's `resolvePrincipal` hook is handed.
@@ -764,11 +1532,32 @@ interface PrincipalResolutionContext {
764
1532
  /** The call's arguments, AFTER Baton's injected intent params are stripped,
765
1533
  * so a hook sees exactly what the vendor's own handler will. */
766
1534
  arguments: Record<string, unknown>;
1535
+ /** The validated access token for this request, read from wherever this
1536
+ * major keeps it — see `extraAuthInfo`. `null` on stdio and on any
1537
+ * unauthenticated request. `principalFromOAuthSub` and
1538
+ * `principalFromOAuthEmail` read it, and so can a vendor's own hook.
1539
+ *
1540
+ * Optional so a vendor hand-building a context in their own tests keeps
1541
+ * compiling, as Python's defaulted `claims` keeps theirs running. */
1542
+ authInfo?: AuthInfo | null | undefined;
767
1543
  }
768
1544
  /** A vendor's per-request identity resolver. Sync or async; returning `null`
769
1545
  * means "no opinion about this caller", which is not an error. */
770
1546
  type ResolvePrincipalHook = (context: PrincipalResolutionContext) => Principal | null | Promise<Principal | null>;
771
1547
 
1548
+ /** The registered values of `resultCaptureMode` (SPEC §11.4), and the single
1549
+ * source of truth for them.
1550
+ *
1551
+ * Shaped after `identity.ts`'s `FORM_BY_MODE` → `PRINCIPAL_ID_MODES`, whose
1552
+ * own note says why: a second hand-written list makes the guarantee "two lists
1553
+ * happen to agree", which is the prose-shaped binding that pattern exists to
1554
+ * replace. `config.ts` builds its validator set from THIS array rather than
1555
+ * restating the literals, so a mode cannot be accepted at the door without
1556
+ * someone having given it a payload shape below. */
1557
+ declare const RESULT_CAPTURE_MODES: readonly ["full", "off"];
1558
+ /** What a vendor may set. Derived, so the type and the registry cannot drift. */
1559
+ type ResultCaptureMode = (typeof RESULT_CAPTURE_MODES)[number];
1560
+
772
1561
  /**
773
1562
  * `BatonConfig` — vendor-side configuration for `withBaton`. A trimmed
774
1563
  * mirror of `baton` (Python)'s `integrations/_config.py::VendorConfig`.
@@ -877,6 +1666,32 @@ interface BatonConfig {
877
1666
  * nothing. A tool registered with no `inputSchema` at all is left alone
878
1667
  * regardless of this setting (see `schemaCompat.injectGoalParams`). */
879
1668
  intentParamMode?: "optional" | "required" | "off";
1669
+ /** Whether tool RESPONSE data is captured at all (SPEC §11.4).
1670
+ *
1671
+ * `"full"` (the default) captures as it always has. `"off"` means nothing
1672
+ * **derived from what your tool returns** leaves this process: no `result` on
1673
+ * `tool_call_end` or `tool_call_error`, and no `error_body` on the
1674
+ * returned-failure shape, where that text is unwrapped from the result. Each
1675
+ * affected event carries `result_capture: "off"`, so a reader has a FACT
1676
+ * rather than an absence to guess from — without it a missing result is
1677
+ * indistinguishable from "the tool returned nothing", and a consumer
1678
+ * manufactures a failure that never happened.
1679
+ *
1680
+ * **Requests are unaffected**: `params` are captured in both modes.
1681
+ *
1682
+ * ⚠ The message of an error your handler THROWS is KEPT — it is your own code
1683
+ * speaking about a call that never returned, so it is not result-derived
1684
+ * (SPEC §11.4.3). Thrown messages are a classic leak channel; if that is also
1685
+ * a problem for you, say so and the mode grows a stricter value.
1686
+ *
1687
+ * Not a scrubber rule, deliberately (SPEC §7): a scrubber TRANSFORMS a value
1688
+ * that still crosses the network, this DECLARES that nothing crosses. Under
1689
+ * `"off"` the scrubber is never invoked on the result at all.
1690
+ *
1691
+ * What it costs you, and the rest of the reasoning: README, "Not capturing
1692
+ * responses at all". Kept there rather than repeated here — the two copies
1693
+ * had already drifted apart in wording by the time this was written. */
1694
+ resultCaptureMode?: ResultCaptureMode;
880
1695
  /** Per-request principal identity — the ASSERTED provenance behind the
881
1696
  * envelope's `principal` (SPEC §11.4 rung 0), which emits
882
1697
  * `source: "asserted"`. It is the only provenance this SDK has.
@@ -887,10 +1702,11 @@ interface BatonConfig {
887
1702
  * tool name, and the arguments the vendor's own handler will see. Return a
888
1703
  * `Principal`, or `null` for "no opinion about this caller".
889
1704
  *
890
- * **This is the only identity mechanism on this arm.** MCP auth is HTTP
891
- * middleware, so a stdio server has no token at all; and unlike Python, no
892
- * attested rung is implemented here — see `principalResolution.ts` for why
893
- * (TypeScript's `AuthInfo` carries no `claims`).
1705
+ * **This is the only identity mechanism, on both SDKs** (SPEC §11.4): unset,
1706
+ * no event carries a `principal`. For OAuth, pass `principalFromOAuthSub` or
1707
+ * `principalFromOAuthEmail`, which read the validated token the context
1708
+ * carries as `authInfo`. MCP auth is HTTP middleware, so on stdio there is no
1709
+ * token and a hook names the user from whatever the vendor authenticated.
894
1710
  *
895
1711
  * Never fails a tool call: a hook that throws or returns junk yields an
896
1712
  * anonymous call. ⚠ It is awaited INLINE with no timeout — a blocking hook
@@ -1039,4 +1855,57 @@ interface SupportedMcpServer {
1039
1855
  /** Install Baton into an `McpServer`. See module docstring for usage. */
1040
1856
  declare function withBaton(server: SupportedMcpServer, supplied?: BatonConfig): BatonHandle;
1041
1857
 
1042
- export { type AnnotationEvent, AnnotationEventSchema, type AnnotationPayload, AnnotationPayloadSchema, type BatonConfig, BatonHandle, DEFAULT_CONSENT_TOKEN, DEPTH_LIMIT, type Event, EventSchema, type EventType, EventTypeSchema, HttpSink, type HttpSinkOptions, PRINCIPAL_FORM_HASHED, PRINCIPAL_FORM_RAW, PRINCIPAL_SOURCE_ASSERTED, type Principal, type PrincipalIdMode, type PrincipalResolutionContext, PrincipalWireSchema, type ResolvePrincipalHook, SDK_VERSION, Scrubber, type Sink, StdoutSink, type StdoutSinkOptions, type SupportedMcpServer, type SurfaceSnapshotEvent, SurfaceSnapshotEventSchema, type SurfaceSnapshotPayload, SurfaceSnapshotPayloadSchema, type ToolCallEndEvent, ToolCallEndEventSchema, type ToolCallEndPayload, ToolCallEndPayloadSchema, type ToolCallErrorEvent, ToolCallErrorEventSchema, type ToolCallErrorPayload, ToolCallErrorPayloadSchema, type ToolCallStartEvent, ToolCallStartEventSchema, type ToolCallStartPayload, ToolCallStartPayloadSchema, hashPrincipalId, identityScrub, safeWrite, withBaton };
1858
+ /** Ready-made `resolvePrincipal` hooks for a server running OAuth.
1859
+ *
1860
+ * Pass one as `BatonConfig.resolvePrincipal`. Each reads a claim off the
1861
+ * validated token the context carries as `authInfo`, and returns `null` when
1862
+ * the claim is not there — so they compose:
1863
+ *
1864
+ * ```ts
1865
+ * resolvePrincipal: (ctx) => principalFromOAuthEmail(ctx) ?? principalFromOAuthSub(ctx)
1866
+ * ```
1867
+ *
1868
+ * They are ordinary hooks: what they return is `source: "asserted"` like any
1869
+ * other (SPEC §11.4). The Python twins are `principal_from_oauth_sub` and
1870
+ * `principal_from_oauth_email`, and the two must agree on one token.
1871
+ *
1872
+ * ⚠ **They read the claims from `authInfo.extra`, and that is a convention,
1873
+ * not a contract.** Neither MCP major's `AuthInfo` has a `claims` member — the
1874
+ * only place a verifier can put the token's subject is the free-form `extra`
1875
+ * bag, and nothing specifies the keys. These hooks expect the standard JWT
1876
+ * claim names (`sub`, `iss`, `email`) at the top of `extra`, which is what a
1877
+ * verifier that spreads its decoded payload into `extra` produces. A verifier
1878
+ * that nests them, renames them or omits them gets `null` here, and its vendor
1879
+ * writes a three-line hook reading wherever their verifier put them. Python
1880
+ * reads a typed `claims` field instead, which is why the two arms describe the
1881
+ * same hooks differently.
1882
+ *
1883
+ * ⚠ **Never `clientId`.** It names the OAuth APPLICATION, not the person, and
1884
+ * is identical for every user of one app; keying on it merges all of them.
1885
+ *
1886
+ * HTTP only: MCP auth is HTTP middleware, so a stdio call has no token and both
1887
+ * hooks return `null` there.
1888
+ */
1889
+
1890
+ /** The token's `sub`, keyed with its `iss` — a subject is unique only per
1891
+ * issuer, so two identity providers can hand two people the same one. */
1892
+ declare function principalFromOAuthSub(context: PrincipalResolutionContext): Principal | null;
1893
+ /** The token's `email`, as the WHOLE address and with NO issuer.
1894
+ *
1895
+ * `principalId` is the whole address and `displayName` the part before the
1896
+ * last `@`. The local part alone is not an id — `alice@acme.com` and
1897
+ * `alice@contoso.com` are two people. `displayName` IS sent, in every mode: a
1898
+ * vendor who hashes ids and does not want `alice` on the wire writes their
1899
+ * own hook.
1900
+ *
1901
+ * No issuer, unlike the `sub` hook: a subject is unique only per issuer, an
1902
+ * address on its own, and folding `iss` in would give one person a new
1903
+ * pseudonym the day their identity provider changes its issuer URL.
1904
+ *
1905
+ * ⚠ `email` is not a standard ACCESS-token claim (OIDC puts it in the ID
1906
+ * token), so it is here only if the identity provider adds it and the verifier
1907
+ * keeps it. `email_verified` is not consulted: whether an unverified address is
1908
+ * good enough is the vendor's call. */
1909
+ declare function principalFromOAuthEmail(context: PrincipalResolutionContext): Principal | null;
1910
+
1911
+ export { type AnnotationEvent, AnnotationEventSchema, type AnnotationPayload, AnnotationPayloadSchema, type AuthInfo, type BatonConfig, BatonHandle, DEFAULT_CONSENT_TOKEN, DEPTH_LIMIT, type Event, EventSchema, type EventType, EventTypeSchema, HttpSink, type HttpSinkOptions, PRINCIPAL_FORM_HASHED, PRINCIPAL_FORM_RAW, PRINCIPAL_SOURCE_ASSERTED, type Principal, type PrincipalIdMode, type PrincipalResolutionContext, PrincipalWireSchema, type PromptGetEndEvent, PromptGetEndEventSchema, type PromptGetEndPayload, PromptGetEndPayloadSchema, type PromptGetErrorEvent, PromptGetErrorEventSchema, type PromptGetErrorPayload, PromptGetErrorPayloadSchema, type PromptGetStartEvent, PromptGetStartEventSchema, type PromptGetStartPayload, PromptGetStartPayloadSchema, type PromptListEndEvent, PromptListEndEventSchema, type PromptListEndPayload, PromptListEndPayloadSchema, type PromptListErrorEvent, PromptListErrorEventSchema, type PromptListErrorPayload, PromptListErrorPayloadSchema, type PromptListStartEvent, PromptListStartEventSchema, type PromptListStartPayload, PromptListStartPayloadSchema, type ResolvePrincipalHook, type ResourceListEndEvent, ResourceListEndEventSchema, type ResourceListEndPayload, ResourceListEndPayloadSchema, type ResourceListErrorEvent, ResourceListErrorEventSchema, type ResourceListErrorPayload, ResourceListErrorPayloadSchema, type ResourceListStartEvent, ResourceListStartEventSchema, type ResourceListStartPayload, ResourceListStartPayloadSchema, type ResourceReadEndEvent, ResourceReadEndEventSchema, type ResourceReadEndPayload, ResourceReadEndPayloadSchema, type ResourceReadErrorEvent, ResourceReadErrorEventSchema, type ResourceReadErrorPayload, ResourceReadErrorPayloadSchema, type ResourceReadStartEvent, ResourceReadStartEventSchema, type ResourceReadStartPayload, ResourceReadStartPayloadSchema, type ResultCaptureMode, SDK_VERSION, Scrubber, type Sink, StdoutSink, type StdoutSinkOptions, type SupportedMcpServer, type SurfaceSnapshotEvent, SurfaceSnapshotEventSchema, type SurfaceSnapshotPayload, SurfaceSnapshotPayloadSchema, type ToolCallEndEvent, ToolCallEndEventSchema, type ToolCallEndPayload, ToolCallEndPayloadSchema, type ToolCallErrorEvent, ToolCallErrorEventSchema, type ToolCallErrorPayload, ToolCallErrorPayloadSchema, type ToolCallStartEvent, ToolCallStartEventSchema, type ToolCallStartPayload, ToolCallStartPayloadSchema, hashPrincipalId, identityScrub, principalFromOAuthEmail, principalFromOAuthSub, safeWrite, withBaton };