@spectrum-ts/core 8.0.0 → 8.1.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.
@@ -1,6 +1,6 @@
1
1
  import z from "zod";
2
- import vCard from "vcf";
3
2
  import { LogLevel } from "@photon-ai/otel";
3
+ import vCard from "vcf";
4
4
 
5
5
  //#region src/content/app.d.ts
6
6
  /**
@@ -447,6 +447,20 @@ interface Message<TPlatform extends string = string, TSender extends User = User
447
447
  declare const editSchema: z.ZodObject<{
448
448
  type: z.ZodLiteral<"edit">;
449
449
  content: z.ZodCustom<{
450
+ type: "text";
451
+ text: string;
452
+ } | {
453
+ type: "markdown";
454
+ markdown: string;
455
+ } | {
456
+ type: "attachment";
457
+ id: string;
458
+ name: string;
459
+ mimeType: string;
460
+ read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
461
+ stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
462
+ size?: number | undefined;
463
+ } | {
450
464
  type: "contact";
451
465
  user?: {
452
466
  __platform: string;
@@ -489,30 +503,9 @@ declare const editSchema: z.ZodObject<{
489
503
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
490
504
  } | undefined;
491
505
  raw?: unknown;
492
- } | {
493
- type: "attachment";
494
- id: string;
495
- name: string;
496
- mimeType: string;
497
- read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
498
- stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
499
- size?: number | undefined;
500
- } | {
501
- type: "group";
502
- items: Message<string, User, Space<unknown>>[];
503
506
  } | {
504
507
  type: "custom";
505
508
  raw: unknown;
506
- } | {
507
- type: "text";
508
- text: string;
509
- } | {
510
- type: "markdown";
511
- markdown: string;
512
- } | {
513
- type: "reaction";
514
- emoji: string;
515
- target: Message<string, User, Space<unknown>>;
516
509
  } | {
517
510
  type: "poll";
518
511
  title: string;
@@ -534,8 +527,12 @@ declare const editSchema: z.ZodObject<{
534
527
  selected: boolean;
535
528
  title: string;
536
529
  } | {
537
- type: "richlink";
538
- url: string;
530
+ type: "group";
531
+ items: Message<string, User, Space<unknown>>[];
532
+ } | {
533
+ type: "reaction";
534
+ emoji: string;
535
+ target: Message<string, User, Space<unknown>>;
539
536
  } | {
540
537
  type: "voice";
541
538
  mimeType: string;
@@ -544,6 +541,9 @@ declare const editSchema: z.ZodObject<{
544
541
  name?: string | undefined;
545
542
  duration?: number | undefined;
546
543
  size?: number | undefined;
544
+ } | {
545
+ type: "richlink";
546
+ url: string;
547
547
  } | {
548
548
  type: "streamText";
549
549
  stream: () => AsyncIterable<string>;
@@ -564,6 +564,12 @@ declare const editSchema: z.ZodObject<{
564
564
  } | {
565
565
  type: "effect";
566
566
  content: {
567
+ type: "text";
568
+ text: string;
569
+ } | {
570
+ type: "markdown";
571
+ markdown: string;
572
+ } | {
567
573
  type: "attachment";
568
574
  id: string;
569
575
  name: string;
@@ -571,12 +577,6 @@ declare const editSchema: z.ZodObject<{
571
577
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
572
578
  stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
573
579
  size?: number | undefined;
574
- } | {
575
- type: "text";
576
- text: string;
577
- } | {
578
- type: "markdown";
579
- markdown: string;
580
580
  };
581
581
  effect: string;
582
582
  } | {
@@ -595,6 +595,20 @@ declare const editSchema: z.ZodObject<{
595
595
  kind: "clear";
596
596
  };
597
597
  }, {
598
+ type: "text";
599
+ text: string;
600
+ } | {
601
+ type: "markdown";
602
+ markdown: string;
603
+ } | {
604
+ type: "attachment";
605
+ id: string;
606
+ name: string;
607
+ mimeType: string;
608
+ read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
609
+ stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
610
+ size?: number | undefined;
611
+ } | {
598
612
  type: "contact";
599
613
  user?: {
600
614
  __platform: string;
@@ -637,30 +651,9 @@ declare const editSchema: z.ZodObject<{
637
651
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
638
652
  } | undefined;
639
653
  raw?: unknown;
640
- } | {
641
- type: "attachment";
642
- id: string;
643
- name: string;
644
- mimeType: string;
645
- read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
646
- stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
647
- size?: number | undefined;
648
- } | {
649
- type: "group";
650
- items: Message<string, User, Space<unknown>>[];
651
654
  } | {
652
655
  type: "custom";
653
656
  raw: unknown;
654
- } | {
655
- type: "text";
656
- text: string;
657
- } | {
658
- type: "markdown";
659
- markdown: string;
660
- } | {
661
- type: "reaction";
662
- emoji: string;
663
- target: Message<string, User, Space<unknown>>;
664
657
  } | {
665
658
  type: "poll";
666
659
  title: string;
@@ -682,8 +675,12 @@ declare const editSchema: z.ZodObject<{
682
675
  selected: boolean;
683
676
  title: string;
684
677
  } | {
685
- type: "richlink";
686
- url: string;
678
+ type: "group";
679
+ items: Message<string, User, Space<unknown>>[];
680
+ } | {
681
+ type: "reaction";
682
+ emoji: string;
683
+ target: Message<string, User, Space<unknown>>;
687
684
  } | {
688
685
  type: "voice";
689
686
  mimeType: string;
@@ -692,6 +689,9 @@ declare const editSchema: z.ZodObject<{
692
689
  name?: string | undefined;
693
690
  duration?: number | undefined;
694
691
  size?: number | undefined;
692
+ } | {
693
+ type: "richlink";
694
+ url: string;
695
695
  } | {
696
696
  type: "streamText";
697
697
  stream: () => AsyncIterable<string>;
@@ -712,6 +712,12 @@ declare const editSchema: z.ZodObject<{
712
712
  } | {
713
713
  type: "effect";
714
714
  content: {
715
+ type: "text";
716
+ text: string;
717
+ } | {
718
+ type: "markdown";
719
+ markdown: string;
720
+ } | {
715
721
  type: "attachment";
716
722
  id: string;
717
723
  name: string;
@@ -719,12 +725,6 @@ declare const editSchema: z.ZodObject<{
719
725
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
720
726
  stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
721
727
  size?: number | undefined;
722
- } | {
723
- type: "text";
724
- text: string;
725
- } | {
726
- type: "markdown";
727
- markdown: string;
728
728
  };
729
729
  effect: string;
730
730
  } | {
@@ -968,6 +968,20 @@ declare function rename(displayName: string): ContentBuilder;
968
968
  declare const replySchema: z.ZodObject<{
969
969
  type: z.ZodLiteral<"reply">;
970
970
  content: z.ZodCustom<{
971
+ type: "text";
972
+ text: string;
973
+ } | {
974
+ type: "markdown";
975
+ markdown: string;
976
+ } | {
977
+ type: "attachment";
978
+ id: string;
979
+ name: string;
980
+ mimeType: string;
981
+ read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
982
+ stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
983
+ size?: number | undefined;
984
+ } | {
971
985
  type: "contact";
972
986
  user?: {
973
987
  __platform: string;
@@ -1010,30 +1024,9 @@ declare const replySchema: z.ZodObject<{
1010
1024
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
1011
1025
  } | undefined;
1012
1026
  raw?: unknown;
1013
- } | {
1014
- type: "attachment";
1015
- id: string;
1016
- name: string;
1017
- mimeType: string;
1018
- read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
1019
- stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
1020
- size?: number | undefined;
1021
- } | {
1022
- type: "group";
1023
- items: Message<string, User, Space<unknown>>[];
1024
1027
  } | {
1025
1028
  type: "custom";
1026
1029
  raw: unknown;
1027
- } | {
1028
- type: "text";
1029
- text: string;
1030
- } | {
1031
- type: "markdown";
1032
- markdown: string;
1033
- } | {
1034
- type: "reaction";
1035
- emoji: string;
1036
- target: Message<string, User, Space<unknown>>;
1037
1030
  } | {
1038
1031
  type: "poll";
1039
1032
  title: string;
@@ -1055,8 +1048,12 @@ declare const replySchema: z.ZodObject<{
1055
1048
  selected: boolean;
1056
1049
  title: string;
1057
1050
  } | {
1058
- type: "richlink";
1059
- url: string;
1051
+ type: "group";
1052
+ items: Message<string, User, Space<unknown>>[];
1053
+ } | {
1054
+ type: "reaction";
1055
+ emoji: string;
1056
+ target: Message<string, User, Space<unknown>>;
1060
1057
  } | {
1061
1058
  type: "voice";
1062
1059
  mimeType: string;
@@ -1065,6 +1062,9 @@ declare const replySchema: z.ZodObject<{
1065
1062
  name?: string | undefined;
1066
1063
  duration?: number | undefined;
1067
1064
  size?: number | undefined;
1065
+ } | {
1066
+ type: "richlink";
1067
+ url: string;
1068
1068
  } | {
1069
1069
  type: "streamText";
1070
1070
  stream: () => AsyncIterable<string>;
@@ -1085,6 +1085,12 @@ declare const replySchema: z.ZodObject<{
1085
1085
  } | {
1086
1086
  type: "effect";
1087
1087
  content: {
1088
+ type: "text";
1089
+ text: string;
1090
+ } | {
1091
+ type: "markdown";
1092
+ markdown: string;
1093
+ } | {
1088
1094
  type: "attachment";
1089
1095
  id: string;
1090
1096
  name: string;
@@ -1092,12 +1098,6 @@ declare const replySchema: z.ZodObject<{
1092
1098
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
1093
1099
  stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
1094
1100
  size?: number | undefined;
1095
- } | {
1096
- type: "text";
1097
- text: string;
1098
- } | {
1099
- type: "markdown";
1100
- markdown: string;
1101
1101
  };
1102
1102
  effect: string;
1103
1103
  } | {
@@ -1116,6 +1116,20 @@ declare const replySchema: z.ZodObject<{
1116
1116
  kind: "clear";
1117
1117
  };
1118
1118
  }, {
1119
+ type: "text";
1120
+ text: string;
1121
+ } | {
1122
+ type: "markdown";
1123
+ markdown: string;
1124
+ } | {
1125
+ type: "attachment";
1126
+ id: string;
1127
+ name: string;
1128
+ mimeType: string;
1129
+ read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
1130
+ stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
1131
+ size?: number | undefined;
1132
+ } | {
1119
1133
  type: "contact";
1120
1134
  user?: {
1121
1135
  __platform: string;
@@ -1158,30 +1172,9 @@ declare const replySchema: z.ZodObject<{
1158
1172
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
1159
1173
  } | undefined;
1160
1174
  raw?: unknown;
1161
- } | {
1162
- type: "attachment";
1163
- id: string;
1164
- name: string;
1165
- mimeType: string;
1166
- read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
1167
- stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
1168
- size?: number | undefined;
1169
- } | {
1170
- type: "group";
1171
- items: Message<string, User, Space<unknown>>[];
1172
1175
  } | {
1173
1176
  type: "custom";
1174
1177
  raw: unknown;
1175
- } | {
1176
- type: "text";
1177
- text: string;
1178
- } | {
1179
- type: "markdown";
1180
- markdown: string;
1181
- } | {
1182
- type: "reaction";
1183
- emoji: string;
1184
- target: Message<string, User, Space<unknown>>;
1185
1178
  } | {
1186
1179
  type: "poll";
1187
1180
  title: string;
@@ -1203,8 +1196,12 @@ declare const replySchema: z.ZodObject<{
1203
1196
  selected: boolean;
1204
1197
  title: string;
1205
1198
  } | {
1206
- type: "richlink";
1207
- url: string;
1199
+ type: "group";
1200
+ items: Message<string, User, Space<unknown>>[];
1201
+ } | {
1202
+ type: "reaction";
1203
+ emoji: string;
1204
+ target: Message<string, User, Space<unknown>>;
1208
1205
  } | {
1209
1206
  type: "voice";
1210
1207
  mimeType: string;
@@ -1213,6 +1210,9 @@ declare const replySchema: z.ZodObject<{
1213
1210
  name?: string | undefined;
1214
1211
  duration?: number | undefined;
1215
1212
  size?: number | undefined;
1213
+ } | {
1214
+ type: "richlink";
1215
+ url: string;
1216
1216
  } | {
1217
1217
  type: "streamText";
1218
1218
  stream: () => AsyncIterable<string>;
@@ -1233,6 +1233,12 @@ declare const replySchema: z.ZodObject<{
1233
1233
  } | {
1234
1234
  type: "effect";
1235
1235
  content: {
1236
+ type: "text";
1237
+ text: string;
1238
+ } | {
1239
+ type: "markdown";
1240
+ markdown: string;
1241
+ } | {
1236
1242
  type: "attachment";
1237
1243
  id: string;
1238
1244
  name: string;
@@ -1240,12 +1246,6 @@ declare const replySchema: z.ZodObject<{
1240
1246
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
1241
1247
  stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
1242
1248
  size?: number | undefined;
1243
- } | {
1244
- type: "text";
1245
- text: string;
1246
- } | {
1247
- type: "markdown";
1248
- markdown: string;
1249
1249
  };
1250
1250
  effect: string;
1251
1251
  } | {
@@ -6851,6 +6851,20 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
6851
6851
  }, z.core.$strip>, z.ZodObject<{
6852
6852
  type: z.ZodLiteral<"reply">;
6853
6853
  content: z.ZodCustom<{
6854
+ type: "text";
6855
+ text: string;
6856
+ } | {
6857
+ type: "markdown";
6858
+ markdown: string;
6859
+ } | {
6860
+ type: "attachment";
6861
+ id: string;
6862
+ name: string;
6863
+ mimeType: string;
6864
+ read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
6865
+ stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
6866
+ size?: number | undefined;
6867
+ } | {
6854
6868
  type: "contact";
6855
6869
  user?: {
6856
6870
  __platform: string;
@@ -6893,30 +6907,9 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
6893
6907
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
6894
6908
  } | undefined;
6895
6909
  raw?: unknown;
6896
- } | {
6897
- type: "attachment";
6898
- id: string;
6899
- name: string;
6900
- mimeType: string;
6901
- read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
6902
- stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
6903
- size?: number | undefined;
6904
- } | {
6905
- type: "group";
6906
- items: Message<string, User, Space<unknown>>[];
6907
6910
  } | {
6908
6911
  type: "custom";
6909
6912
  raw: unknown;
6910
- } | {
6911
- type: "text";
6912
- text: string;
6913
- } | {
6914
- type: "markdown";
6915
- markdown: string;
6916
- } | {
6917
- type: "reaction";
6918
- emoji: string;
6919
- target: Message<string, User, Space<unknown>>;
6920
6913
  } | {
6921
6914
  type: "poll";
6922
6915
  title: string;
@@ -6938,8 +6931,12 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
6938
6931
  selected: boolean;
6939
6932
  title: string;
6940
6933
  } | {
6941
- type: "richlink";
6942
- url: string;
6934
+ type: "group";
6935
+ items: Message<string, User, Space<unknown>>[];
6936
+ } | {
6937
+ type: "reaction";
6938
+ emoji: string;
6939
+ target: Message<string, User, Space<unknown>>;
6943
6940
  } | {
6944
6941
  type: "voice";
6945
6942
  mimeType: string;
@@ -6948,6 +6945,9 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
6948
6945
  name?: string | undefined;
6949
6946
  duration?: number | undefined;
6950
6947
  size?: number | undefined;
6948
+ } | {
6949
+ type: "richlink";
6950
+ url: string;
6951
6951
  } | {
6952
6952
  type: "streamText";
6953
6953
  stream: () => AsyncIterable<string>;
@@ -6968,6 +6968,12 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
6968
6968
  } | {
6969
6969
  type: "effect";
6970
6970
  content: {
6971
+ type: "text";
6972
+ text: string;
6973
+ } | {
6974
+ type: "markdown";
6975
+ markdown: string;
6976
+ } | {
6971
6977
  type: "attachment";
6972
6978
  id: string;
6973
6979
  name: string;
@@ -6975,12 +6981,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
6975
6981
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
6976
6982
  stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
6977
6983
  size?: number | undefined;
6978
- } | {
6979
- type: "text";
6980
- text: string;
6981
- } | {
6982
- type: "markdown";
6983
- markdown: string;
6984
6984
  };
6985
6985
  effect: string;
6986
6986
  } | {
@@ -6999,6 +6999,20 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
6999
6999
  kind: "clear";
7000
7000
  };
7001
7001
  }, {
7002
+ type: "text";
7003
+ text: string;
7004
+ } | {
7005
+ type: "markdown";
7006
+ markdown: string;
7007
+ } | {
7008
+ type: "attachment";
7009
+ id: string;
7010
+ name: string;
7011
+ mimeType: string;
7012
+ read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7013
+ stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
7014
+ size?: number | undefined;
7015
+ } | {
7002
7016
  type: "contact";
7003
7017
  user?: {
7004
7018
  __platform: string;
@@ -7041,30 +7055,9 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7041
7055
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7042
7056
  } | undefined;
7043
7057
  raw?: unknown;
7044
- } | {
7045
- type: "attachment";
7046
- id: string;
7047
- name: string;
7048
- mimeType: string;
7049
- read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7050
- stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
7051
- size?: number | undefined;
7052
- } | {
7053
- type: "group";
7054
- items: Message<string, User, Space<unknown>>[];
7055
7058
  } | {
7056
7059
  type: "custom";
7057
7060
  raw: unknown;
7058
- } | {
7059
- type: "text";
7060
- text: string;
7061
- } | {
7062
- type: "markdown";
7063
- markdown: string;
7064
- } | {
7065
- type: "reaction";
7066
- emoji: string;
7067
- target: Message<string, User, Space<unknown>>;
7068
7061
  } | {
7069
7062
  type: "poll";
7070
7063
  title: string;
@@ -7086,8 +7079,12 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7086
7079
  selected: boolean;
7087
7080
  title: string;
7088
7081
  } | {
7089
- type: "richlink";
7090
- url: string;
7082
+ type: "group";
7083
+ items: Message<string, User, Space<unknown>>[];
7084
+ } | {
7085
+ type: "reaction";
7086
+ emoji: string;
7087
+ target: Message<string, User, Space<unknown>>;
7091
7088
  } | {
7092
7089
  type: "voice";
7093
7090
  mimeType: string;
@@ -7096,6 +7093,9 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7096
7093
  name?: string | undefined;
7097
7094
  duration?: number | undefined;
7098
7095
  size?: number | undefined;
7096
+ } | {
7097
+ type: "richlink";
7098
+ url: string;
7099
7099
  } | {
7100
7100
  type: "streamText";
7101
7101
  stream: () => AsyncIterable<string>;
@@ -7116,6 +7116,12 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7116
7116
  } | {
7117
7117
  type: "effect";
7118
7118
  content: {
7119
+ type: "text";
7120
+ text: string;
7121
+ } | {
7122
+ type: "markdown";
7123
+ markdown: string;
7124
+ } | {
7119
7125
  type: "attachment";
7120
7126
  id: string;
7121
7127
  name: string;
@@ -7123,12 +7129,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7123
7129
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7124
7130
  stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
7125
7131
  size?: number | undefined;
7126
- } | {
7127
- type: "text";
7128
- text: string;
7129
- } | {
7130
- type: "markdown";
7131
- markdown: string;
7132
7132
  };
7133
7133
  effect: string;
7134
7134
  } | {
@@ -7151,6 +7151,20 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7151
7151
  }, z.core.$strip>, z.ZodObject<{
7152
7152
  type: z.ZodLiteral<"edit">;
7153
7153
  content: z.ZodCustom<{
7154
+ type: "text";
7155
+ text: string;
7156
+ } | {
7157
+ type: "markdown";
7158
+ markdown: string;
7159
+ } | {
7160
+ type: "attachment";
7161
+ id: string;
7162
+ name: string;
7163
+ mimeType: string;
7164
+ read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7165
+ stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
7166
+ size?: number | undefined;
7167
+ } | {
7154
7168
  type: "contact";
7155
7169
  user?: {
7156
7170
  __platform: string;
@@ -7193,30 +7207,9 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7193
7207
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7194
7208
  } | undefined;
7195
7209
  raw?: unknown;
7196
- } | {
7197
- type: "attachment";
7198
- id: string;
7199
- name: string;
7200
- mimeType: string;
7201
- read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7202
- stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
7203
- size?: number | undefined;
7204
- } | {
7205
- type: "group";
7206
- items: Message<string, User, Space<unknown>>[];
7207
7210
  } | {
7208
7211
  type: "custom";
7209
7212
  raw: unknown;
7210
- } | {
7211
- type: "text";
7212
- text: string;
7213
- } | {
7214
- type: "markdown";
7215
- markdown: string;
7216
- } | {
7217
- type: "reaction";
7218
- emoji: string;
7219
- target: Message<string, User, Space<unknown>>;
7220
7213
  } | {
7221
7214
  type: "poll";
7222
7215
  title: string;
@@ -7238,8 +7231,12 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7238
7231
  selected: boolean;
7239
7232
  title: string;
7240
7233
  } | {
7241
- type: "richlink";
7242
- url: string;
7234
+ type: "group";
7235
+ items: Message<string, User, Space<unknown>>[];
7236
+ } | {
7237
+ type: "reaction";
7238
+ emoji: string;
7239
+ target: Message<string, User, Space<unknown>>;
7243
7240
  } | {
7244
7241
  type: "voice";
7245
7242
  mimeType: string;
@@ -7248,6 +7245,9 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7248
7245
  name?: string | undefined;
7249
7246
  duration?: number | undefined;
7250
7247
  size?: number | undefined;
7248
+ } | {
7249
+ type: "richlink";
7250
+ url: string;
7251
7251
  } | {
7252
7252
  type: "streamText";
7253
7253
  stream: () => AsyncIterable<string>;
@@ -7268,6 +7268,12 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7268
7268
  } | {
7269
7269
  type: "effect";
7270
7270
  content: {
7271
+ type: "text";
7272
+ text: string;
7273
+ } | {
7274
+ type: "markdown";
7275
+ markdown: string;
7276
+ } | {
7271
7277
  type: "attachment";
7272
7278
  id: string;
7273
7279
  name: string;
@@ -7275,12 +7281,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7275
7281
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7276
7282
  stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
7277
7283
  size?: number | undefined;
7278
- } | {
7279
- type: "text";
7280
- text: string;
7281
- } | {
7282
- type: "markdown";
7283
- markdown: string;
7284
7284
  };
7285
7285
  effect: string;
7286
7286
  } | {
@@ -7299,6 +7299,20 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7299
7299
  kind: "clear";
7300
7300
  };
7301
7301
  }, {
7302
+ type: "text";
7303
+ text: string;
7304
+ } | {
7305
+ type: "markdown";
7306
+ markdown: string;
7307
+ } | {
7308
+ type: "attachment";
7309
+ id: string;
7310
+ name: string;
7311
+ mimeType: string;
7312
+ read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7313
+ stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
7314
+ size?: number | undefined;
7315
+ } | {
7302
7316
  type: "contact";
7303
7317
  user?: {
7304
7318
  __platform: string;
@@ -7341,30 +7355,9 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7341
7355
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7342
7356
  } | undefined;
7343
7357
  raw?: unknown;
7344
- } | {
7345
- type: "attachment";
7346
- id: string;
7347
- name: string;
7348
- mimeType: string;
7349
- read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7350
- stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
7351
- size?: number | undefined;
7352
- } | {
7353
- type: "group";
7354
- items: Message<string, User, Space<unknown>>[];
7355
7358
  } | {
7356
7359
  type: "custom";
7357
7360
  raw: unknown;
7358
- } | {
7359
- type: "text";
7360
- text: string;
7361
- } | {
7362
- type: "markdown";
7363
- markdown: string;
7364
- } | {
7365
- type: "reaction";
7366
- emoji: string;
7367
- target: Message<string, User, Space<unknown>>;
7368
7361
  } | {
7369
7362
  type: "poll";
7370
7363
  title: string;
@@ -7386,8 +7379,12 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7386
7379
  selected: boolean;
7387
7380
  title: string;
7388
7381
  } | {
7389
- type: "richlink";
7390
- url: string;
7382
+ type: "group";
7383
+ items: Message<string, User, Space<unknown>>[];
7384
+ } | {
7385
+ type: "reaction";
7386
+ emoji: string;
7387
+ target: Message<string, User, Space<unknown>>;
7391
7388
  } | {
7392
7389
  type: "voice";
7393
7390
  mimeType: string;
@@ -7396,6 +7393,9 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7396
7393
  name?: string | undefined;
7397
7394
  duration?: number | undefined;
7398
7395
  size?: number | undefined;
7396
+ } | {
7397
+ type: "richlink";
7398
+ url: string;
7399
7399
  } | {
7400
7400
  type: "streamText";
7401
7401
  stream: () => AsyncIterable<string>;
@@ -7416,6 +7416,12 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7416
7416
  } | {
7417
7417
  type: "effect";
7418
7418
  content: {
7419
+ type: "text";
7420
+ text: string;
7421
+ } | {
7422
+ type: "markdown";
7423
+ markdown: string;
7424
+ } | {
7419
7425
  type: "attachment";
7420
7426
  id: string;
7421
7427
  name: string;
@@ -7423,12 +7429,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7423
7429
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7424
7430
  stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
7425
7431
  size?: number | undefined;
7426
- } | {
7427
- type: "text";
7428
- text: string;
7429
- } | {
7430
- type: "markdown";
7431
- markdown: string;
7432
7432
  };
7433
7433
  effect: string;
7434
7434
  } | {
@@ -1,6 +1,6 @@
1
- import { $t as groupSchema, Bt as asPollOption, Dn as buildPhotoAction, En as PhotoInput, H as ProviderMessageRecord, K as ManagedStream, Nt as asRead, On as photoActionSchema, St as asText, Tt as asRichlink, Wt as asMarkdown, Zt as asGroup, cn as reactionSchema, gt as asVoice, ln as asCustom, on as asReaction, r as asAttachment, yn as asContact, zt as asPoll } from "./attachment-ByH1Espb.js";
1
+ import { $t as groupSchema, Bt as asPollOption, Dn as buildPhotoAction, En as PhotoInput, H as ProviderMessageRecord, K as ManagedStream, Nt as asRead, On as photoActionSchema, St as asText, Tt as asRichlink, Wt as asMarkdown, Zt as asGroup, cn as reactionSchema, gt as asVoice, ln as asCustom, on as asReaction, r as asAttachment, yn as asContact, zt as asPoll } from "./attachment-ChyfdoQL.js";
2
2
  import z from "zod";
3
- import { LogAttrs, LogAttrs as LogAttrs$1, LogLevel, PhotonLogger, createLogger, sanitizeEmail, sanitizeErrorMessage, sanitizePhone, setLogLevel } from "@photon-ai/otel";
3
+ import { FetchSpanOptions, LogAttrs, LogAttrs as LogAttrs$1, LogLevel, PhotonLogger, SanitizeUrlOptions, createLogger, sanitizeEmail, sanitizeErrorMessage, sanitizePhone, sanitizeUrl, setLogLevel } from "@photon-ai/otel";
4
4
  import { Token } from "marked";
5
5
 
6
6
  //#region src/content/effect.d.ts
@@ -30,6 +30,26 @@ declare const ensureM4a: (buffer: Buffer, mimeType: string) => Promise<{
30
30
  duration?: number;
31
31
  }>;
32
32
  //#endregion
33
+ //#region src/utils/instrumented-fetch.d.ts
34
+ /**
35
+ * Build a fetch that traces spectrum's OWN outbound HTTP: each request through
36
+ * the returned fetch emits a CLIENT span (tagged with `peer.service`) and
37
+ * carries W3C trace context downstream. It never mutates `globalThis.fetch`, so
38
+ * a consumer's unrelated requests stay untouched.
39
+ *
40
+ * The base delegates to `globalThis.fetch` at call time — deliberately NOT
41
+ * `createInstrumentedFetch(globalThis.fetch, …)`, which would capture the
42
+ * original and bypass a test's `spyOn(globalThis, "fetch")`. When telemetry is
43
+ * off (no `setupOtel`), the tracer is a no-op and this is a transparent
44
+ * pass-through. Create one per module: `const tf = tracedFetch("…")`.
45
+ *
46
+ * Pass `redactUrl` to strip secrets from a request URL before it is recorded as
47
+ * the span's `url.full` (e.g. a token in the path or query); the real request
48
+ * still uses the original URL. Pair with `sanitizeUrl` for semconv-style query
49
+ * redaction.
50
+ */
51
+ declare const tracedFetch: (peerService: string, options?: Pick<FetchSpanOptions, "ignore" | "redactUrl">) => typeof fetch;
52
+ //#endregion
33
53
  //#region src/utils/markdown.d.ts
