@goodtiming/baton-sdk 0.6.7 → 1.0.0

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.7";
3
+ declare const SDK_VERSION = "ts-1.0.0";
4
4
 
5
5
  /**
6
6
  * Zod schemas + TS types for the Baton event stream per SPEC §11.4.
@@ -124,43 +124,17 @@ 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
+ /** @experimental May change in a minor release. */
137
+ type CaptureObserved = z.infer<typeof CaptureObservedSchema>;
164
138
  declare const EventTypeSchema: z.ZodEnum<{
165
139
  tool_call_start: "tool_call_start";
166
140
  tool_call_end: "tool_call_end";
@@ -352,6 +326,12 @@ declare const ToolCallStartEventSchema: z.ZodObject<{
352
326
  form: z.ZodString;
353
327
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
354
328
  }, z.core.$strict>>>;
329
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
330
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
331
+ settings_version: z.ZodOptional<z.ZodNumber>;
332
+ audience: z.ZodOptional<z.ZodString>;
333
+ overlay: z.ZodOptional<z.ZodString>;
334
+ }, z.core.$strict>>>;
355
335
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
356
336
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
357
337
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -397,6 +377,12 @@ declare const ToolCallEndEventSchema: z.ZodObject<{
397
377
  form: z.ZodString;
398
378
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
399
379
  }, z.core.$strict>>>;
380
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
381
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
382
+ settings_version: z.ZodOptional<z.ZodNumber>;
383
+ audience: z.ZodOptional<z.ZodString>;
384
+ overlay: z.ZodOptional<z.ZodString>;
385
+ }, z.core.$strict>>>;
400
386
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
401
387
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
402
388
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -445,6 +431,12 @@ declare const ToolCallErrorEventSchema: z.ZodObject<{
445
431
  form: z.ZodString;
446
432
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
447
433
  }, z.core.$strict>>>;
434
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
435
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
436
+ settings_version: z.ZodOptional<z.ZodNumber>;
437
+ audience: z.ZodOptional<z.ZodString>;
438
+ overlay: z.ZodOptional<z.ZodString>;
439
+ }, z.core.$strict>>>;
448
440
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
449
441
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
450
442
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -493,6 +485,12 @@ declare const AnnotationEventSchema: z.ZodObject<{
493
485
  form: z.ZodString;
494
486
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
495
487
  }, z.core.$strict>>>;
488
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
489
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
490
+ settings_version: z.ZodOptional<z.ZodNumber>;
491
+ audience: z.ZodOptional<z.ZodString>;
492
+ overlay: z.ZodOptional<z.ZodString>;
493
+ }, z.core.$strict>>>;
496
494
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
497
495
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
498
496
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -540,6 +538,12 @@ declare const SurfaceSnapshotEventSchema: z.ZodObject<{
540
538
  form: z.ZodString;
541
539
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
542
540
  }, z.core.$strict>>>;
541
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
542
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
543
+ settings_version: z.ZodOptional<z.ZodNumber>;
544
+ audience: z.ZodOptional<z.ZodString>;
545
+ overlay: z.ZodOptional<z.ZodString>;
546
+ }, z.core.$strict>>>;
543
547
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
544
548
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
545
549
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -583,6 +587,12 @@ declare const ClientReportEventSchema: z.ZodObject<{
583
587
  form: z.ZodString;
584
588
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
585
589
  }, z.core.$strict>>>;
590
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
591
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
592
+ settings_version: z.ZodOptional<z.ZodNumber>;
593
+ audience: z.ZodOptional<z.ZodString>;
594
+ overlay: z.ZodOptional<z.ZodString>;
595
+ }, z.core.$strict>>>;
586
596
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
587
597
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
588
598
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -598,6 +608,7 @@ declare const ClientReportEventSchema: z.ZodObject<{
598
608
  call_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
599
609
  runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
600
610
  }, z.core.$strict>;
611
+ /** @experimental May change in a minor release. */
601
612
  type ClientReportEvent = z.infer<typeof ClientReportEventSchema>;
