@oxvo/ai-live-assist 7.4.50 → 7.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.
Files changed (163) hide show
  1. package/cjs/AiLiveAssist.d.ts +76 -11
  2. package/cjs/AiLiveAssist.js +1771 -298
  3. package/cjs/client.d.ts +19 -0
  4. package/cjs/client.js +51 -0
  5. package/cjs/context.d.ts +23 -1
  6. package/cjs/context.js +713 -126
  7. package/cjs/control.d.ts +2 -0
  8. package/cjs/control.js +42 -3
  9. package/cjs/ctaOffer.d.ts +11 -0
  10. package/cjs/ctaOffer.js +185 -0
  11. package/cjs/dialogFocusScope.js +1 -1
  12. package/cjs/guideAdmission.d.ts +46 -0
  13. package/cjs/guideAdmission.js +397 -0
  14. package/cjs/guideHost.d.ts +47 -0
  15. package/cjs/guideHost.js +48 -0
  16. package/cjs/guideInstallation.d.ts +12 -0
  17. package/cjs/guideInstallation.js +60 -0
  18. package/cjs/guideInstaller.d.ts +4 -0
  19. package/cjs/guideInstaller.js +116 -0
  20. package/cjs/guideMount.d.ts +22 -0
  21. package/cjs/guideMount.js +84 -0
  22. package/cjs/guideRecording.d.ts +64 -0
  23. package/cjs/guideRecording.js +176 -0
  24. package/cjs/guideRecordingSession.d.ts +35 -0
  25. package/cjs/guideRecordingSession.js +167 -0
  26. package/cjs/guideSubjectStore.d.ts +32 -0
  27. package/cjs/guideSubjectStore.js +105 -0
  28. package/cjs/guideTypes.d.ts +117 -0
  29. package/cjs/guideTypes.js +15 -0
  30. package/cjs/index.d.ts +6 -0
  31. package/cjs/index.js +25 -11
  32. package/cjs/liveAudioProcessor.d.ts +92 -0
  33. package/cjs/liveAudioProcessor.js +269 -0
  34. package/cjs/liveAudioQueue.d.ts +40 -0
  35. package/cjs/liveAudioQueue.js +130 -0
  36. package/cjs/liveAudioWorklet.d.ts +1 -0
  37. package/cjs/liveAudioWorklet.js +63 -0
  38. package/cjs/liveBrowserDetector.d.ts +16 -0
  39. package/cjs/liveBrowserDetector.js +75 -0
  40. package/cjs/liveBrowserDetectorWorker.d.ts +1 -0
  41. package/cjs/liveBrowserDetectorWorker.js +72 -0
  42. package/cjs/liveControlChannel.d.ts +176 -0
  43. package/cjs/liveControlChannel.js +829 -0
  44. package/cjs/liveDuplexMedia.d.ts +204 -0
  45. package/cjs/liveDuplexMedia.js +740 -0
  46. package/cjs/liveGuideAdmission.d.ts +21 -0
  47. package/cjs/liveGuideAdmission.js +94 -0
  48. package/cjs/liveGuideWidget.d.ts +68 -0
  49. package/cjs/liveGuideWidget.js +451 -0
  50. package/cjs/liveSpeechAssets.d.ts +36 -0
  51. package/cjs/liveSpeechAssets.js +39 -0
  52. package/cjs/liveSpeechCaptureBridge.d.ts +32 -0
  53. package/cjs/liveSpeechCaptureBridge.js +140 -0
  54. package/cjs/liveSpeechDetector.d.ts +62 -0
  55. package/cjs/liveSpeechDetector.js +206 -0
  56. package/cjs/liveSpeechModel.d.ts +46 -0
  57. package/cjs/liveSpeechModel.js +105 -0
  58. package/cjs/liveSpeechResampler.d.ts +22 -0
  59. package/cjs/liveSpeechResampler.js +93 -0
  60. package/cjs/liveSpeechWorker.d.ts +56 -0
  61. package/cjs/liveSpeechWorker.js +143 -0
  62. package/cjs/locales/resources.js +568 -8
  63. package/cjs/media.d.ts +11 -0
  64. package/cjs/media.js +78 -9
  65. package/cjs/messages.js +22 -8
  66. package/cjs/pageAssistancePreference.d.ts +15 -3
  67. package/cjs/pageAssistancePreference.js +46 -7
  68. package/cjs/preview.d.ts +4 -1
  69. package/cjs/preview.js +42 -1
  70. package/cjs/recording.d.ts +12 -0
  71. package/cjs/recording.js +150 -0
  72. package/cjs/standalone.d.ts +6 -0
  73. package/cjs/standalone.js +12 -0
  74. package/cjs/types.d.ts +31 -5
  75. package/cjs/types.js +14 -0
  76. package/cjs/ui.d.ts +128 -4
  77. package/cjs/ui.js +1918 -276
  78. package/cjs/version.d.ts +1 -1
  79. package/cjs/version.js +1 -1
  80. package/cjs/voicePresenceUi.d.ts +52 -4
  81. package/cjs/voicePresenceUi.js +659 -57
  82. package/lib/AiLiveAssist.d.ts +76 -11
  83. package/lib/AiLiveAssist.js +1772 -299
  84. package/lib/client.d.ts +19 -0
  85. package/lib/client.js +51 -0
  86. package/lib/context.d.ts +23 -1
  87. package/lib/context.js +713 -126
  88. package/lib/control.d.ts +2 -0
  89. package/lib/control.js +42 -3
  90. package/lib/ctaOffer.d.ts +11 -0
  91. package/lib/ctaOffer.js +179 -0
  92. package/lib/dialogFocusScope.js +1 -1
  93. package/lib/guideAdmission.d.ts +46 -0
  94. package/lib/guideAdmission.js +392 -0
  95. package/lib/guideHost.d.ts +47 -0
  96. package/lib/guideHost.js +42 -0
  97. package/lib/guideInstallation.d.ts +12 -0
  98. package/lib/guideInstallation.js +56 -0
  99. package/lib/guideInstaller.d.ts +4 -0
  100. package/lib/guideInstaller.js +113 -0
  101. package/lib/guideMount.d.ts +22 -0
  102. package/lib/guideMount.js +77 -0
  103. package/lib/guideRecording.d.ts +64 -0
  104. package/lib/guideRecording.js +172 -0
  105. package/lib/guideRecordingSession.d.ts +35 -0
  106. package/lib/guideRecordingSession.js +163 -0
  107. package/lib/guideSubjectStore.d.ts +32 -0
  108. package/lib/guideSubjectStore.js +101 -0
  109. package/lib/guideTypes.d.ts +117 -0
  110. package/lib/guideTypes.js +11 -0
  111. package/lib/index.d.ts +6 -0
  112. package/lib/index.js +21 -10
  113. package/lib/liveAudioProcessor.d.ts +92 -0
  114. package/lib/liveAudioProcessor.js +265 -0
  115. package/lib/liveAudioQueue.d.ts +40 -0
  116. package/lib/liveAudioQueue.js +126 -0
  117. package/lib/liveAudioWorklet.d.ts +1 -0
  118. package/lib/liveAudioWorklet.js +61 -0
  119. package/lib/liveBrowserDetector.d.ts +16 -0
  120. package/lib/liveBrowserDetector.js +71 -0
  121. package/lib/liveBrowserDetectorWorker.d.ts +1 -0
  122. package/lib/liveBrowserDetectorWorker.js +70 -0
  123. package/lib/liveControlChannel.d.ts +176 -0
  124. package/lib/liveControlChannel.js +825 -0
  125. package/lib/liveDuplexMedia.d.ts +204 -0
  126. package/lib/liveDuplexMedia.js +736 -0
  127. package/lib/liveGuideAdmission.d.ts +21 -0
  128. package/lib/liveGuideAdmission.js +90 -0
  129. package/lib/liveGuideWidget.d.ts +68 -0
  130. package/lib/liveGuideWidget.js +447 -0
  131. package/lib/liveSpeechAssets.d.ts +36 -0
  132. package/lib/liveSpeechAssets.js +35 -0
  133. package/lib/liveSpeechCaptureBridge.d.ts +32 -0
  134. package/lib/liveSpeechCaptureBridge.js +136 -0
  135. package/lib/liveSpeechDetector.d.ts +62 -0
  136. package/lib/liveSpeechDetector.js +202 -0
  137. package/lib/liveSpeechModel.d.ts +46 -0
  138. package/lib/liveSpeechModel.js +101 -0
  139. package/lib/liveSpeechResampler.d.ts +22 -0
  140. package/lib/liveSpeechResampler.js +89 -0
  141. package/lib/liveSpeechWorker.d.ts +56 -0
  142. package/lib/liveSpeechWorker.js +137 -0
  143. package/lib/locales/resources.js +568 -8
  144. package/lib/media.d.ts +11 -0
  145. package/lib/media.js +77 -8
  146. package/lib/messages.js +22 -8
  147. package/lib/pageAssistancePreference.d.ts +15 -3
  148. package/lib/pageAssistancePreference.js +46 -7
  149. package/lib/preview.d.ts +4 -1
  150. package/lib/preview.js +42 -1
  151. package/lib/recording.d.ts +12 -0
  152. package/lib/recording.js +146 -0
  153. package/lib/standalone.d.ts +6 -0
  154. package/lib/standalone.js +6 -0
  155. package/lib/types.d.ts +31 -5
  156. package/lib/types.js +14 -0
  157. package/lib/ui.d.ts +128 -4
  158. package/lib/ui.js +1919 -277
  159. package/lib/version.d.ts +1 -1
  160. package/lib/version.js +1 -1
  161. package/lib/voicePresenceUi.d.ts +52 -4
  162. package/lib/voicePresenceUi.js +659 -57
  163. package/package.json +16 -1
