@runtypelabs/persona 4.24.0 → 4.25.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/approval-ui.d.cts +63 -0
- package/dist/approval-ui.d.ts +63 -0
- package/dist/artifacts-ui.d.cts +63 -0
- package/dist/artifacts-ui.d.ts +63 -0
- package/dist/codegen.cjs +1 -1
- package/dist/codegen.js +1 -1
- package/dist/context-mentions.d.cts +63 -0
- package/dist/context-mentions.d.ts +63 -0
- package/dist/event-stream-view.d.cts +63 -0
- package/dist/event-stream-view.d.ts +63 -0
- package/dist/forms-ui.d.cts +74 -0
- package/dist/forms-ui.d.ts +74 -0
- package/dist/index.cjs +42 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +75 -1
- package/dist/index.d.ts +75 -1
- package/dist/index.global.js +27 -27
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +42 -42
- package/dist/index.js.map +1 -1
- package/dist/session-reconnect.d.cts +63 -0
- package/dist/session-reconnect.d.ts +63 -0
- package/dist/smart-dom-reader.d.cts +63 -0
- package/dist/smart-dom-reader.d.ts +63 -0
- package/dist/theme-editor-preview.cjs +49 -49
- package/dist/theme-editor-preview.d.cts +63 -0
- package/dist/theme-editor-preview.d.ts +63 -0
- package/dist/theme-editor-preview.js +27 -27
- package/dist/theme-editor.d.cts +63 -0
- package/dist/theme-editor.d.ts +63 -0
- package/dist/voice-runtime-7DA7MJH4.js +1 -0
- package/dist/voice-runtime.cjs +1 -1
- package/dist/voice-runtime.d.cts +33 -0
- package/dist/voice-runtime.d.ts +33 -0
- package/dist/voice-runtime.js +1 -1
- package/package.json +1 -1
- package/src/index-core.ts +2 -0
- package/src/session.ts +30 -1
- package/src/session.voice.test.ts +72 -1
- package/src/types.ts +71 -0
- package/src/ui.ts +59 -0
- package/src/ui.voice-prewarm.test.ts +222 -0
- package/src/voice/runtype-voice-provider.ts +238 -27
- package/src/voice/voice.test.ts +272 -2
- package/dist/voice-runtime-EFR3R5ES.js +0 -1
package/dist/approval-ui.d.cts
CHANGED
|
@@ -6577,6 +6577,22 @@ type AgentWidgetStatusIndicatorConfig = {
|
|
|
6577
6577
|
/** Status text while a reconnect attempt is in flight. */
|
|
6578
6578
|
resumingText?: string;
|
|
6579
6579
|
};
|
|
6580
|
+
/** Built-in `voiceRecognition.prewarm` triggers. See {@link AgentWidgetVoiceRecognitionConfig.prewarm}. */
|
|
6581
|
+
type AgentWidgetVoicePrewarmTrigger = 'hover';
|
|
6582
|
+
/**
|
|
6583
|
+
* Custom `voiceRecognition.prewarm` trigger. Runs while the composer has a mic
|
|
6584
|
+
* button, and again when the button is rebuilt or `update()` swaps in a
|
|
6585
|
+
* different function. Call `warm()` whenever the visitor shows intent to talk
|
|
6586
|
+
* (it is safe to call repeatedly). Return a cleanup to run on replacement.
|
|
6587
|
+
*/
|
|
6588
|
+
type AgentWidgetVoicePrewarmHook = (context: {
|
|
6589
|
+
/** Fire-and-forget voice warm-up; latched and error-swallowing. */
|
|
6590
|
+
warm: () => void;
|
|
6591
|
+
/** The composer's current mic button. */
|
|
6592
|
+
micButton: HTMLButtonElement;
|
|
6593
|
+
/** The widget's mount element. */
|
|
6594
|
+
mount: HTMLElement;
|
|
6595
|
+
}) => void | (() => void);
|
|
6580
6596
|
type AgentWidgetVoiceRecognitionConfig = {
|
|
6581
6597
|
/**
|
|
6582
6598
|
* Enable the mic button and voice input. The mic still only renders when the
|
|
@@ -6642,6 +6658,29 @@ type AgentWidgetVoiceRecognitionConfig = {
|
|
|
6642
6658
|
* Fires once per turn after the reply completes.
|
|
6643
6659
|
*/
|
|
6644
6660
|
onMetrics?: (metrics: VoiceMetrics) => void;
|
|
6661
|
+
/**
|
|
6662
|
+
* Warm the voice path when the visitor shows intent to talk, before the mic
|
|
6663
|
+
* click, so the call starts faster.
|
|
6664
|
+
*
|
|
6665
|
+
* - `'hover'`: when the pointer enters the mic button, it receives focus, or
|
|
6666
|
+
* (on touch) the first pointer-down on it.
|
|
6667
|
+
* - `false`: never.
|
|
6668
|
+
* - A function: custom trigger. Called with `{ warm, micButton, mount }`
|
|
6669
|
+
* while the mic button exists (and again when the button is rebuilt or
|
|
6670
|
+
* `update()` swaps in a different function); call `warm()` whenever you
|
|
6671
|
+
* decide, e.g. when the panel opens. May return a cleanup that runs on
|
|
6672
|
+
* destroy, rebuild, or replacement. Replaces the built-in trigger.
|
|
6673
|
+
*
|
|
6674
|
+
* What `warm()` does depends on the provider: `runtype` fires its prewarm
|
|
6675
|
+
* (see `provider.runtype.prewarmMode`), a `custom` provider's optional
|
|
6676
|
+
* {@link VoiceProvider.prewarm} runs, and the browser (Web Speech) path
|
|
6677
|
+
* starts the client-token session init (as `sessionInit` does), since speech
|
|
6678
|
+
* recognition itself cannot start before the click. Warming is
|
|
6679
|
+
* fire-and-forget, latched, and never surfaces an error or UI state.
|
|
6680
|
+
*
|
|
6681
|
+
* @default 'hover' in client token mode, otherwise `false`
|
|
6682
|
+
*/
|
|
6683
|
+
prewarm?: AgentWidgetVoicePrewarmTrigger | AgentWidgetVoicePrewarmHook | false;
|
|
6645
6684
|
provider?: {
|
|
6646
6685
|
type: 'browser' | 'runtype' | 'custom';
|
|
6647
6686
|
browser?: {
|
|
@@ -6663,6 +6702,23 @@ type AgentWidgetVoiceRecognitionConfig = {
|
|
|
6663
6702
|
* `@runtypelabs/persona/voice-worklet-player` for a jitter-buffered engine.
|
|
6664
6703
|
*/
|
|
6665
6704
|
createPlaybackEngine?: () => VoicePlaybackEngine | Promise<VoicePlaybackEngine>;
|
|
6705
|
+
/**
|
|
6706
|
+
* How `prewarm()` warms the voice path (see `voiceRecognition.prewarm`).
|
|
6707
|
+
*
|
|
6708
|
+
* - `'request'` (default): a fire-and-forget
|
|
6709
|
+
* `POST {host}/v1/client/agents/{agentId}/voice/prewarm`.
|
|
6710
|
+
* - `'attach'`: open the voice WebSocket ahead of the click without
|
|
6711
|
+
* starting a call; the click then starts the call on that socket. It can
|
|
6712
|
+
* create server work before the visitor clicks, so it is opt-in.
|
|
6713
|
+
* @default 'request'
|
|
6714
|
+
*/
|
|
6715
|
+
prewarmMode?: 'request' | 'attach';
|
|
6716
|
+
/**
|
|
6717
|
+
* `'attach'` mode: how long (ms) an attached socket waits for the click
|
|
6718
|
+
* before it closes. The server clamps it to 30000..600000.
|
|
6719
|
+
* @default 30000
|
|
6720
|
+
*/
|
|
6721
|
+
attachIdleMs?: number;
|
|
6666
6722
|
/** @deprecated No-op on the realtime path: the server's STT owns turn-taking. */
|
|
6667
6723
|
pauseDuration?: number;
|
|
6668
6724
|
/** @deprecated No-op on the realtime path: the server's STT owns turn-taking. */
|
|
@@ -6963,6 +7019,13 @@ interface VoiceProvider {
|
|
|
6963
7019
|
deactivateBargeIn?(): Promise<void>;
|
|
6964
7020
|
/** Stop playback / cancel in-flight request without starting recording */
|
|
6965
7021
|
stopPlayback?(): void;
|
|
7022
|
+
/**
|
|
7023
|
+
* Warm the provider ahead of `startListening()` (the widget calls it on mic
|
|
7024
|
+
* intent, see `voiceRecognition.prewarm`). Must be fire-and-forget: never
|
|
7025
|
+
* throw, emit errors or status, or acquire the microphone. May be called
|
|
7026
|
+
* repeatedly; throttle as needed.
|
|
7027
|
+
*/
|
|
7028
|
+
prewarm?(): void;
|
|
6966
7029
|
}
|
|
6967
7030
|
/**
|
|
6968
7031
|
* Extra context for an approval decision, surfaced to `onDecision` and to the
|
package/dist/approval-ui.d.ts
CHANGED
|
@@ -6577,6 +6577,22 @@ type AgentWidgetStatusIndicatorConfig = {
|
|
|
6577
6577
|
/** Status text while a reconnect attempt is in flight. */
|
|
6578
6578
|
resumingText?: string;
|
|
6579
6579
|
};
|
|
6580
|
+
/** Built-in `voiceRecognition.prewarm` triggers. See {@link AgentWidgetVoiceRecognitionConfig.prewarm}. */
|
|
6581
|
+
type AgentWidgetVoicePrewarmTrigger = 'hover';
|
|
6582
|
+
/**
|
|
6583
|
+
* Custom `voiceRecognition.prewarm` trigger. Runs while the composer has a mic
|
|
6584
|
+
* button, and again when the button is rebuilt or `update()` swaps in a
|
|
6585
|
+
* different function. Call `warm()` whenever the visitor shows intent to talk
|
|
6586
|
+
* (it is safe to call repeatedly). Return a cleanup to run on replacement.
|
|
6587
|
+
*/
|
|
6588
|
+
type AgentWidgetVoicePrewarmHook = (context: {
|
|
6589
|
+
/** Fire-and-forget voice warm-up; latched and error-swallowing. */
|
|
6590
|
+
warm: () => void;
|
|
6591
|
+
/** The composer's current mic button. */
|
|
6592
|
+
micButton: HTMLButtonElement;
|
|
6593
|
+
/** The widget's mount element. */
|
|
6594
|
+
mount: HTMLElement;
|
|
6595
|
+
}) => void | (() => void);
|
|
6580
6596
|
type AgentWidgetVoiceRecognitionConfig = {
|
|
6581
6597
|
/**
|
|
6582
6598
|
* Enable the mic button and voice input. The mic still only renders when the
|
|
@@ -6642,6 +6658,29 @@ type AgentWidgetVoiceRecognitionConfig = {
|
|
|
6642
6658
|
* Fires once per turn after the reply completes.
|
|
6643
6659
|
*/
|
|
6644
6660
|
onMetrics?: (metrics: VoiceMetrics) => void;
|
|
6661
|
+
/**
|
|
6662
|
+
* Warm the voice path when the visitor shows intent to talk, before the mic
|
|
6663
|
+
* click, so the call starts faster.
|
|
6664
|
+
*
|
|
6665
|
+
* - `'hover'`: when the pointer enters the mic button, it receives focus, or
|
|
6666
|
+
* (on touch) the first pointer-down on it.
|
|
6667
|
+
* - `false`: never.
|
|
6668
|
+
* - A function: custom trigger. Called with `{ warm, micButton, mount }`
|
|
6669
|
+
* while the mic button exists (and again when the button is rebuilt or
|
|
6670
|
+
* `update()` swaps in a different function); call `warm()` whenever you
|
|
6671
|
+
* decide, e.g. when the panel opens. May return a cleanup that runs on
|
|
6672
|
+
* destroy, rebuild, or replacement. Replaces the built-in trigger.
|
|
6673
|
+
*
|
|
6674
|
+
* What `warm()` does depends on the provider: `runtype` fires its prewarm
|
|
6675
|
+
* (see `provider.runtype.prewarmMode`), a `custom` provider's optional
|
|
6676
|
+
* {@link VoiceProvider.prewarm} runs, and the browser (Web Speech) path
|
|
6677
|
+
* starts the client-token session init (as `sessionInit` does), since speech
|
|
6678
|
+
* recognition itself cannot start before the click. Warming is
|
|
6679
|
+
* fire-and-forget, latched, and never surfaces an error or UI state.
|
|
6680
|
+
*
|
|
6681
|
+
* @default 'hover' in client token mode, otherwise `false`
|
|
6682
|
+
*/
|
|
6683
|
+
prewarm?: AgentWidgetVoicePrewarmTrigger | AgentWidgetVoicePrewarmHook | false;
|
|
6645
6684
|
provider?: {
|
|
6646
6685
|
type: 'browser' | 'runtype' | 'custom';
|
|
6647
6686
|
browser?: {
|
|
@@ -6663,6 +6702,23 @@ type AgentWidgetVoiceRecognitionConfig = {
|
|
|
6663
6702
|
* `@runtypelabs/persona/voice-worklet-player` for a jitter-buffered engine.
|
|
6664
6703
|
*/
|
|
6665
6704
|
createPlaybackEngine?: () => VoicePlaybackEngine | Promise<VoicePlaybackEngine>;
|
|
6705
|
+
/**
|
|
6706
|
+
* How `prewarm()` warms the voice path (see `voiceRecognition.prewarm`).
|
|
6707
|
+
*
|
|
6708
|
+
* - `'request'` (default): a fire-and-forget
|
|
6709
|
+
* `POST {host}/v1/client/agents/{agentId}/voice/prewarm`.
|
|
6710
|
+
* - `'attach'`: open the voice WebSocket ahead of the click without
|
|
6711
|
+
* starting a call; the click then starts the call on that socket. It can
|
|
6712
|
+
* create server work before the visitor clicks, so it is opt-in.
|
|
6713
|
+
* @default 'request'
|
|
6714
|
+
*/
|
|
6715
|
+
prewarmMode?: 'request' | 'attach';
|
|
6716
|
+
/**
|
|
6717
|
+
* `'attach'` mode: how long (ms) an attached socket waits for the click
|
|
6718
|
+
* before it closes. The server clamps it to 30000..600000.
|
|
6719
|
+
* @default 30000
|
|
6720
|
+
*/
|
|
6721
|
+
attachIdleMs?: number;
|
|
6666
6722
|
/** @deprecated No-op on the realtime path: the server's STT owns turn-taking. */
|
|
6667
6723
|
pauseDuration?: number;
|
|
6668
6724
|
/** @deprecated No-op on the realtime path: the server's STT owns turn-taking. */
|
|
@@ -6963,6 +7019,13 @@ interface VoiceProvider {
|
|
|
6963
7019
|
deactivateBargeIn?(): Promise<void>;
|
|
6964
7020
|
/** Stop playback / cancel in-flight request without starting recording */
|
|
6965
7021
|
stopPlayback?(): void;
|
|
7022
|
+
/**
|
|
7023
|
+
* Warm the provider ahead of `startListening()` (the widget calls it on mic
|
|
7024
|
+
* intent, see `voiceRecognition.prewarm`). Must be fire-and-forget: never
|
|
7025
|
+
* throw, emit errors or status, or acquire the microphone. May be called
|
|
7026
|
+
* repeatedly; throttle as needed.
|
|
7027
|
+
*/
|
|
7028
|
+
prewarm?(): void;
|
|
6966
7029
|
}
|
|
6967
7030
|
/**
|
|
6968
7031
|
* Extra context for an approval decision, surfaced to `onDecision` and to the
|
package/dist/artifacts-ui.d.cts
CHANGED
|
@@ -6579,6 +6579,22 @@ type AgentWidgetStatusIndicatorConfig = {
|
|
|
6579
6579
|
/** Status text while a reconnect attempt is in flight. */
|
|
6580
6580
|
resumingText?: string;
|
|
6581
6581
|
};
|
|
6582
|
+
/** Built-in `voiceRecognition.prewarm` triggers. See {@link AgentWidgetVoiceRecognitionConfig.prewarm}. */
|
|
6583
|
+
type AgentWidgetVoicePrewarmTrigger = 'hover';
|
|
6584
|
+
/**
|
|
6585
|
+
* Custom `voiceRecognition.prewarm` trigger. Runs while the composer has a mic
|
|
6586
|
+
* button, and again when the button is rebuilt or `update()` swaps in a
|
|
6587
|
+
* different function. Call `warm()` whenever the visitor shows intent to talk
|
|
6588
|
+
* (it is safe to call repeatedly). Return a cleanup to run on replacement.
|
|
6589
|
+
*/
|
|
6590
|
+
type AgentWidgetVoicePrewarmHook = (context: {
|
|
6591
|
+
/** Fire-and-forget voice warm-up; latched and error-swallowing. */
|
|
6592
|
+
warm: () => void;
|
|
6593
|
+
/** The composer's current mic button. */
|
|
6594
|
+
micButton: HTMLButtonElement;
|
|
6595
|
+
/** The widget's mount element. */
|
|
6596
|
+
mount: HTMLElement;
|
|
6597
|
+
}) => void | (() => void);
|
|
6582
6598
|
type AgentWidgetVoiceRecognitionConfig = {
|
|
6583
6599
|
/**
|
|
6584
6600
|
* Enable the mic button and voice input. The mic still only renders when the
|
|
@@ -6644,6 +6660,29 @@ type AgentWidgetVoiceRecognitionConfig = {
|
|
|
6644
6660
|
* Fires once per turn after the reply completes.
|
|
6645
6661
|
*/
|
|
6646
6662
|
onMetrics?: (metrics: VoiceMetrics) => void;
|
|
6663
|
+
/**
|
|
6664
|
+
* Warm the voice path when the visitor shows intent to talk, before the mic
|
|
6665
|
+
* click, so the call starts faster.
|
|
6666
|
+
*
|
|
6667
|
+
* - `'hover'`: when the pointer enters the mic button, it receives focus, or
|
|
6668
|
+
* (on touch) the first pointer-down on it.
|
|
6669
|
+
* - `false`: never.
|
|
6670
|
+
* - A function: custom trigger. Called with `{ warm, micButton, mount }`
|
|
6671
|
+
* while the mic button exists (and again when the button is rebuilt or
|
|
6672
|
+
* `update()` swaps in a different function); call `warm()` whenever you
|
|
6673
|
+
* decide, e.g. when the panel opens. May return a cleanup that runs on
|
|
6674
|
+
* destroy, rebuild, or replacement. Replaces the built-in trigger.
|
|
6675
|
+
*
|
|
6676
|
+
* What `warm()` does depends on the provider: `runtype` fires its prewarm
|
|
6677
|
+
* (see `provider.runtype.prewarmMode`), a `custom` provider's optional
|
|
6678
|
+
* {@link VoiceProvider.prewarm} runs, and the browser (Web Speech) path
|
|
6679
|
+
* starts the client-token session init (as `sessionInit` does), since speech
|
|
6680
|
+
* recognition itself cannot start before the click. Warming is
|
|
6681
|
+
* fire-and-forget, latched, and never surfaces an error or UI state.
|
|
6682
|
+
*
|
|
6683
|
+
* @default 'hover' in client token mode, otherwise `false`
|
|
6684
|
+
*/
|
|
6685
|
+
prewarm?: AgentWidgetVoicePrewarmTrigger | AgentWidgetVoicePrewarmHook | false;
|
|
6647
6686
|
provider?: {
|
|
6648
6687
|
type: 'browser' | 'runtype' | 'custom';
|
|
6649
6688
|
browser?: {
|
|
@@ -6665,6 +6704,23 @@ type AgentWidgetVoiceRecognitionConfig = {
|
|
|
6665
6704
|
* `@runtypelabs/persona/voice-worklet-player` for a jitter-buffered engine.
|
|
6666
6705
|
*/
|
|
6667
6706
|
createPlaybackEngine?: () => VoicePlaybackEngine | Promise<VoicePlaybackEngine>;
|
|
6707
|
+
/**
|
|
6708
|
+
* How `prewarm()` warms the voice path (see `voiceRecognition.prewarm`).
|
|
6709
|
+
*
|
|
6710
|
+
* - `'request'` (default): a fire-and-forget
|
|
6711
|
+
* `POST {host}/v1/client/agents/{agentId}/voice/prewarm`.
|
|
6712
|
+
* - `'attach'`: open the voice WebSocket ahead of the click without
|
|
6713
|
+
* starting a call; the click then starts the call on that socket. It can
|
|
6714
|
+
* create server work before the visitor clicks, so it is opt-in.
|
|
6715
|
+
* @default 'request'
|
|
6716
|
+
*/
|
|
6717
|
+
prewarmMode?: 'request' | 'attach';
|
|
6718
|
+
/**
|
|
6719
|
+
* `'attach'` mode: how long (ms) an attached socket waits for the click
|
|
6720
|
+
* before it closes. The server clamps it to 30000..600000.
|
|
6721
|
+
* @default 30000
|
|
6722
|
+
*/
|
|
6723
|
+
attachIdleMs?: number;
|
|
6668
6724
|
/** @deprecated No-op on the realtime path: the server's STT owns turn-taking. */
|
|
6669
6725
|
pauseDuration?: number;
|
|
6670
6726
|
/** @deprecated No-op on the realtime path: the server's STT owns turn-taking. */
|
|
@@ -6965,6 +7021,13 @@ interface VoiceProvider {
|
|
|
6965
7021
|
deactivateBargeIn?(): Promise<void>;
|
|
6966
7022
|
/** Stop playback / cancel in-flight request without starting recording */
|
|
6967
7023
|
stopPlayback?(): void;
|
|
7024
|
+
/**
|
|
7025
|
+
* Warm the provider ahead of `startListening()` (the widget calls it on mic
|
|
7026
|
+
* intent, see `voiceRecognition.prewarm`). Must be fire-and-forget: never
|
|
7027
|
+
* throw, emit errors or status, or acquire the microphone. May be called
|
|
7028
|
+
* repeatedly; throttle as needed.
|
|
7029
|
+
*/
|
|
7030
|
+
prewarm?(): void;
|
|
6968
7031
|
}
|
|
6969
7032
|
/**
|
|
6970
7033
|
* Extra context for an approval decision, surfaced to `onDecision` and to the
|
package/dist/artifacts-ui.d.ts
CHANGED
|
@@ -6579,6 +6579,22 @@ type AgentWidgetStatusIndicatorConfig = {
|
|
|
6579
6579
|
/** Status text while a reconnect attempt is in flight. */
|
|
6580
6580
|
resumingText?: string;
|
|
6581
6581
|
};
|
|
6582
|
+
/** Built-in `voiceRecognition.prewarm` triggers. See {@link AgentWidgetVoiceRecognitionConfig.prewarm}. */
|
|
6583
|
+
type AgentWidgetVoicePrewarmTrigger = 'hover';
|
|
6584
|
+
/**
|
|
6585
|
+
* Custom `voiceRecognition.prewarm` trigger. Runs while the composer has a mic
|
|
6586
|
+
* button, and again when the button is rebuilt or `update()` swaps in a
|
|
6587
|
+
* different function. Call `warm()` whenever the visitor shows intent to talk
|
|
6588
|
+
* (it is safe to call repeatedly). Return a cleanup to run on replacement.
|
|
6589
|
+
*/
|
|
6590
|
+
type AgentWidgetVoicePrewarmHook = (context: {
|
|
6591
|
+
/** Fire-and-forget voice warm-up; latched and error-swallowing. */
|
|
6592
|
+
warm: () => void;
|
|
6593
|
+
/** The composer's current mic button. */
|
|
6594
|
+
micButton: HTMLButtonElement;
|
|
6595
|
+
/** The widget's mount element. */
|
|
6596
|
+
mount: HTMLElement;
|
|
6597
|
+
}) => void | (() => void);
|
|
6582
6598
|
type AgentWidgetVoiceRecognitionConfig = {
|
|
6583
6599
|
/**
|
|
6584
6600
|
* Enable the mic button and voice input. The mic still only renders when the
|
|
@@ -6644,6 +6660,29 @@ type AgentWidgetVoiceRecognitionConfig = {
|
|
|
6644
6660
|
* Fires once per turn after the reply completes.
|
|
6645
6661
|
*/
|
|
6646
6662
|
onMetrics?: (metrics: VoiceMetrics) => void;
|
|
6663
|
+
/**
|
|
6664
|
+
* Warm the voice path when the visitor shows intent to talk, before the mic
|
|
6665
|
+
* click, so the call starts faster.
|
|
6666
|
+
*
|
|
6667
|
+
* - `'hover'`: when the pointer enters the mic button, it receives focus, or
|
|
6668
|
+
* (on touch) the first pointer-down on it.
|
|
6669
|
+
* - `false`: never.
|
|
6670
|
+
* - A function: custom trigger. Called with `{ warm, micButton, mount }`
|
|
6671
|
+
* while the mic button exists (and again when the button is rebuilt or
|
|
6672
|
+
* `update()` swaps in a different function); call `warm()` whenever you
|
|
6673
|
+
* decide, e.g. when the panel opens. May return a cleanup that runs on
|
|
6674
|
+
* destroy, rebuild, or replacement. Replaces the built-in trigger.
|
|
6675
|
+
*
|
|
6676
|
+
* What `warm()` does depends on the provider: `runtype` fires its prewarm
|
|
6677
|
+
* (see `provider.runtype.prewarmMode`), a `custom` provider's optional
|
|
6678
|
+
* {@link VoiceProvider.prewarm} runs, and the browser (Web Speech) path
|
|
6679
|
+
* starts the client-token session init (as `sessionInit` does), since speech
|
|
6680
|
+
* recognition itself cannot start before the click. Warming is
|
|
6681
|
+
* fire-and-forget, latched, and never surfaces an error or UI state.
|
|
6682
|
+
*
|
|
6683
|
+
* @default 'hover' in client token mode, otherwise `false`
|
|
6684
|
+
*/
|
|
6685
|
+
prewarm?: AgentWidgetVoicePrewarmTrigger | AgentWidgetVoicePrewarmHook | false;
|
|
6647
6686
|
provider?: {
|
|
6648
6687
|
type: 'browser' | 'runtype' | 'custom';
|
|
6649
6688
|
browser?: {
|
|
@@ -6665,6 +6704,23 @@ type AgentWidgetVoiceRecognitionConfig = {
|
|
|
6665
6704
|
* `@runtypelabs/persona/voice-worklet-player` for a jitter-buffered engine.
|
|
6666
6705
|
*/
|
|
6667
6706
|
createPlaybackEngine?: () => VoicePlaybackEngine | Promise<VoicePlaybackEngine>;
|
|
6707
|
+
/**
|
|
6708
|
+
* How `prewarm()` warms the voice path (see `voiceRecognition.prewarm`).
|
|
6709
|
+
*
|
|
6710
|
+
* - `'request'` (default): a fire-and-forget
|
|
6711
|
+
* `POST {host}/v1/client/agents/{agentId}/voice/prewarm`.
|
|
6712
|
+
* - `'attach'`: open the voice WebSocket ahead of the click without
|
|
6713
|
+
* starting a call; the click then starts the call on that socket. It can
|
|
6714
|
+
* create server work before the visitor clicks, so it is opt-in.
|
|
6715
|
+
* @default 'request'
|
|
6716
|
+
*/
|
|
6717
|
+
prewarmMode?: 'request' | 'attach';
|
|
6718
|
+
/**
|
|
6719
|
+
* `'attach'` mode: how long (ms) an attached socket waits for the click
|
|
6720
|
+
* before it closes. The server clamps it to 30000..600000.
|
|
6721
|
+
* @default 30000
|
|
6722
|
+
*/
|
|
6723
|
+
attachIdleMs?: number;
|
|
6668
6724
|
/** @deprecated No-op on the realtime path: the server's STT owns turn-taking. */
|
|
6669
6725
|
pauseDuration?: number;
|
|
6670
6726
|
/** @deprecated No-op on the realtime path: the server's STT owns turn-taking. */
|
|
@@ -6965,6 +7021,13 @@ interface VoiceProvider {
|
|
|
6965
7021
|
deactivateBargeIn?(): Promise<void>;
|
|
6966
7022
|
/** Stop playback / cancel in-flight request without starting recording */
|
|
6967
7023
|
stopPlayback?(): void;
|
|
7024
|
+
/**
|
|
7025
|
+
* Warm the provider ahead of `startListening()` (the widget calls it on mic
|
|
7026
|
+
* intent, see `voiceRecognition.prewarm`). Must be fire-and-forget: never
|
|
7027
|
+
* throw, emit errors or status, or acquire the microphone. May be called
|
|
7028
|
+
* repeatedly; throttle as needed.
|
|
7029
|
+
*/
|
|
7030
|
+
prewarm?(): void;
|
|
6968
7031
|
}
|
|
6969
7032
|
/**
|
|
6970
7033
|
* Extra context for an approval decision, surfaced to `onDecision` and to the
|
package/dist/codegen.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var $=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var W=(e,i)=>{for(var r in i)$(e,r,{get:i[r],enumerable:!0})},H=(e,i,r,s)=>{if(i&&typeof i=="object"||typeof i=="function")for(let a of M(i))!R.call(e,a)&&a!==r&&$(e,a,{get:()=>i[a],enumerable:!(s=T(i,a))||s.enumerable});return e};var N=e=>H($({},"__esModule",{value:!0}),e);var X={};W(X,{generateCodeSnippet:()=>I});module.exports=N(X);var j="4.
|
|
1
|
+
"use strict";var $=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var W=(e,i)=>{for(var r in i)$(e,r,{get:i[r],enumerable:!0})},H=(e,i,r,s)=>{if(i&&typeof i=="object"||typeof i=="function")for(let a of M(i))!R.call(e,a)&&a!==r&&$(e,a,{get:()=>i[a],enumerable:!(s=T(i,a))||s.enumerable});return e};var N=e=>H($({},"__esModule",{value:!0}),e);var X={};W(X,{generateCodeSnippet:()=>I});module.exports=N(X);var j="4.25.0";var A=j;function x(e){return e?.cdnBase?.trim().replace(/\/+$/,"").replace(/[\\'"<>`]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`)||`https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${A}/dist`}function u(e){if(e!==void 0)return typeof e=="string"?e:Array.isArray(e)?`[${e.map(i=>i.toString()).join(", ")}]`:e.toString()}function q(e){if(e)return{getHeaders:u(e.getHeaders),onFeedback:u(e.onFeedback),onCopy:u(e.onCopy),requestMiddleware:u(e.requestMiddleware),actionHandlers:u(e.actionHandlers),actionParsers:u(e.actionParsers),postprocessMessage:u(e.postprocessMessage),contextProviders:u(e.contextProviders),streamParser:u(e.streamParser)}}var O=`({ text, message }: any) => {
|
|
2
2
|
const jsonSource = (message as any).rawContent || text || message.content;
|
|
3
3
|
if (!jsonSource || typeof jsonSource !== 'string') return null;
|
|
4
4
|
let cleanJson = jsonSource
|
package/dist/codegen.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var S="4.
|
|
1
|
+
var S="4.25.0";var j=S;function $(e){return e?.cdnBase?.trim().replace(/\/+$/,"").replace(/[\\'"<>`]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`)||`https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${j}/dist`}function u(e){if(e!==void 0)return typeof e=="string"?e:Array.isArray(e)?`[${e.map(i=>i.toString()).join(", ")}]`:e.toString()}function _(e){if(e)return{getHeaders:u(e.getHeaders),onFeedback:u(e.onFeedback),onCopy:u(e.onCopy),requestMiddleware:u(e.requestMiddleware),actionHandlers:u(e.actionHandlers),actionParsers:u(e.actionParsers),postprocessMessage:u(e.postprocessMessage),contextProviders:u(e.contextProviders),streamParser:u(e.streamParser)}}var A=`({ text, message }: any) => {
|
|
2
2
|
const jsonSource = (message as any).rawContent || text || message.content;
|
|
3
3
|
if (!jsonSource || typeof jsonSource !== 'string') return null;
|
|
4
4
|
let cleanJson = jsonSource
|
|
@@ -6577,6 +6577,22 @@ type AgentWidgetStatusIndicatorConfig = {
|
|
|
6577
6577
|
/** Status text while a reconnect attempt is in flight. */
|
|
6578
6578
|
resumingText?: string;
|
|
6579
6579
|
};
|
|
6580
|
+
/** Built-in `voiceRecognition.prewarm` triggers. See {@link AgentWidgetVoiceRecognitionConfig.prewarm}. */
|
|
6581
|
+
type AgentWidgetVoicePrewarmTrigger = 'hover';
|
|
6582
|
+
/**
|
|
6583
|
+
* Custom `voiceRecognition.prewarm` trigger. Runs while the composer has a mic
|
|
6584
|
+
* button, and again when the button is rebuilt or `update()` swaps in a
|
|
6585
|
+
* different function. Call `warm()` whenever the visitor shows intent to talk
|
|
6586
|
+
* (it is safe to call repeatedly). Return a cleanup to run on replacement.
|
|
6587
|
+
*/
|
|
6588
|
+
type AgentWidgetVoicePrewarmHook = (context: {
|
|
6589
|
+
/** Fire-and-forget voice warm-up; latched and error-swallowing. */
|
|
6590
|
+
warm: () => void;
|
|
6591
|
+
/** The composer's current mic button. */
|
|
6592
|
+
micButton: HTMLButtonElement;
|
|
6593
|
+
/** The widget's mount element. */
|
|
6594
|
+
mount: HTMLElement;
|
|
6595
|
+
}) => void | (() => void);
|
|
6580
6596
|
type AgentWidgetVoiceRecognitionConfig = {
|
|
6581
6597
|
/**
|
|
6582
6598
|
* Enable the mic button and voice input. The mic still only renders when the
|
|
@@ -6642,6 +6658,29 @@ type AgentWidgetVoiceRecognitionConfig = {
|
|
|
6642
6658
|
* Fires once per turn after the reply completes.
|
|
6643
6659
|
*/
|
|
6644
6660
|
onMetrics?: (metrics: VoiceMetrics) => void;
|
|
6661
|
+
/**
|
|
6662
|
+
* Warm the voice path when the visitor shows intent to talk, before the mic
|
|
6663
|
+
* click, so the call starts faster.
|
|
6664
|
+
*
|
|
6665
|
+
* - `'hover'`: when the pointer enters the mic button, it receives focus, or
|
|
6666
|
+
* (on touch) the first pointer-down on it.
|
|
6667
|
+
* - `false`: never.
|
|
6668
|
+
* - A function: custom trigger. Called with `{ warm, micButton, mount }`
|
|
6669
|
+
* while the mic button exists (and again when the button is rebuilt or
|
|
6670
|
+
* `update()` swaps in a different function); call `warm()` whenever you
|
|
6671
|
+
* decide, e.g. when the panel opens. May return a cleanup that runs on
|
|
6672
|
+
* destroy, rebuild, or replacement. Replaces the built-in trigger.
|
|
6673
|
+
*
|
|
6674
|
+
* What `warm()` does depends on the provider: `runtype` fires its prewarm
|
|
6675
|
+
* (see `provider.runtype.prewarmMode`), a `custom` provider's optional
|
|
6676
|
+
* {@link VoiceProvider.prewarm} runs, and the browser (Web Speech) path
|
|
6677
|
+
* starts the client-token session init (as `sessionInit` does), since speech
|
|
6678
|
+
* recognition itself cannot start before the click. Warming is
|
|
6679
|
+
* fire-and-forget, latched, and never surfaces an error or UI state.
|
|
6680
|
+
*
|
|
6681
|
+
* @default 'hover' in client token mode, otherwise `false`
|
|
6682
|
+
*/
|
|
6683
|
+
prewarm?: AgentWidgetVoicePrewarmTrigger | AgentWidgetVoicePrewarmHook | false;
|
|
6645
6684
|
provider?: {
|
|
6646
6685
|
type: 'browser' | 'runtype' | 'custom';
|
|
6647
6686
|
browser?: {
|
|
@@ -6663,6 +6702,23 @@ type AgentWidgetVoiceRecognitionConfig = {
|
|
|
6663
6702
|
* `@runtypelabs/persona/voice-worklet-player` for a jitter-buffered engine.
|
|
6664
6703
|
*/
|
|
6665
6704
|
createPlaybackEngine?: () => VoicePlaybackEngine | Promise<VoicePlaybackEngine>;
|
|
6705
|
+
/**
|
|
6706
|
+
* How `prewarm()` warms the voice path (see `voiceRecognition.prewarm`).
|
|
6707
|
+
*
|
|
6708
|
+
* - `'request'` (default): a fire-and-forget
|
|
6709
|
+
* `POST {host}/v1/client/agents/{agentId}/voice/prewarm`.
|
|
6710
|
+
* - `'attach'`: open the voice WebSocket ahead of the click without
|
|
6711
|
+
* starting a call; the click then starts the call on that socket. It can
|
|
6712
|
+
* create server work before the visitor clicks, so it is opt-in.
|
|
6713
|
+
* @default 'request'
|
|
6714
|
+
*/
|
|
6715
|
+
prewarmMode?: 'request' | 'attach';
|
|
6716
|
+
/**
|
|
6717
|
+
* `'attach'` mode: how long (ms) an attached socket waits for the click
|
|
6718
|
+
* before it closes. The server clamps it to 30000..600000.
|
|
6719
|
+
* @default 30000
|
|
6720
|
+
*/
|
|
6721
|
+
attachIdleMs?: number;
|
|
6666
6722
|
/** @deprecated No-op on the realtime path: the server's STT owns turn-taking. */
|
|
6667
6723
|
pauseDuration?: number;
|
|
6668
6724
|
/** @deprecated No-op on the realtime path: the server's STT owns turn-taking. */
|
|
@@ -6963,6 +7019,13 @@ interface VoiceProvider {
|
|
|
6963
7019
|
deactivateBargeIn?(): Promise<void>;
|
|
6964
7020
|
/** Stop playback / cancel in-flight request without starting recording */
|
|
6965
7021
|
stopPlayback?(): void;
|
|
7022
|
+
/**
|
|
7023
|
+
* Warm the provider ahead of `startListening()` (the widget calls it on mic
|
|
7024
|
+
* intent, see `voiceRecognition.prewarm`). Must be fire-and-forget: never
|
|
7025
|
+
* throw, emit errors or status, or acquire the microphone. May be called
|
|
7026
|
+
* repeatedly; throttle as needed.
|
|
7027
|
+
*/
|
|
7028
|
+
prewarm?(): void;
|
|
6966
7029
|
}
|
|
6967
7030
|
/**
|
|
6968
7031
|
* Extra context for an approval decision, surfaced to `onDecision` and to the
|
|
@@ -6577,6 +6577,22 @@ type AgentWidgetStatusIndicatorConfig = {
|
|
|
6577
6577
|
/** Status text while a reconnect attempt is in flight. */
|
|
6578
6578
|
resumingText?: string;
|
|
6579
6579
|
};
|
|
6580
|
+
/** Built-in `voiceRecognition.prewarm` triggers. See {@link AgentWidgetVoiceRecognitionConfig.prewarm}. */
|
|
6581
|
+
type AgentWidgetVoicePrewarmTrigger = 'hover';
|
|
6582
|
+
/**
|
|
6583
|
+
* Custom `voiceRecognition.prewarm` trigger. Runs while the composer has a mic
|
|
6584
|
+
* button, and again when the button is rebuilt or `update()` swaps in a
|
|
6585
|
+
* different function. Call `warm()` whenever the visitor shows intent to talk
|
|
6586
|
+
* (it is safe to call repeatedly). Return a cleanup to run on replacement.
|
|
6587
|
+
*/
|
|
6588
|
+
type AgentWidgetVoicePrewarmHook = (context: {
|
|
6589
|
+
/** Fire-and-forget voice warm-up; latched and error-swallowing. */
|
|
6590
|
+
warm: () => void;
|
|
6591
|
+
/** The composer's current mic button. */
|
|
6592
|
+
micButton: HTMLButtonElement;
|
|
6593
|
+
/** The widget's mount element. */
|
|
6594
|
+
mount: HTMLElement;
|
|
6595
|
+
}) => void | (() => void);
|
|
6580
6596
|
type AgentWidgetVoiceRecognitionConfig = {
|
|
6581
6597
|
/**
|
|
6582
6598
|
* Enable the mic button and voice input. The mic still only renders when the
|
|
@@ -6642,6 +6658,29 @@ type AgentWidgetVoiceRecognitionConfig = {
|
|
|
6642
6658
|
* Fires once per turn after the reply completes.
|
|
6643
6659
|
*/
|
|
6644
6660
|
onMetrics?: (metrics: VoiceMetrics) => void;
|
|
6661
|
+
/**
|
|
6662
|
+
* Warm the voice path when the visitor shows intent to talk, before the mic
|
|
6663
|
+
* click, so the call starts faster.
|
|
6664
|
+
*
|
|
6665
|
+
* - `'hover'`: when the pointer enters the mic button, it receives focus, or
|
|
6666
|
+
* (on touch) the first pointer-down on it.
|
|
6667
|
+
* - `false`: never.
|
|
6668
|
+
* - A function: custom trigger. Called with `{ warm, micButton, mount }`
|
|
6669
|
+
* while the mic button exists (and again when the button is rebuilt or
|
|
6670
|
+
* `update()` swaps in a different function); call `warm()` whenever you
|
|
6671
|
+
* decide, e.g. when the panel opens. May return a cleanup that runs on
|
|
6672
|
+
* destroy, rebuild, or replacement. Replaces the built-in trigger.
|
|
6673
|
+
*
|
|
6674
|
+
* What `warm()` does depends on the provider: `runtype` fires its prewarm
|
|
6675
|
+
* (see `provider.runtype.prewarmMode`), a `custom` provider's optional
|
|
6676
|
+
* {@link VoiceProvider.prewarm} runs, and the browser (Web Speech) path
|
|
6677
|
+
* starts the client-token session init (as `sessionInit` does), since speech
|
|
6678
|
+
* recognition itself cannot start before the click. Warming is
|
|
6679
|
+
* fire-and-forget, latched, and never surfaces an error or UI state.
|
|
6680
|
+
*
|
|
6681
|
+
* @default 'hover' in client token mode, otherwise `false`
|
|
6682
|
+
*/
|
|
6683
|
+
prewarm?: AgentWidgetVoicePrewarmTrigger | AgentWidgetVoicePrewarmHook | false;
|
|
6645
6684
|
provider?: {
|
|
6646
6685
|
type: 'browser' | 'runtype' | 'custom';
|
|
6647
6686
|
browser?: {
|
|
@@ -6663,6 +6702,23 @@ type AgentWidgetVoiceRecognitionConfig = {
|
|
|
6663
6702
|
* `@runtypelabs/persona/voice-worklet-player` for a jitter-buffered engine.
|
|
6664
6703
|
*/
|
|
6665
6704
|
createPlaybackEngine?: () => VoicePlaybackEngine | Promise<VoicePlaybackEngine>;
|
|
6705
|
+
/**
|
|
6706
|
+
* How `prewarm()` warms the voice path (see `voiceRecognition.prewarm`).
|
|
6707
|
+
*
|
|
6708
|
+
* - `'request'` (default): a fire-and-forget
|
|
6709
|
+
* `POST {host}/v1/client/agents/{agentId}/voice/prewarm`.
|
|
6710
|
+
* - `'attach'`: open the voice WebSocket ahead of the click without
|
|
6711
|
+
* starting a call; the click then starts the call on that socket. It can
|
|
6712
|
+
* create server work before the visitor clicks, so it is opt-in.
|
|
6713
|
+
* @default 'request'
|
|
6714
|
+
*/
|
|
6715
|
+
prewarmMode?: 'request' | 'attach';
|
|
6716
|
+
/**
|
|
6717
|
+
* `'attach'` mode: how long (ms) an attached socket waits for the click
|
|
6718
|
+
* before it closes. The server clamps it to 30000..600000.
|
|
6719
|
+
* @default 30000
|
|
6720
|
+
*/
|
|
6721
|
+
attachIdleMs?: number;
|
|
6666
6722
|
/** @deprecated No-op on the realtime path: the server's STT owns turn-taking. */
|
|
6667
6723
|
pauseDuration?: number;
|
|
6668
6724
|
/** @deprecated No-op on the realtime path: the server's STT owns turn-taking. */
|
|
@@ -6963,6 +7019,13 @@ interface VoiceProvider {
|
|
|
6963
7019
|
deactivateBargeIn?(): Promise<void>;
|
|
6964
7020
|
/** Stop playback / cancel in-flight request without starting recording */
|
|
6965
7021
|
stopPlayback?(): void;
|
|
7022
|
+
/**
|
|
7023
|
+
* Warm the provider ahead of `startListening()` (the widget calls it on mic
|
|
7024
|
+
* intent, see `voiceRecognition.prewarm`). Must be fire-and-forget: never
|
|
7025
|
+
* throw, emit errors or status, or acquire the microphone. May be called
|
|
7026
|
+
* repeatedly; throttle as needed.
|
|
7027
|
+
*/
|
|
7028
|
+
prewarm?(): void;
|
|
6966
7029
|
}
|
|
6967
7030
|
/**
|
|
6968
7031
|
* Extra context for an approval decision, surfaced to `onDecision` and to the
|
|
@@ -6577,6 +6577,22 @@ type AgentWidgetStatusIndicatorConfig = {
|
|
|
6577
6577
|
/** Status text while a reconnect attempt is in flight. */
|
|
6578
6578
|
resumingText?: string;
|
|
6579
6579
|
};
|
|
6580
|
+
/** Built-in `voiceRecognition.prewarm` triggers. See {@link AgentWidgetVoiceRecognitionConfig.prewarm}. */
|
|
6581
|
+
type AgentWidgetVoicePrewarmTrigger = 'hover';
|
|
6582
|
+
/**
|
|
6583
|
+
* Custom `voiceRecognition.prewarm` trigger. Runs while the composer has a mic
|
|
6584
|
+
* button, and again when the button is rebuilt or `update()` swaps in a
|
|
6585
|
+
* different function. Call `warm()` whenever the visitor shows intent to talk
|
|
6586
|
+
* (it is safe to call repeatedly). Return a cleanup to run on replacement.
|
|
6587
|
+
*/
|
|
6588
|
+
type AgentWidgetVoicePrewarmHook = (context: {
|
|
6589
|
+
/** Fire-and-forget voice warm-up; latched and error-swallowing. */
|
|
6590
|
+
warm: () => void;
|
|
6591
|
+
/** The composer's current mic button. */
|
|
6592
|
+
micButton: HTMLButtonElement;
|
|
6593
|
+
/** The widget's mount element. */
|
|
6594
|
+
mount: HTMLElement;
|
|
6595
|
+
}) => void | (() => void);
|
|
6580
6596
|
type AgentWidgetVoiceRecognitionConfig = {
|
|
6581
6597
|
/**
|
|
6582
6598
|
* Enable the mic button and voice input. The mic still only renders when the
|
|
@@ -6642,6 +6658,29 @@ type AgentWidgetVoiceRecognitionConfig = {
|
|
|
6642
6658
|
* Fires once per turn after the reply completes.
|
|
6643
6659
|
*/
|
|
6644
6660
|
onMetrics?: (metrics: VoiceMetrics) => void;
|
|
6661
|
+
/**
|
|
6662
|
+
* Warm the voice path when the visitor shows intent to talk, before the mic
|
|
6663
|
+
* click, so the call starts faster.
|
|
6664
|
+
*
|
|
6665
|
+
* - `'hover'`: when the pointer enters the mic button, it receives focus, or
|
|
6666
|
+
* (on touch) the first pointer-down on it.
|
|
6667
|
+
* - `false`: never.
|
|
6668
|
+
* - A function: custom trigger. Called with `{ warm, micButton, mount }`
|
|
6669
|
+
* while the mic button exists (and again when the button is rebuilt or
|
|
6670
|
+
* `update()` swaps in a different function); call `warm()` whenever you
|
|
6671
|
+
* decide, e.g. when the panel opens. May return a cleanup that runs on
|
|
6672
|
+
* destroy, rebuild, or replacement. Replaces the built-in trigger.
|
|
6673
|
+
*
|
|
6674
|
+
* What `warm()` does depends on the provider: `runtype` fires its prewarm
|
|
6675
|
+
* (see `provider.runtype.prewarmMode`), a `custom` provider's optional
|
|
6676
|
+
* {@link VoiceProvider.prewarm} runs, and the browser (Web Speech) path
|
|
6677
|
+
* starts the client-token session init (as `sessionInit` does), since speech
|
|
6678
|
+
* recognition itself cannot start before the click. Warming is
|
|
6679
|
+
* fire-and-forget, latched, and never surfaces an error or UI state.
|
|
6680
|
+
*
|
|
6681
|
+
* @default 'hover' in client token mode, otherwise `false`
|
|
6682
|
+
*/
|
|
6683
|
+
prewarm?: AgentWidgetVoicePrewarmTrigger | AgentWidgetVoicePrewarmHook | false;
|
|
6645
6684
|
provider?: {
|
|
6646
6685
|
type: 'browser' | 'runtype' | 'custom';
|
|
6647
6686
|
browser?: {
|
|
@@ -6663,6 +6702,23 @@ type AgentWidgetVoiceRecognitionConfig = {
|
|
|
6663
6702
|
* `@runtypelabs/persona/voice-worklet-player` for a jitter-buffered engine.
|
|
6664
6703
|
*/
|
|
6665
6704
|
createPlaybackEngine?: () => VoicePlaybackEngine | Promise<VoicePlaybackEngine>;
|
|
6705
|
+
/**
|
|
6706
|
+
* How `prewarm()` warms the voice path (see `voiceRecognition.prewarm`).
|
|
6707
|
+
*
|
|
6708
|
+
* - `'request'` (default): a fire-and-forget
|
|
6709
|
+
* `POST {host}/v1/client/agents/{agentId}/voice/prewarm`.
|
|
6710
|
+
* - `'attach'`: open the voice WebSocket ahead of the click without
|
|
6711
|
+
* starting a call; the click then starts the call on that socket. It can
|
|
6712
|
+
* create server work before the visitor clicks, so it is opt-in.
|
|
6713
|
+
* @default 'request'
|
|
6714
|
+
*/
|
|
6715
|
+
prewarmMode?: 'request' | 'attach';
|
|
6716
|
+
/**
|
|
6717
|
+
* `'attach'` mode: how long (ms) an attached socket waits for the click
|
|
6718
|
+
* before it closes. The server clamps it to 30000..600000.
|
|
6719
|
+
* @default 30000
|
|
6720
|
+
*/
|
|
6721
|
+
attachIdleMs?: number;
|
|
6666
6722
|
/** @deprecated No-op on the realtime path: the server's STT owns turn-taking. */
|
|
6667
6723
|
pauseDuration?: number;
|
|
6668
6724
|
/** @deprecated No-op on the realtime path: the server's STT owns turn-taking. */
|
|
@@ -6963,6 +7019,13 @@ interface VoiceProvider {
|
|
|
6963
7019
|
deactivateBargeIn?(): Promise<void>;
|
|
6964
7020
|
/** Stop playback / cancel in-flight request without starting recording */
|
|
6965
7021
|
stopPlayback?(): void;
|
|
7022
|
+
/**
|
|
7023
|
+
* Warm the provider ahead of `startListening()` (the widget calls it on mic
|
|
7024
|
+
* intent, see `voiceRecognition.prewarm`). Must be fire-and-forget: never
|
|
7025
|
+
* throw, emit errors or status, or acquire the microphone. May be called
|
|
7026
|
+
* repeatedly; throttle as needed.
|
|
7027
|
+
*/
|
|
7028
|
+
prewarm?(): void;
|
|
6966
7029
|
}
|
|
6967
7030
|
/**
|
|
6968
7031
|
* Extra context for an approval decision, surfaced to `onDecision` and to the
|