602
613
  declare const ResourceListStartEventSchema: z.ZodObject<{
603
614
  event_type: z.ZodDefault<z.ZodLiteral<"resource_list_start">>;
@@ -623,6 +634,12 @@ declare const ResourceListStartEventSchema: z.ZodObject<{
623
634
  form: z.ZodString;
624
635
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
625
636
  }, z.core.$strict>>>;
637
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
638
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
639
+ settings_version: z.ZodOptional<z.ZodNumber>;
640
+ audience: z.ZodOptional<z.ZodString>;
641
+ overlay: z.ZodOptional<z.ZodString>;
642
+ }, z.core.$strict>>>;
626
643
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
627
644
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
628
645
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -666,6 +683,12 @@ declare const ResourceListEndEventSchema: z.ZodObject<{
666
683
  form: z.ZodString;
667
684
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
668
685
  }, z.core.$strict>>>;
686
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
687
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
688
+ settings_version: z.ZodOptional<z.ZodNumber>;
689
+ audience: z.ZodOptional<z.ZodString>;
690
+ overlay: z.ZodOptional<z.ZodString>;
691
+ }, z.core.$strict>>>;
669
692
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
670
693
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
671
694
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -710,6 +733,12 @@ declare const ResourceListErrorEventSchema: z.ZodObject<{
710
733
  form: z.ZodString;
711
734
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
712
735
  }, z.core.$strict>>>;
736
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
737
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
738
+ settings_version: z.ZodOptional<z.ZodNumber>;
739
+ audience: z.ZodOptional<z.ZodString>;
740
+ overlay: z.ZodOptional<z.ZodString>;
741
+ }, z.core.$strict>>>;
713
742
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
714
743
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
715
744
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -753,6 +782,12 @@ declare const ResourceReadStartEventSchema: z.ZodObject<{
753
782
  form: z.ZodString;
754
783
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
755
784
  }, z.core.$strict>>>;
785
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
786
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
787
+ settings_version: z.ZodOptional<z.ZodNumber>;
788
+ audience: z.ZodOptional<z.ZodString>;
789
+ overlay: z.ZodOptional<z.ZodString>;
790
+ }, z.core.$strict>>>;
756
791
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
757
792
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
758
793
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -796,6 +831,12 @@ declare const ResourceReadEndEventSchema: z.ZodObject<{
796
831
  form: z.ZodString;
797
832
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
798
833
  }, z.core.$strict>>>;
834
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
835
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
836
+ settings_version: z.ZodOptional<z.ZodNumber>;
837
+ audience: z.ZodOptional<z.ZodString>;
838
+ overlay: z.ZodOptional<z.ZodString>;
839
+ }, z.core.$strict>>>;
799
840
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
800
841
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
801
842
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -841,6 +882,12 @@ declare const ResourceReadErrorEventSchema: z.ZodObject<{
841
882
  form: z.ZodString;
842
883
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
843
884
  }, z.core.$strict>>>;
885
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
886
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
887
+ settings_version: z.ZodOptional<z.ZodNumber>;
888
+ audience: z.ZodOptional<z.ZodString>;
889
+ overlay: z.ZodOptional<z.ZodString>;
890
+ }, z.core.$strict>>>;
844
891
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
845
892
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
846
893
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -881,6 +928,12 @@ declare const PromptListStartEventSchema: z.ZodObject<{
881
928
  form: z.ZodString;
882
929
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
883
930
  }, z.core.$strict>>>;
931
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
932
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
933
+ settings_version: z.ZodOptional<z.ZodNumber>;
934
+ audience: z.ZodOptional<z.ZodString>;
935
+ overlay: z.ZodOptional<z.ZodString>;
936
+ }, z.core.$strict>>>;
884
937
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
885
938
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
886
939
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -924,6 +977,12 @@ declare const PromptListEndEventSchema: z.ZodObject<{
924
977
  form: z.ZodString;
925
978
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
926
979
  }, z.core.$strict>>>;
980
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
981
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
982
+ settings_version: z.ZodOptional<z.ZodNumber>;
983
+ audience: z.ZodOptional<z.ZodString>;
984
+ overlay: z.ZodOptional<z.ZodString>;
985
+ }, z.core.$strict>>>;
927
986
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
928
987
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
929
988
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -968,6 +1027,12 @@ declare const PromptListErrorEventSchema: z.ZodObject<{
968
1027
  form: z.ZodString;
969
1028
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
970
1029
  }, z.core.$strict>>>;
1030
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1031
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1032
+ settings_version: z.ZodOptional<z.ZodNumber>;
1033
+ audience: z.ZodOptional<z.ZodString>;
1034
+ overlay: z.ZodOptional<z.ZodString>;
1035
+ }, z.core.$strict>>>;
971
1036
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
972
1037
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
973
1038
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1011,6 +1076,12 @@ declare const PromptGetStartEventSchema: z.ZodObject<{
1011
1076
  form: z.ZodString;
1012
1077
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1013
1078
  }, z.core.$strict>>>;
