spectrum-ts 1.17.1 → 2.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.
Files changed (36) hide show
  1. package/README.md +11 -1
  2. package/dist/{attachment-DfWSZS5L.d.ts → attachment-B4nSrKVd.d.ts} +1 -1
  3. package/dist/{authoring-C9uDdZ2F.d.ts → authoring-BjE5BvlO.d.ts} +2 -2
  4. package/dist/authoring.d.ts +3 -3
  5. package/dist/authoring.js +6 -3
  6. package/dist/chunk-34FQGGD7.js +34 -0
  7. package/dist/chunk-3B4QH4JG.js +35 -0
  8. package/dist/chunk-3GEJYGZK.js +84 -0
  9. package/dist/chunk-5LT5J3NR.js +695 -0
  10. package/dist/{chunk-MC6ZKFSG.js → chunk-5XEFJBN2.js} +25 -103
  11. package/dist/{chunk-JQN6CRSC.js → chunk-6BI4PFTP.js} +10 -39
  12. package/dist/{chunk-QGJFZMD5.js → chunk-6UZFVXQF.js} +17 -101
  13. package/dist/{chunk-YJMPSD3S.js → chunk-ATNAE7OR.js} +196 -47
  14. package/dist/{chunk-IPOFBAIM.js → chunk-NGC4DJIX.js} +23 -19
  15. package/dist/{chunk-5TIF3FIE.js → chunk-Q537JPTG.js} +8 -6
  16. package/dist/{chunk-5BKZJMZV.js → chunk-U3LXXT3W.js} +61 -32
  17. package/dist/chunk-U7AWXDH6.js +91 -0
  18. package/dist/{chunk-3OTECDNH.js → chunk-WXY5QP3M.js} +5 -3
  19. package/dist/index.d.ts +71 -126
  20. package/dist/index.js +350 -90
  21. package/dist/manifest.json +6 -0
  22. package/dist/providers/imessage/index.d.ts +75 -3
  23. package/dist/providers/imessage/index.js +10 -5
  24. package/dist/providers/index.d.ts +5 -2
  25. package/dist/providers/index.js +16 -8
  26. package/dist/providers/slack/index.d.ts +1 -1
  27. package/dist/providers/slack/index.js +4 -3
  28. package/dist/providers/telegram/index.d.ts +47 -0
  29. package/dist/providers/telegram/index.js +13 -0
  30. package/dist/providers/terminal/index.d.ts +17 -419
  31. package/dist/providers/terminal/index.js +5 -3
  32. package/dist/providers/whatsapp-business/index.d.ts +1 -1
  33. package/dist/providers/whatsapp-business/index.js +6 -4
  34. package/dist/types-BD0-kKyv.d.ts +82 -0
  35. package/dist/{types-DcQ5a7PK.d.ts → types-Bje8aq1k.d.ts} +34 -4
  36. package/package.json +3 -2
@@ -1,8 +1,8 @@
1
- import { C as ContentBuilder, c as ContentInput, M as Message, S as SchemaMessage, P as Platform, a as PlatformDef, b as Space, d as Store } from '../../types-DcQ5a7PK.js';
1
+ import { C as ContentBuilder, h as ContentInput, M as Message, S as SchemaMessage, P as Platform, a as PlatformDef, e as Space, c as Store } from '../../types-Bje8aq1k.js';
2
2
  import * as zod_v4_core from 'zod/v4/core';
3
3
  import * as z from 'zod';
4
4
  import z__default from 'zod';
5
- import { A as Attachment } from '../../attachment-DfWSZS5L.js';
5
+ import { A as Attachment } from '../../attachment-B4nSrKVd.js';
6
6
  import { P as PhotoInput } from '../../photo-content-BJKnqgN-.js';
7
7
  import { MessageEffect, AdvancedIMessage } from '@photon-ai/advanced-imessage';
8
8
  import { IMessageSDK } from '@photon-ai/imessage-kit';
@@ -39,6 +39,78 @@ declare function background(input: string | Buffer | URL, options?: {
39
39
  mimeType?: string;
40
40
  }): ContentBuilder;
41
41
 
