@codexhost/cli-linux-arm64 0.18.0-beta.5 → 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.
Files changed (58) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +64 -4
  4. package/app/console-web.js +193 -73
  5. package/app/desktop-controller.mjs +274 -11
  6. package/app/host-runtime.mjs +12322 -2469
  7. package/app/plugins/antigravity/plugin.mjs +654 -216
  8. package/app/plugins/claude-code/plugin.mjs +138 -11
  9. package/app/plugins/codebuddy/plugin.mjs +152 -20
  10. package/app/plugins/codex-usage/plugin.mjs +59 -2
  11. package/app/plugins/copilot/plugin.mjs +59 -2
  12. package/app/plugins/cursor-cli/plugin.mjs +134 -12
  13. package/app/plugins/deepseek-harness/manifest.json +2 -2
  14. package/app/plugins/deepseek-harness/plugin.mjs +86 -7
  15. package/app/plugins/devin/plugin.mjs +59 -2
  16. package/app/plugins/grok/plugin.mjs +392 -269
  17. package/app/plugins/hermes/plugin.mjs +138 -14
  18. package/app/plugins/kimi-code/plugin.mjs +59 -2
  19. package/app/plugins/kiro-cli/plugin.mjs +287 -18
  20. package/app/plugins/omp/plugin.mjs +788 -627
  21. package/app/plugins/opencode/plugin.mjs +59 -2
  22. package/app/plugins/pi/plugin.mjs +899 -773
  23. package/app/plugins/qoder/plugin.mjs +61 -6
  24. package/app/plugins/qoder-cn/plugin.mjs +61 -6
  25. package/app/plugins/qwen-code/plugin.mjs +168 -94
  26. package/app/plugins/workbuddy/plugin.mjs +152 -20
  27. package/app/plugins/zcode/plugin.mjs +132 -5
  28. package/app/renderer-extension.js +739 -336
  29. package/app/web/assets/index-BNQIOOHE.css +1 -0
  30. package/app/web/assets/index-Feo4BkqN.js +199 -0
  31. package/app/web/codexhost-settings.js +151 -65
  32. package/app/web/index.html +2 -2
  33. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
  34. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +8 -8
  35. package/app/web/plugins/deepseek-ai__dsh-client-file-upload/client.js +1 -1
  36. package/app/web/plugins/deepseek-ai__dsh-client-locale/client.js +3 -3
  37. package/app/web/plugins/deepseek-ai__dsh-client-ui-attachment/client.js +1 -1
  38. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +129 -8
  39. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +65 -63
  40. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +95 -93
  41. package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
  42. package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +2 -2
  43. package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +1 -1
  44. package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +3 -3
  45. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.excel.js +1 -1
  46. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-files/client.js +1 -1
  47. package/app/web/plugins/deepseek-ai__dsh-client-ui-theme/client.js +1 -1
  48. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +16 -16
  49. package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +1 -1
  50. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +11 -11
  51. package/app/web/sw.js +40 -0
  52. package/app/web-modules/server.mjs +2339 -1514
  53. package/bin/codexhost +0 -0
  54. package/libexec/codexhost-shim +0 -0
  55. package/libexec/codexhost-updater +0 -0
  56. package/package.json +1 -1
  57. package/app/web/assets/index-C0aXz2jD.js +0 -199
  58. 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