1079
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1080
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1081
+ settings_version: z.ZodOptional<z.ZodNumber>;
1082
+ audience: z.ZodOptional<z.ZodString>;
1083
+ overlay: z.ZodOptional<z.ZodString>;
1084
+ }, z.core.$strict>>>;
1014
1085
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1015
1086
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1016
1087
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1054,6 +1125,12 @@ declare const PromptGetEndEventSchema: z.ZodObject<{
1054
1125
  form: z.ZodString;
1055
1126
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1056
1127
  }, z.core.$strict>>>;
1128
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1129
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1130
+ settings_version: z.ZodOptional<z.ZodNumber>;
1131
+ audience: z.ZodOptional<z.ZodString>;
1132
+ overlay: z.ZodOptional<z.ZodString>;
1133
+ }, z.core.$strict>>>;
1057
1134
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1058
1135
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1059
1136
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1099,6 +1176,12 @@ declare const PromptGetErrorEventSchema: z.ZodObject<{
1099
1176
  form: z.ZodString;
1100
1177
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1101
1178
  }, z.core.$strict>>>;
1179
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1180
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1181
+ settings_version: z.ZodOptional<z.ZodNumber>;
1182
+ audience: z.ZodOptional<z.ZodString>;
1183
+ overlay: z.ZodOptional<z.ZodString>;
1184
+ }, z.core.$strict>>>;
1102
1185
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1103
1186
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1104
1187
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1139,6 +1222,12 @@ declare const ToolListStartEventSchema: z.ZodObject<{
1139
1222
  form: z.ZodString;
1140
1223
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1141
1224
  }, z.core.$strict>>>;
1225
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1226
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1227
+ settings_version: z.ZodOptional<z.ZodNumber>;
1228
+ audience: z.ZodOptional<z.ZodString>;
1229
+ overlay: z.ZodOptional<z.ZodString>;
1230
+ }, z.core.$strict>>>;
1142
1231
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1143
1232
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1144
1233
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1182,6 +1271,12 @@ declare const ToolListEndEventSchema: z.ZodObject<{
1182
1271
  form: z.ZodString;
1183
1272
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1184
1273
  }, z.core.$strict>>>;
1274
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1275
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1276
+ settings_version: z.ZodOptional<z.ZodNumber>;
1277
+ audience: z.ZodOptional<z.ZodString>;
1278
+ overlay: z.ZodOptional<z.ZodString>;
1279
+ }, z.core.$strict>>>;
1185
1280
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1186
1281
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1187
1282
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1226,6 +1321,12 @@ declare const ToolListErrorEventSchema: z.ZodObject<{
1226
1321
  form: z.ZodString;
1227
1322
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1228
1323
  }, z.core.$strict>>>;
1324
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1325
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1326
+ settings_version: z.ZodOptional<z.ZodNumber>;
1327
+ audience: z.ZodOptional<z.ZodString>;
1328
+ overlay: z.ZodOptional<z.ZodString>;
1329
+ }, z.core.$strict>>>;
1229
1330
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1230
1331
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1231
1332
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1242,6 +1343,8 @@ declare const ToolListErrorEventSchema: z.ZodObject<{
1242
1343
  runtime_meta: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
1243
1344
  }, z.core.$strict>;
1244
1345
  type ToolListErrorEvent = z.infer<typeof ToolListErrorEventSchema>;
1346
+ /** @experimental The zod schema for any event. Its type names zod's, so it may
1347
+ * change with a zod major. */
1245
1348
  declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1246
1349
  call_id: z.ZodString;
1247
1350
  event_type: z.ZodDefault<z.ZodLiteral<"tool_call_start">>;
@@ -1274,6 +1377,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1274
1377
  form: z.ZodString;
1275
1378
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1276
1379
  }, z.core.$strict>>>;
1380
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1381
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1382
+ settings_version: z.ZodOptional<z.ZodNumber>;
1383
+ audience: z.ZodOptional<z.ZodString>;
1384
+ overlay: z.ZodOptional<z.ZodString>;
1385
+ }, z.core.$strict>>>;
1277
1386
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1278
1387
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1279
1388
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1317,6 +1426,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1317
1426
  form: z.ZodString;
