@spectrum-ts/core 8.0.0 → 8.1.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.
|
@@ -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,14 @@ 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: "attachment";
|
|
451
|
+
id: string;
|
|
452
|
+
name: string;
|
|
453
|
+
mimeType: string;
|
|
454
|
+
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
455
|
+
stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
456
|
+
size?: number | undefined;
|
|
457
|
+
} | {
|
|
450
458
|
type: "contact";
|
|
451
459
|
user?: {
|
|
452
460
|
__platform: string;
|
|
@@ -489,17 +497,6 @@ declare const editSchema: z.ZodObject<{
|
|
|
489
497
|
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
490
498
|
} | undefined;
|
|
491
499
|
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
500
|
} | {
|
|
504
501
|
type: "custom";
|
|
505
502
|
raw: unknown;
|
|
@@ -510,9 +507,8 @@ declare const editSchema: z.ZodObject<{
|
|
|
510
507
|
type: "markdown";
|
|
511
508
|
markdown: string;
|
|
512
509
|
} | {
|
|
513
|
-
type: "
|
|
514
|
-
|
|
515
|
-
target: Message<string, User, Space<unknown>>;
|
|
510
|
+
type: "group";
|
|
511
|
+
items: Message<string, User, Space<unknown>>[];
|
|
516
512
|
} | {
|
|
517
513
|
type: "poll";
|
|
518
514
|
title: string;
|
|
@@ -533,6 +529,10 @@ declare const editSchema: z.ZodObject<{
|
|
|
533
529
|
};
|
|
534
530
|
selected: boolean;
|
|
535
531
|
title: string;
|
|
532
|
+
} | {
|
|
533
|
+
type: "reaction";
|
|
534
|
+
emoji: string;
|
|
535
|
+
target: Message<string, User, Space<unknown>>;
|
|
536
536
|
} | {
|
|
537
537
|
type: "richlink";
|
|
538
538
|
url: string;
|
|
@@ -595,6 +595,14 @@ declare const editSchema: z.ZodObject<{
|
|
|
595
595
|
kind: "clear";
|
|
596
596
|
};
|
|
597
597
|
}, {
|
|
598
|
+
type: "attachment";
|
|
599
|
+
id: string;
|
|
600
|
+
name: string;
|
|
601
|
+
mimeType: string;
|
|
602
|
+
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
603
|
+
stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
604
|
+
size?: number | undefined;
|
|
605
|
+
} | {
|
|
598
606
|
type: "contact";
|
|
599
607
|
user?: {
|
|
600
608
|
__platform: string;
|
|
@@ -637,17 +645,6 @@ declare const editSchema: z.ZodObject<{
|
|
|
637
645
|
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
638
646
|
} | undefined;
|
|
639
647
|
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
648
|
} | {
|
|
652
649
|
type: "custom";
|
|
653
650
|
raw: unknown;
|
|
@@ -658,9 +655,8 @@ declare const editSchema: z.ZodObject<{
|
|
|
658
655
|
type: "markdown";
|
|
659
656
|
markdown: string;
|
|
660
657
|
} | {
|
|
661
|
-
type: "
|
|
662
|
-
|
|
663
|
-
target: Message<string, User, Space<unknown>>;
|
|
658
|
+
type: "group";
|
|
659
|
+
items: Message<string, User, Space<unknown>>[];
|
|
664
660
|
} | {
|
|
665
661
|
type: "poll";
|
|
666
662
|
title: string;
|
|
@@ -681,6 +677,10 @@ declare const editSchema: z.ZodObject<{
|
|
|
681
677
|
};
|
|
682
678
|
selected: boolean;
|
|
683
679
|
title: string;
|
|
680
|
+
} | {
|
|
681
|
+
type: "reaction";
|
|
682
|
+
emoji: string;
|
|
683
|
+
target: Message<string, User, Space<unknown>>;
|
|
684
684
|
} | {
|
|
685
685
|
type: "richlink";
|
|
686
686
|
url: string;
|
|
@@ -968,6 +968,14 @@ 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: "attachment";
|
|
972
|
+
id: string;
|
|
973
|
+
name: string;
|
|
974
|
+
mimeType: string;
|
|
975
|
+
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
976
|
+
stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
977
|
+
size?: number | undefined;
|
|
978
|
+
} | {
|
|
971
979
|
type: "contact";
|
|
972
980
|
user?: {
|
|
973
981
|
__platform: string;
|
|
@@ -1010,17 +1018,6 @@ declare const replySchema: z.ZodObject<{
|
|
|
1010
1018
|
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
1011
1019
|
} | undefined;
|
|
1012
1020
|
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
1021
|
} | {
|
|
1025
1022
|
type: "custom";
|
|
1026
1023
|
raw: unknown;
|
|
@@ -1031,9 +1028,8 @@ declare const replySchema: z.ZodObject<{
|
|
|
1031
1028
|
type: "markdown";
|
|
1032
1029
|
markdown: string;
|
|
1033
1030
|
} | {
|
|
1034
|
-
type: "
|
|
1035
|
-
|
|
1036
|
-
target: Message<string, User, Space<unknown>>;
|
|
1031
|
+
type: "group";
|
|
1032
|
+
items: Message<string, User, Space<unknown>>[];
|
|
1037
1033
|
} | {
|
|
1038
1034
|
type: "poll";
|
|
1039
1035
|
title: string;
|
|
@@ -1054,6 +1050,10 @@ declare const replySchema: z.ZodObject<{
|
|
|
1054
1050
|
};
|
|
1055
1051
|
selected: boolean;
|
|
1056
1052
|
title: string;
|
|
1053
|
+
} | {
|
|
1054
|
+
type: "reaction";
|
|
1055
|
+
emoji: string;
|
|
1056
|
+
target: Message<string, User, Space<unknown>>;
|
|
1057
1057
|
} | {
|
|
1058
1058
|
type: "richlink";
|
|
1059
1059
|
url: string;
|
|
@@ -1116,6 +1116,14 @@ declare const replySchema: z.ZodObject<{
|
|
|
1116
1116
|
kind: "clear";
|
|
1117
1117
|
};
|
|
1118
1118
|
}, {
|
|
1119
|
+
type: "attachment";
|
|
1120
|
+
id: string;
|
|
1121
|
+
name: string;
|
|
1122
|
+
mimeType: string;
|
|
1123
|
+
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
1124
|
+
stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
1125
|
+
size?: number | undefined;
|
|
1126
|
+
} | {
|
|
1119
1127
|
type: "contact";
|
|
1120
1128
|
user?: {
|
|
1121
1129
|
__platform: string;
|
|
@@ -1158,17 +1166,6 @@ declare const replySchema: z.ZodObject<{
|
|
|
1158
1166
|
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
1159
1167
|
} | undefined;
|
|
1160
1168
|
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
1169
|
} | {
|
|
1173
1170
|
type: "custom";
|
|
1174
1171
|
raw: unknown;
|
|
@@ -1179,9 +1176,8 @@ declare const replySchema: z.ZodObject<{
|
|
|
1179
1176
|
type: "markdown";
|
|
1180
1177
|
markdown: string;
|
|
1181
1178
|
} | {
|
|
1182
|
-
type: "
|
|
1183
|
-
|
|
1184
|
-
target: Message<string, User, Space<unknown>>;
|
|
1179
|
+
type: "group";
|
|
1180
|
+
items: Message<string, User, Space<unknown>>[];
|
|
1185
1181
|
} | {
|
|
1186
1182
|
type: "poll";
|
|
1187
1183
|
title: string;
|
|
@@ -1202,6 +1198,10 @@ declare const replySchema: z.ZodObject<{
|
|
|
1202
1198
|
};
|
|
1203
1199
|
selected: boolean;
|
|
1204
1200
|
title: string;
|
|
1201
|
+
} | {
|
|
1202
|
+
type: "reaction";
|
|
1203
|
+
emoji: string;
|
|
1204
|
+
target: Message<string, User, Space<unknown>>;
|
|
1205
1205
|
} | {
|
|
1206
1206
|
type: "richlink";
|
|
1207
1207
|
url: string;
|
|
@@ -6851,6 +6851,14 @@ 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: "attachment";
|
|
6855
|
+
id: string;
|
|
6856
|
+
name: string;
|
|
6857
|
+
mimeType: string;
|
|
6858
|
+
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
6859
|
+
stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
6860
|
+
size?: number | undefined;
|
|
6861
|
+
} | {
|
|
6854
6862
|
type: "contact";
|
|
6855
6863
|
user?: {
|
|
6856
6864
|
__platform: string;
|
|
@@ -6893,17 +6901,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
6893
6901
|
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
6894
6902
|
} | undefined;
|
|
6895
6903
|
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
6904
|
} | {
|
|
6908
6905
|
type: "custom";
|
|
6909
6906
|
raw: unknown;
|
|
@@ -6914,9 +6911,8 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
6914
6911
|
type: "markdown";
|
|
6915
6912
|
markdown: string;
|
|
6916
6913
|
} | {
|
|
6917
|
-
type: "
|
|
6918
|
-
|
|
6919
|
-
target: Message<string, User, Space<unknown>>;
|
|
6914
|
+
type: "group";
|
|
6915
|
+
items: Message<string, User, Space<unknown>>[];
|
|
6920
6916
|
} | {
|
|
6921
6917
|
type: "poll";
|
|
6922
6918
|
title: string;
|
|
@@ -6937,6 +6933,10 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
6937
6933
|
};
|
|
6938
6934
|
selected: boolean;
|
|
6939
6935
|
title: string;
|
|
6936
|
+
} | {
|
|
6937
|
+
type: "reaction";
|
|
6938
|
+
emoji: string;
|
|
6939
|
+
target: Message<string, User, Space<unknown>>;
|
|
6940
6940
|
} | {
|
|
6941
6941
|
type: "richlink";
|
|
6942
6942
|
url: string;
|
|
@@ -6999,6 +6999,14 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
6999
6999
|
kind: "clear";
|
|
7000
7000
|
};
|
|
7001
7001
|
}, {
|
|
7002
|
+
type: "attachment";
|
|
7003
|
+
id: string;
|
|
7004
|
+
name: string;
|
|
7005
|
+
mimeType: string;
|
|
7006
|
+
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
7007
|
+
stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
7008
|
+
size?: number | undefined;
|
|
7009
|
+
} | {
|
|
7002
7010
|
type: "contact";
|
|
7003
7011
|
user?: {
|
|
7004
7012
|
__platform: string;
|
|
@@ -7041,17 +7049,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7041
7049
|
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
7042
7050
|
} | undefined;
|
|
7043
7051
|
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
7052
|
} | {
|
|
7056
7053
|
type: "custom";
|
|
7057
7054
|
raw: unknown;
|
|
@@ -7062,9 +7059,8 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7062
7059
|
type: "markdown";
|
|
7063
7060
|
markdown: string;
|
|
7064
7061
|
} | {
|
|
7065
|
-
type: "
|
|
7066
|
-
|
|
7067
|
-
target: Message<string, User, Space<unknown>>;
|
|
7062
|
+
type: "group";
|
|
7063
|
+
items: Message<string, User, Space<unknown>>[];
|
|
7068
7064
|
} | {
|
|
7069
7065
|
type: "poll";
|
|
7070
7066
|
title: string;
|
|
@@ -7085,6 +7081,10 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7085
7081
|
};
|
|
7086
7082
|
selected: boolean;
|
|
7087
7083
|
title: string;
|
|
7084
|
+
} | {
|
|
7085
|
+
type: "reaction";
|
|
7086
|
+
emoji: string;
|
|
7087
|
+
target: Message<string, User, Space<unknown>>;
|
|
7088
7088
|
} | {
|
|
7089
7089
|
type: "richlink";
|
|
7090
7090
|
url: string;
|
|
@@ -7151,6 +7151,14 @@ 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: "attachment";
|
|
7155
|
+
id: string;
|
|
7156
|
+
name: string;
|
|
7157
|
+
mimeType: string;
|
|
7158
|
+
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
7159
|
+
stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
7160
|
+
size?: number | undefined;
|
|
7161
|
+
} | {
|
|
7154
7162
|
type: "contact";
|
|
7155
7163
|
user?: {
|
|
7156
7164
|
__platform: string;
|
|
@@ -7193,17 +7201,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7193
7201
|
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
7194
7202
|
} | undefined;
|
|
7195
7203
|
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
7204
|
} | {
|
|
7208
7205
|
type: "custom";
|
|
7209
7206
|
raw: unknown;
|
|
@@ -7214,9 +7211,8 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7214
7211
|
type: "markdown";
|
|
7215
7212
|
markdown: string;
|
|
7216
7213
|
} | {
|
|
7217
|
-
type: "
|
|
7218
|
-
|
|
7219
|
-
target: Message<string, User, Space<unknown>>;
|
|
7214
|
+
type: "group";
|
|
7215
|
+
items: Message<string, User, Space<unknown>>[];
|
|
7220
7216
|
} | {
|
|
7221
7217
|
type: "poll";
|
|
7222
7218
|
title: string;
|
|
@@ -7237,6 +7233,10 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7237
7233
|
};
|
|
7238
7234
|
selected: boolean;
|
|
7239
7235
|
title: string;
|
|
7236
|
+
} | {
|
|
7237
|
+
type: "reaction";
|
|
7238
|
+
emoji: string;
|
|
7239
|
+
target: Message<string, User, Space<unknown>>;
|
|
7240
7240
|
} | {
|
|
7241
7241
|
type: "richlink";
|
|
7242
7242
|
url: string;
|
|
@@ -7299,6 +7299,14 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7299
7299
|
kind: "clear";
|
|
7300
7300
|
};
|
|
7301
7301
|
}, {
|
|
7302
|
+
type: "attachment";
|
|
7303
|
+
id: string;
|
|
7304
|
+
name: string;
|
|
7305
|
+
mimeType: string;
|
|
7306
|
+
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
7307
|
+
stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
7308
|
+
size?: number | undefined;
|
|
7309
|
+
} | {
|
|
7302
7310
|
type: "contact";
|
|
7303
7311
|
user?: {
|
|
7304
7312
|
__platform: string;
|
|
@@ -7341,17 +7349,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7341
7349
|
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
7342
7350
|
} | undefined;
|
|
7343
7351
|
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
7352
|
} | {
|
|
7356
7353
|
type: "custom";
|
|
7357
7354
|
raw: unknown;
|
|
@@ -7362,9 +7359,8 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7362
7359
|
type: "markdown";
|
|
7363
7360
|
markdown: string;
|
|
7364
7361
|
} | {
|
|
7365
|
-
type: "
|
|
7366
|
-
|
|
7367
|
-
target: Message<string, User, Space<unknown>>;
|
|
7362
|
+
type: "group";
|
|
7363
|
+
items: Message<string, User, Space<unknown>>[];
|
|
7368
7364
|
} | {
|
|
7369
7365
|
type: "poll";
|
|
7370
7366
|
title: string;
|
|
@@ -7385,6 +7381,10 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7385
7381
|
};
|
|
7386
7382
|
selected: boolean;
|
|
7387
7383
|
title: string;
|
|
7384
|
+
} | {
|
|
7385
|
+
type: "reaction";
|
|
7386
|
+
emoji: string;
|
|
7387
|
+
target: Message<string, User, Space<unknown>>;
|
|
7388
7388
|
} | {
|
|
7389
7389
|
type: "richlink";
|
|
7390
7390
|
url: string;
|
package/dist/authoring.d.ts
CHANGED
|
@@ -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-
|
|
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-DSVZbNyn.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-
|
|
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-
|
|
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-DSVZbNyn.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-
|
|
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.
|
|
3045
|
+
const SPECTRUM_SDK_VERSION = "8.1.0";
|
|
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
|
|
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
|
|
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.
|
|
3
|
+
"version": "8.1.0",
|
|
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
|
|
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",
|