@goodtiming/baton-sdk 0.6.8 → 1.0.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.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
 
3
- declare const SDK_VERSION = "ts-0.6.8";
3
+ declare const SDK_VERSION = "ts-1.0.1";
4
4
 
5
5
  /**
6
6
  * Zod schemas + TS types for the Baton event stream per SPEC §11.4.
@@ -14,7 +14,7 @@ declare const SDK_VERSION = "ts-0.6.8";
14
14
  *
15
15
  * All concrete event schemas share the same envelope fields and differ only
16
16
  * in `payload`. Fields match Python field-for-field (snake_case on the wire,
17
- * per CHARTER's wire-compatibility requirement — NOT camelCase).
17
+ * NOT camelCase).
18
18
  */
19
19
 
20
20
  /** Emitted before the vendor handler runs. `params` is PII-scrubbed at
@@ -124,43 +124,16 @@ declare const ClientReportPayloadSchema: z.ZodObject<{
124
124
  instance_id: z.ZodUUID;
125
125
  dropped: z.ZodRecord<z.ZodString, z.ZodNumber>;
126
126
  }, z.core.$strict>;
127
+ /** @experimental May change in a minor release. */
127
128
  type ClientReportPayload = z.infer<typeof ClientReportPayloadSchema>;
128
- /**
129
- * What the SDK puts in `consent_token` when the vendor names no other value.
130
- * Byte-for-byte Python's `baton.events.DEFAULT_CONSENT_TOKEN`, and the two
131
- * must not drift: a collector comparing the field across arms would see two
132
- * populations where there is one.
133
- *
134
- * **The field stays on the wire and the customer stops carrying it.** SPEC
135
- * §2.3 governs the envelope, not the config, so defaulting here changes
136
- * nothing a consumer sees — this is the value the onboarding recipe has been
137
- * minting into `BATON_CONSENT_TOKEN` all along, now stated once instead of
138
- * threaded through an environment variable that reads to nobody.
139
- */
140
- declare const DEFAULT_CONSENT_TOKEN = "customer-consented";
141
- /** The principal as emitted — `{id, source, form}`, all three REQUIRED
142
- * together, plus an optional `display_name` (SPEC §11.4). The runtime shape
143
- * of `identity.PrincipalWire`.
144
- *
145
- * `.strict()` mirrors Python's `extra="forbid"`: a member this producer does
146
- * not know about is a malformed object, not a richer one.
147
- *
148
- * ⚠ **`source` and `form` are `z.string()`, not enums, on purpose** — the same
149
- * decision `transport_observed` records and the collector's own columns make.
150
- * A fourth `source` is already foreseen (alias-derived), and an enum would
151
- * make this producer unable to emit a value SPEC registers later without a
152
- * release. Worse, it would throw at the emit boundary — `emit()` catches that
153
- * and DROPS the event, so the tool call survives and the capture does not,
154
- * which is still the wrong trade for a value SPEC may register later. The
155
- * safety lives in the consumer rules stated positively — trust only exactly
156
- * `"attested"`, treat anything but exactly `"hashed"` as personal data — so an
157
- * unregistered value fails safe without anything having to reject it. */
158
- declare const PrincipalWireSchema: z.ZodObject<{
159
- id: z.ZodString;
160
- source: z.ZodString;
161
- form: z.ZodString;
162
- display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
129
+ /** Which collector settings a call ran under (SPEC §11.4, §2.6). A member
130
+ * with no value is left out. */
131
+ declare const CaptureObservedSchema: z.ZodObject<{
132
+ settings_version: z.ZodOptional<z.ZodNumber>;
133
+ audience: z.ZodOptional<z.ZodString>;
134
+ overlay: z.ZodOptional<z.ZodString>;
163
135
  }, z.core.$strict>;
136
+ type CaptureObserved = z.infer<typeof CaptureObservedSchema>;
164
137
  declare const EventTypeSchema: z.ZodEnum<{
165
138
  tool_call_start: "tool_call_start";
166
139
  tool_call_end: "tool_call_end";
@@ -352,6 +325,12 @@ declare const ToolCallStartEventSchema: z.ZodObject<{
352
325
  form: z.ZodString;
353
326
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
354
327
  }, z.core.$strict>>>;
328
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
329
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
330
+ settings_version: z.ZodOptional<z.ZodNumber>;
331
+ audience: z.ZodOptional<z.ZodString>;
332
+ overlay: z.ZodOptional<z.ZodString>;
333
+ }, z.core.$strict>>>;
355
334
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
356
335
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
357
336
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -397,6 +376,12 @@ declare const ToolCallEndEventSchema: z.ZodObject<{
397
376
  form: z.ZodString;
398
377
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
399
378
  }, z.core.$strict>>>;
379
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
380
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
381
+ settings_version: z.ZodOptional<z.ZodNumber>;
382
+ audience: z.ZodOptional<z.ZodString>;
383
+ overlay: z.ZodOptional<z.ZodString>;
384
+ }, z.core.$strict>>>;
400
385
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
401
386
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
402
387
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -445,6 +430,12 @@ declare const ToolCallErrorEventSchema: z.ZodObject<{
445
430
  form: z.ZodString;
446
431
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
447
432
  }, z.core.$strict>>>;
433
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
434
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
435
+ settings_version: z.ZodOptional<z.ZodNumber>;
436
+ audience: z.ZodOptional<z.ZodString>;
437
+ overlay: z.ZodOptional<z.ZodString>;
438
+ }, z.core.$strict>>>;
448
439
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
449
440
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
450
441
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -493,6 +484,12 @@ declare const AnnotationEventSchema: z.ZodObject<{
493
484
  form: z.ZodString;
494
485
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
495
486
  }, z.core.$strict>>>;
487
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
488
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
489
+ settings_version: z.ZodOptional<z.ZodNumber>;
490
+ audience: z.ZodOptional<z.ZodString>;
491
+ overlay: z.ZodOptional<z.ZodString>;
492
+ }, z.core.$strict>>>;
496
493
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
497
494
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
498
495
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -540,6 +537,12 @@ declare const SurfaceSnapshotEventSchema: z.ZodObject<{
540
537
  form: z.ZodString;
541
538
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
542
539
  }, z.core.$strict>>>;
