@karlorz/codexhost-cli-win32-x64 0.17.0-0 → 0.17.1-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/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 +910 -38
- package/app/host-runtime.mjs +911 -41
- package/app/plugins/antigravity/plugin.mjs +27 -7
- package/app/plugins/cursor-cli/plugin.mjs +19 -3
- package/app/plugins/kimi-code/plugin.mjs +50 -3
- package/app/plugins/pi/plugin.mjs +208 -88
- package/app/plugins/zcode/plugin.mjs +142 -9
- package/app/renderer-extension.js +800 -396
- package/bin/codexhost.exe +0 -0
- package/libexec/codexhost-node-repl.exe +0 -0
- package/libexec/codexhost-shim.exe +0 -0
- package/libexec/codexhost-updater.exe +0 -0
- package/package.json +1 -1
|
@@ -17070,9 +17070,10 @@ function isolateRendererPrewarmConsumption(manager, discardExternal) {
|
|
|
17070
17070
|
}
|
|
17071
17071
|
|
|
17072
17072
|
// packages/desktop-control/src/renderer-draft-prewarm-runtime.ts
|
|
17073
|
-
function createDraftPrewarmPolicyBridge(manager, bridge, hostId2, target, prewarmedThreadManager, isCurrentManager, retainResponses = retainRendererHostResponses, isolateConsumption = isolateRendererPrewarmConsumption) {
|
|
17073
|
+
function createDraftPrewarmPolicyBridge(manager, bridge, hostId2, target, prewarmedThreadManager, isCurrentManager, retainResponses = retainRendererHostResponses, isolateConsumption = isolateRendererPrewarmConsumption, sendControlRequest) {
|
|
17074
17074
|
let disposed = false;
|
|
17075
17075
|
const originalSend = bridge.sendRequest;
|
|
17076
|
+
const controlSend = (method, parameters) => sendControlRequest ? sendControlRequest(method, parameters) : originalSend.call(bridge, method, parameters);
|
|
17076
17077
|
const originalPrewarm = bridge.prewarmThreadStart;
|
|
17077
17078
|
const originalOnNotification = manager.onNotification;
|
|
17078
17079
|
const originalDispatchAppServerResponse = manager.dispatchAppServerResponse;
|
|
@@ -17156,7 +17157,7 @@ function createDraftPrewarmPolicyBridge(manager, bridge, hostId2, target, prewar
|
|
|
17156
17157
|
bridgeRequests.clear();
|
|
17157
17158
|
if (isRemoteControlHost && terminate) {
|
|
17158
17159
|
void Promise.resolve(
|
|
17159
|
-
|
|
17160
|
+
controlSend("process/kill", { processHandle: failedProcessHandle })
|
|
17160
17161
|
).catch(() => void 0);
|
|
17161
17162
|
}
|
|
17162
17163
|
};
|
|
@@ -17319,7 +17320,7 @@ function createDraftPrewarmPolicyBridge(manager, bridge, hostId2, target, prewar
|
|
|
17319
17320
|
];
|
|
17320
17321
|
const startedProcessHandle = bridgeProcessHandle;
|
|
17321
17322
|
try {
|
|
17322
|
-
const started =
|
|
17323
|
+
const started = controlSend("process/spawn", {
|
|
17323
17324
|
command,
|
|
17324
17325
|
processHandle: startedProcessHandle,
|
|
17325
17326
|
cwd: "C:\\",
|
|
@@ -17340,7 +17341,7 @@ function createDraftPrewarmPolicyBridge(manager, bridge, hostId2, target, prewar
|
|
|
17340
17341
|
const operation = async () => {
|
|
17341
17342
|
await startBridge();
|
|
17342
17343
|
if (bridgeState !== "ready") throw transportError("is not ready");
|
|
17343
|
-
await
|
|
17344
|
+
await controlSend("process/writeStdin", {
|
|
17344
17345
|
processHandle: bridgeProcessHandle,
|
|
17345
17346
|
deltaBase64: utf8Base64(`${JSON.stringify(value)}
|
|
17346
17347
|
`)
|
|
@@ -17620,7 +17621,7 @@ function createDraftPrewarmPolicyBridge(manager, bridge, hostId2, target, prewar
|
|
|
17620
17621
|
bridgeReadyTimeout = null;
|
|
17621
17622
|
if (isRemoteControlHost && (bridgeState === "starting" || bridgeState === "ready")) {
|
|
17622
17623
|
void Promise.resolve(
|
|
17623
|
-
|
|
17624
|
+
controlSend("process/kill", { processHandle: bridgeProcessHandle })
|
|
17624
17625
|
).catch(() => void 0);
|
|
17625
17626
|
}
|
|
17626
17627
|
bridgeState = "disposed";
|
|
@@ -17722,10 +17723,11 @@ function resolveRendererHostManager(discovery, hostId2, managerFrom = requestMan
|
|
|
17722
17723
|
}
|
|
17723
17724
|
|
|
17724
17725
|
// packages/desktop-control/src/renderer-host-routing.ts
|
|
17725
|
-
function installRendererHostRouting(root, target, discover, resolve, createPolicy) {
|
|
17726
|
+
function installRendererHostRouting(root, target, discover, resolve, createPolicy, readConnection, publishRouting = true) {
|
|
17726
17727
|
const existing = target.__codexhostHostRoutingV1;
|
|
17727
|
-
if (existing) return existing;
|
|
17728
|
-
|
|
17728
|
+
if (publishRouting && existing) return existing;
|
|
17729
|
+
if (publishRouting)
|
|
17730
|
+
target.__codexhostDraftPrewarmPolicyV1?.dispose?.();
|
|
17729
17731
|
let disposed = false;
|
|
17730
17732
|
let lastDiscovery = null;
|
|
17731
17733
|
const routes = /* @__PURE__ */ new Map();
|
|
@@ -17752,10 +17754,20 @@ function installRendererHostRouting(root, target, discover, resolve, createPolic
|
|
|
17752
17754
|
routes.delete(hostId2);
|
|
17753
17755
|
entry?.route.policy.dispose();
|
|
17754
17756
|
};
|
|
17757
|
+
const connectionFor = (hostId2) => {
|
|
17758
|
+
if (!hostId2.startsWith("remote-control:")) return void 0;
|
|
17759
|
+
try {
|
|
17760
|
+
return readConnection?.(hostId2);
|
|
17761
|
+
} catch {
|
|
17762
|
+
return null;
|
|
17763
|
+
}
|
|
17764
|
+
};
|
|
17765
|
+
const sameConnection = (expected, current) => expected === void 0 ? current === void 0 : current?.owner === expected.owner && current.revision === expected.revision;
|
|
17755
17766
|
const routeFor = (hostId2, discovery) => {
|
|
17756
17767
|
const manager = lookup(hostId2, discovery);
|
|
17768
|
+
const connection = connectionFor(hostId2);
|
|
17757
17769
|
const previous = routes.get(hostId2);
|
|
17758
|
-
if (manager && previous?.route.manager === manager && previous.bridge === manager.requestClient && previous.prewarmed === manager.prewarmedThreadManager && previous.route.policy.owns(
|
|
17770
|
+
if (manager && previous?.route.manager === manager && previous.bridge === manager.requestClient && previous.prewarmed === manager.prewarmedThreadManager && sameConnection(previous.connection, connection) && previous.route.policy.owns(
|
|
17759
17771
|
manager,
|
|
17760
17772
|
manager.requestClient,
|
|
17761
17773
|
hostId2,
|
|
@@ -17765,7 +17777,7 @@ function installRendererHostRouting(root, target, discover, resolve, createPolic
|
|
|
17765
17777
|
return previous.route;
|
|
17766
17778
|
}
|
|
17767
17779
|
retire(hostId2);
|
|
17768
|
-
if (!manager) return null;
|
|
17780
|
+
if (!manager || connection === null) return null;
|
|
17769
17781
|
const bridge = manager.requestClient;
|
|
17770
17782
|
const prewarmed = manager.prewarmedThreadManager;
|
|
17771
17783
|
const policy = createPolicy(
|
|
@@ -17774,13 +17786,14 @@ function installRendererHostRouting(root, target, discover, resolve, createPolic
|
|
|
17774
17786
|
hostId2,
|
|
17775
17787
|
target,
|
|
17776
17788
|
prewarmed,
|
|
17777
|
-
() => lookup(hostId2) === manager && manager.requestClient === bridge && manager.prewarmedThreadManager === prewarmed
|
|
17789
|
+
() => lookup(hostId2) === manager && sameConnection(connection, connectionFor(hostId2)) && manager.requestClient === bridge && manager.prewarmedThreadManager === prewarmed
|
|
17778
17790
|
);
|
|
17779
17791
|
const route = { hostId: hostId2, manager, policy };
|
|
17780
|
-
routes.set(hostId2, { route, bridge, prewarmed });
|
|
17792
|
+
routes.set(hostId2, { route, bridge, prewarmed, connection });
|
|
17781
17793
|
return route;
|
|
17782
17794
|
};
|
|
17783
17795
|
const publish = (route) => {
|
|
17796
|
+
if (!publishRouting) return;
|
|
17784
17797
|
const policy = route?.policy;
|
|
17785
17798
|
if (target.__codexhostDraftPrewarmPolicyV1 === policy) return;
|
|
17786
17799
|
Object.defineProperty(target, "__codexhostDraftPrewarmPolicyV1", {
|
|
@@ -17833,7 +17846,7 @@ function installRendererHostRouting(root, target, discover, resolve, createPolic
|
|
|
17833
17846
|
if (!composer) {
|
|
17834
17847
|
for (const [hostId3, entry] of routes) {
|
|
17835
17848
|
const manager = lookup(hostId3, discovery);
|
|
17836
|
-
if (manager !== entry.route.manager || manager.requestClient !== entry.bridge || manager.prewarmedThreadManager !== entry.prewarmed)
|
|
17849
|
+
if (manager !== entry.route.manager || manager.requestClient !== entry.bridge || manager.prewarmedThreadManager !== entry.prewarmed || !sameConnection(entry.connection, connectionFor(hostId3)))
|
|
17837
17850
|
retire(hostId3);
|
|
17838
17851
|
}
|
|
17839
17852
|
}
|
|
@@ -17853,7 +17866,11 @@ function installRendererHostRouting(root, target, discover, resolve, createPolic
|
|
|
17853
17866
|
}
|
|
17854
17867
|
}
|
|
17855
17868
|
};
|
|
17856
|
-
|
|
17869
|
+
if (publishRouting)
|
|
17870
|
+
Object.defineProperty(target, "__codexhostHostRoutingV1", {
|
|
17871
|
+
configurable: true,
|
|
17872
|
+
value: routing
|
|
17873
|
+
});
|
|
17857
17874
|
return routing;
|
|
17858
17875
|
}
|
|
17859
17876
|
|
|
@@ -18018,18 +18035,38 @@ function installRendererHostRpcRouting(root, target, dependencies) {
|
|
|
18018
18035
|
return existing;
|
|
18019
18036
|
}
|
|
18020
18037
|
let disposed = false;
|
|
18038
|
+
let nativeRouting = null;
|
|
18021
18039
|
let discovery = null;
|
|
18022
18040
|
const routes = /* @__PURE__ */ new Map();
|
|
18023
18041
|
const read = () => {
|
|
18024
18042
|
if (disposed) return null;
|
|
18025
|
-
|
|
18043
|
+
try {
|
|
18026
18044
|
const store = dependencies.findStore(root);
|
|
18027
18045
|
discovery = store ? dependencies.findFamily(store) : null;
|
|
18046
|
+
} catch {
|
|
18047
|
+
discovery = null;
|
|
18028
18048
|
}
|
|
18029
18049
|
return discovery;
|
|
18030
18050
|
};
|
|
18031
18051
|
if (!read()) return null;
|
|
18032
18052
|
const queuePolicy = dependencies.installQueuePolicy(root, target);
|
|
18053
|
+
const native = () => {
|
|
18054
|
+
if (disposed) return null;
|
|
18055
|
+
try {
|
|
18056
|
+
nativeRouting ??= dependencies.nativeRouting?.() ?? null;
|
|
18057
|
+
} catch {
|
|
18058
|
+
}
|
|
18059
|
+
return nativeRouting;
|
|
18060
|
+
};
|
|
18061
|
+
const connectionFor = (hostId2) => {
|
|
18062
|
+
if (!hostId2.startsWith("remote-control:")) return void 0;
|
|
18063
|
+
try {
|
|
18064
|
+
return dependencies.readConnection?.(hostId2);
|
|
18065
|
+
} catch {
|
|
18066
|
+
return null;
|
|
18067
|
+
}
|
|
18068
|
+
};
|
|
18069
|
+
const sameConnection = (previous, current) => previous === void 0 ? current === void 0 : current?.owner === previous.owner && current.revision === previous.revision;
|
|
18033
18070
|
const isRecord3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
18034
18071
|
const externalDrafts = /* @__PURE__ */ new Map();
|
|
18035
18072
|
const selectedModels = /* @__PURE__ */ new Map();
|
|
@@ -18107,16 +18144,25 @@ function installRendererHostRpcRouting(root, target, dependencies) {
|
|
|
18107
18144
|
const postMessage = function(message, ...rest) {
|
|
18108
18145
|
let routed = message;
|
|
18109
18146
|
try {
|
|
18110
|
-
routed = disposed ? message : routeCreationCall(message);
|
|
18147
|
+
routed = disposed || routes.size === 0 ? message : routeCreationCall(message);
|
|
18111
18148
|
} catch {
|
|
18112
18149
|
routed = message;
|
|
18113
18150
|
}
|
|
18114
18151
|
return originalPostMessage.call(this, routed, ...rest);
|
|
18115
18152
|
};
|
|
18116
18153
|
port.postMessage = postMessage;
|
|
18117
|
-
const createRoute = (hostId2, rpc) => {
|
|
18154
|
+
const createRoute = (hostId2, rpc, connection) => {
|
|
18118
18155
|
let retired = false;
|
|
18119
|
-
const isCurrent = () =>
|
|
18156
|
+
const isCurrent = () => {
|
|
18157
|
+
if (retired || disposed || routes.get(hostId2)?.rpc !== rpc || !sameConnection(connection, connectionFor(hostId2)))
|
|
18158
|
+
return false;
|
|
18159
|
+
try {
|
|
18160
|
+
const current = read();
|
|
18161
|
+
return !!current && dependencies.resolve(current, hostId2) === rpc;
|
|
18162
|
+
} catch {
|
|
18163
|
+
return false;
|
|
18164
|
+
}
|
|
18165
|
+
};
|
|
18120
18166
|
const manager = Object.freeze({
|
|
18121
18167
|
kind: "main-process-rpc",
|
|
18122
18168
|
getHostId: () => hostId2,
|
|
@@ -18193,15 +18239,23 @@ function installRendererHostRpcRouting(root, target, dependencies) {
|
|
|
18193
18239
|
routes.delete(hostId2);
|
|
18194
18240
|
entry?.route.policy.dispose();
|
|
18195
18241
|
};
|
|
18196
|
-
const routeFor = (hostId2) => {
|
|
18242
|
+
const routeFor = (hostId2, nativeRoute) => {
|
|
18243
|
+
if (disposed) return null;
|
|
18244
|
+
const connection = connectionFor(hostId2);
|
|
18245
|
+
const preferred = nativeRoute === void 0 ? native()?.forHost(hostId2) : nativeRoute;
|
|
18246
|
+
if (connection === null || preferred) {
|
|
18247
|
+
retire(hostId2);
|
|
18248
|
+
return connection === null ? null : preferred ?? null;
|
|
18249
|
+
}
|
|
18197
18250
|
const current = read();
|
|
18198
18251
|
const rpc = current ? dependencies.resolve(current, hostId2) : null;
|
|
18199
18252
|
const previous = routes.get(hostId2);
|
|
18200
|
-
if (rpc && previous?.rpc === rpc
|
|
18253
|
+
if (rpc && previous?.rpc === rpc && sameConnection(previous.connection, connection))
|
|
18254
|
+
return previous.route;
|
|
18201
18255
|
retire(hostId2);
|
|
18202
18256
|
if (!rpc) return null;
|
|
18203
|
-
const route = createRoute(hostId2, rpc);
|
|
18204
|
-
routes.set(hostId2, { route, rpc });
|
|
18257
|
+
const route = createRoute(hostId2, rpc, connection);
|
|
18258
|
+
routes.set(hostId2, { route, rpc, connection });
|
|
18205
18259
|
return route;
|
|
18206
18260
|
};
|
|
18207
18261
|
const publish = (route) => {
|
|
@@ -18216,14 +18270,22 @@ function installRendererHostRpcRouting(root, target, dependencies) {
|
|
|
18216
18270
|
}
|
|
18217
18271
|
};
|
|
18218
18272
|
const composerHostId = (composer) => {
|
|
18273
|
+
const nativeHostId = native()?.hostIdForComposer(composer);
|
|
18274
|
+
if (nativeHostId) return nativeHostId;
|
|
18219
18275
|
const hostIds = new Set(dependencies.composerHostIds(composer).hostIds);
|
|
18220
18276
|
const hostId2 = hostIds.size === 1 ? hostIds.values().next().value : null;
|
|
18221
18277
|
return typeof hostId2 === "string" && hostId2 ? hostId2 : null;
|
|
18222
18278
|
};
|
|
18223
18279
|
const routing = {
|
|
18224
18280
|
knownHostIds() {
|
|
18281
|
+
if (disposed) return [];
|
|
18225
18282
|
const current = read();
|
|
18226
|
-
return
|
|
18283
|
+
return [
|
|
18284
|
+
.../* @__PURE__ */ new Set([
|
|
18285
|
+
...current ? dependencies.hostIds(current) : [],
|
|
18286
|
+
...native()?.knownHostIds?.() ?? []
|
|
18287
|
+
])
|
|
18288
|
+
];
|
|
18227
18289
|
},
|
|
18228
18290
|
forHost(hostId2) {
|
|
18229
18291
|
return hostId2 && !disposed ? routeFor(hostId2) : null;
|
|
@@ -18239,18 +18301,22 @@ function installRendererHostRpcRouting(root, target, dependencies) {
|
|
|
18239
18301
|
forComposer(composer) {
|
|
18240
18302
|
if (disposed) return null;
|
|
18241
18303
|
let hostId2;
|
|
18304
|
+
let preferred = null;
|
|
18242
18305
|
try {
|
|
18243
|
-
|
|
18306
|
+
preferred = native()?.forComposer(composer) ?? null;
|
|
18307
|
+
hostId2 = preferred?.hostId ?? composerHostId(composer);
|
|
18244
18308
|
} catch {
|
|
18245
18309
|
hostId2 = null;
|
|
18246
18310
|
}
|
|
18247
|
-
const route = hostId2 ? routeFor(hostId2) : null;
|
|
18311
|
+
const route = hostId2 ? routeFor(hostId2, preferred) : null;
|
|
18248
18312
|
if (!composer) publish(route);
|
|
18249
18313
|
return route;
|
|
18250
18314
|
},
|
|
18251
18315
|
dispose() {
|
|
18252
18316
|
if (disposed) return;
|
|
18253
18317
|
disposed = true;
|
|
18318
|
+
nativeRouting?.dispose();
|
|
18319
|
+
nativeRouting = null;
|
|
18254
18320
|
for (const hostId2 of [...routes.keys()]) retire(hostId2);
|
|
18255
18321
|
discovery = null;
|
|
18256
18322
|
externalDrafts.clear();
|
|
@@ -18267,6 +18333,30 @@ function installRendererHostRpcRouting(root, target, dependencies) {
|
|
|
18267
18333
|
return routing;
|
|
18268
18334
|
}
|
|
18269
18335
|
|
|
18336
|
+
// packages/desktop-control/src/renderer-connection-generation.ts
|
|
18337
|
+
function readRendererConnectionGeneration(store, hostId2) {
|
|
18338
|
+
if (!store) return void 0;
|
|
18339
|
+
const record3 = (value) => value !== null && typeof value === "object";
|
|
18340
|
+
const candidates = /* @__PURE__ */ new Set();
|
|
18341
|
+
for (const members of store.familyBindings.values()) {
|
|
18342
|
+
const value = members.get(hostId2)?.value;
|
|
18343
|
+
if (record3(value) && record3(value.state$) && record3(value.revision$) && record3(value.appServerVersion$) && typeof value.state$.get === "function" && typeof value.revision$.get === "function")
|
|
18344
|
+
candidates.add(value);
|
|
18345
|
+
}
|
|
18346
|
+
if (!candidates.size) return void 0;
|
|
18347
|
+
if (candidates.size !== 1) return null;
|
|
18348
|
+
const owner = candidates.values().next().value;
|
|
18349
|
+
if (!owner) return null;
|
|
18350
|
+
const state = owner.state$;
|
|
18351
|
+
const revision = owner.revision$;
|
|
18352
|
+
try {
|
|
18353
|
+
const current = revision.get();
|
|
18354
|
+
return state.get() === "connected" && typeof current === "number" && Number.isSafeInteger(current) ? { owner, revision: current } : null;
|
|
18355
|
+
} catch {
|
|
18356
|
+
return null;
|
|
18357
|
+
}
|
|
18358
|
+
}
|
|
18359
|
+
|
|
18270
18360
|
// packages/desktop-control/src/renderer-draft-prewarm-policy.ts
|
|
18271
18361
|
var REQUEST_MANAGER_WAIT_TIMEOUT_MS = 6e4;
|
|
18272
18362
|
var REQUEST_MANAGER_POLL_INTERVAL_MS = 25;
|
|
@@ -18279,15 +18369,19 @@ function directRendererInstaller() {
|
|
|
18279
18369
|
const retainRendererHostResponses = ${retainRendererHostResponses.toString()};
|
|
18280
18370
|
const createDraftPrewarmPolicyBridge = ${createDraftPrewarmPolicyBridge.toString()};
|
|
18281
18371
|
const isolateRendererPrewarmConsumption = ${isolateRendererPrewarmConsumption.toString()};
|
|
18372
|
+
const findRendererAppScopeStore = ${findRendererAppScopeStore.toString()};
|
|
18373
|
+
const readRendererConnectionGeneration = ${readRendererConnectionGeneration.toString()};
|
|
18282
18374
|
const discover = (root) =>
|
|
18283
18375
|
discoverRendererHosts(root, committedReactAncestors, requestManagerFromHookState);
|
|
18284
|
-
const installNative = () => (${installRendererHostRouting.toString()})(
|
|
18376
|
+
const installNative = (publishRouting = true) => (${installRendererHostRouting.toString()})(
|
|
18285
18377
|
document, window, discover,
|
|
18286
18378
|
(discovery, hostId) => resolveRendererHostManager(discovery, hostId, requestManagerFromHookState),
|
|
18287
18379
|
(manager, bridge, hostId, target, prewarmed, isCurrent) => createDraftPrewarmPolicyBridge(
|
|
18288
18380
|
manager, bridge, hostId, target, prewarmed, isCurrent, retainRendererHostResponses,
|
|
18289
18381
|
isolateRendererPrewarmConsumption,
|
|
18290
18382
|
),
|
|
18383
|
+
(hostId) => readRendererConnectionGeneration(findRendererAppScopeStore(document), hostId),
|
|
18384
|
+
publishRouting,
|
|
18291
18385
|
);
|
|
18292
18386
|
const installRpc = () => typeof MessagePort !== 'function' ? null : (${installRendererHostRpcRouting.toString()})(document, window, {
|
|
18293
18387
|
findStore: ${findRendererAppScopeStore.toString()},
|
|
@@ -18306,20 +18400,21 @@ function directRendererInstaller() {
|
|
|
18306
18400
|
portPrototype: MessagePort.prototype,
|
|
18307
18401
|
}),
|
|
18308
18402
|
portPrototype: MessagePort.prototype,
|
|
18403
|
+
nativeRouting: () => {
|
|
18404
|
+
const native = discover(document);
|
|
18405
|
+
return native.managers.length || native.registries.length ? installNative(false) : null;
|
|
18406
|
+
},
|
|
18407
|
+
readConnection: (hostId) => readRendererConnectionGeneration(findRendererAppScopeStore(document), hostId),
|
|
18309
18408
|
});
|
|
18310
18409
|
const connected = (routing) => routing.forComposer() !== null ||
|
|
18311
18410
|
['local', ...(routing.knownHostIds?.() ?? [])].some((hostId) => routing.forHost(hostId) !== null);
|
|
18312
18411
|
let nativeReady = false;
|
|
18313
|
-
//
|
|
18314
|
-
//
|
|
18412
|
+
// Mixed layouts can expose native managers for only some Hosts. Keep one
|
|
18413
|
+
// router that selects a native owner or the current ready RPC peer per Host.
|
|
18315
18414
|
const routing = (() => {
|
|
18316
|
-
if (window.__codexhostHostRoutingV1)
|
|
18317
|
-
|
|
18318
|
-
|
|
18319
|
-
hostId => existing.forHost(hostId)?.manager.kind === 'main-process-rpc'
|
|
18320
|
-
)) installRpc();
|
|
18321
|
-
return existing;
|
|
18322
|
-
}
|
|
18415
|
+
if (window.__codexhostHostRoutingV1) return window.__codexhostHostRoutingV1;
|
|
18416
|
+
const rpc = installRpc();
|
|
18417
|
+
if (rpc) return rpc;
|
|
18323
18418
|
const native = discover(document);
|
|
18324
18419
|
if (native.managers.length || native.registries.length) {
|
|
18325
18420
|
const routing = installNative();
|
|
@@ -18329,8 +18424,6 @@ function directRendererInstaller() {
|
|
|
18329
18424
|
}
|
|
18330
18425
|
routing.dispose();
|
|
18331
18426
|
}
|
|
18332
|
-
const rpc = installRpc();
|
|
18333
|
-
if (rpc) return rpc;
|
|
18334
18427
|
throw new Error('Renderer Host request manager is unavailable');
|
|
18335
18428
|
})();
|
|
18336
18429
|
// Publish a default draft policy only when its Host is unambiguous. Host
|
|
@@ -18490,6 +18583,781 @@ async function installRendererLoadedModules(renderer) {
|
|
|
18490
18583
|
}
|
|
18491
18584
|
}
|
|
18492
18585
|
|
|
18586
|
+
// packages/desktop-control/src/renderer-native-rpc-discovery.ts
|
|
18587
|
+
function nativeManagerDependencies(factoryName, callers) {
|
|
18588
|
+
const identifier = "[$A-Z_a-z][$\\w]*";
|
|
18589
|
+
const escaped = factoryName.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
|
|
18590
|
+
const pattern = new RegExp(
|
|
18591
|
+
`${escaped}\\((${identifier}),(${identifier}),\\1\\.get\\((${identifier}),\\2\\),(${identifier})\\.bind\\(null,\\1\\),\\((${identifier}),(${identifier})\\)=>\\5\\((${identifier}),\\6\\)\\)`
|
|
18592
|
+
);
|
|
18593
|
+
const matches = callers.flatMap((source) => {
|
|
18594
|
+
const match = pattern.exec(source);
|
|
18595
|
+
return match?.[3] && match[4] && match[7] ? [
|
|
18596
|
+
{
|
|
18597
|
+
requestDefinition: match[3],
|
|
18598
|
+
isHostForConversation: match[4],
|
|
18599
|
+
imageDefinition: match[7]
|
|
18600
|
+
}
|
|
18601
|
+
] : [];
|
|
18602
|
+
});
|
|
18603
|
+
return matches.length === 1 ? matches[0] : void 0;
|
|
18604
|
+
}
|
|
18605
|
+
function nativeRpcRole(source) {
|
|
18606
|
+
if (["dispatchMessageFromView", "threadProjectAssignments", "queuedMessageCoordination"].every(
|
|
18607
|
+
(part) => source.includes(part)
|
|
18608
|
+
))
|
|
18609
|
+
return "createManager";
|
|
18610
|
+
if (["collectAppStateSnapshot", "getReviewPaneSnapshotMetrics", "registerReplayAdmission"].every(
|
|
18611
|
+
(part) => source.includes(part)
|
|
18612
|
+
))
|
|
18613
|
+
return "createController";
|
|
18614
|
+
if (["getWorkInProgress", "getCachedThreadSearchSnapshot", "registerReplayAdmission"].every(
|
|
18615
|
+
(part) => source.includes(part)
|
|
18616
|
+
))
|
|
18617
|
+
return "RpcManager";
|
|
18618
|
+
if (["prewarmedThreadManager", "onNotification", "dispatchAppServerResponse"].every(
|
|
18619
|
+
(part) => source.includes(part)
|
|
18620
|
+
))
|
|
18621
|
+
return "Manager";
|
|
18622
|
+
return void 0;
|
|
18623
|
+
}
|
|
18624
|
+
function nativeRpcObjectShape(value) {
|
|
18625
|
+
if (value === null || typeof value !== "object")
|
|
18626
|
+
return { scope: false, services: false, controller: false };
|
|
18627
|
+
const candidate = value;
|
|
18628
|
+
const own = (keys) => keys.every((key) => Object.hasOwn(candidate, key));
|
|
18629
|
+
const methods = (keys) => keys.every((key) => typeof candidate[key] === "function");
|
|
18630
|
+
return {
|
|
18631
|
+
scope: own(["node", "scope", "get", "set", "watch"]) && methods(["get", "set", "watch"]),
|
|
18632
|
+
services: own(["appServerManagers", "remoteConnections", "applicationMenu"]) && typeof candidate.appServerManagers?.subscribe === "function",
|
|
18633
|
+
controller: own(["forHost", "collectAppStateSnapshot", "getReviewPaneSnapshotMetrics", "dispose"]) && methods(["forHost", "collectAppStateSnapshot", "getReviewPaneSnapshotMetrics", "dispose"])
|
|
18634
|
+
};
|
|
18635
|
+
}
|
|
18636
|
+
async function withNativeRpcComponents(client, install) {
|
|
18637
|
+
const group = `codexhost-native-rpc-${crypto.randomUUID()}`;
|
|
18638
|
+
const command = async (method, params) => client.command(method, params);
|
|
18639
|
+
const evaluate = (expression) => command("Runtime.evaluate", { expression, awaitPromise: true, objectGroup: group });
|
|
18640
|
+
const properties = (objectId) => command("Runtime.getProperties", { objectId, ownProperties: true });
|
|
18641
|
+
const call = (objectId, functionDeclaration, args = []) => command("Runtime.callFunctionOn", {
|
|
18642
|
+
objectId,
|
|
18643
|
+
functionDeclaration,
|
|
18644
|
+
arguments: args,
|
|
18645
|
+
objectGroup: group,
|
|
18646
|
+
returnByValue: true
|
|
18647
|
+
});
|
|
18648
|
+
try {
|
|
18649
|
+
const initial = await evaluate(String.raw`(() => {
|
|
18650
|
+
const catalog = globalThis.__codexhostLoadedModulesV1;
|
|
18651
|
+
if (!catalog?.complete || catalog.documentUrl !== location.href) return null;
|
|
18652
|
+
const urls = catalog.urls.filter(url => /^app:\/\/-\/assets\/(?:renderer-app-server-managers|app-shared)-[^/]+\.js$/.test(url));
|
|
18653
|
+
return { document, urls };
|
|
18654
|
+
})()`);
|
|
18655
|
+
if (!initial.result.objectId) return false;
|
|
18656
|
+
const holder = initial.result.objectId;
|
|
18657
|
+
const catalog = await call(holder, "function(){return this.urls}");
|
|
18658
|
+
const urls = catalog.result.value;
|
|
18659
|
+
if (!Array.isArray(urls) || urls.length !== 2) return false;
|
|
18660
|
+
const managerUrl = urls.find((url2) => url2.includes("renderer-app-server-managers"));
|
|
18661
|
+
const sharedUrl = urls.find((url2) => url2.includes("app-shared"));
|
|
18662
|
+
if (!managerUrl || !sharedUrl) return false;
|
|
18663
|
+
const attach = async (name, objectId) => {
|
|
18664
|
+
const result = await call(
|
|
18665
|
+
holder,
|
|
18666
|
+
"function(name,value){if(this.document!==document)throw Error('Renderer Realm changed');this[name]=value;return true}",
|
|
18667
|
+
[{ value: name }, { objectId }]
|
|
18668
|
+
);
|
|
18669
|
+
if (result.exceptionDetails) throw new Error("Native RPC discovery lost its Renderer Realm");
|
|
18670
|
+
};
|
|
18671
|
+
const imported = await evaluate(`import(${JSON.stringify(managerUrl)})`);
|
|
18672
|
+
if (!imported.result.objectId) return false;
|
|
18673
|
+
const exports = (await properties(imported.result.objectId)).result.filter(
|
|
18674
|
+
(entry) => entry.value?.type === "function"
|
|
18675
|
+
);
|
|
18676
|
+
let bindings = [];
|
|
18677
|
+
for (const entry of exports.slice(0, 3)) {
|
|
18678
|
+
if (!entry.value?.objectId) continue;
|
|
18679
|
+
const scopes = (await properties(entry.value.objectId)).internalProperties?.find(
|
|
18680
|
+
(entry2) => entry2.name === "[[Scopes]]"
|
|
18681
|
+
)?.value?.objectId;
|
|
18682
|
+
if (!scopes) continue;
|
|
18683
|
+
const modules = (await properties(scopes)).result.filter(
|
|
18684
|
+
(entry2) => entry2.value?.description?.startsWith("Module") && entry2.value.objectId
|
|
18685
|
+
);
|
|
18686
|
+
const moduleId = modules[0]?.value?.objectId;
|
|
18687
|
+
if (modules.length !== 1 || !moduleId) continue;
|
|
18688
|
+
bindings = (await properties(moduleId)).result;
|
|
18689
|
+
break;
|
|
18690
|
+
}
|
|
18691
|
+
const functions = bindings.filter((entry) => entry.value?.type === "function");
|
|
18692
|
+
const roles = /* @__PURE__ */ new Map();
|
|
18693
|
+
for (const entry of functions) {
|
|
18694
|
+
const role = nativeRpcRole(entry.value?.description ?? "");
|
|
18695
|
+
if (role) roles.set(role, [...roles.get(role) ?? [], entry]);
|
|
18696
|
+
}
|
|
18697
|
+
if (["createManager", "Manager", "RpcManager", "createController"].some(
|
|
18698
|
+
(role) => roles.get(role)?.length !== 1
|
|
18699
|
+
))
|
|
18700
|
+
return false;
|
|
18701
|
+
const factory = roles.get("createManager")?.[0];
|
|
18702
|
+
if (!factory) return false;
|
|
18703
|
+
const dependencies = nativeManagerDependencies(
|
|
18704
|
+
factory.name,
|
|
18705
|
+
functions.map((entry) => entry.value?.description ?? "")
|
|
18706
|
+
);
|
|
18707
|
+
if (!dependencies) return false;
|
|
18708
|
+
for (const [role, entries] of roles) {
|
|
18709
|
+
const id = entries[0]?.value?.objectId;
|
|
18710
|
+
if (!id) return false;
|
|
18711
|
+
await attach(role, id);
|
|
18712
|
+
}
|
|
18713
|
+
for (const [role, name] of Object.entries(dependencies)) {
|
|
18714
|
+
const value = bindings.find((entry) => entry.name === name)?.value?.objectId;
|
|
18715
|
+
if (!value) return false;
|
|
18716
|
+
await attach(role, value);
|
|
18717
|
+
}
|
|
18718
|
+
const shared = await evaluate(`import(${JSON.stringify(sharedUrl)})`);
|
|
18719
|
+
if (!shared.result.objectId) return false;
|
|
18720
|
+
const sharedExports = (await properties(shared.result.objectId)).result;
|
|
18721
|
+
const sessions = sharedExports.filter(
|
|
18722
|
+
(entry) => entry.value?.type === "function" && ["getRemoteMain", "getStats", "drain", "getMainImport"].every(
|
|
18723
|
+
(word) => entry.value?.description?.includes(word)
|
|
18724
|
+
)
|
|
18725
|
+
);
|
|
18726
|
+
const sessionId = sessions[0]?.value?.objectId;
|
|
18727
|
+
if (sessions.length !== 1 || !sessionId) return false;
|
|
18728
|
+
await attach("RpcSession", sessionId);
|
|
18729
|
+
const serviceMatches = await command("Runtime.callFunctionOn", {
|
|
18730
|
+
objectId: shared.result.objectId,
|
|
18731
|
+
functionDeclaration: `function(){return [...new Set(Object.values(this).filter(value => (${nativeRpcObjectShape.toString()})(value).services))]}`,
|
|
18732
|
+
objectGroup: group
|
|
18733
|
+
});
|
|
18734
|
+
if (!serviceMatches.result.objectId) return false;
|
|
18735
|
+
const services = (await properties(serviceMatches.result.objectId)).result.flatMap(
|
|
18736
|
+
(entry) => entry.value?.type === "object" && entry.value.objectId ? [entry.value.objectId] : []
|
|
18737
|
+
);
|
|
18738
|
+
const serviceId = services[0];
|
|
18739
|
+
if (services.length !== 1 || !serviceId) return false;
|
|
18740
|
+
await attach("services", serviceId);
|
|
18741
|
+
const prototype = await evaluate("Object.getPrototypeOf(async function(){})");
|
|
18742
|
+
if (!prototype.result.objectId) return false;
|
|
18743
|
+
const objects = await command("Runtime.queryObjects", {
|
|
18744
|
+
prototypeObjectId: prototype.result.objectId,
|
|
18745
|
+
objectGroup: group
|
|
18746
|
+
});
|
|
18747
|
+
if (!objects.objects.objectId) return false;
|
|
18748
|
+
const filtered = await command("Runtime.callFunctionOn", {
|
|
18749
|
+
objectId: objects.objects.objectId,
|
|
18750
|
+
functionDeclaration: 'function(){return this.filter(fn=>fn.name==="collectAppStateSnapshot"&&String(fn).includes("collectSnapshot")).slice(0,9)}',
|
|
18751
|
+
objectGroup: group
|
|
18752
|
+
});
|
|
18753
|
+
if (!filtered.result.objectId) return false;
|
|
18754
|
+
const snapshots = (await properties(filtered.result.objectId)).result.filter(
|
|
18755
|
+
(entry) => entry.value?.type === "function"
|
|
18756
|
+
);
|
|
18757
|
+
if (snapshots.length > 8) return false;
|
|
18758
|
+
const owners = [];
|
|
18759
|
+
for (const snapshot of snapshots) {
|
|
18760
|
+
const fn = snapshot.value?.objectId;
|
|
18761
|
+
if (!fn) continue;
|
|
18762
|
+
const scopes = (await properties(fn)).internalProperties?.find(
|
|
18763
|
+
(entry) => entry.name === "[[Scopes]]"
|
|
18764
|
+
)?.value?.objectId;
|
|
18765
|
+
if (!scopes) continue;
|
|
18766
|
+
for (const scope of (await properties(scopes)).result) {
|
|
18767
|
+
if (!scope.value?.description?.startsWith("Closure") || !scope.value.objectId) continue;
|
|
18768
|
+
const candidates = (await properties(scope.value.objectId)).result;
|
|
18769
|
+
const controllers = [], handles = [];
|
|
18770
|
+
for (const binding of candidates) {
|
|
18771
|
+
if (binding.value?.type !== "object" || !binding.value.objectId) continue;
|
|
18772
|
+
const id = binding.value.objectId;
|
|
18773
|
+
const response = await call(
|
|
18774
|
+
id,
|
|
18775
|
+
`function(){return (${nativeRpcObjectShape.toString()})(this)}`
|
|
18776
|
+
);
|
|
18777
|
+
const shape = response.result.value;
|
|
18778
|
+
if (shape?.scope) handles.push(id);
|
|
18779
|
+
if (shape?.controller && (await call(id, "function(fn){return this.collectAppStateSnapshot===fn}", [
|
|
18780
|
+
{ objectId: fn }
|
|
18781
|
+
])).result.value === true)
|
|
18782
|
+
controllers.push(id);
|
|
18783
|
+
}
|
|
18784
|
+
const controller = controllers[0], handle = handles[0];
|
|
18785
|
+
if (controllers.length === 1 && handles.length === 1 && controller && handle)
|
|
18786
|
+
owners.push({ controller, scope: handle });
|
|
18787
|
+
}
|
|
18788
|
+
}
|
|
18789
|
+
const owner = owners[0];
|
|
18790
|
+
if (owners.length !== 1 || !owner) return false;
|
|
18791
|
+
await attach("controller", owner.controller);
|
|
18792
|
+
await attach("scope", owner.scope);
|
|
18793
|
+
return await install(holder);
|
|
18794
|
+
} finally {
|
|
18795
|
+
await client.command("Runtime.releaseObjectGroup", { objectGroup: group }).catch(() => void 0);
|
|
18796
|
+
}
|
|
18797
|
+
}
|
|
18798
|
+
|
|
18799
|
+
// packages/desktop-control/src/renderer-native-rpc-runtime.ts
|
|
18800
|
+
function installNativeRpcRemoteControl(components, target, dependencies) {
|
|
18801
|
+
if (target.__codexhostNativeRpcRemoteControlV1) return true;
|
|
18802
|
+
const routing = target.__codexhostHostRoutingV1;
|
|
18803
|
+
if (!routing) return false;
|
|
18804
|
+
const adapted = dependencies.createService(
|
|
18805
|
+
components,
|
|
18806
|
+
(hostId2, upstream) => dependencies.createManager(
|
|
18807
|
+
components,
|
|
18808
|
+
hostId2,
|
|
18809
|
+
upstream,
|
|
18810
|
+
target,
|
|
18811
|
+
dependencies.createPolicy,
|
|
18812
|
+
dependencies.createChannel,
|
|
18813
|
+
dependencies.retainInteractions
|
|
18814
|
+
)
|
|
18815
|
+
);
|
|
18816
|
+
const controller = components.controller;
|
|
18817
|
+
const originalHost = routing.forHost, originalComposer = routing.forComposer, originalDispose = routing.dispose;
|
|
18818
|
+
controller.dispose();
|
|
18819
|
+
let replacement;
|
|
18820
|
+
try {
|
|
18821
|
+
replacement = components.createController(components.scope, adapted.service);
|
|
18822
|
+
} catch (error51) {
|
|
18823
|
+
replacement = components.createController(
|
|
18824
|
+
components.scope,
|
|
18825
|
+
components.services.appServerManagers
|
|
18826
|
+
);
|
|
18827
|
+
throw error51;
|
|
18828
|
+
} finally {
|
|
18829
|
+
adapted.service[Symbol.dispose]();
|
|
18830
|
+
controller.forHost = (hostId2) => replacement.forHost(hostId2);
|
|
18831
|
+
controller.collectAppStateSnapshot = (hostId2, options) => replacement.collectAppStateSnapshot(hostId2, options);
|
|
18832
|
+
controller.getReviewPaneSnapshotMetrics = (hostId2) => replacement.getReviewPaneSnapshotMetrics(hostId2);
|
|
18833
|
+
controller.dispose = () => replacement.dispose();
|
|
18834
|
+
}
|
|
18835
|
+
const forHost = (hostId2) => {
|
|
18836
|
+
const route = adapted.route(hostId2);
|
|
18837
|
+
return route === void 0 ? originalHost.call(routing, hostId2) : route;
|
|
18838
|
+
};
|
|
18839
|
+
const forComposer = (composer) => {
|
|
18840
|
+
const hostId2 = routing.hostIdForComposer(composer);
|
|
18841
|
+
return hostId2 ? forHost(hostId2) : originalComposer.call(routing, composer);
|
|
18842
|
+
};
|
|
18843
|
+
routing.forHost = forHost;
|
|
18844
|
+
routing.forComposer = forComposer;
|
|
18845
|
+
const installation = {
|
|
18846
|
+
dispose() {
|
|
18847
|
+
if (target.__codexhostNativeRpcRemoteControlV1 !== installation) return;
|
|
18848
|
+
delete target.__codexhostNativeRpcRemoteControlV1;
|
|
18849
|
+
replacement.dispose();
|
|
18850
|
+
replacement = components.createController(
|
|
18851
|
+
components.scope,
|
|
18852
|
+
components.services.appServerManagers
|
|
18853
|
+
);
|
|
18854
|
+
if (routing.forHost === forHost) routing.forHost = originalHost;
|
|
18855
|
+
if (routing.forComposer === forComposer) routing.forComposer = originalComposer;
|
|
18856
|
+
routing.dispose = originalDispose;
|
|
18857
|
+
}
|
|
18858
|
+
};
|
|
18859
|
+
routing.dispose = () => {
|
|
18860
|
+
installation.dispose();
|
|
18861
|
+
originalDispose.call(routing);
|
|
18862
|
+
};
|
|
18863
|
+
target.__codexhostNativeRpcRemoteControlV1 = installation;
|
|
18864
|
+
return true;
|
|
18865
|
+
}
|
|
18866
|
+
|
|
18867
|
+
// packages/desktop-control/src/renderer-native-remote-manager.ts
|
|
18868
|
+
function createNativeRemoteManager(components, hostId2, original, target, createPolicy, createChannel, retainInteractions) {
|
|
18869
|
+
const source = components.scope.get(components.requestDefinition, hostId2);
|
|
18870
|
+
const upstream = original.dup();
|
|
18871
|
+
let manager;
|
|
18872
|
+
let policy;
|
|
18873
|
+
let interactions;
|
|
18874
|
+
let disposed = false;
|
|
18875
|
+
const pending = /* @__PURE__ */ new Set();
|
|
18876
|
+
const send = (method, params, options) => {
|
|
18877
|
+
const request = upstream.sendRequest(method, params, options);
|
|
18878
|
+
const result = Promise.resolve(request).finally(() => {
|
|
18879
|
+
request[Symbol.dispose]();
|
|
18880
|
+
pending.delete(result);
|
|
18881
|
+
});
|
|
18882
|
+
pending.add(result);
|
|
18883
|
+
return result;
|
|
18884
|
+
};
|
|
18885
|
+
const record3 = (value) => value !== null && typeof value === "object";
|
|
18886
|
+
const dispatch = (type, payload) => {
|
|
18887
|
+
if ((type === "mcp-request" || type === "thread-prewarm-start") && record3(payload) && record3(payload.request)) {
|
|
18888
|
+
const request = payload.request;
|
|
18889
|
+
const options = {};
|
|
18890
|
+
for (const key of ["priority", "timeoutMs", "source", "trace", "threadAccess"])
|
|
18891
|
+
if (payload[key] !== void 0) options[key] = payload[key];
|
|
18892
|
+
void send(String(request.method), request.params, options).then(
|
|
18893
|
+
(result) => {
|
|
18894
|
+
if (!disposed) client.onResult(request.id, result);
|
|
18895
|
+
},
|
|
18896
|
+
(error51) => {
|
|
18897
|
+
if (!disposed)
|
|
18898
|
+
client.onError(request.id, {
|
|
18899
|
+
code: record3(error51) ? error51.jsonRpcCode ?? error51.code ?? -32603 : -32603,
|
|
18900
|
+
message: error51 instanceof Error ? error51.message : String(error51)
|
|
18901
|
+
});
|
|
18902
|
+
}
|
|
18903
|
+
);
|
|
18904
|
+
return;
|
|
18905
|
+
}
|
|
18906
|
+
return source.dispatchMessage(type, payload);
|
|
18907
|
+
};
|
|
18908
|
+
const Constructor = source.constructor;
|
|
18909
|
+
let client;
|
|
18910
|
+
try {
|
|
18911
|
+
client = new Constructor(
|
|
18912
|
+
hostId2,
|
|
18913
|
+
dispatch,
|
|
18914
|
+
false,
|
|
18915
|
+
(id) => manager?.getConversation(id)?.threadAccess
|
|
18916
|
+
);
|
|
18917
|
+
client.setAppServerVersion(source.getAppServerVersion());
|
|
18918
|
+
manager = components.createManager(
|
|
18919
|
+
components.scope,
|
|
18920
|
+
hostId2,
|
|
18921
|
+
client,
|
|
18922
|
+
components.isHostForConversation.bind(null, components.scope),
|
|
18923
|
+
(get, id) => get(components.imageDefinition, id),
|
|
18924
|
+
{ dispatchMessageFromView: dispatch }
|
|
18925
|
+
);
|
|
18926
|
+
manager.dispatchAppServerResponse = manager.sendAppServerResponse;
|
|
18927
|
+
const owned = manager;
|
|
18928
|
+
const ownedPolicy = createPolicy(
|
|
18929
|
+
owned,
|
|
18930
|
+
client,
|
|
18931
|
+
hostId2,
|
|
18932
|
+
target,
|
|
18933
|
+
owned.prewarmedThreadManager,
|
|
18934
|
+
() => !disposed,
|
|
18935
|
+
void 0,
|
|
18936
|
+
void 0,
|
|
18937
|
+
(method, params) => send(method, params, { priority: "critical" })
|
|
18938
|
+
);
|
|
18939
|
+
policy = ownedPolicy;
|
|
18940
|
+
owned.sendAppServerResponse = (...args) => owned.dispatchAppServerResponse(...args);
|
|
18941
|
+
const channel = createChannel(components, owned);
|
|
18942
|
+
const nativeInteractions = retainInteractions(upstream, owned, hostId2);
|
|
18943
|
+
interactions = nativeInteractions;
|
|
18944
|
+
const notify = (event) => {
|
|
18945
|
+
const { data, source: source2, origin } = event;
|
|
18946
|
+
if (disposed || source2 != null && source2 !== target || !record3(data) || data.hostId !== hostId2)
|
|
18947
|
+
return;
|
|
18948
|
+
const ownOrigin = record3(target.location) ? target.location.origin : void 0;
|
|
18949
|
+
if (source2 === target && ownOrigin && ownOrigin !== "null" && origin !== ownOrigin) return;
|
|
18950
|
+
if (data.type === "mcp-notification" && typeof data.method === "string" && !data.method.startsWith("process/"))
|
|
18951
|
+
owned.onNotification(data.method, data.params);
|
|
18952
|
+
if (data.type === "mcp-request") owned.onRequest(record3(data.request) ? data.request : data);
|
|
18953
|
+
};
|
|
18954
|
+
target.addEventListener?.("message", notify);
|
|
18955
|
+
return {
|
|
18956
|
+
route: { hostId: hostId2, manager: owned, policy: ownedPolicy },
|
|
18957
|
+
rpc: channel.rpc,
|
|
18958
|
+
ready: nativeInteractions.ready,
|
|
18959
|
+
dispose() {
|
|
18960
|
+
if (disposed) return;
|
|
18961
|
+
disposed = true;
|
|
18962
|
+
target.removeEventListener?.("message", notify);
|
|
18963
|
+
nativeInteractions.dispose();
|
|
18964
|
+
ownedPolicy.dispose();
|
|
18965
|
+
client.queuedRequests.length = 0;
|
|
18966
|
+
for (const id of [...client.requestPromises.keys()])
|
|
18967
|
+
client.onError(id, new Error("Remote Control connection retired"));
|
|
18968
|
+
channel.dispose();
|
|
18969
|
+
components.Manager.dispose(owned);
|
|
18970
|
+
void Promise.allSettled([...pending]).then(() => upstream[Symbol.dispose]());
|
|
18971
|
+
}
|
|
18972
|
+
};
|
|
18973
|
+
} catch (error51) {
|
|
18974
|
+
interactions?.dispose();
|
|
18975
|
+
policy?.dispose();
|
|
18976
|
+
if (manager) components.Manager.dispose(manager);
|
|
18977
|
+
upstream[Symbol.dispose]();
|
|
18978
|
+
throw error51;
|
|
18979
|
+
}
|
|
18980
|
+
}
|
|
18981
|
+
|
|
18982
|
+
// packages/desktop-control/src/renderer-native-rpc-channel.ts
|
|
18983
|
+
function createNativeRpcChannel(components, manager) {
|
|
18984
|
+
const channel = new MessageChannel();
|
|
18985
|
+
const transports = [];
|
|
18986
|
+
const transport = (port) => {
|
|
18987
|
+
const values = [];
|
|
18988
|
+
const readers = [];
|
|
18989
|
+
let closed = false;
|
|
18990
|
+
let failure;
|
|
18991
|
+
port.addEventListener("message", (event) => {
|
|
18992
|
+
const value = JSON.stringify(event.data);
|
|
18993
|
+
const reader = readers.shift();
|
|
18994
|
+
if (reader) reader.resolve(value);
|
|
18995
|
+
else values.push(value);
|
|
18996
|
+
});
|
|
18997
|
+
port.start();
|
|
18998
|
+
const result = {
|
|
18999
|
+
send(message) {
|
|
19000
|
+
if (closed) throw failure;
|
|
19001
|
+
port.postMessage(JSON.parse(message));
|
|
19002
|
+
},
|
|
19003
|
+
receive() {
|
|
19004
|
+
if (closed) return Promise.reject(failure);
|
|
19005
|
+
const value = values.shift();
|
|
19006
|
+
return value !== void 0 ? Promise.resolve(value) : new Promise((resolve, reject) => readers.push({ resolve, reject }));
|
|
19007
|
+
},
|
|
19008
|
+
abort(error51) {
|
|
19009
|
+
if (closed) return;
|
|
19010
|
+
closed = true;
|
|
19011
|
+
failure = error51 ?? new Error("Remote Control RPC manager retired");
|
|
19012
|
+
values.length = 0;
|
|
19013
|
+
for (const reader of readers.splice(0)) reader.reject(failure);
|
|
19014
|
+
port.close();
|
|
19015
|
+
}
|
|
19016
|
+
};
|
|
19017
|
+
transports.push(result);
|
|
19018
|
+
return result;
|
|
19019
|
+
};
|
|
19020
|
+
try {
|
|
19021
|
+
new components.RpcSession(transport(channel.port1), new components.RpcManager(() => manager));
|
|
19022
|
+
const session = new components.RpcSession(transport(channel.port2));
|
|
19023
|
+
const rpc = session.getRemoteMain();
|
|
19024
|
+
return {
|
|
19025
|
+
rpc,
|
|
19026
|
+
dispose() {
|
|
19027
|
+
rpc[Symbol.dispose]();
|
|
19028
|
+
for (const transport2 of transports) transport2.abort();
|
|
19029
|
+
}
|
|
19030
|
+
};
|
|
19031
|
+
} catch (error51) {
|
|
19032
|
+
for (const transport2 of transports) transport2.abort(error51);
|
|
19033
|
+
channel.port1.close();
|
|
19034
|
+
channel.port2.close();
|
|
19035
|
+
throw error51;
|
|
19036
|
+
}
|
|
19037
|
+
}
|
|
19038
|
+
|
|
19039
|
+
// packages/desktop-control/src/renderer-native-rpc-service.ts
|
|
19040
|
+
function createNativeRpcService(components, createRemote) {
|
|
19041
|
+
const source = components.services.appServerManagers.dup();
|
|
19042
|
+
const routes = /* @__PURE__ */ new Map();
|
|
19043
|
+
const subscriptions = /* @__PURE__ */ new Set();
|
|
19044
|
+
let refs = 1;
|
|
19045
|
+
const record3 = (value) => value !== null && typeof value === "object";
|
|
19046
|
+
const connectionSignals = (hostId2) => {
|
|
19047
|
+
let node = components.scope.node;
|
|
19048
|
+
const seen = /* @__PURE__ */ new Set();
|
|
19049
|
+
while (node.parent && !seen.has(node.parent) && seen.size < 100) {
|
|
19050
|
+
seen.add(node);
|
|
19051
|
+
node = node.parent;
|
|
19052
|
+
}
|
|
19053
|
+
const found = [];
|
|
19054
|
+
for (const members of node.familyBindings.values()) {
|
|
19055
|
+
const value = members.get(hostId2)?.value;
|
|
19056
|
+
if (record3(value) && Object.hasOwn(value, "state$") && Object.hasOwn(value, "revision$") && Object.hasOwn(value, "appServerVersion$"))
|
|
19057
|
+
found.push({ state$: value.state$, revision$: value.revision$ });
|
|
19058
|
+
}
|
|
19059
|
+
return found.length === 1 ? found[0] : void 0;
|
|
19060
|
+
};
|
|
19061
|
+
const service = {
|
|
19062
|
+
dup() {
|
|
19063
|
+
refs++;
|
|
19064
|
+
return service;
|
|
19065
|
+
},
|
|
19066
|
+
onRpcBroken(listener) {
|
|
19067
|
+
source.onRpcBroken(listener);
|
|
19068
|
+
},
|
|
19069
|
+
openAccount(hostId2) {
|
|
19070
|
+
return source.openAccount(hostId2);
|
|
19071
|
+
},
|
|
19072
|
+
subscribe(hostId2, listener) {
|
|
19073
|
+
if (!hostId2.startsWith("remote-control:")) return source.subscribe(hostId2, listener);
|
|
19074
|
+
let active = true;
|
|
19075
|
+
let generation = 0;
|
|
19076
|
+
let upstream;
|
|
19077
|
+
let platformRequest;
|
|
19078
|
+
let remote;
|
|
19079
|
+
let stopWatch;
|
|
19080
|
+
let previousRevision;
|
|
19081
|
+
let previousState;
|
|
19082
|
+
const retire = () => {
|
|
19083
|
+
generation++;
|
|
19084
|
+
platformRequest?.[Symbol.dispose]();
|
|
19085
|
+
platformRequest = void 0;
|
|
19086
|
+
remote?.dispose();
|
|
19087
|
+
remote = void 0;
|
|
19088
|
+
routes.set(hostId2, null);
|
|
19089
|
+
};
|
|
19090
|
+
const cleanup = () => {
|
|
19091
|
+
if (!active) return;
|
|
19092
|
+
active = false;
|
|
19093
|
+
stopWatch?.();
|
|
19094
|
+
retire();
|
|
19095
|
+
upstream?.[Symbol.dispose]();
|
|
19096
|
+
upstream = void 0;
|
|
19097
|
+
routes.delete(hostId2);
|
|
19098
|
+
subscriptions.delete(cleanup);
|
|
19099
|
+
};
|
|
19100
|
+
subscriptions.add(cleanup);
|
|
19101
|
+
const publish = async () => {
|
|
19102
|
+
const owner = upstream;
|
|
19103
|
+
const current = generation;
|
|
19104
|
+
if (!owner || !active) return;
|
|
19105
|
+
let request;
|
|
19106
|
+
try {
|
|
19107
|
+
request = owner.getCodexHome();
|
|
19108
|
+
platformRequest = request;
|
|
19109
|
+
const home = await request;
|
|
19110
|
+
if (!active || current !== generation || owner !== upstream) return;
|
|
19111
|
+
if (!/^(?:[A-Za-z]:[\\/]|\\\\)/u.test(home)) {
|
|
19112
|
+
routes.delete(hostId2);
|
|
19113
|
+
listener({ status: "ready", manager: owner });
|
|
19114
|
+
return;
|
|
19115
|
+
}
|
|
19116
|
+
const created = createRemote(hostId2, owner);
|
|
19117
|
+
remote = created;
|
|
19118
|
+
await created.ready;
|
|
19119
|
+
if (!active || current !== generation || owner !== upstream) return;
|
|
19120
|
+
routes.set(hostId2, created.route);
|
|
19121
|
+
listener({ status: "ready", manager: created.rpc });
|
|
19122
|
+
} catch {
|
|
19123
|
+
if (active && current === generation) {
|
|
19124
|
+
remote?.dispose();
|
|
19125
|
+
remote = void 0;
|
|
19126
|
+
routes.delete(hostId2);
|
|
19127
|
+
listener({ status: "ready", manager: owner });
|
|
19128
|
+
}
|
|
19129
|
+
} finally {
|
|
19130
|
+
if (platformRequest === request) {
|
|
19131
|
+
platformRequest = void 0;
|
|
19132
|
+
request?.[Symbol.dispose]();
|
|
19133
|
+
}
|
|
19134
|
+
}
|
|
19135
|
+
};
|
|
19136
|
+
const changed = (state) => {
|
|
19137
|
+
if (!active) return;
|
|
19138
|
+
stopWatch?.();
|
|
19139
|
+
stopWatch = void 0;
|
|
19140
|
+
retire();
|
|
19141
|
+
upstream?.[Symbol.dispose]();
|
|
19142
|
+
upstream = void 0;
|
|
19143
|
+
if (state.status !== "ready") {
|
|
19144
|
+
listener(state);
|
|
19145
|
+
return;
|
|
19146
|
+
}
|
|
19147
|
+
upstream = state.manager.dup();
|
|
19148
|
+
listener({ status: "connecting" });
|
|
19149
|
+
const signals = connectionSignals(hostId2);
|
|
19150
|
+
if (!signals) {
|
|
19151
|
+
void publish();
|
|
19152
|
+
return;
|
|
19153
|
+
}
|
|
19154
|
+
previousState = void 0;
|
|
19155
|
+
previousRevision = void 0;
|
|
19156
|
+
stopWatch = components.scope.watch(({ get }) => {
|
|
19157
|
+
const connection = get(signals.state$), revision = get(signals.revision$);
|
|
19158
|
+
if (connection === previousState && revision === previousRevision) return;
|
|
19159
|
+
previousState = connection;
|
|
19160
|
+
previousRevision = revision;
|
|
19161
|
+
retire();
|
|
19162
|
+
listener({ status: connection === "connected" ? "connecting" : "disconnected" });
|
|
19163
|
+
if (connection === "connected") void publish();
|
|
19164
|
+
});
|
|
19165
|
+
};
|
|
19166
|
+
const original = source.subscribe(hostId2, changed);
|
|
19167
|
+
const result = original.then((lease) => {
|
|
19168
|
+
if (!active) lease[Symbol.dispose]();
|
|
19169
|
+
return {
|
|
19170
|
+
onRpcBroken: (listener2) => lease.onRpcBroken(listener2),
|
|
19171
|
+
[Symbol.dispose]() {
|
|
19172
|
+
cleanup();
|
|
19173
|
+
lease[Symbol.dispose]();
|
|
19174
|
+
}
|
|
19175
|
+
};
|
|
19176
|
+
});
|
|
19177
|
+
Object.assign(result, {
|
|
19178
|
+
onRpcBroken: (listener2) => original.onRpcBroken(listener2),
|
|
19179
|
+
[Symbol.dispose]() {
|
|
19180
|
+
cleanup();
|
|
19181
|
+
original[Symbol.dispose]();
|
|
19182
|
+
}
|
|
19183
|
+
});
|
|
19184
|
+
return result;
|
|
19185
|
+
},
|
|
19186
|
+
[Symbol.dispose]() {
|
|
19187
|
+
if (--refs !== 0) return;
|
|
19188
|
+
for (const cleanup of [...subscriptions]) cleanup();
|
|
19189
|
+
source[Symbol.dispose]();
|
|
19190
|
+
}
|
|
19191
|
+
};
|
|
19192
|
+
return { service, route: (hostId2) => routes.get(hostId2) };
|
|
19193
|
+
}
|
|
19194
|
+
|
|
19195
|
+
// packages/desktop-control/src/renderer-native-rpc-interactions.ts
|
|
19196
|
+
function retainNativeRpcInteractions(upstream, manager, hostId2) {
|
|
19197
|
+
let disposed = false;
|
|
19198
|
+
const retained = /* @__PURE__ */ new Set();
|
|
19199
|
+
const requests = /* @__PURE__ */ new Map();
|
|
19200
|
+
const reads = /* @__PURE__ */ new Map();
|
|
19201
|
+
const record3 = (value) => value !== null && typeof value === "object";
|
|
19202
|
+
const read = (threadId) => {
|
|
19203
|
+
const existing = reads.get(threadId);
|
|
19204
|
+
if (existing) {
|
|
19205
|
+
existing.dirty = true;
|
|
19206
|
+
return existing.promise;
|
|
19207
|
+
}
|
|
19208
|
+
const entry = { promise: Promise.resolve(), dirty: false };
|
|
19209
|
+
reads.set(threadId, entry);
|
|
19210
|
+
entry.promise = Promise.resolve().then(async () => {
|
|
19211
|
+
do {
|
|
19212
|
+
if (disposed) break;
|
|
19213
|
+
entry.dirty = false;
|
|
19214
|
+
const pending = upstream.getConversation(threadId);
|
|
19215
|
+
retained.add(pending);
|
|
19216
|
+
try {
|
|
19217
|
+
const conversation = await pending;
|
|
19218
|
+
if (disposed || entry.dirty || !record3(conversation) || !Array.isArray(conversation.requests))
|
|
19219
|
+
continue;
|
|
19220
|
+
const previous = requests.get(threadId) ?? /* @__PURE__ */ new Set();
|
|
19221
|
+
const next = /* @__PURE__ */ new Set();
|
|
19222
|
+
for (const request of conversation.requests) {
|
|
19223
|
+
if (!record3(request) || typeof request.method !== "string" || !record3(request.params) || (request.params.threadId ?? request.params.conversationId) !== threadId || typeof request.id !== "string" && typeof request.id !== "number")
|
|
19224
|
+
continue;
|
|
19225
|
+
next.add(request.id);
|
|
19226
|
+
if (!previous.has(request.id)) manager.onRequest(request);
|
|
19227
|
+
}
|
|
19228
|
+
if (next.size) requests.set(threadId, next);
|
|
19229
|
+
else requests.delete(threadId);
|
|
19230
|
+
} finally {
|
|
19231
|
+
if (retained.delete(pending)) pending[Symbol.dispose]();
|
|
19232
|
+
}
|
|
19233
|
+
} while (!disposed && entry.dirty);
|
|
19234
|
+
}).finally(() => {
|
|
19235
|
+
reads.delete(threadId);
|
|
19236
|
+
});
|
|
19237
|
+
return entry.promise;
|
|
19238
|
+
};
|
|
19239
|
+
const event = (value) => {
|
|
19240
|
+
if (disposed || !record3(value) || typeof value.conversationId !== "string") return;
|
|
19241
|
+
void read(value.conversationId).catch(() => void 0);
|
|
19242
|
+
};
|
|
19243
|
+
const subscribe = (input) => {
|
|
19244
|
+
const pending = upstream.subscribe(input);
|
|
19245
|
+
retained.add(pending);
|
|
19246
|
+
return Promise.resolve(pending).then((lease) => {
|
|
19247
|
+
if (disposed) lease[Symbol.dispose]();
|
|
19248
|
+
else retained.add(lease);
|
|
19249
|
+
});
|
|
19250
|
+
};
|
|
19251
|
+
const subscriptions = [
|
|
19252
|
+
"approval-request",
|
|
19253
|
+
"user-input-request",
|
|
19254
|
+
"mcp-elicitation-request",
|
|
19255
|
+
"approval-resolved"
|
|
19256
|
+
].map((name) => subscribe({ type: "event", key: { hostId: hostId2 }, event: name, listener: event }));
|
|
19257
|
+
subscriptions.push(
|
|
19258
|
+
subscribe({
|
|
19259
|
+
type: "notification",
|
|
19260
|
+
key: { hostId: hostId2 },
|
|
19261
|
+
methods: ["serverRequest/resolved"],
|
|
19262
|
+
listener(value) {
|
|
19263
|
+
if (record3(value) && record3(value.params) && typeof value.params.threadId === "string")
|
|
19264
|
+
event({ conversationId: value.params.threadId });
|
|
19265
|
+
}
|
|
19266
|
+
})
|
|
19267
|
+
);
|
|
19268
|
+
const ready = Promise.all(subscriptions).then(async () => {
|
|
19269
|
+
if (disposed) return;
|
|
19270
|
+
const pending = upstream.getWorkInProgress();
|
|
19271
|
+
retained.add(pending);
|
|
19272
|
+
try {
|
|
19273
|
+
const work = await pending;
|
|
19274
|
+
if (disposed) return;
|
|
19275
|
+
if (!Array.isArray(work)) throw new Error("Native RPC interaction snapshot is unavailable");
|
|
19276
|
+
const threadIds = new Set(
|
|
19277
|
+
work.flatMap(
|
|
19278
|
+
(item) => record3(item) && typeof item.conversationId === "string" ? [item.conversationId] : []
|
|
19279
|
+
)
|
|
19280
|
+
);
|
|
19281
|
+
await Promise.all([...threadIds].map(read));
|
|
19282
|
+
} finally {
|
|
19283
|
+
if (retained.delete(pending)) pending[Symbol.dispose]();
|
|
19284
|
+
}
|
|
19285
|
+
});
|
|
19286
|
+
return {
|
|
19287
|
+
ready,
|
|
19288
|
+
dispose() {
|
|
19289
|
+
if (disposed) return;
|
|
19290
|
+
disposed = true;
|
|
19291
|
+
for (const lease of retained) lease[Symbol.dispose]();
|
|
19292
|
+
retained.clear();
|
|
19293
|
+
requests.clear();
|
|
19294
|
+
}
|
|
19295
|
+
};
|
|
19296
|
+
}
|
|
19297
|
+
|
|
19298
|
+
// packages/desktop-control/src/renderer-native-rpc-install.ts
|
|
19299
|
+
async function installNativeRpcRemoteControlDirect(renderer) {
|
|
19300
|
+
let attempt;
|
|
19301
|
+
const probeId = crypto.randomUUID();
|
|
19302
|
+
try {
|
|
19303
|
+
attempt = await renderer.evaluate(`(() => {
|
|
19304
|
+
if (window.__codexhostNativeRpcRemoteControlV1) return null;
|
|
19305
|
+
const routing = window.__codexhostHostRoutingV1;
|
|
19306
|
+
const owner = routing?.forHost('local')?.manager;
|
|
19307
|
+
if (owner?.kind !== 'main-process-rpc') return null;
|
|
19308
|
+
const catalog = window.__codexhostLoadedModulesV1;
|
|
19309
|
+
if (!catalog?.complete) return null;
|
|
19310
|
+
const key = JSON.stringify([catalog.owner, catalog.urls.filter(url => /renderer-app-server-managers|app-shared/.test(url)).sort()]);
|
|
19311
|
+
const previous = window.__codexhostNativeRpcDiscoveryV1;
|
|
19312
|
+
const sameOwner = previous?.key === key && previous.owner === owner;
|
|
19313
|
+
if (sameOwner && (previous.state !== 'unavailable' || previous.attempts >= 3 || Date.now() < previous.nextRetryAt)) return null;
|
|
19314
|
+
const token = ${JSON.stringify(probeId)};
|
|
19315
|
+
window.__codexhostNativeRpcDiscoveryV1 = {
|
|
19316
|
+
key, owner, token, state: 'discovering', attempts: sameOwner ? previous.attempts + 1 : 1,
|
|
19317
|
+
};
|
|
19318
|
+
return token;
|
|
19319
|
+
})()`);
|
|
19320
|
+
} catch {
|
|
19321
|
+
return false;
|
|
19322
|
+
}
|
|
19323
|
+
if (attempt === null) return false;
|
|
19324
|
+
let installed = false;
|
|
19325
|
+
try {
|
|
19326
|
+
installed = await withNativeRpcComponents(renderer, async (objectId) => {
|
|
19327
|
+
const result = await renderer.command("Runtime.callFunctionOn", {
|
|
19328
|
+
objectId,
|
|
19329
|
+
functionDeclaration: `function() {
|
|
19330
|
+
if (this.document !== document) return false;
|
|
19331
|
+
const retainRendererHostResponses = ${retainRendererHostResponses.toString()};
|
|
19332
|
+
const isolateRendererPrewarmConsumption = ${isolateRendererPrewarmConsumption.toString()};
|
|
19333
|
+
return (${installNativeRpcRemoteControl.toString()})(this, window, {
|
|
19334
|
+
createPolicy: ${createDraftPrewarmPolicyBridge.toString()},
|
|
19335
|
+
createManager: ${createNativeRemoteManager.toString()},
|
|
19336
|
+
createChannel: ${createNativeRpcChannel.toString()},
|
|
19337
|
+
createService: ${createNativeRpcService.toString()},
|
|
19338
|
+
retainInteractions: ${retainNativeRpcInteractions.toString()},
|
|
19339
|
+
});
|
|
19340
|
+
}`,
|
|
19341
|
+
returnByValue: true
|
|
19342
|
+
});
|
|
19343
|
+
return !result.exceptionDetails && result.result?.value === true;
|
|
19344
|
+
});
|
|
19345
|
+
return installed;
|
|
19346
|
+
} catch {
|
|
19347
|
+
return false;
|
|
19348
|
+
} finally {
|
|
19349
|
+
await renderer.evaluate(
|
|
19350
|
+
`(() => {
|
|
19351
|
+
const status = window.__codexhostNativeRpcDiscoveryV1;
|
|
19352
|
+
if (status?.token === ${JSON.stringify(attempt)}) {
|
|
19353
|
+
status.state = ${JSON.stringify(installed ? "ready" : "unavailable")};
|
|
19354
|
+
status.nextRetryAt = Date.now() + 5000 * 2 ** (status.attempts - 1);
|
|
19355
|
+
}
|
|
19356
|
+
})()`
|
|
19357
|
+
).catch(() => void 0);
|
|
19358
|
+
}
|
|
19359
|
+
}
|
|
19360
|
+
|
|
18493
19361
|
// packages/desktop-control/src/renderer-cdp-control-session.ts
|
|
18494
19362
|
function isRecord2(value) {
|
|
18495
19363
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -18856,7 +19724,11 @@ var InstalledRendererCdpControlSession = class {
|
|
|
18856
19724
|
var defaultOperations = {
|
|
18857
19725
|
listTargets: (endpoint, signal) => listCdpTargets(endpoint, fetch, signal),
|
|
18858
19726
|
connect: (webSocketDebuggerUrl) => CdpClient.connect(webSocketDebuggerUrl),
|
|
18859
|
-
installDraftPrewarmPolicy
|
|
19727
|
+
async installDraftPrewarmPolicy(renderer) {
|
|
19728
|
+
const status = await installRendererDraftPrewarmPolicyDirect(renderer);
|
|
19729
|
+
await installNativeRpcRemoteControlDirect(renderer);
|
|
19730
|
+
return status;
|
|
19731
|
+
}
|
|
18860
19732
|
};
|
|
18861
19733
|
async function createRendererCdpControlSession(options) {
|
|
18862
19734
|
const enabledAgents = options.enabledAgents;
|