42
+ /**
43
+ * Visible layout of a mini-app card. Mirrors Apple's
44
+ * `MSMessageTemplateLayout`. At least one of `caption`, `subcaption`,
45
+ * `trailingCaption`, `trailingSubcaption`, or `image` must be set so the
46
+ * bubble is not empty — `summary` is the fallback text shown on surfaces
47
+ * that cannot render the card (notifications, lock screen) and is not a
48
+ * visible slot on its own. `image` and `imageTitle` must be set together;
49
+ * `imageSubtitle` requires `image`.
50
+ */
51
+ declare const layoutSchema: z__default.ZodObject<{
52
+ caption: z__default.ZodOptional<z__default.ZodString>;
53
+ subcaption: z__default.ZodOptional<z__default.ZodString>;
54
+ trailingCaption: z__default.ZodOptional<z__default.ZodString>;
55
+ trailingSubcaption: z__default.ZodOptional<z__default.ZodString>;
56
+ image: z__default.ZodOptional<z__default.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>>;
57
+ imageTitle: z__default.ZodOptional<z__default.ZodString>;
58
+ imageSubtitle: z__default.ZodOptional<z__default.ZodString>;
59
+ summary: z__default.ZodOptional<z__default.ZodString>;
60
+ }, z__default.core.$strip>;
61
+ /**
62
+ * iMessage-only mini-app card content. Lives entirely under the iMessage
63
+ * provider — never enters the universal `Content` discriminated union. The
64
+ * framework recognizes it via the generic content-level platform contract:
65
+ *
66
+ * - `__platform: "iMessage"` — `findUnsupportedPlatformContent` reads this tag
67
+ * and warns-and-skips when a different platform receives it.
68
+ *
69
+ * Unlike `background` / `read`, this content is **not** `__fireAndForget`: it
70
+ * produces a real outbound message, so the iMessage `send` handler narrows
71
+ * back to `CustomizedMiniApp` via the `isCustomizedMiniApp` guard and returns
72
+ * the resulting `ProviderMessageRecord` (rather than `void`).
73
+ */
74
+ declare const customizedMiniAppSchema: z__default.ZodObject<{
75
+ type: z__default.ZodLiteral<"customized-mini-app">;
76
+ __platform: z__default.ZodLiteral<"iMessage">;
77
+ appName: z__default.ZodString;
78
+ appStoreId: z__default.ZodOptional<z__default.ZodNumber>;
79
+ extensionBundleId: z__default.ZodString;
80
+ layout: z__default.ZodObject<{
81
+ caption: z__default.ZodOptional<z__default.ZodString>;
82
+ subcaption: z__default.ZodOptional<z__default.ZodString>;
83
+ trailingCaption: z__default.ZodOptional<z__default.ZodString>;
84
+ trailingSubcaption: z__default.ZodOptional<z__default.ZodString>;
85
+ image: z__default.ZodOptional<z__default.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>>;
86
+ imageTitle: z__default.ZodOptional<z__default.ZodString>;
87
+ imageSubtitle: z__default.ZodOptional<z__default.ZodString>;
88
+ summary: z__default.ZodOptional<z__default.ZodString>;
89
+ }, z__default.core.$strip>;
90
+ teamId: z__default.ZodString;
91
+ url: z__default.ZodURL;
92
+ }, z__default.core.$strip>;
93
+ type CustomizedMiniApp = z__default.infer<typeof customizedMiniAppSchema>;
94
+ type CustomizedMiniAppLayout = z__default.infer<typeof layoutSchema>;
95
+ type CustomizedMiniAppInput = Omit<CustomizedMiniApp, "type" | "__platform">;
96
+ /**
97
+ * Construct a `customized-mini-app` content value. iMessage-only, remote-only.
98
+ *
99
+ * The layout is what recipients see in the bubble. `teamId` and
100
+ * `extensionBundleId` identify the iMessage extension that receives `url` when
101
+ * the recipient taps the card; the server constructs the matching
102
+ * `MSMessageExtensionBalloonPlugin` plugin id from these values. `appStoreId`
103
+ * is optional and only points recipients without the extension at its App
104
+ * Store entry.
105
+ *
106
+ * `space.send(customizedMiniApp(...))` is the canonical form.
107
+ *
108
+ * `CustomizedMiniApp` is intentionally not a member of the universal `Content`
109
+ * union — the `as unknown as Content` cast keeps the builder shape compatible
110
+ * with the framework's `ContentBuilder.build(): Promise<Content>` signature.
111
+ */
112
+ declare function customizedMiniApp(input: CustomizedMiniAppInput): ContentBuilder;
113
+
42
114
  type IMessageMessageEffect = MessageEffect;
43
115
  declare function effect(input: ContentInput, messageEffect: IMessageMessageEffect): ContentBuilder;
44
116
 
@@ -176,4 +248,4 @@ declare const imessage: Platform<PlatformDef<"iMessage", z.ZodUnion<readonly [z.
176
248
  };
177
249
  }>;
178
250
 