1318
1427
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1319
1428
  }, z.core.$strict>>>;
1429
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1430
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1431
+ settings_version: z.ZodOptional<z.ZodNumber>;
1432
+ audience: z.ZodOptional<z.ZodString>;
1433
+ overlay: z.ZodOptional<z.ZodString>;
1434
+ }, z.core.$strict>>>;
1320
1435
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1321
1436
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1322
1437
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1363,6 +1478,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1363
1478
  form: z.ZodString;
1364
1479
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1365
1480
  }, z.core.$strict>>>;
1481
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1482
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1483
+ settings_version: z.ZodOptional<z.ZodNumber>;
1484
+ audience: z.ZodOptional<z.ZodString>;
1485
+ overlay: z.ZodOptional<z.ZodString>;
1486
+ }, z.core.$strict>>>;
1366
1487
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1367
1488
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1368
1489
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1409,6 +1530,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1409
1530
  form: z.ZodString;
1410
1531
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1411
1532
  }, z.core.$strict>>>;
1533
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1534
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1535
+ settings_version: z.ZodOptional<z.ZodNumber>;
1536
+ audience: z.ZodOptional<z.ZodString>;
1537
+ overlay: z.ZodOptional<z.ZodString>;
1538
+ }, z.core.$strict>>>;
1412
1539
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1413
1540
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1414
1541
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1454,6 +1581,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1454
1581
  form: z.ZodString;
1455
1582
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1456
1583
  }, z.core.$strict>>>;
1584
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1585
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1586
+ settings_version: z.ZodOptional<z.ZodNumber>;
1587
+ audience: z.ZodOptional<z.ZodString>;
1588
+ overlay: z.ZodOptional<z.ZodString>;
1589
+ }, z.core.$strict>>>;
1457
1590
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1458
1591
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1459
1592
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1495,6 +1628,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1495
1628
  form: z.ZodString;
1496
1629
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1497
1630
  }, z.core.$strict>>>;
1631
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1632
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1633
+ settings_version: z.ZodOptional<z.ZodNumber>;
1634
+ audience: z.ZodOptional<z.ZodString>;
1635
+ overlay: z.ZodOptional<z.ZodString>;
1636
+ }, z.core.$strict>>>;
1498
1637
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1499
1638
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1500
1639
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1533,6 +1672,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1533
1672
  form: z.ZodString;
1534
1673
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1535
1674
  }, z.core.$strict>>>;
1675
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1676
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1677
+ settings_version: z.ZodOptional<z.ZodNumber>;
1678
+ audience: z.ZodOptional<z.ZodString>;
1679
+ overlay: z.ZodOptional<z.ZodString>;
1680
+ }, z.core.$strict>>>;
1536
1681
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1537
1682
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1538
1683
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1574,6 +1719,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1574
1719
  form: z.ZodString;
1575
1720
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1576
1721
  }, z.core.$strict>>>;
1722
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1723
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1724
+ settings_version: z.ZodOptional<z.ZodNumber>;
1725
+ audience: z.ZodOptional<z.ZodString>;
1726
+ overlay: z.ZodOptional<z.ZodString>;
1727
+ }, z.core.$strict>>>;
1577
1728
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1578
1729
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1579
1730
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1616,6 +1767,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1616
1767
  form: z.ZodString;
1617
1768
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1618
1769
  }, z.core.$strict>>>;
1770
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1771
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1772
+ settings_version: z.ZodOptional<z.ZodNumber>;
1773
+ audience: z.ZodOptional<z.ZodString>;
1774
+ overlay: z.ZodOptional<z.ZodString>;
1775
+ }, z.core.$strict>>>;
1619
1776
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1620
1777
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1621
1778
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1657,6 +1814,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1657
1814
  form: z.ZodString;
1658
1815
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1659
1816
  }, z.core.$strict>>>;
1817
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1818
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1819
+ settings_version: z.ZodOptional<z.ZodNumber>;
1820
+ audience: z.ZodOptional<z.ZodString>;
1821
+ overlay: z.ZodOptional<z.ZodString>;
1822
+ }, z.core.$strict>>>;
1660
1823
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1661
1824
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1662
1825
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1698,6 +1861,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1698
1861
  form: z.ZodString;
1699
1862
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1700
1863
  }, z.core.$strict>>>;
