@codexhost/cli-darwin-x64 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,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
(() => {
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __export = (
|
|
4
|
+
var __export = (target2, all) => {
|
|
5
5
|
for (var name in all)
|
|
6
|
-
__defProp(
|
|
6
|
+
__defProp(target2, name, { get: all[name], enumerable: true });
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
// src/agent-selection-state.ts
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
function defaultIdFactory(sequence) {
|
|
12
12
|
return `codexhost-composer-${Date.now().toString(36)}-${sequence.toString(36)}`;
|
|
13
13
|
}
|
|
14
|
-
function isDefaultTarget(
|
|
15
|
-
return
|
|
14
|
+
function isDefaultTarget(target2) {
|
|
15
|
+
return target2?.[0] === "default";
|
|
16
16
|
}
|
|
17
|
-
function isConversationTarget(
|
|
18
|
-
return
|
|
17
|
+
function isConversationTarget(target2) {
|
|
18
|
+
return target2?.[0] === "conversation";
|
|
19
19
|
}
|
|
20
|
-
function isIdentifiedTarget(
|
|
21
|
-
return
|
|
20
|
+
function isIdentifiedTarget(target2) {
|
|
21
|
+
return target2?.[0] === "conversation" || target2?.[0] === "default" && typeof target2[1] === "string" && target2[1].startsWith("client-new-thread:");
|
|
22
22
|
}
|
|
23
23
|
function sameTarget(left, right) {
|
|
24
24
|
return left.length === right.length && left.every((value, index) => value === right[index]);
|
|
@@ -56,15 +56,15 @@
|
|
|
56
56
|
if (state && !preservePendingSubmission) this.#pendingSubmissions.delete(state);
|
|
57
57
|
this.#states.delete(composer);
|
|
58
58
|
}
|
|
59
|
-
mount(composer,
|
|
60
|
-
const bound = this.#targetState(
|
|
59
|
+
mount(composer, target2, preferredNewThreadAgent) {
|
|
60
|
+
const bound = this.#targetState(target2);
|
|
61
61
|
if (bound) {
|
|
62
62
|
this.#states.set(composer, bound);
|
|
63
63
|
return bound;
|
|
64
64
|
}
|
|
65
65
|
const preferredAgent = preferredNewThreadAgent ?? this.#lastSubmittedAgent;
|
|
66
|
-
const state = this.#state(composer, isDefaultTarget(
|
|
67
|
-
if (isIdentifiedTarget(
|
|
66
|
+
const state = this.#state(composer, isDefaultTarget(target2) ? preferredAgent : "codex");
|
|
67
|
+
if (isIdentifiedTarget(target2)) this.#targetStates.push({ target: target2, state });
|
|
68
68
|
return state;
|
|
69
69
|
}
|
|
70
70
|
isSwitching(composer) {
|
|
@@ -90,20 +90,20 @@
|
|
|
90
90
|
isCurrentOwnershipRequest(composer, generation) {
|
|
91
91
|
return (this.#ownershipRequestGenerations.get(this.#state(composer)) ?? 0) === generation;
|
|
92
92
|
}
|
|
93
|
-
rebindConversation(composer,
|
|
94
|
-
if (!isConversationTarget(
|
|
93
|
+
rebindConversation(composer, target2) {
|
|
94
|
+
if (!isConversationTarget(target2)) return null;
|
|
95
95
|
const previous = this.#state(composer);
|
|
96
96
|
this.#pendingSubmissions.delete(previous);
|
|
97
97
|
this.#modelRequestGenerations.set(previous, ++this.#modelRequestSequence);
|
|
98
98
|
this.#ownershipRequestGenerations.set(previous, ++this.#ownershipRequestSequence);
|
|
99
|
-
let state = this.#targetState(
|
|
99
|
+
let state = this.#targetState(target2);
|
|
100
100
|
if (!state) {
|
|
101
101
|
state = {
|
|
102
102
|
agent: "codex",
|
|
103
103
|
phase: "draft",
|
|
104
104
|
composerId: this.#idFactory(++this.#composerSequence)
|
|
105
105
|
};
|
|
106
|
-
this.#targetStates.push({ target, state });
|
|
106
|
+
this.#targetStates.push({ target: target2, state });
|
|
107
107
|
}
|
|
108
108
|
this.#states.set(composer, state);
|
|
109
109
|
this.#modelRequestGenerations.set(state, ++this.#modelRequestSequence);
|
|
@@ -184,17 +184,17 @@
|
|
|
184
184
|
if (state.phase === "draft") this.#lastSubmittedAgent = state.agent;
|
|
185
185
|
return state;
|
|
186
186
|
}
|
|
187
|
-
transfer(source, replacement,
|
|
187
|
+
transfer(source, replacement, target2 = null) {
|
|
188
188
|
const state = this.#states.get(source);
|
|
189
189
|
if (!state) return false;
|
|
190
|
-
const bound = this.#targetState(
|
|
190
|
+
const bound = this.#targetState(target2);
|
|
191
191
|
if (bound && bound !== state) return false;
|
|
192
192
|
if (source !== replacement) {
|
|
193
193
|
if (this.#states.has(replacement)) return false;
|
|
194
194
|
this.#states.set(replacement, state);
|
|
195
195
|
}
|
|
196
|
-
if (isIdentifiedTarget(
|
|
197
|
-
if (isConversationTarget(
|
|
196
|
+
if (isIdentifiedTarget(target2) && !bound) this.#targetStates.push({ target: target2, state });
|
|
197
|
+
if (isConversationTarget(target2) && this.#pendingSubmissions.delete(state))
|
|
198
198
|
state.phase = "locked";
|
|
199
199
|
return true;
|
|
200
200
|
}
|
|
@@ -220,9 +220,9 @@
|
|
|
220
220
|
this.#switching.delete(state);
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
|
-
#targetState(
|
|
224
|
-
if (!isIdentifiedTarget(
|
|
225
|
-
return this.#targetStates.find((candidate) => sameTarget(candidate.target,
|
|
223
|
+
#targetState(target2) {
|
|
224
|
+
if (!isIdentifiedTarget(target2)) return null;
|
|
225
|
+
return this.#targetStates.find((candidate) => sameTarget(candidate.target, target2))?.state ?? null;
|
|
226
226
|
}
|
|
227
227
|
#state(composer, initialAgent) {
|
|
228
228
|
const existing = this.#states.get(composer);
|
|
@@ -984,8 +984,8 @@
|
|
|
984
984
|
function objectClone(obj) {
|
|
985
985
|
return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj));
|
|
986
986
|
}
|
|
987
|
-
function assignProp(
|
|
988
|
-
Object.defineProperty(
|
|
987
|
+
function assignProp(target2, prop, value) {
|
|
988
|
+
Object.defineProperty(target2, prop, {
|
|
989
989
|
value,
|
|
990
990
|
writable: true,
|
|
991
991
|
enumerable: true,
|
|
@@ -1168,35 +1168,35 @@
|
|
|
1168
1168
|
return params;
|
|
1169
1169
|
}
|
|
1170
1170
|
function createTransparentProxy(getter) {
|
|
1171
|
-
let
|
|
1171
|
+
let target2;
|
|
1172
1172
|
return new Proxy({}, {
|
|
1173
1173
|
get(_, prop, receiver) {
|
|
1174
|
-
|
|
1175
|
-
return Reflect.get(
|
|
1174
|
+
target2 ?? (target2 = getter());
|
|
1175
|
+
return Reflect.get(target2, prop, receiver);
|
|
1176
1176
|
},
|
|
1177
1177
|
set(_, prop, value, receiver) {
|
|
1178
|
-
|
|
1179
|
-
return Reflect.set(
|
|
1178
|
+
target2 ?? (target2 = getter());
|
|
1179
|
+
return Reflect.set(target2, prop, value, receiver);
|
|
1180
1180
|
},
|
|
1181
1181
|
has(_, prop) {
|
|
1182
|
-
|
|
1183
|
-
return Reflect.has(
|
|
1182
|
+
target2 ?? (target2 = getter());
|
|
1183
|
+
return Reflect.has(target2, prop);
|
|
1184
1184
|
},
|
|
1185
1185
|
deleteProperty(_, prop) {
|
|
1186
|
-
|
|
1187
|
-
return Reflect.deleteProperty(
|
|
1186
|
+
target2 ?? (target2 = getter());
|
|
1187
|
+
return Reflect.deleteProperty(target2, prop);
|
|
1188
1188
|
},
|
|
1189
1189
|
ownKeys(_) {
|
|
1190
|
-
|
|
1191
|
-
return Reflect.ownKeys(
|
|
1190
|
+
target2 ?? (target2 = getter());
|
|
1191
|
+
return Reflect.ownKeys(target2);
|
|
1192
1192
|
},
|
|
1193
1193
|
getOwnPropertyDescriptor(_, prop) {
|
|
1194
|
-
|
|
1195
|
-
return Reflect.getOwnPropertyDescriptor(
|
|
1194
|
+
target2 ?? (target2 = getter());
|
|
1195
|
+
return Reflect.getOwnPropertyDescriptor(target2, prop);
|
|
1196
1196
|
},
|
|
1197
1197
|
defineProperty(_, prop, descriptor) {
|
|
1198
|
-
|
|
1199
|
-
return Reflect.defineProperty(
|
|
1198
|
+
target2 ?? (target2 = getter());
|
|
1199
|
+
return Reflect.defineProperty(target2, prop, descriptor);
|
|
1200
1200
|
}
|
|
1201
1201
|
});
|
|
1202
1202
|
}
|
|
@@ -11648,15 +11648,15 @@
|
|
|
11648
11648
|
|
|
11649
11649
|
// ../../node_modules/zod/v4/core/to-json-schema.js
|
|
11650
11650
|
function initializeContext(params) {
|
|
11651
|
-
let
|
|
11652
|
-
if (
|
|
11653
|
-
|
|
11654
|
-
if (
|
|
11655
|
-
|
|
11651
|
+
let target2 = params?.target ?? "draft-2020-12";
|
|
11652
|
+
if (target2 === "draft-4")
|
|
11653
|
+
target2 = "draft-04";
|
|
11654
|
+
if (target2 === "draft-7")
|
|
11655
|
+
target2 = "draft-07";
|
|
11656
11656
|
return {
|
|
11657
11657
|
processors: params.processors ?? {},
|
|
11658
11658
|
metadataRegistry: params?.metadata ?? globalRegistry,
|
|
11659
|
-
target,
|
|
11659
|
+
target: target2,
|
|
11660
11660
|
unrepresentable: params?.unrepresentable ?? "throw",
|
|
11661
11661
|
override: params?.override ?? (() => {
|
|
11662
11662
|
}),
|
|
@@ -11998,8 +11998,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11998
11998
|
return finalize(ctx, schema);
|
|
11999
11999
|
};
|
|
12000
12000
|
var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
|
|
12001
|
-
const { libraryOptions, target } = params ?? {};
|
|
12002
|
-
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
|
|
12001
|
+
const { libraryOptions, target: target2 } = params ?? {};
|
|
12002
|
+
const ctx = initializeContext({ ...libraryOptions ?? {}, target: target2, io, processors });
|
|
12003
12003
|
process(schema, ctx);
|
|
12004
12004
|
extractDefs(ctx, schema);
|
|
12005
12005
|
return finalize(ctx, schema);
|
|
@@ -13058,8 +13058,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
13058
13058
|
catch(params) {
|
|
13059
13059
|
return _catch2(this, params);
|
|
13060
13060
|
},
|
|
13061
|
-
pipe(
|
|
13062
|
-
return pipe(this,
|
|
13061
|
+
pipe(target2) {
|
|
13062
|
+
return pipe(this, target2);
|
|
13063
13063
|
},
|
|
13064
13064
|
readonly() {
|
|
13065
13065
|
return readonly(this);
|
|
@@ -15319,15 +15319,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15319
15319
|
threads: external_exports.array(threadOwnershipSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
|
|
15320
15320
|
}).strict().superRefine(({ threads }, context2) => {
|
|
15321
15321
|
const seen = /* @__PURE__ */ new Set();
|
|
15322
|
-
for (const [index,
|
|
15323
|
-
if (seen.has(
|
|
15322
|
+
for (const [index, thread2] of threads.entries()) {
|
|
15323
|
+
if (seen.has(thread2.threadId)) {
|
|
15324
15324
|
context2.addIssue({
|
|
15325
15325
|
code: "custom",
|
|
15326
15326
|
message: "Thread ownership-list results must be unique",
|
|
15327
15327
|
path: ["threads", index, "threadId"]
|
|
15328
15328
|
});
|
|
15329
15329
|
}
|
|
15330
|
-
seen.add(
|
|
15330
|
+
seen.add(thread2.threadId);
|
|
15331
15331
|
}
|
|
15332
15332
|
});
|
|
15333
15333
|
var threadSteeringInspectParamsSchema = external_exports.object({
|
|
@@ -15538,13 +15538,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15538
15538
|
});
|
|
15539
15539
|
|
|
15540
15540
|
// ../shared-contracts/dist/thread-catalog.js
|
|
15541
|
-
var threadCatalogReadParamsSchema = external_exports.object({
|
|
15541
|
+
var threadCatalogReadParamsSchema = external_exports.object({
|
|
15542
|
+
includeArchived: external_exports.boolean().optional(),
|
|
15543
|
+
/** Absent means first page; null means this branch is exhausted. Native cursors only. */
|
|
15544
|
+
officialCursor: external_exports.object({ live: external_exports.string().nullable(), archived: external_exports.string().nullable().optional() }).strict().optional()
|
|
15545
|
+
}).strict();
|
|
15542
15546
|
var threadCatalogReadResultSchema = external_exports.object({
|
|
15543
15547
|
threads: external_exports.array(jsonObjectSchema),
|
|
15544
15548
|
ownership: external_exports.array(threadOwnershipSchema),
|
|
15545
15549
|
/** Known archived IDs, including visible local external records even when their rows are
|
|
15546
|
-
* excluded. Native archived IDs
|
|
15547
|
-
archivedThreadIds: external_exports.array(hostThreadIdSchema)
|
|
15550
|
+
* excluded. Native archived IDs describe only the returned page, never a complete set. */
|
|
15551
|
+
archivedThreadIds: external_exports.array(hostThreadIdSchema),
|
|
15552
|
+
officialCursor: external_exports.object({ live: external_exports.string().nullable(), archived: external_exports.string().nullable().optional() }).strict().optional()
|
|
15548
15553
|
}).strict();
|
|
15549
15554
|
|
|
15550
15555
|
// ../shared-contracts/dist/voice.js
|
|
@@ -15786,7 +15791,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15786
15791
|
});
|
|
15787
15792
|
var DEFAULT_IDLE_RELEASE_SETTINGS = Object.freeze({
|
|
15788
15793
|
enabled: false,
|
|
15789
|
-
timeoutMinutes:
|
|
15794
|
+
timeoutMinutes: 10
|
|
15790
15795
|
});
|
|
15791
15796
|
|
|
15792
15797
|
// ../shared-contracts/dist/harness-preferences.js
|
|
@@ -16782,6 +16787,44 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16782
16787
|
}).strict();
|
|
16783
16788
|
var remoteSshSetupResultSchema = external_exports.object({ state: external_exports.enum(["installed", "not-installed"]) }).strict();
|
|
16784
16789
|
|
|
16790
|
+
// ../shared-contracts/dist/remote-sessions.js
|
|
16791
|
+
var REMOTE_CONTROLLER_REQUEST_MAX_BYTES = 16 * 1024;
|
|
16792
|
+
var identity = external_exports.string().min(1).max(1024);
|
|
16793
|
+
var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
|
|
16794
|
+
var thread = { ...target, threadId: identity };
|
|
16795
|
+
var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
16796
|
+
external_exports.strictObject({ kind: external_exports.literal("hosts") }),
|
|
16797
|
+
external_exports.strictObject({
|
|
16798
|
+
kind: external_exports.literal("list"),
|
|
16799
|
+
...target,
|
|
16800
|
+
cursor: external_exports.string().nullable(),
|
|
16801
|
+
archived: external_exports.boolean()
|
|
16802
|
+
}),
|
|
16803
|
+
external_exports.strictObject({ kind: external_exports.literal("read"), ...thread }),
|
|
16804
|
+
external_exports.strictObject({
|
|
16805
|
+
kind: external_exports.literal("prompt"),
|
|
16806
|
+
...thread,
|
|
16807
|
+
epoch: identity,
|
|
16808
|
+
text: external_exports.string().min(1).max(8e3),
|
|
16809
|
+
requestId: identity.optional()
|
|
16810
|
+
}),
|
|
16811
|
+
external_exports.strictObject({ kind: external_exports.literal("interrupt"), ...thread, epoch: identity, turnId: identity }),
|
|
16812
|
+
external_exports.strictObject({
|
|
16813
|
+
kind: external_exports.literal("rename"),
|
|
16814
|
+
...thread,
|
|
16815
|
+
epoch: identity,
|
|
16816
|
+
name: external_exports.string().min(1).max(512)
|
|
16817
|
+
}),
|
|
16818
|
+
external_exports.strictObject({ kind: external_exports.literal("archive"), ...thread, epoch: identity, archived: external_exports.boolean() }),
|
|
16819
|
+
external_exports.strictObject({
|
|
16820
|
+
kind: external_exports.literal("respond"),
|
|
16821
|
+
...thread,
|
|
16822
|
+
epoch: identity,
|
|
16823
|
+
requestId: external_exports.union([identity, external_exports.number().int()]),
|
|
16824
|
+
result: external_exports.record(external_exports.string(), external_exports.unknown())
|
|
16825
|
+
})
|
|
16826
|
+
]);
|
|
16827
|
+
|
|
16785
16828
|
// ../shared-contracts/dist/remote-connections.js
|
|
16786
16829
|
var hostId = external_exports.string().min(1).max(1024);
|
|
16787
16830
|
var codexSshConnectionSchema = external_exports.object({
|
|
@@ -16802,7 +16845,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16802
16845
|
identity: external_exports.string().max(4096).nullable()
|
|
16803
16846
|
});
|
|
16804
16847
|
var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action", [
|
|
16848
|
+
external_exports.strictObject({ action: external_exports.literal("session"), operation: remoteSessionOperationSchema }),
|
|
16805
16849
|
external_exports.strictObject({ action: external_exports.literal("list") }),
|
|
16850
|
+
external_exports.strictObject({ action: external_exports.literal("catalog") }),
|
|
16806
16851
|
external_exports.strictObject({
|
|
16807
16852
|
action: external_exports.literal("read-thread"),
|
|
16808
16853
|
hostId: hostId.refine((id) => id !== "local"),
|
|
@@ -17378,6 +17423,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17378
17423
|
}
|
|
17379
17424
|
return {
|
|
17380
17425
|
list,
|
|
17426
|
+
async catalog() {
|
|
17427
|
+
const result = await request("refresh-remote-connections", {});
|
|
17428
|
+
if (!record4(result) || !Array.isArray(result.remoteConnections))
|
|
17429
|
+
throw new Error("Native remote catalog unavailable");
|
|
17430
|
+
return result.remoteConnections.flatMap(
|
|
17431
|
+
(item) => record4(item) && typeof item.hostId === "string" && /^remote-(?:ssh(?:-|:)|control:)/u.test(item.hostId) && typeof item.displayName === "string" ? [
|
|
17432
|
+
{
|
|
17433
|
+
hostId: item.hostId,
|
|
17434
|
+
displayName: item.displayName,
|
|
17435
|
+
autoConnect: item.autoConnect === true
|
|
17436
|
+
}
|
|
17437
|
+
] : []
|
|
17438
|
+
);
|
|
17439
|
+
},
|
|
17381
17440
|
save: (draft, previous, signal) => mutate(previous, draft, signal),
|
|
17382
17441
|
remove: (previous, signal) => mutate(previous, null, signal),
|
|
17383
17442
|
async connect(hostId2, enabled, signal) {
|
|
@@ -18018,9 +18077,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18018
18077
|
const MAX_VISITED_FIBERS = 2e5;
|
|
18019
18078
|
const fiber = (value2) => typeof value2 === "object" && value2 !== null ? value2 : null;
|
|
18020
18079
|
const exhausted = () => {
|
|
18021
|
-
const
|
|
18022
|
-
if (typeof
|
|
18023
|
-
|
|
18080
|
+
const target2 = globalThis;
|
|
18081
|
+
if (typeof target2.dispatchEvent === "function" && typeof CustomEvent === "function")
|
|
18082
|
+
target2.dispatchEvent(new CustomEvent("codexhost:react-fiber-walk-limit", {
|
|
18024
18083
|
detail: { limit: MAX_VISITED_FIBERS }
|
|
18025
18084
|
}));
|
|
18026
18085
|
return [];
|
|
@@ -18539,10 +18598,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18539
18598
|
assertCurrent();
|
|
18540
18599
|
if (!record6(result) || result.status !== "created" || !createdId || !record6(result.firstTurn) || result.firstTurn.status !== "not-requested")
|
|
18541
18600
|
throw new Error("Chat creation was not confirmed. Check the chat list before creating another task.");
|
|
18542
|
-
const { thread, empty } = await readEmpty(createdId);
|
|
18601
|
+
const { thread: thread2, empty } = await readEmpty(createdId);
|
|
18543
18602
|
const inspection = threadInspectionSchema.parse(await request("codexhost/thread/inspect", { threadId: createdId }));
|
|
18544
18603
|
assertCurrent();
|
|
18545
|
-
if (!empty ||
|
|
18604
|
+
if (!empty || thread2.cwd !== input.workspace.cwd || inspection.owner !== "external" || inspection.transportModelId !== input.model)
|
|
18546
18605
|
throw new Error("The created chat's workspace, Model or empty state could not be confirmed");
|
|
18547
18606
|
return {
|
|
18548
18607
|
threadId: createdId,
|
|
@@ -18727,11 +18786,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18727
18786
|
async function handleRemoteConnectionsRequest(control, input) {
|
|
18728
18787
|
const request = remoteConnectionsRequestSchema.parse(input);
|
|
18729
18788
|
switch (request.action) {
|
|
18789
|
+
case "session":
|
|
18790
|
+
throw new Error("Remote sessions require the Desktop Controller route");
|
|
18730
18791
|
case "read-thread":
|
|
18731
18792
|
if (!control.readThread) throw new Error("Remote Thread reading is unavailable");
|
|
18732
18793
|
return control.readThread(request.hostId, request.input);
|
|
18733
18794
|
case "list":
|
|
18734
18795
|
return control.ssh.list();
|
|
18796
|
+
case "catalog":
|
|
18797
|
+
return control.ssh.catalog?.() ?? control.ssh.list();
|
|
18735
18798
|
case "save":
|
|
18736
18799
|
await control.ssh.save(request.draft, request.previous);
|
|
18737
18800
|
return null;
|
|
@@ -20005,20 +20068,20 @@ ${error51.stderrTail}`] : []
|
|
|
20005
20068
|
row.dataset.connectionSelected = String(selected);
|
|
20006
20069
|
row.tabIndex = selected ? 0 : -1;
|
|
20007
20070
|
row.setAttribute("role", "row");
|
|
20008
|
-
const
|
|
20009
|
-
|
|
20010
|
-
|
|
20071
|
+
const identity3 = document2.createElement("div");
|
|
20072
|
+
identity3.className = "settings-connection-row__identity";
|
|
20073
|
+
identity3.setAttribute("role", "cell");
|
|
20011
20074
|
if (group) {
|
|
20012
20075
|
const handle = document2.createElement("span");
|
|
20013
20076
|
handle.className = "settings-connection-row__handle";
|
|
20014
20077
|
handle.setAttribute("aria-hidden", "true");
|
|
20015
20078
|
handle.title = group.dragHandleTitle;
|
|
20016
20079
|
handle.append(createRendererSettingsIcon("grip-vertical", 15));
|
|
20017
|
-
|
|
20080
|
+
identity3.append(handle);
|
|
20018
20081
|
}
|
|
20019
20082
|
const label = document2.createElement("strong");
|
|
20020
20083
|
label.textContent = item.name;
|
|
20021
|
-
|
|
20084
|
+
identity3.append(createConnectionIdentityIcon(document2, item, 19), label);
|
|
20022
20085
|
const status = document2.createElement("span");
|
|
20023
20086
|
status.className = "settings-connection-row__status";
|
|
20024
20087
|
status.dataset.connectionTone = connectionStatusTone(item.availability, item.error !== null);
|
|
@@ -20096,8 +20159,8 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20096
20159
|
action.append(toggle);
|
|
20097
20160
|
}
|
|
20098
20161
|
row.addEventListener("click", (event) => {
|
|
20099
|
-
const
|
|
20100
|
-
if (
|
|
20162
|
+
const target2 = event.target;
|
|
20163
|
+
if (target2?.closest?.("a")) return;
|
|
20101
20164
|
select();
|
|
20102
20165
|
});
|
|
20103
20166
|
row.addEventListener("keydown", (event) => {
|
|
@@ -20115,17 +20178,17 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20115
20178
|
row.addEventListener("drop", group.onDrop);
|
|
20116
20179
|
row.addEventListener("dragend", group.onDragEnd);
|
|
20117
20180
|
}
|
|
20118
|
-
row.append(
|
|
20181
|
+
row.append(identity3, status, action);
|
|
20119
20182
|
return row;
|
|
20120
20183
|
}
|
|
20121
20184
|
function createInspectorHeader(document2, item, messages) {
|
|
20122
20185
|
const header = document2.createElement("header");
|
|
20123
20186
|
header.className = "settings-connection-inspector__header";
|
|
20124
|
-
const
|
|
20125
|
-
|
|
20187
|
+
const identity3 = document2.createElement("div");
|
|
20188
|
+
identity3.className = "settings-connection-inspector__identity";
|
|
20126
20189
|
const title = document2.createElement("strong");
|
|
20127
20190
|
title.textContent = item.name;
|
|
20128
|
-
|
|
20191
|
+
identity3.append(createConnectionIdentityIcon(document2, item, 20), title);
|
|
20129
20192
|
const websiteUrl = item.agentSnapshot?.plugin?.links?.website ?? item.agentSnapshot?.plugin?.links?.documentation;
|
|
20130
20193
|
if (websiteUrl) {
|
|
20131
20194
|
const website = document2.createElement("a");
|
|
@@ -20137,13 +20200,13 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20137
20200
|
website.setAttribute("aria-label", `${messages.connectionOfficialWebsite}: ${item.name}`);
|
|
20138
20201
|
website.append(createRendererSettingsIcon("external-link", 13));
|
|
20139
20202
|
website.addEventListener("click", (event) => event.stopPropagation());
|
|
20140
|
-
|
|
20203
|
+
identity3.append(website);
|
|
20141
20204
|
}
|
|
20142
20205
|
const status = document2.createElement("span");
|
|
20143
20206
|
status.className = "settings-connection-row__status";
|
|
20144
20207
|
status.dataset.connectionTone = connectionStatusTone(item.availability, item.error !== null);
|
|
20145
20208
|
status.textContent = item.error?.code === "authenticationRequired" ? messages.connectionLoginRequired : item.error?.code === "configurationRequired" ? messages.connectionConfigurationRequired : item.agentSnapshot && item.availability === "ready" && !item.error ? messages.connectionStatusConnected : connectionStatusLabel(item.availability, messages, item.error !== null);
|
|
20146
|
-
header.append(
|
|
20209
|
+
header.append(identity3, status);
|
|
20147
20210
|
return header;
|
|
20148
20211
|
}
|
|
20149
20212
|
function renderConnectionInspector(document2, inspector, item, hostId2, messages, diagnostics, existingLaunchControls, refresh) {
|
|
@@ -21624,8 +21687,8 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
21624
21687
|
...menu.querySelectorAll('[role="menuitemradio"], [role="menuitem"]')
|
|
21625
21688
|
].filter((button2) => !button2.disabled && !button2.closest("[hidden]"));
|
|
21626
21689
|
const selected = available.find((button2) => button2.getAttribute("aria-checked") === "true");
|
|
21627
|
-
const
|
|
21628
|
-
|
|
21690
|
+
const target2 = position === "last" ? available.at(-1) : position === "selected" ? selected : available[0];
|
|
21691
|
+
target2?.focus();
|
|
21629
21692
|
};
|
|
21630
21693
|
const open = (focus = "selected") => {
|
|
21631
21694
|
if (trigger.disabled || popoverOpen(menu)) return;
|
|
@@ -21905,8 +21968,8 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
21905
21968
|
}
|
|
21906
21969
|
if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key)) return;
|
|
21907
21970
|
event.preventDefault();
|
|
21908
|
-
const
|
|
21909
|
-
|
|
21971
|
+
const target2 = event.key === "Home" ? buttons[0] : event.key === "End" ? buttons.at(-1) : event.key === "ArrowDown" ? buttons[(index + 1 + buttons.length) % buttons.length] : buttons[(index - 1 + buttons.length) % buttons.length];
|
|
21972
|
+
target2?.focus();
|
|
21910
21973
|
};
|
|
21911
21974
|
const onToggle = () => {
|
|
21912
21975
|
trigger.setAttribute("aria-expanded", String(popoverOpen(menu)));
|
|
@@ -23608,16 +23671,16 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
23608
23671
|
trigger.setAttribute("data-state", openState || popoverOpen2(menu) ? "open" : "closed");
|
|
23609
23672
|
};
|
|
23610
23673
|
const onRootClick = (event) => {
|
|
23611
|
-
const
|
|
23612
|
-
if (
|
|
23674
|
+
const target2 = event.target instanceof Element ? event.target.closest("button") : null;
|
|
23675
|
+
if (target2?.dataset.openModelMenu) {
|
|
23613
23676
|
openModelMenu();
|
|
23614
23677
|
control.searchInput.focus();
|
|
23615
23678
|
return;
|
|
23616
23679
|
}
|
|
23617
|
-
if (
|
|
23680
|
+
if (target2?.dataset.thinkingOptionId) {
|
|
23618
23681
|
close();
|
|
23619
23682
|
trigger.focus();
|
|
23620
|
-
onSelectThinking(
|
|
23683
|
+
onSelectThinking(target2.dataset.thinkingOptionId);
|
|
23621
23684
|
}
|
|
23622
23685
|
};
|
|
23623
23686
|
const onModelMenuClick = (event) => {
|
|
@@ -23647,17 +23710,17 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
23647
23710
|
modelMenu.scrollTop = 0;
|
|
23648
23711
|
return;
|
|
23649
23712
|
}
|
|
23650
|
-
const
|
|
23651
|
-
if (!
|
|
23713
|
+
const target2 = event.target instanceof Element ? event.target.closest("button[data-model-id]") : null;
|
|
23714
|
+
if (!target2?.dataset.modelId) return;
|
|
23652
23715
|
close();
|
|
23653
23716
|
trigger.focus();
|
|
23654
|
-
onSelectModel(
|
|
23717
|
+
onSelectModel(target2.dataset.modelId);
|
|
23655
23718
|
};
|
|
23656
23719
|
const onModelHover = () => openModelMenu();
|
|
23657
23720
|
const onDocumentPointerDown = (event) => {
|
|
23658
23721
|
if (!popoverOpen2(menu) && !popoverOpen2(modelMenu)) return;
|
|
23659
|
-
const
|
|
23660
|
-
if (
|
|
23722
|
+
const target2 = event.target instanceof Node ? event.target : null;
|
|
23723
|
+
if (target2 && (root.contains(target2) || menu.contains(target2) || modelMenu.contains(target2))) {
|
|
23661
23724
|
return;
|
|
23662
23725
|
}
|
|
23663
23726
|
close();
|
|
@@ -24079,8 +24142,8 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24079
24142
|
const focusOption = (position) => {
|
|
24080
24143
|
const available = [...options.values()].map(({ button: button2 }) => button2).filter((button2) => !button2.disabled);
|
|
24081
24144
|
const selected = available.find((button2) => button2.getAttribute("aria-checked") === "true");
|
|
24082
|
-
const
|
|
24083
|
-
|
|
24145
|
+
const target2 = position === "last" ? available.at(-1) : position === "selected" ? selected : available[0];
|
|
24146
|
+
target2?.focus();
|
|
24084
24147
|
};
|
|
24085
24148
|
const open = (focus = "selected") => {
|
|
24086
24149
|
if (trigger.disabled || popoverOpen3(menu)) return;
|
|
@@ -24123,8 +24186,8 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24123
24186
|
}
|
|
24124
24187
|
if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key)) return;
|
|
24125
24188
|
event.preventDefault();
|
|
24126
|
-
const
|
|
24127
|
-
|
|
24189
|
+
const target2 = event.key === "Home" ? buttons[0] : event.key === "End" ? buttons.at(-1) : event.key === "ArrowDown" ? buttons[(index + 1 + buttons.length) % buttons.length] : buttons[(index - 1 + buttons.length) % buttons.length];
|
|
24190
|
+
target2?.focus();
|
|
24128
24191
|
};
|
|
24129
24192
|
const onToggle = () => {
|
|
24130
24193
|
const openState = popoverOpen3(menu);
|
|
@@ -24889,9 +24952,9 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24889
24952
|
// src/renderer-composer-dom.ts
|
|
24890
24953
|
var CODEX_COMPOSER_SELECTOR = "[data-codex-composer-root]";
|
|
24891
24954
|
var EDITOR_SELECTOR = 'textarea, [contenteditable="true"], [role="textbox"]';
|
|
24892
|
-
function eventElement(
|
|
24893
|
-
if (
|
|
24894
|
-
return
|
|
24955
|
+
function eventElement(target2) {
|
|
24956
|
+
if (target2 instanceof Element) return target2;
|
|
24957
|
+
return target2 instanceof Node ? target2.parentElement : null;
|
|
24895
24958
|
}
|
|
24896
24959
|
function controlDescription(element) {
|
|
24897
24960
|
const typed = element;
|
|
@@ -25641,9 +25704,9 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
25641
25704
|
const trace = (value, prefix) => new Proxy(
|
|
25642
25705
|
{ ...value },
|
|
25643
25706
|
{
|
|
25644
|
-
get(
|
|
25707
|
+
get(target2, property, receiver) {
|
|
25645
25708
|
if (typeof property === "string") read.add(`${prefix}.${property}`);
|
|
25646
|
-
return Reflect.get(
|
|
25709
|
+
return Reflect.get(target2, property, receiver);
|
|
25647
25710
|
}
|
|
25648
25711
|
}
|
|
25649
25712
|
);
|
|
@@ -25738,12 +25801,12 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
25738
25801
|
return found;
|
|
25739
25802
|
}
|
|
25740
25803
|
function project2(kind, { fiber, subscriber, store, atom, instance, subscribeEffect }) {
|
|
25741
|
-
for (const [
|
|
25804
|
+
for (const [target2, key] of [
|
|
25742
25805
|
[store, "sub"],
|
|
25743
25806
|
[subscriber, "getSnapshot"],
|
|
25744
25807
|
[instance, "getSnapshot"]
|
|
25745
25808
|
]) {
|
|
25746
|
-
if (Object.getOwnPropertyDescriptor(
|
|
25809
|
+
if (Object.getOwnPropertyDescriptor(target2, key)?.writable !== true) {
|
|
25747
25810
|
throw new Error("Codex usage gate is not writable");
|
|
25748
25811
|
}
|
|
25749
25812
|
}
|
|
@@ -26017,8 +26080,8 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
26017
26080
|
}
|
|
26018
26081
|
async function verifyNativeCodexThread(sendRequest, threadId) {
|
|
26019
26082
|
const native = await sendRequest("thread/read", { threadId, includeTurns: false });
|
|
26020
|
-
const
|
|
26021
|
-
if (!isRecord4(
|
|
26083
|
+
const thread2 = isRecord4(native) ? native.thread : null;
|
|
26084
|
+
if (!isRecord4(thread2) || thread2.id !== threadId || typeof thread2.modelProvider !== "string" || !thread2.modelProvider || thread2.modelProvider === "codexhost" || typeof thread2.cliVersion !== "string" || !thread2.cliVersion || thread2.cliVersion === "codexhost") {
|
|
26022
26085
|
throw new Error("Native Thread response cannot establish Codex ownership");
|
|
26023
26086
|
}
|
|
26024
26087
|
}
|
|
@@ -26327,7 +26390,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
26327
26390
|
const params = threadOwnershipListParamsSchema.parse(input);
|
|
26328
26391
|
const value = await manager.sendRequest(THREAD_OWNERSHIP_LIST_METHOD, params);
|
|
26329
26392
|
const result = threadOwnershipListResultSchema.parse(value);
|
|
26330
|
-
if (result.threads.length !== params.threadIds.length || result.threads.some((
|
|
26393
|
+
if (result.threads.length !== params.threadIds.length || result.threads.some((thread2, index) => thread2.threadId !== params.threadIds[index])) {
|
|
26331
26394
|
throw new Error("Thread ownership-list result does not match the requested IDs");
|
|
26332
26395
|
}
|
|
26333
26396
|
return result;
|
|
@@ -26480,9 +26543,9 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
26480
26543
|
function isRecord6(value) {
|
|
26481
26544
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
26482
26545
|
}
|
|
26483
|
-
function installRendererExternalQueue(
|
|
26484
|
-
if (!isRecord6(
|
|
26485
|
-
const coordinator =
|
|
26546
|
+
function installRendererExternalQueue(target2) {
|
|
26547
|
+
if (!isRecord6(target2) || typeof target2.getTurnCoordinator !== "function") return null;
|
|
26548
|
+
const coordinator = target2.getTurnCoordinator();
|
|
26486
26549
|
const queue = isRecord6(coordinator) ? coordinator.serverQueue : null;
|
|
26487
26550
|
if (!isRecord6(queue) || typeof queue.isEnabled !== "function") return null;
|
|
26488
26551
|
return () => void 0;
|
|
@@ -26507,7 +26570,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
26507
26570
|
return "official";
|
|
26508
26571
|
}
|
|
26509
26572
|
const result = threadOwnershipListResultSchema.parse(response);
|
|
26510
|
-
const owner = result.threads.find((
|
|
26573
|
+
const owner = result.threads.find((thread2) => thread2.threadId === threadId)?.owner;
|
|
26511
26574
|
if (!owner) throw new Error("Thread ownership could not be resolved for steering");
|
|
26512
26575
|
return owner === "codex" ? "official" : "newTurn";
|
|
26513
26576
|
}
|
|
@@ -26589,9 +26652,9 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
26589
26652
|
});
|
|
26590
26653
|
};
|
|
26591
26654
|
}
|
|
26592
|
-
function installRendererExternalSteering(
|
|
26593
|
-
if (!isManager(
|
|
26594
|
-
const manager =
|
|
26655
|
+
function installRendererExternalSteering(target2, sendTurnStart, prepareTurnInput) {
|
|
26656
|
+
if (!isManager(target2)) return null;
|
|
26657
|
+
const manager = target2;
|
|
26595
26658
|
const originalSteer = manager.steerTurn;
|
|
26596
26659
|
const originalSend = manager.sendRequest;
|
|
26597
26660
|
const routes = /* @__PURE__ */ new Map();
|
|
@@ -26830,16 +26893,16 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
26830
26893
|
for (let index = 0; index < decoded.length; index += 1) bytes[index] = decoded.charCodeAt(index);
|
|
26831
26894
|
return { contents: new Blob([bytes], { type: mimeType }), extension };
|
|
26832
26895
|
}
|
|
26833
|
-
function createRemoteAttachmentSender(
|
|
26896
|
+
function createRemoteAttachmentSender(target2, hostId2, isCurrent) {
|
|
26834
26897
|
const prepared = /* @__PURE__ */ new WeakMap();
|
|
26835
26898
|
return (params, send) => {
|
|
26836
|
-
if (hostId2 === "local" || !isRecord8(
|
|
26899
|
+
if (hostId2 === "local" || !isRecord8(target2) || !isRecord8(params) || typeof params.threadId !== "string" || !Array.isArray(params.input) || typeof target2.getConversation !== "function")
|
|
26837
26900
|
return send(params);
|
|
26838
26901
|
const images = params.input.filter(
|
|
26839
26902
|
(item) => isRecord8(item) && (item.type === "image" || item.type === "localImage")
|
|
26840
26903
|
);
|
|
26841
26904
|
if (images.length === 0) return send(params);
|
|
26842
|
-
const conversation =
|
|
26905
|
+
const conversation = target2.getConversation.call(target2, params.threadId);
|
|
26843
26906
|
if (!isRecord8(conversation) || conversation.id !== params.threadId || conversation.modelProvider !== "codexhost")
|
|
26844
26907
|
return send(params);
|
|
26845
26908
|
const assertCurrent = () => {
|
|
@@ -26869,7 +26932,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
26869
26932
|
if (totalBytes > MAX_TOTAL_BYTES) throw new Error("Remote image attachments exceed 32 MiB");
|
|
26870
26933
|
return file2;
|
|
26871
26934
|
});
|
|
26872
|
-
if (files.some((file2) => "contents" in file2) && typeof
|
|
26935
|
+
if (files.some((file2) => "contents" in file2) && typeof target2.createFileAttachment !== "function") {
|
|
26873
26936
|
throw new Error("Desktop remote attachment storage is unavailable");
|
|
26874
26937
|
}
|
|
26875
26938
|
const created = [];
|
|
@@ -26881,7 +26944,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
26881
26944
|
paths.push(file2.path);
|
|
26882
26945
|
continue;
|
|
26883
26946
|
}
|
|
26884
|
-
const saved = await
|
|
26947
|
+
const saved = await target2.createFileAttachment.call(target2, {
|
|
26885
26948
|
contents: file2.contents,
|
|
26886
26949
|
label: `image-${index + 1}.${file2.extension}`
|
|
26887
26950
|
});
|
|
@@ -26914,11 +26977,11 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
26914
26977
|
]
|
|
26915
26978
|
};
|
|
26916
26979
|
} catch (error51) {
|
|
26917
|
-
if (isCurrent() && typeof
|
|
26980
|
+
if (isCurrent() && typeof target2.removePastedTextAttachment === "function") {
|
|
26918
26981
|
await Promise.allSettled(
|
|
26919
26982
|
created.map(
|
|
26920
26983
|
(path) => Promise.resolve().then(
|
|
26921
|
-
() =>
|
|
26984
|
+
() => target2.removePastedTextAttachment.call(target2, path)
|
|
26922
26985
|
)
|
|
26923
26986
|
)
|
|
26924
26987
|
);
|
|
@@ -27057,13 +27120,13 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27057
27120
|
function isRecord9(value) {
|
|
27058
27121
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
27059
27122
|
}
|
|
27060
|
-
function installRendererManualCompaction(
|
|
27061
|
-
if (!messages || typeof messages.addEventListener !== "function" || typeof messages.removeEventListener !== "function" || !isRecord9(
|
|
27123
|
+
function installRendererManualCompaction(target2, hostId2, messages) {
|
|
27124
|
+
if (!messages || typeof messages.addEventListener !== "function" || typeof messages.removeEventListener !== "function" || !isRecord9(target2) || typeof target2.registerPendingManualContextCompaction !== "function" || typeof target2.getConversation !== "function") {
|
|
27062
27125
|
return null;
|
|
27063
27126
|
}
|
|
27064
|
-
const register =
|
|
27065
|
-
const getConversation =
|
|
27066
|
-
const getStreamRole = typeof
|
|
27127
|
+
const register = target2.registerPendingManualContextCompaction;
|
|
27128
|
+
const getConversation = target2.getConversation;
|
|
27129
|
+
const getStreamRole = typeof target2.getStreamRole === "function" ? target2.getStreamRole : null;
|
|
27067
27130
|
const listener = (event) => {
|
|
27068
27131
|
if (event.source != null && event.source !== messages) return;
|
|
27069
27132
|
const message2 = event.data;
|
|
@@ -27073,13 +27136,13 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27073
27136
|
const params = threadManualCompactionStartedSchema.safeParse(message2.params);
|
|
27074
27137
|
if (!params.success) return;
|
|
27075
27138
|
const { threadId } = params.data;
|
|
27076
|
-
const conversation = getConversation.call(
|
|
27139
|
+
const conversation = getConversation.call(target2, threadId);
|
|
27077
27140
|
if (!isRecord9(conversation) || conversation.id !== threadId || conversation.modelProvider !== "codexhost") {
|
|
27078
27141
|
return;
|
|
27079
27142
|
}
|
|
27080
|
-
const role = getStreamRole?.call(
|
|
27143
|
+
const role = getStreamRole?.call(target2, threadId);
|
|
27081
27144
|
if (isRecord9(role) && role.role === "follower") return;
|
|
27082
|
-
register.call(
|
|
27145
|
+
register.call(target2, threadId);
|
|
27083
27146
|
};
|
|
27084
27147
|
messages.addEventListener("message", listener);
|
|
27085
27148
|
return () => {
|
|
@@ -27106,7 +27169,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27106
27169
|
const cached2 = entries.get(route.hostId);
|
|
27107
27170
|
if (cached2?.route === route) return cached2.client;
|
|
27108
27171
|
retire(route.hostId);
|
|
27109
|
-
const
|
|
27172
|
+
const target2 = route.manager;
|
|
27110
27173
|
const cleanups = /* @__PURE__ */ new Set();
|
|
27111
27174
|
const nativeClient = createRendererModelClient([
|
|
27112
27175
|
{
|
|
@@ -27114,11 +27177,11 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27114
27177
|
if (disposed || readRouting()?.forHost(route.hostId) !== route) {
|
|
27115
27178
|
throw new Error(`Renderer request manager is unavailable for Host ${route.hostId}`);
|
|
27116
27179
|
}
|
|
27117
|
-
return options === void 0 ?
|
|
27180
|
+
return options === void 0 ? target2.sendRequest(method, params) : target2.sendRequest(method, params, options);
|
|
27118
27181
|
},
|
|
27119
|
-
...
|
|
27182
|
+
...target2.addNotificationCallback ? {
|
|
27120
27183
|
addNotificationCallback(methods, listener) {
|
|
27121
|
-
const unsubscribe =
|
|
27184
|
+
const unsubscribe = target2.addNotificationCallback?.(methods, listener);
|
|
27122
27185
|
if (!messages || !(typeof methods === "string" ? [methods] : methods).some(
|
|
27123
27186
|
(method) => [
|
|
27124
27187
|
THREAD_USAGE_UPDATED_METHOD,
|
|
@@ -27157,28 +27220,28 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27157
27220
|
if (!nativeClient) return null;
|
|
27158
27221
|
const client = restoreThreadReferenceCapability(
|
|
27159
27222
|
nativeClient,
|
|
27160
|
-
|
|
27223
|
+
target2,
|
|
27161
27224
|
() => !disposed && readRouting()?.forHost(route.hostId) === route,
|
|
27162
27225
|
messages
|
|
27163
27226
|
);
|
|
27164
27227
|
entries.set(route.hostId, { route, client, cleanups });
|
|
27165
27228
|
try {
|
|
27166
27229
|
for (const install2 of [
|
|
27167
|
-
() => installRendererExternalQueue(
|
|
27230
|
+
() => installRendererExternalQueue(target2),
|
|
27168
27231
|
() => installRendererExternalSteering(
|
|
27169
|
-
|
|
27232
|
+
target2,
|
|
27170
27233
|
createRemoteAttachmentSender(
|
|
27171
|
-
|
|
27234
|
+
target2,
|
|
27172
27235
|
route.hostId,
|
|
27173
27236
|
() => !disposed && readRouting()?.forHost(route.hostId) === route
|
|
27174
27237
|
),
|
|
27175
27238
|
createThreadReferenceContext(
|
|
27176
|
-
|
|
27239
|
+
target2,
|
|
27177
27240
|
route.hostId,
|
|
27178
27241
|
() => !disposed && readRouting()?.forHost(route.hostId) === route
|
|
27179
27242
|
)
|
|
27180
27243
|
),
|
|
27181
|
-
() => installRendererManualCompaction(
|
|
27244
|
+
() => installRendererManualCompaction(target2, route.hostId, messages)
|
|
27182
27245
|
]) {
|
|
27183
27246
|
const cleanup = install2();
|
|
27184
27247
|
if (cleanup) cleanups.add(cleanup);
|
|
@@ -27411,11 +27474,11 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27411
27474
|
changed.add(this.#row(element));
|
|
27412
27475
|
};
|
|
27413
27476
|
for (const mutation of mutations) {
|
|
27414
|
-
const
|
|
27415
|
-
const row =
|
|
27477
|
+
const target2 = mutation.target instanceof Element ? mutation.target : mutation.target.parentElement;
|
|
27478
|
+
const row = target2?.closest(SIDEBAR_AGENT_ICON_ROW_SELECTOR);
|
|
27416
27479
|
if (row) changed.add(this.#row(row));
|
|
27417
|
-
else if (
|
|
27418
|
-
changed.add(this.#row(
|
|
27480
|
+
else if (target2 && this.#rowsByElement.has(target2))
|
|
27481
|
+
changed.add(this.#row(target2));
|
|
27419
27482
|
for (const node of mutation.addedNodes) collect(node);
|
|
27420
27483
|
for (const node of mutation.removedNodes) collect(node);
|
|
27421
27484
|
}
|
|
@@ -27800,18 +27863,18 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27800
27863
|
const button2 = origin?.closest("button");
|
|
27801
27864
|
if (!button2) return;
|
|
27802
27865
|
if (this.#replayed.delete(button2)) return;
|
|
27803
|
-
const
|
|
27804
|
-
if (!
|
|
27866
|
+
const target2 = rendererForkTargetFromButton(button2);
|
|
27867
|
+
if (!target2 || !onFork(target2)) return;
|
|
27805
27868
|
event.preventDefault();
|
|
27806
27869
|
event.stopImmediatePropagation();
|
|
27807
27870
|
};
|
|
27808
27871
|
document.addEventListener("click", listener, true);
|
|
27809
27872
|
return () => document.removeEventListener("click", listener, true);
|
|
27810
27873
|
}
|
|
27811
|
-
replay(
|
|
27812
|
-
if (!(
|
|
27813
|
-
this.#replayed.add(
|
|
27814
|
-
|
|
27874
|
+
replay(target2) {
|
|
27875
|
+
if (!(target2.control instanceof HTMLButtonElement) || !target2.control.isConnected) return;
|
|
27876
|
+
this.#replayed.add(target2.control);
|
|
27877
|
+
target2.control.click();
|
|
27815
27878
|
}
|
|
27816
27879
|
openThread(threadId) {
|
|
27817
27880
|
return openRendererThread(threadId);
|
|
@@ -27821,22 +27884,22 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27821
27884
|
const dom = options.dom ?? new BrowserRendererForkDom();
|
|
27822
27885
|
const pending2 = /* @__PURE__ */ new Set();
|
|
27823
27886
|
let disposed = false;
|
|
27824
|
-
const stop = dom.listen((
|
|
27887
|
+
const stop = dom.listen((target2) => {
|
|
27825
27888
|
if (disposed) return false;
|
|
27826
27889
|
const client = options.getClient();
|
|
27827
27890
|
if (!client) return false;
|
|
27828
|
-
const key = `${
|
|
27891
|
+
const key = `${target2.threadId}\0${target2.turnId}`;
|
|
27829
27892
|
if (pending2.has(key)) return true;
|
|
27830
27893
|
pending2.add(key);
|
|
27831
|
-
void client.inspectThread({ threadId:
|
|
27894
|
+
void client.inspectThread({ threadId: target2.threadId }).then(async (inspection) => {
|
|
27832
27895
|
if (disposed) return;
|
|
27833
|
-
if (inspection.owner === "codex" || !inspection.history.fork || !
|
|
27834
|
-
dom.replay(
|
|
27896
|
+
if (inspection.owner === "codex" || !inspection.history.fork || !target2.isProjectlessConversation) {
|
|
27897
|
+
dom.replay(target2);
|
|
27835
27898
|
return;
|
|
27836
27899
|
}
|
|
27837
27900
|
const result = await client.forkThread({
|
|
27838
|
-
threadId:
|
|
27839
|
-
lastTurnId:
|
|
27901
|
+
threadId: target2.threadId,
|
|
27902
|
+
lastTurnId: target2.turnId
|
|
27840
27903
|
});
|
|
27841
27904
|
if (!disposed) await dom.openThread(result.threadId);
|
|
27842
27905
|
}).catch((error51) => options.reportError?.(error51)).finally(() => pending2.delete(key));
|
|
@@ -28019,11 +28082,11 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
28019
28082
|
...thinking?.success ? { thinkingOptionId: thinking.data } : {}
|
|
28020
28083
|
};
|
|
28021
28084
|
}
|
|
28022
|
-
function threadIdFromComposerModelTarget(
|
|
28023
|
-
if (
|
|
28085
|
+
function threadIdFromComposerModelTarget(target2) {
|
|
28086
|
+
if (target2?.[0] !== "conversation" || typeof target2[1] !== "string" || target2[1].trim().length === 0) {
|
|
28024
28087
|
return null;
|
|
28025
28088
|
}
|
|
28026
|
-
return hostThreadIdSchema.parse(
|
|
28089
|
+
return hostThreadIdSchema.parse(target2[1]);
|
|
28027
28090
|
}
|
|
28028
28091
|
function findComposerFiber(composer) {
|
|
28029
28092
|
const selector = '[data-codex-composer], [contenteditable="true"][role="textbox"]';
|
|
@@ -28127,15 +28190,15 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
28127
28190
|
function isDraftPrewarmPolicyReady(value) {
|
|
28128
28191
|
return isRecord12(value) && value.state === "ready" && typeof value.hostId === "string" && value.hostId.length > 0 && typeof value.select === "function" && typeof value.clear === "function";
|
|
28129
28192
|
}
|
|
28130
|
-
async function waitForRendererDraftPrewarmPolicy(
|
|
28193
|
+
async function waitForRendererDraftPrewarmPolicy(target2, composer) {
|
|
28131
28194
|
const deadline = Date.now() + DRAFT_PREWARM_POLICY_WAIT_TIMEOUT_MS;
|
|
28132
28195
|
while (true) {
|
|
28133
|
-
const policy =
|
|
28196
|
+
const policy = target2.__codexhostHostRoutingV1?.forComposer(composer)?.policy;
|
|
28134
28197
|
if (isDraftPrewarmPolicyReady(policy)) return policy;
|
|
28135
28198
|
const remaining = deadline - Date.now();
|
|
28136
28199
|
if (remaining <= 0) throw new Error("Renderer draft prewarm policy is unavailable");
|
|
28137
28200
|
await new Promise((resolve) => {
|
|
28138
|
-
|
|
28201
|
+
target2.setTimeout(resolve, Math.min(DRAFT_PREWARM_POLICY_POLL_INTERVAL_MS, remaining));
|
|
28139
28202
|
});
|
|
28140
28203
|
}
|
|
28141
28204
|
}
|
|
@@ -28325,12 +28388,12 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
28325
28388
|
const route = window.__codexhostHostRoutingV1?.forComposer(composer);
|
|
28326
28389
|
if (!route) return false;
|
|
28327
28390
|
try {
|
|
28328
|
-
const
|
|
28329
|
-
if (
|
|
28330
|
-
if (
|
|
28391
|
+
const target2 = composer ? findComposerModelTarget(composer) : null;
|
|
28392
|
+
if (target2?.[0] === "conversation") return true;
|
|
28393
|
+
if (target2?.[0] !== "default" || typeof target2[1] !== "string" || !composer)
|
|
28331
28394
|
return agent === "codex";
|
|
28332
|
-
const binding = findScopedDraftModelBinding(composer,
|
|
28333
|
-
const draftKey =
|
|
28395
|
+
const binding = findScopedDraftModelBinding(composer, target2[1]);
|
|
28396
|
+
const draftKey = target2[1];
|
|
28334
28397
|
if (!binding || !route.policy.scopedCreation)
|
|
28335
28398
|
return agent === "codex" && !draftModels.has(draftKey);
|
|
28336
28399
|
const previous = draftModels.model(draftKey);
|
|
@@ -28815,20 +28878,20 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
28815
28878
|
unmeteredRequests: 0
|
|
28816
28879
|
};
|
|
28817
28880
|
}
|
|
28818
|
-
function addTotals(
|
|
28819
|
-
|
|
28820
|
-
|
|
28821
|
-
|
|
28822
|
-
|
|
28823
|
-
|
|
28824
|
-
|
|
28825
|
-
|
|
28826
|
-
|
|
28827
|
-
|
|
28828
|
-
|
|
28829
|
-
|
|
28830
|
-
|
|
28831
|
-
return
|
|
28881
|
+
function addTotals(target2, source) {
|
|
28882
|
+
target2.requests += source.requests;
|
|
28883
|
+
target2.inputTokens += source.inputTokens;
|
|
28884
|
+
target2.cachedInputTokens += source.cachedInputTokens;
|
|
28885
|
+
target2.cacheWriteInputTokens += source.cacheWriteInputTokens;
|
|
28886
|
+
target2.cacheKnownInputTokens += source.cacheKnownInputTokens;
|
|
28887
|
+
target2.cacheHitCachedInputTokens += source.cacheHitCachedInputTokens;
|
|
28888
|
+
target2.cacheHitInputTokens += source.cacheHitInputTokens;
|
|
28889
|
+
target2.outputTokens += source.outputTokens;
|
|
28890
|
+
target2.reasoningOutputTokens += source.reasoningOutputTokens;
|
|
28891
|
+
target2.costUsd += source.costUsd;
|
|
28892
|
+
target2.unpricedRequests += source.unpricedRequests;
|
|
28893
|
+
target2.unmeteredRequests += source.unmeteredRequests;
|
|
28894
|
+
return target2;
|
|
28832
28895
|
}
|
|
28833
28896
|
function inputWithoutCache(totals2) {
|
|
28834
28897
|
return totals2.inputTokens - totals2.cachedInputTokens - totals2.cacheWriteInputTokens;
|
|
@@ -31786,7 +31849,7 @@ ${detail}` : ""}`
|
|
|
31786
31849
|
card.setAttribute("aria-label", connection.displayName);
|
|
31787
31850
|
card.setAttribute("aria-busy", String(locked));
|
|
31788
31851
|
const head = remoteElement(document2, "div", "settings-remote-card__head");
|
|
31789
|
-
const
|
|
31852
|
+
const identity3 = remoteElement(document2, "div", "settings-remote-card__identity");
|
|
31790
31853
|
const titleLine = remoteElement(document2, "div", "settings-remote-card__title");
|
|
31791
31854
|
const [tone, stateLabel] = connectionState(row, t);
|
|
31792
31855
|
const state = remoteElement(document2, "span", "settings-remote-card__state", stateLabel);
|
|
@@ -31799,7 +31862,7 @@ ${detail}` : ""}`
|
|
|
31799
31862
|
addressLine.append(
|
|
31800
31863
|
remoteElement(document2, "span", "settings-status-badge", t("SSH \u914D\u7F6E", "SSH config"))
|
|
31801
31864
|
);
|
|
31802
|
-
|
|
31865
|
+
identity3.append(titleLine, addressLine);
|
|
31803
31866
|
const headActions = remoteElement(document2, "div", "settings-remote-card__actions");
|
|
31804
31867
|
if (row.installation !== "not-installed" && !row.probing) {
|
|
31805
31868
|
if (row.state === "error" && connection.autoConnect)
|
|
@@ -31822,7 +31885,7 @@ ${detail}` : ""}`
|
|
|
31822
31885
|
remove.append(createRendererSettingsIcon("trash", 15));
|
|
31823
31886
|
remove.addEventListener("click", () => onAction("remove"));
|
|
31824
31887
|
headActions.append(remove);
|
|
31825
|
-
head.append(
|
|
31888
|
+
head.append(identity3, headActions);
|
|
31826
31889
|
card.append(head);
|
|
31827
31890
|
if (row.stateError) {
|
|
31828
31891
|
const detail = remoteElement(
|
|
@@ -31874,15 +31937,15 @@ ${detail}` : ""}`
|
|
|
31874
31937
|
}
|
|
31875
31938
|
if (!remote) serviceActions.append(command("recheck", t("\u91CD\u65B0\u68C0\u6D4B", "Check again")));
|
|
31876
31939
|
}
|
|
31877
|
-
const
|
|
31940
|
+
const target2 = remote ? remoteMaintenanceTarget(local, remote) : null;
|
|
31878
31941
|
if (row.installation === "not-installed") {
|
|
31879
31942
|
const install2 = command("install", t("\u5B89\u88C5\u5E76\u8FDE\u63A5", "Install and connect"), true);
|
|
31880
31943
|
install2.disabled ||= !remoteInstallVersion(local);
|
|
31881
31944
|
serviceActions.append(install2);
|
|
31882
|
-
} else if (remote &&
|
|
31945
|
+
} else if (remote && target2 && !remoteBusy(remote)) {
|
|
31883
31946
|
const update = command(
|
|
31884
31947
|
"update",
|
|
31885
|
-
|
|
31948
|
+
target2 === remote.installedVersion ? t("\u91CD\u542F\u5E76\u8FDE\u63A5", "Restart and connect") : t("\u66F4\u65B0\u5230\u672C\u673A\u7248\u672C", "Match local version"),
|
|
31886
31949
|
true
|
|
31887
31950
|
);
|
|
31888
31951
|
serviceActions.append(update);
|
|
@@ -32116,13 +32179,13 @@ ${detail}` : ""}`
|
|
|
32116
32179
|
port.min = "1";
|
|
32117
32180
|
port.max = "65535";
|
|
32118
32181
|
port.step = "1";
|
|
32119
|
-
const
|
|
32182
|
+
const identity3 = field2(
|
|
32120
32183
|
t("\u79C1\u94A5\u8DEF\u5F84\uFF08\u53EF\u9009\uFF09", "Identity file (optional)"),
|
|
32121
32184
|
previous?.identity ?? "",
|
|
32122
32185
|
"~/.ssh/id_ed25519"
|
|
32123
32186
|
);
|
|
32124
32187
|
if (previous?.source === "discovered") {
|
|
32125
|
-
hostname3.disabled = port.disabled =
|
|
32188
|
+
hostname3.disabled = port.disabled = identity3.disabled = true;
|
|
32126
32189
|
dialog.body.append(
|
|
32127
32190
|
remoteElement(
|
|
32128
32191
|
document2,
|
|
@@ -32142,7 +32205,7 @@ ${detail}` : ""}`
|
|
|
32142
32205
|
displayName: name.value,
|
|
32143
32206
|
hostname: hostname3.value,
|
|
32144
32207
|
sshPort: port.value ? Number(port.value) : null,
|
|
32145
|
-
identity:
|
|
32208
|
+
identity: identity3.value.trim() || null
|
|
32146
32209
|
})
|
|
32147
32210
|
);
|
|
32148
32211
|
});
|
|
@@ -32463,8 +32526,8 @@ ${detail}` : ""}`
|
|
|
32463
32526
|
});
|
|
32464
32527
|
}
|
|
32465
32528
|
function focusAction(card, action) {
|
|
32466
|
-
const
|
|
32467
|
-
|
|
32529
|
+
const target2 = card.querySelector(`[data-action="${action}"]:not(:disabled)`) ?? card.querySelector("button:not(:disabled)");
|
|
32530
|
+
target2?.focus();
|
|
32468
32531
|
}
|
|
32469
32532
|
async function probe(row) {
|
|
32470
32533
|
const { hostId: hostId2 } = row.connection;
|
|
@@ -32745,15 +32808,15 @@ ${detail}` : ""}`
|
|
|
32745
32808
|
});
|
|
32746
32809
|
break;
|
|
32747
32810
|
case "update": {
|
|
32748
|
-
const
|
|
32749
|
-
if (!
|
|
32750
|
-
const restart =
|
|
32811
|
+
const target2 = row.remote ? remoteMaintenanceTarget(local, row.remote) : null;
|
|
32812
|
+
if (!target2) break;
|
|
32813
|
+
const restart = target2 === row.remote?.installedVersion;
|
|
32751
32814
|
void act(
|
|
32752
32815
|
row,
|
|
32753
32816
|
action,
|
|
32754
32817
|
restart ? t("\u6B63\u5728\u91CD\u542F\u8FDC\u7A0B\u670D\u52A1\u2026", "Restarting remote service\u2026") : t("\u6B63\u5728\u63D0\u4EA4\u66F4\u65B0\u2026", "Starting update\u2026"),
|
|
32755
32818
|
async () => {
|
|
32756
|
-
await control.update(hostId2,
|
|
32819
|
+
await control.update(hostId2, target2);
|
|
32757
32820
|
await setConnected(true);
|
|
32758
32821
|
}
|
|
32759
32822
|
);
|
|
@@ -33423,15 +33486,15 @@ ${detail}` : ""}`
|
|
|
33423
33486
|
cwd.className = "settings-session-import-row__cwd";
|
|
33424
33487
|
cwd.textContent = candidate.cwd;
|
|
33425
33488
|
cwd.title = candidate.cwd;
|
|
33426
|
-
const
|
|
33427
|
-
|
|
33428
|
-
|
|
33429
|
-
|
|
33489
|
+
const identity3 = document2.createElement("span");
|
|
33490
|
+
identity3.textContent = `${messages.sessionImportSessionId}: ${shortSessionId(candidate.nativeSessionId)}`;
|
|
33491
|
+
identity3.title = candidate.nativeSessionId;
|
|
33492
|
+
identity3.setAttribute("aria-hidden", "true");
|
|
33430
33493
|
copy.append(
|
|
33431
33494
|
title,
|
|
33432
33495
|
metadata,
|
|
33433
33496
|
cwd,
|
|
33434
|
-
|
|
33497
|
+
identity3,
|
|
33435
33498
|
createAccessibleText(
|
|
33436
33499
|
document2,
|
|
33437
33500
|
`${messages.sessionImportSessionId}: ${candidate.nativeSessionId}`
|
|
@@ -34097,12 +34160,12 @@ ${detail}` : ""}`
|
|
|
34097
34160
|
let hideEmails = false;
|
|
34098
34161
|
const shown = (text) => accountDisplayText(text, hideEmails);
|
|
34099
34162
|
const targetButtons = /* @__PURE__ */ new Map();
|
|
34100
|
-
const importedRecords = () => snapshot.targets.find((
|
|
34163
|
+
const importedRecords = () => snapshot.targets.find((target2) => target2.harnessId === TARGET_HARNESS_ID)?.imports ?? [];
|
|
34101
34164
|
const sourceOf = (record14) => snapshot.sources.find((source) => source.id === record14.source.id);
|
|
34102
34165
|
const piTarget = () => snapshot.targets.find((candidate) => candidate.harnessId === TARGET_HARNESS_ID);
|
|
34103
34166
|
const compatibleSources = () => {
|
|
34104
|
-
const
|
|
34105
|
-
return
|
|
34167
|
+
const target2 = piTarget();
|
|
34168
|
+
return target2 ? snapshot.sources.filter((source) => target2.providers.includes(source.provider)) : [];
|
|
34106
34169
|
};
|
|
34107
34170
|
const section = document2.createElement("section");
|
|
34108
34171
|
section.className = "settings-pi-accounts";
|
|
@@ -34194,8 +34257,8 @@ ${detail}` : ""}`
|
|
|
34194
34257
|
row.setAttribute("aria-label", shown(record14.source.label));
|
|
34195
34258
|
const agent = record14.source.harnessId;
|
|
34196
34259
|
const mark = createMark(agent);
|
|
34197
|
-
const
|
|
34198
|
-
|
|
34260
|
+
const identity3 = document2.createElement("div");
|
|
34261
|
+
identity3.className = "settings-pi-accounts__identity";
|
|
34199
34262
|
const label = document2.createElement("strong");
|
|
34200
34263
|
label.className = "settings-account-email";
|
|
34201
34264
|
label.textContent = shown(record14.source.label);
|
|
@@ -34219,7 +34282,7 @@ ${detail}` : ""}`
|
|
|
34219
34282
|
}
|
|
34220
34283
|
meta3.append(part);
|
|
34221
34284
|
});
|
|
34222
|
-
|
|
34285
|
+
identity3.append(label, meta3);
|
|
34223
34286
|
const actions = document2.createElement("div");
|
|
34224
34287
|
actions.className = "settings-pi-accounts__actions";
|
|
34225
34288
|
const reimport = document2.createElement("button");
|
|
@@ -34241,7 +34304,7 @@ ${detail}` : ""}`
|
|
|
34241
34304
|
remove.addEventListener("click", () => openDialog("remove", { record: record14 }, `row:${record14.name}`));
|
|
34242
34305
|
if (source) actions.append(reimport);
|
|
34243
34306
|
actions.append(remove);
|
|
34244
|
-
row.append(mark,
|
|
34307
|
+
row.append(mark, identity3, actions);
|
|
34245
34308
|
rows.set(record14.name, row);
|
|
34246
34309
|
return row;
|
|
34247
34310
|
};
|
|
@@ -34255,8 +34318,8 @@ ${detail}` : ""}`
|
|
|
34255
34318
|
[shown(login.label ?? login.provider), agent && rendererAgentLabel(agent, pluginFor(agent))].filter(Boolean).join(" \xB7 ")
|
|
34256
34319
|
);
|
|
34257
34320
|
const mark = createMark(agent);
|
|
34258
|
-
const
|
|
34259
|
-
|
|
34321
|
+
const identity3 = document2.createElement("div");
|
|
34322
|
+
identity3.className = "settings-pi-accounts__identity";
|
|
34260
34323
|
const title = document2.createElement("strong");
|
|
34261
34324
|
title.className = "settings-account-email";
|
|
34262
34325
|
title.textContent = shown(login.label ?? login.provider);
|
|
@@ -34275,15 +34338,15 @@ ${detail}` : ""}`
|
|
|
34275
34338
|
}
|
|
34276
34339
|
meta3.append(part);
|
|
34277
34340
|
});
|
|
34278
|
-
|
|
34279
|
-
row.append(mark,
|
|
34341
|
+
identity3.append(title, meta3);
|
|
34342
|
+
row.append(mark, identity3);
|
|
34280
34343
|
return row;
|
|
34281
34344
|
};
|
|
34282
34345
|
const renderSection = () => {
|
|
34283
|
-
const
|
|
34284
|
-
section.hidden = !
|
|
34346
|
+
const target2 = piTarget();
|
|
34347
|
+
section.hidden = !target2;
|
|
34285
34348
|
const records = importedRecords();
|
|
34286
|
-
const others =
|
|
34349
|
+
const others = target2?.others ?? [];
|
|
34287
34350
|
sectionCount.textContent = String(records.length + others.length);
|
|
34288
34351
|
card.hidden = !sectionExpanded;
|
|
34289
34352
|
sectionImport.hidden = compatibleSources().length === 0;
|
|
@@ -34540,8 +34603,8 @@ ${detail}` : ""}`
|
|
|
34540
34603
|
modal.addEventListener("close", () => {
|
|
34541
34604
|
modal.remove();
|
|
34542
34605
|
dialog = void 0;
|
|
34543
|
-
const
|
|
34544
|
-
(
|
|
34606
|
+
const target2 = returnKey ? returnKey === SECTION_IMPORT_KEY ? sectionImport : targetButtons.get(returnKey) ?? rows.get(returnKey.replace(/^row:/, "")) : void 0;
|
|
34607
|
+
(target2?.isConnected ? target2 : section).focus();
|
|
34545
34608
|
});
|
|
34546
34609
|
show(initialMode);
|
|
34547
34610
|
root.append(modal);
|
|
@@ -34569,11 +34632,11 @@ ${detail}` : ""}`
|
|
|
34569
34632
|
const source = snapshot.sources.find(
|
|
34570
34633
|
(candidate) => candidate.harnessId === harnessId && candidate.label === accountLabel
|
|
34571
34634
|
);
|
|
34572
|
-
const
|
|
34635
|
+
const target2 = snapshot.targets.find(
|
|
34573
34636
|
(candidate) => candidate.harnessId === TARGET_HARNESS_ID && source && candidate.providers.includes(source.provider)
|
|
34574
34637
|
);
|
|
34575
|
-
if (!source || !
|
|
34576
|
-
const record14 =
|
|
34638
|
+
if (!source || !target2) return null;
|
|
34639
|
+
const record14 = target2.imports.find((candidate) => candidate.source.id === source.id);
|
|
34577
34640
|
const key = `${harnessId}:${accountLabel}:import`;
|
|
34578
34641
|
const button2 = document2.createElement("button");
|
|
34579
34642
|
button2.type = "button";
|
|
@@ -34975,11 +35038,11 @@ ${detail}` : ""}`
|
|
|
34975
35038
|
const key = active.getAttribute("data-account-focus");
|
|
34976
35039
|
const accountId = active.closest(".settings-account-row")?.dataset.accountId;
|
|
34977
35040
|
return () => {
|
|
34978
|
-
const
|
|
34979
|
-
if (
|
|
34980
|
-
const dialog =
|
|
35041
|
+
const target2 = key ? list.querySelector(`[data-account-focus="${CSS.escape(key)}"]`) : null;
|
|
35042
|
+
if (target2 && !target2.matches(":disabled")) {
|
|
35043
|
+
const dialog = target2.closest("dialog");
|
|
34981
35044
|
if (dialog && !dialog.open) dialog.showModal();
|
|
34982
|
-
|
|
35045
|
+
target2.focus({ preventScroll: true });
|
|
34983
35046
|
return;
|
|
34984
35047
|
}
|
|
34985
35048
|
const row = accountId ? list.querySelector(
|
|
@@ -35022,8 +35085,8 @@ ${detail}` : ""}`
|
|
|
35022
35085
|
function createAccountPerson(document2, messages, input) {
|
|
35023
35086
|
const person = document2.createElement("div");
|
|
35024
35087
|
person.className = "settings-account-row__person";
|
|
35025
|
-
const
|
|
35026
|
-
|
|
35088
|
+
const identity3 = document2.createElement("div");
|
|
35089
|
+
identity3.className = "settings-account-row__identity";
|
|
35027
35090
|
const title = document2.createElement("strong");
|
|
35028
35091
|
title.className = "settings-account-email";
|
|
35029
35092
|
title.textContent = input.name;
|
|
@@ -35055,9 +35118,9 @@ ${detail}` : ""}`
|
|
|
35055
35118
|
badge.title = messages.accountDefaultHint;
|
|
35056
35119
|
metadata.append(badge);
|
|
35057
35120
|
}
|
|
35058
|
-
|
|
35059
|
-
if (metadata.childElementCount)
|
|
35060
|
-
person.append(input.mark,
|
|
35121
|
+
identity3.append(title);
|
|
35122
|
+
if (metadata.childElementCount) identity3.append(metadata);
|
|
35123
|
+
person.append(input.mark, identity3);
|
|
35061
35124
|
return person;
|
|
35062
35125
|
}
|
|
35063
35126
|
function appendAccountExtras(cell, items) {
|
|
@@ -35756,14 +35819,14 @@ ${detail}` : ""}`
|
|
|
35756
35819
|
function isWindowsRenderer(window2) {
|
|
35757
35820
|
const navigator2 = window2?.navigator;
|
|
35758
35821
|
if (!navigator2) return false;
|
|
35759
|
-
const
|
|
35760
|
-
return /windows|win32|win64/iu.test(
|
|
35822
|
+
const identity3 = `${rendererUserAgentData(navigator2)?.platform ?? ""} ${navigator2.platform ?? ""} ${navigator2.userAgent}`;
|
|
35823
|
+
return /windows|win32|win64/iu.test(identity3);
|
|
35761
35824
|
}
|
|
35762
35825
|
function windowsInstallerDownloadUrl(window2, version2) {
|
|
35763
35826
|
const navigator2 = window2?.navigator;
|
|
35764
35827
|
const hints = navigator2 ? rendererUserAgentData(navigator2) : void 0;
|
|
35765
|
-
const
|
|
35766
|
-
const architecture = /arm64|aarch64|\barm\b/iu.test(
|
|
35828
|
+
const identity3 = `${hints?.architecture ?? ""} ${hints?.platform ?? ""} ${navigator2?.platform ?? ""} ${navigator2?.userAgent ?? ""}`;
|
|
35829
|
+
const architecture = /arm64|aarch64|\barm\b/iu.test(identity3) ? "arm64" : "x64";
|
|
35767
35830
|
return `https://github.com/BytePioneer-AI/codex-host/releases/download/v${version2}/codexhost-${version2}-windows-${architecture}.exe`;
|
|
35768
35831
|
}
|
|
35769
35832
|
function panelIconName(view) {
|
|
@@ -41432,11 +41495,11 @@ ${renderer_brand_mark_default}`;
|
|
|
41432
41495
|
ownerDocument.defaultView?.setTimeout(restoreFocus, 0);
|
|
41433
41496
|
};
|
|
41434
41497
|
const onNavigationClick = (event) => {
|
|
41435
|
-
const
|
|
41436
|
-
const pageId =
|
|
41498
|
+
const target2 = event.target instanceof Element ? event.target.closest("button[data-page-id]") : null;
|
|
41499
|
+
const pageId = target2?.dataset.pageId;
|
|
41437
41500
|
if (!pageId || pageId === navigationState.activePageId) return;
|
|
41438
41501
|
activatePage(pageId);
|
|
41439
|
-
|
|
41502
|
+
target2.focus();
|
|
41440
41503
|
};
|
|
41441
41504
|
const hide = (restoreFocus) => {
|
|
41442
41505
|
if (disposed || surface.hidden) return;
|
|
@@ -41727,7 +41790,7 @@ ${renderer_brand_mark_default}`;
|
|
|
41727
41790
|
}
|
|
41728
41791
|
return hook == null ? result : [];
|
|
41729
41792
|
}
|
|
41730
|
-
function
|
|
41793
|
+
function identity2(owner) {
|
|
41731
41794
|
const props = owner.memoizedProps;
|
|
41732
41795
|
if (!record11(props) || !record11(props.dataAttributes)) return null;
|
|
41733
41796
|
const { conversationId: threadId, hostId: hostId2, dataAttributes: attributes } = props;
|
|
@@ -41756,7 +41819,7 @@ ${renderer_brand_mark_default}`;
|
|
|
41756
41819
|
}
|
|
41757
41820
|
function repairSidebarThreadState(owner) {
|
|
41758
41821
|
if (!record11(owner)) return null;
|
|
41759
|
-
const key =
|
|
41822
|
+
const key = identity2(owner);
|
|
41760
41823
|
if (!key) return null;
|
|
41761
41824
|
const candidates = [];
|
|
41762
41825
|
try {
|
|
@@ -41776,12 +41839,12 @@ ${renderer_brand_mark_default}`;
|
|
|
41776
41839
|
const candidate = candidates[0];
|
|
41777
41840
|
if (candidates.length !== 1 || !candidate) return null;
|
|
41778
41841
|
const { atom, store, subscriber, instance, effect } = candidate;
|
|
41779
|
-
for (const [
|
|
41842
|
+
for (const [target2, name] of [
|
|
41780
41843
|
[store, "sub"],
|
|
41781
41844
|
[subscriber, "getSnapshot"],
|
|
41782
41845
|
[instance, "getSnapshot"]
|
|
41783
41846
|
]) {
|
|
41784
|
-
if (Object.getOwnPropertyDescriptor(
|
|
41847
|
+
if (Object.getOwnPropertyDescriptor(target2, name)?.writable !== true) return null;
|
|
41785
41848
|
}
|
|
41786
41849
|
const originalSub = store.sub;
|
|
41787
41850
|
let notify2;
|
|
@@ -41848,7 +41911,7 @@ ${renderer_brand_mark_default}`;
|
|
|
41848
41911
|
if (!fiber) break;
|
|
41849
41912
|
if (seen.has(fiber)) return /* @__PURE__ */ new Set();
|
|
41850
41913
|
seen.add(fiber);
|
|
41851
|
-
if (
|
|
41914
|
+
if (identity2(fiber)) owners.add(fiber);
|
|
41852
41915
|
if (fiber !== first && record11(fiber.sibling)) stack.push(fiber.sibling);
|
|
41853
41916
|
if (record11(fiber.child)) stack.push(fiber.child);
|
|
41854
41917
|
}
|
|
@@ -42042,13 +42105,13 @@ ${renderer_brand_mark_default}`;
|
|
|
42042
42105
|
function filterDelegationTargets(targets, query) {
|
|
42043
42106
|
const needle = query.trim().toLowerCase();
|
|
42044
42107
|
if (!needle) return [...targets];
|
|
42045
|
-
const scored = targets.flatMap((
|
|
42046
|
-
const label =
|
|
42047
|
-
const id =
|
|
42108
|
+
const scored = targets.flatMap((target2, index) => {
|
|
42109
|
+
const label = target2.label.toLowerCase();
|
|
42110
|
+
const id = target2.agent.toLowerCase();
|
|
42048
42111
|
const score = label.startsWith(needle) || id.startsWith(needle) ? 2 : label.includes(needle) || id.includes(needle) ? 1 : 0;
|
|
42049
|
-
return score > 0 ? [{ target, score, index }] : [];
|
|
42112
|
+
return score > 0 ? [{ target: target2, score, index }] : [];
|
|
42050
42113
|
});
|
|
42051
|
-
return scored.sort((left, right) => right.score - left.score || left.index - right.index).map(({ target }) =>
|
|
42114
|
+
return scored.sort((left, right) => right.score - left.score || left.index - right.index).map(({ target: target2 }) => target2);
|
|
42052
42115
|
}
|
|
42053
42116
|
function filterDelegationCommands(commands, query) {
|
|
42054
42117
|
const needle = query.trim().toLowerCase().replace(/^\//u, "");
|
|
@@ -42245,13 +42308,13 @@ ${renderer_brand_mark_default}`;
|
|
|
42245
42308
|
entries = [];
|
|
42246
42309
|
if (targets.length > 0) {
|
|
42247
42310
|
rows.push(sectionHeader(agentsTitle(locale)));
|
|
42248
|
-
for (const
|
|
42311
|
+
for (const target2 of targets) {
|
|
42249
42312
|
rows.push(
|
|
42250
42313
|
optionRow(
|
|
42251
|
-
{ kind: "agent", target },
|
|
42314
|
+
{ kind: "agent", target: target2 },
|
|
42252
42315
|
rowContent(
|
|
42253
|
-
createRendererAgentIcon(
|
|
42254
|
-
|
|
42316
|
+
createRendererAgentIcon(target2.agent, 16, ownerDocument, target2.plugin),
|
|
42317
|
+
target2.label,
|
|
42255
42318
|
""
|
|
42256
42319
|
)
|
|
42257
42320
|
)
|
|
@@ -42364,17 +42427,17 @@ ${renderer_brand_mark_default}`;
|
|
|
42364
42427
|
await waitForSelectionSync();
|
|
42365
42428
|
return true;
|
|
42366
42429
|
};
|
|
42367
|
-
const insertAgent = async (trigger, range,
|
|
42368
|
-
const path = delegationMentionPath(
|
|
42430
|
+
const insertAgent = async (trigger, range, target2) => {
|
|
42431
|
+
const path = delegationMentionPath(target2.agent);
|
|
42369
42432
|
if (insertNativeAgentMention(trigger.editor, range, {
|
|
42370
|
-
name:
|
|
42371
|
-
displayName:
|
|
42433
|
+
name: target2.label,
|
|
42434
|
+
displayName: target2.label,
|
|
42372
42435
|
path
|
|
42373
42436
|
})) {
|
|
42374
42437
|
return;
|
|
42375
42438
|
}
|
|
42376
42439
|
if (!await selectTriggerText(trigger)) return;
|
|
42377
|
-
const carrier = `${formatDelegationMentionLink({ harnessId:
|
|
42440
|
+
const carrier = `${formatDelegationMentionLink({ harnessId: target2.agent, label: target2.label })} `;
|
|
42378
42441
|
const pasted = dispatchPlainTextPaste(trigger.editor, carrier);
|
|
42379
42442
|
if (!pasted) ownerDocument.execCommand("insertText", false, carrier);
|
|
42380
42443
|
};
|
|
@@ -43565,42 +43628,42 @@ ${renderer_brand_mark_default}`;
|
|
|
43565
43628
|
if (!isLateConversationTarget(mountedTarget, currentTarget)) return "none";
|
|
43566
43629
|
return mountedTarget?.[0] === "default" && (sourcePhase === "locked" || submissionPending) ? "transfer" : "inspect";
|
|
43567
43630
|
}
|
|
43568
|
-
function scopedComposerTarget(
|
|
43569
|
-
if (
|
|
43570
|
-
return ["conversation",
|
|
43631
|
+
function scopedComposerTarget(target2, hostId2) {
|
|
43632
|
+
if (target2?.[0] !== "conversation" || !hostId2) return target2;
|
|
43633
|
+
return ["conversation", target2[1], hostId2];
|
|
43571
43634
|
}
|
|
43572
|
-
function isComposerModelWriteAllowed(
|
|
43573
|
-
return
|
|
43635
|
+
function isComposerModelWriteAllowed(target2) {
|
|
43636
|
+
return target2?.[0] === "default";
|
|
43574
43637
|
}
|
|
43575
|
-
function applyComposerModelWrite(
|
|
43576
|
-
if (
|
|
43577
|
-
if (!isComposerModelWriteAllowed(
|
|
43638
|
+
function applyComposerModelWrite(target2, write) {
|
|
43639
|
+
if (target2?.[0] === "conversation") return true;
|
|
43640
|
+
if (!isComposerModelWriteAllowed(target2)) return false;
|
|
43578
43641
|
return write();
|
|
43579
43642
|
}
|
|
43580
43643
|
function mutationMayAffectComposer(mutation) {
|
|
43581
|
-
const
|
|
43582
|
-
if (!
|
|
43644
|
+
const target2 = mutation.target instanceof Element ? mutation.target : mutation.target.parentElement;
|
|
43645
|
+
if (!target2) return true;
|
|
43583
43646
|
if (mutation.type === "attributes" && (mutation.attributeName === "data-codex-composer-root" || NATIVE_COMPOSER_REQUEST_ATTRIBUTES.some((attribute) => attribute === mutation.attributeName)))
|
|
43584
43647
|
return true;
|
|
43585
|
-
if (mutation.type !== "attributes" && editorForElement(
|
|
43648
|
+
if (mutation.type !== "attributes" && editorForElement(target2)) {
|
|
43586
43649
|
return mutation.type === "childList" && [...mutation.addedNodes, ...mutation.removedNodes].some(
|
|
43587
43650
|
(node) => node instanceof Element && hasNativeComposerRequest(node)
|
|
43588
43651
|
);
|
|
43589
43652
|
}
|
|
43590
|
-
if (
|
|
43653
|
+
if (target2.closest(CODEX_COMPOSER_SELECTOR)) return true;
|
|
43591
43654
|
if (mutation.type === "characterData") return false;
|
|
43592
|
-
if (!
|
|
43655
|
+
if (!target2.closest(
|
|
43593
43656
|
`${TRANSCRIPT_ITEM_SELECTOR}, [data-turn-key], [data-content-search-turn-key], [data-app-action-sidebar-scroll], [data-app-action-sidebar-section], ${SIDEBAR_THREAD_ROW_SELECTOR}`
|
|
43594
43657
|
))
|
|
43595
43658
|
return true;
|
|
43596
|
-
if (mutation.type === "attributes") return
|
|
43659
|
+
if (mutation.type === "attributes") return target2.querySelector(CODEX_COMPOSER_SELECTOR) !== null;
|
|
43597
43660
|
return mutation.type === "childList" && [...mutation.addedNodes, ...mutation.removedNodes].some(
|
|
43598
43661
|
(node) => node instanceof Element && (node.matches(CODEX_COMPOSER_SELECTOR) || node.querySelector(CODEX_COMPOSER_SELECTOR))
|
|
43599
43662
|
);
|
|
43600
43663
|
}
|
|
43601
43664
|
function mutationMayChangeComposerTarget(mutation) {
|
|
43602
|
-
const
|
|
43603
|
-
return !
|
|
43665
|
+
const target2 = mutation.target instanceof Element ? mutation.target : mutation.target.parentElement;
|
|
43666
|
+
return !target2 || editorForElement(target2) === null;
|
|
43604
43667
|
}
|
|
43605
43668
|
function catalogWithConfigurationState(catalog, model2, state) {
|
|
43606
43669
|
if (!state.availableThinkingOptions) return catalog;
|
|
@@ -43648,7 +43711,7 @@ ${renderer_brand_mark_default}`;
|
|
|
43648
43711
|
const hostId2 = modelControl.currentHostId ? modelControl.currentHostId(composer) : "local";
|
|
43649
43712
|
return hostId2 === "durable" ? null : hostId2;
|
|
43650
43713
|
};
|
|
43651
|
-
const controllerTarget = (
|
|
43714
|
+
const controllerTarget = (target2, hostId2) => scopedComposerTarget(target2, hostId2);
|
|
43652
43715
|
const usageSubscriptions = /* @__PURE__ */ new Map();
|
|
43653
43716
|
const usageNotificationDispose = () => {
|
|
43654
43717
|
for (const subscription2 of usageSubscriptions.values()) subscription2.dispose();
|
|
@@ -43656,9 +43719,9 @@ ${renderer_brand_mark_default}`;
|
|
|
43656
43719
|
};
|
|
43657
43720
|
const localAgentForSidebarThread = (input) => {
|
|
43658
43721
|
for (const mounted of mountedByComposer.values()) {
|
|
43659
|
-
const
|
|
43660
|
-
const matchesDraft =
|
|
43661
|
-
const matchesConversation =
|
|
43722
|
+
const target2 = mounted.modelTarget;
|
|
43723
|
+
const matchesDraft = target2?.[0] === "default" && input.draftId !== null && target2[1] === input.draftId;
|
|
43724
|
+
const matchesConversation = target2?.[0] === "conversation" && input.threadId !== null && target2[1] === input.threadId && mounted.ownershipStatus === "ready";
|
|
43662
43725
|
if (!matchesDraft && !matchesConversation) continue;
|
|
43663
43726
|
const mountedHostId = activeModelHostId(mounted.composer);
|
|
43664
43727
|
if (input.hostId !== mountedHostId) return null;
|
|
@@ -45114,8 +45177,8 @@ ${renderer_brand_mark_default}`;
|
|
|
45114
45177
|
else void refreshDraftUsage(mounted);
|
|
45115
45178
|
continue;
|
|
45116
45179
|
}
|
|
45117
|
-
const
|
|
45118
|
-
if (controller.rebindConversation(mounted.composer,
|
|
45180
|
+
const target2 = controllerTarget(mounted.modelTarget, hostId2);
|
|
45181
|
+
if (controller.rebindConversation(mounted.composer, target2) === null) {
|
|
45119
45182
|
mounted.ownershipStatus = "error";
|
|
45120
45183
|
renderMounted(mounted);
|
|
45121
45184
|
continue;
|
|
@@ -45155,22 +45218,22 @@ ${renderer_brand_mark_default}`;
|
|
|
45155
45218
|
}
|
|
45156
45219
|
}
|
|
45157
45220
|
let connectionsChanged = false;
|
|
45158
|
-
for (const
|
|
45159
|
-
if (!
|
|
45160
|
-
const client = modelClientForHost(
|
|
45161
|
-
const previous = usageSubscriptions.get(
|
|
45221
|
+
for (const target2 of new Set([...mountedByComposer.values()].map((m) => m.hostId))) {
|
|
45222
|
+
if (!target2) continue;
|
|
45223
|
+
const client = modelClientForHost(target2);
|
|
45224
|
+
const previous = usageSubscriptions.get(target2);
|
|
45162
45225
|
if (previous?.client === client) continue;
|
|
45163
45226
|
connectionsChanged ||= previous !== void 0;
|
|
45164
45227
|
previous?.dispose();
|
|
45165
|
-
usageSubscriptions.delete(
|
|
45228
|
+
usageSubscriptions.delete(target2);
|
|
45166
45229
|
if (!client?.subscribeThreadUsage) continue;
|
|
45167
45230
|
try {
|
|
45168
45231
|
const dispose = client.subscribeThreadUsage((update) => {
|
|
45169
|
-
if (usageSubscriptions.get(
|
|
45170
|
-
if (modelClientForHost(
|
|
45171
|
-
applyThreadUsageUpdate(
|
|
45232
|
+
if (usageSubscriptions.get(target2)?.client !== client) return;
|
|
45233
|
+
if (modelClientForHost(target2) !== client) return;
|
|
45234
|
+
applyThreadUsageUpdate(target2, update);
|
|
45172
45235
|
});
|
|
45173
|
-
usageSubscriptions.set(
|
|
45236
|
+
usageSubscriptions.set(target2, { client, dispose });
|
|
45174
45237
|
connectionsChanged = true;
|
|
45175
45238
|
} catch {
|
|
45176
45239
|
}
|
|
@@ -45225,14 +45288,14 @@ ${renderer_brand_mark_default}`;
|
|
|
45225
45288
|
if (hostId2 === "durable") return Promise.resolve();
|
|
45226
45289
|
return refreshConnectionHosts(
|
|
45227
45290
|
[hostId2],
|
|
45228
|
-
(
|
|
45229
|
-
(
|
|
45291
|
+
(target2) => refreshHarnessAvailabilityForHost(target2, true, false, true),
|
|
45292
|
+
(target2) => hostHarnessAvailabilityState(target2).request?.promise
|
|
45230
45293
|
);
|
|
45231
45294
|
}
|
|
45232
45295
|
reconcileHarnessAvailabilityHost();
|
|
45233
45296
|
return refreshConnectionHosts(
|
|
45234
|
-
[...harnessAvailabilityByHost.keys()].filter((
|
|
45235
|
-
(
|
|
45297
|
+
[...harnessAvailabilityByHost.keys()].filter((target2) => target2 !== "durable"),
|
|
45298
|
+
(target2) => refreshHarnessAvailabilityForHost(target2, true, false, true)
|
|
45236
45299
|
);
|
|
45237
45300
|
},
|
|
45238
45301
|
async installation(hostId2, agent, action) {
|
|
@@ -45403,21 +45466,21 @@ ${renderer_brand_mark_default}`;
|
|
|
45403
45466
|
if (disposed) return;
|
|
45404
45467
|
settingsLifecycle.refresh();
|
|
45405
45468
|
const transferredComposers = /* @__PURE__ */ new Set();
|
|
45406
|
-
for (const [
|
|
45469
|
+
for (const [target2, replacement] of pendingReplacements) {
|
|
45407
45470
|
const sourceState = controller.get(replacement.source.composer);
|
|
45408
|
-
const replacementTarget = findComposerModelTarget(
|
|
45409
|
-
const replacementHostId = activeModelHostId(
|
|
45410
|
-
if (hasNativeComposerRequest(
|
|
45471
|
+
const replacementTarget = findComposerModelTarget(target2);
|
|
45472
|
+
const replacementHostId = activeModelHostId(target2);
|
|
45473
|
+
if (hasNativeComposerRequest(target2) || orbitComposerKind(target2) !== "codex" || !shouldTransferComposerState(
|
|
45411
45474
|
replacement.sourceModelTarget,
|
|
45412
45475
|
replacementTarget,
|
|
45413
45476
|
sourceState.phase,
|
|
45414
45477
|
controller.isSubmissionPending(replacement.source.composer)
|
|
45415
45478
|
) || !controller.transfer(
|
|
45416
45479
|
replacement.source.composer,
|
|
45417
|
-
|
|
45480
|
+
target2,
|
|
45418
45481
|
controllerTarget(replacementTarget, replacementHostId)
|
|
45419
45482
|
)) {
|
|
45420
|
-
pendingReplacements.delete(
|
|
45483
|
+
pendingReplacements.delete(target2);
|
|
45421
45484
|
} else {
|
|
45422
45485
|
transferredComposers.add(replacement.source.composer);
|
|
45423
45486
|
}
|
|
@@ -45511,10 +45574,10 @@ ${renderer_brand_mark_default}`;
|
|
|
45511
45574
|
for (const replacement of replacements.values()) {
|
|
45512
45575
|
if (replacement.removed.size !== 1 || replacement.added.size !== 1) continue;
|
|
45513
45576
|
const source = replacement.removed.values().next().value;
|
|
45514
|
-
const
|
|
45577
|
+
const target2 = replacement.added.values().next().value;
|
|
45515
45578
|
const mounted = mountedByComposer.get(source);
|
|
45516
|
-
if (source !==
|
|
45517
|
-
pendingReplacements.set(
|
|
45579
|
+
if (source !== target2 && mounted) {
|
|
45580
|
+
pendingReplacements.set(target2, {
|
|
45518
45581
|
source: mounted,
|
|
45519
45582
|
sourceModelTarget: mounted.modelTarget
|
|
45520
45583
|
});
|
|
@@ -45552,8 +45615,8 @@ ${renderer_brand_mark_default}`;
|
|
|
45552
45615
|
renderMounted(mounted);
|
|
45553
45616
|
return true;
|
|
45554
45617
|
};
|
|
45555
|
-
const composerForTarget = (
|
|
45556
|
-
const element = eventElement(
|
|
45618
|
+
const composerForTarget = (target2) => {
|
|
45619
|
+
const element = eventElement(target2);
|
|
45557
45620
|
const editor = element ? editorForElement(element) : null;
|
|
45558
45621
|
const composer = editor ? composerForEditor(editor) : null;
|
|
45559
45622
|
return composer && isMountedComposer(composer) ? composer : null;
|
|
@@ -45997,7 +46060,7 @@ ${renderer_brand_mark_default}`;
|
|
|
45997
46060
|
|
|
45998
46061
|
// src/renderer-rpc-steering.ts
|
|
45999
46062
|
var record13 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
46000
|
-
var invoke = (
|
|
46063
|
+
var invoke = (target2, name, ...args) => Reflect.apply(Reflect.get(target2, name), target2, args);
|
|
46001
46064
|
var running = (state) => record13(state) && (state.inProgress === true || !!state.activeTurnId);
|
|
46002
46065
|
var context = (previous, marker) => ({
|
|
46003
46066
|
...record13(previous) ? previous : {},
|
|
@@ -46032,7 +46095,7 @@ ${renderer_brand_mark_default}`;
|
|
|
46032
46095
|
current();
|
|
46033
46096
|
return delivery;
|
|
46034
46097
|
};
|
|
46035
|
-
const
|
|
46098
|
+
const target2 = async (threadId, messageId, delivery) => {
|
|
46036
46099
|
const state = await invoke(rpc, "getThreadExecutionState", threadId);
|
|
46037
46100
|
current();
|
|
46038
46101
|
if (!record13(state) || typeof state.activeTurnId !== "string" || !state.activeTurnId || typeof messageId !== "string" || !messageId)
|
|
@@ -46114,7 +46177,7 @@ ${renderer_brand_mark_default}`;
|
|
|
46114
46177
|
const restore = prepared.steer.restoreMessage;
|
|
46115
46178
|
messageId = record13(restore) && typeof restore.id === "string" ? restore.id : void 0;
|
|
46116
46179
|
const clientId = prepared.steer.clientUserMessageId ?? messageId;
|
|
46117
|
-
marker = await
|
|
46180
|
+
marker = await target2(threadId, clientId, delivery);
|
|
46118
46181
|
if (delivery === "activeTurn") return apply(prepared);
|
|
46119
46182
|
if (!messageId) throw new Error("Native queued message identity is unavailable");
|
|
46120
46183
|
finish = await prepareRpcSteeringQueue(
|