@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,21 @@
|
|
|
1
|
+
import { RuntimeClient } from './client.js';
|
|
2
|
+
import type { GuideIdentity, GuideLaunchIntent } from './guideTypes.js';
|
|
3
|
+
import { GuideSubjectStore } from './guideSubjectStore.js';
|
|
4
|
+
import type { GuideAdmission } from './guideAdmission.js';
|
|
5
|
+
import { LIVE_CONTROL_CLIENT_CAPABILITIES, type LiveControlAuthorization } from './liveControlChannel.js';
|
|
6
|
+
export type LiveGuideLaunchIntent = GuideLaunchIntent & {
|
|
7
|
+
liveCapabilities: typeof LIVE_CONTROL_CLIENT_CAPABILITIES;
|
|
8
|
+
};
|
|
9
|
+
/** Separate protocol owner; shares the existing visitor possession store, never
|
|
10
|
+
* legacy launch/recovery endpoints. Durable pending intent is kept before launch. */
|
|
11
|
+
export declare class LiveGuideAdmission {
|
|
12
|
+
readonly identity: GuideIdentity;
|
|
13
|
+
private readonly store;
|
|
14
|
+
private readonly runtime;
|
|
15
|
+
private readonly legacy?;
|
|
16
|
+
private pendingAdmission;
|
|
17
|
+
constructor(identity: GuideIdentity, store: GuideSubjectStore, runtime: RuntimeClient, legacy?: Pick<GuideAdmission, "endLaunch" | "complete"> | undefined);
|
|
18
|
+
hasPendingLaunch(): boolean;
|
|
19
|
+
launch(intent: LiveGuideLaunchIntent, signal: AbortSignal): Promise<LiveControlAuthorization>;
|
|
20
|
+
end(signal?: AbortSignal): Promise<void>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { GUIDE_SUBJECT_CREDENTIAL_PATTERN, GUIDE_UUID_PATTERN } from './guideTypes.js';
|
|
2
|
+
import { LIVE_CONTROL_CLIENT_CAPABILITIES } from './liveControlChannel.js';
|
|
3
|
+
const unavailable = () => new Error('AI Guide could not secure this conversation.');
|
|
4
|
+
/** Separate protocol owner; shares the existing visitor possession store, never
|
|
5
|
+
* legacy launch/recovery endpoints. Durable pending intent is kept before launch. */
|
|
6
|
+
export class LiveGuideAdmission {
|
|
7
|
+
constructor(identity, store, runtime, legacy) {
|
|
8
|
+
this.identity = identity;
|
|
9
|
+
this.store = store;
|
|
10
|
+
this.runtime = runtime;
|
|
11
|
+
this.legacy = legacy;
|
|
12
|
+
this.pendingAdmission = null;
|
|
13
|
+
}
|
|
14
|
+
hasPendingLaunch() { return this.store.readLaunch() !== null; }
|
|
15
|
+
async launch(intent, signal) {
|
|
16
|
+
if (intent.installKey !== this.identity.installKey || this.store.readLaunch())
|
|
17
|
+
throw unavailable();
|
|
18
|
+
const subject = this.store.readSubject();
|
|
19
|
+
const admission = this.runtime.admitLiveGuide(intent, subject?.credential, signal);
|
|
20
|
+
this.pendingAdmission = admission;
|
|
21
|
+
let subjectId;
|
|
22
|
+
let grant;
|
|
23
|
+
try {
|
|
24
|
+
const result = await admission;
|
|
25
|
+
const required = ['schemaVersion', 'protocolVersion', 'providerProtocol', 'projectId', 'guideId', 'subjectId', 'subjectAuthorityRevision',
|
|
26
|
+
'tabId', 'launchRequestId', 'configRevision', 'configChecksum', 'admissionGrant', 'expiresAt', 'subjectCredentialExpiresAt'];
|
|
27
|
+
if (!result || Object.keys(result).some(key => ![...required, 'subjectCredential'].includes(key)) || required.some(key => !(key in result)) ||
|
|
28
|
+
result.schemaVersion !== 3 || result.protocolVersion !== 2 || result.providerProtocol !== 'live' ||
|
|
29
|
+
result.projectId !== this.identity.projectId || result.guideId !== this.identity.guideId || !GUIDE_UUID_PATTERN.test(result.subjectId) ||
|
|
30
|
+
result.tabId !== intent.tabId || result.launchRequestId !== intent.launchRequestId || result.configRevision !== intent.configRevision ||
|
|
31
|
+
!/^sha256:[a-f0-9]{64}$/.test(result.configChecksum) || !Number.isSafeInteger(result.subjectAuthorityRevision) || result.subjectAuthorityRevision < 0 ||
|
|
32
|
+
typeof result.admissionGrant !== 'string' || !result.admissionGrant.length || result.admissionGrant.length > 4096 ||
|
|
33
|
+
!Number.isFinite(Date.parse(result.expiresAt)) || Date.parse(result.expiresAt) <= Date.now() ||
|
|
34
|
+
!Number.isFinite(Date.parse(result.subjectCredentialExpiresAt)) || Date.parse(result.subjectCredentialExpiresAt) <= Date.now() ||
|
|
35
|
+
(subject && (result.subjectId !== subject.subjectId || result.subjectAuthorityRevision !== subject.subjectAuthorityRevision)))
|
|
36
|
+
throw unavailable();
|
|
37
|
+
const credential = subject?.credential ?? result.subjectCredential;
|
|
38
|
+
if (!credential || !GUIDE_SUBJECT_CREDENTIAL_PATTERN.test(credential))
|
|
39
|
+
throw unavailable();
|
|
40
|
+
this.store.saveSubject({ v: 1, origin: this.store.origin, projectId: this.identity.projectId, guideId: this.identity.guideId,
|
|
41
|
+
subjectId: result.subjectId, subjectAuthorityRevision: result.subjectAuthorityRevision, credential, expiresAt: result.subjectCredentialExpiresAt });
|
|
42
|
+
this.store.saveLaunch({ v: 1, subjectId: result.subjectId, intent, recordingConsent: false });
|
|
43
|
+
subjectId = result.subjectId;
|
|
44
|
+
grant = result.admissionGrant;
|
|
45
|
+
}
|
|
46
|
+
finally {
|
|
47
|
+
if (this.pendingAdmission === admission)
|
|
48
|
+
this.pendingAdmission = null;
|
|
49
|
+
}
|
|
50
|
+
if (signal.aborted)
|
|
51
|
+
throw unavailable();
|
|
52
|
+
const launch = await this.runtime.launchLiveGuide(intent, grant, signal);
|
|
53
|
+
if (launch.projectId !== this.identity.projectId || launch.guideId !== this.identity.guideId ||
|
|
54
|
+
launch.subjectId !== subjectId || launch.launchRequestId !== intent.launchRequestId)
|
|
55
|
+
throw unavailable();
|
|
56
|
+
return launch;
|
|
57
|
+
}
|
|
58
|
+
async end(signal) {
|
|
59
|
+
if (this.pendingAdmission) {
|
|
60
|
+
await this.pendingAdmission.catch(() => undefined);
|
|
61
|
+
await Promise.resolve();
|
|
62
|
+
}
|
|
63
|
+
const record = this.store.readLaunch();
|
|
64
|
+
if (!record)
|
|
65
|
+
return;
|
|
66
|
+
const intent = record.intent;
|
|
67
|
+
// A published model change shares the same visitor store. Retire the exact
|
|
68
|
+
// prior protocol through its authoritative End readback, never discard it
|
|
69
|
+
// or submit a legacy launch to Live endpoints.
|
|
70
|
+
if (!Object.prototype.hasOwnProperty.call(intent, 'liveCapabilities')) {
|
|
71
|
+
if (!this.legacy)
|
|
72
|
+
throw unavailable();
|
|
73
|
+
await this.legacy.endLaunch(record.intent.launchRequestId, record.intent.tabId, signal);
|
|
74
|
+
this.legacy.complete();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (JSON.stringify(intent.liveCapabilities) !== JSON.stringify(LIVE_CONTROL_CLIENT_CAPABILITIES))
|
|
78
|
+
throw unavailable();
|
|
79
|
+
const subject = this.store.readSubject();
|
|
80
|
+
if (!subject || subject.subjectId !== record.subjectId)
|
|
81
|
+
throw unavailable();
|
|
82
|
+
const result = await this.runtime.endLiveGuide({ schemaVersion: 3, installKey: this.identity.installKey,
|
|
83
|
+
subjectCredential: subject.credential, launchRequestId: record.intent.launchRequestId, tabId: record.intent.tabId, action: 'end' }, signal);
|
|
84
|
+
if (Object.keys(result).length !== 5 || result.schemaVersion !== 3 || result.protocolVersion !== 2 || result.providerProtocol !== 'live' ||
|
|
85
|
+
result.status !== 'end_requested' || result.launchRequestId !== record.intent.launchRequestId)
|
|
86
|
+
throw unavailable();
|
|
87
|
+
// This retires the client launch intent only; it does not claim provider or wallet finality.
|
|
88
|
+
this.store.clearLaunch(record.intent.launchRequestId);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { WidgetView, type WidgetViewOptions } from './ui.js';
|
|
2
|
+
import type { AiGuideControllerState, AiGuideOpenInput, BootstrapConfig, PluginOptions } from './types.js';
|
|
3
|
+
import type { GuideAdmission } from './guideAdmission.js';
|
|
4
|
+
import { RuntimeClient } from './client.js';
|
|
5
|
+
type Options = {
|
|
6
|
+
bootstrap: BootstrapConfig;
|
|
7
|
+
admission: GuideAdmission;
|
|
8
|
+
runtime: RuntimeClient;
|
|
9
|
+
tabId: string;
|
|
10
|
+
locale: string;
|
|
11
|
+
messages: PluginOptions['messages'];
|
|
12
|
+
viewOptions: WidgetViewOptions;
|
|
13
|
+
acquire(): boolean;
|
|
14
|
+
release(): void;
|
|
15
|
+
onState(): void;
|
|
16
|
+
};
|
|
17
|
+
/** Actual widget protocol branch. Reuses WidgetView, visitor possession storage,
|
|
18
|
+
* local detector/media and authenticated runtime; never constructs a Realtime
|
|
19
|
+
* transport or grants model/provider authority on the browser's behalf. */
|
|
20
|
+
export declare class LiveGuideWidget {
|
|
21
|
+
private readonly options;
|
|
22
|
+
readonly view: WidgetView;
|
|
23
|
+
private readonly admission;
|
|
24
|
+
private channel;
|
|
25
|
+
private operation;
|
|
26
|
+
private ending;
|
|
27
|
+
private destroyed;
|
|
28
|
+
private active;
|
|
29
|
+
private starting;
|
|
30
|
+
private phase;
|
|
31
|
+
private mode;
|
|
32
|
+
private captureEpoch;
|
|
33
|
+
private capturePrepared;
|
|
34
|
+
private preparing;
|
|
35
|
+
private wakeRequested;
|
|
36
|
+
private speaking;
|
|
37
|
+
private speechAttack;
|
|
38
|
+
private speechRelease;
|
|
39
|
+
private captureSequence;
|
|
40
|
+
private lastCaptureAt;
|
|
41
|
+
private playbackUnknownSince;
|
|
42
|
+
private inputEpoch;
|
|
43
|
+
private backendWorking;
|
|
44
|
+
private scopes;
|
|
45
|
+
private transcriptGroup;
|
|
46
|
+
private pendingQuestions;
|
|
47
|
+
private readonly requestIds;
|
|
48
|
+
private livePhase;
|
|
49
|
+
constructor(options: Options);
|
|
50
|
+
open(input?: AiGuideOpenInput): AiGuideControllerState;
|
|
51
|
+
close(): void;
|
|
52
|
+
getState(): AiGuideControllerState;
|
|
53
|
+
private start;
|
|
54
|
+
private onTranscript;
|
|
55
|
+
private settleTranscriptGroup;
|
|
56
|
+
private prepareVoice;
|
|
57
|
+
private toVoice;
|
|
58
|
+
private capture;
|
|
59
|
+
private onControlState;
|
|
60
|
+
private submitText;
|
|
61
|
+
private stop;
|
|
62
|
+
private privacy;
|
|
63
|
+
private toText;
|
|
64
|
+
private pagehide;
|
|
65
|
+
end(): Promise<void>;
|
|
66
|
+
destroy(): void;
|
|
67
|
+
}
|
|
68
|
+
export {};
|
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
import { WidgetView } from './ui.js';
|
|
2
|
+
import { LiveGuideAdmission } from './liveGuideAdmission.js';
|
|
3
|
+
import { LiveControlChannel, LIVE_CONTROL_CLIENT_VERSION, LIVE_CONTROL_CLIENT_CAPABILITIES } from './liveControlChannel.js';
|
|
4
|
+
import { createLiveBrowserDetector, validateLiveBrowserAssets } from './liveBrowserDetector.js';
|
|
5
|
+
const transcriptGroupLimit = 16000;
|
|
6
|
+
/** Actual widget protocol branch. Reuses WidgetView, visitor possession storage,
|
|
7
|
+
* local detector/media and authenticated runtime; never constructs a Realtime
|
|
8
|
+
* transport or grants model/provider authority on the browser's behalf. */
|
|
9
|
+
export class LiveGuideWidget {
|
|
10
|
+
constructor(options) {
|
|
11
|
+
this.options = options;
|
|
12
|
+
this.channel = null;
|
|
13
|
+
this.operation = null;
|
|
14
|
+
this.ending = null;
|
|
15
|
+
this.destroyed = false;
|
|
16
|
+
this.active = false;
|
|
17
|
+
this.starting = false;
|
|
18
|
+
this.phase = 'ready';
|
|
19
|
+
this.mode = 'text';
|
|
20
|
+
this.captureEpoch = 0;
|
|
21
|
+
this.capturePrepared = false;
|
|
22
|
+
this.preparing = false;
|
|
23
|
+
this.wakeRequested = false;
|
|
24
|
+
this.speaking = false;
|
|
25
|
+
this.speechAttack = 0;
|
|
26
|
+
this.speechRelease = 0;
|
|
27
|
+
this.captureSequence = 0;
|
|
28
|
+
this.lastCaptureAt = -Infinity;
|
|
29
|
+
this.playbackUnknownSince = null;
|
|
30
|
+
this.inputEpoch = 0;
|
|
31
|
+
this.backendWorking = false;
|
|
32
|
+
this.scopes = [];
|
|
33
|
+
this.transcriptGroup = null;
|
|
34
|
+
this.pendingQuestions = [];
|
|
35
|
+
this.requestIds = new Set();
|
|
36
|
+
this.livePhase = 'voice_off';
|
|
37
|
+
this.pagehide = () => { void this.end().catch(() => undefined); };
|
|
38
|
+
const config = options.bootstrap;
|
|
39
|
+
if (config.providerProtocol !== 'live' || config.providerModel !== 'gpt-live-1' || !config.liveAssets ||
|
|
40
|
+
JSON.stringify(config.liveCapabilities) !== JSON.stringify(LIVE_CONTROL_CLIENT_CAPABILITIES))
|
|
41
|
+
throw new Error('AI Guide Live is unavailable.');
|
|
42
|
+
validateLiveBrowserAssets(config.liveAssets);
|
|
43
|
+
this.admission = new LiveGuideAdmission(options.admission.identity, options.admission.store, options.runtime, options.admission);
|
|
44
|
+
const callbacks = {
|
|
45
|
+
onStart: (mode, scopes, question) => this.start(mode, scopes, question),
|
|
46
|
+
onRestart: () => !this.active && !this.starting && !this.ending && !this.admission.hasPendingLaunch(),
|
|
47
|
+
onEnd: () => { void this.end().catch(() => undefined); },
|
|
48
|
+
onMute: muted => { if (muted)
|
|
49
|
+
this.privacy('mute');
|
|
50
|
+
else
|
|
51
|
+
void this.prepareVoice(); },
|
|
52
|
+
onInterrupt: () => this.stop(),
|
|
53
|
+
onVoiceTurnMode: () => { this.view.setManualTurn(false); },
|
|
54
|
+
onPushToTalk: active => { if (active)
|
|
55
|
+
void this.prepareVoice(); },
|
|
56
|
+
onPause: paused => { if (paused)
|
|
57
|
+
this.privacy('pause');
|
|
58
|
+
else
|
|
59
|
+
void this.prepareVoice(); },
|
|
60
|
+
onCaptions: () => undefined,
|
|
61
|
+
onTextOnly: () => this.toText(), onModeChange: mode => { if (mode === 'text')
|
|
62
|
+
this.toText();
|
|
63
|
+
else
|
|
64
|
+
void this.toVoice(); },
|
|
65
|
+
onText: text => this.submitText(text),
|
|
66
|
+
onHuman: () => this.view.setStatus(this.view.message('humanUnavailable')),
|
|
67
|
+
onConfirmation: () => this.view.setStatus(this.view.message('error')),
|
|
68
|
+
onVisualContext: () => this.view.setStatus(this.view.message('error')),
|
|
69
|
+
onVisualPause: () => undefined,
|
|
70
|
+
onFeedback: () => undefined,
|
|
71
|
+
onRetry: () => { if (this.active)
|
|
72
|
+
void this.prepareVoice();
|
|
73
|
+
else
|
|
74
|
+
void this.end().catch(() => undefined); },
|
|
75
|
+
onPlaybackState: value => { if (this.active && value.audible)
|
|
76
|
+
this.view.setAssistantState('speaking'); },
|
|
77
|
+
onOpenChange: () => options.onState(),
|
|
78
|
+
};
|
|
79
|
+
this.view = new WidgetView(config, options.messages ?? {}, callbacks, {
|
|
80
|
+
...options.viewOptions, preserveRawText: true, manualTurnsSupported: false,
|
|
81
|
+
});
|
|
82
|
+
if (this.admission.hasPendingLaunch()) {
|
|
83
|
+
this.phase = 'ending';
|
|
84
|
+
this.view.showEndingDetached();
|
|
85
|
+
void this.end().catch(() => undefined);
|
|
86
|
+
}
|
|
87
|
+
window.addEventListener('pagehide', this.pagehide);
|
|
88
|
+
}
|
|
89
|
+
open(input = {}) {
|
|
90
|
+
if (input.requestId && this.requestIds.has(input.requestId))
|
|
91
|
+
return this.getState();
|
|
92
|
+
if (input.question && !this.active && this.pendingQuestions.length >= 8)
|
|
93
|
+
throw new Error('AI Guide is still preparing your previous questions.');
|
|
94
|
+
if (input.requestId) {
|
|
95
|
+
this.requestIds.add(input.requestId);
|
|
96
|
+
if (this.requestIds.size > 100)
|
|
97
|
+
this.requestIds.delete(this.requestIds.values().next().value);
|
|
98
|
+
}
|
|
99
|
+
this.view.open(input.mode ?? this.mode);
|
|
100
|
+
if (input.question) {
|
|
101
|
+
if (this.active)
|
|
102
|
+
this.submitText(input.question, true);
|
|
103
|
+
else
|
|
104
|
+
this.pendingQuestions.push(input.question);
|
|
105
|
+
}
|
|
106
|
+
return this.getState();
|
|
107
|
+
}
|
|
108
|
+
close() { this.view.close(); this.options.onState(); }
|
|
109
|
+
getState() {
|
|
110
|
+
return { ready: true, available: !this.destroyed, open: this.view.isOpen,
|
|
111
|
+
active: this.active || this.starting, mode: this.active || this.starting ? this.mode : null, phase: this.phase,
|
|
112
|
+
companion: false, pendingQuestion: this.pendingQuestions.length > 0 };
|
|
113
|
+
}
|
|
114
|
+
start(mode, scopes, question) {
|
|
115
|
+
if (this.destroyed || this.starting || this.active || this.ending || this.admission.hasPendingLaunch() || !this.options.acquire())
|
|
116
|
+
return false;
|
|
117
|
+
if (question && (!question.trim() || question.length > 4000)) {
|
|
118
|
+
this.options.release();
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
this.mode = mode;
|
|
122
|
+
this.scopes = [...scopes];
|
|
123
|
+
this.starting = true;
|
|
124
|
+
this.phase = 'connecting';
|
|
125
|
+
const operation = new AbortController();
|
|
126
|
+
this.operation = operation;
|
|
127
|
+
const timeout = setTimeout(() => operation.abort(), 20000);
|
|
128
|
+
const config = this.options.bootstrap;
|
|
129
|
+
const intent = { schemaVersion: 3, protocolVersion: 2, installKey: this.options.admission.identity.installKey,
|
|
130
|
+
launchRequestId: crypto.randomUUID(), clientVersion: LIVE_CONTROL_CLIENT_VERSION, liveCapabilities: LIVE_CONTROL_CLIENT_CAPABILITIES,
|
|
131
|
+
configRevision: config.configRevision, path: location.pathname, tabId: this.options.tabId, mode, experienceMode: 'standard',
|
|
132
|
+
consent: { disclosureChecksum: config.consent.disclosureChecksum, scopes: [...scopes], locale: this.options.locale },
|
|
133
|
+
capabilitySummary: { ctaOffer: false, microphone: mode === 'voice' && scopes.includes('microphone'),
|
|
134
|
+
webrtc: typeof RTCPeerConnection !== 'undefined', audioPlayback: typeof HTMLAudioElement !== 'undefined', webAudio: typeof AudioContext !== 'undefined',
|
|
135
|
+
svgOverlay: false, visualViewport: typeof visualViewport !== 'undefined', reducedMotion: matchMedia('(prefers-reduced-motion: reduce)').matches, lowPower: false } };
|
|
136
|
+
// Start after the view has committed its connecting presentation. This does
|
|
137
|
+
// not manufacture activation: prepareVoice tests the current real gesture.
|
|
138
|
+
queueMicrotask(() => {
|
|
139
|
+
void (async () => {
|
|
140
|
+
try {
|
|
141
|
+
const authorization = await this.admission.launch(intent, operation.signal);
|
|
142
|
+
if (operation.signal.aborted || this.destroyed || this.operation !== operation)
|
|
143
|
+
throw new Error('Cancelled.');
|
|
144
|
+
const audio = this.view.livePlaybackElement();
|
|
145
|
+
const channel = new LiveControlChannel({ authorization, trustedRuntimeOrigin: new URL(this.options.runtime.baseUrl).origin,
|
|
146
|
+
tabId: this.options.tabId, onState: state => this.onControlState(state),
|
|
147
|
+
onClose: reason => {
|
|
148
|
+
if (this.channel === channel && !this.ending && !this.destroyed) {
|
|
149
|
+
this.active = false;
|
|
150
|
+
this.capturePrepared = false;
|
|
151
|
+
this.phase = reason === 'ended' ? 'ended' : 'error';
|
|
152
|
+
this.view.showError(this.view.message('error'), true);
|
|
153
|
+
this.options.onState();
|
|
154
|
+
void this.end().catch(() => undefined);
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
onTextAnswer: value => {
|
|
158
|
+
this.backendWorking = false;
|
|
159
|
+
this.view.addCaption('assistant', value.text, true);
|
|
160
|
+
this.view.setAssistantState('ready');
|
|
161
|
+
},
|
|
162
|
+
onTaskState: value => {
|
|
163
|
+
this.backendWorking = value.status === 'working';
|
|
164
|
+
if (value.status === 'working')
|
|
165
|
+
this.view.setAssistantState('thinking');
|
|
166
|
+
else if (value.status === 'fresh_task_required') {
|
|
167
|
+
this.view.setAssistantState('ready');
|
|
168
|
+
this.view.setStatus(this.view.message('taskContextLimit'));
|
|
169
|
+
}
|
|
170
|
+
else if (value.status === 'failed' || value.status === 'blocked')
|
|
171
|
+
this.view.setStatus(this.view.message('error'));
|
|
172
|
+
else
|
|
173
|
+
this.view.setAssistantState('ready');
|
|
174
|
+
},
|
|
175
|
+
onTranscript: value => this.onTranscript(value),
|
|
176
|
+
onRepeatAfterReady: () => this.view.setStatus(this.view.message('repeatWhenMicrophoneReady')),
|
|
177
|
+
media: { audioElement: audio, workletUrl: config.liveAssets.audioWorkletUrl, dataChannelLabel: 'oai-events',
|
|
178
|
+
dependencies: { now: () => performance.now(), schedule: (callback, ms) => setTimeout(callback, ms), cancel: timer => clearTimeout(timer),
|
|
179
|
+
hasUserActivation: () => navigator.userActivation?.isActive === true, isForeground: () => document.visibilityState === 'visible',
|
|
180
|
+
lifecycleEvents: document, getUserMedia: constraints => navigator.mediaDevices.getUserMedia(constraints),
|
|
181
|
+
createAudioContext: () => new AudioContext(), createWorklet: (context, options) => new AudioWorkletNode(context, 'oxvo-live-audio-v1', options),
|
|
182
|
+
createPeerConnection: () => new RTCPeerConnection({ iceServers: [] }), createMediaStream: tracks => new MediaStream(tracks),
|
|
183
|
+
createDetector: input => createLiveBrowserDetector({ ...input, assets: config.liveAssets, onResult: value => this.capture(value) }),
|
|
184
|
+
isPlaybackDrained: (_binding, element) => element === audio && this.view.livePlaybackDrained(), } },
|
|
185
|
+
});
|
|
186
|
+
this.channel = channel;
|
|
187
|
+
await channel.connect(operation.signal);
|
|
188
|
+
if (this.destroyed || operation.signal.aborted)
|
|
189
|
+
throw new Error('Cancelled.');
|
|
190
|
+
this.starting = false;
|
|
191
|
+
this.active = true;
|
|
192
|
+
this.phase = 'active';
|
|
193
|
+
this.view.showActive(null);
|
|
194
|
+
this.view.configureVoiceControls(mode === 'voice', false, true);
|
|
195
|
+
if (question)
|
|
196
|
+
this.submitText(question, true);
|
|
197
|
+
for (const pending of this.pendingQuestions.splice(0))
|
|
198
|
+
this.submitText(pending, true);
|
|
199
|
+
if (mode === 'voice')
|
|
200
|
+
await this.prepareVoice();
|
|
201
|
+
this.options.onState();
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
if (!this.destroyed && !this.ending) {
|
|
205
|
+
this.starting = false;
|
|
206
|
+
this.phase = 'error';
|
|
207
|
+
this.view.showError(this.view.message('error'), true);
|
|
208
|
+
this.options.onState();
|
|
209
|
+
void this.end().catch(() => undefined);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
finally {
|
|
213
|
+
clearTimeout(timeout);
|
|
214
|
+
}
|
|
215
|
+
})();
|
|
216
|
+
});
|
|
217
|
+
return true;
|
|
218
|
+
}
|
|
219
|
+
onTranscript(value) {
|
|
220
|
+
if (!value.text)
|
|
221
|
+
return;
|
|
222
|
+
if (this.transcriptGroup && (this.transcriptGroup.streamId !== value.streamId || this.transcriptGroup.role !== value.role)) {
|
|
223
|
+
this.settleTranscriptGroup();
|
|
224
|
+
}
|
|
225
|
+
let offset = 0;
|
|
226
|
+
while (offset < value.text.length) {
|
|
227
|
+
const group = this.transcriptGroup ?? (this.transcriptGroup = { streamId: value.streamId, role: value.role, text: '' });
|
|
228
|
+
let end = Math.min(value.text.length, offset + transcriptGroupLimit - group.text.length);
|
|
229
|
+
// The bound creates display groups, not utterances. Keep every code unit
|
|
230
|
+
// and avoid splitting a surrogate pair at this rendering-only boundary.
|
|
231
|
+
if (end < value.text.length && /[\uD800-\uDBFF]/u.test(value.text[end - 1] ?? '') &&
|
|
232
|
+
/[\uDC00-\uDFFF]/u.test(value.text[end] ?? ''))
|
|
233
|
+
end--;
|
|
234
|
+
if (end === offset) {
|
|
235
|
+
this.settleTranscriptGroup();
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
group.text += value.text.slice(offset, end);
|
|
239
|
+
offset = end;
|
|
240
|
+
this.view.addCaption(group.role, group.text, false, { liveFragmentGroup: true });
|
|
241
|
+
if (group.text.length === transcriptGroupLimit || offset < value.text.length)
|
|
242
|
+
this.settleTranscriptGroup();
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
settleTranscriptGroup() {
|
|
246
|
+
const group = this.transcriptGroup;
|
|
247
|
+
this.transcriptGroup = null;
|
|
248
|
+
// "final" settles a render group only. Live fragments do not establish a
|
|
249
|
+
// complete user turn, provider utterance boundary, or playback receipt.
|
|
250
|
+
if (group)
|
|
251
|
+
this.view.addCaption(group.role, group.text, true, { liveFragmentGroup: true });
|
|
252
|
+
}
|
|
253
|
+
async prepareVoice() {
|
|
254
|
+
if (!this.channel || !this.operation || !this.active || this.preparing)
|
|
255
|
+
return;
|
|
256
|
+
if (!this.scopes.includes('microphone')) {
|
|
257
|
+
this.view.setModeTransitionPending(null);
|
|
258
|
+
this.view.setStatus(this.view.message('voiceConsentRequired'));
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
this.mode = 'voice';
|
|
262
|
+
this.view.configureVoiceControls(true, false, true);
|
|
263
|
+
if (this.capturePrepared) {
|
|
264
|
+
this.view.setMuted(false);
|
|
265
|
+
this.view.setPaused(false);
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
if (navigator.userActivation?.isActive !== true) {
|
|
269
|
+
this.view.setMuted(true);
|
|
270
|
+
this.view.setModeTransitionPending(null);
|
|
271
|
+
this.view.setStatus(this.view.message('startVoiceHint'));
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
this.preparing = true;
|
|
275
|
+
try {
|
|
276
|
+
await this.channel.prepareVoice({ captureEpoch: this.captureEpoch, operationId: crypto.randomUUID(),
|
|
277
|
+
requestInitialGreeting: true, playbackAuthorized: true, signal: this.operation.signal });
|
|
278
|
+
this.capturePrepared = true;
|
|
279
|
+
this.wakeRequested = false;
|
|
280
|
+
this.captureSequence = 0;
|
|
281
|
+
this.lastCaptureAt = -Infinity;
|
|
282
|
+
this.view.setModeTransitionPending(null);
|
|
283
|
+
this.view.setMuted(false);
|
|
284
|
+
this.view.setPaused(false);
|
|
285
|
+
this.view.setStatus(this.view.message('ready'));
|
|
286
|
+
}
|
|
287
|
+
catch {
|
|
288
|
+
this.capturePrepared = false;
|
|
289
|
+
this.view.setMuted(true);
|
|
290
|
+
this.view.setModeTransitionPending(null);
|
|
291
|
+
this.view.setStatus(this.view.message('voiceUnavailable'));
|
|
292
|
+
}
|
|
293
|
+
finally {
|
|
294
|
+
this.preparing = false;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
async toVoice() {
|
|
298
|
+
if (!this.active || this.starting || this.ending)
|
|
299
|
+
return;
|
|
300
|
+
if (this.scopes.includes('microphone')) {
|
|
301
|
+
await this.prepareVoice();
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
// Voice selection is a new explicit consent intent. Without a server-owned
|
|
305
|
+
// consent-upgrade protocol, close the old logical owner before fresh launch.
|
|
306
|
+
const scopes = [...this.scopes, 'microphone'];
|
|
307
|
+
try {
|
|
308
|
+
await this.end();
|
|
309
|
+
if (this.destroyed)
|
|
310
|
+
return;
|
|
311
|
+
if (this.start('voice', scopes))
|
|
312
|
+
this.view.showConnecting(false, 'voice');
|
|
313
|
+
}
|
|
314
|
+
catch {
|
|
315
|
+
this.view.setModeTransitionPending(null);
|
|
316
|
+
this.view.setStatus(this.view.message('error'));
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
capture(result) {
|
|
320
|
+
if (!this.channel || !this.capturePrepared || result.epoch !== this.captureEpoch || !this.active)
|
|
321
|
+
return;
|
|
322
|
+
if (result.probability >= 0.6) {
|
|
323
|
+
this.speechAttack++;
|
|
324
|
+
this.speechRelease = 0;
|
|
325
|
+
}
|
|
326
|
+
else if (result.probability < 0.3) {
|
|
327
|
+
this.speechRelease++;
|
|
328
|
+
this.speechAttack = 0;
|
|
329
|
+
}
|
|
330
|
+
if (this.speechAttack >= 2)
|
|
331
|
+
this.speaking = true;
|
|
332
|
+
if (this.speechRelease >= 8)
|
|
333
|
+
this.speaking = false;
|
|
334
|
+
const now = performance.now();
|
|
335
|
+
if (now - this.lastCaptureAt >= 250) {
|
|
336
|
+
this.lastCaptureAt = now;
|
|
337
|
+
const playing = this.view.livePlaybackActivity();
|
|
338
|
+
if (playing === null) {
|
|
339
|
+
this.playbackUnknownSince ?? (this.playbackUnknownSince = now);
|
|
340
|
+
if (now - this.playbackUnknownSince >= 2000) {
|
|
341
|
+
this.capturePrepared = false;
|
|
342
|
+
this.channel.fence('audio_suspended');
|
|
343
|
+
this.view.setMuted(true);
|
|
344
|
+
this.view.setStatus(this.view.message('audioMonitoringPaused'));
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
else
|
|
349
|
+
this.playbackUnknownSince = null;
|
|
350
|
+
if (playing !== null && ['active', 'tentative_idle'].includes(this.livePhase)) {
|
|
351
|
+
this.view.setAssistantState(playing ? 'speaking' : this.backendWorking ? 'thinking' : 'listening');
|
|
352
|
+
}
|
|
353
|
+
this.channel.reportCapture({ captureEpoch: result.epoch, sequence: ++this.captureSequence, speaking: this.speaking,
|
|
354
|
+
playing: playing ?? true });
|
|
355
|
+
}
|
|
356
|
+
if (this.speaking && !this.wakeRequested && ['local_listening', 'closing'].includes(this.livePhase)) {
|
|
357
|
+
try {
|
|
358
|
+
this.channel.wake({ operationId: crypto.randomUUID(), captureEpoch: result.epoch, reason: 'speech', bufferedMs: 0 });
|
|
359
|
+
this.wakeRequested = true;
|
|
360
|
+
}
|
|
361
|
+
catch { /* The exact retiring owner/epoch may not be ready yet; next real observation retries. */ }
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
onControlState(state) {
|
|
365
|
+
if (this.livePhase !== state.phase && state.phase === 'local_listening')
|
|
366
|
+
this.wakeRequested = false;
|
|
367
|
+
this.livePhase = state.phase;
|
|
368
|
+
this.captureEpoch = state.captureEpoch;
|
|
369
|
+
if (state.requiresUserGesture) {
|
|
370
|
+
this.capturePrepared = false;
|
|
371
|
+
if (this.mode === 'voice')
|
|
372
|
+
this.view.setMuted(true);
|
|
373
|
+
}
|
|
374
|
+
if (['starting', 'wake_buffering'].includes(state.phase))
|
|
375
|
+
this.view.setAssistantState('thinking');
|
|
376
|
+
else if (['local_listening', 'active', 'tentative_idle'].includes(state.phase))
|
|
377
|
+
this.view.setAssistantState('listening');
|
|
378
|
+
else if (['muted', 'suspended', 'voice_off'].includes(state.phase))
|
|
379
|
+
this.view.setAssistantState('ready');
|
|
380
|
+
this.options.onState();
|
|
381
|
+
}
|
|
382
|
+
submitText(text, echo = false) {
|
|
383
|
+
if (!this.channel || !this.active || !text.trim() || text.length > 4000)
|
|
384
|
+
return false;
|
|
385
|
+
try {
|
|
386
|
+
this.channel.submitText({ inputId: crypto.randomUUID(), inputEpoch: ++this.inputEpoch, text });
|
|
387
|
+
if (echo)
|
|
388
|
+
this.view.addCaption('user', text, true);
|
|
389
|
+
this.view.setAssistantState('thinking');
|
|
390
|
+
return true;
|
|
391
|
+
}
|
|
392
|
+
catch {
|
|
393
|
+
this.view.setStatus(this.view.message('error'));
|
|
394
|
+
return false;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
stop() { this.inputEpoch++; this.channel?.stop(); this.wakeRequested = false; this.view.interruptPlayback(); }
|
|
398
|
+
privacy(reason) {
|
|
399
|
+
this.inputEpoch++;
|
|
400
|
+
this.capturePrepared = false;
|
|
401
|
+
this.wakeRequested = false;
|
|
402
|
+
this.channel?.fence(reason);
|
|
403
|
+
}
|
|
404
|
+
toText() {
|
|
405
|
+
this.privacy('mode_change');
|
|
406
|
+
this.mode = 'text';
|
|
407
|
+
this.view.configureVoiceControls(false, false, false);
|
|
408
|
+
this.view.setModeTransitionPending(null);
|
|
409
|
+
this.options.onState();
|
|
410
|
+
}
|
|
411
|
+
end() {
|
|
412
|
+
if (this.ending)
|
|
413
|
+
return this.ending;
|
|
414
|
+
this.active = false;
|
|
415
|
+
this.starting = false;
|
|
416
|
+
this.capturePrepared = false;
|
|
417
|
+
this.pendingQuestions = [];
|
|
418
|
+
this.phase = 'ending';
|
|
419
|
+
const channel = this.channel;
|
|
420
|
+
this.channel = null;
|
|
421
|
+
channel?.end();
|
|
422
|
+
this.operation?.abort();
|
|
423
|
+
this.operation = null;
|
|
424
|
+
if (!this.destroyed)
|
|
425
|
+
this.view.showEndingDetached();
|
|
426
|
+
const pending = this.admission.end().then(() => {
|
|
427
|
+
this.phase = 'ended';
|
|
428
|
+
this.options.release();
|
|
429
|
+
if (!this.destroyed)
|
|
430
|
+
this.view.showResumeStopped();
|
|
431
|
+
this.options.onState();
|
|
432
|
+
}).catch(error => { this.phase = 'error'; if (!this.destroyed)
|
|
433
|
+
this.view.showError(this.view.message('error'), true); throw error; })
|
|
434
|
+
.finally(() => { if (this.ending === pending)
|
|
435
|
+
this.ending = null; });
|
|
436
|
+
this.ending = pending;
|
|
437
|
+
return pending;
|
|
438
|
+
}
|
|
439
|
+
destroy() {
|
|
440
|
+
if (this.destroyed)
|
|
441
|
+
return;
|
|
442
|
+
this.destroyed = true;
|
|
443
|
+
window.removeEventListener('pagehide', this.pagehide);
|
|
444
|
+
void this.end().catch(() => undefined);
|
|
445
|
+
this.view.destroy();
|
|
446
|
+
}
|
|
447
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** Immutable qualification manifest. Not loaded by the existing widget entrypoint. */
|
|
2
|
+
export declare const LIVE_SPEECH_ASSETS: Readonly<{
|
|
3
|
+
model: Readonly<{
|
|
4
|
+
name: "silero_vad_v5.onnx";
|
|
5
|
+
bytes: 2327524;
|
|
6
|
+
sha256: "2623a2953f6ff3d2c1e61740c6cdb7168133479b267dfef114a4a3cc5bdd788f";
|
|
7
|
+
source: "https://cdn.jsdelivr.net/npm/@ricky0123/vad-web@0.0.30/dist/silero_vad_v5.onnx";
|
|
8
|
+
}>;
|
|
9
|
+
runtime: Readonly<{
|
|
10
|
+
name: "ort.wasm.min.mjs";
|
|
11
|
+
bytes: 48259;
|
|
12
|
+
sha256: "6ef726f355b791129f7ddf3f62e7877a16b9b777abe87004b8ab306e6b9cf265";
|
|
13
|
+
source: "https://cdn.jsdelivr.net/npm/onnxruntime-web@1.22.0/dist/ort.wasm.min.mjs";
|
|
14
|
+
}>;
|
|
15
|
+
glue: Readonly<{
|
|
16
|
+
name: "ort-wasm-simd-threaded.mjs";
|
|
17
|
+
bytes: 20856;
|
|
18
|
+
sha256: "30dd851d9c00622940500f71ddd2ff8820c5cb65270816080175b958705385a8";
|
|
19
|
+
source: "https://cdn.jsdelivr.net/npm/onnxruntime-web@1.22.0/dist/ort-wasm-simd-threaded.mjs";
|
|
20
|
+
}>;
|
|
21
|
+
wasm: Readonly<{
|
|
22
|
+
name: "ort-wasm-simd-threaded.wasm";
|
|
23
|
+
bytes: 11210254;
|
|
24
|
+
sha256: "71aef04959c5c1b6de461b6538e2058e306610034a85aad2742d0c7fd4533fe4";
|
|
25
|
+
source: "https://cdn.jsdelivr.net/npm/onnxruntime-web@1.22.0/dist/ort-wasm-simd-threaded.wasm";
|
|
26
|
+
}>;
|
|
27
|
+
}>;
|
|
28
|
+
export type LiveSpeechAssetName = keyof typeof LIVE_SPEECH_ASSETS;
|
|
29
|
+
/** Verify before importing code/creating a model; callers control self-hosted URLs and CSP. */
|
|
30
|
+
export declare function verifyLiveSpeechAsset(name: LiveSpeechAssetName, bytes: Uint8Array, digest: (input: Uint8Array) => Promise<string>): Promise<void>;
|
|
31
|
+
export declare const LIVE_SPEECH_LICENSE_SOURCES: readonly {
|
|
32
|
+
name: string;
|
|
33
|
+
bytes: number;
|
|
34
|
+
sha256: string;
|
|
35
|
+
source: string;
|
|
36
|
+
}[];
|