@karlorz/codexhost-cli-linux-x64 0.22.0-0 → 0.22.0-2
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/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-web.js +1 -1
- package/app/cpa-live-voice-hook.js +1 -1
- package/app/desktop-controller.mjs +502 -186
- package/app/host-runtime.mjs +389 -127
- package/app/overlay-voice-bootstrap.js +1 -1
- package/app/renderer-extension.js +1 -1
- package/app/voice-qualification.json +10 -10
- package/app/web/codexhost-settings.js +1 -1
- package/app/web-modules/server.mjs +268 -97
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
|
@@ -80544,7 +80544,7 @@ function rendererVoiceHostDocumentGuardExpression() {
|
|
|
80544
80544
|
}
|
|
80545
80545
|
|
|
80546
80546
|
// packages/desktop-control/dist/renderer-voice-host-binding.js
|
|
80547
|
-
var RENDERER_VOICE_HOST_BINDING_NAME = "__codexhostVoiceHostBindingV1", RENDERER_VOICE_HOST_CAPABILITY_GLOBAL = "__codexhostVoiceHostV1", RENDERER_VOICE_HOST_DELIVER_GLOBAL = "__codexhostVoiceHostDeliverV1", RENDERER_VOICE_HOST_PENDING_GLOBAL = "__codexhostVoiceHostPendingV1", RENDERER_VOICE_HOST_MAX_PAYLOAD_BYTES = 256 * 1024, RENDERER_VOICE_HOST_SETTINGS_TIMEOUT_MS = 1e4, RENDERER_VOICE_HOST_GATEWAY_TIMEOUT_MS = 2e3, RENDERER_VOICE_HOST_REALTIME_TIMEOUT_MS = 3e4, RENDERER_VOICE_HOST_METHODS = [
|
|
80547
|
+
var RENDERER_VOICE_HOST_BINDING_NAME = "__codexhostVoiceHostBindingV1", RENDERER_VOICE_HOST_CAPABILITY_GLOBAL = "__codexhostVoiceHostV1", RENDERER_VOICE_HOST_DELIVER_GLOBAL = "__codexhostVoiceHostDeliverV1", RENDERER_VOICE_HOST_PENDING_GLOBAL = "__codexhostVoiceHostPendingV1", RENDERER_VOICE_HOST_MAX_PAYLOAD_BYTES = 256 * 1024, RENDERER_VOICE_HOST_SETTINGS_TIMEOUT_MS = 1e4, RENDERER_VOICE_HOST_GATEWAY_TIMEOUT_MS = 2e3, RENDERER_VOICE_HOST_REALTIME_TIMEOUT_MS = 3e4, RENDERER_VOICE_HOST_PUBLISH_RETRY_MS = 1e3, RENDERER_VOICE_HOST_METHODS = [
|
|
80548
80548
|
VOICE_SETTINGS_METHOD,
|
|
80549
80549
|
VOICE_GATEWAY_STATUS_METHOD,
|
|
80550
80550
|
REALTIME_CALL_METHOD
|
|
@@ -80562,7 +80562,7 @@ function cleanupUnconfirmedError(error51) {
|
|
|
80562
80562
|
if (error51 instanceof Error && error51.message === RENDERER_VOICE_HOST_CLEANUP_UNCONFIRMED && allowlistedStage(Reflect.get(error51, "stage")) === "cancel")
|
|
80563
80563
|
return error51;
|
|
80564
80564
|
}
|
|
80565
|
-
function rendererVoiceHostCapabilitySource(owner, generation) {
|
|
80565
|
+
function rendererVoiceHostCapabilitySource(owner, generation, instanceId = "", installationOrder = 0, publisherId2 = "") {
|
|
80566
80566
|
let guard = rendererVoiceHostDocumentGuardExpression();
|
|
80567
80567
|
return `(() => {
|
|
80568
80568
|
if (!${guard}) return true;
|
|
@@ -80574,6 +80574,9 @@ function rendererVoiceHostCapabilitySource(owner, generation) {
|
|
|
80574
80574
|
const maxBytes = ${RENDERER_VOICE_HOST_MAX_PAYLOAD_BYTES};
|
|
80575
80575
|
const ownerId = ${JSON.stringify(owner)};
|
|
80576
80576
|
const generation = ${generation};
|
|
80577
|
+
const instance = ${JSON.stringify(instanceId)};
|
|
80578
|
+
const order = ${installationOrder};
|
|
80579
|
+
const publisher = ${JSON.stringify(publisherId2)};
|
|
80577
80580
|
const settingsTimeout = ${RENDERER_VOICE_HOST_SETTINGS_TIMEOUT_MS};
|
|
80578
80581
|
const gatewayTimeout = ${RENDERER_VOICE_HOST_GATEWAY_TIMEOUT_MS};
|
|
80579
80582
|
const realtimeTimeout = ${RENDERER_VOICE_HOST_REALTIME_TIMEOUT_MS};
|
|
@@ -80591,6 +80594,8 @@ function rendererVoiceHostCapabilitySource(owner, generation) {
|
|
|
80591
80594
|
}
|
|
80592
80595
|
};
|
|
80593
80596
|
const previous = globalThis[cap];
|
|
80597
|
+
// A publish that outlived its installation must leave a newer installation's state intact.
|
|
80598
|
+
if (previous && previous.publisher === publisher && typeof previous.order === "number" && previous.order > order) return true;
|
|
80594
80599
|
if (previous && previous.generation !== generation) settleAll(${JSON.stringify(UNAVAILABLE)});
|
|
80595
80600
|
globalThis[deliver] = (message) => {
|
|
80596
80601
|
if (!message || typeof message !== "object" || typeof message.id !== "string") return;
|
|
@@ -80615,6 +80620,9 @@ function rendererVoiceHostCapabilitySource(owner, generation) {
|
|
|
80615
80620
|
value: Object.freeze({
|
|
80616
80621
|
owner: ownerId,
|
|
80617
80622
|
generation,
|
|
80623
|
+
instance,
|
|
80624
|
+
order,
|
|
80625
|
+
publisher,
|
|
80618
80626
|
request(method, params) {
|
|
80619
80627
|
try {
|
|
80620
80628
|
if (!${guard}) return unavailable();
|
|
@@ -80646,7 +80654,7 @@ function rendererVoiceHostCapabilitySource(owner, generation) {
|
|
|
80646
80654
|
} catch (e) {}
|
|
80647
80655
|
reject(new Error(${JSON.stringify(UNAVAILABLE)}));
|
|
80648
80656
|
}, timeoutMs);
|
|
80649
|
-
pending.set(id, { resolve, reject, timer, generation });
|
|
80657
|
+
pending.set(id, { resolve, reject, timer, generation, instance });
|
|
80650
80658
|
try {
|
|
80651
80659
|
globalThis[binding](payload);
|
|
80652
80660
|
} catch {
|
|
@@ -80677,14 +80685,6 @@ function callIdFromCreateResult(result) {
|
|
|
80677
80685
|
let callId = realtimeCallIdFromLocation(location);
|
|
80678
80686
|
return isRealtimeCallId(callId) ? callId : void 0;
|
|
80679
80687
|
}
|
|
80680
|
-
async function cleanupAbandonedCreate(execution, params, result) {
|
|
80681
|
-
let unconfirmed, note = (error51) => {
|
|
80682
|
-
unconfirmed ??= cleanupUnconfirmedError(error51);
|
|
80683
|
-
}, requestId2 = typeof params.requestId == "string" ? params.requestId : void 0;
|
|
80684
|
-
requestId2 && await execution.request(REALTIME_CALL_METHOD, { operation: "cancel", requestId: requestId2 }).catch(note);
|
|
80685
|
-
let callId = callIdFromCreateResult(result);
|
|
80686
|
-
return callId && await execution.request(REALTIME_CALL_METHOD, { operation: "hangup", callId }).catch(note), unconfirmed;
|
|
80687
|
-
}
|
|
80688
80688
|
function captureExecution(host) {
|
|
80689
80689
|
return host.bindExecution?.() ?? {
|
|
80690
80690
|
generation: host.generation,
|
|
@@ -80716,18 +80716,41 @@ async function deliver(renderer, executionContextId, message2) {
|
|
|
80716
80716
|
}).catch(() => {
|
|
80717
80717
|
});
|
|
80718
80718
|
}
|
|
80719
|
-
async function
|
|
80720
|
-
previousId && await renderer.command("Page.removeScriptToEvaluateOnNewDocument", { identifier: previousId }).catch(() => {
|
|
80721
|
-
});
|
|
80719
|
+
async function addFutureScript(renderer, source) {
|
|
80722
80720
|
let added = await renderer.command("Page.addScriptToEvaluateOnNewDocument", { source });
|
|
80723
|
-
|
|
80721
|
+
if (!isRecord3(added) || typeof added.identifier != "string")
|
|
80722
|
+
throw new Error("Voice Host future script registration failed");
|
|
80723
|
+
return added.identifier;
|
|
80724
80724
|
}
|
|
80725
80725
|
async function removeFutureScript(renderer, identifier) {
|
|
80726
80726
|
identifier && await renderer.command("Page.removeScriptToEvaluateOnNewDocument", { identifier }).catch(() => {
|
|
80727
80727
|
});
|
|
80728
80728
|
}
|
|
80729
|
+
function rendererVoiceHostCleanupSource(instanceId) {
|
|
80730
|
+
return `(() => {
|
|
80731
|
+
const instance = ${JSON.stringify(instanceId)};
|
|
80732
|
+
const pending = globalThis[${JSON.stringify(RENDERER_VOICE_HOST_PENDING_GLOBAL)}];
|
|
80733
|
+
if (pending && typeof pending.forEach === "function") {
|
|
80734
|
+
for (const [id, wait] of [...pending.entries()]) {
|
|
80735
|
+
if (!wait || wait.instance !== instance) continue;
|
|
80736
|
+
pending.delete(id);
|
|
80737
|
+
try { clearTimeout(wait.timer); } catch (e) {}
|
|
80738
|
+
try { wait.reject(new Error(${JSON.stringify(UNKNOWN_OUTCOME)})); } catch (e) {}
|
|
80739
|
+
}
|
|
80740
|
+
}
|
|
80741
|
+
const capability = globalThis[${JSON.stringify(RENDERER_VOICE_HOST_CAPABILITY_GLOBAL)}];
|
|
80742
|
+
if (capability && capability.instance === instance) {
|
|
80743
|
+
delete globalThis[${JSON.stringify(RENDERER_VOICE_HOST_CAPABILITY_GLOBAL)}];
|
|
80744
|
+
delete globalThis[${JSON.stringify(RENDERER_VOICE_HOST_DELIVER_GLOBAL)}];
|
|
80745
|
+
if (globalThis[${JSON.stringify(RENDERER_VOICE_HOST_PENDING_GLOBAL)}] === pending)
|
|
80746
|
+
delete globalThis[${JSON.stringify(RENDERER_VOICE_HOST_PENDING_GLOBAL)}];
|
|
80747
|
+
}
|
|
80748
|
+
return true;
|
|
80749
|
+
})()`;
|
|
80750
|
+
}
|
|
80751
|
+
var publisherId = crypto.randomUUID(), installationSequence = 0;
|
|
80729
80752
|
async function installRendererVoiceHostBinding(renderer, host, options) {
|
|
80730
|
-
let
|
|
80753
|
+
let instance = crypto.randomUUID(), installationOrder = installationSequence += 1, disposed = !1, ready = !1, scriptId, publishedGeneration, publishing = Promise.resolve(), works = /* @__PURE__ */ new Map(), abandonedIds = /* @__PURE__ */ new Set(), contexts = /* @__PURE__ */ new Map(), rememberContext = (params) => {
|
|
80731
80754
|
if (!isRecord3(params) || !isRecord3(params.context))
|
|
80732
80755
|
return;
|
|
80733
80756
|
let context = params.context;
|
|
@@ -80745,11 +80768,37 @@ async function installRendererVoiceHostBinding(renderer, host, options) {
|
|
|
80745
80768
|
error: unconfirmed.message,
|
|
80746
80769
|
stage: "cancel"
|
|
80747
80770
|
});
|
|
80748
|
-
},
|
|
80749
|
-
|
|
80771
|
+
}, reportCleanupUnconfirmed = (item, error51) => {
|
|
80772
|
+
let create = item.create, unconfirmed = cleanupUnconfirmedError(error51);
|
|
80773
|
+
!create || !unconfirmed || create.cleanupReported || (create.cleanupReported = !0, observeCleanupUnconfirmed(item.contextId, item.pageId, unconfirmed));
|
|
80774
|
+
}, requestCleanup = (item, params) => {
|
|
80775
|
+
try {
|
|
80776
|
+
item.execution.request(REALTIME_CALL_METHOD, params).catch((error51) => reportCleanupUnconfirmed(item, error51));
|
|
80777
|
+
} catch (error51) {
|
|
80778
|
+
reportCleanupUnconfirmed(item, error51);
|
|
80779
|
+
}
|
|
80780
|
+
}, hangUpLateCreate = (item) => {
|
|
80781
|
+
let create = item.create;
|
|
80782
|
+
if (!create || create.hangupIssued)
|
|
80783
|
+
return;
|
|
80784
|
+
let callId = callIdFromCreateResult(create.result);
|
|
80785
|
+
callId && (create.hangupIssued = !0, requestCleanup(item, { operation: "hangup", callId }));
|
|
80786
|
+
}, retireWork = (item) => {
|
|
80787
|
+
item.abandoned = !0;
|
|
80788
|
+
let create = item.create;
|
|
80789
|
+
if (create) {
|
|
80790
|
+
if (create.settled) {
|
|
80791
|
+
hangUpLateCreate(item);
|
|
80792
|
+
return;
|
|
80793
|
+
}
|
|
80794
|
+
create.cancelIssued || (create.cancelIssued = !0, requestCleanup(item, { operation: "cancel", requestId: create.requestId }));
|
|
80795
|
+
}
|
|
80796
|
+
}, retireInflight = () => {
|
|
80797
|
+
for (let item of works.values())
|
|
80798
|
+
retireWork(item);
|
|
80750
80799
|
}, abandonMatching = (contextId, uniqueId) => {
|
|
80751
80800
|
for (let item of works.values())
|
|
80752
|
-
(contextId !== void 0 && item.contextId === contextId || uniqueId !== void 0 && item.uniqueId === uniqueId) &&
|
|
80801
|
+
(contextId !== void 0 && item.contextId === contextId || uniqueId !== void 0 && item.uniqueId === uniqueId) && retireWork(item);
|
|
80753
80802
|
}, forgetContext = (params) => {
|
|
80754
80803
|
if (!isRecord3(params))
|
|
80755
80804
|
return;
|
|
@@ -80763,37 +80812,58 @@ async function installRendererVoiceHostBinding(renderer, host, options) {
|
|
|
80763
80812
|
}, unsubscribeCreated = renderer.on("Runtime.executionContextCreated", rememberContext), unsubscribeDestroyed = renderer.on("Runtime.executionContextDestroyed", forgetContext), unsubscribeCleared = renderer.on("Runtime.executionContextsCleared", () => {
|
|
80764
80813
|
contexts.clear();
|
|
80765
80814
|
for (let item of works.values())
|
|
80766
|
-
|
|
80815
|
+
retireWork(item);
|
|
80767
80816
|
}), contextIsVerified = async (executionContextId, uniqueId) => {
|
|
80768
80817
|
let tracked = contexts.get(executionContextId);
|
|
80769
80818
|
if (!tracked?.isDefault || tracked.uniqueId !== uniqueId)
|
|
80770
80819
|
return !1;
|
|
80771
80820
|
let document2 = await readContextDocument(renderer, executionContextId), still = contexts.get(executionContextId);
|
|
80772
80821
|
return still?.uniqueId !== uniqueId || !still.isDefault || !document2?.top ? !1 : isEligibleVoiceHostUrl(document2.href);
|
|
80822
|
+
}, publishRetry, clearPublishRetry = () => {
|
|
80823
|
+
publishRetry !== void 0 && (clearTimeout(publishRetry), publishRetry = void 0);
|
|
80824
|
+
}, schedulePublishRetry = () => {
|
|
80825
|
+
disposed || publishRetry !== void 0 || (publishRetry = setTimeout(() => {
|
|
80826
|
+
publishRetry = void 0, !disposed && enqueuePublish().catch(() => schedulePublishRetry());
|
|
80827
|
+
}, RENDERER_VOICE_HOST_PUBLISH_RETRY_MS));
|
|
80828
|
+
}, cleanupPageState = async () => {
|
|
80829
|
+
try {
|
|
80830
|
+
await renderer.evaluate(rendererVoiceHostCleanupSource(instance));
|
|
80831
|
+
} catch {
|
|
80832
|
+
}
|
|
80773
80833
|
}, publishGeneration = async () => {
|
|
80774
|
-
|
|
80775
|
-
|
|
80776
|
-
|
|
80777
|
-
|
|
80778
|
-
await
|
|
80779
|
-
|
|
80834
|
+
for (let attempt = 0; !disposed && attempt < 3; attempt += 1) {
|
|
80835
|
+
let startedGeneration = host.generation;
|
|
80836
|
+
if (startedGeneration === publishedGeneration)
|
|
80837
|
+
return;
|
|
80838
|
+
let source = rendererVoiceHostCapabilitySource(host.owner, startedGeneration, instance, installationOrder, publisherId), addedId = await addFutureScript(renderer, source);
|
|
80839
|
+
if (disposed || host.generation !== startedGeneration) {
|
|
80840
|
+
await removeFutureScript(renderer, addedId);
|
|
80841
|
+
continue;
|
|
80842
|
+
}
|
|
80843
|
+
let previousId = scriptId;
|
|
80844
|
+
if (scriptId = addedId, await removeFutureScript(renderer, previousId), disposed)
|
|
80845
|
+
return;
|
|
80846
|
+
if (await renderer.evaluate(source), disposed) {
|
|
80847
|
+
await cleanupPageState();
|
|
80848
|
+
return;
|
|
80849
|
+
}
|
|
80850
|
+
if (publishedGeneration = startedGeneration, host.generation === startedGeneration)
|
|
80851
|
+
return;
|
|
80780
80852
|
}
|
|
80781
|
-
scriptId = addedId, await renderer.evaluate(source);
|
|
80782
80853
|
}, enqueuePublish = () => {
|
|
80783
|
-
|
|
80784
|
-
}).then(
|
|
80854
|
+
let next = publishing.catch(() => {
|
|
80855
|
+
}).then(async () => {
|
|
80856
|
+
await publishGeneration(), !disposed && host.generation !== publishedGeneration ? schedulePublishRetry() : clearPublishRetry();
|
|
80785
80857
|
});
|
|
80786
|
-
|
|
80787
|
-
|
|
80788
|
-
|
|
80789
|
-
|
|
80790
|
-
|
|
80791
|
-
let refresh = () => {
|
|
80792
|
-
disposed || (cancelInflightCreates(), enqueuePublish());
|
|
80793
|
-
}, unsubscribeGeneration = host.onGenerationChange?.(refresh), unsubscribe = renderer.on("Runtime.bindingCalled", (params) => {
|
|
80858
|
+
return publishing = next.catch(() => {
|
|
80859
|
+
}), next;
|
|
80860
|
+
}, refresh = () => {
|
|
80861
|
+
disposed || (retireInflight(), ready && enqueuePublish().catch(() => schedulePublishRetry()));
|
|
80862
|
+
}, unsubscribeGeneration, unsubscribe = renderer.on("Runtime.bindingCalled", (params) => {
|
|
80794
80863
|
if (disposed || !isRecord3(params) || params.name !== RENDERER_VOICE_HOST_BINDING_NAME || typeof params.executionContextId != "number" || typeof params.payload != "string" || params.payload.length > RENDERER_VOICE_HOST_MAX_PAYLOAD_BYTES)
|
|
80795
80864
|
return;
|
|
80796
|
-
let contextId = params.executionContextId, payloadText = params.payload, startedGeneration = host.generation
|
|
80865
|
+
let contextId = params.executionContextId, payloadText = params.payload, startedGeneration = host.generation;
|
|
80866
|
+
(async () => {
|
|
80797
80867
|
let parsed;
|
|
80798
80868
|
try {
|
|
80799
80869
|
parsed = JSON.parse(payloadText);
|
|
@@ -80805,7 +80875,7 @@ async function installRendererVoiceHostBinding(renderer, host, options) {
|
|
|
80805
80875
|
let requestId2 = parsed.id;
|
|
80806
80876
|
if (parsed.abandon === !0) {
|
|
80807
80877
|
let existing = works.get(requestId2);
|
|
80808
|
-
existing ?
|
|
80878
|
+
existing ? retireWork(existing) : abandonedIds.add(requestId2);
|
|
80809
80879
|
return;
|
|
80810
80880
|
}
|
|
80811
80881
|
if (parsed.generation !== startedGeneration || parsed.generation !== host.generation || typeof parsed.method != "string" || !isRecord3(parsed.params)) {
|
|
@@ -80822,17 +80892,25 @@ async function installRendererVoiceHostBinding(renderer, host, options) {
|
|
|
80822
80892
|
generation: startedGeneration,
|
|
80823
80893
|
execution,
|
|
80824
80894
|
abandoned: abandonedIds.has(requestId2),
|
|
80825
|
-
...isCreateOperation(parsed.method, parsed.params) && typeof parsed.params.requestId == "string" ? {
|
|
80895
|
+
...isCreateOperation(parsed.method, parsed.params) && typeof parsed.params.requestId == "string" ? {
|
|
80896
|
+
create: {
|
|
80897
|
+
requestId: parsed.params.requestId,
|
|
80898
|
+
settled: !1,
|
|
80899
|
+
cancelIssued: !1,
|
|
80900
|
+
hangupIssued: !1,
|
|
80901
|
+
cleanupReported: !1
|
|
80902
|
+
}
|
|
80903
|
+
} : {}
|
|
80826
80904
|
};
|
|
80827
80905
|
works.set(requestId2, item), abandonedIds.delete(requestId2);
|
|
80828
80906
|
try {
|
|
80829
80907
|
if (item.abandoned) {
|
|
80830
|
-
|
|
80908
|
+
retireWork(item);
|
|
80831
80909
|
return;
|
|
80832
80910
|
}
|
|
80833
80911
|
let method2 = parsed.method, requestParams = parsed.params, verified = await contextIsVerified(contextId, uniqueId), still = contexts.get(contextId);
|
|
80834
80912
|
if (disposed || item.abandoned || host.generation !== startedGeneration || still?.uniqueId !== uniqueId) {
|
|
80835
|
-
|
|
80913
|
+
retireWork(item);
|
|
80836
80914
|
return;
|
|
80837
80915
|
}
|
|
80838
80916
|
if (!verified) {
|
|
@@ -80845,17 +80923,18 @@ async function installRendererVoiceHostBinding(renderer, host, options) {
|
|
|
80845
80923
|
}
|
|
80846
80924
|
try {
|
|
80847
80925
|
let result = await item.execution.request(method2, requestParams);
|
|
80848
|
-
item.create && (item.create.result = result);
|
|
80926
|
+
item.create && (item.create.result = result, item.create.settled = !0);
|
|
80849
80927
|
let after = contexts.get(contextId);
|
|
80850
80928
|
if (disposed || item.abandoned || host.generation !== startedGeneration || after?.uniqueId !== uniqueId) {
|
|
80851
|
-
|
|
80929
|
+
retireWork(item);
|
|
80852
80930
|
return;
|
|
80853
80931
|
}
|
|
80854
80932
|
await deliver(renderer, contextId, { id: requestId2, ok: !0, result });
|
|
80855
80933
|
} catch (error51) {
|
|
80934
|
+
item.create && (item.create.settled = !0);
|
|
80856
80935
|
let unconfirmed = cleanupUnconfirmedError(error51);
|
|
80857
80936
|
if (unconfirmed && !disposed) {
|
|
80858
|
-
await deliver(renderer, contextId, {
|
|
80937
|
+
item.create && (item.create.cleanupReported = !0), await deliver(renderer, contextId, {
|
|
80859
80938
|
id: requestId2,
|
|
80860
80939
|
ok: !1,
|
|
80861
80940
|
error: unconfirmed.message,
|
|
@@ -80877,33 +80956,16 @@ async function installRendererVoiceHostBinding(renderer, host, options) {
|
|
|
80877
80956
|
works.delete(requestId2);
|
|
80878
80957
|
}
|
|
80879
80958
|
})();
|
|
80880
|
-
|
|
80881
|
-
|
|
80882
|
-
|
|
80883
|
-
if (disposed)
|
|
80884
|
-
return;
|
|
80885
|
-
disposed = !0, unsubscribeGeneration?.(), unsubscribe(), unsubscribeCreated(), unsubscribeDestroyed(), unsubscribeCleared(), cancelInflightCreates();
|
|
80886
|
-
let outstanding = [...inflight], leftover = [...works.values()];
|
|
80887
|
-
Promise.allSettled(outstanding).then(async () => {
|
|
80888
|
-
for (let item of leftover)
|
|
80889
|
-
item.create && await observeCleanupUnconfirmed(item.contextId, item.pageId, await cleanupAbandonedCreate(item.execution, { requestId: item.create.requestId, operation: "create" }, item.create.result));
|
|
80890
|
-
}), removeFutureScript(renderer, scriptId), renderer.command("Runtime.removeBinding", { name: RENDERER_VOICE_HOST_BINDING_NAME }).catch(() => {
|
|
80891
|
-
}), renderer.evaluate(`(() => {
|
|
80892
|
-
const pending = globalThis[${JSON.stringify(RENDERER_VOICE_HOST_PENDING_GLOBAL)}];
|
|
80893
|
-
if (pending && typeof pending.forEach === "function") {
|
|
80894
|
-
for (const [id, wait] of [...pending.entries()]) {
|
|
80895
|
-
pending.delete(id);
|
|
80896
|
-
try { clearTimeout(wait.timer); } catch (e) {}
|
|
80897
|
-
try { wait.reject(new Error(${JSON.stringify(UNKNOWN_OUTCOME)})); } catch (e) {}
|
|
80898
|
-
}
|
|
80899
|
-
}
|
|
80900
|
-
delete globalThis[${JSON.stringify(RENDERER_VOICE_HOST_CAPABILITY_GLOBAL)}];
|
|
80901
|
-
delete globalThis[${JSON.stringify(RENDERER_VOICE_HOST_DELIVER_GLOBAL)}];
|
|
80902
|
-
delete globalThis[${JSON.stringify(RENDERER_VOICE_HOST_PENDING_GLOBAL)}];
|
|
80903
|
-
return true;
|
|
80904
|
-
})()`).catch(() => {
|
|
80905
|
-
});
|
|
80959
|
+
}), dispose = () => {
|
|
80960
|
+
disposed || (disposed = !0, clearPublishRetry(), unsubscribeGeneration?.(), unsubscribe(), unsubscribeCreated(), unsubscribeDestroyed(), unsubscribeCleared(), retireInflight(), removeFutureScript(renderer, scriptId), renderer.command("Runtime.removeBinding", { name: RENDERER_VOICE_HOST_BINDING_NAME }).catch(() => {
|
|
80961
|
+
}), cleanupPageState());
|
|
80906
80962
|
};
|
|
80963
|
+
try {
|
|
80964
|
+
unsubscribeGeneration = host.onGenerationChange?.(refresh), options?.enableRuntime !== !1 && await renderer.command("Runtime.enable"), await renderer.command("Page.enable"), await renderer.command("Runtime.addBinding", { name: RENDERER_VOICE_HOST_BINDING_NAME }), ready = !0, await enqueuePublish();
|
|
80965
|
+
} catch (error51) {
|
|
80966
|
+
throw dispose(), error51;
|
|
80967
|
+
}
|
|
80968
|
+
return dispose;
|
|
80907
80969
|
}
|
|
80908
80970
|
|
|
80909
80971
|
// packages/desktop-control/dist/host-client-channel.js
|
|
@@ -83494,6 +83556,10 @@ function discoveryTimeoutSignal(timeoutMs, signal) {
|
|
|
83494
83556
|
function abortFailure(signal, fallback) {
|
|
83495
83557
|
return signal.reason instanceof Error ? signal.reason : new Error(fallback);
|
|
83496
83558
|
}
|
|
83559
|
+
function throwIfCdpAborted(signal, fallback) {
|
|
83560
|
+
if (signal.aborted)
|
|
83561
|
+
throw abortFailure(signal, fallback);
|
|
83562
|
+
}
|
|
83497
83563
|
function awaitWithSignal(promise2, signal, timeoutMessage) {
|
|
83498
83564
|
return signal.aborted ? Promise.reject(abortFailure(signal, timeoutMessage)) : new Promise((resolve22, reject) => {
|
|
83499
83565
|
let onAbort = () => {
|
|
@@ -83576,6 +83642,28 @@ async function bindRendererVoiceHost(renderer, voiceHost, disposals, options) {
|
|
|
83576
83642
|
function unbindRendererVoiceHost(renderer, disposals) {
|
|
83577
83643
|
disposals.get(renderer)?.(), disposals.delete(renderer);
|
|
83578
83644
|
}
|
|
83645
|
+
var VOICE_HOST_ATTACH_TIMEOUT_MS = 15e3, VOICE_HOST_OVERLAY_RETRY_MS = 5e3, VOICE_HOST_LIVENESS_INTERVAL_MS = 5e3, VOICE_HOST_LIVENESS_TIMEOUT_MS = 3e3;
|
|
83646
|
+
async function bindVoiceHostOnNewConnection(target2, voiceHost, operations, timeoutMs, signal) {
|
|
83647
|
+
let timeout = AbortSignal.timeout(timeoutMs), deadline = signal ? AbortSignal.any([timeout, signal]) : timeout, timeoutMessage = "Voice Host attachment timed out", client = await connectRendererTarget(target2, operations, deadline, timeoutMessage), installing = installRendererVoiceHostBinding(client, voiceHost);
|
|
83648
|
+
try {
|
|
83649
|
+
let dispose = await awaitWithSignal(installing, deadline, timeoutMessage);
|
|
83650
|
+
return { targetId: target2.id, client, dispose, verifiedAt: Date.now() };
|
|
83651
|
+
} catch (error51) {
|
|
83652
|
+
throw client.close(), error51;
|
|
83653
|
+
}
|
|
83654
|
+
}
|
|
83655
|
+
async function lateVoiceBindingIsLive(binding, signal) {
|
|
83656
|
+
if (Date.now() - binding.verifiedAt < VOICE_HOST_LIVENESS_INTERVAL_MS)
|
|
83657
|
+
return !0;
|
|
83658
|
+
if (signal.aborted)
|
|
83659
|
+
return !1;
|
|
83660
|
+
let deadline = AbortSignal.any([AbortSignal.timeout(VOICE_HOST_LIVENESS_TIMEOUT_MS), signal]);
|
|
83661
|
+
try {
|
|
83662
|
+
return await awaitWithSignal(binding.client.evaluate("1", VOICE_HOST_LIVENESS_TIMEOUT_MS), deadline, "Voice Host binding liveness check timed out"), binding.verifiedAt = Date.now(), !0;
|
|
83663
|
+
} catch {
|
|
83664
|
+
return !1;
|
|
83665
|
+
}
|
|
83666
|
+
}
|
|
83579
83667
|
async function evaluateSource(renderer, source) {
|
|
83580
83668
|
let response = await renderer.command("Runtime.evaluate", {
|
|
83581
83669
|
expression: source,
|
|
@@ -83737,7 +83825,7 @@ async function installOverlayHook(target2, overlayHookSource, overlayClients, op
|
|
|
83737
83825
|
renderer ??= await connectRendererTarget(target2, operations, signal, timeoutMessage);
|
|
83738
83826
|
let connected = renderer;
|
|
83739
83827
|
try {
|
|
83740
|
-
registered ? voiceHost && voiceHostDisposals && !voiceHostDisposals.has(connected) && await run2(() => bindRendererVoiceHost(connected, voiceHost, voiceHostDisposals, { enableRuntime: !1 })) : (voiceHost && voiceHostDisposals && !voiceHostDisposals.has(connected) && await run2(() => bindRendererVoiceHost(connected, voiceHost, voiceHostDisposals, { enableRuntime: !1 })), await run2(() => connected.command("Runtime.enable")), await run2(() => connected.command("Page.enable")), overlayClients.set(target2.id, connected));
|
|
83828
|
+
registered ? voiceHost && voiceHostDisposals && !voiceHostDisposals.has(connected) && await run2(() => bindRendererVoiceHost(connected, voiceHost, voiceHostDisposals, { enableRuntime: !1 })) : (voiceHost && voiceHostDisposals && !voiceHostDisposals.has(connected) && await run2(() => bindRendererVoiceHost(connected, voiceHost, voiceHostDisposals, { enableRuntime: !1 })), await run2(() => connected.command("Runtime.enable")), await run2(() => connected.command("Page.enable")), throwIfCdpAborted(signal, timeoutMessage), overlayClients.set(target2.id, connected));
|
|
83741
83829
|
let inspected = !0, snapshot = readOverlayHookSnapshot(await run2(async () => {
|
|
83742
83830
|
try {
|
|
83743
83831
|
return await connected.evaluate(OVERLAY_HOOK_SNAPSHOT_EXPRESSION);
|
|
@@ -83801,7 +83889,7 @@ async function installBrowserAnnotationStyles(target2, browserClients, operation
|
|
|
83801
83889
|
try {
|
|
83802
83890
|
registered || (await run2(() => connected.command("Page.enable")), await run2(() => connected.command("Page.addScriptToEvaluateOnNewDocument", {
|
|
83803
83891
|
source: BROWSER_ANNOTATION_STYLE_COMPAT_SOURCE
|
|
83804
|
-
})), browserClients.set(target2.id, connected)), await run2(() => connected.evaluate("globalThis.__codexhostBrowserAnnotationStylesV1?.refresh() === true")) !== !0 && await run2(() => evaluateSource(connected, BROWSER_ANNOTATION_STYLE_COMPAT_SOURCE));
|
|
83892
|
+
})), throwIfCdpAborted(signal, timeoutMessage), browserClients.set(target2.id, connected)), await run2(() => connected.evaluate("globalThis.__codexhostBrowserAnnotationStylesV1?.refresh() === true")) !== !0 && await run2(() => evaluateSource(connected, BROWSER_ANNOTATION_STYLE_COMPAT_SOURCE));
|
|
83805
83893
|
} catch (error51) {
|
|
83806
83894
|
throw browserClients.delete(target2.id), connected.close(), error51;
|
|
83807
83895
|
}
|
|
@@ -83814,12 +83902,15 @@ async function installLocalThreadRenderer(target2, source, enabledAgents, operat
|
|
|
83814
83902
|
renderer.close();
|
|
83815
83903
|
}
|
|
83816
83904
|
}
|
|
83817
|
-
async function installAuxiliaryRenderers(endpoint, rendererSource, enabledAgents, overlayHookSource, overlayVoiceBootstrapSource, browserStyleClients, overlayClients, operations, signal, voiceHost, voiceHostDisposals) {
|
|
83905
|
+
async function installAuxiliaryRenderers(endpoint, rendererSource, enabledAgents, overlayHookSource, overlayVoiceBootstrapSource, browserStyleClients, overlayClients, operations, signal, voiceHost, voiceHostDisposals, lateVoiceBindings) {
|
|
83818
83906
|
try {
|
|
83819
83907
|
let targets = await awaitWithSignal(operations.listTargets(endpoint, signal), signal, "Auxiliary Renderer CDP target discovery timed out"), liveTargets = new Set(targets.map((target2) => target2.id));
|
|
83820
83908
|
for (let clients of [browserStyleClients, overlayClients])
|
|
83821
83909
|
for (let [id, client] of clients)
|
|
83822
83910
|
liveTargets.has(id) || (voiceHostDisposals && unbindRendererVoiceHost(client, voiceHostDisposals), client.close(), clients.delete(id));
|
|
83911
|
+
if (lateVoiceBindings)
|
|
83912
|
+
for (let [id, binding] of lateVoiceBindings)
|
|
83913
|
+
liveTargets.has(id) || (binding.dispose(), binding.client.close(), lateVoiceBindings.delete(id));
|
|
83823
83914
|
await Promise.allSettled([
|
|
83824
83915
|
...targets.filter(isBrowserPage).map((target2) => installBrowserAnnotationStyles(target2, browserStyleClients, operations, signal)),
|
|
83825
83916
|
...overlayHookSource ? selectAvatarOverlayRendererTargets(targets).map((overlay) => installOverlayHook(overlay, overlayHookSource, overlayClients, operations, signal, overlayVoiceBootstrapSource, voiceHost, voiceHostDisposals)) : [],
|
|
@@ -83828,13 +83919,13 @@ async function installAuxiliaryRenderers(endpoint, rendererSource, enabledAgents
|
|
|
83828
83919
|
} catch {
|
|
83829
83920
|
}
|
|
83830
83921
|
}
|
|
83831
|
-
async function installTarget(target2, rendererSource, enabledAgents, timeoutMs, pollIntervalMs, operations, voiceHost, voiceHostDisposals) {
|
|
83832
|
-
let renderer = await operations.connect(target2.webSocketDebuggerUrl), disposeModules;
|
|
83922
|
+
async function installTarget(target2, rendererSource, enabledAgents, timeoutMs, pollIntervalMs, operations, voiceHost, voiceHostDisposals, signal) {
|
|
83923
|
+
let timeoutMessage = "Primary Renderer installation timed out", run2 = (operation) => signal ? runWithCdpSignal(signal, timeoutMessage, operation) : operation(), renderer = signal ? await connectRendererTarget(target2, operations, signal, timeoutMessage) : await operations.connect(target2.webSocketDebuggerUrl), disposeModules;
|
|
83833
83924
|
try {
|
|
83834
|
-
voiceHost && voiceHostDisposals && await bindRendererVoiceHost(renderer, voiceHost, voiceHostDisposals, {
|
|
83925
|
+
voiceHost && voiceHostDisposals && await run2(() => bindRendererVoiceHost(renderer, voiceHost, voiceHostDisposals, {
|
|
83835
83926
|
enableRuntime: !1
|
|
83836
|
-
}), disposeModules = await installRendererLoadedModules(renderer), await renderer.command("Page.enable"), await renderer.command("Page.addScriptToEvaluateOnNewDocument", { source: rendererSource }), await evaluateSource(renderer, rendererSource);
|
|
83837
|
-
let draftPrewarmPolicy = await operations.installDraftPrewarmPolicy(renderer), binding = await waitForBinding(renderer, enabledAgents, timeoutMs, pollIntervalMs);
|
|
83927
|
+
})), disposeModules = await run2(() => installRendererLoadedModules(renderer)), await run2(() => renderer.command("Page.enable")), await run2(() => renderer.command("Page.addScriptToEvaluateOnNewDocument", { source: rendererSource })), await run2(() => evaluateSource(renderer, rendererSource));
|
|
83928
|
+
let draftPrewarmPolicy = await run2(() => operations.installDraftPrewarmPolicy(renderer)), binding = await waitForBinding(renderer, enabledAgents, timeoutMs, pollIntervalMs, signal);
|
|
83838
83929
|
return { renderer, snapshot: { target: target2, draftPrewarmPolicy, binding }, disposeModules };
|
|
83839
83930
|
} catch (error51) {
|
|
83840
83931
|
throw disposeModules?.(), voiceHostDisposals && unbindRendererVoiceHost(renderer, voiceHostDisposals), renderer.close(), error51;
|
|
@@ -83857,6 +83948,14 @@ var InstalledRendererCdpControlSession = class {
|
|
|
83857
83948
|
voiceHost;
|
|
83858
83949
|
voiceHostDisposals;
|
|
83859
83950
|
#closed = !1;
|
|
83951
|
+
#lateVoiceHost;
|
|
83952
|
+
#lateVoicePrimaryId;
|
|
83953
|
+
#lateVoiceAttach;
|
|
83954
|
+
#lateVoiceBindings = /* @__PURE__ */ new Map();
|
|
83955
|
+
#overlayVoiceRetryAt = /* @__PURE__ */ new Map();
|
|
83956
|
+
// close() aborts this deadline, so discovery, connects, installs, and
|
|
83957
|
+
// liveness probes in flight stop instead of running to their own timeouts.
|
|
83958
|
+
#shutdown = new AbortController();
|
|
83860
83959
|
constructor(renderer, rendererCdpEndpoint, rendererSource, overlayHookSource, overlayVoiceBootstrapSource, browserStyleClients, overlayClients, enabledAgents, timeoutMs, pollIntervalMs, operations, currentSnapshot, disposeModules, voiceHost, voiceHostDisposals) {
|
|
83861
83960
|
this.renderer = renderer, this.rendererCdpEndpoint = rendererCdpEndpoint, this.rendererSource = rendererSource, this.overlayHookSource = overlayHookSource, this.overlayVoiceBootstrapSource = overlayVoiceBootstrapSource, this.browserStyleClients = browserStyleClients, this.overlayClients = overlayClients, this.enabledAgents = enabledAgents, this.timeoutMs = timeoutMs, this.pollIntervalMs = pollIntervalMs, this.operations = operations, this.currentSnapshot = currentSnapshot, this.disposeModules = disposeModules, this.voiceHost = voiceHost, this.voiceHostDisposals = voiceHostDisposals;
|
|
83862
83961
|
}
|
|
@@ -83864,34 +83963,106 @@ var InstalledRendererCdpControlSession = class {
|
|
|
83864
83963
|
return this.currentSnapshot;
|
|
83865
83964
|
}
|
|
83866
83965
|
async ensureInstalled() {
|
|
83966
|
+
this.#assertOpen();
|
|
83967
|
+
let target2 = await waitForPrimaryTarget(this.rendererCdpEndpoint, this.operations, this.timeoutMs, this.pollIntervalMs, this.currentSnapshot.target.id, this.#shutdown.signal);
|
|
83968
|
+
return this.#assertOpen(), target2.id !== this.currentSnapshot.target.id ? (this.#disposeLateVoiceBinding(this.currentSnapshot.target.id), await this.#replacePrimary(target2)) : await this.#reconcilePrimary(target2), await installAuxiliaryRenderers(this.rendererCdpEndpoint, this.rendererSource, this.enabledAgents, this.overlayHookSource, this.overlayVoiceBootstrapSource, this.browserStyleClients, this.overlayClients, this.operations, discoveryTimeoutSignal(this.timeoutMs, this.#shutdown.signal), this.voiceHost, this.voiceHostDisposals, this.#lateVoiceBindings), this.#assertOpen(), this.currentSnapshot;
|
|
83969
|
+
}
|
|
83970
|
+
async #reconcilePrimary(target2) {
|
|
83971
|
+
try {
|
|
83972
|
+
await this.#runWhileOpen(() => readBinding(this.renderer)) === null && await this.#runWhileOpen(() => evaluateSource(this.renderer, this.rendererSource));
|
|
83973
|
+
let draftPrewarmPolicy = await this.#runWhileOpen(() => this.operations.installDraftPrewarmPolicy(this.renderer)), binding = await waitForBinding(this.renderer, this.enabledAgents, this.timeoutMs, this.pollIntervalMs, this.#shutdown.signal);
|
|
83974
|
+
this.#assertOpen(), this.currentSnapshot = { target: target2, draftPrewarmPolicy, binding };
|
|
83975
|
+
} catch {
|
|
83976
|
+
this.#assertOpen(), this.#disposeLateVoiceBinding(this.currentSnapshot.target.id), await this.#replacePrimary(target2);
|
|
83977
|
+
}
|
|
83978
|
+
}
|
|
83979
|
+
async #replacePrimary(target2) {
|
|
83980
|
+
let replacement = await installTarget(target2, this.rendererSource, this.enabledAgents, this.timeoutMs, this.pollIntervalMs, this.operations, this.voiceHost, this.voiceHostDisposals, this.#shutdown.signal);
|
|
83981
|
+
if (this.#closed)
|
|
83982
|
+
throw replacement.disposeModules(), unbindRendererVoiceHost(replacement.renderer, this.voiceHostDisposals), replacement.renderer.close(), new Error("Renderer CDP Control Session is closed");
|
|
83983
|
+
this.disposeModules(), unbindRendererVoiceHost(this.renderer, this.voiceHostDisposals), this.renderer.close(), this.renderer = replacement.renderer, this.disposeModules = replacement.disposeModules, this.currentSnapshot = replacement.snapshot;
|
|
83984
|
+
}
|
|
83985
|
+
#assertOpen() {
|
|
83867
83986
|
if (this.#closed)
|
|
83868
83987
|
throw new Error("Renderer CDP Control Session is closed");
|
|
83869
|
-
|
|
83870
|
-
|
|
83871
|
-
|
|
83872
|
-
|
|
83873
|
-
|
|
83874
|
-
|
|
83875
|
-
|
|
83876
|
-
|
|
83877
|
-
|
|
83878
|
-
|
|
83879
|
-
|
|
83880
|
-
|
|
83988
|
+
}
|
|
83989
|
+
#runWhileOpen(operation) {
|
|
83990
|
+
return runWithCdpSignal(this.#shutdown.signal, "Renderer CDP Control Session is closed", operation);
|
|
83991
|
+
}
|
|
83992
|
+
async attachVoiceHost(voiceHost) {
|
|
83993
|
+
if (this.#assertOpen(), !this.voiceHost)
|
|
83994
|
+
return this.#lateVoiceAttach ??= this.#reconcileVoiceHost(voiceHost).finally(() => {
|
|
83995
|
+
this.#lateVoiceAttach = void 0;
|
|
83996
|
+
}), this.#lateVoiceAttach;
|
|
83997
|
+
}
|
|
83998
|
+
async #reconcileVoiceHost(voiceHost) {
|
|
83999
|
+
let timeoutMs = Math.min(this.timeoutMs, VOICE_HOST_ATTACH_TIMEOUT_MS);
|
|
84000
|
+
this.#lateVoiceHost !== void 0 && this.#lateVoiceHost !== voiceHost && this.#disposeLateVoiceBindings();
|
|
84001
|
+
let primaryTarget = this.currentSnapshot.target;
|
|
84002
|
+
this.#lateVoicePrimaryId !== void 0 && this.#lateVoicePrimaryId !== primaryTarget.id && this.#disposeLateVoiceBinding(this.#lateVoicePrimaryId);
|
|
84003
|
+
let existingPrimary = this.#lateVoiceBindings.get(primaryTarget.id);
|
|
84004
|
+
if (existingPrimary && !await lateVoiceBindingIsLive(existingPrimary, this.#shutdown.signal) && this.#disposeLateVoiceBinding(primaryTarget.id), this.#assertOpen(), !this.#lateVoiceBindings.has(primaryTarget.id)) {
|
|
84005
|
+
this.#disposeLateVoiceBinding(primaryTarget.id);
|
|
84006
|
+
let binding = await bindVoiceHostOnNewConnection(primaryTarget, voiceHost, this.operations, timeoutMs, this.#shutdown.signal);
|
|
84007
|
+
if (this.#closed)
|
|
84008
|
+
throw binding.dispose(), binding.client.close(), new Error("Renderer CDP Control Session is closed");
|
|
84009
|
+
this.#lateVoiceBindings.set(binding.targetId, binding);
|
|
84010
|
+
}
|
|
84011
|
+
this.#lateVoicePrimaryId = primaryTarget.id, this.#lateVoiceHost = voiceHost, await this.#reconcileOverlayVoiceHost(voiceHost, timeoutMs), this.#assertOpen();
|
|
84012
|
+
}
|
|
84013
|
+
async #reconcileOverlayVoiceHost(voiceHost, timeoutMs) {
|
|
84014
|
+
if (this.#closed || !this.overlayHookSource)
|
|
84015
|
+
return;
|
|
84016
|
+
let deadline = AbortSignal.any([AbortSignal.timeout(timeoutMs), this.#shutdown.signal]), targets;
|
|
84017
|
+
try {
|
|
84018
|
+
targets = await awaitWithSignal(this.operations.listTargets(this.rendererCdpEndpoint, deadline), deadline, "Late overlay CDP target discovery timed out");
|
|
84019
|
+
} catch {
|
|
84020
|
+
return;
|
|
84021
|
+
}
|
|
84022
|
+
let overlays = selectAvatarOverlayRendererTargets(targets), live = new Set(overlays.map((target2) => target2.id));
|
|
84023
|
+
for (let id of [...this.#lateVoiceBindings.keys()])
|
|
84024
|
+
id !== this.#lateVoicePrimaryId && !live.has(id) && this.#disposeLateVoiceBinding(id);
|
|
84025
|
+
for (let id of [...this.#overlayVoiceRetryAt.keys()])
|
|
84026
|
+
live.has(id) || this.#overlayVoiceRetryAt.delete(id);
|
|
84027
|
+
await Promise.allSettled(overlays.map(async (target2) => {
|
|
84028
|
+
if (this.#closed)
|
|
84029
|
+
return;
|
|
84030
|
+
let existing = this.#lateVoiceBindings.get(target2.id);
|
|
84031
|
+
if (existing) {
|
|
84032
|
+
if (await lateVoiceBindingIsLive(existing, this.#shutdown.signal) || this.#closed)
|
|
84033
|
+
return;
|
|
84034
|
+
this.#disposeLateVoiceBinding(target2.id);
|
|
83881
84035
|
}
|
|
83882
|
-
|
|
84036
|
+
if (!((this.#overlayVoiceRetryAt.get(target2.id) ?? 0) > Date.now()))
|
|
84037
|
+
try {
|
|
84038
|
+
let binding = await bindVoiceHostOnNewConnection(target2, voiceHost, this.operations, timeoutMs, this.#shutdown.signal);
|
|
84039
|
+
if (this.#closed) {
|
|
84040
|
+
binding.dispose(), binding.client.close();
|
|
84041
|
+
return;
|
|
84042
|
+
}
|
|
84043
|
+
this.#lateVoiceBindings.set(binding.targetId, binding), this.#overlayVoiceRetryAt.delete(binding.targetId);
|
|
84044
|
+
} catch {
|
|
84045
|
+
this.#overlayVoiceRetryAt.set(target2.id, Date.now() + VOICE_HOST_OVERLAY_RETRY_MS);
|
|
84046
|
+
}
|
|
84047
|
+
}));
|
|
84048
|
+
}
|
|
84049
|
+
#disposeLateVoiceBinding(targetId) {
|
|
84050
|
+
let binding = this.#lateVoiceBindings.get(targetId);
|
|
84051
|
+
binding && (binding.dispose(), binding.client.close(), this.#lateVoiceBindings.delete(targetId), this.#lateVoicePrimaryId === targetId && (this.#lateVoicePrimaryId = void 0), this.#overlayVoiceRetryAt.delete(targetId));
|
|
84052
|
+
}
|
|
84053
|
+
#disposeLateVoiceBindings() {
|
|
84054
|
+
for (let targetId of [...this.#lateVoiceBindings.keys()])
|
|
84055
|
+
this.#disposeLateVoiceBinding(targetId);
|
|
83883
84056
|
}
|
|
83884
84057
|
async activateDesktop() {
|
|
83885
|
-
|
|
83886
|
-
throw new Error("Renderer CDP Control Session is closed");
|
|
83887
|
-
return await this.renderer.command("Page.bringToFront"), 1;
|
|
84058
|
+
return this.#assertOpen(), await this.renderer.command("Page.bringToFront"), 1;
|
|
83888
84059
|
}
|
|
83889
84060
|
executeRenderer(expression, timeoutMs) {
|
|
83890
84061
|
return this.#closed ? Promise.reject(new Error("Renderer CDP Control Session is closed")) : this.renderer.evaluate(expression, timeoutMs);
|
|
83891
84062
|
}
|
|
83892
84063
|
close() {
|
|
83893
84064
|
if (!this.#closed) {
|
|
83894
|
-
this.#closed = !0, this.disposeModules(), unbindRendererVoiceHost(this.renderer, this.voiceHostDisposals), this.renderer.close();
|
|
84065
|
+
this.#closed = !0, this.#shutdown.abort(new Error("Renderer CDP Control Session is closed")), this.disposeModules(), unbindRendererVoiceHost(this.renderer, this.voiceHostDisposals), this.renderer.close();
|
|
83895
84066
|
for (let client of this.browserStyleClients.values())
|
|
83896
84067
|
client.close();
|
|
83897
84068
|
this.browserStyleClients.clear();
|
|
@@ -83900,7 +84071,7 @@ var InstalledRendererCdpControlSession = class {
|
|
|
83900
84071
|
this.overlayClients.clear();
|
|
83901
84072
|
for (let dispose of this.voiceHostDisposals.values())
|
|
83902
84073
|
dispose();
|
|
83903
|
-
this.voiceHostDisposals.clear();
|
|
84074
|
+
this.voiceHostDisposals.clear(), this.#disposeLateVoiceBindings();
|
|
83904
84075
|
}
|
|
83905
84076
|
}
|
|
83906
84077
|
}, defaultOperations = {
|
package/bin/codexhost
CHANGED
|
Binary file
|
package/libexec/codexhost-shim
CHANGED
|
Binary file
|
|
Binary file
|