@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.
- package/cjs/AiLiveAssist.d.ts +76 -11
- package/cjs/AiLiveAssist.js +1771 -298
- package/cjs/client.d.ts +19 -0
- package/cjs/client.js +51 -0
- package/cjs/context.d.ts +23 -1
- package/cjs/context.js +713 -126
- package/cjs/control.d.ts +2 -0
- package/cjs/control.js +42 -3
- package/cjs/ctaOffer.d.ts +11 -0
- package/cjs/ctaOffer.js +185 -0
- package/cjs/dialogFocusScope.js +1 -1
- package/cjs/guideAdmission.d.ts +46 -0
- package/cjs/guideAdmission.js +397 -0
- package/cjs/guideHost.d.ts +47 -0
- package/cjs/guideHost.js +48 -0
- package/cjs/guideInstallation.d.ts +12 -0
- package/cjs/guideInstallation.js +60 -0
- package/cjs/guideInstaller.d.ts +4 -0
- package/cjs/guideInstaller.js +116 -0
- package/cjs/guideMount.d.ts +22 -0
- package/cjs/guideMount.js +84 -0
- package/cjs/guideRecording.d.ts +64 -0
- package/cjs/guideRecording.js +176 -0
- package/cjs/guideRecordingSession.d.ts +35 -0
- package/cjs/guideRecordingSession.js +167 -0
- package/cjs/guideSubjectStore.d.ts +32 -0
- package/cjs/guideSubjectStore.js +105 -0
- package/cjs/guideTypes.d.ts +117 -0
- package/cjs/guideTypes.js +15 -0
- package/cjs/index.d.ts +6 -0
- package/cjs/index.js +25 -11
- package/cjs/liveAudioProcessor.d.ts +92 -0
- package/cjs/liveAudioProcessor.js +269 -0
- package/cjs/liveAudioQueue.d.ts +40 -0
- package/cjs/liveAudioQueue.js +130 -0
- package/cjs/liveAudioWorklet.d.ts +1 -0
- package/cjs/liveAudioWorklet.js +63 -0
- package/cjs/liveBrowserDetector.d.ts +16 -0
- package/cjs/liveBrowserDetector.js +75 -0
- package/cjs/liveBrowserDetectorWorker.d.ts +1 -0
- package/cjs/liveBrowserDetectorWorker.js +72 -0
- package/cjs/liveControlChannel.d.ts +176 -0
- package/cjs/liveControlChannel.js +829 -0
- package/cjs/liveDuplexMedia.d.ts +204 -0
- package/cjs/liveDuplexMedia.js +740 -0
- package/cjs/liveGuideAdmission.d.ts +21 -0
- package/cjs/liveGuideAdmission.js +94 -0
- package/cjs/liveGuideWidget.d.ts +68 -0
- package/cjs/liveGuideWidget.js +451 -0
- package/cjs/liveSpeechAssets.d.ts +36 -0
- package/cjs/liveSpeechAssets.js +39 -0
- package/cjs/liveSpeechCaptureBridge.d.ts +32 -0
- package/cjs/liveSpeechCaptureBridge.js +140 -0
- package/cjs/liveSpeechDetector.d.ts +62 -0
- package/cjs/liveSpeechDetector.js +206 -0
- package/cjs/liveSpeechModel.d.ts +46 -0
- package/cjs/liveSpeechModel.js +105 -0
- package/cjs/liveSpeechResampler.d.ts +22 -0
- package/cjs/liveSpeechResampler.js +93 -0
- package/cjs/liveSpeechWorker.d.ts +56 -0
- package/cjs/liveSpeechWorker.js +143 -0
- package/cjs/locales/resources.js +568 -8
- package/cjs/media.d.ts +11 -0
- package/cjs/media.js +78 -9
- package/cjs/messages.js +22 -8
- package/cjs/pageAssistancePreference.d.ts +15 -3
- package/cjs/pageAssistancePreference.js +46 -7
- package/cjs/preview.d.ts +4 -1
- package/cjs/preview.js +42 -1
- package/cjs/recording.d.ts +12 -0
- package/cjs/recording.js +150 -0
- package/cjs/standalone.d.ts +6 -0
- package/cjs/standalone.js +12 -0
- package/cjs/types.d.ts +31 -5
- package/cjs/types.js +14 -0
- package/cjs/ui.d.ts +128 -4
- package/cjs/ui.js +1918 -276
- package/cjs/version.d.ts +1 -1
- package/cjs/version.js +1 -1
- package/cjs/voicePresenceUi.d.ts +52 -4
- package/cjs/voicePresenceUi.js +659 -57
- package/lib/AiLiveAssist.d.ts +76 -11
- package/lib/AiLiveAssist.js +1772 -299
- package/lib/client.d.ts +19 -0
- package/lib/client.js +51 -0
- package/lib/context.d.ts +23 -1
- package/lib/context.js +713 -126
- package/lib/control.d.ts +2 -0
- package/lib/control.js +42 -3
- package/lib/ctaOffer.d.ts +11 -0
- package/lib/ctaOffer.js +179 -0
- package/lib/dialogFocusScope.js +1 -1
- package/lib/guideAdmission.d.ts +46 -0
- package/lib/guideAdmission.js +392 -0
- package/lib/guideHost.d.ts +47 -0
- package/lib/guideHost.js +42 -0
- package/lib/guideInstallation.d.ts +12 -0
- package/lib/guideInstallation.js +56 -0
- package/lib/guideInstaller.d.ts +4 -0
- package/lib/guideInstaller.js +113 -0
- package/lib/guideMount.d.ts +22 -0
- package/lib/guideMount.js +77 -0
- package/lib/guideRecording.d.ts +64 -0
- package/lib/guideRecording.js +172 -0
- package/lib/guideRecordingSession.d.ts +35 -0
- package/lib/guideRecordingSession.js +163 -0
- package/lib/guideSubjectStore.d.ts +32 -0
- package/lib/guideSubjectStore.js +101 -0
- package/lib/guideTypes.d.ts +117 -0
- package/lib/guideTypes.js +11 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.js +21 -10
- package/lib/liveAudioProcessor.d.ts +92 -0
- package/lib/liveAudioProcessor.js +265 -0
- package/lib/liveAudioQueue.d.ts +40 -0
- package/lib/liveAudioQueue.js +126 -0
- package/lib/liveAudioWorklet.d.ts +1 -0
- package/lib/liveAudioWorklet.js +61 -0
- package/lib/liveBrowserDetector.d.ts +16 -0
- package/lib/liveBrowserDetector.js +71 -0
- package/lib/liveBrowserDetectorWorker.d.ts +1 -0
- package/lib/liveBrowserDetectorWorker.js +70 -0
- package/lib/liveControlChannel.d.ts +176 -0
- package/lib/liveControlChannel.js +825 -0
- package/lib/liveDuplexMedia.d.ts +204 -0
- package/lib/liveDuplexMedia.js +736 -0
- package/lib/liveGuideAdmission.d.ts +21 -0
- package/lib/liveGuideAdmission.js +90 -0
- package/lib/liveGuideWidget.d.ts +68 -0
- package/lib/liveGuideWidget.js +447 -0
- package/lib/liveSpeechAssets.d.ts +36 -0
- package/lib/liveSpeechAssets.js +35 -0
- package/lib/liveSpeechCaptureBridge.d.ts +32 -0
- package/lib/liveSpeechCaptureBridge.js +136 -0
- package/lib/liveSpeechDetector.d.ts +62 -0
- package/lib/liveSpeechDetector.js +202 -0
- package/lib/liveSpeechModel.d.ts +46 -0
- package/lib/liveSpeechModel.js +101 -0
- package/lib/liveSpeechResampler.d.ts +22 -0
- package/lib/liveSpeechResampler.js +89 -0
- package/lib/liveSpeechWorker.d.ts +56 -0
- package/lib/liveSpeechWorker.js +137 -0
- package/lib/locales/resources.js +568 -8
- package/lib/media.d.ts +11 -0
- package/lib/media.js +77 -8
- package/lib/messages.js +22 -8
- package/lib/pageAssistancePreference.d.ts +15 -3
- package/lib/pageAssistancePreference.js +46 -7
- package/lib/preview.d.ts +4 -1
- package/lib/preview.js +42 -1
- package/lib/recording.d.ts +12 -0
- package/lib/recording.js +146 -0
- package/lib/standalone.d.ts +6 -0
- package/lib/standalone.js +6 -0
- package/lib/types.d.ts +31 -5
- package/lib/types.js +14 -0
- package/lib/ui.d.ts +128 -4
- package/lib/ui.js +1919 -277
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/voicePresenceUi.d.ts +52 -4
- package/lib/voicePresenceUi.js +659 -57
- package/package.json +16 -1
package/lib/recording.js
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
// This is a separate opt-in entry. Never import it from the recorder-free entry.
|
|
2
|
+
import Browser from "@oxvo/browser";
|
|
3
|
+
import { installGuide } from "./guideInstaller.js";
|
|
4
|
+
import { createGuideRecordingNetworkCapture, observeGuideRecording, } from "./guideRecording.js";
|
|
5
|
+
const OWNED_KEY = Symbol.for("oxvo.ai-guide.owned-recorder.v1");
|
|
6
|
+
export function createGuideOwnedRecording(options, identity, runtimeUrl) {
|
|
7
|
+
const { projectKey, ingestUrl } = options.recording;
|
|
8
|
+
const target = window;
|
|
9
|
+
const owner = {};
|
|
10
|
+
let owned = null;
|
|
11
|
+
let observer = null;
|
|
12
|
+
let starting = null;
|
|
13
|
+
let disposed = false;
|
|
14
|
+
let generation = 0;
|
|
15
|
+
let previousStatus = null;
|
|
16
|
+
const report = (status) => {
|
|
17
|
+
if (previousStatus === status)
|
|
18
|
+
return;
|
|
19
|
+
previousStatus = status;
|
|
20
|
+
try {
|
|
21
|
+
options.onRecordingStatus?.(status);
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
/* no caller error/secret logging */
|
|
25
|
+
}
|
|
26
|
+
window.dispatchEvent(new CustomEvent("oxvo:ai-guide:recording-status", {
|
|
27
|
+
detail: { guideId: identity.guideId, status },
|
|
28
|
+
}));
|
|
29
|
+
if (status === "unavailable")
|
|
30
|
+
console.warn("AI Guide session recording is unavailable. AI Guide can still be used without recording.");
|
|
31
|
+
};
|
|
32
|
+
const stopOwned = () => {
|
|
33
|
+
generation += 1;
|
|
34
|
+
if (owned?.owner === owner)
|
|
35
|
+
owned.recorder.stop();
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
report,
|
|
39
|
+
start() {
|
|
40
|
+
if (disposed)
|
|
41
|
+
return Promise.reject(new Error("AI Guide recording is no longer available."));
|
|
42
|
+
if (starting)
|
|
43
|
+
return starting;
|
|
44
|
+
const attemptGeneration = generation;
|
|
45
|
+
const request = (async () => {
|
|
46
|
+
const endpoint = new URL(ingestUrl);
|
|
47
|
+
if (!/^[A-Za-z0-9_.:-]{1,256}$/.test(projectKey) ||
|
|
48
|
+
endpoint.protocol !== "https:" ||
|
|
49
|
+
endpoint.username ||
|
|
50
|
+
endpoint.password ||
|
|
51
|
+
endpoint.search ||
|
|
52
|
+
endpoint.hash) {
|
|
53
|
+
throw new Error("Invalid AI Guide recording configuration.");
|
|
54
|
+
}
|
|
55
|
+
let recorder;
|
|
56
|
+
const existing = target.__OXVOSESSIONS__;
|
|
57
|
+
const retained = target[OWNED_KEY];
|
|
58
|
+
if (existing) {
|
|
59
|
+
if (existing.options.siteKey !== projectKey ||
|
|
60
|
+
existing.options.networkCapture?.enabled !== false) {
|
|
61
|
+
throw new Error("The existing recorder is not compatible with private AI Guide recording.");
|
|
62
|
+
}
|
|
63
|
+
recorder = existing;
|
|
64
|
+
if (retained?.recorder === existing &&
|
|
65
|
+
retained.projectKey === projectKey &&
|
|
66
|
+
(retained.owner === null || retained.owner === owner)) {
|
|
67
|
+
retained.owner = owner;
|
|
68
|
+
owned = retained;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
// Browser installs network hooks in its constructor. Configure this
|
|
73
|
+
// privacy boundary before construction, not merely before start().
|
|
74
|
+
recorder = new Browser({
|
|
75
|
+
siteKey: projectKey,
|
|
76
|
+
endpoint: endpoint.href.replace(/\/$/, ""),
|
|
77
|
+
analytics: { active: false },
|
|
78
|
+
networkCapture: createGuideRecordingNetworkCapture({
|
|
79
|
+
runtimeUrl,
|
|
80
|
+
pageUrl: window.location.href,
|
|
81
|
+
networkCapture: {
|
|
82
|
+
enabled: false,
|
|
83
|
+
errorsOnly: false,
|
|
84
|
+
captureBodies: false,
|
|
85
|
+
ignoreHeaders: true,
|
|
86
|
+
captureInIframes: false,
|
|
87
|
+
sessionTokenHeader: false,
|
|
88
|
+
},
|
|
89
|
+
}),
|
|
90
|
+
});
|
|
91
|
+
owned = { recorder, owner, projectKey };
|
|
92
|
+
target[OWNED_KEY] = owned;
|
|
93
|
+
}
|
|
94
|
+
let source = null;
|
|
95
|
+
recorder.use((app) => {
|
|
96
|
+
source = app;
|
|
97
|
+
});
|
|
98
|
+
if (!source || source.getProjectKey() !== projectKey)
|
|
99
|
+
throw new Error("The recording workspace is unavailable.");
|
|
100
|
+
observer?.dispose();
|
|
101
|
+
const attemptObserver = observeGuideRecording(source, {
|
|
102
|
+
projectId: identity.projectId,
|
|
103
|
+
});
|
|
104
|
+
observer = attemptObserver;
|
|
105
|
+
if (owned?.owner === owner && !recorder.isActive()) {
|
|
106
|
+
const result = await recorder.start({ startNewSession: true });
|
|
107
|
+
if (!result.success)
|
|
108
|
+
throw new Error("Session recording could not start.");
|
|
109
|
+
}
|
|
110
|
+
if (disposed || attemptGeneration !== generation) {
|
|
111
|
+
if (owned?.owner === owner)
|
|
112
|
+
recorder.stop();
|
|
113
|
+
attemptObserver.dispose();
|
|
114
|
+
if (observer === attemptObserver)
|
|
115
|
+
observer = null;
|
|
116
|
+
throw new Error("Session recording permission changed.");
|
|
117
|
+
}
|
|
118
|
+
return attemptObserver;
|
|
119
|
+
})().finally(() => {
|
|
120
|
+
if (starting === request)
|
|
121
|
+
starting = null;
|
|
122
|
+
});
|
|
123
|
+
starting = request;
|
|
124
|
+
return request;
|
|
125
|
+
},
|
|
126
|
+
stop() {
|
|
127
|
+
stopOwned();
|
|
128
|
+
observer?.dispose();
|
|
129
|
+
observer = null;
|
|
130
|
+
},
|
|
131
|
+
dispose() {
|
|
132
|
+
if (disposed)
|
|
133
|
+
return;
|
|
134
|
+
disposed = true;
|
|
135
|
+
stopOwned();
|
|
136
|
+
observer?.dispose();
|
|
137
|
+
observer = null;
|
|
138
|
+
if (owned?.owner === owner)
|
|
139
|
+
owned.owner = null;
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/** Recording starts only after explicit visitor session_recording consent. */
|
|
144
|
+
export function installAiGuideWithRecording(options) {
|
|
145
|
+
return installGuide(options, (identity, runtimeUrl) => createGuideOwnedRecording(options, identity, runtimeUrl));
|
|
146
|
+
}
|
|
@@ -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,6 @@
|
|
|
1
|
+
import { installGuide } from "./guideInstaller.js";
|
|
2
|
+
export { createGuideRecordingNetworkCapture, observeGuideRecording, } from "./guideRecording.js";
|
|
3
|
+
/** Install a Guide without importing, initializing or consulting a recorder. */
|
|
4
|
+
export function installAiGuide(options) {
|
|
5
|
+
return installGuide(options);
|
|
6
|
+
}
|
package/lib/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/lib/types.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export const WIDGET_MESSAGE_KEYS = [
|
|
2
|
+
"ctaDismiss",
|
|
3
|
+
"ctaNewTab",
|
|
4
|
+
"ctaAvailable",
|
|
5
|
+
"ctaPreviewMessage",
|
|
2
6
|
"launcher",
|
|
3
7
|
"introTitle",
|
|
4
8
|
"conversationStarters",
|
|
@@ -33,6 +37,8 @@ export const WIDGET_MESSAGE_KEYS = [
|
|
|
33
37
|
"handoffContextShare",
|
|
34
38
|
"handoffContextNotNow",
|
|
35
39
|
"retentionConsent",
|
|
40
|
+
"recordingConsent",
|
|
41
|
+
"recordingConsentDescription",
|
|
36
42
|
"startText",
|
|
37
43
|
"startVoice",
|
|
38
44
|
"connecting",
|
|
@@ -65,7 +71,15 @@ export const WIDGET_MESSAGE_KEYS = [
|
|
|
65
71
|
"automaticTurnsUnavailable",
|
|
66
72
|
"startSpeaking",
|
|
67
73
|
"sendVoiceTurn",
|
|
74
|
+
"preparingMicrophone",
|
|
75
|
+
"cancelVoiceStart",
|
|
68
76
|
"microphoneUnavailable",
|
|
77
|
+
"voiceUnavailable",
|
|
78
|
+
"voiceConsentRequired",
|
|
79
|
+
"startVoiceHint",
|
|
80
|
+
"repeatWhenMicrophoneReady",
|
|
81
|
+
"audioMonitoringPaused",
|
|
82
|
+
"taskContextLimit",
|
|
69
83
|
"pauseActions",
|
|
70
84
|
"resumeActions",
|
|
71
85
|
"captionsOn",
|
package/lib/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):
|
|
257
|
-
|
|
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;
|