179
- export { type BackgroundInput, type IMessageMessageEffect, background, effect, imessage, read };
251
+ export { type BackgroundInput, type CustomizedMiniApp, type CustomizedMiniAppInput, type CustomizedMiniAppLayout, type IMessageMessageEffect, background, customizedMiniApp, effect, imessage, read };
@@ -1,18 +1,23 @@
1
1
  import { createRequire as __spectrumCreateRequire } from "node:module"; const require = __spectrumCreateRequire(import.meta.url);
2
2
  import {
3
3
  background,
4
+ customizedMiniApp,
4
5
  effect,
5
6
  imessage,
6
7
  read
7
- } from "../../chunk-YJMPSD3S.js";
8
- import "../../chunk-JQN6CRSC.js";
8
+ } from "../../chunk-ATNAE7OR.js";
9
+ import "../../chunk-6BI4PFTP.js";
10
+ import "../../chunk-3B4QH4JG.js";
9
11
  import "../../chunk-2D27WW5B.js";
10
- import "../../chunk-MC6ZKFSG.js";
11
- import "../../chunk-QGJFZMD5.js";
12
- import "../../chunk-IPOFBAIM.js";
12
+ import "../../chunk-3GEJYGZK.js";
13
+ import "../../chunk-U7AWXDH6.js";
14
+ import "../../chunk-5XEFJBN2.js";
15
+ import "../../chunk-6UZFVXQF.js";
16
+ import "../../chunk-NGC4DJIX.js";
13
17
  import "../../chunk-2ILTJC35.js";
14
18
  export {
15
19
  background,
20
+ customizedMiniApp,
16
21
  effect,
17
22
  imessage,
18
23
  read
@@ -1,16 +1,19 @@
1
1
  export { imessage } from './imessage/index.js';
2
2
  export { slack } from './slack/index.js';
3
+ export { telegram } from './telegram/index.js';
3
4
  export { terminal } from './terminal/index.js';
4
5
  export { whatsappBusiness } from './whatsapp-business/index.js';
5
- import '../types-DcQ5a7PK.js';
6
+ import '../types-Bje8aq1k.js';
6
7
  import 'hotscript';
7
8
  import 'zod';
8
9
  import 'zod/v4/core';
9
- import '../attachment-DfWSZS5L.js';
10
+ import '../attachment-B4nSrKVd.js';
10
11
  import '../photo-content-BJKnqgN-.js';
11
12
  import '@photon-ai/advanced-imessage';
12
13
  import '@photon-ai/imessage-kit';
13
14
  import '@photon-ai/slack';
15
+ import '@photon-ai/telegram-ts';
16
+ import '../types-BD0-kKyv.js';
14
17
  import 'node:child_process';
15
18
  import 'node:net';
16
19
  import '@photon-ai/whatsapp-business';
@@ -1,26 +1,34 @@
1
1
  import { createRequire as __spectrumCreateRequire } from "node:module"; const require = __spectrumCreateRequire(import.meta.url);
2
2
  import {
3
3
  imessage
4
- } from "../chunk-YJMPSD3S.js";
5
- import "../chunk-JQN6CRSC.js";
4
+ } from "../chunk-ATNAE7OR.js";
5
+ import "../chunk-6BI4PFTP.js";
6
6
  import {
7
7
  slack
8
- } from "../chunk-3OTECDNH.js";
8
+ } from "../chunk-WXY5QP3M.js";
9
+ import {
10
+ telegram
11
+ } from "../chunk-5LT5J3NR.js";
12
+ import "../chunk-34FQGGD7.js";
13
+ import "../chunk-3B4QH4JG.js";
9
14
  import {
10
15
  terminal
11
- } from "../chunk-5BKZJMZV.js";
16
+ } from "../chunk-U3LXXT3W.js";
12
17
  import "../chunk-NNY6LMSC.js";
13
18
  import {
14
19
  whatsappBusiness
15
- } from "../chunk-5TIF3FIE.js";
20
+ } from "../chunk-Q537JPTG.js";
16
21
  import "../chunk-2D27WW5B.js";
17
- import "../chunk-MC6ZKFSG.js";
18
- import "../chunk-QGJFZMD5.js";
19
- import "../chunk-IPOFBAIM.js";
22
+ import "../chunk-3GEJYGZK.js";
23
+ import "../chunk-U7AWXDH6.js";
24
+ import "../chunk-5XEFJBN2.js";
25
+ import "../chunk-6UZFVXQF.js";
26
+ import "../chunk-NGC4DJIX.js";
20
27
  import "../chunk-2ILTJC35.js";
21
28
  export {
22
29
  imessage,
23
30
  slack,
31
+ telegram,
24
32
  terminal,
25
33
  whatsappBusiness
26
34
  };