34
54
  /**
35
55
  * Render a run of inline markdown tokens (a paragraph's or table cell's
@@ -103,4 +123,4 @@ declare const resumableOrderedStream: <TLive, TMissed, TOutput>(options: Resumab
103
123
  */
104
124
  declare function errorAttrs(error: unknown, prefix?: string): LogAttrs$1;
105
125
  //#endregion
106
- export { type CloseableAsyncIterable, type LogAttrs, type LogLevel, type PhotoInput, type PhotonLogger, type ProviderMessageRecord, type ResumableStreamItem, asAttachment, asContact, asCustom, asGroup, asMarkdown, asPoll, asPollOption, asReaction, asRead, asRichlink, asText, asVoice, buildPhotoAction, createLogger, ensureM4a, errorAttrs, groupSchema, messageEffectSchema, photoActionSchema, reactionSchema, renderInlineTokens, resumableOrderedStream, sanitizeEmail, sanitizeErrorMessage, sanitizePhone, setLogLevel };
126
+ export { type CloseableAsyncIterable, type LogAttrs, type LogLevel, type PhotoInput, type PhotonLogger, type ProviderMessageRecord, type ResumableStreamItem, type SanitizeUrlOptions, asAttachment, asContact, asCustom, asGroup, asMarkdown, asPoll, asPollOption, asReaction, asRead, asRichlink, asText, asVoice, buildPhotoAction, createLogger, ensureM4a, errorAttrs, groupSchema, messageEffectSchema, photoActionSchema, reactionSchema, renderInlineTokens, resumableOrderedStream, sanitizeEmail, sanitizeErrorMessage, sanitizePhone, sanitizeUrl, setLogLevel, tracedFetch };
package/dist/authoring.js CHANGED
@@ -1,8 +1,8 @@
1
- import { D as asGroup, E as markdownSchema, H as buildPhotoAction, I as asCustom, K as attachmentSchema, N as textSchema, R as asContact, U as photoActionSchema, W as asAttachment, _ as asReaction, b as asPoll, d as asVoice, h as asRead, i as stream, j as asText, k as groupSchema, l as renderInlineTokens, o as errorAttrs, p as asRichlink, w as asMarkdown, x as asPollOption, y as reactionSchema } from "./stream-Cz0pdWd1.js";
1
+ import { D as asGroup, E as markdownSchema, H as buildPhotoAction, I as asCustom, J as tracedFetch, K as attachmentSchema, N as textSchema, R as asContact, U as photoActionSchema, W as asAttachment, _ as asReaction, b as asPoll, d as asVoice, h as asRead, i as stream, j as asText, k as groupSchema, l as renderInlineTokens, o as errorAttrs, p as asRichlink, w as asMarkdown, x as asPollOption, y as reactionSchema } from "./stream-Cs0NMbNv.js";
2
2
  import z from "zod";
