@codexhost/cli-linux-arm64 0.18.0 → 0.19.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 +59 -2
- package/app/console-web.js +76 -4
- package/app/desktop-controller.mjs +274 -11
- package/app/host-runtime.mjs +12322 -2469
- package/app/plugins/antigravity/plugin.mjs +654 -216
- package/app/plugins/claude-code/plugin.mjs +138 -11
- package/app/plugins/codebuddy/plugin.mjs +152 -20
- package/app/plugins/codex-usage/plugin.mjs +59 -2
- package/app/plugins/copilot/plugin.mjs +59 -2
- package/app/plugins/cursor-cli/plugin.mjs +134 -12
- package/app/plugins/deepseek-harness/manifest.json +2 -2
- package/app/plugins/deepseek-harness/plugin.mjs +86 -7
- package/app/plugins/devin/plugin.mjs +59 -2
- package/app/plugins/grok/plugin.mjs +392 -269
- package/app/plugins/hermes/plugin.mjs +138 -14
- package/app/plugins/kimi-code/plugin.mjs +59 -2
- package/app/plugins/kiro-cli/plugin.mjs +287 -18
- package/app/plugins/omp/plugin.mjs +788 -627
- package/app/plugins/opencode/plugin.mjs +59 -2
- package/app/plugins/pi/plugin.mjs +899 -773
- package/app/plugins/qoder/plugin.mjs +61 -6
- package/app/plugins/qoder-cn/plugin.mjs +61 -6
- package/app/plugins/qwen-code/plugin.mjs +168 -94
- package/app/plugins/workbuddy/plugin.mjs +152 -20
- package/app/plugins/zcode/plugin.mjs +132 -5
- package/app/renderer-extension.js +657 -270
- package/app/web/assets/index-BNQIOOHE.css +1 -0
- package/app/web/assets/index-Feo4BkqN.js +199 -0
- package/app/web/codexhost-settings.js +76 -4
- package/app/web/index.html +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-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 +129 -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-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 +16 -16
- 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 +2339 -1514
- 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) => {
|
|
@@ -15362,6 +15365,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15362
15365
|
var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
|
|
15363
15366
|
var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
|
|
15364
15367
|
var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
|
|
15368
|
+
var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
|
|
15369
|
+
var clientThreadTreeSchema = external_exports.object({
|
|
15370
|
+
parents: external_exports.record(external_exports.string().min(1), external_exports.string().min(1))
|
|
15371
|
+
}).strict();
|
|
15365
15372
|
var clientProjectlessWorkspaceSchema = external_exports.object({
|
|
15366
15373
|
prompt: external_exports.string().max(16384).optional()
|
|
15367
15374
|
}).strict();
|
|
@@ -15378,6 +15385,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15378
15385
|
sequence: external_exports.number().int().nonnegative()
|
|
15379
15386
|
});
|
|
15380
15387
|
var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
|
|
15388
|
+
external_exports.object({
|
|
15389
|
+
type: external_exports.literal("skills-changed"),
|
|
15390
|
+
cursor: clientChannelCursorSchema,
|
|
15391
|
+
cwd: external_exports.string().optional()
|
|
15392
|
+
}),
|
|
15381
15393
|
external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
|
|
15382
15394
|
external_exports.object({
|
|
15383
15395
|
type: external_exports.literal("preferences-changed"),
|
|
@@ -15575,6 +15587,71 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15575
15587
|
external_exports.object({ ok: external_exports.literal(false), error: external_exports.object({ code: voiceErrorCodeSchema }).strict() }).strict()
|
|
15576
15588
|
]);
|
|
15577
15589
|
|
|
15590
|
+
// ../shared-contracts/dist/skills.js
|
|
15591
|
+
var SKILLS_LIST_METHOD = "codexhost/skills/list";
|
|
15592
|
+
var SKILLS_CHANGED_METHOD = "codexhost/skills/changed";
|
|
15593
|
+
var skillsListParamsSchema = external_exports.object({
|
|
15594
|
+
threadId: hostThreadIdSchema.optional(),
|
|
15595
|
+
cwd: external_exports.string().min(1).optional()
|
|
15596
|
+
}).strict().refine((params) => !(params.threadId && params.cwd), {
|
|
15597
|
+
message: "Specify threadId or cwd, not both"
|
|
15598
|
+
});
|
|
15599
|
+
var librarySkillSchema = external_exports.object({
|
|
15600
|
+
name: external_exports.string().min(1).regex(/^[^\s[\]]+$/u),
|
|
15601
|
+
description: external_exports.string().optional(),
|
|
15602
|
+
path: external_exports.string().min(1),
|
|
15603
|
+
scope: external_exports.enum(["project", "global"]),
|
|
15604
|
+
source: external_exports.string().min(1)
|
|
15605
|
+
}).strict();
|
|
15606
|
+
var skillsListResultSchema = external_exports.object({
|
|
15607
|
+
revision: external_exports.number().int().nonnegative(),
|
|
15608
|
+
complete: external_exports.boolean(),
|
|
15609
|
+
skills: external_exports.array(librarySkillSchema),
|
|
15610
|
+
warnings: external_exports.array(external_exports.string()).optional()
|
|
15611
|
+
}).strict();
|
|
15612
|
+
var skillsChangedParamsSchema = external_exports.object({ cwd: external_exports.string().min(1).optional() }).strict();
|
|
15613
|
+
|
|
15614
|
+
// ../shared-contracts/dist/skill-reference.js
|
|
15615
|
+
var DESKTOP_SKILL_MENTION_PATH_PREFIX = "subagent://codexhost-skill.";
|
|
15616
|
+
var DESKTOP_MENTION = /\[@[^\]\r\n]+\]\(<?subagent:\/\/codexhost-skill\.([^\s)>]+)>?\)/gu;
|
|
15617
|
+
var LINK = /\[\$([^\]\r\n]+)\]\((?:<([^<>\r\n]+)>|([^\s()]+))(?:[ \t]+(?:"[^"\r\n]*"|'[^'\r\n]*'))?\)/gu;
|
|
15618
|
+
function skillReferences(text) {
|
|
15619
|
+
return [...text.matchAll(LINK)].flatMap((match) => {
|
|
15620
|
+
const path = match[2] ?? match[3] ?? "";
|
|
15621
|
+
if (!/^(?:\/|[A-Za-z]:[\\/]|\\\\)/u.test(path) || !/[\\/]SKILL\.md$/u.test(path))
|
|
15622
|
+
return [];
|
|
15623
|
+
return [
|
|
15624
|
+
{
|
|
15625
|
+
start: match.index,
|
|
15626
|
+
end: match.index + match[0].length,
|
|
15627
|
+
name: match[1] ?? "",
|
|
15628
|
+
path,
|
|
15629
|
+
text: match[0]
|
|
15630
|
+
}
|
|
15631
|
+
];
|
|
15632
|
+
});
|
|
15633
|
+
}
|
|
15634
|
+
function formatSkillReference(skill) {
|
|
15635
|
+
const target2 = /[\s()]/u.test(skill.path) ? `<${skill.path}>` : skill.path;
|
|
15636
|
+
return `[$${skill.name}](${target2} "Read this skill")`;
|
|
15637
|
+
}
|
|
15638
|
+
function desktopSkillMentionPath(skill) {
|
|
15639
|
+
return DESKTOP_SKILL_MENTION_PATH_PREFIX + encodeURIComponent(JSON.stringify({ name: skill.name, path: skill.path })).replace(/[!'()*]/gu, (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
15640
|
+
}
|
|
15641
|
+
function restoreDesktopSkillMentions(text) {
|
|
15642
|
+
return text.replace(DESKTOP_MENTION, (match, encoded) => {
|
|
15643
|
+
try {
|
|
15644
|
+
const skill = JSON.parse(decodeURIComponent(encoded));
|
|
15645
|
+
if (!skill || typeof skill !== "object" || !("name" in skill) || typeof skill.name !== "string" || !("path" in skill) || typeof skill.path !== "string")
|
|
15646
|
+
return match;
|
|
15647
|
+
const canonical = formatSkillReference({ name: skill.name, path: skill.path });
|
|
15648
|
+
return skillReferences(canonical)[0]?.text === canonical ? canonical : match;
|
|
15649
|
+
} catch {
|
|
15650
|
+
return match;
|
|
15651
|
+
}
|
|
15652
|
+
});
|
|
15653
|
+
}
|
|
15654
|
+
|
|
15578
15655
|
// ../shared-contracts/dist/web-access-tokens.js
|
|
15579
15656
|
var webNetworkAccessUrlSchema = external_exports.object({
|
|
15580
15657
|
/**
|
|
@@ -15683,8 +15760,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15683
15760
|
var delegationReadParamsSchema = external_exports.strictObject({
|
|
15684
15761
|
threadId: external_exports.string().min(1).max(1024),
|
|
15685
15762
|
view: external_exports.enum(["result", "messages"]),
|
|
15686
|
-
|
|
15687
|
-
|
|
15763
|
+
from: external_exports.number().int().min(1).max(Number.MAX_SAFE_INTEGER).optional(),
|
|
15764
|
+
to: external_exports.number().int().min(1).max(Number.MAX_SAFE_INTEGER).optional()
|
|
15688
15765
|
});
|
|
15689
15766
|
|
|
15690
15767
|
// ../shared-contracts/dist/credential-imports.js
|
|
@@ -16751,6 +16828,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16751
16828
|
return [...context2.matchAll(IMAGE_ATTACHMENT_PATTERN)].map((match) => match[1] ?? "").filter((path) => path.length > 0 && !CONTROL_CHARACTER_PATTERN.test(path));
|
|
16752
16829
|
}
|
|
16753
16830
|
|
|
16831
|
+
// ../shared-contracts/dist/thread-watch-notice.js
|
|
16832
|
+
var THREAD_WATCH_NOTICE_OUTCOMES = [
|
|
16833
|
+
"completed",
|
|
16834
|
+
"failed",
|
|
16835
|
+
"interrupted",
|
|
16836
|
+
"timedOut",
|
|
16837
|
+
"unreadable",
|
|
16838
|
+
"notFound"
|
|
16839
|
+
];
|
|
16840
|
+
var ENTRY_PATTERN = new RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)\): ` + `(${THREAD_WATCH_NOTICE_OUTCOMES.join("|")})(?:. (.+))?$`, "u");
|
|
16841
|
+
|
|
16754
16842
|
// ../shared-contracts/dist/remote-runtime.js
|
|
16755
16843
|
var RUNTIME_STATUS_METHOD = "codexhost/runtime/status";
|
|
16756
16844
|
var REMOTE_UPDATE_METHOD = "codexhost/remote/update";
|
|
@@ -16801,6 +16889,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16801
16889
|
archived: external_exports.boolean()
|
|
16802
16890
|
}),
|
|
16803
16891
|
external_exports.strictObject({ kind: external_exports.literal("read"), ...thread }),
|
|
16892
|
+
external_exports.strictObject({
|
|
16893
|
+
kind: external_exports.literal("configure"),
|
|
16894
|
+
...thread,
|
|
16895
|
+
epoch: identity,
|
|
16896
|
+
modelId: identity.optional(),
|
|
16897
|
+
thinkingOptionId: identity.optional(),
|
|
16898
|
+
permissionModeId: identity.optional()
|
|
16899
|
+
}).refine((value) => [value.modelId, value.thinkingOptionId, value.permissionModeId].filter((v) => v !== void 0).length === 1, "Select exactly one remote setting"),
|
|
16804
16900
|
external_exports.strictObject({
|
|
16805
16901
|
kind: external_exports.literal("prompt"),
|
|
16806
16902
|
...thread,
|
|
@@ -16873,6 +16969,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16873
16969
|
external_exports.strictObject({ error: external_exports.strictObject({ code: external_exports.number().int(), message: external_exports.string() }) })
|
|
16874
16970
|
]);
|
|
16875
16971
|
|
|
16972
|
+
// ../shared-contracts/dist/thread-title.js
|
|
16973
|
+
var threadTitleInputSchema = external_exports.strictObject({
|
|
16974
|
+
prompt: external_exports.string().trim().min(1).max(2e3),
|
|
16975
|
+
cwd: external_exports.string().max(4096).nullable()
|
|
16976
|
+
});
|
|
16977
|
+
var threadTitleResultSchema = external_exports.string().trim().min(1).max(60).nullable();
|
|
16978
|
+
|
|
16876
16979
|
// ../shared-contracts/dist/web-ui-extensions.js
|
|
16877
16980
|
var webUiExtensionIdSchema = external_exports.string().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u);
|
|
16878
16981
|
var localizedTextSchema2 = external_exports.union([
|
|
@@ -21120,7 +21223,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
21120
21223
|
launchPathSaveError: "Could not save. Enter an existing absolute installation folder on this Host and check configuration permissions.",
|
|
21121
21224
|
connectionOfficialWebsite: "Visit official website",
|
|
21122
21225
|
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.
|
|
21226
|
+
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
21227
|
connectionInstall: "Install",
|
|
21125
21228
|
connectionInstallDescription: "This Harness was not detected.",
|
|
21126
21229
|
connectionInstallRunning: "Installing on the selected Host. You can leave this page; login or setup may still be required afterward.",
|
|
@@ -21402,7 +21505,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
21402
21505
|
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
21506
|
connectionOfficialWebsite: "\u8BBF\u95EE\u5B98\u7F51",
|
|
21404
21507
|
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.
|
|
21508
|
+
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
21509
|
connectionInstall: "\u5B89\u88C5",
|
|
21407
21510
|
connectionInstallDescription: "\u5C1A\u672A\u68C0\u6D4B\u5230\u8BE5 Harness\u3002",
|
|
21408
21511
|
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",
|
|
@@ -23059,7 +23162,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
23059
23162
|
}
|
|
23060
23163
|
function rendererLiveCommandsPendingNotice(locale, harnessLabel) {
|
|
23061
23164
|
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
|
|
23165
|
+
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
23166
|
}
|
|
23064
23167
|
|
|
23065
23168
|
// src/renderer-model-favorites.ts
|
|
@@ -26372,6 +26475,19 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
26372
26475
|
return externalThreadForkResultSchema.parse(result);
|
|
26373
26476
|
},
|
|
26374
26477
|
inspectHarness,
|
|
26478
|
+
async listSkills(params) {
|
|
26479
|
+
return skillsListResultSchema.parse(
|
|
26480
|
+
await manager.sendRequest(SKILLS_LIST_METHOD, skillsListParamsSchema.parse(params))
|
|
26481
|
+
);
|
|
26482
|
+
},
|
|
26483
|
+
subscribeSkillsChanged(listener) {
|
|
26484
|
+
return notificationTarget(source)?.addNotificationCallback?.(SKILLS_CHANGED_METHOD, (value) => {
|
|
26485
|
+
if (!isRecord5(value) || value.method !== SKILLS_CHANGED_METHOD) return;
|
|
26486
|
+
const parsed = skillsChangedParamsSchema.safeParse(value.params);
|
|
26487
|
+
if (parsed.success) listener(parsed.data);
|
|
26488
|
+
}) ?? (() => {
|
|
26489
|
+
});
|
|
26490
|
+
},
|
|
26375
26491
|
async listHarnessPlugins() {
|
|
26376
26492
|
return harnessPluginListResultSchema.parse(
|
|
26377
26493
|
await manager.sendRequest(HARNESS_PLUGIN_LIST_METHOD, {})
|
|
@@ -27197,7 +27313,8 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27197
27313
|
(method) => [
|
|
27198
27314
|
THREAD_USAGE_UPDATED_METHOD,
|
|
27199
27315
|
HARNESS_PREFERENCES_CHANGED_METHOD,
|
|
27200
|
-
HARNESS_DISPLAY_CHANGED_METHOD
|
|
27316
|
+
HARNESS_DISPLAY_CHANGED_METHOD,
|
|
27317
|
+
SKILLS_CHANGED_METHOD
|
|
27201
27318
|
].includes(method)
|
|
27202
27319
|
))
|
|
27203
27320
|
return () => unsubscribe?.();
|
|
@@ -27207,7 +27324,8 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27207
27324
|
if (disposed || !message2 || typeof message2 !== "object" || !("type" in message2) || message2.type !== "mcp-notification" || !("hostId" in message2) || message2.hostId !== route.hostId || !("method" in message2) || ![
|
|
27208
27325
|
THREAD_USAGE_UPDATED_METHOD,
|
|
27209
27326
|
HARNESS_PREFERENCES_CHANGED_METHOD,
|
|
27210
|
-
HARNESS_DISPLAY_CHANGED_METHOD
|
|
27327
|
+
HARNESS_DISPLAY_CHANGED_METHOD,
|
|
27328
|
+
SKILLS_CHANGED_METHOD
|
|
27211
27329
|
].includes(String(message2.method)) || !(typeof methods === "string" ? [methods] : methods).includes(
|
|
27212
27330
|
String(message2.method)
|
|
27213
27331
|
) || readRouting()?.forHost(route.hostId) !== route)
|
|
@@ -42014,6 +42132,98 @@ ${renderer_brand_mark_default}`;
|
|
|
42014
42132
|
};
|
|
42015
42133
|
}
|
|
42016
42134
|
|
|
42135
|
+
// src/renderer-skill-library.ts
|
|
42136
|
+
function createRendererSkillLibrary(options) {
|
|
42137
|
+
let active = null;
|
|
42138
|
+
const key = (context2) => JSON.stringify(context2.params);
|
|
42139
|
+
const current = (state) => {
|
|
42140
|
+
const context2 = options.context(state.editor);
|
|
42141
|
+
return active === state && context2?.client === state.context.client && key(context2) === state.key;
|
|
42142
|
+
};
|
|
42143
|
+
const close = () => {
|
|
42144
|
+
active?.unsubscribe?.();
|
|
42145
|
+
active = null;
|
|
42146
|
+
};
|
|
42147
|
+
const query = async (state) => {
|
|
42148
|
+
if (state.pending) {
|
|
42149
|
+
state.dirty = true;
|
|
42150
|
+
return;
|
|
42151
|
+
}
|
|
42152
|
+
do {
|
|
42153
|
+
state.dirty = false;
|
|
42154
|
+
state.pending = true;
|
|
42155
|
+
delete state.error;
|
|
42156
|
+
try {
|
|
42157
|
+
if (!state.context.client.listSkills)
|
|
42158
|
+
throw new Error("This Host does not support the Skill Library");
|
|
42159
|
+
const result = await state.context.client.listSkills(state.context.params);
|
|
42160
|
+
if (!current(state)) return;
|
|
42161
|
+
state.result = result;
|
|
42162
|
+
} catch (error51) {
|
|
42163
|
+
if (!current(state)) return;
|
|
42164
|
+
state.error = error51 instanceof Error ? error51.message : String(error51);
|
|
42165
|
+
} finally {
|
|
42166
|
+
state.pending = false;
|
|
42167
|
+
}
|
|
42168
|
+
options.changed();
|
|
42169
|
+
} while (state.dirty && current(state));
|
|
42170
|
+
};
|
|
42171
|
+
const open = (editor) => {
|
|
42172
|
+
const context2 = options.context(editor);
|
|
42173
|
+
if (!context2) {
|
|
42174
|
+
close();
|
|
42175
|
+
return;
|
|
42176
|
+
}
|
|
42177
|
+
if (active?.context.client === context2.client && active.key === key(context2)) {
|
|
42178
|
+
active.editor = editor;
|
|
42179
|
+
return;
|
|
42180
|
+
}
|
|
42181
|
+
close();
|
|
42182
|
+
const state = {
|
|
42183
|
+
editor,
|
|
42184
|
+
context: context2,
|
|
42185
|
+
key: key(context2),
|
|
42186
|
+
pending: false,
|
|
42187
|
+
dirty: false
|
|
42188
|
+
};
|
|
42189
|
+
active = state;
|
|
42190
|
+
if (context2.client.subscribeSkillsChanged) {
|
|
42191
|
+
state.unsubscribe = context2.client.subscribeSkillsChanged((change) => {
|
|
42192
|
+
if (!current(state)) return;
|
|
42193
|
+
if (change.cwd && !context2.params.threadId && change.cwd !== context2.params.cwd) return;
|
|
42194
|
+
void query(state);
|
|
42195
|
+
});
|
|
42196
|
+
}
|
|
42197
|
+
void query(state);
|
|
42198
|
+
};
|
|
42199
|
+
return {
|
|
42200
|
+
open,
|
|
42201
|
+
close,
|
|
42202
|
+
read(editor) {
|
|
42203
|
+
const context2 = options.context(editor);
|
|
42204
|
+
if (!context2) return null;
|
|
42205
|
+
if (!active || active.context.client !== context2.client || active.key !== key(context2))
|
|
42206
|
+
open(editor);
|
|
42207
|
+
const state = active;
|
|
42208
|
+
if (!state) return null;
|
|
42209
|
+
const zh = options.locale() === "zh-CN";
|
|
42210
|
+
return {
|
|
42211
|
+
skills: state.result?.skills ?? [],
|
|
42212
|
+
...!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" } : {},
|
|
42213
|
+
...state.result?.warnings?.length ? { warning: state.result.warnings.join("\n") } : {},
|
|
42214
|
+
...state.error ? { error: state.error } : {},
|
|
42215
|
+
retry: () => {
|
|
42216
|
+
if (current(state)) {
|
|
42217
|
+
void query(state);
|
|
42218
|
+
options.changed();
|
|
42219
|
+
}
|
|
42220
|
+
}
|
|
42221
|
+
};
|
|
42222
|
+
},
|
|
42223
|
+
dispose: close
|
|
42224
|
+
};
|
|
42225
|
+
}
|
|
42226
|
+
|
|
42017
42227
|
// src/renderer-native-composer-controller.ts
|
|
42018
42228
|
var MAX_ELEMENT_DEPTH = 4;
|
|
42019
42229
|
var MAX_FIBER_DEPTH = 40;
|
|
@@ -42068,6 +42278,39 @@ ${renderer_brand_mark_default}`;
|
|
|
42068
42278
|
return false;
|
|
42069
42279
|
}
|
|
42070
42280
|
}
|
|
42281
|
+
function nativeSelectionMarkdown(editor) {
|
|
42282
|
+
const controller = findNativeComposerController(editor);
|
|
42283
|
+
if (!controller?.getMarkdownSerializer) return null;
|
|
42284
|
+
const { doc, selection } = controller.view.state;
|
|
42285
|
+
const cut = doc.cut;
|
|
42286
|
+
if (!cut) return null;
|
|
42287
|
+
try {
|
|
42288
|
+
const serialize = controller.getMarkdownSerializer("markdown");
|
|
42289
|
+
return serialize?.(cut.call(doc, selection.from, selection.to)) ?? null;
|
|
42290
|
+
} catch {
|
|
42291
|
+
return null;
|
|
42292
|
+
}
|
|
42293
|
+
}
|
|
42294
|
+
function insertNativeMentionContent(editor, parts) {
|
|
42295
|
+
const controller = findNativeComposerController(editor);
|
|
42296
|
+
if (!controller) return false;
|
|
42297
|
+
const { schema, selection, tr } = controller.view.state;
|
|
42298
|
+
const nodeType = schema.nodes.agentMention;
|
|
42299
|
+
const text = schema.text;
|
|
42300
|
+
const create = nodeType?.create;
|
|
42301
|
+
const replace = tr.replaceWith;
|
|
42302
|
+
if (!text || !create || !replace) return false;
|
|
42303
|
+
try {
|
|
42304
|
+
const literal2 = schema.marks?.literalPaste?.create();
|
|
42305
|
+
const content = parts.filter((part) => part !== "").map(
|
|
42306
|
+
(part) => typeof part === "string" ? text.call(schema, part, literal2 ? [literal2] : void 0) : create.call(nodeType, { conversationId: null, ...part })
|
|
42307
|
+
);
|
|
42308
|
+
controller.view.dispatch(replace.call(tr, selection.from, selection.to, content));
|
|
42309
|
+
return true;
|
|
42310
|
+
} catch {
|
|
42311
|
+
return false;
|
|
42312
|
+
}
|
|
42313
|
+
}
|
|
42071
42314
|
function insertNativeAgentMention(editor, range, mention) {
|
|
42072
42315
|
const controller = findNativeComposerController(editor);
|
|
42073
42316
|
const nodeType = controller?.view.state.schema.nodes.agentMention;
|
|
@@ -42094,9 +42337,82 @@ ${renderer_brand_mark_default}`;
|
|
|
42094
42337
|
}
|
|
42095
42338
|
}
|
|
42096
42339
|
|
|
42340
|
+
// src/renderer-skill-reference.ts
|
|
42341
|
+
var STYLE_ATTRIBUTE3 = "data-codexhost-skill-reference-style";
|
|
42342
|
+
var SVG_NS3 = "http://www.w3.org/2000/svg";
|
|
42343
|
+
var CUBE = "M12 3 20 7.5v9L12 21l-8-4.5v-9ZM4 7.5 12 12l8-4.5M12 12v9";
|
|
42344
|
+
function createSkillIcon(ownerDocument) {
|
|
42345
|
+
const svg2 = ownerDocument.createElementNS(SVG_NS3, "svg");
|
|
42346
|
+
svg2.setAttribute("viewBox", "0 0 24 24");
|
|
42347
|
+
svg2.setAttribute("fill", "none");
|
|
42348
|
+
svg2.setAttribute("stroke", "currentColor");
|
|
42349
|
+
svg2.setAttribute("stroke-width", "1.7");
|
|
42350
|
+
svg2.setAttribute("stroke-linejoin", "round");
|
|
42351
|
+
svg2.setAttribute("aria-hidden", "true");
|
|
42352
|
+
const path = ownerDocument.createElementNS(SVG_NS3, "path");
|
|
42353
|
+
path.setAttribute("d", CUBE);
|
|
42354
|
+
svg2.append(path);
|
|
42355
|
+
return svg2;
|
|
42356
|
+
}
|
|
42357
|
+
function skillMention(skill) {
|
|
42358
|
+
return { name: skill.name, displayName: skill.name, path: desktopSkillMentionPath(skill) };
|
|
42359
|
+
}
|
|
42360
|
+
function installRendererSkillReferences(ownerDocument, isExternalEditor) {
|
|
42361
|
+
const style = ownerDocument.createElement("style");
|
|
42362
|
+
style.setAttribute(STYLE_ATTRIBUTE3, "true");
|
|
42363
|
+
const selector = `[agent-mention-path^="${DESKTOP_SKILL_MENTION_PATH_PREFIX}"][agent-mention-display-name]`;
|
|
42364
|
+
const icon2 = encodeURIComponent(
|
|
42365
|
+
`<svg xmlns="${SVG_NS3}" viewBox="0 0 24 24" fill="none" stroke="#808080" stroke-width="1.7" stroke-linejoin="round"><path d="${CUBE}"/></svg>`
|
|
42366
|
+
);
|
|
42367
|
+
style.textContent = `${selector}>span{display:none;}
|
|
42368
|
+
${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;}
|
|
42369
|
+
${selector}::after{content:attr(agent-mention-display-name);}`;
|
|
42370
|
+
(ownerDocument.head ?? ownerDocument.documentElement).append(style);
|
|
42371
|
+
const selectedEditor = () => {
|
|
42372
|
+
const node = ownerDocument.getSelection()?.anchorNode;
|
|
42373
|
+
const element = node?.nodeType === node?.ELEMENT_NODE ? node : node?.parentElement;
|
|
42374
|
+
const editor = element?.closest('[contenteditable="true"]');
|
|
42375
|
+
return editor && isExternalEditor(editor) ? editor : null;
|
|
42376
|
+
};
|
|
42377
|
+
const copy = (event) => {
|
|
42378
|
+
const editor = selectedEditor();
|
|
42379
|
+
if (!editor || !event.clipboardData) return;
|
|
42380
|
+
const text = nativeSelectionMarkdown(editor) ?? event.clipboardData.getData("text/plain");
|
|
42381
|
+
const canonical = restoreDesktopSkillMentions(text);
|
|
42382
|
+
if (canonical === text) return;
|
|
42383
|
+
event.clipboardData.setData("text/plain", canonical);
|
|
42384
|
+
event.preventDefault();
|
|
42385
|
+
event.stopImmediatePropagation();
|
|
42386
|
+
};
|
|
42387
|
+
const paste = (event) => {
|
|
42388
|
+
const editor = selectedEditor();
|
|
42389
|
+
if (!editor || !event.clipboardData || event.clipboardData.files.length) return;
|
|
42390
|
+
const text = event.clipboardData.getData("text/plain");
|
|
42391
|
+
const references = skillReferences(text);
|
|
42392
|
+
if (!references.length) return;
|
|
42393
|
+
const parts = [];
|
|
42394
|
+
let cursor = 0;
|
|
42395
|
+
for (const reference of references) {
|
|
42396
|
+
parts.push(text.slice(cursor, reference.start), skillMention(reference));
|
|
42397
|
+
cursor = reference.end;
|
|
42398
|
+
}
|
|
42399
|
+
parts.push(text.slice(cursor));
|
|
42400
|
+
if (!insertNativeMentionContent(editor, parts)) return;
|
|
42401
|
+
event.preventDefault();
|
|
42402
|
+
event.stopImmediatePropagation();
|
|
42403
|
+
};
|
|
42404
|
+
ownerDocument.addEventListener("copy", copy, true);
|
|
42405
|
+
ownerDocument.addEventListener("paste", paste, true);
|
|
42406
|
+
return () => {
|
|
42407
|
+
ownerDocument.removeEventListener("copy", copy, true);
|
|
42408
|
+
ownerDocument.removeEventListener("paste", paste, true);
|
|
42409
|
+
style.remove();
|
|
42410
|
+
};
|
|
42411
|
+
}
|
|
42412
|
+
|
|
42097
42413
|
// src/renderer-delegation-mention.ts
|
|
42098
42414
|
var MENU_ATTRIBUTE = "data-codexhost-delegation-mention-menu";
|
|
42099
|
-
var
|
|
42415
|
+
var STYLE_ATTRIBUTE4 = "data-codexhost-delegation-mention-style";
|
|
42100
42416
|
var MENU_MAX_HEIGHT = 320;
|
|
42101
42417
|
var SOURCE_TAG = "codexhost";
|
|
42102
42418
|
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 +42457,13 @@ ${renderer_brand_mark_default}`;
|
|
|
42141
42457
|
return scored.sort((left, right) => right.score - left.score || left.index - right.index).map(({ command }) => command);
|
|
42142
42458
|
}
|
|
42143
42459
|
function harnessCommandDisplayName(label) {
|
|
42144
|
-
const slug = label.trim().replace(/^\//u, "")
|
|
42460
|
+
const slug = label.trim().replace(/^\//u, "");
|
|
42145
42461
|
if (!slug || /\s/u.test(slug) || /[A-Z]/u.test(slug) || /[^\x00-\x7F]/u.test(slug)) {
|
|
42146
42462
|
return slug || label;
|
|
42147
42463
|
}
|
|
42148
42464
|
const name = slug.split(":").filter(Boolean).at(-1) ?? slug;
|
|
42149
42465
|
return name.split(/[-_.]+/u).filter(Boolean).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
42150
42466
|
}
|
|
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
42467
|
function agentsTitle(locale) {
|
|
42166
42468
|
return locale === "zh-CN" ? "\u59D4\u6D3E\u7ED9 Agent" : "Delegate to agent";
|
|
42167
42469
|
}
|
|
@@ -42183,10 +42485,10 @@ ${renderer_brand_mark_default}`;
|
|
|
42183
42485
|
return `"${value.replace(/["\\\n]/gu, (character) => `\\${character === "\n" ? "a " : character}`)}"`;
|
|
42184
42486
|
}
|
|
42185
42487
|
function syncChipStyle(ownerDocument, targets, cache) {
|
|
42186
|
-
let style = ownerDocument.querySelector(`style[${
|
|
42488
|
+
let style = ownerDocument.querySelector(`style[${STYLE_ATTRIBUTE4}]`);
|
|
42187
42489
|
if (!style) {
|
|
42188
42490
|
style = ownerDocument.createElement("style");
|
|
42189
|
-
style.setAttribute(
|
|
42491
|
+
style.setAttribute(STYLE_ATTRIBUTE4, "true");
|
|
42190
42492
|
(ownerDocument.head ?? ownerDocument.documentElement).append(style);
|
|
42191
42493
|
}
|
|
42192
42494
|
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 +42510,13 @@ ${renderer_brand_mark_default}`;
|
|
|
42208
42510
|
const text = rules.join("\n");
|
|
42209
42511
|
if (style.textContent !== text) style.textContent = text;
|
|
42210
42512
|
}
|
|
42513
|
+
function filterDelegationSkills(skills, query) {
|
|
42514
|
+
const needle = query.trim().toLowerCase();
|
|
42515
|
+
return skills.filter(
|
|
42516
|
+
(skill) => `${skill.name}
|
|
42517
|
+
${skill.description ?? ""}`.toLowerCase().includes(needle)
|
|
42518
|
+
);
|
|
42519
|
+
}
|
|
42211
42520
|
function installRendererDelegationMention(ownerDocument, options) {
|
|
42212
42521
|
const view = ownerDocument.defaultView;
|
|
42213
42522
|
if (!view) {
|
|
@@ -42242,9 +42551,11 @@ ${renderer_brand_mark_default}`;
|
|
|
42242
42551
|
let rowsRendered = 0;
|
|
42243
42552
|
const close = () => {
|
|
42244
42553
|
active = null;
|
|
42554
|
+
openedFor = null;
|
|
42245
42555
|
entries = [];
|
|
42246
42556
|
setMenuOpen(false);
|
|
42247
42557
|
list.replaceChildren();
|
|
42558
|
+
options.onClose?.();
|
|
42248
42559
|
};
|
|
42249
42560
|
const highlight = () => {
|
|
42250
42561
|
[...list.querySelectorAll("[role=option]")].forEach((item, index) => {
|
|
@@ -42317,7 +42628,7 @@ ${renderer_brand_mark_default}`;
|
|
|
42317
42628
|
item.addEventListener("click", () => void choose(entry));
|
|
42318
42629
|
return item;
|
|
42319
42630
|
};
|
|
42320
|
-
const render = (trigger, commands, targets) => {
|
|
42631
|
+
const render = (trigger, commands, targets, skills) => {
|
|
42321
42632
|
const locale = options.readLocale();
|
|
42322
42633
|
const rows = [];
|
|
42323
42634
|
entries = [];
|
|
@@ -42337,18 +42648,13 @@ ${renderer_brand_mark_default}`;
|
|
|
42337
42648
|
}
|
|
42338
42649
|
}
|
|
42339
42650
|
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) {
|
|
42651
|
+
if (commands.matches.length) {
|
|
42652
|
+
rows.push(sectionHeader(commandsTitle(locale)));
|
|
42653
|
+
for (const command of commands.matches) {
|
|
42348
42654
|
const reason = commands.source.disabledReason(command);
|
|
42349
42655
|
const presentation = rendererHarnessCommandPresentation(command, locale);
|
|
42350
42656
|
const content = rowContent(
|
|
42351
|
-
|
|
42657
|
+
createHarnessCommandIcon(ownerDocument),
|
|
42352
42658
|
harnessCommandDisplayName(presentation.label),
|
|
42353
42659
|
reason ?? presentation.description
|
|
42354
42660
|
);
|
|
@@ -42376,6 +42682,44 @@ ${renderer_brand_mark_default}`;
|
|
|
42376
42682
|
hint.textContent = notice;
|
|
42377
42683
|
rows.push(hint);
|
|
42378
42684
|
}
|
|
42685
|
+
if (skills) {
|
|
42686
|
+
rows.push(sectionHeader(skillsTitle(locale)));
|
|
42687
|
+
const matches = filterDelegationSkills(skills.skills, trigger.query);
|
|
42688
|
+
for (const skill of matches) {
|
|
42689
|
+
const scope = locale === "zh-CN" ? skill.scope === "project" ? "\u9879\u76EE" : "\u5168\u5C40" : skill.scope === "project" ? "Project" : "Global";
|
|
42690
|
+
const detail = `${scope} \xB7 ${skill.source} \xB7 ${skill.path}${skill.description ? ` \u2014 ${skill.description}` : ""}`;
|
|
42691
|
+
const content = rowContent(createSkillIcon(ownerDocument), skill.name, detail);
|
|
42692
|
+
content.setAttribute("data-skill-path", skill.path);
|
|
42693
|
+
content.title = detail;
|
|
42694
|
+
rows.push(optionRow({ kind: "librarySkill", skill }, content));
|
|
42695
|
+
}
|
|
42696
|
+
const hint = (label, detail = "") => {
|
|
42697
|
+
const row = ownerDocument.createElement("div");
|
|
42698
|
+
row.className = `${ROW_CLASS} opacity-50`;
|
|
42699
|
+
row.setAttribute("aria-disabled", "true");
|
|
42700
|
+
row.title = detail;
|
|
42701
|
+
row.append(rowContent(null, label, detail));
|
|
42702
|
+
rows.push(row);
|
|
42703
|
+
};
|
|
42704
|
+
if (skills.error) {
|
|
42705
|
+
rows.push(
|
|
42706
|
+
optionRow(
|
|
42707
|
+
{ kind: "retrySkills", retry: skills.retry },
|
|
42708
|
+
rowContent(
|
|
42709
|
+
null,
|
|
42710
|
+
locale === "zh-CN" ? "\u91CD\u8BD5 Skill \u5E93" : "Retry Skill Library",
|
|
42711
|
+
skills.error
|
|
42712
|
+
)
|
|
42713
|
+
)
|
|
42714
|
+
);
|
|
42715
|
+
} else if (skills.notice) hint(skills.notice);
|
|
42716
|
+
else if (!matches.length) hint(locale === "zh-CN" ? "\u672A\u627E\u5230 Skill" : "No Skills found");
|
|
42717
|
+
if (skills.warning)
|
|
42718
|
+
hint(
|
|
42719
|
+
locale === "zh-CN" ? "\u90E8\u5206 Skill \u65E0\u6CD5\u8BFB\u53D6" : "Some Skills could not be read",
|
|
42720
|
+
skills.warning
|
|
42721
|
+
);
|
|
42722
|
+
}
|
|
42379
42723
|
rowsRendered = rows.length;
|
|
42380
42724
|
list.replaceChildren(...rows);
|
|
42381
42725
|
activeIndex = Math.min(activeIndex, Math.max(0, entries.length - 1));
|
|
@@ -42418,15 +42762,16 @@ ${renderer_brand_mark_default}`;
|
|
|
42418
42762
|
const targets = filterDelegationTargets(allTargets, trigger.query);
|
|
42419
42763
|
const source = options.readCommands(trigger.editor);
|
|
42420
42764
|
const commandMatches = source ? filterDelegationCommands(source.commands, trigger.query) : [];
|
|
42765
|
+
const skills = options.readSkills?.(trigger.editor) ?? null;
|
|
42421
42766
|
const showsNotice = Boolean(source?.pendingNotice) && trigger.query === "";
|
|
42422
|
-
if (targets.length === 0 && commandMatches.length === 0 && !showsNotice) {
|
|
42767
|
+
if (targets.length === 0 && commandMatches.length === 0 && !showsNotice && !skills) {
|
|
42423
42768
|
close();
|
|
42424
42769
|
return;
|
|
42425
42770
|
}
|
|
42426
42771
|
const sameQuery = active?.query === trigger.query && active.node === trigger.node;
|
|
42427
42772
|
active = trigger;
|
|
42428
42773
|
if (!sameQuery) activeIndex = 0;
|
|
42429
|
-
render(trigger, source ? { source, matches: commandMatches } : null, targets);
|
|
42774
|
+
render(trigger, source ? { source, matches: commandMatches } : null, targets, skills);
|
|
42430
42775
|
if (rowsRendered === 0) close();
|
|
42431
42776
|
};
|
|
42432
42777
|
const waitForSelectionSync = () => new Promise((resolve) => view.setTimeout(resolve, 0));
|
|
@@ -42480,7 +42825,12 @@ ${renderer_brand_mark_default}`;
|
|
|
42480
42825
|
source.select(command);
|
|
42481
42826
|
};
|
|
42482
42827
|
const choose = async (entry) => {
|
|
42828
|
+
if (entry.kind === "retrySkills") {
|
|
42829
|
+
entry.retry();
|
|
42830
|
+
return;
|
|
42831
|
+
}
|
|
42483
42832
|
const trigger = active;
|
|
42833
|
+
if (entry.kind === "librarySkill" && trigger && !options.readSkills?.(trigger.editor)) return;
|
|
42484
42834
|
close();
|
|
42485
42835
|
if (!trigger || !trigger.node.isConnected) return;
|
|
42486
42836
|
const expected = `#${trigger.query}`;
|
|
@@ -42489,7 +42839,15 @@ ${renderer_brand_mark_default}`;
|
|
|
42489
42839
|
inserting = true;
|
|
42490
42840
|
try {
|
|
42491
42841
|
if (entry.kind === "agent") await insertAgent(trigger, range, entry.target);
|
|
42492
|
-
else
|
|
42842
|
+
else if (entry.kind === "librarySkill") {
|
|
42843
|
+
const mention = skillMention(entry.skill);
|
|
42844
|
+
if (!insertNativeAgentMention(trigger.editor, range, mention)) {
|
|
42845
|
+
if (!await selectTriggerText(trigger)) return;
|
|
42846
|
+
const carrier = `[@${mention.name}](${mention.path}) `;
|
|
42847
|
+
if (!dispatchPlainTextPaste(trigger.editor, carrier))
|
|
42848
|
+
ownerDocument.execCommand("insertText", false, carrier);
|
|
42849
|
+
}
|
|
42850
|
+
} else await runCommand(trigger, range, entry);
|
|
42493
42851
|
} finally {
|
|
42494
42852
|
inserting = false;
|
|
42495
42853
|
}
|
|
@@ -42541,8 +42899,9 @@ ${renderer_brand_mark_default}`;
|
|
|
42541
42899
|
ownerDocument.removeEventListener("pointerdown", onPointerDown, true);
|
|
42542
42900
|
view.removeEventListener("resize", onViewportChange);
|
|
42543
42901
|
view.removeEventListener("scroll", onViewportChange, true);
|
|
42902
|
+
options.onClose?.();
|
|
42544
42903
|
menu.remove();
|
|
42545
|
-
ownerDocument.querySelector(`style[${
|
|
42904
|
+
ownerDocument.querySelector(`style[${STYLE_ATTRIBUTE4}]`)?.remove();
|
|
42546
42905
|
};
|
|
42547
42906
|
const openFor = (editor) => {
|
|
42548
42907
|
editor.focus({ preventScroll: true });
|
|
@@ -43966,6 +44325,28 @@ ${renderer_brand_mark_default}`;
|
|
|
43966
44325
|
}
|
|
43967
44326
|
}
|
|
43968
44327
|
}
|
|
44328
|
+
const skillContext = (editor) => {
|
|
44329
|
+
const composer = composerForElement(editor);
|
|
44330
|
+
const mounted = composer ? mountedByComposer.get(composer) : void 0;
|
|
44331
|
+
if (!mounted || !editor.isContentEditable || controller.get(mounted.composer).agent === "codex" || isOwnershipSubmissionBlocked(mounted.ownershipStatus))
|
|
44332
|
+
return null;
|
|
44333
|
+
const threadId = threadIdFromComposerModelTarget(mounted.modelTarget);
|
|
44334
|
+
const hostId2 = threadId ? mounted.hostId : activeModelHostId(mounted.composer);
|
|
44335
|
+
if (hostId2 !== "local") return null;
|
|
44336
|
+
const client = modelClientForHost(hostId2);
|
|
44337
|
+
if (!client) return null;
|
|
44338
|
+
const cwd = draftWorkspaces.get(hostId2);
|
|
44339
|
+
return { client, params: threadId ? { threadId } : cwd ? { cwd } : {} };
|
|
44340
|
+
};
|
|
44341
|
+
const skillLibrary = createRendererSkillLibrary({
|
|
44342
|
+
context: skillContext,
|
|
44343
|
+
locale: () => settingsLifecycle.locale,
|
|
44344
|
+
changed: () => delegationMention?.refresh()
|
|
44345
|
+
});
|
|
44346
|
+
const disposeSkillReferences = installRendererSkillReferences(
|
|
44347
|
+
document,
|
|
44348
|
+
(editor) => skillContext(editor) !== null
|
|
44349
|
+
);
|
|
43969
44350
|
const refreshCommands = async (mounted, { keepCurrent = false } = {}) => {
|
|
43970
44351
|
const generation = ++mounted.commandRequestGeneration;
|
|
43971
44352
|
const agent = controller.get(mounted.composer).agent;
|
|
@@ -45776,6 +46157,7 @@ ${renderer_brand_mark_default}`;
|
|
|
45776
46157
|
const { hostId: hostId2, cwd } = detail;
|
|
45777
46158
|
if (typeof hostId2 !== "string" || typeof cwd !== "string" || cwd.length === 0) return;
|
|
45778
46159
|
draftWorkspaces.set(hostId2, cwd);
|
|
46160
|
+
delegationMention?.refresh();
|
|
45779
46161
|
for (const mounted of mountedByComposer.values()) {
|
|
45780
46162
|
if (!threadIdFromComposerModelTarget(mounted.modelTarget) && activeModelHostId(mounted.composer) === hostId2 && controller.get(mounted.composer).agent !== "codex") {
|
|
45781
46163
|
void refreshCommands(mounted, { keepCurrent: true });
|
|
@@ -45791,7 +46173,10 @@ ${renderer_brand_mark_default}`;
|
|
|
45791
46173
|
window.addEventListener("codexhost:renderer-adapter-status", onAdapterStatus);
|
|
45792
46174
|
window.addEventListener("focus", onWindowFocus);
|
|
45793
46175
|
delegationMention = installRendererDelegationMention(document, {
|
|
46176
|
+
readSkills: (editor) => skillLibrary.read(editor),
|
|
46177
|
+
onClose: () => skillLibrary.close(),
|
|
45794
46178
|
onOpen: (editor) => {
|
|
46179
|
+
skillLibrary.open(editor);
|
|
45795
46180
|
const composer = composerForElement(editor);
|
|
45796
46181
|
const mounted = composer ? mountedByComposer.get(composer) : void 0;
|
|
45797
46182
|
if (mounted && controller.get(mounted.composer).agent !== "codex") {
|
|
@@ -45962,6 +46347,8 @@ ${renderer_brand_mark_default}`;
|
|
|
45962
46347
|
mutationObserver.disconnect();
|
|
45963
46348
|
disposeReasoningSoftWrap();
|
|
45964
46349
|
delegationMention?.dispose();
|
|
46350
|
+
skillLibrary.dispose();
|
|
46351
|
+
disposeSkillReferences();
|
|
45965
46352
|
sidebarAgentIcons.dispose();
|
|
45966
46353
|
sidebarThreadState.dispose();
|
|
45967
46354
|
nativeScheduleControls.dispose();
|