@chatterfly/widget 0.3.0 → 0.5.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 +12 -2
- package/dist/embed.css +1 -1
- package/dist/embed.css.map +1 -1
- package/dist/embed.global.js +33 -27
- package/dist/embed.global.js.map +1 -1
- package/dist/index.css +140 -15
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +106 -7
- package/dist/index.d.ts +106 -7
- package/dist/index.js +904 -263
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +905 -264
- package/dist/index.mjs.map +1 -1
- package/package.json +61 -60
package/dist/index.d.mts
CHANGED
|
@@ -15,6 +15,27 @@ declare class WidgetError {
|
|
|
15
15
|
constructor(code: WidgetErrorCode, message: string);
|
|
16
16
|
toString(): string;
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Config for the "click to start" gate (Phase 119.6b): the widget mounts but
|
|
20
|
+
* does not auto-start a run until the user clicks. `true` uses the default
|
|
21
|
+
* copy; pass an object to customize. Only meaningful for `workflowId` /
|
|
22
|
+
* `deploymentId` (serverless auto-start) embeds — ignored for direct `runId`
|
|
23
|
+
* connections.
|
|
24
|
+
*/
|
|
25
|
+
interface ClickToStartConfig {
|
|
26
|
+
label?: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Config for the resume choice card (Phase 119.6b): shown instead of silently
|
|
31
|
+
* resuming when a persisted session exists. `true` uses the default copy;
|
|
32
|
+
* pass an object to customize.
|
|
33
|
+
*/
|
|
34
|
+
interface ResumePromptConfig {
|
|
35
|
+
title?: string;
|
|
36
|
+
continueLabel?: string;
|
|
37
|
+
restartLabel?: string;
|
|
38
|
+
}
|
|
18
39
|
/**
|
|
19
40
|
* Imperative handle exposed via `ref` on `ChatterflyWidget` (Phase 114.1).
|
|
20
41
|
* Lets host chrome trigger actions without prop churn — e.g. a "Start over"
|
|
@@ -97,8 +118,31 @@ interface WidgetConfig {
|
|
|
97
118
|
* like `POST /api/v1/runs`. Ignored when connecting via `runId` directly.
|
|
98
119
|
*/
|
|
99
120
|
initialInput?: Record<string, unknown>;
|
|
121
|
+
/**
|
|
122
|
+
* Tunes (or disables, via `"always-on"`) the dormancy/hibernation
|
|
123
|
+
* lifecycle. See `ConnectionPolicy`. Defaults apply when omitted.
|
|
124
|
+
*/
|
|
125
|
+
connectionPolicy?: ConnectionPolicy | "always-on";
|
|
126
|
+
}
|
|
127
|
+
type RunStatus = "idle" | "connecting" | "replaying" | "running" | "awaiting_input" | "awaiting_voice" | "awaiting_form" | "awaiting_chat" | "awaiting_editor" | "completed" | "error" | "offline" | "expired";
|
|
128
|
+
/**
|
|
129
|
+
* Connection lifecycle tuning (Phase 119.4/119.5). Controls when an
|
|
130
|
+
* idle-at-input widget deliberately drops its socket ("dormant"), lazily
|
|
131
|
+
* polls for updates instead, and eventually stops polling entirely
|
|
132
|
+
* ("hibernating") until a wake trigger (focus, visibility, `sendMessage`,
|
|
133
|
+
* `submitHandback`, coming back online…). `"always-on"` disables all of
|
|
134
|
+
* this and keeps the socket held open like pre-119 widgets — use it for
|
|
135
|
+
* hosts that need instant push (e.g. multi-participant dashboards). See
|
|
136
|
+
* docs/plan/widget-connection-lifecycle.md.
|
|
137
|
+
*/
|
|
138
|
+
interface ConnectionPolicy {
|
|
139
|
+
/** Idle time at a parked HITL input before deliberately disconnecting. Default 5 min. */
|
|
140
|
+
idleDisconnectMs?: number;
|
|
141
|
+
/** Poll interval while dormant. Default 45 s. */
|
|
142
|
+
pollIntervalMs?: number;
|
|
143
|
+
/** Additional dormant time before polling stops too (hibernating). Default 1 h. */
|
|
144
|
+
hibernateAfterMs?: number;
|
|
100
145
|
}
|
|
101
|
-
type RunStatus = "idle" | "connecting" | "replaying" | "running" | "awaiting_input" | "awaiting_voice" | "awaiting_form" | "awaiting_chat" | "awaiting_editor" | "completed" | "error" | "offline";
|
|
102
146
|
interface ValidationRule {
|
|
103
147
|
type: "required" | "min_length" | "max_length" | "min_selected" | "max_selected" | "min" | "max" | "pattern" | "email" | "url" | "phone" | "location" | "llm" | "and" | "or";
|
|
104
148
|
value?: number | string;
|
|
@@ -228,12 +272,18 @@ type RunEvent = {
|
|
|
228
272
|
type: "message.sent";
|
|
229
273
|
content: string;
|
|
230
274
|
participant_role: string;
|
|
275
|
+
} | {
|
|
276
|
+
type: "run_complete";
|
|
277
|
+
state?: Record<string, unknown>;
|
|
231
278
|
} | {
|
|
232
279
|
type: "run.completed";
|
|
233
280
|
state?: Record<string, unknown>;
|
|
234
281
|
} | {
|
|
235
282
|
type: "run.cancelled";
|
|
236
283
|
state?: Record<string, unknown>;
|
|
284
|
+
} | {
|
|
285
|
+
type: "run_error";
|
|
286
|
+
error?: string;
|
|
237
287
|
} | {
|
|
238
288
|
type: "run.failed";
|
|
239
289
|
error: string;
|
|
@@ -280,14 +330,24 @@ interface WidgetStrings {
|
|
|
280
330
|
statusErrorTitle: string;
|
|
281
331
|
statusOfflineTitle: string;
|
|
282
332
|
statusOfflineBody: string;
|
|
333
|
+
statusExpiredTitle: string;
|
|
334
|
+
statusExpiredBody: string;
|
|
283
335
|
statusListening: string;
|
|
284
336
|
resumingConversation: string;
|
|
337
|
+
reconnecting: string;
|
|
285
338
|
conversationCompleted: string;
|
|
286
339
|
somethingWentWrong: string;
|
|
287
340
|
chatInputPlaceholder: string;
|
|
288
341
|
sendButton: string;
|
|
289
342
|
handBackButton: string;
|
|
290
343
|
converseDoneButton: string;
|
|
344
|
+
startConversation: string;
|
|
345
|
+
clickToStartDescription: string;
|
|
346
|
+
resumeTitle: string;
|
|
347
|
+
resumeContinue: string;
|
|
348
|
+
resumeRestart: string;
|
|
349
|
+
startNewConversation: string;
|
|
350
|
+
conversationEnded: string;
|
|
291
351
|
}
|
|
292
352
|
declare const defaultStrings: WidgetStrings;
|
|
293
353
|
/** Merge a partial override on top of the defaults. */
|
|
@@ -373,9 +433,27 @@ interface ChatterflyWidgetProps extends Omit<WidgetConfig, "runId" | "participan
|
|
|
373
433
|
* auto-start (`workflowId`/`deploymentId`) so a page refresh resumes the
|
|
374
434
|
* existing run instead of minting a new one. `true` uses sessionStorage;
|
|
375
435
|
* pass an options object to use localStorage or a custom key. Ignored for
|
|
376
|
-
* direct `runId` embeds. Default `false
|
|
436
|
+
* direct `runId` embeds. Default `true` — pass `false` to opt out.
|
|
377
437
|
*/
|
|
378
438
|
persistSession?: PersistSessionConfig;
|
|
439
|
+
/**
|
|
440
|
+
* Gate serverless auto-start (`workflowId`/`deploymentId`) behind a "Start
|
|
441
|
+
* conversation" button instead of minting a run on mount. `true` uses the
|
|
442
|
+
* default copy; pass an object to customize. Default `false`.
|
|
443
|
+
*/
|
|
444
|
+
clickToStart?: boolean | ClickToStartConfig;
|
|
445
|
+
/**
|
|
446
|
+
* When a persisted session exists for an active (non-terminal) run, show a
|
|
447
|
+
* "Continue where you left off? / Start fresh" choice instead of silently
|
|
448
|
+
* resuming. Default `false` (silent resume).
|
|
449
|
+
*/
|
|
450
|
+
resumePrompt?: boolean | ResumePromptConfig;
|
|
451
|
+
/**
|
|
452
|
+
* When a persisted session's run already reached a terminal state
|
|
453
|
+
* (completed/error), replay its history read-only with a "Start new
|
|
454
|
+
* conversation" CTA instead of auto-restarting. Default `true`.
|
|
455
|
+
*/
|
|
456
|
+
showCompletedHistory?: boolean;
|
|
379
457
|
/** `inline` (default, zero behavior change) | `floating` (docked launcher bubble + expandable panel). */
|
|
380
458
|
mode?: "inline" | "floating";
|
|
381
459
|
/** Where the launcher bubble docks in `floating` mode. Default `bottom-right`. */
|
|
@@ -451,6 +529,8 @@ declare const ChatAdapter: react.ForwardRefExoticComponent<ChatAdapterProps & re
|
|
|
451
529
|
type VoiceOrbState = "idle" | "listening" | "speaking" | "processing" | "confirming" | "error";
|
|
452
530
|
interface VoiceOrbProps {
|
|
453
531
|
state: VoiceOrbState;
|
|
532
|
+
/** Smoothed microphone energy in the range 0..1. */
|
|
533
|
+
inputLevel?: number;
|
|
454
534
|
onPress?: () => void;
|
|
455
535
|
onRelease?: () => void;
|
|
456
536
|
disabled?: boolean;
|
|
@@ -466,7 +546,7 @@ interface VoiceOrbProps {
|
|
|
466
546
|
* - confirming: pop + success color
|
|
467
547
|
* - error: shake + red flash
|
|
468
548
|
*/
|
|
469
|
-
declare function VoiceOrb({ state, onPress, onRelease, disabled, }: VoiceOrbProps): react_jsx_runtime.JSX.Element;
|
|
549
|
+
declare function VoiceOrb({ state, inputLevel, onPress, onRelease, disabled, }: VoiceOrbProps): react_jsx_runtime.JSX.Element;
|
|
470
550
|
|
|
471
551
|
interface VoicePromptCardProps {
|
|
472
552
|
field: FieldSpec;
|
|
@@ -571,12 +651,16 @@ interface VoiceLiveRendererProps {
|
|
|
571
651
|
participantToken: string;
|
|
572
652
|
/** HITL session id; the proxy resolves field, channel, and tokens from it. */
|
|
573
653
|
sessionId: string;
|
|
654
|
+
/** Current field's HITL session, distinct from the first session pinned for the socket. */
|
|
655
|
+
fieldSessionId: string;
|
|
574
656
|
/** Resolved widget/voice live tunables (config.style "live"). May be empty — defaults are server-side. */
|
|
575
657
|
liveConfig?: SurfaceConfig;
|
|
576
658
|
onValue: (value: unknown) => void;
|
|
659
|
+
onPlaybackComplete?: () => void;
|
|
660
|
+
onFieldRevealed?: (sessionId: string) => void;
|
|
577
661
|
disabled?: boolean;
|
|
578
662
|
}
|
|
579
|
-
declare function VoiceLiveRenderer({ field, apiBase, participantToken, sessionId, liveConfig, onValue, disabled, }: VoiceLiveRendererProps): react_jsx_runtime.JSX.Element;
|
|
663
|
+
declare function VoiceLiveRenderer({ field, apiBase, participantToken, sessionId, fieldSessionId, liveConfig, onValue, onPlaybackComplete, onFieldRevealed, disabled, }: VoiceLiveRendererProps): react_jsx_runtime.JSX.Element;
|
|
580
664
|
|
|
581
665
|
interface RequiredConnection {
|
|
582
666
|
slug: string;
|
|
@@ -639,7 +723,9 @@ declare function ConnectionOnboarding({ connections, appBase, participantToken,
|
|
|
639
723
|
* Live model, so the widget only manages the audio pipes and surfaces
|
|
640
724
|
* transparency events to the UI.
|
|
641
725
|
*/
|
|
642
|
-
type LiveVoiceState = "idle" | "connecting" | "listening"
|
|
726
|
+
type LiveVoiceState = "idle" | "connecting" | "listening"
|
|
727
|
+
/** Transcript arrived; answer/tool/workflow/model turn is advancing. */
|
|
728
|
+
| "processing" | "speaking" | "muted" | "completed" | "error";
|
|
643
729
|
interface LiveTranscript {
|
|
644
730
|
/** "user" for input transcription, "assistant" for output transcription. */
|
|
645
731
|
who: "user" | "assistant";
|
|
@@ -663,8 +749,18 @@ interface LiveSessionResult {
|
|
|
663
749
|
assistantText: string;
|
|
664
750
|
/** Latest field id reported by the proxy via field_change. */
|
|
665
751
|
activeFieldId: string | null;
|
|
752
|
+
/**
|
|
753
|
+
* The most recent field whose audio has finished PLAYING. The engine opens a
|
|
754
|
+
* field (and sends field_change) seconds before the spoken question ends, so
|
|
755
|
+
* renderers should gate field UI on this, not on activeFieldId.
|
|
756
|
+
*/
|
|
757
|
+
askedFieldId: string | null;
|
|
758
|
+
/** True once the terminal socket has closed and all received PCM has played. */
|
|
759
|
+
playbackComplete: boolean;
|
|
666
760
|
/** The committed value, set when the proxy emits a value envelope. */
|
|
667
761
|
lastValue: unknown;
|
|
762
|
+
/** Smoothed microphone energy in the range 0..1; visual feedback only. */
|
|
763
|
+
inputLevel: number;
|
|
668
764
|
isMuted: boolean;
|
|
669
765
|
toggleMute: () => void;
|
|
670
766
|
error: string | null;
|
|
@@ -785,7 +881,10 @@ interface UseChatterflyRunOptions extends Omit<WidgetConfig, "runId" | "particip
|
|
|
785
881
|
runId?: string;
|
|
786
882
|
/** Required alongside `runId`. */
|
|
787
883
|
participantToken?: string;
|
|
788
|
-
/**
|
|
884
|
+
/**
|
|
885
|
+
* Persist the resolved session across page loads. See `PersistSessionConfig`.
|
|
886
|
+
* Default `true` — pass `false` to opt out.
|
|
887
|
+
*/
|
|
789
888
|
persistSession?: PersistSessionConfig;
|
|
790
889
|
/** Firehose of every raw run event, in order. */
|
|
791
890
|
onEvent?: (event: RunEvent) => void;
|
|
@@ -940,4 +1039,4 @@ declare function extractValue(transcript: string, field: FieldSpec): ExtractionR
|
|
|
940
1039
|
*/
|
|
941
1040
|
declare function buildSpokenPrompt(field: FieldSpec, voiceHint?: string): string;
|
|
942
1041
|
|
|
943
|
-
export { type BubbleComponents, type BubbleProps, ChatAdapter, type ChatAdapterProps, type ChatMessage, ChatTimeline, type ChatTimelineProps, ChatterflyWidget, type ChatterflyWidgetHandle, type ChatterflyWidgetProps, type ColorScheme, ConnectionOnboarding, type ConnectionOnboardingProps, type ContinuousVoiceSessionResult, type ContinuousVoiceState, type ExtractionResult, type FieldSpec, type HITLSession, InputBoolean, type InputComponentProps, InputDate, InputDisplay, InputFileUpload, InputLocation, InputMultiSelect, InputNumber, InputRating, InputSingleSelect, InputText, InputTextArea, type InputTypeProps, type LauncherPosition, type LiveSessionConfig, type LiveSessionResult, type LiveTranscript, type LiveVoiceState, type PersistSessionConfig, type PersistSessionOptions, type RecordingState, type RepeaterSpec, type RequiredConnection, type RunEvent, type RunStatus, type SessionRendererProps, type SynthState, type ThemeTokens, type TimelineEntry, type UseChatterflyRunOptions, type UseChatterflyRunResult, type UseParticipantConnectionsResult, type UseRunStreamResult, type UseSpeechSynthesisResult, type UseTranscribeResult, type UseVoiceRecorderResult, type ValidationError, type ValidationRule, VoiceContinuousRenderer, type VoiceContinuousRendererProps, VoiceLiveRenderer, type VoiceLiveRendererProps, VoiceOrb, type VoiceOrbProps, type VoiceOrbState, VoicePromptCard, type VoicePromptCardProps, VoiceRenderer, type VoiceRendererProps, type WidgetConfig, WidgetError, type WidgetErrorCode, type WidgetStrings, buildSpokenPrompt, defaultStrings, extractValue, getInputComponent, registerInputType, registerSessionRenderer, resolveInputType, resolveSessionRenderer, resolveStrings, useChatterflyRun, useContinuousVoiceSession, useGeminiLiveSession, useParticipantConnections, useRunStream, useSpeechSynthesis, useTranscribe, useVoiceRecorder };
|
|
1042
|
+
export { type BubbleComponents, type BubbleProps, ChatAdapter, type ChatAdapterProps, type ChatMessage, ChatTimeline, type ChatTimelineProps, ChatterflyWidget, type ChatterflyWidgetHandle, type ChatterflyWidgetProps, type ClickToStartConfig, type ColorScheme, ConnectionOnboarding, type ConnectionOnboardingProps, type ConnectionPolicy, type ContinuousVoiceSessionResult, type ContinuousVoiceState, type ExtractionResult, type FieldSpec, type HITLSession, InputBoolean, type InputComponentProps, InputDate, InputDisplay, InputFileUpload, InputLocation, InputMultiSelect, InputNumber, InputRating, InputSingleSelect, InputText, InputTextArea, type InputTypeProps, type LauncherPosition, type LiveSessionConfig, type LiveSessionResult, type LiveTranscript, type LiveVoiceState, type PersistSessionConfig, type PersistSessionOptions, type RecordingState, type RepeaterSpec, type RequiredConnection, type ResumePromptConfig, type RunEvent, type RunStatus, type SessionRendererProps, type SynthState, type ThemeTokens, type TimelineEntry, type UseChatterflyRunOptions, type UseChatterflyRunResult, type UseParticipantConnectionsResult, type UseRunStreamResult, type UseSpeechSynthesisResult, type UseTranscribeResult, type UseVoiceRecorderResult, type ValidationError, type ValidationRule, VoiceContinuousRenderer, type VoiceContinuousRendererProps, VoiceLiveRenderer, type VoiceLiveRendererProps, VoiceOrb, type VoiceOrbProps, type VoiceOrbState, VoicePromptCard, type VoicePromptCardProps, VoiceRenderer, type VoiceRendererProps, type WidgetConfig, WidgetError, type WidgetErrorCode, type WidgetStrings, buildSpokenPrompt, defaultStrings, extractValue, getInputComponent, registerInputType, registerSessionRenderer, resolveInputType, resolveSessionRenderer, resolveStrings, useChatterflyRun, useContinuousVoiceSession, useGeminiLiveSession, useParticipantConnections, useRunStream, useSpeechSynthesis, useTranscribe, useVoiceRecorder };
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,27 @@ declare class WidgetError {
|
|
|
15
15
|
constructor(code: WidgetErrorCode, message: string);
|
|
16
16
|
toString(): string;
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Config for the "click to start" gate (Phase 119.6b): the widget mounts but
|
|
20
|
+
* does not auto-start a run until the user clicks. `true` uses the default
|
|
21
|
+
* copy; pass an object to customize. Only meaningful for `workflowId` /
|
|
22
|
+
* `deploymentId` (serverless auto-start) embeds — ignored for direct `runId`
|
|
23
|
+
* connections.
|
|
24
|
+
*/
|
|
25
|
+
interface ClickToStartConfig {
|
|
26
|
+
label?: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Config for the resume choice card (Phase 119.6b): shown instead of silently
|
|
31
|
+
* resuming when a persisted session exists. `true` uses the default copy;
|
|
32
|
+
* pass an object to customize.
|
|
33
|
+
*/
|
|
34
|
+
interface ResumePromptConfig {
|
|
35
|
+
title?: string;
|
|
36
|
+
continueLabel?: string;
|
|
37
|
+
restartLabel?: string;
|
|
38
|
+
}
|
|
18
39
|
/**
|
|
19
40
|
* Imperative handle exposed via `ref` on `ChatterflyWidget` (Phase 114.1).
|
|
20
41
|
* Lets host chrome trigger actions without prop churn — e.g. a "Start over"
|
|
@@ -97,8 +118,31 @@ interface WidgetConfig {
|
|
|
97
118
|
* like `POST /api/v1/runs`. Ignored when connecting via `runId` directly.
|
|
98
119
|
*/
|
|
99
120
|
initialInput?: Record<string, unknown>;
|
|
121
|
+
/**
|
|
122
|
+
* Tunes (or disables, via `"always-on"`) the dormancy/hibernation
|
|
123
|
+
* lifecycle. See `ConnectionPolicy`. Defaults apply when omitted.
|
|
124
|
+
*/
|
|
125
|
+
connectionPolicy?: ConnectionPolicy | "always-on";
|
|
126
|
+
}
|
|
127
|
+
type RunStatus = "idle" | "connecting" | "replaying" | "running" | "awaiting_input" | "awaiting_voice" | "awaiting_form" | "awaiting_chat" | "awaiting_editor" | "completed" | "error" | "offline" | "expired";
|
|
128
|
+
/**
|
|
129
|
+
* Connection lifecycle tuning (Phase 119.4/119.5). Controls when an
|
|
130
|
+
* idle-at-input widget deliberately drops its socket ("dormant"), lazily
|
|
131
|
+
* polls for updates instead, and eventually stops polling entirely
|
|
132
|
+
* ("hibernating") until a wake trigger (focus, visibility, `sendMessage`,
|
|
133
|
+
* `submitHandback`, coming back online…). `"always-on"` disables all of
|
|
134
|
+
* this and keeps the socket held open like pre-119 widgets — use it for
|
|
135
|
+
* hosts that need instant push (e.g. multi-participant dashboards). See
|
|
136
|
+
* docs/plan/widget-connection-lifecycle.md.
|
|
137
|
+
*/
|
|
138
|
+
interface ConnectionPolicy {
|
|
139
|
+
/** Idle time at a parked HITL input before deliberately disconnecting. Default 5 min. */
|
|
140
|
+
idleDisconnectMs?: number;
|
|
141
|
+
/** Poll interval while dormant. Default 45 s. */
|
|
142
|
+
pollIntervalMs?: number;
|
|
143
|
+
/** Additional dormant time before polling stops too (hibernating). Default 1 h. */
|
|
144
|
+
hibernateAfterMs?: number;
|
|
100
145
|
}
|
|
101
|
-
type RunStatus = "idle" | "connecting" | "replaying" | "running" | "awaiting_input" | "awaiting_voice" | "awaiting_form" | "awaiting_chat" | "awaiting_editor" | "completed" | "error" | "offline";
|
|
102
146
|
interface ValidationRule {
|
|
103
147
|
type: "required" | "min_length" | "max_length" | "min_selected" | "max_selected" | "min" | "max" | "pattern" | "email" | "url" | "phone" | "location" | "llm" | "and" | "or";
|
|
104
148
|
value?: number | string;
|
|
@@ -228,12 +272,18 @@ type RunEvent = {
|
|
|
228
272
|
type: "message.sent";
|
|
229
273
|
content: string;
|
|
230
274
|
participant_role: string;
|
|
275
|
+
} | {
|
|
276
|
+
type: "run_complete";
|
|
277
|
+
state?: Record<string, unknown>;
|
|
231
278
|
} | {
|
|
232
279
|
type: "run.completed";
|
|
233
280
|
state?: Record<string, unknown>;
|
|
234
281
|
} | {
|
|
235
282
|
type: "run.cancelled";
|
|
236
283
|
state?: Record<string, unknown>;
|
|
284
|
+
} | {
|
|
285
|
+
type: "run_error";
|
|
286
|
+
error?: string;
|
|
237
287
|
} | {
|
|
238
288
|
type: "run.failed";
|
|
239
289
|
error: string;
|
|
@@ -280,14 +330,24 @@ interface WidgetStrings {
|
|
|
280
330
|
statusErrorTitle: string;
|
|
281
331
|
statusOfflineTitle: string;
|
|
282
332
|
statusOfflineBody: string;
|
|
333
|
+
statusExpiredTitle: string;
|
|
334
|
+
statusExpiredBody: string;
|
|
283
335
|
statusListening: string;
|
|
284
336
|
resumingConversation: string;
|
|
337
|
+
reconnecting: string;
|
|
285
338
|
conversationCompleted: string;
|
|
286
339
|
somethingWentWrong: string;
|
|
287
340
|
chatInputPlaceholder: string;
|
|
288
341
|
sendButton: string;
|
|
289
342
|
handBackButton: string;
|
|
290
343
|
converseDoneButton: string;
|
|
344
|
+
startConversation: string;
|
|
345
|
+
clickToStartDescription: string;
|
|
346
|
+
resumeTitle: string;
|
|
347
|
+
resumeContinue: string;
|
|
348
|
+
resumeRestart: string;
|
|
349
|
+
startNewConversation: string;
|
|
350
|
+
conversationEnded: string;
|
|
291
351
|
}
|
|
292
352
|
declare const defaultStrings: WidgetStrings;
|
|
293
353
|
/** Merge a partial override on top of the defaults. */
|
|
@@ -373,9 +433,27 @@ interface ChatterflyWidgetProps extends Omit<WidgetConfig, "runId" | "participan
|
|
|
373
433
|
* auto-start (`workflowId`/`deploymentId`) so a page refresh resumes the
|
|
374
434
|
* existing run instead of minting a new one. `true` uses sessionStorage;
|
|
375
435
|
* pass an options object to use localStorage or a custom key. Ignored for
|
|
376
|
-
* direct `runId` embeds. Default `false
|
|
436
|
+
* direct `runId` embeds. Default `true` — pass `false` to opt out.
|
|
377
437
|
*/
|
|
378
438
|
persistSession?: PersistSessionConfig;
|
|
439
|
+
/**
|
|
440
|
+
* Gate serverless auto-start (`workflowId`/`deploymentId`) behind a "Start
|
|
441
|
+
* conversation" button instead of minting a run on mount. `true` uses the
|
|
442
|
+
* default copy; pass an object to customize. Default `false`.
|
|
443
|
+
*/
|
|
444
|
+
clickToStart?: boolean | ClickToStartConfig;
|
|
445
|
+
/**
|
|
446
|
+
* When a persisted session exists for an active (non-terminal) run, show a
|
|
447
|
+
* "Continue where you left off? / Start fresh" choice instead of silently
|
|
448
|
+
* resuming. Default `false` (silent resume).
|
|
449
|
+
*/
|
|
450
|
+
resumePrompt?: boolean | ResumePromptConfig;
|
|
451
|
+
/**
|
|
452
|
+
* When a persisted session's run already reached a terminal state
|
|
453
|
+
* (completed/error), replay its history read-only with a "Start new
|
|
454
|
+
* conversation" CTA instead of auto-restarting. Default `true`.
|
|
455
|
+
*/
|
|
456
|
+
showCompletedHistory?: boolean;
|
|
379
457
|
/** `inline` (default, zero behavior change) | `floating` (docked launcher bubble + expandable panel). */
|
|
380
458
|
mode?: "inline" | "floating";
|
|
381
459
|
/** Where the launcher bubble docks in `floating` mode. Default `bottom-right`. */
|
|
@@ -451,6 +529,8 @@ declare const ChatAdapter: react.ForwardRefExoticComponent<ChatAdapterProps & re
|
|
|
451
529
|
type VoiceOrbState = "idle" | "listening" | "speaking" | "processing" | "confirming" | "error";
|
|
452
530
|
interface VoiceOrbProps {
|
|
453
531
|
state: VoiceOrbState;
|
|
532
|
+
/** Smoothed microphone energy in the range 0..1. */
|
|
533
|
+
inputLevel?: number;
|
|
454
534
|
onPress?: () => void;
|
|
455
535
|
onRelease?: () => void;
|
|
456
536
|
disabled?: boolean;
|
|
@@ -466,7 +546,7 @@ interface VoiceOrbProps {
|
|
|
466
546
|
* - confirming: pop + success color
|
|
467
547
|
* - error: shake + red flash
|
|
468
548
|
*/
|
|
469
|
-
declare function VoiceOrb({ state, onPress, onRelease, disabled, }: VoiceOrbProps): react_jsx_runtime.JSX.Element;
|
|
549
|
+
declare function VoiceOrb({ state, inputLevel, onPress, onRelease, disabled, }: VoiceOrbProps): react_jsx_runtime.JSX.Element;
|
|
470
550
|
|
|
471
551
|
interface VoicePromptCardProps {
|
|
472
552
|
field: FieldSpec;
|
|
@@ -571,12 +651,16 @@ interface VoiceLiveRendererProps {
|
|
|
571
651
|
participantToken: string;
|
|
572
652
|
/** HITL session id; the proxy resolves field, channel, and tokens from it. */
|
|
573
653
|
sessionId: string;
|
|
654
|
+
/** Current field's HITL session, distinct from the first session pinned for the socket. */
|
|
655
|
+
fieldSessionId: string;
|
|
574
656
|
/** Resolved widget/voice live tunables (config.style "live"). May be empty — defaults are server-side. */
|
|
575
657
|
liveConfig?: SurfaceConfig;
|
|
576
658
|
onValue: (value: unknown) => void;
|
|
659
|
+
onPlaybackComplete?: () => void;
|
|
660
|
+
onFieldRevealed?: (sessionId: string) => void;
|
|
577
661
|
disabled?: boolean;
|
|
578
662
|
}
|
|
579
|
-
declare function VoiceLiveRenderer({ field, apiBase, participantToken, sessionId, liveConfig, onValue, disabled, }: VoiceLiveRendererProps): react_jsx_runtime.JSX.Element;
|
|
663
|
+
declare function VoiceLiveRenderer({ field, apiBase, participantToken, sessionId, fieldSessionId, liveConfig, onValue, onPlaybackComplete, onFieldRevealed, disabled, }: VoiceLiveRendererProps): react_jsx_runtime.JSX.Element;
|
|
580
664
|
|
|
581
665
|
interface RequiredConnection {
|
|
582
666
|
slug: string;
|
|
@@ -639,7 +723,9 @@ declare function ConnectionOnboarding({ connections, appBase, participantToken,
|
|
|
639
723
|
* Live model, so the widget only manages the audio pipes and surfaces
|
|
640
724
|
* transparency events to the UI.
|
|
641
725
|
*/
|
|
642
|
-
type LiveVoiceState = "idle" | "connecting" | "listening"
|
|
726
|
+
type LiveVoiceState = "idle" | "connecting" | "listening"
|
|
727
|
+
/** Transcript arrived; answer/tool/workflow/model turn is advancing. */
|
|
728
|
+
| "processing" | "speaking" | "muted" | "completed" | "error";
|
|
643
729
|
interface LiveTranscript {
|
|
644
730
|
/** "user" for input transcription, "assistant" for output transcription. */
|
|
645
731
|
who: "user" | "assistant";
|
|
@@ -663,8 +749,18 @@ interface LiveSessionResult {
|
|
|
663
749
|
assistantText: string;
|
|
664
750
|
/** Latest field id reported by the proxy via field_change. */
|
|
665
751
|
activeFieldId: string | null;
|
|
752
|
+
/**
|
|
753
|
+
* The most recent field whose audio has finished PLAYING. The engine opens a
|
|
754
|
+
* field (and sends field_change) seconds before the spoken question ends, so
|
|
755
|
+
* renderers should gate field UI on this, not on activeFieldId.
|
|
756
|
+
*/
|
|
757
|
+
askedFieldId: string | null;
|
|
758
|
+
/** True once the terminal socket has closed and all received PCM has played. */
|
|
759
|
+
playbackComplete: boolean;
|
|
666
760
|
/** The committed value, set when the proxy emits a value envelope. */
|
|
667
761
|
lastValue: unknown;
|
|
762
|
+
/** Smoothed microphone energy in the range 0..1; visual feedback only. */
|
|
763
|
+
inputLevel: number;
|
|
668
764
|
isMuted: boolean;
|
|
669
765
|
toggleMute: () => void;
|
|
670
766
|
error: string | null;
|
|
@@ -785,7 +881,10 @@ interface UseChatterflyRunOptions extends Omit<WidgetConfig, "runId" | "particip
|
|
|
785
881
|
runId?: string;
|
|
786
882
|
/** Required alongside `runId`. */
|
|
787
883
|
participantToken?: string;
|
|
788
|
-
/**
|
|
884
|
+
/**
|
|
885
|
+
* Persist the resolved session across page loads. See `PersistSessionConfig`.
|
|
886
|
+
* Default `true` — pass `false` to opt out.
|
|
887
|
+
*/
|
|
789
888
|
persistSession?: PersistSessionConfig;
|
|
790
889
|
/** Firehose of every raw run event, in order. */
|
|
791
890
|
onEvent?: (event: RunEvent) => void;
|
|
@@ -940,4 +1039,4 @@ declare function extractValue(transcript: string, field: FieldSpec): ExtractionR
|
|
|
940
1039
|
*/
|
|
941
1040
|
declare function buildSpokenPrompt(field: FieldSpec, voiceHint?: string): string;
|
|
942
1041
|
|
|
943
|
-
export { type BubbleComponents, type BubbleProps, ChatAdapter, type ChatAdapterProps, type ChatMessage, ChatTimeline, type ChatTimelineProps, ChatterflyWidget, type ChatterflyWidgetHandle, type ChatterflyWidgetProps, type ColorScheme, ConnectionOnboarding, type ConnectionOnboardingProps, type ContinuousVoiceSessionResult, type ContinuousVoiceState, type ExtractionResult, type FieldSpec, type HITLSession, InputBoolean, type InputComponentProps, InputDate, InputDisplay, InputFileUpload, InputLocation, InputMultiSelect, InputNumber, InputRating, InputSingleSelect, InputText, InputTextArea, type InputTypeProps, type LauncherPosition, type LiveSessionConfig, type LiveSessionResult, type LiveTranscript, type LiveVoiceState, type PersistSessionConfig, type PersistSessionOptions, type RecordingState, type RepeaterSpec, type RequiredConnection, type RunEvent, type RunStatus, type SessionRendererProps, type SynthState, type ThemeTokens, type TimelineEntry, type UseChatterflyRunOptions, type UseChatterflyRunResult, type UseParticipantConnectionsResult, type UseRunStreamResult, type UseSpeechSynthesisResult, type UseTranscribeResult, type UseVoiceRecorderResult, type ValidationError, type ValidationRule, VoiceContinuousRenderer, type VoiceContinuousRendererProps, VoiceLiveRenderer, type VoiceLiveRendererProps, VoiceOrb, type VoiceOrbProps, type VoiceOrbState, VoicePromptCard, type VoicePromptCardProps, VoiceRenderer, type VoiceRendererProps, type WidgetConfig, WidgetError, type WidgetErrorCode, type WidgetStrings, buildSpokenPrompt, defaultStrings, extractValue, getInputComponent, registerInputType, registerSessionRenderer, resolveInputType, resolveSessionRenderer, resolveStrings, useChatterflyRun, useContinuousVoiceSession, useGeminiLiveSession, useParticipantConnections, useRunStream, useSpeechSynthesis, useTranscribe, useVoiceRecorder };
|
|
1042
|
+
export { type BubbleComponents, type BubbleProps, ChatAdapter, type ChatAdapterProps, type ChatMessage, ChatTimeline, type ChatTimelineProps, ChatterflyWidget, type ChatterflyWidgetHandle, type ChatterflyWidgetProps, type ClickToStartConfig, type ColorScheme, ConnectionOnboarding, type ConnectionOnboardingProps, type ConnectionPolicy, type ContinuousVoiceSessionResult, type ContinuousVoiceState, type ExtractionResult, type FieldSpec, type HITLSession, InputBoolean, type InputComponentProps, InputDate, InputDisplay, InputFileUpload, InputLocation, InputMultiSelect, InputNumber, InputRating, InputSingleSelect, InputText, InputTextArea, type InputTypeProps, type LauncherPosition, type LiveSessionConfig, type LiveSessionResult, type LiveTranscript, type LiveVoiceState, type PersistSessionConfig, type PersistSessionOptions, type RecordingState, type RepeaterSpec, type RequiredConnection, type ResumePromptConfig, type RunEvent, type RunStatus, type SessionRendererProps, type SynthState, type ThemeTokens, type TimelineEntry, type UseChatterflyRunOptions, type UseChatterflyRunResult, type UseParticipantConnectionsResult, type UseRunStreamResult, type UseSpeechSynthesisResult, type UseTranscribeResult, type UseVoiceRecorderResult, type ValidationError, type ValidationRule, VoiceContinuousRenderer, type VoiceContinuousRendererProps, VoiceLiveRenderer, type VoiceLiveRendererProps, VoiceOrb, type VoiceOrbProps, type VoiceOrbState, VoicePromptCard, type VoicePromptCardProps, VoiceRenderer, type VoiceRendererProps, type WidgetConfig, WidgetError, type WidgetErrorCode, type WidgetStrings, buildSpokenPrompt, defaultStrings, extractValue, getInputComponent, registerInputType, registerSessionRenderer, resolveInputType, resolveSessionRenderer, resolveStrings, useChatterflyRun, useContinuousVoiceSession, useGeminiLiveSession, useParticipantConnections, useRunStream, useSpeechSynthesis, useTranscribe, useVoiceRecorder };
|