540
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
541
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
542
+ settings_version: z.ZodOptional<z.ZodNumber>;
543
+ audience: z.ZodOptional<z.ZodString>;
544
+ overlay: z.ZodOptional<z.ZodString>;
545
+ }, z.core.$strict>>>;
543
546
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
544
547
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
545
548
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -583,6 +586,12 @@ declare const ClientReportEventSchema: z.ZodObject<{
583
586
  form: z.ZodString;
584
587
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
585
588
  }, z.core.$strict>>>;
589
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
590
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
591
+ settings_version: z.ZodOptional<z.ZodNumber>;
592
+ audience: z.ZodOptional<z.ZodString>;
593
+ overlay: z.ZodOptional<z.ZodString>;
594
+ }, z.core.$strict>>>;
586
595
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
587
596
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
588
597
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -598,6 +607,7 @@ declare const ClientReportEventSchema: z.ZodObject<{
598
607
  call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
599
608
  runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
600
609
  }, z.core.$strict>;
610
+ /** @experimental May change in a minor release. */
601
611
  type ClientReportEvent = z.infer<typeof ClientReportEventSchema>;
602
612
  declare const ResourceListStartEventSchema: z.ZodObject<{
603
613
  event_type: z.ZodDefault<z.ZodLiteral<"resource_list_start">>;
@@ -623,6 +633,12 @@ declare const ResourceListStartEventSchema: z.ZodObject<{
623
633
  form: z.ZodString;
624
634
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
625
635
  }, z.core.$strict>>>;
636
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
637
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
638
+ settings_version: z.ZodOptional<z.ZodNumber>;
639
+ audience: z.ZodOptional<z.ZodString>;
640
+ overlay: z.ZodOptional<z.ZodString>;
641
+ }, z.core.$strict>>>;
626
642
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
627
643
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
628
644
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -666,6 +682,12 @@ declare const ResourceListEndEventSchema: z.ZodObject<{
666
682
  form: z.ZodString;
667
683
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
668
684
  }, z.core.$strict>>>;
685
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
686
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
687
+ settings_version: z.ZodOptional<z.ZodNumber>;
688
+ audience: z.ZodOptional<z.ZodString>;
689
+ overlay: z.ZodOptional<z.ZodString>;
690
+ }, z.core.$strict>>>;
669
691
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
670
692
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
671
693
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -710,6 +732,12 @@ declare const ResourceListErrorEventSchema: z.ZodObject<{
710
732
  form: z.ZodString;
711
733
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
712
734
  }, z.core.$strict>>>;
735
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
736
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
737
+ settings_version: z.ZodOptional<z.ZodNumber>;
738
+ audience: z.ZodOptional<z.ZodString>;
739
+ overlay: z.ZodOptional<z.ZodString>;
740
+ }, z.core.$strict>>>;
713
741
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
714
742
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
715
743
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -753,6 +781,12 @@ declare const ResourceReadStartEventSchema: z.ZodObject<{
753
781
  form: z.ZodString;
754
782
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
755
783
  }, z.core.$strict>>>;
784
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
785
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
786
+ settings_version: z.ZodOptional<z.ZodNumber>;
787
+ audience: z.ZodOptional<z.ZodString>;
788
+ overlay: z.ZodOptional<z.ZodString>;
789
+ }, z.core.$strict>>>;
756
790
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
757
791
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
758
792
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -796,6 +830,12 @@ declare const ResourceReadEndEventSchema: z.ZodObject<{
796
830
  form: z.ZodString;
797
831
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
798
832
  }, z.core.$strict>>>;
833
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
834
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
835
+ settings_version: z.ZodOptional<z.ZodNumber>;
836
+ audience: z.ZodOptional<z.ZodString>;
837
+ overlay: z.ZodOptional<z.ZodString>;
838
+ }, z.core.$strict>>>;
799
839
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
800
840
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
801
841
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -841,6 +881,12 @@ declare const ResourceReadErrorEventSchema: z.ZodObject<{
841
881
  form: z.ZodString;
842
882
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
843
883
  }, z.core.$strict>>>;
884
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
885
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
886
+ settings_version: z.ZodOptional<z.ZodNumber>;
887
+ audience: z.ZodOptional<z.ZodString>;
888
+ overlay: z.ZodOptional<z.ZodString>;
889
+ }, z.core.$strict>>>;
844
890
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
845
891
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
846
892
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -881,6 +927,12 @@ declare const PromptListStartEventSchema: z.ZodObject<{
881
927
  form: z.ZodString;
882
928
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
883
929
  }, z.core.$strict>>>;
930
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
931
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
932
+ settings_version: z.ZodOptional<z.ZodNumber>;
933
+ audience: z.ZodOptional<z.ZodString>;
934
+ overlay: z.ZodOptional<z.ZodString>;
935
+ }, z.core.$strict>>>;
884
936
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
885
937
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
886
938
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -924,6 +976,12 @@ declare const PromptListEndEventSchema: z.ZodObject<{
924
976
  form: z.ZodString;
925
977
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
926
978
  }, z.core.$strict>>>;
979
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
980
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
981
+ settings_version: z.ZodOptional<z.ZodNumber>;
982
+ audience: z.ZodOptional<z.ZodString>;
983
+ overlay: z.ZodOptional<z.ZodString>;
984
+ }, z.core.$strict>>>;
927
985
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
928
986
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
929
987
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -968,6 +1026,12 @@ declare const PromptListErrorEventSchema: z.ZodObject<{
968
1026
  form: z.ZodString;
969
1027
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
970
1028
  }, z.core.$strict>>>;
