@oxvo/ai-live-assist 7.3.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/LICENSE +21 -0
- package/README.md +17 -0
- package/cjs/AiLiveAssist.d.ts +108 -0
- package/cjs/AiLiveAssist.js +1774 -0
- package/cjs/client.d.ts +53 -0
- package/cjs/client.js +193 -0
- package/cjs/context.d.ts +58 -0
- package/cjs/context.js +979 -0
- package/cjs/control.d.ts +31 -0
- package/cjs/control.js +190 -0
- package/cjs/experienceState.d.ts +18 -0
- package/cjs/experienceState.js +82 -0
- package/cjs/index.d.ts +13 -0
- package/cjs/index.js +32 -0
- package/cjs/media.d.ts +34 -0
- package/cjs/media.js +207 -0
- package/cjs/messages.d.ts +2 -0
- package/cjs/messages.js +95 -0
- package/cjs/package.json +1 -0
- package/cjs/placement.d.ts +52 -0
- package/cjs/placement.js +293 -0
- package/cjs/presentation.d.ts +41 -0
- package/cjs/presentation.js +483 -0
- package/cjs/recordingPolicy.d.ts +2 -0
- package/cjs/recordingPolicy.js +12 -0
- package/cjs/safeSvg.d.ts +1 -0
- package/cjs/safeSvg.js +157 -0
- package/cjs/tabLock.d.ts +31 -0
- package/cjs/tabLock.js +260 -0
- package/cjs/types.d.ts +299 -0
- package/cjs/types.js +2 -0
- package/cjs/ui.d.ts +184 -0
- package/cjs/ui.js +2353 -0
- package/cjs/version.d.ts +1 -0
- package/cjs/version.js +4 -0
- package/cjs/visualContext.d.ts +21 -0
- package/cjs/visualContext.js +72 -0
- package/cjs/voicePresenceUi.d.ts +148 -0
- package/cjs/voicePresenceUi.js +2182 -0
- package/lib/AiLiveAssist.d.ts +108 -0
- package/lib/AiLiveAssist.js +1769 -0
- package/lib/client.d.ts +53 -0
- package/lib/client.js +187 -0
- package/lib/context.d.ts +58 -0
- package/lib/context.js +975 -0
- package/lib/control.d.ts +31 -0
- package/lib/control.js +186 -0
- package/lib/experienceState.d.ts +18 -0
- package/lib/experienceState.js +78 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.js +26 -0
- package/lib/media.d.ts +34 -0
- package/lib/media.js +203 -0
- package/lib/messages.d.ts +2 -0
- package/lib/messages.js +92 -0
- package/lib/placement.d.ts +52 -0
- package/lib/placement.js +286 -0
- package/lib/presentation.d.ts +41 -0
- package/lib/presentation.js +478 -0
- package/lib/recordingPolicy.d.ts +2 -0
- package/lib/recordingPolicy.js +8 -0
- package/lib/safeSvg.d.ts +1 -0
- package/lib/safeSvg.js +153 -0
- package/lib/tabLock.d.ts +31 -0
- package/lib/tabLock.js +256 -0
- package/lib/types.d.ts +299 -0
- package/lib/types.js +1 -0
- package/lib/ui.d.ts +184 -0
- package/lib/ui.js +2349 -0
- package/lib/version.d.ts +1 -0
- package/lib/version.js +1 -0
- package/lib/visualContext.d.ts +21 -0
- package/lib/visualContext.js +68 -0
- package/lib/voicePresenceUi.d.ts +148 -0
- package/lib/voicePresenceUi.js +2178 -0
- package/package.json +58 -0
package/cjs/tabLock.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare class TabActivityLock {
|
|
2
|
+
private readonly ownerId;
|
|
3
|
+
private readonly onOtherTabChange;
|
|
4
|
+
private readonly onTakeoverRequest;
|
|
5
|
+
private readonly onHandoff;
|
|
6
|
+
private readonly key;
|
|
7
|
+
private readonly channel;
|
|
8
|
+
private refreshTimer;
|
|
9
|
+
private takeoverRetryTimer;
|
|
10
|
+
private owned;
|
|
11
|
+
private takeoverRequestId;
|
|
12
|
+
private takeoverOwnerId;
|
|
13
|
+
private takeoverAttempts;
|
|
14
|
+
constructor(siteKey: string, ownerId: string, onOtherTabChange: (active: boolean) => void, onTakeoverRequest?: (requesterId: string, requestId: string) => void, onHandoff?: (payload: unknown) => void);
|
|
15
|
+
acquire(): boolean;
|
|
16
|
+
requestTakeover(): boolean;
|
|
17
|
+
handoff(requesterId: string, requestId: string, payload: unknown): boolean;
|
|
18
|
+
isOwnedByOther(): boolean;
|
|
19
|
+
release(): void;
|
|
20
|
+
destroy(): void;
|
|
21
|
+
private read;
|
|
22
|
+
private writeOwner;
|
|
23
|
+
private startRefresh;
|
|
24
|
+
private stopRefresh;
|
|
25
|
+
private reportOtherTab;
|
|
26
|
+
private sendTakeoverRequest;
|
|
27
|
+
private clearTakeoverRequest;
|
|
28
|
+
private expireIncompleteHandoff;
|
|
29
|
+
private onStorage;
|
|
30
|
+
private onMessage;
|
|
31
|
+
}
|
package/cjs/tabLock.js
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TabActivityLock = void 0;
|
|
4
|
+
const validId = (value) => typeof value === 'string' && /^[A-Za-z0-9_.:-]{8,128}$/.test(value);
|
|
5
|
+
const parse = (value) => {
|
|
6
|
+
if (!value)
|
|
7
|
+
return null;
|
|
8
|
+
try {
|
|
9
|
+
const record = JSON.parse(value);
|
|
10
|
+
const ownerId = validId(record.ownerId)
|
|
11
|
+
? record.ownerId
|
|
12
|
+
: validId(record.tabId)
|
|
13
|
+
? record.tabId
|
|
14
|
+
: null;
|
|
15
|
+
return ownerId &&
|
|
16
|
+
typeof record.expiresAt === 'number' &&
|
|
17
|
+
Number.isFinite(record.expiresAt)
|
|
18
|
+
? { ownerId, expiresAt: record.expiresAt }
|
|
19
|
+
: null;
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
class TabActivityLock {
|
|
26
|
+
constructor(siteKey, ownerId, onOtherTabChange, onTakeoverRequest = () => undefined, onHandoff = () => undefined) {
|
|
27
|
+
this.ownerId = ownerId;
|
|
28
|
+
this.onOtherTabChange = onOtherTabChange;
|
|
29
|
+
this.onTakeoverRequest = onTakeoverRequest;
|
|
30
|
+
this.onHandoff = onHandoff;
|
|
31
|
+
this.refreshTimer = null;
|
|
32
|
+
this.takeoverRetryTimer = null;
|
|
33
|
+
this.owned = false;
|
|
34
|
+
this.takeoverRequestId = null;
|
|
35
|
+
this.takeoverOwnerId = null;
|
|
36
|
+
this.takeoverAttempts = 0;
|
|
37
|
+
this.onStorage = (event) => {
|
|
38
|
+
if (event.key !== this.key)
|
|
39
|
+
return;
|
|
40
|
+
if (this.takeoverRequestId &&
|
|
41
|
+
!this.owned &&
|
|
42
|
+
this.read()?.ownerId === this.ownerId) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
this.reportOtherTab();
|
|
46
|
+
};
|
|
47
|
+
this.onMessage = (event) => {
|
|
48
|
+
const value = event.data;
|
|
49
|
+
if (value.type === 'active' && value.ownerId !== this.ownerId) {
|
|
50
|
+
this.onOtherTabChange(true);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (value.type === 'ended') {
|
|
54
|
+
this.reportOtherTab();
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (value.type === 'takeover-request' &&
|
|
58
|
+
value.ownerId === this.ownerId &&
|
|
59
|
+
validId(value.requesterId) &&
|
|
60
|
+
validId(value.requestId) &&
|
|
61
|
+
this.owned) {
|
|
62
|
+
this.onTakeoverRequest(value.requesterId, value.requestId);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (value.type === 'handoff' &&
|
|
66
|
+
value.ownerId === this.ownerId &&
|
|
67
|
+
value.requesterId === this.ownerId &&
|
|
68
|
+
validId(value.requestId) &&
|
|
69
|
+
value.requestId === this.takeoverRequestId &&
|
|
70
|
+
this.read()?.ownerId === this.ownerId) {
|
|
71
|
+
this.clearTakeoverRequest();
|
|
72
|
+
this.owned = true;
|
|
73
|
+
this.startRefresh();
|
|
74
|
+
this.onOtherTabChange(false);
|
|
75
|
+
this.onHandoff(value.payload);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
this.key = `__oxvo_ai_live_assist_active_${siteKey}`;
|
|
79
|
+
this.channel = typeof BroadcastChannel === 'undefined'
|
|
80
|
+
? null
|
|
81
|
+
: new BroadcastChannel(`oxvo-ai-live-assist:${siteKey}`);
|
|
82
|
+
this.channel?.addEventListener('message', this.onMessage);
|
|
83
|
+
window.addEventListener('storage', this.onStorage);
|
|
84
|
+
this.reportOtherTab();
|
|
85
|
+
}
|
|
86
|
+
acquire() {
|
|
87
|
+
const current = this.read();
|
|
88
|
+
if (current &&
|
|
89
|
+
current.expiresAt > Date.now() &&
|
|
90
|
+
current.ownerId !== this.ownerId) {
|
|
91
|
+
this.onOtherTabChange(true);
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
this.writeOwner(this.ownerId);
|
|
95
|
+
const confirmed = this.read();
|
|
96
|
+
if (confirmed?.ownerId !== this.ownerId) {
|
|
97
|
+
this.onOtherTabChange(true);
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
this.owned = true;
|
|
101
|
+
this.startRefresh();
|
|
102
|
+
this.channel?.postMessage({ type: 'active', ownerId: this.ownerId });
|
|
103
|
+
this.onOtherTabChange(false);
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
requestTakeover() {
|
|
107
|
+
const current = this.read();
|
|
108
|
+
if (!this.channel ||
|
|
109
|
+
!current ||
|
|
110
|
+
current.expiresAt <= Date.now() ||
|
|
111
|
+
current.ownerId === this.ownerId) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
const requestId = `takeover_${crypto.randomUUID()}`;
|
|
115
|
+
this.clearTakeoverRequest();
|
|
116
|
+
this.takeoverRequestId = requestId;
|
|
117
|
+
this.takeoverOwnerId = current.ownerId;
|
|
118
|
+
this.sendTakeoverRequest();
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
handoff(requesterId, requestId, payload) {
|
|
122
|
+
if (!this.channel ||
|
|
123
|
+
!this.owned ||
|
|
124
|
+
!validId(requesterId) ||
|
|
125
|
+
!validId(requestId) ||
|
|
126
|
+
this.read()?.ownerId !== this.ownerId) {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
this.stopRefresh();
|
|
130
|
+
this.writeOwner(requesterId);
|
|
131
|
+
if (this.read()?.ownerId !== requesterId) {
|
|
132
|
+
this.startRefresh();
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
this.owned = false;
|
|
136
|
+
this.channel.postMessage({
|
|
137
|
+
type: 'handoff',
|
|
138
|
+
ownerId: requesterId,
|
|
139
|
+
requesterId,
|
|
140
|
+
requestId,
|
|
141
|
+
payload,
|
|
142
|
+
});
|
|
143
|
+
this.onOtherTabChange(true);
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
isOwnedByOther() {
|
|
147
|
+
const current = this.read();
|
|
148
|
+
return Boolean(current &&
|
|
149
|
+
current.expiresAt > Date.now() &&
|
|
150
|
+
current.ownerId !== this.ownerId);
|
|
151
|
+
}
|
|
152
|
+
release() {
|
|
153
|
+
this.stopRefresh();
|
|
154
|
+
const released = this.owned && this.read()?.ownerId === this.ownerId;
|
|
155
|
+
if (released) {
|
|
156
|
+
try {
|
|
157
|
+
localStorage.removeItem(this.key);
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
// Storage may be unavailable in strict privacy modes.
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
this.owned = false;
|
|
164
|
+
this.clearTakeoverRequest();
|
|
165
|
+
if (released) {
|
|
166
|
+
this.channel?.postMessage({ type: 'ended', ownerId: this.ownerId });
|
|
167
|
+
}
|
|
168
|
+
this.reportOtherTab();
|
|
169
|
+
}
|
|
170
|
+
destroy() {
|
|
171
|
+
this.release();
|
|
172
|
+
this.channel?.removeEventListener('message', this.onMessage);
|
|
173
|
+
this.channel?.close();
|
|
174
|
+
window.removeEventListener('storage', this.onStorage);
|
|
175
|
+
}
|
|
176
|
+
read() {
|
|
177
|
+
try {
|
|
178
|
+
return parse(localStorage.getItem(this.key));
|
|
179
|
+
}
|
|
180
|
+
catch {
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
writeOwner(ownerId) {
|
|
185
|
+
try {
|
|
186
|
+
localStorage.setItem(this.key, JSON.stringify({ ownerId, expiresAt: Date.now() + 15000 }));
|
|
187
|
+
}
|
|
188
|
+
catch {
|
|
189
|
+
// The server's distributed lease remains authoritative.
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
startRefresh() {
|
|
193
|
+
this.stopRefresh();
|
|
194
|
+
this.refreshTimer = setInterval(() => this.writeOwner(this.ownerId), 5000);
|
|
195
|
+
}
|
|
196
|
+
stopRefresh() {
|
|
197
|
+
if (this.refreshTimer)
|
|
198
|
+
clearInterval(this.refreshTimer);
|
|
199
|
+
this.refreshTimer = null;
|
|
200
|
+
}
|
|
201
|
+
reportOtherTab() {
|
|
202
|
+
this.onOtherTabChange(this.isOwnedByOther());
|
|
203
|
+
}
|
|
204
|
+
sendTakeoverRequest() {
|
|
205
|
+
const requestId = this.takeoverRequestId;
|
|
206
|
+
const ownerId = this.takeoverOwnerId;
|
|
207
|
+
if (!this.channel || !requestId || !ownerId || this.takeoverAttempts >= 6) {
|
|
208
|
+
this.clearTakeoverRequest();
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
const current = this.read();
|
|
212
|
+
if (!current || current.expiresAt <= Date.now()) {
|
|
213
|
+
this.clearTakeoverRequest();
|
|
214
|
+
this.reportOtherTab();
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
if (current.ownerId !== ownerId) {
|
|
218
|
+
if (current.ownerId === this.ownerId && !this.owned) {
|
|
219
|
+
if (this.takeoverRetryTimer)
|
|
220
|
+
clearTimeout(this.takeoverRetryTimer);
|
|
221
|
+
this.takeoverRetryTimer = setTimeout(() => this.expireIncompleteHandoff(), 5000);
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
this.clearTakeoverRequest();
|
|
225
|
+
this.reportOtherTab();
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
this.takeoverAttempts += 1;
|
|
229
|
+
this.channel.postMessage({
|
|
230
|
+
type: 'takeover-request',
|
|
231
|
+
ownerId,
|
|
232
|
+
requesterId: this.ownerId,
|
|
233
|
+
requestId,
|
|
234
|
+
});
|
|
235
|
+
if (this.takeoverRequestId === requestId) {
|
|
236
|
+
this.takeoverRetryTimer = setTimeout(() => this.sendTakeoverRequest(), 250);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
clearTakeoverRequest() {
|
|
240
|
+
if (this.takeoverRetryTimer)
|
|
241
|
+
clearTimeout(this.takeoverRetryTimer);
|
|
242
|
+
this.takeoverRetryTimer = null;
|
|
243
|
+
this.takeoverRequestId = null;
|
|
244
|
+
this.takeoverOwnerId = null;
|
|
245
|
+
this.takeoverAttempts = 0;
|
|
246
|
+
}
|
|
247
|
+
expireIncompleteHandoff() {
|
|
248
|
+
if (!this.owned && this.read()?.ownerId === this.ownerId) {
|
|
249
|
+
try {
|
|
250
|
+
localStorage.removeItem(this.key);
|
|
251
|
+
}
|
|
252
|
+
catch {
|
|
253
|
+
// The distributed lease expires independently when storage is unavailable.
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
this.clearTakeoverRequest();
|
|
257
|
+
this.reportOtherTab();
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
exports.TabActivityLock = TabActivityLock;
|
package/cjs/types.d.ts
ADDED
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
export type ConsentScope = "ai_disclosure" | "text" | "microphone" | "page_context" | "browser_control" | "visual_context" | "handoff_context" | "retained_transcript" | "presentation_guidance";
|
|
2
|
+
export type ExperienceMode = "standard" | "voice_presence";
|
|
3
|
+
export type CapabilityTier = "standard" | "reduced_motion" | "low_power" | "static";
|
|
4
|
+
export type VoicePresenceConfig = {
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
strictVoiceOnly: boolean;
|
|
7
|
+
fallback: "none" | "offer_standard_assist" | "offer_human_handoff";
|
|
8
|
+
launcher: {
|
|
9
|
+
position: "bottom_right" | "bottom_left";
|
|
10
|
+
size: "compact" | "comfortable";
|
|
11
|
+
theme?: "light" | "dark";
|
|
12
|
+
offsetInlinePx: number;
|
|
13
|
+
offsetBlockPx: number;
|
|
14
|
+
showLabelOnFirstVisit: boolean;
|
|
15
|
+
customIconSvg?: string | null;
|
|
16
|
+
};
|
|
17
|
+
activation: {
|
|
18
|
+
title: string;
|
|
19
|
+
description: string;
|
|
20
|
+
primaryLabel: string;
|
|
21
|
+
secondaryLabel: string;
|
|
22
|
+
detailsLabel: string | null;
|
|
23
|
+
};
|
|
24
|
+
captions: {
|
|
25
|
+
enabled: true;
|
|
26
|
+
showVisitorFinal: boolean;
|
|
27
|
+
showAssistantFinal: boolean;
|
|
28
|
+
showInterimVisitor: boolean;
|
|
29
|
+
maxLines: number;
|
|
30
|
+
maxCharacters: number;
|
|
31
|
+
visibleMs: number;
|
|
32
|
+
placement: "adaptive" | "launcher_only" | "target_when_relevant";
|
|
33
|
+
};
|
|
34
|
+
visual: {
|
|
35
|
+
themeVersion: 1;
|
|
36
|
+
intensity: "subtle" | "balanced" | "immersive";
|
|
37
|
+
introWake: boolean;
|
|
38
|
+
spatialTrail: boolean;
|
|
39
|
+
lowPowerMode: "auto" | "always" | "never";
|
|
40
|
+
};
|
|
41
|
+
presentation: {
|
|
42
|
+
aiCursor: boolean;
|
|
43
|
+
spotlight: boolean;
|
|
44
|
+
annotations: boolean;
|
|
45
|
+
spatialCallouts: boolean;
|
|
46
|
+
sequenceMarkers: boolean;
|
|
47
|
+
maxActiveCues: number;
|
|
48
|
+
maxCuesPerMinute: number;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export type AssistMode = "text" | "voice";
|
|
52
|
+
export type BrowserAction = "scroll" | "highlight" | "focus" | "click" | "type" | "select" | "submit";
|
|
53
|
+
export type Sensitivity = "none" | "private" | "password" | "otp" | "payment" | "banking" | "recovery" | "authentication_secret" | "api_secret";
|
|
54
|
+
export type BootstrapConfig = {
|
|
55
|
+
schemaVersion: 1;
|
|
56
|
+
protocol: {
|
|
57
|
+
min: number;
|
|
58
|
+
max: number;
|
|
59
|
+
};
|
|
60
|
+
available: boolean;
|
|
61
|
+
replayRecordingEnabled?: boolean;
|
|
62
|
+
experienceMode?: ExperienceMode;
|
|
63
|
+
minimumProtocolVersion?: 1 | 2;
|
|
64
|
+
minimumClientVersion?: string;
|
|
65
|
+
configRevision?: number;
|
|
66
|
+
configChecksum?: string;
|
|
67
|
+
widgetVersion?: string;
|
|
68
|
+
capabilities?: {
|
|
69
|
+
text: boolean;
|
|
70
|
+
voice: boolean;
|
|
71
|
+
captions: boolean;
|
|
72
|
+
pageContext: boolean;
|
|
73
|
+
browserControl: boolean;
|
|
74
|
+
visualContext: boolean;
|
|
75
|
+
voicePresence: boolean;
|
|
76
|
+
presentation: boolean;
|
|
77
|
+
aiCursor: boolean;
|
|
78
|
+
annotations: boolean;
|
|
79
|
+
spatialCallouts: boolean;
|
|
80
|
+
handoff: boolean;
|
|
81
|
+
};
|
|
82
|
+
agentAccess?: {
|
|
83
|
+
discoveryUrl: string;
|
|
84
|
+
};
|
|
85
|
+
voice?: {
|
|
86
|
+
turnMode: "semantic_vad" | "server_vad" | "manual";
|
|
87
|
+
};
|
|
88
|
+
appearance?: {
|
|
89
|
+
brandName: string;
|
|
90
|
+
launcherLabel: string;
|
|
91
|
+
accent: string;
|
|
92
|
+
position: "left" | "right";
|
|
93
|
+
panelWidth: number;
|
|
94
|
+
glassEffect: boolean;
|
|
95
|
+
hideLauncherWhenVisitorLimited: boolean;
|
|
96
|
+
attribution?: {
|
|
97
|
+
enabled: boolean;
|
|
98
|
+
};
|
|
99
|
+
welcomeMessage: string | null;
|
|
100
|
+
voicePresence?: VoicePresenceConfig;
|
|
101
|
+
};
|
|
102
|
+
visitorEligibility?: {
|
|
103
|
+
status: "eligible" | "visitor_active" | "visitor_limited" | "cooldown_limited";
|
|
104
|
+
};
|
|
105
|
+
consent?: {
|
|
106
|
+
disclosure: string;
|
|
107
|
+
disclosureChecksum: string;
|
|
108
|
+
policyUrl: string | null;
|
|
109
|
+
termsUrl: string | null;
|
|
110
|
+
requiredScopes: ConsentScope[];
|
|
111
|
+
optionalScopes: ConsentScope[];
|
|
112
|
+
};
|
|
113
|
+
locale?: {
|
|
114
|
+
default: string;
|
|
115
|
+
allowed: string[];
|
|
116
|
+
};
|
|
117
|
+
safety?: {
|
|
118
|
+
policyVersion: number;
|
|
119
|
+
selectorRegions: Array<{
|
|
120
|
+
digest: string;
|
|
121
|
+
selector: string;
|
|
122
|
+
}>;
|
|
123
|
+
};
|
|
124
|
+
cache: {
|
|
125
|
+
maxAgeSeconds: number;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
export type LaunchResult = {
|
|
129
|
+
schemaVersion: 1 | 2;
|
|
130
|
+
protocolVersion: 1 | 2;
|
|
131
|
+
experienceMode: ExperienceMode;
|
|
132
|
+
capabilityTier: CapabilityTier;
|
|
133
|
+
sessionId: string;
|
|
134
|
+
launchCredential: string;
|
|
135
|
+
controlCredential: string;
|
|
136
|
+
resumeCredential: string;
|
|
137
|
+
feedbackCredential: string;
|
|
138
|
+
expiresAt: string;
|
|
139
|
+
feedbackExpiresAt: string;
|
|
140
|
+
controlUrl: string;
|
|
141
|
+
realtimeOfferUrl: string;
|
|
142
|
+
capabilities?: NonNullable<BootstrapConfig["capabilities"]>;
|
|
143
|
+
assistant?: {
|
|
144
|
+
name: string;
|
|
145
|
+
voice: string | null;
|
|
146
|
+
welcomeMessage: string | null;
|
|
147
|
+
};
|
|
148
|
+
state?: "reconnecting";
|
|
149
|
+
correlationId?: string;
|
|
150
|
+
};
|
|
151
|
+
export type ControlServerEnvelope = {
|
|
152
|
+
v: 1 | 2;
|
|
153
|
+
id: string;
|
|
154
|
+
type: string;
|
|
155
|
+
sessionId: string;
|
|
156
|
+
sequence: number;
|
|
157
|
+
sentAt: string;
|
|
158
|
+
payload: Record<string, unknown>;
|
|
159
|
+
};
|
|
160
|
+
export type SanitizedOption = {
|
|
161
|
+
id: string;
|
|
162
|
+
label: string;
|
|
163
|
+
disabled: boolean;
|
|
164
|
+
};
|
|
165
|
+
export type SanitizedTarget = {
|
|
166
|
+
targetId: string;
|
|
167
|
+
revision: number;
|
|
168
|
+
role: string;
|
|
169
|
+
name: string;
|
|
170
|
+
inputType?: string;
|
|
171
|
+
autocomplete?: string;
|
|
172
|
+
semanticRegion?: string;
|
|
173
|
+
sensitivity: Sensitivity;
|
|
174
|
+
protectedRegion?: boolean;
|
|
175
|
+
frameOrigin?: "same_origin" | "cross_origin";
|
|
176
|
+
consequence?: "none" | "navigation" | "state_change" | "submission" | "financial" | "account" | "destructive";
|
|
177
|
+
regionAssessment?: {
|
|
178
|
+
policyVersion: number;
|
|
179
|
+
evaluatedRuleDigests: string[];
|
|
180
|
+
matchedRuleDigests: string[];
|
|
181
|
+
};
|
|
182
|
+
state: {
|
|
183
|
+
visible: boolean;
|
|
184
|
+
enabled: boolean;
|
|
185
|
+
covered?: boolean;
|
|
186
|
+
checked?: boolean;
|
|
187
|
+
};
|
|
188
|
+
options?: SanitizedOption[];
|
|
189
|
+
};
|
|
190
|
+
export type PageContextSnapshot = {
|
|
191
|
+
schemaVersion: 1;
|
|
192
|
+
pageId: string;
|
|
193
|
+
revision: number;
|
|
194
|
+
url: string;
|
|
195
|
+
title: string;
|
|
196
|
+
locale: string;
|
|
197
|
+
viewport: {
|
|
198
|
+
width: number;
|
|
199
|
+
height: number;
|
|
200
|
+
scrollY: number;
|
|
201
|
+
};
|
|
202
|
+
landmarks: Array<{
|
|
203
|
+
role: string;
|
|
204
|
+
label: string;
|
|
205
|
+
}>;
|
|
206
|
+
visibleText: Array<{
|
|
207
|
+
id: string;
|
|
208
|
+
text: string;
|
|
209
|
+
provenance: "page";
|
|
210
|
+
}>;
|
|
211
|
+
selection?: {
|
|
212
|
+
text: string;
|
|
213
|
+
source: "document";
|
|
214
|
+
capturedAt: string;
|
|
215
|
+
};
|
|
216
|
+
targets: SanitizedTarget[];
|
|
217
|
+
alerts: string[];
|
|
218
|
+
truncated: boolean;
|
|
219
|
+
};
|
|
220
|
+
export type VisualContextCapture = {
|
|
221
|
+
source: "sanitized_layout";
|
|
222
|
+
mimeType: "image/jpeg";
|
|
223
|
+
dataUrl: string;
|
|
224
|
+
width: number;
|
|
225
|
+
height: number;
|
|
226
|
+
pageId: string;
|
|
227
|
+
revision: number;
|
|
228
|
+
};
|
|
229
|
+
export type VisualContextRequest = {
|
|
230
|
+
requestId: string;
|
|
231
|
+
functionCallId: string;
|
|
232
|
+
reason: string;
|
|
233
|
+
expiresAt: string;
|
|
234
|
+
approvalMode: "manual" | "automatic";
|
|
235
|
+
};
|
|
236
|
+
export type ActionGrant = {
|
|
237
|
+
grant: string;
|
|
238
|
+
actionId: string;
|
|
239
|
+
action: BrowserAction;
|
|
240
|
+
targetId: string;
|
|
241
|
+
domRevision: number;
|
|
242
|
+
fencingToken: number;
|
|
243
|
+
expiresAt: string;
|
|
244
|
+
value?: string;
|
|
245
|
+
optionValueId?: string;
|
|
246
|
+
desiredChecked?: boolean;
|
|
247
|
+
};
|
|
248
|
+
export type ActionExecutionResult = {
|
|
249
|
+
grant: string;
|
|
250
|
+
actionId: string;
|
|
251
|
+
status: "executed" | "blocked" | "stale" | "failed";
|
|
252
|
+
observed: {
|
|
253
|
+
url?: string;
|
|
254
|
+
revision: number;
|
|
255
|
+
targetState: "unchanged" | "changed" | "detached" | "unknown";
|
|
256
|
+
safeSummary: string;
|
|
257
|
+
checked?: boolean;
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
export type PresentationKind = "pointer" | "spotlight" | "underline" | "circle" | "arrow" | "connector" | "sequence_marker" | "callout" | "clear";
|
|
261
|
+
export type PresentationIntent = {
|
|
262
|
+
presentationId: string;
|
|
263
|
+
groupId: string | null;
|
|
264
|
+
kind: PresentationKind;
|
|
265
|
+
targetId: string | null;
|
|
266
|
+
secondaryTargetId: string | null;
|
|
267
|
+
domRevision: number;
|
|
268
|
+
message: string | null;
|
|
269
|
+
emphasis: "subtle" | "normal" | "strong";
|
|
270
|
+
ttlMs: number;
|
|
271
|
+
replaceGroup: boolean;
|
|
272
|
+
};
|
|
273
|
+
export type PresentationResult = {
|
|
274
|
+
presentationId: string;
|
|
275
|
+
status: "shown" | "blocked" | "stale" | "unsupported" | "cleared";
|
|
276
|
+
reasonCode: "OK" | "PRESENTATION_DISABLED" | "PRESENTATION_TARGET_STALE" | "PRESENTATION_TARGET_BLOCKED" | "PRESENTATION_RATE_LIMITED" | "VISITOR_ACTIVITY" | "REDUCED_MOTION_FALLBACK" | "CAPABILITY_UNAVAILABLE" | "NAVIGATION";
|
|
277
|
+
pageId: string;
|
|
278
|
+
domRevision: number;
|
|
279
|
+
shownAt: string | null;
|
|
280
|
+
};
|
|
281
|
+
export type PresentationTarget = {
|
|
282
|
+
targetId: string;
|
|
283
|
+
pageId: string;
|
|
284
|
+
revision: number;
|
|
285
|
+
rect: DOMRectReadOnly;
|
|
286
|
+
safe: boolean;
|
|
287
|
+
};
|
|
288
|
+
export type WidgetMessageKey = "launcher" | "introTitle" | "disclosure" | "requiredConsent" | "consentAgreement" | "legalDetails" | "legalTitle" | "legalClose" | "termsOfService" | "microphoneConsent" | "pageConsent" | "controlConsent" | "visualConsent" | "visualRequest" | "shareVisual" | "declineVisual" | "visualShared" | "visualUnavailable" | "pauseVisual" | "resumeVisual" | "handoffConsent" | "retentionConsent" | "startText" | "startVoice" | "connecting" | "listening" | "thinking" | "speaking" | "ready" | "paused" | "reconnecting" | "end" | "restart" | "close" | "minimize" | "maximize" | "activeCall" | "movePanel" | "mute" | "unmute" | "interrupt" | "usePushToTalk" | "useAutomaticTurns" | "automaticTurnsUnavailable" | "startSpeaking" | "sendVoiceTurn" | "microphoneUnavailable" | "pauseActions" | "resumeActions" | "captionsOn" | "captionsOff" | "textOnly" | "send" | "messagePlaceholder" | "requestHuman" | "continueWithFullAssist" | "requestHumanFallback" | "approve" | "decline" | "actionRequest" | "actionRunning" | "actionVerified" | "actionFailed" | "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";
|
|
289
|
+
export type PluginOptions = {
|
|
290
|
+
enabled?: boolean;
|
|
291
|
+
recordReplay?: boolean;
|
|
292
|
+
runtimeUrl?: string;
|
|
293
|
+
siteKey?: string;
|
|
294
|
+
locale?: string;
|
|
295
|
+
messages?: Partial<Record<WidgetMessageKey, string>>;
|
|
296
|
+
bootstrapTimeoutMs?: number;
|
|
297
|
+
visualTestMode?: boolean;
|
|
298
|
+
onStateChange?: (state: string) => void;
|
|
299
|
+
};
|
package/cjs/types.js
ADDED