@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
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type GuideIdentity, type GuideLaunchIntent } from "./guideTypes.js";
|
|
2
|
+
export type GuideSubjectRecord = {
|
|
3
|
+
v: 1;
|
|
4
|
+
origin: string;
|
|
5
|
+
projectId: number;
|
|
6
|
+
guideId: string;
|
|
7
|
+
subjectId: string;
|
|
8
|
+
subjectAuthorityRevision: number;
|
|
9
|
+
credential: string;
|
|
10
|
+
expiresAt: string;
|
|
11
|
+
};
|
|
12
|
+
export type GuideLaunchRecord = {
|
|
13
|
+
v: 1;
|
|
14
|
+
subjectId: string;
|
|
15
|
+
intent: GuideLaunchIntent;
|
|
16
|
+
recordingConsent?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare class GuideSubjectStore {
|
|
19
|
+
readonly identity: GuideIdentity;
|
|
20
|
+
readonly origin: string;
|
|
21
|
+
private readonly storage;
|
|
22
|
+
private readonly subjectKey;
|
|
23
|
+
private readonly launchKey;
|
|
24
|
+
constructor(identity: GuideIdentity, origin: string, namespace: string, storage?: Storage);
|
|
25
|
+
readSubject(): GuideSubjectRecord | null;
|
|
26
|
+
saveSubject(subject: GuideSubjectRecord): void;
|
|
27
|
+
readLaunch(): GuideLaunchRecord | null;
|
|
28
|
+
saveLaunch(record: GuideLaunchRecord): void;
|
|
29
|
+
clearLaunch(launchRequestId: string): void;
|
|
30
|
+
private read;
|
|
31
|
+
private write;
|
|
32
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GuideSubjectStore = void 0;
|
|
4
|
+
const guideTypes_js_1 = require("./guideTypes.js");
|
|
5
|
+
class GuideSubjectStore {
|
|
6
|
+
constructor(identity, origin, namespace, storage = localStorage) {
|
|
7
|
+
this.identity = identity;
|
|
8
|
+
this.origin = origin;
|
|
9
|
+
this.storage = storage;
|
|
10
|
+
this.subjectKey = `__oxvo_ai_guide_subject_v1_${namespace}`;
|
|
11
|
+
this.launchKey = `__oxvo_ai_guide_launch_v1_${namespace}`;
|
|
12
|
+
}
|
|
13
|
+
readSubject() {
|
|
14
|
+
const raw = this.read(this.subjectKey);
|
|
15
|
+
if (!raw)
|
|
16
|
+
return null;
|
|
17
|
+
const subject = raw;
|
|
18
|
+
if (subject.v !== 1 ||
|
|
19
|
+
subject.origin !== this.origin ||
|
|
20
|
+
subject.projectId !== this.identity.projectId ||
|
|
21
|
+
subject.guideId !== this.identity.guideId ||
|
|
22
|
+
typeof subject.subjectId !== "string" ||
|
|
23
|
+
!guideTypes_js_1.GUIDE_UUID_PATTERN.test(subject.subjectId) ||
|
|
24
|
+
!Number.isSafeInteger(subject.subjectAuthorityRevision) ||
|
|
25
|
+
(subject.subjectAuthorityRevision ?? -1) < 0 ||
|
|
26
|
+
typeof subject.credential !== "string" ||
|
|
27
|
+
!guideTypes_js_1.GUIDE_SUBJECT_CREDENTIAL_PATTERN.test(subject.credential) ||
|
|
28
|
+
typeof subject.expiresAt !== "string" ||
|
|
29
|
+
!Number.isFinite(Date.parse(subject.expiresAt)))
|
|
30
|
+
throw new Error("The saved AI Guide identity is invalid.");
|
|
31
|
+
// Preserve expired identities; never downgrade rejected/expired possession to
|
|
32
|
+
// an anonymous replacement while recovering a possibly paid operation.
|
|
33
|
+
return subject;
|
|
34
|
+
}
|
|
35
|
+
saveSubject(subject) {
|
|
36
|
+
this.write(this.subjectKey, subject);
|
|
37
|
+
const saved = this.readSubject();
|
|
38
|
+
if (!saved || JSON.stringify(saved) !== JSON.stringify(subject)) {
|
|
39
|
+
throw new Error("AI Guide could not securely save this session identity.");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
readLaunch() {
|
|
43
|
+
const raw = this.read(this.launchKey);
|
|
44
|
+
if (!raw)
|
|
45
|
+
return null;
|
|
46
|
+
const record = raw;
|
|
47
|
+
const intent = record.intent;
|
|
48
|
+
if (record.v !== 1 ||
|
|
49
|
+
typeof record.subjectId !== "string" ||
|
|
50
|
+
!guideTypes_js_1.GUIDE_UUID_PATTERN.test(record.subjectId) ||
|
|
51
|
+
!intent ||
|
|
52
|
+
intent.schemaVersion !== 3 ||
|
|
53
|
+
intent.protocolVersion !== 2 ||
|
|
54
|
+
intent.installKey !== this.identity.installKey ||
|
|
55
|
+
!guideTypes_js_1.GUIDE_UUID_PATTERN.test(intent.launchRequestId) ||
|
|
56
|
+
typeof intent.tabId !== "string" ||
|
|
57
|
+
!/^[A-Za-z0-9_.:-]{1,128}$/.test(intent.tabId) ||
|
|
58
|
+
typeof intent.path !== "string" ||
|
|
59
|
+
intent.path.length > 4096 ||
|
|
60
|
+
(intent.mode !== "text" && intent.mode !== "voice") ||
|
|
61
|
+
intent.experienceMode !== "standard" ||
|
|
62
|
+
!intent.consent ||
|
|
63
|
+
!intent.capabilitySummary ||
|
|
64
|
+
(record.recordingConsent !== undefined &&
|
|
65
|
+
typeof record.recordingConsent !== "boolean"))
|
|
66
|
+
throw new Error("The saved AI Guide launch is invalid.");
|
|
67
|
+
return record;
|
|
68
|
+
}
|
|
69
|
+
saveLaunch(record) {
|
|
70
|
+
const previous = this.readLaunch();
|
|
71
|
+
if (previous &&
|
|
72
|
+
previous.intent.launchRequestId !== record.intent.launchRequestId) {
|
|
73
|
+
throw new Error("The previous AI Guide session must finish first.");
|
|
74
|
+
}
|
|
75
|
+
this.write(this.launchKey, record);
|
|
76
|
+
if (JSON.stringify(this.readLaunch()) !== JSON.stringify(record)) {
|
|
77
|
+
throw new Error("AI Guide could not securely save this launch.");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
clearLaunch(launchRequestId) {
|
|
81
|
+
const record = this.readLaunch();
|
|
82
|
+
if (record?.intent.launchRequestId === launchRequestId)
|
|
83
|
+
this.storage.removeItem(this.launchKey);
|
|
84
|
+
}
|
|
85
|
+
read(key) {
|
|
86
|
+
const value = this.storage.getItem(key);
|
|
87
|
+
if (value === null)
|
|
88
|
+
return null;
|
|
89
|
+
if (value.length > 16384)
|
|
90
|
+
throw new Error("The saved AI Guide state is invalid.");
|
|
91
|
+
try {
|
|
92
|
+
const parsed = JSON.parse(value);
|
|
93
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
94
|
+
throw new Error();
|
|
95
|
+
return parsed;
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
throw new Error("The saved AI Guide state is invalid.");
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
write(key, value) {
|
|
102
|
+
this.storage.setItem(key, JSON.stringify(value));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.GuideSubjectStore = GuideSubjectStore;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { AiGuideControllerState, AiGuideOpenInput, BootstrapConfig, ConsentScope, LaunchResult, PluginOptions } from "./types.js";
|
|
2
|
+
export type GuideIdentity = Readonly<{
|
|
3
|
+
projectId: number;
|
|
4
|
+
guideId: string;
|
|
5
|
+
installKey: string;
|
|
6
|
+
}>;
|
|
7
|
+
export type GuideBootstrapConfig = BootstrapConfig & GuideIdentity & {
|
|
8
|
+
schemaVersion: 3;
|
|
9
|
+
configRevision: number;
|
|
10
|
+
configChecksum: string;
|
|
11
|
+
};
|
|
12
|
+
export type GuideLaunchIntent = {
|
|
13
|
+
schemaVersion: 3;
|
|
14
|
+
protocolVersion: 2;
|
|
15
|
+
installKey: string;
|
|
16
|
+
launchRequestId: string;
|
|
17
|
+
clientVersion: string;
|
|
18
|
+
configRevision: number;
|
|
19
|
+
path: string;
|
|
20
|
+
tabId: string;
|
|
21
|
+
mode: "text" | "voice";
|
|
22
|
+
experienceMode: "standard";
|
|
23
|
+
consent: {
|
|
24
|
+
disclosureChecksum: string;
|
|
25
|
+
scopes: ConsentScope[];
|
|
26
|
+
locale: string;
|
|
27
|
+
};
|
|
28
|
+
capabilitySummary: {
|
|
29
|
+
ctaOffer: boolean;
|
|
30
|
+
microphone: boolean;
|
|
31
|
+
webrtc: boolean;
|
|
32
|
+
audioPlayback: boolean;
|
|
33
|
+
webAudio: boolean;
|
|
34
|
+
svgOverlay: boolean;
|
|
35
|
+
visualViewport: boolean;
|
|
36
|
+
reducedMotion: boolean;
|
|
37
|
+
lowPower: boolean;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export type GuideAdmissionResult = {
|
|
41
|
+
schemaVersion: 3;
|
|
42
|
+
protocolVersion: 2;
|
|
43
|
+
projectId: number;
|
|
44
|
+
guideId: string;
|
|
45
|
+
subjectId: string;
|
|
46
|
+
subjectAuthorityRevision: number;
|
|
47
|
+
tabId: string;
|
|
48
|
+
launchRequestId: string;
|
|
49
|
+
configRevision: number;
|
|
50
|
+
configChecksum: string;
|
|
51
|
+
admissionGrant: string;
|
|
52
|
+
expiresAt: string;
|
|
53
|
+
subjectCredentialExpiresAt: string;
|
|
54
|
+
subjectCredential?: string;
|
|
55
|
+
};
|
|
56
|
+
export type GuideLaunchResult = LaunchResult & {
|
|
57
|
+
schemaVersion: 3;
|
|
58
|
+
protocolVersion: 2;
|
|
59
|
+
projectId: number;
|
|
60
|
+
guideId: string;
|
|
61
|
+
subjectId: string;
|
|
62
|
+
launchRequestId: string;
|
|
63
|
+
};
|
|
64
|
+
export type GuideLaunchRecoveryInput = {
|
|
65
|
+
schemaVersion: 3;
|
|
66
|
+
installKey: string;
|
|
67
|
+
subjectCredential: string;
|
|
68
|
+
launchRequestId: string;
|
|
69
|
+
tabId: string;
|
|
70
|
+
action: "resume" | "end";
|
|
71
|
+
};
|
|
72
|
+
export type GuideLaunchRecoveryResult = {
|
|
73
|
+
schemaVersion: 3;
|
|
74
|
+
launchRequestId: string;
|
|
75
|
+
status: "pending" | "terminal";
|
|
76
|
+
} | {
|
|
77
|
+
schemaVersion: 3;
|
|
78
|
+
launchRequestId: string;
|
|
79
|
+
status: "ready";
|
|
80
|
+
launch: GuideLaunchResult;
|
|
81
|
+
};
|
|
82
|
+
export type GuideRecordingLinkInput = {
|
|
83
|
+
schemaVersion: 3;
|
|
84
|
+
installKey: string;
|
|
85
|
+
subjectCredential: string;
|
|
86
|
+
tabId: string;
|
|
87
|
+
replaySessionId: string;
|
|
88
|
+
replayGrant: string;
|
|
89
|
+
};
|
|
90
|
+
export type GuideRecordingLinkResult = {
|
|
91
|
+
schemaVersion: 3;
|
|
92
|
+
linked: true;
|
|
93
|
+
sessionId: string;
|
|
94
|
+
replaySessionId: string;
|
|
95
|
+
};
|
|
96
|
+
/** Public standalone declarations deliberately do not depend on Browser/App. */
|
|
97
|
+
export type AiGuideController = {
|
|
98
|
+
readonly version: string;
|
|
99
|
+
open(input?: AiGuideOpenInput): AiGuideControllerState;
|
|
100
|
+
close(): void;
|
|
101
|
+
getState(): AiGuideControllerState;
|
|
102
|
+
end(): Promise<void>;
|
|
103
|
+
destroy(): void;
|
|
104
|
+
};
|
|
105
|
+
export type StandaloneGuideOptions = Omit<PluginOptions, "siteKey" | "recordReplay"> & {
|
|
106
|
+
installKey: string;
|
|
107
|
+
runtimeUrl: string;
|
|
108
|
+
/** Opt in to this frame's own document and server-approved origin only.
|
|
109
|
+
* Session recording is unavailable in frames; the Guide remains usable.
|
|
110
|
+
* The embedding site must delegate microphone permission for voice.
|
|
111
|
+
*/
|
|
112
|
+
allowInFrame?: boolean;
|
|
113
|
+
};
|
|
114
|
+
export declare const GUIDE_UUID_PATTERN: RegExp;
|
|
115
|
+
export declare const GUIDE_INSTALL_KEY_PATTERN: RegExp;
|
|
116
|
+
export declare const GUIDE_SUBJECT_CREDENTIAL_PATTERN: RegExp;
|
|
117
|
+
export declare function guideLaunchRequestId(value: string): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GUIDE_SUBJECT_CREDENTIAL_PATTERN = exports.GUIDE_INSTALL_KEY_PATTERN = exports.GUIDE_UUID_PATTERN = void 0;
|
|
4
|
+
exports.guideLaunchRequestId = guideLaunchRequestId;
|
|
5
|
+
exports.GUIDE_UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
6
|
+
exports.GUIDE_INSTALL_KEY_PATTERN = /^gk_[0-9a-f]{32}$/;
|
|
7
|
+
exports.GUIDE_SUBJECT_CREDENTIAL_PATTERN = /^[A-Za-z0-9_-]{32,256}$/;
|
|
8
|
+
function guideLaunchRequestId(value) {
|
|
9
|
+
// Existing durable launch intents already use a UUID with a `launch_` prefix.
|
|
10
|
+
// Preserve that one-to-one identity instead of generating a second attempt.
|
|
11
|
+
const uuid = value.startsWith("launch_") ? value.slice(7) : value;
|
|
12
|
+
if (!exports.GUIDE_UUID_PATTERN.test(uuid))
|
|
13
|
+
throw new Error("Invalid AI Guide launch request ID.");
|
|
14
|
+
return uuid;
|
|
15
|
+
}
|
package/cjs/index.d.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import type { App, Options as BrowserOptions } from '@oxvo/browser';
|
|
2
2
|
import AiLiveAssist from './AiLiveAssist.js';
|
|
3
|
+
import { type GuideHost } from './guideHost.js';
|
|
3
4
|
import type { PluginOptions } from './types.js';
|
|
4
5
|
import { VERSION } from './version.js';
|
|
5
6
|
export type { AiGuideControllerState, AiGuideOpenInput, MessengerCompanionConfig, PluginOptions, } from './types.js';
|
|
6
7
|
export { AiLiveAssist, VERSION };
|
|
8
|
+
export { LiveControlChannel } from './liveControlChannel.js';
|
|
9
|
+
export { createLegacyBrowserHost } from './guideHost.js';
|
|
10
|
+
export type { GuideHost, GuideIdentity, LegacyBrowserGuideHost, ReplayRecordingSource, StandaloneGuideHost, } from './guideHost.js';
|
|
11
|
+
/** Explicit Guide hosts remain gated until signed schema 3 admission is available. */
|
|
12
|
+
export declare function mountAiGuide(host: GuideHost, options?: PluginOptions): AiLiveAssist | undefined;
|
|
7
13
|
export default function aiLiveAssist(options?: PluginOptions): (app: App | null) => AiLiveAssist | undefined;
|
|
8
14
|
export declare function installAiLiveAssist(input: {
|
|
9
15
|
tracker: {
|
package/cjs/index.js
CHANGED
|
@@ -1,30 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VERSION = exports.AiLiveAssist = void 0;
|
|
3
|
+
exports.createLegacyBrowserHost = exports.LiveControlChannel = exports.VERSION = exports.AiLiveAssist = void 0;
|
|
4
|
+
exports.mountAiGuide = mountAiGuide;
|
|
4
5
|
exports.default = aiLiveAssist;
|
|
5
6
|
exports.installAiLiveAssist = installAiLiveAssist;
|
|
6
7
|
const AiLiveAssist_js_1 = require("./AiLiveAssist.js");
|
|
7
8
|
exports.AiLiveAssist = AiLiveAssist_js_1.default;
|
|
9
|
+
const guideHost_js_1 = require("./guideHost.js");
|
|
10
|
+
const guideMount_js_1 = require("./guideMount.js");
|
|
8
11
|
const version_js_1 = require("./version.js");
|
|
9
12
|
Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return version_js_1.VERSION; } });
|
|
10
|
-
|
|
13
|
+
var liveControlChannel_js_1 = require("./liveControlChannel.js");
|
|
14
|
+
Object.defineProperty(exports, "LiveControlChannel", { enumerable: true, get: function () { return liveControlChannel_js_1.LiveControlChannel; } });
|
|
15
|
+
var guideHost_js_2 = require("./guideHost.js");
|
|
16
|
+
Object.defineProperty(exports, "createLegacyBrowserHost", { enumerable: true, get: function () { return guideHost_js_2.createLegacyBrowserHost; } });
|
|
17
|
+
/** Explicit Guide hosts remain gated until signed schema 3 admission is available. */
|
|
18
|
+
function mountAiGuide(host, options = {}) {
|
|
19
|
+
if (options.enabled === false || window.self !== window.top)
|
|
20
|
+
return undefined;
|
|
21
|
+
try {
|
|
22
|
+
const identity = (0, guideHost_js_1.guideMountIdentity)(host, options.siteKey || (host.kind === 'legacy_browser' ? host.siteKey : ''), window.location.origin);
|
|
23
|
+
const existing = (0, guideMount_js_1.mountedGuide)(document, identity);
|
|
24
|
+
return existing ?? new AiLiveAssist_js_1.default(host, options);
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
if (!(error instanceof guideMount_js_1.GuideMountConflictError))
|
|
28
|
+
throw error;
|
|
29
|
+
console.warn(error.message);
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
11
33
|
function aiLiveAssist(options = {}) {
|
|
12
34
|
return function install(app) {
|
|
13
35
|
if (!app || options.enabled === false || app.insideIframe)
|
|
14
36
|
return undefined;
|
|
15
|
-
const existing = installed.get(app);
|
|
16
|
-
if (existing)
|
|
17
|
-
return existing;
|
|
18
|
-
if (document.querySelector('[data-oxvo-ai-live-assist-root]')) {
|
|
19
|
-
return undefined;
|
|
20
|
-
}
|
|
21
37
|
if (!app.checkRequiredVersion?.('7.4.50')) {
|
|
22
38
|
console.warn('OXVO AI Guide requires @oxvo/browser version 7.4.50 or newer.');
|
|
23
39
|
return undefined;
|
|
24
40
|
}
|
|
25
|
-
|
|
26
|
-
installed.set(app, instance);
|
|
27
|
-
return instance;
|
|
41
|
+
return mountAiGuide((0, guideHost_js_1.createLegacyBrowserHost)(app, options), options);
|
|
28
42
|
};
|
|
29
43
|
}
|
|
30
44
|
function installAiLiveAssist(input) {
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export type LiveAudioProcessorEvent = {
|
|
2
|
+
type: 'ready';
|
|
3
|
+
captureEpoch: number;
|
|
4
|
+
sampleRate: number;
|
|
5
|
+
} | {
|
|
6
|
+
type: 'capture_ready';
|
|
7
|
+
captureEpoch: number;
|
|
8
|
+
sourceStart: number;
|
|
9
|
+
} | {
|
|
10
|
+
type: 'wake_buffering';
|
|
11
|
+
captureEpoch: number;
|
|
12
|
+
operationId: string;
|
|
13
|
+
} | {
|
|
14
|
+
type: 'active';
|
|
15
|
+
captureEpoch: number;
|
|
16
|
+
operationId: string;
|
|
17
|
+
} | {
|
|
18
|
+
type: 'retirement_buffering' | 'retirement_complete';
|
|
19
|
+
captureEpoch: number;
|
|
20
|
+
operationId: string;
|
|
21
|
+
} | {
|
|
22
|
+
type: 'capture';
|
|
23
|
+
captureEpoch: number;
|
|
24
|
+
sequence: number;
|
|
25
|
+
sourceSampleOffset: number;
|
|
26
|
+
pcm: Float32Array;
|
|
27
|
+
} | {
|
|
28
|
+
type: 'heartbeat';
|
|
29
|
+
captureEpoch: number;
|
|
30
|
+
sourceEnd: number;
|
|
31
|
+
bufferedFrames: number;
|
|
32
|
+
active: boolean;
|
|
33
|
+
} | {
|
|
34
|
+
type: 'fault';
|
|
35
|
+
captureEpoch: number;
|
|
36
|
+
reason: 'invalid_audio' | 'capture_gap' | 'detector_backpressure' | 'wake_deadline' | 'wake_capacity' | 'processor_failure';
|
|
37
|
+
expectedFrame?: number;
|
|
38
|
+
actualFrame?: number;
|
|
39
|
+
};
|
|
40
|
+
export type LiveAudioProcessorCommand = {
|
|
41
|
+
type: 'begin_wake' | 'activate' | 'begin_retirement' | 'complete_retirement';
|
|
42
|
+
captureEpoch: number;
|
|
43
|
+
operationId: string;
|
|
44
|
+
} | {
|
|
45
|
+
type: 'detector_ack';
|
|
46
|
+
captureEpoch: number;
|
|
47
|
+
sequence: number;
|
|
48
|
+
} | {
|
|
49
|
+
type: 'close' | 'reset';
|
|
50
|
+
captureEpoch: number;
|
|
51
|
+
};
|
|
52
|
+
/** Worklet-safe engine: no network, timers, speech inference or microphone
|
|
53
|
+
* ownership. Detection gets a bounded copy; original-rate audio remains intact.
|
|
54
|
+
* The outside owner alone may begin/activate/reset from current authority proofs.
|
|
55
|
+
*/
|
|
56
|
+
export declare class LiveAudioProcessor {
|
|
57
|
+
readonly sampleRate: number;
|
|
58
|
+
private epoch;
|
|
59
|
+
private readonly emit;
|
|
60
|
+
private queue;
|
|
61
|
+
private phase;
|
|
62
|
+
private deadlineFrame;
|
|
63
|
+
private retiringOperationId;
|
|
64
|
+
private completedRetirementId;
|
|
65
|
+
private history;
|
|
66
|
+
private historyEnd;
|
|
67
|
+
private historySize;
|
|
68
|
+
private expectedFrame;
|
|
69
|
+
private heartbeatFrame;
|
|
70
|
+
private detectorBuffer;
|
|
71
|
+
private detectorSize;
|
|
72
|
+
private detectorStart;
|
|
73
|
+
private detectorSequence;
|
|
74
|
+
private captureEstablished;
|
|
75
|
+
private captureStart;
|
|
76
|
+
private detectorProgressed;
|
|
77
|
+
private detectorInFlight;
|
|
78
|
+
private detectorPending;
|
|
79
|
+
constructor(sampleRate: number, epoch: number, emit: (event: LiveAudioProcessorEvent) => void);
|
|
80
|
+
command(value: unknown, currentFrame: number): boolean;
|
|
81
|
+
/** Exactly one native-rate input/output quantum. A gap cannot become silence. */
|
|
82
|
+
process(input: Float32Array | undefined, output: Float32Array, sourceFrame: number): boolean;
|
|
83
|
+
private captureForDetector;
|
|
84
|
+
/** Keep the most recent 600ms even after it was rendered to the old stream.
|
|
85
|
+
* This fixed ring never grows and is independent of detector scheduling.
|
|
86
|
+
*/
|
|
87
|
+
private remember;
|
|
88
|
+
private historySnapshot;
|
|
89
|
+
private sendDetector;
|
|
90
|
+
private fault;
|
|
91
|
+
private erase;
|
|
92
|
+
}
|