1029
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1030
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1031
+ settings_version: z.ZodOptional<z.ZodNumber>;
1032
+ audience: z.ZodOptional<z.ZodString>;
1033
+ overlay: z.ZodOptional<z.ZodString>;
1034
+ }, z.core.$strict>>>;
971
1035
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
972
1036
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
973
1037
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1011,6 +1075,12 @@ declare const PromptGetStartEventSchema: z.ZodObject<{
1011
1075
  form: z.ZodString;
1012
1076
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1013
1077
  }, z.core.$strict>>>;
1078
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1079
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1080
+ settings_version: z.ZodOptional<z.ZodNumber>;
1081
+ audience: z.ZodOptional<z.ZodString>;
1082
+ overlay: z.ZodOptional<z.ZodString>;
1083
+ }, z.core.$strict>>>;
1014
1084
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1015
1085
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1016
1086
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1054,6 +1124,12 @@ declare const PromptGetEndEventSchema: z.ZodObject<{
1054
1124
  form: z.ZodString;
1055
1125
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1056
1126
  }, z.core.$strict>>>;
1127
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1128
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1129
+ settings_version: z.ZodOptional<z.ZodNumber>;
1130
+ audience: z.ZodOptional<z.ZodString>;
1131
+ overlay: z.ZodOptional<z.ZodString>;
1132
+ }, z.core.$strict>>>;
1057
1133
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1058
1134
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1059
1135
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1099,6 +1175,12 @@ declare const PromptGetErrorEventSchema: z.ZodObject<{
1099
1175
  form: z.ZodString;
1100
1176
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1101
1177
  }, z.core.$strict>>>;
1178
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1179
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1180
+ settings_version: z.ZodOptional<z.ZodNumber>;
1181
+ audience: z.ZodOptional<z.ZodString>;
1182
+ overlay: z.ZodOptional<z.ZodString>;
1183
+ }, z.core.$strict>>>;
1102
1184
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1103
1185
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1104
1186
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1139,6 +1221,12 @@ declare const ToolListStartEventSchema: z.ZodObject<{
1139
1221
  form: z.ZodString;
1140
1222
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1141
1223
  }, z.core.$strict>>>;
1224
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1225
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1226
+ settings_version: z.ZodOptional<z.ZodNumber>;
1227
+ audience: z.ZodOptional<z.ZodString>;
1228
+ overlay: z.ZodOptional<z.ZodString>;
1229
+ }, z.core.$strict>>>;
1142
1230
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1143
1231
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1144
1232
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1182,6 +1270,12 @@ declare const ToolListEndEventSchema: z.ZodObject<{
1182
1270
  form: z.ZodString;
1183
1271
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1184
1272
  }, z.core.$strict>>>;
1273
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1274
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1275
+ settings_version: z.ZodOptional<z.ZodNumber>;
1276
+ audience: z.ZodOptional<z.ZodString>;
1277
+ overlay: z.ZodOptional<z.ZodString>;
1278
+ }, z.core.$strict>>>;
1185
1279
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1186
1280
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1187
1281
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1226,6 +1320,12 @@ declare const ToolListErrorEventSchema: z.ZodObject<{
1226
1320
  form: z.ZodString;
1227
1321
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1228
1322
  }, z.core.$strict>>>;
1323
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1324
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1325
+ settings_version: z.ZodOptional<z.ZodNumber>;
1326
+ audience: z.ZodOptional<z.ZodString>;
1327
+ overlay: z.ZodOptional<z.ZodString>;
1328
+ }, z.core.$strict>>>;
1229
1329
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1230
1330
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1231
1331
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1242,6 +1342,8 @@ declare const ToolListErrorEventSchema: z.ZodObject<{
1242
1342
  runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
1243
1343
  }, z.core.$strict>;
1244
1344
  type ToolListErrorEvent = z.infer<typeof ToolListErrorEventSchema>;
1345
+ /** @experimental The zod schema for any event. Its type names zod's, so it may
1346
+ * change with a zod major. */
1245
1347
  declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1246
1348
  call_id: z.ZodString;
1247
1349
  event_type: z.ZodDefault<z.ZodLiteral<"tool_call_start">>;
@@ -1274,6 +1376,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1274
1376
  form: z.ZodString;
1275
1377
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1276
1378
  }, z.core.$strict>>>;
1379
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1380
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1381
+ settings_version: z.ZodOptional<z.ZodNumber>;
1382
+ audience: z.ZodOptional<z.ZodString>;
1383
+ overlay: z.ZodOptional<z.ZodString>;
1384
+ }, z.core.$strict>>>;
1277
1385
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1278
1386
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1279
1387
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1317,6 +1425,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1317
1425
  form: z.ZodString;
1318
1426
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1319
1427
  }, z.core.$strict>>>;
1428
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1429
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1430
+ settings_version: z.ZodOptional<z.ZodNumber>;
1431
+ audience: z.ZodOptional<z.ZodString>;
1432
+ overlay: z.ZodOptional<z.ZodString>;
1433
+ }, z.core.$strict>>>;
1320
1434
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1321
1435
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1322
1436
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1363,6 +1477,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1363
1477
  form: z.ZodString;
1364
1478
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1365
1479
  }, z.core.$strict>>>;
1480
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1481
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1482
+ settings_version: z.ZodOptional<z.ZodNumber>;
1483
+ audience: z.ZodOptional<z.ZodString>;
1484
+ overlay: z.ZodOptional<z.ZodString>;
1485
+ }, z.core.$strict>>>;
1366
1486
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1367
1487
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1368
1488
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1409,6 +1529,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1409
1529
  form: z.ZodString;
1410
1530
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1411
1531
  }, z.core.$strict>>>;
1532
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1533
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1534
+ settings_version: z.ZodOptional<z.ZodNumber>;
1535
+ audience: z.ZodOptional<z.ZodString>;
1536
+ overlay: z.ZodOptional<z.ZodString>;
1537
+ }, z.core.$strict>>>;
1412
1538
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1413
1539
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1414
1540
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1454,6 +1580,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1454
1580
  form: z.ZodString;
1455
1581
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1456
1582
  }, z.core.$strict>>>;
