@codexhost/cli-darwin-x64 0.18.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +83 -5
- package/app/console-web.js +1172 -687
- package/app/desktop-controller.mjs +314 -15
- package/app/host-runtime.mjs +13158 -2853
- package/app/plugins/antigravity/plugin.mjs +8861 -3944
- package/app/plugins/claude-code/plugin.mjs +164 -14
- package/app/plugins/codebuddy/plugin.mjs +193 -25
- package/app/plugins/codex-usage/plugin.mjs +85 -5
- package/app/plugins/copilot/plugin.mjs +85 -5
- package/app/plugins/cursor-cli/plugin.mjs +160 -15
- package/app/plugins/deepseek-harness/manifest.json +2 -2
- package/app/plugins/deepseek-harness/plugin.mjs +112 -10
- package/app/plugins/devin/plugin.mjs +84 -5
- package/app/plugins/grok/plugin.mjs +418 -272
- package/app/plugins/hermes/plugin.mjs +163 -17
- package/app/plugins/kimi-code/plugin.mjs +85 -5
- package/app/plugins/kiro-cli/plugin.mjs +313 -21
- package/app/plugins/omp/plugin.mjs +1018 -819
- package/app/plugins/opencode/plugin.mjs +85 -5
- package/app/plugins/pi/plugin.mjs +828 -663
- package/app/plugins/qoder/plugin.mjs +109 -10
- package/app/plugins/qoder-cn/plugin.mjs +109 -10
- package/app/plugins/qwen-code/plugin.mjs +194 -97
- package/app/plugins/workbuddy/plugin.mjs +197 -28
- package/app/plugins/zcode/plugin.mjs +158 -8
- package/app/renderer-extension.js +2065 -1004
- package/app/web/assets/index-D6-hvggd.css +1 -0
- package/app/web/assets/index-D85gPBbQ.js +201 -0
- package/app/web/assets/langs/{graphql-B8vkg11W.js → graphql-ChAeyPkT.js} +1 -1
- package/app/web/assets/langs/{http-DmoDEjMt.js → http-BvreBIbD.js} +1 -1
- package/app/web/assets/langs/{php-DJ5ovfAM.js → php-D8omCIuJ.js} +1 -1
- package/app/web/assets/langs/{rst-U5-R5x3p.js → rst-Do7RLLCS.js} +1 -1
- package/app/web/assets/langs/{ruby-VKVsnS0H.js → ruby-rH_O_vse.js} +1 -1
- package/app/web/assets/langs/{svelte-C20lOv9V.js → svelte-xZy73wAj.js} +1 -1
- package/app/web/assets/langs/{vue-z6Y-lzP-.js → vue-C4DW8agZ.js} +1 -1
- package/app/web/assets/{vendor-dSL872WO.js → vendor-C9g2bw8s.js} +3 -3
- package/app/web/codexhost-settings.js +1178 -689
- package/app/web/index.html +4 -3
- package/app/web/plugins/deepseek-ai__dsh-api-gateway/client.js +2 -2
- 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 +8 -8
- package/app/web/plugins/deepseek-ai__dsh-client-connection/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-file-upload/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-locale/client.js +3 -3
- package/app/web/plugins/deepseek-ai__dsh-client-ui-attachment/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +134 -8
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +65 -63
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +95 -93
- package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-session/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.excel.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-files/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
- package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +11 -11
- package/app/web-modules/server.mjs +2468 -1575
- 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-C0aXz2jD.js +0 -199
- package/app/web/assets/index-C3lniEH1.css +0 -1
|
@@ -6,237 +6,6 @@
|
|
|
6
6
|
__defProp(target2, name, { get: all[name], enumerable: true });
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
// src/agent-selection-state.ts
|
|
10
|
-
var DEFAULT_RENDERER_AGENTS = ["codex"];
|
|
11
|
-
function defaultIdFactory(sequence) {
|
|
12
|
-
return `codexhost-composer-${Date.now().toString(36)}-${sequence.toString(36)}`;
|
|
13
|
-
}
|
|
14
|
-
function isDefaultTarget(target2) {
|
|
15
|
-
return target2?.[0] === "default";
|
|
16
|
-
}
|
|
17
|
-
function isConversationTarget(target2) {
|
|
18
|
-
return target2?.[0] === "conversation";
|
|
19
|
-
}
|
|
20
|
-
function isIdentifiedTarget(target2) {
|
|
21
|
-
return target2?.[0] === "conversation" || target2?.[0] === "default" && typeof target2[1] === "string" && target2[1].startsWith("client-new-thread:");
|
|
22
|
-
}
|
|
23
|
-
function sameTarget(left, right) {
|
|
24
|
-
return left.length === right.length && left.every((value, index) => value === right[index]);
|
|
25
|
-
}
|
|
26
|
-
var DraftAgentController = class {
|
|
27
|
-
#idFactory;
|
|
28
|
-
#defaultAgent;
|
|
29
|
-
#enabledAgents;
|
|
30
|
-
#targetStates = [];
|
|
31
|
-
#modelRequestGenerations = /* @__PURE__ */ new WeakMap();
|
|
32
|
-
#ownershipRequestGenerations = /* @__PURE__ */ new WeakMap();
|
|
33
|
-
#states = /* @__PURE__ */ new WeakMap();
|
|
34
|
-
#switching = /* @__PURE__ */ new Set();
|
|
35
|
-
#pendingSubmissions = /* @__PURE__ */ new Set();
|
|
36
|
-
#composerSequence = 0;
|
|
37
|
-
#modelRequestSequence = 0;
|
|
38
|
-
#ownershipRequestSequence = 0;
|
|
39
|
-
#lastSubmittedAgent;
|
|
40
|
-
constructor(options = {}) {
|
|
41
|
-
this.#idFactory = options.idFactory ?? defaultIdFactory;
|
|
42
|
-
this.#enabledAgents = new Set(options.enabledAgents ?? DEFAULT_RENDERER_AGENTS);
|
|
43
|
-
if (!this.#enabledAgents.has("codex"))
|
|
44
|
-
throw new Error("Renderer enabled Agents must include Codex");
|
|
45
|
-
this.#defaultAgent = options.defaultAgent ?? "codex";
|
|
46
|
-
this.#lastSubmittedAgent = this.#defaultAgent;
|
|
47
|
-
}
|
|
48
|
-
setEnabledAgents(agents) {
|
|
49
|
-
this.#enabledAgents = /* @__PURE__ */ new Set(["codex", ...agents]);
|
|
50
|
-
}
|
|
51
|
-
get(composer) {
|
|
52
|
-
return this.#state(composer);
|
|
53
|
-
}
|
|
54
|
-
detach(composer, preservePendingSubmission = false) {
|
|
55
|
-
const state = this.#states.get(composer);
|
|
56
|
-
if (state && !preservePendingSubmission) this.#pendingSubmissions.delete(state);
|
|
57
|
-
this.#states.delete(composer);
|
|
58
|
-
}
|
|
59
|
-
mount(composer, target2, preferredNewThreadAgent) {
|
|
60
|
-
const bound = this.#targetState(target2);
|
|
61
|
-
if (bound) {
|
|
62
|
-
this.#states.set(composer, bound);
|
|
63
|
-
return bound;
|
|
64
|
-
}
|
|
65
|
-
const preferredAgent = preferredNewThreadAgent ?? this.#lastSubmittedAgent;
|
|
66
|
-
const state = this.#state(composer, isDefaultTarget(target2) ? preferredAgent : "codex");
|
|
67
|
-
if (isIdentifiedTarget(target2)) this.#targetStates.push({ target: target2, state });
|
|
68
|
-
return state;
|
|
69
|
-
}
|
|
70
|
-
isSwitching(composer) {
|
|
71
|
-
return this.#switching.has(this.#state(composer));
|
|
72
|
-
}
|
|
73
|
-
beginModelRequest(composer) {
|
|
74
|
-
const state = this.#state(composer);
|
|
75
|
-
const generation = ++this.#modelRequestSequence;
|
|
76
|
-
this.#modelRequestGenerations.set(state, generation);
|
|
77
|
-
return generation;
|
|
78
|
-
}
|
|
79
|
-
invalidateModelRequests(composer) {
|
|
80
|
-
this.beginModelRequest(composer);
|
|
81
|
-
}
|
|
82
|
-
isCurrentModelRequest(composer, generation) {
|
|
83
|
-
return (this.#modelRequestGenerations.get(this.#state(composer)) ?? 0) === generation;
|
|
84
|
-
}
|
|
85
|
-
beginOwnershipRequest(composer) {
|
|
86
|
-
const generation = ++this.#ownershipRequestSequence;
|
|
87
|
-
this.#ownershipRequestGenerations.set(this.#state(composer), generation);
|
|
88
|
-
return generation;
|
|
89
|
-
}
|
|
90
|
-
isCurrentOwnershipRequest(composer, generation) {
|
|
91
|
-
return (this.#ownershipRequestGenerations.get(this.#state(composer)) ?? 0) === generation;
|
|
92
|
-
}
|
|
93
|
-
rebindConversation(composer, target2) {
|
|
94
|
-
if (!isConversationTarget(target2)) return null;
|
|
95
|
-
const previous = this.#state(composer);
|
|
96
|
-
this.#pendingSubmissions.delete(previous);
|
|
97
|
-
this.#modelRequestGenerations.set(previous, ++this.#modelRequestSequence);
|
|
98
|
-
this.#ownershipRequestGenerations.set(previous, ++this.#ownershipRequestSequence);
|
|
99
|
-
let state = this.#targetState(target2);
|
|
100
|
-
if (!state) {
|
|
101
|
-
state = {
|
|
102
|
-
agent: "codex",
|
|
103
|
-
phase: "draft",
|
|
104
|
-
composerId: this.#idFactory(++this.#composerSequence)
|
|
105
|
-
};
|
|
106
|
-
this.#targetStates.push({ target: target2, state });
|
|
107
|
-
}
|
|
108
|
-
this.#states.set(composer, state);
|
|
109
|
-
this.#modelRequestGenerations.set(state, ++this.#modelRequestSequence);
|
|
110
|
-
this.#ownershipRequestGenerations.set(state, ++this.#ownershipRequestSequence);
|
|
111
|
-
return state;
|
|
112
|
-
}
|
|
113
|
-
restore(composer, agent, model2, thinkingOptionId, permissionModeId) {
|
|
114
|
-
const state = this.#state(composer);
|
|
115
|
-
this.#pendingSubmissions.delete(state);
|
|
116
|
-
state.agent = agent;
|
|
117
|
-
state.phase = "locked";
|
|
118
|
-
if (agent !== "codex") {
|
|
119
|
-
state.configurationByAgent = {
|
|
120
|
-
...state.configurationByAgent,
|
|
121
|
-
[agent]: {
|
|
122
|
-
...model2 ? { model: model2 } : {},
|
|
123
|
-
...thinkingOptionId ? { thinkingOptionId } : {},
|
|
124
|
-
...permissionModeId ? { permissionModeId } : {}
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
return state;
|
|
129
|
-
}
|
|
130
|
-
clearConfiguration(composer) {
|
|
131
|
-
delete this.#state(composer).configurationByAgent;
|
|
132
|
-
}
|
|
133
|
-
modelForAgent(composer, agent) {
|
|
134
|
-
return this.#state(composer).configurationByAgent?.[agent]?.model;
|
|
135
|
-
}
|
|
136
|
-
thinkingOptionForAgent(composer, agent) {
|
|
137
|
-
return this.#state(composer).configurationByAgent?.[agent]?.thinkingOptionId;
|
|
138
|
-
}
|
|
139
|
-
permissionModeForAgent(composer, agent) {
|
|
140
|
-
return this.#state(composer).configurationByAgent?.[agent]?.permissionModeId;
|
|
141
|
-
}
|
|
142
|
-
setExternalPermissionMode(composer, agent, permissionModeId) {
|
|
143
|
-
return this.#configure(composer, agent, { permissionModeId });
|
|
144
|
-
}
|
|
145
|
-
setExternalModel(composer, agent, model2) {
|
|
146
|
-
return this.#configure(composer, agent, { model: model2 });
|
|
147
|
-
}
|
|
148
|
-
setExternalThinkingOption(composer, agent, thinkingOptionId) {
|
|
149
|
-
const state = this.#configure(composer, agent, {});
|
|
150
|
-
const configuration = state.configurationByAgent?.[agent];
|
|
151
|
-
if (!configuration) return state;
|
|
152
|
-
if (thinkingOptionId) configuration.thinkingOptionId = thinkingOptionId;
|
|
153
|
-
else delete configuration.thinkingOptionId;
|
|
154
|
-
return state;
|
|
155
|
-
}
|
|
156
|
-
#configure(composer, agent, patch) {
|
|
157
|
-
const state = this.#state(composer);
|
|
158
|
-
state.configurationByAgent = {
|
|
159
|
-
...state.configurationByAgent,
|
|
160
|
-
[agent]: { ...state.configurationByAgent?.[agent], ...patch }
|
|
161
|
-
};
|
|
162
|
-
return state;
|
|
163
|
-
}
|
|
164
|
-
lock(composer) {
|
|
165
|
-
const state = this.#state(composer);
|
|
166
|
-
this.#pendingSubmissions.delete(state);
|
|
167
|
-
state.phase = "locked";
|
|
168
|
-
return state;
|
|
169
|
-
}
|
|
170
|
-
markSubmissionPending(composer) {
|
|
171
|
-
const state = this.#state(composer);
|
|
172
|
-
if (state.phase === "draft") this.#pendingSubmissions.add(state);
|
|
173
|
-
return state;
|
|
174
|
-
}
|
|
175
|
-
isSubmissionPending(composer) {
|
|
176
|
-
return this.#pendingSubmissions.has(this.#state(composer));
|
|
177
|
-
}
|
|
178
|
-
clearPendingSubmission(composer) {
|
|
179
|
-
this.#pendingSubmissions.delete(this.#state(composer));
|
|
180
|
-
}
|
|
181
|
-
/** Only a draft's submission creates a Thread, so only it sets the next new-Thread Agent. */
|
|
182
|
-
recordSubmission(composer) {
|
|
183
|
-
const state = this.#state(composer);
|
|
184
|
-
if (state.phase === "draft") this.#lastSubmittedAgent = state.agent;
|
|
185
|
-
return state;
|
|
186
|
-
}
|
|
187
|
-
transfer(source, replacement, target2 = null) {
|
|
188
|
-
const state = this.#states.get(source);
|
|
189
|
-
if (!state) return false;
|
|
190
|
-
const bound = this.#targetState(target2);
|
|
191
|
-
if (bound && bound !== state) return false;
|
|
192
|
-
if (source !== replacement) {
|
|
193
|
-
if (this.#states.has(replacement)) return false;
|
|
194
|
-
this.#states.set(replacement, state);
|
|
195
|
-
}
|
|
196
|
-
if (isIdentifiedTarget(target2) && !bound) this.#targetStates.push({ target: target2, state });
|
|
197
|
-
if (isConversationTarget(target2) && this.#pendingSubmissions.delete(state))
|
|
198
|
-
state.phase = "locked";
|
|
199
|
-
return true;
|
|
200
|
-
}
|
|
201
|
-
async switchAgent(composer, nextAgent, operations) {
|
|
202
|
-
const state = this.#state(composer);
|
|
203
|
-
if (!this.#enabledAgents.has(nextAgent)) return false;
|
|
204
|
-
if (state.phase !== "draft" || this.#switching.has(state)) return false;
|
|
205
|
-
if (state.agent === nextAgent) return true;
|
|
206
|
-
this.#pendingSubmissions.delete(state);
|
|
207
|
-
this.#switching.add(state);
|
|
208
|
-
try {
|
|
209
|
-
if (!operations.applyAgent(nextAgent)) return false;
|
|
210
|
-
try {
|
|
211
|
-
await operations.clearPrewarm();
|
|
212
|
-
} catch (error51) {
|
|
213
|
-
if (!operations.applyAgent(state.agent))
|
|
214
|
-
throw new Error("Draft Agent switch could not restore the prior Agent", { cause: error51 });
|
|
215
|
-
return false;
|
|
216
|
-
}
|
|
217
|
-
state.agent = nextAgent;
|
|
218
|
-
return true;
|
|
219
|
-
} finally {
|
|
220
|
-
this.#switching.delete(state);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
#targetState(target2) {
|
|
224
|
-
if (!isIdentifiedTarget(target2)) return null;
|
|
225
|
-
return this.#targetStates.find((candidate) => sameTarget(candidate.target, target2))?.state ?? null;
|
|
226
|
-
}
|
|
227
|
-
#state(composer, initialAgent) {
|
|
228
|
-
const existing = this.#states.get(composer);
|
|
229
|
-
if (existing) return existing;
|
|
230
|
-
const created = {
|
|
231
|
-
agent: initialAgent ?? this.#defaultAgent,
|
|
232
|
-
phase: "draft",
|
|
233
|
-
composerId: this.#idFactory(++this.#composerSequence)
|
|
234
|
-
};
|
|
235
|
-
this.#states.set(composer, created);
|
|
236
|
-
return created;
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
|
-
|
|
240
9
|
// ../../node_modules/zod/v4/classic/external.js
|
|
241
10
|
var external_exports = {};
|
|
242
11
|
__export(external_exports, {
|
|
@@ -14751,6 +14520,240 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14751
14520
|
// ../../node_modules/zod/v4/classic/external.js
|
|
14752
14521
|
config(en_default());
|
|
14753
14522
|
|
|
14523
|
+
// src/renderer-schema-config.ts
|
|
14524
|
+
external_exports.config({ jitless: true });
|
|
14525
|
+
|
|
14526
|
+
// src/agent-selection-state.ts
|
|
14527
|
+
var DEFAULT_RENDERER_AGENTS = ["codex"];
|
|
14528
|
+
function defaultIdFactory(sequence) {
|
|
14529
|
+
return `codexhost-composer-${Date.now().toString(36)}-${sequence.toString(36)}`;
|
|
14530
|
+
}
|
|
14531
|
+
function isDefaultTarget(target2) {
|
|
14532
|
+
return target2?.[0] === "default";
|
|
14533
|
+
}
|
|
14534
|
+
function isConversationTarget(target2) {
|
|
14535
|
+
return target2?.[0] === "conversation";
|
|
14536
|
+
}
|
|
14537
|
+
function isIdentifiedTarget(target2) {
|
|
14538
|
+
return target2?.[0] === "conversation" || target2?.[0] === "default" && typeof target2[1] === "string" && target2[1].startsWith("client-new-thread:");
|
|
14539
|
+
}
|
|
14540
|
+
function sameTarget(left, right) {
|
|
14541
|
+
return left.length === right.length && left.every((value, index) => value === right[index]);
|
|
14542
|
+
}
|
|
14543
|
+
var DraftAgentController = class {
|
|
14544
|
+
#idFactory;
|
|
14545
|
+
#defaultAgent;
|
|
14546
|
+
#enabledAgents;
|
|
14547
|
+
#targetStates = [];
|
|
14548
|
+
#modelRequestGenerations = /* @__PURE__ */ new WeakMap();
|
|
14549
|
+
#ownershipRequestGenerations = /* @__PURE__ */ new WeakMap();
|
|
14550
|
+
#states = /* @__PURE__ */ new WeakMap();
|
|
14551
|
+
#switching = /* @__PURE__ */ new Set();
|
|
14552
|
+
#pendingSubmissions = /* @__PURE__ */ new Set();
|
|
14553
|
+
#composerSequence = 0;
|
|
14554
|
+
#modelRequestSequence = 0;
|
|
14555
|
+
#ownershipRequestSequence = 0;
|
|
14556
|
+
#lastSubmittedAgent;
|
|
14557
|
+
constructor(options = {}) {
|
|
14558
|
+
this.#idFactory = options.idFactory ?? defaultIdFactory;
|
|
14559
|
+
this.#enabledAgents = new Set(options.enabledAgents ?? DEFAULT_RENDERER_AGENTS);
|
|
14560
|
+
if (!this.#enabledAgents.has("codex"))
|
|
14561
|
+
throw new Error("Renderer enabled Agents must include Codex");
|
|
14562
|
+
this.#defaultAgent = options.defaultAgent ?? "codex";
|
|
14563
|
+
this.#lastSubmittedAgent = this.#defaultAgent;
|
|
14564
|
+
}
|
|
14565
|
+
setEnabledAgents(agents) {
|
|
14566
|
+
this.#enabledAgents = /* @__PURE__ */ new Set(["codex", ...agents]);
|
|
14567
|
+
}
|
|
14568
|
+
get(composer) {
|
|
14569
|
+
return this.#state(composer);
|
|
14570
|
+
}
|
|
14571
|
+
detach(composer, preservePendingSubmission = false) {
|
|
14572
|
+
const state = this.#states.get(composer);
|
|
14573
|
+
if (state && !preservePendingSubmission) this.#pendingSubmissions.delete(state);
|
|
14574
|
+
this.#states.delete(composer);
|
|
14575
|
+
}
|
|
14576
|
+
mount(composer, target2, preferredNewThreadAgent) {
|
|
14577
|
+
const bound = this.#targetState(target2);
|
|
14578
|
+
if (bound) {
|
|
14579
|
+
this.#states.set(composer, bound);
|
|
14580
|
+
return bound;
|
|
14581
|
+
}
|
|
14582
|
+
const preferredAgent = preferredNewThreadAgent ?? this.#lastSubmittedAgent;
|
|
14583
|
+
const state = this.#state(composer, isDefaultTarget(target2) ? preferredAgent : "codex");
|
|
14584
|
+
if (isIdentifiedTarget(target2)) this.#targetStates.push({ target: target2, state });
|
|
14585
|
+
return state;
|
|
14586
|
+
}
|
|
14587
|
+
isSwitching(composer) {
|
|
14588
|
+
return this.#switching.has(this.#state(composer));
|
|
14589
|
+
}
|
|
14590
|
+
beginModelRequest(composer) {
|
|
14591
|
+
const state = this.#state(composer);
|
|
14592
|
+
const generation = ++this.#modelRequestSequence;
|
|
14593
|
+
this.#modelRequestGenerations.set(state, generation);
|
|
14594
|
+
return generation;
|
|
14595
|
+
}
|
|
14596
|
+
invalidateModelRequests(composer) {
|
|
14597
|
+
this.beginModelRequest(composer);
|
|
14598
|
+
}
|
|
14599
|
+
isCurrentModelRequest(composer, generation) {
|
|
14600
|
+
return (this.#modelRequestGenerations.get(this.#state(composer)) ?? 0) === generation;
|
|
14601
|
+
}
|
|
14602
|
+
beginOwnershipRequest(composer) {
|
|
14603
|
+
const generation = ++this.#ownershipRequestSequence;
|
|
14604
|
+
this.#ownershipRequestGenerations.set(this.#state(composer), generation);
|
|
14605
|
+
return generation;
|
|
14606
|
+
}
|
|
14607
|
+
isCurrentOwnershipRequest(composer, generation) {
|
|
14608
|
+
return (this.#ownershipRequestGenerations.get(this.#state(composer)) ?? 0) === generation;
|
|
14609
|
+
}
|
|
14610
|
+
rebindConversation(composer, target2) {
|
|
14611
|
+
if (!isConversationTarget(target2)) return null;
|
|
14612
|
+
const previous = this.#state(composer);
|
|
14613
|
+
this.#pendingSubmissions.delete(previous);
|
|
14614
|
+
this.#modelRequestGenerations.set(previous, ++this.#modelRequestSequence);
|
|
14615
|
+
this.#ownershipRequestGenerations.set(previous, ++this.#ownershipRequestSequence);
|
|
14616
|
+
let state = this.#targetState(target2);
|
|
14617
|
+
if (!state) {
|
|
14618
|
+
state = {
|
|
14619
|
+
agent: "codex",
|
|
14620
|
+
phase: "draft",
|
|
14621
|
+
composerId: this.#idFactory(++this.#composerSequence)
|
|
14622
|
+
};
|
|
14623
|
+
this.#targetStates.push({ target: target2, state });
|
|
14624
|
+
}
|
|
14625
|
+
this.#states.set(composer, state);
|
|
14626
|
+
this.#modelRequestGenerations.set(state, ++this.#modelRequestSequence);
|
|
14627
|
+
this.#ownershipRequestGenerations.set(state, ++this.#ownershipRequestSequence);
|
|
14628
|
+
return state;
|
|
14629
|
+
}
|
|
14630
|
+
restore(composer, agent, model2, thinkingOptionId, permissionModeId) {
|
|
14631
|
+
const state = this.#state(composer);
|
|
14632
|
+
this.#pendingSubmissions.delete(state);
|
|
14633
|
+
state.agent = agent;
|
|
14634
|
+
state.phase = "locked";
|
|
14635
|
+
if (agent !== "codex") {
|
|
14636
|
+
state.configurationByAgent = {
|
|
14637
|
+
...state.configurationByAgent,
|
|
14638
|
+
[agent]: {
|
|
14639
|
+
...model2 ? { model: model2 } : {},
|
|
14640
|
+
...thinkingOptionId ? { thinkingOptionId } : {},
|
|
14641
|
+
...permissionModeId ? { permissionModeId } : {}
|
|
14642
|
+
}
|
|
14643
|
+
};
|
|
14644
|
+
}
|
|
14645
|
+
return state;
|
|
14646
|
+
}
|
|
14647
|
+
clearConfiguration(composer) {
|
|
14648
|
+
delete this.#state(composer).configurationByAgent;
|
|
14649
|
+
}
|
|
14650
|
+
modelForAgent(composer, agent) {
|
|
14651
|
+
return this.#state(composer).configurationByAgent?.[agent]?.model;
|
|
14652
|
+
}
|
|
14653
|
+
thinkingOptionForAgent(composer, agent) {
|
|
14654
|
+
return this.#state(composer).configurationByAgent?.[agent]?.thinkingOptionId;
|
|
14655
|
+
}
|
|
14656
|
+
permissionModeForAgent(composer, agent) {
|
|
14657
|
+
return this.#state(composer).configurationByAgent?.[agent]?.permissionModeId;
|
|
14658
|
+
}
|
|
14659
|
+
setExternalPermissionMode(composer, agent, permissionModeId) {
|
|
14660
|
+
return this.#configure(composer, agent, { permissionModeId });
|
|
14661
|
+
}
|
|
14662
|
+
setExternalModel(composer, agent, model2) {
|
|
14663
|
+
return this.#configure(composer, agent, { model: model2 });
|
|
14664
|
+
}
|
|
14665
|
+
setExternalThinkingOption(composer, agent, thinkingOptionId) {
|
|
14666
|
+
const state = this.#configure(composer, agent, {});
|
|
14667
|
+
const configuration = state.configurationByAgent?.[agent];
|
|
14668
|
+
if (!configuration) return state;
|
|
14669
|
+
if (thinkingOptionId) configuration.thinkingOptionId = thinkingOptionId;
|
|
14670
|
+
else delete configuration.thinkingOptionId;
|
|
14671
|
+
return state;
|
|
14672
|
+
}
|
|
14673
|
+
#configure(composer, agent, patch) {
|
|
14674
|
+
const state = this.#state(composer);
|
|
14675
|
+
state.configurationByAgent = {
|
|
14676
|
+
...state.configurationByAgent,
|
|
14677
|
+
[agent]: { ...state.configurationByAgent?.[agent], ...patch }
|
|
14678
|
+
};
|
|
14679
|
+
return state;
|
|
14680
|
+
}
|
|
14681
|
+
lock(composer) {
|
|
14682
|
+
const state = this.#state(composer);
|
|
14683
|
+
this.#pendingSubmissions.delete(state);
|
|
14684
|
+
state.phase = "locked";
|
|
14685
|
+
return state;
|
|
14686
|
+
}
|
|
14687
|
+
markSubmissionPending(composer) {
|
|
14688
|
+
const state = this.#state(composer);
|
|
14689
|
+
if (state.phase === "draft") this.#pendingSubmissions.add(state);
|
|
14690
|
+
return state;
|
|
14691
|
+
}
|
|
14692
|
+
isSubmissionPending(composer) {
|
|
14693
|
+
return this.#pendingSubmissions.has(this.#state(composer));
|
|
14694
|
+
}
|
|
14695
|
+
clearPendingSubmission(composer) {
|
|
14696
|
+
this.#pendingSubmissions.delete(this.#state(composer));
|
|
14697
|
+
}
|
|
14698
|
+
/** Only a draft's submission creates a Thread, so only it sets the next new-Thread Agent. */
|
|
14699
|
+
recordSubmission(composer) {
|
|
14700
|
+
const state = this.#state(composer);
|
|
14701
|
+
if (state.phase === "draft") this.#lastSubmittedAgent = state.agent;
|
|
14702
|
+
return state;
|
|
14703
|
+
}
|
|
14704
|
+
transfer(source, replacement, target2 = null) {
|
|
14705
|
+
const state = this.#states.get(source);
|
|
14706
|
+
if (!state) return false;
|
|
14707
|
+
const bound = this.#targetState(target2);
|
|
14708
|
+
if (bound && bound !== state) return false;
|
|
14709
|
+
if (source !== replacement) {
|
|
14710
|
+
if (this.#states.has(replacement)) return false;
|
|
14711
|
+
this.#states.set(replacement, state);
|
|
14712
|
+
}
|
|
14713
|
+
if (isIdentifiedTarget(target2) && !bound) this.#targetStates.push({ target: target2, state });
|
|
14714
|
+
if (isConversationTarget(target2) && this.#pendingSubmissions.delete(state))
|
|
14715
|
+
state.phase = "locked";
|
|
14716
|
+
return true;
|
|
14717
|
+
}
|
|
14718
|
+
async switchAgent(composer, nextAgent, operations) {
|
|
14719
|
+
const state = this.#state(composer);
|
|
14720
|
+
if (!this.#enabledAgents.has(nextAgent)) return false;
|
|
14721
|
+
if (state.phase !== "draft" || this.#switching.has(state)) return false;
|
|
14722
|
+
if (state.agent === nextAgent) return true;
|
|
14723
|
+
this.#pendingSubmissions.delete(state);
|
|
14724
|
+
this.#switching.add(state);
|
|
14725
|
+
try {
|
|
14726
|
+
if (!operations.applyAgent(nextAgent)) return false;
|
|
14727
|
+
try {
|
|
14728
|
+
await operations.clearPrewarm();
|
|
14729
|
+
} catch (error51) {
|
|
14730
|
+
if (!operations.applyAgent(state.agent))
|
|
14731
|
+
throw new Error("Draft Agent switch could not restore the prior Agent", { cause: error51 });
|
|
14732
|
+
return false;
|
|
14733
|
+
}
|
|
14734
|
+
state.agent = nextAgent;
|
|
14735
|
+
return true;
|
|
14736
|
+
} finally {
|
|
14737
|
+
this.#switching.delete(state);
|
|
14738
|
+
}
|
|
14739
|
+
}
|
|
14740
|
+
#targetState(target2) {
|
|
14741
|
+
if (!isIdentifiedTarget(target2)) return null;
|
|
14742
|
+
return this.#targetStates.find((candidate) => sameTarget(candidate.target, target2))?.state ?? null;
|
|
14743
|
+
}
|
|
14744
|
+
#state(composer, initialAgent) {
|
|
14745
|
+
const existing = this.#states.get(composer);
|
|
14746
|
+
if (existing) return existing;
|
|
14747
|
+
const created = {
|
|
14748
|
+
agent: initialAgent ?? this.#defaultAgent,
|
|
14749
|
+
phase: "draft",
|
|
14750
|
+
composerId: this.#idFactory(++this.#composerSequence)
|
|
14751
|
+
};
|
|
14752
|
+
this.#states.set(composer, created);
|
|
14753
|
+
return created;
|
|
14754
|
+
}
|
|
14755
|
+
};
|
|
14756
|
+
|
|
14754
14757
|
// ../shared-contracts/dist/json-value.js
|
|
14755
14758
|
function rejectExplicitUndefined(keys) {
|
|
14756
14759
|
return (value, context2) => {
|
|
@@ -14909,13 +14912,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14909
14912
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
14910
14913
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
14911
14914
|
var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
|
|
14915
|
+
var usageOutputTimingSchema = external_exports.object({
|
|
14916
|
+
version: external_exports.literal(3).optional(),
|
|
14917
|
+
requestId: external_exports.string().min(1),
|
|
14918
|
+
turnId: external_exports.string().min(1).max(1024),
|
|
14919
|
+
outputTokens: nonNegativeSafeIntegerSchema,
|
|
14920
|
+
startedAtMs: nonNegativeSafeIntegerSchema,
|
|
14921
|
+
completedAtMs: nonNegativeSafeIntegerSchema
|
|
14922
|
+
}).strict().refine((value) => value.completedAtMs > value.startedAtMs);
|
|
14912
14923
|
var usageMeasurementSchema = external_exports.object({
|
|
14924
|
+
version: external_exports.union([external_exports.literal(2), external_exports.literal(3)]).optional(),
|
|
14913
14925
|
value: finiteNonNegativeNumberSchema,
|
|
14914
14926
|
turnId: external_exports.string().min(1).max(1024),
|
|
14915
14927
|
at: nonNegativeSafeIntegerSchema
|
|
14916
14928
|
}).strict();
|
|
14917
14929
|
var usageMeasurementsSchema = external_exports.object({
|
|
14918
|
-
|
|
14930
|
+
// Unversioned intervals can omit hidden thinking time; do not restore them into averages.
|
|
14931
|
+
outputTimings: external_exports.array(usageOutputTimingSchema).transform((values) => values.filter((value) => value.version === 3)).optional(),
|
|
14932
|
+
// Retain independent TTFT facts when dropping incompatible speed measurements.
|
|
14933
|
+
outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 3).optional().catch(void 0),
|
|
14919
14934
|
timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
|
|
14920
14935
|
}).strict();
|
|
14921
14936
|
var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text) => text.length <= maximum));
|
|
@@ -14935,6 +14950,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14935
14950
|
cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
14936
14951
|
outputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
14937
14952
|
outputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
14953
|
+
sessionOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
14938
14954
|
apiOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
14939
14955
|
reasoningOutputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
14940
14956
|
totalTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
@@ -15357,11 +15373,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15357
15373
|
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
15358
15374
|
}).strict();
|
|
15359
15375
|
|
|
15376
|
+
// ../shared-contracts/dist/thread-archive-confirm.js
|
|
15377
|
+
var threadArchiveConfirmParamsSchema = external_exports.object({ threadId: hostThreadIdSchema }).strict();
|
|
15378
|
+
var threadArchiveConfirmResultSchema = external_exports.object({ confirmed: external_exports.boolean() }).strict();
|
|
15379
|
+
|
|
15360
15380
|
// ../shared-contracts/dist/client-channel.js
|
|
15361
15381
|
var CLIENT_CHANNEL_VERSION = 1;
|
|
15362
15382
|
var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
|
|
15363
15383
|
var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
|
|
15364
15384
|
var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
|
|
15385
|
+
var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
|
|
15386
|
+
var clientThreadTreeSchema = external_exports.object({
|
|
15387
|
+
parents: external_exports.record(external_exports.string().min(1), external_exports.string().min(1))
|
|
15388
|
+
}).strict();
|
|
15365
15389
|
var clientProjectlessWorkspaceSchema = external_exports.object({
|
|
15366
15390
|
prompt: external_exports.string().max(16384).optional()
|
|
15367
15391
|
}).strict();
|
|
@@ -15378,6 +15402,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15378
15402
|
sequence: external_exports.number().int().nonnegative()
|
|
15379
15403
|
});
|
|
15380
15404
|
var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
|
|
15405
|
+
external_exports.object({
|
|
15406
|
+
type: external_exports.literal("skills-changed"),
|
|
15407
|
+
cursor: clientChannelCursorSchema,
|
|
15408
|
+
cwd: external_exports.string().optional()
|
|
15409
|
+
}),
|
|
15381
15410
|
external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
|
|
15382
15411
|
external_exports.object({
|
|
15383
15412
|
type: external_exports.literal("preferences-changed"),
|
|
@@ -15487,7 +15516,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15487
15516
|
/** Current interruptible Host Turn, including command Turns omitted from client history. */
|
|
15488
15517
|
activeTurnId: external_exports.string().min(1).nullable().optional(),
|
|
15489
15518
|
/** Most recent explicit command in this Host process; not native conversation history. */
|
|
15490
|
-
command: external_exports.object({
|
|
15519
|
+
command: external_exports.object({
|
|
15520
|
+
name: external_exports.string().min(1),
|
|
15521
|
+
turn: clientTurnSchema,
|
|
15522
|
+
/** First ordinary Turn started after this command; its retained result is not a new event. */
|
|
15523
|
+
subsequentTurnId: external_exports.string().min(1).optional()
|
|
15524
|
+
}).optional(),
|
|
15491
15525
|
thread: external_exports.object({
|
|
15492
15526
|
id: external_exports.string().min(1),
|
|
15493
15527
|
cwd: external_exports.string(),
|
|
@@ -15575,6 +15609,71 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15575
15609
|
external_exports.object({ ok: external_exports.literal(false), error: external_exports.object({ code: voiceErrorCodeSchema }).strict() }).strict()
|
|
15576
15610
|
]);
|
|
15577
15611
|
|
|
15612
|
+
// ../shared-contracts/dist/skills.js
|
|
15613
|
+
var SKILLS_LIST_METHOD = "codexhost/skills/list";
|
|
15614
|
+
var SKILLS_CHANGED_METHOD = "codexhost/skills/changed";
|
|
15615
|
+
var skillsListParamsSchema = external_exports.object({
|
|
15616
|
+
threadId: hostThreadIdSchema.optional(),
|
|
15617
|
+
cwd: external_exports.string().min(1).optional()
|
|
15618
|
+
}).strict().refine((params) => !(params.threadId && params.cwd), {
|
|
15619
|
+
message: "Specify threadId or cwd, not both"
|
|
15620
|
+
});
|
|
15621
|
+
var librarySkillSchema = external_exports.object({
|
|
15622
|
+
name: external_exports.string().min(1).regex(/^[^\s[\]]+$/u),
|
|
15623
|
+
description: external_exports.string().optional(),
|
|
15624
|
+
path: external_exports.string().min(1),
|
|
15625
|
+
scope: external_exports.enum(["project", "global"]),
|
|
15626
|
+
source: external_exports.string().min(1)
|
|
15627
|
+
}).strict();
|
|
15628
|
+
var skillsListResultSchema = external_exports.object({
|
|
15629
|
+
revision: external_exports.number().int().nonnegative(),
|
|
15630
|
+
complete: external_exports.boolean(),
|
|
15631
|
+
skills: external_exports.array(librarySkillSchema),
|
|
15632
|
+
warnings: external_exports.array(external_exports.string()).optional()
|
|
15633
|
+
}).strict();
|
|
15634
|
+
var skillsChangedParamsSchema = external_exports.object({ cwd: external_exports.string().min(1).optional() }).strict();
|
|
15635
|
+
|
|
15636
|
+
// ../shared-contracts/dist/skill-reference.js
|
|
15637
|
+
var DESKTOP_SKILL_MENTION_PATH_PREFIX = "subagent://codexhost-skill.";
|
|
15638
|
+
var DESKTOP_MENTION = /\[@[^\]\r\n]+\]\(<?subagent:\/\/codexhost-skill\.([^\s)>]+)>?\)/gu;
|
|
15639
|
+
var LINK = /\[\$([^\]\r\n]+)\]\((?:<([^<>\r\n]+)>|([^\s()]+))(?:[ \t]+(?:"[^"\r\n]*"|'[^'\r\n]*'))?\)/gu;
|
|
15640
|
+
function skillReferences(text) {
|
|
15641
|
+
return [...text.matchAll(LINK)].flatMap((match) => {
|
|
15642
|
+
const path = match[2] ?? match[3] ?? "";
|
|
15643
|
+
if (!/^(?:\/|[A-Za-z]:[\\/]|\\\\)/u.test(path) || !/[\\/]SKILL\.md$/u.test(path))
|
|
15644
|
+
return [];
|
|
15645
|
+
return [
|
|
15646
|
+
{
|
|
15647
|
+
start: match.index,
|
|
15648
|
+
end: match.index + match[0].length,
|
|
15649
|
+
name: match[1] ?? "",
|
|
15650
|
+
path,
|
|
15651
|
+
text: match[0]
|
|
15652
|
+
}
|
|
15653
|
+
];
|
|
15654
|
+
});
|
|
15655
|
+
}
|
|
15656
|
+
function formatSkillReference(skill) {
|
|
15657
|
+
const target2 = /[\s()]/u.test(skill.path) ? `<${skill.path}>` : skill.path;
|
|
15658
|
+
return `[$${skill.name}](${target2} "Read this skill")`;
|
|
15659
|
+
}
|
|
15660
|
+
function desktopSkillMentionPath(skill) {
|
|
15661
|
+
return DESKTOP_SKILL_MENTION_PATH_PREFIX + encodeURIComponent(JSON.stringify({ name: skill.name, path: skill.path })).replace(/[!'()*]/gu, (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
15662
|
+
}
|
|
15663
|
+
function restoreDesktopSkillMentions(text) {
|
|
15664
|
+
return text.replace(DESKTOP_MENTION, (match, encoded) => {
|
|
15665
|
+
try {
|
|
15666
|
+
const skill = JSON.parse(decodeURIComponent(encoded));
|
|
15667
|
+
if (!skill || typeof skill !== "object" || !("name" in skill) || typeof skill.name !== "string" || !("path" in skill) || typeof skill.path !== "string")
|
|
15668
|
+
return match;
|
|
15669
|
+
const canonical = formatSkillReference({ name: skill.name, path: skill.path });
|
|
15670
|
+
return skillReferences(canonical)[0]?.text === canonical ? canonical : match;
|
|
15671
|
+
} catch {
|
|
15672
|
+
return match;
|
|
15673
|
+
}
|
|
15674
|
+
});
|
|
15675
|
+
}
|
|
15676
|
+
|
|
15578
15677
|
// ../shared-contracts/dist/web-access-tokens.js
|
|
15579
15678
|
var webNetworkAccessUrlSchema = external_exports.object({
|
|
15580
15679
|
/**
|
|
@@ -15673,7 +15772,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15673
15772
|
quotaUntil: external_exports.string().optional()
|
|
15674
15773
|
}).strict().optional()
|
|
15675
15774
|
}).strict();
|
|
15676
|
-
var webLocalAccessRequiredDetailsSchema = external_exports.object({ url: external_exports.string() }).strict();
|
|
15677
15775
|
|
|
15678
15776
|
// ../shared-contracts/dist/delegation-read.js
|
|
15679
15777
|
var REMOTE_THREAD_REPLY_MAX_BYTES = 16 * 1024 * 1024;
|
|
@@ -15683,8 +15781,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15683
15781
|
var delegationReadParamsSchema = external_exports.strictObject({
|
|
15684
15782
|
threadId: external_exports.string().min(1).max(1024),
|
|
15685
15783
|
view: external_exports.enum(["result", "messages"]),
|
|
15686
|
-
|
|
15687
|
-
|
|
15784
|
+
from: external_exports.number().int().min(1).max(Number.MAX_SAFE_INTEGER).optional(),
|
|
15785
|
+
to: external_exports.number().int().min(1).max(Number.MAX_SAFE_INTEGER).optional()
|
|
15688
15786
|
});
|
|
15689
15787
|
|
|
15690
15788
|
// ../shared-contracts/dist/credential-imports.js
|
|
@@ -15874,6 +15972,135 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15874
15972
|
...window2.localizations ? { localizations: window2.localizations } : {}
|
|
15875
15973
|
}, locale).label;
|
|
15876
15974
|
}
|
|
15975
|
+
function periodOrder(periodType) {
|
|
15976
|
+
if (periodType === "five_hour")
|
|
15977
|
+
return 0;
|
|
15978
|
+
if (periodType === "seven_day")
|
|
15979
|
+
return 1;
|
|
15980
|
+
if (periodType === "weekly")
|
|
15981
|
+
return 2;
|
|
15982
|
+
if (periodType === "monthly")
|
|
15983
|
+
return 3;
|
|
15984
|
+
return 4;
|
|
15985
|
+
}
|
|
15986
|
+
function groupAccountCreditsWindows(credits, locale, periodLabel, groupedPeriodLabel = periodLabel) {
|
|
15987
|
+
const entries = [
|
|
15988
|
+
{
|
|
15989
|
+
label: credits.label,
|
|
15990
|
+
periodType: credits.periodType,
|
|
15991
|
+
scope: credits.scope,
|
|
15992
|
+
localizations: credits.localizations,
|
|
15993
|
+
usedPercent: credits.usedPercent,
|
|
15994
|
+
used: credits.used,
|
|
15995
|
+
limit: credits.limit,
|
|
15996
|
+
unit: credits.unit,
|
|
15997
|
+
resetsAt: credits.resetsAt,
|
|
15998
|
+
isPrimary: true
|
|
15999
|
+
},
|
|
16000
|
+
...(credits.productUsage ?? []).map((item) => ({
|
|
16001
|
+
product: item.product,
|
|
16002
|
+
periodType: item.periodType,
|
|
16003
|
+
scope: item.scope,
|
|
16004
|
+
localizations: item.localizations,
|
|
16005
|
+
usedPercent: item.usagePercent,
|
|
16006
|
+
used: item.used,
|
|
16007
|
+
limit: item.limit,
|
|
16008
|
+
unit: item.unit,
|
|
16009
|
+
resetsAt: item.resetsAt,
|
|
16010
|
+
isPrimary: false
|
|
16011
|
+
}))
|
|
16012
|
+
];
|
|
16013
|
+
const scopeCounts = /* @__PURE__ */ new Map();
|
|
16014
|
+
for (const entry of entries) {
|
|
16015
|
+
if (entry.scope)
|
|
16016
|
+
scopeCounts.set(entry.scope.id, (scopeCounts.get(entry.scope.id) ?? 0) + 1);
|
|
16017
|
+
}
|
|
16018
|
+
const sections = /* @__PURE__ */ new Map();
|
|
16019
|
+
for (const entry of entries) {
|
|
16020
|
+
const groupedScope = entry.scope && (scopeCounts.get(entry.scope.id) ?? 0) >= 2 ? entry.scope : void 0;
|
|
16021
|
+
const key = groupedScope ? `scope:${groupedScope.id}` : "default";
|
|
16022
|
+
let section = sections.get(key);
|
|
16023
|
+
if (!section) {
|
|
16024
|
+
section = groupedScope ? {
|
|
16025
|
+
id: groupedScope.id,
|
|
16026
|
+
title: localizeHarnessPresentation(groupedScope, locale).label,
|
|
16027
|
+
windows: []
|
|
16028
|
+
} : { windows: [] };
|
|
16029
|
+
sections.set(key, section);
|
|
16030
|
+
}
|
|
16031
|
+
const inlineScope = !groupedScope && entry.scope && entry.periodType && entry.periodType !== "unknown" ? localizeHarnessPresentation(entry.scope, locale).label : void 0;
|
|
16032
|
+
const label = groupedScope && entry.periodType && entry.periodType !== "unknown" ? groupedPeriodLabel(entry.periodType) : inlineScope && entry.periodType && entry.periodType !== "unknown" ? periodLabel(entry.periodType) : accountCreditsWindowLabel(entry, locale, periodLabel);
|
|
16033
|
+
section.windows.push({
|
|
16034
|
+
order: groupedScope ? periodOrder(entry.periodType) : 0,
|
|
16035
|
+
window: {
|
|
16036
|
+
label,
|
|
16037
|
+
...inlineScope ? { scopeLabel: inlineScope } : {},
|
|
16038
|
+
usedPercent: entry.usedPercent,
|
|
16039
|
+
...entry.used === void 0 ? {} : { used: entry.used },
|
|
16040
|
+
...entry.limit === void 0 ? {} : { limit: entry.limit },
|
|
16041
|
+
...entry.unit === void 0 ? {} : { unit: entry.unit },
|
|
16042
|
+
...entry.resetsAt === void 0 ? {} : { resetsAt: entry.resetsAt },
|
|
16043
|
+
isPrimary: entry.isPrimary
|
|
16044
|
+
}
|
|
16045
|
+
});
|
|
16046
|
+
}
|
|
16047
|
+
return [...sections.values()].map(({ windows, ...section }) => ({
|
|
16048
|
+
...section,
|
|
16049
|
+
windows: (section.title !== void 0 ? [...windows].sort((left, right) => left.order - right.order) : windows).map((item) => item.window)
|
|
16050
|
+
}));
|
|
16051
|
+
}
|
|
16052
|
+
function countdownMinutes(value, nowMs) {
|
|
16053
|
+
const timestamp = typeof value === "number" ? value * 1e3 : Date.parse(value);
|
|
16054
|
+
if (!Number.isFinite(timestamp))
|
|
16055
|
+
return null;
|
|
16056
|
+
return Math.max(0, Math.ceil((timestamp - nowMs) / 6e4));
|
|
16057
|
+
}
|
|
16058
|
+
function isChineseLocale(locale) {
|
|
16059
|
+
return locale === "zh-CN" || locale.startsWith("zh-");
|
|
16060
|
+
}
|
|
16061
|
+
function compactDurationText(minutes) {
|
|
16062
|
+
if (minutes >= 1440) {
|
|
16063
|
+
const days = Math.floor(minutes / 1440);
|
|
16064
|
+
const hours2 = Math.floor(minutes % 1440 / 60);
|
|
16065
|
+
return hours2 > 0 ? `${days}d${hours2}h` : `${days}d`;
|
|
16066
|
+
}
|
|
16067
|
+
const hours = Math.floor(minutes / 60);
|
|
16068
|
+
const mins = minutes % 60;
|
|
16069
|
+
if (hours > 0)
|
|
16070
|
+
return mins > 0 ? `${hours}h${mins}m` : `${hours}h`;
|
|
16071
|
+
return `${mins}m`;
|
|
16072
|
+
}
|
|
16073
|
+
function formatAccountCreditsResetCountdown(value, locale, nowMs = Date.now()) {
|
|
16074
|
+
const minutes = countdownMinutes(value, nowMs);
|
|
16075
|
+
if (minutes === null)
|
|
16076
|
+
return null;
|
|
16077
|
+
const chinese = isChineseLocale(locale);
|
|
16078
|
+
if (minutes === 0)
|
|
16079
|
+
return chinese ? "\u5373\u5C06\u91CD\u7F6E" : "Resets soon";
|
|
16080
|
+
if (minutes >= 1440) {
|
|
16081
|
+
const days = Math.floor(minutes / 1440);
|
|
16082
|
+
const hours2 = Math.floor(minutes % 1440 / 60);
|
|
16083
|
+
if (chinese)
|
|
16084
|
+
return hours2 > 0 ? `${days} \u5929 ${hours2} \u5C0F\u65F6\u540E\u91CD\u7F6E` : `${days} \u5929\u540E\u91CD\u7F6E`;
|
|
16085
|
+
return hours2 > 0 ? `Resets in ${days}d ${hours2}h` : `Resets in ${days}d`;
|
|
16086
|
+
}
|
|
16087
|
+
const hours = Math.floor(minutes / 60);
|
|
16088
|
+
const mins = minutes % 60;
|
|
16089
|
+
if (hours > 0) {
|
|
16090
|
+
if (chinese)
|
|
16091
|
+
return mins > 0 ? `${hours} \u5C0F\u65F6 ${mins} \u5206\u540E\u91CD\u7F6E` : `${hours} \u5C0F\u65F6\u540E\u91CD\u7F6E`;
|
|
16092
|
+
return mins > 0 ? `Resets in ${hours}h ${mins}m` : `Resets in ${hours}h`;
|
|
16093
|
+
}
|
|
16094
|
+
return chinese ? `${mins} \u5206\u949F\u540E\u91CD\u7F6E` : `Resets in ${mins}m`;
|
|
16095
|
+
}
|
|
16096
|
+
function formatAccountCreditsCompactCountdown(value, locale, nowMs = Date.now()) {
|
|
16097
|
+
const minutes = countdownMinutes(value, nowMs);
|
|
16098
|
+
if (minutes === null)
|
|
16099
|
+
return null;
|
|
16100
|
+
if (minutes === 0)
|
|
16101
|
+
return isChineseLocale(locale) ? "\u5373\u5C06\u91CD\u7F6E" : "Resets soon";
|
|
16102
|
+
return compactDurationText(minutes);
|
|
16103
|
+
}
|
|
15877
16104
|
|
|
15878
16105
|
// ../shared-contracts/dist/model-price-overrides.js
|
|
15879
16106
|
var MODEL_PRICE_OVERRIDES_GET_METHOD = "codexhost/usage/model-prices/get";
|
|
@@ -16751,6 +16978,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16751
16978
|
return [...context2.matchAll(IMAGE_ATTACHMENT_PATTERN)].map((match) => match[1] ?? "").filter((path) => path.length > 0 && !CONTROL_CHARACTER_PATTERN.test(path));
|
|
16752
16979
|
}
|
|
16753
16980
|
|
|
16981
|
+
// ../shared-contracts/dist/thread-watch-notice.js
|
|
16982
|
+
var THREAD_WATCH_NOTICE_OUTCOMES = [
|
|
16983
|
+
"completed",
|
|
16984
|
+
"failed",
|
|
16985
|
+
"interrupted",
|
|
16986
|
+
"timedOut",
|
|
16987
|
+
"unreadable",
|
|
16988
|
+
"notFound"
|
|
16989
|
+
];
|
|
16990
|
+
var ENTRY_PATTERN = new RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)\): ` + `(${THREAD_WATCH_NOTICE_OUTCOMES.join("|")})(?:. (.+))?$`, "u");
|
|
16991
|
+
|
|
16754
16992
|
// ../shared-contracts/dist/remote-runtime.js
|
|
16755
16993
|
var RUNTIME_STATUS_METHOD = "codexhost/runtime/status";
|
|
16756
16994
|
var REMOTE_UPDATE_METHOD = "codexhost/remote/update";
|
|
@@ -16801,6 +17039,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16801
17039
|
archived: external_exports.boolean()
|
|
16802
17040
|
}),
|
|
16803
17041
|
external_exports.strictObject({ kind: external_exports.literal("read"), ...thread }),
|
|
17042
|
+
external_exports.strictObject({
|
|
17043
|
+
kind: external_exports.literal("configure"),
|
|
17044
|
+
...thread,
|
|
17045
|
+
epoch: identity,
|
|
17046
|
+
modelId: identity.optional(),
|
|
17047
|
+
thinkingOptionId: identity.optional(),
|
|
17048
|
+
permissionModeId: identity.optional()
|
|
17049
|
+
}).refine((value) => [value.modelId, value.thinkingOptionId, value.permissionModeId].filter((v) => v !== void 0).length === 1, "Select exactly one remote setting"),
|
|
16804
17050
|
external_exports.strictObject({
|
|
16805
17051
|
kind: external_exports.literal("prompt"),
|
|
16806
17052
|
...thread,
|
|
@@ -16873,6 +17119,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16873
17119
|
external_exports.strictObject({ error: external_exports.strictObject({ code: external_exports.number().int(), message: external_exports.string() }) })
|
|
16874
17120
|
]);
|
|
16875
17121
|
|
|
17122
|
+
// ../shared-contracts/dist/thread-title.js
|
|
17123
|
+
var threadTitleInputSchema = external_exports.strictObject({
|
|
17124
|
+
prompt: external_exports.string().trim().min(1).max(2e3),
|
|
17125
|
+
cwd: external_exports.string().max(4096).nullable()
|
|
17126
|
+
});
|
|
17127
|
+
var threadTitleResultSchema = external_exports.string().trim().min(1).max(60).nullable();
|
|
17128
|
+
|
|
16876
17129
|
// ../shared-contracts/dist/web-ui-extensions.js
|
|
16877
17130
|
var webUiExtensionIdSchema = external_exports.string().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u);
|
|
16878
17131
|
var localizedTextSchema2 = external_exports.union([
|
|
@@ -18988,6 +19241,37 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18988
19241
|
return fallback;
|
|
18989
19242
|
}
|
|
18990
19243
|
|
|
19244
|
+
// src/settings/harness-version-messages.ts
|
|
19245
|
+
var harnessVersionEnglish = Object.freeze({
|
|
19246
|
+
locale: "en",
|
|
19247
|
+
unknown: "Unknown",
|
|
19248
|
+
trackingBranch: "Tracking branch (new commits)",
|
|
19249
|
+
notes: Object.freeze({
|
|
19250
|
+
"original-installer": "Use the original installer, package manager, or launcher to update this installation."
|
|
19251
|
+
})
|
|
19252
|
+
});
|
|
19253
|
+
var harnessVersionChinese = Object.freeze({
|
|
19254
|
+
locale: "zh-CN",
|
|
19255
|
+
unknown: "\u672A\u77E5",
|
|
19256
|
+
trackingBranch: "\u8DDF\u8E2A\u5206\u652F\uFF08\u6709\u65B0\u63D0\u4EA4\uFF09",
|
|
19257
|
+
notes: Object.freeze({
|
|
19258
|
+
"original-installer": "\u8BF7\u4F7F\u7528\u539F\u5B89\u88C5\u7A0B\u5E8F\u3001\u5305\u7BA1\u7406\u5668\u6216\u542F\u52A8\u5668\u66F4\u65B0\u6B64\u5B89\u88C5\u3002"
|
|
19259
|
+
})
|
|
19260
|
+
});
|
|
19261
|
+
function harnessVersionLabel(state, messages) {
|
|
19262
|
+
if (!state) return "\u2014";
|
|
19263
|
+
if (state.latestVersionKind === "unknown" || state.latestVersion === "Unknown")
|
|
19264
|
+
return messages.unknown;
|
|
19265
|
+
if (state.latestVersionKind === "tracking-branch" || state.latestVersion === "Tracking branch (new commits)")
|
|
19266
|
+
return messages.trackingBranch;
|
|
19267
|
+
return state.latestVersion;
|
|
19268
|
+
}
|
|
19269
|
+
function harnessVersionNote(state, messages) {
|
|
19270
|
+
if (state?.notice) return localizeHarnessText(state.notice, messages.locale);
|
|
19271
|
+
const code = state?.messageCode;
|
|
19272
|
+
return code && Object.hasOwn(messages.notes, code) ? messages.notes[code] : void 0;
|
|
19273
|
+
}
|
|
19274
|
+
|
|
18991
19275
|
// ../../node_modules/lucide/dist/esm/icons/smartphone.mjs
|
|
18992
19276
|
var Smartphone = [
|
|
18993
19277
|
["rect", { width: "14", height: "20", x: "5", y: "2", rx: "2", ry: "2" }],
|
|
@@ -19461,273 +19745,474 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19461
19745
|
return svg2;
|
|
19462
19746
|
}
|
|
19463
19747
|
|
|
19464
|
-
// src/settings/
|
|
19465
|
-
function
|
|
19466
|
-
|
|
19467
|
-
|
|
19468
|
-
|
|
19469
|
-
|
|
19470
|
-
|
|
19471
|
-
|
|
19472
|
-
|
|
19473
|
-
|
|
19474
|
-
|
|
19475
|
-
|
|
19476
|
-
|
|
19477
|
-
|
|
19478
|
-
|
|
19479
|
-
|
|
19480
|
-
|
|
19481
|
-
|
|
19482
|
-
|
|
19483
|
-
|
|
19484
|
-
|
|
19485
|
-
|
|
19486
|
-
|
|
19487
|
-
|
|
19488
|
-
|
|
19489
|
-
|
|
19490
|
-
|
|
19491
|
-
|
|
19492
|
-
|
|
19493
|
-
|
|
19494
|
-
|
|
19495
|
-
|
|
19496
|
-
|
|
19497
|
-
|
|
19498
|
-
|
|
19499
|
-
|
|
19500
|
-
|
|
19501
|
-
}
|
|
19502
|
-
|
|
19503
|
-
|
|
19504
|
-
|
|
19505
|
-
|
|
19506
|
-
|
|
19507
|
-
|
|
19508
|
-
|
|
19509
|
-
|
|
19510
|
-
|
|
19511
|
-
|
|
19512
|
-
|
|
19513
|
-
|
|
19514
|
-
|
|
19515
|
-
|
|
19516
|
-
|
|
19517
|
-
|
|
19748
|
+
// src/settings/connection-row.ts
|
|
19749
|
+
function connectionStatusLabel(availability, messages, hasError = false) {
|
|
19750
|
+
if (availability === "updating") return messages.connectionStatusUpdating;
|
|
19751
|
+
if (hasError && availability !== "notInstalled") return messages.connectionStatusError;
|
|
19752
|
+
if (availability === "ready") return messages.connectionStatusReady;
|
|
19753
|
+
if (availability === "checking") return messages.connectionStatusChecking;
|
|
19754
|
+
if (availability === "notInstalled") return messages.connectionStatusNotInstalled;
|
|
19755
|
+
if (availability === "unavailable" || availability === "error") {
|
|
19756
|
+
return availability === "error" ? messages.connectionStatusError : messages.connectionStatusUnavailable;
|
|
19757
|
+
}
|
|
19758
|
+
return availability === "installing" ? messages.connectionStatusInstalling : messages.connectionStatusUnsupported;
|
|
19759
|
+
}
|
|
19760
|
+
function connectionStatusTone(availability, hasError = false) {
|
|
19761
|
+
if (availability === "updating") return "checking";
|
|
19762
|
+
if (hasError && availability !== "notInstalled") return "failed";
|
|
19763
|
+
if (availability === "ready") return "ready";
|
|
19764
|
+
if (availability === "checking" || availability === "installing") return "checking";
|
|
19765
|
+
if (availability === "notInstalled") return "setup";
|
|
19766
|
+
return "failed";
|
|
19767
|
+
}
|
|
19768
|
+
function createConnectionIdentityIcon(document2, item, size) {
|
|
19769
|
+
const container = document2.createElement("span");
|
|
19770
|
+
container.className = item.agentSnapshot ? "settings-connection-row__mark settings-connection-row__mark--logo" : "settings-connection-row__mark";
|
|
19771
|
+
container.setAttribute("aria-hidden", "true");
|
|
19772
|
+
if (item.agentSnapshot) {
|
|
19773
|
+
container.append(
|
|
19774
|
+
createRendererAgentIcon(item.agentSnapshot.agent, size, document2, item.agentSnapshot.plugin)
|
|
19775
|
+
);
|
|
19776
|
+
} else {
|
|
19777
|
+
container.textContent = "CH";
|
|
19778
|
+
}
|
|
19779
|
+
return container;
|
|
19780
|
+
}
|
|
19781
|
+
function sameElementChildren(container, next) {
|
|
19782
|
+
if (container.children.length !== next.length) return false;
|
|
19783
|
+
for (let index = 0; index < next.length; index++) {
|
|
19784
|
+
if (container.children[index] !== next[index]) return false;
|
|
19785
|
+
}
|
|
19786
|
+
return true;
|
|
19787
|
+
}
|
|
19788
|
+
function reconcileElementChildren(container, next) {
|
|
19789
|
+
if (sameElementChildren(container, next)) return;
|
|
19790
|
+
if (typeof container.insertBefore !== "function") {
|
|
19791
|
+
container.replaceChildren(...next);
|
|
19792
|
+
return;
|
|
19793
|
+
}
|
|
19794
|
+
const nextSet = new Set(next);
|
|
19795
|
+
for (const child of [...container.children]) {
|
|
19796
|
+
if (!nextSet.has(child)) child.remove();
|
|
19797
|
+
}
|
|
19798
|
+
for (let index = 0; index < next.length; index++) {
|
|
19799
|
+
const desired = next[index];
|
|
19800
|
+
if (!desired) continue;
|
|
19801
|
+
const current = container.children[index] ?? null;
|
|
19802
|
+
if (current !== desired) {
|
|
19803
|
+
container.insertBefore(desired, current);
|
|
19518
19804
|
}
|
|
19519
|
-
}
|
|
19520
|
-
input.addEventListener("input", controls);
|
|
19521
|
-
save.addEventListener("click", () => {
|
|
19522
|
-
if (input.value.trim()) void persist(input.value.trim());
|
|
19523
|
-
});
|
|
19524
|
-
reset.addEventListener("click", () => {
|
|
19525
|
-
void persist(null);
|
|
19526
|
-
});
|
|
19527
|
-
controls();
|
|
19528
|
-
status.textContent = messages.launchPathLoading;
|
|
19529
|
-
void settings.get().then((value) => {
|
|
19530
|
-
loaded = true;
|
|
19531
|
-
show(value);
|
|
19532
|
-
}).catch(() => {
|
|
19533
|
-
loaded = true;
|
|
19534
|
-
status.textContent = messages.launchPathLoadError;
|
|
19535
|
-
}).finally(() => {
|
|
19536
|
-
busy = false;
|
|
19537
|
-
controls();
|
|
19538
|
-
});
|
|
19539
|
-
return section;
|
|
19805
|
+
}
|
|
19540
19806
|
}
|
|
19541
|
-
|
|
19542
|
-
|
|
19543
|
-
|
|
19544
|
-
return (plugin?.
|
|
19807
|
+
function identityIconSignature(item) {
|
|
19808
|
+
if (!item.agentSnapshot) return "adapter";
|
|
19809
|
+
const plugin = item.agentSnapshot.plugin;
|
|
19810
|
+
return `${item.agentSnapshot.agent}:${String(plugin?.icon ?? "")}:${String(plugin?.iconStyle ?? "")}`;
|
|
19545
19811
|
}
|
|
19546
|
-
function
|
|
19547
|
-
const
|
|
19548
|
-
|
|
19812
|
+
function createConnectionRowView(document2, messages, groupable) {
|
|
19813
|
+
const row = document2.createElement("div");
|
|
19814
|
+
row.className = "settings-connection-row";
|
|
19815
|
+
row.setAttribute("role", "row");
|
|
19816
|
+
const identity3 = document2.createElement("div");
|
|
19817
|
+
identity3.className = "settings-connection-row__identity";
|
|
19818
|
+
identity3.setAttribute("role", "cell");
|
|
19819
|
+
let handle = null;
|
|
19820
|
+
if (groupable) {
|
|
19821
|
+
handle = document2.createElement("span");
|
|
19822
|
+
handle.className = "settings-connection-row__handle";
|
|
19823
|
+
handle.setAttribute("aria-hidden", "true");
|
|
19824
|
+
handle.append(createRendererSettingsIcon("grip-vertical", 15));
|
|
19825
|
+
identity3.append(handle);
|
|
19826
|
+
}
|
|
19827
|
+
let iconElement = null;
|
|
19828
|
+
let renderedIconKey = null;
|
|
19829
|
+
const label = document2.createElement("strong");
|
|
19830
|
+
const status = document2.createElement("span");
|
|
19831
|
+
status.className = "settings-connection-row__status";
|
|
19832
|
+
status.setAttribute("role", "cell");
|
|
19833
|
+
const action = document2.createElement("div");
|
|
19834
|
+
action.className = "settings-connection-row__action";
|
|
19835
|
+
action.setAttribute("role", "cell");
|
|
19836
|
+
row.append(identity3, status, action);
|
|
19837
|
+
let currentItem = null;
|
|
19838
|
+
let currentSelect = () => void 0;
|
|
19839
|
+
let currentGroup = null;
|
|
19840
|
+
let installButton = null;
|
|
19841
|
+
let viewErrorButton = null;
|
|
19842
|
+
let versionAvailableBadge = null;
|
|
19843
|
+
let updateButton = null;
|
|
19844
|
+
let groupToggleButton = null;
|
|
19845
|
+
let groupToggleSection = null;
|
|
19846
|
+
row.addEventListener("click", (event) => {
|
|
19847
|
+
const target2 = event.target;
|
|
19848
|
+
if (target2?.closest?.("a")) return;
|
|
19849
|
+
currentSelect();
|
|
19850
|
+
});
|
|
19851
|
+
row.addEventListener("keydown", (event) => {
|
|
19852
|
+
if (event.target?.closest?.("button, a")) return;
|
|
19853
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
19854
|
+
event.preventDefault();
|
|
19855
|
+
currentSelect();
|
|
19856
|
+
});
|
|
19857
|
+
if (groupable) {
|
|
19858
|
+
row.addEventListener("dragstart", (event) => currentGroup?.onDragStart(event));
|
|
19859
|
+
row.addEventListener("dragover", (event) => currentGroup?.onDragOver(event));
|
|
19860
|
+
row.addEventListener("dragleave", (event) => currentGroup?.onDragLeave(event));
|
|
19861
|
+
row.addEventListener("drop", (event) => currentGroup?.onDrop(event));
|
|
19862
|
+
row.addEventListener("dragend", (event) => currentGroup?.onDragEnd(event));
|
|
19863
|
+
}
|
|
19864
|
+
const setSelected = (selected) => {
|
|
19865
|
+
const nextSelected = String(selected);
|
|
19866
|
+
if (row.dataset.connectionSelected !== nextSelected) {
|
|
19867
|
+
row.dataset.connectionSelected = nextSelected;
|
|
19868
|
+
}
|
|
19869
|
+
const nextTabIndex = selected ? 0 : -1;
|
|
19870
|
+
if (row.tabIndex !== nextTabIndex) {
|
|
19871
|
+
row.tabIndex = nextTabIndex;
|
|
19872
|
+
}
|
|
19873
|
+
};
|
|
19549
19874
|
return {
|
|
19550
|
-
|
|
19551
|
-
|
|
19552
|
-
|
|
19553
|
-
|
|
19554
|
-
|
|
19875
|
+
element: row,
|
|
19876
|
+
setSelected,
|
|
19877
|
+
update(item, selected, select, group) {
|
|
19878
|
+
currentItem = item;
|
|
19879
|
+
currentSelect = select;
|
|
19880
|
+
currentGroup = group;
|
|
19881
|
+
if (row.dataset.connectionItem !== item.key) {
|
|
19882
|
+
row.dataset.connectionItem = item.key;
|
|
19883
|
+
}
|
|
19884
|
+
setSelected(selected);
|
|
19885
|
+
const nextIconKey = identityIconSignature(item);
|
|
19886
|
+
if (renderedIconKey !== nextIconKey || !iconElement) {
|
|
19887
|
+
renderedIconKey = nextIconKey;
|
|
19888
|
+
iconElement = createConnectionIdentityIcon(document2, item, 19);
|
|
19889
|
+
reconcileElementChildren(
|
|
19890
|
+
identity3,
|
|
19891
|
+
handle ? [handle, iconElement, label] : [iconElement, label]
|
|
19892
|
+
);
|
|
19893
|
+
}
|
|
19894
|
+
if (handle && group && handle.title !== group.dragHandleTitle) {
|
|
19895
|
+
handle.title = group.dragHandleTitle;
|
|
19896
|
+
}
|
|
19897
|
+
if (label.textContent !== item.name) {
|
|
19898
|
+
label.textContent = item.name;
|
|
19899
|
+
}
|
|
19900
|
+
const tone = connectionStatusTone(item.availability, item.error !== null);
|
|
19901
|
+
if (status.dataset.connectionTone !== tone) {
|
|
19902
|
+
status.dataset.connectionTone = tone;
|
|
19903
|
+
}
|
|
19904
|
+
const statusText = item.error?.code === "authenticationRequired" ? messages.connectionLoginRequired : item.error?.code === "configurationRequired" ? messages.connectionConfigurationRequired : connectionStatusLabel(item.availability, messages, item.error !== null);
|
|
19905
|
+
if (status.textContent !== statusText) {
|
|
19906
|
+
status.textContent = statusText;
|
|
19907
|
+
}
|
|
19908
|
+
const nextActions = [];
|
|
19909
|
+
if (item.agentSnapshot?.availability === "notInstalled" && item.install) {
|
|
19910
|
+
if (!installButton) {
|
|
19911
|
+
const button2 = document2.createElement("button");
|
|
19912
|
+
button2.type = "button";
|
|
19913
|
+
button2.className = "settings-connection-install-link";
|
|
19914
|
+
button2.append(createRendererSettingsIcon("download", 17));
|
|
19915
|
+
button2.addEventListener("click", (event) => {
|
|
19916
|
+
event.stopPropagation();
|
|
19917
|
+
currentSelect();
|
|
19918
|
+
currentItem?.install?.();
|
|
19919
|
+
});
|
|
19920
|
+
installButton = button2;
|
|
19921
|
+
}
|
|
19922
|
+
installButton.disabled = item.availability === "installing" || item.availability === "checking";
|
|
19923
|
+
const installLabel = messages.connectionInstall;
|
|
19924
|
+
const ariaLabel = `${installLabel}: ${item.name}`;
|
|
19925
|
+
if (installButton.getAttribute("aria-label") !== ariaLabel) {
|
|
19926
|
+
installButton.setAttribute("aria-label", ariaLabel);
|
|
19927
|
+
}
|
|
19928
|
+
if (installButton.title !== installLabel) {
|
|
19929
|
+
installButton.title = installLabel;
|
|
19930
|
+
}
|
|
19931
|
+
nextActions.push(installButton);
|
|
19932
|
+
} else if (item.error) {
|
|
19933
|
+
if (!viewErrorButton) {
|
|
19934
|
+
const button2 = document2.createElement("button");
|
|
19935
|
+
button2.type = "button";
|
|
19936
|
+
button2.className = "settings-connection-view-error";
|
|
19937
|
+
button2.textContent = messages.connectionViewError;
|
|
19938
|
+
button2.addEventListener("click", (event) => {
|
|
19939
|
+
event.stopPropagation();
|
|
19940
|
+
currentSelect();
|
|
19941
|
+
});
|
|
19942
|
+
viewErrorButton = button2;
|
|
19943
|
+
}
|
|
19944
|
+
nextActions.push(viewErrorButton);
|
|
19945
|
+
}
|
|
19946
|
+
const version2 = item.version;
|
|
19947
|
+
if (version2?.state?.updateAvailable && !version2.updating) {
|
|
19948
|
+
if (!versionAvailableBadge) {
|
|
19949
|
+
const badge = document2.createElement("span");
|
|
19950
|
+
badge.className = "settings-connection-version-available";
|
|
19951
|
+
badge.textContent = messages.harnessVersionAvailable;
|
|
19952
|
+
versionAvailableBadge = badge;
|
|
19953
|
+
}
|
|
19954
|
+
const badgeTitle = `${messages.harnessVersionCurrent}: ${version2.state.currentVersion ?? "\u2014"}
|
|
19955
|
+
${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages.harnessVersion)}`;
|
|
19956
|
+
if (versionAvailableBadge.title !== badgeTitle) {
|
|
19957
|
+
versionAvailableBadge.title = badgeTitle;
|
|
19958
|
+
}
|
|
19959
|
+
nextActions.push(versionAvailableBadge);
|
|
19960
|
+
}
|
|
19961
|
+
if (version2?.state?.updateAvailable && version2.state.canUpdate) {
|
|
19962
|
+
if (!updateButton) {
|
|
19963
|
+
const button2 = document2.createElement("button");
|
|
19964
|
+
button2.type = "button";
|
|
19965
|
+
button2.className = "settings-connection-install-link";
|
|
19966
|
+
button2.dataset.connectionAction = "update";
|
|
19967
|
+
button2.append(createRendererSettingsIcon("download", 17));
|
|
19968
|
+
button2.addEventListener("click", (event) => {
|
|
19969
|
+
event.stopPropagation();
|
|
19970
|
+
if (button2.disabled) return;
|
|
19971
|
+
void currentItem?.version?.update();
|
|
19972
|
+
currentSelect();
|
|
19973
|
+
});
|
|
19974
|
+
updateButton = button2;
|
|
19975
|
+
}
|
|
19976
|
+
updateButton.disabled = version2.updating;
|
|
19977
|
+
if (updateButton.title !== messages.harnessVersionUpdate) {
|
|
19978
|
+
updateButton.title = messages.harnessVersionUpdate;
|
|
19979
|
+
}
|
|
19980
|
+
const updateAriaLabel = `${messages.harnessVersionUpdate}: ${item.name}`;
|
|
19981
|
+
if (updateButton.getAttribute("aria-label") !== updateAriaLabel) {
|
|
19982
|
+
updateButton.setAttribute("aria-label", updateAriaLabel);
|
|
19983
|
+
}
|
|
19984
|
+
nextActions.push(updateButton);
|
|
19985
|
+
}
|
|
19986
|
+
if (group) {
|
|
19987
|
+
if (!groupToggleButton) {
|
|
19988
|
+
const button2 = document2.createElement("button");
|
|
19989
|
+
button2.type = "button";
|
|
19990
|
+
button2.className = "settings-connection-row__group-toggle";
|
|
19991
|
+
button2.addEventListener("click", (event) => {
|
|
19992
|
+
event.stopPropagation();
|
|
19993
|
+
currentGroup?.toggleSection();
|
|
19994
|
+
});
|
|
19995
|
+
groupToggleButton = button2;
|
|
19996
|
+
}
|
|
19997
|
+
groupToggleButton.disabled = group.disabled;
|
|
19998
|
+
if (groupToggleButton.title !== group.moveLabel) {
|
|
19999
|
+
groupToggleButton.title = group.moveLabel;
|
|
20000
|
+
}
|
|
20001
|
+
if (groupToggleButton.getAttribute("aria-label") !== group.moveLabel) {
|
|
20002
|
+
groupToggleButton.setAttribute("aria-label", group.moveLabel);
|
|
20003
|
+
}
|
|
20004
|
+
if (groupToggleSection !== group.section) {
|
|
20005
|
+
groupToggleSection = group.section;
|
|
20006
|
+
groupToggleButton.replaceChildren(
|
|
20007
|
+
createRendererSettingsIcon(
|
|
20008
|
+
group.section === "main" ? "chevron-down" : "chevron-up",
|
|
20009
|
+
15
|
|
20010
|
+
)
|
|
20011
|
+
);
|
|
20012
|
+
}
|
|
20013
|
+
nextActions.push(groupToggleButton);
|
|
20014
|
+
}
|
|
20015
|
+
reconcileElementChildren(action, nextActions);
|
|
20016
|
+
if (group) {
|
|
20017
|
+
row.draggable = !group.disabled;
|
|
20018
|
+
if (row.dataset.connectionGroupSection !== group.section) {
|
|
20019
|
+
row.dataset.connectionGroupSection = group.section;
|
|
20020
|
+
}
|
|
20021
|
+
}
|
|
20022
|
+
}
|
|
19555
20023
|
};
|
|
19556
20024
|
}
|
|
19557
20025
|
|
|
19558
|
-
// src/settings/
|
|
19559
|
-
|
|
19560
|
-
|
|
19561
|
-
|
|
19562
|
-
|
|
19563
|
-
panel.className = "settings-harness-installation";
|
|
19564
|
-
const paragraph = (text) => {
|
|
19565
|
-
const p = document2.createElement("p");
|
|
19566
|
-
p.textContent = text;
|
|
19567
|
-
panel.append(p);
|
|
19568
|
-
};
|
|
19569
|
-
if (hostId2 !== "local") {
|
|
19570
|
-
paragraph(zh ? "\u8BF7\u5728\u8FDC\u7A0B Host \u4E0A\u5B89\u88C5\u3002" : "Install on the remote Host.");
|
|
19571
|
-
}
|
|
19572
|
-
if (guide.before) paragraph(guide.before);
|
|
19573
|
-
const install2 = installation && guide.commands.length > 0 ? document2.createElement("button") : null;
|
|
19574
|
-
if (install2 && installation) {
|
|
19575
|
-
install2.type = "button";
|
|
19576
|
-
install2.className = "settings-command-button";
|
|
19577
|
-
install2.dataset.connectionAction = "install";
|
|
19578
|
-
install2.disabled = installation.status !== "idle";
|
|
19579
|
-
install2.textContent = installation.status === "installing" ? messages.connectionStatusInstalling : installation.status === "checking" ? messages.connectionStatusChecking : zh ? "\u4E00\u952E\u5B89\u88C5" : "Install automatically";
|
|
19580
|
-
install2.addEventListener("click", () => {
|
|
19581
|
-
if (install2.disabled) return;
|
|
19582
|
-
install2.disabled = true;
|
|
19583
|
-
install2.textContent = messages.connectionStatusInstalling;
|
|
19584
|
-
installation.run();
|
|
19585
|
-
});
|
|
19586
|
-
if (guide.commands.length > 1) panel.append(install2);
|
|
19587
|
-
}
|
|
19588
|
-
for (const { terminal, command } of guide.commands) {
|
|
19589
|
-
const block = document2.createElement("div");
|
|
19590
|
-
block.className = "settings-harness-installation-command";
|
|
19591
|
-
const label = document2.createElement("strong");
|
|
19592
|
-
label.textContent = terminal;
|
|
19593
|
-
const pre = document2.createElement("pre");
|
|
19594
|
-
const code = document2.createElement("code");
|
|
19595
|
-
code.textContent = command;
|
|
19596
|
-
pre.append(code);
|
|
19597
|
-
const button2 = document2.createElement("button");
|
|
19598
|
-
button2.type = "button";
|
|
19599
|
-
button2.className = "settings-command-button settings-command-button--secondary";
|
|
19600
|
-
button2.dataset.connectionAction = "copy-install";
|
|
19601
|
-
const copyLabel = zh ? "\u590D\u5236\u547D\u4EE4" : "Copy command";
|
|
19602
|
-
button2.setAttribute("aria-label", `${copyLabel}: ${terminal}`);
|
|
19603
|
-
button2.append(createRendererSettingsIcon("copy", 16), copyLabel);
|
|
19604
|
-
button2.addEventListener("click", () => copy(button2, command, copyLabel));
|
|
19605
|
-
const actions = document2.createElement("div");
|
|
19606
|
-
actions.className = "settings-harness-installation-actions";
|
|
19607
|
-
if (install2 && guide.commands.length === 1) actions.append(install2);
|
|
19608
|
-
actions.append(button2);
|
|
19609
|
-
block.append(label, pre, actions);
|
|
19610
|
-
panel.append(block);
|
|
20026
|
+
// src/settings/connection-updates.ts
|
|
20027
|
+
var sharedBatchStores = /* @__PURE__ */ new WeakMap();
|
|
20028
|
+
function getBatchStore(diagnostics) {
|
|
20029
|
+
if (!diagnostics) {
|
|
20030
|
+
return { batches: /* @__PURE__ */ new Map(), listeners: /* @__PURE__ */ new Set() };
|
|
19611
20031
|
}
|
|
19612
|
-
|
|
19613
|
-
|
|
19614
|
-
|
|
19615
|
-
|
|
19616
|
-
link.target = "_blank";
|
|
19617
|
-
link.rel = "noopener noreferrer";
|
|
19618
|
-
link.textContent = zh ? "\u4E0B\u8F7D" : "Download";
|
|
19619
|
-
link.setAttribute("aria-label", `${link.textContent} ${download2.label}`);
|
|
19620
|
-
panel.append(link);
|
|
20032
|
+
let store = sharedBatchStores.get(diagnostics);
|
|
20033
|
+
if (!store) {
|
|
20034
|
+
store = { batches: /* @__PURE__ */ new Map(), listeners: /* @__PURE__ */ new Set() };
|
|
20035
|
+
sharedBatchStores.set(diagnostics, store);
|
|
19621
20036
|
}
|
|
19622
|
-
|
|
19623
|
-
|
|
19624
|
-
|
|
19625
|
-
|
|
19626
|
-
|
|
19627
|
-
|
|
19628
|
-
|
|
19629
|
-
|
|
20037
|
+
return store;
|
|
20038
|
+
}
|
|
20039
|
+
function createConnectionUpdates(document2, messages, signal, onChange, diagnostics = null) {
|
|
20040
|
+
const store = getBatchStore(diagnostics);
|
|
20041
|
+
const notify2 = () => {
|
|
20042
|
+
for (const listener of [...store.listeners]) listener();
|
|
20043
|
+
};
|
|
20044
|
+
if (!signal.aborted) {
|
|
20045
|
+
const listener = () => {
|
|
20046
|
+
if (!signal.aborted) onChange();
|
|
20047
|
+
};
|
|
20048
|
+
store.listeners.add(listener);
|
|
20049
|
+
signal.addEventListener(
|
|
20050
|
+
"abort",
|
|
20051
|
+
() => {
|
|
20052
|
+
store.listeners.delete(listener);
|
|
20053
|
+
},
|
|
20054
|
+
{ once: true }
|
|
20055
|
+
);
|
|
19630
20056
|
}
|
|
19631
|
-
|
|
20057
|
+
const eligible = (panels) => panels.filter((panel) => panel.state?.updateAvailable && panel.state.canUpdate);
|
|
20058
|
+
const start = async (hostId2, panels) => {
|
|
20059
|
+
if (signal.aborted || store.batches.get(hostId2)?.running) return;
|
|
20060
|
+
const targets = eligible(panels);
|
|
20061
|
+
if (!targets.length) return;
|
|
20062
|
+
const batch = { running: true, total: targets.length, succeeded: 0, failed: 0 };
|
|
20063
|
+
store.batches.set(hostId2, batch);
|
|
20064
|
+
notify2();
|
|
20065
|
+
await Promise.all(
|
|
20066
|
+
targets.map(async (panel) => {
|
|
20067
|
+
try {
|
|
20068
|
+
if (await panel.update()) batch.succeeded++;
|
|
20069
|
+
else batch.failed++;
|
|
20070
|
+
} catch {
|
|
20071
|
+
batch.failed++;
|
|
20072
|
+
}
|
|
20073
|
+
notify2();
|
|
20074
|
+
})
|
|
20075
|
+
);
|
|
20076
|
+
batch.running = false;
|
|
20077
|
+
notify2();
|
|
20078
|
+
};
|
|
20079
|
+
return {
|
|
20080
|
+
createControls(hostId2, panels) {
|
|
20081
|
+
let currentHostId = hostId2;
|
|
20082
|
+
let currentPanels = panels;
|
|
20083
|
+
let renderedLabel = null;
|
|
20084
|
+
const button2 = document2.createElement("button");
|
|
20085
|
+
button2.type = "button";
|
|
20086
|
+
button2.className = "settings-command-button settings-command-button--secondary settings-connection-update-all";
|
|
20087
|
+
button2.dataset.connectionAction = "update-all";
|
|
20088
|
+
button2.title = messages.harnessUpdateAllDescription;
|
|
20089
|
+
button2.addEventListener("click", () => {
|
|
20090
|
+
if (!button2.disabled) void start(currentHostId, currentPanels);
|
|
20091
|
+
});
|
|
20092
|
+
const result = document2.createElement("p");
|
|
20093
|
+
result.className = "settings-connection-update-result";
|
|
20094
|
+
result.setAttribute("role", "status");
|
|
20095
|
+
const update = (nextHostId, nextPanels) => {
|
|
20096
|
+
currentHostId = nextHostId;
|
|
20097
|
+
currentPanels = nextPanels;
|
|
20098
|
+
const batch = store.batches.get(nextHostId);
|
|
20099
|
+
const count3 = eligible(nextPanels).length;
|
|
20100
|
+
button2.disabled = signal.aborted || Boolean(batch?.running) || !count3;
|
|
20101
|
+
const label = batch?.running ? `${messages.harnessUpdateAllProgress} ${batch.succeeded + batch.failed}/${batch.total}` : count3 ? `${messages.harnessUpdateAll} (${count3})` : messages.harnessUpdateAll;
|
|
20102
|
+
if (renderedLabel !== label) {
|
|
20103
|
+
renderedLabel = label;
|
|
20104
|
+
button2.replaceChildren(createRendererSettingsIcon("download", 15), label);
|
|
20105
|
+
}
|
|
20106
|
+
const hidden = !batch || batch.running;
|
|
20107
|
+
result.hidden = hidden;
|
|
20108
|
+
const resultText = batch && !batch.running ? messages.harnessUpdateAllResult.replace("{succeeded}", String(batch.succeeded)).replace("{failed}", String(batch.failed)) : "";
|
|
20109
|
+
if (result.textContent !== resultText) {
|
|
20110
|
+
result.textContent = resultText;
|
|
20111
|
+
}
|
|
20112
|
+
};
|
|
20113
|
+
update(hostId2, panels);
|
|
20114
|
+
return { button: button2, result, update };
|
|
20115
|
+
}
|
|
20116
|
+
};
|
|
19632
20117
|
}
|
|
19633
20118
|
|
|
19634
|
-
// src/settings/harness-
|
|
19635
|
-
function
|
|
19636
|
-
return typeof error51 === "object" && error51 !== null && "
|
|
19637
|
-
}
|
|
19638
|
-
function unknownInstallOutcome(message2) {
|
|
19639
|
-
return /outcome is unknown|do not retry automatically|did not answer in time/i.test(message2);
|
|
20119
|
+
// src/settings/harness-version-panel.ts
|
|
20120
|
+
function isUnsupportedInstallationError(error51) {
|
|
20121
|
+
return typeof error51 === "object" && error51 !== null && "code" in error51 && (error51.code === -32601 || error51.code === -32078);
|
|
19640
20122
|
}
|
|
19641
|
-
|
|
19642
|
-
|
|
19643
|
-
|
|
20123
|
+
function createHarnessVersionSession(client, options) {
|
|
20124
|
+
let state;
|
|
20125
|
+
let statusKind = "checking";
|
|
20126
|
+
let checkPromise = null;
|
|
20127
|
+
let updatePromise = null;
|
|
19644
20128
|
const listeners = /* @__PURE__ */ new Set();
|
|
19645
|
-
const
|
|
19646
|
-
const notify2 = () =>
|
|
20129
|
+
const signal = options?.signal;
|
|
20130
|
+
const notify2 = (pageChange) => {
|
|
20131
|
+
if (signal?.aborted) return;
|
|
20132
|
+
for (const listener of [...listeners]) listener(pageChange);
|
|
20133
|
+
};
|
|
20134
|
+
const check2 = () => {
|
|
20135
|
+
if (signal?.aborted || updatePromise) return Promise.resolve();
|
|
20136
|
+
if (checkPromise) return checkPromise;
|
|
20137
|
+
statusKind = "checking";
|
|
20138
|
+
notify2(false);
|
|
20139
|
+
checkPromise = (async () => {
|
|
20140
|
+
try {
|
|
20141
|
+
const result = await client.run("check");
|
|
20142
|
+
if (signal?.aborted || updatePromise) return;
|
|
20143
|
+
state = result;
|
|
20144
|
+
statusKind = "idle";
|
|
20145
|
+
} catch (error51) {
|
|
20146
|
+
if (signal?.aborted || updatePromise) return;
|
|
20147
|
+
statusKind = isUnsupportedInstallationError(error51) ? "unsupported" : "failed";
|
|
20148
|
+
if (state) state = { ...state, canUpdate: false };
|
|
20149
|
+
} finally {
|
|
20150
|
+
checkPromise = null;
|
|
20151
|
+
if (!signal?.aborted && !updatePromise) {
|
|
20152
|
+
notify2(true);
|
|
20153
|
+
}
|
|
20154
|
+
}
|
|
20155
|
+
})();
|
|
20156
|
+
return checkPromise;
|
|
20157
|
+
};
|
|
20158
|
+
const update = () => {
|
|
20159
|
+
if (updatePromise) return updatePromise;
|
|
20160
|
+
updatePromise = (async () => {
|
|
20161
|
+
if (signal?.aborted) return false;
|
|
20162
|
+
if (checkPromise) await checkPromise;
|
|
20163
|
+
if (signal?.aborted || statusKind === "unsupported" || !state?.canUpdate || !state.updateAvailable) {
|
|
20164
|
+
return false;
|
|
20165
|
+
}
|
|
20166
|
+
statusKind = "updating";
|
|
20167
|
+
notify2(true);
|
|
20168
|
+
try {
|
|
20169
|
+
const result = await client.run("update");
|
|
20170
|
+
if (signal?.aborted) return false;
|
|
20171
|
+
state = result;
|
|
20172
|
+
statusKind = !result.canUpdate ? "updated" : result.updateAvailable ? "failed" : "updated";
|
|
20173
|
+
return result.canUpdate && !result.updateAvailable;
|
|
20174
|
+
} catch (error51) {
|
|
20175
|
+
if (signal?.aborted) return false;
|
|
20176
|
+
statusKind = isUnsupportedInstallationError(error51) ? "unsupported" : "failed";
|
|
20177
|
+
if (state) state = { ...state, canUpdate: false };
|
|
20178
|
+
return false;
|
|
20179
|
+
} finally {
|
|
20180
|
+
updatePromise = null;
|
|
20181
|
+
if (!signal?.aborted) {
|
|
20182
|
+
notify2(true);
|
|
20183
|
+
}
|
|
20184
|
+
}
|
|
20185
|
+
})();
|
|
20186
|
+
return updatePromise;
|
|
20187
|
+
};
|
|
19647
20188
|
return {
|
|
19648
|
-
get
|
|
19649
|
-
|
|
19650
|
-
|
|
19651
|
-
|
|
20189
|
+
get state() {
|
|
20190
|
+
return state;
|
|
20191
|
+
},
|
|
20192
|
+
get statusKind() {
|
|
20193
|
+
return statusKind;
|
|
20194
|
+
},
|
|
20195
|
+
get updating() {
|
|
20196
|
+
return statusKind === "updating";
|
|
20197
|
+
},
|
|
20198
|
+
prepareMount() {
|
|
20199
|
+
if (updatePromise || checkPromise) return false;
|
|
20200
|
+
statusKind = "checking";
|
|
20201
|
+
return true;
|
|
19652
20202
|
},
|
|
20203
|
+
check: check2,
|
|
20204
|
+
update,
|
|
19653
20205
|
subscribe(listener) {
|
|
19654
20206
|
listeners.add(listener);
|
|
19655
20207
|
return () => {
|
|
19656
20208
|
listeners.delete(listener);
|
|
19657
20209
|
};
|
|
19658
|
-
},
|
|
19659
|
-
async install(host, agent) {
|
|
19660
|
-
const id = key(host, agent);
|
|
19661
|
-
const previous = states2.get(id);
|
|
19662
|
-
if (!diagnostics.installation || previous && previous.status !== "error") return;
|
|
19663
|
-
states2.set(id, { status: "installing" });
|
|
19664
|
-
notify2();
|
|
19665
|
-
let failure;
|
|
19666
|
-
try {
|
|
19667
|
-
await diagnostics.installation(host, agent, "install");
|
|
19668
|
-
states2.set(id, { status: "checking" });
|
|
19669
|
-
notify2();
|
|
19670
|
-
} catch (error51) {
|
|
19671
|
-
failure = errorMessage(error51);
|
|
19672
|
-
}
|
|
19673
|
-
try {
|
|
19674
|
-
await diagnostics.refresh(host);
|
|
19675
|
-
const refreshed = diagnostics.snapshot().hosts.find((candidate) => candidate.hostId === host)?.agents.find((candidate) => candidate.agent === agent);
|
|
19676
|
-
if (refreshed?.availability === "ready") failure = void 0;
|
|
19677
|
-
else if (failure && unknownInstallOutcome(failure) && refreshed && refreshed.availability !== "notInstalled") {
|
|
19678
|
-
failure = void 0;
|
|
19679
|
-
}
|
|
19680
|
-
} catch (error51) {
|
|
19681
|
-
failure ??= errorMessage(error51);
|
|
19682
|
-
}
|
|
19683
|
-
if (failure) states2.set(id, { status: "error", error: failure });
|
|
19684
|
-
else states2.delete(id);
|
|
19685
|
-
notify2();
|
|
19686
20210
|
}
|
|
19687
20211
|
};
|
|
19688
20212
|
}
|
|
19689
|
-
function
|
|
19690
|
-
|
|
19691
|
-
|
|
19692
|
-
store = createStore(diagnostics);
|
|
19693
|
-
stores.set(diagnostics, store);
|
|
19694
|
-
}
|
|
19695
|
-
return store;
|
|
19696
|
-
}
|
|
19697
|
-
|
|
19698
|
-
// src/settings/harness-version-messages.ts
|
|
19699
|
-
var harnessVersionEnglish = Object.freeze({
|
|
19700
|
-
locale: "en",
|
|
19701
|
-
unknown: "Unknown",
|
|
19702
|
-
trackingBranch: "Tracking branch (new commits)",
|
|
19703
|
-
notes: Object.freeze({
|
|
19704
|
-
"original-installer": "Use the original installer, package manager, or launcher to update this installation."
|
|
19705
|
-
})
|
|
19706
|
-
});
|
|
19707
|
-
var harnessVersionChinese = Object.freeze({
|
|
19708
|
-
locale: "zh-CN",
|
|
19709
|
-
unknown: "\u672A\u77E5",
|
|
19710
|
-
trackingBranch: "\u8DDF\u8E2A\u5206\u652F\uFF08\u6709\u65B0\u63D0\u4EA4\uFF09",
|
|
19711
|
-
notes: Object.freeze({
|
|
19712
|
-
"original-installer": "\u8BF7\u4F7F\u7528\u539F\u5B89\u88C5\u7A0B\u5E8F\u3001\u5305\u7BA1\u7406\u5668\u6216\u542F\u52A8\u5668\u66F4\u65B0\u6B64\u5B89\u88C5\u3002"
|
|
19713
|
-
})
|
|
19714
|
-
});
|
|
19715
|
-
function harnessVersionLabel(state, messages) {
|
|
19716
|
-
if (!state) return "\u2014";
|
|
19717
|
-
if (state.latestVersionKind === "unknown" || state.latestVersion === "Unknown")
|
|
19718
|
-
return messages.unknown;
|
|
19719
|
-
if (state.latestVersionKind === "tracking-branch" || state.latestVersion === "Tracking branch (new commits)")
|
|
19720
|
-
return messages.trackingBranch;
|
|
19721
|
-
return state.latestVersion;
|
|
19722
|
-
}
|
|
19723
|
-
function harnessVersionNote(state, messages) {
|
|
19724
|
-
if (state?.notice) return localizeHarnessText(state.notice, messages.locale);
|
|
19725
|
-
const code = state?.messageCode;
|
|
19726
|
-
return code && Object.hasOwn(messages.notes, code) ? messages.notes[code] : void 0;
|
|
19727
|
-
}
|
|
19728
|
-
|
|
19729
|
-
// src/settings/harness-version-panel.ts
|
|
19730
|
-
function createHarnessVersionPanel(document2, messages, signal, agent, client, onChange = () => void 0) {
|
|
20213
|
+
function createHarnessVersionPanel(document2, messages, signal, agent, client, onChange = () => void 0, sharedSession) {
|
|
20214
|
+
const session = sharedSession ?? createHarnessVersionSession(client, { signal });
|
|
20215
|
+
const shouldScheduleCheck = session.prepareMount();
|
|
19731
20216
|
const panel = document2.createElement("section");
|
|
19732
20217
|
panel.className = "settings-harness-version";
|
|
19733
20218
|
panel.dataset.harnessVersion = agent;
|
|
@@ -19751,15 +20236,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19751
20236
|
note.textContent = messages.harnessVersionNote;
|
|
19752
20237
|
actions.append(update);
|
|
19753
20238
|
panel.append(heading, versions, status, actions, note);
|
|
19754
|
-
let state;
|
|
19755
|
-
let busy = false;
|
|
19756
|
-
let updating = false;
|
|
19757
|
-
let unsupported = false;
|
|
19758
|
-
let updatePromise = null;
|
|
19759
20239
|
const render = () => {
|
|
20240
|
+
const state = session.state;
|
|
20241
|
+
const statusKind = session.statusKind;
|
|
20242
|
+
const busy = statusKind === "checking" || statusKind === "updating";
|
|
19760
20243
|
heading.textContent = state?.versionKind === "application" ? messages.harnessVersionApplicationTitle : messages.harnessVersionTitle;
|
|
19761
20244
|
current.textContent = `${messages.harnessVersionCurrent}: ${state?.currentVersion ?? "\u2014"}`;
|
|
19762
20245
|
latest.textContent = `${messages.harnessVersionLatest}: ${harnessVersionLabel(state, messages.harnessVersion)}`;
|
|
20246
|
+
status.textContent = statusKind === "checking" ? messages.harnessVersionChecking : statusKind === "updating" ? messages.harnessVersionUpdating : statusKind === "unsupported" ? messages.harnessVersionUnsupported : statusKind === "failed" ? messages.harnessVersionFailed : statusKind === "updated" ? !state?.canUpdate ? messages.harnessVersionManual : messages.harnessVersionUpdated : state && !state.canUpdate ? messages.harnessVersionManual : "";
|
|
19763
20247
|
update.disabled = busy || signal.aborted || !state?.canUpdate || !state.updateAvailable;
|
|
19764
20248
|
const manualUrl = !state?.canUpdate && state?.updateAvailable ? state.manualUpdateUrl : void 0;
|
|
19765
20249
|
actions.replaceChildren(update);
|
|
@@ -19778,99 +20262,92 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19778
20262
|
const detail = harnessVersionNote(state, messages.harnessVersion);
|
|
19779
20263
|
note.textContent = detail ? !state?.canUpdate ? detail : `${detail} ${messages.harnessVersionNote}` : messages.harnessVersionNote;
|
|
19780
20264
|
};
|
|
19781
|
-
|
|
19782
|
-
if (
|
|
19783
|
-
|
|
19784
|
-
|
|
19785
|
-
|
|
19786
|
-
onChange();
|
|
19787
|
-
status.textContent = action === "check" ? messages.harnessVersionChecking : messages.harnessVersionUpdating;
|
|
20265
|
+
update.addEventListener("click", () => {
|
|
20266
|
+
if (!signal.aborted) void session.update();
|
|
20267
|
+
});
|
|
20268
|
+
const unsubscribe = session.subscribe((pageChange) => {
|
|
20269
|
+
if (signal.aborted) return;
|
|
19788
20270
|
render();
|
|
19789
|
-
|
|
19790
|
-
|
|
19791
|
-
if (signal.aborted) return false;
|
|
19792
|
-
state = result;
|
|
19793
|
-
status.textContent = !result.canUpdate ? messages.harnessVersionManual : action === "update" ? result.updateAvailable ? messages.harnessVersionFailed : messages.harnessVersionUpdated : "";
|
|
19794
|
-
return result.canUpdate && !result.updateAvailable;
|
|
19795
|
-
} catch (error51) {
|
|
19796
|
-
if (signal.aborted) return false;
|
|
19797
|
-
unsupported = typeof error51 === "object" && error51 !== null && "code" in error51 && (error51.code === -32601 || error51.code === -32078);
|
|
19798
|
-
status.textContent = unsupported ? messages.harnessVersionUnsupported : messages.harnessVersionFailed;
|
|
19799
|
-
if (state) state = { ...state, canUpdate: false };
|
|
19800
|
-
return false;
|
|
19801
|
-
} finally {
|
|
19802
|
-
busy = false;
|
|
19803
|
-
updating = false;
|
|
19804
|
-
if (!signal.aborted) {
|
|
19805
|
-
render();
|
|
19806
|
-
onChange();
|
|
19807
|
-
}
|
|
19808
|
-
}
|
|
19809
|
-
};
|
|
19810
|
-
const updateVersion = () => {
|
|
19811
|
-
updatePromise ??= run("update").finally(() => {
|
|
19812
|
-
updatePromise = null;
|
|
19813
|
-
});
|
|
19814
|
-
return updatePromise;
|
|
19815
|
-
};
|
|
19816
|
-
update.addEventListener("click", () => void updateVersion());
|
|
20271
|
+
if (pageChange) onChange();
|
|
20272
|
+
});
|
|
19817
20273
|
const owner = document2.defaultView;
|
|
19818
20274
|
let checkFrame = null;
|
|
19819
20275
|
let checkTimer = null;
|
|
19820
20276
|
signal.addEventListener(
|
|
19821
20277
|
"abort",
|
|
19822
20278
|
() => {
|
|
20279
|
+
unsubscribe();
|
|
19823
20280
|
if (checkFrame !== null) owner?.cancelAnimationFrame(checkFrame);
|
|
19824
20281
|
if (checkTimer !== null) owner?.clearTimeout(checkTimer);
|
|
19825
20282
|
render();
|
|
19826
20283
|
},
|
|
19827
20284
|
{ once: true }
|
|
19828
20285
|
);
|
|
19829
|
-
status.textContent = messages.harnessVersionChecking;
|
|
19830
20286
|
render();
|
|
19831
|
-
if (!signal.aborted
|
|
19832
|
-
|
|
19833
|
-
checkFrame =
|
|
19834
|
-
|
|
19835
|
-
|
|
19836
|
-
checkTimer =
|
|
19837
|
-
|
|
19838
|
-
|
|
19839
|
-
|
|
19840
|
-
|
|
19841
|
-
|
|
20287
|
+
if (shouldScheduleCheck && !signal.aborted) {
|
|
20288
|
+
if (owner?.requestAnimationFrame) {
|
|
20289
|
+
checkFrame = owner.requestAnimationFrame(() => {
|
|
20290
|
+
checkFrame = null;
|
|
20291
|
+
if (signal.aborted) return;
|
|
20292
|
+
checkTimer = owner.setTimeout(() => {
|
|
20293
|
+
checkTimer = null;
|
|
20294
|
+
if (!signal.aborted) void session.check();
|
|
20295
|
+
}, 0);
|
|
20296
|
+
});
|
|
20297
|
+
} else {
|
|
20298
|
+
void session.check();
|
|
20299
|
+
}
|
|
19842
20300
|
}
|
|
19843
20301
|
return {
|
|
19844
20302
|
element: panel,
|
|
19845
20303
|
get state() {
|
|
19846
|
-
return state;
|
|
20304
|
+
return session.state;
|
|
19847
20305
|
},
|
|
19848
20306
|
get updating() {
|
|
19849
|
-
return updating;
|
|
20307
|
+
return session.updating;
|
|
19850
20308
|
},
|
|
19851
|
-
update:
|
|
20309
|
+
update: () => signal.aborted ? Promise.resolve(false) : session.update()
|
|
19852
20310
|
};
|
|
19853
20311
|
}
|
|
19854
20312
|
|
|
19855
20313
|
// src/settings/connection-versions.ts
|
|
20314
|
+
var sessionStores = /* @__PURE__ */ new WeakMap();
|
|
20315
|
+
function getSessionStore(diagnostics) {
|
|
20316
|
+
let store = sessionStores.get(diagnostics);
|
|
20317
|
+
if (!store) {
|
|
20318
|
+
store = /* @__PURE__ */ new Map();
|
|
20319
|
+
sessionStores.set(diagnostics, store);
|
|
20320
|
+
}
|
|
20321
|
+
return store;
|
|
20322
|
+
}
|
|
19856
20323
|
function createConnectionVersions(document2, messages, signal, diagnostics, onChange) {
|
|
19857
20324
|
const panels = /* @__PURE__ */ new Map();
|
|
19858
20325
|
const installation = diagnostics?.installation?.bind(diagnostics);
|
|
20326
|
+
const sessions = diagnostics ? getSessionStore(diagnostics) : null;
|
|
20327
|
+
const sessionKey = (hostId2, agent) => JSON.stringify([hostId2, agent]);
|
|
19859
20328
|
return {
|
|
20329
|
+
isUpdating(hostId2, agent) {
|
|
20330
|
+
return Boolean(sessions?.get(sessionKey(hostId2, agent))?.updating);
|
|
20331
|
+
},
|
|
19860
20332
|
get(hostId2, agent) {
|
|
19861
20333
|
if (!installation || signal.aborted) return void 0;
|
|
19862
|
-
const key =
|
|
20334
|
+
const key = sessionKey(hostId2, agent);
|
|
19863
20335
|
let panel = panels.get(key);
|
|
19864
20336
|
if (!panel) {
|
|
20337
|
+
const run = (action) => installation(hostId2, agent, action);
|
|
20338
|
+
let session = sessions?.get(key);
|
|
20339
|
+
if (!session) {
|
|
20340
|
+
session = createHarnessVersionSession({ run });
|
|
20341
|
+
sessions?.set(key, session);
|
|
20342
|
+
}
|
|
19865
20343
|
panel = createHarnessVersionPanel(
|
|
19866
20344
|
document2,
|
|
19867
20345
|
messages,
|
|
19868
20346
|
signal,
|
|
19869
20347
|
agent,
|
|
19870
|
-
{
|
|
19871
|
-
|
|
19872
|
-
|
|
19873
|
-
onChange
|
|
20348
|
+
{ run },
|
|
20349
|
+
onChange,
|
|
20350
|
+
session
|
|
19874
20351
|
);
|
|
19875
20352
|
panels.set(key, panel);
|
|
19876
20353
|
}
|
|
@@ -19879,79 +20356,242 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19879
20356
|
};
|
|
19880
20357
|
}
|
|
19881
20358
|
|
|
19882
|
-
// src/settings/
|
|
19883
|
-
function
|
|
19884
|
-
|
|
19885
|
-
|
|
19886
|
-
|
|
19887
|
-
|
|
19888
|
-
|
|
19889
|
-
|
|
19890
|
-
|
|
19891
|
-
|
|
19892
|
-
|
|
19893
|
-
|
|
19894
|
-
|
|
19895
|
-
try {
|
|
19896
|
-
if (await panel.update()) batch.succeeded++;
|
|
19897
|
-
else batch.failed++;
|
|
19898
|
-
} catch {
|
|
19899
|
-
batch.failed++;
|
|
19900
|
-
}
|
|
19901
|
-
if (!signal.aborted) onChange();
|
|
19902
|
-
})
|
|
19903
|
-
);
|
|
19904
|
-
batch.running = false;
|
|
19905
|
-
if (!signal.aborted) onChange();
|
|
19906
|
-
};
|
|
20359
|
+
// src/settings/harness-install-store.ts
|
|
20360
|
+
function errorMessage(error51) {
|
|
20361
|
+
return typeof error51 === "object" && error51 !== null && "message" in error51 && typeof error51.message === "string" ? error51.message.slice(0, 2048) : "Could not install the Harness. Check the official installation guide and retry.";
|
|
20362
|
+
}
|
|
20363
|
+
function unknownInstallOutcome(message2) {
|
|
20364
|
+
return /outcome is unknown|do not retry automatically|did not answer in time/i.test(message2);
|
|
20365
|
+
}
|
|
20366
|
+
var stores = /* @__PURE__ */ new WeakMap();
|
|
20367
|
+
function createStore(diagnostics) {
|
|
20368
|
+
const states2 = /* @__PURE__ */ new Map();
|
|
20369
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
20370
|
+
const key = (host, agent) => JSON.stringify([host, agent]);
|
|
20371
|
+
const notify2 = () => listeners.forEach((listener) => listener());
|
|
19907
20372
|
return {
|
|
19908
|
-
|
|
19909
|
-
|
|
19910
|
-
const
|
|
19911
|
-
|
|
19912
|
-
|
|
19913
|
-
|
|
19914
|
-
|
|
19915
|
-
|
|
19916
|
-
|
|
19917
|
-
|
|
19918
|
-
|
|
19919
|
-
|
|
19920
|
-
|
|
19921
|
-
|
|
19922
|
-
|
|
19923
|
-
|
|
19924
|
-
|
|
19925
|
-
|
|
19926
|
-
|
|
19927
|
-
|
|
20373
|
+
get: (host, agent) => states2.get(key(host, agent)),
|
|
20374
|
+
clearErrors() {
|
|
20375
|
+
for (const [id, state] of states2) if (state.status === "error") states2.delete(id);
|
|
20376
|
+
notify2();
|
|
20377
|
+
},
|
|
20378
|
+
subscribe(listener) {
|
|
20379
|
+
listeners.add(listener);
|
|
20380
|
+
return () => {
|
|
20381
|
+
listeners.delete(listener);
|
|
20382
|
+
};
|
|
20383
|
+
},
|
|
20384
|
+
async install(host, agent) {
|
|
20385
|
+
const id = key(host, agent);
|
|
20386
|
+
const previous = states2.get(id);
|
|
20387
|
+
if (!diagnostics.installation || previous && previous.status !== "error") return;
|
|
20388
|
+
states2.set(id, { status: "installing" });
|
|
20389
|
+
notify2();
|
|
20390
|
+
let failure;
|
|
20391
|
+
try {
|
|
20392
|
+
await diagnostics.installation(host, agent, "install");
|
|
20393
|
+
states2.set(id, { status: "checking" });
|
|
20394
|
+
notify2();
|
|
20395
|
+
} catch (error51) {
|
|
20396
|
+
failure = errorMessage(error51);
|
|
19928
20397
|
}
|
|
19929
|
-
|
|
20398
|
+
try {
|
|
20399
|
+
await diagnostics.refresh(host);
|
|
20400
|
+
const refreshed = diagnostics.snapshot().hosts.find((candidate) => candidate.hostId === host)?.agents.find((candidate) => candidate.agent === agent);
|
|
20401
|
+
if (refreshed?.availability === "ready") failure = void 0;
|
|
20402
|
+
else if (failure && unknownInstallOutcome(failure) && refreshed && refreshed.availability !== "notInstalled") {
|
|
20403
|
+
failure = void 0;
|
|
20404
|
+
}
|
|
20405
|
+
} catch (error51) {
|
|
20406
|
+
failure ??= errorMessage(error51);
|
|
20407
|
+
}
|
|
20408
|
+
if (failure) states2.set(id, { status: "error", error: failure });
|
|
20409
|
+
else states2.delete(id);
|
|
20410
|
+
notify2();
|
|
19930
20411
|
}
|
|
19931
20412
|
};
|
|
19932
20413
|
}
|
|
20414
|
+
function harnessInstallStore(diagnostics) {
|
|
20415
|
+
let store = stores.get(diagnostics);
|
|
20416
|
+
if (!store) {
|
|
20417
|
+
store = createStore(diagnostics);
|
|
20418
|
+
stores.set(diagnostics, store);
|
|
20419
|
+
}
|
|
20420
|
+
return store;
|
|
20421
|
+
}
|
|
19933
20422
|
|
|
19934
|
-
// src/settings/
|
|
19935
|
-
|
|
19936
|
-
|
|
19937
|
-
|
|
19938
|
-
|
|
19939
|
-
|
|
19940
|
-
|
|
19941
|
-
|
|
19942
|
-
|
|
19943
|
-
|
|
20423
|
+
// src/settings/harness-installation-guides.ts
|
|
20424
|
+
function harnessHasInstallCommands(plugin) {
|
|
20425
|
+
return (plugin?.installation?.commands.length ?? 0) > 0;
|
|
20426
|
+
}
|
|
20427
|
+
function harnessInstallationGuide(plugin, locale) {
|
|
20428
|
+
const guide = plugin?.installation;
|
|
20429
|
+
const text = (value) => value?.[locale] ?? value?.en;
|
|
20430
|
+
return {
|
|
20431
|
+
url: plugin?.links?.installation ?? plugin?.links?.documentation ?? plugin?.links?.website,
|
|
20432
|
+
commands: guide?.commands ?? [],
|
|
20433
|
+
downloads: guide?.downloads ?? [],
|
|
20434
|
+
before: text(guide?.before),
|
|
20435
|
+
after: text(guide?.after)
|
|
20436
|
+
};
|
|
20437
|
+
}
|
|
20438
|
+
|
|
20439
|
+
// src/settings/harness-installation-panel.ts
|
|
20440
|
+
function createHarnessInstallationPanel(document2, plugin, hostId2, messages, copy, installation) {
|
|
20441
|
+
const zh = messages.locale === "zh-CN";
|
|
20442
|
+
const guide = harnessInstallationGuide(plugin, messages.locale);
|
|
20443
|
+
const panel = document2.createElement("div");
|
|
20444
|
+
panel.className = "settings-harness-installation";
|
|
20445
|
+
const paragraph = (text) => {
|
|
20446
|
+
const p = document2.createElement("p");
|
|
20447
|
+
p.textContent = text;
|
|
20448
|
+
panel.append(p);
|
|
20449
|
+
};
|
|
20450
|
+
if (hostId2 !== "local") {
|
|
20451
|
+
paragraph(zh ? "\u8BF7\u5728\u8FDC\u7A0B Host \u4E0A\u5B89\u88C5\u3002" : "Install on the remote Host.");
|
|
19944
20452
|
}
|
|
19945
|
-
|
|
20453
|
+
if (guide.before) paragraph(guide.before);
|
|
20454
|
+
const install2 = installation && guide.commands.length > 0 ? document2.createElement("button") : null;
|
|
20455
|
+
if (install2 && installation) {
|
|
20456
|
+
install2.type = "button";
|
|
20457
|
+
install2.className = "settings-command-button";
|
|
20458
|
+
install2.dataset.connectionAction = "install";
|
|
20459
|
+
install2.disabled = installation.status !== "idle";
|
|
20460
|
+
install2.textContent = installation.status === "installing" ? messages.connectionStatusInstalling : installation.status === "checking" ? messages.connectionStatusChecking : zh ? "\u4E00\u952E\u5B89\u88C5" : "Install automatically";
|
|
20461
|
+
install2.addEventListener("click", () => {
|
|
20462
|
+
if (install2.disabled) return;
|
|
20463
|
+
install2.disabled = true;
|
|
20464
|
+
install2.textContent = messages.connectionStatusInstalling;
|
|
20465
|
+
installation.run();
|
|
20466
|
+
});
|
|
20467
|
+
if (guide.commands.length > 1) panel.append(install2);
|
|
20468
|
+
}
|
|
20469
|
+
for (const { terminal, command } of guide.commands) {
|
|
20470
|
+
const block = document2.createElement("div");
|
|
20471
|
+
block.className = "settings-harness-installation-command";
|
|
20472
|
+
const label = document2.createElement("strong");
|
|
20473
|
+
label.textContent = terminal;
|
|
20474
|
+
const pre = document2.createElement("pre");
|
|
20475
|
+
const code = document2.createElement("code");
|
|
20476
|
+
code.textContent = command;
|
|
20477
|
+
pre.append(code);
|
|
20478
|
+
const button2 = document2.createElement("button");
|
|
20479
|
+
button2.type = "button";
|
|
20480
|
+
button2.className = "settings-command-button settings-command-button--secondary";
|
|
20481
|
+
button2.dataset.connectionAction = "copy-install";
|
|
20482
|
+
const copyLabel = zh ? "\u590D\u5236\u547D\u4EE4" : "Copy command";
|
|
20483
|
+
button2.setAttribute("aria-label", `${copyLabel}: ${terminal}`);
|
|
20484
|
+
button2.append(createRendererSettingsIcon("copy", 16), copyLabel);
|
|
20485
|
+
button2.addEventListener("click", () => copy(button2, command, copyLabel));
|
|
20486
|
+
const actions = document2.createElement("div");
|
|
20487
|
+
actions.className = "settings-harness-installation-actions";
|
|
20488
|
+
if (install2 && guide.commands.length === 1) actions.append(install2);
|
|
20489
|
+
actions.append(button2);
|
|
20490
|
+
block.append(label, pre, actions);
|
|
20491
|
+
panel.append(block);
|
|
20492
|
+
}
|
|
20493
|
+
for (const download2 of guide.downloads ?? []) {
|
|
20494
|
+
const link = document2.createElement("a");
|
|
20495
|
+
link.className = "settings-command-button settings-command-button--secondary";
|
|
20496
|
+
link.href = download2.url;
|
|
20497
|
+
link.target = "_blank";
|
|
20498
|
+
link.rel = "noopener noreferrer";
|
|
20499
|
+
link.textContent = zh ? "\u4E0B\u8F7D" : "Download";
|
|
20500
|
+
link.setAttribute("aria-label", `${link.textContent} ${download2.label}`);
|
|
20501
|
+
panel.append(link);
|
|
20502
|
+
}
|
|
20503
|
+
if (guide.after) paragraph(guide.after);
|
|
20504
|
+
if (!plugin?.installation && guide.url) {
|
|
20505
|
+
const link = document2.createElement("a");
|
|
20506
|
+
link.href = guide.url;
|
|
20507
|
+
link.target = "_blank";
|
|
20508
|
+
link.rel = "noopener noreferrer";
|
|
20509
|
+
link.textContent = zh ? "\u5B89\u88C5\u8BF4\u660E" : "Installation instructions";
|
|
20510
|
+
panel.append(link);
|
|
20511
|
+
}
|
|
20512
|
+
return panel;
|
|
19946
20513
|
}
|
|
19947
|
-
|
|
19948
|
-
|
|
19949
|
-
|
|
19950
|
-
|
|
19951
|
-
|
|
19952
|
-
|
|
19953
|
-
|
|
20514
|
+
|
|
20515
|
+
// src/settings/harness-launch-controls.ts
|
|
20516
|
+
function createHarnessLaunchControls(document2, messages, agent, settings) {
|
|
20517
|
+
const section = document2.createElement("section");
|
|
20518
|
+
section.className = "settings-harness-launch";
|
|
20519
|
+
section.dataset.harnessLaunch = agent;
|
|
20520
|
+
const label = document2.createElement("label");
|
|
20521
|
+
label.textContent = messages.launchPathLabel;
|
|
20522
|
+
const input = document2.createElement("input");
|
|
20523
|
+
input.type = "text";
|
|
20524
|
+
input.autocomplete = "off";
|
|
20525
|
+
input.spellcheck = false;
|
|
20526
|
+
input.placeholder = messages.locale === "zh-CN" ? "\u5E94\u7528\u5B89\u88C5\u76EE\u5F55\u7684\u7EDD\u5BF9\u8DEF\u5F84" : "Absolute installation directory";
|
|
20527
|
+
input.setAttribute("aria-label", messages.launchPathLabel);
|
|
20528
|
+
label.append(input);
|
|
20529
|
+
const help = document2.createElement("p");
|
|
20530
|
+
help.textContent = messages.locale === "zh-CN" ? "\u586B\u5199\u63D2\u4EF6\u5BF9\u5E94\u5E94\u7528\u7684\u5B89\u88C5\u76EE\u5F55\uFF1B\u6E05\u9664\u540E\u6062\u590D\u81EA\u52A8\u53D1\u73B0\u3002\u4FEE\u6539\u540E\u9700\u91CD\u542F codexhost\u3002" : "Choose the application's installation directory; clear it to restore automatic discovery. Restart codexhost after changing it.";
|
|
20531
|
+
const actions = document2.createElement("div");
|
|
20532
|
+
actions.className = "settings-harness-launch__actions";
|
|
20533
|
+
const save = document2.createElement("button");
|
|
20534
|
+
save.type = "button";
|
|
20535
|
+
save.className = "settings-command-button";
|
|
20536
|
+
save.textContent = messages.launchPathSave;
|
|
20537
|
+
const reset = document2.createElement("button");
|
|
20538
|
+
reset.type = "button";
|
|
20539
|
+
reset.className = "settings-command-button settings-command-button--secondary";
|
|
20540
|
+
reset.textContent = messages.launchPathReset;
|
|
20541
|
+
const status = document2.createElement("p");
|
|
20542
|
+
status.setAttribute("role", "status");
|
|
20543
|
+
status.setAttribute("aria-live", "polite");
|
|
20544
|
+
actions.append(save, reset);
|
|
20545
|
+
section.append(label, help, actions, status);
|
|
20546
|
+
let busy = true;
|
|
20547
|
+
let loaded = false;
|
|
20548
|
+
const controls = () => {
|
|
20549
|
+
input.disabled = busy || !loaded;
|
|
20550
|
+
save.disabled = busy || !loaded || !input.value.trim();
|
|
20551
|
+
reset.disabled = busy || !loaded;
|
|
20552
|
+
};
|
|
20553
|
+
const show = (value) => {
|
|
20554
|
+
input.value = value.path ?? "";
|
|
20555
|
+
status.textContent = value.restartRequired ? messages.launchPathRestart : value.path ? messages.launchPathSaved : messages.launchPathAutomatic;
|
|
20556
|
+
};
|
|
20557
|
+
const persist = async (value) => {
|
|
20558
|
+
if (busy || !loaded) return;
|
|
20559
|
+
busy = true;
|
|
20560
|
+
controls();
|
|
20561
|
+
status.textContent = messages.launchPathSaving;
|
|
20562
|
+
try {
|
|
20563
|
+
show(await settings.set(value));
|
|
20564
|
+
} catch {
|
|
20565
|
+
status.textContent = messages.launchPathSaveError;
|
|
20566
|
+
} finally {
|
|
20567
|
+
busy = false;
|
|
20568
|
+
controls();
|
|
20569
|
+
}
|
|
20570
|
+
};
|
|
20571
|
+
input.addEventListener("input", controls);
|
|
20572
|
+
save.addEventListener("click", () => {
|
|
20573
|
+
if (input.value.trim()) void persist(input.value.trim());
|
|
20574
|
+
});
|
|
20575
|
+
reset.addEventListener("click", () => {
|
|
20576
|
+
void persist(null);
|
|
20577
|
+
});
|
|
20578
|
+
controls();
|
|
20579
|
+
status.textContent = messages.launchPathLoading;
|
|
20580
|
+
void settings.get().then((value) => {
|
|
20581
|
+
loaded = true;
|
|
20582
|
+
show(value);
|
|
20583
|
+
}).catch(() => {
|
|
20584
|
+
loaded = true;
|
|
20585
|
+
status.textContent = messages.launchPathLoadError;
|
|
20586
|
+
}).finally(() => {
|
|
20587
|
+
busy = false;
|
|
20588
|
+
controls();
|
|
20589
|
+
});
|
|
20590
|
+
return section;
|
|
19954
20591
|
}
|
|
20592
|
+
|
|
20593
|
+
// src/settings/connections-page.ts
|
|
20594
|
+
var CODEXHOST_GITHUB_ISSUES_NEW_URL = "https://github.com/BytePioneer-AI/codex-host/issues/new";
|
|
19955
20595
|
function diagnosticText(hostId2, item) {
|
|
19956
20596
|
const error51 = item.error;
|
|
19957
20597
|
return [
|
|
@@ -20047,148 +20687,21 @@ ${error51.stderrTail}`] : []
|
|
|
20047
20687
|
tabs.addEventListener("wheel", onWheel, { passive: false });
|
|
20048
20688
|
const ownerWindow = document2.defaultView;
|
|
20049
20689
|
ownerWindow?.addEventListener("resize", updateButtons);
|
|
20050
|
-
|
|
20051
|
-
|
|
20052
|
-
|
|
20053
|
-
|
|
20054
|
-
|
|
20055
|
-
|
|
20056
|
-
|
|
20057
|
-
|
|
20690
|
+
const refreshLayout = () => {
|
|
20691
|
+
ownerWindow?.setTimeout(updateButtons, 0);
|
|
20692
|
+
updateButtons();
|
|
20693
|
+
};
|
|
20694
|
+
refreshLayout();
|
|
20695
|
+
return {
|
|
20696
|
+
update: refreshLayout,
|
|
20697
|
+
dispose() {
|
|
20698
|
+
left.removeEventListener("click", onLeft);
|
|
20699
|
+
right.removeEventListener("click", onRight);
|
|
20700
|
+
tabs.removeEventListener("scroll", updateButtons);
|
|
20701
|
+
tabs.removeEventListener("wheel", onWheel);
|
|
20702
|
+
ownerWindow?.removeEventListener("resize", updateButtons);
|
|
20703
|
+
}
|
|
20058
20704
|
};
|
|
20059
|
-
}
|
|
20060
|
-
function createConnectionIdentityIcon(document2, item, size) {
|
|
20061
|
-
const container = document2.createElement("span");
|
|
20062
|
-
container.className = item.agentSnapshot ? "settings-connection-row__mark settings-connection-row__mark--logo" : "settings-connection-row__mark";
|
|
20063
|
-
container.setAttribute("aria-hidden", "true");
|
|
20064
|
-
if (item.agentSnapshot) {
|
|
20065
|
-
container.append(
|
|
20066
|
-
createRendererAgentIcon(item.agentSnapshot.agent, size, document2, item.agentSnapshot.plugin)
|
|
20067
|
-
);
|
|
20068
|
-
} else {
|
|
20069
|
-
container.textContent = "CH";
|
|
20070
|
-
}
|
|
20071
|
-
return container;
|
|
20072
|
-
}
|
|
20073
|
-
function createConnectionRow(document2, item, messages, selected, select, group = null) {
|
|
20074
|
-
const row = document2.createElement("div");
|
|
20075
|
-
row.className = "settings-connection-row";
|
|
20076
|
-
row.dataset.connectionItem = item.key;
|
|
20077
|
-
row.dataset.connectionSelected = String(selected);
|
|
20078
|
-
row.tabIndex = selected ? 0 : -1;
|
|
20079
|
-
row.setAttribute("role", "row");
|
|
20080
|
-
const identity3 = document2.createElement("div");
|
|
20081
|
-
identity3.className = "settings-connection-row__identity";
|
|
20082
|
-
identity3.setAttribute("role", "cell");
|
|
20083
|
-
if (group) {
|
|
20084
|
-
const handle = document2.createElement("span");
|
|
20085
|
-
handle.className = "settings-connection-row__handle";
|
|
20086
|
-
handle.setAttribute("aria-hidden", "true");
|
|
20087
|
-
handle.title = group.dragHandleTitle;
|
|
20088
|
-
handle.append(createRendererSettingsIcon("grip-vertical", 15));
|
|
20089
|
-
identity3.append(handle);
|
|
20090
|
-
}
|
|
20091
|
-
const label = document2.createElement("strong");
|
|
20092
|
-
label.textContent = item.name;
|
|
20093
|
-
identity3.append(createConnectionIdentityIcon(document2, item, 19), label);
|
|
20094
|
-
const status = document2.createElement("span");
|
|
20095
|
-
status.className = "settings-connection-row__status";
|
|
20096
|
-
status.dataset.connectionTone = connectionStatusTone(item.availability, item.error !== null);
|
|
20097
|
-
status.setAttribute("role", "cell");
|
|
20098
|
-
status.textContent = item.error?.code === "authenticationRequired" ? messages.connectionLoginRequired : item.error?.code === "configurationRequired" ? messages.connectionConfigurationRequired : connectionStatusLabel(item.availability, messages, item.error !== null);
|
|
20099
|
-
const version2 = item.version;
|
|
20100
|
-
const action = document2.createElement("div");
|
|
20101
|
-
action.className = "settings-connection-row__action";
|
|
20102
|
-
action.setAttribute("role", "cell");
|
|
20103
|
-
if (item.agentSnapshot?.availability === "notInstalled" && item.install) {
|
|
20104
|
-
const install2 = document2.createElement("button");
|
|
20105
|
-
install2.type = "button";
|
|
20106
|
-
install2.className = "settings-connection-install-link";
|
|
20107
|
-
install2.addEventListener("click", (event) => {
|
|
20108
|
-
event.stopPropagation();
|
|
20109
|
-
select();
|
|
20110
|
-
item.install?.();
|
|
20111
|
-
});
|
|
20112
|
-
install2.disabled = item.availability === "installing" || item.availability === "checking";
|
|
20113
|
-
const installLabel = messages.connectionInstall;
|
|
20114
|
-
install2.setAttribute("aria-label", `${installLabel}: ${item.name}`);
|
|
20115
|
-
install2.title = installLabel;
|
|
20116
|
-
install2.append(createRendererSettingsIcon("download", 17));
|
|
20117
|
-
action.append(install2);
|
|
20118
|
-
} else if (item.error) {
|
|
20119
|
-
const viewError = document2.createElement("button");
|
|
20120
|
-
viewError.type = "button";
|
|
20121
|
-
viewError.className = "settings-connection-view-error";
|
|
20122
|
-
viewError.textContent = messages.connectionViewError;
|
|
20123
|
-
viewError.addEventListener("click", (event) => {
|
|
20124
|
-
event.stopPropagation();
|
|
20125
|
-
select();
|
|
20126
|
-
});
|
|
20127
|
-
action.append(viewError);
|
|
20128
|
-
}
|
|
20129
|
-
if (version2?.state?.updateAvailable && !version2.updating) {
|
|
20130
|
-
const available = document2.createElement("span");
|
|
20131
|
-
available.className = "settings-connection-version-available";
|
|
20132
|
-
available.textContent = messages.harnessVersionAvailable;
|
|
20133
|
-
available.title = `${messages.harnessVersionCurrent}: ${version2.state.currentVersion ?? "\u2014"}
|
|
20134
|
-
${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages.harnessVersion)}`;
|
|
20135
|
-
action.append(available);
|
|
20136
|
-
}
|
|
20137
|
-
if (version2?.state?.updateAvailable && version2.state.canUpdate) {
|
|
20138
|
-
const update = document2.createElement("button");
|
|
20139
|
-
update.type = "button";
|
|
20140
|
-
update.className = "settings-connection-install-link";
|
|
20141
|
-
update.dataset.connectionAction = "update";
|
|
20142
|
-
update.disabled = version2.updating;
|
|
20143
|
-
update.title = messages.harnessVersionUpdate;
|
|
20144
|
-
update.setAttribute("aria-label", `${messages.harnessVersionUpdate}: ${item.name}`);
|
|
20145
|
-
update.append(createRendererSettingsIcon("download", 17));
|
|
20146
|
-
update.addEventListener("click", (event) => {
|
|
20147
|
-
event.stopPropagation();
|
|
20148
|
-
if (update.disabled) return;
|
|
20149
|
-
void version2.update();
|
|
20150
|
-
select();
|
|
20151
|
-
});
|
|
20152
|
-
action.append(update);
|
|
20153
|
-
}
|
|
20154
|
-
if (group) {
|
|
20155
|
-
const toggle = document2.createElement("button");
|
|
20156
|
-
toggle.type = "button";
|
|
20157
|
-
toggle.disabled = group.disabled;
|
|
20158
|
-
toggle.className = "settings-connection-row__group-toggle";
|
|
20159
|
-
toggle.title = group.moveLabel;
|
|
20160
|
-
toggle.setAttribute("aria-label", group.moveLabel);
|
|
20161
|
-
toggle.append(
|
|
20162
|
-
createRendererSettingsIcon(group.section === "main" ? "chevron-down" : "chevron-up", 15)
|
|
20163
|
-
);
|
|
20164
|
-
toggle.addEventListener("click", (event) => {
|
|
20165
|
-
event.stopPropagation();
|
|
20166
|
-
group.toggleSection();
|
|
20167
|
-
});
|
|
20168
|
-
action.append(toggle);
|
|
20169
|
-
}
|
|
20170
|
-
row.addEventListener("click", (event) => {
|
|
20171
|
-
const target2 = event.target;
|
|
20172
|
-
if (target2?.closest?.("a")) return;
|
|
20173
|
-
select();
|
|
20174
|
-
});
|
|
20175
|
-
row.addEventListener("keydown", (event) => {
|
|
20176
|
-
if (event.target?.closest?.("button, a")) return;
|
|
20177
|
-
if (event.key !== "Enter" && event.key !== " ") return;
|
|
20178
|
-
event.preventDefault();
|
|
20179
|
-
select();
|
|
20180
|
-
});
|
|
20181
|
-
if (group) {
|
|
20182
|
-
row.draggable = !group.disabled;
|
|
20183
|
-
row.dataset.connectionGroupSection = group.section;
|
|
20184
|
-
row.addEventListener("dragstart", group.onDragStart);
|
|
20185
|
-
row.addEventListener("dragover", group.onDragOver);
|
|
20186
|
-
row.addEventListener("dragleave", group.onDragLeave);
|
|
20187
|
-
row.addEventListener("drop", group.onDrop);
|
|
20188
|
-
row.addEventListener("dragend", group.onDragEnd);
|
|
20189
|
-
}
|
|
20190
|
-
row.append(identity3, status, action);
|
|
20191
|
-
return row;
|
|
20192
20705
|
}
|
|
20193
20706
|
function createInspectorHeader(document2, item, messages) {
|
|
20194
20707
|
const header = document2.createElement("header");
|
|
@@ -20218,6 +20731,29 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20218
20731
|
header.append(identity3, status);
|
|
20219
20732
|
return header;
|
|
20220
20733
|
}
|
|
20734
|
+
function inspectorRenderSignature(hostId2, item, messages, diagnostics) {
|
|
20735
|
+
const plugin = item.agentSnapshot?.plugin;
|
|
20736
|
+
const notice = plugin?.notice ? plugin.notice[messages.locale] ?? plugin.notice.en : "";
|
|
20737
|
+
const websiteUrl = plugin?.links?.website ?? plugin?.links?.documentation ?? "";
|
|
20738
|
+
const hasLaunchControls = hostId2 === "local" && Boolean(item.agentSnapshot?.agent) && Boolean(plugin?.launchCommand) && Boolean(diagnostics?.getLaunchSettings && diagnostics?.setLaunchSettings);
|
|
20739
|
+
return JSON.stringify([
|
|
20740
|
+
hostId2,
|
|
20741
|
+
item.key,
|
|
20742
|
+
item.name,
|
|
20743
|
+
item.availability,
|
|
20744
|
+
item.agentSnapshot?.availability ?? null,
|
|
20745
|
+
String(plugin?.icon ?? ""),
|
|
20746
|
+
String(plugin?.iconStyle ?? ""),
|
|
20747
|
+
websiteUrl,
|
|
20748
|
+
notice,
|
|
20749
|
+
item.installError ?? "",
|
|
20750
|
+
Boolean(item.install),
|
|
20751
|
+
plugin?.installation ?? null,
|
|
20752
|
+
Boolean(item.openWebUi),
|
|
20753
|
+
hasLaunchControls,
|
|
20754
|
+
item.error ? diagnosticText(hostId2, item) : ""
|
|
20755
|
+
]);
|
|
20756
|
+
}
|
|
20221
20757
|
function renderConnectionInspector(document2, inspector, item, hostId2, messages, diagnostics, existingLaunchControls, refresh) {
|
|
20222
20758
|
inspector.replaceChildren(createInspectorHeader(document2, item, messages));
|
|
20223
20759
|
const body = document2.createElement("div");
|
|
@@ -20383,11 +20919,10 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20383
20919
|
function requestConnectionsPageFocus(agentKey) {
|
|
20384
20920
|
pendingFocusAgent = agentKey;
|
|
20385
20921
|
}
|
|
20386
|
-
function createGroupDivider(document2
|
|
20922
|
+
function createGroupDivider(document2) {
|
|
20387
20923
|
const divider = document2.createElement("div");
|
|
20388
20924
|
divider.className = "settings-connection-group-divider";
|
|
20389
20925
|
divider.setAttribute("role", "presentation");
|
|
20390
|
-
divider.textContent = `${messages.connectionGroupMoreLabel} (${count3})`;
|
|
20391
20926
|
return divider;
|
|
20392
20927
|
}
|
|
20393
20928
|
function createGroupMoreHint(document2, messages) {
|
|
@@ -20440,11 +20975,13 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20440
20975
|
context2.content.append(header, syncMessage, content);
|
|
20441
20976
|
let pending2 = false;
|
|
20442
20977
|
let selectedHostId = null;
|
|
20978
|
+
let renderedHostId = null;
|
|
20443
20979
|
let selectedItemKey = null;
|
|
20444
20980
|
let launchControls = null;
|
|
20981
|
+
let renderedInspector = null;
|
|
20445
20982
|
const hostNames = /* @__PURE__ */ new Map();
|
|
20983
|
+
const knownNotInstalled = /* @__PURE__ */ new Map();
|
|
20446
20984
|
let latestSnapshot = null;
|
|
20447
|
-
let disposeHostScroller = () => void 0;
|
|
20448
20985
|
let disposed = false;
|
|
20449
20986
|
let renderQueued = false;
|
|
20450
20987
|
let renderFrame = null;
|
|
@@ -20478,7 +21015,99 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20478
21015
|
scheduleRender
|
|
20479
21016
|
);
|
|
20480
21017
|
const installs = diagnostics ? harnessInstallStore(diagnostics) : null;
|
|
20481
|
-
const updates = createConnectionUpdates(
|
|
21018
|
+
const updates = createConnectionUpdates(
|
|
21019
|
+
document2,
|
|
21020
|
+
messages,
|
|
21021
|
+
context2.signal,
|
|
21022
|
+
scheduleRender,
|
|
21023
|
+
diagnostics
|
|
21024
|
+
);
|
|
21025
|
+
const panelId = "codexhost-settings-connection-host-panel";
|
|
21026
|
+
const empty = document2.createElement("div");
|
|
21027
|
+
empty.className = "settings-empty";
|
|
21028
|
+
empty.textContent = messages.connectionNoRuntime;
|
|
21029
|
+
const layout = document2.createElement("div");
|
|
21030
|
+
layout.className = "settings-connections-layout";
|
|
21031
|
+
const list = document2.createElement("section");
|
|
21032
|
+
list.className = "settings-connection-list";
|
|
21033
|
+
const hostStrip = document2.createElement("div");
|
|
21034
|
+
hostStrip.className = "settings-connection-host-strip";
|
|
21035
|
+
const scrollLeft = createHostScrollButton(document2, "left", messages);
|
|
21036
|
+
const tabs = document2.createElement("div");
|
|
21037
|
+
tabs.className = "settings-connection-host-tabs";
|
|
21038
|
+
tabs.setAttribute("role", "tablist");
|
|
21039
|
+
tabs.setAttribute("aria-label", messages.connectionHosts);
|
|
21040
|
+
const scrollRight = createHostScrollButton(document2, "right", messages);
|
|
21041
|
+
hostStrip.append(scrollLeft, tabs, scrollRight);
|
|
21042
|
+
const updateControls = updates.createControls("local", []);
|
|
21043
|
+
const hostHeader = document2.createElement("div");
|
|
21044
|
+
hostHeader.className = "settings-connection-host-header";
|
|
21045
|
+
hostHeader.append(hostStrip, updateControls.button);
|
|
21046
|
+
const tableHeader = document2.createElement("div");
|
|
21047
|
+
tableHeader.className = "settings-connection-table-header";
|
|
21048
|
+
tableHeader.setAttribute("role", "row");
|
|
21049
|
+
const componentHeading = document2.createElement("span");
|
|
21050
|
+
componentHeading.textContent = messages.connectionComponent;
|
|
21051
|
+
componentHeading.setAttribute("role", "columnheader");
|
|
21052
|
+
const statusHeading = document2.createElement("span");
|
|
21053
|
+
statusHeading.textContent = messages.connectionStatus;
|
|
21054
|
+
statusHeading.setAttribute("role", "columnheader");
|
|
21055
|
+
const actionHeading = document2.createElement("span");
|
|
21056
|
+
actionHeading.setAttribute("aria-hidden", "true");
|
|
21057
|
+
tableHeader.append(componentHeading, statusHeading, actionHeading);
|
|
21058
|
+
const rows = document2.createElement("div");
|
|
21059
|
+
rows.className = "settings-connection-rows";
|
|
21060
|
+
rows.id = panelId;
|
|
21061
|
+
rows.setAttribute("role", "rowgroup");
|
|
21062
|
+
list.append(hostHeader, updateControls.result, tableHeader, rows);
|
|
21063
|
+
const inspector = document2.createElement("aside");
|
|
21064
|
+
inspector.className = "settings-connection-inspector";
|
|
21065
|
+
inspector.setAttribute("aria-live", "polite");
|
|
21066
|
+
layout.append(list, inspector);
|
|
21067
|
+
const hostScroller = configureHostScroller(
|
|
21068
|
+
document2,
|
|
21069
|
+
hostStrip,
|
|
21070
|
+
tabs,
|
|
21071
|
+
scrollLeft,
|
|
21072
|
+
scrollRight
|
|
21073
|
+
);
|
|
21074
|
+
const hostTabElements = /* @__PURE__ */ new Map();
|
|
21075
|
+
const hostRowViews = /* @__PURE__ */ new Map();
|
|
21076
|
+
const groupDivider = createGroupDivider(document2);
|
|
21077
|
+
const moreHint = createGroupMoreHint(document2, messages);
|
|
21078
|
+
const moreZone = document2.createElement("div");
|
|
21079
|
+
moreZone.className = "settings-connection-group-more";
|
|
21080
|
+
moreZone.setAttribute("role", "presentation");
|
|
21081
|
+
const resetButton = createGroupResetButton(document2, messages, () => {
|
|
21082
|
+
groupPreference.resetToDefault();
|
|
21083
|
+
});
|
|
21084
|
+
let draggingAgent = null;
|
|
21085
|
+
let currentCatalog = [];
|
|
21086
|
+
let currentMainEntries = [];
|
|
21087
|
+
let currentMoreEntries = [];
|
|
21088
|
+
let currentHostRows = /* @__PURE__ */ new Map();
|
|
21089
|
+
const clearDropIndicators = () => {
|
|
21090
|
+
for (const view of currentHostRows.values()) {
|
|
21091
|
+
view.element.dataset.connectionDropIndicator = "";
|
|
21092
|
+
}
|
|
21093
|
+
moreZone.dataset.connectionDragOver = "false";
|
|
21094
|
+
};
|
|
21095
|
+
moreZone.addEventListener("dragover", (event) => {
|
|
21096
|
+
if (!draggingAgent) return;
|
|
21097
|
+
event.preventDefault();
|
|
21098
|
+
moreZone.dataset.connectionDragOver = "true";
|
|
21099
|
+
});
|
|
21100
|
+
moreZone.addEventListener("dragleave", () => {
|
|
21101
|
+
moreZone.dataset.connectionDragOver = "false";
|
|
21102
|
+
});
|
|
21103
|
+
moreZone.addEventListener("drop", (event) => {
|
|
21104
|
+
event.preventDefault();
|
|
21105
|
+
moreZone.dataset.connectionDragOver = "false";
|
|
21106
|
+
if (!draggingAgent) return;
|
|
21107
|
+
groupPreference.moveAgent(draggingAgent, "more", null, currentCatalog);
|
|
21108
|
+
draggingAgent = null;
|
|
21109
|
+
clearDropIndicators();
|
|
21110
|
+
});
|
|
20482
21111
|
const runRefresh = () => {
|
|
20483
21112
|
if (pending2 || !diagnostics) return;
|
|
20484
21113
|
pending2 = true;
|
|
@@ -20491,6 +21120,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20491
21120
|
success() {
|
|
20492
21121
|
installs?.clearErrors();
|
|
20493
21122
|
pending2 = false;
|
|
21123
|
+
renderedInspector = null;
|
|
20494
21124
|
refresh.disabled = false;
|
|
20495
21125
|
refresh.replaceChildren(
|
|
20496
21126
|
createRendererSettingsIcon("diagnose", 16),
|
|
@@ -20500,6 +21130,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20500
21130
|
},
|
|
20501
21131
|
failure(error51) {
|
|
20502
21132
|
pending2 = false;
|
|
21133
|
+
renderedInspector = null;
|
|
20503
21134
|
refresh.disabled = false;
|
|
20504
21135
|
refresh.replaceChildren(
|
|
20505
21136
|
createRendererSettingsIcon("diagnose", 16),
|
|
@@ -20525,97 +21156,111 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20525
21156
|
}
|
|
20526
21157
|
});
|
|
20527
21158
|
};
|
|
21159
|
+
const syncSelectedInspector = (hostId2, item) => {
|
|
21160
|
+
const currentDiagnostics = getDiagnostics();
|
|
21161
|
+
const signature = inspectorRenderSignature(hostId2, item, messages, currentDiagnostics);
|
|
21162
|
+
const versionElement = item.version?.element ?? null;
|
|
21163
|
+
if (renderedInspector?.signature === signature && renderedInspector.versionElement === versionElement) {
|
|
21164
|
+
return;
|
|
21165
|
+
}
|
|
21166
|
+
const existing = launchControls?.hostId === hostId2 && launchControls.itemKey === item.key ? launchControls.element : null;
|
|
21167
|
+
const element = renderConnectionInspector(
|
|
21168
|
+
document2,
|
|
21169
|
+
inspector,
|
|
21170
|
+
item,
|
|
21171
|
+
hostId2,
|
|
21172
|
+
messages,
|
|
21173
|
+
currentDiagnostics,
|
|
21174
|
+
existing,
|
|
21175
|
+
runRefresh
|
|
21176
|
+
);
|
|
21177
|
+
launchControls = { hostId: hostId2, itemKey: item.key, element };
|
|
21178
|
+
if (versionElement) inspector.append(versionElement);
|
|
21179
|
+
renderedInspector = { signature, versionElement };
|
|
21180
|
+
};
|
|
20528
21181
|
const render = (snapshot) => {
|
|
20529
21182
|
const syncStatus = groupPreference.syncStatus();
|
|
20530
21183
|
const groupDisabled = syncStatus === "loading" || syncStatus === "saving";
|
|
20531
21184
|
syncMessage.hidden = syncStatus === "ready";
|
|
20532
21185
|
syncMessage.textContent = syncStatus === "error" ? messages.connectionGroupSyncFailed : syncStatus === "saving" ? messages.connectionGroupSaving : messages.connectionGroupLoading;
|
|
20533
21186
|
latestSnapshot = snapshot;
|
|
20534
|
-
disposeHostScroller();
|
|
20535
|
-
disposeHostScroller = () => void 0;
|
|
20536
21187
|
if (!snapshot) {
|
|
20537
|
-
|
|
20538
|
-
|
|
20539
|
-
empty
|
|
20540
|
-
content.replaceChildren(empty);
|
|
21188
|
+
renderedHostId = null;
|
|
21189
|
+
renderedInspector = null;
|
|
21190
|
+
reconcileElementChildren(content, [empty]);
|
|
20541
21191
|
return;
|
|
20542
21192
|
}
|
|
20543
21193
|
const selectedHost = (selectedHostId ? snapshot.hosts.find((host) => host.hostId === selectedHostId) : void 0) ?? snapshot.hosts.find((host) => host.active) ?? snapshot.hosts.find((host) => host.hostId === "local") ?? snapshot.hosts[0];
|
|
20544
21194
|
if (!selectedHost) return;
|
|
20545
21195
|
selectedHostId = selectedHost.hostId;
|
|
20546
|
-
const
|
|
20547
|
-
|
|
20548
|
-
|
|
20549
|
-
|
|
20550
|
-
|
|
20551
|
-
|
|
20552
|
-
|
|
20553
|
-
|
|
20554
|
-
|
|
20555
|
-
|
|
20556
|
-
|
|
20557
|
-
|
|
20558
|
-
|
|
20559
|
-
|
|
20560
|
-
|
|
20561
|
-
|
|
20562
|
-
|
|
20563
|
-
|
|
20564
|
-
|
|
20565
|
-
|
|
20566
|
-
|
|
20567
|
-
|
|
20568
|
-
|
|
21196
|
+
const layoutFirstMount = content.children[0] !== layout;
|
|
21197
|
+
reconcileElementChildren(content, [layout]);
|
|
21198
|
+
let tabsChanged = tabs.children.length !== snapshot.hosts.length;
|
|
21199
|
+
const nextTabs = snapshot.hosts.map((host) => {
|
|
21200
|
+
let tab = hostTabElements.get(host.hostId);
|
|
21201
|
+
if (!tab) {
|
|
21202
|
+
tab = document2.createElement("button");
|
|
21203
|
+
tab.type = "button";
|
|
21204
|
+
tab.className = "settings-connection-host-tab";
|
|
21205
|
+
tab.dataset.connectionHostTab = host.hostId;
|
|
21206
|
+
tab.setAttribute("role", "tab");
|
|
21207
|
+
tab.setAttribute("aria-controls", panelId);
|
|
21208
|
+
tab.addEventListener("click", () => {
|
|
21209
|
+
selectedHostId = host.hostId;
|
|
21210
|
+
render(latestSnapshot);
|
|
21211
|
+
});
|
|
21212
|
+
tab.addEventListener("keydown", (event) => {
|
|
21213
|
+
if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
|
|
21214
|
+
event.preventDefault();
|
|
21215
|
+
const hosts = latestSnapshot?.hosts ?? [];
|
|
21216
|
+
const index = hosts.findIndex((candidate) => candidate.hostId === host.hostId);
|
|
21217
|
+
if (index < 0) return;
|
|
21218
|
+
const direction = event.key === "ArrowRight" ? 1 : -1;
|
|
21219
|
+
const next = hosts[(index + direction + hosts.length) % hosts.length];
|
|
21220
|
+
if (!next) return;
|
|
21221
|
+
selectedHostId = next.hostId;
|
|
21222
|
+
render(latestSnapshot);
|
|
21223
|
+
hostTabElements.get(next.hostId)?.focus();
|
|
21224
|
+
});
|
|
21225
|
+
hostTabElements.set(host.hostId, tab);
|
|
21226
|
+
tabsChanged = true;
|
|
21227
|
+
}
|
|
21228
|
+
const isSelected = host.hostId === selectedHost.hostId;
|
|
21229
|
+
const activeValue = String(host.active);
|
|
21230
|
+
if (tab.dataset.connectionHostActive !== activeValue) {
|
|
21231
|
+
tab.dataset.connectionHostActive = activeValue;
|
|
21232
|
+
}
|
|
21233
|
+
const selectedValue = String(isSelected);
|
|
21234
|
+
if (tab.getAttribute("aria-selected") !== selectedValue) {
|
|
21235
|
+
tab.setAttribute("aria-selected", selectedValue);
|
|
21236
|
+
}
|
|
21237
|
+
const nextTabIndex = isSelected ? 0 : -1;
|
|
21238
|
+
if (tab.tabIndex !== nextTabIndex) {
|
|
21239
|
+
tab.tabIndex = nextTabIndex;
|
|
21240
|
+
}
|
|
20569
21241
|
const hostName = hostNames.get(host.hostId) || connectionHostName(host.hostId, messages);
|
|
20570
|
-
tab.textContent
|
|
20571
|
-
|
|
20572
|
-
|
|
20573
|
-
|
|
20574
|
-
|
|
20575
|
-
|
|
20576
|
-
|
|
20577
|
-
|
|
20578
|
-
|
|
20579
|
-
const direction = event.key === "ArrowRight" ? 1 : -1;
|
|
20580
|
-
const next = snapshot.hosts[(index + direction + snapshot.hosts.length) % snapshot.hosts.length];
|
|
20581
|
-
if (!next) return;
|
|
20582
|
-
selectedHostId = next.hostId;
|
|
20583
|
-
render(latestSnapshot);
|
|
20584
|
-
const nextTab = [
|
|
20585
|
-
...content.querySelectorAll("[data-connection-host-tab]")
|
|
20586
|
-
].find((candidate) => candidate.dataset.connectionHostTab === next.hostId);
|
|
20587
|
-
nextTab?.focus();
|
|
20588
|
-
});
|
|
20589
|
-
tabs.append(tab);
|
|
21242
|
+
if (tab.textContent !== hostName) {
|
|
21243
|
+
tab.textContent = hostName;
|
|
21244
|
+
tabsChanged = true;
|
|
21245
|
+
}
|
|
21246
|
+
const tabTitle = host.active ? `${hostName} \xB7 ${messages.connectionActiveHost}` : hostName;
|
|
21247
|
+
if (tab.title !== tabTitle) {
|
|
21248
|
+
tab.title = tabTitle;
|
|
21249
|
+
}
|
|
21250
|
+
return tab;
|
|
20590
21251
|
});
|
|
20591
|
-
|
|
20592
|
-
|
|
20593
|
-
|
|
20594
|
-
|
|
20595
|
-
const componentHeading = document2.createElement("span");
|
|
20596
|
-
componentHeading.textContent = messages.connectionComponent;
|
|
20597
|
-
componentHeading.setAttribute("role", "columnheader");
|
|
20598
|
-
const statusHeading = document2.createElement("span");
|
|
20599
|
-
statusHeading.textContent = messages.connectionStatus;
|
|
20600
|
-
statusHeading.setAttribute("role", "columnheader");
|
|
20601
|
-
const actionHeading = document2.createElement("span");
|
|
20602
|
-
actionHeading.setAttribute("aria-hidden", "true");
|
|
20603
|
-
tableHeader.append(componentHeading, statusHeading, actionHeading);
|
|
20604
|
-
const rows = document2.createElement("div");
|
|
20605
|
-
rows.className = "settings-connection-rows";
|
|
20606
|
-
rows.id = panelId;
|
|
20607
|
-
rows.dataset.connectionHost = selectedHost.hostId;
|
|
20608
|
-
rows.setAttribute("role", "rowgroup");
|
|
20609
|
-
const inspector = document2.createElement("aside");
|
|
20610
|
-
inspector.className = "settings-connection-inspector";
|
|
20611
|
-
inspector.setAttribute("aria-live", "polite");
|
|
21252
|
+
reconcileElementChildren(tabs, nextTabs);
|
|
21253
|
+
if (rows.dataset.connectionHost !== selectedHost.hostId) {
|
|
21254
|
+
rows.dataset.connectionHost = selectedHost.hostId;
|
|
21255
|
+
}
|
|
20612
21256
|
const items = connectionItems(snapshot, selectedHost, messages, diagnostics).map(
|
|
20613
21257
|
(item) => {
|
|
20614
21258
|
const agent = item.agentSnapshot?.agent;
|
|
20615
21259
|
if (!agent) return item;
|
|
20616
21260
|
const state = installs?.get(selectedHost.hostId, agent);
|
|
20617
21261
|
const availability = state?.status ?? item.availability;
|
|
20618
|
-
const
|
|
21262
|
+
const updating = versions.isUpdating(selectedHost.hostId, agent);
|
|
21263
|
+
const version2 = updating || item.agentSnapshot?.availability !== "notInstalled" && availability !== "installing" && availability !== "checking" ? versions.get(selectedHost.hostId, agent) : void 0;
|
|
20619
21264
|
return {
|
|
20620
21265
|
...item,
|
|
20621
21266
|
...state ? { availability: state.status } : {},
|
|
@@ -20637,66 +21282,66 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20637
21282
|
(item) => item.agentSnapshot?.availability === "notInstalled" || item.error !== null
|
|
20638
21283
|
)?.key ?? items[0]?.key ?? null;
|
|
20639
21284
|
}
|
|
20640
|
-
|
|
21285
|
+
let hostRows = hostRowViews.get(selectedHost.hostId);
|
|
21286
|
+
if (!hostRows) {
|
|
21287
|
+
hostRows = /* @__PURE__ */ new Map();
|
|
21288
|
+
hostRowViews.set(selectedHost.hostId, hostRows);
|
|
21289
|
+
}
|
|
21290
|
+
currentHostRows = hostRows;
|
|
20641
21291
|
const selectItem = (item) => {
|
|
20642
21292
|
selectedItemKey = item.key;
|
|
20643
|
-
for (const [key,
|
|
20644
|
-
|
|
20645
|
-
row.dataset.connectionSelected = String(selected);
|
|
20646
|
-
row.tabIndex = selected ? 0 : -1;
|
|
21293
|
+
for (const [key, view] of currentHostRows) {
|
|
21294
|
+
view.setSelected(key === item.key);
|
|
20647
21295
|
}
|
|
20648
|
-
|
|
20649
|
-
const element = renderConnectionInspector(
|
|
20650
|
-
document2,
|
|
20651
|
-
inspector,
|
|
20652
|
-
item,
|
|
20653
|
-
selectedHost.hostId,
|
|
20654
|
-
messages,
|
|
20655
|
-
getDiagnostics(),
|
|
20656
|
-
existing,
|
|
20657
|
-
runRefresh
|
|
20658
|
-
);
|
|
20659
|
-
launchControls = { hostId: selectedHost.hostId, itemKey: item.key, element };
|
|
20660
|
-
if (item.version) inspector.append(item.version.element);
|
|
21296
|
+
syncSelectedInspector(selectedHost.hostId, item);
|
|
20661
21297
|
};
|
|
20662
|
-
const
|
|
20663
|
-
|
|
20664
|
-
|
|
20665
|
-
document2,
|
|
21298
|
+
const ensureRowView = (key, groupable) => {
|
|
21299
|
+
let view = hostRows.get(key);
|
|
21300
|
+
if (!view) {
|
|
21301
|
+
view = createConnectionRowView(document2, messages, groupable);
|
|
21302
|
+
hostRows.set(key, view);
|
|
21303
|
+
}
|
|
21304
|
+
return view;
|
|
21305
|
+
};
|
|
21306
|
+
const activeKeys = /* @__PURE__ */ new Set();
|
|
21307
|
+
const nextRowChildren = [];
|
|
21308
|
+
const pinnedItems = items.filter((item) => item.agentSnapshot === void 0);
|
|
21309
|
+
for (const pinnedItem of pinnedItems) {
|
|
21310
|
+
activeKeys.add(pinnedItem.key);
|
|
21311
|
+
const view = ensureRowView(pinnedItem.key, false);
|
|
21312
|
+
view.update(
|
|
20666
21313
|
pinnedItem,
|
|
20667
|
-
messages,
|
|
20668
21314
|
pinnedItem.key === selectedItemKey,
|
|
20669
|
-
() => selectItem(pinnedItem)
|
|
21315
|
+
() => selectItem(pinnedItem),
|
|
21316
|
+
null
|
|
20670
21317
|
);
|
|
20671
|
-
|
|
20672
|
-
rows.append(row);
|
|
21318
|
+
nextRowChildren.push(view.element);
|
|
20673
21319
|
}
|
|
20674
21320
|
const groupableItems = items.filter(
|
|
20675
21321
|
(item) => item.agentSnapshot !== void 0
|
|
20676
21322
|
);
|
|
20677
21323
|
const agentByKey = new Map(groupableItems.map((item) => [item.key, item]));
|
|
20678
|
-
|
|
20679
|
-
const
|
|
20680
|
-
|
|
20681
|
-
|
|
20682
|
-
|
|
20683
|
-
|
|
20684
|
-
|
|
20685
|
-
|
|
20686
|
-
|
|
21324
|
+
currentCatalog = groupableItems.map((item) => ({ id: item.key, name: item.name }));
|
|
21325
|
+
const notInstalledAgents = /* @__PURE__ */ new Set();
|
|
21326
|
+
for (const item of groupableItems) {
|
|
21327
|
+
const agent = item.agentSnapshot.agent;
|
|
21328
|
+
const stateKey = `${selectedHost.hostId}:${agent}`;
|
|
21329
|
+
if (item.agentSnapshot.availability !== "checking") {
|
|
21330
|
+
knownNotInstalled.set(stateKey, item.agentSnapshot.availability === "notInstalled");
|
|
21331
|
+
}
|
|
21332
|
+
const isNotInstalled = item.agentSnapshot.availability === "checking" ? knownNotInstalled.get(stateKey) ?? false : item.agentSnapshot.availability === "notInstalled";
|
|
21333
|
+
if (isNotInstalled) notInstalledAgents.add(agent);
|
|
21334
|
+
}
|
|
21335
|
+
const preferenceOrder = groupPreference.list(notInstalledAgents, currentCatalog).filter((entry) => agentByKey.has(entry.agent));
|
|
21336
|
+
currentMainEntries = preferenceOrder.filter((entry) => entry.section === "main");
|
|
21337
|
+
currentMoreEntries = preferenceOrder.filter((entry) => entry.section === "more");
|
|
20687
21338
|
const nextInSection = (section, agent) => {
|
|
20688
|
-
const
|
|
20689
|
-
const index =
|
|
20690
|
-
return index >= 0 ?
|
|
20691
|
-
};
|
|
20692
|
-
let draggingAgent = null;
|
|
20693
|
-
let moreZone = null;
|
|
20694
|
-
const clearDropIndicators = () => {
|
|
20695
|
-
for (const row of rowElements.values()) row.dataset.connectionDropIndicator = "";
|
|
20696
|
-
if (moreZone) moreZone.dataset.connectionDragOver = "false";
|
|
21339
|
+
const sectionEntries = section === "main" ? currentMainEntries : currentMoreEntries;
|
|
21340
|
+
const index = sectionEntries.findIndex((entry) => entry.agent === agent);
|
|
21341
|
+
return index >= 0 ? sectionEntries[index + 1]?.agent ?? null : null;
|
|
20697
21342
|
};
|
|
20698
21343
|
const dropTargetSection = (agent, event) => {
|
|
20699
|
-
const row =
|
|
21344
|
+
const row = currentHostRows.get(agent)?.element;
|
|
20700
21345
|
const rect = row && typeof row.getBoundingClientRect === "function" ? row.getBoundingClientRect() : null;
|
|
20701
21346
|
const before = rect ? event.clientY - rect.top < rect.height / 2 : true;
|
|
20702
21347
|
const section = row?.dataset.connectionGroupSection ?? "main";
|
|
@@ -20708,7 +21353,12 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20708
21353
|
moveLabel: section === "main" ? messages.connectionGroupMoveToMore : messages.connectionGroupMoveToMain,
|
|
20709
21354
|
dragHandleTitle: messages.connectionGroupDragHandle,
|
|
20710
21355
|
toggleSection() {
|
|
20711
|
-
groupPreference.moveAgent(
|
|
21356
|
+
groupPreference.moveAgent(
|
|
21357
|
+
agent,
|
|
21358
|
+
section === "main" ? "more" : "main",
|
|
21359
|
+
null,
|
|
21360
|
+
currentCatalog
|
|
21361
|
+
);
|
|
20712
21362
|
},
|
|
20713
21363
|
onDragStart(event) {
|
|
20714
21364
|
if (groupDisabled) {
|
|
@@ -20718,127 +21368,107 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20718
21368
|
draggingAgent = agent;
|
|
20719
21369
|
event.dataTransfer?.setData("text/plain", agent);
|
|
20720
21370
|
if (event.dataTransfer) event.dataTransfer.effectAllowed = "move";
|
|
20721
|
-
const row =
|
|
21371
|
+
const row = currentHostRows.get(agent)?.element;
|
|
20722
21372
|
if (row) row.dataset.connectionDragging = "true";
|
|
20723
21373
|
},
|
|
20724
21374
|
onDragOver(event) {
|
|
20725
21375
|
if (!draggingAgent || draggingAgent === agent) return;
|
|
20726
21376
|
event.preventDefault();
|
|
20727
|
-
const row =
|
|
21377
|
+
const row = currentHostRows.get(agent)?.element;
|
|
20728
21378
|
if (!row) return;
|
|
20729
21379
|
const { before } = dropTargetSection(agent, event);
|
|
20730
21380
|
clearDropIndicators();
|
|
20731
21381
|
row.dataset.connectionDropIndicator = before ? "before" : "after";
|
|
20732
21382
|
},
|
|
20733
21383
|
onDragLeave() {
|
|
20734
|
-
const row =
|
|
21384
|
+
const row = currentHostRows.get(agent)?.element;
|
|
20735
21385
|
if (row) row.dataset.connectionDropIndicator = "";
|
|
20736
21386
|
},
|
|
20737
21387
|
onDrop(event) {
|
|
20738
21388
|
event.preventDefault();
|
|
20739
21389
|
if (!draggingAgent) return;
|
|
20740
21390
|
const { beforeAgent } = dropTargetSection(agent, event);
|
|
20741
|
-
groupPreference.moveAgent(draggingAgent, section, beforeAgent,
|
|
21391
|
+
groupPreference.moveAgent(draggingAgent, section, beforeAgent, currentCatalog);
|
|
20742
21392
|
draggingAgent = null;
|
|
20743
21393
|
clearDropIndicators();
|
|
20744
21394
|
},
|
|
20745
21395
|
onDragEnd() {
|
|
20746
21396
|
draggingAgent = null;
|
|
20747
|
-
const row =
|
|
21397
|
+
const row = currentHostRows.get(agent)?.element;
|
|
20748
21398
|
if (row) row.dataset.connectionDragging = "false";
|
|
20749
21399
|
clearDropIndicators();
|
|
21400
|
+
scheduleRender();
|
|
20750
21401
|
}
|
|
20751
21402
|
});
|
|
20752
|
-
const
|
|
20753
|
-
const item = agentByKey.get(agent);
|
|
20754
|
-
if (!item)
|
|
20755
|
-
|
|
20756
|
-
|
|
21403
|
+
for (const entry of currentMainEntries) {
|
|
21404
|
+
const item = agentByKey.get(entry.agent);
|
|
21405
|
+
if (!item) continue;
|
|
21406
|
+
activeKeys.add(item.key);
|
|
21407
|
+
const view = ensureRowView(item.key, true);
|
|
21408
|
+
view.update(
|
|
20757
21409
|
item,
|
|
20758
|
-
messages,
|
|
20759
21410
|
item.key === selectedItemKey,
|
|
20760
21411
|
() => selectItem(item),
|
|
20761
|
-
createGroupController(agent,
|
|
21412
|
+
createGroupController(entry.agent, "main")
|
|
20762
21413
|
);
|
|
20763
|
-
|
|
20764
|
-
|
|
20765
|
-
};
|
|
20766
|
-
for (const entry of mainEntries) appendGroupRow(entry.agent, "main");
|
|
21414
|
+
nextRowChildren.push(view.element);
|
|
21415
|
+
}
|
|
20767
21416
|
if (groupableItems.length > 0) {
|
|
20768
|
-
|
|
20769
|
-
|
|
20770
|
-
|
|
20771
|
-
|
|
20772
|
-
|
|
20773
|
-
|
|
20774
|
-
|
|
20775
|
-
|
|
20776
|
-
zone.dataset.connectionDragOver = "true";
|
|
20777
|
-
});
|
|
20778
|
-
zone.addEventListener("dragleave", () => {
|
|
20779
|
-
zone.dataset.connectionDragOver = "false";
|
|
20780
|
-
});
|
|
20781
|
-
zone.addEventListener("drop", (event) => {
|
|
20782
|
-
event.preventDefault();
|
|
20783
|
-
zone.dataset.connectionDragOver = "false";
|
|
20784
|
-
if (!draggingAgent) return;
|
|
20785
|
-
groupPreference.moveAgent(draggingAgent, "more", null, catalog);
|
|
20786
|
-
draggingAgent = null;
|
|
20787
|
-
clearDropIndicators();
|
|
20788
|
-
});
|
|
20789
|
-
if (moreEntries.length === 0) {
|
|
20790
|
-
zone.append(createGroupMoreHint(document2, messages));
|
|
21417
|
+
const dividerText = `${messages.connectionGroupMoreLabel} (${currentMoreEntries.length})`;
|
|
21418
|
+
if (groupDivider.textContent !== dividerText) {
|
|
21419
|
+
groupDivider.textContent = dividerText;
|
|
21420
|
+
}
|
|
21421
|
+
nextRowChildren.push(groupDivider);
|
|
21422
|
+
const nextMoreChildren = [];
|
|
21423
|
+
if (currentMoreEntries.length === 0) {
|
|
21424
|
+
nextMoreChildren.push(moreHint);
|
|
20791
21425
|
} else {
|
|
20792
|
-
for (const entry of
|
|
21426
|
+
for (const entry of currentMoreEntries) {
|
|
20793
21427
|
const item = agentByKey.get(entry.agent);
|
|
20794
21428
|
if (!item) continue;
|
|
20795
|
-
|
|
20796
|
-
|
|
21429
|
+
activeKeys.add(item.key);
|
|
21430
|
+
const view = ensureRowView(item.key, true);
|
|
21431
|
+
view.update(
|
|
20797
21432
|
item,
|
|
20798
|
-
messages,
|
|
20799
21433
|
item.key === selectedItemKey,
|
|
20800
21434
|
() => selectItem(item),
|
|
20801
21435
|
createGroupController(entry.agent, "more")
|
|
20802
21436
|
);
|
|
20803
|
-
|
|
20804
|
-
zone.append(row);
|
|
21437
|
+
nextMoreChildren.push(view.element);
|
|
20805
21438
|
}
|
|
20806
21439
|
}
|
|
20807
|
-
|
|
20808
|
-
|
|
20809
|
-
|
|
20810
|
-
|
|
20811
|
-
|
|
20812
|
-
|
|
21440
|
+
if (!draggingAgent || renderedHostId !== selectedHost.hostId) {
|
|
21441
|
+
reconcileElementChildren(moreZone, nextMoreChildren);
|
|
21442
|
+
}
|
|
21443
|
+
nextRowChildren.push(moreZone);
|
|
21444
|
+
resetButton.disabled = groupDisabled;
|
|
21445
|
+
nextRowChildren.push(resetButton);
|
|
21446
|
+
}
|
|
21447
|
+
for (const key of hostRows.keys()) {
|
|
21448
|
+
if (!activeKeys.has(key)) hostRows.delete(key);
|
|
21449
|
+
}
|
|
21450
|
+
if (!draggingAgent || renderedHostId !== selectedHost.hostId) {
|
|
21451
|
+
reconcileElementChildren(rows, nextRowChildren);
|
|
20813
21452
|
}
|
|
20814
21453
|
const selectedItem = items.find((item) => item.key === selectedItemKey) ?? items[0];
|
|
20815
21454
|
if (selectedItem) selectItem(selectedItem);
|
|
20816
|
-
|
|
21455
|
+
updateControls.update(
|
|
20817
21456
|
selectedHost.hostId,
|
|
20818
21457
|
items.flatMap((item) => item.version ? [item.version] : [])
|
|
20819
21458
|
);
|
|
20820
|
-
|
|
20821
|
-
|
|
20822
|
-
|
|
20823
|
-
|
|
20824
|
-
|
|
20825
|
-
|
|
20826
|
-
|
|
20827
|
-
|
|
20828
|
-
|
|
20829
|
-
|
|
20830
|
-
|
|
20831
|
-
|
|
20832
|
-
|
|
20833
|
-
const selectedTab = [...tabs.children].find(
|
|
20834
|
-
(child) => child.getAttribute("aria-selected") === "true"
|
|
20835
|
-
);
|
|
20836
|
-
if (selectedTab) {
|
|
20837
|
-
const left = selectedTab.offsetLeft;
|
|
20838
|
-
const right = left + selectedTab.offsetWidth;
|
|
20839
|
-
if (left < tabs.scrollLeft) tabs.scrollLeft = left;
|
|
20840
|
-
else if (right > tabs.scrollLeft + tabs.clientWidth) {
|
|
20841
|
-
tabs.scrollLeft = right - tabs.clientWidth;
|
|
21459
|
+
if (layoutFirstMount || tabsChanged) {
|
|
21460
|
+
hostScroller.update();
|
|
21461
|
+
}
|
|
21462
|
+
if (renderedHostId !== selectedHost.hostId) {
|
|
21463
|
+
renderedHostId = selectedHost.hostId;
|
|
21464
|
+
const selectedTab = hostTabElements.get(selectedHost.hostId);
|
|
21465
|
+
if (selectedTab) {
|
|
21466
|
+
const left = selectedTab.offsetLeft;
|
|
21467
|
+
const right = left + selectedTab.offsetWidth;
|
|
21468
|
+
if (left < tabs.scrollLeft) tabs.scrollLeft = left;
|
|
21469
|
+
else if (right > tabs.scrollLeft + tabs.clientWidth) {
|
|
21470
|
+
tabs.scrollLeft = right - tabs.clientWidth;
|
|
21471
|
+
}
|
|
20842
21472
|
}
|
|
20843
21473
|
}
|
|
20844
21474
|
};
|
|
@@ -20859,7 +21489,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20859
21489
|
refresh.disabled = true;
|
|
20860
21490
|
return () => {
|
|
20861
21491
|
cancelRender();
|
|
20862
|
-
|
|
21492
|
+
hostScroller.dispose();
|
|
20863
21493
|
unsubscribeGroup();
|
|
20864
21494
|
};
|
|
20865
21495
|
}
|
|
@@ -20868,7 +21498,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20868
21498
|
const unsubscribeInstalls = installs?.subscribe(scheduleRender);
|
|
20869
21499
|
return () => {
|
|
20870
21500
|
cancelRender();
|
|
20871
|
-
|
|
21501
|
+
hostScroller.dispose();
|
|
20872
21502
|
unsubscribeInstalls?.();
|
|
20873
21503
|
unsubscribe();
|
|
20874
21504
|
unsubscribeGroup();
|
|
@@ -21120,7 +21750,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
21120
21750
|
launchPathSaveError: "Could not save. Enter an existing absolute installation folder on this Host and check configuration permissions.",
|
|
21121
21751
|
connectionOfficialWebsite: "Visit official website",
|
|
21122
21752
|
connectionOpenHarnessWeb: "Open DeepSeek Harness Web",
|
|
21123
|
-
connectionDeepSeekTestedVersions: "Supported DSH versions: 0.1.7-rc.1, 0.1.7-rc.2, 0.2.0-rc.1, 0.2.0-rc.2, 0.2.1-rc.1, 0.2.1-rc.2, 0.2.1-rc.3, 0.2.1-rc.4, 0.2.1-rc.5 and 0.2.2-rc.
|
|
21753
|
+
connectionDeepSeekTestedVersions: "Supported DSH versions: 0.1.7-rc.1, 0.1.7-rc.2, 0.2.0-rc.1, 0.2.0-rc.2, 0.2.1-rc.1, 0.2.1-rc.2, 0.2.1-rc.3, 0.2.1-rc.4, 0.2.1-rc.5, 0.2.2-rc.1 and 0.2.2-rc.2. Versions newer than 0.2.2-rc.2 can be tried, but compatibility may be limited; versions older than 0.1.7-rc.1 must be upgraded first.",
|
|
21124
21754
|
connectionInstall: "Install",
|
|
21125
21755
|
connectionInstallDescription: "This Harness was not detected.",
|
|
21126
21756
|
connectionInstallRunning: "Installing on the selected Host. You can leave this page; login or setup may still be required afterward.",
|
|
@@ -21402,7 +22032,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
21402
22032
|
launchPathSaveError: "\u4FDD\u5B58\u5931\u8D25\u3002\u8BF7\u586B\u5199\u6B64 Host \u4E0A\u5B9E\u9645\u5B58\u5728\u7684\u5B89\u88C5\u76EE\u5F55\u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u5E76\u786E\u8BA4\u914D\u7F6E\u76EE\u5F55\u53EF\u5199\u3002",
|
|
21403
22033
|
connectionOfficialWebsite: "\u8BBF\u95EE\u5B98\u7F51",
|
|
21404
22034
|
connectionOpenHarnessWeb: "\u6253\u5F00 DeepSeek Harness Web",
|
|
21405
|
-
connectionDeepSeekTestedVersions: "\u652F\u6301 DSH \u7248\u672C\uFF1A0.1.7-rc.1\u30010.1.7-rc.2\u30010.2.0-rc.1\u30010.2.0-rc.2\u30010.2.1-rc.1\u30010.2.1-rc.2\u30010.2.1-rc.3\u30010.2.1-rc.4\u30010.2.1-rc.5 \u548C 0.2.2-rc.
|
|
22035
|
+
connectionDeepSeekTestedVersions: "\u652F\u6301 DSH \u7248\u672C\uFF1A0.1.7-rc.1\u30010.1.7-rc.2\u30010.2.0-rc.1\u30010.2.0-rc.2\u30010.2.1-rc.1\u30010.2.1-rc.2\u30010.2.1-rc.3\u30010.2.1-rc.4\u30010.2.1-rc.5\u30010.2.2-rc.1 \u548C 0.2.2-rc.2\u3002\u9AD8\u4E8E 0.2.2-rc.2 \u7684\u7248\u672C\u53EF\u4EE5\u5C1D\u8BD5\u8FDE\u63A5\uFF0C\u4F46\u9002\u914D\u5EA6\u53EF\u80FD\u6709\u9650\uFF1B\u4F4E\u4E8E 0.1.7-rc.1 \u7684\u7248\u672C\u9700\u8981\u5148\u5347\u7EA7\u3002",
|
|
21406
22036
|
connectionInstall: "\u5B89\u88C5",
|
|
21407
22037
|
connectionInstallDescription: "\u5C1A\u672A\u68C0\u6D4B\u5230\u8BE5 Harness\u3002",
|
|
21408
22038
|
connectionInstallRunning: "\u6B63\u5728\u6240\u9009 Host \u4E0A\u5B89\u88C5\uFF0C\u79BB\u5F00\u9875\u9762\u4E0D\u4F1A\u4E2D\u65AD\u3002\u5B89\u88C5\u540E\u53EF\u80FD\u4ECD\u9700\u767B\u5F55\u6216\u914D\u7F6E\u3002",
|
|
@@ -22275,6 +22905,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
22275
22905
|
latestCacheHit: "Latest cache hit (CH)",
|
|
22276
22906
|
sessionCacheHit: "Average cache hit",
|
|
22277
22907
|
outputSpeed: "Output speed (TPS)",
|
|
22908
|
+
averageOutputSpeed: "Average output speed (TPS)",
|
|
22278
22909
|
apiOutputSpeed: "API average speed",
|
|
22279
22910
|
apiOutputSpeedDescription: "Output tokens / native API time, including first-token wait; not generation TPS.",
|
|
22280
22911
|
timeToFirstOutput: "Time to first token (TTFT)",
|
|
@@ -22300,6 +22931,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
22300
22931
|
latestCacheHit: "\u6700\u8FD1\u7F13\u5B58\u547D\u4E2D\uFF08CH\uFF09",
|
|
22301
22932
|
sessionCacheHit: "\u5E73\u5747\u7F13\u5B58\u547D\u4E2D",
|
|
22302
22933
|
outputSpeed: "\u8F93\u51FA\u901F\u5EA6\uFF08TPS\uFF09",
|
|
22934
|
+
averageOutputSpeed: "\u5E73\u5747\u8F93\u51FA\u901F\u5EA6\uFF08TPS\uFF09",
|
|
22303
22935
|
apiOutputSpeed: "API \u5E73\u5747\u901F\u5EA6",
|
|
22304
22936
|
apiOutputSpeedDescription: "\u8F93\u51FA Token \xF7 \u539F\u751F API \u8017\u65F6\uFF0C\u542B\u9996\u5B57\u7B49\u5F85\uFF1B\u4E0D\u662F\u751F\u6210 TPS\u3002",
|
|
22305
22937
|
timeToFirstOutput: "\u9996 token\uFF08TTFT\uFF09",
|
|
@@ -22397,7 +23029,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
22397
23029
|
return svg2;
|
|
22398
23030
|
}
|
|
22399
23031
|
function rendererUsageHasDisplayData(usage) {
|
|
22400
|
-
return usage?.cacheHitRatePercent !== void 0 || usage?.sessionCacheHitRatePercent !== void 0 || usage?.outputTokensPerSecond !== void 0 || usage?.apiOutputTokensPerSecond !== void 0 || usage?.timeToFirstOutputMs !== void 0 || usage?.totalCostUsd !== void 0 || usage?.totalCredits !== void 0 || usage?.contextUsagePercent !== void 0 || usage?.contextUsedTokens !== void 0 && usage.contextWindowTokens !== void 0 || usage?.totalTokens !== void 0 || usage?.inputTokens !== void 0 || usage?.cachedInputTokens !== void 0 || usage?.cacheWriteInputTokens !== void 0 || usage?.outputTokens !== void 0;
|
|
23032
|
+
return usage?.cacheHitRatePercent !== void 0 || usage?.sessionCacheHitRatePercent !== void 0 || usage?.sessionOutputTokensPerSecond !== void 0 || usage?.outputTokensPerSecond !== void 0 || usage?.apiOutputTokensPerSecond !== void 0 || usage?.timeToFirstOutputMs !== void 0 || usage?.totalCostUsd !== void 0 || usage?.totalCredits !== void 0 || usage?.contextUsagePercent !== void 0 || usage?.contextUsedTokens !== void 0 && usage.contextWindowTokens !== void 0 || usage?.totalTokens !== void 0 || usage?.inputTokens !== void 0 || usage?.cachedInputTokens !== void 0 || usage?.cacheWriteInputTokens !== void 0 || usage?.outputTokens !== void 0;
|
|
22401
23033
|
}
|
|
22402
23034
|
function applyRendererPopoverChrome(popover) {
|
|
22403
23035
|
popover.style.border = "1px solid light-dark(rgba(15, 23, 42, 0.10), color-mix(in srgb, CanvasText 16%, transparent))";
|
|
@@ -22510,6 +23142,12 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
22510
23142
|
formatRendererCacheHitRate(usage.sessionCacheHitRatePercent)
|
|
22511
23143
|
]);
|
|
22512
23144
|
}
|
|
23145
|
+
if (usage?.sessionOutputTokensPerSecond !== void 0) {
|
|
23146
|
+
session.push([
|
|
23147
|
+
messages.averageOutputSpeed,
|
|
23148
|
+
formatRendererTokenRate(usage.sessionOutputTokensPerSecond, locale)
|
|
23149
|
+
]);
|
|
23150
|
+
}
|
|
22513
23151
|
if (usage?.cacheHitRatePercent !== void 0) {
|
|
22514
23152
|
session.push([messages.latestCacheHit, formatRendererCacheHitRate(usage.cacheHitRatePercent)]);
|
|
22515
23153
|
}
|
|
@@ -23059,7 +23697,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
23059
23697
|
}
|
|
23060
23698
|
function rendererLiveCommandsPendingNotice(locale, harnessLabel) {
|
|
23061
23699
|
const harness2 = harnessLabel.replace(/\s*[((][^))]*[))]\s*$/u, "").trim() || harnessLabel;
|
|
23062
|
-
return locale === "zh-CN" ? `\u53D1\u9001\u4E00\u6761\u6D88\u606F\u540E\uFF0C\u4F1A\u52A0\u8F7D ${harness2} \u5728\u5F53\u524D\u9879\u76EE\u7684\u5168\u90E8\u547D\u4EE4
|
|
23700
|
+
return locale === "zh-CN" ? `\u53D1\u9001\u4E00\u6761\u6D88\u606F\u540E\uFF0C\u4F1A\u52A0\u8F7D ${harness2} \u5728\u5F53\u524D\u9879\u76EE\u7684\u5168\u90E8\u547D\u4EE4` : `Send a message to load all ${harness2} commands for this project`;
|
|
23063
23701
|
}
|
|
23064
23702
|
|
|
23065
23703
|
// src/renderer-model-favorites.ts
|
|
@@ -24336,9 +24974,13 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24336
24974
|
resets: "Resets",
|
|
24337
24975
|
details: "Account limit details",
|
|
24338
24976
|
weekly: "Weekly limit",
|
|
24977
|
+
weeklyShort: "Weekly",
|
|
24339
24978
|
monthly: "Monthly limit",
|
|
24979
|
+
monthlyShort: "Monthly",
|
|
24340
24980
|
fiveHour: "5-hour limit",
|
|
24981
|
+
fiveHourShort: "5-hour",
|
|
24341
24982
|
sevenDay: "7-day limit",
|
|
24983
|
+
sevenDayShort: "7-day",
|
|
24342
24984
|
account: "Account limit"
|
|
24343
24985
|
});
|
|
24344
24986
|
var CHINESE_CREDITS_MESSAGES = Object.freeze({
|
|
@@ -24346,9 +24988,13 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24346
24988
|
resets: "\u91CD\u7F6E",
|
|
24347
24989
|
details: "\u8D26\u53F7\u989D\u5EA6\u8BE6\u60C5",
|
|
24348
24990
|
weekly: "\u5468\u989D\u5EA6",
|
|
24991
|
+
weeklyShort: "\u5468\u989D\u5EA6",
|
|
24349
24992
|
monthly: "\u6708\u989D\u5EA6",
|
|
24993
|
+
monthlyShort: "\u6708\u989D\u5EA6",
|
|
24350
24994
|
fiveHour: "5 \u5C0F\u65F6\u989D\u5EA6",
|
|
24995
|
+
fiveHourShort: "5 \u5C0F\u65F6",
|
|
24351
24996
|
sevenDay: "7 \u5929\u989D\u5EA6",
|
|
24997
|
+
sevenDayShort: "7 \u5929",
|
|
24352
24998
|
account: "\u8D26\u53F7\u989D\u5EA6"
|
|
24353
24999
|
});
|
|
24354
25000
|
function rendererCreditsMessages(locale) {
|
|
@@ -24380,6 +25026,14 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24380
25026
|
if (periodType === "seven_day") return messages.sevenDay;
|
|
24381
25027
|
return messages.account;
|
|
24382
25028
|
}
|
|
25029
|
+
function compactPeriodLabel(periodType, locale) {
|
|
25030
|
+
const messages = rendererCreditsMessages(locale);
|
|
25031
|
+
if (periodType === "weekly") return messages.weeklyShort;
|
|
25032
|
+
if (periodType === "monthly") return messages.monthlyShort;
|
|
25033
|
+
if (periodType === "five_hour") return messages.fiveHourShort;
|
|
25034
|
+
if (periodType === "seven_day") return messages.sevenDayShort;
|
|
25035
|
+
return messages.account;
|
|
25036
|
+
}
|
|
24383
25037
|
function productLabel(product, locale = "en") {
|
|
24384
25038
|
return accountCreditsWindowLabel(product, locale, (period) => creditsPeriodLabel(period, locale));
|
|
24385
25039
|
}
|
|
@@ -24391,10 +25045,10 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24391
25045
|
function remainingPercent(usedPercent) {
|
|
24392
25046
|
return Math.min(100, Math.max(0, 100 - usedPercent));
|
|
24393
25047
|
}
|
|
24394
|
-
function renderCreditsBar(usagePercent, color) {
|
|
25048
|
+
function renderCreditsBar(usagePercent, color, height = "6px") {
|
|
24395
25049
|
const track = document.createElement("div");
|
|
24396
25050
|
track.dataset.codexhostCreditsBar = "";
|
|
24397
|
-
track.style.height =
|
|
25051
|
+
track.style.height = height;
|
|
24398
25052
|
track.style.borderRadius = "9999px";
|
|
24399
25053
|
track.style.background = "color-mix(in srgb, currentColor 16%, transparent)";
|
|
24400
25054
|
track.style.overflow = "hidden";
|
|
@@ -24411,6 +25065,34 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24411
25065
|
const formatted = formatRendererCreditsReset(resetsAt, /* @__PURE__ */ new Date(), locale);
|
|
24412
25066
|
return locale === "zh-CN" ? `${formatted} ${messages.resets}` : `${messages.resets} ${formatted}`;
|
|
24413
25067
|
}
|
|
25068
|
+
function renderResetLine(resetsAt, fontSize, locale, messages) {
|
|
25069
|
+
const exact = resetLabel(resetsAt, locale, messages);
|
|
25070
|
+
const reset = document.createElement("div");
|
|
25071
|
+
reset.dataset.codexhostResetAt = resetsAt;
|
|
25072
|
+
reset.dataset.codexhostResetLocale = locale;
|
|
25073
|
+
reset.textContent = formatAccountCreditsResetCountdown(resetsAt, locale) ?? exact;
|
|
25074
|
+
reset.title = exact;
|
|
25075
|
+
reset.style.fontSize = fontSize;
|
|
25076
|
+
reset.style.color = "color-mix(in srgb, currentColor 62%, transparent)";
|
|
25077
|
+
return reset;
|
|
25078
|
+
}
|
|
25079
|
+
function refreshResetLines(popover) {
|
|
25080
|
+
if (typeof popover.querySelectorAll !== "function") return;
|
|
25081
|
+
const nowMs = Date.now();
|
|
25082
|
+
for (const element of popover.querySelectorAll("[data-codexhost-reset-at]")) {
|
|
25083
|
+
const resetsAt = element.dataset.codexhostResetAt;
|
|
25084
|
+
if (!resetsAt) continue;
|
|
25085
|
+
const locale = element.dataset.codexhostResetLocale === "zh-CN" ? "zh-CN" : "en";
|
|
25086
|
+
const exact = resetLabel(resetsAt, locale, rendererCreditsMessages(locale));
|
|
25087
|
+
if (element.dataset.codexhostResetCompact === "1") {
|
|
25088
|
+
const compact = formatAccountCreditsCompactCountdown(resetsAt, locale, nowMs);
|
|
25089
|
+
element.textContent = `\xB7 ${compact ?? exact}`;
|
|
25090
|
+
} else {
|
|
25091
|
+
element.textContent = formatAccountCreditsResetCountdown(resetsAt, locale, nowMs) ?? exact;
|
|
25092
|
+
}
|
|
25093
|
+
element.title = exact;
|
|
25094
|
+
}
|
|
25095
|
+
}
|
|
24414
25096
|
function renderCreditsHeader(credits, locale, messages) {
|
|
24415
25097
|
const wrapper = document.createElement("div");
|
|
24416
25098
|
wrapper.style.marginBottom = "11px";
|
|
@@ -24427,11 +25109,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24427
25109
|
label.style.fontWeight = "600";
|
|
24428
25110
|
left.append(label);
|
|
24429
25111
|
if (credits.resetsAt) {
|
|
24430
|
-
|
|
24431
|
-
reset.textContent = resetLabel(credits.resetsAt, locale, messages);
|
|
24432
|
-
reset.style.fontSize = "11px";
|
|
24433
|
-
reset.style.color = "color-mix(in srgb, currentColor 62%, transparent)";
|
|
24434
|
-
left.append(reset);
|
|
25112
|
+
left.append(renderResetLine(credits.resetsAt, "11px", locale, messages));
|
|
24435
25113
|
}
|
|
24436
25114
|
const color = toneColor(rendererCreditsTone(credits.usedPercent));
|
|
24437
25115
|
const remaining = remainingPercent(credits.usedPercent);
|
|
@@ -24460,7 +25138,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24460
25138
|
const color = toneColor(rendererCreditsTone(usagePercent));
|
|
24461
25139
|
const remaining = remainingPercent(usagePercent);
|
|
24462
25140
|
const tile = document.createElement("div");
|
|
24463
|
-
tile.style.marginBottom = "
|
|
25141
|
+
tile.style.marginBottom = "9px";
|
|
24464
25142
|
const top = document.createElement("div");
|
|
24465
25143
|
top.style.display = "flex";
|
|
24466
25144
|
top.style.alignItems = "flex-start";
|
|
@@ -24473,40 +25151,137 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24473
25151
|
name.style.fontSize = "12px";
|
|
24474
25152
|
left.append(name);
|
|
24475
25153
|
if (resetsAt) {
|
|
24476
|
-
|
|
24477
|
-
reset.textContent = resetLabel(resetsAt, locale, messages);
|
|
24478
|
-
reset.style.fontSize = "10.5px";
|
|
24479
|
-
reset.style.color = "color-mix(in srgb, currentColor 62%, transparent)";
|
|
24480
|
-
left.append(reset);
|
|
25154
|
+
left.append(renderResetLine(resetsAt, "10.5px", locale, messages));
|
|
24481
25155
|
}
|
|
24482
25156
|
const percent2 = document.createElement("span");
|
|
24483
25157
|
percent2.textContent = `${messages.remaining} ${formatRendererCreditsPercent(remaining)}`;
|
|
24484
25158
|
percent2.style.fontSize = "12px";
|
|
24485
25159
|
percent2.style.fontVariantNumeric = "tabular-nums";
|
|
25160
|
+
percent2.style.whiteSpace = "nowrap";
|
|
24486
25161
|
percent2.style.color = color;
|
|
24487
25162
|
top.append(left, percent2);
|
|
24488
25163
|
tile.append(top, renderCreditsBar(remaining, color));
|
|
24489
25164
|
return tile;
|
|
24490
25165
|
}
|
|
25166
|
+
function renderCompactCreditsRow(label, usagePercent, locale, messages, resetsAt, hero = false) {
|
|
25167
|
+
const color = toneColor(rendererCreditsTone(usagePercent));
|
|
25168
|
+
const remaining = remainingPercent(usagePercent);
|
|
25169
|
+
const row = document.createElement("div");
|
|
25170
|
+
row.style.marginBottom = "8px";
|
|
25171
|
+
const top = document.createElement("div");
|
|
25172
|
+
top.style.display = "flex";
|
|
25173
|
+
top.style.alignItems = "baseline";
|
|
25174
|
+
top.style.justifyContent = "space-between";
|
|
25175
|
+
top.style.gap = "8px";
|
|
25176
|
+
top.style.marginBottom = "4px";
|
|
25177
|
+
const left = document.createElement("span");
|
|
25178
|
+
left.style.display = "inline-flex";
|
|
25179
|
+
left.style.alignItems = "baseline";
|
|
25180
|
+
left.style.gap = "6px";
|
|
25181
|
+
left.style.minWidth = "0";
|
|
25182
|
+
const name = document.createElement("span");
|
|
25183
|
+
name.textContent = label;
|
|
25184
|
+
name.style.fontSize = "12px";
|
|
25185
|
+
name.style.color = "color-mix(in srgb, currentColor 82%, transparent)";
|
|
25186
|
+
left.append(name);
|
|
25187
|
+
if (resetsAt) {
|
|
25188
|
+
const exact = resetLabel(resetsAt, locale, messages);
|
|
25189
|
+
if (usagePercent > 0) {
|
|
25190
|
+
const countdown = document.createElement("span");
|
|
25191
|
+
countdown.dataset.codexhostResetAt = resetsAt;
|
|
25192
|
+
countdown.dataset.codexhostResetLocale = locale;
|
|
25193
|
+
countdown.dataset.codexhostResetCompact = "1";
|
|
25194
|
+
const compact = formatAccountCreditsCompactCountdown(resetsAt, locale);
|
|
25195
|
+
countdown.textContent = `\xB7 ${compact ?? exact}`;
|
|
25196
|
+
countdown.title = exact;
|
|
25197
|
+
countdown.style.fontSize = "11px";
|
|
25198
|
+
countdown.style.color = "color-mix(in srgb, currentColor 52%, transparent)";
|
|
25199
|
+
countdown.style.whiteSpace = "nowrap";
|
|
25200
|
+
left.append(countdown);
|
|
25201
|
+
} else {
|
|
25202
|
+
left.title = exact;
|
|
25203
|
+
}
|
|
25204
|
+
}
|
|
25205
|
+
const percent2 = document.createElement("span");
|
|
25206
|
+
percent2.textContent = formatRendererCreditsPercent(remaining);
|
|
25207
|
+
percent2.style.fontSize = hero ? "22px" : "13px";
|
|
25208
|
+
percent2.style.fontWeight = hero ? "700" : "600";
|
|
25209
|
+
if (hero) {
|
|
25210
|
+
percent2.style.lineHeight = "1";
|
|
25211
|
+
percent2.style.marginTop = "-6px";
|
|
25212
|
+
}
|
|
25213
|
+
percent2.style.fontVariantNumeric = "tabular-nums";
|
|
25214
|
+
percent2.style.whiteSpace = "nowrap";
|
|
25215
|
+
percent2.style.color = color;
|
|
25216
|
+
top.append(left, percent2);
|
|
25217
|
+
row.append(top, renderCreditsBar(remaining, color, "4px"));
|
|
25218
|
+
return row;
|
|
25219
|
+
}
|
|
24491
25220
|
function renderDetails2(popover, credits, locale) {
|
|
24492
25221
|
const messages = rendererCreditsMessages(locale);
|
|
24493
25222
|
const glowColor = toneColor(rendererCreditsTone(credits.usedPercent));
|
|
24494
25223
|
popover.style.backgroundImage = `radial-gradient(160px 100px at 18% -10%, color-mix(in srgb, ${glowColor} 20%, transparent), transparent 70%)`;
|
|
24495
25224
|
popover.setAttribute("aria-label", messages.details);
|
|
24496
25225
|
popover.replaceChildren();
|
|
24497
|
-
|
|
24498
|
-
|
|
24499
|
-
|
|
24500
|
-
|
|
24501
|
-
|
|
24502
|
-
locale,
|
|
24503
|
-
messages,
|
|
24504
|
-
product.resetsAt
|
|
24505
|
-
)
|
|
25226
|
+
const sections = groupAccountCreditsWindows(
|
|
25227
|
+
credits,
|
|
25228
|
+
locale,
|
|
25229
|
+
(period) => creditsPeriodLabel(period, locale),
|
|
25230
|
+
(period) => compactPeriodLabel(period, locale)
|
|
24506
25231
|
);
|
|
24507
|
-
const
|
|
24508
|
-
if (
|
|
24509
|
-
|
|
25232
|
+
const firstScopedIndex = sections.findIndex((section) => section.title !== void 0);
|
|
25233
|
+
if (firstScopedIndex === -1) {
|
|
25234
|
+
popover.append(renderCreditsHeader(credits, locale, messages));
|
|
25235
|
+
const tiles = (credits.productUsage ?? []).map(
|
|
25236
|
+
(product) => renderCreditsTile(
|
|
25237
|
+
productLabel(product, locale),
|
|
25238
|
+
product.usagePercent,
|
|
25239
|
+
locale,
|
|
25240
|
+
messages,
|
|
25241
|
+
product.resetsAt
|
|
25242
|
+
)
|
|
25243
|
+
);
|
|
25244
|
+
const lastTile = tiles.at(-1);
|
|
25245
|
+
if (lastTile) lastTile.style.marginBottom = "0";
|
|
25246
|
+
popover.append(...tiles);
|
|
25247
|
+
return;
|
|
25248
|
+
}
|
|
25249
|
+
sections.forEach((section, sectionIndex) => {
|
|
25250
|
+
const group = document.createElement("div");
|
|
25251
|
+
if (sectionIndex > 0) {
|
|
25252
|
+
group.style.marginTop = "11px";
|
|
25253
|
+
group.style.paddingTop = "10px";
|
|
25254
|
+
group.style.borderTop = "1px solid color-mix(in srgb, currentColor 12%, transparent)";
|
|
25255
|
+
}
|
|
25256
|
+
if (section.title) {
|
|
25257
|
+
const heading = document.createElement("div");
|
|
25258
|
+
heading.textContent = section.title;
|
|
25259
|
+
heading.style.marginBottom = "7px";
|
|
25260
|
+
heading.style.fontSize = "12px";
|
|
25261
|
+
heading.style.fontWeight = "600";
|
|
25262
|
+
group.append(heading);
|
|
25263
|
+
}
|
|
25264
|
+
const tiles = section.windows.map(
|
|
25265
|
+
(window2, windowIndex) => section.title ? renderCompactCreditsRow(
|
|
25266
|
+
window2.label,
|
|
25267
|
+
window2.usedPercent,
|
|
25268
|
+
locale,
|
|
25269
|
+
messages,
|
|
25270
|
+
window2.resetsAt,
|
|
25271
|
+
sectionIndex === firstScopedIndex && windowIndex === 0
|
|
25272
|
+
) : renderCreditsTile(
|
|
25273
|
+
window2.scopeLabel ? `${window2.scopeLabel} \xB7 ${window2.label}` : window2.label,
|
|
25274
|
+
window2.usedPercent,
|
|
25275
|
+
locale,
|
|
25276
|
+
messages,
|
|
25277
|
+
window2.resetsAt
|
|
25278
|
+
)
|
|
25279
|
+
);
|
|
25280
|
+
const lastTile = tiles.at(-1);
|
|
25281
|
+
if (lastTile) lastTile.style.marginBottom = "0";
|
|
25282
|
+
group.append(...tiles);
|
|
25283
|
+
popover.append(group);
|
|
25284
|
+
});
|
|
24510
25285
|
}
|
|
24511
25286
|
function popoverIsOpen2(popover) {
|
|
24512
25287
|
try {
|
|
@@ -24533,6 +25308,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24533
25308
|
control.trigger.setAttribute("aria-expanded", "false");
|
|
24534
25309
|
}
|
|
24535
25310
|
function openPopover2(control) {
|
|
25311
|
+
refreshResetLines(control.popover);
|
|
24536
25312
|
positionPopover2(control);
|
|
24537
25313
|
control.popover.hidden = false;
|
|
24538
25314
|
if (typeof control.popover.showPopover === "function" && !popoverIsOpen2(control.popover)) {
|
|
@@ -26372,6 +27148,19 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
26372
27148
|
return externalThreadForkResultSchema.parse(result);
|
|
26373
27149
|
},
|
|
26374
27150
|
inspectHarness,
|
|
27151
|
+
async listSkills(params) {
|
|
27152
|
+
return skillsListResultSchema.parse(
|
|
27153
|
+
await manager.sendRequest(SKILLS_LIST_METHOD, skillsListParamsSchema.parse(params))
|
|
27154
|
+
);
|
|
27155
|
+
},
|
|
27156
|
+
subscribeSkillsChanged(listener) {
|
|
27157
|
+
return notificationTarget(source)?.addNotificationCallback?.(SKILLS_CHANGED_METHOD, (value) => {
|
|
27158
|
+
if (!isRecord5(value) || value.method !== SKILLS_CHANGED_METHOD) return;
|
|
27159
|
+
const parsed = skillsChangedParamsSchema.safeParse(value.params);
|
|
27160
|
+
if (parsed.success) listener(parsed.data);
|
|
27161
|
+
}) ?? (() => {
|
|
27162
|
+
});
|
|
27163
|
+
},
|
|
26375
27164
|
async listHarnessPlugins() {
|
|
26376
27165
|
return harnessPluginListResultSchema.parse(
|
|
26377
27166
|
await manager.sendRequest(HARNESS_PLUGIN_LIST_METHOD, {})
|
|
@@ -27197,7 +27986,8 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27197
27986
|
(method) => [
|
|
27198
27987
|
THREAD_USAGE_UPDATED_METHOD,
|
|
27199
27988
|
HARNESS_PREFERENCES_CHANGED_METHOD,
|
|
27200
|
-
HARNESS_DISPLAY_CHANGED_METHOD
|
|
27989
|
+
HARNESS_DISPLAY_CHANGED_METHOD,
|
|
27990
|
+
SKILLS_CHANGED_METHOD
|
|
27201
27991
|
].includes(method)
|
|
27202
27992
|
))
|
|
27203
27993
|
return () => unsubscribe?.();
|
|
@@ -27207,7 +27997,8 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27207
27997
|
if (disposed || !message2 || typeof message2 !== "object" || !("type" in message2) || message2.type !== "mcp-notification" || !("hostId" in message2) || message2.hostId !== route.hostId || !("method" in message2) || ![
|
|
27208
27998
|
THREAD_USAGE_UPDATED_METHOD,
|
|
27209
27999
|
HARNESS_PREFERENCES_CHANGED_METHOD,
|
|
27210
|
-
HARNESS_DISPLAY_CHANGED_METHOD
|
|
28000
|
+
HARNESS_DISPLAY_CHANGED_METHOD,
|
|
28001
|
+
SKILLS_CHANGED_METHOD
|
|
27211
28002
|
].includes(String(message2.method)) || !(typeof methods === "string" ? [methods] : methods).includes(
|
|
27212
28003
|
String(message2.method)
|
|
27213
28004
|
) || readRouting()?.forHost(route.hostId) !== route)
|
|
@@ -37666,6 +38457,7 @@ ${detail}` : ""}`
|
|
|
37666
38457
|
.settings-connection-inspector {
|
|
37667
38458
|
position: sticky;
|
|
37668
38459
|
top: 18px;
|
|
38460
|
+
overflow-anchor: none;
|
|
37669
38461
|
}
|
|
37670
38462
|
|
|
37671
38463
|
.settings-connection-inspector__header {
|
|
@@ -42014,6 +42806,98 @@ ${renderer_brand_mark_default}`;
|
|
|
42014
42806
|
};
|
|
42015
42807
|
}
|
|
42016
42808
|
|
|
42809
|
+
// src/renderer-skill-library.ts
|
|
42810
|
+
function createRendererSkillLibrary(options) {
|
|
42811
|
+
let active = null;
|
|
42812
|
+
const key = (context2) => JSON.stringify(context2.params);
|
|
42813
|
+
const current = (state) => {
|
|
42814
|
+
const context2 = options.context(state.editor);
|
|
42815
|
+
return active === state && context2?.client === state.context.client && key(context2) === state.key;
|
|
42816
|
+
};
|
|
42817
|
+
const close = () => {
|
|
42818
|
+
active?.unsubscribe?.();
|
|
42819
|
+
active = null;
|
|
42820
|
+
};
|
|
42821
|
+
const query = async (state) => {
|
|
42822
|
+
if (state.pending) {
|
|
42823
|
+
state.dirty = true;
|
|
42824
|
+
return;
|
|
42825
|
+
}
|
|
42826
|
+
do {
|
|
42827
|
+
state.dirty = false;
|
|
42828
|
+
state.pending = true;
|
|
42829
|
+
delete state.error;
|
|
42830
|
+
try {
|
|
42831
|
+
if (!state.context.client.listSkills)
|
|
42832
|
+
throw new Error("This Host does not support the Skill Library");
|
|
42833
|
+
const result = await state.context.client.listSkills(state.context.params);
|
|
42834
|
+
if (!current(state)) return;
|
|
42835
|
+
state.result = result;
|
|
42836
|
+
} catch (error51) {
|
|
42837
|
+
if (!current(state)) return;
|
|
42838
|
+
state.error = error51 instanceof Error ? error51.message : String(error51);
|
|
42839
|
+
} finally {
|
|
42840
|
+
state.pending = false;
|
|
42841
|
+
}
|
|
42842
|
+
options.changed();
|
|
42843
|
+
} while (state.dirty && current(state));
|
|
42844
|
+
};
|
|
42845
|
+
const open = (editor) => {
|
|
42846
|
+
const context2 = options.context(editor);
|
|
42847
|
+
if (!context2) {
|
|
42848
|
+
close();
|
|
42849
|
+
return;
|
|
42850
|
+
}
|
|
42851
|
+
if (active?.context.client === context2.client && active.key === key(context2)) {
|
|
42852
|
+
active.editor = editor;
|
|
42853
|
+
return;
|
|
42854
|
+
}
|
|
42855
|
+
close();
|
|
42856
|
+
const state = {
|
|
42857
|
+
editor,
|
|
42858
|
+
context: context2,
|
|
42859
|
+
key: key(context2),
|
|
42860
|
+
pending: false,
|
|
42861
|
+
dirty: false
|
|
42862
|
+
};
|
|
42863
|
+
active = state;
|
|
42864
|
+
if (context2.client.subscribeSkillsChanged) {
|
|
42865
|
+
state.unsubscribe = context2.client.subscribeSkillsChanged((change) => {
|
|
42866
|
+
if (!current(state)) return;
|
|
42867
|
+
if (change.cwd && !context2.params.threadId && change.cwd !== context2.params.cwd) return;
|
|
42868
|
+
void query(state);
|
|
42869
|
+
});
|
|
42870
|
+
}
|
|
42871
|
+
void query(state);
|
|
42872
|
+
};
|
|
42873
|
+
return {
|
|
42874
|
+
open,
|
|
42875
|
+
close,
|
|
42876
|
+
read(editor) {
|
|
42877
|
+
const context2 = options.context(editor);
|
|
42878
|
+
if (!context2) return null;
|
|
42879
|
+
if (!active || active.context.client !== context2.client || active.key !== key(context2))
|
|
42880
|
+
open(editor);
|
|
42881
|
+
const state = active;
|
|
42882
|
+
if (!state) return null;
|
|
42883
|
+
const zh = options.locale() === "zh-CN";
|
|
42884
|
+
return {
|
|
42885
|
+
skills: state.result?.skills ?? [],
|
|
42886
|
+
...!state.result && state.pending ? { notice: zh ? "\u6B63\u5728\u52A0\u8F7D Skill\u2026" : "Loading Skills\u2026" } : state.result?.complete === false ? { notice: zh ? "\u6B63\u5728\u53D1\u73B0 Skill\u2026" : "Discovering Skills\u2026" } : {},
|
|
42887
|
+
...state.result?.warnings?.length ? { warning: state.result.warnings.join("\n") } : {},
|
|
42888
|
+
...state.error ? { error: state.error } : {},
|
|
42889
|
+
retry: () => {
|
|
42890
|
+
if (current(state)) {
|
|
42891
|
+
void query(state);
|
|
42892
|
+
options.changed();
|
|
42893
|
+
}
|
|
42894
|
+
}
|
|
42895
|
+
};
|
|
42896
|
+
},
|
|
42897
|
+
dispose: close
|
|
42898
|
+
};
|
|
42899
|
+
}
|
|
42900
|
+
|
|
42017
42901
|
// src/renderer-native-composer-controller.ts
|
|
42018
42902
|
var MAX_ELEMENT_DEPTH = 4;
|
|
42019
42903
|
var MAX_FIBER_DEPTH = 40;
|
|
@@ -42068,6 +42952,39 @@ ${renderer_brand_mark_default}`;
|
|
|
42068
42952
|
return false;
|
|
42069
42953
|
}
|
|
42070
42954
|
}
|
|
42955
|
+
function nativeSelectionMarkdown(editor) {
|
|
42956
|
+
const controller = findNativeComposerController(editor);
|
|
42957
|
+
if (!controller?.getMarkdownSerializer) return null;
|
|
42958
|
+
const { doc, selection } = controller.view.state;
|
|
42959
|
+
const cut = doc.cut;
|
|
42960
|
+
if (!cut) return null;
|
|
42961
|
+
try {
|
|
42962
|
+
const serialize = controller.getMarkdownSerializer("markdown");
|
|
42963
|
+
return serialize?.(cut.call(doc, selection.from, selection.to)) ?? null;
|
|
42964
|
+
} catch {
|
|
42965
|
+
return null;
|
|
42966
|
+
}
|
|
42967
|
+
}
|
|
42968
|
+
function insertNativeMentionContent(editor, parts) {
|
|
42969
|
+
const controller = findNativeComposerController(editor);
|
|
42970
|
+
if (!controller) return false;
|
|
42971
|
+
const { schema, selection, tr } = controller.view.state;
|
|
42972
|
+
const nodeType = schema.nodes.agentMention;
|
|
42973
|
+
const text = schema.text;
|
|
42974
|
+
const create = nodeType?.create;
|
|
42975
|
+
const replace = tr.replaceWith;
|
|
42976
|
+
if (!text || !create || !replace) return false;
|
|
42977
|
+
try {
|
|
42978
|
+
const literal2 = schema.marks?.literalPaste?.create();
|
|
42979
|
+
const content = parts.filter((part) => part !== "").map(
|
|
42980
|
+
(part) => typeof part === "string" ? text.call(schema, part, literal2 ? [literal2] : void 0) : create.call(nodeType, { conversationId: null, ...part })
|
|
42981
|
+
);
|
|
42982
|
+
controller.view.dispatch(replace.call(tr, selection.from, selection.to, content));
|
|
42983
|
+
return true;
|
|
42984
|
+
} catch {
|
|
42985
|
+
return false;
|
|
42986
|
+
}
|
|
42987
|
+
}
|
|
42071
42988
|
function insertNativeAgentMention(editor, range, mention) {
|
|
42072
42989
|
const controller = findNativeComposerController(editor);
|
|
42073
42990
|
const nodeType = controller?.view.state.schema.nodes.agentMention;
|
|
@@ -42094,9 +43011,82 @@ ${renderer_brand_mark_default}`;
|
|
|
42094
43011
|
}
|
|
42095
43012
|
}
|
|
42096
43013
|
|
|
43014
|
+
// src/renderer-skill-reference.ts
|
|
43015
|
+
var STYLE_ATTRIBUTE3 = "data-codexhost-skill-reference-style";
|
|
43016
|
+
var SVG_NS3 = "http://www.w3.org/2000/svg";
|
|
43017
|
+
var CUBE = "M12 3 20 7.5v9L12 21l-8-4.5v-9ZM4 7.5 12 12l8-4.5M12 12v9";
|
|
43018
|
+
function createSkillIcon(ownerDocument) {
|
|
43019
|
+
const svg2 = ownerDocument.createElementNS(SVG_NS3, "svg");
|
|
43020
|
+
svg2.setAttribute("viewBox", "0 0 24 24");
|
|
43021
|
+
svg2.setAttribute("fill", "none");
|
|
43022
|
+
svg2.setAttribute("stroke", "currentColor");
|
|
43023
|
+
svg2.setAttribute("stroke-width", "1.7");
|
|
43024
|
+
svg2.setAttribute("stroke-linejoin", "round");
|
|
43025
|
+
svg2.setAttribute("aria-hidden", "true");
|
|
43026
|
+
const path = ownerDocument.createElementNS(SVG_NS3, "path");
|
|
43027
|
+
path.setAttribute("d", CUBE);
|
|
43028
|
+
svg2.append(path);
|
|
43029
|
+
return svg2;
|
|
43030
|
+
}
|
|
43031
|
+
function skillMention(skill) {
|
|
43032
|
+
return { name: skill.name, displayName: skill.name, path: desktopSkillMentionPath(skill) };
|
|
43033
|
+
}
|
|
43034
|
+
function installRendererSkillReferences(ownerDocument, isExternalEditor) {
|
|
43035
|
+
const style = ownerDocument.createElement("style");
|
|
43036
|
+
style.setAttribute(STYLE_ATTRIBUTE3, "true");
|
|
43037
|
+
const selector = `[agent-mention-path^="${DESKTOP_SKILL_MENTION_PATH_PREFIX}"][agent-mention-display-name]`;
|
|
43038
|
+
const icon2 = encodeURIComponent(
|
|
43039
|
+
`<svg xmlns="${SVG_NS3}" viewBox="0 0 24 24" fill="none" stroke="#808080" stroke-width="1.7" stroke-linejoin="round"><path d="${CUBE}"/></svg>`
|
|
43040
|
+
);
|
|
43041
|
+
style.textContent = `${selector}>span{display:none;}
|
|
43042
|
+
${selector}::before{content:"";display:inline-block;width:16px;height:16px;margin-inline-end:3px;vertical-align:-3px;background:url("data:image/svg+xml,${icon2}") center/contain no-repeat;}
|
|
43043
|
+
${selector}::after{content:attr(agent-mention-display-name);}`;
|
|
43044
|
+
(ownerDocument.head ?? ownerDocument.documentElement).append(style);
|
|
43045
|
+
const selectedEditor = () => {
|
|
43046
|
+
const node = ownerDocument.getSelection()?.anchorNode;
|
|
43047
|
+
const element = node?.nodeType === node?.ELEMENT_NODE ? node : node?.parentElement;
|
|
43048
|
+
const editor = element?.closest('[contenteditable="true"]');
|
|
43049
|
+
return editor && isExternalEditor(editor) ? editor : null;
|
|
43050
|
+
};
|
|
43051
|
+
const copy = (event) => {
|
|
43052
|
+
const editor = selectedEditor();
|
|
43053
|
+
if (!editor || !event.clipboardData) return;
|
|
43054
|
+
const text = nativeSelectionMarkdown(editor) ?? event.clipboardData.getData("text/plain");
|
|
43055
|
+
const canonical = restoreDesktopSkillMentions(text);
|
|
43056
|
+
if (canonical === text) return;
|
|
43057
|
+
event.clipboardData.setData("text/plain", canonical);
|
|
43058
|
+
event.preventDefault();
|
|
43059
|
+
event.stopImmediatePropagation();
|
|
43060
|
+
};
|
|
43061
|
+
const paste = (event) => {
|
|
43062
|
+
const editor = selectedEditor();
|
|
43063
|
+
if (!editor || !event.clipboardData || event.clipboardData.files.length) return;
|
|
43064
|
+
const text = event.clipboardData.getData("text/plain");
|
|
43065
|
+
const references = skillReferences(text);
|
|
43066
|
+
if (!references.length) return;
|
|
43067
|
+
const parts = [];
|
|
43068
|
+
let cursor = 0;
|
|
43069
|
+
for (const reference of references) {
|
|
43070
|
+
parts.push(text.slice(cursor, reference.start), skillMention(reference));
|
|
43071
|
+
cursor = reference.end;
|
|
43072
|
+
}
|
|
43073
|
+
parts.push(text.slice(cursor));
|
|
43074
|
+
if (!insertNativeMentionContent(editor, parts)) return;
|
|
43075
|
+
event.preventDefault();
|
|
43076
|
+
event.stopImmediatePropagation();
|
|
43077
|
+
};
|
|
43078
|
+
ownerDocument.addEventListener("copy", copy, true);
|
|
43079
|
+
ownerDocument.addEventListener("paste", paste, true);
|
|
43080
|
+
return () => {
|
|
43081
|
+
ownerDocument.removeEventListener("copy", copy, true);
|
|
43082
|
+
ownerDocument.removeEventListener("paste", paste, true);
|
|
43083
|
+
style.remove();
|
|
43084
|
+
};
|
|
43085
|
+
}
|
|
43086
|
+
|
|
42097
43087
|
// src/renderer-delegation-mention.ts
|
|
42098
43088
|
var MENU_ATTRIBUTE = "data-codexhost-delegation-mention-menu";
|
|
42099
|
-
var
|
|
43089
|
+
var STYLE_ATTRIBUTE4 = "data-codexhost-delegation-mention-style";
|
|
42100
43090
|
var MENU_MAX_HEIGHT = 320;
|
|
42101
43091
|
var SOURCE_TAG = "codexhost";
|
|
42102
43092
|
var MENU_CLASS = "border-default bg-surface-elevated-secondary flex flex-col overflow-hidden rounded-[var(--radius-suggestion-menu,var(--radius-2xl))] border text-sm backdrop-blur-sm";
|
|
@@ -42141,27 +43131,13 @@ ${renderer_brand_mark_default}`;
|
|
|
42141
43131
|
return scored.sort((left, right) => right.score - left.score || left.index - right.index).map(({ command }) => command);
|
|
42142
43132
|
}
|
|
42143
43133
|
function harnessCommandDisplayName(label) {
|
|
42144
|
-
const slug = label.trim().replace(/^\//u, "")
|
|
43134
|
+
const slug = label.trim().replace(/^\//u, "");
|
|
42145
43135
|
if (!slug || /\s/u.test(slug) || /[A-Z]/u.test(slug) || /[^\x00-\x7F]/u.test(slug)) {
|
|
42146
43136
|
return slug || label;
|
|
42147
43137
|
}
|
|
42148
43138
|
const name = slug.split(":").filter(Boolean).at(-1) ?? slug;
|
|
42149
43139
|
return name.split(/[-_.]+/u).filter(Boolean).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
42150
43140
|
}
|
|
42151
|
-
var SVG_NS3 = "http://www.w3.org/2000/svg";
|
|
42152
|
-
function createSkillIcon(ownerDocument) {
|
|
42153
|
-
const svg2 = ownerDocument.createElementNS(SVG_NS3, "svg");
|
|
42154
|
-
svg2.setAttribute("viewBox", "0 0 24 24");
|
|
42155
|
-
svg2.setAttribute("fill", "none");
|
|
42156
|
-
svg2.setAttribute("stroke", "currentColor");
|
|
42157
|
-
svg2.setAttribute("stroke-width", "1.7");
|
|
42158
|
-
svg2.setAttribute("stroke-linejoin", "round");
|
|
42159
|
-
svg2.setAttribute("aria-hidden", "true");
|
|
42160
|
-
const path = ownerDocument.createElementNS(SVG_NS3, "path");
|
|
42161
|
-
path.setAttribute("d", "M12 3 20 7.5v9L12 21l-8-4.5v-9ZM4 7.5 12 12l8-4.5M12 12v9");
|
|
42162
|
-
svg2.append(path);
|
|
42163
|
-
return svg2;
|
|
42164
|
-
}
|
|
42165
43141
|
function agentsTitle(locale) {
|
|
42166
43142
|
return locale === "zh-CN" ? "\u59D4\u6D3E\u7ED9 Agent" : "Delegate to agent";
|
|
42167
43143
|
}
|
|
@@ -42183,10 +43159,10 @@ ${renderer_brand_mark_default}`;
|
|
|
42183
43159
|
return `"${value.replace(/["\\\n]/gu, (character) => `\\${character === "\n" ? "a " : character}`)}"`;
|
|
42184
43160
|
}
|
|
42185
43161
|
function syncChipStyle(ownerDocument, targets, cache) {
|
|
42186
|
-
let style = ownerDocument.querySelector(`style[${
|
|
43162
|
+
let style = ownerDocument.querySelector(`style[${STYLE_ATTRIBUTE4}]`);
|
|
42187
43163
|
if (!style) {
|
|
42188
43164
|
style = ownerDocument.createElement("style");
|
|
42189
|
-
style.setAttribute(
|
|
43165
|
+
style.setAttribute(STYLE_ATTRIBUTE4, "true");
|
|
42190
43166
|
(ownerDocument.head ?? ownerDocument.documentElement).append(style);
|
|
42191
43167
|
}
|
|
42192
43168
|
const chip = [DELEGATION_MENTION_PATH_PREFIX, HARNESS_COMMAND_MENTION_PATH_PREFIX].map((prefix) => `[agent-mention-path^=${cssString(prefix)}][agent-mention-display-name]`).join(",");
|
|
@@ -42208,6 +43184,13 @@ ${renderer_brand_mark_default}`;
|
|
|
42208
43184
|
const text = rules.join("\n");
|
|
42209
43185
|
if (style.textContent !== text) style.textContent = text;
|
|
42210
43186
|
}
|
|
43187
|
+
function filterDelegationSkills(skills, query) {
|
|
43188
|
+
const needle = query.trim().toLowerCase();
|
|
43189
|
+
return skills.filter(
|
|
43190
|
+
(skill) => `${skill.name}
|
|
43191
|
+
${skill.description ?? ""}`.toLowerCase().includes(needle)
|
|
43192
|
+
);
|
|
43193
|
+
}
|
|
42211
43194
|
function installRendererDelegationMention(ownerDocument, options) {
|
|
42212
43195
|
const view = ownerDocument.defaultView;
|
|
42213
43196
|
if (!view) {
|
|
@@ -42242,9 +43225,11 @@ ${renderer_brand_mark_default}`;
|
|
|
42242
43225
|
let rowsRendered = 0;
|
|
42243
43226
|
const close = () => {
|
|
42244
43227
|
active = null;
|
|
43228
|
+
openedFor = null;
|
|
42245
43229
|
entries = [];
|
|
42246
43230
|
setMenuOpen(false);
|
|
42247
43231
|
list.replaceChildren();
|
|
43232
|
+
options.onClose?.();
|
|
42248
43233
|
};
|
|
42249
43234
|
const highlight = () => {
|
|
42250
43235
|
[...list.querySelectorAll("[role=option]")].forEach((item, index) => {
|
|
@@ -42317,7 +43302,7 @@ ${renderer_brand_mark_default}`;
|
|
|
42317
43302
|
item.addEventListener("click", () => void choose(entry));
|
|
42318
43303
|
return item;
|
|
42319
43304
|
};
|
|
42320
|
-
const render = (trigger, commands, targets) => {
|
|
43305
|
+
const render = (trigger, commands, targets, skills) => {
|
|
42321
43306
|
const locale = options.readLocale();
|
|
42322
43307
|
const rows = [];
|
|
42323
43308
|
entries = [];
|
|
@@ -42337,18 +43322,13 @@ ${renderer_brand_mark_default}`;
|
|
|
42337
43322
|
}
|
|
42338
43323
|
}
|
|
42339
43324
|
if (commands) {
|
|
42340
|
-
|
|
42341
|
-
|
|
42342
|
-
|
|
42343
|
-
];
|
|
42344
|
-
for (const [title, group] of groups) {
|
|
42345
|
-
if (group.length === 0) continue;
|
|
42346
|
-
rows.push(sectionHeader(title));
|
|
42347
|
-
for (const command of group) {
|
|
43325
|
+
if (commands.matches.length) {
|
|
43326
|
+
rows.push(sectionHeader(commandsTitle(locale)));
|
|
43327
|
+
for (const command of commands.matches) {
|
|
42348
43328
|
const reason = commands.source.disabledReason(command);
|
|
42349
43329
|
const presentation = rendererHarnessCommandPresentation(command, locale);
|
|
42350
43330
|
const content = rowContent(
|
|
42351
|
-
|
|
43331
|
+
createHarnessCommandIcon(ownerDocument),
|
|
42352
43332
|
harnessCommandDisplayName(presentation.label),
|
|
42353
43333
|
reason ?? presentation.description
|
|
42354
43334
|
);
|
|
@@ -42376,6 +43356,44 @@ ${renderer_brand_mark_default}`;
|
|
|
42376
43356
|
hint.textContent = notice;
|
|
42377
43357
|
rows.push(hint);
|
|
42378
43358
|
}
|
|
43359
|
+
if (skills) {
|
|
43360
|
+
rows.push(sectionHeader(skillsTitle(locale)));
|
|
43361
|
+
const matches = filterDelegationSkills(skills.skills, trigger.query);
|
|
43362
|
+
for (const skill of matches) {
|
|
43363
|
+
const scope = locale === "zh-CN" ? skill.scope === "project" ? "\u9879\u76EE" : "\u5168\u5C40" : skill.scope === "project" ? "Project" : "Global";
|
|
43364
|
+
const detail = `${scope} \xB7 ${skill.source} \xB7 ${skill.path}${skill.description ? ` \u2014 ${skill.description}` : ""}`;
|
|
43365
|
+
const content = rowContent(createSkillIcon(ownerDocument), skill.name, detail);
|
|
43366
|
+
content.setAttribute("data-skill-path", skill.path);
|
|
43367
|
+
content.title = detail;
|
|
43368
|
+
rows.push(optionRow({ kind: "librarySkill", skill }, content));
|
|
43369
|
+
}
|
|
43370
|
+
const hint = (label, detail = "") => {
|
|
43371
|
+
const row = ownerDocument.createElement("div");
|
|
43372
|
+
row.className = `${ROW_CLASS} opacity-50`;
|
|
43373
|
+
row.setAttribute("aria-disabled", "true");
|
|
43374
|
+
row.title = detail;
|
|
43375
|
+
row.append(rowContent(null, label, detail));
|
|
43376
|
+
rows.push(row);
|
|
43377
|
+
};
|
|
43378
|
+
if (skills.error) {
|
|
43379
|
+
rows.push(
|
|
43380
|
+
optionRow(
|
|
43381
|
+
{ kind: "retrySkills", retry: skills.retry },
|
|
43382
|
+
rowContent(
|
|
43383
|
+
null,
|
|
43384
|
+
locale === "zh-CN" ? "\u91CD\u8BD5 Skill \u5E93" : "Retry Skill Library",
|
|
43385
|
+
skills.error
|
|
43386
|
+
)
|
|
43387
|
+
)
|
|
43388
|
+
);
|
|
43389
|
+
} else if (skills.notice) hint(skills.notice);
|
|
43390
|
+
else if (!matches.length) hint(locale === "zh-CN" ? "\u672A\u627E\u5230 Skill" : "No Skills found");
|
|
43391
|
+
if (skills.warning)
|
|
43392
|
+
hint(
|
|
43393
|
+
locale === "zh-CN" ? "\u90E8\u5206 Skill \u65E0\u6CD5\u8BFB\u53D6" : "Some Skills could not be read",
|
|
43394
|
+
skills.warning
|
|
43395
|
+
);
|
|
43396
|
+
}
|
|
42379
43397
|
rowsRendered = rows.length;
|
|
42380
43398
|
list.replaceChildren(...rows);
|
|
42381
43399
|
activeIndex = Math.min(activeIndex, Math.max(0, entries.length - 1));
|
|
@@ -42418,15 +43436,16 @@ ${renderer_brand_mark_default}`;
|
|
|
42418
43436
|
const targets = filterDelegationTargets(allTargets, trigger.query);
|
|
42419
43437
|
const source = options.readCommands(trigger.editor);
|
|
42420
43438
|
const commandMatches = source ? filterDelegationCommands(source.commands, trigger.query) : [];
|
|
43439
|
+
const skills = options.readSkills?.(trigger.editor) ?? null;
|
|
42421
43440
|
const showsNotice = Boolean(source?.pendingNotice) && trigger.query === "";
|
|
42422
|
-
if (targets.length === 0 && commandMatches.length === 0 && !showsNotice) {
|
|
43441
|
+
if (targets.length === 0 && commandMatches.length === 0 && !showsNotice && !skills) {
|
|
42423
43442
|
close();
|
|
42424
43443
|
return;
|
|
42425
43444
|
}
|
|
42426
43445
|
const sameQuery = active?.query === trigger.query && active.node === trigger.node;
|
|
42427
43446
|
active = trigger;
|
|
42428
43447
|
if (!sameQuery) activeIndex = 0;
|
|
42429
|
-
render(trigger, source ? { source, matches: commandMatches } : null, targets);
|
|
43448
|
+
render(trigger, source ? { source, matches: commandMatches } : null, targets, skills);
|
|
42430
43449
|
if (rowsRendered === 0) close();
|
|
42431
43450
|
};
|
|
42432
43451
|
const waitForSelectionSync = () => new Promise((resolve) => view.setTimeout(resolve, 0));
|
|
@@ -42480,7 +43499,12 @@ ${renderer_brand_mark_default}`;
|
|
|
42480
43499
|
source.select(command);
|
|
42481
43500
|
};
|
|
42482
43501
|
const choose = async (entry) => {
|
|
43502
|
+
if (entry.kind === "retrySkills") {
|
|
43503
|
+
entry.retry();
|
|
43504
|
+
return;
|
|
43505
|
+
}
|
|
42483
43506
|
const trigger = active;
|
|
43507
|
+
if (entry.kind === "librarySkill" && trigger && !options.readSkills?.(trigger.editor)) return;
|
|
42484
43508
|
close();
|
|
42485
43509
|
if (!trigger || !trigger.node.isConnected) return;
|
|
42486
43510
|
const expected = `#${trigger.query}`;
|
|
@@ -42489,7 +43513,15 @@ ${renderer_brand_mark_default}`;
|
|
|
42489
43513
|
inserting = true;
|
|
42490
43514
|
try {
|
|
42491
43515
|
if (entry.kind === "agent") await insertAgent(trigger, range, entry.target);
|
|
42492
|
-
else
|
|
43516
|
+
else if (entry.kind === "librarySkill") {
|
|
43517
|
+
const mention = skillMention(entry.skill);
|
|
43518
|
+
if (!insertNativeAgentMention(trigger.editor, range, mention)) {
|
|
43519
|
+
if (!await selectTriggerText(trigger)) return;
|
|
43520
|
+
const carrier = `[@${mention.name}](${mention.path}) `;
|
|
43521
|
+
if (!dispatchPlainTextPaste(trigger.editor, carrier))
|
|
43522
|
+
ownerDocument.execCommand("insertText", false, carrier);
|
|
43523
|
+
}
|
|
43524
|
+
} else await runCommand(trigger, range, entry);
|
|
42493
43525
|
} finally {
|
|
42494
43526
|
inserting = false;
|
|
42495
43527
|
}
|
|
@@ -42541,8 +43573,9 @@ ${renderer_brand_mark_default}`;
|
|
|
42541
43573
|
ownerDocument.removeEventListener("pointerdown", onPointerDown, true);
|
|
42542
43574
|
view.removeEventListener("resize", onViewportChange);
|
|
42543
43575
|
view.removeEventListener("scroll", onViewportChange, true);
|
|
43576
|
+
options.onClose?.();
|
|
42544
43577
|
menu.remove();
|
|
42545
|
-
ownerDocument.querySelector(`style[${
|
|
43578
|
+
ownerDocument.querySelector(`style[${STYLE_ATTRIBUTE4}]`)?.remove();
|
|
42546
43579
|
};
|
|
42547
43580
|
const openFor = (editor) => {
|
|
42548
43581
|
editor.focus({ preventScroll: true });
|
|
@@ -43966,6 +44999,28 @@ ${renderer_brand_mark_default}`;
|
|
|
43966
44999
|
}
|
|
43967
45000
|
}
|
|
43968
45001
|
}
|
|
45002
|
+
const skillContext = (editor) => {
|
|
45003
|
+
const composer = composerForElement(editor);
|
|
45004
|
+
const mounted = composer ? mountedByComposer.get(composer) : void 0;
|
|
45005
|
+
if (!mounted || !editor.isContentEditable || controller.get(mounted.composer).agent === "codex" || isOwnershipSubmissionBlocked(mounted.ownershipStatus))
|
|
45006
|
+
return null;
|
|
45007
|
+
const threadId = threadIdFromComposerModelTarget(mounted.modelTarget);
|
|
45008
|
+
const hostId2 = threadId ? mounted.hostId : activeModelHostId(mounted.composer);
|
|
45009
|
+
if (hostId2 !== "local") return null;
|
|
45010
|
+
const client = modelClientForHost(hostId2);
|
|
45011
|
+
if (!client) return null;
|
|
45012
|
+
const cwd = draftWorkspaces.get(hostId2);
|
|
45013
|
+
return { client, params: threadId ? { threadId } : cwd ? { cwd } : {} };
|
|
45014
|
+
};
|
|
45015
|
+
const skillLibrary = createRendererSkillLibrary({
|
|
45016
|
+
context: skillContext,
|
|
45017
|
+
locale: () => settingsLifecycle.locale,
|
|
45018
|
+
changed: () => delegationMention?.refresh()
|
|
45019
|
+
});
|
|
45020
|
+
const disposeSkillReferences = installRendererSkillReferences(
|
|
45021
|
+
document,
|
|
45022
|
+
(editor) => skillContext(editor) !== null
|
|
45023
|
+
);
|
|
43969
45024
|
const refreshCommands = async (mounted, { keepCurrent = false } = {}) => {
|
|
43970
45025
|
const generation = ++mounted.commandRequestGeneration;
|
|
43971
45026
|
const agent = controller.get(mounted.composer).agent;
|
|
@@ -45776,6 +46831,7 @@ ${renderer_brand_mark_default}`;
|
|
|
45776
46831
|
const { hostId: hostId2, cwd } = detail;
|
|
45777
46832
|
if (typeof hostId2 !== "string" || typeof cwd !== "string" || cwd.length === 0) return;
|
|
45778
46833
|
draftWorkspaces.set(hostId2, cwd);
|
|
46834
|
+
delegationMention?.refresh();
|
|
45779
46835
|
for (const mounted of mountedByComposer.values()) {
|
|
45780
46836
|
if (!threadIdFromComposerModelTarget(mounted.modelTarget) && activeModelHostId(mounted.composer) === hostId2 && controller.get(mounted.composer).agent !== "codex") {
|
|
45781
46837
|
void refreshCommands(mounted, { keepCurrent: true });
|
|
@@ -45791,7 +46847,10 @@ ${renderer_brand_mark_default}`;
|
|
|
45791
46847
|
window.addEventListener("codexhost:renderer-adapter-status", onAdapterStatus);
|
|
45792
46848
|
window.addEventListener("focus", onWindowFocus);
|
|
45793
46849
|
delegationMention = installRendererDelegationMention(document, {
|
|
46850
|
+
readSkills: (editor) => skillLibrary.read(editor),
|
|
46851
|
+
onClose: () => skillLibrary.close(),
|
|
45794
46852
|
onOpen: (editor) => {
|
|
46853
|
+
skillLibrary.open(editor);
|
|
45795
46854
|
const composer = composerForElement(editor);
|
|
45796
46855
|
const mounted = composer ? mountedByComposer.get(composer) : void 0;
|
|
45797
46856
|
if (mounted && controller.get(mounted.composer).agent !== "codex") {
|
|
@@ -45962,6 +47021,8 @@ ${renderer_brand_mark_default}`;
|
|
|
45962
47021
|
mutationObserver.disconnect();
|
|
45963
47022
|
disposeReasoningSoftWrap();
|
|
45964
47023
|
delegationMention?.dispose();
|
|
47024
|
+
skillLibrary.dispose();
|
|
47025
|
+
disposeSkillReferences();
|
|
45965
47026
|
sidebarAgentIcons.dispose();
|
|
45966
47027
|
sidebarThreadState.dispose();
|
|
45967
47028
|
nativeScheduleControls.dispose();
|