@runtypelabs/persona 4.25.0 → 4.26.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/animations/glyph-cycle.d.cts +1 -1
- package/dist/animations/glyph-cycle.d.ts +1 -1
- package/dist/animations/{types-Db61aI9J.d.cts → types-BwKTZhg9.d.cts} +14 -0
- package/dist/animations/{types-Db61aI9J.d.ts → types-BwKTZhg9.d.ts} +14 -0
- package/dist/animations/wipe.d.cts +1 -1
- package/dist/animations/wipe.d.ts +1 -1
- package/dist/animations-extra.d.cts +14 -0
- package/dist/animations-extra.d.ts +14 -0
- package/dist/approval-ui-QAKWNFNM.js +1 -0
- package/dist/approval-ui.cjs +2 -2
- package/dist/approval-ui.d.cts +180 -8
- package/dist/approval-ui.d.ts +180 -8
- package/dist/approval-ui.js +2 -2
- package/dist/{artifacts-ui-IGB5YKLO.js → artifacts-ui-NJGMM27I.js} +1 -1
- package/dist/artifacts-ui.cjs +4 -4
- package/dist/artifacts-ui.d.cts +180 -8
- package/dist/artifacts-ui.d.ts +180 -8
- package/dist/artifacts-ui.js +5 -5
- package/dist/chunk-2ANTRKTV.js +1 -0
- package/dist/chunk-4HPTPUC6.js +1 -0
- package/dist/chunk-6V3MNEKB.js +1 -0
- package/dist/chunk-HGUCGM3K.js +9 -0
- package/dist/chunk-IO5VVUKP.js +3 -0
- package/dist/chunk-J4J3Y2P2.js +1 -0
- package/dist/chunk-K6HKIP5K.js +1 -0
- package/dist/chunk-K7NA7G7J.js +1 -0
- package/dist/chunk-MXUTS3LB.js +1 -0
- package/dist/chunk-PDPVORUF.js +1 -0
- package/dist/chunk-QPPJUSZH.js +1 -0
- package/dist/chunk-QRKGQPU7.js +1 -0
- package/dist/chunk-S6PBWE75.js +1 -0
- package/dist/chunk-T7QM7YMF.js +1 -0
- package/dist/chunk-TR2H475E.js +1 -0
- package/dist/chunk-UPO4GUFC.js +1 -0
- package/dist/chunk-ZC66NAIR.js +1 -0
- package/dist/client-history-YPEG45Q4.js +1 -0
- package/dist/client-history.js +1 -0
- package/dist/client-stream-42FOI3EC.js +4 -0
- package/dist/client-stream.js +5 -0
- package/dist/codegen.cjs +1 -1
- package/dist/codegen.js +1 -1
- package/dist/context-mentions-E7HJYWO6.js +161 -0
- package/dist/{context-mentions-inline-I2RDEBAK.js → context-mentions-inline-QVESLW55.js} +1 -1
- package/dist/context-mentions.cjs +7 -7
- package/dist/context-mentions.d.cts +180 -8
- package/dist/context-mentions.d.ts +180 -8
- package/dist/context-mentions.js +8 -8
- package/dist/event-stream-view-FOIJHFQO.js +1 -0
- package/dist/event-stream-view.cjs +1 -1
- package/dist/event-stream-view.d.cts +183 -31
- package/dist/event-stream-view.d.ts +183 -31
- package/dist/event-stream-view.js +1 -1
- package/dist/forms-ui.d.cts +221 -667
- package/dist/forms-ui.d.ts +221 -667
- package/dist/history-shell-QDQ44PSE.js +3 -0
- package/dist/history-shell.js +3 -0
- package/dist/{history-view-BD6OXLNA.js → history-view-NCFBI5GR.js} +2 -2
- package/dist/history-view.cjs +2 -2
- package/dist/history-view.d.cts +35 -1
- package/dist/history-view.d.ts +35 -1
- package/dist/history-view.js +2 -2
- package/dist/index.cjs +80 -74
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +227 -738
- package/dist/index.d.ts +227 -738
- package/dist/index.global.js +3 -215
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +81 -75
- package/dist/index.js.map +1 -1
- package/dist/install.global.js +1 -1
- package/dist/install.global.js.map +1 -1
- package/dist/launcher.global.js +3 -67
- package/dist/launcher.global.js.map +1 -1
- package/dist/markdown-parsers.js +22 -22
- package/dist/runtype-tts-entry-NFBVWR7N.js +1 -0
- package/dist/runtype-tts.js +1 -1
- package/dist/session-actions-ISSKSI66.js +1 -0
- package/dist/session-actions.js +1 -0
- package/dist/session-reconnect.d.cts +180 -8
- package/dist/session-reconnect.d.ts +180 -8
- package/dist/smart-dom-reader.cjs +13 -13
- package/dist/smart-dom-reader.d.cts +180 -8
- package/dist/smart-dom-reader.d.ts +180 -8
- package/dist/smart-dom-reader.js +11 -11
- package/dist/theme-editor-preview.cjs +116 -98
- package/dist/theme-editor-preview.d.cts +182 -8
- package/dist/theme-editor-preview.d.ts +182 -8
- package/dist/theme-editor-preview.js +49 -54
- package/dist/theme-editor.cjs +2 -2
- package/dist/theme-editor.d.cts +181 -23
- package/dist/theme-editor.d.ts +181 -23
- package/dist/theme-editor.js +2 -2
- package/dist/theme-reference.d.cts +14 -0
- package/dist/theme-reference.d.ts +14 -0
- package/dist/ui-extras-entry-WAYFKVNW.js +3 -0
- package/dist/ui-extras.js +72 -0
- package/dist/voice-runtime-UOQOFAFY.js +17 -0
- package/dist/voice-runtime.cjs +17 -1
- package/dist/voice-runtime.d.cts +11650 -232
- package/dist/voice-runtime.d.ts +11650 -232
- package/dist/voice-runtime.js +17 -1
- package/dist/voice-worklet-player.cjs +19 -4
- package/dist/voice-worklet-player.d.cts +9 -10
- package/dist/voice-worklet-player.d.ts +9 -10
- package/dist/voice-worklet-player.js +19 -4
- package/dist/webmcp-polyfill.js +1 -1
- package/dist/webmcp-runtime-V6ZWW3PI.js +6 -0
- package/dist/webmcp-runtime.cjs +2 -2
- package/dist/webmcp-runtime.d.cts +1 -33
- package/dist/webmcp-runtime.d.ts +1 -33
- package/dist/webmcp-runtime.js +2 -2
- package/dist/widget.css +1 -1
- package/package.json +11 -5
- package/src/approval-paused-tool-settle.test.ts +221 -0
- package/src/client-approve.test.ts +311 -0
- package/src/client-history-eager.ts +9 -0
- package/src/client-history-loader.ts +23 -0
- package/src/client-history.ts +579 -0
- package/src/client-resume.ts +177 -0
- package/src/client-stream-eager.ts +12 -0
- package/src/client-stream-loader.ts +25 -0
- package/src/client-stream.ts +1880 -0
- package/src/client.test.ts +31 -1
- package/src/client.ts +293 -2607
- package/src/components/approval-actions.test.ts +27 -0
- package/src/components/approval-actions.ts +27 -3
- package/src/components/message-bubble.test.ts +19 -0
- package/src/components/message-bubble.ts +2 -0
- package/src/components/registry.ts +6 -6
- package/src/components/tool-bubble.test.ts +9 -0
- package/src/components/tool-bubble.ts +1 -0
- package/src/history-shell-bundle.test.ts +54 -0
- package/src/history-shell-eager.ts +12 -0
- package/src/history-shell-loader.ts +27 -0
- package/src/history-shell.ts +2362 -0
- package/src/history-view-loader.ts +2 -0
- package/src/history-view.ts +3 -0
- package/src/index-core.ts +6 -0
- package/src/index-global.ts +90 -248
- package/src/index.ts +13 -0
- package/src/install.ts +6 -4
- package/src/internal/runtype-history-provider.test.ts +1 -0
- package/src/internal/runtype-history-provider.ts +28 -13
- package/src/plugins/registry.ts +8 -8
- package/src/session-actions-chunk.test.ts +55 -0
- package/src/session-actions-eager.ts +11 -0
- package/src/session-actions-loader.ts +37 -0
- package/src/session-actions.ts +909 -0
- package/src/session-history.test.ts +3 -1
- package/src/session.ts +852 -1536
- package/src/session.voice.test.ts +1170 -5
- package/src/styles/widget.css +58 -0
- package/src/theme-editor/state.ts +91 -91
- package/src/types.ts +198 -5
- package/src/ui-ask-user-sheet.ts +382 -0
- package/src/ui-extras-eager.ts +10 -0
- package/src/ui-extras-entry.ts +9 -0
- package/src/ui-extras-loader.ts +26 -0
- package/src/ui.artifact-rail-resize.test.ts +2 -1
- package/src/ui.ask-user-chunk.test.ts +93 -0
- package/src/ui.history-chunk.test.ts +2 -1
- package/src/ui.history-config-provider.test.ts +2 -1
- package/src/ui.history-confirm-fallback.test.ts +142 -0
- package/src/ui.history-controller.test.ts +2 -1
- package/src/ui.history-lifecycle.test.ts +2 -1
- package/src/ui.history-render-hooks.test.ts +2 -1
- package/src/ui.history-shell.test.ts +2 -1
- package/src/ui.rail-overlay.test.ts +2 -1
- package/src/ui.rail-resize.test.ts +2 -1
- package/src/ui.rail-trigger-pending.test.ts +2 -1
- package/src/ui.ts +340 -2770
- package/src/utils/attachment-manager.ts +67 -67
- package/src/utils/constants.ts +3 -0
- package/src/utils/context-mention-controller.ts +323 -323
- package/src/utils/context-mention-manager.ts +40 -40
- package/src/utils/context-mention-orchestrator.ts +28 -0
- package/src/utils/event-stream-buffer.ts +50 -50
- package/src/utils/event-stream-store.ts +43 -43
- package/src/utils/throughput-tracker.ts +34 -34
- package/src/utils/virtual-scroller.ts +67 -67
- package/src/utils/visitor-store.test.ts +50 -0
- package/src/utils/visitor-store.ts +23 -5
- package/src/voice/__fixtures__/voice-wire/README.md +1 -0
- package/src/voice/__fixtures__/voice-wire/client/cancel.json +3 -0
- package/src/voice/__fixtures__/voice-wire/client/context.json +4 -0
- package/src/voice/__fixtures__/voice-wire/client/delegation_result.json +6 -0
- package/src/voice/__fixtures__/voice-wire/client/delegation_update.json +6 -0
- package/src/voice/__fixtures__/voice-wire/client/ping.json +3 -0
- package/src/voice/__fixtures__/voice-wire/client/playback_progress.json +5 -0
- package/src/voice/__fixtures__/voice-wire/client/start.json +3 -0
- package/src/voice/__fixtures__/voice-wire/server/artifact.json +11 -0
- package/src/voice/__fixtures__/voice-wire/server/attached.json +4 -0
- package/src/voice/__fixtures__/voice-wire/server/audio_clear.json +4 -0
- package/src/voice/__fixtures__/voice-wire/server/audio_end.json +3 -0
- package/src/voice/__fixtures__/voice-wire/server/delegation_cancelled.json +5 -0
- package/src/voice/__fixtures__/voice-wire/server/delegation_completed.json +8 -0
- package/src/voice/__fixtures__/voice-wire/server/delegation_started.json +15 -0
- package/src/voice/__fixtures__/voice-wire/server/error.json +6 -0
- package/src/voice/__fixtures__/voice-wire/server/metrics.json +10 -0
- package/src/voice/__fixtures__/voice-wire/server/pong.json +3 -0
- package/src/voice/__fixtures__/voice-wire/server/session_config.json +16 -0
- package/src/voice/__fixtures__/voice-wire/server/transcript_final.json +7 -0
- package/src/voice/__fixtures__/voice-wire/server/transcript_interim.json +4 -0
- package/src/voice/__fixtures__/voice-wire/server/transcript_partial.json +6 -0
- package/src/voice/__fixtures__/voice-wire/server/transcript_update.json +10 -0
- package/src/voice/__fixtures__/voice-wire/server/warning.json +5 -0
- package/src/voice/audio-playback-manager.test.ts +57 -0
- package/src/voice/audio-playback-manager.ts +120 -98
- package/src/voice/browser-voice-provider.ts +37 -37
- package/src/voice/fallback-speech-engine.ts +22 -16
- package/src/voice/keyed-voice-transcript.ts +314 -0
- package/src/voice/mic-state-styles.ts +182 -0
- package/src/voice/read-aloud-controller.ts +46 -44
- package/src/voice/runtype-speech-engine.ts +35 -33
- package/src/voice/runtype-voice-provider.ts +670 -189
- package/src/voice/session-voice-wiring.ts +266 -0
- package/src/voice/voice-delegation.test.ts +71 -0
- package/src/voice/voice-delegation.ts +364 -0
- package/src/voice/voice-turn-tracker.ts +6 -6
- package/src/voice/voice.test.ts +981 -8
- package/src/voice/worklet-playback-engine.test.ts +81 -0
- package/src/voice/worklet-playback-engine.ts +21 -3
- package/src/voice-runtime-loader.ts +4 -1
- package/src/voice-runtime.ts +7 -0
- package/src/webmcp-runtime-entry.ts +41 -39
- package/dist/approval-ui-3NMYNXBD.js +0 -1
- package/dist/chunk-5EIIHQLQ.js +0 -1
- package/dist/chunk-7CO4T5KB.js +0 -1
- package/dist/chunk-EFJBUH5F.js +0 -1
- package/dist/chunk-R2TMIMDI.js +0 -3
- package/dist/chunk-UTVLOTWB.js +0 -9
- package/dist/context-mentions-45MODWOY.js +0 -161
- package/dist/event-stream-view-GL3ADRY2.js +0 -1
- package/dist/runtype-tts-entry-UJAEF7NZ.js +0 -1
- package/dist/voice-runtime-7DA7MJH4.js +0 -1
- package/dist/webmcp-runtime-JI7T4QYF.js +0 -6
|
@@ -6862,6 +6862,45 @@ type AgentWidgetVoiceRecognitionConfig = {
|
|
|
6862
6862
|
* @default 30000
|
|
6863
6863
|
*/
|
|
6864
6864
|
attachIdleMs?: number;
|
|
6865
|
+
/**
|
|
6866
|
+
* Full-duplex (speech-to-speech, e.g. GPT-Live) calls: run the turns the
|
|
6867
|
+
* voice model hands off to the agent through this widget's normal chat
|
|
6868
|
+
* pipeline. The spoken request becomes the user message, and the answer
|
|
6869
|
+
* renders as a regular assistant message (streaming, tool and approval
|
|
6870
|
+
* UI, WebMCP page tools, persistence) that the voice model then reads
|
|
6871
|
+
* aloud. Only takes effect when the server supports it (it confirms in
|
|
6872
|
+
* `session_config`); otherwise the agent turn runs on the server and its
|
|
6873
|
+
* spoken reply is transcribed, as before. Set `false` to always keep the
|
|
6874
|
+
* agent turn on the server.
|
|
6875
|
+
* @default true
|
|
6876
|
+
*/
|
|
6877
|
+
clientDelegation?: boolean;
|
|
6878
|
+
/**
|
|
6879
|
+
* Full-duplex calls: extra context for the voice model (for example the
|
|
6880
|
+
* page the visitor is on), sent after the chat history as of call start.
|
|
6881
|
+
* The frame goes out once, when the visitor finishes their first
|
|
6882
|
+
* utterance (or at the first agent hand-off). A function is
|
|
6883
|
+
* called at call start and may be async. This text is capped at 4000 characters and the whole frame
|
|
6884
|
+
* (history included) at 8000. Sent only to servers that accept call
|
|
6885
|
+
* context (they announce it in `session_config`).
|
|
6886
|
+
*/
|
|
6887
|
+
callContext?: string | (() => string | Promise<string>);
|
|
6888
|
+
/**
|
|
6889
|
+
* Full-duplex calls with client delegation: how long a tool approval
|
|
6890
|
+
* that a spoken request raised may wait before it is declined as
|
|
6891
|
+
* expired (and the voice model says so). Server-side approval gates
|
|
6892
|
+
* keep their own timeout too. Hanging up never declines it: the
|
|
6893
|
+
* approval card in the chat stays usable. Capped at 540000 (9 minutes),
|
|
6894
|
+
* under the server's 10-minute delegation deadline.
|
|
6895
|
+
* @default 300000
|
|
6896
|
+
*/
|
|
6897
|
+
approvalTimeoutMs?: number;
|
|
6898
|
+
/**
|
|
6899
|
+
* Speech-to-speech calls: the one-line notice shown in the composer
|
|
6900
|
+
* status area when the call starts. `false` hides it.
|
|
6901
|
+
* @default "You're talking to an AI assistant. Voice is processed by OpenAI."
|
|
6902
|
+
*/
|
|
6903
|
+
disclosureText?: string | false;
|
|
6865
6904
|
/** @deprecated No-op on the realtime path: the server's STT owns turn-taking. */
|
|
6866
6905
|
pauseDuration?: number;
|
|
6867
6906
|
/** @deprecated No-op on the realtime path: the server's STT owns turn-taking. */
|
|
@@ -7100,6 +7139,13 @@ interface VoicePlaybackEngine {
|
|
|
7100
7139
|
onFinished(callback: () => void): void;
|
|
7101
7140
|
/** Release all audio resources. */
|
|
7102
7141
|
destroy(): Promise<void> | void;
|
|
7142
|
+
/**
|
|
7143
|
+
* Optional. Speech-to-speech calls stream reply audio with no end-of-stream
|
|
7144
|
+
* marker, so an engine that holds audio below a prebuffer waterline must, while
|
|
7145
|
+
* continuous, release that held tail on its own (e.g. after a short input gap)
|
|
7146
|
+
* instead of waiting for {@link markStreamEnd}. Engines without a prebuffer can omit it.
|
|
7147
|
+
*/
|
|
7148
|
+
setContinuousMode?(enabled: boolean): void;
|
|
7103
7149
|
}
|
|
7104
7150
|
/**
|
|
7105
7151
|
* A {@link VoicePlaybackEngine} that also supports pause/resume. Returned by
|
|
@@ -7143,14 +7189,23 @@ interface VoiceProvider {
|
|
|
7143
7189
|
* Register a callback for incremental transcript updates during a voice turn.
|
|
7144
7190
|
* `isFinal=false` is a live interim update (user partials, or assistant deltas
|
|
7145
7191
|
* on providers that stream them); `isFinal=true` finalizes that role's text.
|
|
7146
|
-
* On the realtime `runtype` path, interim updates fire for the `user`
|
|
7147
|
-
* the `assistant` arrives as a single final
|
|
7148
|
-
*
|
|
7149
|
-
*
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
|
|
7192
|
+
* On the classic realtime `runtype` path, interim updates fire for the `user`
|
|
7193
|
+
* only and the `assistant` arrives as a single final; without a turnId the
|
|
7194
|
+
* session assumes strictly alternating turns, and providers must discard
|
|
7195
|
+
* cancelled output before emitting the next user final.
|
|
7196
|
+
*
|
|
7197
|
+
* When `metadata.turnId` is present (full-duplex / speech-to-speech, e.g.
|
|
7198
|
+
* GPT-Live), the session reconciles by `(turnId, role)`: each pair owns one
|
|
7199
|
+
* bubble that later updates replace in place, turns may overlap or arrive in
|
|
7200
|
+
* any order, and no empty assistant placeholder is injected. User and
|
|
7201
|
+
* assistant may share a turnId (a late user bubble then renders above its
|
|
7202
|
+
* reply) or use distinct ones. `metadata.startMs` (call-relative ms when the
|
|
7203
|
+
* utterance began) orders a new bubble among the call's other keyed bubbles;
|
|
7204
|
+
* without it bubbles order by first arrival. After a stop, keyed providers
|
|
7205
|
+
* must drop the cancelled reply's output until the server acknowledges the
|
|
7206
|
+
* cancel: the session renders every reply it receives.
|
|
7207
|
+
*/
|
|
7208
|
+
onTranscript?(callback: (role: 'user' | 'assistant', text: string, isFinal: boolean, metadata?: VoiceTranscriptMetadata) => void): void;
|
|
7154
7209
|
/** Register a callback for per-turn latency metrics (realtime path). */
|
|
7155
7210
|
onMetrics?(callback: (metrics: VoiceMetrics) => void): void;
|
|
7156
7211
|
/**
|
|
@@ -7178,6 +7233,109 @@ interface VoiceProvider {
|
|
|
7178
7233
|
* repeatedly; throttle as needed.
|
|
7179
7234
|
*/
|
|
7180
7235
|
prewarm?(): void;
|
|
7236
|
+
/**
|
|
7237
|
+
* Called by the session once after construction with the chat-side surface
|
|
7238
|
+
* a full-duplex provider uses to hand agent turns to the chat pipeline
|
|
7239
|
+
* ({@link VoiceSessionBridge}). Providers without client delegation omit it.
|
|
7240
|
+
*/
|
|
7241
|
+
setSessionBridge?(bridge: VoiceSessionBridge): void;
|
|
7242
|
+
/** The AI-disclosure notice for the live call, if one should show (speech-to-speech). */
|
|
7243
|
+
getDisclosure?(): string | null;
|
|
7244
|
+
}
|
|
7245
|
+
/** Metadata on a {@link VoiceProvider.onTranscript} update. */
|
|
7246
|
+
type VoiceTranscriptMetadata = {
|
|
7247
|
+
/** Groups updates that belong to one utterance bubble (full duplex). */
|
|
7248
|
+
turnId?: string;
|
|
7249
|
+
/** Call-relative ms when the utterance began; orders late bubbles. */
|
|
7250
|
+
startMs?: number;
|
|
7251
|
+
/** Call-relative ms of the latest audio this update covers. */
|
|
7252
|
+
endMs?: number;
|
|
7253
|
+
/**
|
|
7254
|
+
* The bubble only captions speech (see `AgentWidgetMessage.voiceCaption`).
|
|
7255
|
+
* The chat pipeline owns the conversation, as with client delegation.
|
|
7256
|
+
*/
|
|
7257
|
+
caption?: boolean;
|
|
7258
|
+
};
|
|
7259
|
+
/** An agent turn a full-duplex voice model handed to the widget. */
|
|
7260
|
+
type VoiceDelegationRequest = {
|
|
7261
|
+
/** The voice model's delegation id (`delegation_started.delegationId`). */
|
|
7262
|
+
delegationId: string;
|
|
7263
|
+
/** What the visitor asked, as the voice model heard it. */
|
|
7264
|
+
userText: string;
|
|
7265
|
+
/**
|
|
7266
|
+
* The user transcript utterances `userText` joins, oldest first (the last
|
|
7267
|
+
* is the one it came from). May be empty.
|
|
7268
|
+
*/
|
|
7269
|
+
userUtteranceIds: string[];
|
|
7270
|
+
/** The voice model's view of the conversation it delegated from. */
|
|
7271
|
+
messages: Array<{
|
|
7272
|
+
role: string;
|
|
7273
|
+
content: unknown;
|
|
7274
|
+
}>;
|
|
7275
|
+
};
|
|
7276
|
+
/**
|
|
7277
|
+
* How a delegated turn ended, or that it waits on an approval (contract
|
|
7278
|
+
* Amendment 5). `pending_approval` is the only non-terminal status. Open:
|
|
7279
|
+
* a receiver treats an unknown terminal status as `failed`.
|
|
7280
|
+
* - `completed`: the work ran.
|
|
7281
|
+
* - `denied`: the visitor said no (Deny tap, or a spoken decline).
|
|
7282
|
+
* - `timeout`: the approval lapsed (`approvalTimeoutMs`, or the server's own timeout).
|
|
7283
|
+
* - `cancelled`: replaced by a newer request, or abandoned by the system.
|
|
7284
|
+
* - `failed`: an error.
|
|
7285
|
+
*/
|
|
7286
|
+
type VoiceDelegationStatus = 'completed' | 'pending_approval' | 'denied' | 'timeout' | 'cancelled' | 'failed' | (string & {});
|
|
7287
|
+
/** The terminal result of a turn that parked on approvals. */
|
|
7288
|
+
type VoiceDelegationFollowUp = {
|
|
7289
|
+
status: VoiceDelegationStatus;
|
|
7290
|
+
/** What to read aloud (Markdown allowed). May be empty: nothing more to say. */
|
|
7291
|
+
text: string;
|
|
7292
|
+
};
|
|
7293
|
+
/** The delegated turn's answer, sent back for the voice model to read aloud. */
|
|
7294
|
+
type VoiceDelegationResult = {
|
|
7295
|
+
/** `pending_approval` when `followUp` is set; otherwise terminal. */
|
|
7296
|
+
status: VoiceDelegationStatus;
|
|
7297
|
+
/** The assistant text (Markdown allowed). */
|
|
7298
|
+
text: string;
|
|
7299
|
+
/**
|
|
7300
|
+
* Set when the turn parked on approvals (`text` then asks for the decision).
|
|
7301
|
+
* Resolves with the terminal result once the visitor decides (or the
|
|
7302
|
+
* approval is replaced, declined by voice, or unanswered for
|
|
7303
|
+
* `approvalTimeoutMs`) and the resumed turn finishes; `null` only when
|
|
7304
|
+
* `signal` aborts first (hang-up, or the server cancelled the delegation).
|
|
7305
|
+
*/
|
|
7306
|
+
followUp?: (options: {
|
|
7307
|
+
signal: AbortSignal;
|
|
7308
|
+
approvalTimeoutMs?: number;
|
|
7309
|
+
/** `false`: run only the approval bookkeeping (expiry, supersede); nothing will be read back. @default true */
|
|
7310
|
+
readBack?: boolean;
|
|
7311
|
+
/** The resumed turn stopped on another approval: ask for it too (`text` is its approval script). */
|
|
7312
|
+
onUpdate?: (text: string) => void;
|
|
7313
|
+
}) => Promise<VoiceDelegationFollowUp | null>;
|
|
7314
|
+
};
|
|
7315
|
+
/**
|
|
7316
|
+
* Chat-side surface the session hands a full-duplex provider: the visible
|
|
7317
|
+
* history (for the call-start context) and a way to run a delegated turn
|
|
7318
|
+
* through the normal chat pipeline.
|
|
7319
|
+
*/
|
|
7320
|
+
interface VoiceSessionBridge {
|
|
7321
|
+
/** Visible user/assistant messages, oldest first. */
|
|
7322
|
+
getHistory(): Array<{
|
|
7323
|
+
role: 'user' | 'assistant';
|
|
7324
|
+
content: string;
|
|
7325
|
+
}>;
|
|
7326
|
+
/**
|
|
7327
|
+
* Submit the turn as the visitor's message (reusing its transcript bubble)
|
|
7328
|
+
* and resolve with the assistant's final answer once the turn settles.
|
|
7329
|
+
* Waits for any chat turn already in flight first. Never rejects.
|
|
7330
|
+
*/
|
|
7331
|
+
runDelegatedTurn(request: VoiceDelegationRequest): Promise<VoiceDelegationResult>;
|
|
7332
|
+
/**
|
|
7333
|
+
* The server dropped this delegation's result (cancelled it, or refused a
|
|
7334
|
+
* late result): its chat answer is no longer spoken, so browser TTS may read it.
|
|
7335
|
+
* `expired`: the server's deadline passed, so its pending approvals are
|
|
7336
|
+
* declined too, as the approval TTL would.
|
|
7337
|
+
*/
|
|
7338
|
+
dropDelegation?(delegationId: string, expired?: boolean): void;
|
|
7181
7339
|
}
|
|
7182
7340
|
/**
|
|
7183
7341
|
* Extra context for an approval decision, surfaced to `onDecision` and to the
|
|
@@ -9785,6 +9943,11 @@ type AgentWidgetToolCall = {
|
|
|
9785
9943
|
startedAt?: number;
|
|
9786
9944
|
completedAt?: number;
|
|
9787
9945
|
durationMs?: number;
|
|
9946
|
+
/**
|
|
9947
|
+
* The call paused for an approval that was granted, and the agent re-ran it
|
|
9948
|
+
* as a new tool call: that later call carries the result, this one has none.
|
|
9949
|
+
*/
|
|
9950
|
+
superseded?: boolean;
|
|
9788
9951
|
};
|
|
9789
9952
|
/**
|
|
9790
9953
|
* Represents a tool approval request in the chat conversation.
|
|
@@ -9806,6 +9969,8 @@ type AgentWidgetApproval = {
|
|
|
9806
9969
|
*/
|
|
9807
9970
|
reason?: string;
|
|
9808
9971
|
parameters?: unknown;
|
|
9972
|
+
/** The paused tool call this approval gates (`approval_start.toolCallId`). */
|
|
9973
|
+
toolCallId?: string;
|
|
9809
9974
|
resolvedAt?: number;
|
|
9810
9975
|
};
|
|
9811
9976
|
type AgentWidgetMessageVariant = "assistant" | "reasoning" | "tool" | "approval";
|
|
@@ -9905,6 +10070,13 @@ type AgentWidgetMessage = {
|
|
|
9905
10070
|
* }
|
|
9906
10071
|
*/
|
|
9907
10072
|
voiceProcessing?: boolean;
|
|
10073
|
+
/**
|
|
10074
|
+
* Display-only caption of full-duplex voice speech, such as the voice
|
|
10075
|
+
* model's own words, or something the visitor said that wasn't submitted
|
|
10076
|
+
* as a chat turn. It renders in the transcript but is never sent to the
|
|
10077
|
+
* model as conversation.
|
|
10078
|
+
*/
|
|
10079
|
+
voiceCaption?: boolean;
|
|
9908
10080
|
/**
|
|
9909
10081
|
* Raw structured payload for this message (e.g., JSON action response).
|
|
9910
10082
|
* Populated automatically when structured parsers run.
|
|
@@ -10020,6 +10192,8 @@ type InjectMessageOptions = {
|
|
|
10020
10192
|
* Consumers can detect this in `messageTransform` to render custom UI.
|
|
10021
10193
|
*/
|
|
10022
10194
|
voiceProcessing?: boolean;
|
|
10195
|
+
/** See {@link AgentWidgetMessage.voiceCaption}. */
|
|
10196
|
+
voiceCaption?: boolean;
|
|
10023
10197
|
/**
|
|
10024
10198
|
* Raw structured payload (typically a JSON string) representing the
|
|
10025
10199
|
* full directive that produced this message: e.g. `{ "text": "...",
|
|
@@ -6862,6 +6862,45 @@ type AgentWidgetVoiceRecognitionConfig = {
|
|
|
6862
6862
|
* @default 30000
|
|
6863
6863
|
*/
|
|
6864
6864
|
attachIdleMs?: number;
|
|
6865
|
+
/**
|
|
6866
|
+
* Full-duplex (speech-to-speech, e.g. GPT-Live) calls: run the turns the
|
|
6867
|
+
* voice model hands off to the agent through this widget's normal chat
|
|
6868
|
+
* pipeline. The spoken request becomes the user message, and the answer
|
|
6869
|
+
* renders as a regular assistant message (streaming, tool and approval
|
|
6870
|
+
* UI, WebMCP page tools, persistence) that the voice model then reads
|
|
6871
|
+
* aloud. Only takes effect when the server supports it (it confirms in
|
|
6872
|
+
* `session_config`); otherwise the agent turn runs on the server and its
|
|
6873
|
+
* spoken reply is transcribed, as before. Set `false` to always keep the
|
|
6874
|
+
* agent turn on the server.
|
|
6875
|
+
* @default true
|
|
6876
|
+
*/
|
|
6877
|
+
clientDelegation?: boolean;
|
|
6878
|
+
/**
|
|
6879
|
+
* Full-duplex calls: extra context for the voice model (for example the
|
|
6880
|
+
* page the visitor is on), sent after the chat history as of call start.
|
|
6881
|
+
* The frame goes out once, when the visitor finishes their first
|
|
6882
|
+
* utterance (or at the first agent hand-off). A function is
|
|
6883
|
+
* called at call start and may be async. This text is capped at 4000 characters and the whole frame
|
|
6884
|
+
* (history included) at 8000. Sent only to servers that accept call
|
|
6885
|
+
* context (they announce it in `session_config`).
|
|
6886
|
+
*/
|
|
6887
|
+
callContext?: string | (() => string | Promise<string>);
|
|
6888
|
+
/**
|
|
6889
|
+
* Full-duplex calls with client delegation: how long a tool approval
|
|
6890
|
+
* that a spoken request raised may wait before it is declined as
|
|
6891
|
+
* expired (and the voice model says so). Server-side approval gates
|
|
6892
|
+
* keep their own timeout too. Hanging up never declines it: the
|
|
6893
|
+
* approval card in the chat stays usable. Capped at 540000 (9 minutes),
|
|
6894
|
+
* under the server's 10-minute delegation deadline.
|
|
6895
|
+
* @default 300000
|
|
6896
|
+
*/
|
|
6897
|
+
approvalTimeoutMs?: number;
|
|
6898
|
+
/**
|
|
6899
|
+
* Speech-to-speech calls: the one-line notice shown in the composer
|
|
6900
|
+
* status area when the call starts. `false` hides it.
|
|
6901
|
+
* @default "You're talking to an AI assistant. Voice is processed by OpenAI."
|
|
6902
|
+
*/
|
|
6903
|
+
disclosureText?: string | false;
|
|
6865
6904
|
/** @deprecated No-op on the realtime path: the server's STT owns turn-taking. */
|
|
6866
6905
|
pauseDuration?: number;
|
|
6867
6906
|
/** @deprecated No-op on the realtime path: the server's STT owns turn-taking. */
|
|
@@ -7100,6 +7139,13 @@ interface VoicePlaybackEngine {
|
|
|
7100
7139
|
onFinished(callback: () => void): void;
|
|
7101
7140
|
/** Release all audio resources. */
|
|
7102
7141
|
destroy(): Promise<void> | void;
|
|
7142
|
+
/**
|
|
7143
|
+
* Optional. Speech-to-speech calls stream reply audio with no end-of-stream
|
|
7144
|
+
* marker, so an engine that holds audio below a prebuffer waterline must, while
|
|
7145
|
+
* continuous, release that held tail on its own (e.g. after a short input gap)
|
|
7146
|
+
* instead of waiting for {@link markStreamEnd}. Engines without a prebuffer can omit it.
|
|
7147
|
+
*/
|
|
7148
|
+
setContinuousMode?(enabled: boolean): void;
|
|
7103
7149
|
}
|
|
7104
7150
|
/**
|
|
7105
7151
|
* A {@link VoicePlaybackEngine} that also supports pause/resume. Returned by
|
|
@@ -7143,14 +7189,23 @@ interface VoiceProvider {
|
|
|
7143
7189
|
* Register a callback for incremental transcript updates during a voice turn.
|
|
7144
7190
|
* `isFinal=false` is a live interim update (user partials, or assistant deltas
|
|
7145
7191
|
* on providers that stream them); `isFinal=true` finalizes that role's text.
|
|
7146
|
-
* On the realtime `runtype` path, interim updates fire for the `user`
|
|
7147
|
-
* the `assistant` arrives as a single final
|
|
7148
|
-
*
|
|
7149
|
-
*
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
|
|
7192
|
+
* On the classic realtime `runtype` path, interim updates fire for the `user`
|
|
7193
|
+
* only and the `assistant` arrives as a single final; without a turnId the
|
|
7194
|
+
* session assumes strictly alternating turns, and providers must discard
|
|
7195
|
+
* cancelled output before emitting the next user final.
|
|
7196
|
+
*
|
|
7197
|
+
* When `metadata.turnId` is present (full-duplex / speech-to-speech, e.g.
|
|
7198
|
+
* GPT-Live), the session reconciles by `(turnId, role)`: each pair owns one
|
|
7199
|
+
* bubble that later updates replace in place, turns may overlap or arrive in
|
|
7200
|
+
* any order, and no empty assistant placeholder is injected. User and
|
|
7201
|
+
* assistant may share a turnId (a late user bubble then renders above its
|
|
7202
|
+
* reply) or use distinct ones. `metadata.startMs` (call-relative ms when the
|
|
7203
|
+
* utterance began) orders a new bubble among the call's other keyed bubbles;
|
|
7204
|
+
* without it bubbles order by first arrival. After a stop, keyed providers
|
|
7205
|
+
* must drop the cancelled reply's output until the server acknowledges the
|
|
7206
|
+
* cancel: the session renders every reply it receives.
|
|
7207
|
+
*/
|
|
7208
|
+
onTranscript?(callback: (role: 'user' | 'assistant', text: string, isFinal: boolean, metadata?: VoiceTranscriptMetadata) => void): void;
|
|
7154
7209
|
/** Register a callback for per-turn latency metrics (realtime path). */
|
|
7155
7210
|
onMetrics?(callback: (metrics: VoiceMetrics) => void): void;
|
|
7156
7211
|
/**
|
|
@@ -7178,6 +7233,109 @@ interface VoiceProvider {
|
|
|
7178
7233
|
* repeatedly; throttle as needed.
|
|
7179
7234
|
*/
|
|
7180
7235
|
prewarm?(): void;
|
|
7236
|
+
/**
|
|
7237
|
+
* Called by the session once after construction with the chat-side surface
|
|
7238
|
+
* a full-duplex provider uses to hand agent turns to the chat pipeline
|
|
7239
|
+
* ({@link VoiceSessionBridge}). Providers without client delegation omit it.
|
|
7240
|
+
*/
|
|
7241
|
+
setSessionBridge?(bridge: VoiceSessionBridge): void;
|
|
7242
|
+
/** The AI-disclosure notice for the live call, if one should show (speech-to-speech). */
|
|
7243
|
+
getDisclosure?(): string | null;
|
|
7244
|
+
}
|
|
7245
|
+
/** Metadata on a {@link VoiceProvider.onTranscript} update. */
|
|
7246
|
+
type VoiceTranscriptMetadata = {
|
|
7247
|
+
/** Groups updates that belong to one utterance bubble (full duplex). */
|
|
7248
|
+
turnId?: string;
|
|
7249
|
+
/** Call-relative ms when the utterance began; orders late bubbles. */
|
|
7250
|
+
startMs?: number;
|
|
7251
|
+
/** Call-relative ms of the latest audio this update covers. */
|
|
7252
|
+
endMs?: number;
|
|
7253
|
+
/**
|
|
7254
|
+
* The bubble only captions speech (see `AgentWidgetMessage.voiceCaption`).
|
|
7255
|
+
* The chat pipeline owns the conversation, as with client delegation.
|
|
7256
|
+
*/
|
|
7257
|
+
caption?: boolean;
|
|
7258
|
+
};
|
|
7259
|
+
/** An agent turn a full-duplex voice model handed to the widget. */
|
|
7260
|
+
type VoiceDelegationRequest = {
|
|
7261
|
+
/** The voice model's delegation id (`delegation_started.delegationId`). */
|
|
7262
|
+
delegationId: string;
|
|
7263
|
+
/** What the visitor asked, as the voice model heard it. */
|
|
7264
|
+
userText: string;
|
|
7265
|
+
/**
|
|
7266
|
+
* The user transcript utterances `userText` joins, oldest first (the last
|
|
7267
|
+
* is the one it came from). May be empty.
|
|
7268
|
+
*/
|
|
7269
|
+
userUtteranceIds: string[];
|
|
7270
|
+
/** The voice model's view of the conversation it delegated from. */
|
|
7271
|
+
messages: Array<{
|
|
7272
|
+
role: string;
|
|
7273
|
+
content: unknown;
|
|
7274
|
+
}>;
|
|
7275
|
+
};
|
|
7276
|
+
/**
|
|
7277
|
+
* How a delegated turn ended, or that it waits on an approval (contract
|
|
7278
|
+
* Amendment 5). `pending_approval` is the only non-terminal status. Open:
|
|
7279
|
+
* a receiver treats an unknown terminal status as `failed`.
|
|
7280
|
+
* - `completed`: the work ran.
|
|
7281
|
+
* - `denied`: the visitor said no (Deny tap, or a spoken decline).
|
|
7282
|
+
* - `timeout`: the approval lapsed (`approvalTimeoutMs`, or the server's own timeout).
|
|
7283
|
+
* - `cancelled`: replaced by a newer request, or abandoned by the system.
|
|
7284
|
+
* - `failed`: an error.
|
|
7285
|
+
*/
|
|
7286
|
+
type VoiceDelegationStatus = 'completed' | 'pending_approval' | 'denied' | 'timeout' | 'cancelled' | 'failed' | (string & {});
|
|
7287
|
+
/** The terminal result of a turn that parked on approvals. */
|
|
7288
|
+
type VoiceDelegationFollowUp = {
|
|
7289
|
+
status: VoiceDelegationStatus;
|
|
7290
|
+
/** What to read aloud (Markdown allowed). May be empty: nothing more to say. */
|
|
7291
|
+
text: string;
|
|
7292
|
+
};
|
|
7293
|
+
/** The delegated turn's answer, sent back for the voice model to read aloud. */
|
|
7294
|
+
type VoiceDelegationResult = {
|
|
7295
|
+
/** `pending_approval` when `followUp` is set; otherwise terminal. */
|
|
7296
|
+
status: VoiceDelegationStatus;
|
|
7297
|
+
/** The assistant text (Markdown allowed). */
|
|
7298
|
+
text: string;
|
|
7299
|
+
/**
|
|
7300
|
+
* Set when the turn parked on approvals (`text` then asks for the decision).
|
|
7301
|
+
* Resolves with the terminal result once the visitor decides (or the
|
|
7302
|
+
* approval is replaced, declined by voice, or unanswered for
|
|
7303
|
+
* `approvalTimeoutMs`) and the resumed turn finishes; `null` only when
|
|
7304
|
+
* `signal` aborts first (hang-up, or the server cancelled the delegation).
|
|
7305
|
+
*/
|
|
7306
|
+
followUp?: (options: {
|
|
7307
|
+
signal: AbortSignal;
|
|
7308
|
+
approvalTimeoutMs?: number;
|
|
7309
|
+
/** `false`: run only the approval bookkeeping (expiry, supersede); nothing will be read back. @default true */
|
|
7310
|
+
readBack?: boolean;
|
|
7311
|
+
/** The resumed turn stopped on another approval: ask for it too (`text` is its approval script). */
|
|
7312
|
+
onUpdate?: (text: string) => void;
|
|
7313
|
+
}) => Promise<VoiceDelegationFollowUp | null>;
|
|
7314
|
+
};
|
|
7315
|
+
/**
|
|
7316
|
+
* Chat-side surface the session hands a full-duplex provider: the visible
|
|
7317
|
+
* history (for the call-start context) and a way to run a delegated turn
|
|
7318
|
+
* through the normal chat pipeline.
|
|
7319
|
+
*/
|
|
7320
|
+
interface VoiceSessionBridge {
|
|
7321
|
+
/** Visible user/assistant messages, oldest first. */
|
|
7322
|
+
getHistory(): Array<{
|
|
7323
|
+
role: 'user' | 'assistant';
|
|
7324
|
+
content: string;
|
|
7325
|
+
}>;
|
|
7326
|
+
/**
|
|
7327
|
+
* Submit the turn as the visitor's message (reusing its transcript bubble)
|
|
7328
|
+
* and resolve with the assistant's final answer once the turn settles.
|
|
7329
|
+
* Waits for any chat turn already in flight first. Never rejects.
|
|
7330
|
+
*/
|
|
7331
|
+
runDelegatedTurn(request: VoiceDelegationRequest): Promise<VoiceDelegationResult>;
|
|
7332
|
+
/**
|
|
7333
|
+
* The server dropped this delegation's result (cancelled it, or refused a
|
|
7334
|
+
* late result): its chat answer is no longer spoken, so browser TTS may read it.
|
|
7335
|
+
* `expired`: the server's deadline passed, so its pending approvals are
|
|
7336
|
+
* declined too, as the approval TTL would.
|
|
7337
|
+
*/
|
|
7338
|
+
dropDelegation?(delegationId: string, expired?: boolean): void;
|
|
7181
7339
|
}
|
|
7182
7340
|
/**
|
|
7183
7341
|
* Extra context for an approval decision, surfaced to `onDecision` and to the
|
|
@@ -9785,6 +9943,11 @@ type AgentWidgetToolCall = {
|
|
|
9785
9943
|
startedAt?: number;
|
|
9786
9944
|
completedAt?: number;
|
|
9787
9945
|
durationMs?: number;
|
|
9946
|
+
/**
|
|
9947
|
+
* The call paused for an approval that was granted, and the agent re-ran it
|
|
9948
|
+
* as a new tool call: that later call carries the result, this one has none.
|
|
9949
|
+
*/
|
|
9950
|
+
superseded?: boolean;
|
|
9788
9951
|
};
|
|
9789
9952
|
/**
|
|
9790
9953
|
* Represents a tool approval request in the chat conversation.
|
|
@@ -9806,6 +9969,8 @@ type AgentWidgetApproval = {
|
|
|
9806
9969
|
*/
|
|
9807
9970
|
reason?: string;
|
|
9808
9971
|
parameters?: unknown;
|
|
9972
|
+
/** The paused tool call this approval gates (`approval_start.toolCallId`). */
|
|
9973
|
+
toolCallId?: string;
|
|
9809
9974
|
resolvedAt?: number;
|
|
9810
9975
|
};
|
|
9811
9976
|
type AgentWidgetMessageVariant = "assistant" | "reasoning" | "tool" | "approval";
|
|
@@ -9905,6 +10070,13 @@ type AgentWidgetMessage = {
|
|
|
9905
10070
|
* }
|
|
9906
10071
|
*/
|
|
9907
10072
|
voiceProcessing?: boolean;
|
|
10073
|
+
/**
|
|
10074
|
+
* Display-only caption of full-duplex voice speech, such as the voice
|
|
10075
|
+
* model's own words, or something the visitor said that wasn't submitted
|
|
10076
|
+
* as a chat turn. It renders in the transcript but is never sent to the
|
|
10077
|
+
* model as conversation.
|
|
10078
|
+
*/
|
|
10079
|
+
voiceCaption?: boolean;
|
|
9908
10080
|
/**
|
|
9909
10081
|
* Raw structured payload for this message (e.g., JSON action response).
|
|
9910
10082
|
* Populated automatically when structured parsers run.
|
|
@@ -10020,6 +10192,8 @@ type InjectMessageOptions = {
|
|
|
10020
10192
|
* Consumers can detect this in `messageTransform` to render custom UI.
|
|
10021
10193
|
*/
|
|
10022
10194
|
voiceProcessing?: boolean;
|
|
10195
|
+
/** See {@link AgentWidgetMessage.voiceCaption}. */
|
|
10196
|
+
voiceCaption?: boolean;
|
|
10023
10197
|
/**
|
|
10024
10198
|
* Raw structured payload (typically a JSON string) representing the
|
|
10025
10199
|
* full directive that produced this message: e.g. `{ "text": "...",
|