1583
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1584
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1585
+ settings_version: z.ZodOptional<z.ZodNumber>;
1586
+ audience: z.ZodOptional<z.ZodString>;
1587
+ overlay: z.ZodOptional<z.ZodString>;
1588
+ }, z.core.$strict>>>;
1457
1589
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1458
1590
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1459
1591
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1495,6 +1627,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1495
1627
  form: z.ZodString;
1496
1628
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1497
1629
  }, z.core.$strict>>>;
1630
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1631
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1632
+ settings_version: z.ZodOptional<z.ZodNumber>;
1633
+ audience: z.ZodOptional<z.ZodString>;
1634
+ overlay: z.ZodOptional<z.ZodString>;
1635
+ }, z.core.$strict>>>;
1498
1636
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1499
1637
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1500
1638
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1533,6 +1671,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1533
1671
  form: z.ZodString;
1534
1672
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1535
1673
  }, z.core.$strict>>>;
1674
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1675
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1676
+ settings_version: z.ZodOptional<z.ZodNumber>;
1677
+ audience: z.ZodOptional<z.ZodString>;
1678
+ overlay: z.ZodOptional<z.ZodString>;
1679
+ }, z.core.$strict>>>;
1536
1680
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1537
1681
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1538
1682
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1574,6 +1718,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1574
1718
  form: z.ZodString;
1575
1719
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1576
1720
  }, z.core.$strict>>>;
1721
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1722
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1723
+ settings_version: z.ZodOptional<z.ZodNumber>;
1724
+ audience: z.ZodOptional<z.ZodString>;
1725
+ overlay: z.ZodOptional<z.ZodString>;
1726
+ }, z.core.$strict>>>;
1577
1727
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1578
1728
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1579
1729
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1616,6 +1766,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1616
1766
  form: z.ZodString;
1617
1767
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1618
1768
  }, z.core.$strict>>>;
1769
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1770
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1771
+ settings_version: z.ZodOptional<z.ZodNumber>;
1772
+ audience: z.ZodOptional<z.ZodString>;
1773
+ overlay: z.ZodOptional<z.ZodString>;
1774
+ }, z.core.$strict>>>;
1619
1775
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1620
1776
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1621
1777
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1657,6 +1813,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1657
1813
  form: z.ZodString;
1658
1814
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1659
1815
  }, z.core.$strict>>>;
1816
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1817
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1818
+ settings_version: z.ZodOptional<z.ZodNumber>;
1819
+ audience: z.ZodOptional<z.ZodString>;
1820
+ overlay: z.ZodOptional<z.ZodString>;
1821
+ }, z.core.$strict>>>;
1660
1822
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1661
1823
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1662
1824
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1698,6 +1860,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1698
1860
  form: z.ZodString;
1699
1861
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1700
1862
  }, z.core.$strict>>>;
1863
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1864
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1865
+ settings_version: z.ZodOptional<z.ZodNumber>;
1866
+ audience: z.ZodOptional<z.ZodString>;
1867
+ overlay: z.ZodOptional<z.ZodString>;
1868
+ }, z.core.$strict>>>;
1701
1869
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1702
1870
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1703
1871
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1741,6 +1909,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1741
1909
  form: z.ZodString;
1742
1910
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1743
1911
  }, z.core.$strict>>>;
1912
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1913
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1914
+ settings_version: z.ZodOptional<z.ZodNumber>;
1915
+ audience: z.ZodOptional<z.ZodString>;
1916
+ overlay: z.ZodOptional<z.ZodString>;
1917
+ }, z.core.$strict>>>;
1744
1918
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1745
1919
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1746
1920
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1779,6 +1953,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1779
1953
  form: z.ZodString;
1780
1954
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1781
1955
  }, z.core.$strict>>>;
1956
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1957
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1958
+ settings_version: z.ZodOptional<z.ZodNumber>;
1959
+ audience: z.ZodOptional<z.ZodString>;
1960
+ overlay: z.ZodOptional<z.ZodString>;
1961
+ }, z.core.$strict>>>;
1782
1962
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1783
1963
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1784
1964
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1820,6 +2000,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1820
2000
  form: z.ZodString;
1821
2001
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1822
2002
  }, z.core.$strict>>>;
2003
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
2004
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
2005
+ settings_version: z.ZodOptional<z.ZodNumber>;
2006
+ audience: z.ZodOptional<z.ZodString>;
2007
+ overlay: z.ZodOptional<z.ZodString>;
2008
+ }, z.core.$strict>>>;
1823
2009
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1824
2010
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1825
2011
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1862,6 +2048,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1862
2048
  form: z.ZodString;
1863
2049
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1864
2050
  }, z.core.$strict>>>;
2051
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
2052
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
2053
+ settings_version: z.ZodOptional<z.ZodNumber>;
2054
+ audience: z.ZodOptional<z.ZodString>;
2055
+ overlay: z.ZodOptional<z.ZodString>;
2056
+ }, z.core.$strict>>>;
1865
2057
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1866
2058
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1867
2059
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1903,6 +2095,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1903
2095
  form: z.ZodString;
1904
2096
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1905
2097
  }, z.core.$strict>>>;
2098
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
2099
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
2100
+ settings_version: z.ZodOptional<z.ZodNumber>;
2101
+ audience: z.ZodOptional<z.ZodString>;
2102
+ overlay: z.ZodOptional<z.ZodString>;
2103
+ }, z.core.$strict>>>;
1906
2104
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1907
2105
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1908
2106
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1944,6 +2142,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1944
2142
  form: z.ZodString;
1945
2143
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1946
2144
  }, z.core.$strict>>>;
2145
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
2146
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
2147
+ settings_version: z.ZodOptional<z.ZodNumber>;
2148
+ audience: z.ZodOptional<z.ZodString>;
2149
+ overlay: z.ZodOptional<z.ZodString>;
2150
+ }, z.core.$strict>>>;
1947
2151
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1948
2152
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1949
2153
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1987,6 +2191,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1987
2191
  form: z.ZodString;
1988
2192
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1989
2193
  }, z.core.$strict>>>;