- cursor: external_exports.string().min(1).max(8192).optional(),
15687
- limit: external_exports.number().int().min(1).max(100).optional()
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([
@@ -18215,12 +18318,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18215
18318
  const modes = /* @__PURE__ */ new Set();
18216
18319
  const creationModes = /* @__PURE__ */ new Set();
18217
18320
  for (const row of rows) {
18218
- if (row.length !== 24 || row[7] !== null || row[10] !== true || !updates.has(row[13]))
18321
+ const offset = row.length === 25 ? 1 : 0;
18322
+ if (row.length !== 24 && row.length !== 25 || row[7 + offset] !== null || row[10 + offset] !== true || !updates.has(row[13 + offset]))
18219
18323
  continue;
18220
- const context2 = row[12];
18221
- const result = row[23];
18222
- if (context2 && context2 === row[21] && typeof context2.usesAccountPreferences === "boolean" && result?.usesAccountPreferences === context2.usesAccountPreferences && typeof row[14] === "function" && row[14] === row[20] && result.setModelAndReasoningEffort === row[14]) {
18223
- update ??= row[13];
18324
+ const context2 = row[12 + offset];
18325
+ const result = row[23 + offset];
18326
+ if (context2 && context2 === row[21 + offset] && typeof context2.usesAccountPreferences === "boolean" && result?.usesAccountPreferences === context2.usesAccountPreferences && typeof row[14 + offset] === "function" && row[14 + offset] === row[20 + offset] && result.setModelAndReasoningEffort === row[14 + offset]) {
18327
+ update ??= row[13 + offset];
18224
18328
  modes.add(context2.usesAccountPreferences);
18225
18329
  const settings = result.modelSettings;
18226
18330
  const group = groups.get(row);
@@ -18987,6 +19091,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18987
19091
  return fallback;
18988
19092
  }
18989
19093
 
19094
+ // ../../node_modules/lucide/dist/esm/icons/smartphone.mjs
19095
+ var Smartphone = [
19096
+ ["rect", { width: "14", height: "20", x: "5", y: "2", rx: "2", ry: "2" }],
19097
+ ["path", { d: "M12 18h.01" }]
19098
+ ];
19099
+
18990
19100
  // ../../node_modules/lucide/dist/esm/icons/boxes.mjs
18991
19101
  var Boxes = [
18992
19102
  [
@@ -19329,6 +19439,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19329
19439
  "model-pool",
19330
19440
  "routes",
19331
19441
  "gateway",
19442
+ "mobile",
19332
19443
  "updates",
19333
19444
  "schedules",
19334
19445
  "about",
@@ -19381,6 +19492,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19381
19492
  "model-pool": Boxes,
19382
19493
  routes: Route,
19383
19494
  gateway: Network,
19495
+ mobile: Smartphone,
19384
19496
  updates: CircleArrowUp,
19385
19497
  schedules: CalendarClock,
19386
19498
  about: Info,
@@ -21111,7 +21223,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
21111
21223
  launchPathSaveError: "Could not save. Enter an existing absolute installation folder on this Host and check configuration permissions.",
21112
21224
  connectionOfficialWebsite: "Visit official website",
21113
21225
  connectionOpenHarnessWeb: "Open DeepSeek Harness Web",
21114
- 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.1. Versions newer than 0.2.2-rc.1 can be tried, but compatibility may be limited; versions older than 0.1.7-rc.1 must be upgraded first.",
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.",
21115
21227
  connectionInstall: "Install",
21116
21228
  connectionInstallDescription: "This Harness was not detected.",
21117
21229
  connectionInstallRunning: "Installing on the selected Host. You can leave this page; login or setup may still be required afterward.",
@@ -21209,7 +21321,8 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
21209
21321
  aboutConsoleFailed: "The console could not be opened",
21210
21322
  pageLabels: Object.freeze({
21211
21323
  connections: "Connections",
21212
- "remote-connections": "Remote connections",
21324
+ "mobile-web": "Phone & browser",
21325
+ "remote-connections": "Other computers (SSH)",
21213
21326
  appearance: "General",
21214
21327
  accounts: "Accounts",
21215
21328
  "session-import": "Session Import",
@@ -21392,7 +21505,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
21392
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",
21393
21506
  connectionOfficialWebsite: "\u8BBF\u95EE\u5B98\u7F51",
21394
21507
  connectionOpenHarnessWeb: "\u6253\u5F00 DeepSeek Harness Web",
21395
- 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.1\u3002\u9AD8\u4E8E 0.2.2-rc.1 \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",
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",
21396
21509
  connectionInstall: "\u5B89\u88C5",
21397
21510
  connectionInstallDescription: "\u5C1A\u672A\u68C0\u6D4B\u5230\u8BE5 Harness\u3002",
21398
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",
@@ -21490,7 +21603,8 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
21490
21603
  aboutConsoleFailed: "\u63A7\u5236\u53F0\u6253\u5F00\u5931\u8D25",
21491
21604
  pageLabels: Object.freeze({
21492
21605
  connections: "\u8FDE\u63A5",
21493
- "remote-connections": "\u8FDC\u7A0B\u8FDE\u63A5",
21606
+ "mobile-web": "\u624B\u673A\u4E0E\u6D4F\u89C8\u5668",
21607
+ "remote-connections": "\u5176\u4ED6\u7535\u8111\uFF08SSH\uFF09",
21494
21608
  appearance: "\u901A\u7528",
21495
21609
  accounts: "\u8D26\u53F7",
21496
21610
  "session-import": "\u4F1A\u8BDD\u5BFC\u5165",
@@ -23048,7 +23162,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
23048
23162
  }
23049
23163
  function rendererLiveCommandsPendingNotice(locale, harnessLabel) {
23050
23164
  const harness2 = harnessLabel.replace(/\s*[((][^))]*[))]\s*$/u, "").trim() || harnessLabel;
23051
- 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\u548C\u6280\u80FD` : `Send a message to load all ${harness2} commands and skills for this project`;
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`;
23052
23166
  }
23053
23167
 
23054
23168
  // src/renderer-model-favorites.ts
@@ -26361,6 +26475,19 @@ Codex Fast mode prioritizes requests and may increase usage.`
26361
26475
  return externalThreadForkResultSchema.parse(result);
26362
26476
  },
26363
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
+ },
26364
26491
  async listHarnessPlugins() {
26365
26492
  return harnessPluginListResultSchema.parse(
26366
26493
  await manager.sendRequest(HARNESS_PLUGIN_LIST_METHOD, {})
@@ -27186,7 +27313,8 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
27186
27313
  (method) => [
27187
27314
  THREAD_USAGE_UPDATED_METHOD,
27188
27315
  HARNESS_PREFERENCES_CHANGED_METHOD,
27189
- HARNESS_DISPLAY_CHANGED_METHOD
27316
+ HARNESS_DISPLAY_CHANGED_METHOD,
27317
+ SKILLS_CHANGED_METHOD
27190
27318
  ].includes(method)
27191
27319
  ))
27192
27320
  return () => unsubscribe?.();
@@ -27196,7 +27324,8 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
27196
27324
  if (disposed || !message2 || typeof message2 !== "object" || !("type" in message2) || message2.type !== "mcp-notification" || !("hostId" in message2) || message2.hostId !== route.hostId || !("method" in message2) || ![
27197
27325
  THREAD_USAGE_UPDATED_METHOD,
27198
27326
  HARNESS_PREFERENCES_CHANGED_METHOD,
27199
- HARNESS_DISPLAY_CHANGED_METHOD
27327
+ HARNESS_DISPLAY_CHANGED_METHOD,
27328
+ SKILLS_CHANGED_METHOD
27200
27329
  ].includes(String(message2.method)) || !(typeof methods === "string" ? [methods] : methods).includes(
27201
27330
  String(message2.method)
27202
27331
  ) || readRouting()?.forHost(route.hostId) !== route)
@@ -32300,7 +32429,7 @@ ${detail}` : ""}`
32300
32429
  var INSPECT_RETRY_MS = 6e4;
32301
32430
  var RESTART_GRACE_MS = 9e4;
32302
32431
  var CONNECT_REQUEST_WAIT_MS = 3e3;
32303
- function createRemoteConnectionsPage(messages, getControl, getOpenWeb = () => void 0) {
32432
+ function createRemoteConnectionsPage(messages, getControl) {
32304
32433
  const zh = messages.locale === "zh-CN";
32305
32434
  const t = (cn, en) => zh ? cn : en;
32306
32435
  return Object.freeze({
@@ -32319,72 +32448,17 @@ ${detail}` : ""}`
32319
32448
  return panel;
32320
32449
  };
32321
32450
  const root = el("div", "settings-remote");
32322
- const openWeb = getOpenWeb();
32323
- if (openWeb) {
32324
- root.append(el("h1", "settings-section-label", messages.pageLabels["remote-connections"]));
32325
- const web = el("section", "settings-remote");
32326
- const webHeader = el("div", "settings-remote__header");
32327
- const webCopy = el("div");
32328
- webCopy.append(
32329
- el(
32330
- "h2",
32331
- "settings-section-label",
32332
- t("\u624B\u673A\u548C\u5176\u4ED6\u8BBE\u5907\uFF08Web\uFF09", "Phones and other devices (Web)")
32333
- ),
32334
- el(
32335
- "p",
32336
- "settings-page-description",
32337
- t(
32338
- "\u5728\u624B\u673A\u6216\u5176\u4ED6\u8BBE\u5907\u7684\u6D4F\u89C8\u5668\u4E0A\u4F7F\u7528\u8FD9\u53F0\u7535\u8111\u7684 CodexHost\uFF0C\u8FD9\u53F0\u7535\u8111\u9700\u8981\u4FDD\u6301\u5F00\u673A\u548C\u8054\u7F51\u3002",
32339
- "Use this computer's CodexHost from a browser on your phone or another device. This computer must stay on and connected to the network."
32340
- )
32341
- )
32342
- );
32343
- webHeader.append(webCopy);
32344
- const actions = el("div", "settings-remote__toolbar");
32345
- const button2 = el(
32346
- "button",
32347
- "settings-command-button settings-command-button--secondary",
32348
- t("\u6253\u5F00\u8FDE\u63A5\u8BBE\u5907\u9875", "Open Connect devices")
32349
- );
32350
- button2.type = "button";
32351
- const status = el("div", "settings-remote__banner");
32352
- status.setAttribute("role", "alert");
32353
- status.hidden = true;
32354
- button2.addEventListener("click", () => {
32355
- button2.disabled = true;
32356
- button2.textContent = t("\u6B63\u5728\u6253\u5F00\u2026", "Opening\u2026");
32357
- status.hidden = true;
32358
- void openWeb().catch((error51) => {
32359
- status.textContent = `${t("Web \u6253\u5F00\u5931\u8D25", "Web could not be opened")}: ${remoteErrorMessage(error51)}`;
32360
- status.hidden = false;
32361
- }).finally(() => {
32362
- button2.disabled = false;
32363
- button2.textContent = t("\u6253\u5F00\u8FDE\u63A5\u8BBE\u5907\u9875", "Open Connect devices");
32364
- });
32365
- });
32366
- actions.append(button2);
32367
- web.append(webHeader, actions, status);
32368
- root.append(web);
32369
- }
32370
32451
  const header = el("div", "settings-remote__header");
32371
32452
  const headerCopy = el("div");
32372
32453
  const localVersion = el("p", "settings-remote__meta");
32373
32454
  headerCopy.append(
32374
- el(
32375
- openWeb ? "h2" : "h1",
32376
- "settings-section-label",
32377
- openWeb ? t("\u5176\u4ED6\u7535\u8111\uFF08SSH\uFF09", "Other computers (SSH)") : messages.pageLabels["remote-connections"]
32378
- ),
32455
+ el("h1", "settings-section-label", messages.pageLabels["remote-connections"]),
32379
32456
  el(
32380
32457
  "p",
32381
32458
  "settings-page-description",
32382
- openWeb ? t(
32459
+ t(
32383
32460
  "\u8FD9\u53F0\u7535\u8111\u901A\u8FC7 SSH \u8FDE\u63A5\u53E6\u4E00\u53F0 Mac \u6216 Linux \u7535\u8111\u3002\u8FDE\u63A5\u914D\u7F6E\u4E0E Codex \u5171\u7528\u3002",
32384
32461
  "This computer connects to another Mac or Linux computer over SSH. Connection settings are shared with Codex."
32385
- ) : t(
32386
- "\u901A\u8FC7 SSH \u8FDE\u63A5\u4F60\u7684 Mac \u6216 Linux \u7535\u8111\u3002\u8FDE\u63A5\u914D\u7F6E\u4E0E Codex \u5171\u7528\u3002",
32387
- "Connect to a Mac or Linux computer over SSH. Connection settings are shared with Codex."
32388
32462
  )
32389
32463
  ),
32390
32464
  localVersion
@@ -32855,6 +32929,64 @@ ${detail}` : ""}`
32855
32929
  });
32856
32930
  }
32857
32931
 
32932
+ // src/settings/mobile-web-page.ts
32933
+ function createMobileWebPage(messages, getOpenWeb) {
32934
+ const zh = messages.locale === "zh-CN";
32935
+ const t = (cn, en) => zh ? cn : en;
32936
+ return Object.freeze({
32937
+ id: "mobile-web",
32938
+ label: messages.pageLabels["mobile-web"],
32939
+ icon: "mobile",
32940
+ mount({ content }) {
32941
+ const document2 = content.ownerDocument;
32942
+ const el = (tag, className = "", text = "") => remoteElement(document2, tag, className, text);
32943
+ const root = el("div", "settings-remote");
32944
+ const header = el("div", "settings-remote__header");
32945
+ const copy = el("div");
32946
+ copy.append(
32947
+ el("h1", "settings-section-label", messages.pageLabels["mobile-web"]),
32948
+ el(
32949
+ "p",
32950
+ "settings-page-description",
32951
+ t(
32952
+ "\u5728\u624B\u673A\u6216\u5176\u4ED6\u8BBE\u5907\u7684\u6D4F\u89C8\u5668\u4E0A\u4F7F\u7528\u8FD9\u53F0\u7535\u8111\u7684 CodexHost\uFF0C\u8FD9\u53F0\u7535\u8111\u9700\u8981\u4FDD\u6301\u5F00\u673A\u548C\u8054\u7F51\u3002",
32953
+ "Use this computer's CodexHost from a browser on your phone or another device. This computer must stay on and connected to the network."
32954
+ )
32955
+ )
32956
+ );
32957
+ header.append(copy);
32958
+ const label = t("\u5728\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00\u8FDE\u63A5\u8BBE\u7F6E", "Open connection settings in browser");
32959
+ const button2 = el("button", "settings-command-button", "");
32960
+ button2.type = "button";
32961
+ button2.textContent = label;
32962
+ const status = el("div", "settings-remote__banner");
32963
+ status.setAttribute("role", "alert");
32964
+ status.hidden = true;
32965
+ const openWeb = getOpenWeb();
32966
+ if (!openWeb) {
32967
+ button2.disabled = true;
32968
+ status.textContent = t("\u6B64\u7A97\u53E3\u65E0\u6CD5\u6253\u5F00 Web\u3002", "Web cannot be opened from this window.");
32969
+ status.hidden = false;
32970
+ }
32971
+ button2.addEventListener("click", () => {
32972
+ if (!openWeb) return;
32973
+ button2.disabled = true;
32974
+ status.hidden = true;
32975
+ void openWeb().catch((error51) => {
32976
+ status.textContent = `${t("Web \u6253\u5F00\u5931\u8D25", "Web could not be opened")}: ${remoteErrorMessage(error51)}`;
32977
+ status.hidden = false;
32978
+ }).finally(() => {
32979
+ button2.disabled = false;
32980
+ });
32981
+ });
32982
+ const actions = el("div", "settings-remote__toolbar");
32983
+ actions.append(button2);
32984
+ root.append(header, actions, status);
32985
+ content.append(root);
32986
+ }
32987
+ });
32988
+ }
32989
+
32858
32990
  // src/settings/core.ts
32859
32991
  var SETTINGS_PAGE_ID_PATTERN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u;
32860
32992
  var MAX_SETTINGS_PAGE_ID_LENGTH = 48;
@@ -36310,10 +36442,11 @@ ${detail}` : ""}`
36310
36442
  function createDefaultRendererSettingsPages(messages = DEFAULT_RENDERER_SETTINGS_MESSAGES, getUpdateClient = () => null, getDiagnostics = () => null, getAccountClient = () => null, getSessionImportClient = () => null, openImportedThread = () => Promise.reject(new Error("Imported Thread navigation is unavailable")), getLoadedSessionsClient = () => null, getRemoteConnections = () => null, requestUsageStatistics = () => Promise.reject(new Error("Local Host connection is unavailable")), usageStatisticsHosts, harnessSchedules) {
36311
36443
  return Object.freeze([
36312
36444
  createConnectionsSettingsPage(messages, getDiagnostics, void 0, getRemoteConnections),
36313
- createRemoteConnectionsPage(messages, getRemoteConnections, () => {
36445
+ createMobileWebPage(messages, () => {
36314
36446
  const client = getUpdateClient();
36315
36447
  return client?.openWeb?.bind(client);
36316
36448
  }),
36449
+ createRemoteConnectionsPage(messages, getRemoteConnections),
36317
36450
  createAccountsSettingsPage(messages, getAccountClient),
36318
36451
  ...harnessSchedules ? [createHarnessSchedulesPage(messages, harnessSchedules)] : [],
36319
36452
  createSessionImportSettingsPage(
@@ -41999,6 +42132,98 @@ ${renderer_brand_mark_default}`;
41999
42132
  };
42000
42133
  }
42001
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
+
42002
42227
  // src/renderer-native-composer-controller.ts
42003
42228
  var MAX_ELEMENT_DEPTH = 4;
42004
42229
  var MAX_FIBER_DEPTH = 40;
@@ -42053,6 +42278,39 @@ ${renderer_brand_mark_default}`;
42053
42278
  return false;
42054
42279
  }
42055
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
+ }
42056
42314
  function insertNativeAgentMention(editor, range, mention) {
42057
42315
  const controller = findNativeComposerController(editor);
42058
42316
  const nodeType = controller?.view.state.schema.nodes.agentMention;
@@ -42079,9 +42337,82 @@ ${renderer_brand_mark_default}`;
42079
42337
  }
