@spectrum-ts/core 9.3.1 → 10.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
@@ -27,7 +27,7 @@ The fastest way to ship is with **Spectrum Cloud** — hosted infrastructure for
27
27
 
28
28
  1. Sign up at **[app.photon.codes](https://app.photon.codes)** to get your project ID and secret.
29
29
  2. Install the SDK (`spectrum-ts` is batteries-included — the runtime plus
30
- every official provider):
30
+ the standard provider set):
31
31
 
32
32
  ```bash
33
33
  bun add spectrum-ts
@@ -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
- providers: [imessage.config()],
45
+ platforms: [imessage.config()],
46
46
  });
47
47
 
48
48
  for await (const [space, message] of app.messages) {
@@ -52,7 +52,7 @@ The fastest way to ship is with **Spectrum Cloud** — hosted infrastructure for
52
52
  }
53
53
  ```
54
54
 
55
- Spectrum also runs fully standalone — you can connect to a local iMessage database, bring your own gRPC endpoints, or build your own platform provider. See the [docs](https://docs.photon.codes) for self-hosted setups.
55
+ Spectrum also runs fully standalone — you can connect to a local iMessage database with the separate [`@spectrum-ts/imessage-local`](https://npmjs.com/package/@spectrum-ts/imessage-local) package, bring your own gRPC endpoints, or build your own platform provider. See the [docs](https://docs.photon.codes) for self-hosted setups.
56
56
 
57
57
  ## Documentation
58
58
 
@@ -63,13 +63,14 @@ Visit **[docs.photon.codes](https://docs.photon.codes)** to view the full docume
63
63
  | Platform | Package |
64
64
  |----------|---------|
65
65
  | iMessage | [`@spectrum-ts/imessage`](https://npmjs.com/package/@spectrum-ts/imessage) |
66
+ | Local iMessage | [`@spectrum-ts/imessage-local`](https://npmjs.com/package/@spectrum-ts/imessage-local) (explicit install only) |
66
67
  | WhatsApp Business | [`@spectrum-ts/whatsapp-business`](https://npmjs.com/package/@spectrum-ts/whatsapp-business) |
67
68
  | Telegram | [`@spectrum-ts/telegram`](https://npmjs.com/package/@spectrum-ts/telegram) |
68
69
  | Slack | [`@spectrum-ts/slack`](https://npmjs.com/package/@spectrum-ts/slack) |
69
70
  | Terminal | [`@spectrum-ts/terminal`](https://npmjs.com/package/@spectrum-ts/terminal) |
70
71
  | Custom | `definePlatform` from `spectrum-ts` |
71
72
 
72
- `bun add spectrum-ts` is batteries-included (all providers). For a smaller install, depend on the runtime plus only the providers you use — `bun add @spectrum-ts/core @spectrum-ts/telegram` — and import from the scoped packages directly. Either way the `spectrum-ts/providers/<platform>` import paths work as long as the matching provider package is installed; if it isn't, the import fails at build/startup naming the exact package to add.
73
+ `bun add spectrum-ts` is batteries-included (the standard provider set; local iMessage is an explicit install). For a smaller install, depend on the runtime plus only the providers you use — `bun add @spectrum-ts/core @spectrum-ts/telegram` — and import from the scoped packages directly. Either way the `spectrum-ts/providers/<platform>` import paths work as long as the matching provider package is installed; if it isn't, the import fails at build/startup naming the exact package to add.
73
74
 
74
75
  ## Issues
75
76
 
@@ -594,6 +594,14 @@ declare const editSchema: z.ZodObject<{
594
594
  content: z.ZodCustom<{
595
595
  type: "custom";
596
596
  raw: unknown;
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;
597
605
  } | {
598
606
  type: "contact";
599
607
  user?: {
@@ -637,20 +645,39 @@ 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
648
  } | {
649
649
  type: "text";
650
650
  text: string;
651
651
  } | {
652
652
  type: "markdown";
653
653
  markdown: string;
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>>;
661
+ } | {
662
+ type: "poll";
663
+ title: string;
664
+ options: {
665
+ title: string;
666
+ }[];
667
+ } | {
668
+ type: "poll_option";
669
+ option: {
670
+ title: string;
671
+ };
672
+ poll: {
673
+ type: "poll";
674
+ title: string;
675
+ options: {
676
+ title: string;
677
+ }[];
678
+ };
679
+ selected: boolean;
680
+ title: string;
654
681
  } | {
655
682
  type: "streamText";
656
683
  stream: () => AsyncIterable<string>;
@@ -680,33 +707,6 @@ declare const editSchema: z.ZodObject<{
680
707
  summary: z.ZodOptional<z.ZodString>;
681
708
  }, z.core.$strip>>>;
682
709
  live?: boolean | undefined;
683
- } | {
684
- type: "reaction";
685
- emoji: string;
686
- target: Message<string, User, Space<unknown>>;
687
- } | {
688
- type: "group";
689
- items: Message<string, User, Space<unknown>>[];
690
- } | {
691
- type: "poll";
692
- title: string;
693
- options: {
694
- title: string;
695
- }[];
696
- } | {
697
- type: "poll_option";
698
- option: {
699
- title: string;
700
- };
701
- poll: {
702
- type: "poll";
703
- title: string;
704
- options: {
705
- title: string;
706
- }[];
707
- };
708
- selected: boolean;
709
- title: string;
710
710
  } | {
711
711
  type: "effect";
712
712
  content: {
@@ -751,6 +751,14 @@ declare const editSchema: z.ZodObject<{
751
751
  }, {
752
752
  type: "custom";
753
753
  raw: unknown;
754
+ } | {
755
+ type: "attachment";
756
+ id: string;
757
+ name: string;
758
+ mimeType: string;
759
+ read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
760
+ stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
761
+ size?: number | undefined;
754
762
  } | {
755
763
  type: "contact";
756
764
  user?: {
@@ -794,20 +802,39 @@ declare const editSchema: z.ZodObject<{
794
802
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
795
803
  } | undefined;
796
804
  raw?: unknown;
797
- } | {
798
- type: "attachment";
799
- id: string;
800
- name: string;
801
- mimeType: string;
802
- read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
803
- stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
804
- size?: number | undefined;
805
805
  } | {
806
806
  type: "text";
807
807
  text: string;
808
808
  } | {
809
809
  type: "markdown";
810
810
  markdown: string;
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>>;
818
+ } | {
819
+ type: "poll";
820
+ title: string;
821
+ options: {
822
+ title: string;
823
+ }[];
824
+ } | {
825
+ type: "poll_option";
826
+ option: {
827
+ title: string;
828
+ };
829
+ poll: {
830
+ type: "poll";
831
+ title: string;
832
+ options: {
833
+ title: string;
834
+ }[];
835
+ };
836
+ selected: boolean;
837
+ title: string;
811
838
  } | {
812
839
  type: "streamText";
813
840
  stream: () => AsyncIterable<string>;
@@ -837,33 +864,6 @@ declare const editSchema: z.ZodObject<{
837
864
  summary: z.ZodOptional<z.ZodString>;
838
865
  }, z.core.$strip>>>;
839
866
  live?: boolean | undefined;
840
- } | {
841
- type: "reaction";
842
- emoji: string;
843
- target: Message<string, User, Space<unknown>>;
844
- } | {
845
- type: "group";
846
- items: Message<string, User, Space<unknown>>[];
847
- } | {
848
- type: "poll";
849
- title: string;
850
- options: {
851
- title: string;
852
- }[];
853
- } | {
854
- type: "poll_option";
855
- option: {
856
- title: string;
857
- };
858
- poll: {
859
- type: "poll";
860
- title: string;
861
- options: {
862
- title: string;
863
- }[];
864
- };
865
- selected: boolean;
866
- title: string;
867
867
  } | {
868
868
  type: "effect";
869
869
  content: {
@@ -1138,6 +1138,14 @@ declare const replySchema: z.ZodObject<{
1138
1138
  content: z.ZodCustom<{
1139
1139
  type: "custom";
1140
1140
  raw: unknown;
1141
+ } | {
1142
+ type: "attachment";
1143
+ id: string;
1144
+ name: string;
1145
+ mimeType: string;
1146
+ read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
1147
+ stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
1148
+ size?: number | undefined;
1141
1149
  } | {
1142
1150
  type: "contact";
1143
1151
  user?: {
@@ -1181,20 +1189,39 @@ declare const replySchema: z.ZodObject<{
1181
1189
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
1182
1190
  } | undefined;
1183
1191
  raw?: unknown;
1184
- } | {
1185
- type: "attachment";
1186
- id: string;
1187
- name: string;
1188
- mimeType: string;
1189
- read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
1190
- stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
1191
- size?: number | undefined;
1192
1192
  } | {
1193
1193
  type: "text";
1194
1194
  text: string;
1195
1195
  } | {
1196
1196
  type: "markdown";
1197
1197
  markdown: string;
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>>;
1205
+ } | {
1206
+ type: "poll";
1207
+ title: string;
1208
+ options: {
1209
+ title: string;
1210
+ }[];
1211
+ } | {
1212
+ type: "poll_option";
1213
+ option: {
1214
+ title: string;
1215
+ };
1216
+ poll: {
1217
+ type: "poll";
1218
+ title: string;
1219
+ options: {
1220
+ title: string;
1221
+ }[];
1222
+ };
1223
+ selected: boolean;
1224
+ title: string;
1198
1225
  } | {
1199
1226
  type: "streamText";
1200
1227
  stream: () => AsyncIterable<string>;
@@ -1224,33 +1251,6 @@ declare const replySchema: z.ZodObject<{
1224
1251
  summary: z.ZodOptional<z.ZodString>;
1225
1252
  }, z.core.$strip>>>;
1226
1253
  live?: boolean | undefined;
1227
- } | {
1228
- type: "reaction";
1229
- emoji: string;
1230
- target: Message<string, User, Space<unknown>>;
1231
- } | {
1232
- type: "group";
1233
- items: Message<string, User, Space<unknown>>[];
1234
- } | {
1235
- type: "poll";
1236
- title: string;
1237
- options: {
1238
- title: string;
1239
- }[];
1240
- } | {
1241
- type: "poll_option";
1242
- option: {
1243
- title: string;
1244
- };
1245
- poll: {
1246
- type: "poll";
1247
- title: string;
1248
- options: {
1249
- title: string;
1250
- }[];
1251
- };
1252
- selected: boolean;
1253
- title: string;
1254
1254
  } | {
1255
1255
  type: "effect";
1256
1256
  content: {
@@ -1295,6 +1295,14 @@ declare const replySchema: z.ZodObject<{
1295
1295
  }, {
1296
1296
  type: "custom";
1297
1297
  raw: unknown;
1298
+ } | {
1299
+ type: "attachment";
1300
+ id: string;
1301
+ name: string;
1302
+ mimeType: string;
1303
+ read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
1304
+ stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
1305
+ size?: number | undefined;
1298
1306
  } | {
1299
1307
  type: "contact";
1300
1308
  user?: {
@@ -1338,20 +1346,39 @@ declare const replySchema: z.ZodObject<{
1338
1346
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
1339
1347
  } | undefined;
1340
1348
  raw?: unknown;
1341
- } | {
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;
1349
1349
  } | {
1350
1350
  type: "text";
1351
1351
  text: string;
1352
1352
  } | {
1353
1353
  type: "markdown";
1354
1354
  markdown: string;
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>>;
1362
+ } | {
1363
+ type: "poll";
1364
+ title: string;
1365
+ options: {
1366
+ title: string;
1367
+ }[];
1368
+ } | {
1369
+ type: "poll_option";
1370
+ option: {
1371
+ title: string;
1372
+ };
1373
+ poll: {
1374
+ type: "poll";
1375
+ title: string;
1376
+ options: {
1377
+ title: string;
1378
+ }[];
1379
+ };
1380
+ selected: boolean;
1381
+ title: string;
1355
1382
  } | {
1356
1383
  type: "streamText";
1357
1384
  stream: () => AsyncIterable<string>;
@@ -1381,33 +1408,6 @@ declare const replySchema: z.ZodObject<{
1381
1408
  summary: z.ZodOptional<z.ZodString>;
1382
1409
  }, z.core.$strip>>>;
1383
1410
  live?: boolean | undefined;
1384
- } | {
1385
- type: "reaction";
1386
- emoji: string;
1387
- target: Message<string, User, Space<unknown>>;
1388
- } | {
1389
- type: "group";
1390
- items: Message<string, User, Space<unknown>>[];
1391
- } | {
1392
- type: "poll";
1393
- title: string;
1394
- options: {
1395
- title: string;
1396
- }[];
1397
- } | {
1398
- type: "poll_option";
1399
- option: {
1400
- title: string;
1401
- };
1402
- poll: {
1403
- type: "poll";
1404
- title: string;
1405
- options: {
1406
- title: string;
1407
- }[];
1408
- };
1409
- selected: boolean;
1410
- title: string;
1411
1411
  } | {
1412
1412
  type: "effect";
1413
1413
  content: {
@@ -6872,24 +6872,28 @@ interface SpectrumOptions {
6872
6872
  */
6873
6873
  logLevel?: LogLevel;
6874
6874
  }
6875
- declare function Spectrum<const Providers extends PlatformProviderConfig[]>(options: {
6876
- projectId: string;
6877
- projectSecret: string;
6875
+ type PlatformSelection<Providers extends PlatformProviderConfig[]> = {
6876
+ platforms: [...Providers];
6877
+ providers?: never;
6878
+ } | {
6879
+ platforms?: never;
6878
6880
  providers: [...Providers];
6881
+ };
6882
+ type SpectrumFactoryOptions<Providers extends PlatformProviderConfig[]> = PlatformSelection<Providers> & {
6879
6883
  options?: SpectrumOptions;
6880
6884
  telemetry?: boolean;
6881
6885
  webhookSecret?: string;
6882
- }): Promise<SpectrumInstance<Providers> & {
6886
+ };
6887
+ declare function Spectrum<const Providers extends PlatformProviderConfig[]>(options: {
6888
+ projectId: string;
6889
+ projectSecret: string;
6890
+ } & SpectrumFactoryOptions<Providers>): Promise<SpectrumInstance<Providers> & {
6883
6891
  readonly config: ProjectData;
6884
6892
  }>;
6885
6893
  declare function Spectrum<const Providers extends PlatformProviderConfig[]>(options: {
6886
6894
  projectId?: never;
6887
6895
  projectSecret?: never;
6888
- providers: [...Providers];
6889
- options?: SpectrumOptions;
6890
- telemetry?: boolean;
6891
- webhookSecret?: string;
6892
- }): Promise<SpectrumInstance<Providers>>;
6896
+ } & SpectrumFactoryOptions<Providers>): Promise<SpectrumInstance<Providers>>;
6893
6897
  //#endregion
6894
6898
  //#region src/utils/errors.d.ts
6895
6899
  type UnsupportedKind = "content" | "action";
@@ -7276,6 +7280,14 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7276
7280
  content: z.ZodCustom<{
7277
7281
  type: "custom";
7278
7282
  raw: unknown;
7283
+ } | {
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;
7279
7291
  } | {
7280
7292
  type: "contact";
7281
7293
  user?: {
@@ -7319,20 +7331,39 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7319
7331
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7320
7332
  } | undefined;
7321
7333
  raw?: unknown;
7322
- } | {
7323
- type: "attachment";
7324
- id: string;
7325
- name: string;
7326
- mimeType: string;
7327
- read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7328
- stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
7329
- size?: number | undefined;
7330
7334
  } | {
7331
7335
  type: "text";
7332
7336
  text: string;
7333
7337
  } | {
7334
7338
  type: "markdown";
7335
7339
  markdown: string;
7340
+ } | {
7341
+ type: "group";
7342
+ items: Message<string, User, Space<unknown>>[];
7343
+ } | {
7344
+ type: "reaction";
7345
+ emoji: string;
7346
+ target: Message<string, User, Space<unknown>>;
7347
+ } | {
7348
+ type: "poll";
7349
+ title: string;
7350
+ options: {
7351
+ title: string;
7352
+ }[];
7353
+ } | {
7354
+ type: "poll_option";
7355
+ option: {
7356
+ title: string;
7357
+ };
7358
+ poll: {
7359
+ type: "poll";
7360
+ title: string;
7361
+ options: {
7362
+ title: string;
7363
+ }[];
7364
+ };
7365
+ selected: boolean;
7366
+ title: string;
7336
7367
  } | {
7337
7368
  type: "streamText";
7338
7369
  stream: () => AsyncIterable<string>;
@@ -7362,33 +7393,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7362
7393
  summary: z.ZodOptional<z.ZodString>;
7363
7394
  }, z.core.$strip>>>;
7364
7395
  live?: boolean | undefined;
7365
- } | {
7366
- type: "reaction";
7367
- emoji: string;
7368
- target: Message<string, User, Space<unknown>>;
7369
- } | {
7370
- type: "group";
7371
- items: Message<string, User, Space<unknown>>[];
7372
- } | {
7373
- type: "poll";
7374
- title: string;
7375
- options: {
7376
- title: string;
7377
- }[];
7378
- } | {
7379
- type: "poll_option";
7380
- option: {
7381
- title: string;
7382
- };
7383
- poll: {
7384
- type: "poll";
7385
- title: string;
7386
- options: {
7387
- title: string;
7388
- }[];
7389
- };
7390
- selected: boolean;
7391
- title: string;
7392
7396
  } | {
7393
7397
  type: "effect";
7394
7398
  content: {
@@ -7433,6 +7437,14 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7433
7437
  }, {
7434
7438
  type: "custom";
7435
7439
  raw: unknown;
7440
+ } | {
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;
7436
7448
  } | {
7437
7449
  type: "contact";
7438
7450
  user?: {
@@ -7476,20 +7488,39 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7476
7488
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7477
7489
  } | undefined;
7478
7490
  raw?: unknown;
7479
- } | {
7480
- type: "attachment";
7481
- id: string;
7482
- name: string;
7483
- mimeType: string;
7484
- read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7485
- stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
7486
- size?: number | undefined;
7487
7491
  } | {
7488
7492
  type: "text";
7489
7493
  text: string;
7490
7494
  } | {
7491
7495
  type: "markdown";
7492
7496
  markdown: string;
7497
+ } | {
7498
+ type: "group";
7499
+ items: Message<string, User, Space<unknown>>[];
7500
+ } | {
7501
+ type: "reaction";
7502
+ emoji: string;
7503
+ target: Message<string, User, Space<unknown>>;
7504
+ } | {
7505
+ type: "poll";
7506
+ title: string;
7507
+ options: {
7508
+ title: string;
7509
+ }[];
7510
+ } | {
7511
+ type: "poll_option";
7512
+ option: {
7513
+ title: string;
7514
+ };
7515
+ poll: {
7516
+ type: "poll";
7517
+ title: string;
7518
+ options: {
7519
+ title: string;
7520
+ }[];
7521
+ };
7522
+ selected: boolean;
7523
+ title: string;
7493
7524
  } | {
7494
7525
  type: "streamText";
7495
7526
  stream: () => AsyncIterable<string>;
@@ -7519,33 +7550,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7519
7550
  summary: z.ZodOptional<z.ZodString>;
7520
7551
  }, z.core.$strip>>>;
7521
7552
  live?: boolean | undefined;
7522
- } | {
7523
- type: "reaction";
7524
- emoji: string;
7525
- target: Message<string, User, Space<unknown>>;
7526
- } | {
7527
- type: "group";
7528
- items: Message<string, User, Space<unknown>>[];
7529
- } | {
7530
- type: "poll";
7531
- title: string;
7532
- options: {
7533
- title: string;
7534
- }[];
7535
- } | {
7536
- type: "poll_option";
7537
- option: {
7538
- title: string;
7539
- };
7540
- poll: {
7541
- type: "poll";
7542
- title: string;
7543
- options: {
7544
- title: string;
7545
- }[];
7546
- };
7547
- selected: boolean;
7548
- title: string;
7549
7553
  } | {
7550
7554
  type: "effect";
7551
7555
  content: {
@@ -7594,6 +7598,14 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7594
7598
  content: z.ZodCustom<{
7595
7599
  type: "custom";
7596
7600
  raw: unknown;
7601
+ } | {
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;
7597
7609
  } | {
7598
7610
  type: "contact";
7599
7611
  user?: {
@@ -7637,20 +7649,39 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7637
7649
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7638
7650
  } | undefined;
7639
7651
  raw?: unknown;
7640
- } | {
7641
- type: "attachment";
7642
- id: string;
7643
- name: string;
7644
- mimeType: string;
7645
- read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7646
- stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
7647
- size?: number | undefined;
7648
7652
  } | {
7649
7653
  type: "text";
7650
7654
  text: string;
7651
7655
  } | {
7652
7656
  type: "markdown";
7653
7657
  markdown: string;
7658
+ } | {
7659
+ type: "group";
7660
+ items: Message<string, User, Space<unknown>>[];
7661
+ } | {
7662
+ type: "reaction";
7663
+ emoji: string;
7664
+ target: Message<string, User, Space<unknown>>;
7665
+ } | {
7666
+ type: "poll";
7667
+ title: string;
7668
+ options: {
7669
+ title: string;
7670
+ }[];
7671
+ } | {
7672
+ type: "poll_option";
7673
+ option: {
7674
+ title: string;
7675
+ };
7676
+ poll: {
7677
+ type: "poll";
7678
+ title: string;
7679
+ options: {
7680
+ title: string;
7681
+ }[];
7682
+ };
7683
+ selected: boolean;
7684
+ title: string;
7654
7685
  } | {
7655
7686
  type: "streamText";
7656
7687
  stream: () => AsyncIterable<string>;
@@ -7680,33 +7711,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7680
7711
  summary: z.ZodOptional<z.ZodString>;
7681
7712
  }, z.core.$strip>>>;
7682
7713
  live?: boolean | undefined;
7683
- } | {
7684
- type: "reaction";
7685
- emoji: string;
7686
- target: Message<string, User, Space<unknown>>;
7687
- } | {
7688
- type: "group";
7689
- items: Message<string, User, Space<unknown>>[];
7690
- } | {
7691
- type: "poll";
7692
- title: string;
7693
- options: {
7694
- title: string;
7695
- }[];
7696
- } | {
7697
- type: "poll_option";
7698
- option: {
7699
- title: string;
7700
- };
7701
- poll: {
7702
- type: "poll";
7703
- title: string;
7704
- options: {
7705
- title: string;
7706
- }[];
7707
- };
7708
- selected: boolean;
7709
- title: string;
7710
7714
  } | {
7711
7715
  type: "effect";
7712
7716
  content: {
@@ -7751,6 +7755,14 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7751
7755
  }, {
7752
7756
  type: "custom";
7753
7757
  raw: unknown;
7758
+ } | {
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;
7754
7766
  } | {
7755
7767
  type: "contact";
7756
7768
  user?: {
@@ -7794,20 +7806,39 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7794
7806
  read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7795
7807
  } | undefined;
7796
7808
  raw?: unknown;
7797
- } | {
7798
- type: "attachment";
7799
- id: string;
7800
- name: string;
7801
- mimeType: string;
7802
- read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
7803
- stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
7804
- size?: number | undefined;
7805
7809
  } | {
7806
7810
  type: "text";
7807
7811
  text: string;
7808
7812
  } | {
7809
7813
  type: "markdown";
7810
7814
  markdown: string;
7815
+ } | {
7816
+ type: "group";
7817
+ items: Message<string, User, Space<unknown>>[];
7818
+ } | {
7819
+ type: "reaction";
7820
+ emoji: string;
7821
+ target: Message<string, User, Space<unknown>>;
7822
+ } | {
7823
+ type: "poll";
7824
+ title: string;
7825
+ options: {
7826
+ title: string;
7827
+ }[];
7828
+ } | {
7829
+ type: "poll_option";
7830
+ option: {
7831
+ title: string;
7832
+ };
7833
+ poll: {
7834
+ type: "poll";
7835
+ title: string;
7836
+ options: {
7837
+ title: string;
7838
+ }[];
7839
+ };
7840
+ selected: boolean;
7841
+ title: string;
7811
7842
  } | {
7812
7843
  type: "streamText";
7813
7844
  stream: () => AsyncIterable<string>;
@@ -7837,33 +7868,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7837
7868
  summary: z.ZodOptional<z.ZodString>;
7838
7869
  }, z.core.$strip>>>;
7839
7870
  live?: boolean | undefined;
7840
- } | {
7841
- type: "reaction";
7842
- emoji: string;
7843
- target: Message<string, User, Space<unknown>>;
7844
- } | {
7845
- type: "group";
7846
- items: Message<string, User, Space<unknown>>[];
7847
- } | {
7848
- type: "poll";
7849
- title: string;
7850
- options: {
7851
- title: string;
7852
- }[];
7853
- } | {
7854
- type: "poll_option";
7855
- option: {
7856
- title: string;
7857
- };
7858
- poll: {
7859
- type: "poll";
7860
- title: string;
7861
- options: {
7862
- title: string;
7863
- }[];
7864
- };
7865
- selected: boolean;
7866
- title: string;
7867
7871
  } | {
7868
7872
  type: "effect";
7869
7873
  content: {
@@ -1,4 +1,4 @@
1
- import { At as asReply, Cn as asCustom, Ct as asText, Et as asRichlink, Ft as renameSchema, H as ProviderMessageRecord, Hn as PhotoInput, Jt as asMarkdown, Lt as asRead, Mt as replySchema, Nn as asContact, Sn as reactionSchema, U as ProviderUserRecord, Un as buildPhotoAction, Ut as asPoll, Vn as avatarSchema, Wn as photoActionSchema, Wt as asPollOption, _n as removeMemberSchema, _t as asVoice, bn as asReaction, hn as leaveSpaceSchema, pn as addMemberSchema, q as ManagedStream, r as asAttachment, rn as groupSchema, tn as asGroup } from "./attachment-ChqzKngn.js";
1
+ import { At as asReply, Cn as asCustom, Ct as asText, Et as asRichlink, Ft as renameSchema, H as ProviderMessageRecord, Hn as PhotoInput, Jt as asMarkdown, Lt as asRead, Mt as replySchema, Nn as asContact, Sn as reactionSchema, U as ProviderUserRecord, Un as buildPhotoAction, Ut as asPoll, Vn as avatarSchema, Wn as photoActionSchema, Wt as asPollOption, _n as removeMemberSchema, _t as asVoice, bn as asReaction, hn as leaveSpaceSchema, pn as addMemberSchema, q as ManagedStream, r as asAttachment, rn as groupSchema, tn as asGroup } from "./attachment-CxF8ejPo.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/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as DedicatedTokenData, $t as TextStreamOptions, A as isFusorEvent, An as ContactName, B as PlatformUser, Bn as avatar, Bt as PollChoice, C as FusorVerify, D as WebhookRawResult, Dn as ContactDetails, Dt as richlink, E as WebhookRawRequest, En as ContactAddress, F as PlatformInstance, Fn as AgentSender, G as SpaceNamespace, Gn as App, Gt as option, Ht as PollOption, I as PlatformMessage, In as User, It as Read, J as broadcast, Jn as AppUrl, K as Broadcaster, Kn as AppLayout, Kt as poll, L as PlatformProviderConfig, Ln as Avatar, M as EventProducer, Mn as ContactPhone, N as Platform, Nt as Rename, O as FusorEvent, On as ContactEmail, Ot as resolveContents, P as PlatformDef, Pn as contact, Pt as rename, Q as CloudPlatform, Qt as StreamTextSource, R as PlatformRuntime, Rn as AvatarData, Rt as read, S as FusorRespond, St as typing, T as WebhookHandler, Tn as Contact, Tt as Richlink, V as ProviderMessage, Vt as PollChoiceInput, W as SchemaMessage, X as stream, Xn as appLayoutSchema, Xt as DeltaExtractor, Y as mergeStreams, Yn as app, Yt as markdown, Z as Store, Zt as StreamText, _ as FusorClient, a as Content, an as edit, at as ProjectProfile, b as FusorMessagesReturn, bt as unsend, c as fromVCard, cn as AddMember, ct as SlackTokenData, d as UnsupportedKind, dn as RemoveMember, dt as SubscriptionStatus, en as Group, et as FusorTokenData, f as Spectrum, fn as addMember, ft as TokenData, g as isFusorClient, gn as removeMember, gt as Voice, h as fusor, ht as EmojiKey, i as attachment, in as Edit, it as ProjectData, j as AnyPlatformDef, jn as ContactOrg, jt as reply, k as fusorEvent, kn as ContactInput, kt as Reply, l as toVCard, ln as LeaveSpace, lt as SpectrumCloudError, m as definePlatform, mn as leaveSpace, mt as Emoji, n as AttachmentInput, nn as group, nt as PlatformStatus, o as ContentBuilder, on as Message, ot as SharedTokenData, p as SpectrumInstance, pt as cloud, q as ManagedStream, qn as AppOptions, qt as Markdown, rt as PlatformsData, s as ContentInput, sn as Space, st as SlackTeamMeta, t as Attachment, tt as ImessageInfoData, u as UnsupportedError, un as MemberInput, ut as SubscriptionData, v as FusorMessages, vn as Reaction, vt as voice, w as FusorVerifyRequest, wn as custom, wt as text, x as FusorReply, xn as reaction, xt as Typing, y as FusorMessagesCtx, yn as ReactionBuilder, yt as Unsend, z as PlatformSpace, zn as AvatarInput, zt as Poll } from "./attachment-ChqzKngn.js";
1
+ import { $ as DedicatedTokenData, $t as TextStreamOptions, A as isFusorEvent, An as ContactName, B as PlatformUser, Bn as avatar, Bt as PollChoice, C as FusorVerify, D as WebhookRawResult, Dn as ContactDetails, Dt as richlink, E as WebhookRawRequest, En as ContactAddress, F as PlatformInstance, Fn as AgentSender, G as SpaceNamespace, Gn as App, Gt as option, Ht as PollOption, I as PlatformMessage, In as User, It as Read, J as broadcast, Jn as AppUrl, K as Broadcaster, Kn as AppLayout, Kt as poll, L as PlatformProviderConfig, Ln as Avatar, M as EventProducer, Mn as ContactPhone, N as Platform, Nt as Rename, O as FusorEvent, On as ContactEmail, Ot as resolveContents, P as PlatformDef, Pn as contact, Pt as rename, Q as CloudPlatform, Qt as StreamTextSource, R as PlatformRuntime, Rn as AvatarData, Rt as read, S as FusorRespond, St as typing, T as WebhookHandler, Tn as Contact, Tt as Richlink, V as ProviderMessage, Vt as PollChoiceInput, W as SchemaMessage, X as stream, Xn as appLayoutSchema, Xt as DeltaExtractor, Y as mergeStreams, Yn as app, Yt as markdown, Z as Store, Zt as StreamText, _ as FusorClient, a as Content, an as edit, at as ProjectProfile, b as FusorMessagesReturn, bt as unsend, c as fromVCard, cn as AddMember, ct as SlackTokenData, d as UnsupportedKind, dn as RemoveMember, dt as SubscriptionStatus, en as Group, et as FusorTokenData, f as Spectrum, fn as addMember, ft as TokenData, g as isFusorClient, gn as removeMember, gt as Voice, h as fusor, ht as EmojiKey, i as attachment, in as Edit, it as ProjectData, j as AnyPlatformDef, jn as ContactOrg, jt as reply, k as fusorEvent, kn as ContactInput, kt as Reply, l as toVCard, ln as LeaveSpace, lt as SpectrumCloudError, m as definePlatform, mn as leaveSpace, mt as Emoji, n as AttachmentInput, nn as group, nt as PlatformStatus, o as ContentBuilder, on as Message, ot as SharedTokenData, p as SpectrumInstance, pt as cloud, q as ManagedStream, qn as AppOptions, qt as Markdown, rt as PlatformsData, s as ContentInput, sn as Space, st as SlackTeamMeta, t as Attachment, tt as ImessageInfoData, u as UnsupportedError, un as MemberInput, ut as SubscriptionData, v as FusorMessages, vn as Reaction, vt as voice, w as FusorVerifyRequest, wn as custom, wt as text, x as FusorReply, xn as reaction, xt as Typing, y as FusorMessagesCtx, yn as ReactionBuilder, yt as Unsend, z as PlatformSpace, zn as AvatarInput, zt as Poll } from "./attachment-CxF8ejPo.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
@@ -3051,7 +3051,7 @@ function definePlatform(name, rawDef) {
3051
3051
  }
3052
3052
  //#endregion
3053
3053
  //#region src/build-env.ts
3054
- const SPECTRUM_SDK_VERSION = "9.3.1";
3054
+ const SPECTRUM_SDK_VERSION = "10.0.0";
3055
3055
  //#endregion
3056
3056
  //#region src/utils/provider-packages.ts
3057
3057
  const OFFICIAL_PROVIDER_PACKAGES = {
@@ -3073,7 +3073,7 @@ const installCommand = (pkg) => process.versions.bun ? `bun add ${pkg}` : `npm i
3073
3073
  const officialProviderInstallHint = (platform) => {
3074
3074
  const pkg = officialProviderPackage(platform);
3075
3075
  if (!pkg) return;
3076
- return `the "${platform}" platform is provided by the optional package ${pkg} — install it (\`${installCommand(pkg)}\`) and pass it to Spectrum({ providers: [...] })`;
3076
+ return `the "${platform}" platform is provided by the optional package ${pkg} — install it (\`${installCommand(pkg)}\`) and pass it to Spectrum({ platforms: [...] })`;
3077
3077
  };
3078
3078
  //#endregion
3079
3079
  //#region src/utils/cloud.ts
@@ -4058,18 +4058,20 @@ const spectrumOptionsSchema = z.object({
4058
4058
  const spectrumConfigSchema = z.union([z.object({
4059
4059
  projectId: z.string().min(1),
4060
4060
  projectSecret: z.string().min(1),
4061
- providers: z.array(z.custom()),
4061
+ providers: z.array(z.custom()).optional(),
4062
+ platforms: z.array(z.custom()).optional(),
4062
4063
  options: spectrumOptionsSchema,
4063
4064
  telemetry: z.boolean().optional(),
4064
4065
  webhookSecret: z.string().min(1).optional()
4065
4066
  }), z.object({
4066
4067
  projectId: z.undefined().optional(),
4067
4068
  projectSecret: z.undefined().optional(),
4068
- providers: z.array(z.custom()),
4069
+ providers: z.array(z.custom()).optional(),
4070
+ platforms: z.array(z.custom()).optional(),
4069
4071
  options: spectrumOptionsSchema,
4070
4072
  telemetry: z.boolean().optional(),
4071
4073
  webhookSecret: z.string().min(1).optional()
4072
- })]);
4074
+ })]).refine((config) => config.providers === void 0 !== (config.platforms === void 0), "Spectrum requires exactly one of platforms or providers");
4073
4075
  function bootstrapTelemetry(opts) {
4074
4076
  const headers = {};
4075
4077
  if (opts.projectId && opts.projectSecret) {
@@ -4101,6 +4103,11 @@ function resolveProjectCredentials(options) {
4101
4103
  projectSecret: options.projectSecret ?? envValue(envFor("PROJECT", "SECRET"))
4102
4104
  };
4103
4105
  }
4106
+ const resolveConfiguredProviders = (options) => {
4107
+ const configuredProviders = options.platforms ?? options.providers;
4108
+ if (!configuredProviders) throw new Error("Spectrum requires platforms or providers");
4109
+ return configuredProviders;
4110
+ };
4104
4111
  async function Spectrum(options) {
4105
4112
  const { projectId, projectSecret } = resolveProjectCredentials(options);
4106
4113
  spectrumConfigSchema.parse({
@@ -4108,7 +4115,8 @@ async function Spectrum(options) {
4108
4115
  projectId,
4109
4116
  projectSecret
4110
4117
  });
4111
- const { providers, options: runtimeOptions, telemetry, webhookSecret } = options;
4118
+ const providers = resolveConfiguredProviders(options);
4119
+ const { options: runtimeOptions, telemetry, webhookSecret } = options;
4112
4120
  const flattenGroups = runtimeOptions?.flattenGroups ?? false;
4113
4121
  applyLogLevel(runtimeOptions?.logLevel);
4114
4122
  const resolvedWebhookSecret = webhookSecret ?? process.env[envFor("WEBHOOK", "SECRET")];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-ts/core",
3
- "version": "9.3.1",
3
+ "version": "10.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",