3
+ import { createLogger, createLogger as createLogger$1, sanitizeEmail, sanitizeErrorMessage, sanitizePhone, sanitizeUrl, setLogLevel } from "@photon-ai/otel";
3
4
  import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
4
5
  import { join } from "node:path";
5
- import { createLogger, createLogger as createLogger$1, sanitizeEmail, sanitizeErrorMessage, sanitizePhone, setLogLevel } from "@photon-ai/otel";
6
6
  import { spawn } from "node:child_process";
7
7
  import { tmpdir } from "node:os";
8
8
  //#region src/content/effect.ts
@@ -422,4 +422,4 @@ const resumableOrderedStream = (options) => stream((emit, end) => {
422
422
  };
423
423
  });
424
424
  //#endregion
425
- export { asAttachment, asContact, asCustom, asGroup, asMarkdown, asPoll, asPollOption, asReaction, asRead, asRichlink, asText, asVoice, buildPhotoAction, createLogger, ensureM4a, errorAttrs, groupSchema, messageEffectSchema, photoActionSchema, reactionSchema, renderInlineTokens, resumableOrderedStream, sanitizeEmail, sanitizeErrorMessage, sanitizePhone, setLogLevel };
425
+ export { asAttachment, asContact, asCustom, asGroup, asMarkdown, asPoll, asPollOption, asReaction, asRead, asRichlink, asText, asVoice, buildPhotoAction, createLogger, ensureM4a, errorAttrs, groupSchema, messageEffectSchema, photoActionSchema, reactionSchema, renderInlineTokens, resumableOrderedStream, sanitizeEmail, sanitizeErrorMessage, sanitizePhone, sanitizeUrl, setLogLevel, tracedFetch };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as FusorTokenData, A as isFusorEvent, An as AppLayout, At as Rename, B as PlatformUser, C as FusorVerify, Cn as Avatar, Ct as text, D as WebhookRawResult, Dt as resolveContents, E as WebhookRawRequest, Et as richlink, F as PlatformInstance, Ft as Poll, G as Broadcaster, Gt as markdown, Ht as poll, I as PlatformMessage, It as PollChoice, J as mergeStreams, Jt as StreamTextSource, K as ManagedStream, Kt as DeltaExtractor, L as PlatformProviderConfig, Lt as PollChoiceInput, M as EventProducer, Mn as app, Mt as Read, N as Platform, Nn as appLayoutSchema, O as FusorEvent, Ot as Reply, P as PlatformDef, Pt as read, Q as DedicatedTokenData, Qt as group, R as PlatformRuntime, Rt as PollOption, S as FusorRespond, Sn as User, T as WebhookHandler, Tn as avatar, U as SchemaMessage, Ut as Markdown, V as ProviderMessage, Vt as option, W as SpaceNamespace, X as Store, Xt as Group, Y as stream, Yt as TextStreamOptions, Z as CloudPlatform, _ as FusorClient, _n as ContactOrg, _t as voice, a as Content, an as ReactionBuilder, at as SharedTokenData, b as FusorMessagesReturn, bn as contact, bt as Typing, c as fromVCard, ct as SpectrumCloudError, d as UnsupportedKind, dn as Contact, dt as TokenData, en as Edit, et as ImessageInfoData, f as Spectrum, fn as ContactAddress, ft as cloud, g as isFusorClient, gn as ContactName, h as fusor, hn as ContactInput, ht as Voice, i as attachment, in as Reaction, it as ProjectProfile, j as AnyPlatformDef, jn as AppUrl, jt as rename, k as fusorEvent, kn as App, kt as reply, l as toVCard, lt as SubscriptionData, m as definePlatform, mn as ContactEmail, mt as EmojiKey, n as AttachmentInput, nn as Message, nt as PlatformsData, o as ContentBuilder, ot as SlackTeamMeta, p as SpectrumInstance, pn as ContactDetails, pt as Emoji, q as broadcast, qt as StreamText, rn as Space, rt as ProjectData, s as ContentInput, sn as reaction, st as SlackTokenData, t as Attachment, tn as edit, tt as PlatformStatus, u as UnsupportedError, un as custom, ut as SubscriptionStatus, v as FusorMessages, vn as ContactPhone, vt as Unsend, w as FusorVerifyRequest, wn as AvatarInput, wt as Richlink, x as FusorReply, xn as AgentSender, xt as typing, y as FusorMessagesCtx, yt as unsend, z as PlatformSpace } from "./attachment-ByH1Espb.js";
1
+ import { $ as FusorTokenData, A as isFusorEvent, An as AppLayout, At as Rename, B as PlatformUser, C as FusorVerify, Cn as Avatar, Ct as text, D as WebhookRawResult, Dt as resolveContents, E as WebhookRawRequest, Et as richlink, F as PlatformInstance, Ft as Poll, G as Broadcaster, Gt as markdown, Ht as poll, I as PlatformMessage, It as PollChoice, J as mergeStreams, Jt as StreamTextSource, K as ManagedStream, Kt as DeltaExtractor, L as PlatformProviderConfig, Lt as PollChoiceInput, M as EventProducer, Mn as app, Mt as Read, N as Platform, Nn as appLayoutSchema, O as FusorEvent, Ot as Reply, P as PlatformDef, Pt as read, Q as DedicatedTokenData, Qt as group, R as PlatformRuntime, Rt as PollOption, S as FusorRespond, Sn as User, T as WebhookHandler, Tn as avatar, U as SchemaMessage, Ut as Markdown, V as ProviderMessage, Vt as option, W as SpaceNamespace, X as Store, Xt as Group, Y as stream, Yt as TextStreamOptions, Z as CloudPlatform, _ as FusorClient, _n as ContactOrg, _t as voice, a as Content, an as ReactionBuilder, at as SharedTokenData, b as FusorMessagesReturn, bn as contact, bt as Typing, c as fromVCard, ct as SpectrumCloudError, d as UnsupportedKind, dn as Contact, dt as TokenData, en as Edit, et as ImessageInfoData, f as Spectrum, fn as ContactAddress, ft as cloud, g as isFusorClient, gn as ContactName, h as fusor, hn as ContactInput, ht as Voice, i as attachment, in as Reaction, it as ProjectProfile, j as AnyPlatformDef, jn as AppUrl, jt as rename, k as fusorEvent, kn as App, kt as reply, l as toVCard, lt as SubscriptionData, m as definePlatform, mn as ContactEmail, mt as EmojiKey, n as AttachmentInput, nn as Message, nt as PlatformsData, o as ContentBuilder, ot as SlackTeamMeta, p as SpectrumInstance, pn as ContactDetails, pt as Emoji, q as broadcast, qt as StreamText, rn as Space, rt as ProjectData, s as ContentInput, sn as reaction, st as SlackTokenData, t as Attachment, tn as edit, tt as PlatformStatus, u as UnsupportedError, un as custom, ut as SubscriptionStatus, v as FusorMessages, vn as ContactPhone, vt as Unsend, w as FusorVerifyRequest, wn as AvatarInput, wt as Richlink, x as FusorReply, xn as AgentSender, xt as typing, y as FusorMessagesCtx, yt as unsend, z as PlatformSpace } from "./attachment-ChyfdoQL.js";
2
2
  export { type AgentSender, type AnyPlatformDef, type App, type AppLayout, type AppUrl, type Attachment, type AttachmentInput, type Avatar, type AvatarInput, type Broadcaster, type CloudPlatform, type Contact, type ContactAddress, type ContactDetails, type ContactEmail, type ContactInput, type ContactName, type ContactOrg, type ContactPhone, type Content, type ContentBuilder, type ContentInput, type DedicatedTokenData, type DeltaExtractor, type Edit, Emoji, type EmojiKey, type EventProducer, type FusorClient, type FusorEvent, type FusorMessages, type FusorMessagesCtx, type FusorMessagesReturn, type FusorReply, type FusorRespond, type FusorTokenData, type FusorVerify, type FusorVerifyRequest, type Group, type ImessageInfoData, type ManagedStream, type Markdown, type Message, type Platform, type PlatformDef, type PlatformInstance, type PlatformMessage, type PlatformProviderConfig, type PlatformRuntime, type PlatformSpace, type PlatformStatus, type PlatformUser, type PlatformsData, type Poll, type PollChoice, type PollChoiceInput, type PollOption, type ProjectData, type ProjectProfile, type ProviderMessage, type Reaction, type ReactionBuilder, type Read, type Rename, type Reply, type Richlink, type SchemaMessage, type SharedTokenData, type SlackTeamMeta, type SlackTokenData, type Space, type SpaceNamespace, Spectrum, SpectrumCloudError, type SpectrumInstance, type Store, type StreamText, type StreamTextSource, type SubscriptionData, type SubscriptionStatus, type TextStreamOptions, type TokenData, type Typing, type Unsend, UnsupportedError, type UnsupportedKind, type User, type Voice, type WebhookHandler, type WebhookRawRequest, type WebhookRawResult, app, appLayoutSchema, attachment, avatar, broadcast, cloud, contact, custom, definePlatform, edit, fromVCard, fusor, fusorEvent, group, isFusorClient, isFusorEvent, markdown, mergeStreams, option, poll, reaction, read, rename, reply, resolveContents, richlink, stream, text, toVCard, typing, unsend, voice };
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { A as resolveContents, B as fromVCard, C as poll, F as drainStreamText, G as attachment, H as buildPhotoAction, I as asCustom, L as custom, M as text, O as group, P as StreamConsumedError, R as asContact, S as option, T as markdown, U as photoActionSchema, V as toVCard, W as asAttachment, a as contentAttrs, c as markdownToPlainText, f as voice, g as read, i as stream, j as asText, m as richlink, n as createAsyncQueue, o as errorAttrs, q as fetchUrlBytes, r as mergeStreams, s as senderAttrs, t as broadcast, u as classifyIdentifier, v as reaction, w as asMarkdown, z as contact } from "./stream-Cz0pdWd1.js";
1
+ import { A as resolveContents, B as fromVCard, C as poll, F as drainStreamText, G as attachment, H as buildPhotoAction, I as asCustom, J as tracedFetch, L as custom, M as text, O as group, P as StreamConsumedError, R as asContact, S as option, T as markdown, U as photoActionSchema, V as toVCard, W as asAttachment, a as contentAttrs, c as markdownToPlainText, f as voice, g as read, i as stream, j as asText, m as richlink, n as createAsyncQueue, o as errorAttrs, q as fetchUrlBytes, r as mergeStreams, s as senderAttrs, t as broadcast, u as classifyIdentifier, v as reaction, w as asMarkdown, z as contact } from "./stream-Cs0NMbNv.js";
2
2
  import z from "zod";