42080
42338
  }
42081
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
+
42082
42413
  // src/renderer-delegation-mention.ts
42083
42414
  var MENU_ATTRIBUTE = "data-codexhost-delegation-mention-menu";
42084
- var STYLE_ATTRIBUTE3 = "data-codexhost-delegation-mention-style";
42415
+ var STYLE_ATTRIBUTE4 = "data-codexhost-delegation-mention-style";
42085
42416
  var MENU_MAX_HEIGHT = 320;
42086
42417
  var SOURCE_TAG = "codexhost";
42087
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";
@@ -42126,27 +42457,13 @@ ${renderer_brand_mark_default}`;
42126
42457
  return scored.sort((left, right) => right.score - left.score || left.index - right.index).map(({ command }) => command);
42127
42458
  }
42128
42459
  function harnessCommandDisplayName(label) {
42129
- const slug = label.trim().replace(/^\//u, "").replace(/^skill:/u, "");
42460
+ const slug = label.trim().replace(/^\//u, "");
42130
42461
  if (!slug || /\s/u.test(slug) || /[A-Z]/u.test(slug) || /[^\x00-\x7F]/u.test(slug)) {
42131
42462
  return slug || label;
42132
42463
  }
42133
42464
  const name = slug.split(":").filter(Boolean).at(-1) ?? slug;
42134
42465
  return name.split(/[-_.]+/u).filter(Boolean).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
42135
42466
  }
42136
- var SVG_NS3 = "http://www.w3.org/2000/svg";
42137
- function createSkillIcon(ownerDocument) {
42138
- const svg2 = ownerDocument.createElementNS(SVG_NS3, "svg");
42139
- svg2.setAttribute("viewBox", "0 0 24 24");
42140
- svg2.setAttribute("fill", "none");
42141
- svg2.setAttribute("stroke", "currentColor");
42142
- svg2.setAttribute("stroke-width", "1.7");
42143
- svg2.setAttribute("stroke-linejoin", "round");
42144
- svg2.setAttribute("aria-hidden", "true");
42145
- const path = ownerDocument.createElementNS(SVG_NS3, "path");
42146
- path.setAttribute("d", "M12 3 20 7.5v9L12 21l-8-4.5v-9ZM4 7.5 12 12l8-4.5M12 12v9");
42147
- svg2.append(path);
42148
- return svg2;
42149
- }
42150
42467
  function agentsTitle(locale) {
42151
42468
  return locale === "zh-CN" ? "\u59D4\u6D3E\u7ED9 Agent" : "Delegate to agent";
42152
42469
  }
@@ -42168,10 +42485,10 @@ ${renderer_brand_mark_default}`;
42168
42485
  return `"${value.replace(/["\\\n]/gu, (character) => `\\${character === "\n" ? "a " : character}`)}"`;