2194
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
2195
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
2196
+ settings_version: z.ZodOptional<z.ZodNumber>;
2197
+ audience: z.ZodOptional<z.ZodString>;
2198
+ overlay: z.ZodOptional<z.ZodString>;
2199
+ }, z.core.$strict>>>;
1990
2200
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1991
2201
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1992
2202
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -2025,6 +2235,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2025
2235
  form: z.ZodString;
2026
2236
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2027
2237
  }, z.core.$strict>>>;
2238
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
2239
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
2240
+ settings_version: z.ZodOptional<z.ZodNumber>;
2241
+ audience: z.ZodOptional<z.ZodString>;
2242
+ overlay: z.ZodOptional<z.ZodString>;
2243
+ }, z.core.$strict>>>;
2028
2244
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2029
2245
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2030
2246
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -2066,6 +2282,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2066
2282
  form: z.ZodString;
2067
2283
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2068
2284
  }, z.core.$strict>>>;
2285
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
2286
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
2287
+ settings_version: z.ZodOptional<z.ZodNumber>;
2288
+ audience: z.ZodOptional<z.ZodString>;
2289
+ overlay: z.ZodOptional<z.ZodString>;
2290
+ }, z.core.$strict>>>;
2069
2291
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2070
2292
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2071
2293
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -2108,6 +2330,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2108
2330
  form: z.ZodString;
2109
2331
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2110
2332
  }, z.core.$strict>>>;
2333
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
2334
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
2335
+ settings_version: z.ZodOptional<z.ZodNumber>;
2336
+ audience: z.ZodOptional<z.ZodString>;
2337
+ overlay: z.ZodOptional<z.ZodString>;
2338
+ }, z.core.$strict>>>;
2111
2339
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2112
2340
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2113
2341
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -2135,56 +2363,6 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2135
2363
  * than a fourth copy. */
2136
2364
  type Event = z.infer<typeof EventSchema>;
2137
2365
 
2138
- /**
2139
- * Source-side PII scrubbing for event payloads (SPEC §7).
2140
- *
2141
- * The SDK emits whatever the wrapped MCP server returns — including tool
2142
- * params and results that may carry customer PII (emails in search results,
2143
- * bearer tokens in error bodies, API keys pasted into chat tools). Persona
2144
- * B's trust pitch is that nothing unscrubbed ever leaves the customer's
2145
- * machine; this module is what makes that true. Every event payload runs
2146
- * through `Scrubber` before it lands in the sink, so both local sinks AND
2147
- * any HTTP sink see only scrubbed values.
2148
- *
2149
- * **Default ruleset** ships fixed for v1 (no public env-var configurability
2150
- * — deferred until customer feedback justifies the surface area):
2151
- *
2152
- * - email — RFC-ish address regex
2153
- * - bearer — `Bearer <opaque>` header values
2154
- * - sk_key — OpenAI/Anthropic-style `sk-*` API keys
2155
- * - aws_key — `AKIA*` access key IDs
2156
- * - jwt — three-segment `eyJ*.*.*` tokens
2157
- * - phone — North-American-leaning loose digit pattern
2158
- * - cc — 13-19 digit candidates filtered by Luhn
2159
- *
2160
- * Plus field-name overrides: any object key matching
2161
- * `{email, phone, ssn, api_key, token, secret, password, user_name}`
2162
- * (case-insensitive) force-redacts its string value regardless of pattern.
2163
- *
2164
- * Differs from LangSmith's approach (off by default, bring-your-own regex)
2165
- * by shipping rules on by default — the right tradeoff for Persona B's
2166
- * consumer/SMB audience that won't write masking code.
2167
- *
2168
- * Ported from `baton` (Python)'s `src/baton/scrub.py` on 2026-08-11, which
2169
- * is itself a parallel copy of baton-proxy's (the two are rule-identical —
2170
- * verified by diff at port time; they differ only in docstrings). All three
2171
- * ship parallel copies until the extracted shared package lands. Rule
2172
- * parity here is verified by mirroring Python's `tests/test_scrub.py` test
2173
- * matrix in `test/scrub.test.ts`; when a pattern lands or changes, port the
2174
- * test every way.
2175
- *
2176
- * **Port notes** (where TypeScript forced a divergence from the Python):
2177
- * - `counts` is a `Map<string, number>`, not a `collections.Counter`. Use
2178
- * `count(category)` for Python's zero-default read.
2179
- * - Python walks anything `isinstance(dict)`; this walks only *plain*
2180
- * objects (`{}` / `Object.create(null)`). A `Date`, `Map`, or class
2181
- * instance passes through untouched rather than being flattened to `{}`
2182
- * — matching Python, where those aren't dicts either.
2183
- */
2184
- /** Cap on recursive walk depth. Matches LangSmith's default; protects
2185
- * against pathological inputs without truncating realistic MCP payloads. */
2186
- declare const DEPTH_LIMIT = 10;
2187
- declare const DEPTH_MARKER = "[REDACTED:depth-limit]";
2188
2366
  /**
2189
2367
  * Stateful recursive scrubber with the default ruleset baked in.
2190
2368
  *
@@ -2239,9 +2417,10 @@ declare function identityScrub(value: unknown): unknown;
2239
2417
  */
2240
2418
 
