@codexhost/cli-linux-arm64 0.18.0-beta.3 → 0.18.0-beta.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/console-server.mjs +102 -57
- package/app/console-web.js +168 -123
- package/app/desktop-controller.mjs +292 -117
- package/app/host-runtime.mjs +5875 -3270
- package/app/plugins/antigravity/plugin.mjs +796 -307
- package/app/plugins/claude-code/plugin.mjs +214 -103
- package/app/plugins/codebuddy/plugin.mjs +108 -63
- package/app/plugins/codex-usage/plugin.mjs +94 -49
- package/app/plugins/copilot/plugin.mjs +99 -54
- package/app/plugins/cursor-cli/plugin.mjs +122 -77
- package/app/plugins/deepseek-harness/plugin.mjs +125 -80
- package/app/plugins/devin/plugin.mjs +99 -54
- package/app/plugins/grok/plugin.mjs +105 -60
- package/app/plugins/hermes/plugin.mjs +86 -41
- package/app/plugins/kimi-code/plugin.mjs +103 -58
- package/app/plugins/kiro-cli/plugin.mjs +99 -54
- package/app/plugins/omp/plugin.mjs +90 -45
- package/app/plugins/opencode/plugin.mjs +87 -42
- package/app/plugins/pi/plugin.mjs +103 -58
- package/app/plugins/qoder/plugin.mjs +115 -70
- package/app/plugins/qoder-cn/plugin.mjs +115 -70
- package/app/plugins/qwen-code/plugin.mjs +110 -65
- package/app/plugins/workbuddy/plugin.mjs +108 -63
- package/app/plugins/zcode/plugin.mjs +91 -46
- package/app/renderer-extension.js +362 -299
- package/app/web/assets/index-C0aXz2jD.js +199 -0
- package/app/web/codex-agent.png +0 -0
- package/app/web/codexhost-settings.js +163 -118
- package/app/web/index.html +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-gateway/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +61 -61
- package/app/web/plugins/deepseek-ai__dsh-client-connection/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +8 -8
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +63 -63
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +12 -12
- package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-permission-presets/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-settings/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +9 -13
- package/app/web/plugins.json +4 -0
- package/app/web/sw.js +1 -6
- package/app/web-modules/server.mjs +2443 -1345
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
- package/app/web/assets/index-aKvkfNJN.js +0 -199
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __export = (
|
|
2
|
+
var __export = (target2, all) => {
|
|
3
3
|
for (var name in all)
|
|
4
|
-
__defProp(
|
|
4
|
+
__defProp(target2, name, { get: all[name], enumerable: true });
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
// packages/desktop-control/src/production-controller.ts
|
|
@@ -29,7 +29,7 @@ async function openRendererLocalPage(execute, url2, targets) {
|
|
|
29
29
|
initiator: "codexhost_local_page"
|
|
30
30
|
});
|
|
31
31
|
const deadline = Date.now() + 5e3;
|
|
32
|
-
while (!(await targets()).some((
|
|
32
|
+
while (!(await targets()).some((target2) => target2.url === url2)) {
|
|
33
33
|
if (Date.now() >= deadline)
|
|
34
34
|
throw new Error("Codex in-app browser did not load the local page");
|
|
35
35
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
@@ -145,7 +145,7 @@ async function listCdpTargets(endpoint, fetchImpl = defaultFetch, signal) {
|
|
|
145
145
|
if (!response.ok) throw new Error(`CDP target discovery failed with HTTP ${response.status}`);
|
|
146
146
|
const value = await response.json();
|
|
147
147
|
if (!Array.isArray(value)) throw new Error("CDP target discovery did not return an array");
|
|
148
|
-
return value.map(parseTarget).filter((
|
|
148
|
+
return value.map(parseTarget).filter((target2) => target2 !== null);
|
|
149
149
|
}
|
|
150
150
|
var CdpClient = class _CdpClient {
|
|
151
151
|
#commandTimeoutMs;
|
|
@@ -313,6 +313,116 @@ var CdpClient = class _CdpClient {
|
|
|
313
313
|
}
|
|
314
314
|
};
|
|
315
315
|
|
|
316
|
+
// packages/desktop-control/src/renderer-remote-sessions.ts
|
|
317
|
+
async function rendererRemoteSession(target2, operation) {
|
|
318
|
+
const routing = target2.__codexhostHostRoutingV1;
|
|
319
|
+
if (!routing) throw new Error("Desktop remote session routing is unavailable");
|
|
320
|
+
const ids = [...new Set(routing.knownHostIds?.() ?? [])].filter(
|
|
321
|
+
(id) => /^remote-(?:ssh(?:-|:)|control:)/u.test(id)
|
|
322
|
+
);
|
|
323
|
+
const state = target2.__codexhostRemoteSessionsV1 ??= { managers: /* @__PURE__ */ new WeakMap() };
|
|
324
|
+
if (operation.kind === "hosts") {
|
|
325
|
+
const api = target2.__codexhostRendererBindingProbeV1;
|
|
326
|
+
if (!api?.remoteConnections)
|
|
327
|
+
return ids.map((hostId2) => ({ hostId: hostId2, online: !!routing.forHost(hostId2) }));
|
|
328
|
+
const configured = await api.remoteConnections({ action: "catalog" });
|
|
329
|
+
const connections = Array.isArray(configured) ? configured : [];
|
|
330
|
+
const attempts = state.reconnectAttempts ??= /* @__PURE__ */ new Set();
|
|
331
|
+
return Promise.all(
|
|
332
|
+
[.../* @__PURE__ */ new Set([...ids, ...connections.map((c) => c.hostId)])].map(async (hostId2) => {
|
|
333
|
+
const connection = connections.find((c) => c.hostId === hostId2);
|
|
334
|
+
let status = await api.remoteConnections({ action: "state", hostId: hostId2 }).catch(() => ({ state: "error" }));
|
|
335
|
+
if (connection?.autoConnect === false) attempts.delete(hostId2);
|
|
336
|
+
if (connection?.autoConnect && status.state === "disconnected" && !attempts.has(hostId2)) {
|
|
337
|
+
attempts.add(hostId2);
|
|
338
|
+
await api.remoteConnections({ action: "connect", hostId: hostId2, enabled: true }).catch(() => void 0);
|
|
339
|
+
status = await api.remoteConnections({ action: "state", hostId: hostId2 }).catch(() => ({ state: "error" }));
|
|
340
|
+
}
|
|
341
|
+
return {
|
|
342
|
+
hostId: hostId2,
|
|
343
|
+
displayName: connection?.displayName ?? (hostId2.startsWith("remote-control:") ? "Remote Control" : hostId2.replace(/^remote-ssh-(?:discovered|codex-managed):/u, "")),
|
|
344
|
+
state: status.state,
|
|
345
|
+
online: status.state === "connected" && !!routing.forHost(hostId2)
|
|
346
|
+
};
|
|
347
|
+
})
|
|
348
|
+
);
|
|
349
|
+
}
|
|
350
|
+
if (!ids.includes(operation.hostId))
|
|
351
|
+
throw new Error("Remote Host is offline or no longer known to Desktop");
|
|
352
|
+
const route = routing.forHost(operation.hostId);
|
|
353
|
+
const manager = route?.manager;
|
|
354
|
+
if (!route || !manager) throw new Error("Remote Host is offline");
|
|
355
|
+
let generation = state.managers.get(route);
|
|
356
|
+
if (!generation) {
|
|
357
|
+
generation = { epoch: crypto.randomUUID(), answered: /* @__PURE__ */ new Set() };
|
|
358
|
+
state.managers.set(route, generation);
|
|
359
|
+
}
|
|
360
|
+
if ("epoch" in operation && operation.epoch !== generation.epoch)
|
|
361
|
+
throw new Error("Remote connection changed; refresh before operating");
|
|
362
|
+
if (operation.kind === "list")
|
|
363
|
+
return manager.sendRequest("thread/list", {
|
|
364
|
+
cursor: operation.cursor,
|
|
365
|
+
archived: operation.archived,
|
|
366
|
+
limit: 100
|
|
367
|
+
});
|
|
368
|
+
const threadId = operation.threadId;
|
|
369
|
+
const pendingRequests = async () => {
|
|
370
|
+
const conversation = await manager.getConversation?.(threadId);
|
|
371
|
+
if (routing.forHost(operation.hostId) !== route)
|
|
372
|
+
throw new Error("Remote connection changed during interaction read");
|
|
373
|
+
return Array.isArray(conversation?.requests) ? conversation.requests : [];
|
|
374
|
+
};
|
|
375
|
+
if (operation.kind === "read") {
|
|
376
|
+
const result = await manager.sendRequest("thread/read", { threadId, includeTurns: true });
|
|
377
|
+
if (routing.forHost(operation.hostId) !== route)
|
|
378
|
+
throw new Error("Remote connection changed during read");
|
|
379
|
+
const requests = await pendingRequests();
|
|
380
|
+
return {
|
|
381
|
+
result,
|
|
382
|
+
epoch: generation.epoch,
|
|
383
|
+
interactionsAvailable: !!manager.getConversation && !!manager.replyWithCommandExecutionApprovalDecision && !!manager.replyWithFileChangeApprovalDecision,
|
|
384
|
+
requests: requests.filter(
|
|
385
|
+
(request) => (request.params.threadId ?? request.params.conversationId) === threadId && !generation.answered.has(JSON.stringify([threadId, request.id]))
|
|
386
|
+
)
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
if (operation.kind === "respond") {
|
|
390
|
+
const key = JSON.stringify([threadId, operation.requestId]);
|
|
391
|
+
const request = (await pendingRequests()).find(
|
|
392
|
+
(item) => item.id === operation.requestId && (item.params.threadId ?? item.params.conversationId) === threadId
|
|
393
|
+
);
|
|
394
|
+
if (!request || generation.answered.has(key) || !manager.replyWithCommandExecutionApprovalDecision || !manager.replyWithFileChangeApprovalDecision)
|
|
395
|
+
throw new Error("Native interaction is no longer pending");
|
|
396
|
+
if (!["item/commandExecution/requestApproval", "item/fileChange/requestApproval"].includes(
|
|
397
|
+
request.method
|
|
398
|
+
) || !["accept", "decline", "cancel"].includes(String(operation.result.decision)) || Object.keys(operation.result).some((key2) => key2 !== "decision"))
|
|
399
|
+
throw new Error("Unsupported native interaction response");
|
|
400
|
+
generation.answered.add(key);
|
|
401
|
+
const respond2 = request.method === "item/commandExecution/requestApproval" ? manager.replyWithCommandExecutionApprovalDecision : manager.replyWithFileChangeApprovalDecision;
|
|
402
|
+
await respond2.call(manager, threadId, request.id, String(operation.result.decision));
|
|
403
|
+
return { accepted: true };
|
|
404
|
+
}
|
|
405
|
+
switch (operation.kind) {
|
|
406
|
+
case "prompt":
|
|
407
|
+
await manager.sendRequest("thread/resume", { threadId });
|
|
408
|
+
if (routing.forHost(operation.hostId) !== route)
|
|
409
|
+
throw new Error("Remote connection changed during resume");
|
|
410
|
+
return manager.sendRequest("turn/start", {
|
|
411
|
+
threadId,
|
|
412
|
+
input: [{ type: "text", text: operation.text, text_elements: [] }],
|
|
413
|
+
...operation.requestId ? { clientUserMessageId: operation.requestId } : {}
|
|
414
|
+
});
|
|
415
|
+
case "interrupt":
|
|
416
|
+
return manager.sendRequest("turn/interrupt", { threadId, turnId: operation.turnId });
|
|
417
|
+
case "rename":
|
|
418
|
+
return manager.sendRequest("thread/name/set", { threadId, name: operation.name });
|
|
419
|
+
case "archive":
|
|
420
|
+
return manager.sendRequest(operation.archived ? "thread/archive" : "thread/unarchive", {
|
|
421
|
+
threadId
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
316
426
|
// node_modules/zod/v4/classic/external.js
|
|
317
427
|
var external_exports = {};
|
|
318
428
|
__export(external_exports, {
|
|
@@ -1060,8 +1170,8 @@ function defineLazy(object2, key, getter) {
|
|
|
1060
1170
|
function objectClone(obj) {
|
|
1061
1171
|
return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj));
|
|
1062
1172
|
}
|
|
1063
|
-
function assignProp(
|
|
1064
|
-
Object.defineProperty(
|
|
1173
|
+
function assignProp(target2, prop, value) {
|
|
1174
|
+
Object.defineProperty(target2, prop, {
|
|
1065
1175
|
value,
|
|
1066
1176
|
writable: true,
|
|
1067
1177
|
enumerable: true,
|
|
@@ -1244,35 +1354,35 @@ function normalizeParams(_params) {
|
|
|
1244
1354
|
return params;
|
|
1245
1355
|
}
|
|
1246
1356
|
function createTransparentProxy(getter) {
|
|
1247
|
-
let
|
|
1357
|
+
let target2;
|
|
1248
1358
|
return new Proxy({}, {
|
|
1249
1359
|
get(_, prop, receiver) {
|
|
1250
|
-
|
|
1251
|
-
return Reflect.get(
|
|
1360
|
+
target2 ?? (target2 = getter());
|
|
1361
|
+
return Reflect.get(target2, prop, receiver);
|
|
1252
1362
|
},
|
|
1253
1363
|
set(_, prop, value, receiver) {
|
|
1254
|
-
|
|
1255
|
-
return Reflect.set(
|
|
1364
|
+
target2 ?? (target2 = getter());
|
|
1365
|
+
return Reflect.set(target2, prop, value, receiver);
|
|
1256
1366
|
},
|
|
1257
1367
|
has(_, prop) {
|
|
1258
|
-
|
|
1259
|
-
return Reflect.has(
|
|
1368
|
+
target2 ?? (target2 = getter());
|
|
1369
|
+
return Reflect.has(target2, prop);
|
|
1260
1370
|
},
|
|
1261
1371
|
deleteProperty(_, prop) {
|
|
1262
|
-
|
|
1263
|
-
return Reflect.deleteProperty(
|
|
1372
|
+
target2 ?? (target2 = getter());
|
|
1373
|
+
return Reflect.deleteProperty(target2, prop);
|
|
1264
1374
|
},
|
|
1265
1375
|
ownKeys(_) {
|
|
1266
|
-
|
|
1267
|
-
return Reflect.ownKeys(
|
|
1376
|
+
target2 ?? (target2 = getter());
|
|
1377
|
+
return Reflect.ownKeys(target2);
|
|
1268
1378
|
},
|
|
1269
1379
|
getOwnPropertyDescriptor(_, prop) {
|
|
1270
|
-
|
|
1271
|
-
return Reflect.getOwnPropertyDescriptor(
|
|
1380
|
+
target2 ?? (target2 = getter());
|
|
1381
|
+
return Reflect.getOwnPropertyDescriptor(target2, prop);
|
|
1272
1382
|
},
|
|
1273
1383
|
defineProperty(_, prop, descriptor) {
|
|
1274
|
-
|
|
1275
|
-
return Reflect.defineProperty(
|
|
1384
|
+
target2 ?? (target2 = getter());
|
|
1385
|
+
return Reflect.defineProperty(target2, prop, descriptor);
|
|
1276
1386
|
}
|
|
1277
1387
|
});
|
|
1278
1388
|
}
|
|
@@ -11724,15 +11834,15 @@ function _stringFormat(Class2, format, fnOrRegex, _params = {}) {
|
|
|
11724
11834
|
|
|
11725
11835
|
// node_modules/zod/v4/core/to-json-schema.js
|
|
11726
11836
|
function initializeContext(params) {
|
|
11727
|
-
let
|
|
11728
|
-
if (
|
|
11729
|
-
|
|
11730
|
-
if (
|
|
11731
|
-
|
|
11837
|
+
let target2 = params?.target ?? "draft-2020-12";
|
|
11838
|
+
if (target2 === "draft-4")
|
|
11839
|
+
target2 = "draft-04";
|
|
11840
|
+
if (target2 === "draft-7")
|
|
11841
|
+
target2 = "draft-07";
|
|
11732
11842
|
return {
|
|
11733
11843
|
processors: params.processors ?? {},
|
|
11734
11844
|
metadataRegistry: params?.metadata ?? globalRegistry,
|
|
11735
|
-
target,
|
|
11845
|
+
target: target2,
|
|
11736
11846
|
unrepresentable: params?.unrepresentable ?? "throw",
|
|
11737
11847
|
override: params?.override ?? (() => {
|
|
11738
11848
|
}),
|
|
@@ -12074,8 +12184,8 @@ var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
|
12074
12184
|
return finalize(ctx, schema);
|
|
12075
12185
|
};
|
|
12076
12186
|
var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
|
|
12077
|
-
const { libraryOptions, target } = params ?? {};
|
|
12078
|
-
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
|
|
12187
|
+
const { libraryOptions, target: target2 } = params ?? {};
|
|
12188
|
+
const ctx = initializeContext({ ...libraryOptions ?? {}, target: target2, io, processors });
|
|
12079
12189
|
process2(schema, ctx);
|
|
12080
12190
|
extractDefs(ctx, schema);
|
|
12081
12191
|
return finalize(ctx, schema);
|
|
@@ -13134,8 +13244,8 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
13134
13244
|
catch(params) {
|
|
13135
13245
|
return _catch2(this, params);
|
|
13136
13246
|
},
|
|
13137
|
-
pipe(
|
|
13138
|
-
return pipe(this,
|
|
13247
|
+
pipe(target2) {
|
|
13248
|
+
return pipe(this, target2);
|
|
13139
13249
|
},
|
|
13140
13250
|
readonly() {
|
|
13141
13251
|
return readonly(this);
|
|
@@ -15365,15 +15475,15 @@ var threadOwnershipListResultSchema = external_exports.object({
|
|
|
15365
15475
|
threads: external_exports.array(threadOwnershipSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
|
|
15366
15476
|
}).strict().superRefine(({ threads }, context) => {
|
|
15367
15477
|
const seen = /* @__PURE__ */ new Set();
|
|
15368
|
-
for (const [index,
|
|
15369
|
-
if (seen.has(
|
|
15478
|
+
for (const [index, thread2] of threads.entries()) {
|
|
15479
|
+
if (seen.has(thread2.threadId)) {
|
|
15370
15480
|
context.addIssue({
|
|
15371
15481
|
code: "custom",
|
|
15372
15482
|
message: "Thread ownership-list results must be unique",
|
|
15373
15483
|
path: ["threads", index, "threadId"]
|
|
15374
15484
|
});
|
|
15375
15485
|
}
|
|
15376
|
-
seen.add(
|
|
15486
|
+
seen.add(thread2.threadId);
|
|
15377
15487
|
}
|
|
15378
15488
|
});
|
|
15379
15489
|
var threadSteeringInspectParamsSchema = external_exports.object({
|
|
@@ -15582,13 +15692,18 @@ var clientChannelResponseSchema = external_exports.object({
|
|
|
15582
15692
|
});
|
|
15583
15693
|
|
|
15584
15694
|
// packages/shared-contracts/dist/thread-catalog.js
|
|
15585
|
-
var threadCatalogReadParamsSchema = external_exports.object({
|
|
15695
|
+
var threadCatalogReadParamsSchema = external_exports.object({
|
|
15696
|
+
includeArchived: external_exports.boolean().optional(),
|
|
15697
|
+
/** Absent means first page; null means this branch is exhausted. Native cursors only. */
|
|
15698
|
+
officialCursor: external_exports.object({ live: external_exports.string().nullable(), archived: external_exports.string().nullable().optional() }).strict().optional()
|
|
15699
|
+
}).strict();
|
|
15586
15700
|
var threadCatalogReadResultSchema = external_exports.object({
|
|
15587
15701
|
threads: external_exports.array(jsonObjectSchema),
|
|
15588
15702
|
ownership: external_exports.array(threadOwnershipSchema),
|
|
15589
15703
|
/** Known archived IDs, including visible local external records even when their rows are
|
|
15590
|
-
* excluded. Native archived IDs
|
|
15591
|
-
archivedThreadIds: external_exports.array(hostThreadIdSchema)
|
|
15704
|
+
* excluded. Native archived IDs describe only the returned page, never a complete set. */
|
|
15705
|
+
archivedThreadIds: external_exports.array(hostThreadIdSchema),
|
|
15706
|
+
officialCursor: external_exports.object({ live: external_exports.string().nullable(), archived: external_exports.string().nullable().optional() }).strict().optional()
|
|
15592
15707
|
}).strict();
|
|
15593
15708
|
|
|
15594
15709
|
// packages/shared-contracts/dist/voice.js
|
|
@@ -15804,7 +15919,7 @@ var idleReleaseSettingsSchema = external_exports.strictObject({
|
|
|
15804
15919
|
});
|
|
15805
15920
|
var DEFAULT_IDLE_RELEASE_SETTINGS = Object.freeze({
|
|
15806
15921
|
enabled: false,
|
|
15807
|
-
timeoutMinutes:
|
|
15922
|
+
timeoutMinutes: 10
|
|
15808
15923
|
});
|
|
15809
15924
|
|
|
15810
15925
|
// packages/shared-contracts/dist/harness-preferences.js
|
|
@@ -16702,6 +16817,44 @@ var remoteSshSetupParamsSchema = external_exports.object({
|
|
|
16702
16817
|
}).strict();
|
|
16703
16818
|
var remoteSshSetupResultSchema = external_exports.object({ state: external_exports.enum(["installed", "not-installed"]) }).strict();
|
|
16704
16819
|
|
|
16820
|
+
// packages/shared-contracts/dist/remote-sessions.js
|
|
16821
|
+
var REMOTE_CONTROLLER_REQUEST_MAX_BYTES = 16 * 1024;
|
|
16822
|
+
var identity = external_exports.string().min(1).max(1024);
|
|
16823
|
+
var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
|
|
16824
|
+
var thread = { ...target, threadId: identity };
|
|
16825
|
+
var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
16826
|
+
external_exports.strictObject({ kind: external_exports.literal("hosts") }),
|
|
16827
|
+
external_exports.strictObject({
|
|
16828
|
+
kind: external_exports.literal("list"),
|
|
16829
|
+
...target,
|
|
16830
|
+
cursor: external_exports.string().nullable(),
|
|
16831
|
+
archived: external_exports.boolean()
|
|
16832
|
+
}),
|
|
16833
|
+
external_exports.strictObject({ kind: external_exports.literal("read"), ...thread }),
|
|
16834
|
+
external_exports.strictObject({
|
|
16835
|
+
kind: external_exports.literal("prompt"),
|
|
16836
|
+
...thread,
|
|
16837
|
+
epoch: identity,
|
|
16838
|
+
text: external_exports.string().min(1).max(8e3),
|
|
16839
|
+
requestId: identity.optional()
|
|
16840
|
+
}),
|
|
16841
|
+
external_exports.strictObject({ kind: external_exports.literal("interrupt"), ...thread, epoch: identity, turnId: identity }),
|
|
16842
|
+
external_exports.strictObject({
|
|
16843
|
+
kind: external_exports.literal("rename"),
|
|
16844
|
+
...thread,
|
|
16845
|
+
epoch: identity,
|
|
16846
|
+
name: external_exports.string().min(1).max(512)
|
|
16847
|
+
}),
|
|
16848
|
+
external_exports.strictObject({ kind: external_exports.literal("archive"), ...thread, epoch: identity, archived: external_exports.boolean() }),
|
|
16849
|
+
external_exports.strictObject({
|
|
16850
|
+
kind: external_exports.literal("respond"),
|
|
16851
|
+
...thread,
|
|
16852
|
+
epoch: identity,
|
|
16853
|
+
requestId: external_exports.union([identity, external_exports.number().int()]),
|
|
16854
|
+
result: external_exports.record(external_exports.string(), external_exports.unknown())
|
|
16855
|
+
})
|
|
16856
|
+
]);
|
|
16857
|
+
|
|
16705
16858
|
// packages/shared-contracts/dist/remote-connections.js
|
|
16706
16859
|
var hostId = external_exports.string().min(1).max(1024);
|
|
16707
16860
|
var codexSshConnectionSchema = external_exports.object({
|
|
@@ -16722,7 +16875,9 @@ var codexSshDraftSchema = external_exports.strictObject({
|
|
|
16722
16875
|
identity: external_exports.string().max(4096).nullable()
|
|
16723
16876
|
});
|
|
16724
16877
|
var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action", [
|
|
16878
|
+
external_exports.strictObject({ action: external_exports.literal("session"), operation: remoteSessionOperationSchema }),
|
|
16725
16879
|
external_exports.strictObject({ action: external_exports.literal("list") }),
|
|
16880
|
+
external_exports.strictObject({ action: external_exports.literal("catalog") }),
|
|
16726
16881
|
external_exports.strictObject({
|
|
16727
16882
|
action: external_exports.literal("read-thread"),
|
|
16728
16883
|
hostId: hostId.refine((id) => id !== "local"),
|
|
@@ -16795,6 +16950,8 @@ var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT
|
|
|
16795
16950
|
var MAX_REPLY_BYTES = 1024 * 1024;
|
|
16796
16951
|
function remoteConnectionsExpression(input) {
|
|
16797
16952
|
const request = remoteConnectionsRequestSchema.parse(input);
|
|
16953
|
+
if (request.action === "session")
|
|
16954
|
+
return `(async () => { try { return {result:await (${rendererRemoteSession.toString()})(window,${JSON.stringify(request.operation)})}; } catch(error) {return {error:{code:-32090,message:String(error?.message ?? error)}};} })()`;
|
|
16798
16955
|
return `(async () => {
|
|
16799
16956
|
try {
|
|
16800
16957
|
const api = window.__codexhostRendererBindingProbeV1;
|
|
@@ -16865,7 +17022,7 @@ async function serveLocalPage(socket, url2, open) {
|
|
|
16865
17022
|
}
|
|
16866
17023
|
|
|
16867
17024
|
// packages/desktop-control/src/controller-attachment-server.ts
|
|
16868
|
-
var MAX_REQUEST_BYTES =
|
|
17025
|
+
var MAX_REQUEST_BYTES = REMOTE_CONTROLLER_REQUEST_MAX_BYTES;
|
|
16869
17026
|
function validPort(value) {
|
|
16870
17027
|
return Number.isInteger(value) && value >= 1 && value <= 65535;
|
|
16871
17028
|
}
|
|
@@ -16926,19 +17083,19 @@ async function startControllerAttachmentServer(options) {
|
|
|
16926
17083
|
return;
|
|
16927
17084
|
}
|
|
16928
17085
|
socket.setTimeout(
|
|
16929
|
-
input.action === "read-thread" ? REMOTE_THREAD_CONTROL_TIMEOUT_MS : 3e4,
|
|
17086
|
+
input.action === "read-thread" || input.action === "session" ? REMOTE_THREAD_CONTROL_TIMEOUT_MS : 3e4,
|
|
16930
17087
|
() => socket.destroy()
|
|
16931
17088
|
);
|
|
16932
17089
|
const operation = options.remoteConnections;
|
|
16933
17090
|
void Promise.resolve().then(() => operation(input)).then(
|
|
16934
17091
|
(reply) => {
|
|
16935
17092
|
const serialized = JSON.stringify(reply) + "\n";
|
|
16936
|
-
if (input.action === "read-thread" && Buffer.byteLength(serialized) > REMOTE_THREAD_REPLY_MAX_BYTES) {
|
|
17093
|
+
if ((input.action === "read-thread" || input.action === "session") && Buffer.byteLength(serialized) > REMOTE_THREAD_REPLY_MAX_BYTES) {
|
|
16937
17094
|
socket.end(
|
|
16938
17095
|
JSON.stringify({
|
|
16939
17096
|
error: {
|
|
16940
17097
|
code: -32094,
|
|
16941
|
-
message: "Thread snapshot exceeds the 16 MiB response limit; reduce the message page size. Oversized individual results are not supported."
|
|
17098
|
+
message: input.action === "session" ? "Remote Thread snapshot exceeds the 16 MiB response limit; open this Thread in Codex Desktop. Paged remote snapshots are not supported." : "Thread snapshot exceeds the 16 MiB response limit; reduce the message page size. Oversized individual results are not supported."
|
|
16942
17099
|
}
|
|
16943
17100
|
}) + "\n"
|
|
16944
17101
|
);
|
|
@@ -17109,9 +17266,9 @@ function committedReactAncestors(value) {
|
|
|
17109
17266
|
const MAX_VISITED_FIBERS = 2e5;
|
|
17110
17267
|
const fiber = (value2) => typeof value2 === "object" && value2 !== null ? value2 : null;
|
|
17111
17268
|
const exhausted = () => {
|
|
17112
|
-
const
|
|
17113
|
-
if (typeof
|
|
17114
|
-
|
|
17269
|
+
const target2 = globalThis;
|
|
17270
|
+
if (typeof target2.dispatchEvent === "function" && typeof CustomEvent === "function")
|
|
17271
|
+
target2.dispatchEvent(
|
|
17115
17272
|
new CustomEvent("codexhost:react-fiber-walk-limit", {
|
|
17116
17273
|
detail: { limit: MAX_VISITED_FIBERS }
|
|
17117
17274
|
})
|
|
@@ -17177,8 +17334,8 @@ function committedReactAncestors(value) {
|
|
|
17177
17334
|
}
|
|
17178
17335
|
|
|
17179
17336
|
// packages/desktop-control/src/renderer-host-response-ownership.ts
|
|
17180
|
-
function retainRendererHostResponses(client, hostId2,
|
|
17181
|
-
if (typeof client.addRequestLifecycleListener !== "function" || typeof
|
|
17337
|
+
function retainRendererHostResponses(client, hostId2, target2) {
|
|
17338
|
+
if (typeof client.addRequestLifecycleListener !== "function" || typeof target2.addEventListener !== "function" || typeof target2.removeEventListener !== "function")
|
|
17182
17339
|
return () => {
|
|
17183
17340
|
};
|
|
17184
17341
|
const isRecord3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -17187,14 +17344,14 @@ function retainRendererHostResponses(client, hostId2, target) {
|
|
|
17187
17344
|
let unsubscribe = () => {
|
|
17188
17345
|
};
|
|
17189
17346
|
const detach = () => {
|
|
17190
|
-
|
|
17347
|
+
target2.removeEventListener?.("message", receive);
|
|
17191
17348
|
unsubscribe();
|
|
17192
17349
|
};
|
|
17193
17350
|
const receive = (event) => {
|
|
17194
17351
|
const { source, origin, data } = event;
|
|
17195
|
-
if (source != null && source !==
|
|
17196
|
-
const ownOrigin =
|
|
17197
|
-
if (source ===
|
|
17352
|
+
if (source != null && source !== target2) return;
|
|
17353
|
+
const ownOrigin = target2.location?.origin;
|
|
17354
|
+
if (source === target2 && ownOrigin && ownOrigin !== "null" && origin !== ownOrigin) return;
|
|
17198
17355
|
if (!isRecord3(data) || data.type !== "mcp-response" || data.hostId !== hostId2) return;
|
|
17199
17356
|
const message = data.message;
|
|
17200
17357
|
if (!isRecord3(message)) return;
|
|
@@ -17208,7 +17365,7 @@ function retainRendererHostResponses(client, hostId2, target) {
|
|
|
17208
17365
|
else client.onResult(id, message.result, data.hostMetrics);
|
|
17209
17366
|
});
|
|
17210
17367
|
};
|
|
17211
|
-
|
|
17368
|
+
target2.addEventListener("message", receive);
|
|
17212
17369
|
unsubscribe = client.addRequestLifecycleListener((event) => {
|
|
17213
17370
|
if (!isRecord3(event) || event.hostId !== hostId2) return;
|
|
17214
17371
|
const id = event.id;
|
|
@@ -17318,7 +17475,7 @@ function isolateRendererPrewarmConsumption(manager, discardExternal) {
|
|
|
17318
17475
|
}
|
|
17319
17476
|
|
|
17320
17477
|
// packages/desktop-control/src/renderer-draft-prewarm-runtime.ts
|
|
17321
|
-
function createDraftPrewarmPolicyBridge(manager, bridge, hostId2,
|
|
17478
|
+
function createDraftPrewarmPolicyBridge(manager, bridge, hostId2, target2, prewarmedThreadManager, isCurrentManager, retainResponses = retainRendererHostResponses, isolateConsumption = isolateRendererPrewarmConsumption, sendControlRequest) {
|
|
17322
17479
|
let disposed = false;
|
|
17323
17480
|
const originalSend = bridge.sendRequest;
|
|
17324
17481
|
const controlSend = (method, parameters) => sendControlRequest ? sendControlRequest(method, parameters) : originalSend.call(bridge, method, parameters);
|
|
@@ -17342,7 +17499,7 @@ function createDraftPrewarmPolicyBridge(manager, bridge, hostId2, target, prewar
|
|
|
17342
17499
|
};
|
|
17343
17500
|
const isRemoteControlHost = hostId2.startsWith("remote-control:");
|
|
17344
17501
|
const retireResponses = isRemoteControlHost ? () => {
|
|
17345
|
-
} : retainResponses(bridge, hostId2,
|
|
17502
|
+
} : retainResponses(bridge, hostId2, target2);
|
|
17346
17503
|
const knownExternalThreadIds = /* @__PURE__ */ new Set();
|
|
17347
17504
|
const knownOfficialThreadIds = /* @__PURE__ */ new Set();
|
|
17348
17505
|
const threadOwnershipResolutions = /* @__PURE__ */ new Map();
|
|
@@ -17434,7 +17591,7 @@ function createDraftPrewarmPolicyBridge(manager, bridge, hostId2, target, prewar
|
|
|
17434
17591
|
const observeBridgeResult = (request, result) => {
|
|
17435
17592
|
if (!request || !isRecord3(result)) return;
|
|
17436
17593
|
if (request.method === "thread/list" && Array.isArray(result.data)) {
|
|
17437
|
-
for (const
|
|
17594
|
+
for (const thread2 of result.data) rememberExternalThread(thread2);
|
|
17438
17595
|
return;
|
|
17439
17596
|
}
|
|
17440
17597
|
if (request.method === "thread/start" || request.method === "thread/read" || request.method === "thread/resume") {
|
|
@@ -17731,14 +17888,14 @@ function createDraftPrewarmPolicyBridge(manager, bridge, hostId2, target, prewar
|
|
|
17731
17888
|
if (!isRecord3(parameters) || parameters.ephemeral === true) return;
|
|
17732
17889
|
const cwd = parameters.cwd;
|
|
17733
17890
|
if (typeof cwd !== "string" || cwd.length === 0) return;
|
|
17734
|
-
const drafts = isRecord3(
|
|
17891
|
+
const drafts = isRecord3(target2.__codexhostDraftWorkspacesV1) ? target2.__codexhostDraftWorkspacesV1 : {};
|
|
17735
17892
|
drafts[hostId2] = cwd;
|
|
17736
|
-
Object.defineProperty(
|
|
17893
|
+
Object.defineProperty(target2, "__codexhostDraftWorkspacesV1", {
|
|
17737
17894
|
configurable: true,
|
|
17738
17895
|
value: drafts
|
|
17739
17896
|
});
|
|
17740
|
-
if (typeof
|
|
17741
|
-
|
|
17897
|
+
if (typeof target2.dispatchEvent === "function" && typeof CustomEvent === "function") {
|
|
17898
|
+
target2.dispatchEvent(
|
|
17742
17899
|
new CustomEvent("codexhost:draft-workspace", { detail: { hostId: hostId2, cwd } })
|
|
17743
17900
|
);
|
|
17744
17901
|
}
|
|
@@ -17785,8 +17942,8 @@ function createDraftPrewarmPolicyBridge(manager, bridge, hostId2, target, prewar
|
|
|
17785
17942
|
}
|
|
17786
17943
|
handleOuterNotification(message.method, message.params);
|
|
17787
17944
|
};
|
|
17788
|
-
const observesWindowNotifications = isRemoteControlHost && typeof
|
|
17789
|
-
if (observesWindowNotifications)
|
|
17945
|
+
const observesWindowNotifications = isRemoteControlHost && typeof target2.addEventListener === "function" && typeof target2.removeEventListener === "function";
|
|
17946
|
+
if (observesWindowNotifications) target2.addEventListener?.("message", routedWindowMessage);
|
|
17790
17947
|
const routedOnNotification = (method, parameters) => {
|
|
17791
17948
|
if (!handleOuterNotification(method, parameters)) {
|
|
17792
17949
|
originalOnNotification.call(manager, method, parameters);
|
|
@@ -17853,7 +18010,7 @@ function createDraftPrewarmPolicyBridge(manager, bridge, hostId2, target, prewar
|
|
|
17853
18010
|
bridge.prewarmThreadStart = originalPrewarm;
|
|
17854
18011
|
}
|
|
17855
18012
|
if (observesWindowNotifications) {
|
|
17856
|
-
|
|
18013
|
+
target2.removeEventListener?.("message", routedWindowMessage);
|
|
17857
18014
|
} else if (manager.onNotification === routedOnNotification) {
|
|
17858
18015
|
manager.onNotification = originalOnNotification;
|
|
17859
18016
|
}
|
|
@@ -17966,11 +18123,11 @@ function resolveRendererHostManager(discovery, hostId2, managerFrom = requestMan
|
|
|
17966
18123
|
}
|
|
17967
18124
|
|
|
17968
18125
|
// packages/desktop-control/src/renderer-host-routing.ts
|
|
17969
|
-
function installRendererHostRouting(root,
|
|
17970
|
-
const existing =
|
|
18126
|
+
function installRendererHostRouting(root, target2, discover, resolve, createPolicy, readConnection, publishRouting = true) {
|
|
18127
|
+
const existing = target2.__codexhostHostRoutingV1;
|
|
17971
18128
|
if (publishRouting && existing) return existing;
|
|
17972
18129
|
if (publishRouting)
|
|
17973
|
-
|
|
18130
|
+
target2.__codexhostDraftPrewarmPolicyV1?.dispose?.();
|
|
17974
18131
|
let disposed = false;
|
|
17975
18132
|
let lastDiscovery = null;
|
|
17976
18133
|
const routes = /* @__PURE__ */ new Map();
|
|
@@ -18027,7 +18184,7 @@ function installRendererHostRouting(root, target, discover, resolve, createPolic
|
|
|
18027
18184
|
manager,
|
|
18028
18185
|
bridge,
|
|
18029
18186
|
hostId2,
|
|
18030
|
-
|
|
18187
|
+
target2,
|
|
18031
18188
|
prewarmed,
|
|
18032
18189
|
() => lookup(hostId2) === manager && sameConnection(connection, connectionFor(hostId2)) && manager.requestClient === bridge && manager.prewarmedThreadManager === prewarmed
|
|
18033
18190
|
);
|
|
@@ -18038,13 +18195,13 @@ function installRendererHostRouting(root, target, discover, resolve, createPolic
|
|
|
18038
18195
|
const publish = (route) => {
|
|
18039
18196
|
if (!publishRouting) return;
|
|
18040
18197
|
const policy = route?.policy;
|
|
18041
|
-
if (
|
|
18042
|
-
Object.defineProperty(
|
|
18198
|
+
if (target2.__codexhostDraftPrewarmPolicyV1 === policy) return;
|
|
18199
|
+
Object.defineProperty(target2, "__codexhostDraftPrewarmPolicyV1", {
|
|
18043
18200
|
configurable: true,
|
|
18044
18201
|
value: policy
|
|
18045
18202
|
});
|
|
18046
|
-
if (typeof
|
|
18047
|
-
|
|
18203
|
+
if (typeof target2.dispatchEvent === "function" && typeof CustomEvent === "function") {
|
|
18204
|
+
target2.dispatchEvent(new CustomEvent("codexhost:draft-prewarm-policy-changed"));
|
|
18048
18205
|
}
|
|
18049
18206
|
};
|
|
18050
18207
|
const composerHostId = (discovery) => {
|
|
@@ -18105,14 +18262,14 @@ function installRendererHostRouting(root, target, discover, resolve, createPolic
|
|
|
18105
18262
|
disposed = true;
|
|
18106
18263
|
for (const hostId2 of routes.keys()) retire(hostId2);
|
|
18107
18264
|
lastDiscovery = null;
|
|
18108
|
-
if (
|
|
18109
|
-
delete
|
|
18265
|
+
if (target2.__codexhostHostRoutingV1 === routing) {
|
|
18266
|
+
delete target2.__codexhostHostRoutingV1;
|
|
18110
18267
|
publish(null);
|
|
18111
18268
|
}
|
|
18112
18269
|
}
|
|
18113
18270
|
};
|
|
18114
18271
|
if (publishRouting)
|
|
18115
|
-
Object.defineProperty(
|
|
18272
|
+
Object.defineProperty(target2, "__codexhostHostRoutingV1", {
|
|
18116
18273
|
configurable: true,
|
|
18117
18274
|
value: routing
|
|
18118
18275
|
});
|
|
@@ -18221,8 +18378,8 @@ function rendererHostRpcHostIds(discovery) {
|
|
|
18221
18378
|
}
|
|
18222
18379
|
|
|
18223
18380
|
// packages/desktop-control/src/renderer-host-rpc-routing.ts
|
|
18224
|
-
function installRendererHostRpcRouting(root,
|
|
18225
|
-
const existing =
|
|
18381
|
+
function installRendererHostRpcRouting(root, target2, dependencies) {
|
|
18382
|
+
const existing = target2.__codexhostHostRoutingV1;
|
|
18226
18383
|
if (existing) return existing;
|
|
18227
18384
|
let disposed = false;
|
|
18228
18385
|
let nativeRouting = null;
|
|
@@ -18277,15 +18434,15 @@ function installRendererHostRpcRouting(root, target, dependencies) {
|
|
|
18277
18434
|
};
|
|
18278
18435
|
const publishDraftWorkspace = (hostId2, cwd) => {
|
|
18279
18436
|
if (typeof cwd !== "string" || cwd.length === 0) return;
|
|
18280
|
-
const drafts = isRecord3(
|
|
18437
|
+
const drafts = isRecord3(target2.__codexhostDraftWorkspacesV1) ? target2.__codexhostDraftWorkspacesV1 : {};
|
|
18281
18438
|
if (drafts[hostId2] === cwd) return;
|
|
18282
18439
|
drafts[hostId2] = cwd;
|
|
18283
|
-
Object.defineProperty(
|
|
18440
|
+
Object.defineProperty(target2, "__codexhostDraftWorkspacesV1", {
|
|
18284
18441
|
configurable: true,
|
|
18285
18442
|
value: drafts
|
|
18286
18443
|
});
|
|
18287
|
-
if (typeof
|
|
18288
|
-
|
|
18444
|
+
if (typeof target2.dispatchEvent === "function" && typeof CustomEvent === "function") {
|
|
18445
|
+
target2.dispatchEvent(
|
|
18289
18446
|
new CustomEvent("codexhost:draft-workspace", { detail: { hostId: hostId2, cwd } })
|
|
18290
18447
|
);
|
|
18291
18448
|
}
|
|
@@ -18358,6 +18515,24 @@ function installRendererHostRpcRouting(root, target, dependencies) {
|
|
|
18358
18515
|
const manager = Object.freeze({
|
|
18359
18516
|
kind: "main-process-rpc",
|
|
18360
18517
|
getHostId: () => hostId2,
|
|
18518
|
+
...typeof rpc.getConversation === "function" ? {
|
|
18519
|
+
getConversation: async (threadId) => {
|
|
18520
|
+
if (!isCurrent()) throw new Error("Remote manager retired");
|
|
18521
|
+
return rpc.getConversation?.(threadId);
|
|
18522
|
+
}
|
|
18523
|
+
} : {},
|
|
18524
|
+
...typeof rpc.replyWithCommandExecutionApprovalDecision === "function" ? {
|
|
18525
|
+
replyWithCommandExecutionApprovalDecision: async (threadId, requestId, decision) => {
|
|
18526
|
+
if (!isCurrent()) throw new Error("Remote manager retired");
|
|
18527
|
+
return rpc.replyWithCommandExecutionApprovalDecision?.(threadId, requestId, decision);
|
|
18528
|
+
}
|
|
18529
|
+
} : {},
|
|
18530
|
+
...typeof rpc.replyWithFileChangeApprovalDecision === "function" ? {
|
|
18531
|
+
replyWithFileChangeApprovalDecision: async (threadId, requestId, decision) => {
|
|
18532
|
+
if (!isCurrent()) throw new Error("Remote manager retired");
|
|
18533
|
+
return rpc.replyWithFileChangeApprovalDecision?.(threadId, requestId, decision);
|
|
18534
|
+
}
|
|
18535
|
+
} : {},
|
|
18361
18536
|
sendRequest(method, params, options) {
|
|
18362
18537
|
if (!isCurrent())
|
|
18363
18538
|
return Promise.reject(new Error(`Renderer request manager is retired for ${hostId2}`));
|
|
@@ -18369,13 +18544,13 @@ function installRendererHostRpcRouting(root, target, dependencies) {
|
|
|
18369
18544
|
const accepted = new Set(typeof methods === "string" ? [methods] : methods);
|
|
18370
18545
|
const onMessage = (event) => {
|
|
18371
18546
|
const { source, data } = event;
|
|
18372
|
-
if (source != null && source !==
|
|
18547
|
+
if (source != null && source !== target2) return;
|
|
18373
18548
|
if (!isRecord3(data) || data.type !== "mcp-notification" || data.hostId !== hostId2 || typeof data.method !== "string" || !accepted.has(data.method) || !isCurrent())
|
|
18374
18549
|
return;
|
|
18375
18550
|
listener({ method: data.method, params: data.params });
|
|
18376
18551
|
};
|
|
18377
|
-
|
|
18378
|
-
return () =>
|
|
18552
|
+
target2.addEventListener?.("message", onMessage);
|
|
18553
|
+
return () => target2.removeEventListener?.("message", onMessage);
|
|
18379
18554
|
}
|
|
18380
18555
|
});
|
|
18381
18556
|
const clearDrafts = () => {
|
|
@@ -18448,13 +18623,13 @@ function installRendererHostRpcRouting(root, target, dependencies) {
|
|
|
18448
18623
|
};
|
|
18449
18624
|
const publish = (route) => {
|
|
18450
18625
|
const policy = route?.policy;
|
|
18451
|
-
if (
|
|
18452
|
-
Object.defineProperty(
|
|
18626
|
+
if (target2.__codexhostDraftPrewarmPolicyV1 === policy) return;
|
|
18627
|
+
Object.defineProperty(target2, "__codexhostDraftPrewarmPolicyV1", {
|
|
18453
18628
|
configurable: true,
|
|
18454
18629
|
value: policy
|
|
18455
18630
|
});
|
|
18456
|
-
if (typeof
|
|
18457
|
-
|
|
18631
|
+
if (typeof target2.dispatchEvent === "function" && typeof CustomEvent === "function") {
|
|
18632
|
+
target2.dispatchEvent(new CustomEvent("codexhost:draft-prewarm-policy-changed"));
|
|
18458
18633
|
}
|
|
18459
18634
|
};
|
|
18460
18635
|
const composerHostId = (owners, composer) => {
|
|
@@ -18519,13 +18694,13 @@ function installRendererHostRpcRouting(root, target, dependencies) {
|
|
|
18519
18694
|
externalDrafts.clear();
|
|
18520
18695
|
selectedModels.clear();
|
|
18521
18696
|
if (port.postMessage === postMessage) port.postMessage = originalPostMessage;
|
|
18522
|
-
if (
|
|
18523
|
-
delete
|
|
18697
|
+
if (target2.__codexhostHostRoutingV1 === routing) {
|
|
18698
|
+
delete target2.__codexhostHostRoutingV1;
|
|
18524
18699
|
publish(null);
|
|
18525
18700
|
}
|
|
18526
18701
|
}
|
|
18527
18702
|
};
|
|
18528
|
-
Object.defineProperty(
|
|
18703
|
+
Object.defineProperty(target2, "__codexhostHostRoutingV1", { configurable: true, value: routing });
|
|
18529
18704
|
return routing;
|
|
18530
18705
|
}
|
|
18531
18706
|
|
|
@@ -18985,9 +19160,9 @@ async function withNativeRpcComponents(client, install) {
|
|
|
18985
19160
|
}
|
|
18986
19161
|
|
|
18987
19162
|
// packages/desktop-control/src/renderer-native-rpc-runtime.ts
|
|
18988
|
-
function installNativeRpcRemoteControl(components,
|
|
18989
|
-
if (
|
|
18990
|
-
const routing =
|
|
19163
|
+
function installNativeRpcRemoteControl(components, target2, dependencies) {
|
|
19164
|
+
if (target2.__codexhostNativeRpcRemoteControlV1) return true;
|
|
19165
|
+
const routing = target2.__codexhostHostRoutingV1;
|
|
18991
19166
|
if (!routing) return false;
|
|
18992
19167
|
const adapted = dependencies.createService(
|
|
18993
19168
|
components,
|
|
@@ -18995,7 +19170,7 @@ function installNativeRpcRemoteControl(components, target, dependencies) {
|
|
|
18995
19170
|
components,
|
|
18996
19171
|
hostId2,
|
|
18997
19172
|
upstream,
|
|
18998
|
-
|
|
19173
|
+
target2,
|
|
18999
19174
|
dependencies.createPolicy,
|
|
19000
19175
|
dependencies.createChannel,
|
|
19001
19176
|
dependencies.retainInteractions
|
|
@@ -19032,8 +19207,8 @@ function installNativeRpcRemoteControl(components, target, dependencies) {
|
|
|
19032
19207
|
routing.forComposer = forComposer;
|
|
19033
19208
|
const installation = {
|
|
19034
19209
|
dispose() {
|
|
19035
|
-
if (
|
|
19036
|
-
delete
|
|
19210
|
+
if (target2.__codexhostNativeRpcRemoteControlV1 !== installation) return;
|
|
19211
|
+
delete target2.__codexhostNativeRpcRemoteControlV1;
|
|
19037
19212
|
replacement.dispose();
|
|
19038
19213
|
replacement = components.createController(
|
|
19039
19214
|
components.scope,
|
|
@@ -19048,12 +19223,12 @@ function installNativeRpcRemoteControl(components, target, dependencies) {
|
|
|
19048
19223
|
installation.dispose();
|
|
19049
19224
|
originalDispose.call(routing);
|
|
19050
19225
|
};
|
|
19051
|
-
|
|
19226
|
+
target2.__codexhostNativeRpcRemoteControlV1 = installation;
|
|
19052
19227
|
return true;
|
|
19053
19228
|
}
|
|
19054
19229
|
|
|
19055
19230
|
// packages/desktop-control/src/renderer-native-remote-manager.ts
|
|
19056
|
-
function createNativeRemoteManager(components, hostId2, original,
|
|
19231
|
+
function createNativeRemoteManager(components, hostId2, original, target2, createPolicy, createChannel, retainInteractions) {
|
|
19057
19232
|
const source = components.scope.get(components.requestDefinition, hostId2);
|
|
19058
19233
|
const upstream = original.dup();
|
|
19059
19234
|
let manager;
|
|
@@ -19117,7 +19292,7 @@ function createNativeRemoteManager(components, hostId2, original, target, create
|
|
|
19117
19292
|
owned,
|
|
19118
19293
|
client,
|
|
19119
19294
|
hostId2,
|
|
19120
|
-
|
|
19295
|
+
target2,
|
|
19121
19296
|
owned.prewarmedThreadManager,
|
|
19122
19297
|
() => !disposed,
|
|
19123
19298
|
void 0,
|
|
@@ -19131,15 +19306,15 @@ function createNativeRemoteManager(components, hostId2, original, target, create
|
|
|
19131
19306
|
interactions = nativeInteractions;
|
|
19132
19307
|
const notify = (event) => {
|
|
19133
19308
|
const { data, source: source2, origin } = event;
|
|
19134
|
-
if (disposed || source2 != null && source2 !==
|
|
19309
|
+
if (disposed || source2 != null && source2 !== target2 || !record4(data) || data.hostId !== hostId2)
|
|
19135
19310
|
return;
|
|
19136
|
-
const ownOrigin = record4(
|
|
19137
|
-
if (source2 ===
|
|
19311
|
+
const ownOrigin = record4(target2.location) ? target2.location.origin : void 0;
|
|
19312
|
+
if (source2 === target2 && ownOrigin && ownOrigin !== "null" && origin !== ownOrigin) return;
|
|
19138
19313
|
if (data.type === "mcp-notification" && typeof data.method === "string" && !data.method.startsWith("process/"))
|
|
19139
19314
|
owned.onNotification(data.method, data.params);
|
|
19140
19315
|
if (data.type === "mcp-request") owned.onRequest(record4(data.request) ? data.request : data);
|
|
19141
19316
|
};
|
|
19142
|
-
|
|
19317
|
+
target2.addEventListener?.("message", notify);
|
|
19143
19318
|
return {
|
|
19144
19319
|
route: { hostId: hostId2, manager: owned, policy: ownedPolicy },
|
|
19145
19320
|
rpc: channel.rpc,
|
|
@@ -19147,7 +19322,7 @@ function createNativeRemoteManager(components, hostId2, original, target, create
|
|
|
19147
19322
|
dispose() {
|
|
19148
19323
|
if (disposed) return;
|
|
19149
19324
|
disposed = true;
|
|
19150
|
-
|
|
19325
|
+
target2.removeEventListener?.("message", notify);
|
|
19151
19326
|
nativeInteractions.dispose();
|
|
19152
19327
|
ownedPolicy.dispose();
|
|
19153
19328
|
client.queuedRequests.length = 0;
|
|
@@ -19707,9 +19882,9 @@ function isPrimaryRendererUrl(value) {
|
|
|
19707
19882
|
}
|
|
19708
19883
|
function selectPrimaryRendererTarget(targets, preferredTargetId) {
|
|
19709
19884
|
const candidates = targets.filter(
|
|
19710
|
-
(
|
|
19885
|
+
(target2) => target2.type === "page" && isPrimaryRendererUrl(target2.url)
|
|
19711
19886
|
);
|
|
19712
|
-
return candidates.find((
|
|
19887
|
+
return candidates.find((target2) => target2.id === preferredTargetId) ?? candidates.at(0) ?? null;
|
|
19713
19888
|
}
|
|
19714
19889
|
var RendererAdapterReadinessError = class extends Error {
|
|
19715
19890
|
constructor(state, reason) {
|
|
@@ -19737,7 +19912,7 @@ async function waitForPrimaryTarget(endpoint, operations, timeoutMs, pollInterva
|
|
|
19737
19912
|
let lastError;
|
|
19738
19913
|
while (!discovery.aborted) {
|
|
19739
19914
|
try {
|
|
19740
|
-
const
|
|
19915
|
+
const target2 = selectPrimaryRendererTarget(
|
|
19741
19916
|
await awaitWithSignal(
|
|
19742
19917
|
operations.listTargets(endpoint, discovery),
|
|
19743
19918
|
discovery,
|
|
@@ -19745,7 +19920,7 @@ async function waitForPrimaryTarget(endpoint, operations, timeoutMs, pollInterva
|
|
|
19745
19920
|
),
|
|
19746
19921
|
preferredTargetId
|
|
19747
19922
|
);
|
|
19748
|
-
if (
|
|
19923
|
+
if (target2) return target2;
|
|
19749
19924
|
lastError = new Error("Renderer CDP has no primary app://-/index.html page target");
|
|
19750
19925
|
} catch (error51) {
|
|
19751
19926
|
lastError = error51;
|
|
@@ -19800,8 +19975,8 @@ async function waitForBinding(renderer, enabledAgents, timeoutMs, pollIntervalMs
|
|
|
19800
19975
|
const detail = lastError instanceof Error ? `: ${lastError.message}` : "";
|
|
19801
19976
|
throw new Error(`Production Renderer binding did not become ready${detail}`);
|
|
19802
19977
|
}
|
|
19803
|
-
async function installTarget(
|
|
19804
|
-
const renderer = await operations.connect(
|
|
19978
|
+
async function installTarget(target2, rendererSource, enabledAgents, timeoutMs, pollIntervalMs, operations) {
|
|
19979
|
+
const renderer = await operations.connect(target2.webSocketDebuggerUrl);
|
|
19805
19980
|
let disposeModules;
|
|
19806
19981
|
try {
|
|
19807
19982
|
disposeModules = await installRendererLoadedModules(renderer);
|
|
@@ -19810,7 +19985,7 @@ async function installTarget(target, rendererSource, enabledAgents, timeoutMs, p
|
|
|
19810
19985
|
await evaluateSource(renderer, rendererSource);
|
|
19811
19986
|
const draftPrewarmPolicy = await operations.installDraftPrewarmPolicy(renderer);
|
|
19812
19987
|
const binding = await waitForBinding(renderer, enabledAgents, timeoutMs, pollIntervalMs);
|
|
19813
|
-
return { renderer, snapshot: { target, draftPrewarmPolicy, binding }, disposeModules };
|
|
19988
|
+
return { renderer, snapshot: { target: target2, draftPrewarmPolicy, binding }, disposeModules };
|
|
19814
19989
|
} catch (error51) {
|
|
19815
19990
|
disposeModules?.();
|
|
19816
19991
|
renderer.close();
|
|
@@ -19844,16 +20019,16 @@ var InstalledRendererCdpControlSession = class {
|
|
|
19844
20019
|
}
|
|
19845
20020
|
async ensureInstalled() {
|
|
19846
20021
|
if (this.#closed) throw new Error("Renderer CDP Control Session is closed");
|
|
19847
|
-
const
|
|
20022
|
+
const target2 = await waitForPrimaryTarget(
|
|
19848
20023
|
this.rendererCdpEndpoint,
|
|
19849
20024
|
this.operations,
|
|
19850
20025
|
this.timeoutMs,
|
|
19851
20026
|
this.pollIntervalMs,
|
|
19852
20027
|
this.currentSnapshot.target.id
|
|
19853
20028
|
);
|
|
19854
|
-
if (
|
|
20029
|
+
if (target2.id !== this.currentSnapshot.target.id) {
|
|
19855
20030
|
const replacement = await installTarget(
|
|
19856
|
-
|
|
20031
|
+
target2,
|
|
19857
20032
|
this.rendererSource,
|
|
19858
20033
|
this.enabledAgents,
|
|
19859
20034
|
this.timeoutMs,
|
|
@@ -19877,11 +20052,11 @@ var InstalledRendererCdpControlSession = class {
|
|
|
19877
20052
|
this.timeoutMs,
|
|
19878
20053
|
this.pollIntervalMs
|
|
19879
20054
|
);
|
|
19880
|
-
this.currentSnapshot = { target, draftPrewarmPolicy, binding };
|
|
20055
|
+
this.currentSnapshot = { target: target2, draftPrewarmPolicy, binding };
|
|
19881
20056
|
return this.currentSnapshot;
|
|
19882
20057
|
} catch {
|
|
19883
20058
|
const replacement = await installTarget(
|
|
19884
|
-
|
|
20059
|
+
target2,
|
|
19885
20060
|
this.rendererSource,
|
|
19886
20061
|
this.enabledAgents,
|
|
19887
20062
|
this.timeoutMs,
|
|
@@ -19927,7 +20102,7 @@ async function createRendererCdpControlSession(options) {
|
|
|
19927
20102
|
const timeoutMs = options.timeoutMs ?? 3e4;
|
|
19928
20103
|
const pollIntervalMs = options.pollIntervalMs ?? 250;
|
|
19929
20104
|
const operations = options.operations ?? defaultOperations;
|
|
19930
|
-
const
|
|
20105
|
+
const target2 = await waitForPrimaryTarget(
|
|
19931
20106
|
options.rendererCdpEndpoint,
|
|
19932
20107
|
operations,
|
|
19933
20108
|
timeoutMs,
|
|
@@ -19936,7 +20111,7 @@ async function createRendererCdpControlSession(options) {
|
|
|
19936
20111
|
options.signal
|
|
19937
20112
|
);
|
|
19938
20113
|
const installed = await installTarget(
|
|
19939
|
-
|
|
20114
|
+
target2,
|
|
19940
20115
|
options.rendererSource,
|
|
19941
20116
|
enabledAgents,
|
|
19942
20117
|
timeoutMs,
|