3
3
  import ogs from "open-graph-scraper";
4
- import { createHmac, timingSafeEqual } from "node:crypto";
5
4
  import { createLogger, setLogLevel, setupOtel, withSpan } from "@photon-ai/otel";
5
+ import { createHmac, timingSafeEqual } from "node:crypto";
6
6
  import { RawInboundEvent } from "@photon-ai/proto/photon/fusor/v1/inbound";
7
7
  //#region src/utils/link-metadata.ts
8
8
  const DEFAULT_TIMEOUT_MS = 5e3;
@@ -3042,7 +3042,7 @@ function definePlatform(name, rawDef) {
3042
3042
  }
3043
3043
  //#endregion
3044
3044
  //#region src/build-env.ts
3045
- const SPECTRUM_SDK_VERSION = "8.0.0";
3045
+ const SPECTRUM_SDK_VERSION = "8.1.1";
3046
3046
  //#endregion
3047
3047
  //#region src/utils/provider-packages.ts
3048
3048
  const OFFICIAL_PROVIDER_PACKAGES = {
@@ -3079,8 +3079,9 @@ var SpectrumCloudError = class extends Error {
3079
3079
  this.code = code;
3080
3080
  }
3081
3081
  };
3082
+ const cloudFetch = tracedFetch("spectrum-cloud");
3082
3083
  const request = async (path, init) => {
3083
- const response = await fetch(`${SPECTRUM_CLOUD_URL}${path}`, init);
3084
+ const response = await cloudFetch(`${SPECTRUM_CLOUD_URL}${path}`, init);
3084
3085
  if (!response.ok) {
3085
3086
  const body = await response.text().catch(() => "");
3086
3087
  try {
@@ -4035,7 +4036,9 @@ function bootstrapTelemetry(opts) {
4035
4036
  serviceVersion: SPECTRUM_SDK_VERSION,
4036
4037
  endpoint: PHOTON_OTEL_ENDPOINT,
4037
4038
  headers,
4038
- resourceAttributes
4039
+ resourceAttributes,
4040
+ instrumentFetch: false,
4041
+ register: false
4039
4042
  });
4040
4043
  }
4041
4044
  function applyLogLevel(level) {
@@ -1,4 +1,5 @@
1
1
  import z from "zod";
2
+ import { createInstrumentedFetch, sanitizeEmail, sanitizeErrorMessage, sanitizePhone, sanitizeUrl } from "@photon-ai/otel";
2
3
  import { randomUUID } from "node:crypto";
3
4
  import { createReadStream } from "node:fs";
4
5
  import { readFile, stat } from "node:fs/promises";
@@ -6,9 +7,31 @@ import { basename } from "node:path";
6
7
  import { Readable } from "node:stream";
7
8
  import { lookup } from "mime-types";
8
9
  import vCard from "vcf";
9
- import { sanitizeEmail, sanitizeErrorMessage, sanitizePhone } from "@photon-ai/otel";
10
10
  import { Marked } from "marked";
11
11
  import { Repeater } from "@repeaterjs/repeater";
12
+ //#region src/utils/instrumented-fetch.ts
13
+ /**
14
+ * Build a fetch that traces spectrum's OWN outbound HTTP: each request through
15
+ * the returned fetch emits a CLIENT span (tagged with `peer.service`) and
16
+ * carries W3C trace context downstream. It never mutates `globalThis.fetch`, so
17
+ * a consumer's unrelated requests stay untouched.
18
+ *
19
+ * The base delegates to `globalThis.fetch` at call time — deliberately NOT
20
+ * `createInstrumentedFetch(globalThis.fetch, …)`, which would capture the
21
+ * original and bypass a test's `spyOn(globalThis, "fetch")`. When telemetry is
22
+ * off (no `setupOtel`), the tracer is a no-op and this is a transparent
23
+ * pass-through. Create one per module: `const tf = tracedFetch("…")`.
24
+ *
25
+ * Pass `redactUrl` to strip secrets from a request URL before it is recorded as
26
+ * the span's `url.full` (e.g. a token in the path or query); the real request
27
+ * still uses the original URL. Pair with `sanitizeUrl` for semconv-style query
28
+ * redaction.
29
+ */
30
+ const tracedFetch = (peerService, options) => createInstrumentedFetch(((input, init) => globalThis.fetch(input, init)), {
31
+ attributes: { "peer.service": peerService },
32
+ ...options
33
+ });
34
+ //#endregion
12
35
  //#region src/utils/io.ts
13
36
  const readSchema$1 = z.function({
14
37
  input: [],
@@ -23,6 +46,7 @@ const bufferToStream = (buf) => new ReadableStream({ start(controller) {
23
46
  controller.close();
24
47
  } });
25
48
  const DEFAULT_FETCH_TIMEOUT_MS = 1e4;
49
+ const mediaFetch = tracedFetch("media", { redactUrl: sanitizeUrl });
26
50
  /**
27
51
  * Fetch URL bytes into memory — never touches the filesystem, so callers
28
52
  * remain safe in read-only environments. Returns the response's Content-Type
@@ -32,7 +56,7 @@ const fetchUrlBytes = async (url, options) => {
32
56
  const controller = new AbortController();
33
57
  const timer = setTimeout(() => controller.abort(), options?.timeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS);
34
58
  try {
35
- const res = await fetch(url, {
59
+ const res = await mediaFetch(url, {
36
60
  signal: controller.signal,
37
61
  headers: options?.headers
38
62
  });
@@ -1395,4 +1419,4 @@ function broadcast(source) {
1395
1419
  };
1396
1420
  }
1397
1421
  //#endregion
1398
- export { resolveContents as A, fromVCard as B, poll as C, asGroup as D, markdownSchema as E, drainStreamText as F, attachment as G, buildPhotoAction as H, asCustom as I, attachmentSchema as K, custom as L, text as M, textSchema as N, group as O, StreamConsumedError as P, asContact as R, option as S, markdown as T, photoActionSchema as U, toVCard as V, asAttachment as W, asReaction as _, contentAttrs as a, asPoll as b, markdownToPlainText as c, asVoice as d, voice as f, read as g, asRead as h, stream as i, asText as j, groupSchema as k, renderInlineTokens as l, richlink as m, createAsyncQueue as n, errorAttrs as o, asRichlink as p, fetchUrlBytes as q, mergeStreams as r, senderAttrs as s, broadcast as t, classifyIdentifier as u, reaction as v, asMarkdown as w, asPollOption as x, reactionSchema as y, contact as z };
1422
+ export { resolveContents as A, fromVCard as B, poll as C, asGroup as D, markdownSchema as E, drainStreamText as F, attachment as G, buildPhotoAction as H, asCustom as I, tracedFetch as J, attachmentSchema as K, custom as L, text as M, textSchema as N, group as O, StreamConsumedError as P, asContact as R, option as S, markdown as T, photoActionSchema as U, toVCard as V, asAttachment as W, asReaction as _, contentAttrs as a, asPoll as b, markdownToPlainText as c, asVoice as d, voice as f, read as g, asRead as h, stream as i, asText as j, groupSchema as k, renderInlineTokens as l, richlink as m, createAsyncQueue as n, errorAttrs as o, asRichlink as p, fetchUrlBytes as q, mergeStreams as r, senderAttrs as s, broadcast as t, classifyIdentifier as u, reaction as v, asMarkdown as w, asPollOption as x, reactionSchema as y, contact as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-ts/core",
3
- "version": "8.0.0",
3
+ "version": "8.1.1",
4
4
  "description": "The spectrum-ts runtime — Spectrum, content builders, fusor, and the provider authoring API.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -32,7 +32,7 @@
32
32
  "access": "public"
33
33
  },
34
34
  "dependencies": {
35
- "@photon-ai/otel": "^1.0.0",
35
+ "@photon-ai/otel": "^3.1.0",
36
36
  "@photon-ai/proto": "^0.2.4",
37
37
  "@repeaterjs/repeater": "^3.0.6",
38
38
  "marked": "^18.0.5",