@goodtiming/baton-sdk 1.2.0 → 1.2.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.cjs +38 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +44 -1
- package/dist/index.d.ts +44 -1
- package/dist/index.js +38 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
-
declare const SDK_VERSION = "ts-1.2.
|
|
3
|
+
declare const SDK_VERSION = "ts-1.2.1";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Zod schemas + TS types for the Baton event stream per SPEC §11.4.
|
|
@@ -133,6 +133,7 @@ declare const CaptureObservedSchema: z.ZodObject<{
|
|
|
133
133
|
audience: z.ZodOptional<z.ZodString>;
|
|
134
134
|
overlay: z.ZodOptional<z.ZodString>;
|
|
135
135
|
candidate: z.ZodOptional<z.ZodString>;
|
|
136
|
+
task: z.ZodOptional<z.ZodString>;
|
|
136
137
|
}, z.core.$strict>;
|
|
137
138
|
type CaptureObserved = z.infer<typeof CaptureObservedSchema>;
|
|
138
139
|
declare const EventTypeSchema: z.ZodEnum<{
|
|
@@ -332,6 +333,7 @@ declare const ToolCallStartEventSchema: z.ZodObject<{
|
|
|
332
333
|
audience: z.ZodOptional<z.ZodString>;
|
|
333
334
|
overlay: z.ZodOptional<z.ZodString>;
|
|
334
335
|
candidate: z.ZodOptional<z.ZodString>;
|
|
336
|
+
task: z.ZodOptional<z.ZodString>;
|
|
335
337
|
}, z.core.$strict>>>;
|
|
336
338
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
337
339
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -384,6 +386,7 @@ declare const ToolCallEndEventSchema: z.ZodObject<{
|
|
|
384
386
|
audience: z.ZodOptional<z.ZodString>;
|
|
385
387
|
overlay: z.ZodOptional<z.ZodString>;
|
|
386
388
|
candidate: z.ZodOptional<z.ZodString>;
|
|
389
|
+
task: z.ZodOptional<z.ZodString>;
|
|
387
390
|
}, z.core.$strict>>>;
|
|
388
391
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
389
392
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -439,6 +442,7 @@ declare const ToolCallErrorEventSchema: z.ZodObject<{
|
|
|
439
442
|
audience: z.ZodOptional<z.ZodString>;
|
|
440
443
|
overlay: z.ZodOptional<z.ZodString>;
|
|
441
444
|
candidate: z.ZodOptional<z.ZodString>;
|
|
445
|
+
task: z.ZodOptional<z.ZodString>;
|
|
442
446
|
}, z.core.$strict>>>;
|
|
443
447
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
444
448
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -494,6 +498,7 @@ declare const AnnotationEventSchema: z.ZodObject<{
|
|
|
494
498
|
audience: z.ZodOptional<z.ZodString>;
|
|
495
499
|
overlay: z.ZodOptional<z.ZodString>;
|
|
496
500
|
candidate: z.ZodOptional<z.ZodString>;
|
|
501
|
+
task: z.ZodOptional<z.ZodString>;
|
|
497
502
|
}, z.core.$strict>>>;
|
|
498
503
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
499
504
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -548,6 +553,7 @@ declare const SurfaceSnapshotEventSchema: z.ZodObject<{
|
|
|
548
553
|
audience: z.ZodOptional<z.ZodString>;
|
|
549
554
|
overlay: z.ZodOptional<z.ZodString>;
|
|
550
555
|
candidate: z.ZodOptional<z.ZodString>;
|
|
556
|
+
task: z.ZodOptional<z.ZodString>;
|
|
551
557
|
}, z.core.$strict>>>;
|
|
552
558
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
553
559
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -598,6 +604,7 @@ declare const ClientReportEventSchema: z.ZodObject<{
|
|
|
598
604
|
audience: z.ZodOptional<z.ZodString>;
|
|
599
605
|
overlay: z.ZodOptional<z.ZodString>;
|
|
600
606
|
candidate: z.ZodOptional<z.ZodString>;
|
|
607
|
+
task: z.ZodOptional<z.ZodString>;
|
|
601
608
|
}, z.core.$strict>>>;
|
|
602
609
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
603
610
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -646,6 +653,7 @@ declare const ResourceListStartEventSchema: z.ZodObject<{
|
|
|
646
653
|
audience: z.ZodOptional<z.ZodString>;
|
|
647
654
|
overlay: z.ZodOptional<z.ZodString>;
|
|
648
655
|
candidate: z.ZodOptional<z.ZodString>;
|
|
656
|
+
task: z.ZodOptional<z.ZodString>;
|
|
649
657
|
}, z.core.$strict>>>;
|
|
650
658
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
651
659
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -696,6 +704,7 @@ declare const ResourceListEndEventSchema: z.ZodObject<{
|
|
|
696
704
|
audience: z.ZodOptional<z.ZodString>;
|
|
697
705
|
overlay: z.ZodOptional<z.ZodString>;
|
|
698
706
|
candidate: z.ZodOptional<z.ZodString>;
|
|
707
|
+
task: z.ZodOptional<z.ZodString>;
|
|
699
708
|
}, z.core.$strict>>>;
|
|
700
709
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
701
710
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -747,6 +756,7 @@ declare const ResourceListErrorEventSchema: z.ZodObject<{
|
|
|
747
756
|
audience: z.ZodOptional<z.ZodString>;
|
|
748
757
|
overlay: z.ZodOptional<z.ZodString>;
|
|
749
758
|
candidate: z.ZodOptional<z.ZodString>;
|
|
759
|
+
task: z.ZodOptional<z.ZodString>;
|
|
750
760
|
}, z.core.$strict>>>;
|
|
751
761
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
752
762
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -797,6 +807,7 @@ declare const ResourceReadStartEventSchema: z.ZodObject<{
|
|
|
797
807
|
audience: z.ZodOptional<z.ZodString>;
|
|
798
808
|
overlay: z.ZodOptional<z.ZodString>;
|
|
799
809
|
candidate: z.ZodOptional<z.ZodString>;
|
|
810
|
+
task: z.ZodOptional<z.ZodString>;
|
|
800
811
|
}, z.core.$strict>>>;
|
|
801
812
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
802
813
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -847,6 +858,7 @@ declare const ResourceReadEndEventSchema: z.ZodObject<{
|
|
|
847
858
|
audience: z.ZodOptional<z.ZodString>;
|
|
848
859
|
overlay: z.ZodOptional<z.ZodString>;
|
|
849
860
|
candidate: z.ZodOptional<z.ZodString>;
|
|
861
|
+
task: z.ZodOptional<z.ZodString>;
|
|
850
862
|
}, z.core.$strict>>>;
|
|
851
863
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
852
864
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -899,6 +911,7 @@ declare const ResourceReadErrorEventSchema: z.ZodObject<{
|
|
|
899
911
|
audience: z.ZodOptional<z.ZodString>;
|
|
900
912
|
overlay: z.ZodOptional<z.ZodString>;
|
|
901
913
|
candidate: z.ZodOptional<z.ZodString>;
|
|
914
|
+
task: z.ZodOptional<z.ZodString>;
|
|
902
915
|
}, z.core.$strict>>>;
|
|
903
916
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
904
917
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -946,6 +959,7 @@ declare const PromptListStartEventSchema: z.ZodObject<{
|
|
|
946
959
|
audience: z.ZodOptional<z.ZodString>;
|
|
947
960
|
overlay: z.ZodOptional<z.ZodString>;
|
|
948
961
|
candidate: z.ZodOptional<z.ZodString>;
|
|
962
|
+
task: z.ZodOptional<z.ZodString>;
|
|
949
963
|
}, z.core.$strict>>>;
|
|
950
964
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
951
965
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -996,6 +1010,7 @@ declare const PromptListEndEventSchema: z.ZodObject<{
|
|
|
996
1010
|
audience: z.ZodOptional<z.ZodString>;
|
|
997
1011
|
overlay: z.ZodOptional<z.ZodString>;
|
|
998
1012
|
candidate: z.ZodOptional<z.ZodString>;
|
|
1013
|
+
task: z.ZodOptional<z.ZodString>;
|
|
999
1014
|
}, z.core.$strict>>>;
|
|
1000
1015
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1001
1016
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -1047,6 +1062,7 @@ declare const PromptListErrorEventSchema: z.ZodObject<{
|
|
|
1047
1062
|
audience: z.ZodOptional<z.ZodString>;
|
|
1048
1063
|
overlay: z.ZodOptional<z.ZodString>;
|
|
1049
1064
|
candidate: z.ZodOptional<z.ZodString>;
|
|
1065
|
+
task: z.ZodOptional<z.ZodString>;
|
|
1050
1066
|
}, z.core.$strict>>>;
|
|
1051
1067
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1052
1068
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -1097,6 +1113,7 @@ declare const PromptGetStartEventSchema: z.ZodObject<{
|
|
|
1097
1113
|
audience: z.ZodOptional<z.ZodString>;
|
|
1098
1114
|
overlay: z.ZodOptional<z.ZodString>;
|
|
1099
1115
|
candidate: z.ZodOptional<z.ZodString>;
|
|
1116
|
+
task: z.ZodOptional<z.ZodString>;
|
|
1100
1117
|
}, z.core.$strict>>>;
|
|
1101
1118
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1102
1119
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -1147,6 +1164,7 @@ declare const PromptGetEndEventSchema: z.ZodObject<{
|
|
|
1147
1164
|
audience: z.ZodOptional<z.ZodString>;
|
|
1148
1165
|
overlay: z.ZodOptional<z.ZodString>;
|
|
1149
1166
|
candidate: z.ZodOptional<z.ZodString>;
|
|
1167
|
+
task: z.ZodOptional<z.ZodString>;
|
|
1150
1168
|
}, z.core.$strict>>>;
|
|
1151
1169
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1152
1170
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -1199,6 +1217,7 @@ declare const PromptGetErrorEventSchema: z.ZodObject<{
|
|
|
1199
1217
|
audience: z.ZodOptional<z.ZodString>;
|
|
1200
1218
|
overlay: z.ZodOptional<z.ZodString>;
|
|
1201
1219
|
candidate: z.ZodOptional<z.ZodString>;
|
|
1220
|
+
task: z.ZodOptional<z.ZodString>;
|
|
1202
1221
|
}, z.core.$strict>>>;
|
|
1203
1222
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1204
1223
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -1246,6 +1265,7 @@ declare const ToolListStartEventSchema: z.ZodObject<{
|
|
|
1246
1265
|
audience: z.ZodOptional<z.ZodString>;
|
|
1247
1266
|
overlay: z.ZodOptional<z.ZodString>;
|
|
1248
1267
|
candidate: z.ZodOptional<z.ZodString>;
|
|
1268
|
+
task: z.ZodOptional<z.ZodString>;
|
|
1249
1269
|
}, z.core.$strict>>>;
|
|
1250
1270
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1251
1271
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -1296,6 +1316,7 @@ declare const ToolListEndEventSchema: z.ZodObject<{
|
|
|
1296
1316
|
audience: z.ZodOptional<z.ZodString>;
|
|
1297
1317
|
overlay: z.ZodOptional<z.ZodString>;
|
|
1298
1318
|
candidate: z.ZodOptional<z.ZodString>;
|
|
1319
|
+
task: z.ZodOptional<z.ZodString>;
|
|
1299
1320
|
}, z.core.$strict>>>;
|
|
1300
1321
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1301
1322
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -1347,6 +1368,7 @@ declare const ToolListErrorEventSchema: z.ZodObject<{
|
|
|
1347
1368
|
audience: z.ZodOptional<z.ZodString>;
|
|
1348
1369
|
overlay: z.ZodOptional<z.ZodString>;
|
|
1349
1370
|
candidate: z.ZodOptional<z.ZodString>;
|
|
1371
|
+
task: z.ZodOptional<z.ZodString>;
|
|
1350
1372
|
}, z.core.$strict>>>;
|
|
1351
1373
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1352
1374
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -1404,6 +1426,7 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1404
1426
|
audience: z.ZodOptional<z.ZodString>;
|
|
1405
1427
|
overlay: z.ZodOptional<z.ZodString>;
|
|
1406
1428
|
candidate: z.ZodOptional<z.ZodString>;
|
|
1429
|
+
task: z.ZodOptional<z.ZodString>;
|
|
1407
1430
|
}, z.core.$strict>>>;
|
|
1408
1431
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1409
1432
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -1454,6 +1477,7 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1454
1477
|
audience: z.ZodOptional<z.ZodString>;
|
|
1455
1478
|
overlay: z.ZodOptional<z.ZodString>;
|
|
1456
1479
|
candidate: z.ZodOptional<z.ZodString>;
|
|
1480
|
+
task: z.ZodOptional<z.ZodString>;
|
|
1457
1481
|
}, z.core.$strict>>>;
|
|
1458
1482
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1459
1483
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -1507,6 +1531,7 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1507
1531
|
audience: z.ZodOptional<z.ZodString>;
|
|
1508
1532
|
overlay: z.ZodOptional<z.ZodString>;
|
|
1509
1533
|
candidate: z.ZodOptional<z.ZodString>;
|
|
1534
|
+
task: z.ZodOptional<z.ZodString>;
|
|
1510
1535
|
}, z.core.$strict>>>;
|
|
1511
1536
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1512
1537
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -1560,6 +1585,7 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1560
1585
|
audience: z.ZodOptional<z.ZodString>;
|
|
1561
1586
|
overlay: z.ZodOptional<z.ZodString>;
|
|
1562
1587
|
candidate: z.ZodOptional<z.ZodString>;
|
|
1588
|
+
task: z.ZodOptional<z.ZodString>;
|
|
1563
1589
|
}, z.core.$strict>>>;
|
|
1564
1590
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1565
1591
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -1612,6 +1638,7 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1612
1638
|
audience: z.ZodOptional<z.ZodString>;
|
|
1613
1639
|
overlay: z.ZodOptional<z.ZodString>;
|
|
1614
1640
|
candidate: z.ZodOptional<z.ZodString>;
|
|
1641
|
+
task: z.ZodOptional<z.ZodString>;
|
|
1615
1642
|
}, z.core.$strict>>>;
|
|
1616
1643
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1617
1644
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -1660,6 +1687,7 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1660
1687
|
audience: z.ZodOptional<z.ZodString>;
|
|
1661
1688
|
overlay: z.ZodOptional<z.ZodString>;
|
|
1662
1689
|
candidate: z.ZodOptional<z.ZodString>;
|
|
1690
|
+
task: z.ZodOptional<z.ZodString>;
|
|
1663
1691
|
}, z.core.$strict>>>;
|
|
1664
1692
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1665
1693
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -1705,6 +1733,7 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1705
1733
|
audience: z.ZodOptional<z.ZodString>;
|
|
1706
1734
|
overlay: z.ZodOptional<z.ZodString>;
|
|
1707
1735
|
candidate: z.ZodOptional<z.ZodString>;
|
|
1736
|
+
task: z.ZodOptional<z.ZodString>;
|
|
1708
1737
|
}, z.core.$strict>>>;
|
|
1709
1738
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1710
1739
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -1753,6 +1782,7 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1753
1782
|
audience: z.ZodOptional<z.ZodString>;
|
|
1754
1783
|
overlay: z.ZodOptional<z.ZodString>;
|
|
1755
1784
|
candidate: z.ZodOptional<z.ZodString>;
|
|
1785
|
+
task: z.ZodOptional<z.ZodString>;
|
|
1756
1786
|
}, z.core.$strict>>>;
|
|
1757
1787
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1758
1788
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -1802,6 +1832,7 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1802
1832
|
audience: z.ZodOptional<z.ZodString>;
|
|
1803
1833
|
overlay: z.ZodOptional<z.ZodString>;
|
|
1804
1834
|
candidate: z.ZodOptional<z.ZodString>;
|
|
1835
|
+
task: z.ZodOptional<z.ZodString>;
|
|
1805
1836
|
}, z.core.$strict>>>;
|
|
1806
1837
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1807
1838
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -1850,6 +1881,7 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1850
1881
|
audience: z.ZodOptional<z.ZodString>;
|
|
1851
1882
|
overlay: z.ZodOptional<z.ZodString>;
|
|
1852
1883
|
candidate: z.ZodOptional<z.ZodString>;
|
|
1884
|
+
task: z.ZodOptional<z.ZodString>;
|
|
1853
1885
|
}, z.core.$strict>>>;
|
|
1854
1886
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1855
1887
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -1898,6 +1930,7 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1898
1930
|
audience: z.ZodOptional<z.ZodString>;
|
|
1899
1931
|
overlay: z.ZodOptional<z.ZodString>;
|
|
1900
1932
|
candidate: z.ZodOptional<z.ZodString>;
|
|
1933
|
+
task: z.ZodOptional<z.ZodString>;
|
|
1901
1934
|
}, z.core.$strict>>>;
|
|
1902
1935
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1903
1936
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -1948,6 +1981,7 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1948
1981
|
audience: z.ZodOptional<z.ZodString>;
|
|
1949
1982
|
overlay: z.ZodOptional<z.ZodString>;
|
|
1950
1983
|
candidate: z.ZodOptional<z.ZodString>;
|
|
1984
|
+
task: z.ZodOptional<z.ZodString>;
|
|
1951
1985
|
}, z.core.$strict>>>;
|
|
1952
1986
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1953
1987
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -1993,6 +2027,7 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1993
2027
|
audience: z.ZodOptional<z.ZodString>;
|
|
1994
2028
|
overlay: z.ZodOptional<z.ZodString>;
|
|
1995
2029
|
candidate: z.ZodOptional<z.ZodString>;
|
|
2030
|
+
task: z.ZodOptional<z.ZodString>;
|
|
1996
2031
|
}, z.core.$strict>>>;
|
|
1997
2032
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1998
2033
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -2041,6 +2076,7 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2041
2076
|
audience: z.ZodOptional<z.ZodString>;
|
|
2042
2077
|
overlay: z.ZodOptional<z.ZodString>;
|
|
2043
2078
|
candidate: z.ZodOptional<z.ZodString>;
|
|
2079
|
+
task: z.ZodOptional<z.ZodString>;
|
|
2044
2080
|
}, z.core.$strict>>>;
|
|
2045
2081
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
2046
2082
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -2090,6 +2126,7 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2090
2126
|
audience: z.ZodOptional<z.ZodString>;
|
|
2091
2127
|
overlay: z.ZodOptional<z.ZodString>;
|
|
2092
2128
|
candidate: z.ZodOptional<z.ZodString>;
|
|
2129
|
+
task: z.ZodOptional<z.ZodString>;
|
|
2093
2130
|
}, z.core.$strict>>>;
|
|
2094
2131
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
2095
2132
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -2138,6 +2175,7 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2138
2175
|
audience: z.ZodOptional<z.ZodString>;
|
|
2139
2176
|
overlay: z.ZodOptional<z.ZodString>;
|
|
2140
2177
|
candidate: z.ZodOptional<z.ZodString>;
|
|
2178
|
+
task: z.ZodOptional<z.ZodString>;
|
|
2141
2179
|
}, z.core.$strict>>>;
|
|
2142
2180
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
2143
2181
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -2186,6 +2224,7 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2186
2224
|
audience: z.ZodOptional<z.ZodString>;
|
|
2187
2225
|
overlay: z.ZodOptional<z.ZodString>;
|
|
2188
2226
|
candidate: z.ZodOptional<z.ZodString>;
|
|
2227
|
+
task: z.ZodOptional<z.ZodString>;
|
|
2189
2228
|
}, z.core.$strict>>>;
|
|
2190
2229
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
2191
2230
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -2236,6 +2275,7 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2236
2275
|
audience: z.ZodOptional<z.ZodString>;
|
|
2237
2276
|
overlay: z.ZodOptional<z.ZodString>;
|
|
2238
2277
|
candidate: z.ZodOptional<z.ZodString>;
|
|
2278
|
+
task: z.ZodOptional<z.ZodString>;
|
|
2239
2279
|
}, z.core.$strict>>>;
|
|
2240
2280
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
2241
2281
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -2281,6 +2321,7 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2281
2321
|
audience: z.ZodOptional<z.ZodString>;
|
|
2282
2322
|
overlay: z.ZodOptional<z.ZodString>;
|
|
2283
2323
|
candidate: z.ZodOptional<z.ZodString>;
|
|
2324
|
+
task: z.ZodOptional<z.ZodString>;
|
|
2284
2325
|
}, z.core.$strict>>>;
|
|
2285
2326
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
2286
2327
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -2329,6 +2370,7 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2329
2370
|
audience: z.ZodOptional<z.ZodString>;
|
|
2330
2371
|
overlay: z.ZodOptional<z.ZodString>;
|
|
2331
2372
|
candidate: z.ZodOptional<z.ZodString>;
|
|
2373
|
+
task: z.ZodOptional<z.ZodString>;
|
|
2332
2374
|
}, z.core.$strict>>>;
|
|
2333
2375
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
2334
2376
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -2378,6 +2420,7 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2378
2420
|
audience: z.ZodOptional<z.ZodString>;
|
|
2379
2421
|
overlay: z.ZodOptional<z.ZodString>;
|
|
2380
2422
|
candidate: z.ZodOptional<z.ZodString>;
|
|
2423
|
+
task: z.ZodOptional<z.ZodString>;
|
|
2381
2424
|
}, z.core.$strict>>>;
|
|
2382
2425
|
transport_observed: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
2383
2426
|
session_id_origin: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/version.ts
|
|
2
|
-
var SDK_VERSION = "ts-1.2.
|
|
2
|
+
var SDK_VERSION = "ts-1.2.1";
|
|
3
3
|
|
|
4
4
|
// src/events.ts
|
|
5
5
|
import { z } from "zod";
|
|
@@ -133,7 +133,8 @@ var CaptureObservedSchema = z.object({
|
|
|
133
133
|
settings_version: z.number().int().min(1).optional(),
|
|
134
134
|
audience: z.string().optional(),
|
|
135
135
|
overlay: z.string().optional(),
|
|
136
|
-
candidate: z.string().optional()
|
|
136
|
+
candidate: z.string().optional(),
|
|
137
|
+
task: z.string().optional()
|
|
137
138
|
}).strict();
|
|
138
139
|
var PrincipalWireSchema = z.object({
|
|
139
140
|
id: z.string(),
|
|
@@ -2333,18 +2334,36 @@ var CANDIDATES_HELD = 32;
|
|
|
2333
2334
|
var CANDIDATE_READS_AT_ONCE = 4;
|
|
2334
2335
|
var CANDIDATE_START_TIMEOUT_MS = 5e3;
|
|
2335
2336
|
var CANDIDATE_ID = /^[A-Za-z0-9_-]{1,128}$/;
|
|
2336
|
-
|
|
2337
|
+
var TASK_ENV = "BATON_TASK";
|
|
2338
|
+
var TASK_HEADER = "baton-task";
|
|
2339
|
+
var TASK_ID = /^[A-Za-z0-9_.:-]{1,128}$/;
|
|
2340
|
+
function matchingId(pattern, value) {
|
|
2337
2341
|
if (typeof value !== "string") return null;
|
|
2338
2342
|
const id = stripWhiteSpace(value);
|
|
2339
|
-
return
|
|
2343
|
+
return pattern.test(id) ? id : null;
|
|
2340
2344
|
}
|
|
2341
|
-
function
|
|
2345
|
+
function headerId(headers, name, parse) {
|
|
2342
2346
|
try {
|
|
2343
|
-
return
|
|
2347
|
+
return parse(headers?.get(name));
|
|
2344
2348
|
} catch {
|
|
2345
2349
|
return null;
|
|
2346
2350
|
}
|
|
2347
2351
|
}
|
|
2352
|
+
function candidateId(value) {
|
|
2353
|
+
return matchingId(CANDIDATE_ID, value);
|
|
2354
|
+
}
|
|
2355
|
+
function headerCandidate(headers) {
|
|
2356
|
+
return headerId(headers, CANDIDATE_HEADER, candidateId);
|
|
2357
|
+
}
|
|
2358
|
+
function taskId(value) {
|
|
2359
|
+
return matchingId(TASK_ID, value);
|
|
2360
|
+
}
|
|
2361
|
+
function headerTask(headers) {
|
|
2362
|
+
return headerId(headers, TASK_HEADER, taskId);
|
|
2363
|
+
}
|
|
2364
|
+
function envTask() {
|
|
2365
|
+
return taskId(typeof process !== "undefined" ? process.env?.[TASK_ENV] : void 0);
|
|
2366
|
+
}
|
|
2348
2367
|
function envCandidate() {
|
|
2349
2368
|
const value = typeof process !== "undefined" ? process.env?.[CANDIDATE_ENV] : void 0;
|
|
2350
2369
|
if (!value) return null;
|
|
@@ -2568,15 +2587,17 @@ var SettingsFetcher = class {
|
|
|
2568
2587
|
};
|
|
2569
2588
|
var PENDING = /* @__PURE__ */ Symbol("pending");
|
|
2570
2589
|
var CaptureSettings = class {
|
|
2571
|
-
constructor(vendorId2, source, candidate = null, startTimeoutMs = CANDIDATE_START_TIMEOUT_MS) {
|
|
2590
|
+
constructor(vendorId2, source, candidate = null, task = null, startTimeoutMs = CANDIDATE_START_TIMEOUT_MS) {
|
|
2572
2591
|
this.vendorId = vendorId2;
|
|
2573
2592
|
this.source = source;
|
|
2574
2593
|
this.candidate = candidate;
|
|
2594
|
+
this.task = task;
|
|
2575
2595
|
this.startTimeoutMs = startTimeoutMs;
|
|
2576
2596
|
}
|
|
2577
2597
|
vendorId;
|
|
2578
2598
|
source;
|
|
2579
2599
|
candidate;
|
|
2600
|
+
task;
|
|
2580
2601
|
startTimeoutMs;
|
|
2581
2602
|
processDocument = null;
|
|
2582
2603
|
/** `BATON_CANDIDATE`'s read; requests wait for it. */
|
|
@@ -2622,7 +2643,10 @@ var CaptureSettings = class {
|
|
|
2622
2643
|
/** `undefined` while no document is held, and the config's values apply. */
|
|
2623
2644
|
forCaller(caller) {
|
|
2624
2645
|
const document = caller.candidate == null ? this.document : this.headerDocument(caller.candidate) ?? this.source.document;
|
|
2625
|
-
|
|
2646
|
+
const settings = document?.settingsFor(caller, this.vendorId);
|
|
2647
|
+
const task = caller.candidate == null ? this.task : caller.task;
|
|
2648
|
+
if (settings === void 0 || task == null || settings.capture.candidate === void 0) return settings;
|
|
2649
|
+
return { ...settings, capture: { ...settings.capture, task } };
|
|
2626
2650
|
}
|
|
2627
2651
|
/** Whether `test` holds for some document a request could be served under now. */
|
|
2628
2652
|
someDocument(test) {
|
|
@@ -2763,11 +2787,14 @@ async function resolveCaller(hook, call, settings, client = null) {
|
|
|
2763
2787
|
const caller = await resolveIdentity(hook, call);
|
|
2764
2788
|
if (settings === void 0) return caller;
|
|
2765
2789
|
try {
|
|
2790
|
+
const headers = extraHeaders(call.extra);
|
|
2791
|
+
const candidate = headerCandidate(headers);
|
|
2766
2792
|
const callSettings = settings.forCaller({
|
|
2767
2793
|
labels: caller.labels,
|
|
2768
2794
|
clientName: client?.info?.name ?? null,
|
|
2769
2795
|
shareKey: caller.principal?.id ?? null,
|
|
2770
|
-
candidate
|
|
2796
|
+
candidate,
|
|
2797
|
+
task: candidate === null ? null : headerTask(headers)
|
|
2771
2798
|
});
|
|
2772
2799
|
return callSettings === void 0 ? caller : { ...caller, settings: callSettings };
|
|
2773
2800
|
} catch {
|
|
@@ -3503,7 +3530,8 @@ function resolveBatonConfig(supplied) {
|
|
|
3503
3530
|
vendorId: dsn.vendorId,
|
|
3504
3531
|
refreshMs: identity.settingsRefreshMs ?? DEFAULT_SETTINGS_REFRESH_MS
|
|
3505
3532
|
}),
|
|
3506
|
-
envCandidate()
|
|
3533
|
+
envCandidate(),
|
|
3534
|
+
envTask()
|
|
3507
3535
|
)
|
|
3508
3536
|
} : {}
|
|
3509
3537
|
};
|