2241
2419
  interface Sink {
2242
- /** Hand one event to the sink. Resolves once the sink has accepted it
2243
- * (which may mean buffered, not yet shipped). MUST NOT block the
2244
- * producer on slow downstream destinations. */
2420
+ /** Hand one event to the sink. Baton calls a sink you write from a queue,
2421
+ * one event at a time for each install or client the sink is given to,
2422
+ * never from the vendor's call: a slow write delays later events, not the
2423
+ * vendor. */
2245
2424
  write(event: Event): Promise<void>;
2246
2425
  /** Wait for any buffered events to reach their destination (or be
2247
2426
  * dropped per the sink's policy). No-op for synchronous sinks. */
@@ -2254,14 +2433,6 @@ interface Sink {
2254
2433
  declare class SinkClosedError extends Error {
2255
2434
  name: string;
2256
2435
  }
2257
- /** Fail-open wrapper around `sink.write`.
2258
- *
2259
- * The MCP tool wrapper sits BEFORE the vendor's tool handler runs. A reject
2260
- * from `sink.write` (closed sink, transport error, etc.) would otherwise
2261
- * propagate up and break the vendor's tool call — making Baton
2262
- * instrumentation look like a vendor bug. SPEC §11.2 mandates fail-open at
2263
- * the capture boundary; this wrapper enforces it. */
2264
- declare function safeWrite(sink: Sink, event: Event): Promise<void>;
2265
2436
  interface StdoutSinkOptions {
2266
2437
  /** Defaults to `process.stderr` — stdio MCP transport reserves stdout for
2267
2438
  * JSON-RPC framing. Pass `process.stdout` explicitly for non-MCP (library
@@ -2281,11 +2452,15 @@ declare class StdoutSink implements Sink {
2281
2452
  * resolves, so `tail -f` sees it at once. */
2282
2453
  declare class FileSink implements Sink {
2283
2454
  private readonly path;
2284
- private fd;
2455
+ private file;
2456
+ private closeOnce;
2457
+ /** Writes run one after another: two at once on one file can interleave. */
2458
+ private last;
2285
2459
  private closed;
2286
2460
  constructor(path: string);
2287
2461
  write(event: Event): Promise<void>;
2288
2462
  flush(): Promise<void>;
2463
+ /** A second call waits for the first (SPEC §11.2 rule 7). */
2289
2464
  aclose(): Promise<void>;
2290
2465
  }
2291
2466
  /** Sends each event to every sink, e.g. `new MultiSink([new StdoutSink(),
@@ -2501,21 +2676,6 @@ declare class HttpSink implements Sink {
2501
2676
  private static refusedIn;
2502
2677
  }
2503
2678
 
2504
- /** Principal identity — what a vendor's resolver hands back, and how it goes
2505
- * on the wire.
2506
- *
2507
- * The TypeScript half of Python's `baton/identity.py`. Baton attaches the
2508
- * resolved principal to every event so the Console can group by
2509
- * `(tenant_id, vendor_id, principal.id)`, at whatever grain the vendor
2510
- * resolved (SPEC §11.4). The resolver decides everything about the value: who
2511
- * it names, whether it is hashed, what a page shows for it. The SDK sends it
2512
- * on as stated.
2513
- */
2514
- /** Where a principal came from. `"asserted"` is a vendor's own resolver,
2515
- * which nothing in the protocol checks, and is the only value this SDK
2516
- * emits — `integrations/mcp/principalResolution.ts` has the why, and the
2517
- * wording trap that comes with it. */
2518
- declare const PRINCIPAL_SOURCE_ASSERTED = "asserted";
2519
2679
  /** What the emitted value IS — the privacy classification, and the only thing
2520
2680
  * SPEC §11.4 lets a consumer classify on. */
2521
2681
  declare const PRINCIPAL_FORM_HASHED = "hashed";
@@ -2541,6 +2701,9 @@ interface Principal {
2541
2701
  /** The company this principal belongs to. Sent as `organization`, and
2542
2702
  * dropped alone when unusable (SPEC §11.4). */
2543
2703
  organization?: Organization | null | undefined;
2704
+ /** As `Organization.labels`. A principal's labels and its organization's
2705
+ * are sent together. */
2706
+ labels?: readonly string[] | undefined;
2544
2707
  }
2545
2708
  /** The company or workspace the caller belongs to, as the vendor sees it.
2546
2709
  * Sent as `organization` (SPEC §11.4), beside `principal` or alone. It is
@@ -2549,6 +2712,10 @@ interface Organization {
2549
2712
  organizationId: string;
2550
2713
  form?: PrincipalForm | undefined;
2551
2714
  displayName?: string | null | undefined;
2715
+ /** Your names for the groups this caller is in, for Console settings to
2716
+ * match (SPEC §11.4). Baton sees them, so use group names or keys you keep,
2717
+ * never raw ids. */
2718
+ labels?: readonly string[] | undefined;
2552
2719
  }
2553
2720
 
2554
2721
  /** A validated access token, as both majors declare it
@@ -2568,6 +2735,31 @@ interface AuthInfo {
2568
2735
  extra?: Record<string, unknown> | undefined;
2569
2736
  }
2570
2737
 
2738
+ /** The envelope's `client_observed` (SPEC §11.4): what the client said about
2739
+ * itself, sent uninterpreted. The consumer names the client; this SDK does
2740
+ * not, and sends `agent_runtime: "unknown"` on every event. */
2741
+
2742
+ /** Headers as a vendor's server framework holds them: a fetch `Headers`, or a
2743
+ * plain record such as Node's `req.headers`. */
2744
+ type HeaderInput = Headers | Record<string, string | readonly string[] | undefined>;
2745
+
2746
+ /** The registered values of `resultCaptureMode` (SPEC §11.4), and the single
2747
+ * source of truth for them.
2748
+ *
2749
+ * A second hand-written list would make the guarantee "two lists happen to
2750
+ * agree". `config.ts` builds its validator set from THIS array rather than
2751
+ * restating the literals, so a mode cannot be accepted at the door without
2752
+ * someone having given it a payload shape below. */
2753
+ declare const RESULT_CAPTURE_MODES: readonly ["full", "off"];
2754
+ /** What a vendor may set. Derived, so the type and the registry cannot drift. */
2755
+ type ResultCaptureMode = (typeof RESULT_CAPTURE_MODES)[number];
2756
+
2757
+ /** Capture settings read from the collector (SPEC §2.6): fetch, match, apply.
2758
+ * The TypeScript half of Python's `_capture_settings.py`. */
2759
+
2760
+ declare const SETTINGS_MODES: readonly ["local", "console"];
2761
+ type SettingsMode = (typeof SETTINGS_MODES)[number];
2762
+
2571
2763
  /** `BatonConfig.resolvePrincipal` — the ONLY identity provenance (SPEC §11.4).
2572
2764
  *
2573
2765
  * The producer never reads the token itself and never derives the value: who
@@ -2617,17 +2809,6 @@ interface PrincipalResolutionContext {
2617
2809
  * means "no opinion about this caller", which is not an error. */
2618
2810
  type ResolvePrincipalHook = (context: PrincipalResolutionContext) => Principal | Organization | null | Promise<Principal | Organization | null>;
2619
2811
 
2620
- /** The registered values of `resultCaptureMode` (SPEC §11.4), and the single
2621
- * source of truth for them.
2622
- *
2623
- * A second hand-written list would make the guarantee "two lists happen to
2624
- * agree". `config.ts` builds its validator set from THIS array rather than
2625
- * restating the literals, so a mode cannot be accepted at the door without
2626
- * someone having given it a payload shape below. */
2627
- declare const RESULT_CAPTURE_MODES: readonly ["full", "off"];
2628
- /** What a vendor may set. Derived, so the type and the registry cannot drift. */
2629
- type ResultCaptureMode = (typeof RESULT_CAPTURE_MODES)[number];
2630
-
2631
2812
  /**
2632
2813
  * `BatonConfig` — vendor-side configuration for `withBaton`. A trimmed
2633
2814
  * mirror of `baton` (Python)'s `integrations/_config.py::VendorConfig`.
@@ -2694,8 +2875,9 @@ interface BatonConfig {
2694
2875
  /** End-user consent token attached to every emitted event per SPEC §2.3 —
2695
2876
  * the Console MUST reject events missing it.
2696
2877
  *
2697
- * **Defaulted, so the customer never has to carry it** — see
2698
- * `DEFAULT_CONSENT_TOKEN` for why the field stays on the wire regardless.
2878
+ * **Defaulted to `"customer-consented"`, so the customer never has to carry
2879
+ * it.** The field stays on the wire: SPEC §2.3 governs the envelope, not the
2880
+ * config.
2699
2881
  * Passing `""` explicitly still throws: a value the vendor deliberately
2700
2882
  * emptied is a mistake, not a request for the default.
2701
2883
  *
@@ -2727,11 +2909,29 @@ interface BatonConfig {
2727
2909
  * `reportMode: "on"`, and warns if set without it. */
2728
2910
  annotationToolName?: string;
2729
2911
  /** Whether the agent is given a tool to report a call that went wrong.
2730
- * `"off"` (the default) registers no annotation tool, and Baton's server
2912
+ * Unset, it is `"on"` with `settings: "console"` and `"off"` otherwise.
2913
+ * `"off"` registers no annotation tool, and Baton's server
2731
2914
  * instructions are `INTENT_INSTRUCTIONS` alone, below your own. Each call's
2732
2915
  * goal still arrives through `user_goal`. `"on"` registers the tool and
2733
2916
  * serves its instructions. */
2734
2917
  reportMode?: "on" | "off";
2918
+ /** Where capture settings come from. `"local"` (default): the values in
2919
+ * this config, and Baton is never asked. `"console"`: the settings saved on
2920
+ * the Console's Capture page, read from the collector every
2921
+ * `settingsRefreshMs`, so they can differ by label, client or a share of
2922
+ * callers (SPEC §2.6). Needs a `dsn`. Until the first read succeeds, and
2923
+ * whenever nothing is saved, this config's values apply. A read never
2924
+ * delays startup or a call.
2925
+ *
2926
+ * `results` (`resultCaptureMode`) is applied per call. `goal`
2927
+ * (`intentParamMode`) and `reports` (`reportMode`) are applied per
2928
+ * `tools/list`. With `reportMode: "off"` no annotation tool is registered,
2929
+ * so the Console can hide reports from some callers only when they are on
2930
+ * here. */
2931
+ settings?: SettingsMode;
2932
+ /** How often `settings: "console"` reads the saved settings, in
2933
+ * milliseconds. Default 60000, at least 15000. */
2934
+ settingsRefreshMs?: number;
2735
2935
  /** Per-tool intent-param injection (mirrors baton-extmcp's vendor-neutral
2736
2936
  * naming). `"required"` (default) injects a `user_goal` string param on
2737
2937
  * every wrapped tool's advertised schema and ADVERTISES it as required in
@@ -2807,6 +3007,8 @@ interface BatonConfig {
2807
3007
  * scope for this package.
2808
3008
  */
2809
3009
  declare class BatonHandle {
3010
+ #private;
3011
+ /** The sink the vendor passed, or the default one. */
2810
3012
  readonly sink: Sink;
2811
3013
  readonly vendorId: string;
2812
3014
  /** The install's own session id: what stdio and in-memory calls, and the
@@ -2819,6 +3021,8 @@ declare class BatonHandle {
2819
3021
  readonly annotationToolName: string;
2820
3022
  constructor(options: {
2821
3023
  sink: Sink;
3024
+ /** What Baton writes to, in front of `sink`. */
3025
+ queue?: Sink;
2822
3026
  vendorId: string;
2823
3027
  sessionId: string;
2824
3028
  annotationToolName: string;
@@ -2994,14 +3198,6 @@ interface ListToolsOptions {
2994
3198
  instructions?: string | null;
2995
3199
  }
2996
3200
 
2997
- /** The envelope's `client_observed` (SPEC §11.4): what the client said about
2998
- * itself, sent uninterpreted. The consumer names the client; this SDK does
2999
- * not, and sends `agent_runtime: "unknown"` on every event. */
3000
-
3001
- /** Headers as a vendor's server framework holds them: a fetch `Headers`, or a
3002
- * plain record such as Node's `req.headers`. */
3003
- type HeaderInput = Headers | Record<string, string | readonly string[] | undefined>;
3004
-
3005
3201
  /**
3006
3202
  * The library API (SPEC §5.6): `Client` for a vendor whose agents reach it
3007
3203
  * through something other than MCP — a REST API, a skill, or a tool loop in
@@ -3042,8 +3238,8 @@ interface SessionOptions {
3042
3238
  sessionId?: string;
3043
3239
  /** Who the vendor says is calling: a `Principal`, which may carry its
3044
3240
  * `organization`, or an `Organization` alone when only the company is known.
3045
- * A block with only a company and no `sessionId` is never joined to another
3046
- * (SPEC §11.5.1), so pass your own `sessionId` then. */
3241
+ * A block with only a company and no `sessionId` gets a session of its own,
3242
+ * so pass your own `sessionId` to keep a conversation's blocks together. */
3047
3243
  principal?: Principal | Organization;
3048
3244
  /** What the calling client said about itself. */
3049
3245
  clientInfo?: {
@@ -3136,6 +3332,28 @@ declare class Client {
3136
3332
  aclose(): Promise<void>;
3137
3333
  }
3138
3334
 
3335
+ /** The annotation tool as data, for a vendor offering it through its own API (SPEC §5.6). */
3336
+
3337
+ /** The tool an MCP adapter registers under `reportMode: "on"`. */
3338
+ interface ReportTool {
3339
+ readonly name: string;
3340
+ readonly description: string;
3341
+ readonly inputSchema: Record<string, unknown>;
3342
+ /** The report pointer and `INTENT_INSTRUCTIONS`, for a vendor serving MCP itself. */
3343
+ readonly instructions: string;
3344
+ /** What to answer when `annotateArgs` returns `null`. */
3345
+ readonly refusal: string;
3346
+ /** The `annotate()` options for this tool's `args`, or `null` when there is
3347
+ * no `what_happened`: answer `refusal` and send nothing. */
3348
+ annotateArgs(args: Readonly<Record<string, unknown>>): AnnotateOptions | null;
3349
+ }
3350
+ /** The annotation tool an adapter registers on a server named
3351
+ * `vendorDisplayName`. `name` overrides the name made from it. */
3352
+ declare function reportTool(options: {
3353
+ vendorDisplayName: string;
3354
+ name?: string;
3355
+ }): ReportTool;
3356
+
3139
3357
  /** The server instructions a vendor serving MCP itself puts in its
3140
3358
  * `initialize` result beside `user_goal` (SPEC §5.6), and all of Baton's
3141
3359
  * instructions under `reportMode: "off"`. */
@@ -3152,4 +3370,4 @@ interface IntentParam {
3152
3370
  }
3153
3371
  declare const INTENT_PARAMS: readonly IntentParam[];
3154
3372
 
3155
- export { type AnnotateOptions, type AnnotationEvent, AnnotationEventSchema, type AnnotationPayload, AnnotationPayloadSchema, type AuthInfo, type Baton, type BatonConfig, BatonHandle, Client, type ClientOptions, type ClientReportEvent, ClientReportEventSchema, type ClientReportPayload, ClientReportPayloadSchema, DEFAULT_CONSENT_TOKEN, DEPTH_LIMIT, DEPTH_MARKER, type Event, EventSchema, type EventType, EventTypeSchema, FileSink, type HeaderInput, HttpSink, type HttpSinkOptions, INTENT_INSTRUCTIONS, INTENT_PARAMS, type IntentParam, type ListToolsOptions, MultiSink, type ObservedError, type Organization, PRINCIPAL_FORM_HASHED, PRINCIPAL_FORM_RAW, PRINCIPAL_SOURCE_ASSERTED, type Principal, type PrincipalForm, 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 SessionOptions, type Sink, SinkClosedError, 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, type ToolListEndEvent, ToolListEndEventSchema, type ToolListEndPayload, ToolListEndPayloadSchema, type ToolListErrorEvent, ToolListErrorEventSchema, type ToolListErrorPayload, ToolListErrorPayloadSchema, type ToolListStartEvent, ToolListStartEventSchema, type ToolListStartPayload, ToolListStartPayloadSchema, Trace, type TraceOptions, createBaton, identityScrub, principalFromOAuthEmail, principalFromOAuthSub, safeWrite, withBaton };
3373
+ export { type AnnotateOptions, type AnnotationEvent, type AnnotationPayload, type AuthInfo, type Baton, type BatonConfig, BatonHandle, type CaptureObserved, Client, type ClientOptions, type ClientReportEvent, type ClientReportPayload, type Event, EventSchema, type EventType, FileSink, type HeaderInput, HttpSink, type HttpSinkOptions, INTENT_INSTRUCTIONS, INTENT_PARAMS, type IntentParam, type ListToolsOptions, MultiSink, type ObservedError, type Organization, type Principal, type PrincipalForm, type PrincipalResolutionContext, type PromptGetEndEvent, type PromptGetEndPayload, type PromptGetErrorEvent, type PromptGetErrorPayload, type PromptGetStartEvent, type PromptGetStartPayload, type PromptListEndEvent, type PromptListEndPayload, type PromptListErrorEvent, type PromptListErrorPayload, type PromptListStartEvent, type PromptListStartPayload, type ReportTool, type ResolvePrincipalHook, type ResourceListEndEvent, type ResourceListEndPayload, type ResourceListErrorEvent, type ResourceListErrorPayload, type ResourceListStartEvent, type ResourceListStartPayload, type ResourceReadEndEvent, type ResourceReadEndPayload, type ResourceReadErrorEvent, type ResourceReadErrorPayload, type ResourceReadStartEvent, type ResourceReadStartPayload, type ResultCaptureMode, SDK_VERSION, Scrubber, type SessionOptions, type Sink, SinkClosedError, StdoutSink, type StdoutSinkOptions, type SupportedMcpServer, type SurfaceSnapshotEvent, type SurfaceSnapshotPayload, type ToolCallEndEvent, type ToolCallEndPayload, type ToolCallErrorEvent, type ToolCallErrorPayload, type ToolCallStartEvent, type ToolCallStartPayload, type ToolListEndEvent, type ToolListEndPayload, type ToolListErrorEvent, type ToolListErrorPayload, type ToolListStartEvent, type ToolListStartPayload, Trace, type TraceOptions, createBaton, identityScrub, principalFromOAuthEmail, principalFromOAuthSub, reportTool, withBaton };