@@ -0,0 +1,150 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createGuideOwnedRecording = createGuideOwnedRecording;
4
+ exports.installAiGuideWithRecording = installAiGuideWithRecording;
5
+ // This is a separate opt-in entry. Never import it from the recorder-free entry.
6
+ const browser_1 = require("@oxvo/browser");
7
+ const guideInstaller_js_1 = require("./guideInstaller.js");
8
+ const guideRecording_js_1 = require("./guideRecording.js");
9
+ const OWNED_KEY = Symbol.for("oxvo.ai-guide.owned-recorder.v1");
10
+ function createGuideOwnedRecording(options, identity, runtimeUrl) {
11
+ const { projectKey, ingestUrl } = options.recording;
12
+ const target = window;
13
+ const owner = {};
14
+ let owned = null;
15
+ let observer = null;
16
+ let starting = null;
17
+ let disposed = false;
18
+ let generation = 0;
19
+ let previousStatus = null;
20
+ const report = (status) => {
21
+ if (previousStatus === status)
22
+ return;
23
+ previousStatus = status;
24
+ try {
25
+ options.onRecordingStatus?.(status);
26
+ }
27
+ catch {
28
+ /* no caller error/secret logging */
29
+ }
30
+ window.dispatchEvent(new CustomEvent("oxvo:ai-guide:recording-status", {
31
+ detail: { guideId: identity.guideId, status },
32
+ }));
33
+ if (status === "unavailable")
34
+ console.warn("AI Guide session recording is unavailable. AI Guide can still be used without recording.");
35
+ };
36
+ const stopOwned = () => {
37
+ generation += 1;
38
+ if (owned?.owner === owner)
39
+ owned.recorder.stop();
40
+ };
41
+ return {
42
+ report,
43
+ start() {
44
+ if (disposed)
45
+ return Promise.reject(new Error("AI Guide recording is no longer available."));
46
+ if (starting)
47
+ return starting;
48
+ const attemptGeneration = generation;
49
+ const request = (async () => {
50
+ const endpoint = new URL(ingestUrl);
51
+ if (!/^[A-Za-z0-9_.:-]{1,256}$/.test(projectKey) ||
52
+ endpoint.protocol !== "https:" ||
53
+ endpoint.username ||
54
+ endpoint.password ||
55
+ endpoint.search ||
56
+ endpoint.hash) {
57
+ throw new Error("Invalid AI Guide recording configuration.");
58
+ }
59
+ let recorder;
60
+ const existing = target.__OXVOSESSIONS__;
61
+ const retained = target[OWNED_KEY];
62
+ if (existing) {
63
+ if (existing.options.siteKey !== projectKey ||
64
+ existing.options.networkCapture?.enabled !== false) {
65
+ throw new Error("The existing recorder is not compatible with private AI Guide recording.");
66
+ }
67
+ recorder = existing;
68
+ if (retained?.recorder === existing &&
69
+ retained.projectKey === projectKey &&
70
+ (retained.owner === null || retained.owner === owner)) {
71
+ retained.owner = owner;
72
+ owned = retained;
73
+ }
74
+ }
75
+ else {
76
+ // Browser installs network hooks in its constructor. Configure this
77
+ // privacy boundary before construction, not merely before start().
78
+ recorder = new browser_1.default({
79
+ siteKey: projectKey,
80
+ endpoint: endpoint.href.replace(/\/$/, ""),
81
+ analytics: { active: false },
82
+ networkCapture: (0, guideRecording_js_1.createGuideRecordingNetworkCapture)({
83
+ runtimeUrl,
84
+ pageUrl: window.location.href,
85
+ networkCapture: {
86
+ enabled: false,
87
+ errorsOnly: false,
88
+ captureBodies: false,
89
+ ignoreHeaders: true,
90
+ captureInIframes: false,
91
+ sessionTokenHeader: false,
92
+ },
93
+ }),
94
+ });
95
+ owned = { recorder, owner, projectKey };
96
+ target[OWNED_KEY] = owned;
97
+ }
98
+ let source = null;
99
+ recorder.use((app) => {
100
+ source = app;
101
+ });
102
+ if (!source || source.getProjectKey() !== projectKey)
103
+ throw new Error("The recording workspace is unavailable.");
104
+ observer?.dispose();
105
+ const attemptObserver = (0, guideRecording_js_1.observeGuideRecording)(source, {
106
+ projectId: identity.projectId,
107
+ });
108
+ observer = attemptObserver;
109
+ if (owned?.owner === owner && !recorder.isActive()) {
110
+ const result = await recorder.start({ startNewSession: true });
111
+ if (!result.success)
112
+ throw new Error("Session recording could not start.");
113
+ }
114
+ if (disposed || attemptGeneration !== generation) {
115
+ if (owned?.owner === owner)
116
+ recorder.stop();
117
+ attemptObserver.dispose();
118
+ if (observer === attemptObserver)
119
+ observer = null;
120
+ throw new Error("Session recording permission changed.");
121
+ }
122
+ return attemptObserver;
123
+ })().finally(() => {
124
+ if (starting === request)
125
+ starting = null;
126
+ });
127
+ starting = request;
128
+ return request;
129
+ },
130
+ stop() {
131
+ stopOwned();
132
+ observer?.dispose();
133
+ observer = null;
134
+ },
135
+ dispose() {
136
+ if (disposed)
137
+ return;
138
+ disposed = true;
139
+ stopOwned();
140
+ observer?.dispose();
141
+ observer = null;
142
+ if (owned?.owner === owner)
143
+ owned.owner = null;
144
+ },
145
+ };
146
+ }
147
+ /** Recording starts only after explicit visitor session_recording consent. */
148
+ function installAiGuideWithRecording(options) {
149
+ return (0, guideInstaller_js_1.installGuide)(options, (identity, runtimeUrl) => createGuideOwnedRecording(options, identity, runtimeUrl));
150
+ }
@@ -0,0 +1,6 @@
1
+ import type { AiGuideController, StandaloneGuideOptions } from "./guideTypes.js";
2
+ export type { AiGuideController, StandaloneGuideOptions, } from "./guideTypes.js";
3
+ export { createGuideRecordingNetworkCapture, observeGuideRecording, } from "./guideRecording.js";
4
+ export type { GuideRecordingObserver, GuideRecordingSource, GuideRecordingLink, } from "./guideRecording.js";
5
+ /** Install a Guide without importing, initializing or consulting a recorder. */
6
+ export declare function installAiGuide(options: StandaloneGuideOptions): Promise<AiGuideController | undefined>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.observeGuideRecording = exports.createGuideRecordingNetworkCapture = void 0;
4
+ exports.installAiGuide = installAiGuide;
5
+ const guideInstaller_js_1 = require("./guideInstaller.js");
6
+ var guideRecording_js_1 = require("./guideRecording.js");
7
+ Object.defineProperty(exports, "createGuideRecordingNetworkCapture", { enumerable: true, get: function () { return guideRecording_js_1.createGuideRecordingNetworkCapture; } });
8
+ Object.defineProperty(exports, "observeGuideRecording", { enumerable: true, get: function () { return guideRecording_js_1.observeGuideRecording; } });
9
+ /** Install a Guide without importing, initializing or consulting a recorder. */
10
+ function installAiGuide(options) {
11
+ return (0, guideInstaller_js_1.installGuide)(options);
12
+ }
package/cjs/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type ConsentScope = "ai_disclosure" | "text" | "microphone" | "page_context" | "browser_control" | "visual_context" | "handoff_context" | "retained_transcript" | "presentation_guidance";
1
+ export type ConsentScope = "ai_disclosure" | "text" | "microphone" | "page_context" | "browser_control" | "visual_context" | "handoff_context" | "retained_transcript" | "session_recording" | "presentation_guidance";
2
2
  export type ExperienceMode = "standard" | "voice_presence";