42169
42486
  }
42170
42487
  function syncChipStyle(ownerDocument, targets, cache) {
42171
- let style = ownerDocument.querySelector(`style[${STYLE_ATTRIBUTE3}]`);
42488
+ let style = ownerDocument.querySelector(`style[${STYLE_ATTRIBUTE4}]`);
42172
42489
  if (!style) {
42173
42490
  style = ownerDocument.createElement("style");
42174
- style.setAttribute(STYLE_ATTRIBUTE3, "true");
42491
+ style.setAttribute(STYLE_ATTRIBUTE4, "true");
42175
42492
  (ownerDocument.head ?? ownerDocument.documentElement).append(style);
42176
42493
  }
42177
42494
  const chip = [DELEGATION_MENTION_PATH_PREFIX, HARNESS_COMMAND_MENTION_PATH_PREFIX].map((prefix) => `[agent-mention-path^=${cssString(prefix)}][agent-mention-display-name]`).join(",");
@@ -42193,6 +42510,13 @@ ${renderer_brand_mark_default}`;
42193
42510
  const text = rules.join("\n");
42194
42511
  if (style.textContent !== text) style.textContent = text;
42195
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
+ }
42196
42520
  function installRendererDelegationMention(ownerDocument, options) {
42197
42521
  const view = ownerDocument.defaultView;
42198
42522
  if (!view) {
@@ -42227,9 +42551,11 @@ ${renderer_brand_mark_default}`;
42227
42551
  let rowsRendered = 0;
42228
42552
  const close = () => {
42229
42553
  active = null;
42554
+ openedFor = null;
42230
42555
  entries = [];
42231
42556
  setMenuOpen(false);
42232
42557
  list.replaceChildren();
42558
+ options.onClose?.();
42233
42559
  };
42234
42560
  const highlight = () => {
42235
42561
  [...list.querySelectorAll("[role=option]")].forEach((item, index) => {
@@ -42302,7 +42628,7 @@ ${renderer_brand_mark_default}`;
42302
42628
  item.addEventListener("click", () => void choose(entry));
42303
42629
  return item;
42304
42630
  };
42305
- const render = (trigger, commands, targets) => {
42631
+ const render = (trigger, commands, targets, skills) => {
42306
42632
  const locale = options.readLocale();
42307
42633
  const rows = [];
42308
42634
  entries = [];
@@ -42322,18 +42648,13 @@ ${renderer_brand_mark_default}`;
42322
42648
  }
42323
42649
  }
42324
42650
  if (commands) {
42325
- const groups = [
42326
- [commandsTitle(locale), commands.matches.filter(({ kind }) => kind !== "skill")],
42327
- [skillsTitle(locale), commands.matches.filter(({ kind }) => kind === "skill")]
42328
- ];
42329
- for (const [title, group] of groups) {
42330
- if (group.length === 0) continue;
42331
- rows.push(sectionHeader(title));
42332
- for (const command of group) {
42651
+ if (commands.matches.length) {
42652
+ rows.push(sectionHeader(commandsTitle(locale)));
42653
+ for (const command of commands.matches) {
42333
42654
  const reason = commands.source.disabledReason(command);
42334
42655
  const presentation = rendererHarnessCommandPresentation(command, locale);
42335
42656
  const content = rowContent(
42336
- command.kind === "skill" ? createSkillIcon(ownerDocument) : createHarnessCommandIcon(ownerDocument),
42657
+ createHarnessCommandIcon(ownerDocument),
42337
42658
  harnessCommandDisplayName(presentation.label),
42338
42659
  reason ?? presentation.description
42339
42660
  );
@@ -42361,6 +42682,44 @@ ${renderer_brand_mark_default}`;
42361
42682
  hint.textContent = notice;
42362
42683
  rows.push(hint);
42363
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
+ }
42364
42723
  rowsRendered = rows.length;
42365
42724
  list.replaceChildren(...rows);
42366
42725
  activeIndex = Math.min(activeIndex, Math.max(0, entries.length - 1));
@@ -42403,15 +42762,16 @@ ${renderer_brand_mark_default}`;
42403
42762
  const targets = filterDelegationTargets(allTargets, trigger.query);
42404
42763
  const source = options.readCommands(trigger.editor);
42405
42764
  const commandMatches = source ? filterDelegationCommands(source.commands, trigger.query) : [];
42765
+ const skills = options.readSkills?.(trigger.editor) ?? null;
42406
42766
  const showsNotice = Boolean(source?.pendingNotice) && trigger.query === "";
42407
- if (targets.length === 0 && commandMatches.length === 0 && !showsNotice) {
42767
+ if (targets.length === 0 && commandMatches.length === 0 && !showsNotice && !skills) {
42408
42768
  close();
42409
42769
  return;
42410
42770
  }
42411
42771
  const sameQuery = active?.query === trigger.query && active.node === trigger.node;
42412
42772
  active = trigger;
42413
42773
  if (!sameQuery) activeIndex = 0;
42414
- render(trigger, source ? { source, matches: commandMatches } : null, targets);
42774
+ render(trigger, source ? { source, matches: commandMatches } : null, targets, skills);
42415
42775
  if (rowsRendered === 0) close();
42416
42776
  };
42417
42777
  const waitForSelectionSync = () => new Promise((resolve) => view.setTimeout(resolve, 0));
@@ -42465,7 +42825,12 @@ ${renderer_brand_mark_default}`;
42465
42825
  source.select(command);
42466
42826
  };
42467
42827
  const choose = async (entry) => {
42828
+ if (entry.kind === "retrySkills") {
42829
+ entry.retry();
42830
+ return;
42831
+ }
42468
42832
  const trigger = active;
42833
+ if (entry.kind === "librarySkill" && trigger && !options.readSkills?.(trigger.editor)) return;
42469
42834
  close();
42470
42835
  if (!trigger || !trigger.node.isConnected) return;
42471
42836
  const expected = `#${trigger.query}`;
@@ -42474,7 +42839,15 @@ ${renderer_brand_mark_default}`;
42474
42839
  inserting = true;
42475
42840
  try {
42476
42841
  if (entry.kind === "agent") await insertAgent(trigger, range, entry.target);
42477
- else await runCommand(trigger, range, entry);
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);
42478
42851
  } finally {
42479
42852
  inserting = false;
42480
42853
  }
@@ -42526,8 +42899,9 @@ ${renderer_brand_mark_default}`;
42526
42899
  ownerDocument.removeEventListener("pointerdown", onPointerDown, true);
42527
42900
  view.removeEventListener("resize", onViewportChange);
42528
42901
  view.removeEventListener("scroll", onViewportChange, true);
42902
+ options.onClose?.();
42529
42903
  menu.remove();
42530
- ownerDocument.querySelector(`style[${STYLE_ATTRIBUTE3}]`)?.remove();
42904
+ ownerDocument.querySelector(`style[${STYLE_ATTRIBUTE4}]`)?.remove();
42531
42905
  };
42532
42906
  const openFor = (editor) => {
42533
42907
  editor.focus({ preventScroll: true });
@@ -43951,6 +44325,28 @@ ${renderer_brand_mark_default}`;
43951
44325
  }
43952
44326
  }
43953
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
+ );
43954
44350
  const refreshCommands = async (mounted, { keepCurrent = false } = {}) => {
43955
44351
  const generation = ++mounted.commandRequestGeneration;
43956
44352
  const agent = controller.get(mounted.composer).agent;
@@ -45761,6 +46157,7 @@ ${renderer_brand_mark_default}`;
45761
46157
  const { hostId: hostId2, cwd } = detail;
45762
46158
  if (typeof hostId2 !== "string" || typeof cwd !== "string" || cwd.length === 0) return;
45763
46159
  draftWorkspaces.set(hostId2, cwd);
46160
+ delegationMention?.refresh();
45764
46161
  for (const mounted of mountedByComposer.values()) {
45765
46162
  if (!threadIdFromComposerModelTarget(mounted.modelTarget) && activeModelHostId(mounted.composer) === hostId2 && controller.get(mounted.composer).agent !== "codex") {
45766
46163
  void refreshCommands(mounted, { keepCurrent: true });
@@ -45776,7 +46173,10 @@ ${renderer_brand_mark_default}`;
45776
46173
  window.addEventListener("codexhost:renderer-adapter-status", onAdapterStatus);
45777
46174
  window.addEventListener("focus", onWindowFocus);
45778
46175
  delegationMention = installRendererDelegationMention(document, {
46176
+ readSkills: (editor) => skillLibrary.read(editor),
46177
+ onClose: () => skillLibrary.close(),
45779
46178
  onOpen: (editor) => {
46179
+ skillLibrary.open(editor);
45780
46180
  const composer = composerForElement(editor);
45781
46181
  const mounted = composer ? mountedByComposer.get(composer) : void 0;
45782
46182
  if (mounted && controller.get(mounted.composer).agent !== "codex") {
@@ -45947,6 +46347,8 @@ ${renderer_brand_mark_default}`;
45947
46347
  mutationObserver.disconnect();
45948
46348
  disposeReasoningSoftWrap();
45949
46349
  delegationMention?.dispose();
46350
+ skillLibrary.dispose();
46351
+ disposeSkillReferences();
45950
46352
  sidebarAgentIcons.dispose();
45951
46353
  sidebarThreadState.dispose();
45952
46354
  nativeScheduleControls.dispose();
@@ -46286,6 +46688,7 @@ lucide/dist/esm/icons/check.mjs:
46286
46688
  lucide/dist/esm/icons/message-circle-question-mark.mjs:
46287
46689
  lucide/dist/esm/icons/pencil.mjs:
46288
46690
  lucide/dist/esm/icons/x.mjs:
46691
+ lucide/dist/esm/icons/smartphone.mjs:
46289
46692
  lucide/dist/esm/icons/boxes.mjs:
46290
46693
  lucide/dist/esm/icons/calendar-clock.mjs:
46291
46694
  lucide/dist/esm/icons/circle-check.mjs: