@karlorz/codexhost-cli-darwin-x64 0.22.0-2 → 0.22.0-5
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/desktop-controller.mjs +50 -9
- package/app/host-runtime.mjs +124 -25
- package/app/web-modules/server.mjs +31 -12
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Run Pi and Claude Code as first-class external harnesses inside Codex Desktop.
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npm install -g @karlorz/codexhost-cli@0.22.0-
|
|
10
|
+
npm install -g @karlorz/codexhost-cli@0.22.0-5
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
Do not install this package directly. npm selects it through the optional dependencies of `@karlorz/codexhost-cli`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"schemaVersion":1,"version":"0.22.0-
|
|
1
|
+
{"schemaVersion":1,"version":"0.22.0-5","distribution":"npm","target":"macos-x64"}
|
|
@@ -21750,6 +21750,30 @@ function discoveryTimeoutSignal(timeoutMs, signal) {
|
|
|
21750
21750
|
function abortFailure(signal, fallback) {
|
|
21751
21751
|
return signal.reason instanceof Error ? signal.reason : new Error(fallback);
|
|
21752
21752
|
}
|
|
21753
|
+
function isRendererDocumentLoadEvent(params) {
|
|
21754
|
+
if (!isRecord3(params) || typeof params.name !== "string") return false;
|
|
21755
|
+
return params.name === "DOMContentLoaded" || params.name === "load" || params.name === "networkIdle";
|
|
21756
|
+
}
|
|
21757
|
+
async function waitForRendererDocumentLoad(renderer, run, signal, timeoutMessage) {
|
|
21758
|
+
await run(() => renderer.command("Page.enable"));
|
|
21759
|
+
let finished = false;
|
|
21760
|
+
const loaded = new Promise((resolve) => {
|
|
21761
|
+
const complete = () => {
|
|
21762
|
+
if (finished) return;
|
|
21763
|
+
finished = true;
|
|
21764
|
+
unsubscribeLoad();
|
|
21765
|
+
unsubscribeLifecycle();
|
|
21766
|
+
resolve();
|
|
21767
|
+
};
|
|
21768
|
+
const unsubscribeLoad = renderer.on("Page.loadEventFired", complete);
|
|
21769
|
+
const unsubscribeLifecycle = renderer.on("Page.lifecycleEvent", (params) => {
|
|
21770
|
+
if (isRendererDocumentLoadEvent(params)) complete();
|
|
21771
|
+
});
|
|
21772
|
+
});
|
|
21773
|
+
await run(() => renderer.command("Page.setLifecycleEventsEnabled", { enabled: true }));
|
|
21774
|
+
if (signal) await awaitWithSignal(loaded, signal, timeoutMessage);
|
|
21775
|
+
else await loaded;
|
|
21776
|
+
}
|
|
21753
21777
|
function throwIfCdpAborted(signal, fallback) {
|
|
21754
21778
|
if (signal.aborted) throw abortFailure(signal, fallback);
|
|
21755
21779
|
}
|
|
@@ -22255,10 +22279,11 @@ async function installAuxiliaryRenderers(endpoint, rendererSource, enabledAgents
|
|
|
22255
22279
|
} catch {
|
|
22256
22280
|
}
|
|
22257
22281
|
}
|
|
22258
|
-
async function installTarget(target2, rendererSource, enabledAgents, timeoutMs, pollIntervalMs, operations, voiceHost, voiceHostDisposals, signal) {
|
|
22282
|
+
async function installTarget(target2, rendererSource, enabledAgents, timeoutMs, pollIntervalMs, operations, voiceHost, voiceHostDisposals, signal, waitForDocumentLoad) {
|
|
22259
22283
|
const timeoutMessage = "Primary Renderer installation timed out";
|
|
22260
|
-
const
|
|
22261
|
-
const
|
|
22284
|
+
const loadSignal = signal ?? (waitForDocumentLoad ? AbortSignal.timeout(timeoutMs) : void 0);
|
|
22285
|
+
const run = (operation) => loadSignal ? runWithCdpSignal(loadSignal, timeoutMessage, operation) : operation();
|
|
22286
|
+
const renderer = loadSignal ? await connectRendererTarget(target2, operations, loadSignal, timeoutMessage) : await operations.connect(target2.webSocketDebuggerUrl);
|
|
22262
22287
|
let disposeModules;
|
|
22263
22288
|
try {
|
|
22264
22289
|
if (voiceHost && voiceHostDisposals)
|
|
@@ -22267,6 +22292,9 @@ async function installTarget(target2, rendererSource, enabledAgents, timeoutMs,
|
|
|
22267
22292
|
enableRuntime: false
|
|
22268
22293
|
})
|
|
22269
22294
|
);
|
|
22295
|
+
if (waitForDocumentLoad) {
|
|
22296
|
+
await waitForRendererDocumentLoad(renderer, run, loadSignal, timeoutMessage);
|
|
22297
|
+
}
|
|
22270
22298
|
disposeModules = await run(() => installRendererLoadedModules(renderer));
|
|
22271
22299
|
await run(() => renderer.command("Page.enable"));
|
|
22272
22300
|
await run(
|
|
@@ -22290,7 +22318,7 @@ async function installTarget(target2, rendererSource, enabledAgents, timeoutMs,
|
|
|
22290
22318
|
}
|
|
22291
22319
|
}
|
|
22292
22320
|
var InstalledRendererCdpControlSession = class {
|
|
22293
|
-
constructor(renderer, rendererCdpEndpoint2, rendererSource, overlayHookSource, overlayVoiceBootstrapSource, browserStyleClients, overlayClients, enabledAgents, timeoutMs, pollIntervalMs, operations, currentSnapshot, disposeModules, voiceHost, voiceHostDisposals) {
|
|
22321
|
+
constructor(renderer, rendererCdpEndpoint2, rendererSource, overlayHookSource, overlayVoiceBootstrapSource, browserStyleClients, overlayClients, enabledAgents, timeoutMs, pollIntervalMs, operations, currentSnapshot, disposeModules, voiceHost, voiceHostDisposals, waitForDocumentLoad) {
|
|
22294
22322
|
this.renderer = renderer;
|
|
22295
22323
|
this.rendererCdpEndpoint = rendererCdpEndpoint2;
|
|
22296
22324
|
this.rendererSource = rendererSource;
|
|
@@ -22306,6 +22334,7 @@ var InstalledRendererCdpControlSession = class {
|
|
|
22306
22334
|
this.disposeModules = disposeModules;
|
|
22307
22335
|
this.voiceHost = voiceHost;
|
|
22308
22336
|
this.voiceHostDisposals = voiceHostDisposals;
|
|
22337
|
+
this.waitForDocumentLoad = waitForDocumentLoad;
|
|
22309
22338
|
}
|
|
22310
22339
|
renderer;
|
|
22311
22340
|
rendererCdpEndpoint;
|
|
@@ -22322,6 +22351,7 @@ var InstalledRendererCdpControlSession = class {
|
|
|
22322
22351
|
disposeModules;
|
|
22323
22352
|
voiceHost;
|
|
22324
22353
|
voiceHostDisposals;
|
|
22354
|
+
waitForDocumentLoad;
|
|
22325
22355
|
#closed = false;
|
|
22326
22356
|
#lateVoiceHost;
|
|
22327
22357
|
#lateVoicePrimaryId;
|
|
@@ -22401,7 +22431,8 @@ var InstalledRendererCdpControlSession = class {
|
|
|
22401
22431
|
this.operations,
|
|
22402
22432
|
this.voiceHost,
|
|
22403
22433
|
this.voiceHostDisposals,
|
|
22404
|
-
this.#shutdown.signal
|
|
22434
|
+
this.#shutdown.signal,
|
|
22435
|
+
this.waitForDocumentLoad
|
|
22405
22436
|
);
|
|
22406
22437
|
if (this.#closed) {
|
|
22407
22438
|
replacement.disposeModules();
|
|
@@ -22589,7 +22620,9 @@ async function createRendererCdpControlSession(options) {
|
|
|
22589
22620
|
pollIntervalMs,
|
|
22590
22621
|
operations,
|
|
22591
22622
|
options.voiceHost,
|
|
22592
|
-
voiceHostDisposals
|
|
22623
|
+
voiceHostDisposals,
|
|
22624
|
+
options.signal,
|
|
22625
|
+
options.waitForDocumentLoad
|
|
22593
22626
|
);
|
|
22594
22627
|
const browserStyleClients = /* @__PURE__ */ new Map();
|
|
22595
22628
|
const overlayClients = /* @__PURE__ */ new Map();
|
|
@@ -22621,7 +22654,8 @@ async function createRendererCdpControlSession(options) {
|
|
|
22621
22654
|
installed.snapshot,
|
|
22622
22655
|
installed.disposeModules,
|
|
22623
22656
|
options.voiceHost,
|
|
22624
|
-
voiceHostDisposals
|
|
22657
|
+
voiceHostDisposals,
|
|
22658
|
+
options.waitForDocumentLoad === true
|
|
22625
22659
|
);
|
|
22626
22660
|
}
|
|
22627
22661
|
function installRendererCdpControlSession(options) {
|
|
@@ -22631,10 +22665,15 @@ function installRendererCdpControlSession(options) {
|
|
|
22631
22665
|
// packages/desktop-control/src/renderer-injection-skip.ts
|
|
22632
22666
|
var SKIPPED_DESKTOP_VERSION_PREFIXES = ["26.1103.", "26.1106."];
|
|
22633
22667
|
var HASHED_RENDERER_CANDIDATE_VERSION = "26.1106.51428";
|
|
22668
|
+
function hashedRendererWaitsForDocumentLoad(desktopVersion, platform = process.platform) {
|
|
22669
|
+
return platform === "win32" && desktopVersion?.trim() === HASHED_RENDERER_CANDIDATE_VERSION;
|
|
22670
|
+
}
|
|
22634
22671
|
function rendererInjectionSkipReason(desktopVersion, platform = process.platform, options) {
|
|
22635
22672
|
const version2 = desktopVersion?.trim();
|
|
22636
22673
|
if (!version2) return null;
|
|
22637
|
-
if (platform === "darwin"
|
|
22674
|
+
if (version2 === HASHED_RENDERER_CANDIDATE_VERSION && (platform === "darwin" || platform === "win32")) {
|
|
22675
|
+
return null;
|
|
22676
|
+
}
|
|
22638
22677
|
if (SKIPPED_DESKTOP_VERSION_PREFIXES.some((prefix) => version2.startsWith(prefix))) {
|
|
22639
22678
|
if (allowsIsolatedHashedInjection(version2, platform, options)) return null;
|
|
22640
22679
|
return `Desktop ${version2} is skipped until hashed Renderer bindings are requalified`;
|
|
@@ -23239,6 +23278,7 @@ ${bootstrap}${overlayBundle}` : void 0;
|
|
|
23239
23278
|
const overlayVoiceBootstrapSource = overlayHookSource && overlayBootstrapBundle.trim().length > 0 ? `${RENDERER_CSP_BOOTSTRAP}
|
|
23240
23279
|
${bootstrap}${overlayBootstrapBundle}` : void 0;
|
|
23241
23280
|
startupTrace("installing Renderer Session");
|
|
23281
|
+
const waitForDocumentLoad = hashedRendererWaitsForDocumentLoad(desktopVersion);
|
|
23242
23282
|
if (!voiceHost && options.hostDataDirectory && !skipReason) {
|
|
23243
23283
|
for (let attempt = 0; attempt < 8 && !voiceHost && !signal.aborted; attempt += 1) {
|
|
23244
23284
|
if (attempt > 0) await dependencies.sleep(250);
|
|
@@ -23259,7 +23299,8 @@ ${bootstrap}${rendererSource}`,
|
|
|
23259
23299
|
...voiceHost ? { voiceHost } : {},
|
|
23260
23300
|
// External Agents are discovered from each target Host after installation.
|
|
23261
23301
|
timeoutMs: PRODUCTION_INSTALL_TIMEOUT_MS,
|
|
23262
|
-
signal
|
|
23302
|
+
signal,
|
|
23303
|
+
...waitForDocumentLoad ? { waitForDocumentLoad } : {}
|
|
23263
23304
|
},
|
|
23264
23305
|
dependencies
|
|
23265
23306
|
);
|
package/app/host-runtime.mjs
CHANGED
|
@@ -33585,7 +33585,9 @@ var storedTurnMappingV1Schema = external_exports.object({
|
|
|
33585
33585
|
nativeTurnRef: nativeTurnRefSchema,
|
|
33586
33586
|
nativeCheckpointRef: nativeCheckpointRefSchema.optional(),
|
|
33587
33587
|
/** Desktop presentation for work completed during an external voice call. */
|
|
33588
|
-
realtimeInline: external_exports.literal(true).optional()
|
|
33588
|
+
realtimeInline: external_exports.literal(true).optional(),
|
|
33589
|
+
/** Voice-originated input uses Desktop's native delegation presentation. */
|
|
33590
|
+
realtimeDelegation: external_exports.literal(true).optional()
|
|
33589
33591
|
}).strict();
|
|
33590
33592
|
var storedGitInfoV1Schema = external_exports.object({
|
|
33591
33593
|
branch: nonBlankTextSchema6.max(4096).optional(),
|
|
@@ -34903,6 +34905,8 @@ var MappingStore = class {
|
|
|
34903
34905
|
}
|
|
34904
34906
|
if (update.realtimeInline)
|
|
34905
34907
|
hostMatch.realtimeInline = true;
|
|
34908
|
+
if (update.realtimeDelegation)
|
|
34909
|
+
hostMatch.realtimeDelegation = true;
|
|
34906
34910
|
continue;
|
|
34907
34911
|
}
|
|
34908
34912
|
const added = { ...update };
|
|
@@ -51196,6 +51200,35 @@ function discoveryTimeoutSignal(timeoutMs, signal) {
|
|
|
51196
51200
|
function abortFailure(signal, fallback) {
|
|
51197
51201
|
return signal.reason instanceof Error ? signal.reason : new Error(fallback);
|
|
51198
51202
|
}
|
|
51203
|
+
function isRendererDocumentLoadEvent(params) {
|
|
51204
|
+
if (!isRecord12(params) || typeof params.name !== "string")
|
|
51205
|
+
return false;
|
|
51206
|
+
return params.name === "DOMContentLoaded" || params.name === "load" || params.name === "networkIdle";
|
|
51207
|
+
}
|
|
51208
|
+
async function waitForRendererDocumentLoad(renderer, run, signal, timeoutMessage) {
|
|
51209
|
+
await run(() => renderer.command("Page.enable"));
|
|
51210
|
+
let finished = false;
|
|
51211
|
+
const loaded = new Promise((resolve3) => {
|
|
51212
|
+
const complete = () => {
|
|
51213
|
+
if (finished)
|
|
51214
|
+
return;
|
|
51215
|
+
finished = true;
|
|
51216
|
+
unsubscribeLoad();
|
|
51217
|
+
unsubscribeLifecycle();
|
|
51218
|
+
resolve3();
|
|
51219
|
+
};
|
|
51220
|
+
const unsubscribeLoad = renderer.on("Page.loadEventFired", complete);
|
|
51221
|
+
const unsubscribeLifecycle = renderer.on("Page.lifecycleEvent", (params) => {
|
|
51222
|
+
if (isRendererDocumentLoadEvent(params))
|
|
51223
|
+
complete();
|
|
51224
|
+
});
|
|
51225
|
+
});
|
|
51226
|
+
await run(() => renderer.command("Page.setLifecycleEventsEnabled", { enabled: true }));
|
|
51227
|
+
if (signal)
|
|
51228
|
+
await awaitWithSignal(loaded, signal, timeoutMessage);
|
|
51229
|
+
else
|
|
51230
|
+
await loaded;
|
|
51231
|
+
}
|
|
51199
51232
|
function throwIfCdpAborted(signal, fallback) {
|
|
51200
51233
|
if (signal.aborted)
|
|
51201
51234
|
throw abortFailure(signal, fallback);
|
|
@@ -51673,16 +51706,20 @@ async function installAuxiliaryRenderers(endpoint, rendererSource, enabledAgents
|
|
|
51673
51706
|
} catch {
|
|
51674
51707
|
}
|
|
51675
51708
|
}
|
|
51676
|
-
async function installTarget(target2, rendererSource, enabledAgents, timeoutMs, pollIntervalMs, operations2, voiceHost, voiceHostDisposals, signal) {
|
|
51709
|
+
async function installTarget(target2, rendererSource, enabledAgents, timeoutMs, pollIntervalMs, operations2, voiceHost, voiceHostDisposals, signal, waitForDocumentLoad) {
|
|
51677
51710
|
const timeoutMessage = "Primary Renderer installation timed out";
|
|
51678
|
-
const
|
|
51679
|
-
const
|
|
51711
|
+
const loadSignal = signal ?? (waitForDocumentLoad ? AbortSignal.timeout(timeoutMs) : void 0);
|
|
51712
|
+
const run = (operation) => loadSignal ? runWithCdpSignal(loadSignal, timeoutMessage, operation) : operation();
|
|
51713
|
+
const renderer = loadSignal ? await connectRendererTarget(target2, operations2, loadSignal, timeoutMessage) : await operations2.connect(target2.webSocketDebuggerUrl);
|
|
51680
51714
|
let disposeModules;
|
|
51681
51715
|
try {
|
|
51682
51716
|
if (voiceHost && voiceHostDisposals)
|
|
51683
51717
|
await run(() => bindRendererVoiceHost(renderer, voiceHost, voiceHostDisposals, {
|
|
51684
51718
|
enableRuntime: false
|
|
51685
51719
|
}));
|
|
51720
|
+
if (waitForDocumentLoad) {
|
|
51721
|
+
await waitForRendererDocumentLoad(renderer, run, loadSignal, timeoutMessage);
|
|
51722
|
+
}
|
|
51686
51723
|
disposeModules = await run(() => installRendererLoadedModules(renderer));
|
|
51687
51724
|
await run(() => renderer.command("Page.enable"));
|
|
51688
51725
|
await run(() => renderer.command("Page.addScriptToEvaluateOnNewDocument", { source: rendererSource }));
|
|
@@ -51714,6 +51751,7 @@ var InstalledRendererCdpControlSession = class {
|
|
|
51714
51751
|
disposeModules;
|
|
51715
51752
|
voiceHost;
|
|
51716
51753
|
voiceHostDisposals;
|
|
51754
|
+
waitForDocumentLoad;
|
|
51717
51755
|
#closed = false;
|
|
51718
51756
|
#lateVoiceHost;
|
|
51719
51757
|
#lateVoicePrimaryId;
|
|
@@ -51723,7 +51761,7 @@ var InstalledRendererCdpControlSession = class {
|
|
|
51723
51761
|
// close() aborts this deadline, so discovery, connects, installs, and
|
|
51724
51762
|
// liveness probes in flight stop instead of running to their own timeouts.
|
|
51725
51763
|
#shutdown = new AbortController();
|
|
51726
|
-
constructor(renderer, rendererCdpEndpoint, rendererSource, overlayHookSource, overlayVoiceBootstrapSource, browserStyleClients, overlayClients, enabledAgents, timeoutMs, pollIntervalMs, operations2, currentSnapshot, disposeModules, voiceHost, voiceHostDisposals) {
|
|
51764
|
+
constructor(renderer, rendererCdpEndpoint, rendererSource, overlayHookSource, overlayVoiceBootstrapSource, browserStyleClients, overlayClients, enabledAgents, timeoutMs, pollIntervalMs, operations2, currentSnapshot, disposeModules, voiceHost, voiceHostDisposals, waitForDocumentLoad) {
|
|
51727
51765
|
this.renderer = renderer;
|
|
51728
51766
|
this.rendererCdpEndpoint = rendererCdpEndpoint;
|
|
51729
51767
|
this.rendererSource = rendererSource;
|
|
@@ -51739,6 +51777,7 @@ var InstalledRendererCdpControlSession = class {
|
|
|
51739
51777
|
this.disposeModules = disposeModules;
|
|
51740
51778
|
this.voiceHost = voiceHost;
|
|
51741
51779
|
this.voiceHostDisposals = voiceHostDisposals;
|
|
51780
|
+
this.waitForDocumentLoad = waitForDocumentLoad;
|
|
51742
51781
|
}
|
|
51743
51782
|
get snapshot() {
|
|
51744
51783
|
return this.currentSnapshot;
|
|
@@ -51773,7 +51812,7 @@ var InstalledRendererCdpControlSession = class {
|
|
|
51773
51812
|
}
|
|
51774
51813
|
}
|
|
51775
51814
|
async #replacePrimary(target2) {
|
|
51776
|
-
const replacement = await installTarget(target2, this.rendererSource, this.enabledAgents, this.timeoutMs, this.pollIntervalMs, this.operations, this.voiceHost, this.voiceHostDisposals, this.#shutdown.signal);
|
|
51815
|
+
const replacement = await installTarget(target2, this.rendererSource, this.enabledAgents, this.timeoutMs, this.pollIntervalMs, this.operations, this.voiceHost, this.voiceHostDisposals, this.#shutdown.signal, this.waitForDocumentLoad);
|
|
51777
51816
|
if (this.#closed) {
|
|
51778
51817
|
replacement.disposeModules();
|
|
51779
51818
|
unbindRendererVoiceHost(replacement.renderer, this.voiceHostDisposals);
|
|
@@ -51938,11 +51977,11 @@ async function createRendererCdpControlSession(options) {
|
|
|
51938
51977
|
const operations2 = options.operations ?? defaultOperations;
|
|
51939
51978
|
const target2 = await waitForPrimaryTarget(options.rendererCdpEndpoint, operations2, timeoutMs, pollIntervalMs, void 0, options.signal);
|
|
51940
51979
|
const voiceHostDisposals = /* @__PURE__ */ new Map();
|
|
51941
|
-
const installed = await installTarget(target2, options.rendererSource, enabledAgents, timeoutMs, pollIntervalMs, operations2, options.voiceHost, voiceHostDisposals);
|
|
51980
|
+
const installed = await installTarget(target2, options.rendererSource, enabledAgents, timeoutMs, pollIntervalMs, operations2, options.voiceHost, voiceHostDisposals, options.signal, options.waitForDocumentLoad);
|
|
51942
51981
|
const browserStyleClients = /* @__PURE__ */ new Map();
|
|
51943
51982
|
const overlayClients = /* @__PURE__ */ new Map();
|
|
51944
51983
|
await installAuxiliaryRenderers(options.rendererCdpEndpoint, options.rendererSource, enabledAgents, options.overlayHookSource, options.overlayVoiceBootstrapSource, browserStyleClients, overlayClients, operations2, discoveryTimeoutSignal(timeoutMs, options.signal), options.voiceHost, voiceHostDisposals);
|
|
51945
|
-
return new InstalledRendererCdpControlSession(installed.renderer, options.rendererCdpEndpoint, options.rendererSource, options.overlayHookSource, options.overlayVoiceBootstrapSource, browserStyleClients, overlayClients, enabledAgents, timeoutMs, pollIntervalMs, operations2, installed.snapshot, installed.disposeModules, options.voiceHost, voiceHostDisposals);
|
|
51984
|
+
return new InstalledRendererCdpControlSession(installed.renderer, options.rendererCdpEndpoint, options.rendererSource, options.overlayHookSource, options.overlayVoiceBootstrapSource, browserStyleClients, overlayClients, enabledAgents, timeoutMs, pollIntervalMs, operations2, installed.snapshot, installed.disposeModules, options.voiceHost, voiceHostDisposals, options.waitForDocumentLoad === true);
|
|
51946
51985
|
}
|
|
51947
51986
|
function installRendererCdpControlSession(options) {
|
|
51948
51987
|
return createRendererCdpControlSession(options);
|
|
@@ -52425,29 +52464,67 @@ import { createHash as createHash10, randomUUID as randomUUID10 } from "node:cry
|
|
|
52425
52464
|
// packages/host-runtime/src/external-voice-presentation.ts
|
|
52426
52465
|
var INLINE_MARKDOWN = "::codex-realtime-inline{}\n";
|
|
52427
52466
|
var inlineMarker = /^::codex-realtime-inline\{\}\r?\n/u;
|
|
52467
|
+
var delegationInput = /^<realtime_delegation>\n <input>([\s\S]*)<\/input>\n<\/realtime_delegation>$/u;
|
|
52468
|
+
function externalVoiceUserInputText(text4) {
|
|
52469
|
+
const captured = delegationInput.exec(text4)?.[1];
|
|
52470
|
+
return captured === void 0 ? text4 : captured.replaceAll("<", "<").replaceAll(">", ">").replaceAll("&", "&");
|
|
52471
|
+
}
|
|
52472
|
+
function presentUserInput(text4) {
|
|
52473
|
+
if (delegationInput.test(text4)) return text4;
|
|
52474
|
+
const escaped = text4.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
52475
|
+
return `<realtime_delegation>
|
|
52476
|
+
<input>${escaped}</input>
|
|
52477
|
+
</realtime_delegation>`;
|
|
52478
|
+
}
|
|
52428
52479
|
function externalVoiceContentText(text4) {
|
|
52429
52480
|
return text4.replace(inlineMarker, "");
|
|
52430
52481
|
}
|
|
52431
52482
|
function object5(value2) {
|
|
52432
52483
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
52433
52484
|
}
|
|
52434
|
-
function presentItem(item) {
|
|
52485
|
+
function presentItem(item, delegatedInput = false) {
|
|
52486
|
+
if (delegatedInput && object5(item) && item.type === "userMessage" && Array.isArray(item.content)) {
|
|
52487
|
+
return {
|
|
52488
|
+
...item,
|
|
52489
|
+
codexhostNativeInput: item.codexhostNativeInput ?? item.content,
|
|
52490
|
+
content: item.content.map(
|
|
52491
|
+
(part) => object5(part) && part.type === "text" && typeof part.text === "string" ? { ...part, text: presentUserInput(part.text) } : part
|
|
52492
|
+
)
|
|
52493
|
+
};
|
|
52494
|
+
}
|
|
52435
52495
|
if (!object5(item) || item.type !== "agentMessage" || typeof item.text !== "string") return item;
|
|
52436
52496
|
if (!item.text.trim() || inlineMarker.test(item.text)) return item;
|
|
52437
52497
|
return { ...item, text: INLINE_MARKDOWN + item.text };
|
|
52438
52498
|
}
|
|
52439
|
-
function presentExternalVoiceTurn(turn) {
|
|
52499
|
+
function presentExternalVoiceTurn(turn, realtimeDelegation = false) {
|
|
52440
52500
|
if (!Array.isArray(turn.items)) return turn;
|
|
52441
|
-
return {
|
|
52501
|
+
return {
|
|
52502
|
+
...turn,
|
|
52503
|
+
items: turn.items.map(
|
|
52504
|
+
(item) => presentItem(item, realtimeDelegation && object5(item) && item.id === `${turn.id}-user`)
|
|
52505
|
+
)
|
|
52506
|
+
};
|
|
52442
52507
|
}
|
|
52443
|
-
function presentExternalVoiceMessage(message2) {
|
|
52508
|
+
function presentExternalVoiceMessage(message2, realtimeDelegation = false) {
|
|
52444
52509
|
const params = message2.params;
|
|
52445
52510
|
if (!object5(params)) return message2;
|
|
52446
52511
|
if ((message2.method === "item/started" || message2.method === "item/completed") && params.item) {
|
|
52447
|
-
return {
|
|
52512
|
+
return {
|
|
52513
|
+
...message2,
|
|
52514
|
+
params: {
|
|
52515
|
+
...params,
|
|
52516
|
+
item: presentItem(
|
|
52517
|
+
params.item,
|
|
52518
|
+
realtimeDelegation && object5(params.item) && params.item.id === `${params.turnId}-user`
|
|
52519
|
+
)
|
|
52520
|
+
}
|
|
52521
|
+
};
|
|
52448
52522
|
}
|
|
52449
52523
|
if ((message2.method === "turn/started" || message2.method === "turn/completed") && object5(params.turn)) {
|
|
52450
|
-
return {
|
|
52524
|
+
return {
|
|
52525
|
+
...message2,
|
|
52526
|
+
params: { ...params, turn: presentExternalVoiceTurn(params.turn, realtimeDelegation) }
|
|
52527
|
+
};
|
|
52451
52528
|
}
|
|
52452
52529
|
return message2;
|
|
52453
52530
|
}
|
|
@@ -52602,7 +52679,9 @@ async function projectExternalSnapshot(store, record7, snapshot2, previousParent
|
|
|
52602
52679
|
cwd: record7.cwd,
|
|
52603
52680
|
snapshot: { ...turn, input: withoutInjectedText(turn.input, injected), items }
|
|
52604
52681
|
});
|
|
52605
|
-
turns.push(
|
|
52682
|
+
turns.push(
|
|
52683
|
+
mapping.realtimeInline || mapping.realtimeDelegation ? presentExternalVoiceTurn(projected, mapping.realtimeDelegation) : projected
|
|
52684
|
+
);
|
|
52606
52685
|
}
|
|
52607
52686
|
return turns;
|
|
52608
52687
|
}
|
|
@@ -52735,7 +52814,7 @@ var ExternalThreadRepository = class {
|
|
|
52735
52814
|
if (!record7.nativeSessionRef || !this.store.saveUsageMeasurements) return record7;
|
|
52736
52815
|
return this.store.saveUsageMeasurements(record7.hostThreadId, record7.nativeSessionRef, values);
|
|
52737
52816
|
}
|
|
52738
|
-
async persistTurn(record7, hostTurnId, nativeTurnRef, nativeCheckpointRef, realtimeInline) {
|
|
52817
|
+
async persistTurn(record7, hostTurnId, nativeTurnRef, nativeCheckpointRef, realtimeInline, realtimeDelegation) {
|
|
52739
52818
|
if (record7.state !== "ready" || !record7.nativeSessionRef || nativeTurnRef.harnessId !== record7.harnessId || nativeTurnRef.nativeSessionId !== record7.nativeSessionRef.nativeSessionId || nativeCheckpointRef && (nativeCheckpointRef.harnessId !== record7.harnessId || nativeCheckpointRef.nativeSessionId !== record7.nativeSessionRef.nativeSessionId)) {
|
|
52740
52819
|
throw new Error("Live Turn identity does not belong to the stored Thread");
|
|
52741
52820
|
}
|
|
@@ -52744,7 +52823,8 @@ var ExternalThreadRepository = class {
|
|
|
52744
52823
|
hostTurnId,
|
|
52745
52824
|
nativeTurnRef,
|
|
52746
52825
|
...nativeCheckpointRef ? { nativeCheckpointRef } : {},
|
|
52747
|
-
...realtimeInline ? { realtimeInline } : {}
|
|
52826
|
+
...realtimeInline ? { realtimeInline } : {},
|
|
52827
|
+
...realtimeDelegation ? { realtimeDelegation } : {}
|
|
52748
52828
|
}
|
|
52749
52829
|
]);
|
|
52750
52830
|
}
|
|
@@ -52791,6 +52871,7 @@ var ExternalThreadRepository = class {
|
|
|
52791
52871
|
return {
|
|
52792
52872
|
hostTurnId: previous.hostTurnId,
|
|
52793
52873
|
...previous.realtimeInline ? { realtimeInline: true } : {},
|
|
52874
|
+
...previous.realtimeDelegation ? { realtimeDelegation: true } : {},
|
|
52794
52875
|
nativeTurnRef: turn.nativeTurnRef,
|
|
52795
52876
|
...turn.checkpoint ? { nativeCheckpointRef: turn.checkpoint } : {}
|
|
52796
52877
|
};
|
|
@@ -52823,6 +52904,7 @@ var ExternalThreadRepository = class {
|
|
|
52823
52904
|
return {
|
|
52824
52905
|
hostTurnId: previous.hostTurnId,
|
|
52825
52906
|
...previous.realtimeInline ? { realtimeInline: true } : {},
|
|
52907
|
+
...previous.realtimeDelegation ? { realtimeDelegation: true } : {},
|
|
52826
52908
|
nativeTurnRef: turn.nativeTurnRef,
|
|
52827
52909
|
...turn.checkpoint ? { nativeCheckpointRef: turn.checkpoint } : {}
|
|
52828
52910
|
};
|
|
@@ -52882,6 +52964,7 @@ var ExternalThreadRepository = class {
|
|
|
52882
52964
|
mapping: {
|
|
52883
52965
|
hostTurnId: mapping.hostTurnId,
|
|
52884
52966
|
...mapping.realtimeInline ? { realtimeInline: true } : {},
|
|
52967
|
+
...mapping.realtimeDelegation ? { realtimeDelegation: true } : {},
|
|
52885
52968
|
nativeTurnRef: turn.nativeTurnRef,
|
|
52886
52969
|
...turn.checkpoint ? { nativeCheckpointRef: turn.checkpoint } : {}
|
|
52887
52970
|
}
|
|
@@ -54033,7 +54116,9 @@ function isRecord15(value2) {
|
|
|
54033
54116
|
}
|
|
54034
54117
|
function userMessageText(item) {
|
|
54035
54118
|
if (!Array.isArray(item.content)) return "";
|
|
54036
|
-
return item.content.filter(isRecord15).map(
|
|
54119
|
+
return item.content.filter(isRecord15).map(
|
|
54120
|
+
(part) => part.type === "text" && typeof part.text === "string" ? externalVoiceUserInputText(part.text).trim() : ""
|
|
54121
|
+
).filter((text4) => text4.length > 0).join("\n");
|
|
54037
54122
|
}
|
|
54038
54123
|
function clip(text4) {
|
|
54039
54124
|
return text4.length <= MAX_MESSAGE_CHARS ? text4 : text4.slice(0, MAX_MESSAGE_CHARS);
|
|
@@ -59821,7 +59906,8 @@ var ExternalThreadRuntime = class {
|
|
|
59821
59906
|
event.turnId,
|
|
59822
59907
|
event.nativeTurnRef,
|
|
59823
59908
|
event.outcome.checkpoint,
|
|
59824
|
-
thread3.projectedTurns.get(event.turnId)?.realtimeInline
|
|
59909
|
+
thread3.projectedTurns.get(event.turnId)?.realtimeInline,
|
|
59910
|
+
thread3.projectedTurns.get(event.turnId)?.realtimeDelegation
|
|
59825
59911
|
);
|
|
59826
59912
|
thread3.persistenceError = null;
|
|
59827
59913
|
await this.persistUsageMeasurements(thread3);
|
|
@@ -69331,8 +69417,17 @@ var AppServerHost = class {
|
|
|
69331
69417
|
this.#unregisterDelegationApi = typeof unregisterDelegationApi === "function" ? unregisterDelegationApi : void 0;
|
|
69332
69418
|
this.#turnProjection = new ExternalTurnProjection({
|
|
69333
69419
|
writeJson: (value2) => {
|
|
69334
|
-
if (isRecord29(value2) && isRecord29(value2.params) && typeof value2.params.threadId === "string"
|
|
69335
|
-
|
|
69420
|
+
if (isRecord29(value2) && isRecord29(value2.params) && typeof value2.params.threadId === "string") {
|
|
69421
|
+
const threadId3 = value2.params.threadId;
|
|
69422
|
+
const thread3 = this.#externalRuntime.get(threadId3);
|
|
69423
|
+
const turnId = isRecord29(value2.params.turn) ? value2.params.turn.id : value2.params.turnId;
|
|
69424
|
+
const realtimeDelegation = typeof turnId === "string" && (thread3?.projectedTurns.get(turnId)?.realtimeDelegation === true || thread3?.record.turnMappings.some(
|
|
69425
|
+
(mapping) => mapping.hostTurnId === turnId && mapping.realtimeDelegation
|
|
69426
|
+
) === true);
|
|
69427
|
+
if (realtimeDelegation || this.#externalVoice.has(threadId3))
|
|
69428
|
+
return this.#writer.json(
|
|
69429
|
+
presentExternalVoiceMessage(value2, realtimeDelegation)
|
|
69430
|
+
);
|
|
69336
69431
|
}
|
|
69337
69432
|
return this.#writer.json(value2);
|
|
69338
69433
|
},
|
|
@@ -72814,7 +72909,9 @@ var AppServerHost = class {
|
|
|
72814
72909
|
if (!thread3.activeTurnId || forClient2 && thread3.ephemeralTurnIds.has(thread3.activeTurnId))
|
|
72815
72910
|
return turns;
|
|
72816
72911
|
const active2 = thread3.projectedTurns.get(thread3.activeTurnId);
|
|
72817
|
-
|
|
72912
|
+
if (!active2) return turns;
|
|
72913
|
+
const turn = forClient2 ? active2.projector.snapshotTurn() : active2.projector.pendingTurn();
|
|
72914
|
+
return [...turns, active2.realtimeDelegation ? presentExternalVoiceTurn(turn, true) : turn];
|
|
72818
72915
|
}
|
|
72819
72916
|
/**
|
|
72820
72917
|
* Background commands whose native task has not settled overlay their live
|
|
@@ -72930,7 +73027,8 @@ var AppServerHost = class {
|
|
|
72930
73027
|
if (signal.aborted) throw new Error("Voice session ended");
|
|
72931
73028
|
const thread3 = this.#externalRuntime.get(threadId3);
|
|
72932
73029
|
if (!thread3 || this.#closeRequested) throw new Error("External chat is unavailable");
|
|
72933
|
-
const started = await this.#beginExternalInputTurn(thread3, text4);
|
|
73030
|
+
const started = await this.#beginExternalInputTurn(thread3, text4, void 0, void 0, true);
|
|
73031
|
+
projectedTurn(thread3, started.turnId).realtimeDelegation = true;
|
|
72934
73032
|
answer = this.#externalVoiceResults.watch(threadId3, started.turnId, signal);
|
|
72935
73033
|
void answer.catch(() => void 0);
|
|
72936
73034
|
started.gate.resolve();
|
|
@@ -73851,11 +73949,12 @@ var AppServerHost = class {
|
|
|
73851
73949
|
this.#followExternalVoiceTurn(thread3.id, event.turnId);
|
|
73852
73950
|
}
|
|
73853
73951
|
const ephemeralTurn = event.type === "turn.completed" && (event.ephemeral === true || thread3.ephemeralTurnIds.has(event.turnId));
|
|
73952
|
+
const realtimeDelegation = thread3.projectedTurns.get(event.turnId)?.realtimeDelegation;
|
|
73854
73953
|
await this.#turnProjection.project(thread3, event);
|
|
73855
|
-
if (event.type === "turn.completed" && this.#externalVoice.has(thread3.id) && !ephemeralTurn) {
|
|
73954
|
+
if (event.type === "turn.completed" && (realtimeDelegation || this.#externalVoice.has(thread3.id)) && !ephemeralTurn) {
|
|
73856
73955
|
const last = thread3.turns.at(-1);
|
|
73857
73956
|
if (last && isRecord29(last)) {
|
|
73858
|
-
thread3.turns[thread3.turns.length - 1] = presentExternalVoiceTurn(last);
|
|
73957
|
+
thread3.turns[thread3.turns.length - 1] = presentExternalVoiceTurn(last, realtimeDelegation);
|
|
73859
73958
|
}
|
|
73860
73959
|
}
|
|
73861
73960
|
this.#externalVoiceResults.observe(
|
|
@@ -77080,8 +77080,12 @@ function itemOf(item, reasoningPreviewIds) {
|
|
|
77080
77080
|
return;
|
|
77081
77081
|
}
|
|
77082
77082
|
}
|
|
77083
|
+
function userMessageContent(item) {
|
|
77084
|
+
let content = item.codexhostNativeInput ?? item.content;
|
|
77085
|
+
return Array.isArray(content) ? content : [];
|
|
77086
|
+
}
|
|
77083
77087
|
function userMessageIdentity(item) {
|
|
77084
|
-
return JSON.stringify([item
|
|
77088
|
+
return JSON.stringify([userMessageContent(item), item.clientId ?? null]);
|
|
77085
77089
|
}
|
|
77086
77090
|
function nativeTime(seconds) {
|
|
77087
77091
|
return typeof seconds == "number" && Number.isFinite(seconds) && seconds >= 0 ? seconds * 1e3 : void 0;
|
|
@@ -77165,7 +77169,7 @@ var ChThreadView = class _ChThreadView {
|
|
|
77165
77169
|
let currentTurn;
|
|
77166
77170
|
for (let event of this.log.events)
|
|
77167
77171
|
if (event.type === "turn/start" && (currentTurn = event.data.turn), currentTurn === view.projector.turn && event.type === "user/message")
|
|
77168
|
-
return { seq: event.seq, turnId: turn.id, input: messages2[0]
|
|
77172
|
+
return { seq: event.seq, turnId: turn.id, input: userMessageContent(messages2[0]) };
|
|
77169
77173
|
}
|
|
77170
77174
|
/** Older native pages are projected separately, without changing the visible tail. */
|
|
77171
77175
|
prepend(turns) {
|
|
@@ -77294,7 +77298,7 @@ var ChThreadView = class _ChThreadView {
|
|
|
77294
77298
|
}
|
|
77295
77299
|
}), opening = items[0]?.type === "userMessage" ? items[0] : void 0;
|
|
77296
77300
|
opening ? projector.begin(
|
|
77297
|
-
this.projectInput(
|
|
77301
|
+
this.projectInput(userMessageContent(opening)),
|
|
77298
77302
|
typeof opening.clientId == "string" ? opening.clientId : void 0
|
|
77299
77303
|
) : projector.beginAutonomous([]), view = {
|
|
77300
77304
|
projector,
|
|
@@ -77312,7 +77316,7 @@ var ChThreadView = class _ChThreadView {
|
|
|
77312
77316
|
for (let item of items) {
|
|
77313
77317
|
if (item.type === "userMessage") {
|
|
77314
77318
|
view.userMessages.has(item.id) || (view.projector.steer(
|
|
77315
|
-
this.projectInput(
|
|
77319
|
+
this.projectInput(userMessageContent(item)),
|
|
77316
77320
|
typeof item.clientId == "string" ? item.clientId : void 0
|
|
77317
77321
|
), view.userMessages.set(item.id, userMessageIdentity(item)), view.started.add(item.id));
|
|
77318
77322
|
continue;
|
|
@@ -83556,6 +83560,20 @@ function discoveryTimeoutSignal(timeoutMs, signal) {
|
|
|
83556
83560
|
function abortFailure(signal, fallback) {
|
|
83557
83561
|
return signal.reason instanceof Error ? signal.reason : new Error(fallback);
|
|
83558
83562
|
}
|
|
83563
|
+
function isRendererDocumentLoadEvent(params) {
|
|
83564
|
+
return !isRecord5(params) || typeof params.name != "string" ? !1 : params.name === "DOMContentLoaded" || params.name === "load" || params.name === "networkIdle";
|
|
83565
|
+
}
|
|
83566
|
+
async function waitForRendererDocumentLoad(renderer, run2, signal, timeoutMessage) {
|
|
83567
|
+
await run2(() => renderer.command("Page.enable"));
|
|
83568
|
+
let finished2 = !1, loaded = new Promise((resolve22) => {
|
|
83569
|
+
let complete = () => {
|
|
83570
|
+
finished2 || (finished2 = !0, unsubscribeLoad(), unsubscribeLifecycle(), resolve22());
|
|
83571
|
+
}, unsubscribeLoad = renderer.on("Page.loadEventFired", complete), unsubscribeLifecycle = renderer.on("Page.lifecycleEvent", (params) => {
|
|
83572
|
+
isRendererDocumentLoadEvent(params) && complete();
|
|
83573
|
+
});
|
|
83574
|
+
});
|
|
83575
|
+
await run2(() => renderer.command("Page.setLifecycleEventsEnabled", { enabled: !0 })), signal ? await awaitWithSignal(loaded, signal, timeoutMessage) : await loaded;
|
|
83576
|
+
}
|
|
83559
83577
|
function throwIfCdpAborted(signal, fallback) {
|
|
83560
83578
|
if (signal.aborted)
|
|
83561
83579
|
throw abortFailure(signal, fallback);
|
|
@@ -83919,12 +83937,12 @@ async function installAuxiliaryRenderers(endpoint, rendererSource, enabledAgents
|
|
|
83919
83937
|
} catch {
|
|
83920
83938
|
}
|
|
83921
83939
|
}
|
|
83922
|
-
async function installTarget(target2, rendererSource, enabledAgents, timeoutMs, pollIntervalMs, operations, voiceHost, voiceHostDisposals, signal) {
|
|
83923
|
-
let timeoutMessage = "Primary Renderer installation timed out", run2 = (operation) =>
|
|
83940
|
+
async function installTarget(target2, rendererSource, enabledAgents, timeoutMs, pollIntervalMs, operations, voiceHost, voiceHostDisposals, signal, waitForDocumentLoad) {
|
|
83941
|
+
let timeoutMessage = "Primary Renderer installation timed out", loadSignal = signal ?? (waitForDocumentLoad ? AbortSignal.timeout(timeoutMs) : void 0), run2 = (operation) => loadSignal ? runWithCdpSignal(loadSignal, timeoutMessage, operation) : operation(), renderer = loadSignal ? await connectRendererTarget(target2, operations, loadSignal, timeoutMessage) : await operations.connect(target2.webSocketDebuggerUrl), disposeModules;
|
|
83924
83942
|
try {
|
|
83925
83943
|
voiceHost && voiceHostDisposals && await run2(() => bindRendererVoiceHost(renderer, voiceHost, voiceHostDisposals, {
|
|
83926
83944
|
enableRuntime: !1
|
|
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));
|
|
83945
|
+
})), waitForDocumentLoad && await waitForRendererDocumentLoad(renderer, run2, loadSignal, timeoutMessage), 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
83946
|
let draftPrewarmPolicy = await run2(() => operations.installDraftPrewarmPolicy(renderer)), binding = await waitForBinding(renderer, enabledAgents, timeoutMs, pollIntervalMs, signal);
|
|
83929
83947
|
return { renderer, snapshot: { target: target2, draftPrewarmPolicy, binding }, disposeModules };
|
|
83930
83948
|
} catch (error51) {
|
|
@@ -83947,6 +83965,7 @@ var InstalledRendererCdpControlSession = class {
|
|
|
83947
83965
|
disposeModules;
|
|
83948
83966
|
voiceHost;
|
|
83949
83967
|
voiceHostDisposals;
|
|
83968
|
+
waitForDocumentLoad;
|
|
83950
83969
|
#closed = !1;
|
|
83951
83970
|
#lateVoiceHost;
|
|
83952
83971
|
#lateVoicePrimaryId;
|
|
@@ -83956,8 +83975,8 @@ var InstalledRendererCdpControlSession = class {
|
|
|
83956
83975
|
// close() aborts this deadline, so discovery, connects, installs, and
|
|
83957
83976
|
// liveness probes in flight stop instead of running to their own timeouts.
|
|
83958
83977
|
#shutdown = new AbortController();
|
|
83959
|
-
constructor(renderer, rendererCdpEndpoint, rendererSource, overlayHookSource, overlayVoiceBootstrapSource, browserStyleClients, overlayClients, enabledAgents, timeoutMs, pollIntervalMs, operations, currentSnapshot, disposeModules, voiceHost, voiceHostDisposals) {
|
|
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;
|
|
83978
|
+
constructor(renderer, rendererCdpEndpoint, rendererSource, overlayHookSource, overlayVoiceBootstrapSource, browserStyleClients, overlayClients, enabledAgents, timeoutMs, pollIntervalMs, operations, currentSnapshot, disposeModules, voiceHost, voiceHostDisposals, waitForDocumentLoad) {
|
|
83979
|
+
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, this.waitForDocumentLoad = waitForDocumentLoad;
|
|
83961
83980
|
}
|
|
83962
83981
|
get snapshot() {
|
|
83963
83982
|
return this.currentSnapshot;
|
|
@@ -83977,7 +83996,7 @@ var InstalledRendererCdpControlSession = class {
|
|
|
83977
83996
|
}
|
|
83978
83997
|
}
|
|
83979
83998
|
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);
|
|
83999
|
+
let replacement = await installTarget(target2, this.rendererSource, this.enabledAgents, this.timeoutMs, this.pollIntervalMs, this.operations, this.voiceHost, this.voiceHostDisposals, this.#shutdown.signal, this.waitForDocumentLoad);
|
|
83981
84000
|
if (this.#closed)
|
|
83982
84001
|
throw replacement.disposeModules(), unbindRendererVoiceHost(replacement.renderer, this.voiceHostDisposals), replacement.renderer.close(), new Error("Renderer CDP Control Session is closed");
|
|
83983
84002
|
this.disposeModules(), unbindRendererVoiceHost(this.renderer, this.voiceHostDisposals), this.renderer.close(), this.renderer = replacement.renderer, this.disposeModules = replacement.disposeModules, this.currentSnapshot = replacement.snapshot;
|
|
@@ -84083,8 +84102,8 @@ var InstalledRendererCdpControlSession = class {
|
|
|
84083
84102
|
}
|
|
84084
84103
|
};
|
|
84085
84104
|
async function createRendererCdpControlSession(options) {
|
|
84086
|
-
let enabledAgents = options.enabledAgents, timeoutMs = options.timeoutMs ?? 3e4, pollIntervalMs = options.pollIntervalMs ?? 250, operations = options.operations ?? defaultOperations, target2 = await waitForPrimaryTarget(options.rendererCdpEndpoint, operations, timeoutMs, pollIntervalMs, void 0, options.signal), voiceHostDisposals = /* @__PURE__ */ new Map(), installed = await installTarget(target2, options.rendererSource, enabledAgents, timeoutMs, pollIntervalMs, operations, options.voiceHost, voiceHostDisposals), browserStyleClients = /* @__PURE__ */ new Map(), overlayClients = /* @__PURE__ */ new Map();
|
|
84087
|
-
return await installAuxiliaryRenderers(options.rendererCdpEndpoint, options.rendererSource, enabledAgents, options.overlayHookSource, options.overlayVoiceBootstrapSource, browserStyleClients, overlayClients, operations, discoveryTimeoutSignal(timeoutMs, options.signal), options.voiceHost, voiceHostDisposals), new InstalledRendererCdpControlSession(installed.renderer, options.rendererCdpEndpoint, options.rendererSource, options.overlayHookSource, options.overlayVoiceBootstrapSource, browserStyleClients, overlayClients, enabledAgents, timeoutMs, pollIntervalMs, operations, installed.snapshot, installed.disposeModules, options.voiceHost, voiceHostDisposals);
|
|
84105
|
+
let enabledAgents = options.enabledAgents, timeoutMs = options.timeoutMs ?? 3e4, pollIntervalMs = options.pollIntervalMs ?? 250, operations = options.operations ?? defaultOperations, target2 = await waitForPrimaryTarget(options.rendererCdpEndpoint, operations, timeoutMs, pollIntervalMs, void 0, options.signal), voiceHostDisposals = /* @__PURE__ */ new Map(), installed = await installTarget(target2, options.rendererSource, enabledAgents, timeoutMs, pollIntervalMs, operations, options.voiceHost, voiceHostDisposals, options.signal, options.waitForDocumentLoad), browserStyleClients = /* @__PURE__ */ new Map(), overlayClients = /* @__PURE__ */ new Map();
|
|
84106
|
+
return await installAuxiliaryRenderers(options.rendererCdpEndpoint, options.rendererSource, enabledAgents, options.overlayHookSource, options.overlayVoiceBootstrapSource, browserStyleClients, overlayClients, operations, discoveryTimeoutSignal(timeoutMs, options.signal), options.voiceHost, voiceHostDisposals), new InstalledRendererCdpControlSession(installed.renderer, options.rendererCdpEndpoint, options.rendererSource, options.overlayHookSource, options.overlayVoiceBootstrapSource, browserStyleClients, overlayClients, enabledAgents, timeoutMs, pollIntervalMs, operations, installed.snapshot, installed.disposeModules, options.voiceHost, voiceHostDisposals, options.waitForDocumentLoad === !0);
|
|
84088
84107
|
}
|
|
84089
84108
|
function installRendererCdpControlSession(options) {
|
|
84090
84109
|
return createRendererCdpControlSession(options);
|
package/bin/codexhost
CHANGED
|
Binary file
|
package/libexec/codexhost-shim
CHANGED
|
Binary file
|
|
Binary file
|