spectrum-ts 2.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{attachment-B4nSrKVd.d.ts → attachment-CEpGtZLm.d.ts} +1 -1
- package/dist/{authoring-BjE5BvlO.d.ts → authoring-CP3vRza8.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-WXY5QP3M.js → chunk-7ON5XHC2.js} +27 -21
- package/dist/{chunk-6BI4PFTP.js → chunk-CHY5YLLV.js} +1 -1
- package/dist/{chunk-Q537JPTG.js → chunk-FA7VA4XN.js} +10 -10
- package/dist/{chunk-NGC4DJIX.js → chunk-L3NUESOW.js} +425 -137
- package/dist/{chunk-2ILTJC35.js → chunk-LQMDV75O.js} +205 -11
- 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-PSSWQBOH.js} +262 -30
- package/dist/{chunk-U3LXXT3W.js → chunk-Q44CIGG6.js} +20 -8
- package/dist/{chunk-ATNAE7OR.js → chunk-WMG36LHW.js} +676 -159
- package/dist/index.d.ts +107 -56
- package/dist/index.js +29 -182
- package/dist/providers/imessage/index.d.ts +7 -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-Bje8aq1k.d.ts → types-Be0T6E0e.d.ts} +172 -23
- package/dist/{types-BD0-kKyv.d.ts → types-CDYXH2R7.d.ts} +1 -1
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { A as Attachment, a as AttachmentInput, b as attachment } from './attachment-
|
|
1
|
+
export { A as Attachment, a as AttachmentInput, b as attachment } from './attachment-CEpGtZLm.js';
|
|
2
2
|
import z__default from 'zod';
|
|
3
3
|
import { P as PhotoInput } from './photo-content-BJKnqgN-.js';
|
|
4
|
-
import { C as ContentBuilder, M as Message, U as User, e as Space, h as ContentInput, i as Content, g as ProviderMessage, E as EventProducer, j as SpaceActionFn, k as MessageActionFn, I as InstanceActionFn, l as CreateClientContext, c as Store, a as PlatformDef, P as Platform, m as PlatformProviderConfig, n as SpectrumLike, o as CustomEventStreams, A as AgentSender, b as ProjectData } from './types-
|
|
5
|
-
export { p as AnyPlatformDef, B as Broadcaster, q as CloudPlatform, D as DedicatedTokenData, F as FusorTokenData, r as ImessageInfoData, s as ManagedStream, t as PlatformInstance, u as PlatformMessage, v as PlatformRuntime, w as PlatformSpace, x as PlatformStatus, y as PlatformUser, z as PlatformsData, G as ProjectProfile, S as SchemaMessage,
|
|
6
|
-
import { C as ContactInput, a as Contact } from './authoring-
|
|
7
|
-
export { b as ContactAddress, c as ContactDetails, d as ContactEmail, e as ContactName, f as ContactOrg, g as ContactPhone, G as Group, P as Poll, h as PollChoice, i as PollChoiceInput, j as PollOption, R as
|
|
8
|
-
import { a as FusorVerify, F as FusorClient, b as FusorMessages, W as WebhookHandler, c as WebhookRawRequest, d as WebhookRawResult } from './types-
|
|
9
|
-
export { e as FusorEvent, f as FusorMessagesCtx, g as FusorMessagesReturn, h as FusorReply, i as FusorRespond, j as FusorVerifyRequest, k as fusorEvent, l as isFusorEvent } from './types-
|
|
4
|
+
import { C as ContentBuilder, M as Message, U as User, e as Space, h as ContentInput, i as Content, g as ProviderMessage, E as EventProducer, j as SpaceActionFn, k as MessageActionFn, I as InstanceActionFn, l as CreateClientContext, c as Store, a as PlatformDef, P as Platform, m as PlatformProviderConfig, n as SpectrumLike, o as CustomEventStreams, A as AgentSender, b as ProjectData } from './types-Be0T6E0e.js';
|
|
5
|
+
export { p as AnyPlatformDef, B as Broadcaster, q as CloudPlatform, D as DedicatedTokenData, F as FusorTokenData, r as ImessageInfoData, s as ManagedStream, t as PlatformInstance, u as PlatformMessage, v as PlatformRuntime, w as PlatformSpace, x as PlatformStatus, y as PlatformUser, z as PlatformsData, G as ProjectProfile, R as Reaction, H as ReactionBuilder, S as SchemaMessage, J as SharedTokenData, K as SlackTeamMeta, L as SlackTokenData, N as SpaceNamespace, O as SpectrumCloudError, Q as SubscriptionData, T as SubscriptionStatus, V as TokenData, W as broadcast, X as cloud, Y as mergeStreams, Z as reaction, _ as stream } from './types-Be0T6E0e.js';
|
|
6
|
+
import { S as StreamTextSource, T as TextStreamOptions, C as ContactInput, a as Contact } from './authoring-CP3vRza8.js';
|
|
7
|
+
export { b as ContactAddress, c as ContactDetails, d as ContactEmail, e as ContactName, f as ContactOrg, g as ContactPhone, D as DeltaExtractor, G as Group, P as Poll, h as PollChoice, i as PollChoiceInput, j as PollOption, R as Richlink, k as StreamText, V as Voice, l as contact, m as custom, n as group, o as option, p as poll, r as richlink, t as text, v as voice } from './authoring-CP3vRza8.js';
|
|
8
|
+
import { a as FusorVerify, F as FusorClient, b as FusorMessages, W as WebhookHandler, c as WebhookRawRequest, d as WebhookRawResult } from './types-CDYXH2R7.js';
|
|
9
|
+
export { e as FusorEvent, f as FusorMessagesCtx, g as FusorMessagesReturn, h as FusorReply, i as FusorRespond, j as FusorVerifyRequest, k as fusorEvent, l as isFusorEvent } from './types-CDYXH2R7.js';
|
|
10
10
|
import 'hotscript';
|
|
11
11
|
import 'vcf';
|
|
12
12
|
|
|
@@ -67,7 +67,7 @@ declare function avatar(input: Buffer, options: {
|
|
|
67
67
|
* (no new message id is produced; the existing message mutates in place).
|
|
68
68
|
*
|
|
69
69
|
* Edit cannot wrap `edit`, `reply`, `reaction`, `group`, `typing`, `rename`,
|
|
70
|
-
* or `
|
|
70
|
+
* `avatar`, or `unsend` content.
|
|
71
71
|
*/
|
|
72
72
|
declare const editSchema: z__default.ZodObject<{
|
|
73
73
|
type: z__default.ZodLiteral<"edit">;
|
|
@@ -83,6 +83,9 @@ declare const editSchema: z__default.ZodObject<{
|
|
|
83
83
|
} | {
|
|
84
84
|
type: "text";
|
|
85
85
|
text: string;
|
|
86
|
+
} | {
|
|
87
|
+
type: "markdown";
|
|
88
|
+
markdown: string;
|
|
86
89
|
} | {
|
|
87
90
|
type: "attachment";
|
|
88
91
|
id: string;
|
|
@@ -94,6 +97,7 @@ declare const editSchema: z__default.ZodObject<{
|
|
|
94
97
|
} | {
|
|
95
98
|
type: "streamText";
|
|
96
99
|
stream: () => AsyncIterable<string>;
|
|
100
|
+
format?: "markdown" | "plain" | undefined;
|
|
97
101
|
} | {
|
|
98
102
|
type: "custom";
|
|
99
103
|
raw: unknown;
|
|
@@ -190,6 +194,9 @@ declare const editSchema: z__default.ZodObject<{
|
|
|
190
194
|
content: {
|
|
191
195
|
type: "text";
|
|
192
196
|
text: string;
|
|
197
|
+
} | {
|
|
198
|
+
type: "markdown";
|
|
199
|
+
markdown: string;
|
|
193
200
|
} | {
|
|
194
201
|
type: "attachment";
|
|
195
202
|
id: string;
|
|
@@ -218,6 +225,9 @@ declare const editSchema: z__default.ZodObject<{
|
|
|
218
225
|
} | {
|
|
219
226
|
type: "text";
|
|
220
227
|
text: string;
|
|
228
|
+
} | {
|
|
229
|
+
type: "markdown";
|
|
230
|
+
markdown: string;
|
|
221
231
|
} | {
|
|
222
232
|
type: "attachment";
|
|
223
233
|
id: string;
|
|
@@ -229,6 +239,7 @@ declare const editSchema: z__default.ZodObject<{
|
|
|
229
239
|
} | {
|
|
230
240
|
type: "streamText";
|
|
231
241
|
stream: () => AsyncIterable<string>;
|
|
242
|
+
format?: "markdown" | "plain" | undefined;
|
|
232
243
|
} | {
|
|
233
244
|
type: "custom";
|
|
234
245
|
raw: unknown;
|
|
@@ -325,6 +336,9 @@ declare const editSchema: z__default.ZodObject<{
|
|
|
325
336
|
content: {
|
|
326
337
|
type: "text";
|
|
327
338
|
text: string;
|
|
339
|
+
} | {
|
|
340
|
+
type: "markdown";
|
|
341
|
+
markdown: string;
|
|
328
342
|
} | {
|
|
329
343
|
type: "attachment";
|
|
330
344
|
id: string;
|
|
@@ -352,7 +366,38 @@ type Edit = z__default.infer<typeof editSchema>;
|
|
|
352
366
|
* this with an inbound target throws at build time so the misuse surfaces
|
|
353
367
|
* before the send pipeline runs.
|
|
354
368
|
*/
|
|
355
|
-
declare function edit(content: ContentInput, target: Message): ContentBuilder;
|
|
369
|
+
declare function edit(content: ContentInput, target: Message | undefined): ContentBuilder;
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Styled text written in standard markdown (CommonMark plus GFM tables and
|
|
373
|
+
* strikethrough). Outbound-only by design: inbound messages always surface as
|
|
374
|
+
* `text` content — no provider maps platform formatting back to markdown.
|
|
375
|
+
* Each platform renders the markdown to its native format (Telegram: HTML via
|
|
376
|
+
* `parse_mode`; remote iMessage: styled text via UTF-16 formatting ranges);
|
|
377
|
+
* platforms without native support receive readable plain text via the send
|
|
378
|
+
* pipeline's markdown fallback.
|
|
379
|
+
*/
|
|
380
|
+
declare const markdownSchema: z__default.ZodObject<{
|
|
381
|
+
type: z__default.ZodLiteral<"markdown">;
|
|
382
|
+
markdown: z__default.ZodString;
|
|
383
|
+
}, z__default.core.$strip>;
|
|
384
|
+
type Markdown = z__default.infer<typeof markdownSchema>;
|
|
385
|
+
/**
|
|
386
|
+
* Send styled text written in standard markdown — a static string or a
|
|
387
|
+
* streaming LLM response.
|
|
388
|
+
*
|
|
389
|
+
* - `markdown("**hi**")` sends the markdown as one message.
|
|
390
|
+
* - `markdown(source)` marks a text stream as markdown: platforms with native
|
|
391
|
+
* support stream it styled (Telegram renders drafts and the final message
|
|
392
|
+
* via `parse_mode`), and everywhere else the accumulated text falls back
|
|
393
|
+
* through the markdown chain instead of surfacing raw `**` markers.
|
|
394
|
+
*
|
|
395
|
+
* Stream sources and options work exactly as in `text()` — any SDK streaming
|
|
396
|
+
* result or `AsyncIterable` / `ReadableStream`, with `options.extract` for
|
|
397
|
+
* unrecognized chunk shapes.
|
|
398
|
+
*/
|
|
399
|
+
declare function markdown(source: string): ContentBuilder;
|
|
400
|
+
declare function markdown<T = unknown>(source: StreamTextSource<T>, options?: TextStreamOptions<T>): ContentBuilder;
|
|
356
401
|
|
|
357
402
|
/**
|
|
358
403
|
* Rename the current chat. Universal content — providers dispatch by
|
|
@@ -382,7 +427,7 @@ declare function rename(displayName: string): ContentBuilder;
|
|
|
382
427
|
* `reply` like any other content type and route to a threaded send.
|
|
383
428
|
*
|
|
384
429
|
* Reply cannot wrap `reply`, `edit`, `reaction`, `group`, `typing`,
|
|
385
|
-
* `rename`, or `
|
|
430
|
+
* `rename`, `avatar`, or `unsend` content.
|
|
386
431
|
*/
|
|
387
432
|
declare const replySchema: z__default.ZodObject<{
|
|
388
433
|
type: z__default.ZodLiteral<"reply">;
|
|
@@ -398,6 +443,9 @@ declare const replySchema: z__default.ZodObject<{
|
|
|
398
443
|
} | {
|
|
399
444
|
type: "text";
|
|
400
445
|
text: string;
|
|
446
|
+
} | {
|
|
447
|
+
type: "markdown";
|
|
448
|
+
markdown: string;
|
|
401
449
|
} | {
|
|
402
450
|
type: "attachment";
|
|
403
451
|
id: string;
|
|
@@ -409,6 +457,7 @@ declare const replySchema: z__default.ZodObject<{
|
|
|
409
457
|
} | {
|
|
410
458
|
type: "streamText";
|
|
411
459
|
stream: () => AsyncIterable<string>;
|
|
460
|
+
format?: "markdown" | "plain" | undefined;
|
|
412
461
|
} | {
|
|
413
462
|
type: "custom";
|
|
414
463
|
raw: unknown;
|
|
@@ -505,6 +554,9 @@ declare const replySchema: z__default.ZodObject<{
|
|
|
505
554
|
content: {
|
|
506
555
|
type: "text";
|
|
507
556
|
text: string;
|
|
557
|
+
} | {
|
|
558
|
+
type: "markdown";
|
|
559
|
+
markdown: string;
|
|
508
560
|
} | {
|
|
509
561
|
type: "attachment";
|
|
510
562
|
id: string;
|
|
@@ -533,6 +585,9 @@ declare const replySchema: z__default.ZodObject<{
|
|
|
533
585
|
} | {
|
|
534
586
|
type: "text";
|
|
535
587
|
text: string;
|
|
588
|
+
} | {
|
|
589
|
+
type: "markdown";
|
|
590
|
+
markdown: string;
|
|
536
591
|
} | {
|
|
537
592
|
type: "attachment";
|
|
538
593
|
id: string;
|
|
@@ -544,6 +599,7 @@ declare const replySchema: z__default.ZodObject<{
|
|
|
544
599
|
} | {
|
|
545
600
|
type: "streamText";
|
|
546
601
|
stream: () => AsyncIterable<string>;
|
|
602
|
+
format?: "markdown" | "plain" | undefined;
|
|
547
603
|
} | {
|
|
548
604
|
type: "custom";
|
|
549
605
|
raw: unknown;
|
|
@@ -640,6 +696,9 @@ declare const replySchema: z__default.ZodObject<{
|
|
|
640
696
|
content: {
|
|
641
697
|
type: "text";
|
|
642
698
|
text: string;
|
|
699
|
+
} | {
|
|
700
|
+
type: "markdown";
|
|
701
|
+
markdown: string;
|
|
643
702
|
} | {
|
|
644
703
|
type: "attachment";
|
|
645
704
|
id: string;
|
|
@@ -660,56 +719,13 @@ declare const replySchema: z__default.ZodObject<{
|
|
|
660
719
|
target: z__default.ZodCustom<Message<string, User, Space<unknown>>, Message<string, User, Space<unknown>>>;
|
|
661
720
|
}, z__default.core.$strip>;
|
|
662
721
|
type Reply = z__default.infer<typeof replySchema>;
|
|
663
|
-
declare function reply(content: ContentInput, target: Message): ContentBuilder;
|
|
722
|
+
declare function reply(content: ContentInput, target: Message | undefined): ContentBuilder;
|
|
664
723
|
|
|
665
724
|
declare const resolveContents: (items: readonly ContentInput[]) => Promise<Content[]>;
|
|
666
725
|
|
|
667
|
-
/**
|
|
668
|
-
* Maps one chunk emitted by a stream to the incremental text it carries.
|
|
669
|
-
* Return a string to emit, or `null`/`undefined` to skip the chunk (e.g. for
|
|
670
|
-
* control events that carry no text).
|
|
671
|
-
*/
|
|
672
|
-
type DeltaExtractor<T> = (chunk: T) => string | null | undefined;
|
|
673
|
-
/**
|
|
674
|
-
* Anything `streamText()` accepts as a source. The builder normalizes all of
|
|
675
|
-
* these to an internal `AsyncIterable<string>` of text deltas:
|
|
676
|
-
*
|
|
677
|
-
* - the Vercel AI SDK `streamText()` result (its `.textStream` is picked up
|
|
678
|
-
* automatically — pass either the whole result or `.textStream` directly),
|
|
679
|
-
* - a raw `AsyncIterable<T>` (e.g. an OpenAI / Anthropic streaming response),
|
|
680
|
-
* - a raw `ReadableStream<T>` of chunks.
|
|
681
|
-
*/
|
|
682
|
-
type StreamTextSource<T = unknown> = {
|
|
683
|
-
textStream: AsyncIterable<string> | ReadableStream<string>;
|
|
684
|
-
} | AsyncIterable<T> | ReadableStream<T>;
|
|
685
|
-
interface StreamTextOptions<T = unknown> {
|
|
686
|
-
/**
|
|
687
|
-
* Map each chunk to its incremental text. Omit to rely on built-in
|
|
688
|
-
* auto-detection of the common SDK shapes (OpenAI chat/responses, Anthropic
|
|
689
|
-
* messages, AI SDK text streams, and plain strings).
|
|
690
|
-
*/
|
|
691
|
-
extract?: DeltaExtractor<T>;
|
|
692
|
-
}
|
|
693
|
-
declare const streamTextSchema: z__default.ZodObject<{
|
|
694
|
-
type: z__default.ZodLiteral<"streamText">;
|
|
695
|
-
stream: z__default.ZodCustom<() => AsyncIterable<string>, () => AsyncIterable<string>>;
|
|
696
|
-
}, z__default.core.$strip>;
|
|
697
|
-
type StreamText = z__default.infer<typeof streamTextSchema>;
|
|
698
|
-
/**
|
|
699
|
-
* Wrap a streaming LLM text response so it can be sent like any other content.
|
|
700
|
-
*
|
|
701
|
-
* Delivery is platform-specific — iMessage (remote) sends the first chunk as a
|
|
702
|
-
* real message and then edits it in place as more text arrives. Platforms that
|
|
703
|
-
* can't stream reject it (the send is warn-and-skipped).
|
|
704
|
-
*
|
|
705
|
-
* Accepts whatever the popular SDKs return; pass `options.extract` for any
|
|
706
|
-
* chunk shape the built-in detection doesn't recognize.
|
|
707
|
-
*/
|
|
708
|
-
declare function streamText<T = unknown>(source: StreamTextSource<T>, options?: StreamTextOptions<T>): ContentBuilder;
|
|
709
|
-
|
|
710
726
|
/**
|
|
711
727
|
* A `typing` content value carries a typing-indicator signal — either
|
|
712
|
-
* `"start"` or `"stop"`. Like `
|
|
728
|
+
* `"start"` or `"stop"`. Like `edit`, it's fire-and-forget: providers
|
|
713
729
|
* dispatch on `content.type === "typing"` inside their `send()` action and
|
|
714
730
|
* `space.send(typing(...))` resolves to `undefined`.
|
|
715
731
|
*
|
|
@@ -734,6 +750,41 @@ type Typing = z__default.infer<typeof typingSchema>;
|
|
|
734
750
|
*/
|
|
735
751
|
declare function typing(state?: "start" | "stop"): ContentBuilder;
|
|
736
752
|
|
|
753
|
+
/**
|
|
754
|
+
* An `unsend` retracts a previously-sent outbound message.
|
|
755
|
+
*
|
|
756
|
+
* `space.send(unsend(message))` is the canonical outbound API;
|
|
757
|
+
* `message.unsend()` and `space.unsend(message)` are sugar that delegate
|
|
758
|
+
* here. Unsends are fire-and-forget — providers handle them inside their
|
|
759
|
+
* `send` action and the resolved value is `undefined` (no new message id is
|
|
760
|
+
* produced; the existing message is retracted in place).
|
|
761
|
+
*
|
|
762
|
+
* Platform constraints surface from the provider at send time — e.g.
|
|
763
|
+
* iMessage enforces Apple's ~2-minute unsend window for regular messages
|
|
764
|
+
* (reaction removal is not time-limited), and a late or repeated unsend
|
|
765
|
+
* rejects with the provider's error. `space.getMessage(id)` results are
|
|
766
|
+
* wrapped as inbound, so a message cannot be unsent from a refetched id
|
|
767
|
+
* after a restart — keep the Message returned by `send` (same limitation
|
|
768
|
+
* as `edit`).
|
|
769
|
+
*/
|
|
770
|
+
declare const unsendSchema: z__default.ZodObject<{
|
|
771
|
+
type: z__default.ZodLiteral<"unsend">;
|
|
772
|
+
target: z__default.ZodCustom<Message<string, User, Space<unknown>>, Message<string, User, Space<unknown>>>;
|
|
773
|
+
}, z__default.core.$strip>;
|
|
774
|
+
type Unsend = z__default.infer<typeof unsendSchema>;
|
|
775
|
+
/**
|
|
776
|
+
* Construct an `unsend` content value retracting `target`.
|
|
777
|
+
*
|
|
778
|
+
* Only outbound messages (those sent by the agent) can be unsent; calling
|
|
779
|
+
* this with an inbound target throws at build time so the misuse surfaces
|
|
780
|
+
* before the send pipeline runs.
|
|
781
|
+
*
|
|
782
|
+
* Accepts `Message | undefined` so `space.send` results chain without
|
|
783
|
+
* narrowing (`send` resolves `undefined` when a platform skips unsupported
|
|
784
|
+
* content); an undefined target throws at build time.
|
|
785
|
+
*/
|
|
786
|
+
declare function unsend(target: Message | undefined): ContentBuilder;
|
|
787
|
+
|
|
737
788
|
declare const Emoji: {
|
|
738
789
|
readonly love: "❤️";
|
|
739
790
|
readonly like: "👍";
|
|
@@ -2782,4 +2833,4 @@ declare class UnsupportedError extends Error {
|
|
|
2782
2833
|
declare const fromVCard: (vcf: string) => ContactInput;
|
|
2783
2834
|
declare const toVCard: (contact: Contact) => Promise<string>;
|
|
2784
2835
|
|
|
2785
|
-
export { AgentSender, type Avatar, type AvatarInput, Contact, ContactInput, Content, ContentBuilder, ContentInput, type
|
|
2836
|
+
export { AgentSender, type Avatar, type AvatarInput, Contact, ContactInput, Content, ContentBuilder, ContentInput, type Edit, Emoji, type EmojiKey, EventProducer, FusorClient, FusorMessages, FusorVerify, type Markdown, Message, Platform, PlatformDef, PlatformProviderConfig, ProjectData, ProviderMessage, type Rename, type Reply, Space, Spectrum, type SpectrumInstance, StreamTextSource, TextStreamOptions, type Typing, type Unsend, UnsupportedError, type UnsupportedKind, User, WebhookHandler, WebhookRawRequest, WebhookRawResult, avatar, definePlatform, edit, fromVCard, fusor, isFusorClient, markdown, rename, reply, resolveContents, toVCard, typing, unsend };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __spectrumCreateRequire } from "node:module"; const require = __spectrumCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
richlink
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CHY5YLLV.js";
|
|
5
5
|
import {
|
|
6
6
|
FUSOR_MESSAGES_CHANNEL,
|
|
7
7
|
fusor,
|
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
} from "./chunk-34FQGGD7.js";
|
|
12
12
|
import {
|
|
13
13
|
group
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-MHGCPC2V.js";
|
|
15
15
|
import {
|
|
16
16
|
voice
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-77U6SH5A.js";
|
|
18
18
|
import {
|
|
19
19
|
option,
|
|
20
20
|
poll
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
} from "./chunk-3GEJYGZK.js";
|
|
26
26
|
import {
|
|
27
27
|
contact
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-NZ5WCMTY.js";
|
|
29
29
|
import {
|
|
30
30
|
broadcast,
|
|
31
31
|
createAsyncQueue,
|
|
@@ -43,12 +43,14 @@ import {
|
|
|
43
43
|
contentAttrs,
|
|
44
44
|
definePlatform,
|
|
45
45
|
edit,
|
|
46
|
+
markdown,
|
|
46
47
|
rename,
|
|
47
48
|
reply,
|
|
48
49
|
senderAttrs,
|
|
49
50
|
typing,
|
|
51
|
+
unsend,
|
|
50
52
|
wrapProviderMessage
|
|
51
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-L3NUESOW.js";
|
|
52
54
|
import {
|
|
53
55
|
__commonJS,
|
|
54
56
|
__esm,
|
|
@@ -61,7 +63,7 @@ import {
|
|
|
61
63
|
reaction,
|
|
62
64
|
resolveContents,
|
|
63
65
|
text
|
|
64
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-LQMDV75O.js";
|
|
65
67
|
|
|
66
68
|
// ../../node_modules/@grpc/grpc-js/build/src/constants.js
|
|
67
69
|
var require_constants = __commonJS({
|
|
@@ -6456,13 +6458,13 @@ var require_path = __commonJS({
|
|
|
6456
6458
|
return /^(?:\/|\w+:)/.test(path2);
|
|
6457
6459
|
}
|
|
6458
6460
|
);
|
|
6459
|
-
var
|
|
6461
|
+
var normalize = (
|
|
6460
6462
|
/**
|
|
6461
6463
|
* Normalizes the specified path.
|
|
6462
6464
|
* @param {string} path Path to normalize
|
|
6463
6465
|
* @returns {string} Normalized path
|
|
6464
6466
|
*/
|
|
6465
|
-
path.normalize = function
|
|
6467
|
+
path.normalize = function normalize2(path2) {
|
|
6466
6468
|
path2 = path2.replace(/\\/g, "/").replace(/\/{2,}/g, "/");
|
|
6467
6469
|
var parts = path2.split("/"), absolute = isAbsolute(path2), prefix = "";
|
|
6468
6470
|
if (absolute)
|
|
@@ -6485,12 +6487,12 @@ var require_path = __commonJS({
|
|
|
6485
6487
|
);
|
|
6486
6488
|
path.resolve = function resolve(originPath, includePath, alreadyNormalized) {
|
|
6487
6489
|
if (!alreadyNormalized)
|
|
6488
|
-
includePath =
|
|
6490
|
+
includePath = normalize(includePath);
|
|
6489
6491
|
if (isAbsolute(includePath))
|
|
6490
6492
|
return includePath;
|
|
6491
6493
|
if (!alreadyNormalized)
|
|
6492
|
-
originPath =
|
|
6493
|
-
return (originPath = originPath.replace(/(?:\/|^)[^/]+$/, "")).length ?
|
|
6494
|
+
originPath = normalize(originPath);
|
|
6495
|
+
return (originPath = originPath.replace(/(?:\/|^)[^/]+$/, "")).length ? normalize(originPath + "/" + includePath) : includePath;
|
|
6494
6496
|
};
|
|
6495
6497
|
}
|
|
6496
6498
|
});
|
|
@@ -24207,162 +24209,6 @@ var require_src3 = __commonJS({
|
|
|
24207
24209
|
}
|
|
24208
24210
|
});
|
|
24209
24211
|
|
|
24210
|
-
// src/content/stream-text.ts
|
|
24211
|
-
import z from "zod";
|
|
24212
|
-
var streamTextSchema = z.object({
|
|
24213
|
-
type: z.literal("streamText"),
|
|
24214
|
-
// A single-consumption producer of normalized text deltas. The builder
|
|
24215
|
-
// closes over the normalized source; the platform driver calls it once.
|
|
24216
|
-
// Kept opaque to Zod via `z.custom` (same approach as `attachment.read`).
|
|
24217
|
-
stream: z.custom(
|
|
24218
|
-
(v) => typeof v === "function",
|
|
24219
|
-
{
|
|
24220
|
-
message: "streamText.stream must be a function returning AsyncIterable<string>"
|
|
24221
|
-
}
|
|
24222
|
-
)
|
|
24223
|
-
});
|
|
24224
|
-
var asRecord = (value) => typeof value === "object" && value !== null ? value : void 0;
|
|
24225
|
-
var SKIP_EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
24226
|
-
"message_start",
|
|
24227
|
-
"message_delta",
|
|
24228
|
-
"message_stop",
|
|
24229
|
-
"content_block_start",
|
|
24230
|
-
"content_block_stop",
|
|
24231
|
-
"ping"
|
|
24232
|
-
]);
|
|
24233
|
-
var fromOpenAIResponses = (obj) => {
|
|
24234
|
-
const type = obj.type;
|
|
24235
|
-
if (typeof type !== "string" || !type.startsWith("response.")) {
|
|
24236
|
-
return;
|
|
24237
|
-
}
|
|
24238
|
-
if (type === "response.output_text.delta" && typeof obj.delta === "string") {
|
|
24239
|
-
return obj.delta;
|
|
24240
|
-
}
|
|
24241
|
-
return null;
|
|
24242
|
-
};
|
|
24243
|
-
var fromAnthropicDelta = (obj) => {
|
|
24244
|
-
if (obj.type !== "content_block_delta") {
|
|
24245
|
-
return;
|
|
24246
|
-
}
|
|
24247
|
-
const delta = asRecord(obj.delta);
|
|
24248
|
-
if (delta?.type === "text_delta" && typeof delta.text === "string") {
|
|
24249
|
-
return delta.text;
|
|
24250
|
-
}
|
|
24251
|
-
return null;
|
|
24252
|
-
};
|
|
24253
|
-
var fromAiSdkPart = (obj) => {
|
|
24254
|
-
if (obj.type !== "text-delta") {
|
|
24255
|
-
return;
|
|
24256
|
-
}
|
|
24257
|
-
if (typeof obj.textDelta === "string") {
|
|
24258
|
-
return obj.textDelta;
|
|
24259
|
-
}
|
|
24260
|
-
return typeof obj.text === "string" ? obj.text : null;
|
|
24261
|
-
};
|
|
24262
|
-
var fromOpenAIChat = (obj) => {
|
|
24263
|
-
if (!Array.isArray(obj.choices)) {
|
|
24264
|
-
return;
|
|
24265
|
-
}
|
|
24266
|
-
const delta = asRecord(asRecord(obj.choices[0])?.delta);
|
|
24267
|
-
const content = delta?.content;
|
|
24268
|
-
return typeof content === "string" ? content : null;
|
|
24269
|
-
};
|
|
24270
|
-
var fromControlEvent = (obj) => typeof obj.type === "string" && SKIP_EVENT_TYPES.has(obj.type) ? null : void 0;
|
|
24271
|
-
var OBJECT_EXTRACTORS = [
|
|
24272
|
-
fromOpenAIResponses,
|
|
24273
|
-
fromAnthropicDelta,
|
|
24274
|
-
fromAiSdkPart,
|
|
24275
|
-
fromOpenAIChat,
|
|
24276
|
-
fromControlEvent
|
|
24277
|
-
];
|
|
24278
|
-
var defaultExtract = (chunk) => {
|
|
24279
|
-
if (typeof chunk === "string") {
|
|
24280
|
-
return chunk;
|
|
24281
|
-
}
|
|
24282
|
-
const record = asRecord(chunk);
|
|
24283
|
-
if (!record) {
|
|
24284
|
-
throw new Error(
|
|
24285
|
-
`streamText: cannot extract a text delta from a ${typeof chunk} chunk. Pass { extract } to map your stream's chunks to text.`
|
|
24286
|
-
);
|
|
24287
|
-
}
|
|
24288
|
-
for (const extractor of OBJECT_EXTRACTORS) {
|
|
24289
|
-
const result = extractor(record);
|
|
24290
|
-
if (result !== void 0) {
|
|
24291
|
-
return result;
|
|
24292
|
-
}
|
|
24293
|
-
}
|
|
24294
|
-
throw new Error(
|
|
24295
|
-
`streamText: unrecognized chunk shape (type=${String(record.type)}). Pass an { extract } function to map your provider's chunk to a text delta.`
|
|
24296
|
-
);
|
|
24297
|
-
};
|
|
24298
|
-
var isReadableStream = (value) => typeof value?.getReader === "function";
|
|
24299
|
-
var isAsyncIterable = (value) => typeof value?.[Symbol.asyncIterator] === "function";
|
|
24300
|
-
async function* readableToAsync(source) {
|
|
24301
|
-
if (isAsyncIterable(source)) {
|
|
24302
|
-
yield* source;
|
|
24303
|
-
return;
|
|
24304
|
-
}
|
|
24305
|
-
const reader = source.getReader();
|
|
24306
|
-
try {
|
|
24307
|
-
while (true) {
|
|
24308
|
-
const { done, value } = await reader.read();
|
|
24309
|
-
if (done) {
|
|
24310
|
-
return;
|
|
24311
|
-
}
|
|
24312
|
-
yield value;
|
|
24313
|
-
}
|
|
24314
|
-
} finally {
|
|
24315
|
-
reader.releaseLock();
|
|
24316
|
-
}
|
|
24317
|
-
}
|
|
24318
|
-
var resolveChunkIterable = (source) => {
|
|
24319
|
-
const textStream = source.textStream;
|
|
24320
|
-
if (textStream != null) {
|
|
24321
|
-
if (isReadableStream(textStream)) {
|
|
24322
|
-
return readableToAsync(textStream);
|
|
24323
|
-
}
|
|
24324
|
-
if (isAsyncIterable(textStream)) {
|
|
24325
|
-
return textStream;
|
|
24326
|
-
}
|
|
24327
|
-
throw new Error(
|
|
24328
|
-
"streamText: `.textStream` must be an AsyncIterable or a ReadableStream."
|
|
24329
|
-
);
|
|
24330
|
-
}
|
|
24331
|
-
if (isReadableStream(source)) {
|
|
24332
|
-
return readableToAsync(source);
|
|
24333
|
-
}
|
|
24334
|
-
if (isAsyncIterable(source)) {
|
|
24335
|
-
return source;
|
|
24336
|
-
}
|
|
24337
|
-
throw new Error(
|
|
24338
|
-
"streamText: source must be an AsyncIterable, a ReadableStream, or an object with a `.textStream` (e.g. the AI SDK streamText() result)."
|
|
24339
|
-
);
|
|
24340
|
-
};
|
|
24341
|
-
var normalize = (source, options) => {
|
|
24342
|
-
const extract = options?.extract ? options.extract : defaultExtract;
|
|
24343
|
-
let consumed = false;
|
|
24344
|
-
return async function* normalized() {
|
|
24345
|
-
if (consumed) {
|
|
24346
|
-
throw new Error(
|
|
24347
|
-
"streamText: this source has already been consumed \u2014 a stream can only be sent once."
|
|
24348
|
-
);
|
|
24349
|
-
}
|
|
24350
|
-
consumed = true;
|
|
24351
|
-
for await (const chunk of resolveChunkIterable(source)) {
|
|
24352
|
-
const delta = extract(chunk);
|
|
24353
|
-
if (delta) {
|
|
24354
|
-
yield delta;
|
|
24355
|
-
}
|
|
24356
|
-
}
|
|
24357
|
-
};
|
|
24358
|
-
};
|
|
24359
|
-
var asStreamText = (input) => streamTextSchema.parse({ type: "streamText", stream: input.stream });
|
|
24360
|
-
function streamText(source, options) {
|
|
24361
|
-
return {
|
|
24362
|
-
build: async () => asStreamText({ stream: normalize(source, options) })
|
|
24363
|
-
};
|
|
24364
|
-
}
|
|
24365
|
-
|
|
24366
24212
|
// src/emoji/generated.ts
|
|
24367
24213
|
var GeneratedEmoji = {
|
|
24368
24214
|
_1stPlaceMedal: "\u{1F947}",
|
|
@@ -26299,7 +26145,7 @@ import {
|
|
|
26299
26145
|
withSpan
|
|
26300
26146
|
} from "@photon-ai/otel";
|
|
26301
26147
|
import { RawInboundEvent as RawInboundEvent2 } from "@photon-ai/proto/photon/fusor/v1/inbound";
|
|
26302
|
-
import
|
|
26148
|
+
import z from "zod";
|
|
26303
26149
|
|
|
26304
26150
|
// src/build-env.ts
|
|
26305
26151
|
var SPECTRUM_SDK_VERSION = "local";
|
|
@@ -27726,23 +27572,23 @@ var PHOTON_OTEL_ENDPOINT = "https://otlp.photon.codes";
|
|
|
27726
27572
|
var STREAM_CLOSE_TIMEOUT_MS = 5e3;
|
|
27727
27573
|
var lifecycleLog = createLogger2("spectrum.lifecycle");
|
|
27728
27574
|
var ignoreCleanupError = () => void 0;
|
|
27729
|
-
var spectrumOptionsSchema =
|
|
27730
|
-
flattenGroups:
|
|
27575
|
+
var spectrumOptionsSchema = z.object({
|
|
27576
|
+
flattenGroups: z.boolean().optional()
|
|
27731
27577
|
}).optional();
|
|
27732
|
-
var spectrumConfigSchema =
|
|
27733
|
-
|
|
27734
|
-
projectId:
|
|
27735
|
-
projectSecret:
|
|
27736
|
-
providers:
|
|
27578
|
+
var spectrumConfigSchema = z.union([
|
|
27579
|
+
z.object({
|
|
27580
|
+
projectId: z.string().min(1),
|
|
27581
|
+
projectSecret: z.string().min(1),
|
|
27582
|
+
providers: z.array(z.custom()),
|
|
27737
27583
|
options: spectrumOptionsSchema,
|
|
27738
|
-
telemetry:
|
|
27584
|
+
telemetry: z.boolean().optional()
|
|
27739
27585
|
}),
|
|
27740
|
-
|
|
27741
|
-
projectId:
|
|
27742
|
-
projectSecret:
|
|
27743
|
-
providers:
|
|
27586
|
+
z.object({
|
|
27587
|
+
projectId: z.undefined().optional(),
|
|
27588
|
+
projectSecret: z.undefined().optional(),
|
|
27589
|
+
providers: z.array(z.custom()),
|
|
27744
27590
|
options: spectrumOptionsSchema,
|
|
27745
|
-
telemetry:
|
|
27591
|
+
telemetry: z.boolean().optional()
|
|
27746
27592
|
})
|
|
27747
27593
|
]);
|
|
27748
27594
|
function bootstrapTelemetry(opts) {
|
|
@@ -28368,6 +28214,7 @@ export {
|
|
|
28368
28214
|
group,
|
|
28369
28215
|
isFusorClient,
|
|
28370
28216
|
isFusorEvent,
|
|
28217
|
+
markdown,
|
|
28371
28218
|
mergeStreams,
|
|
28372
28219
|
option,
|
|
28373
28220
|
poll,
|
|
@@ -28377,10 +28224,10 @@ export {
|
|
|
28377
28224
|
resolveContents,
|
|
28378
28225
|
richlink,
|
|
28379
28226
|
stream,
|
|
28380
|
-
streamText,
|
|
28381
28227
|
text,
|
|
28382
28228
|
toVCard,
|
|
28383
28229
|
typing,
|
|
28230
|
+
unsend,
|
|
28384
28231
|
voice
|
|
28385
28232
|
};
|
|
28386
28233
|
/*! Bundled license information:
|
|
@@ -1,8 +1,8 @@
|
|
|
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-
|
|
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-Be0T6E0e.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-
|
|
5
|
+
import { A as Attachment } from '../../attachment-CEpGtZLm.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';
|
|
@@ -149,6 +149,7 @@ declare const spaceSchema: z__default.ZodObject<{
|
|
|
149
149
|
phone: z__default.ZodString;
|
|
150
150
|
}, z__default.core.$strip>;
|
|
151
151
|
type IMessageMessage = SchemaMessage<typeof userSchema, typeof spaceSchema> & {
|
|
152
|
+
direction?: "inbound" | "outbound";
|
|
152
153
|
partIndex?: number;
|
|
153
154
|
parentId?: string;
|
|
154
155
|
};
|
|
@@ -179,11 +180,7 @@ declare const imessage: Platform<PlatformDef<"iMessage", z.ZodUnion<readonly [z.
|
|
|
179
180
|
id: string;
|
|
180
181
|
}, {
|
|
181
182
|
id: string;
|
|
182
|
-
type: "dm";
|
|
183
|
-
phone: string;
|
|
184
|
-
} | {
|
|
185
|
-
id: string;
|
|
186
|
-
type: "group";
|
|
183
|
+
type: "group" | "dm";
|
|
187
184
|
phone: string;
|
|
188
185
|
}, z.ZodObject<{
|
|
189
186
|
partIndex: z.ZodOptional<z.ZodNumber>;
|
|
@@ -213,15 +210,11 @@ declare const imessage: Platform<PlatformDef<"iMessage", z.ZodUnion<readonly [z.
|
|
|
213
210
|
}[] | undefined;
|
|
214
211
|
};
|
|
215
212
|
store: Store;
|
|
216
|
-
}, space:
|
|
217
|
-
id: string;
|
|
218
|
-
type: "dm";
|
|
219
|
-
phone: string;
|
|
220
|
-
} | {
|
|
213
|
+
}, space: {
|
|
221
214
|
id: string;
|
|
222
|
-
type: "group";
|
|
215
|
+
type: "group" | "dm";
|
|
223
216
|
phone: string;
|
|
224
|
-
}
|
|
217
|
+
} & {
|
|
225
218
|
id: string;
|
|
226
219
|
__platform: string;
|
|
227
220
|
}, messageId: string) => Promise<IMessageMessage | undefined>;
|
|
@@ -5,16 +5,16 @@ import {
|
|
|
5
5
|
effect,
|
|
6
6
|
imessage,
|
|
7
7
|
read
|
|
8
|
-
} from "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
10
|
-
import "../../chunk-
|
|
8
|
+
} from "../../chunk-WMG36LHW.js";
|
|
9
|
+
import "../../chunk-CHY5YLLV.js";
|
|
10
|
+
import "../../chunk-MHGCPC2V.js";
|
|
11
11
|
import "../../chunk-2D27WW5B.js";
|
|
12
12
|
import "../../chunk-3GEJYGZK.js";
|
|
13
|
-
import "../../chunk-
|
|
13
|
+
import "../../chunk-NZ5WCMTY.js";
|
|
14
14
|
import "../../chunk-5XEFJBN2.js";
|
|
15
15
|
import "../../chunk-6UZFVXQF.js";
|
|
16
|
-
import "../../chunk-
|
|
17
|
-
import "../../chunk-
|
|
16
|
+
import "../../chunk-L3NUESOW.js";
|
|
17
|
+
import "../../chunk-LQMDV75O.js";
|
|
18
18
|
export {
|
|
19
19
|
background,
|
|
20
20
|
customizedMiniApp,
|