@@ -1,4 +1,4 @@
1
- import { S as SchemaMessage, P as Platform, a as PlatformDef } from '../../types-DcQ5a7PK.js';
1
+ import { S as SchemaMessage, P as Platform, a as PlatformDef } from '../../types-Bje8aq1k.js';
2
2
  import * as z from 'zod';
3
3
  import z__default from 'zod';
4
4
  import * as _photon_ai_slack from '@photon-ai/slack';
@@ -1,9 +1,10 @@
1
1
  import { createRequire as __spectrumCreateRequire } from "node:module"; const require = __spectrumCreateRequire(import.meta.url);
2
2
  import {
3
3
  slack
4
- } from "../../chunk-3OTECDNH.js";
5
- import "../../chunk-MC6ZKFSG.js";
6
- import "../../chunk-IPOFBAIM.js";
4
+ } from "../../chunk-WXY5QP3M.js";
5
+ import "../../chunk-3GEJYGZK.js";
6
+ import "../../chunk-5XEFJBN2.js";
7
+ import "../../chunk-NGC4DJIX.js";
7
8
  import "../../chunk-2ILTJC35.js";
8
9
  export {
9
10
  slack
@@ -0,0 +1,47 @@
1
+ import { P as Platform, a as PlatformDef, g as ProviderMessage } from '../../types-Bje8aq1k.js';
2
+ import * as _photon_ai_telegram_ts from '@photon-ai/telegram-ts';
3
+ import * as zod_v4_core from 'zod/v4/core';
4
+ import * as z from 'zod';
5
+ import z__default from 'zod';
6
+ import { F as FusorClient } from '../../types-BD0-kKyv.js';
7
+ import 'hotscript';
8
+
9
+ interface TelegramSpace {
10
+ id: string;
11
+ }
12
+
13
+ declare const configSchema: z__default.ZodObject<{
14
+ botToken: z__default.ZodString;
15
+ webhookSecret: z__default.ZodOptional<z__default.ZodString>;
16
+ baseUrl: z__default.ZodDefault<z__default.ZodURL>;
17
+ }, z__default.core.$strip>;
18
+ type TelegramConfig = z__default.infer<typeof configSchema>;
19
+
20
+ /**
21
+ * Telegram provider for Spectrum.
22
+ *
23
+ * Inbound is delivered through Fusor: `createClient` returns a `fusor(...)`
24
+ * client whose `verify` checks the Telegram webhook secret token and parses the
25
+ * `Update` (pure parsing — no client). The `messages` handler reads `config`
26
+ * from its ctx and builds a photon client inline only to download media bytes.
27
+ * Outbound (`send`) also builds a photon client inline. Both go through
28
+ * `@photon-ai/telegram-ts`. Drop `telegram.config({...})` into
29
+ * `Spectrum({ providers: [...] })`.
30
+ *
31
+ * In cloud mode (`projectConfig` present), `createClient` also self-registers
32
+ * the bot's webhook against the Fusor edge for the project slug — see
33
+ * `ensureWebhook`. Without a slug (local/direct mode) registration is skipped.
34
+ */
35
+ declare const telegram: Platform<PlatformDef<"telegram", z.ZodObject<{
36
+ botToken: z.ZodString;
37
+ webhookSecret: z.ZodOptional<z.ZodString>;
38
+ baseUrl: z.ZodDefault<z.ZodURL>;
39
+ }, zod_v4_core.$strip>, z.ZodType<object, unknown, zod_v4_core.$ZodTypeInternals<object, unknown>> | undefined, z.ZodType<object, unknown, zod_v4_core.$ZodTypeInternals<object, unknown>> | undefined, z.ZodObject<{
40
+ chatId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
41
+ }, zod_v4_core.$strip>, FusorClient<_photon_ai_telegram_ts.Update>, {
42
+ id: string;
43
+ }, TelegramSpace, undefined, ProviderMessage<{
44
+ id: string;
45
+ }, TelegramSpace, Record<never, never>>, undefined, Record<never, never>, Record<never, never>, Record<never, never>>> & Readonly<Record<never, never>>;
46
+
47
+ export { type TelegramConfig, telegram };
@@ -0,0 +1,13 @@
1
+ import { createRequire as __spectrumCreateRequire } from "node:module"; const require = __spectrumCreateRequire(import.meta.url);
2
+ import {
3
+ telegram
4
+ } from "../../chunk-5LT5J3NR.js";
5
+ import "../../chunk-34FQGGD7.js";
6
+ import "../../chunk-3B4QH4JG.js";
7
+ import "../../chunk-NNY6LMSC.js";
8
+ import "../../chunk-6UZFVXQF.js";
9
+ import "../../chunk-NGC4DJIX.js";
10
+ import "../../chunk-2ILTJC35.js";
11
+ export {
12
+ telegram
13
+ };