1864
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1865
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1866
+ settings_version: z.ZodOptional<z.ZodNumber>;
1867
+ audience: z.ZodOptional<z.ZodString>;
1868
+ overlay: z.ZodOptional<z.ZodString>;
1869
+ }, z.core.$strict>>>;
1701
1870
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1702
1871
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1703
1872
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1741,6 +1910,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1741
1910
  form: z.ZodString;
1742
1911
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1743
1912
  }, z.core.$strict>>>;
1913
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1914
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1915
+ settings_version: z.ZodOptional<z.ZodNumber>;
1916
+ audience: z.ZodOptional<z.ZodString>;
1917
+ overlay: z.ZodOptional<z.ZodString>;
1918
+ }, z.core.$strict>>>;
1744
1919
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1745
1920
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1746
1921
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1779,6 +1954,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1779
1954
  form: z.ZodString;
1780
1955
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1781
1956
  }, z.core.$strict>>>;
1957
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1958
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1959
+ settings_version: z.ZodOptional<z.ZodNumber>;
1960
+ audience: z.ZodOptional<z.ZodString>;
1961
+ overlay: z.ZodOptional<z.ZodString>;
1962
+ }, z.core.$strict>>>;
1782
1963
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1783
1964
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1784
1965
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1820,6 +2001,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1820
2001
  form: z.ZodString;
1821
2002
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1822
2003
  }, z.core.$strict>>>;
2004
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
2005
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
2006
+ settings_version: z.ZodOptional<z.ZodNumber>;
2007
+ audience: z.ZodOptional<z.ZodString>;
2008
+ overlay: z.ZodOptional<z.ZodString>;
2009
+ }, z.core.$strict>>>;
1823
2010
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1824
2011
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1825
2012
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1862,6 +2049,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1862
2049
  form: z.ZodString;
1863
2050
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1864
2051
  }, z.core.$strict>>>;
2052
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
2053
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
2054
+ settings_version: z.ZodOptional<z.ZodNumber>;
2055
+ audience: z.ZodOptional<z.ZodString>;
2056
+ overlay: z.ZodOptional<z.ZodString>;
2057
+ }, z.core.$strict>>>;
1865
2058
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1866
2059
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1867
2060
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1903,6 +2096,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1903
2096
  form: z.ZodString;
1904
2097
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1905
2098
  }, z.core.$strict>>>;
2099
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
2100
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
2101
+ settings_version: z.ZodOptional<z.ZodNumber>;
2102
+ audience: z.ZodOptional<z.ZodString>;
2103
+ overlay: z.ZodOptional<z.ZodString>;
2104
+ }, z.core.$strict>>>;
1906
2105
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1907
2106
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1908
2107
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1944,6 +2143,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1944
2143
  form: z.ZodString;
1945
2144
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1946
2145
  }, z.core.$strict>>>;
2146
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
2147
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
2148
+ settings_version: z.ZodOptional<z.ZodNumber>;
2149
+ audience: z.ZodOptional<z.ZodString>;
2150
+ overlay: z.ZodOptional<z.ZodString>;
2151
+ }, z.core.$strict>>>;
1947
2152
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1948
2153
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1949
2154
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -1987,6 +2192,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1987
2192
  form: z.ZodString;
1988
2193
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1989
2194
  }, z.core.$strict>>>;
2195
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
2196
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
2197
+ settings_version: z.ZodOptional<z.ZodNumber>;
2198
+ audience: z.ZodOptional<z.ZodString>;
2199
+ overlay: z.ZodOptional<z.ZodString>;
2200
+ }, z.core.$strict>>>;
1990
2201
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1991
2202
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1992
2203
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -2025,6 +2236,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2025
2236
  form: z.ZodString;
2026
2237
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2027
2238
  }, z.core.$strict>>>;
2239
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
2240
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
2241
+ settings_version: z.ZodOptional<z.ZodNumber>;
2242
+ audience: z.ZodOptional<z.ZodString>;
2243
+ overlay: z.ZodOptional<z.ZodString>;
2244
+ }, z.core.$strict>>>;
2028
2245
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2029
2246
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2030
2247
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -2066,6 +2283,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2066
2283
  form: z.ZodString;
2067
2284
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2068
2285
  }, z.core.$strict>>>;
