@smooai/chat-widget 0.12.0 → 0.14.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 +1 -0
- package/dist/chat-widget.global.js +676 -50
- package/dist/chat-widget.global.js.map +1 -1
- package/dist/index.d.ts +268 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +703 -51
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/config.ts +29 -1
- package/src/conversation.ts +116 -2
- package/src/element.ts +252 -15
- package/src/index.ts +21 -1
- package/src/styles.ts +83 -0
- package/src/voice-session.ts +420 -0
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,17 @@ import { Citation } from "@smooai/smooth-operator";
|
|
|
2
2
|
import { StoreApi } from "zustand/vanilla";
|
|
3
3
|
|
|
4
4
|
//#region src/config.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Browser voice input/output (SMOODEV-2534). OFF by default — when disabled the
|
|
7
|
+
* widget renders zero voice UI. When enabled, a mic toggle appears in the
|
|
8
|
+
* composer and speech flows over the browser-voice WebSocket.
|
|
9
|
+
*/
|
|
10
|
+
interface ChatWidgetVoiceConfig {
|
|
11
|
+
/** Turn the voice feature on. Default `false`. */
|
|
12
|
+
enabled?: boolean;
|
|
13
|
+
/** Browser-voice WS endpoint. Defaults to the hosted SmooAI voice service. */
|
|
14
|
+
url?: string;
|
|
15
|
+
}
|
|
5
16
|
interface ChatWidgetTheme {
|
|
6
17
|
/** Foreground text color for the widget chrome. */
|
|
7
18
|
text?: string;
|
|
@@ -134,6 +145,18 @@ interface ChatWidgetConfig {
|
|
|
134
145
|
* `require*` flags are ignored and the pre-chat form is skipped.
|
|
135
146
|
*/
|
|
136
147
|
allowAnonymous?: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Show the agent's tool activity (grep / read_file / bash / knowledge_search…)
|
|
150
|
+
* as inline chips interleaved with its prose, mirroring the smooth daemon SPA.
|
|
151
|
+
*
|
|
152
|
+
* Defaults to **`false`**: for a customer-facing support widget, surfacing raw
|
|
153
|
+
* tool calls to an end-user is usually undesirable, so tool activity is hidden
|
|
154
|
+
* and only the assistant's prose renders. Enable it for internal / power-user
|
|
155
|
+
* surfaces where seeing what the agent did mid-turn is valuable.
|
|
156
|
+
*/
|
|
157
|
+
showToolActivity?: boolean;
|
|
158
|
+
/** Browser voice input/output. OFF by default (zero UI when off). */
|
|
159
|
+
voice?: ChatWidgetVoiceConfig;
|
|
137
160
|
/** Theme overrides. */
|
|
138
161
|
theme?: ChatWidgetTheme;
|
|
139
162
|
}
|
|
@@ -219,6 +242,36 @@ declare function createWidgetStore(agentId: string): StoreApi<WidgetStore>;
|
|
|
219
242
|
*/
|
|
220
243
|
declare function httpBaseFromWsEndpoint(endpoint: string): string | null;
|
|
221
244
|
type Role = 'user' | 'assistant';
|
|
245
|
+
/**
|
|
246
|
+
* One tool invocation within an assistant turn. Mirrors the smooth daemon SPA's
|
|
247
|
+
* `ToolCall` (`crates/smooth-web/web/src/operator.ts`): opens `done: false` on the
|
|
248
|
+
* tool call and resolves on the tool result.
|
|
249
|
+
*/
|
|
250
|
+
interface ToolCall {
|
|
251
|
+
/** Stable id for keyed rendering (assigned when the call opens). */
|
|
252
|
+
id: string;
|
|
253
|
+
name: string;
|
|
254
|
+
/** Raw arguments, JSON-stringified. */
|
|
255
|
+
args: string;
|
|
256
|
+
/** Present once the tool resolves. */
|
|
257
|
+
result?: string;
|
|
258
|
+
isError?: boolean;
|
|
259
|
+
done: boolean;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* One ordered segment of an assistant turn: a run of prose, or a tool call.
|
|
263
|
+
* Preserves the interleave order the model produced (say a bit → call a tool →
|
|
264
|
+
* say a bit → …) so the UI can render tool chips INLINE where the model called
|
|
265
|
+
* them. Mirrors the daemon SPA's `MessageBlock`. Only populated when the widget
|
|
266
|
+
* is configured with `showToolActivity: true`.
|
|
267
|
+
*/
|
|
268
|
+
type MessageBlock = {
|
|
269
|
+
kind: 'text';
|
|
270
|
+
text: string;
|
|
271
|
+
} | {
|
|
272
|
+
kind: 'tool';
|
|
273
|
+
tool: ToolCall;
|
|
274
|
+
};
|
|
222
275
|
interface ChatMessage {
|
|
223
276
|
id: string;
|
|
224
277
|
role: Role;
|
|
@@ -226,6 +279,12 @@ interface ChatMessage {
|
|
|
226
279
|
text: string;
|
|
227
280
|
/** True while an assistant message is still streaming. */
|
|
228
281
|
streaming: boolean;
|
|
282
|
+
/**
|
|
283
|
+
* Ordered text + tool segments, interleaved as the model produced them. Present
|
|
284
|
+
* only on assistant messages when `showToolActivity` is enabled (absent
|
|
285
|
+
* otherwise — the default popover renders `text` alone, byte-for-byte unchanged).
|
|
286
|
+
*/
|
|
287
|
+
blocks?: MessageBlock[];
|
|
229
288
|
/**
|
|
230
289
|
* Sources that grounded an assistant answer, when the terminal
|
|
231
290
|
* `eventual_response` carried any. Optional + back-compatible: absent when
|
|
@@ -349,6 +408,8 @@ declare class ConversationController {
|
|
|
349
408
|
private readonly store;
|
|
350
409
|
private client;
|
|
351
410
|
private sessionId;
|
|
411
|
+
/** Conversation id of the live session (create or resume) — lets voice join the same thread. */
|
|
412
|
+
private conversationId;
|
|
352
413
|
private readonly messages;
|
|
353
414
|
private status;
|
|
354
415
|
private seq;
|
|
@@ -377,6 +438,14 @@ declare class ConversationController {
|
|
|
377
438
|
private readonly httpBase;
|
|
378
439
|
constructor(config: ChatWidgetConfig, events: ConversationEvents, store?: StoreApi<WidgetStore>);
|
|
379
440
|
get connectionStatus(): ConnectionStatus;
|
|
441
|
+
/** Conversation id of the live session, or null before connect (voice passes this as `conversation_id`). */
|
|
442
|
+
get currentConversationId(): string | null;
|
|
443
|
+
/**
|
|
444
|
+
* Append an already-finalized message to the transcript and emit — the voice
|
|
445
|
+
* path reuses this so `transcript_final` (user) and `reply_text` (assistant)
|
|
446
|
+
* turns land in the same message list / render pipeline as typed chat.
|
|
447
|
+
*/
|
|
448
|
+
appendLocalMessage(role: Role, text: string): void;
|
|
380
449
|
/** The persisted store, exposed so the view can read identity for the pre-chat gate. */
|
|
381
450
|
getStore(): StoreApi<WidgetStore>;
|
|
382
451
|
/** True when a persisted session pointer exists (drives the resume path). */
|
|
@@ -525,6 +594,10 @@ declare class SmoothAgentChatElement extends HTMLElement {
|
|
|
525
594
|
private allowChatRestore;
|
|
526
595
|
/** True while the pre-chat identity gate is showing (blocks premature connect). */
|
|
527
596
|
private gating;
|
|
597
|
+
/** Voice config (SMOODEV-2534) — enabled=false renders zero voice UI. */
|
|
598
|
+
private voiceCfg;
|
|
599
|
+
/** Live voice session, or null when voice is off. */
|
|
600
|
+
private voiceSession;
|
|
528
601
|
private panelEl;
|
|
529
602
|
private launcherEl;
|
|
530
603
|
private messagesEl;
|
|
@@ -532,6 +605,7 @@ declare class SmoothAgentChatElement extends HTMLElement {
|
|
|
532
605
|
private dotEl;
|
|
533
606
|
private inputEl;
|
|
534
607
|
private sendBtn;
|
|
608
|
+
private micBtn;
|
|
535
609
|
private suggestionsEl;
|
|
536
610
|
/** The live streaming assistant bubble whose textContent the rAF loop drives. */
|
|
537
611
|
private streamBubbleEl;
|
|
@@ -542,6 +616,10 @@ declare class SmoothAgentChatElement extends HTMLElement {
|
|
|
542
616
|
/** How many chars of {@link streamTarget} are currently shown. */
|
|
543
617
|
private displayedLength;
|
|
544
618
|
private rafId;
|
|
619
|
+
/** Block structure signature of the last-rendered streaming message (tool chips
|
|
620
|
+
* only — text growth doesn't change it), so a chip add/resolve forces a rebuild
|
|
621
|
+
* while plain trailing-text growth stays on the fast reveal path. */
|
|
622
|
+
private prevBlockSig;
|
|
545
623
|
constructor();
|
|
546
624
|
connectedCallback(): void;
|
|
547
625
|
disconnectedCallback(): void;
|
|
@@ -605,6 +683,14 @@ declare class SmoothAgentChatElement extends HTMLElement {
|
|
|
605
683
|
* rebuild via {@link renderMessages}.
|
|
606
684
|
*/
|
|
607
685
|
private handleMessages;
|
|
686
|
+
/** True when an assistant message's turn invoked at least one tool. */
|
|
687
|
+
private hasToolBlocks;
|
|
688
|
+
/** Signature that changes only when a tool chip is added or resolved (text growth is 'x'). */
|
|
689
|
+
private blockSig;
|
|
690
|
+
/** The live (last) text block for a tool turn, else the whole message text. */
|
|
691
|
+
private tailText;
|
|
692
|
+
/** Reveal-binding key — composite for a tool-turn tail (so a new trailing block rebinds), else msg id. */
|
|
693
|
+
private tailKey;
|
|
608
694
|
private renderMessages;
|
|
609
695
|
/**
|
|
610
696
|
* Render (or clear) the mid-conversation suggested-reply chips under the
|
|
@@ -624,6 +710,19 @@ declare class SmoothAgentChatElement extends HTMLElement {
|
|
|
624
710
|
* doesn't restart the reveal from zero), then resumes the loop.
|
|
625
711
|
*/
|
|
626
712
|
private bindReveal;
|
|
713
|
+
/**
|
|
714
|
+
* Render a tool-activity assistant turn as an ordered strip: prose bubbles and
|
|
715
|
+
* inline tool chips in the order the model produced them (mirrors the daemon
|
|
716
|
+
* SPA's `blocks`). The live trailing text block (while streaming) binds to the
|
|
717
|
+
* rAF reveal; earlier/finalized text blocks render as sanitized markdown.
|
|
718
|
+
*/
|
|
719
|
+
private renderAssistantBlocks;
|
|
720
|
+
/**
|
|
721
|
+
* A single tool-activity chip: icon + tool name + status (running… / done / error),
|
|
722
|
+
* with a truncated args preview. Tool name/args are set via `textContent` so a
|
|
723
|
+
* tool payload can never inject markup.
|
|
724
|
+
*/
|
|
725
|
+
private buildToolChip;
|
|
627
726
|
/** Start the rAF loop if it isn't already running. */
|
|
628
727
|
private ensureRevealLoop;
|
|
629
728
|
/**
|
|
@@ -667,6 +766,17 @@ declare class SmoothAgentChatElement extends HTMLElement {
|
|
|
667
766
|
private renderSources;
|
|
668
767
|
private renderStatus;
|
|
669
768
|
private renderComposerState;
|
|
769
|
+
/**
|
|
770
|
+
* Mic button: start a voice session, or — when one is live — end it. Hitting
|
|
771
|
+
* the button while the agent's TTS is playing barges in first (interrupt +
|
|
772
|
+
* playback flush) so the audio dies instantly, then the session ends.
|
|
773
|
+
*/
|
|
774
|
+
private toggleVoice;
|
|
775
|
+
private startVoice;
|
|
776
|
+
/** End any live voice session and reset the composer UI. Idempotent. */
|
|
777
|
+
private stopVoice;
|
|
778
|
+
/** Toggle the mic button's listening state + clear the partial transcript. */
|
|
779
|
+
private syncVoiceUi;
|
|
670
780
|
private submit;
|
|
671
781
|
}
|
|
672
782
|
/** Register the custom element once. Safe to call multiple times. */
|
|
@@ -692,6 +802,163 @@ declare function mountChatWidget(config: ChatWidgetConfig, target?: HTMLElement)
|
|
|
692
802
|
*/
|
|
693
803
|
declare function mountFullPageChat(config: Omit<ChatWidgetConfig, 'mode'>, target?: HTMLElement): SmoothAgentChatElement;
|
|
694
804
|
//#endregion
|
|
805
|
+
//#region src/voice-session.d.ts
|
|
806
|
+
/**
|
|
807
|
+
* VoiceSession — framework-free browser voice for the chat widget.
|
|
808
|
+
*
|
|
809
|
+
* Speaks the FROZEN browser-voice WebSocket protocol (SMOODEV-2534 / ADR-084):
|
|
810
|
+
*
|
|
811
|
+
* client → server:
|
|
812
|
+
* - first frame, JSON: `{"type":"start","agent_id":"…","conversation_id":"…?","token":"…?"}`
|
|
813
|
+
* (public-agent auth is the `Origin` header the browser sends automatically;
|
|
814
|
+
* `token` only for authenticated contexts)
|
|
815
|
+
* - binary frames: raw PCM linear16 mono @ 16 kHz mic chunks
|
|
816
|
+
* - JSON `{"type":"interrupt"}` (user barged in), `{"type":"stop"}`
|
|
817
|
+
* server → client:
|
|
818
|
+
* - JSON `transcript_partial` / `transcript_final` / `reply_text` /
|
|
819
|
+
* `speaking_started` / `speaking_done` / `handoff` / `error {code}`
|
|
820
|
+
* - binary frames: PCM linear16 mono @ 16 kHz TTS audio chunks
|
|
821
|
+
*
|
|
822
|
+
* The class owns: the WS lifecycle, mic capture (getUserMedia → AudioWorklet or
|
|
823
|
+
* ScriptProcessor fallback → downsample to 16 kHz mono Int16 → binary frames),
|
|
824
|
+
* gapless playback of incoming PCM through a 16 kHz AudioContext, and barge-in
|
|
825
|
+
* (RMS speech detection while the agent is speaking → `interrupt` + playback
|
|
826
|
+
* flush). Browser audio + WebSocket are thin injectable seams so unit tests run
|
|
827
|
+
* under jsdom/happy-dom with no real audio.
|
|
828
|
+
*/
|
|
829
|
+
declare const DEFAULT_VOICE_URL = "wss://twilio-voice.smoo.ai/browser-voice/ws";
|
|
830
|
+
/** Target wire format: PCM linear16 mono @ 16 kHz. */
|
|
831
|
+
declare const VOICE_SAMPLE_RATE = 16000;
|
|
832
|
+
/**
|
|
833
|
+
* Downsample Float32 mic samples at `inputRate` to 16 kHz mono Int16 (linear16).
|
|
834
|
+
* Bucket-averaging decimation: each output sample averages its source bucket,
|
|
835
|
+
* which is a cheap low-pass that's plenty for speech (and handles non-integer
|
|
836
|
+
* ratios like 44.1k → 16k). Values are clamped to the Int16 range.
|
|
837
|
+
*/
|
|
838
|
+
declare function downsampleTo16k(samples: Float32Array, inputRate: number): Int16Array;
|
|
839
|
+
/** Root-mean-square level of a Float32 frame (0..1) — the barge-in speech gate. */
|
|
840
|
+
declare function rmsLevel(samples: Float32Array): number;
|
|
841
|
+
/** The subset of WebSocket the session needs (mockable in tests). */
|
|
842
|
+
interface VoiceWebSocket {
|
|
843
|
+
binaryType: string;
|
|
844
|
+
readyState: number;
|
|
845
|
+
send(data: string | ArrayBuffer): void;
|
|
846
|
+
close(code?: number, reason?: string): void;
|
|
847
|
+
addEventListener(type: 'open' | 'message' | 'close' | 'error', fn: (ev: never) => void): void;
|
|
848
|
+
}
|
|
849
|
+
/** Playback sink for incoming 16 kHz PCM chunks (mockable in tests). */
|
|
850
|
+
interface VoicePlayer {
|
|
851
|
+
/** Queue a linear16 chunk for gapless playback. */
|
|
852
|
+
enqueue(chunk: ArrayBuffer): void;
|
|
853
|
+
/** Stop everything queued/playing immediately (barge-in). */
|
|
854
|
+
flush(): void;
|
|
855
|
+
/** Flush + release the audio device. */
|
|
856
|
+
close(): void;
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* Start mic capture, invoking `onFrame(samples, sampleRate)` with raw Float32
|
|
860
|
+
* frames until the returned stop function is called.
|
|
861
|
+
*/
|
|
862
|
+
type StartCapture = (onFrame: (samples: Float32Array, sampleRate: number) => void) => Promise<() => void>;
|
|
863
|
+
interface VoiceSessionSeams {
|
|
864
|
+
createWebSocket?: (url: string) => VoiceWebSocket;
|
|
865
|
+
startCapture?: StartCapture;
|
|
866
|
+
createPlayer?: () => VoicePlayer;
|
|
867
|
+
}
|
|
868
|
+
/**
|
|
869
|
+
* The minimal AudioContext surface {@link PcmPlayer} uses — injectable so the
|
|
870
|
+
* scheduling/flush logic is unit-testable without real audio hardware.
|
|
871
|
+
*/
|
|
872
|
+
interface PlayerAudioContext {
|
|
873
|
+
readonly currentTime: number;
|
|
874
|
+
readonly destination: unknown;
|
|
875
|
+
createBuffer(channels: number, length: number, sampleRate: number): {
|
|
876
|
+
getChannelData(channel: number): Float32Array;
|
|
877
|
+
};
|
|
878
|
+
createBufferSource(): {
|
|
879
|
+
buffer: unknown;
|
|
880
|
+
connect(dest: unknown): void;
|
|
881
|
+
start(when?: number): void;
|
|
882
|
+
stop(): void;
|
|
883
|
+
onended: (() => void) | null;
|
|
884
|
+
};
|
|
885
|
+
close?(): Promise<void>;
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
888
|
+
* Gapless PCM playback: each incoming linear16 chunk becomes an AudioBuffer
|
|
889
|
+
* scheduled back-to-back (`nextTime`) so consecutive chunks butt together with
|
|
890
|
+
* no gaps. `flush()` stops every scheduled source (barge-in / mic-button stop).
|
|
891
|
+
*/
|
|
892
|
+
declare class PcmPlayer implements VoicePlayer {
|
|
893
|
+
private readonly ctx;
|
|
894
|
+
private nextTime;
|
|
895
|
+
private readonly live;
|
|
896
|
+
constructor(ctx: PlayerAudioContext);
|
|
897
|
+
enqueue(chunk: ArrayBuffer): void;
|
|
898
|
+
flush(): void;
|
|
899
|
+
close(): void;
|
|
900
|
+
}
|
|
901
|
+
interface VoiceSessionOptions {
|
|
902
|
+
/** Full browser-voice WS endpoint (default {@link DEFAULT_VOICE_URL}). */
|
|
903
|
+
url?: string;
|
|
904
|
+
/** UUID of the agent to talk to. */
|
|
905
|
+
agentId: string;
|
|
906
|
+
/** Existing conversation id so voice resumes the same thread. */
|
|
907
|
+
conversationId?: string;
|
|
908
|
+
/** Optional JWT for authenticated contexts (public agents auth by Origin). */
|
|
909
|
+
token?: string;
|
|
910
|
+
/**
|
|
911
|
+
* RMS level (0..1) above which a mic frame counts as speech for barge-in
|
|
912
|
+
* while the agent is speaking. Default 0.02 — comfortably above room noise
|
|
913
|
+
* post-AGC, well below speech.
|
|
914
|
+
*/
|
|
915
|
+
bargeInThreshold?: number;
|
|
916
|
+
/** Injectable browser seams (tests). */
|
|
917
|
+
seams?: VoiceSessionSeams;
|
|
918
|
+
}
|
|
919
|
+
interface VoiceSessionEvents {
|
|
920
|
+
onTranscriptPartial?: (text: string) => void;
|
|
921
|
+
onTranscriptFinal?: (text: string) => void;
|
|
922
|
+
onReplyText?: (text: string) => void;
|
|
923
|
+
/** Agent TTS started/stopped playing. */
|
|
924
|
+
onSpeaking?: (speaking: boolean) => void;
|
|
925
|
+
onError?: (code: string) => void;
|
|
926
|
+
/** The session is over (stop, server close, handoff, or error). Fires once. */
|
|
927
|
+
onEnded?: () => void;
|
|
928
|
+
}
|
|
929
|
+
type VoiceSessionState = 'idle' | 'connecting' | 'active' | 'ended';
|
|
930
|
+
declare class VoiceSession {
|
|
931
|
+
private readonly opts;
|
|
932
|
+
private readonly events;
|
|
933
|
+
private ws;
|
|
934
|
+
private player;
|
|
935
|
+
private stopCapture;
|
|
936
|
+
private speaking;
|
|
937
|
+
private ended;
|
|
938
|
+
state: VoiceSessionState;
|
|
939
|
+
constructor(opts: VoiceSessionOptions, events?: VoiceSessionEvents);
|
|
940
|
+
/** Open the WS, send the start frame, and begin streaming mic audio. */
|
|
941
|
+
start(): Promise<void>;
|
|
942
|
+
/** One raw mic frame: barge-in check, then downsample → binary frame. */
|
|
943
|
+
private handleMicFrame;
|
|
944
|
+
/** Route a server frame: binary = TTS audio, string = JSON control event. */
|
|
945
|
+
private handleServerFrame;
|
|
946
|
+
private setSpeaking;
|
|
947
|
+
/** True while agent TTS is playing (between speaking_started/done). */
|
|
948
|
+
get isSpeaking(): boolean;
|
|
949
|
+
/**
|
|
950
|
+
* Barge in: tell the server the user interrupted and flush queued TTS so the
|
|
951
|
+
* agent goes silent immediately. Called automatically on mic speech during
|
|
952
|
+
* playback; the widget also calls it when the visitor hits the mic button
|
|
953
|
+
* mid-playback.
|
|
954
|
+
*/
|
|
955
|
+
interrupt(): void;
|
|
956
|
+
/** Graceful end: send `stop`, then tear everything down. */
|
|
957
|
+
stop(): void;
|
|
958
|
+
/** Idempotent teardown: capture, playback, socket, `ended` event. */
|
|
959
|
+
private teardown;
|
|
960
|
+
}
|
|
961
|
+
//#endregion
|
|
695
962
|
//#region src/loader-core.d.ts
|
|
696
963
|
/**
|
|
697
964
|
* Tiny, dependency-free deferred loader for `@smooai/chat-widget`.
|
|
@@ -778,5 +1045,5 @@ declare function computeFingerprint(): string;
|
|
|
778
1045
|
*/
|
|
779
1046
|
declare function getOrCreateFingerprint(get: () => string | null, set: (fp: string) => void): string;
|
|
780
1047
|
//#endregion
|
|
781
|
-
export { type ChatMessage, type ChatWidgetConfig, type ChatWidgetMode, type ChatWidgetTheme, type Citation, type ConnectionStatus, type ConsentState, ConversationController, type ConversationEvents, ELEMENT_TAG, type IdentityRestore, type IdentityState, PERSIST_VERSION, type PersistedWidgetState, type RestorableConversation, type Role, SmoothAgentChatElement, type UserInfo, type WidgetStore, computeFingerprint, createWidgetStore, defineChatWidget, getOrCreateFingerprint, httpBaseFromWsEndpoint, initChatWidgetLoader, mountChatWidget, mountFullPageChat, storageKey };
|
|
1048
|
+
export { type ChatMessage, type ChatWidgetConfig, type ChatWidgetMode, type ChatWidgetTheme, type ChatWidgetVoiceConfig, type Citation, type ConnectionStatus, type ConsentState, ConversationController, type ConversationEvents, DEFAULT_VOICE_URL, ELEMENT_TAG, type IdentityRestore, type IdentityState, type MessageBlock, PERSIST_VERSION, PcmPlayer, type PersistedWidgetState, type PlayerAudioContext, type RestorableConversation, type Role, SmoothAgentChatElement, type StartCapture, type ToolCall, type UserInfo, VOICE_SAMPLE_RATE, type VoicePlayer, VoiceSession, type VoiceSessionEvents, type VoiceSessionOptions, type VoiceSessionSeams, type VoiceSessionState, type VoiceWebSocket, type WidgetStore, computeFingerprint, createWidgetStore, defineChatWidget, downsampleTo16k, getOrCreateFingerprint, httpBaseFromWsEndpoint, initChatWidgetLoader, mountChatWidget, mountFullPageChat, rmsLevel, storageKey };
|
|
782
1049
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/config.ts","../src/persistence.ts","../src/conversation.ts","../src/element.ts","../src/loader-core.ts","../src/fingerprint.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/config.ts","../src/persistence.ts","../src/conversation.ts","../src/element.ts","../src/voice-session.ts","../src/loader-core.ts","../src/fingerprint.ts"],"mappings":";;;;;;;;AAeA;UAAiB,qBAAA;;EAEb,OAAA;EAEG;EAAH,GAAG;AAAA;AAAA,UAGU,eAAA;EAAe;EAE5B,IAAA;EAEA;EAAA,UAAA;EAIA;EAFA,OAAA;EAMA;EAJA,WAAA;EAQA;EANA,SAAA;EAUA;EARA,eAAA;EAgBA;EAdA,mBAAA;EAkBA;EAhBA,UAAA;EAgBsB;EAdtB,cAAA;EAyBsB;EAvBtB,MAAA;EAuBsB;EAjBtB,iBAAA;EAmBa;EAjBb,qBAAA;;EAEA,kBAAA;EAmHQ;EAjHR,sBAAA;AAAA;;;;;;;;;KAWQ,cAAA;AAAA,UAEK,gBAAA;EAkCb;;;;EA7BA,QAAA;EAiCA;;;;EA5BA,IAAA,GAAO,cAAA;EAiDP;EA/CA,OAAA;EA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