@spectrum-ts/core 11.1.0 → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -42,7 +42,7 @@ The fastest way to ship is with **Spectrum Cloud** — hosted infrastructure for
42
42
  const app = await Spectrum({
43
43
  projectId: process.env.PROJECT_ID,
44
44
  projectSecret: process.env.PROJECT_SECRET,
45
- platforms: [imessage.config()],
45
+ providers: [imessage.config()],
46
46
  });
47
47
 
48
48
  for await (const [space, message] of app.messages) {
@@ -592,14 +592,6 @@ interface Message<TPlatform extends string = string, TSender extends User = User
592
592
  declare const editSchema: z.ZodObject<{
593
593
  type: z.ZodLiteral<"edit">;
594
594
  content: z.ZodCustom<{
595
- type: "attachment";
596
- id: string;
597
- name: string;
598
- mimeType: string;
599
- read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
600
- stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
601
- size?: number | undefined;
602
- } | {
603
595
  type: "contact";
604
596
  user?: {
605
597
  __platform: string;
@@ -643,21 +635,13 @@ declare const editSchema: z.ZodObject<{
643
635
  } | undefined;
644
636
  raw?: unknown;
645
637
  } | {
646
- type: "text";
647
- text: string;
648
- } | {
649
- type: "markdown";
650
- markdown: string;
651
- } | {
652
- type: "custom";
653
- raw: unknown;
654
- } | {
655
- type: "group";
656
- items: Message<string, User, Space<unknown>>[];
657
- } | {
658
- type: "reaction";
659
- emoji: string;
660
- target: Message<string, User, Space<unknown>>;
638
+ type: "attachment";
639
+ id: string;
640
+ name: string;
641
+ mimeType: string;
642
+ read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
643
+ stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
644
+ size?: number | undefined;
661
645
  } | {
662
646
  type: "poll";
663
647
  title: string;
@@ -678,6 +662,15 @@ declare const editSchema: z.ZodObject<{
678
662
  };
679
663
  selected: boolean;
680
664
  title: string;
665
+ } | {
666
+ type: "custom";
667
+ raw: unknown;
668
+ } | {
669
+ type: "text";
670
+ text: string;
671
+ } | {
672
+ type: "markdown";
673
+ markdown: string;
681
674
  } | {
682
675
  type: "streamText";
683
676
  stream: () => AsyncIterable<string>;
@@ -687,6 +680,7 @@ declare const editSchema: z.ZodObject<{
687
680
  mimeType: string;
688
681
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
689
682
  stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
683
+ id?: string | undefined;
690
684
  name?: string | undefined;
691
685
  duration?: number | undefined;
692
686
  size?: number | undefined;
@@ -707,6 +701,13 @@ declare const editSchema: z.ZodObject<{
707
701
  summary: z.ZodOptional<z.ZodString>;
708
702
  }, z.core.$strip>>>;
709
703
  live?: boolean | undefined;
704
+ } | {
705
+ type: "reaction";
706
+ emoji: string;
707
+ target: Message<string, User, Space<unknown>>;
708
+ } | {
709
+ type: "group";
710
+ items: Message<string, User, Space<unknown>>[];
710
711
  } | {
711
712
  type: "effect";
712
713
  content: {
@@ -749,14 +750,6 @@ declare const editSchema: z.ZodObject<{
749
750
  } | {
750
751
  type: "leaveSpace";
751
752
  }, {
752
- type: "attachment";
753
- id: string;
754
- name: string;
755
- mimeType: string;
756
- read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
757
- stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
758
- size?: number | undefined;
759
- } | {
760
753
  type: "contact";
761
754
  user?: {
762
755
  __platform: string;
@@ -800,21 +793,13 @@ declare const editSchema: z.ZodObject<{
800
793
  } | undefined;
801
794
  raw?: unknown;
802
795
  } | {
803
- type: "text";
804
- text: string;
805
- } | {
806
- type: "markdown";
807
- markdown: string;
808
- } | {
809
- type: "custom";
810
- raw: unknown;
811
- } | {
812
- type: "group";
813
- items: Message<string, User, Space<unknown>>[];
814
- } | {
815
- type: "reaction";
816
- emoji: string;
817
- target: Message<string, User, Space<unknown>>;
796
+ type: "attachment";
797
+ id: string;
798
+ name: string;
799
+ mimeType: string;
800
+ read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
801
+ stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
802
+ size?: number | undefined;
818
803
  } | {
819
804
  type: "poll";
820
805
  title: string;
@@ -835,6 +820,15 @@ declare const editSchema: z.ZodObject<{
835
820
  };
836
821
  selected: boolean;
837
822
  title: string;
823
+ } | {
824
+ type: "custom";
825
+ raw: unknown;
826
+ } | {
827
+ type: "text";
828
+ text: string;
829
+ } | {
830
+ type: "markdown";
831
+ markdown: string;
838
832
  } | {
839
833
  type: "streamText";
840
834
  stream: () => AsyncIterable<string>;
@@ -844,6 +838,7 @@ declare const editSchema: z.ZodObject<{
844
838
  mimeType: string;
845
839
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
846
840
  stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
841
+ id?: string | undefined;
847
842
  name?: string | undefined;
848
843
  duration?: number | undefined;
849
844
  size?: number | undefined;
@@ -864,6 +859,13 @@ declare const editSchema: z.ZodObject<{
864
859
  summary: z.ZodOptional<z.ZodString>;
865
860
  }, z.core.$strip>>>;
866
861
  live?: boolean | undefined;
862
+ } | {
863
+ type: "reaction";
864
+ emoji: string;
865
+ target: Message<string, User, Space<unknown>>;
866
+ } | {
867
+ type: "group";
868
+ items: Message<string, User, Space<unknown>>[];
867
869
  } | {
868
870
  type: "effect";
869
871
  content: {
@@ -1136,14 +1138,6 @@ declare function rename(displayName: string): ContentBuilder;
1136
1138
  declare const replySchema: z.ZodObject<{
1137
1139
  type: z.ZodLiteral<"reply">;
1138
1140
  content: z.ZodCustom<{
1139
- type: "attachment";
1140
- id: string;
1141
- name: string;
1142
- mimeType: string;
1143
- read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
1144
- stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
1145
- size?: number | undefined;
1146
- } | {
1147
1141
  type: "contact";
1148
1142
  user?: {
1149
1143
  __platform: string;
@@ -1187,21 +1181,13 @@ declare const replySchema: z.ZodObject<{
1187
1181
  } | undefined;
1188
1182
  raw?: unknown;
1189
1183
  } | {
1190
- type: "text";
1191
- text: string;
1192
- } | {
1193
- type: "markdown";
1194
- markdown: string;
1195
- } | {
1196
- type: "custom";
1197
- raw: unknown;
1198
- } | {
1199
- type: "group";
1200
- items: Message<string, User, Space<unknown>>[];
1201
- } | {
1202
- type: "reaction";
1203
- emoji: string;
1204
- target: Message<string, User, Space<unknown>>;
1184
+ type: "attachment";
1185
+ id: string;
1186
+ name: string;
1187
+ mimeType: string;
1188
+ read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
1189
+ stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
1190
+ size?: number | undefined;
1205
1191
  } | {
1206
1192
  type: "poll";
1207
1193
  title: string;
@@ -1222,6 +1208,15 @@ declare const replySchema: z.ZodObject<{
1222
1208
  };
1223
1209
  selected: boolean;
1224
1210
  title: string;
1211
+ } | {
1212
+ type: "custom";
1213
+ raw: unknown;
1214
+ } | {
1215
+ type: "text";
1216
+ text: string;
1217
+ } | {
1218
+ type: "markdown";
1219
+ markdown: string;
1225
1220
  } | {
1226
1221
  type: "streamText";
1227
1222
  stream: () => AsyncIterable<string>;
@@ -1231,6 +1226,7 @@ declare const replySchema: z.ZodObject<{
1231
1226
  mimeType: string;
1232
1227
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
1233
1228
  stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
1229
+ id?: string | undefined;
1234
1230
  name?: string | undefined;
1235
1231
  duration?: number | undefined;
1236
1232
  size?: number | undefined;
@@ -1251,6 +1247,13 @@ declare const replySchema: z.ZodObject<{
1251
1247
  summary: z.ZodOptional<z.ZodString>;
1252
1248
  }, z.core.$strip>>>;
1253
1249
  live?: boolean | undefined;
1250
+ } | {
1251
+ type: "reaction";
1252
+ emoji: string;
1253
+ target: Message<string, User, Space<unknown>>;
1254
+ } | {
1255
+ type: "group";
1256
+ items: Message<string, User, Space<unknown>>[];
1254
1257
  } | {
1255
1258
  type: "effect";
1256
1259
  content: {
@@ -1293,14 +1296,6 @@ declare const replySchema: z.ZodObject<{
1293
1296
  } | {
1294
1297
  type: "leaveSpace";
1295
1298
  }, {
1296
- type: "attachment";
1297
- id: string;
1298
- name: string;
1299
- mimeType: string;
1300
- read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
1301
- stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
1302
- size?: number | undefined;
1303
- } | {
1304
1299
  type: "contact";
1305
1300
  user?: {
1306
1301
  __platform: string;
@@ -1344,21 +1339,13 @@ declare const replySchema: z.ZodObject<{
1344
1339
  } | undefined;
1345
1340
  raw?: unknown;
1346
1341
  } | {
1347
- type: "text";
1348
- text: string;
1349
- } | {
1350
- type: "markdown";
1351
- markdown: string;
1352
- } | {
1353
- type: "custom";
1354
- raw: unknown;
1355
- } | {
1356
- type: "group";
1357
- items: Message<string, User, Space<unknown>>[];
1358
- } | {
1359
- type: "reaction";
1360
- emoji: string;
1361
- target: Message<string, User, Space<unknown>>;
1342
+ type: "attachment";
1343
+ id: string;
1344
+ name: string;
1345
+ mimeType: string;
1346
+ read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
1347
+ stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
1348
+ size?: number | undefined;
1362
1349
  } | {
1363
1350
  type: "poll";
1364
1351
  title: string;
@@ -1379,6 +1366,15 @@ declare const replySchema: z.ZodObject<{
1379
1366
  };
1380
1367
  selected: boolean;
1381
1368
  title: string;
1369
+ } | {
1370
+ type: "custom";
1371
+ raw: unknown;
1372
+ } | {
1373
+ type: "text";
1374
+ text: string;
1375
+ } | {
1376
+ type: "markdown";
1377
+ markdown: string;
1382
1378
  } | {
1383
1379
  type: "streamText";
1384
1380
  stream: () => AsyncIterable<string>;
@@ -1388,6 +1384,7 @@ declare const replySchema: z.ZodObject<{
1388
1384
  mimeType: string;
1389
1385
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
1390
1386
  stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
1387
+ id?: string | undefined;
1391
1388
  name?: string | undefined;
1392
1389
  duration?: number | undefined;
1393
1390
  size?: number | undefined;
@@ -1408,6 +1405,13 @@ declare const replySchema: z.ZodObject<{
1408
1405
  summary: z.ZodOptional<z.ZodString>;
1409
1406
  }, z.core.$strip>>>;
1410
1407
  live?: boolean | undefined;
1408
+ } | {
1409
+ type: "reaction";
1410
+ emoji: string;
1411
+ target: Message<string, User, Space<unknown>>;
1412
+ } | {
1413
+ type: "group";
1414
+ items: Message<string, User, Space<unknown>>[];
1411
1415
  } | {
1412
1416
  type: "effect";
1413
1417
  content: {
@@ -1581,6 +1585,7 @@ declare function unsend(target: Message | undefined): ContentBuilder;
1581
1585
  //#region src/content/voice.d.ts
1582
1586
  declare const voiceSchema: z.ZodObject<{
1583
1587
  type: z.ZodLiteral<"voice">;
1588
+ id: z.ZodOptional<z.ZodString>;
1584
1589
  name: z.ZodOptional<z.ZodString>;
1585
1590
  mimeType: z.ZodString;
1586
1591
  duration: z.ZodOptional<z.ZodNumber>;
@@ -1591,6 +1596,7 @@ declare const voiceSchema: z.ZodObject<{
1591
1596
  type Voice = z.infer<typeof voiceSchema>;
1592
1597
  type VoiceInput = string | Buffer | URL;
1593
1598
  declare const asVoice: (input: {
1599
+ id?: string;
1594
1600
  name?: string;
1595
1601
  mimeType: string;
1596
1602
  duration?: number;
@@ -6875,18 +6881,12 @@ interface SpectrumOptions {
6875
6881
  */
6876
6882
  logLevel?: LogLevel;
6877
6883
  }
6878
- type PlatformSelection<Providers extends PlatformProviderConfig[]> = {
6879
- platforms: [...Providers];
6880
- providers?: never;
6881
- } | {
6882
- platforms?: never;
6883
- providers: [...Providers];
6884
- };
6885
- type SpectrumFactoryOptions<Providers extends PlatformProviderConfig[]> = PlatformSelection<Providers> & {
6884
+ interface SpectrumFactoryOptions<Providers extends PlatformProviderConfig[]> {
6886
6885
  options?: SpectrumOptions;
6886
+ providers: [...Providers];
6887
6887
  telemetry?: boolean;
6888
6888
  webhookSecret?: string;
6889
- };
6889
+ }
6890
6890
  declare function Spectrum<const Providers extends PlatformProviderConfig[]>(options: {
6891
6891
  projectId: string;
6892
6892
  projectSecret: string;
@@ -7006,6 +7006,7 @@ declare const baseContentSchema: z.ZodDiscriminatedUnion<readonly [z.ZodObject<{
7006
7006
  raw: z.ZodOptional<z.ZodUnknown>;
7007
7007
  }, z.core.$strip>, z.ZodObject<{
7008
7008
  type: z.ZodLiteral<"voice">;
7009
+ id: z.ZodOptional<z.ZodString>;
7009
7010
  name: z.ZodOptional<z.ZodString>;
7010
7011
  mimeType: z.ZodString;
7011
7012
  duration: z.ZodOptional<z.ZodNumber>;
@@ -7184,6 +7185,7 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7184
7185
  raw: z.ZodOptional<z.ZodUnknown>;
7185
7186
  }, z.core.$strip>, z.ZodObject<{
7186
7187
  type: z.ZodLiteral<"voice">;
7188
+ id: z.ZodOptional<z.ZodString>;
7187
7189
  name: z.ZodOptional<z.ZodString>;
7188
7190
  mimeType: z.ZodString;
7189
7191
  duration: z.ZodOptional<z.ZodNumber>;
@@ -7281,14 +7283,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7281
7283
  }, z.core.$strip>, z.ZodObject<{
7282
7284
  type: z.ZodLiteral<"reply">;
7283
7285
  content: z.ZodCustom<{
7284
- type: "attachment";
7285
- id: string;
7286
- name: string;
7287
- mimeType: string;
7288
- read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7289
- stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
7290
- size?: number | undefined;
7291
- } | {
7292
7286
  type: "contact";
7293
7287
  user?: {
7294
7288
  __platform: string;
@@ -7332,21 +7326,13 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7332
7326
  } | undefined;
7333
7327
  raw?: unknown;
7334
7328
  } | {
7335
- type: "text";
7336
- text: string;
7337
- } | {
7338
- type: "markdown";
7339
- markdown: string;
7340
- } | {
7341
- type: "custom";
7342
- raw: unknown;
7343
- } | {
7344
- type: "group";
7345
- items: Message<string, User, Space<unknown>>[];
7346
- } | {
7347
- type: "reaction";
7348
- emoji: string;
7349
- target: Message<string, User, Space<unknown>>;
7329
+ type: "attachment";
7330
+ id: string;
7331
+ name: string;
7332
+ mimeType: string;
7333
+ read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7334
+ stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
7335
+ size?: number | undefined;
7350
7336
  } | {
7351
7337
  type: "poll";
7352
7338
  title: string;
@@ -7367,6 +7353,15 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7367
7353
  };
7368
7354
  selected: boolean;
7369
7355
  title: string;
7356
+ } | {
7357
+ type: "custom";
7358
+ raw: unknown;
7359
+ } | {
7360
+ type: "text";
7361
+ text: string;
7362
+ } | {
7363
+ type: "markdown";
7364
+ markdown: string;
7370
7365
  } | {
7371
7366
  type: "streamText";
7372
7367
  stream: () => AsyncIterable<string>;
@@ -7376,6 +7371,7 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7376
7371
  mimeType: string;
7377
7372
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7378
7373
  stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
7374
+ id?: string | undefined;
7379
7375
  name?: string | undefined;
7380
7376
  duration?: number | undefined;
7381
7377
  size?: number | undefined;
@@ -7396,6 +7392,13 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7396
7392
  summary: z.ZodOptional<z.ZodString>;
7397
7393
  }, z.core.$strip>>>;
7398
7394
  live?: boolean | undefined;
7395
+ } | {
7396
+ type: "reaction";
7397
+ emoji: string;
7398
+ target: Message<string, User, Space<unknown>>;
7399
+ } | {
7400
+ type: "group";
7401
+ items: Message<string, User, Space<unknown>>[];
7399
7402
  } | {
7400
7403
  type: "effect";
7401
7404
  content: {
@@ -7438,14 +7441,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7438
7441
  } | {
7439
7442
  type: "leaveSpace";
7440
7443
  }, {
7441
- type: "attachment";
7442
- id: string;
7443
- name: string;
7444
- mimeType: string;
7445
- read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7446
- stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
7447
- size?: number | undefined;
7448
- } | {
7449
7444
  type: "contact";
7450
7445
  user?: {
7451
7446
  __platform: string;
@@ -7489,21 +7484,13 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7489
7484
  } | undefined;
7490
7485
  raw?: unknown;
7491
7486
  } | {
7492
- type: "text";
7493
- text: string;
7494
- } | {
7495
- type: "markdown";
7496
- markdown: string;
7497
- } | {
7498
- type: "custom";
7499
- raw: unknown;
7500
- } | {
7501
- type: "group";
7502
- items: Message<string, User, Space<unknown>>[];
7503
- } | {
7504
- type: "reaction";
7505
- emoji: string;
7506
- target: Message<string, User, Space<unknown>>;
7487
+ type: "attachment";
7488
+ id: string;
7489
+ name: string;
7490
+ mimeType: string;
7491
+ read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7492
+ stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
7493
+ size?: number | undefined;
7507
7494
  } | {
7508
7495
  type: "poll";
7509
7496
  title: string;
@@ -7524,6 +7511,15 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7524
7511
  };
7525
7512
  selected: boolean;
7526
7513
  title: string;
7514
+ } | {
7515
+ type: "custom";
7516
+ raw: unknown;
7517
+ } | {
7518
+ type: "text";
7519
+ text: string;
7520
+ } | {
7521
+ type: "markdown";
7522
+ markdown: string;
7527
7523
  } | {
7528
7524
  type: "streamText";
7529
7525
  stream: () => AsyncIterable<string>;
@@ -7533,6 +7529,7 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7533
7529
  mimeType: string;
7534
7530
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7535
7531
  stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
7532
+ id?: string | undefined;
7536
7533
  name?: string | undefined;
7537
7534
  duration?: number | undefined;
7538
7535
  size?: number | undefined;
@@ -7553,6 +7550,13 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7553
7550
  summary: z.ZodOptional<z.ZodString>;
7554
7551
  }, z.core.$strip>>>;
7555
7552
  live?: boolean | undefined;
7553
+ } | {
7554
+ type: "reaction";
7555
+ emoji: string;
7556
+ target: Message<string, User, Space<unknown>>;
7557
+ } | {
7558
+ type: "group";
7559
+ items: Message<string, User, Space<unknown>>[];
7556
7560
  } | {
7557
7561
  type: "effect";
7558
7562
  content: {
@@ -7599,14 +7603,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7599
7603
  }, z.core.$strip>, z.ZodObject<{
7600
7604
  type: z.ZodLiteral<"edit">;
7601
7605
  content: z.ZodCustom<{
7602
- type: "attachment";
7603
- id: string;
7604
- name: string;
7605
- mimeType: string;
7606
- read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7607
- stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
7608
- size?: number | undefined;
7609
- } | {
7610
7606
  type: "contact";
7611
7607
  user?: {
7612
7608
  __platform: string;
@@ -7650,21 +7646,13 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7650
7646
  } | undefined;
7651
7647
  raw?: unknown;
7652
7648
  } | {
7653
- type: "text";
7654
- text: string;
7655
- } | {
7656
- type: "markdown";
7657
- markdown: string;
7658
- } | {
7659
- type: "custom";
7660
- raw: unknown;
7661
- } | {
7662
- type: "group";
7663
- items: Message<string, User, Space<unknown>>[];
7664
- } | {
7665
- type: "reaction";
7666
- emoji: string;
7667
- target: Message<string, User, Space<unknown>>;
7649
+ type: "attachment";
7650
+ id: string;
7651
+ name: string;
7652
+ mimeType: string;
7653
+ read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7654
+ stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
7655
+ size?: number | undefined;
7668
7656
  } | {
7669
7657
  type: "poll";
7670
7658
  title: string;
@@ -7685,6 +7673,15 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7685
7673
  };
7686
7674
  selected: boolean;
7687
7675
  title: string;
7676
+ } | {
7677
+ type: "custom";
7678
+ raw: unknown;
7679
+ } | {
7680
+ type: "text";
7681
+ text: string;
7682
+ } | {
7683
+ type: "markdown";
7684
+ markdown: string;
7688
7685
  } | {
7689
7686
  type: "streamText";
7690
7687
  stream: () => AsyncIterable<string>;
@@ -7694,6 +7691,7 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7694
7691
  mimeType: string;
7695
7692
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7696
7693
  stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
7694
+ id?: string | undefined;
7697
7695
  name?: string | undefined;
7698
7696
  duration?: number | undefined;
7699
7697
  size?: number | undefined;
@@ -7714,6 +7712,13 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7714
7712
  summary: z.ZodOptional<z.ZodString>;
7715
7713
  }, z.core.$strip>>>;
7716
7714
  live?: boolean | undefined;
7715
+ } | {
7716
+ type: "reaction";
7717
+ emoji: string;
7718
+ target: Message<string, User, Space<unknown>>;
7719
+ } | {
7720
+ type: "group";
7721
+ items: Message<string, User, Space<unknown>>[];
7717
7722
  } | {
7718
7723
  type: "effect";
7719
7724
  content: {
@@ -7756,14 +7761,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7756
7761
  } | {
7757
7762
  type: "leaveSpace";
7758
7763
  }, {
7759
- type: "attachment";
7760
- id: string;
7761
- name: string;
7762
- mimeType: string;
7763
- read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7764
- stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
7765
- size?: number | undefined;
7766
- } | {
7767
7764
  type: "contact";
7768
7765
  user?: {
7769
7766
  __platform: string;
@@ -7807,21 +7804,13 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7807
7804
  } | undefined;
7808
7805
  raw?: unknown;
7809
7806
  } | {
7810
- type: "text";
7811
- text: string;
7812
- } | {
7813
- type: "markdown";
7814
- markdown: string;
7815
- } | {
7816
- type: "custom";
7817
- raw: unknown;
7818
- } | {
7819
- type: "group";
7820
- items: Message<string, User, Space<unknown>>[];
7821
- } | {
7822
- type: "reaction";
7823
- emoji: string;
7824
- target: Message<string, User, Space<unknown>>;
7807
+ type: "attachment";
7808
+ id: string;
7809
+ name: string;
7810
+ mimeType: string;
7811
+ read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7812
+ stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
7813
+ size?: number | undefined;
7825
7814
  } | {
7826
7815
  type: "poll";
7827
7816
  title: string;
@@ -7842,6 +7831,15 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7842
7831
  };
7843
7832
  selected: boolean;
7844
7833
  title: string;
7834
+ } | {
7835
+ type: "custom";
7836
+ raw: unknown;
7837
+ } | {
7838
+ type: "text";
7839
+ text: string;
7840
+ } | {
7841
+ type: "markdown";
7842
+ markdown: string;
7845
7843
  } | {
7846
7844
  type: "streamText";
7847
7845
  stream: () => AsyncIterable<string>;
@@ -7851,6 +7849,7 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7851
7849
  mimeType: string;
7852
7850
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7853
7851
  stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
7852
+ id?: string | undefined;
7854
7853
  name?: string | undefined;
7855
7854
  duration?: number | undefined;
7856
7855
  size?: number | undefined;
@@ -7871,6 +7870,13 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7871
7870
  summary: z.ZodOptional<z.ZodString>;
7872
7871
  }, z.core.$strip>>>;
7873
7872
  live?: boolean | undefined;
7873
+ } | {
7874
+ type: "reaction";
7875
+ emoji: string;
7876
+ target: Message<string, User, Space<unknown>>;
7877
+ } | {
7878
+ type: "group";
7879
+ items: Message<string, User, Space<unknown>>[];
7874
7880
  } | {
7875
7881
  type: "effect";
7876
7882
  content: {
@@ -1,4 +1,4 @@
1
- import { Cn as reactionSchema, Dt as asRichlink, Gn as photoActionSchema, Gt as asPollOption, H as ProviderMessageRecord, Hn as avatarSchema, It as renameSchema, Nt as replySchema, Pn as asContact, Rt as asRead, U as ProviderUserRecord, Un as PhotoInput, Wn as buildPhotoAction, Wt as asPoll, Yt as asMarkdown, _t as asVoice, bt as asUnsend, gn as leaveSpaceSchema, in as groupSchema, jt as asReply, mn as addMemberSchema, nn as asGroup, q as ManagedStream, r as asAttachment, vn as removeMemberSchema, wn as asCustom, wt as asText, xn as asReaction } from "./attachment-BK3lYu2W.js";
1
+ import { Cn as reactionSchema, Dt as asRichlink, Gn as photoActionSchema, Gt as asPollOption, H as ProviderMessageRecord, Hn as avatarSchema, It as renameSchema, Nt as replySchema, Pn as asContact, Rt as asRead, U as ProviderUserRecord, Un as PhotoInput, Wn as buildPhotoAction, Wt as asPoll, Yt as asMarkdown, _t as asVoice, bt as asUnsend, gn as leaveSpaceSchema, in as groupSchema, jt as asReply, mn as addMemberSchema, nn as asGroup, q as ManagedStream, r as asAttachment, vn as removeMemberSchema, wn as asCustom, wt as asText, xn as asReaction } from "./attachment-DN82cCAP.js";
2
2
  import z from "zod";
3
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";
package/dist/authoring.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as asPoll, B as asMarkdown, D as asReaction, F as addMemberSchema, G as groupSchema, H as markdownSchema, L as leaveSpaceSchema, Q as asCustom, S as replySchema, T as asRead, U as asGroup, Y as textSchema, at as avatarSchema, b as asReply, ct as asAttachment, d as envAwareConfig, et as asContact, f as envFor, ft as tracedFetch, g as asUnsend, i as stream, j as asPollOption, k as reactionSchema, l as renderInlineTokens, m as asVoice, o as errorAttrs, ot as buildPhotoAction, p as fromEnv, q as asText, st as photoActionSchema, ut as attachmentSchema, v as asRichlink, w as renameSchema, z as removeMemberSchema } from "./stream-CxcG-Kup.js";
1
+ import { A as asPoll, B as asMarkdown, D as asReaction, F as addMemberSchema, G as groupSchema, H as markdownSchema, L as leaveSpaceSchema, Q as asCustom, S as replySchema, T as asRead, U as asGroup, Y as textSchema, at as avatarSchema, b as asReply, ct as asAttachment, d as envAwareConfig, et as asContact, f as envFor, ft as tracedFetch, g as asUnsend, i as stream, j as asPollOption, k as reactionSchema, l as renderInlineTokens, m as asVoice, o as errorAttrs, ot as buildPhotoAction, p as fromEnv, q as asText, st as photoActionSchema, ut as attachmentSchema, v as asRichlink, w as renameSchema, z as removeMemberSchema } from "./stream-B6kth7y9.js";
2
2
  import z from "zod";
3
3
  import { createLogger, createLogger as createLogger$1, sanitizeEmail, sanitizeErrorMessage, sanitizePhone, sanitizeUrl, setLogLevel } from "@photon-ai/otel";
4
4
  import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as DedicatedTokenData, $t as StreamTextSource, A as isFusorEvent, An as ContactInput, At as Reply, B as PlatformUser, Bn as AvatarInput, Bt as Poll, C as FusorVerify, Ct as typing, D as WebhookRawResult, Dn as ContactAddress, E as WebhookRawRequest, En as Contact, Et as Richlink, F as PlatformInstance, Fn as contact, Ft as rename, G as SpaceNamespace, Ht as PollChoiceInput, I as PlatformMessage, In as AgentSender, J as broadcast, Jn as AppOptions, Jt as Markdown, K as Broadcaster, Kn as App, Kt as option, L as PlatformProviderConfig, Ln as User, Lt as Read, M as EventProducer, Mn as ContactOrg, Mt as reply, N as Platform, Nn as ContactPhone, O as FusorEvent, On as ContactDetails, Ot as richlink, P as PlatformDef, Pt as Rename, Q as CloudPlatform, Qt as StreamText, R as PlatformRuntime, Rn as Avatar, S as FusorRespond, Sn as reaction, St as Typing, T as WebhookHandler, Tn as custom, Tt as text, Ut as PollOption, V as ProviderMessage, Vn as avatar, Vt as PollChoice, W as SchemaMessage, X as stream, Xn as app, Xt as markdown, Y as mergeStreams, Yn as AppUrl, Z as Store, Zn as appLayoutSchema, Zt as DeltaExtractor, _ as FusorClient, _n as removeMember, a as Content, an as Edit, at as ProjectProfile, b as FusorMessagesReturn, bn as ReactionBuilder, c as fromVCard, cn as Space, ct as SlackTokenData, d as UnsupportedKind, dn as MemberInput, dt as SubscriptionStatus, en as TextStreamOptions, et as FusorTokenData, f as Spectrum, fn as RemoveMember, ft as TokenData, g as isFusorClient, gt as Voice, h as fusor, hn as leaveSpace, ht as EmojiKey, i as attachment, it as ProjectData, j as AnyPlatformDef, jn as ContactName, k as fusorEvent, kn as ContactEmail, kt as resolveContents, l as toVCard, ln as AddMember, lt as SpectrumCloudError, m as definePlatform, mt as Emoji, n as AttachmentInput, nt as PlatformStatus, o as ContentBuilder, on as edit, ot as SharedTokenData, p as SpectrumInstance, pn as addMember, pt as cloud, q as ManagedStream, qn as AppLayout, qt as poll, rn as group, rt as PlatformsData, s as ContentInput, sn as Message, st as SlackTeamMeta, t as Attachment, tn as Group, tt as ImessageInfoData, u as UnsupportedError, un as LeaveSpace, ut as SubscriptionData, v as FusorMessages, vt as voice, w as FusorVerifyRequest, x as FusorReply, xt as unsend, y as FusorMessagesCtx, yn as Reaction, yt as Unsend, z as PlatformSpace, zn as AvatarData, zt as read } from "./attachment-BK3lYu2W.js";
1
+ import { $ as DedicatedTokenData, $t as StreamTextSource, A as isFusorEvent, An as ContactInput, At as Reply, B as PlatformUser, Bn as AvatarInput, Bt as Poll, C as FusorVerify, Ct as typing, D as WebhookRawResult, Dn as ContactAddress, E as WebhookRawRequest, En as Contact, Et as Richlink, F as PlatformInstance, Fn as contact, Ft as rename, G as SpaceNamespace, Ht as PollChoiceInput, I as PlatformMessage, In as AgentSender, J as broadcast, Jn as AppOptions, Jt as Markdown, K as Broadcaster, Kn as App, Kt as option, L as PlatformProviderConfig, Ln as User, Lt as Read, M as EventProducer, Mn as ContactOrg, Mt as reply, N as Platform, Nn as ContactPhone, O as FusorEvent, On as ContactDetails, Ot as richlink, P as PlatformDef, Pt as Rename, Q as CloudPlatform, Qt as StreamText, R as PlatformRuntime, Rn as Avatar, S as FusorRespond, Sn as reaction, St as Typing, T as WebhookHandler, Tn as custom, Tt as text, Ut as PollOption, V as ProviderMessage, Vn as avatar, Vt as PollChoice, W as SchemaMessage, X as stream, Xn as app, Xt as markdown, Y as mergeStreams, Yn as AppUrl, Z as Store, Zn as appLayoutSchema, Zt as DeltaExtractor, _ as FusorClient, _n as removeMember, a as Content, an as Edit, at as ProjectProfile, b as FusorMessagesReturn, bn as ReactionBuilder, c as fromVCard, cn as Space, ct as SlackTokenData, d as UnsupportedKind, dn as MemberInput, dt as SubscriptionStatus, en as TextStreamOptions, et as FusorTokenData, f as Spectrum, fn as RemoveMember, ft as TokenData, g as isFusorClient, gt as Voice, h as fusor, hn as leaveSpace, ht as EmojiKey, i as attachment, it as ProjectData, j as AnyPlatformDef, jn as ContactName, k as fusorEvent, kn as ContactEmail, kt as resolveContents, l as toVCard, ln as AddMember, lt as SpectrumCloudError, m as definePlatform, mt as Emoji, n as AttachmentInput, nt as PlatformStatus, o as ContentBuilder, on as edit, ot as SharedTokenData, p as SpectrumInstance, pn as addMember, pt as cloud, q as ManagedStream, qn as AppLayout, qt as poll, rn as group, rt as PlatformsData, s as ContentInput, sn as Message, st as SlackTeamMeta, t as Attachment, tn as Group, tt as ImessageInfoData, u as UnsupportedError, un as LeaveSpace, ut as SubscriptionData, v as FusorMessages, vt as voice, w as FusorVerifyRequest, x as FusorReply, xt as unsend, y as FusorMessagesCtx, yn as Reaction, yt as Unsend, z as PlatformSpace, zn as AvatarData, zt as read } from "./attachment-DN82cCAP.js";
2
2
  export { type AddMember, type AgentSender, type AnyPlatformDef, type App, type AppLayout, type AppOptions, type AppUrl, type Attachment, type AttachmentInput, type Avatar, type AvatarData, 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 LeaveSpace, type ManagedStream, type Markdown, type MemberInput, 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 RemoveMember, 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, addMember, app, appLayoutSchema, attachment, avatar, broadcast, cloud, contact, custom, definePlatform, edit, fromVCard, fusor, fusorEvent, group, isFusorClient, isFusorEvent, leaveSpace, markdown, mergeStreams, option, poll, reaction, read, removeMember, rename, reply, resolveContents, richlink, stream, text, toVCard, typing, unsend, voice };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as custom, B as asMarkdown, C as rename, E as read, F as addMemberSchema, I as leaveSpace, J as text, K as resolveContents, L as leaveSpaceSchema, M as option, N as poll, O as reaction, P as addMember, Q as asCustom, R as removeMember, V as markdown, W as group, X as StreamConsumedError, Z as drainStreamText, _ as unsend, a as contentAttrs, at as avatarSchema, c as markdownToPlainText, ct as asAttachment, d as envAwareConfig, dt as fetchUrlBytes, et as asContact, f as envFor, ft as tracedFetch, h as voice, i as stream, it as avatar, lt as attachment, n as createAsyncQueue, nt as fromVCard, o as errorAttrs, q as asText, r as mergeStreams, rt as toVCard, s as senderAttrs, t as broadcast, tt as contact, u as classifyIdentifier, w as renameSchema, x as reply, y as richlink, z as removeMemberSchema } from "./stream-CxcG-Kup.js";
1
+ import { $ as custom, B as asMarkdown, C as rename, E as read, F as addMemberSchema, I as leaveSpace, J as text, K as resolveContents, L as leaveSpaceSchema, M as option, N as poll, O as reaction, P as addMember, Q as asCustom, R as removeMember, V as markdown, W as group, X as StreamConsumedError, Z as drainStreamText, _ as unsend, a as contentAttrs, at as avatarSchema, c as markdownToPlainText, ct as asAttachment, d as envAwareConfig, dt as fetchUrlBytes, et as asContact, f as envFor, ft as tracedFetch, h as voice, i as stream, it as avatar, lt as attachment, m as asVoice, n as createAsyncQueue, nt as fromVCard, o as errorAttrs, q as asText, r as mergeStreams, rt as toVCard, s as senderAttrs, t as broadcast, tt as contact, u as classifyIdentifier, w as renameSchema, x as reply, y as richlink, z as removeMemberSchema } from "./stream-B6kth7y9.js";
2
2
  import z from "zod";
3
3
  import ogs from "open-graph-scraper";
4
4
  import { createLogger, setLogLevel, setupOtel, withSpan } from "@photon-ai/otel";
@@ -3005,7 +3005,7 @@ function definePlatform(name, rawDef) {
3005
3005
  }
3006
3006
  //#endregion
3007
3007
  //#region src/build-env.ts
3008
- const SPECTRUM_SDK_VERSION = "11.1.0";
3008
+ const SPECTRUM_SDK_VERSION = "12.0.0";
3009
3009
  //#endregion
3010
3010
  //#region src/utils/provider-packages.ts
3011
3011
  const OFFICIAL_PROVIDER_PACKAGES = {
@@ -3027,7 +3027,7 @@ const installCommand = (pkg) => process.versions.bun ? `bun add ${pkg}` : `npm i
3027
3027
  const officialProviderInstallHint = (platform) => {
3028
3028
  const pkg = officialProviderPackage(platform);
3029
3029
  if (!pkg) return;
3030
- return `the "${platform}" platform is provided by the optional package ${pkg} — install it (\`${installCommand(pkg)}\`) and pass it to Spectrum({ platforms: [...] })`;
3030
+ return `the "${platform}" platform is provided by the optional package ${pkg} — install it (\`${installCommand(pkg)}\`) and pass it to Spectrum({ providers: [...] })`;
3031
3031
  };
3032
3032
  //#endregion
3033
3033
  //#region src/utils/cloud.ts
@@ -3765,6 +3765,7 @@ const mapContent = (content, platform, spaceRef, ctx) => {
3765
3765
  case "reply": return deserializeReply(raw, platform, spaceRef, ctx);
3766
3766
  case "group": return deserializeGroup(raw, platform, spaceRef, ctx);
3767
3767
  case "attachment": return deserializeAttachment(raw, platform, spaceRef, ctx);
3768
+ case "voice": return deserializeVoice(raw, platform, spaceRef, ctx);
3768
3769
  case "addMember": return addMemberSchema.parse({
3769
3770
  type: "addMember",
3770
3771
  members: memberStrings(raw.members)
@@ -3813,6 +3814,20 @@ const deserializeAttachment = (raw, platform, spaceRef, ctx) => {
3813
3814
  stream: bytes?.stream
3814
3815
  });
3815
3816
  };
3817
+ const deserializeVoice = (raw, platform, spaceRef, ctx) => {
3818
+ const id = asString(raw.id);
3819
+ const bytes = id ? ctx.resolveAttachment?.(platform, spaceRef, id) : void 0;
3820
+ const unavailable = () => Promise.reject(UnsupportedError.action("getAttachment", platform, `voice attachment "${id}" arrived without bytes over the Spectrum webhook and "${platform}" exposes no getAttachment`));
3821
+ return asVoice({
3822
+ ...id ? { id } : {},
3823
+ name: asString(raw.name) || void 0,
3824
+ mimeType: asString(raw.mimeType),
3825
+ duration: typeof raw.duration === "number" ? raw.duration : void 0,
3826
+ size: typeof raw.size === "number" ? raw.size : void 0,
3827
+ read: bytes ? bytes.read : unavailable,
3828
+ stream: bytes?.stream
3829
+ });
3830
+ };
3816
3831
  const deserializeReaction = (raw, spaceRef) => ({
3817
3832
  type: "reaction",
3818
3833
  emoji: asString(raw.emoji),
@@ -4012,20 +4027,18 @@ const spectrumOptionsSchema = z.object({
4012
4027
  const spectrumConfigSchema = z.union([z.object({
4013
4028
  projectId: z.string().min(1),
4014
4029
  projectSecret: z.string().min(1),
4015
- providers: z.array(z.custom()).optional(),
4016
- platforms: z.array(z.custom()).optional(),
4030
+ providers: z.array(z.custom()),
4017
4031
  options: spectrumOptionsSchema,
4018
4032
  telemetry: z.boolean().optional(),
4019
4033
  webhookSecret: z.string().min(1).optional()
4020
4034
  }), z.object({
4021
4035
  projectId: z.undefined().optional(),
4022
4036
  projectSecret: z.undefined().optional(),
4023
- providers: z.array(z.custom()).optional(),
4024
- platforms: z.array(z.custom()).optional(),
4037
+ providers: z.array(z.custom()),
4025
4038
  options: spectrumOptionsSchema,
4026
4039
  telemetry: z.boolean().optional(),
4027
4040
  webhookSecret: z.string().min(1).optional()
4028
- })]).refine((config) => config.providers === void 0 !== (config.platforms === void 0), "Spectrum requires exactly one of platforms or providers");
4041
+ })]);
4029
4042
  function bootstrapTelemetry(opts) {
4030
4043
  const headers = {};
4031
4044
  if (opts.projectId && opts.projectSecret) {
@@ -4057,11 +4070,6 @@ function resolveProjectCredentials(options) {
4057
4070
  projectSecret: options.projectSecret ?? envValue(envFor("PROJECT", "SECRET"))
4058
4071
  };
4059
4072
  }
4060
- const resolveConfiguredProviders = (options) => {
4061
- const configuredProviders = options.platforms ?? options.providers;
4062
- if (!configuredProviders) throw new Error("Spectrum requires platforms or providers");
4063
- return configuredProviders;
4064
- };
4065
4073
  async function Spectrum(options) {
4066
4074
  const { projectId, projectSecret } = resolveProjectCredentials(options);
4067
4075
  spectrumConfigSchema.parse({
@@ -4069,8 +4077,7 @@ async function Spectrum(options) {
4069
4077
  projectId,
4070
4078
  projectSecret
4071
4079
  });
4072
- const providers = resolveConfiguredProviders(options);
4073
- const { options: runtimeOptions, telemetry, webhookSecret } = options;
4080
+ const { options: runtimeOptions, providers, telemetry, webhookSecret } = options;
4074
4081
  const flattenGroups = runtimeOptions?.flattenGroups ?? false;
4075
4082
  applyLogLevel(runtimeOptions?.logLevel);
4076
4083
  const resolvedWebhookSecret = webhookSecret ?? process.env[envFor("WEBHOOK", "SECRET")];
@@ -1122,6 +1122,7 @@ const AUDIO_MIME_PATTERN = /^audio\//i;
1122
1122
  const audioMimeSchema = z.string().nonempty().regex(AUDIO_MIME_PATTERN, "voice content requires an audio/* MIME type");
1123
1123
  const voiceSchema = z.object({
1124
1124
  type: z.literal("voice"),
1125
+ id: z.string().nonempty().optional(),
1125
1126
  name: z.string().nonempty().optional(),
1126
1127
  mimeType: audioMimeSchema,
1127
1128
  duration: z.number().nonnegative().optional(),
@@ -1163,6 +1164,7 @@ const asVoice = (input) => {
1163
1164
  const stream = input.stream ?? (async () => bufferToStream(await read()));
1164
1165
  return voiceSchema.parse({
1165
1166
  type: "voice",
1167
+ ...input.id ? { id: input.id } : {},
1166
1168
  name: input.name,
1167
1169
  mimeType: input.mimeType,
1168
1170
  duration: input.duration,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-ts/core",
3
- "version": "11.1.0",
3
+ "version": "12.0.0",
4
4
  "description": "The spectrum-ts runtime — Spectrum, content builders, fusor, and the provider authoring API.",
5
5
  "repository": {
6
6
  "type": "git",