2286
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
2287
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
2288
+ settings_version: z.ZodOptional<z.ZodNumber>;
2289
+ audience: z.ZodOptional<z.ZodString>;
2290
+ overlay: z.ZodOptional<z.ZodString>;
2291
+ }, z.core.$strict>>>;
2069
2292
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2070
2293
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2071
2294
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -2108,6 +2331,12 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2108
2331
  form: z.ZodString;
2109
2332
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2110
2333
  }, z.core.$strict>>>;
2334
+ labels: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
2335
+ capture: z.ZodDefault<z.ZodNullable<z.ZodObject<{
2336
+ settings_version: z.ZodOptional<z.ZodNumber>;
2337
+ audience: z.ZodOptional<z.ZodString>;
2338
+ overlay: z.ZodOptional<z.ZodString>;
2339
+ }, z.core.$strict>>>;
2111
2340
  transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2112
2341
  session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2113
2342
  client_observed: z.ZodDefault<z.ZodNullable<z.ZodObject<{
@@ -2135,56 +2364,6 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2135
2364
  * than a fourth copy. */
2136
2365
  type Event = z.infer<typeof EventSchema>;
2137
2366
 
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
2367
  /**
2189
2368
  * Stateful recursive scrubber with the default ruleset baked in.
2190
2369
  *
@@ -2239,9 +2418,10 @@ declare function identityScrub(value: unknown): unknown;
2239
2418
  */
2240
2419
 
2241
2420
  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. */
2421
+ /** Hand one event to the sink. Baton calls a sink you write from a queue,
2422
+ * one event at a time for each install or client the sink is given to,
2423
+ * never from the vendor's call: a slow write delays later events, not the
2424
+ * vendor. */
2245
2425
  write(event: Event): Promise<void>;
2246
2426
  /** Wait for any buffered events to reach their destination (or be
2247
2427
  * dropped per the sink's policy). No-op for synchronous sinks. */
@@ -2254,14 +2434,6 @@ interface Sink {
2254
2434
  declare class SinkClosedError extends Error {
2255
2435
  name: string;
2256
2436
  }
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
2437
  interface StdoutSinkOptions {
2266
2438
  /** Defaults to `process.stderr` — stdio MCP transport reserves stdout for
2267
2439
  * JSON-RPC framing. Pass `process.stdout` explicitly for non-MCP (library
@@ -2281,11 +2453,15 @@ declare class StdoutSink implements Sink {
2281
2453
  * resolves, so `tail -f` sees it at once. */
2282
2454
  declare class FileSink implements Sink {
2283
2455
  private readonly path;
2284
- private fd;
2456
+ private file;
2457
+ private closeOnce;
2458
+ /** Writes run one after another: two at once on one file can interleave. */
2459
+ private last;
2285
2460
  private closed;
2286
2461
  constructor(path: string);
2287
2462
  write(event: Event): Promise<void>;
2288
2463
  flush(): Promise<void>;
2464
+ /** A second call waits for the first (SPEC §11.2 rule 7). */
2289
2465
  aclose(): Promise<void>;
2290
2466
  }
2291
2467
  /** Sends each event to every sink, e.g. `new MultiSink([new StdoutSink(),
@@ -2501,21 +2677,6 @@ declare class HttpSink implements Sink {
2501
2677
  private static refusedIn;
2502
2678
  }
2503
2679
 
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
2680
  /** What the emitted value IS — the privacy classification, and the only thing
2520
2681
  * SPEC §11.4 lets a consumer classify on. */
2521
2682
  declare const PRINCIPAL_FORM_HASHED = "hashed";
@@ -2541,6 +2702,11 @@ interface Principal {
2541
2702
  /** The company this principal belongs to. Sent as `organization`, and
2542
2703
  * dropped alone when unusable (SPEC §11.4). */
2543
2704
  organization?: Organization | null | undefined;
2705
+ /** @experimental May change in a minor release.
2706
+ *
2707
+ * As `Organization.labels`. A principal's labels and its organization's
2708
+ * are sent together. */
2709
+ labels?: readonly string[] | undefined;
2544
2710
  }
2545
2711
  /** The company or workspace the caller belongs to, as the vendor sees it.
2546
2712
  * Sent as `organization` (SPEC §11.4), beside `principal` or alone. It is
@@ -2549,6 +2715,12 @@ interface Organization {
2549
2715
  organizationId: string;
2550
2716
  form?: PrincipalForm | undefined;
2551
2717
  displayName?: string | null | undefined;
2718
+ /** @experimental May change in a minor release.
2719
+ *
2720
+ * Your names for the groups this caller is in, for Console settings to
2721
+ * match (SPEC §11.4). Baton sees them, so use group names or keys you keep,
2722
+ * never raw ids. */
2723
+ labels?: readonly string[] | undefined;
2552
2724
  }
2553
2725
 
2554
2726
  /** A validated access token, as both majors declare it
@@ -2568,6 +2740,31 @@ interface AuthInfo {
2568
2740
  extra?: Record<string, unknown> | undefined;
2569
2741
  }
2570
2742
 
2743
+ /** The envelope's `client_observed` (SPEC §11.4): what the client said about
2744
+ * itself, sent uninterpreted. The consumer names the client; this SDK does
2745
+ * not, and sends `agent_runtime: "unknown"` on every event. */
2746
+
2747
+ /** Headers as a vendor's server framework holds them: a fetch `Headers`, or a
2748
+ * plain record such as Node's `req.headers`. */
2749
+ type HeaderInput = Headers | Record<string, string | readonly string[] | undefined>;
2750
+
2751
+ /** The registered values of `resultCaptureMode` (SPEC §11.4), and the single
2752
+ * source of truth for them.
2753
+ *
2754
+ * A second hand-written list would make the guarantee "two lists happen to
2755
+ * agree". `config.ts` builds its validator set from THIS array rather than
2756
+ * restating the literals, so a mode cannot be accepted at the door without
2757
+ * someone having given it a payload shape below. */
2758
+ declare const RESULT_CAPTURE_MODES: readonly ["full", "off"];
2759
+ /** What a vendor may set. Derived, so the type and the registry cannot drift. */
2760
+ type ResultCaptureMode = (typeof RESULT_CAPTURE_MODES)[number];
2761
+
2762
+ /** Capture settings read from the collector (SPEC §2.6): fetch, match, apply.
2763
+ * The TypeScript half of Python's `_capture_settings.py`. */
2764
+
2765
+ declare const SETTINGS_MODES: readonly ["local", "console"];
2766
+ type SettingsMode = (typeof SETTINGS_MODES)[number];
2767
+
2571
2768
  /** `BatonConfig.resolvePrincipal` — the ONLY identity provenance (SPEC §11.4).
2572
2769
  *
2573
2770
  * The producer never reads the token itself and never derives the value: who
@@ -2617,17 +2814,6 @@ interface PrincipalResolutionContext {
2617
2814
  * means "no opinion about this caller", which is not an error. */
2618
2815
  type ResolvePrincipalHook = (context: PrincipalResolutionContext) => Principal | Organization | null | Promise<Principal | Organization | null>;
2619
2816
 
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
2817
  /**
2632
2818
  * `BatonConfig` — vendor-side configuration for `withBaton`. A trimmed
2633
2819
  * mirror of `baton` (Python)'s `integrations/_config.py::VendorConfig`.
@@ -2694,8 +2880,9 @@ interface BatonConfig {
2694
2880
  /** End-user consent token attached to every emitted event per SPEC §2.3 —
2695
2881
  * the Console MUST reject events missing it.
2696
2882
  *
2697
- * **Defaulted, so the customer never has to carry it** — see
2698
- * `DEFAULT_CONSENT_TOKEN` for why the field stays on the wire regardless.
2883
+ * **Defaulted to `"customer-consented"`, so the customer never has to carry
2884
+ * it.** The field stays on the wire: SPEC §2.3 governs the envelope, not the
2885
+ * config.
2699
2886
  * Passing `""` explicitly still throws: a value the vendor deliberately
2700
2887
  * emptied is a mistake, not a request for the default.
2701
2888
  *
@@ -2727,11 +2914,33 @@ interface BatonConfig {
2727
2914
  * `reportMode: "on"`, and warns if set without it. */
2728
2915
  annotationToolName?: string;
2729
2916
  /** 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
2917
+ * Unset, it is `"on"` with `settings: "console"` and `"off"` otherwise.
2918
+ * `"off"` registers no annotation tool, and Baton's server
2731
2919
  * instructions are `INTENT_INSTRUCTIONS` alone, below your own. Each call's
2732
2920
  * goal still arrives through `user_goal`. `"on"` registers the tool and
2733
2921
  * serves its instructions. */
2734
2922
  reportMode?: "on" | "off";
2923
+ /** @experimental May change in a minor release.
2924
+ *
2925
+ * Where capture settings come from. `"local"` (default): the values in
2926
+ * this config, and Baton is never asked. `"console"`: the settings saved on
2927
+ * the Console's Capture page, read from the collector every
2928
+ * `settingsRefreshMs`, so they can differ by label, client or a share of
2929
+ * callers (SPEC §2.6). Needs a `dsn`. Until the first read succeeds, and
2930
+ * whenever nothing is saved, this config's values apply. A read never
2931
+ * delays startup or a call.
2932
+ *
2933
+ * `results` (`resultCaptureMode`) is applied per call. `goal`
2934
+ * (`intentParamMode`) and `reports` (`reportMode`) are applied per
2935
+ * `tools/list`. With `reportMode: "off"` no annotation tool is registered,
2936
+ * so the Console can hide reports from some callers only when they are on
2937
+ * here. */
2938
+ settings?: SettingsMode;
2939
+ /** @experimental May change in a minor release.
2940
+ *
2941
+ * How often `settings: "console"` reads the saved settings, in
2942
+ * milliseconds. Default 60000, at least 15000. */
2943
+ settingsRefreshMs?: number;
2735
2944
  /** Per-tool intent-param injection (mirrors baton-extmcp's vendor-neutral
2736
2945
  * naming). `"required"` (default) injects a `user_goal` string param on
2737
2946
  * every wrapped tool's advertised schema and ADVERTISES it as required in
@@ -2807,6 +3016,8 @@ interface BatonConfig {
2807
3016
  * scope for this package.
2808
3017
  */
2809
3018
  declare class BatonHandle {
3019
+ #private;
3020
+ /** The sink the vendor passed, or the default one. */
2810
3021
  readonly sink: Sink;
2811
3022
  readonly vendorId: string;
2812
3023
  /** The install's own session id: what stdio and in-memory calls, and the
@@ -2819,6 +3030,8 @@ declare class BatonHandle {
2819
3030
  readonly annotationToolName: string;
2820
3031
  constructor(options: {
2821
3032
  sink: Sink;
3033
+ /** What Baton writes to, in front of `sink`. */
3034
+ queue?: Sink;
2822
3035
  vendorId: string;
2823
3036
  sessionId: string;
2824
3037
  annotationToolName: string;
@@ -2994,14 +3207,6 @@ interface ListToolsOptions {
2994
3207
  instructions?: string | null;
2995
3208
  }
2996
3209
 
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
3210
  /**
3006
3211
  * The library API (SPEC §5.6): `Client` for a vendor whose agents reach it
3007
3212
  * through something other than MCP — a REST API, a skill, or a tool loop in
@@ -3136,6 +3341,28 @@ declare class Client {
3136
3341
  aclose(): Promise<void>;
3137
3342
  }
3138
3343
 
3344
+ /** The annotation tool as data, for a vendor offering it through its own API (SPEC §5.6). */
3345
+
3346
+ /** The tool an MCP adapter registers under `reportMode: "on"`. */
3347
+ interface ReportTool {
3348
+ readonly name: string;
3349
+ readonly description: string;
3350
+ readonly inputSchema: Record<string, unknown>;
3351
+ /** The report pointer and `INTENT_INSTRUCTIONS`, for a vendor serving MCP itself. */
3352
+ readonly instructions: string;
3353
+ /** What to answer when `annotateArgs` returns `null`. */
3354
+ readonly refusal: string;
3355
+ /** The `annotate()` options for this tool's `args`, or `null` when there is
3356
+ * no `what_happened`: answer `refusal` and send nothing. */
3357
+ annotateArgs(args: Readonly<Record<string, unknown>>): AnnotateOptions | null;
3358
+ }
3359
+ /** The annotation tool an adapter registers on a server named
3360
+ * `vendorDisplayName`. `name` overrides the name made from it. */
3361
+ declare function reportTool(options: {
3362
+ vendorDisplayName: string;
3363
+ name?: string;
3364
+ }): ReportTool;
3365
+
3139
3366
  /** The server instructions a vendor serving MCP itself puts in its
3140
3367
  * `initialize` result beside `user_goal` (SPEC §5.6), and all of Baton's
3141
3368
  * instructions under `reportMode: "off"`. */
@@ -3152,4 +3379,4 @@ interface IntentParam {
3152
3379
  }
3153
3380
  declare const INTENT_PARAMS: readonly IntentParam[];
3154
3381
 
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 };
3382
+ 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 };