spectrum-ts 2.0.0 → 3.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/dist/{attachment-B4nSrKVd.d.ts → attachment-WePAHfcH.d.ts} +1 -1
- package/dist/{authoring-BjE5BvlO.d.ts → authoring-DDh3muGT.d.ts} +61 -26
- package/dist/authoring.d.ts +3 -3
- package/dist/authoring.js +5 -5
- package/dist/{chunk-NNY6LMSC.js → chunk-77U6SH5A.js} +1 -1
- package/dist/{chunk-ATNAE7OR.js → chunk-AYCMTRVC.js} +549 -76
- package/dist/{chunk-6BI4PFTP.js → chunk-CHY5YLLV.js} +1 -1
- package/dist/{chunk-U3LXXT3W.js → chunk-EZ5SNNFS.js} +20 -8
- package/dist/{chunk-WXY5QP3M.js → chunk-FULEQIRQ.js} +27 -21
- package/dist/{chunk-2ILTJC35.js → chunk-LQMDV75O.js} +205 -11
- package/dist/{chunk-NGC4DJIX.js → chunk-LX437ZTY.js} +416 -135
- package/dist/{chunk-3B4QH4JG.js → chunk-MHGCPC2V.js} +1 -1
- package/dist/{chunk-U7AWXDH6.js → chunk-NZ5WCMTY.js} +1 -1
- package/dist/{chunk-5LT5J3NR.js → chunk-TXRWKSNH.js} +262 -30
- package/dist/{chunk-Q537JPTG.js → chunk-UXJ5OO6P.js} +10 -10
- package/dist/index.d.ts +107 -56
- package/dist/index.js +29 -182
- package/dist/providers/imessage/index.d.ts +6 -14
- package/dist/providers/imessage/index.js +6 -6
- package/dist/providers/index.d.ts +3 -3
- package/dist/providers/index.js +11 -11
- package/dist/providers/slack/index.d.ts +1 -2
- package/dist/providers/slack/index.js +3 -3
- package/dist/providers/telegram/index.d.ts +3 -5
- package/dist/providers/telegram/index.js +5 -5
- package/dist/providers/terminal/index.d.ts +2 -4
- package/dist/providers/terminal/index.js +5 -5
- package/dist/providers/whatsapp-business/index.d.ts +1 -1
- package/dist/providers/whatsapp-business/index.js +4 -4
- package/dist/{types-BD0-kKyv.d.ts → types-BujGKBin.d.ts} +1 -1
- package/dist/{types-Bje8aq1k.d.ts → types-YqCNUDIt.d.ts} +171 -23
- package/package.json +2 -1
|
@@ -3,17 +3,17 @@ export { slack } from './slack/index.js';
|
|
|
3
3
|
export { telegram } from './telegram/index.js';
|
|
4
4
|
export { terminal } from './terminal/index.js';
|
|
5
5
|
export { whatsappBusiness } from './whatsapp-business/index.js';
|
|
6
|
-
import '../types-
|
|
6
|
+
import '../types-YqCNUDIt.js';
|
|
7
7
|
import 'hotscript';
|
|
8
8
|
import 'zod';
|
|
9
9
|
import 'zod/v4/core';
|
|
10
|
-
import '../attachment-
|
|
10
|
+
import '../attachment-WePAHfcH.js';
|
|
11
11
|
import '../photo-content-BJKnqgN-.js';
|
|
12
12
|
import '@photon-ai/advanced-imessage';
|
|
13
13
|
import '@photon-ai/imessage-kit';
|
|
14
14
|
import '@photon-ai/slack';
|
|
15
15
|
import '@photon-ai/telegram-ts';
|
|
16
|
-
import '../types-
|
|
16
|
+
import '../types-BujGKBin.js';
|
|
17
17
|
import 'node:child_process';
|
|
18
18
|
import 'node:net';
|
|
19
19
|
import '@photon-ai/whatsapp-business';
|
package/dist/providers/index.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import { createRequire as __spectrumCreateRequire } from "node:module"; const require = __spectrumCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
imessage
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-AYCMTRVC.js";
|
|
5
|
+
import "../chunk-CHY5YLLV.js";
|
|
6
6
|
import {
|
|
7
7
|
slack
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-FULEQIRQ.js";
|
|
9
9
|
import {
|
|
10
10
|
telegram
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-TXRWKSNH.js";
|
|
12
12
|
import "../chunk-34FQGGD7.js";
|
|
13
|
-
import "../chunk-
|
|
13
|
+
import "../chunk-MHGCPC2V.js";
|
|
14
14
|
import {
|
|
15
15
|
terminal
|
|
16
|
-
} from "../chunk-
|
|
17
|
-
import "../chunk-
|
|
16
|
+
} from "../chunk-EZ5SNNFS.js";
|
|
17
|
+
import "../chunk-77U6SH5A.js";
|
|
18
18
|
import {
|
|
19
19
|
whatsappBusiness
|
|
20
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-UXJ5OO6P.js";
|
|
21
21
|
import "../chunk-2D27WW5B.js";
|
|
22
22
|
import "../chunk-3GEJYGZK.js";
|
|
23
|
-
import "../chunk-
|
|
23
|
+
import "../chunk-NZ5WCMTY.js";
|
|
24
24
|
import "../chunk-5XEFJBN2.js";
|
|
25
25
|
import "../chunk-6UZFVXQF.js";
|
|
26
|
-
import "../chunk-
|
|
27
|
-
import "../chunk-
|
|
26
|
+
import "../chunk-LX437ZTY.js";
|
|
27
|
+
import "../chunk-LQMDV75O.js";
|
|
28
28
|
export {
|
|
29
29
|
imessage,
|
|
30
30
|
slack,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SchemaMessage, P as Platform, a as PlatformDef } from '../../types-
|
|
1
|
+
import { S as SchemaMessage, P as Platform, a as PlatformDef } from '../../types-YqCNUDIt.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';
|
|
@@ -30,7 +30,6 @@ declare const slack: Platform<PlatformDef<"Slack", z.ZodUnion<readonly [z.ZodObj
|
|
|
30
30
|
id: z.ZodString;
|
|
31
31
|
teamId: z.ZodString;
|
|
32
32
|
}, zod_v4_core.$strip>, z.ZodObject<{
|
|
33
|
-
channel: z.ZodOptional<z.ZodString>;
|
|
34
33
|
teamId: z.ZodString;
|
|
35
34
|
}, zod_v4_core.$strip>, _photon_ai_slack.SlackClient, {
|
|
36
35
|
id: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createRequire as __spectrumCreateRequire } from "node:module"; const require = __spectrumCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
slack
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-FULEQIRQ.js";
|
|
5
5
|
import "../../chunk-3GEJYGZK.js";
|
|
6
6
|
import "../../chunk-5XEFJBN2.js";
|
|
7
|
-
import "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-LX437ZTY.js";
|
|
8
|
+
import "../../chunk-LQMDV75O.js";
|
|
9
9
|
export {
|
|
10
10
|
slack
|
|
11
11
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { P as Platform, a as PlatformDef, g as ProviderMessage } from '../../types-
|
|
1
|
+
import { P as Platform, a as PlatformDef, g as ProviderMessage } from '../../types-YqCNUDIt.js';
|
|
2
2
|
import * as _photon_ai_telegram_ts from '@photon-ai/telegram-ts';
|
|
3
3
|
import * as zod_v4_core from 'zod/v4/core';
|
|
4
4
|
import * as z from 'zod';
|
|
5
5
|
import z__default from 'zod';
|
|
6
|
-
import { F as FusorClient } from '../../types-
|
|
6
|
+
import { F as FusorClient } from '../../types-BujGKBin.js';
|
|
7
7
|
import 'hotscript';
|
|
8
8
|
|
|
9
9
|
interface TelegramSpace {
|
|
@@ -36,9 +36,7 @@ declare const telegram: Platform<PlatformDef<"telegram", z.ZodObject<{
|
|
|
36
36
|
botToken: z.ZodString;
|
|
37
37
|
webhookSecret: z.ZodOptional<z.ZodString>;
|
|
38
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.
|
|
40
|
-
chatId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
41
|
-
}, zod_v4_core.$strip>, FusorClient<_photon_ai_telegram_ts.Update>, {
|
|
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.ZodType<object, unknown, zod_v4_core.$ZodTypeInternals<object, unknown>> | undefined, FusorClient<_photon_ai_telegram_ts.Update>, {
|
|
42
40
|
id: string;
|
|
43
41
|
}, TelegramSpace, undefined, ProviderMessage<{
|
|
44
42
|
id: string;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { createRequire as __spectrumCreateRequire } from "node:module"; const require = __spectrumCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
telegram
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-TXRWKSNH.js";
|
|
5
5
|
import "../../chunk-34FQGGD7.js";
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-MHGCPC2V.js";
|
|
7
|
+
import "../../chunk-77U6SH5A.js";
|
|
8
8
|
import "../../chunk-6UZFVXQF.js";
|
|
9
|
-
import "../../chunk-
|
|
10
|
-
import "../../chunk-
|
|
9
|
+
import "../../chunk-LX437ZTY.js";
|
|
10
|
+
import "../../chunk-LQMDV75O.js";
|
|
11
11
|
export {
|
|
12
12
|
telegram
|
|
13
13
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as Platform, a as PlatformDef, f as contentSchema } from '../../types-
|
|
1
|
+
import { P as Platform, a as PlatformDef, f as contentSchema } from '../../types-YqCNUDIt.js';
|
|
2
2
|
import { ChildProcess } from 'node:child_process';
|
|
3
3
|
import z__default from 'zod';
|
|
4
4
|
import { Socket } from 'node:net';
|
|
@@ -106,9 +106,7 @@ declare const terminal: Platform<PlatformDef<"Terminal", z__default.ZodObject<{
|
|
|
106
106
|
name: z__default.ZodString;
|
|
107
107
|
description: z__default.ZodOptional<z__default.ZodString>;
|
|
108
108
|
}, z__default.core.$strip>>>;
|
|
109
|
-
}, z__default.core.$strip>, z__default.ZodType<object, unknown, z__default.core.$ZodTypeInternals<object, unknown>> | undefined, z__default.ZodType<object, unknown, z__default.core.$ZodTypeInternals<object, unknown>> | undefined, z__default.
|
|
110
|
-
id: z__default.ZodOptional<z__default.ZodString>;
|
|
111
|
-
}, z__default.core.$strip>, TerminalClient, {
|
|
109
|
+
}, z__default.core.$strip>, z__default.ZodType<object, unknown, z__default.core.$ZodTypeInternals<object, unknown>> | undefined, z__default.ZodType<object, unknown, z__default.core.$ZodTypeInternals<object, unknown>> | undefined, z__default.ZodType<object, unknown, z__default.core.$ZodTypeInternals<object, unknown>> | undefined, TerminalClient, {
|
|
112
110
|
id: string;
|
|
113
111
|
}, {
|
|
114
112
|
id: string;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { createRequire as __spectrumCreateRequire } from "node:module"; const require = __spectrumCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
terminal
|
|
4
|
-
} from "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
4
|
+
} from "../../chunk-EZ5SNNFS.js";
|
|
5
|
+
import "../../chunk-77U6SH5A.js";
|
|
6
|
+
import "../../chunk-NZ5WCMTY.js";
|
|
7
7
|
import "../../chunk-5XEFJBN2.js";
|
|
8
8
|
import "../../chunk-6UZFVXQF.js";
|
|
9
|
-
import "../../chunk-
|
|
10
|
-
import "../../chunk-
|
|
9
|
+
import "../../chunk-LX437ZTY.js";
|
|
10
|
+
import "../../chunk-LQMDV75O.js";
|
|
11
11
|
export {
|
|
12
12
|
terminal
|
|
13
13
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SchemaMessage, P as Platform, a as PlatformDef } from '../../types-
|
|
1
|
+
import { S as SchemaMessage, P as Platform, a as PlatformDef } from '../../types-YqCNUDIt.js';
|
|
2
2
|
import { WhatsAppClient } from '@photon-ai/whatsapp-business';
|
|
3
3
|
import * as z from 'zod';
|
|
4
4
|
import z__default from 'zod';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { createRequire as __spectrumCreateRequire } from "node:module"; const require = __spectrumCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
whatsappBusiness
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-UXJ5OO6P.js";
|
|
5
5
|
import "../../chunk-2D27WW5B.js";
|
|
6
6
|
import "../../chunk-3GEJYGZK.js";
|
|
7
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-NZ5WCMTY.js";
|
|
8
8
|
import "../../chunk-5XEFJBN2.js";
|
|
9
9
|
import "../../chunk-6UZFVXQF.js";
|
|
10
|
-
import "../../chunk-
|
|
11
|
-
import "../../chunk-
|
|
10
|
+
import "../../chunk-LX437ZTY.js";
|
|
11
|
+
import "../../chunk-LQMDV75O.js";
|
|
12
12
|
export {
|
|
13
13
|
whatsappBusiness
|
|
14
14
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as ProjectData, c as Store, d as ProviderMessageRecord, e as Space, M as Message } from './types-
|
|
1
|
+
import { b as ProjectData, c as Store, d as ProviderMessageRecord, e as Space, M as Message } from './types-YqCNUDIt.js';
|
|
2
2
|
|
|
3
3
|
declare const FUSOR_EVENT_BRAND: unique symbol;
|
|
4
4
|
interface FusorEvent<TName extends string = string, TData = unknown> {
|
|
@@ -4,9 +4,16 @@ import z__default from 'zod';
|
|
|
4
4
|
declare const contentSchema: z__default.ZodDiscriminatedUnion<[z__default.ZodObject<{
|
|
5
5
|
type: z__default.ZodLiteral<"text">;
|
|
6
6
|
text: z__default.ZodString;
|
|
7
|
+
}, z__default.core.$strip>, z__default.ZodObject<{
|
|
8
|
+
type: z__default.ZodLiteral<"markdown">;
|
|
9
|
+
markdown: z__default.ZodString;
|
|
7
10
|
}, z__default.core.$strip>, z__default.ZodObject<{
|
|
8
11
|
type: z__default.ZodLiteral<"streamText">;
|
|
9
12
|
stream: z__default.ZodCustom<() => AsyncIterable<string>, () => AsyncIterable<string>>;
|
|
13
|
+
format: z__default.ZodOptional<z__default.ZodEnum<{
|
|
14
|
+
markdown: "markdown";
|
|
15
|
+
plain: "plain";
|
|
16
|
+
}>>;
|
|
10
17
|
}, z__default.core.$strip>, z__default.ZodObject<{
|
|
11
18
|
type: z__default.ZodLiteral<"custom">;
|
|
12
19
|
raw: z__default.ZodUnknown;
|
|
@@ -124,6 +131,9 @@ declare const contentSchema: z__default.ZodDiscriminatedUnion<[z__default.ZodObj
|
|
|
124
131
|
content: z__default.ZodDiscriminatedUnion<[z__default.ZodObject<{
|
|
125
132
|
type: z__default.ZodLiteral<"text">;
|
|
126
133
|
text: z__default.ZodString;
|
|
134
|
+
}, z__default.core.$strip>, z__default.ZodObject<{
|
|
135
|
+
type: z__default.ZodLiteral<"markdown">;
|
|
136
|
+
markdown: z__default.ZodString;
|
|
127
137
|
}, z__default.core.$strip>, z__default.ZodObject<{
|
|
128
138
|
type: z__default.ZodLiteral<"attachment">;
|
|
129
139
|
id: z__default.ZodString;
|
|
@@ -166,6 +176,9 @@ declare const contentSchema: z__default.ZodDiscriminatedUnion<[z__default.ZodObj
|
|
|
166
176
|
} | {
|
|
167
177
|
type: "text";
|
|
168
178
|
text: string;
|
|
179
|
+
} | {
|
|
180
|
+
type: "markdown";
|
|
181
|
+
markdown: string;
|
|
169
182
|
} | {
|
|
170
183
|
type: "attachment";
|
|
171
184
|
id: string;
|
|
@@ -177,6 +190,7 @@ declare const contentSchema: z__default.ZodDiscriminatedUnion<[z__default.ZodObj
|
|
|
177
190
|
} | {
|
|
178
191
|
type: "streamText";
|
|
179
192
|
stream: () => AsyncIterable<string>;
|
|
193
|
+
format?: "markdown" | "plain" | undefined;
|
|
180
194
|
} | {
|
|
181
195
|
type: "custom";
|
|
182
196
|
raw: unknown;
|
|
@@ -273,6 +287,9 @@ declare const contentSchema: z__default.ZodDiscriminatedUnion<[z__default.ZodObj
|
|
|
273
287
|
content: {
|
|
274
288
|
type: "text";
|
|
275
289
|
text: string;
|
|
290
|
+
} | {
|
|
291
|
+
type: "markdown";
|
|
292
|
+
markdown: string;
|
|
276
293
|
} | {
|
|
277
294
|
type: "attachment";
|
|
278
295
|
id: string;
|
|
@@ -301,6 +318,9 @@ declare const contentSchema: z__default.ZodDiscriminatedUnion<[z__default.ZodObj
|
|
|
301
318
|
} | {
|
|
302
319
|
type: "text";
|
|
303
320
|
text: string;
|
|
321
|
+
} | {
|
|
322
|
+
type: "markdown";
|
|
323
|
+
markdown: string;
|
|
304
324
|
} | {
|
|
305
325
|
type: "attachment";
|
|
306
326
|
id: string;
|
|
@@ -312,6 +332,7 @@ declare const contentSchema: z__default.ZodDiscriminatedUnion<[z__default.ZodObj
|
|
|
312
332
|
} | {
|
|
313
333
|
type: "streamText";
|
|
314
334
|
stream: () => AsyncIterable<string>;
|
|
335
|
+
format?: "markdown" | "plain" | undefined;
|
|
315
336
|
} | {
|
|
316
337
|
type: "custom";
|
|
317
338
|
raw: unknown;
|
|
@@ -408,6 +429,9 @@ declare const contentSchema: z__default.ZodDiscriminatedUnion<[z__default.ZodObj
|
|
|
408
429
|
content: {
|
|
409
430
|
type: "text";
|
|
410
431
|
text: string;
|
|
432
|
+
} | {
|
|
433
|
+
type: "markdown";
|
|
434
|
+
markdown: string;
|
|
411
435
|
} | {
|
|
412
436
|
type: "attachment";
|
|
413
437
|
id: string;
|
|
@@ -440,6 +464,9 @@ declare const contentSchema: z__default.ZodDiscriminatedUnion<[z__default.ZodObj
|
|
|
440
464
|
} | {
|
|
441
465
|
type: "text";
|
|
442
466
|
text: string;
|
|
467
|
+
} | {
|
|
468
|
+
type: "markdown";
|
|
469
|
+
markdown: string;
|
|
443
470
|
} | {
|
|
444
471
|
type: "attachment";
|
|
445
472
|
id: string;
|
|
@@ -451,6 +478,7 @@ declare const contentSchema: z__default.ZodDiscriminatedUnion<[z__default.ZodObj
|
|
|
451
478
|
} | {
|
|
452
479
|
type: "streamText";
|
|
453
480
|
stream: () => AsyncIterable<string>;
|
|
481
|
+
format?: "markdown" | "plain" | undefined;
|
|
454
482
|
} | {
|
|
455
483
|
type: "custom";
|
|
456
484
|
raw: unknown;
|
|
@@ -547,6 +575,9 @@ declare const contentSchema: z__default.ZodDiscriminatedUnion<[z__default.ZodObj
|
|
|
547
575
|
content: {
|
|
548
576
|
type: "text";
|
|
549
577
|
text: string;
|
|
578
|
+
} | {
|
|
579
|
+
type: "markdown";
|
|
580
|
+
markdown: string;
|
|
550
581
|
} | {
|
|
551
582
|
type: "attachment";
|
|
552
583
|
id: string;
|
|
@@ -575,6 +606,9 @@ declare const contentSchema: z__default.ZodDiscriminatedUnion<[z__default.ZodObj
|
|
|
575
606
|
} | {
|
|
576
607
|
type: "text";
|
|
577
608
|
text: string;
|
|
609
|
+
} | {
|
|
610
|
+
type: "markdown";
|
|
611
|
+
markdown: string;
|
|
578
612
|
} | {
|
|
579
613
|
type: "attachment";
|
|
580
614
|
id: string;
|
|
@@ -586,6 +620,7 @@ declare const contentSchema: z__default.ZodDiscriminatedUnion<[z__default.ZodObj
|
|
|
586
620
|
} | {
|
|
587
621
|
type: "streamText";
|
|
588
622
|
stream: () => AsyncIterable<string>;
|
|
623
|
+
format?: "markdown" | "plain" | undefined;
|
|
589
624
|
} | {
|
|
590
625
|
type: "custom";
|
|
591
626
|
raw: unknown;
|
|
@@ -682,6 +717,9 @@ declare const contentSchema: z__default.ZodDiscriminatedUnion<[z__default.ZodObj
|
|
|
682
717
|
content: {
|
|
683
718
|
type: "text";
|
|
684
719
|
text: string;
|
|
720
|
+
} | {
|
|
721
|
+
type: "markdown";
|
|
722
|
+
markdown: string;
|
|
685
723
|
} | {
|
|
686
724
|
type: "attachment";
|
|
687
725
|
id: string;
|
|
@@ -700,6 +738,9 @@ declare const contentSchema: z__default.ZodDiscriminatedUnion<[z__default.ZodObj
|
|
|
700
738
|
displayName: string;
|
|
701
739
|
}>;
|
|
702
740
|
target: z__default.ZodCustom<Message<string, User, Space<unknown>>, Message<string, User, Space<unknown>>>;
|
|
741
|
+
}, z__default.core.$strip>, z__default.ZodObject<{
|
|
742
|
+
type: z__default.ZodLiteral<"unsend">;
|
|
743
|
+
target: z__default.ZodCustom<Message<string, User, Space<unknown>>, Message<string, User, Space<unknown>>>;
|
|
703
744
|
}, z__default.core.$strip>], "type">;
|
|
704
745
|
type Content = z__default.infer<typeof contentSchema>;
|
|
705
746
|
interface ContentBuilder {
|
|
@@ -716,6 +757,43 @@ interface AgentSender extends User {
|
|
|
716
757
|
readonly kind: "agent";
|
|
717
758
|
}
|
|
718
759
|
|
|
760
|
+
/**
|
|
761
|
+
* A `ContentBuilder` whose build is statically known to produce `Reaction`
|
|
762
|
+
* content. `space.send` overloads on this so `space.send(reaction(...))`
|
|
763
|
+
* returns a Message with `content` narrowed to `Reaction`, matching
|
|
764
|
+
* `message.react()`.
|
|
765
|
+
*/
|
|
766
|
+
interface ReactionBuilder extends ContentBuilder {
|
|
767
|
+
build(): Promise<Reaction>;
|
|
768
|
+
}
|
|
769
|
+
declare const reactionSchema: z__default.ZodObject<{
|
|
770
|
+
type: z__default.ZodLiteral<"reaction">;
|
|
771
|
+
emoji: z__default.ZodString;
|
|
772
|
+
target: z__default.ZodCustom<Message<string, User, Space<unknown>>, Message<string, User, Space<unknown>>>;
|
|
773
|
+
}, z__default.core.$strip>;
|
|
774
|
+
type Reaction = z__default.infer<typeof reactionSchema>;
|
|
775
|
+
declare const asReaction: (input: {
|
|
776
|
+
emoji: string;
|
|
777
|
+
target: Message;
|
|
778
|
+
}) => Reaction;
|
|
779
|
+
/**
|
|
780
|
+
* Construct a `reaction` content value targeting the given message.
|
|
781
|
+
*
|
|
782
|
+
* `space.send(reaction(emoji, message))` is the canonical form of
|
|
783
|
+
* `message.react(emoji)`. It resolves to the reaction `Message`
|
|
784
|
+
* (`content.type === "reaction"`) — keep it as the handle to `unsend()`
|
|
785
|
+
* later. Resolves `undefined` only when the platform does not support
|
|
786
|
+
* reactions (warned and skipped).
|
|
787
|
+
*
|
|
788
|
+
* Accepts `Message | undefined` so `space.send` results chain without
|
|
789
|
+
* narrowing (`send` resolves `undefined` when a platform skips unsupported
|
|
790
|
+
* content); an undefined target throws at build time.
|
|
791
|
+
*
|
|
792
|
+
* To react to a message known only by id, resolve it first via
|
|
793
|
+
* `space.getMessage(id)`.
|
|
794
|
+
*/
|
|
795
|
+
declare function reaction(emoji: string, target: Message | undefined): ReactionBuilder;
|
|
796
|
+
|
|
719
797
|
interface Space<_Def = unknown> {
|
|
720
798
|
readonly __platform: string;
|
|
721
799
|
/**
|
|
@@ -740,7 +818,12 @@ interface Space<_Def = unknown> {
|
|
|
740
818
|
avatar(input: Buffer, options: {
|
|
741
819
|
mimeType: string;
|
|
742
820
|
}): Promise<void>;
|
|
743
|
-
|
|
821
|
+
/**
|
|
822
|
+
* Rewrite a previously-sent outbound message. Sugar for
|
|
823
|
+
* `send(edit(newContent, message))`. Accepts `Message | undefined` so
|
|
824
|
+
* `send` results chain without narrowing; an undefined target throws.
|
|
825
|
+
*/
|
|
826
|
+
edit(message: Message | undefined, newContent: ContentInput): Promise<void>;
|
|
744
827
|
/**
|
|
745
828
|
* Look up a message in this space by its id. Returns `undefined` if the
|
|
746
829
|
* platform has no way to resolve the id (e.g. cache miss with no by-id
|
|
@@ -757,10 +840,25 @@ interface Space<_Def = unknown> {
|
|
|
757
840
|
*/
|
|
758
841
|
rename(displayName: string): Promise<void>;
|
|
759
842
|
responding<T>(fn: () => T | Promise<T>): Promise<T>;
|
|
843
|
+
/**
|
|
844
|
+
* A reaction send resolves to the reaction Message (`content` narrowed to
|
|
845
|
+
* `Reaction`) — the handle to `unsend()` later. Listed before the general
|
|
846
|
+
* overload so `send(reaction(...))` picks it; every other `ContentBuilder`
|
|
847
|
+
* fails the `ReactionBuilder` shape and falls through.
|
|
848
|
+
*/
|
|
849
|
+
send(content: ReactionBuilder): Promise<(Message<string, AgentSender> & {
|
|
850
|
+
content: Reaction;
|
|
851
|
+
}) | undefined>;
|
|
760
852
|
send(content: ContentInput): Promise<Message<string, AgentSender> | undefined>;
|
|
761
853
|
send(...content: [ContentInput, ContentInput, ...ContentInput[]]): Promise<Message<string, AgentSender>[]>;
|
|
762
854
|
startTyping(): Promise<void>;
|
|
763
855
|
stopTyping(): Promise<void>;
|
|
856
|
+
/**
|
|
857
|
+
* Retract a previously-sent outbound message. Sugar for
|
|
858
|
+
* `send(unsend(message))`. Accepts `Message | undefined` so `send`
|
|
859
|
+
* results chain without narrowing; an undefined target throws.
|
|
860
|
+
*/
|
|
861
|
+
unsend(message: Message | undefined): Promise<void>;
|
|
764
862
|
}
|
|
765
863
|
|
|
766
864
|
interface Message<TPlatform extends string = string, TSender extends User = User, TSpace extends Space = Space> {
|
|
@@ -769,12 +867,34 @@ interface Message<TPlatform extends string = string, TSender extends User = User
|
|
|
769
867
|
edit(newContent: ContentInput): Promise<void>;
|
|
770
868
|
readonly id: string;
|
|
771
869
|
platform: TPlatform;
|
|
772
|
-
|
|
870
|
+
/**
|
|
871
|
+
* React to this message. Resolves to the reaction `Message` (content
|
|
872
|
+
* narrowed to `Reaction`) — keep it as the handle to `unsend()` later.
|
|
873
|
+
* Resolves `undefined` when the platform does not support reactions
|
|
874
|
+
* (warned and skipped).
|
|
875
|
+
*
|
|
876
|
+
* The return type is an inline intersection rather than a `TContent`
|
|
877
|
+
* generic on `Message`: a content type parameter would need `Content` as
|
|
878
|
+
* its default, and `Content`'s schemas (`reaction`, `reply`, `edit`,
|
|
879
|
+
* `group`) reference `Message` — TS rejects the resulting circular
|
|
880
|
+
* default (TS2716).
|
|
881
|
+
*/
|
|
882
|
+
react(reaction: string): Promise<(Message<TPlatform, AgentSender, TSpace> & {
|
|
883
|
+
content: Reaction;
|
|
884
|
+
}) | undefined>;
|
|
773
885
|
reply(content: ContentInput): Promise<Message<TPlatform, AgentSender, TSpace> | undefined>;
|
|
774
886
|
reply(...content: [ContentInput, ContentInput, ...ContentInput[]]): Promise<Message<TPlatform, AgentSender, TSpace>[]>;
|
|
775
887
|
sender: TSender | undefined;
|
|
776
888
|
space: TSpace;
|
|
777
889
|
timestamp: Date;
|
|
890
|
+
/**
|
|
891
|
+
* Retract this message. Sugar for `space.send(unsend(this))`. Unsends are
|
|
892
|
+
* fire-and-forget; per-platform support and constraints (e.g. iMessage's
|
|
893
|
+
* ~2-minute unsend window for regular messages) surface from the
|
|
894
|
+
* provider's send action. Only outbound messages can be unsent; calling
|
|
895
|
+
* this on an inbound message throws.
|
|
896
|
+
*/
|
|
897
|
+
unsend(): Promise<void>;
|
|
778
898
|
}
|
|
779
899
|
|
|
780
900
|
type SubscriptionStatus = "active" | "canceled" | "past_due";
|
|
@@ -904,7 +1024,7 @@ declare function broadcast<T>(source: ManagedStream<T>): Broadcaster<T>;
|
|
|
904
1024
|
* through `space.send(...)`, call the underlying SDK, or perform any other
|
|
905
1025
|
* side effect.
|
|
906
1026
|
*
|
|
907
|
-
* Names that collide with reserved `Space` keys (`send`, `edit`,
|
|
1027
|
+
* Names that collide with reserved `Space` keys (`send`, `edit`, `unsend`,
|
|
908
1028
|
* `getMessage`, `startTyping`, `stopTyping`, `responding`, `id`,
|
|
909
1029
|
* `__platform`) are skipped at runtime with a warning and excluded at the
|
|
910
1030
|
* type level via `Exclude<…, keyof Space>`.
|
|
@@ -918,9 +1038,9 @@ type SpaceActionFn = (space: Space, ...args: never[]) => Promise<void>;
|
|
|
918
1038
|
* SDK, or perform any other side effect.
|
|
919
1039
|
*
|
|
920
1040
|
* Names that collide with reserved `Message` keys (`react`, `reply`, `edit`,
|
|
921
|
-
* `id`, `space`, `sender`, `content`, `platform`, `direction`,
|
|
922
|
-
* are skipped at runtime with a warning and excluded at the
|
|
923
|
-
* `Exclude<…, keyof Message>`.
|
|
1041
|
+
* `unsend`, `id`, `space`, `sender`, `content`, `platform`, `direction`,
|
|
1042
|
+
* `timestamp`) are skipped at runtime with a warning and excluded at the
|
|
1043
|
+
* type level via `Exclude<…, keyof Message>`.
|
|
924
1044
|
*/
|
|
925
1045
|
type MessageActionFn = (message: Message, ...args: never[]) => Promise<void>;
|
|
926
1046
|
/**
|
|
@@ -1156,8 +1276,10 @@ interface PlatformDef<_Name extends string = string, _ConfigSchema extends z__de
|
|
|
1156
1276
|
* through this single action.
|
|
1157
1277
|
*
|
|
1158
1278
|
* Returns a `ProviderMessageRecord` (id + timestamp) for content that
|
|
1159
|
-
* produces a message
|
|
1160
|
-
*
|
|
1279
|
+
* produces a message — including reactions, whose record is the unsend
|
|
1280
|
+
* handle (synthesize a deterministic id when the platform assigns none);
|
|
1281
|
+
* returns `undefined` only for fire-and-forget control signals (typing,
|
|
1282
|
+
* edits, renames, avatars, unsends) on platforms that don't return ids.
|
|
1161
1283
|
*
|
|
1162
1284
|
* One of the two universal platform contracts (along with `messages`).
|
|
1163
1285
|
*/
|
|
@@ -1171,7 +1293,7 @@ interface PlatformDef<_Name extends string = string, _ConfigSchema extends z__de
|
|
|
1171
1293
|
space: {
|
|
1172
1294
|
schema?: _SpaceSchema;
|
|
1173
1295
|
params?: _SpaceParamsSchema;
|
|
1174
|
-
|
|
1296
|
+
create: (_: {
|
|
1175
1297
|
input: {
|
|
1176
1298
|
users: (_ResolvedUser & {
|
|
1177
1299
|
__platform: _Name;
|
|
@@ -1182,6 +1304,21 @@ interface PlatformDef<_Name extends string = string, _ConfigSchema extends z__de
|
|
|
1182
1304
|
config: z__default.infer<_ConfigSchema>;
|
|
1183
1305
|
store: Store;
|
|
1184
1306
|
}) => Promise<_ResolvedSpace>;
|
|
1307
|
+
/**
|
|
1308
|
+
* Optional: hydrate a space from a known platform space id. When absent,
|
|
1309
|
+
* the framework builds the candidate `{ id }` and validates it against
|
|
1310
|
+
* `space.schema` — providers whose schema requires more fields must
|
|
1311
|
+
* implement this.
|
|
1312
|
+
*/
|
|
1313
|
+
get?: (_: {
|
|
1314
|
+
input: {
|
|
1315
|
+
id: string;
|
|
1316
|
+
params?: _SpaceParamsSchema extends z__default.ZodType<object> ? z__default.infer<_SpaceParamsSchema> : undefined;
|
|
1317
|
+
};
|
|
1318
|
+
client: NoInferClient<_Client>;
|
|
1319
|
+
config: z__default.infer<_ConfigSchema>;
|
|
1320
|
+
store: Store;
|
|
1321
|
+
}) => Promise<_ResolvedSpace>;
|
|
1185
1322
|
/**
|
|
1186
1323
|
* Optional platform-specific methods bound to `PlatformSpace<Def>`.
|
|
1187
1324
|
*
|
|
@@ -1197,9 +1334,9 @@ interface PlatformDef<_Name extends string = string, _ConfigSchema extends z__de
|
|
|
1197
1334
|
* lives here for platform-specific surface area.
|
|
1198
1335
|
*
|
|
1199
1336
|
* Names that collide with reserved `Space` keys (`send`, `edit`,
|
|
1200
|
-
* `getMessage`, `startTyping`, `stopTyping`, `responding`,
|
|
1201
|
-
* `__platform`) are skipped at runtime with a warning and excluded
|
|
1202
|
-
* the type level.
|
|
1337
|
+
* `unsend`, `getMessage`, `startTyping`, `stopTyping`, `responding`,
|
|
1338
|
+
* `id`, `__platform`) are skipped at runtime with a warning and excluded
|
|
1339
|
+
* at the type level.
|
|
1203
1340
|
*/
|
|
1204
1341
|
actions?: _SpaceActions;
|
|
1205
1342
|
};
|
|
@@ -1235,7 +1372,8 @@ interface AnyPlatformDef {
|
|
|
1235
1372
|
space: {
|
|
1236
1373
|
schema?: z__default.ZodType<object>;
|
|
1237
1374
|
params?: z__default.ZodType<object>;
|
|
1238
|
-
|
|
1375
|
+
create: (_: any) => Promise<any>;
|
|
1376
|
+
get?: (_: any) => Promise<any>;
|
|
1239
1377
|
actions?: Record<string, SpaceActionFn>;
|
|
1240
1378
|
};
|
|
1241
1379
|
user: {
|
|
@@ -1277,21 +1415,31 @@ type UnifiedCustomEvent<Providers extends PlatformProviderConfig[], EventName ex
|
|
|
1277
1415
|
type CustomEventStreams<Providers extends PlatformProviderConfig[]> = {
|
|
1278
1416
|
[K in Exclude<AllCustomEventNames<Providers>, ReservedNames> & string]: AsyncIterable<UnifiedCustomEvent<Providers, K>>;
|
|
1279
1417
|
};
|
|
1280
|
-
type ResolvedSpaceOf<Def extends AnyPlatformDef> = AwaitedReturn<Def["space"]["
|
|
1418
|
+
type ResolvedSpaceOf<Def extends AnyPlatformDef> = AwaitedReturn<Def["space"]["create"]>;
|
|
1281
1419
|
type SchemaSpaceOf<Def extends AnyPlatformDef> = InferOptionalSchema<Def["space"]["schema"]>;
|
|
1282
1420
|
type ResolvedUserOf<Def extends AnyPlatformDef> = AwaitedReturn<Def["user"]["resolve"]>;
|
|
1283
1421
|
type SpaceShapeOf<Def extends AnyPlatformDef> = [SchemaSpaceOf<Def>] extends [
|
|
1284
1422
|
never
|
|
1285
1423
|
] ? ResolvedSpaceOf<Def> : SchemaSpaceOf<Def>;
|
|
1286
|
-
type SpaceParamsInputOf<Def extends AnyPlatformDef> = InputSchema<Def["space"]["params"]>;
|
|
1424
|
+
type SpaceParamsInputOf<Def extends AnyPlatformDef> = z__default.ZodType<object> extends Def["space"]["params"] ? never : InputSchema<Def["space"]["params"]>;
|
|
1287
1425
|
type SpaceUserLike<Def extends AnyPlatformDef> = PlatformUser<Def> | string;
|
|
1288
|
-
type
|
|
1426
|
+
type SpaceParamsArgs<Def extends AnyPlatformDef> = [
|
|
1289
1427
|
SpaceParamsInputOf<Def>
|
|
1290
|
-
] extends [never] ? [
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1428
|
+
] extends [never] ? [] : Record<string, never> extends SpaceParamsInputOf<Def> ? [params?: SpaceParamsInputOf<Def>] : [params: SpaceParamsInputOf<Def>];
|
|
1429
|
+
interface SpaceNamespace<Def extends AnyPlatformDef> {
|
|
1430
|
+
/**
|
|
1431
|
+
* Resolve or create a space from its participants — a single user (1:1
|
|
1432
|
+
* conversation) or several (group, where the platform supports it). Users
|
|
1433
|
+
* may be raw id strings or previously resolved `PlatformUser`s.
|
|
1434
|
+
*/
|
|
1435
|
+
create(users: SpaceUserLike<Def> | SpaceUserLike<Def>[], ...params: SpaceParamsArgs<Def>): Promise<PlatformSpace<Def>>;
|
|
1436
|
+
/**
|
|
1437
|
+
* Construct a space from a known platform space id — e.g. one persisted
|
|
1438
|
+
* from an earlier event. Providers may hydrate platform-specific fields
|
|
1439
|
+
* (or verify existence) via their `space.get` hook.
|
|
1440
|
+
*/
|
|
1441
|
+
get(id: string, ...params: SpaceParamsArgs<Def>): Promise<PlatformSpace<Def>>;
|
|
1442
|
+
}
|
|
1295
1443
|
type SpaceActionFns<Def extends AnyPlatformDef> = Def["space"] extends {
|
|
1296
1444
|
actions?: infer A;
|
|
1297
1445
|
} ? A extends Record<string, SpaceActionFn> ? A : Record<string, never> : Record<string, never>;
|
|
@@ -1322,7 +1470,7 @@ type PlatformMessage<Def extends AnyPlatformDef> = Omit<SchemaInfer<Def["message
|
|
|
1322
1470
|
type PlatformUser<Def extends AnyPlatformDef> = Omit<ResolvedUserOf<Def>, keyof User> & User;
|
|
1323
1471
|
type PlatformInstance<Def extends AnyPlatformDef> = {
|
|
1324
1472
|
readonly messages: AsyncIterable<[PlatformSpace<Def>, PlatformMessage<Def>]>;
|
|
1325
|
-
space
|
|
1473
|
+
readonly space: SpaceNamespace<Def>;
|
|
1326
1474
|
user(userID: string): Promise<PlatformUser<Def>>;
|
|
1327
1475
|
} & CustomEventInstanceProperties<Def> & PlatformWiseInstanceMethods<Def> & InstanceActionMethods<Def>;
|
|
1328
1476
|
type CustomEventInstanceProperties<Def extends AnyPlatformDef> = Def["events"] extends Record<string, unknown> ? {
|
|
@@ -1353,4 +1501,4 @@ interface Platform<Def extends AnyPlatformDef> {
|
|
|
1353
1501
|
(message: Message): PlatformMessage<Def>;
|
|
1354
1502
|
}
|
|
1355
1503
|
|
|
1356
|
-
export { type AgentSender as A, type Broadcaster as B, type ContentBuilder as C, type DedicatedTokenData as D, type EventProducer as E, type FusorTokenData as F, type ProjectProfile as G, type
|
|
1504
|
+
export { asReaction as $, type AgentSender as A, type Broadcaster as B, type ContentBuilder as C, type DedicatedTokenData as D, type EventProducer as E, type FusorTokenData as F, type ProjectProfile as G, type ReactionBuilder as H, type InstanceActionFn as I, type SharedTokenData as J, type SlackTeamMeta as K, type SlackTokenData as L, type Message as M, type SpaceNamespace as N, SpectrumCloudError as O, type Platform as P, type SubscriptionData as Q, type Reaction as R, type SchemaMessage as S, type SubscriptionStatus as T, type User as U, type TokenData as V, broadcast as W, cloud as X, mergeStreams as Y, reaction as Z, stream as _, type PlatformDef as a, type ProjectData as b, type Store as c, type ProviderMessageRecord as d, type Space as e, contentSchema as f, type ProviderMessage as g, type ContentInput as h, type Content as i, type SpaceActionFn as j, type MessageActionFn as k, type CreateClientContext as l, type PlatformProviderConfig as m, type SpectrumLike as n, type CustomEventStreams as o, type AnyPlatformDef as p, type CloudPlatform as q, type ImessageInfoData as r, type ManagedStream as s, type PlatformInstance as t, type PlatformMessage as u, type PlatformRuntime as v, type PlatformSpace as w, type PlatformStatus as x, type PlatformUser as y, type PlatformsData as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spectrum-ts",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Bring agents to any interface — unified messaging SDK for TypeScript.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"@repeaterjs/repeater": "^3.0.6",
|
|
49
49
|
"better-grpc": "^0.3.2",
|
|
50
50
|
"lru-cache": "^11.0.0",
|
|
51
|
+
"marked": "^18.0.5",
|
|
51
52
|
"mime-types": "^3.0.1",
|
|
52
53
|
"nice-grpc": "^2.1.16",
|
|
53
54
|
"nice-grpc-common": "^2.0.2",
|