3
3
  export type CapabilityTier = "standard" | "reduced_motion" | "low_power" | "static";
4
4
  export type VoicePresenceConfig = {
@@ -135,8 +135,32 @@ export type AiGuidePreviewBridge = {
135
135
  };
136
136
  export type BrowserAction = "scroll" | "highlight" | "focus" | "click" | "type" | "select" | "submit";
137
137
  export type Sensitivity = "none" | "private" | "password" | "otp" | "payment" | "banking" | "recovery" | "authentication_secret" | "api_secret";
138
+ export type CtaOffer = {
139
+ offerId: string;
140
+ sourceTurnId: string;
141
+ label: string;
142
+ url: string;
143
+ openBehavior: "same_tab" | "new_tab";
144
+ configRevision: number;
145
+ expiresAt: string;
146
+ };
147
+ export type CtaResult = {
148
+ offerId: string;
149
+ outcome: "clicked" | "dismissed";
150
+ };
138
151
  export type BootstrapConfig = {
139
- schemaVersion: 1;
152
+ schemaVersion: 1 | 3;
153
+ providerProtocol?: "live";
154
+ providerModel?: "gpt-live-1";
155
+ liveCapabilities?: readonly ["live_duplex_v1", "live_local_wake_v1", "live_fragment_captions_v1"];
156
+ liveAssets?: {
157
+ baseUrl: string;
158
+ detectorWorkerUrl: string;
159
+ audioWorkletUrl: string;
160
+ };
161
+ projectId?: number;
162
+ guideId?: string;
163
+ installKey?: string;
140
164
  protocol: {
141
165
  min: number;
142
166
  max: number;
@@ -153,6 +177,7 @@ export type BootstrapConfig = {
153
177
  text: boolean;
154
178
  voice: boolean;
155
179
  captions: boolean;
180
+ ctaOffer?: boolean;
156
181
  pageContext: boolean;
157
182
  browserControl: boolean;
158
183
  pageAssistance?: boolean;
@@ -169,7 +194,8 @@ export type BootstrapConfig = {
169
194
  discoveryUrl: string;
170
195
  };
171
196
  voice?: {
172
- turnMode: "semantic_vad" | "server_vad" | "manual";
197
+ turnMode: "semantic_vad" | "server_vad" | "manual" | "live_duplex";
198
+ manualPushReadiness?: 1;
173
199
  };
174
200
  appearance?: {
175
201
  brandName: string;
@@ -245,7 +271,7 @@ export type PageAssistanceRequest = {
245
271
  persistenceEligible: boolean;
246
272
  };
247
273
  export type LaunchResult = {
248
- schemaVersion: 1 | 2;
274
+ schemaVersion: 1 | 2 | 3;
249
275
  protocolVersion: 1 | 2;
250
276
  experienceMode: ExperienceMode;
251
277
  capabilityTier: CapabilityTier;
@@ -446,7 +472,7 @@ export type PresentationTarget = {
446
472
  rect: DOMRectReadOnly;
447
473
  safe: boolean;
448
474
  };
449
- export declare const WIDGET_MESSAGE_KEYS: readonly ["launcher", "introTitle", "conversationStarters", "disclosure", "requiredConsent", "consentAgreement", "pageAssistanceTitle", "pageAssistanceAlways", "pageAssistanceAgreement", "pageAssistanceAgreementConnector", "pageAssistanceAgreementTerminator", "pageAssistanceAppliesTo", "pageAssistanceAllow", "pageAssistanceNotNow", "pageAssistanceRevoke", "legalDetails", "legalTitle", "legalClose", "termsOfService", "microphoneConsent", "pageConsent", "controlConsent", "visualConsent", "visualRequest", "shareVisual", "declineVisual", "visualShared", "visualUnavailable", "pauseVisual", "resumeVisual", "handoffConsent", "handoffContextShare", "handoffContextNotNow", "retentionConsent", "startText", "startVoice", "connecting", "listening", "thinking", "speaking", "voiceAssistantAnnouncement", "voiceUserAnnouncement", "ready", "paused", "reconnecting", "ending", "handoffEnding", "endRetry", "end", "restart", "close", "minimize", "maximize", "activeCall", "sessionDuration", "sessionControls", "movePanel", "mute", "muted", "unmute", "interrupt", "usePushToTalk", "useAutomaticTurns", "automaticTurnsUnavailable", "startSpeaking", "sendVoiceTurn", "microphoneUnavailable", "pauseActions", "resumeActions", "captionsOn", "captionsOff", "textOnly", "modeSwitch", "chatMode", "voiceMode", "stopVoice", "send", "messagePlaceholder", "requestHuman", "support", "supportReply", "viewSupport", "continueWithFullAssist", "requestHumanFallback", "approve", "decline", "actionRequest", "actionRunning", "actionVerified", "actionFailed", "actionVerificationExpired", "limitReached", "ended", "idleEnded", "feedbackQuestion", "resolved", "partiallyResolved", "notResolved", "submitFeedback", "error", "retry", "activeElsewhere", "visitorLimitReached", "visitorCooldown", "visitorAlreadyActive", "safetyBoundary", "privacyPolicy", "moreControls", "emptyConversation", "audioPaused", "humanConnected", "humanConnecting", "humanUnavailable", "textMode", "reconnectFailed", "connectedTool", "approvedService", "approvedToolEffect"];
475
+ export declare const WIDGET_MESSAGE_KEYS: readonly ["ctaDismiss", "ctaNewTab", "ctaAvailable", "ctaPreviewMessage", "launcher", "introTitle", "conversationStarters", "disclosure", "requiredConsent", "consentAgreement", "pageAssistanceTitle", "pageAssistanceAlways", "pageAssistanceAgreement", "pageAssistanceAgreementConnector", "pageAssistanceAgreementTerminator", "pageAssistanceAppliesTo", "pageAssistanceAllow", "pageAssistanceNotNow", "pageAssistanceRevoke", "legalDetails", "legalTitle", "legalClose", "termsOfService", "microphoneConsent", "pageConsent", "controlConsent", "visualConsent", "visualRequest", "shareVisual", "declineVisual", "visualShared", "visualUnavailable", "pauseVisual", "resumeVisual", "handoffConsent", "handoffContextShare", "handoffContextNotNow", "retentionConsent", "recordingConsent", "recordingConsentDescription", "startText", "startVoice", "connecting", "listening", "thinking", "speaking", "voiceAssistantAnnouncement", "voiceUserAnnouncement", "ready", "paused", "reconnecting", "ending", "handoffEnding", "endRetry", "end", "restart", "close", "minimize", "maximize", "activeCall", "sessionDuration", "sessionControls", "movePanel", "mute", "muted", "unmute", "interrupt", "usePushToTalk", "useAutomaticTurns", "automaticTurnsUnavailable", "startSpeaking", "sendVoiceTurn", "preparingMicrophone", "cancelVoiceStart", "microphoneUnavailable", "voiceUnavailable", "voiceConsentRequired", "startVoiceHint", "repeatWhenMicrophoneReady", "audioMonitoringPaused", "taskContextLimit", "pauseActions", "resumeActions", "captionsOn", "captionsOff", "textOnly", "modeSwitch", "chatMode", "voiceMode", "stopVoice", "send", "messagePlaceholder", "requestHuman", "support", "supportReply", "viewSupport", "continueWithFullAssist", "requestHumanFallback", "approve", "decline", "actionRequest", "actionRunning", "actionVerified", "actionFailed", "actionVerificationExpired", "limitReached", "ended", "idleEnded", "feedbackQuestion", "resolved", "partiallyResolved", "notResolved", "submitFeedback", "error", "retry", "activeElsewhere", "visitorLimitReached", "visitorCooldown", "visitorAlreadyActive", "safetyBoundary", "privacyPolicy", "moreControls", "emptyConversation", "audioPaused", "humanConnected", "humanConnecting", "humanUnavailable", "textMode", "reconnectFailed", "connectedTool", "approvedService", "approvedToolEffect"];
450
476
  export type WidgetMessageKey = (typeof WIDGET_MESSAGE_KEYS)[number];
451
477
  export type PluginOptions = {
452
478
  enabled?: boolean;
package/cjs/types.js CHANGED
@@ -2,6 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WIDGET_MESSAGE_KEYS = void 0;
4
4
  exports.WIDGET_MESSAGE_KEYS = [
5
+ "ctaDismiss",
6
+ "ctaNewTab",
7
+ "ctaAvailable",
8
+ "ctaPreviewMessage",
5
9
  "launcher",
6
10
  "introTitle",
7
11
  "conversationStarters",
@@ -36,6 +40,8 @@ exports.WIDGET_MESSAGE_KEYS = [
36
40
  "handoffContextShare",
37
41
  "handoffContextNotNow",
38
42
  "retentionConsent",
43
+ "recordingConsent",
44
+ "recordingConsentDescription",
39
45
  "startText",
40
46
  "startVoice",
41
47
  "connecting",
@@ -68,7 +74,15 @@ exports.WIDGET_MESSAGE_KEYS = [
68
74
  "automaticTurnsUnavailable",
69
75
  "startSpeaking",
70
76
  "sendVoiceTurn",
77
+ "preparingMicrophone",
78
+ "cancelVoiceStart",
71
79
  "microphoneUnavailable",
80
+ "voiceUnavailable",
81
+ "voiceConsentRequired",
82
+ "startVoiceHint",
83
+ "repeatWhenMicrophoneReady",
84
+ "audioMonitoringPaused",
85
+ "taskContextLimit",
72
86
  "pauseActions",
73
87
  "resumeActions",
74
88
  "captionsOn",
package/cjs/ui.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { AssistMode, BootstrapConfig, CapabilityTier, ConsentScope, HandoffContextRequest, HandoffContextStatus, PageAssistanceDecision, PageAssistanceRequest, VisualContextRequest, WidgetActivity, WidgetMessageKey } from "./types.js";
1
+ import type { AssistMode, BootstrapConfig, CapabilityTier, ConsentScope, CtaOffer, CtaResult, HandoffContextRequest, HandoffContextStatus, PageAssistanceDecision, PageAssistanceRequest, VisualContextRequest, WidgetActivity, WidgetMessageKey } from "./types.js";
2
2
  type Confirmation = {
3
3
  actionId: string;
4
4
  proposalChecksum: string;
@@ -9,6 +9,8 @@ type Confirmation = {
9
9
  expiresAt: string;
10
10
  };
11
11
  export type WidgetCallbacks = {
12
+ onRecordingConsent?: (allowed: boolean) => void;
13
+ onCtaResult?: (result: CtaResult) => boolean;
12
14
  onStart: (mode: AssistMode, scopes: ConsentScope[], initialQuestion?: string) => boolean;
13
15
  onRestart?: () => boolean;
14
16
  onEnd: () => void;
@@ -40,10 +42,16 @@ export type WidgetCallbacks = {
40
42
  };
41
43
  export type WidgetViewOptions = {
42
44
  persistentState?: boolean;
45
+ storageNamespace?: string;
43
46
  initialPanelView?: "compact" | "expanded";
47
+ preserveRawText?: boolean;
48
+ /** A protocol without manual turns must not advertise the legacy switch. */
49
+ manualTurnsSupported?: boolean;
44
50
  };
45
51
  export declare class WidgetView {
46
52
  private readonly callbacks;
53
+ private ctaCard;
54
+ private ctaSlot;
47
55
  private host;
48
56
  private shadow;
49
57
  private panel;
@@ -66,11 +74,38 @@ export declare class WidgetView {
66
74
  private audio;
67
75
  private playbackBlocked;
68
76
  private playbackResumePending;
77
+ private playbackResumeTimer;
78
+ private playbackResumeFinish;
69
79
  private playbackGeneration;
80
+ private playbackAttempt;
81
+ private destroyed;
82
+ private recordingConsent;
83
+ private mediaPlaybackActive;
84
+ private remoteAudioContext;
85
+ private remoteAudioContextStateListener;
86
+ private remoteAudioAnalyser;
87
+ private remoteAudioSilentSink;
88
+ private remoteAudioSources;
89
+ private remoteAudioAnalysisStreams;
90
+ private remoteAudioAnalysedTracks;
91
+ private remoteAudioFloatBuffer;
92
+ private remoteAudioByteBuffer;
93
+ private remoteAudioEvidenceTimer;
94
+ private remoteAudioEvidenceGeneration;
95
+ private remoteAudioEvidenceAttackWindow;
96
+ private remoteAudioEvidenceQuietSince;
97
+ private remoteAudioEvidenceAudible;
98
+ private remoteAudioEvidenceCandidateUntil;
99
+ private boundRemoteAudioStreams;
100
+ private boundRemoteAudioTracks;
101
+ private playbackStateBindings;
102
+ private remotePlaybackState;
70
103
  private muted;
104
+ private playbackInterrupted;
71
105
  private statusBeforeMute;
72
106
  private manualTurn;
73
107
  private pushActive;
108
+ private pushPending;
74
109
  private voiceActive;
75
110
  private modeTransitionPending;
76
111
  private startingVoicePresentation;
@@ -82,6 +117,7 @@ export declare class WidgetView {
82
117
  private visualPaused;
83
118
  private active;
84
119
  private endRequested;
120
+ private endingPresentationDismissed;
85
121
  private launcherSuppressed;
86
122
  private introMinimized;
87
123
  private introTransitionTarget;
@@ -101,6 +137,12 @@ export declare class WidgetView {
101
137
  private introComposing;
102
138
  private legalOpenedPanel;
103
139
  private highlightedElement;
140
+ private highlightFrame;
141
+ private highlightIntersectionKnown;
142
+ private highlightIntersectionObserver;
143
+ private highlightIntersectionRect;
144
+ private highlightResizeObserver;
145
+ private highlightScrollTargets;
104
146
  private dragState;
105
147
  private suggestionDragState;
106
148
  private suppressSuggestionClick;
@@ -119,6 +161,7 @@ export declare class WidgetView {
119
161
  private durationInterval;
120
162
  private compactCaptionTimers;
121
163
  private compactCaptionContentTimers;
164
+ private captionsPinnedToBottom;
122
165
  private captionHeightGlides;
123
166
  private captionResizeObserver;
124
167
  private introTransitionTimers;
@@ -146,22 +189,49 @@ export declare class WidgetView {
146
189
  private assistantState;
147
190
  private assistantCaptionPhase;
148
191
  private actionStateRunning;
192
+ private actionPendingAssistantCaption;
193
+ private actionPendingCompactAssistantCaption;
149
194
  private supportCompanion;
150
195
  private messages;
151
196
  private readonly messageOverrides;
152
197
  private config;
153
198
  private readonly dialogFocus;
154
199
  private readonly persistentState;
200
+ private readonly storageNamespace;
155
201
  private readonly initialPanelView;
202
+ private readonly preserveRawText;
203
+ private readonly manualTurnsSupported;
156
204
  constructor(config: BootstrapConfig, overrides: Partial<Record<WidgetMessageKey, string>>, callbacks: WidgetCallbacks, options?: WidgetViewOptions);
157
205
  setRemoteStream(stream: MediaStream): void;
206
+ private bindRemoteAudioTrackState;
207
+ private remoteAudioIsAudible;
208
+ private authorizeVoicePlayback;
158
209
  private playRemoteAudio;
210
+ private markPlaybackBlocked;
159
211
  private invalidateRemotePlayback;
160
212
  private pauseRemotePlayback;
161
213
  private resetRemotePlayback;
162
214
  private onPlaybackActivation;
163
215
  private playbackEventIsCurrent;
164
216
  private bindPlaybackState;
217
+ private unbindPlaybackState;
218
+ private ensureRemoteAudioContext;
219
+ private resumeRemoteAudioContext;
220
+ private rebuildRemoteAudioAnalyser;
221
+ private disconnectRemoteAudioAnalyser;
222
+ private remoteAudioEvidenceNow;
223
+ private remoteAudioEvidenceVisualStateIsEligible;
224
+ private remoteAudioEvidenceCandidateIsCurrent;
225
+ private updateRemoteAudioEvidenceExpectation;
226
+ private remoteAudioTrackIsPlayable;
227
+ private startRemoteAudioEvidenceSampling;
228
+ private sampleRemoteAudioEvidence;
229
+ private readRemoteAudioEvidence;
230
+ private stopRemoteAudioEvidenceSampling;
231
+ private resetRemoteAudioEvidenceAttack;
232
+ private resetRemoteAudioEvidenceState;
233
+ private resetRemoteAudioEvidence;
234
+ private applyRemotePlaybackState;
165
235
  private emitPlaybackState;
166
236
  setStatus(value: string): void;
167
237
  private applyStatus;
@@ -190,9 +260,23 @@ export declare class WidgetView {
190
260
  restoreAfterCompanionTransferFailure(restoreFocus: boolean): void;
191
261
  get isOpen(): boolean;
192
262
  rootElement(): HTMLElement;
263
+ /** Live owns this same playback element; never create a second audible sink. */
264
+ livePlaybackElement(): HTMLAudioElement;
265
+ private livePlaybackObservation;
266
+ /** Current remote PCM activity, independent of the element's continuous
267
+ * playing state. Null is unavailable evidence, never proof of silence.
268
+ * Reuses the existing analyser and never starts or authorizes playback. */
269
+ livePlaybackActivity(): boolean | null;
270
+ private liveDrainObservation;
271
+ /** Observe a stopped render sink across several audio quanta. This proves
272
+ * local playback drain only, never provider closure or acoustic echo quality. */
273
+ livePlaybackDrained(): boolean;
193
274
  get hasFocus(): boolean;
194
275
  setLauncherSuppressed(value: boolean): void;
195
276
  setAssistantState(state: "listening" | "thinking" | "speaking" | "ready"): void;
277
+ private assistantPresentationState;
278
+ private assistantPresentationMessage;
279
+ private refreshAssistantPlaybackPresentation;
196
280
  private applyAssistantState;
197
281
  private shouldHoldAssistantBusyIndicator;
198
282
  private clearAssistantReadyVisualTimer;
@@ -203,9 +287,21 @@ export declare class WidgetView {
203
287
  private ensureWelcomeSkeleton;
204
288
  private clearPendingWelcomeSkeleton;
205
289
  private scrollCaptionsToBottom;
290
+ private updateCaptionsPinnedState;
291
+ private readonly onCaptionsScroll;
292
+ private readonly onPanelWheel;
206
293
  addCaption(role: "assistant" | "user", text: string, final: boolean, options?: {
207
294
  restored?: boolean;
295
+ localQuestionId?: string;
296
+ sourceTurnId?: string;
297
+ /** Live render groups follow fragment order, including overlapping speech. */
298
+ liveFragmentGroup?: boolean;
208
299
  }): void;
300
+ showCtaOffer(value: CtaOffer, options?: {
301
+ announce?: boolean;
302
+ }): void;
303
+ clearCtaOffer(): void;
304
+ private placeCtaOffer;
209
305
  private ensurePendingCaption;
210
306
  private renderPendingDots;
211
307
  private renderLiveCaption;
@@ -226,6 +322,7 @@ export declare class WidgetView {
226
322
  private settleCompactCaptionMotion;
227
323
  showConfirmation(value: Confirmation): void;
228
324
  showActionState(status: "running" | "verified" | "failed" | "unconfirmed"): void;
325
+ private retireActionPendingCaption;
229
326
  dismissActionState(): void;
230
327
  showVisualRequest(value: VisualContextRequest): void;
231
328
  showVisualResult(shared: boolean): void;
@@ -239,6 +336,7 @@ export declare class WidgetView {
239
336
  private syncPageAssistanceFooter;
240
337
  dismissPageAssistanceRequest(): void;
241
338
  setPageAssistancePersistentAllowed(value: boolean): void;
339
+ private syncLegalDetailsAvailability;
242
340
  setSupportCompanion(linked: boolean): void;
243
341
  showSupportReplyNotice(visible: boolean): void;
244
342
  setVisualAvailable(available: boolean, paused?: boolean): void;
@@ -253,25 +351,45 @@ export declare class WidgetView {
253
351
  private requestSessionMode;
254
352
  private syncSessionModeUi;
255
353
  setManualTurn(value: boolean): void;
256
- setPushActive(value: boolean): void;
257
- interruptPlayback(): void;
354
+ setPushActive(value: boolean): boolean;
355
+ setPushPending(value: boolean): boolean;
356
+ private pushToTalkAvailable;
357
+ private releaseActivePushToTalk;
358
+ private syncPushToTalkControls;
359
+ interruptPlayback(preserveManualInput?: boolean): void;
360
+ resumeInterruptedPlayback(): void;
258
361
  private clearErrorPresentation;
259
362
  private clearEndingPresentation;
260
363
  showError(message?: string, retryable?: boolean, sessionActive?: boolean): void;
261
364
  showEndingDetached(message?: string): void;
262
365
  showEndRetry(message?: string): void;
263
- showResumeStopped(): void;
366
+ showResumeStopped(notifyOpenChange?: boolean): void;
367
+ showStartRetry(question: string, message: string, localQuestionId: string): void;
368
+ private removeLocalQuestionEcho;
264
369
  showEnded(message?: string): void;
265
370
  showLimit(message?: string): void;
266
371
  showActiveElsewhere(active: boolean): void;
267
372
  showLaunchUnavailable(message: string): void;
268
373
  updateHighlight(element: Element | null, status: "focus" | "success" | "failure"): void;
374
+ private clipsHighlightOverflow;
375
+ private highlightScrollportRect;
376
+ private composedHighlightParent;
377
+ private establishesFixedContainingBlock;
378
+ private highlightPositionEscape;
379
+ private establishesHighlightContainingBlock;
380
+ private collectHighlightScrollTargets;
381
+ private syncHighlightScrollTargets;
382
+ private unbindHighlightScrollTargets;
383
+ private clearHighlightTracking;
269
384
  safetySurfaceVisible(): boolean;
270
385
  destroy(): void;
271
386
  private build;
272
387
  private bind;
273
388
  private applyConfig;
274
389
  private applyBrandAvatar;
390
+ private recordingConsentOffered;
391
+ setRecordingConsent(allowed: boolean): void;
392
+ private renderRecordingConsent;
275
393
  private renderLegalScopes;
276
394
  private start;
277
395
  private submitIntroQuestion;
@@ -358,6 +476,7 @@ export declare class WidgetView {
358
476
  private clearPanelDestinationSurface;
359
477
  private setTransitionRect;
360
478
  private focusPanelView;
479
+ private storageKey;
361
480
  private readPanelView;
362
481
  private readPanelVisibility;
363
482
  private writePanelVisibility;
@@ -400,6 +519,11 @@ export declare class WidgetView {
400
519
  private onTooltipFocusOut;
401
520
  private closeControlsMenu;
402
521
  private onDocumentPointerDown;
522
+ private onHighlightIntersection;
523
+ private rearmHighlightIntersection;
524
+ private scheduleHighlightGeometryRefresh;
525
+ private onHighlightViewportGeometryChange;
526
+ private scheduleHighlightRefresh;
403
527
  private refreshHighlight;
404
528
  private onResize;
405
529
  private onDragStart;