@shuind/dsh-codex-harness 0.3.2 → 0.3.3

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 (82) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +21 -41
  3. package/docs/preset-library.md +2 -2
  4. package/docs/tool-policy.md +1 -1
  5. package/lib/client.js +1826 -545
  6. package/lib/compact-command.js +7 -1
  7. package/lib/compaction.js +7 -1
  8. package/lib/hybrid-executor.js +23 -12
  9. package/lib/index.js +1229 -17
  10. package/lib/preferences.js +21 -2
  11. package/lib/tool-policy.js +11 -2
  12. package/lib/typert.js +42 -1
  13. package/lib/types/client/desktop.d.ts +20 -42
  14. package/lib/types/client/desktop.js +184 -127
  15. package/lib/types/client/index.d.ts +104 -39
  16. package/lib/types/client/index.js +97 -15
  17. package/lib/types/client/policy-drafts.d.ts +18 -0
  18. package/lib/types/client/policy-drafts.js +27 -0
  19. package/lib/types/client/policy-locale.d.ts +81 -32
  20. package/lib/types/client/policy-locale.js +197 -107
  21. package/lib/types/client/preset-manager.d.ts +25 -2
  22. package/lib/types/client/preset-manager.js +89 -5
  23. package/lib/types/client/preset-requests.d.ts +44 -1
  24. package/lib/types/client/preset-requests.js +150 -0
  25. package/lib/types/client/tool-policy.d.ts +6 -15
  26. package/lib/types/client/tool-policy.js +24 -39
  27. package/lib/types/contracts/preset-editor-schema.d.ts +35 -0
  28. package/lib/types/contracts/preset-editor-schema.js +39 -0
  29. package/lib/types/contracts/settings.d.ts +12 -0
  30. package/lib/types/contracts/settings.js +10 -1
  31. package/lib/types/contracts/ui-contracts.d.ts +48 -0
  32. package/lib/types/contracts/ui-contracts.js +58 -0
  33. package/lib/types/contracts/update.d.ts +73 -0
  34. package/lib/types/contracts/update.js +291 -0
  35. package/lib/types/entries/index.js +20 -2
  36. package/lib/types/entries/preferences.d.ts +2 -0
  37. package/lib/types/entries/preferences.js +9 -0
  38. package/lib/types/hybrid/hybrid-sdk.d.ts +1 -1
  39. package/lib/types/hybrid/hybrid-sdk.js +27 -13
  40. package/lib/types/presets/preset-editor.d.ts +13 -1
  41. package/lib/types/presets/preset-editor.js +24 -1
  42. package/lib/types/presets/pro-mode-store.d.ts +13 -0
  43. package/lib/types/presets/pro-mode-store.js +69 -0
  44. package/lib/types/responses/background-sse-codec.d.ts +23 -0
  45. package/lib/types/responses/background-sse-codec.js +230 -0
  46. package/lib/types/responses/background-stream.d.ts +28 -0
  47. package/lib/types/responses/background-stream.js +351 -0
  48. package/lib/types/responses/fetch-transport.js +24 -9
  49. package/lib/types/responses/wire-rewrite.d.ts +4 -0
  50. package/lib/types/responses/wire-rewrite.js +30 -4
  51. package/lib/types/tools/codex-subagent.d.ts +14 -0
  52. package/lib/types/tools/codex-subagent.js +269 -0
  53. package/lib/types/update/checker.d.ts +14 -0
  54. package/lib/types/update/checker.js +166 -0
  55. package/locale/en.json +1 -1
  56. package/locale/hybrid-executor/en.json +1 -1
  57. package/locale/hybrid-executor/zh.json +1 -1
  58. package/locale/zh.json +1 -1
  59. package/package.json +6 -2
  60. package/src/client/desktop.tsx +359 -160
  61. package/src/client/index.tsx +122 -22
  62. package/src/client/policy-drafts.ts +45 -0
  63. package/src/client/policy-locale.ts +198 -106
  64. package/src/client/preset-manager.tsx +125 -4
  65. package/src/client/preset-requests.ts +185 -1
  66. package/src/client/tool-policy.tsx +29 -63
  67. package/src/contracts/preset-editor-schema.ts +44 -0
  68. package/src/contracts/settings.ts +20 -1
  69. package/src/contracts/ui-contracts.ts +87 -0
  70. package/src/contracts/update.ts +307 -0
  71. package/src/entries/index.ts +25 -2
  72. package/src/entries/preferences.ts +9 -0
  73. package/src/hybrid/hybrid-sdk.ts +28 -12
  74. package/src/presets/preset-editor.ts +31 -3
  75. package/src/presets/pro-mode-store.ts +80 -0
  76. package/src/responses/background-sse-codec.ts +237 -0
  77. package/src/responses/background-stream.ts +371 -0
  78. package/src/responses/fetch-transport.ts +28 -9
  79. package/src/responses/wire-rewrite.ts +34 -3
  80. package/src/tools/codex-subagent.ts +290 -0
  81. package/src/update/checker.ts +193 -0
  82. package/tsdown.config.ts +4 -0
package/lib/client.js CHANGED
@@ -17,6 +17,50 @@ window.__ModuleLoader__.load({
17
17
  const CODEX_CONTEXT_MAX = 1e6;
18
18
  const OPENAI_CODEX_SETTINGS_NAMESPACE = "llm-openai-codex";
19
19
  const OPENAI_CODEX_MODEL_CATALOG_PATH = "/plugins/dsh-codex-connect/models";
20
+ const CODEX_SUBAGENT_TOOL_NAME = "codex_subagent";
21
+ const CODEX_SUBAGENT_DEFAULT_PRESET = "codex-hybrid";
22
+ const CODEX_SUBAGENT_PRESET_INHERIT = "inherit";
23
+ const API_PRO_MODE_MODEL = /^gpt-(?:5\.6|[6-9]|\d{2,})(?:[._-]|$)/i;
24
+ const LEGACY_PRO_MODEL_SLUG = /(?:^|[-_.])pro(?:$|[-_.])/i;
25
+ /**
26
+ * Models on the OpenAI Responses API that accept `reasoning.mode = "pro"`.
27
+ * Excludes standalone legacy `*-pro` slugs (e.g. `gpt-5.4-pro`, `gpt-5.5-pro`).
28
+ */
29
+ function supportsApiProMode(model) {
30
+ if (typeof model !== "string") return false;
31
+ const trimmed = model.trim();
32
+ if (trimmed.length === 0) return false;
33
+ const base = trimmed.includes("/") ? trimmed.slice(trimmed.lastIndexOf("/") + 1) : trimmed;
34
+ return API_PRO_MODE_MODEL.test(base) && !LEGACY_PRO_MODEL_SLUG.test(base);
35
+ }
36
+ /** True only when `url` is an HTTPS official OpenAI API endpoint (`api.openai.com`). */
37
+ function isOfficialOpenAiBaseUrl(url) {
38
+ if (typeof url !== "string") return false;
39
+ const trimmed = url.trim();
40
+ if (trimmed.length === 0) return false;
41
+ try {
42
+ const parsed = new URL(trimmed);
43
+ return parsed.protocol === "https:" && parsed.hostname.toLowerCase() === "api.openai.com";
44
+ } catch {
45
+ return false;
46
+ }
47
+ }
48
+ /**
49
+ * True only when `(provider, model)` routes to the official OpenAI Responses API
50
+ * (`https://api.openai.com`) on a Pro-capable GPT-5.6 / 6+ model.
51
+ */
52
+ function isOfficialOpenAiApiRoute(provider, model, providers) {
53
+ if (typeof provider !== "string" || provider.length === 0 || provider === "openai-codex") return false;
54
+ if (!supportsApiProMode(model)) return false;
55
+ const profile = providers?.[provider];
56
+ const override = model !== void 0 ? profile?.modelOverrides?.[model] : void 0;
57
+ const modelEntry = model !== void 0 && Array.isArray(profile?.models) ? profile.models.find((item) => item?.id === model) : void 0;
58
+ const effectiveApi = override?.api ?? modelEntry?.api ?? profile?.api;
59
+ if (effectiveApi !== void 0 && effectiveApi !== "openai-responses") return false;
60
+ const effectiveBaseUrl = override?.baseURL ?? override?.baseUrl ?? modelEntry?.baseURL ?? modelEntry?.baseUrl ?? profile?.baseURL ?? profile?.baseUrl;
61
+ if (typeof effectiveBaseUrl === "string" && effectiveBaseUrl.trim().length > 0) return isOfficialOpenAiBaseUrl(effectiveBaseUrl);
62
+ return provider === "openai";
63
+ }
20
64
  const OPENAI_CODEX_MODEL_LIMITS = {
21
65
  "gpt-6.1-sol": {
22
66
  defaultTokens: 5e5,
@@ -118,6 +162,269 @@ window.__ModuleLoader__.load({
118
162
  "deployment:persona-suffix",
119
163
  "codex:base"
120
164
  ];
165
+ const CODEX_HARNESS_RELEASES_URL = "https://github.com/shuind/dsh-codex-harness/releases";
166
+ const CODEX_HARNESS_RELEASE_TAG_BASE = "https://github.com/shuind/dsh-codex-harness/releases/tag/v";
167
+ const CODEX_CONNECT_REPO_URL = "https://github.com/shuind/dsh-codex-connect";
168
+ const CODEX_HARNESS_UPDATE_CACHE_KEY = "@shuind/dsh-codex-harness:update-check";
169
+ const CODEX_HARNESS_UPDATE_DISMISSED_KEY = "@shuind/dsh-codex-harness:update-seen";
170
+ const CODEX_HARNESS_UPDATE_RECHECK_MS = 3e5;
171
+ function normalizeHarnessVersion(raw) {
172
+ return raw.startsWith("v") ? raw.slice(1) : raw;
173
+ }
174
+ function harnessReleaseUrl(version) {
175
+ return `${CODEX_HARNESS_RELEASE_TAG_BASE}${normalizeHarnessVersion(version)}`;
176
+ }
177
+ function parseHarnessVersion(raw) {
178
+ if (typeof raw !== "string") return void 0;
179
+ const normalized = normalizeHarnessVersion(raw.trim());
180
+ const match = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u.exec(normalized);
181
+ if (match === null) return void 0;
182
+ const rawPrerelease = match[4] === void 0 ? [] : match[4].split(".");
183
+ if (rawPrerelease.some((part) => /^\d+$/u.test(part) && !/^(0|[1-9]\d*)$/u.test(part))) return void 0;
184
+ const prerelease = rawPrerelease.map((part) => /^(0|[1-9]\d*)$/u.test(part) ? Number(part) : part);
185
+ if (prerelease.some((part) => typeof part === "number" && !Number.isSafeInteger(part))) return void 0;
186
+ const parsed = {
187
+ major: Number(match[1]),
188
+ minor: Number(match[2]),
189
+ patch: Number(match[3]),
190
+ prerelease
191
+ };
192
+ return [
193
+ parsed.major,
194
+ parsed.minor,
195
+ parsed.patch
196
+ ].every(Number.isSafeInteger) ? parsed : void 0;
197
+ }
198
+ function compareIdentifiers(left, right) {
199
+ if (typeof left === "number" && typeof right === "number") return left < right ? -1 : left > right ? 1 : 0;
200
+ if (typeof left === "number") return -1;
201
+ if (typeof right === "number") return 1;
202
+ return left < right ? -1 : left > right ? 1 : 0;
203
+ }
204
+ function compareHarnessVersions(left, right) {
205
+ const a = parseHarnessVersion(left);
206
+ const b = parseHarnessVersion(right);
207
+ if (a === void 0 || b === void 0) throw new TypeError("invalid Codex Harness version");
208
+ for (const [aPart, bPart] of [
209
+ [a.major, b.major],
210
+ [a.minor, b.minor],
211
+ [a.patch, b.patch]
212
+ ]) if (aPart !== bPart) return aPart < bPart ? -1 : 1;
213
+ if (a.prerelease.length === 0 && b.prerelease.length !== 0) return 1;
214
+ if (a.prerelease.length !== 0 && b.prerelease.length === 0) return -1;
215
+ for (let i = 0; i < Math.max(a.prerelease.length, b.prerelease.length); i += 1) {
216
+ const aPart = a.prerelease[i];
217
+ const bPart = b.prerelease[i];
218
+ if (aPart === void 0) return -1;
219
+ if (bPart === void 0) return 1;
220
+ const cmp = compareIdentifiers(aPart, bPart);
221
+ if (cmp !== 0) return cmp;
222
+ }
223
+ return 0;
224
+ }
225
+ function parseHarnessUpdateResult(value) {
226
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
227
+ const record = value;
228
+ const currentVersion = record["currentVersion"];
229
+ if (typeof currentVersion !== "string" || parseHarnessVersion(currentVersion) === void 0) return void 0;
230
+ if (record["status"] === "unavailable") {
231
+ const reason = record["reason"];
232
+ return reason === "invalid-current-version" || reason === "registry-unavailable" || reason === "invalid-registry-response" ? {
233
+ status: "unavailable",
234
+ currentVersion: normalizeHarnessVersion(currentVersion),
235
+ reason
236
+ } : void 0;
237
+ }
238
+ const latestVersion = record["latestVersion"];
239
+ if (typeof latestVersion !== "string" || parseHarnessVersion(latestVersion) === void 0) return void 0;
240
+ const normalizedCurrent = normalizeHarnessVersion(currentVersion);
241
+ const normalizedLatest = normalizeHarnessVersion(latestVersion);
242
+ if (record["status"] === "up-to-date") return {
243
+ status: "up-to-date",
244
+ currentVersion: normalizedCurrent,
245
+ latestVersion: normalizedLatest
246
+ };
247
+ if (record["status"] !== "update-available" || compareHarnessVersions(normalizedLatest, normalizedCurrent) <= 0) return void 0;
248
+ const expectedUrl = harnessReleaseUrl(normalizedLatest);
249
+ if (record["releaseUrl"] !== expectedUrl) return void 0;
250
+ return {
251
+ status: "update-available",
252
+ currentVersion: normalizedCurrent,
253
+ latestVersion: normalizedLatest,
254
+ releaseUrl: expectedUrl
255
+ };
256
+ }
257
+ function bundledHarnessVersion() {
258
+ try {
259
+ return parseHarnessVersion("0.3.3") !== void 0 ? normalizeHarnessVersion("0.3.3") : void 0;
260
+ } catch {
261
+ return;
262
+ }
263
+ }
264
+ function harnessUpdateNoticeKey(snapshot) {
265
+ if (snapshot.status !== "update-available" || !snapshot.currentVersion || !snapshot.latestVersion) return void 0;
266
+ return `${snapshot.currentVersion}:${snapshot.latestVersion}`;
267
+ }
268
+ function browserStorage() {
269
+ try {
270
+ return typeof localStorage === "undefined" ? void 0 : localStorage;
271
+ } catch {
272
+ return;
273
+ }
274
+ }
275
+ var HarnessUpdateStore = class {
276
+ fetchUpdate;
277
+ initialVersion;
278
+ snapshot;
279
+ listeners = /* @__PURE__ */ new Set();
280
+ shownInSession = /* @__PURE__ */ new Set();
281
+ dismissedInSession;
282
+ inFlight = false;
283
+ disposed = false;
284
+ recheckTimer;
285
+ constructor(fetchUpdate, initialVersion = bundledHarnessVersion()) {
286
+ this.fetchUpdate = fetchUpdate;
287
+ this.initialVersion = initialVersion;
288
+ this.snapshot = {
289
+ status: "idle",
290
+ ...initialVersion === void 0 ? {} : { currentVersion: initialVersion }
291
+ };
292
+ }
293
+ getSnapshot = () => this.snapshot;
294
+ subscribe = (listener) => {
295
+ this.listeners.add(listener);
296
+ return () => {
297
+ this.listeners.delete(listener);
298
+ };
299
+ };
300
+ setSnapshot(next) {
301
+ if (this.disposed) return;
302
+ this.snapshot = next;
303
+ for (const listener of [...this.listeners]) listener();
304
+ }
305
+ effectiveDismissed() {
306
+ if (this.dismissedInSession !== void 0) return this.dismissedInSession;
307
+ try {
308
+ const stored = browserStorage()?.getItem(CODEX_HARNESS_UPDATE_DISMISSED_KEY);
309
+ if (!stored) return void 0;
310
+ return this.shownInSession.has(stored) ? void 0 : stored;
311
+ } catch {
312
+ return;
313
+ }
314
+ }
315
+ readCached() {
316
+ try {
317
+ const raw = browserStorage()?.getItem(CODEX_HARNESS_UPDATE_CACHE_KEY);
318
+ if (!raw) return void 0;
319
+ const parsed = JSON.parse(raw);
320
+ if (typeof parsed.checkedAt !== "number" || !Number.isSafeInteger(parsed.checkedAt)) return void 0;
321
+ const now = Date.now();
322
+ if (parsed.checkedAt > now || now - parsed.checkedAt > 864e5) return void 0;
323
+ const result = parseHarnessUpdateResult(parsed.result);
324
+ if (result === void 0 || result.status === "unavailable") return void 0;
325
+ if (this.initialVersion !== void 0 && result.currentVersion !== this.initialVersion) return void 0;
326
+ return {
327
+ result,
328
+ checkedAt: parsed.checkedAt
329
+ };
330
+ } catch {
331
+ return;
332
+ }
333
+ }
334
+ writeCached(result, checkedAt) {
335
+ try {
336
+ if (result.status === "unavailable") browserStorage()?.removeItem(CODEX_HARNESS_UPDATE_CACHE_KEY);
337
+ else browserStorage()?.setItem(CODEX_HARNESS_UPDATE_CACHE_KEY, JSON.stringify({
338
+ checkedAt,
339
+ result
340
+ }));
341
+ } catch {}
342
+ }
343
+ toSnapshot(result, checkedAt) {
344
+ const dismissedNotice = this.effectiveDismissed();
345
+ return {
346
+ status: result.status,
347
+ currentVersion: result.currentVersion,
348
+ checkedAt,
349
+ ...result.status === "up-to-date" || result.status === "update-available" ? { latestVersion: result.latestVersion } : {},
350
+ ...result.status === "update-available" ? { releaseUrl: result.releaseUrl } : {},
351
+ ...dismissedNotice === void 0 ? {} : { dismissedNotice }
352
+ };
353
+ }
354
+ async refresh(force = false) {
355
+ if (this.disposed || this.inFlight) return;
356
+ clearTimeout(this.recheckTimer);
357
+ this.recheckTimer = void 0;
358
+ this.inFlight = true;
359
+ const dismissedNotice = this.effectiveDismissed();
360
+ this.setSnapshot({
361
+ status: "checking",
362
+ ...this.snapshot.currentVersion === void 0 ? {} : { currentVersion: this.snapshot.currentVersion },
363
+ ...dismissedNotice === void 0 ? {} : { dismissedNotice }
364
+ });
365
+ try {
366
+ if (!force) {
367
+ const cached = this.readCached();
368
+ if (cached !== void 0) {
369
+ this.setSnapshot(this.toSnapshot(cached.result, cached.checkedAt));
370
+ return;
371
+ }
372
+ }
373
+ const raw = await this.fetchUpdate();
374
+ if (this.disposed) return;
375
+ const valid = parseHarnessUpdateResult(raw);
376
+ if (valid !== void 0) {
377
+ const checkedAt = Date.now();
378
+ this.writeCached(valid, checkedAt);
379
+ this.setSnapshot(this.toSnapshot(valid, checkedAt));
380
+ if (valid.status === "unavailable") this.recheckTimer = setTimeout(() => {
381
+ this.refresh(true);
382
+ }, CODEX_HARNESS_UPDATE_RECHECK_MS);
383
+ return;
384
+ }
385
+ const fallbackVersion = this.snapshot.currentVersion ?? this.initialVersion;
386
+ this.setSnapshot({
387
+ status: "unavailable",
388
+ ...fallbackVersion === void 0 ? {} : { currentVersion: fallbackVersion },
389
+ checkedAt: Date.now(),
390
+ ...dismissedNotice === void 0 ? {} : { dismissedNotice }
391
+ });
392
+ } catch {
393
+ if (this.disposed) return;
394
+ const fallbackVersion = this.snapshot.currentVersion ?? this.initialVersion;
395
+ this.setSnapshot({
396
+ status: "unavailable",
397
+ ...fallbackVersion === void 0 ? {} : { currentVersion: fallbackVersion },
398
+ checkedAt: Date.now(),
399
+ ...dismissedNotice === void 0 ? {} : { dismissedNotice }
400
+ });
401
+ } finally {
402
+ this.inFlight = false;
403
+ }
404
+ }
405
+ markShown(notice) {
406
+ this.shownInSession.add(notice);
407
+ try {
408
+ browserStorage()?.setItem(CODEX_HARNESS_UPDATE_DISMISSED_KEY, notice);
409
+ } catch {}
410
+ }
411
+ dismiss(notice) {
412
+ this.dismissedInSession = notice;
413
+ try {
414
+ browserStorage()?.setItem(CODEX_HARNESS_UPDATE_DISMISSED_KEY, notice);
415
+ } catch {}
416
+ this.setSnapshot({
417
+ ...this.snapshot,
418
+ dismissedNotice: notice
419
+ });
420
+ }
421
+ dispose() {
422
+ this.disposed = true;
423
+ clearTimeout(this.recheckTimer);
424
+ this.recheckTimer = void 0;
425
+ this.listeners.clear();
426
+ }
427
+ };
121
428
  //#endregion
122
429
  //#region lib/types/client/activity.js
123
430
  /** Client-only inference used while the host activity projection frame is in flight. */
@@ -2421,6 +2728,70 @@ window.__ModuleLoader__.load({
2421
2728
  });
2422
2729
  };
2423
2730
  });
2731
+ function discriminatorMap(def) {
2732
+ const map = /* @__PURE__ */ new Map();
2733
+ for (const option of def.options) {
2734
+ const values = option._zod.propValues?.[def.discriminator];
2735
+ if (!values || values.size === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
2736
+ for (const value of values) if (map.has(value)) {
2737
+ if (value !== void 0) throw new Error(`Duplicate discriminator value "${String(value)}"`);
2738
+ map.set(value, null);
2739
+ } else map.set(value, option);
2740
+ }
2741
+ return map;
2742
+ }
2743
+ const $ZodDiscriminatedUnion = /*@__PURE__*/ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
2744
+ def.inclusive = false;
2745
+ $ZodUnion.init(inst, def);
2746
+ const _super = inst._zod.parse;
2747
+ defineLazyInternal(inst, "propValues", (zod) => {
2748
+ const propValues = {};
2749
+ let undefinedCount = 0;
2750
+ for (const option of zod.def.options) {
2751
+ const pv = option._zod.propValues;
2752
+ if (!pv || Object.keys(pv).length === 0) throw new Error(`Invalid discriminated union option at index "${zod.def.options.indexOf(option)}"`);
2753
+ if (pv[zod.def.discriminator]?.has(void 0)) undefinedCount++;
2754
+ for (const [k, v] of Object.entries(pv)) {
2755
+ if (!Object.prototype.hasOwnProperty.call(propValues, k)) assignProp(propValues, k, /* @__PURE__ */ new Set());
2756
+ for (const val of v) propValues[k].add(val);
2757
+ }
2758
+ }
2759
+ if (!zod.def.unionFallback && undefinedCount > 1) propValues[zod.def.discriminator]?.delete(void 0);
2760
+ return propValues;
2761
+ });
2762
+ def.options.forEach((option, i) => {
2763
+ const propShape = rawShape(option._zod.def);
2764
+ if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) throw new Error(`Invalid discriminated union option at index "${i}"`);
2765
+ });
2766
+ const disc = cached(() => discriminatorMap(def));
2767
+ inst._zod.parse = (payload, ctx) => {
2768
+ const input = payload.value;
2769
+ if (!isObject(input)) {
2770
+ payload.issues.push({
2771
+ code: "invalid_type",
2772
+ expected: "object",
2773
+ input,
2774
+ inst
2775
+ });
2776
+ return payload;
2777
+ }
2778
+ const value = input?.[def.discriminator];
2779
+ const opt = disc.value.get(value);
2780
+ if (opt && (value !== void 0 || ctx.direction !== "backward")) return opt._zod.run(payload, ctx);
2781
+ if (def.unionFallback || ctx.direction === "backward") return _super(payload, ctx);
2782
+ payload.issues.push({
2783
+ code: "invalid_union",
2784
+ errors: [],
2785
+ note: "No matching discriminator",
2786
+ discriminator: def.discriminator,
2787
+ options: Array.from(disc.value.keys()).filter((value) => disc.value.get(value) !== null),
2788
+ input,
2789
+ path: [def.discriminator],
2790
+ inst
2791
+ });
2792
+ return payload;
2793
+ };
2794
+ });
2424
2795
  const $ZodIntersection = /*@__PURE__*/ $constructor("$ZodIntersection", (inst, def) => {
2425
2796
  $ZodType.init(inst, def);
2426
2797
  inst._zod.parse = (payload, ctx) => {
@@ -5186,6 +5557,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5186
5557
  ...normalizeParams(params)
5187
5558
  });
5188
5559
  }
5560
+ const ZodDiscriminatedUnion = /*@__PURE__*/ $constructor("ZodDiscriminatedUnion", (inst, def) => {
5561
+ ZodUnion.init(inst, def);
5562
+ $ZodDiscriminatedUnion.init(inst, def);
5563
+ });
5564
+ function discriminatedUnion(discriminator, options, params) {
5565
+ return new ZodDiscriminatedUnion({
5566
+ type: "union",
5567
+ options,
5568
+ discriminator,
5569
+ ...normalizeParams(params)
5570
+ });
5571
+ }
5189
5572
  const ZodIntersection = /*@__PURE__*/ $constructor("ZodIntersection", (inst, def) => {
5190
5573
  $ZodIntersection.init(inst, def);
5191
5574
  ZodType.init(inst, def);
@@ -5423,6 +5806,43 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5423
5806
  const PRESET_EDITOR_PACKAGE = "@shuind/dsh-codex-harness";
5424
5807
  const PRESET_EDITOR_SERVICE = "codexPresetEditor";
5425
5808
  const presetIdSchema = string().min(1).max(256);
5809
+ const proModeSessionIdSchema = string().min(1).max(256);
5810
+ const proModeSetInputSchema = object({
5811
+ sessionId: proModeSessionIdSchema,
5812
+ enabled: boolean()
5813
+ });
5814
+ const proModeStateSchema = object({ enabled: boolean() });
5815
+ const harnessUpdateResultSchema = discriminatedUnion("status", [
5816
+ object({
5817
+ status: literal("up-to-date"),
5818
+ currentVersion: string(),
5819
+ latestVersion: string()
5820
+ }),
5821
+ object({
5822
+ status: literal("update-available"),
5823
+ currentVersion: string(),
5824
+ latestVersion: string(),
5825
+ releaseUrl: string()
5826
+ }),
5827
+ object({
5828
+ status: literal("unavailable"),
5829
+ currentVersion: string(),
5830
+ reason: _enum([
5831
+ "invalid-current-version",
5832
+ "registry-unavailable",
5833
+ "invalid-registry-response"
5834
+ ])
5835
+ })
5836
+ ]);
5837
+ const codexSubagentModelsSchema = object({
5838
+ available: boolean(),
5839
+ models: array(object({
5840
+ id: string(),
5841
+ name: string(),
5842
+ efforts: array(string()),
5843
+ defaultEffort: string().optional()
5844
+ }))
5845
+ });
5426
5846
  const presetCatalogSchema = object({
5427
5847
  presets: array(object({
5428
5848
  id: string(),
@@ -5512,7 +5932,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5512
5932
  descriptor("catalog", void 0, unknown(), presetCatalogSchema),
5513
5933
  descriptor("tools", "id", presetIdSchema, presetToolCatalogSchema),
5514
5934
  descriptor("prompts", "id", presetIdSchema, presetPromptCatalogSchema),
5515
- descriptor("read", "id", presetIdSchema, presetDefinitionSchema)
5935
+ descriptor("read", "id", presetIdSchema, presetDefinitionSchema),
5936
+ descriptor("proModeGet", "sessionId", proModeSessionIdSchema, proModeStateSchema),
5937
+ descriptor("proModeSet", "input", proModeSetInputSchema, proModeStateSchema),
5938
+ descriptor("updateCheck", void 0, unknown(), harnessUpdateResultSchema),
5939
+ descriptor("codexSubagentModels", void 0, unknown(), codexSubagentModelsSchema)
5516
5940
  ];
5517
5941
  }
5518
5942
  const presetEditorRemote = {
@@ -5550,6 +5974,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5550
5974
  function cachedPresetTools(manager, id) {
5551
5975
  return toolCatalogs.get(manager)?.get(id);
5552
5976
  }
5977
+ function invalidatePresetTools(manager) {
5978
+ toolCatalogs.delete(manager);
5979
+ }
5553
5980
  /** The requested preset owns this snapshot; never substitute current-Agent tools. */
5554
5981
  function requestPresetTools(manager, id, refresh = false) {
5555
5982
  const pending = toolRequests.get(manager)?.get(id);
@@ -5621,6 +6048,149 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5621
6048
  return read();
5622
6049
  }
5623
6050
  }
6051
+ const subagentModelRequests = /* @__PURE__ */ new WeakMap();
6052
+ function requestCodexSubagentModels(manager) {
6053
+ const pending = subagentModelRequests.get(manager);
6054
+ if (pending !== void 0) return pending;
6055
+ const request = (async () => {
6056
+ await manager.ready;
6057
+ const remote = manager.remote.codexPresetEditor;
6058
+ if (typeof remote.codexSubagentModels !== "function") throw new Error("codex-subagent-models-unavailable");
6059
+ const result = await remote.codexSubagentModels();
6060
+ if (!result.ok) throw new Error(result.error.message ?? "codex-subagent-models-unavailable");
6061
+ return result.value;
6062
+ })();
6063
+ subagentModelRequests.set(manager, request);
6064
+ request.finally(() => {
6065
+ if (subagentModelRequests.get(manager) === request) subagentModelRequests.delete(manager);
6066
+ }).catch(() => {});
6067
+ return request;
6068
+ }
6069
+ function asRecord(value) {
6070
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
6071
+ }
6072
+ function asOverrides(value) {
6073
+ const record = asRecord(value);
6074
+ if (record === void 0) return void 0;
6075
+ const out = {};
6076
+ for (const [k, v] of Object.entries(record)) if (v === null || typeof v === "number" && Number.isSafeInteger(v) && v > 0) out[k] = v;
6077
+ return out;
6078
+ }
6079
+ function projectCodexConnectRecord(record, baseRecord, writable) {
6080
+ const searchModel = typeof record.searchModel === "string" && record.searchModel.trim() ? record.searchModel.trim() : void 0;
6081
+ const imageModelHint = typeof record.imageModelHint === "string" ? record.imageModelHint.trim() : void 0;
6082
+ return {
6083
+ status: "ready",
6084
+ writable,
6085
+ overrides: asOverrides(record.contextWindowOverrides),
6086
+ baseOverrides: asOverrides(baseRecord?.contextWindowOverrides),
6087
+ ...typeof record.enableNativeCompaction === "boolean" ? { nativeCompaction: record.enableNativeCompaction } : {},
6088
+ ...typeof record.enableSearch === "boolean" ? { searchEnabled: record.enableSearch } : {},
6089
+ ...searchModel !== void 0 ? { searchModel } : {},
6090
+ ...typeof record.enableImageGeneration === "boolean" ? { imageGenerationEnabled: record.enableImageGeneration } : {},
6091
+ ...imageModelHint !== void 0 ? { imageModelHint } : {}
6092
+ };
6093
+ }
6094
+ function bindCodexConnectScope(configForms) {
6095
+ const form = configForms.get(OPENAI_CODEX_SETTINGS_NAMESPACE);
6096
+ const mirror = configForms.describe?.();
6097
+ Promise.resolve(mirror?.ensure?.()).catch(() => {});
6098
+ let lastFormSnap;
6099
+ let lastMirrorSnap;
6100
+ let projected = {
6101
+ status: "loading",
6102
+ writable: false
6103
+ };
6104
+ const getSnapshot = () => {
6105
+ const formSnap = form.getSnapshot();
6106
+ const mirrorSnap = mirror?.getSnapshot();
6107
+ if (formSnap === lastFormSnap && mirrorSnap === lastMirrorSnap) return projected;
6108
+ lastFormSnap = formSnap;
6109
+ lastMirrorSnap = mirrorSnap;
6110
+ const formRecord = formSnap.status === "ready" ? asRecord(formSnap.value) : void 0;
6111
+ if (formRecord !== void 0) return projected = projectCodexConnectRecord(formRecord, asRecord(formSnap.base), formSnap.writable);
6112
+ const view = mirrorSnap?.view;
6113
+ if (view !== void 0) {
6114
+ const row = view.namespaces?.find((candidate) => candidate.ns === OPENAI_CODEX_SETTINGS_NAMESPACE);
6115
+ const rowRecord = row === void 0 ? void 0 : asRecord(row.value);
6116
+ if (row === void 0 || rowRecord === void 0) return projected = {
6117
+ status: "unavailable",
6118
+ writable: false
6119
+ };
6120
+ return projected = projectCodexConnectRecord(rowRecord, asRecord(row.base), view.writable ?? formSnap.writable);
6121
+ }
6122
+ return projected = {
6123
+ status: formSnap.status,
6124
+ writable: formSnap.writable
6125
+ };
6126
+ };
6127
+ return {
6128
+ getSnapshot,
6129
+ subscribe: (listener) => {
6130
+ const stopForm = form.subscribe(listener);
6131
+ const stopMirror = mirror?.subscribe(listener);
6132
+ return () => {
6133
+ stopForm();
6134
+ stopMirror?.();
6135
+ };
6136
+ },
6137
+ setModelOverride: async (modelId, tokens) => {
6138
+ const snap = getSnapshot();
6139
+ const next = nextOpenAICodexOverrides(snap.overrides, snap.baseOverrides, modelId, tokens);
6140
+ if (!(next === void 0 ? await form.unset("contextWindowOverrides") : await form.set("contextWindowOverrides", next))) throw new Error("The host did not accept the settings change.");
6141
+ },
6142
+ setNativeCompaction: async (enabled) => {
6143
+ if (!await form.set("enableNativeCompaction", enabled)) throw new Error("The host did not accept the settings change.");
6144
+ },
6145
+ setSearchEnabled: async (enabled) => {
6146
+ if (!await form.set("enableSearch", enabled)) throw new Error("The host did not accept the settings change.");
6147
+ },
6148
+ setImageGenerationEnabled: async (enabled) => {
6149
+ if (!await form.set("enableImageGeneration", enabled)) throw new Error("The host did not accept the settings change.");
6150
+ }
6151
+ };
6152
+ }
6153
+ function bindLlmProvidersScope(configForms) {
6154
+ const mirror = configForms.describe?.();
6155
+ if (mirror === void 0) return void 0;
6156
+ Promise.resolve(mirror.ensure?.()).catch(() => {});
6157
+ let lastMirrorSnap;
6158
+ let projected;
6159
+ const getSnapshot = () => {
6160
+ const mirrorSnap = mirror.getSnapshot();
6161
+ if (mirrorSnap === lastMirrorSnap) return projected;
6162
+ lastMirrorSnap = mirrorSnap;
6163
+ const row = mirrorSnap?.view?.namespaces?.find((candidate) => candidate.ns === "llm-pi-ai");
6164
+ return projected = asRecord(asRecord(row?.value)?.providers);
6165
+ };
6166
+ return {
6167
+ getSnapshot,
6168
+ subscribe: (listener) => mirror.subscribe(listener)
6169
+ };
6170
+ }
6171
+ function adaptConfigForm(form) {
6172
+ const accepted = async (result) => {
6173
+ if (!await result) throw new Error("The host did not accept the settings change.");
6174
+ };
6175
+ return {
6176
+ getSnapshot: () => form.getSnapshot(),
6177
+ subscribe: (listener) => form.subscribe(listener),
6178
+ set: (field, value) => accepted(form.set(field, value)),
6179
+ unset: (field) => accepted(form.unset(field))
6180
+ };
6181
+ }
6182
+ async function saveDesktopSettings(form, edits, expectedRevision) {
6183
+ const ops = Object.entries(edits).map(([field, value]) => value === void 0 ? {
6184
+ op: "unset",
6185
+ path: [field]
6186
+ } : {
6187
+ op: "set",
6188
+ path: [field],
6189
+ value
6190
+ });
6191
+ if (!ops.length) return;
6192
+ if (!(expectedRevision === void 0 ? await form.mutate(ops) : await form.mutate(ops, expectedRevision))) throw new Error("The host did not accept the settings change.");
6193
+ }
5624
6194
  //#endregion
5625
6195
  //#region lib/types/client/preset-manager.js
5626
6196
  /** Read-only preset definition viewer and composer context-window control for Harness 0.2.2+. */
@@ -5724,15 +6294,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5724
6294
  function pillStyle(active, writable) {
5725
6295
  return {
5726
6296
  boxSizing: "border-box",
5727
- display: "inline-flex",
6297
+ display: "flex",
5728
6298
  alignItems: "center",
5729
6299
  gap: 5,
5730
6300
  height: 28,
5731
6301
  border: 0,
5732
- borderRadius: 7,
5733
- padding: "0 6px",
6302
+ borderRadius: "var(--dsw-radius-sm, 7px)",
6303
+ padding: "3px 6px 0",
5734
6304
  font: "inherit",
5735
- fontSize: 12,
6305
+ fontSize: 13,
5736
6306
  lineHeight: "20px",
5737
6307
  whiteSpace: "nowrap",
5738
6308
  color: active ? "var(--dsw-static-blue-500)" : "var(--dsw-alias-label-secondary)",
@@ -5984,28 +6554,145 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5984
6554
  ]
5985
6555
  }), document.body) : null] });
5986
6556
  }
5987
- //#endregion
5988
- //#region lib/types/contracts/tool-policy-contract.js
5989
- /** Legacy configuration remains a baseline, never a live second veto of an explicit choice. */
5990
- function legacyToolAction(rule, name, context = {}) {
5991
- let action = "keep";
5992
- if (rule !== void 0) {
5993
- if (rule.allow !== void 0 && !rule.allow.includes(name) || rule.deny?.includes(name)) return "hide";
5994
- if ((name === "bash" || name === "pwsh") && rule.replaceShell !== false) action = "codex-exec";
5995
- if (name === "todo_write" && rule.replacePlan !== false) action = "codex-plan";
5996
- if ((name === "edit" || name === "write") && rule.replacePatch === true) action = "codex-patch";
5997
- }
5998
- if (action === "keep" && context.defaultDeferred === true) action = "defer";
5999
- const capability = context.codexTool?.capability ?? (action === "codex-exec" ? "terminalToolsEnabled" : action === "codex-plan" ? "planToolEnabled" : action === "codex-patch" ? "patchToolEnabled" : void 0);
6000
- if (!(context.codexTool?.presetOverridesLegacy === true && context.codexTool.presetEnabled) && capability !== void 0 && context.legacyCapabilities?.[capability] === false) return "hide";
6001
- return action;
6002
- }
6003
- /** Policy action only: `keep` still respects the original preset's local enablement. */
6004
- function effectiveToolAction(rule, name, context = {}) {
6005
- return rule?.tools?.find((tool) => tool.name === name)?.action ?? legacyToolAction(rule, name, context);
6557
+ /** Show the ephemeral API Pro toggle only for official OpenAI API GPT-5.6/6+ models. */
6558
+ function isProModeEligible(snapshot, hasDirectory, llmProviders) {
6559
+ if (!hasDirectory || snapshot?.status !== "ready" || snapshot.current === void 0) return false;
6560
+ return isOfficialOpenAiApiRoute(snapshot.current.provider, snapshot.current.model, llmProviders);
6561
+ }
6562
+ function ProModeControl(props) {
6563
+ const { sessionId, injectedSessionId, useSettings, presetManager, modelDirectory, getLlmProvidersScope, t } = props;
6564
+ const dirSnapshot = useModelDirectory(modelDirectory);
6565
+ const visible = useSettings((state) => state).value?.proModeControlEnabled ?? true;
6566
+ const providersScope = modelDirectory !== void 0 && dirSnapshot?.status === "ready" && dirSnapshot.current?.provider !== "openai-codex" && supportsApiProMode(dirSnapshot.current?.model) ? getLlmProvidersScope?.() : void 0;
6567
+ const subscribeProviders = (0, react.useCallback)((listener) => providersScope ? providersScope.subscribe(listener) : NOOP_SUBSCRIBE(), [providersScope]);
6568
+ const getProvidersSnap = (0, react.useCallback)(() => providersScope?.getSnapshot(), [providersScope]);
6569
+ const llmProviders = (0, react.useSyncExternalStore)(subscribeProviders, getProvidersSnap, getProvidersSnap);
6570
+ const eligible = isProModeEligible(dirSnapshot, modelDirectory !== void 0, llmProviders);
6571
+ const rawSessionId = sessionId ?? injectedSessionId;
6572
+ const normalizedSessionId = typeof rawSessionId === "string" ? rawSessionId.trim() : rawSessionId !== void 0 && rawSessionId !== null ? String(rawSessionId).trim() : "";
6573
+ const [enabled, setEnabled] = (0, react.useState)(false);
6574
+ const [pending, setPending] = (0, react.useState)(false);
6575
+ const activeSessionRef = (0, react.useRef)(normalizedSessionId);
6576
+ const mountedRef = (0, react.useRef)(true);
6577
+ activeSessionRef.current = normalizedSessionId;
6578
+ (0, react.useEffect)(() => {
6579
+ mountedRef.current = true;
6580
+ return () => {
6581
+ mountedRef.current = false;
6582
+ };
6583
+ }, []);
6584
+ (0, react.useEffect)(() => {
6585
+ setEnabled(false);
6586
+ setPending(false);
6587
+ if (!visible || !eligible || normalizedSessionId.length === 0) return void 0;
6588
+ let active = true;
6589
+ Promise.resolve(presetManager?.ready).then(async () => {
6590
+ const api = presetManager?.remote?.codexPresetEditor;
6591
+ if (!active || typeof api?.proModeGet !== "function") return;
6592
+ const result = await api.proModeGet(normalizedSessionId);
6593
+ if (active && result.ok) setEnabled(result.value.enabled);
6594
+ }).catch(() => {});
6595
+ return () => {
6596
+ active = false;
6597
+ };
6598
+ }, [
6599
+ visible,
6600
+ eligible,
6601
+ normalizedSessionId,
6602
+ presetManager
6603
+ ]);
6604
+ if (!visible || !eligible) return null;
6605
+ const interactive = !pending && normalizedSessionId.length > 0;
6606
+ const label = enabled ? t("proOn") : t("proOff");
6607
+ const toggle = () => {
6608
+ if (!interactive) return;
6609
+ const targetSessionId = normalizedSessionId;
6610
+ const next = !enabled;
6611
+ setPending(true);
6612
+ setEnabled(next);
6613
+ Promise.resolve(presetManager?.ready).then(async () => {
6614
+ const api = presetManager?.remote?.codexPresetEditor;
6615
+ if (typeof api?.proModeSet !== "function") {
6616
+ if (mountedRef.current && activeSessionRef.current === targetSessionId) setEnabled(!next);
6617
+ return;
6618
+ }
6619
+ const result = await api.proModeSet({
6620
+ sessionId: targetSessionId,
6621
+ enabled: next
6622
+ });
6623
+ if (mountedRef.current && activeSessionRef.current === targetSessionId) setEnabled(result.ok ? result.value.enabled : !next);
6624
+ }).catch(() => {
6625
+ if (mountedRef.current && activeSessionRef.current === targetSessionId) setEnabled(!next);
6626
+ }).finally(() => {
6627
+ if (mountedRef.current && activeSessionRef.current === targetSessionId) setPending(false);
6628
+ });
6629
+ };
6630
+ return (0, react_jsx_runtime.jsxs)("button", {
6631
+ type: "button",
6632
+ role: "switch",
6633
+ disabled: !interactive,
6634
+ "aria-checked": enabled,
6635
+ "data-codex-pro-control": enabled ? "on" : "off",
6636
+ "aria-label": label,
6637
+ title: label,
6638
+ onClick: toggle,
6639
+ style: {
6640
+ ...pillStyle(enabled, interactive),
6641
+ ...enabled ? { boxShadow: "inset 0 0 0 1px var(--dsw-static-blue-500)" } : {}
6642
+ },
6643
+ children: [(0, react_jsx_runtime.jsx)("span", { children: t("pro") }), (0, react_jsx_runtime.jsx)("span", {
6644
+ style: {
6645
+ color: enabled ? "var(--dsw-static-blue-500)" : "var(--dsw-alias-label-secondary)",
6646
+ fontSize: 12
6647
+ },
6648
+ children: enabled ? t("fastStateOn") : t("fastStateOff")
6649
+ })]
6650
+ });
6651
+ }
6652
+ //#endregion
6653
+ //#region lib/types/contracts/tool-policy-contract.js
6654
+ /** Legacy configuration remains a baseline, never a live second veto of an explicit choice. */
6655
+ function legacyToolAction(rule, name, context = {}) {
6656
+ let action = "keep";
6657
+ if (rule !== void 0) {
6658
+ if (rule.allow !== void 0 && !rule.allow.includes(name) || rule.deny?.includes(name)) return "hide";
6659
+ if ((name === "bash" || name === "pwsh") && rule.replaceShell !== false) action = "codex-exec";
6660
+ if (name === "todo_write" && rule.replacePlan !== false) action = "codex-plan";
6661
+ if ((name === "edit" || name === "write") && rule.replacePatch === true) action = "codex-patch";
6662
+ }
6663
+ if (action === "keep" && context.defaultDeferred === true) action = "defer";
6664
+ const capability = context.codexTool?.capability ?? (action === "codex-exec" ? "terminalToolsEnabled" : action === "codex-plan" ? "planToolEnabled" : action === "codex-patch" ? "patchToolEnabled" : void 0);
6665
+ if (!(context.codexTool?.presetOverridesLegacy === true && context.codexTool.presetEnabled) && capability !== void 0 && context.legacyCapabilities?.[capability] === false) return "hide";
6666
+ return action;
6667
+ }
6668
+ /** Policy action only: `keep` still respects the original preset's local enablement. */
6669
+ function effectiveToolAction(rule, name, context = {}) {
6670
+ return rule?.tools?.find((tool) => tool.name === name)?.action ?? legacyToolAction(rule, name, context);
6006
6671
  }
6007
6672
  //#endregion
6008
6673
  //#region lib/types/client/policy-drafts.js
6674
+ function resolveGptCapabilities(codexSettings, codexConnect) {
6675
+ const connectReady = codexConnect?.status === "ready";
6676
+ if (codexSettings === void 0 && !connectReady) return void 0;
6677
+ const subagentModel = codexSettings?.codexSubagentModel?.trim() || void 0;
6678
+ return {
6679
+ hostedWebSearch: codexSettings !== void 0 ? codexSettings.hostedWebSearchEnabled ?? true : false,
6680
+ codexSearch: connectReady && codexConnect.searchEnabled === true,
6681
+ codexSearchModel: connectReady ? codexConnect.searchModel : void 0,
6682
+ remoteCompaction: codexSettings !== void 0 && (codexSettings.remoteCompactionEnabled ?? true) || connectReady && codexConnect.nativeCompaction === true,
6683
+ imageGeneration: connectReady && codexConnect.imageGenerationEnabled === true,
6684
+ imageModelHint: connectReady ? codexConnect.imageModelHint : void 0,
6685
+ ...codexSettings?.codexSubagentEnabled === true ? { codexSubagent: true } : {},
6686
+ ...subagentModel !== void 0 ? { codexSubagentModel: subagentModel } : {}
6687
+ };
6688
+ }
6689
+ function formatGptImageBadge(hint) {
6690
+ const value = hint?.trim() ?? "";
6691
+ if (!value || value === "gpt-image-2.6-sunburst") return "GPT-Image-2.6 Sunburst";
6692
+ if (value === "gpt-image-2.6-flare") return "GPT-Image-2.6 Flare";
6693
+ if (value === "gpt-image-2") return "GPT-Image-2";
6694
+ return value;
6695
+ }
6009
6696
  function canonical(value) {
6010
6697
  if (Array.isArray(value)) return value.map(canonical);
6011
6698
  if (value !== null && typeof value === "object") return Object.fromEntries(Object.entries(value).filter(([, item]) => item !== void 0).sort(([a], [b]) => a.localeCompare(b)).map(([key, item]) => [key, canonical(item)]));
@@ -6063,18 +6750,68 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6063
6750
  const toolPolicyEn = {
6064
6751
  settingsTabLabel: "Codex Harness",
6065
6752
  settingsToolsPage: "Preset plans",
6066
- settingsRuntimePage: "Runtime preferences",
6753
+ settingsRuntimePage: "Global settings",
6754
+ settingsHelpPage: "Guide",
6755
+ helpFaqHeading: "Quick answers",
6756
+ helpDeferDisabledTitle: "Why is Defer greyed out on some tools?",
6757
+ helpDeferDisabledDesc: "Already deferred; hide it if you’re sure you won’t use it.",
6758
+ helpDeferLifecycleTitle: "What is Defer for?",
6759
+ helpDeferLifecycleDesc: "Saves context—loaded on demand and reclaimed after context compaction.",
6760
+ helpNativeSearchTitle: "Prefer native search?",
6761
+ helpNativeSearchDesc: "On uses OpenAI built-in search (billed per search on API); off reuses subscription search.",
6762
+ helpConnectHeading: "Works with Codex Connect",
6763
+ helpRegistrationScopeTitle: "Global subscription search, images & subagent",
6764
+ helpRegistrationScopeDesc: "Turn on in Global settings to share Codex Connect search, image generation, and codex_subagent across all tool-capable models; override per preset.",
6765
+ helpProComboTitle: "API Pro + subscription subagents + subscription search",
6766
+ helpProComboDesc: "Use Pro plan API credits on GPT-5.6/6+ with the composer Pro toggle (only shown on API-key GPT-5.6/6+, current chat only); route subagents and web search to Codex subscription (saves API)—taste Pro freed from the web cage.",
6767
+ helpConnectContextTitle: "Context window & compaction sync",
6768
+ helpConnectContextDesc: "The composer context button syncs Codex Connect model limits; Prefer remote compaction stays in sync too.",
6769
+ helpConnectLinkLabel: "Companion plugin",
6770
+ helpUpdateHeading: "Version & updates",
6771
+ updateHeading: "Codex Harness update",
6772
+ updateBadge: "Update",
6773
+ updateAvailable: "Update available",
6774
+ updateUpToDate: "Up to date",
6775
+ updateChecking: "Checking…",
6776
+ updateUnavailable: "Check failed",
6777
+ updateCheckNow: "Check updates",
6778
+ updateOpenRelease: "View release",
6779
+ updateDismiss: "Dismiss update notice",
6780
+ updateHowTo: "Update from the DSH Plugin Market, or reinstall @shuind/dsh-codex-harness@latest.",
6067
6781
  settingsSubTools: "Tools",
6068
6782
  settingsPresetPrompts: "Prompts",
6069
6783
  settingsDefinition: "YAML",
6070
- settingsPreferHostedSearch: "Prefer model-hosted search",
6784
+ settingsPreferHostedSearch: "Prefer native search",
6071
6785
  settingsPreferRemoteCompaction: "Prefer remote compaction",
6072
- settingsSharedFailed: "Not saved; this page’s draft is kept. Shared settings may have changed—discard this page’s draft to reload.",
6073
- settingsRuntimeScope: "Shared in this environment",
6074
- settingsSaveRuntime: "Save runtime preferences",
6786
+ settingsSharedFailed: "Save failed. Settings may have changed—please try again.",
6787
+ settingsRuntimeScope: "Shared across all presets in this environment.",
6788
+ capabilitiesConnectHeading: "Subscription global registrations",
6789
+ capabilitiesConnectCollapsedTitle: "Codex Connect subscription features",
6790
+ capabilitiesConnectInstallHint: "Install Codex Connect to share subscription web search, image generation, and subagents across all models.",
6791
+ capabilitiesConnectNote: "Registered live via Codex Connect for all models. Adjust per preset in Preset plans.",
6792
+ capabilitySearchTitle: "Subscription web search",
6793
+ capabilitySearchNoteAll: "Reused by all models.",
6794
+ capabilitySearchNoteFallback: "GPT sessions prefer native search; other models reuse this.",
6795
+ capabilityImageTitle: "Subscription image generation",
6796
+ capabilityImageNote: "Registered globally for all tool-capable models.",
6797
+ capabilitySubagentTitle: "Subscription subagent",
6798
+ capabilitySubagentNote: "Registered globally so any tool-capable model can delegate tasks to a Codex subscription subagent.",
6799
+ capabilitySubagentModel: "Model",
6800
+ capabilitySubagentNoModels: "No enabled models",
6801
+ capabilitySubagentRestart: "Restart DSH required",
6802
+ capabilitySubagentEffort: "Effort",
6803
+ capabilitySubagentEffortDefault: "Default",
6804
+ capabilitySubagentPreset: "Preset",
6805
+ capabilitySubagentPresetHybrid: "Codex hybrid",
6806
+ capabilitySubagentPresetInherit: "Follow current chat",
6807
+ capabilityRegistered: "Registered",
6808
+ capabilityNotRegistered: "Not registered",
6809
+ capabilityUnavailable: "Codex Connect unavailable",
6810
+ capabilityLoading: "Loading registration status…",
6811
+ capabilityWriteFailed: "Failed to update registration.",
6075
6812
  settingsBundleSummary: "Configure Codex Harness in its dedicated Settings tab.",
6076
6813
  settingsBundlePath: "Settings → Plugins → Codex Harness",
6077
- settingsDefinitionAbsent: "Choose a preset on Preset plans first.",
6814
+ settingsDefinitionAbsent: "Choose a preset first.",
6078
6815
  globalGroupRequest: "Model requests",
6079
6816
  globalGroupDisplay: "Display",
6080
6817
  globalPending: "Unsaved",
@@ -6104,25 +6841,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6104
6841
  toolPolicyAction: "Tool action",
6105
6842
  toolPolicyKeep: "Enable",
6106
6843
  toolPolicyDefer: "Defer",
6107
- toolPolicyDeferHint: "Defer loading until activated via activate_tools",
6844
+ toolPolicyDeferHint: "Load on demand via activate_tools",
6108
6845
  toolPolicyHide: "Hide",
6109
6846
  toolPolicyReplaceShort: "Replace",
6110
- toolPolicyRestoreChoice: "Restore default choice",
6847
+ toolPolicyRestoreChoice: "Restore default",
6111
6848
  toolPolicyUnsupported: "Saved replacement unavailable",
6112
6849
  toolPolicyConditional: "Conditional",
6113
6850
  toolPolicyTargetExists: "Replacement target already exists",
6114
6851
  toolPolicyPresetDisabled: "Disabled by original preset",
6115
- toolPolicyGptGroup: "GPT capabilities",
6116
- toolPolicyGptHostedSearch: "GPT hosted search",
6117
- toolPolicyGptHostedSearchTitle: "GPT sessions prefer OpenAI Responses hosted web_search (controlled in Runtime preferences).",
6118
- toolPolicyGptCodexSearch: "Codex search",
6119
- toolPolicyGptCodexSearchTitle: "Profile-wide web search owned by Codex Connect.",
6120
- toolPolicyGptDualSearch: "GPT hosted / Codex search",
6121
- toolPolicyGptDualSearchTitle: "GPT sessions prefer OpenAI hosted web_search; other models use Codex Connect search.",
6122
- toolPolicyGptImageTitle: "Provided by Codex Connect (ChatGPT subscription image endpoint; tested to route to GPT-Image-2.6 Sunburst); callable from any tool-capable model.",
6123
- toolPolicyGptCompactionDesc: "Server-side native context compaction (GPT sessions only; falls back to local summary on failure)",
6124
- toolPolicyGptCompactionBadge: "GPT native compaction",
6125
- toolPolicyGptCompactionReadOnly: "Non-tool · Runtime preference",
6852
+ toolPolicyGptHostedSearch: "GPT native search",
6853
+ toolPolicyGptHostedSearchTitle: "GPT sessions prefer OpenAI native search (set in Global settings).",
6854
+ toolPolicyGptCodexSearch: "Codex Connect",
6855
+ toolPolicyGptCodexSearchTitle: "Registered globally by Codex Connect (manage in Global settings).",
6856
+ toolPolicyGptDualSearch: "GPT native / Codex Connect",
6857
+ toolPolicyGptDualSearchTitle: "GPT sessions prefer native search; other models reuse Codex Connect search.",
6858
+ toolPolicyGptImageTitle: "Registered globally by Codex Connect (manage in Global settings).",
6859
+ toolPolicyGptSubagentTitle: "Registered globally using Codex Connect subscription model (manage in Global settings).",
6126
6860
  toolPolicyCommandGroup: "Commands & runtime",
6127
6861
  toolPolicyFileGroup: "Files & search",
6128
6862
  toolPolicyPlanGroup: "Planning & interaction",
@@ -6164,6 +6898,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6164
6898
  toolLabelSubagent: "Spawn isolated subagent for a subtask",
6165
6899
  toolLabelSubagentFork: "Fork subagent from current context",
6166
6900
  toolLabelSubagentCodex: "Delegate task to Codex subagent",
6901
+ toolLabelCodexSubagent: "Delegate task to Codex subscription subagent",
6167
6902
  toolLabelSubagentClaude: "Delegate task to Claude Code subagent",
6168
6903
  toolLabelSubagentOar: "Run experimental OAR subagent",
6169
6904
  toolLabelSubagentModels: "List available models for subagents",
@@ -6182,8 +6917,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6182
6917
  toolLabelTeamGet: "Read latest shared Team task state",
6183
6918
  toolLabelTeamList: "List shared Team tasks and blockers",
6184
6919
  toolLabelTeamUpdate: "Update shared Team task with revision check",
6185
- toolLabelWebSearch: "Search the web for current information",
6186
- toolLabelWebFetch: "Fetch decoded text from HTTP(S) URL",
6920
+ toolLabelWebSearch: "Search the web",
6921
+ toolLabelWebFetch: "Fetch text from HTTP(S) URL",
6187
6922
  toolLabelSkill: "Load full instructions for a skill",
6188
6923
  toolLabelActivateTools: "Activate deferred (deferLoading) tools",
6189
6924
  toolLabelSchedule: "Manage scheduled tasks",
@@ -6210,30 +6945,30 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6210
6945
  toolLabelStagehandObserve: "Observe interactive page elements (Stagehand)",
6211
6946
  toolLabelStagehandShot: "Capture browser screenshot (Stagehand)",
6212
6947
  toolLabelStagehandTabs: "Manage browser tabs (Stagehand)",
6213
- toolLabelViewImage: "View local or HTTP(S) image (Codex Connect)",
6214
- toolLabelCodexImageGen: "Generate or edit images via GPT Image (Codex Connect)",
6215
- toolLabelCodexQuota: "Query shared Codex account quota (Codex Connect)",
6948
+ toolLabelViewImage: "View local or HTTP(S) image",
6949
+ toolLabelCodexImageGen: "Generate or edit images",
6950
+ toolLabelCodexQuota: "Query Codex account quota",
6216
6951
  toolLabelMcpDynamic: "MCP server tool",
6217
6952
  toolLabelOther: "Other tool",
6218
6953
  toolPolicyToolsLoading: "Loading tools…",
6219
6954
  toolPolicyToolsEmpty: "No registered tools.",
6220
6955
  toolPolicyNoMatches: "No matching tools.",
6221
- toolPolicyToolsFailed: "Tool list unavailable. Saved rules are kept.",
6956
+ toolPolicyToolsFailed: "Could not load tools; saved rules are kept.",
6222
6957
  toolPolicyToolsRefresh: "Refresh tools",
6223
6958
  toolPolicyCatalogLoading: "Loading presets…",
6224
6959
  toolPolicyCatalogEmpty: "No presets found.",
6225
- toolPolicyCatalogFailed: "Preset list unavailable. Saved IDs remain selectable.",
6960
+ toolPolicyCatalogFailed: "Could not load presets; saved IDs remain selectable.",
6226
6961
  toolPolicyCatalogRetry: "Reload presets",
6227
6962
  toolPolicyEmpty: "Choose a preset",
6228
- toolPolicySave: "Save preset",
6963
+ toolPolicySave: "Save",
6229
6964
  toolPolicySaving: "Saving…",
6230
6965
  toolPolicyDiscard: "Discard draft",
6231
- toolPolicySaved: "Preset saved.",
6966
+ toolPolicySaved: "Saved.",
6232
6967
  toolPolicyInvalidPreset: "An empty preset ID cannot be saved.",
6233
6968
  toolPolicyDuplicatePreset: "Duplicate preset IDs cannot be saved.",
6234
- toolPolicyRefused: "Not saved. Draft started from older settings; discard draft to reload.",
6969
+ toolPolicyRefused: "Save conflict. Discard draft to reload.",
6235
6970
  toolPolicyFailed: "Save failed. Draft is kept.",
6236
- toolPolicyReadOnly: "These settings are read-only.",
6971
+ toolPolicyReadOnly: "Settings are read-only.",
6237
6972
  pmRefresh: "Refresh",
6238
6973
  peLoading: "Loading preset…",
6239
6974
  peReadError: "Preset definition unavailable."
@@ -6241,18 +6976,68 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6241
6976
  const toolPolicyZh = {
6242
6977
  settingsTabLabel: "Codex Harness",
6243
6978
  settingsToolsPage: "预设方案",
6244
- settingsRuntimePage: "运行偏好",
6979
+ settingsRuntimePage: "全局设置",
6980
+ settingsHelpPage: "说明",
6981
+ helpFaqHeading: "常见问题",
6982
+ helpDeferDisabledTitle: "为什么有的工具点不了「延迟」?",
6983
+ helpDeferDisabledDesc: "因为它已经延迟了,确定不用可隐藏。",
6984
+ helpDeferLifecycleTitle: "「延迟」干嘛的?",
6985
+ helpDeferLifecycleDesc: "省上下文,模型需要时再调出来;经过上下文压缩后,不常用的会自动收回。",
6986
+ helpNativeSearchTitle: "「优先使用原生搜索」开不开?",
6987
+ helpNativeSearchDesc: "开了 GPT 走 OpenAI 原生搜索(API 按次收费);关了统一用订阅搜索。",
6988
+ helpConnectHeading: "与 Codex Connect 联动",
6989
+ helpRegistrationScopeTitle: "全局复用订阅搜索、生图与子代理",
6990
+ helpRegistrationScopeDesc: "在「全局设置」打开后,所有能调工具的模型都能直接用订阅搜索、生图和 codex_subagent;预设方案只管单个模式用不用。",
6991
+ helpProComboTitle: "API Pro + 订阅子代理 + 订阅搜索",
6992
+ helpProComboDesc: "用 Pro 订阅送的 API 额度接 GPT-5.6 / 6+,开输入框右侧 Pro(只有官 key 接 GPT-5.6 / 6+ 才会显示,仅当前对话有效);子代理和联网搜索走 Codex 订阅(省 API),品尝脱离网页牢笼的 Pro。",
6993
+ helpConnectContextTitle: "上下文与压缩联动",
6994
+ helpConnectContextDesc: "输入框上下文按钮直接同步 Codex Connect 模型上限;「优先使用远程压缩」也会自动同步。",
6995
+ helpConnectLinkLabel: "配套插件",
6996
+ helpUpdateHeading: "版本与更新",
6997
+ updateHeading: "Codex Harness 更新",
6998
+ updateBadge: "有更新",
6999
+ updateAvailable: "发现新版本",
7000
+ updateUpToDate: "已是最新",
7001
+ updateChecking: "正在检查…",
7002
+ updateUnavailable: "检查失败",
7003
+ updateCheckNow: "检查更新",
7004
+ updateOpenRelease: "查看更新",
7005
+ updateDismiss: "关闭更新提醒",
7006
+ updateHowTo: "在 DSH 插件市场直接更新,或重新安装 @shuind/dsh-codex-harness@latest。",
6245
7007
  settingsSubTools: "工具",
6246
7008
  settingsPresetPrompts: "提示词",
6247
7009
  settingsDefinition: "原始定义",
6248
- settingsPreferHostedSearch: "优先使用模型托管搜索",
7010
+ settingsPreferHostedSearch: "优先使用原生搜索",
6249
7011
  settingsPreferRemoteCompaction: "优先使用远程压缩",
6250
- settingsSharedFailed: "未保存,本页草稿已保留。共享设置可能已更新,请放弃本页草稿后重新读取。",
6251
- settingsRuntimeScope: "本环境共享",
6252
- settingsSaveRuntime: "保存运行偏好",
7012
+ settingsSharedFailed: "保存失败,设置可能已在别处更新,请重试。",
7013
+ settingsRuntimeScope: "本环境共享,对所有预设生效。",
7014
+ capabilitiesConnectHeading: "订阅能力全局注册",
7015
+ capabilitiesConnectCollapsedTitle: "Codex Connect 订阅能力",
7016
+ capabilitiesConnectInstallHint: "安装 Codex Connect 后,可在此全局共享订阅搜索、生图与子代理。",
7017
+ capabilitiesConnectNote: "通过 Codex Connect 即时注册到全环境,所有模型可复用;单预设开关请在「预设方案 → 工具」调整。",
7018
+ capabilitySearchTitle: "订阅联网搜索",
7019
+ capabilitySearchNoteAll: "所有模型统一复用此搜索。",
7020
+ capabilitySearchNoteFallback: "GPT 会话优先用原生搜索,其他模型复用此搜索。",
7021
+ capabilityImageTitle: "订阅图片生成 / 编辑",
7022
+ capabilityImageNote: "注册为全局工具,所有支持工具调用的模型均可调用。",
7023
+ capabilitySubagentTitle: "订阅子代理",
7024
+ capabilitySubagentNote: "注册为全局工具,所有支持工具调用的模型均可把任务交给 Codex 订阅子代理。",
7025
+ capabilitySubagentModel: "模型",
7026
+ capabilitySubagentNoModels: "无可用模型",
7027
+ capabilitySubagentRestart: "需重启 DSH",
7028
+ capabilitySubagentEffort: "推理",
7029
+ capabilitySubagentEffortDefault: "默认",
7030
+ capabilitySubagentPreset: "预设",
7031
+ capabilitySubagentPresetHybrid: "Codex 混合模式",
7032
+ capabilitySubagentPresetInherit: "跟随当前对话",
7033
+ capabilityRegistered: "已注册",
7034
+ capabilityNotRegistered: "未注册",
7035
+ capabilityUnavailable: "未安装 Codex Connect",
7036
+ capabilityLoading: "正在读取注册状态…",
7037
+ capabilityWriteFailed: "更新注册状态失败。",
6253
7038
  settingsBundleSummary: "请在独立的 Codex Harness 设置页配置。",
6254
7039
  settingsBundlePath: "设置 → 内置插件 → Codex Harness",
6255
- settingsDefinitionAbsent: "请先在预设方案页选择预设。",
7040
+ settingsDefinitionAbsent: "请先选择一个预设。",
6256
7041
  globalGroupRequest: "模型请求",
6257
7042
  globalGroupDisplay: "界面",
6258
7043
  globalPending: "未保存",
@@ -6271,146 +7056,144 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6271
7056
  presetSummaryPrompts: "提示词",
6272
7057
  toolPolicyDraftSummary: "本次修改",
6273
7058
  toolPolicyRuleChanged: "预设方案调整",
6274
- toolPolicyNoToolDelta: "没有待保存变化",
7059
+ toolPolicyNoToolDelta: "无待保存修改",
6275
7060
  toolPolicySearch: "搜索工具",
6276
7061
  toolPolicyFilter: "工具筛选",
6277
7062
  toolPolicyAll: "全部",
6278
7063
  toolPolicyModified: "已修改",
6279
- toolPolicyDeferredFilter: "按需延迟",
7064
+ toolPolicyDeferredFilter: "已延迟",
6280
7065
  toolPolicyReplaceable: "可替换",
6281
7066
  toolPolicyDefaultDeferred: "默认延迟",
6282
7067
  toolPolicyAction: "工具操作",
6283
7068
  toolPolicyKeep: "启用",
6284
7069
  toolPolicyDefer: "延迟",
6285
- toolPolicyDeferHint: "按需延迟加载(通过 activate_tools 激活)",
7070
+ toolPolicyDeferHint: "按需加载(调用时再激活)",
6286
7071
  toolPolicyHide: "隐藏",
6287
7072
  toolPolicyReplaceShort: "替换",
6288
- toolPolicyRestoreChoice: "恢复默认选择",
7073
+ toolPolicyRestoreChoice: "恢复默认",
6289
7074
  toolPolicyUnsupported: "已保存的替换当前不可用",
6290
7075
  toolPolicyConditional: "按条件可用",
6291
7076
  toolPolicyTargetExists: "替换目标已存在",
6292
7077
  toolPolicyPresetDisabled: "原预设未启用",
6293
- toolPolicyGptGroup: "GPT 能力",
6294
- toolPolicyGptHostedSearch: "GPT 托管搜索",
6295
- toolPolicyGptHostedSearchTitle: "GPT 会话优先使用 OpenAI Responses 原生托管搜索(由「运行偏好」控制)。",
6296
- toolPolicyGptCodexSearch: "Codex 订阅搜索",
6297
- toolPolicyGptCodexSearchTitle: "由 Codex Connect 接管当前配置全局联网搜索。",
6298
- toolPolicyGptDualSearch: "GPT 托管 / Codex 搜索",
6299
- toolPolicyGptDualSearchTitle: "GPT 会话优先使用 OpenAI 原生托管搜索;其他模型走 Codex Connect 订阅搜索。",
6300
- toolPolicyGptImageTitle: "来源于 Codex Connect(ChatGPT 订阅生图接口,实测路由至 GPT-Image-2.6 Sunburst),支持工具调用的模型均可调用。",
6301
- toolPolicyGptCompactionDesc: "使用 OpenAI 服务端原生压缩替代默认文本摘要(仅 GPT 会话,失败自动回退)",
6302
- toolPolicyGptCompactionBadge: "GPT 原生压缩",
6303
- toolPolicyGptCompactionReadOnly: "非工具 · 运行偏好控制",
7078
+ toolPolicyGptHostedSearch: "GPT 原生搜索",
7079
+ toolPolicyGptHostedSearchTitle: "GPT 会话优先用原生搜索(在「全局设置」调整)。",
7080
+ toolPolicyGptCodexSearch: "Codex Connect",
7081
+ toolPolicyGptCodexSearchTitle: "由 Codex Connect 全局注册(在「全局设置」管理)。",
7082
+ toolPolicyGptDualSearch: "GPT 原生 / Codex Connect",
7083
+ toolPolicyGptDualSearchTitle: "GPT 会话优先用原生搜索,其他模型复用订阅搜索。",
7084
+ toolPolicyGptImageTitle: "由 Codex Connect 全局注册的生图工具(在「全局设置」管理)。",
7085
+ toolPolicyGptSubagentTitle: "通过 Codex Connect 订阅模型全局注册的子代理工具(在「全局设置」管理)。",
6304
7086
  toolPolicyCommandGroup: "命令与执行",
6305
7087
  toolPolicyFileGroup: "文件与检索",
6306
7088
  toolPolicyPlanGroup: "规划与交互",
6307
7089
  toolPolicyCollabGroup: "子代理与工作流",
6308
7090
  toolPolicyOtherGroup: "网络与扩展",
6309
7091
  toolPolicyCustomized: "项修改",
6310
- toolLabelExec: "在 Shell / PTY 中运行终端命令",
6311
- toolLabelStdin: "轮询命令输出或向交互式 PTY 发送输入",
7092
+ toolLabelExec: "运行终端命令(Shell / PTY)",
7093
+ toolLabelStdin: "读写交互式终端(PTY)",
6312
7094
  toolLabelPwsh: "执行 PowerShell 命令",
6313
7095
  toolLabelBash: "执行 Bash 命令",
6314
- toolLabelRunCode: "在沙箱中运行 SDK 代码批量调用工具",
6315
- toolLabelJobList: "列出后台 job(运行中与已结束)及状态",
6316
- toolLabelJobOutput: "读取后台 job 的增量输出或结果",
6317
- toolLabelJobKill: "终止正在运行的后台 job",
6318
- toolLabelTermOpen: "创建持久化终端 session",
6319
- toolLabelTermList: "列出当前 Agent 的持久化终端 session",
6320
- toolLabelTermRead: "分页读取持久化终端输出",
6321
- toolLabelTermSend: "向持久化终端发送输入",
6322
- toolLabelTermSignal: "向持久化终端进程组发送信号",
6323
- toolLabelTermClose: "关闭持久化终端并清理进程树",
6324
- toolLabelWorkdir: "查看或切换当前工作目录(cd)",
6325
- toolLabelWorktree: "新建 Git 分支与 Worktree 并切换目录",
6326
- toolLabelPatch: "使用 Codex Patch 语法增删改移文件",
6327
- toolLabelRead: "读取 UTF-8 文本文件(带行号)",
6328
- toolLabelWrite: "新建或覆盖写入 UTF-8 文本文件",
6329
- toolLabelEdit: "按字面文本精确替换修改文件",
6330
- toolLabelStrReplace: "使用 str_replace 命令查看或编辑文件",
6331
- toolLabelGlob: "按 Glob 模式匹配查找文件路径",
6332
- toolLabelGrep: "使用 ripgrep 正则搜索文件内容",
6333
- toolLabelImage: "读取 PNG / JPEG / WebP / GIF 图片",
6334
- toolLabelLsp: "通过 LSP 查询定义跳转、引用与符号",
6335
- toolLabelPlan: "更新任务执行计划与步骤状态",
6336
- toolLabelTodo: "覆盖写入待办任务列表(todo)",
6337
- toolLabelExitPlan: "提交 Markdown 方案并请求退出 Plan 模式",
6338
- toolLabelAskUser: "向用户发起结构化提问",
6339
- toolLabelPresent: "将文件声明为交付物展示给用户",
6340
- toolLabelProposeAction: "发起需用户确认的操作卡片",
6341
- toolLabelApprove: "批准被 Codex Auto-review 拦截的操作",
6342
- toolLabelSubagent: "启动独立上下文的 subagent 执行子任务",
6343
- toolLabelSubagentFork: "基于当前上下文 fork 子代理",
6344
- toolLabelSubagentCodex: "委托外部 Codex subagent 执行任务",
6345
- toolLabelSubagentClaude: "委托外部 Claude Code subagent 执行任务",
6346
- toolLabelSubagentOar: "启动实验性 OAR subagent",
6347
- toolLabelSubagentModels: "查询可用于 subagent 的模型列表",
6348
- toolLabelSendMessage: "向 subagent 或协作代理发送消息",
6349
- toolLabelListAgents: "列出已启动的 subagent 及状态",
6350
- toolLabelInterruptAgent: "中断指定 subagent 当前任务",
6351
- toolLabelWaitAgent: "等待 subagent 或团队成员状态更新",
6352
- toolLabelWorkflow: "运行多阶段 / 并行 PTC 工作流",
6353
- toolLabelRalph: "运行多轮自动迭代的 Ralph 循环代理",
6354
- toolLabelCreateGoal: "创建持久化会话 Goal",
6355
- toolLabelGetGoal: "读取当前会话 Goal 状态",
6356
- toolLabelUpdateGoal: "更新当前会话 Goal 进度",
6357
- toolLabelGoal: "管理当前会话 Goal",
6358
- toolLabelSpawnTeammate: "创建持久化 Team 协作代理",
6359
- toolLabelTeamCreate: "在 Team 看板新建待认领任务",
6360
- toolLabelTeamGet: "读取 Team 共享任务最新状态",
6361
- toolLabelTeamList: "列出 Team 共享任务与阻塞关系",
6362
- toolLabelTeamUpdate: "按修订号更新 Team 共享任务",
6363
- toolLabelWebSearch: "搜索实时网页信息与来源摘要",
6364
- toolLabelWebFetch: "抓取指定 HTTP(S) URL 网页文本",
6365
- toolLabelSkill: "按需加载指定 Skill 完整指令",
6366
- toolLabelActivateTools: "激活按需延迟加载(deferLoading)的工具",
6367
- toolLabelSchedule: "管理定时与周期任务",
6368
- toolLabelScheduleCreate: "新建一次性或 Cron 周期任务",
6369
- toolLabelScheduleEdit: "修改或启停已有定时任务",
6370
- toolLabelScheduleList: "列出定时任务与下次触发时间",
6371
- toolLabelScheduleView: "查看单个定时任务详情与记录",
6372
- toolLabelPluginManager: "查看、启停、安装或移除 Profile 插件",
6373
- toolLabelPluginMarket: "浏览插件市场索引与可安装包",
6374
- toolLabelCordisList: "列出宿主已知的 Cordis Inspect Provider",
6375
- toolLabelCordisQuery: "执行 Cordis Inspect 只读诊断查询",
6376
- toolLabelSessionSearch: "跨历史 Session 搜索匹配事件",
6377
- toolLabelSessionTrace: "追踪 Session 派生与上下文链路",
6378
- toolLabelSessionEventRead: "读取 Session 单条完整原始事件",
6379
- toolLabelSessionEventSearch: "在单个 Session 内搜索历史事件",
6380
- toolLabelSessionEventTrace: "追踪单条 Session 事件的引用与替换链",
6381
- toolLabelMcpList: "列出 MCP Server 可用资源",
6382
- toolLabelMcpTemplates: "列出 MCP Server 参数化 URI 模板",
6383
- toolLabelMcpRead: "按 URI 读取 MCP Server 资源内容",
6384
- toolLabelWorkspaceDeps: "获取内置 Python 与依赖库路径",
6385
- toolLabelStagehandNav: "浏览器导航至目标 URL(Stagehand)",
6386
- toolLabelStagehandAct: "在页面执行交互操作(Stagehand)",
6387
- toolLabelStagehandExtract: "从页面提取结构化数据(Stagehand)",
6388
- toolLabelStagehandObserve: "观察页面可交互元素(Stagehand)",
6389
- toolLabelStagehandShot: "截取当前浏览器页面(Stagehand)",
7096
+ toolLabelRunCode: "沙箱运行代码并批量调用工具",
7097
+ toolLabelJobList: "列出后台任务及状态",
7098
+ toolLabelJobOutput: "读取后台任务输出",
7099
+ toolLabelJobKill: "终止后台任务",
7100
+ toolLabelTermOpen: "打开持久终端",
7101
+ toolLabelTermList: "列出持久终端",
7102
+ toolLabelTermRead: "读取持久终端输出",
7103
+ toolLabelTermSend: "向持久终端发送输入",
7104
+ toolLabelTermSignal: "向持久终端发送信号",
7105
+ toolLabelTermClose: "关闭持久终端",
7106
+ toolLabelWorkdir: "查看或切换工作目录(cd)",
7107
+ toolLabelWorktree: "新建 Git 分支与工作树",
7108
+ toolLabelPatch: "应用补丁修改文件",
7109
+ toolLabelRead: "读取文本文件",
7110
+ toolLabelWrite: "新建或覆盖文件",
7111
+ toolLabelEdit: "按文本替换编辑文件",
7112
+ toolLabelStrReplace: "按文本替换查看或编辑文件",
7113
+ toolLabelGlob: "按通配符查找文件",
7114
+ toolLabelGrep: "正则搜索文件内容",
7115
+ toolLabelImage: "读取图片",
7116
+ toolLabelLsp: "LSP 代码符号与引用查询",
7117
+ toolLabelPlan: "更新任务计划",
7118
+ toolLabelTodo: "更新待办列表",
7119
+ toolLabelExitPlan: "提交方案并退出规划模式",
7120
+ toolLabelAskUser: "向用户提问",
7121
+ toolLabelPresent: "向用户展示交付文件",
7122
+ toolLabelProposeAction: "请求用户确认操作",
7123
+ toolLabelApprove: "批准自动审查拦截的操作",
7124
+ toolLabelSubagent: "启动独立子代理",
7125
+ toolLabelSubagentFork: "派生子代理(继承上下文)",
7126
+ toolLabelSubagentCodex: "委托 Codex 子代理",
7127
+ toolLabelCodexSubagent: "委托 Codex 订阅子代理",
7128
+ toolLabelSubagentClaude: "委托 Claude Code 子代理",
7129
+ toolLabelSubagentOar: "启动 OAR 子代理",
7130
+ toolLabelSubagentModels: "列出子代理可用模型",
7131
+ toolLabelSendMessage: "向子代理发消息",
7132
+ toolLabelListAgents: "列出子代理及状态",
7133
+ toolLabelInterruptAgent: "中断子代理任务",
7134
+ toolLabelWaitAgent: "等待子代理状态更新",
7135
+ toolLabelWorkflow: "运行多阶段 / 并行工作流",
7136
+ toolLabelRalph: "运行自动迭代循环代理",
7137
+ toolLabelCreateGoal: "创建会话目标",
7138
+ toolLabelGetGoal: "读取会话目标",
7139
+ toolLabelUpdateGoal: "更新会话目标进度",
7140
+ toolLabelGoal: "管理会话目标",
7141
+ toolLabelSpawnTeammate: "创建团队协作代理",
7142
+ toolLabelTeamCreate: "新建团队任务",
7143
+ toolLabelTeamGet: "读取团队任务状态",
7144
+ toolLabelTeamList: "列出团队任务与阻塞",
7145
+ toolLabelTeamUpdate: "更新团队任务",
7146
+ toolLabelWebSearch: "搜索网页信息",
7147
+ toolLabelWebFetch: "抓取网页文本",
7148
+ toolLabelSkill: "加载技能说明",
7149
+ toolLabelActivateTools: "激活延迟加载的工具",
7150
+ toolLabelSchedule: "管理定时任务",
7151
+ toolLabelScheduleCreate: "新建定时任务",
7152
+ toolLabelScheduleEdit: "修改或启停定时任务",
7153
+ toolLabelScheduleList: "列出定时任务",
7154
+ toolLabelScheduleView: "查看定时任务详情",
7155
+ toolLabelPluginManager: "管理当前配置插件",
7156
+ toolLabelPluginMarket: "浏览插件市场",
7157
+ toolLabelCordisList: "列出宿主诊断接口",
7158
+ toolLabelCordisQuery: "查询宿主诊断信息",
7159
+ toolLabelSessionSearch: "跨历史会话搜索事件",
7160
+ toolLabelSessionTrace: "追踪会话链路",
7161
+ toolLabelSessionEventRead: "读取单条会话事件",
7162
+ toolLabelSessionEventSearch: "搜索当前会话事件",
7163
+ toolLabelSessionEventTrace: "追踪会话事件引用链",
7164
+ toolLabelMcpList: "列出 MCP 资源",
7165
+ toolLabelMcpTemplates: "列出 MCP 资源模板",
7166
+ toolLabelMcpRead: "读取 MCP 资源",
7167
+ toolLabelWorkspaceDeps: "获取内置 Python 与依赖路径",
7168
+ toolLabelStagehandNav: "浏览器打开网页(Stagehand)",
7169
+ toolLabelStagehandAct: "执行页面交互(Stagehand)",
7170
+ toolLabelStagehandExtract: "提取页面数据(Stagehand)",
7171
+ toolLabelStagehandObserve: "识别页面可交互元素(Stagehand)",
7172
+ toolLabelStagehandShot: "截取浏览器页面(Stagehand)",
6390
7173
  toolLabelStagehandTabs: "管理浏览器标签页(Stagehand)",
6391
- toolLabelViewImage: "查看本地或 HTTP(S) 图片(Codex Connect)",
6392
- toolLabelCodexImageGen: "通过 GPT Image 生成或编辑图片(Codex Connect)",
6393
- toolLabelCodexQuota: "查询当前 Codex 账号共享额度(Codex Connect)",
7174
+ toolLabelViewImage: "查看本地或网络图片",
7175
+ toolLabelCodexImageGen: "生成或编辑图片",
7176
+ toolLabelCodexQuota: "查询 Codex 账号额度",
6394
7177
  toolLabelMcpDynamic: "MCP 扩展工具",
6395
7178
  toolLabelOther: "其它工具",
6396
7179
  toolPolicyToolsLoading: "正在读取工具…",
6397
7180
  toolPolicyToolsEmpty: "没有已注册工具。",
6398
7181
  toolPolicyNoMatches: "没有匹配工具。",
6399
- toolPolicyToolsFailed: "工具目录不可用,已保存规则仍保留。",
7182
+ toolPolicyToolsFailed: "无法加载工具列表,已保存规则不受影响。",
6400
7183
  toolPolicyToolsRefresh: "刷新工具",
6401
7184
  toolPolicyCatalogLoading: "正在读取预设…",
6402
7185
  toolPolicyCatalogEmpty: "没有可选预设。",
6403
- toolPolicyCatalogFailed: "预设列表不可用,仍可选择已保存 ID。",
7186
+ toolPolicyCatalogFailed: "无法加载预设列表,仍可选择已保存项。",
6404
7187
  toolPolicyCatalogRetry: "重新读取预设",
6405
7188
  toolPolicyEmpty: "请选择预设",
6406
- toolPolicySave: "保存此预设",
7189
+ toolPolicySave: "保存",
6407
7190
  toolPolicySaving: "正在保存…",
6408
7191
  toolPolicyDiscard: "放弃草稿",
6409
- toolPolicySaved: "此预设已保存。",
7192
+ toolPolicySaved: "已保存。",
6410
7193
  toolPolicyInvalidPreset: "预设 ID 为空,无法保存。",
6411
7194
  toolPolicyDuplicatePreset: "预设 ID 重复,无法保存。",
6412
- toolPolicyRefused: "未保存,草稿基于旧设置。请放弃草稿后重新读取。",
6413
- toolPolicyFailed: "保存失败,此预设草稿已保留。",
7195
+ toolPolicyRefused: "保存冲突,请放弃草稿后重试。",
7196
+ toolPolicyFailed: "保存失败,草稿已保留。",
6414
7197
  toolPolicyReadOnly: "当前设置为只读。",
6415
7198
  pmRefresh: "刷新",
6416
7199
  peLoading: "正在读取预设…",
@@ -6459,6 +7242,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6459
7242
  "subagent",
6460
7243
  "subagent_fork",
6461
7244
  "subagent_codex",
7245
+ "codex_subagent",
6462
7246
  "subagent_claude_code",
6463
7247
  "subagent_oar",
6464
7248
  "list_subagent_models",
@@ -6478,9 +7262,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6478
7262
  "team_task_list",
6479
7263
  "team_task_update"
6480
7264
  ]);
6481
- function groupOf(tool, gptSearchActive = false) {
6482
- if (tool.name === "codex_connect_image_generate") return "gpt";
6483
- if (tool.name === "web_search" && gptSearchActive) return "gpt";
7265
+ function groupOf(tool) {
6484
7266
  if (commandNames.has(tool.name) || tool.replacements.some((item) => item.action === "codex-exec")) return "command";
6485
7267
  if (fileNames.has(tool.name) || tool.replacements.some((item) => item.action === "codex-patch")) return "file";
6486
7268
  if (planNames.has(tool.name) || tool.replacements.some((item) => item.action === "codex-plan")) return "plan";
@@ -6523,6 +7305,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6523
7305
  subagent: "toolLabelSubagent",
6524
7306
  subagent_fork: "toolLabelSubagentFork",
6525
7307
  subagent_codex: "toolLabelSubagentCodex",
7308
+ codex_subagent: "toolLabelCodexSubagent",
6526
7309
  subagent_claude_code: "toolLabelSubagentClaude",
6527
7310
  subagent_oar: "toolLabelSubagentOar",
6528
7311
  list_subagent_models: "toolLabelSubagentModels",
@@ -6686,31 +7469,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6686
7469
  value
6687
7470
  }], revision);
6688
7471
  }
6689
- function resolveGptCapabilities(codexSettings, codexConnect) {
6690
- const connectReady = codexConnect?.status === "ready";
6691
- if (codexSettings === void 0 && !connectReady) return void 0;
6692
- return {
6693
- hostedWebSearch: codexSettings !== void 0 ? codexSettings.hostedWebSearchEnabled ?? true : false,
6694
- codexSearch: connectReady && codexConnect.searchEnabled === true,
6695
- codexSearchModel: connectReady ? codexConnect.searchModel : void 0,
6696
- remoteCompaction: codexSettings !== void 0 && (codexSettings.remoteCompactionEnabled ?? true) || connectReady && codexConnect.nativeCompaction === true,
6697
- imageGeneration: connectReady && codexConnect.imageGenerationEnabled === true,
6698
- imageModelHint: connectReady ? codexConnect.imageModelHint : void 0
6699
- };
6700
- }
6701
- function formatGptImageBadge(hint) {
6702
- const value = hint?.trim() ?? "";
6703
- if (!value || value === "gpt-image-2.6-sunburst") return "GPT-Image-2.6 Sunburst";
6704
- if (value === "gpt-image-2.6-flare") return "GPT-Image-2.6 Flare";
6705
- if (value === "gpt-image-2") return "GPT-Image-2";
6706
- return value;
6707
- }
6708
7472
  const isPromptName = (name) => PRESET_PROMPT_NAMES.includes(name);
6709
7473
  const GROUP_META = [
6710
- {
6711
- id: "gpt",
6712
- labelKey: "toolPolicyGptGroup"
6713
- },
6714
7474
  {
6715
7475
  id: "command",
6716
7476
  labelKey: "toolPolicyCommandGroup"
@@ -6739,7 +7499,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6739
7499
  ...props
6740
7500
  });
6741
7501
  }
6742
- function ToolPolicySettingsCard({ form, presetManager, mode = "tools", gptCapabilities, t }) {
7502
+ function ToolPolicySettingsCard({ form, presetManager, mode = "tools", gptCapabilities, toolsVersion = 0, t }) {
6743
7503
  const snapshot = (0, react.useSyncExternalStore)((listener) => form.subscribe(listener), () => form.getSnapshot(), () => form.getSnapshot());
6744
7504
  const [subMode, setSubMode] = (0, react.useState)(mode === "prompts" || mode === "definition" ? mode : "tools");
6745
7505
  const prevMode = (0, react.useRef)(mode);
@@ -6835,6 +7595,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6835
7595
  toolsRequest.current++;
6836
7596
  };
6837
7597
  }, [presetManager, selectedId]);
7598
+ const loadedToolsVersion = (0, react.useRef)(toolsVersion);
7599
+ (0, react.useEffect)(() => {
7600
+ if (mode !== "inactive" && loadedToolsVersion.current !== toolsVersion) {
7601
+ loadedToolsVersion.current = toolsVersion;
7602
+ loadTools(true);
7603
+ }
7604
+ }, [
7605
+ mode,
7606
+ toolsVersion,
7607
+ presetManager,
7608
+ selectedId
7609
+ ]);
6838
7610
  const cached = presetManager && selectedId ? cachedPresetTools(presetManager, selectedId) : void 0;
6839
7611
  const inventory = toolsView?.preset === selectedId && toolsView.status === "error" ? void 0 : toolsView?.preset === selectedId && toolsView.status === "ready" ? toolsView.value : cached;
6840
7612
  const toolsStatus = inventory ? "ready" : toolsView?.preset === selectedId ? toolsView.status : selectedId ? "loading" : "error";
@@ -7000,8 +7772,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7000
7772
  const unavailable = (reason) => t(reason === "conditional" ? "toolPolicyConditional" : reason === "target-exists" ? "toolPolicyTargetExists" : "toolPolicyUnsupported");
7001
7773
  const gptSearchActive = gptCapabilities?.hostedWebSearch === true || gptCapabilities?.codexSearch === true;
7002
7774
  const gptBadgeFor = (tool) => {
7775
+ if (tool.name === "codex_subagent") {
7776
+ const model = gptCapabilities?.codexSubagentModel;
7777
+ return {
7778
+ label: model ? `${t("toolPolicyGptCodexSearch")} · ${model}` : t("toolPolicyGptCodexSearch"),
7779
+ title: t("toolPolicyGptSubagentTitle")
7780
+ };
7781
+ }
7003
7782
  if (tool.name === "codex_connect_image_generate") return {
7004
- label: formatGptImageBadge(gptCapabilities?.imageModelHint),
7783
+ label: `${t("toolPolicyGptCodexSearch")} · ${formatGptImageBadge(gptCapabilities?.imageModelHint)}`,
7005
7784
  title: t("toolPolicyGptImageTitle")
7006
7785
  };
7007
7786
  if (tool.name === "web_search" && gptSearchActive) {
@@ -7020,165 +7799,131 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7020
7799
  };
7021
7800
  }
7022
7801
  };
7023
- const renderRows = (tools, includeCompaction = false) => (0, react_jsx_runtime.jsxs)("div", {
7802
+ const renderRows = (tools) => (0, react_jsx_runtime.jsxs)("div", {
7024
7803
  className: "codex-tool-policy-table",
7025
7804
  role: "table",
7026
7805
  "aria-label": t("toolPolicyTitle"),
7027
- children: [
7028
- tools.map((tool) => {
7029
- const action = chosen(tool);
7030
- const deferReason = deferUnavailableReason(tool);
7031
- const supported = action === "keep" || action === "hide" || action === "defer" || tool.replacements.some((option) => option.action === action);
7032
- const custom = customized(tool);
7033
- const hasOverride = !!rule?.tools?.some((choice) => choice.name === tool.name);
7034
- const gptBadge = gptBadgeFor(tool);
7035
- return (0, react_jsx_runtime.jsxs)("div", {
7036
- role: "row",
7037
- className: "codex-tool-policy-tool",
7038
- "data-tool-name": tool.name,
7039
- "data-tool-action": action,
7040
- children: [(0, react_jsx_runtime.jsxs)("div", {
7041
- role: "cell",
7042
- className: "codex-tool-policy-name",
7043
- children: [
7044
- (0, react_jsx_runtime.jsx)("code", {
7045
- className: "codex-tool-policy-identifier",
7046
- children: tool.name
7047
- }),
7048
- (0, react_jsx_runtime.jsx)("span", {
7049
- className: "codex-tool-policy-description",
7050
- title: tool.description,
7051
- children: human(tool)
7052
- }),
7053
- gptBadge && (0, react_jsx_runtime.jsx)("span", {
7054
- className: "codex-badge",
7055
- "data-tone": "gpt",
7056
- title: gptBadge.title,
7057
- children: gptBadge.label
7058
- }),
7059
- tool.defaultDeferred && !custom && (0, react_jsx_runtime.jsx)("span", {
7060
- className: "codex-badge",
7061
- "data-tone": "blue",
7062
- children: t("toolPolicyDefaultDeferred")
7063
- }),
7064
- custom && (0, react_jsx_runtime.jsx)("span", {
7065
- className: "codex-badge",
7066
- "data-tone": "blue",
7067
- children: t("toolPolicyModified")
7068
- }),
7069
- tool.codexTool?.presetEnabled === false && (0, react_jsx_runtime.jsx)("span", {
7070
- className: "codex-badge",
7071
- "data-tone": "warn",
7072
- children: t("toolPolicyPresetDisabled")
7073
- }),
7074
- tool.conditional && tool.codexTool === void 0 && (0, react_jsx_runtime.jsx)("span", {
7075
- className: "codex-badge",
7076
- children: t("toolPolicyConditional")
7077
- })
7078
- ]
7079
- }), (0, react_jsx_runtime.jsxs)("div", {
7080
- role: "cell",
7081
- className: "codex-tool-policy-action",
7082
- children: [
7083
- (0, react_jsx_runtime.jsxs)("div", {
7084
- className: "codex-seg",
7085
- role: "group",
7086
- "aria-label": `${t("toolPolicyAction")} ${tool.name}`,
7087
- children: [
7088
- (0, react_jsx_runtime.jsx)("button", {
7089
- type: "button",
7090
- "data-action": "keep",
7091
- "aria-pressed": action === "keep",
7092
- disabled: duplicate,
7093
- onClick: () => chooseAction(tool, "keep"),
7094
- children: t("toolPolicyKeep")
7095
- }),
7096
- tool.replacements.map((option) => (0, react_jsx_runtime.jsx)("button", {
7097
- type: "button",
7098
- "data-action": option.action,
7099
- "aria-pressed": action === option.action,
7100
- disabled: duplicate || !option.available,
7101
- title: option.available ? option.tools.join(" + ") : `${option.tools.join(" + ")} · ${unavailable(option.reason)}`,
7102
- onClick: () => chooseAction(tool, option.action),
7103
- children: t("toolPolicyReplaceShort")
7104
- }, option.action)),
7105
- (0, react_jsx_runtime.jsx)("button", {
7106
- type: "button",
7107
- "data-action": "defer",
7108
- "aria-pressed": action === "defer",
7109
- disabled: duplicate || deferReason !== void 0,
7110
- title: deferReason !== void 0 ? unavailable(deferReason) : t("toolPolicyDeferHint"),
7111
- onClick: () => chooseAction(tool, "defer"),
7112
- children: t("toolPolicyDefer")
7113
- }),
7114
- (0, react_jsx_runtime.jsx)("button", {
7115
- type: "button",
7116
- "data-action": "hide",
7117
- "aria-pressed": action === "hide",
7118
- disabled: duplicate,
7119
- onClick: () => chooseAction(tool, "hide"),
7120
- children: t("toolPolicyHide")
7121
- })
7122
- ]
7123
- }),
7124
- !supported && (0, react_jsx_runtime.jsxs)("span", {
7125
- className: "codex-tool-policy-warning",
7126
- children: [
7127
- t("toolPolicyUnsupported"),
7128
- " (",
7129
- action,
7130
- ")"
7131
- ]
7132
- }),
7133
- hasOverride && (0, react_jsx_runtime.jsx)("button", {
7134
- type: "button",
7135
- className: "codex-btn",
7136
- "aria-label": `${t("toolPolicyRestoreChoice")} ${tool.name}`,
7137
- title: t("toolPolicyRestoreChoice"),
7138
- onClick: () => removeChoice(tool.name),
7139
- children: "↶"
7140
- })
7141
- ]
7142
- })]
7143
- }, tool.name);
7144
- }),
7145
- includeCompaction && (0, react_jsx_runtime.jsxs)("div", {
7806
+ children: [tools.map((tool) => {
7807
+ const action = chosen(tool);
7808
+ const deferReason = deferUnavailableReason(tool);
7809
+ const supported = action === "keep" || action === "hide" || action === "defer" || tool.replacements.some((option) => option.action === action);
7810
+ const custom = customized(tool);
7811
+ const hasOverride = !!rule?.tools?.some((choice) => choice.name === tool.name);
7812
+ const gptBadge = gptBadgeFor(tool);
7813
+ return (0, react_jsx_runtime.jsxs)("div", {
7146
7814
  role: "row",
7147
7815
  className: "codex-tool-policy-tool",
7148
- "data-gpt-capability": "compaction",
7816
+ "data-tool-name": tool.name,
7817
+ "data-tool-action": action,
7149
7818
  children: [(0, react_jsx_runtime.jsxs)("div", {
7150
7819
  role: "cell",
7151
7820
  className: "codex-tool-policy-name",
7152
7821
  children: [
7153
7822
  (0, react_jsx_runtime.jsx)("code", {
7154
7823
  className: "codex-tool-policy-identifier",
7155
- children: "/compact"
7824
+ children: tool.name
7156
7825
  }),
7157
7826
  (0, react_jsx_runtime.jsx)("span", {
7158
7827
  className: "codex-tool-policy-description",
7159
- children: t("toolPolicyGptCompactionDesc")
7828
+ title: tool.description,
7829
+ children: human(tool)
7160
7830
  }),
7161
- (0, react_jsx_runtime.jsx)("span", {
7831
+ gptBadge && (0, react_jsx_runtime.jsx)("span", {
7162
7832
  className: "codex-badge",
7163
7833
  "data-tone": "gpt",
7164
- children: t("toolPolicyGptCompactionBadge")
7834
+ title: gptBadge.title,
7835
+ children: gptBadge.label
7836
+ }),
7837
+ tool.defaultDeferred && !custom && (0, react_jsx_runtime.jsx)("span", {
7838
+ className: "codex-badge",
7839
+ "data-tone": "blue",
7840
+ children: t("toolPolicyDefaultDeferred")
7841
+ }),
7842
+ custom && (0, react_jsx_runtime.jsx)("span", {
7843
+ className: "codex-badge",
7844
+ "data-tone": "blue",
7845
+ children: t("toolPolicyModified")
7846
+ }),
7847
+ tool.codexTool?.presetEnabled === false && (0, react_jsx_runtime.jsx)("span", {
7848
+ className: "codex-badge",
7849
+ "data-tone": "warn",
7850
+ children: t("toolPolicyPresetDisabled")
7851
+ }),
7852
+ tool.conditional && tool.codexTool === void 0 && (0, react_jsx_runtime.jsx)("span", {
7853
+ className: "codex-badge",
7854
+ children: t("toolPolicyConditional")
7165
7855
  })
7166
7856
  ]
7167
- }), (0, react_jsx_runtime.jsx)("div", {
7857
+ }), (0, react_jsx_runtime.jsxs)("div", {
7168
7858
  role: "cell",
7169
7859
  className: "codex-tool-policy-action",
7170
- children: (0, react_jsx_runtime.jsx)("span", {
7171
- className: "codex-badge",
7172
- children: t("toolPolicyGptCompactionReadOnly")
7173
- })
7860
+ children: [
7861
+ (0, react_jsx_runtime.jsxs)("div", {
7862
+ className: "codex-seg",
7863
+ role: "group",
7864
+ "aria-label": `${t("toolPolicyAction")} ${tool.name}`,
7865
+ children: [
7866
+ (0, react_jsx_runtime.jsx)("button", {
7867
+ type: "button",
7868
+ "data-action": "keep",
7869
+ "aria-pressed": action === "keep",
7870
+ disabled: duplicate,
7871
+ onClick: () => chooseAction(tool, "keep"),
7872
+ children: t("toolPolicyKeep")
7873
+ }),
7874
+ tool.replacements.map((option) => (0, react_jsx_runtime.jsx)("button", {
7875
+ type: "button",
7876
+ "data-action": option.action,
7877
+ "aria-pressed": action === option.action,
7878
+ disabled: duplicate || !option.available,
7879
+ title: option.available ? option.tools.join(" + ") : `${option.tools.join(" + ")} · ${unavailable(option.reason)}`,
7880
+ onClick: () => chooseAction(tool, option.action),
7881
+ children: t("toolPolicyReplaceShort")
7882
+ }, option.action)),
7883
+ (0, react_jsx_runtime.jsx)("button", {
7884
+ type: "button",
7885
+ "data-action": "defer",
7886
+ "aria-pressed": action === "defer",
7887
+ disabled: duplicate || deferReason !== void 0,
7888
+ title: deferReason !== void 0 ? unavailable(deferReason) : t("toolPolicyDeferHint"),
7889
+ onClick: () => chooseAction(tool, "defer"),
7890
+ children: t("toolPolicyDefer")
7891
+ }),
7892
+ (0, react_jsx_runtime.jsx)("button", {
7893
+ type: "button",
7894
+ "data-action": "hide",
7895
+ "aria-pressed": action === "hide",
7896
+ disabled: duplicate,
7897
+ onClick: () => chooseAction(tool, "hide"),
7898
+ children: t("toolPolicyHide")
7899
+ })
7900
+ ]
7901
+ }),
7902
+ !supported && (0, react_jsx_runtime.jsxs)("span", {
7903
+ className: "codex-tool-policy-warning",
7904
+ children: [
7905
+ t("toolPolicyUnsupported"),
7906
+ " (",
7907
+ action,
7908
+ ")"
7909
+ ]
7910
+ }),
7911
+ hasOverride && (0, react_jsx_runtime.jsx)("button", {
7912
+ type: "button",
7913
+ className: "codex-btn",
7914
+ "aria-label": `${t("toolPolicyRestoreChoice")} ${tool.name}`,
7915
+ title: t("toolPolicyRestoreChoice"),
7916
+ onClick: () => removeChoice(tool.name),
7917
+ children: "↶"
7918
+ })
7919
+ ]
7174
7920
  })]
7175
- }, "__gpt_compaction__"),
7176
- tools.length === 0 && !includeCompaction && (0, react_jsx_runtime.jsx)("p", {
7177
- className: "codex-tool-policy-note",
7178
- style: { padding: "12px 14px" },
7179
- children: t("toolPolicyNoMatches")
7180
- })
7181
- ]
7921
+ }, tool.name);
7922
+ }), tools.length === 0 && (0, react_jsx_runtime.jsx)("p", {
7923
+ className: "codex-tool-policy-note",
7924
+ style: { padding: "12px 14px" },
7925
+ children: t("toolPolicyNoMatches")
7926
+ })]
7182
7927
  });
7183
7928
  if (snapshot.status !== "ready" || snapshot.value === void 0 || mode === "inactive") return null;
7184
7929
  const text = query.trim().toLowerCase();
@@ -7190,8 +7935,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7190
7935
  const haystack = `${human(tool)} ${tool.name} ${tool.description} ${gptBadge?.label ?? ""}`.toLowerCase();
7191
7936
  return (!text || haystack.includes(text)) && (filter === "all" || (filter === "modified" ? customized(tool) : filter === "deferred" ? chosen(tool) === "defer" : tool.replacements.some((option) => option.available)));
7192
7937
  });
7193
- const compactionSearchText = `/compact compaction ${t("toolPolicyGptCompactionDesc")} ${t("toolPolicyGptCompactionBadge")} gpt`.toLowerCase();
7194
- const showCompactionRow = gptCapabilities?.remoteCompaction === true && filter === "all" && (!text || compactionSearchText.includes(text));
7195
7938
  return (0, react_jsx_runtime.jsxs)("section", {
7196
7939
  className: "codex-tool-policy",
7197
7940
  "aria-label": t(activeSub === "prompts" ? "settingsPresetPrompts" : "toolPolicyTitle"),
@@ -7323,16 +8066,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7323
8066
  })
7324
8067
  ]
7325
8068
  }),
7326
- inventory && !duplicate && (isFiltering && shown.length === 0 && !showCompactionRow ? (0, react_jsx_runtime.jsx)("div", {
8069
+ inventory && !duplicate && (isFiltering && shown.length === 0 ? (0, react_jsx_runtime.jsx)("div", {
7327
8070
  className: "codex-card",
7328
8071
  children: renderRows(shown)
7329
8072
  }) : GROUP_META.map((group) => {
7330
- const tools = shown.filter((tool) => groupOf(tool, gptSearchActive) === group.id);
7331
- const includeCompaction = group.id === "gpt" && showCompactionRow;
7332
- if (!tools.length && !includeCompaction) return null;
8073
+ const tools = shown.filter((tool) => groupOf(tool) === group.id);
8074
+ if (!tools.length) return null;
7333
8075
  const changes = tools.filter(customized).length;
7334
8076
  const key = `${selectedId}/${group.id}`;
7335
- const count = tools.length + (includeCompaction ? 1 : 0);
7336
8077
  return (0, react_jsx_runtime.jsxs)("details", {
7337
8078
  className: "codex-group",
7338
8079
  "data-tool-group": group.id,
@@ -7343,8 +8084,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7343
8084
  },
7344
8085
  children: [(0, react_jsx_runtime.jsxs)("summary", { children: [(0, react_jsx_runtime.jsx)("span", { children: t(group.labelKey) }), (0, react_jsx_runtime.jsxs)("span", {
7345
8086
  className: "codex-tool-policy-note",
7346
- children: [count, changes ? ` · ${changes} ${t("toolPolicyCustomized")}` : ""]
7347
- })] }), renderRows(tools, includeCompaction)]
8087
+ children: [tools.length, changes ? ` · ${changes} ${t("toolPolicyCustomized")}` : ""]
8088
+ })] }), renderRows(tools)]
7348
8089
  }, group.id);
7349
8090
  }))
7350
8091
  ] }),
@@ -7479,24 +8220,28 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7479
8220
  ...toolPolicyEn,
7480
8221
  fast: "Fast mode",
7481
8222
  fastModeControl: "Show fast mode control",
8223
+ proModeControl: "Show API Pro mode control",
7482
8224
  contextWindowControl: "Show context window control",
7483
8225
  fastOn: "Fast mode on (priority tier)",
7484
8226
  fastOff: "Fast mode off",
7485
8227
  fastStateOn: "On",
7486
8228
  fastStateOff: "Off",
8229
+ pro: "Pro",
8230
+ proOn: "Pro mode on",
8231
+ proOff: "Pro mode off",
7487
8232
  contextSize: "Context size",
7488
8233
  contextShortDefault: "Ctx",
7489
8234
  contextDefaultOption: "Default",
7490
8235
  contextCustomPlaceholder: "≥16k (e.g. 64)",
7491
8236
  contextApply: "Set",
7492
8237
  compactRemote: "Remote compaction",
7493
- compactRemoteHint: "Use the provider remote compaction endpoint first.",
7494
- compactLocal: "Local compaction",
7495
- compactLocalHint: "Use the DSH text-summary compaction engine directly.",
8238
+ compactRemoteHint: "Use provider remote compaction first.",
8239
+ compactLocal: "Model summary",
8240
+ compactLocalHint: "Compact context with a model summary.",
7496
8241
  capabilityActivity: "Activity indicator",
7497
8242
  promptDiscard: "Discard",
7498
8243
  promptSaving: "Saving...",
7499
- promptReadOnly: "This settings document is read-only.",
8244
+ promptReadOnly: "Settings are read-only.",
7500
8245
  activityCompacting: "Compacting context...",
7501
8246
  activityRequestingModel: "Requesting model...",
7502
8247
  activityModelReply: "Model replying..."
@@ -7504,25 +8249,29 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7504
8249
  const zh = {
7505
8250
  ...toolPolicyZh,
7506
8251
  fastModeControl: "显示快速模式开关",
8252
+ proModeControl: "显示 API Pro 模式开关",
7507
8253
  contextWindowControl: "显示上下文大小快捷按钮",
7508
8254
  fast: "快速模式",
7509
8255
  fastOn: "快速模式已开启(优先通道)",
7510
8256
  fastOff: "快速模式已关闭",
7511
8257
  fastStateOn: "开",
7512
8258
  fastStateOff: "关",
8259
+ pro: "Pro",
8260
+ proOn: "Pro 模式已开启",
8261
+ proOff: "Pro 模式已关闭",
7513
8262
  contextSize: "上下文大小",
7514
8263
  contextShortDefault: "上下文",
7515
8264
  contextDefaultOption: "默认",
7516
8265
  contextCustomPlaceholder: "≥16k (如 64)",
7517
8266
  contextApply: "确定",
7518
8267
  compactRemote: "远程压缩",
7519
- compactRemoteHint: "优先使用提供商的远程压缩端点。",
7520
- compactLocal: "本地压缩",
7521
- compactLocalHint: "直接使用 DSH 文本摘要压缩引擎。",
8268
+ compactRemoteHint: "优先使用服务端远程压缩。",
8269
+ compactLocal: "模型摘要",
8270
+ compactLocalHint: "使用模型摘要压缩上下文。",
7522
8271
  capabilityActivity: "活动状态",
7523
8272
  promptDiscard: "放弃",
7524
8273
  promptSaving: "保存中...",
7525
- promptReadOnly: "当前设置文件为只读。",
8274
+ promptReadOnly: "当前设置为只读。",
7526
8275
  activityCompacting: "正在压缩上下文...",
7527
8276
  activityRequestingModel: "请求中...",
7528
8277
  activityModelReply: "回复中..."
@@ -7554,14 +8303,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7554
8303
  children: [(0, react_jsx_runtime.jsx)("span", { children: t("fast") }), (0, react_jsx_runtime.jsx)("span", {
7555
8304
  style: {
7556
8305
  color: "var(--dsw-alias-label-secondary)",
7557
- fontSize: 11
8306
+ fontSize: 12
7558
8307
  },
7559
8308
  children: fast ? t("fastStateOn") : t("fastStateOff")
7560
8309
  })]
7561
8310
  });
7562
8311
  }
7563
8312
  function ComposerControls(props) {
7564
- return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)(ContextWindowControl, { ...props }), (0, react_jsx_runtime.jsx)(FastModeFallback, { ...props })] });
8313
+ return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
8314
+ (0, react_jsx_runtime.jsx)(ContextWindowControl, { ...props }),
8315
+ (0, react_jsx_runtime.jsx)(ProModeControl, { ...props }),
8316
+ (0, react_jsx_runtime.jsx)(FastModeFallback, { ...props })
8317
+ ] });
7565
8318
  }
7566
8319
  function elapsedSeconds(startedAt, now) {
7567
8320
  return Math.max(0, Math.floor((now - startedAt) / 1e3));
@@ -7654,11 +8407,119 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7654
8407
  }, "codex client: preset editor remote");
7655
8408
  });
7656
8409
  ready.catch(() => {});
8410
+ let boundRemote;
8411
+ ctx.inject(["remote", "remote.codexPresetEditor"], (remoteCtx) => {
8412
+ boundRemote = remoteCtx.remote;
8413
+ return () => {
8414
+ boundRemote = void 0;
8415
+ };
8416
+ });
8417
+ const resolveCodexPresetEditor = () => {
8418
+ if (boundRemote !== void 0) return boundRemote.codexPresetEditor;
8419
+ const fromCtx = ctx.get?.("remote.codexPresetEditor");
8420
+ if (fromCtx !== void 0) return fromCtx;
8421
+ try {
8422
+ return remote?.codexPresetEditor;
8423
+ } catch {
8424
+ return;
8425
+ }
8426
+ };
7657
8427
  return {
7658
- remote,
8428
+ remote: new Proxy(remote ?? {}, { get(target, prop, receiver) {
8429
+ if (prop === "codexPresetEditor") return resolveCodexPresetEditor();
8430
+ return Reflect.get(target, prop, receiver);
8431
+ } }),
7659
8432
  ready
7660
8433
  };
7661
8434
  }
8435
+ function HarnessUpdateOverlay({ updater, t }) {
8436
+ const snapshot = (0, react.useSyncExternalStore)(updater.subscribe, updater.getSnapshot, updater.getSnapshot);
8437
+ const noticeKey = harnessUpdateNoticeKey(snapshot);
8438
+ const visible = snapshot.status === "update-available" && noticeKey !== void 0 && snapshot.dismissedNotice !== noticeKey && snapshot.latestVersion !== void 0;
8439
+ (0, react.useEffect)(() => {
8440
+ if (visible && noticeKey !== void 0) updater.markShown(noticeKey);
8441
+ }, [
8442
+ visible,
8443
+ noticeKey,
8444
+ updater
8445
+ ]);
8446
+ if (!visible || noticeKey === void 0 || snapshot.latestVersion === void 0) return null;
8447
+ return (0, react_jsx_runtime.jsxs)("div", {
8448
+ role: "status",
8449
+ "aria-label": t("updateHeading"),
8450
+ "data-codex-update-overlay": true,
8451
+ style: {
8452
+ position: "absolute",
8453
+ top: 52,
8454
+ right: 18,
8455
+ zIndex: 30,
8456
+ display: "inline-flex",
8457
+ alignItems: "center",
8458
+ gap: 10,
8459
+ maxWidth: "calc(100vw - 36px)",
8460
+ padding: "6px 10px 6px 12px",
8461
+ border: "0.5px solid var(--dsw-alias-border-l2)",
8462
+ borderRadius: 8,
8463
+ background: "var(--dsw-alias-bg-module-platform, var(--dsw-alias-bg-layer-1))",
8464
+ color: "var(--dsw-alias-label-primary)",
8465
+ boxShadow: "0 4px 16px rgba(0, 0, 0, 0.14)",
8466
+ fontSize: 12,
8467
+ lineHeight: "18px",
8468
+ whiteSpace: "nowrap",
8469
+ boxSizing: "border-box"
8470
+ },
8471
+ children: [
8472
+ (0, react_jsx_runtime.jsxs)("span", {
8473
+ style: {
8474
+ overflow: "hidden",
8475
+ textOverflow: "ellipsis"
8476
+ },
8477
+ children: [
8478
+ "Codex Harness ",
8479
+ t("updateAvailable"),
8480
+ " v",
8481
+ snapshot.latestVersion
8482
+ ]
8483
+ }),
8484
+ snapshot.releaseUrl && (0, react_jsx_runtime.jsx)("a", {
8485
+ href: snapshot.releaseUrl,
8486
+ target: "_blank",
8487
+ rel: "noopener noreferrer",
8488
+ style: {
8489
+ color: "var(--dsw-alias-brand-primary)",
8490
+ textDecoration: "underline",
8491
+ textUnderlineOffset: 2,
8492
+ flexShrink: 0
8493
+ },
8494
+ children: t("updateOpenRelease")
8495
+ }),
8496
+ (0, react_jsx_runtime.jsx)("button", {
8497
+ type: "button",
8498
+ "aria-label": t("updateDismiss"),
8499
+ title: t("updateDismiss"),
8500
+ onClick: () => updater.dismiss(noticeKey),
8501
+ style: {
8502
+ display: "inline-flex",
8503
+ alignItems: "center",
8504
+ justifyContent: "center",
8505
+ width: 20,
8506
+ height: 20,
8507
+ padding: 0,
8508
+ border: 0,
8509
+ borderRadius: 4,
8510
+ background: "transparent",
8511
+ color: "var(--dsw-alias-label-secondary)",
8512
+ font: "inherit",
8513
+ fontSize: 14,
8514
+ lineHeight: 1,
8515
+ cursor: "pointer",
8516
+ flexShrink: 0
8517
+ },
8518
+ children: "×"
8519
+ })
8520
+ ]
8521
+ });
8522
+ }
7662
8523
  function applyWithSettingsApi(ctx, api) {
7663
8524
  ctx.effect(() => ctx.locale.register(NS, {
7664
8525
  en,
@@ -7699,6 +8560,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7699
8560
  }), "codex client: /compact mode picker");
7700
8561
  const settings = api.bind(ctx);
7701
8562
  const presetManager = createPresetManager(ctx);
8563
+ const updateStore = new HarnessUpdateStore(async () => {
8564
+ await presetManager.ready;
8565
+ const check = presetManager.remote.codexPresetEditor?.updateCheck;
8566
+ if (typeof check !== "function") return void 0;
8567
+ const result = await check();
8568
+ return result.ok ? result.value : void 0;
8569
+ });
8570
+ ctx.effect(() => {
8571
+ let active = true;
8572
+ presetManager.ready.then(() => {
8573
+ if (active && typeof presetManager.remote.codexPresetEditor?.updateCheck === "function") updateStore.refresh();
8574
+ }).catch(() => {});
8575
+ return () => {
8576
+ active = false;
8577
+ updateStore.dispose();
8578
+ };
8579
+ }, "codex client: update checker");
7702
8580
  const injected = () => ({
7703
8581
  hooks: { settings },
7704
8582
  setSetting: (field, value) => settings.set(field, value),
@@ -7712,7 +8590,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7712
8590
  locale: NS,
7713
8591
  inject: (sessionId) => ({
7714
8592
  ...injected(),
8593
+ injectedSessionId: typeof sessionId === "string" ? sessionId : sessionId !== void 0 && sessionId !== null ? String(sessionId) : void 0,
7715
8594
  getCodexConnectScope: api.getCodexConnectScope,
8595
+ getLlmProvidersScope: api.getLlmProvidersScope,
7716
8596
  modelDirectory: sessionId === void 0 ? void 0 : ctx.get("modelDirectories")?.directoryFor(sessionId)?.store
7717
8597
  })
7718
8598
  }, ComposerControls));
@@ -7723,133 +8603,70 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7723
8603
  locale: NS,
7724
8604
  inject: injected
7725
8605
  }, ActivityLine));
7726
- ctx.inject(["remote", "remote.codexPresetEditor"], (settingsCtx) => api.register(settingsCtx, settings, presetManager));
8606
+ if (typeof ctx.slots.spec !== "function" || ctx.slots.spec("shell.overlay") !== void 0) ctx.slots.inject("shell.overlay", () => ctx.slots.register({
8607
+ name: "shell.overlay",
8608
+ id: "codex-harness-update",
8609
+ order: 45,
8610
+ locale: NS,
8611
+ inject: () => ({ updater: updateStore })
8612
+ }, HarnessUpdateOverlay));
8613
+ ctx.inject(["remote", "remote.codexPresetEditor"], (settingsCtx) => api.register(settingsCtx, settings, presetManager, updateStore));
7727
8614
  }
7728
8615
  //#endregion
7729
8616
  //#region lib/types/client/desktop.js
7730
8617
  /** A single Settings workspace; the bundle page is only a signpost. */
7731
- function asRecord(value) {
7732
- return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
7733
- }
7734
- function asOverrides(value) {
7735
- const record = asRecord(value);
7736
- if (record === void 0) return void 0;
7737
- const out = {};
7738
- for (const [k, v] of Object.entries(record)) if (v === null || typeof v === "number" && Number.isSafeInteger(v) && v > 0) out[k] = v;
7739
- return out;
7740
- }
7741
- function projectCodexConnectRecord(record, baseRecord, writable) {
7742
- const searchModel = typeof record.searchModel === "string" && record.searchModel.trim() ? record.searchModel.trim() : void 0;
7743
- const imageModelHint = typeof record.imageModelHint === "string" ? record.imageModelHint.trim() : void 0;
7744
- return {
7745
- status: "ready",
7746
- writable,
7747
- overrides: asOverrides(record.contextWindowOverrides),
7748
- baseOverrides: asOverrides(baseRecord?.contextWindowOverrides),
7749
- ...typeof record.enableNativeCompaction === "boolean" ? { nativeCompaction: record.enableNativeCompaction } : {},
7750
- ...typeof record.enableSearch === "boolean" ? { searchEnabled: record.enableSearch } : {},
7751
- ...searchModel !== void 0 ? { searchModel } : {},
7752
- ...typeof record.enableImageGeneration === "boolean" ? { imageGenerationEnabled: record.enableImageGeneration } : {},
7753
- ...imageModelHint !== void 0 ? { imageModelHint } : {}
7754
- };
7755
- }
7756
- function bindCodexConnectScope(configForms) {
7757
- const form = configForms.get(OPENAI_CODEX_SETTINGS_NAMESPACE);
7758
- const mirror = configForms.describe?.();
7759
- Promise.resolve(mirror?.ensure?.()).catch(() => {});
7760
- let lastFormSnap;
7761
- let lastMirrorSnap;
7762
- let projected = {
7763
- status: "loading",
7764
- writable: false
7765
- };
7766
- const getSnapshot = () => {
7767
- const formSnap = form.getSnapshot();
7768
- const mirrorSnap = mirror?.getSnapshot();
7769
- if (formSnap === lastFormSnap && mirrorSnap === lastMirrorSnap) return projected;
7770
- lastFormSnap = formSnap;
7771
- lastMirrorSnap = mirrorSnap;
7772
- const formRecord = formSnap.status === "ready" ? asRecord(formSnap.value) : void 0;
7773
- if (formRecord !== void 0) return projected = projectCodexConnectRecord(formRecord, asRecord(formSnap.base), formSnap.writable);
7774
- const view = mirrorSnap?.view;
7775
- if (view !== void 0) {
7776
- const row = view.namespaces?.find((candidate) => candidate.ns === OPENAI_CODEX_SETTINGS_NAMESPACE);
7777
- const rowRecord = row === void 0 ? void 0 : asRecord(row.value);
7778
- if (row === void 0 || rowRecord === void 0) return projected = {
7779
- status: "unavailable",
7780
- writable: false
7781
- };
7782
- return projected = projectCodexConnectRecord(rowRecord, asRecord(row.base), view.writable ?? formSnap.writable);
7783
- }
7784
- return projected = {
7785
- status: formSnap.status,
7786
- writable: formSnap.writable
7787
- };
7788
- };
7789
- return {
7790
- getSnapshot,
7791
- subscribe: (listener) => {
7792
- const stopForm = form.subscribe(listener);
7793
- const stopMirror = mirror?.subscribe(listener);
7794
- return () => {
7795
- stopForm();
7796
- stopMirror?.();
7797
- };
7798
- },
7799
- setModelOverride: async (modelId, tokens) => {
7800
- const snap = getSnapshot();
7801
- const next = nextOpenAICodexOverrides(snap.overrides, snap.baseOverrides, modelId, tokens);
7802
- if (!(next === void 0 ? await form.unset("contextWindowOverrides") : await form.set("contextWindowOverrides", next))) throw new Error("The host did not accept the settings change.");
7803
- },
7804
- setNativeCompaction: async (enabled) => {
7805
- if (!await form.set("enableNativeCompaction", enabled)) throw new Error("The host did not accept the settings change.");
7806
- }
7807
- };
7808
- }
7809
- function adaptConfigForm(form) {
7810
- const accepted = async (result) => {
7811
- if (!await result) throw new Error("The host did not accept the settings change.");
7812
- };
7813
- return {
7814
- getSnapshot: () => form.getSnapshot(),
7815
- subscribe: (listener) => form.subscribe(listener),
7816
- set: (field, value) => accepted(form.set(field, value)),
7817
- unset: (field) => accepted(form.unset(field))
7818
- };
7819
- }
7820
- async function saveDesktopSettings(form, edits, expectedRevision) {
7821
- const ops = Object.entries(edits).map(([field, value]) => value === void 0 ? {
7822
- op: "unset",
7823
- path: [field]
7824
- } : {
7825
- op: "set",
7826
- path: [field],
7827
- value
7828
- });
7829
- if (!ops.length) return;
7830
- if (!(expectedRevision === void 0 ? await form.mutate(ops) : await form.mutate(ops, expectedRevision))) throw new Error("The host did not accept the settings change.");
7831
- }
8618
+ const DEFAULT_EFFORTS = [
8619
+ "low",
8620
+ "medium",
8621
+ "high",
8622
+ "xhigh",
8623
+ "max"
8624
+ ];
7832
8625
  const desktopStyles = `
7833
8626
  .codex-harness-settings { max-width:760px; min-width:0; font-size:13px; color:var(--dsw-alias-label-primary); }
7834
8627
  .codex-harness-settings h3 { font-size:14px; margin:0 0 10px; }
7835
8628
  .codex-harness-settings .codex-harness-nav { display:flex; align-items:flex-end; gap:20px; margin-bottom:14px; border-bottom:0.5px solid var(--dsw-alias-border-l2); }
7836
8629
  .codex-harness-settings .codex-harness-nav button { position:relative; border:0; padding:7px 1px 9px; background:transparent; color:var(--dsw-alias-label-tertiary, var(--dsw-alias-label-secondary)); font:inherit; font-size:13px; line-height:20px; cursor:pointer; }
8630
+ .codex-harness-settings .codex-harness-nav button[data-nav-align=end] { margin-left:auto; }
7837
8631
  .codex-harness-settings .codex-harness-nav button[aria-pressed=true] { color:var(--dsw-alias-label-primary); font-weight:500; }
7838
8632
  .codex-harness-settings .codex-harness-nav button[aria-pressed=true]::after { position:absolute; right:0; bottom:-1px; left:0; height:2px; border-radius:2px 2px 0 0; background:var(--dsw-alias-label-primary); content:''; }
8633
+ .codex-harness-settings .codex-harness-help-list { margin:0; padding:0; list-style:none; display:flex; flex-direction:column; gap:8px; }
8634
+ .codex-harness-settings .codex-harness-help-list li { display:flex; flex-direction:column; gap:2px; padding-top:8px; border-top:0.5px solid var(--dsw-alias-border-l1); }
8635
+ .codex-harness-settings .codex-harness-help-list li:first-child { padding-top:0; border-top:0; }
8636
+ .codex-harness-settings .codex-harness-help-list strong { font-size:13px; font-weight:600; }
8637
+ .codex-harness-settings .codex-harness-help-list span { font-size:12px; color:var(--dsw-alias-label-secondary); line-height:1.5; }
8638
+ .codex-harness-settings .codex-harness-link { color:var(--dsw-alias-brand-primary); text-decoration:underline; text-underline-offset:2px; font-size:12px; }
8639
+ .codex-harness-settings .codex-harness-inline-row { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:8px; }
8640
+ .codex-harness-settings .codex-harness-update-bar { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:8px; margin-bottom:12px; padding:8px 12px; border-radius:var(--dsw-radius-md, 8px); background:var(--dsw-alias-state-success-bg, rgba(16,163,127,0.1)); border:0.5px solid var(--dsw-alias-border-l2); font-size:12px; }
7839
8641
  .codex-harness-settings button { box-sizing:border-box; min-width:0; max-width:100%; font:inherit; color:inherit; }
7840
8642
  .codex-harness-settings .codex-harness-btn { background:var(--dsw-alias-bg-layer-2); border:0.5px solid var(--dsw-alias-border-l3, var(--dsw-alias-border-l2)); border-radius:var(--dsw-radius-md, 8px); padding:6px 12px; font-size:12px; cursor:pointer; }
7841
8643
  .codex-harness-settings .codex-harness-btn:disabled { opacity:.48; cursor:default; }
7842
8644
  .codex-harness-settings .codex-harness-primary { background:var(--dsw-alias-label-primary); color:var(--dsw-alias-bg-base); border-color:transparent; font-weight:500; }
7843
- .codex-harness-settings :is(input,button):focus-visible { outline:2px solid var(--dsw-focus-ring-color, var(--dsw-alias-brand-primary)); outline-offset:2px; }
8645
+ .codex-harness-settings :is(input,select,button):focus-visible { outline:2px solid var(--dsw-focus-ring-color, var(--dsw-alias-brand-primary)); outline-offset:2px; }
7844
8646
  .codex-harness-settings fieldset { min-width:0; border:0; padding:0; margin:0; display:flex; flex-direction:column; gap:12px; }
7845
8647
  .codex-harness-settings .codex-harness-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,260px),1fr)); gap:12px; }
8648
+ .codex-harness-settings .codex-harness-stack { display:flex; flex-direction:column; gap:12px; }
7846
8649
  .codex-harness-settings .codex-harness-card { border:0.5px solid var(--dsw-alias-settings-card-stroke, var(--dsw-alias-border-l2)); border-radius:var(--dsw-radius-xl, 12px); background:var(--dsw-alias-settings-card-fill, var(--dsw-alias-bg-layer-1)); padding:12px 16px; }
8650
+ .codex-harness-settings details.codex-harness-collapse > summary { display:flex; align-items:center; justify-content:space-between; gap:8px; cursor:pointer; list-style:none; user-select:none; font-size:13px; font-weight:500; }
8651
+ .codex-harness-settings details.codex-harness-collapse > summary::-webkit-details-marker { display:none; }
8652
+ .codex-harness-settings details.codex-harness-collapse[open] > summary { padding-bottom:8px; margin-bottom:8px; border-bottom:0.5px solid var(--dsw-alias-border-l1); }
7847
8653
  .codex-harness-settings .codex-harness-group h4 { margin:0 0 6px; font-size:12px; font-weight:600; color:var(--dsw-alias-label-secondary); }
7848
8654
  .codex-harness-settings .codex-harness-setting-row { min-width:0; display:flex; gap:12px; justify-content:space-between; align-items:center; padding:8px 0; border-bottom:0.5px solid var(--dsw-alias-border-l1); }
7849
8655
  .codex-harness-settings .codex-harness-setting-row:last-child { border-bottom:0; }
8656
+ .codex-harness-settings .codex-harness-cap-row { min-width:0; display:flex; gap:12px; justify-content:space-between; align-items:flex-start; padding:10px 0; border-bottom:0.5px solid var(--dsw-alias-border-l1); }
8657
+ .codex-harness-settings .codex-harness-cap-row:last-child { border-bottom:0; }
8658
+ .codex-harness-settings .codex-harness-cap-info { min-width:0; flex:1 1 240px; display:flex; flex-direction:column; gap:4px; }
8659
+ .codex-harness-settings .codex-harness-cap-head { display:flex; flex-wrap:wrap; align-items:center; gap:6px; }
8660
+ .codex-harness-settings .codex-harness-cap-title { font-size:13px; font-weight:600; }
8661
+ .codex-harness-settings .codex-harness-cap-detail { font-size:12px; color:var(--dsw-alias-label-secondary); line-height:1.45; }
8662
+ .codex-harness-settings .codex-harness-subagent-controls { display:flex; flex-wrap:wrap; gap:8px; margin-top:4px; }
8663
+ .codex-harness-settings .codex-harness-subagent-field { display:inline-flex; align-items:center; gap:6px; font-size:12px; color:var(--dsw-alias-label-secondary); }
8664
+ .codex-harness-settings .codex-harness-subagent-field select { height:28px; padding:0 8px; border:0.5px solid var(--dsw-alias-border-l3, var(--dsw-alias-border-l2)); border-radius:var(--dsw-radius-md, 8px); background:var(--dsw-alias-bg-layer-2); color:var(--dsw-alias-label-primary); font:inherit; font-size:12px; }
8665
+ .codex-harness-settings .codex-harness-badge { font-size:11px; line-height:16px; padding:1px 7px; border-radius:999px; background:var(--dsw-alias-bg-layer-2); color:var(--dsw-alias-label-secondary); border:0.5px solid var(--dsw-alias-border-l2); }
8666
+ .codex-harness-settings .codex-harness-badge[data-tone=ok] { background:var(--dsw-alias-state-success-bg, rgba(16,163,127,0.12)); color:var(--dsw-alias-state-success-primary, #10a37f); border-color:transparent; font-weight:500; }
7850
8667
  .codex-harness-settings .codex-harness-note { margin:0 0 12px; color:var(--dsw-alias-label-secondary); font-size:12px; line-height:1.5; }
7851
- .codex-harness-settings .codex-harness-actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:4px; }
7852
8668
  .codex-harness-settings input[role=switch] { appearance:none; width:34px; height:20px; border:0.5px solid var(--dsw-alias-border-l3, var(--dsw-alias-border-l2)); border-radius:16px; background:var(--dsw-alias-bg-layer-2); position:relative; cursor:pointer; flex-shrink:0; margin:0; transition:background .15s; }
8669
+ .codex-harness-settings input[role=switch]:disabled { opacity:.45; cursor:default; }
7853
8670
  .codex-harness-settings input[role=switch]:before { content:''; position:absolute; width:14px; height:14px; top:2.5px; left:2.5px; border-radius:50%; background:var(--dsw-alias-label-secondary); transition:left .15s, background .15s; }
7854
8671
  .codex-harness-settings input[role=switch]:checked { background:var(--dsw-alias-label-primary); border-color:transparent; }
7855
8672
  .codex-harness-settings input[role=switch]:checked:before { left:16.5px; background:var(--dsw-alias-bg-base); }
@@ -7858,93 +8675,121 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7858
8675
  function DesktopSettingsCard({ t }) {
7859
8676
  return (0, react_jsx_runtime.jsxs)("section", { children: [(0, react_jsx_runtime.jsx)("p", { children: t("settingsBundleSummary") }), (0, react_jsx_runtime.jsx)("p", { children: t("settingsBundlePath") })] });
7860
8677
  }
7861
- /** Kept mounted while inactive, so switching pages preserves runtime drafts. */
7862
- function RuntimeSettingsEditor({ active, ...props }) {
7863
- const { useSettings, saveSettings, t } = props;
8678
+ const EMPTY_CONNECT_SUBSCRIBE = () => () => {};
8679
+ const EMPTY_CONNECT_SNAPSHOT = () => void 0;
8680
+ /** Unified environment-wide settings: live subscription registrations, model requests, and display toggles. */
8681
+ function RuntimeSettingsEditor({ active, connectScope, connectSnapshot, onImageRegistrationChanged, ...props }) {
8682
+ const { useSettings, saveSettings, presetManager, t } = props;
7864
8683
  const snapshot = useSettings((state) => state);
7865
- const [draft, setDraft] = (0, react.useState)();
7866
- const [saving, setSaving] = (0, react.useState)(false);
8684
+ const [busyField, setBusyField] = (0, react.useState)(null);
7867
8685
  const [error, setError] = (0, react.useState)("");
7868
- const edits = draft?.edits ?? {};
7869
- const value = (field) => Object.hasOwn(edits, field) ? edits[field] === void 0 ? snapshot.base?.[field] : edits[field] : snapshot.value?.[field];
7870
- const edit = (field, next) => {
8686
+ const [capBusy, setCapBusy] = (0, react.useState)(null);
8687
+ const [capError, setCapError] = (0, react.useState)("");
8688
+ const [subagentModels, setSubagentModels] = (0, react.useState)();
8689
+ const [subagentModelsStatus, setSubagentModelsStatus] = (0, react.useState)("idle");
8690
+ (0, react.useEffect)(() => {
8691
+ if (!active || presetManager === void 0) return void 0;
8692
+ let alive = true;
8693
+ setSubagentModelsStatus((current) => current === "ready" ? "ready" : "loading");
8694
+ requestCodexSubagentModels(presetManager).then((result) => {
8695
+ if (!alive) return;
8696
+ setSubagentModels(result);
8697
+ setSubagentModelsStatus("ready");
8698
+ }).catch(() => {
8699
+ if (alive) setSubagentModelsStatus("error");
8700
+ });
8701
+ return () => {
8702
+ alive = false;
8703
+ };
8704
+ }, [active, presetManager]);
8705
+ if (!active) return null;
8706
+ const value = (field) => {
8707
+ const raw = snapshot.value?.[field];
8708
+ if (typeof raw === "boolean") return raw;
8709
+ return field !== "fast" && field !== "codexSubagentEnabled";
8710
+ };
8711
+ const saveCodex = (key, edits, refreshTools = false) => {
8712
+ if (busyField !== null || !snapshot.writable || snapshot.status !== "ready") return;
8713
+ setBusyField(key);
7871
8714
  setError("");
7872
- setDraft((current) => ({
7873
- edits: {
7874
- ...current?.edits,
7875
- [field]: next
7876
- },
7877
- revision: current === void 0 ? snapshot.revision : current.revision
7878
- }));
8715
+ saveSettings(edits, snapshot.revision).then(() => {
8716
+ if (refreshTools) onImageRegistrationChanged?.();
8717
+ }).catch(() => setError(t("settingsSharedFailed"))).finally(() => setBusyField((current) => current === key ? null : current));
7879
8718
  };
7880
- const groups = [{
7881
- label: "globalGroupRequest",
7882
- fields: [
7883
- ["fast", "fast"],
7884
- ["hostedWebSearchEnabled", "settingsPreferHostedSearch"],
7885
- ["remoteCompactionEnabled", "settingsPreferRemoteCompaction"]
7886
- ]
7887
- }, {
7888
- label: "globalGroupDisplay",
7889
- fields: [
7890
- ["contextWindowControlEnabled", "contextWindowControl"],
7891
- ["fastModeControlEnabled", "fastModeControl"],
7892
- ["activityIndicatorEnabled", "capabilityActivity"]
7893
- ]
7894
- }];
7895
- if (!active) return null;
8719
+ const connectReady = connectSnapshot?.status === "ready";
8720
+ const connectLoading = connectSnapshot?.status === "loading";
8721
+ const searchRegistered = connectReady && connectSnapshot.searchEnabled === true;
8722
+ const imageRegistered = connectReady && connectSnapshot.imageGenerationEnabled === true;
8723
+ const hostedWebSearch = value("hostedWebSearchEnabled");
8724
+ const canToggleSearch = connectReady && connectSnapshot.writable && connectScope?.setSearchEnabled !== void 0 && capBusy === null;
8725
+ const canToggleImage = connectReady && connectSnapshot.writable && connectScope?.setImageGenerationEnabled !== void 0 && capBusy === null;
8726
+ const subagentAvailable = connectReady || subagentModels?.available === true;
8727
+ const subagentNeedsRestart = subagentModelsStatus === "error";
8728
+ const subagentEnabled = subagentAvailable && value("codexSubagentEnabled");
8729
+ const subagentModel = snapshot.value?.codexSubagentModel?.trim() || "";
8730
+ const subagentEffort = snapshot.value?.codexSubagentEffort?.trim() || "";
8731
+ const subagentPreset = snapshot.value?.codexSubagentPreset?.trim() || "codex-hybrid";
8732
+ const availableModels = subagentModels?.models ?? [];
8733
+ const effectiveModelId = subagentModel || availableModels[0]?.id || "";
8734
+ const selectedModelMeta = availableModels.find((model) => model.id === effectiveModelId);
8735
+ const effortChoices = selectedModelMeta && selectedModelMeta.efforts.length > 0 ? selectedModelMeta.efforts : DEFAULT_EFFORTS;
8736
+ const canEditSubagent = subagentAvailable && !subagentNeedsRestart && snapshot.writable && snapshot.status === "ready" && busyField === null;
8737
+ const toggleRegistration = (kind, next) => {
8738
+ const write = kind === "search" ? connectScope?.setSearchEnabled : connectScope?.setImageGenerationEnabled;
8739
+ if (!write || capBusy !== null || !connectReady || !connectSnapshot.writable) return;
8740
+ setCapBusy(kind);
8741
+ setCapError("");
8742
+ write(next).then(() => {
8743
+ if (kind === "image") onImageRegistrationChanged?.();
8744
+ }).catch(() => setCapError(t("capabilityWriteFailed"))).finally(() => setCapBusy((current) => current === kind ? null : current));
8745
+ };
8746
+ const registrationBadge = (registered, available = connectReady) => (0, react_jsx_runtime.jsx)("span", {
8747
+ className: "codex-harness-badge",
8748
+ "data-tone": registered ? "ok" : void 0,
8749
+ children: available ? t(registered ? "capabilityRegistered" : "capabilityNotRegistered") : t("capabilityUnavailable")
8750
+ });
7896
8751
  return (0, react_jsx_runtime.jsxs)("section", {
7897
8752
  "aria-label": t("settingsRuntimePage"),
8753
+ className: "codex-harness-stack",
7898
8754
  children: [
7899
- (0, react_jsx_runtime.jsxs)("h3", { children: [t("settingsRuntimePage"), (0, react_jsx_runtime.jsxs)("span", {
8755
+ (0, react_jsx_runtime.jsx)("p", {
7900
8756
  className: "codex-harness-note",
7901
- children: [" · ", t("settingsRuntimeScope")]
7902
- })] }),
7903
- (0, react_jsx_runtime.jsx)("form", {
7904
- onSubmit: (event) => {
7905
- event.preventDefault();
7906
- if (saving || draft === void 0 || !snapshot.writable || snapshot.status !== "ready") return;
7907
- setSaving(true);
7908
- setError("");
7909
- const submitted = draft;
7910
- saveSettings(submitted.edits, submitted.revision).then(() => setDraft((current) => current === submitted ? void 0 : current)).catch(() => setError(t("settingsSharedFailed"))).finally(() => setSaving(false));
7911
- },
7912
- children: (0, react_jsx_runtime.jsxs)("fieldset", {
7913
- disabled: !snapshot.writable || snapshot.status !== "ready" || saving,
7914
- children: [(0, react_jsx_runtime.jsx)("div", {
7915
- className: "codex-harness-grid",
7916
- children: groups.map((group) => (0, react_jsx_runtime.jsxs)("div", {
7917
- className: "codex-harness-card codex-harness-group",
7918
- children: [(0, react_jsx_runtime.jsx)("h4", { children: t(group.label) }), group.fields.map(([field, label]) => (0, react_jsx_runtime.jsxs)("label", {
7919
- className: "codex-harness-setting-row",
7920
- children: [(0, react_jsx_runtime.jsx)("span", { children: t(label) }), (0, react_jsx_runtime.jsx)("input", {
7921
- type: "checkbox",
7922
- role: "switch",
7923
- "aria-label": t(label),
7924
- "aria-checked": Boolean(value(field) ?? field !== "fast"),
7925
- checked: Boolean(value(field) ?? field !== "fast"),
7926
- onChange: (event) => edit(field, event.target.checked)
7927
- })]
7928
- }, field))]
7929
- }, group.label))
7930
- }), (0, react_jsx_runtime.jsxs)("div", {
7931
- className: "codex-harness-actions",
7932
- children: [(0, react_jsx_runtime.jsx)("button", {
7933
- className: "codex-harness-btn codex-harness-primary",
7934
- type: "submit",
7935
- disabled: !Object.keys(edits).length,
7936
- children: t(saving ? "promptSaving" : "settingsSaveRuntime")
7937
- }), (0, react_jsx_runtime.jsx)("button", {
7938
- className: "codex-harness-btn",
7939
- type: "button",
7940
- disabled: draft === void 0,
7941
- onClick: () => {
7942
- setDraft(void 0);
7943
- setError("");
7944
- },
7945
- children: t("promptDiscard")
7946
- })]
7947
- })]
8757
+ style: { marginBottom: 0 },
8758
+ children: t("settingsRuntimeScope")
8759
+ }),
8760
+ (0, react_jsx_runtime.jsx)("fieldset", {
8761
+ disabled: !snapshot.writable || snapshot.status !== "ready" || busyField !== null,
8762
+ children: (0, react_jsx_runtime.jsx)("div", {
8763
+ className: "codex-harness-grid",
8764
+ children: [{
8765
+ label: "globalGroupRequest",
8766
+ fields: [
8767
+ ["fast", "fast"],
8768
+ ["hostedWebSearchEnabled", "settingsPreferHostedSearch"],
8769
+ ["remoteCompactionEnabled", "settingsPreferRemoteCompaction"]
8770
+ ]
8771
+ }, {
8772
+ label: "globalGroupDisplay",
8773
+ fields: [
8774
+ ["contextWindowControlEnabled", "contextWindowControl"],
8775
+ ["proModeControlEnabled", "proModeControl"],
8776
+ ["fastModeControlEnabled", "fastModeControl"],
8777
+ ["activityIndicatorEnabled", "capabilityActivity"]
8778
+ ]
8779
+ }].map((group) => (0, react_jsx_runtime.jsxs)("div", {
8780
+ className: "codex-harness-card codex-harness-group",
8781
+ children: [(0, react_jsx_runtime.jsx)("h4", { children: t(group.label) }), group.fields.map(([field, label]) => (0, react_jsx_runtime.jsxs)("label", {
8782
+ className: "codex-harness-setting-row",
8783
+ children: [(0, react_jsx_runtime.jsx)("span", { children: t(label) }), (0, react_jsx_runtime.jsx)("input", {
8784
+ type: "checkbox",
8785
+ role: "switch",
8786
+ "aria-label": t(label),
8787
+ "aria-checked": value(field),
8788
+ checked: value(field),
8789
+ onChange: (event) => saveCodex(field, { [field]: event.target.checked })
8790
+ })]
8791
+ }, field))]
8792
+ }, group.label))
7948
8793
  })
7949
8794
  }),
7950
8795
  !snapshot.writable && (0, react_jsx_runtime.jsx)("p", {
@@ -7954,18 +8799,399 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7954
8799
  error && (0, react_jsx_runtime.jsx)("p", {
7955
8800
  role: "alert",
7956
8801
  children: error
8802
+ }),
8803
+ subagentAvailable ? (0, react_jsx_runtime.jsxs)("div", {
8804
+ className: "codex-harness-card codex-harness-group",
8805
+ "data-capability-group": "connect",
8806
+ children: [
8807
+ (0, react_jsx_runtime.jsx)("h4", { children: t("capabilitiesConnectHeading") }),
8808
+ (0, react_jsx_runtime.jsx)("p", {
8809
+ className: "codex-harness-note",
8810
+ children: t("capabilitiesConnectNote")
8811
+ }),
8812
+ (0, react_jsx_runtime.jsxs)("div", {
8813
+ className: "codex-harness-cap-row",
8814
+ "data-global-capability": "web_search",
8815
+ children: [(0, react_jsx_runtime.jsxs)("div", {
8816
+ className: "codex-harness-cap-info",
8817
+ children: [(0, react_jsx_runtime.jsxs)("div", {
8818
+ className: "codex-harness-cap-head",
8819
+ children: [
8820
+ (0, react_jsx_runtime.jsx)("span", {
8821
+ className: "codex-harness-cap-title",
8822
+ children: t("capabilitySearchTitle")
8823
+ }),
8824
+ (0, react_jsx_runtime.jsx)("code", { children: "web_search" }),
8825
+ registrationBadge(searchRegistered),
8826
+ connectReady && connectSnapshot.searchModel && (0, react_jsx_runtime.jsx)("span", {
8827
+ className: "codex-harness-badge",
8828
+ children: connectSnapshot.searchModel
8829
+ })
8830
+ ]
8831
+ }), (0, react_jsx_runtime.jsx)("span", {
8832
+ className: "codex-harness-cap-detail",
8833
+ children: t(hostedWebSearch ? "capabilitySearchNoteFallback" : "capabilitySearchNoteAll")
8834
+ })]
8835
+ }), (0, react_jsx_runtime.jsx)("input", {
8836
+ type: "checkbox",
8837
+ role: "switch",
8838
+ "aria-label": t("capabilitySearchTitle"),
8839
+ "aria-checked": searchRegistered,
8840
+ checked: searchRegistered,
8841
+ disabled: !canToggleSearch,
8842
+ onChange: (event) => toggleRegistration("search", event.target.checked)
8843
+ })]
8844
+ }),
8845
+ (0, react_jsx_runtime.jsxs)("div", {
8846
+ className: "codex-harness-cap-row",
8847
+ "data-global-capability": "codex_connect_image_generate",
8848
+ children: [(0, react_jsx_runtime.jsxs)("div", {
8849
+ className: "codex-harness-cap-info",
8850
+ children: [(0, react_jsx_runtime.jsxs)("div", {
8851
+ className: "codex-harness-cap-head",
8852
+ children: [
8853
+ (0, react_jsx_runtime.jsx)("span", {
8854
+ className: "codex-harness-cap-title",
8855
+ children: t("capabilityImageTitle")
8856
+ }),
8857
+ (0, react_jsx_runtime.jsx)("code", { children: "codex_connect_image_generate" }),
8858
+ registrationBadge(imageRegistered),
8859
+ connectReady && (0, react_jsx_runtime.jsx)("span", {
8860
+ className: "codex-harness-badge",
8861
+ children: formatGptImageBadge(connectSnapshot.imageModelHint)
8862
+ })
8863
+ ]
8864
+ }), (0, react_jsx_runtime.jsx)("span", {
8865
+ className: "codex-harness-cap-detail",
8866
+ children: t("capabilityImageNote")
8867
+ })]
8868
+ }), (0, react_jsx_runtime.jsx)("input", {
8869
+ type: "checkbox",
8870
+ role: "switch",
8871
+ "aria-label": t("capabilityImageTitle"),
8872
+ "aria-checked": imageRegistered,
8873
+ checked: imageRegistered,
8874
+ disabled: !canToggleImage,
8875
+ onChange: (event) => toggleRegistration("image", event.target.checked)
8876
+ })]
8877
+ }),
8878
+ (0, react_jsx_runtime.jsxs)("div", {
8879
+ className: "codex-harness-cap-row",
8880
+ "data-global-capability": CODEX_SUBAGENT_TOOL_NAME,
8881
+ children: [(0, react_jsx_runtime.jsxs)("div", {
8882
+ className: "codex-harness-cap-info",
8883
+ children: [
8884
+ (0, react_jsx_runtime.jsxs)("div", {
8885
+ className: "codex-harness-cap-head",
8886
+ children: [
8887
+ (0, react_jsx_runtime.jsx)("span", {
8888
+ className: "codex-harness-cap-title",
8889
+ children: t("capabilitySubagentTitle")
8890
+ }),
8891
+ (0, react_jsx_runtime.jsx)("code", { children: CODEX_SUBAGENT_TOOL_NAME }),
8892
+ registrationBadge(subagentEnabled, subagentAvailable),
8893
+ effectiveModelId && (0, react_jsx_runtime.jsxs)("span", {
8894
+ className: "codex-harness-badge",
8895
+ children: [effectiveModelId, subagentEffort ? ` · ${subagentEffort}` : ""]
8896
+ })
8897
+ ]
8898
+ }),
8899
+ (0, react_jsx_runtime.jsx)("span", {
8900
+ className: "codex-harness-cap-detail",
8901
+ children: t("capabilitySubagentNote")
8902
+ }),
8903
+ (0, react_jsx_runtime.jsxs)("div", {
8904
+ className: "codex-harness-subagent-controls",
8905
+ children: [
8906
+ (0, react_jsx_runtime.jsxs)("label", {
8907
+ className: "codex-harness-subagent-field",
8908
+ children: [(0, react_jsx_runtime.jsx)("span", { children: t("capabilitySubagentModel") }), (0, react_jsx_runtime.jsxs)("select", {
8909
+ "aria-label": t("capabilitySubagentModel"),
8910
+ value: effectiveModelId,
8911
+ disabled: !canEditSubagent || availableModels.length === 0 && !subagentModel,
8912
+ onChange: (event) => {
8913
+ const nextModel = event.target.value;
8914
+ if (!nextModel) return;
8915
+ const targetMeta = availableModels.find((model) => model.id === nextModel);
8916
+ const keepEffort = !subagentEffort || !targetMeta?.efforts.length || targetMeta.efforts.includes(subagentEffort);
8917
+ saveCodex("codexSubagentModel", {
8918
+ codexSubagentModel: nextModel,
8919
+ ...keepEffort ? {} : { codexSubagentEffort: void 0 }
8920
+ });
8921
+ },
8922
+ children: [
8923
+ availableModels.length === 0 && !subagentModel && (0, react_jsx_runtime.jsx)("option", {
8924
+ value: "",
8925
+ children: t(subagentNeedsRestart ? "capabilitySubagentRestart" : subagentModelsStatus === "loading" ? "capabilityLoading" : "capabilitySubagentNoModels")
8926
+ }),
8927
+ subagentModel && !availableModels.some((model) => model.id === subagentModel) && (0, react_jsx_runtime.jsx)("option", {
8928
+ value: subagentModel,
8929
+ children: subagentModel
8930
+ }),
8931
+ availableModels.map((model) => (0, react_jsx_runtime.jsx)("option", {
8932
+ value: model.id,
8933
+ children: model.id
8934
+ }, model.id))
8935
+ ]
8936
+ })]
8937
+ }),
8938
+ (0, react_jsx_runtime.jsxs)("label", {
8939
+ className: "codex-harness-subagent-field",
8940
+ children: [(0, react_jsx_runtime.jsx)("span", { children: t("capabilitySubagentEffort") }), (0, react_jsx_runtime.jsxs)("select", {
8941
+ "aria-label": t("capabilitySubagentEffort"),
8942
+ value: subagentEffort,
8943
+ disabled: !canEditSubagent,
8944
+ onChange: (event) => {
8945
+ saveCodex("codexSubagentEffort", { codexSubagentEffort: event.target.value || void 0 });
8946
+ },
8947
+ children: [
8948
+ (0, react_jsx_runtime.jsx)("option", {
8949
+ value: "",
8950
+ children: t("capabilitySubagentEffortDefault")
8951
+ }),
8952
+ subagentEffort && !effortChoices.includes(subagentEffort) && (0, react_jsx_runtime.jsx)("option", {
8953
+ value: subagentEffort,
8954
+ children: subagentEffort
8955
+ }),
8956
+ effortChoices.map((effort) => (0, react_jsx_runtime.jsx)("option", {
8957
+ value: effort,
8958
+ children: effort
8959
+ }, effort))
8960
+ ]
8961
+ })]
8962
+ }),
8963
+ (0, react_jsx_runtime.jsxs)("label", {
8964
+ className: "codex-harness-subagent-field",
8965
+ children: [(0, react_jsx_runtime.jsx)("span", { children: t("capabilitySubagentPreset") }), (0, react_jsx_runtime.jsxs)("select", {
8966
+ "aria-label": t("capabilitySubagentPreset"),
8967
+ value: subagentPreset,
8968
+ disabled: !canEditSubagent,
8969
+ onChange: (event) => {
8970
+ saveCodex("codexSubagentPreset", { codexSubagentPreset: event.target.value });
8971
+ },
8972
+ children: [
8973
+ (0, react_jsx_runtime.jsx)("option", {
8974
+ value: CODEX_SUBAGENT_DEFAULT_PRESET,
8975
+ children: t("capabilitySubagentPresetHybrid")
8976
+ }),
8977
+ (0, react_jsx_runtime.jsx)("option", {
8978
+ value: CODEX_SUBAGENT_PRESET_INHERIT,
8979
+ children: t("capabilitySubagentPresetInherit")
8980
+ }),
8981
+ subagentPreset !== "codex-hybrid" && subagentPreset !== "inherit" && (0, react_jsx_runtime.jsx)("option", {
8982
+ value: subagentPreset,
8983
+ children: subagentPreset
8984
+ })
8985
+ ]
8986
+ })]
8987
+ })
8988
+ ]
8989
+ })
8990
+ ]
8991
+ }), (0, react_jsx_runtime.jsx)("input", {
8992
+ type: "checkbox",
8993
+ role: "switch",
8994
+ "aria-label": t("capabilitySubagentTitle"),
8995
+ "aria-checked": subagentEnabled,
8996
+ checked: subagentEnabled,
8997
+ disabled: !canEditSubagent,
8998
+ onChange: (event) => {
8999
+ const next = event.target.checked;
9000
+ saveCodex("codexSubagentEnabled", {
9001
+ codexSubagentEnabled: next,
9002
+ ...next && !subagentModel && effectiveModelId ? { codexSubagentModel: effectiveModelId } : {}
9003
+ }, true);
9004
+ }
9005
+ })]
9006
+ }),
9007
+ connectReady && !connectSnapshot.writable && (0, react_jsx_runtime.jsx)("p", {
9008
+ className: "codex-harness-note",
9009
+ children: t("promptReadOnly")
9010
+ }),
9011
+ capError && (0, react_jsx_runtime.jsx)("p", {
9012
+ role: "alert",
9013
+ children: capError
9014
+ })
9015
+ ]
9016
+ }) : (0, react_jsx_runtime.jsxs)("details", {
9017
+ className: "codex-harness-card codex-harness-collapse",
9018
+ "data-capability-group": "connect",
9019
+ "data-collapsed": "true",
9020
+ children: [(0, react_jsx_runtime.jsxs)("summary", { children: [(0, react_jsx_runtime.jsx)("span", { children: t("capabilitiesConnectCollapsedTitle") }), connectLoading && (0, react_jsx_runtime.jsx)("span", {
9021
+ className: "codex-harness-badge",
9022
+ children: t("capabilityLoading")
9023
+ })] }), (0, react_jsx_runtime.jsxs)("div", {
9024
+ className: "codex-harness-inline-row",
9025
+ children: [(0, react_jsx_runtime.jsx)("span", {
9026
+ className: "codex-harness-cap-detail",
9027
+ children: t("capabilitiesConnectInstallHint")
9028
+ }), (0, react_jsx_runtime.jsx)("a", {
9029
+ className: "codex-harness-link",
9030
+ href: CODEX_CONNECT_REPO_URL,
9031
+ target: "_blank",
9032
+ rel: "noopener noreferrer",
9033
+ children: "github.com/shuind/dsh-codex-connect"
9034
+ })]
9035
+ })]
7957
9036
  })
7958
9037
  ]
7959
9038
  });
7960
9039
  }
7961
- const EMPTY_CONNECT_SUBSCRIBE = () => () => {};
7962
- const EMPTY_CONNECT_SNAPSHOT = () => void 0;
9040
+ const EMPTY_UPDATE_SNAPSHOT = () => void 0;
9041
+ function HelpGuideSection({ active, updateStore, updateSnapshot, t }) {
9042
+ if (!active) return null;
9043
+ const cards = [{
9044
+ id: "faq",
9045
+ heading: "helpFaqHeading",
9046
+ items: [
9047
+ ["helpDeferDisabledTitle", "helpDeferDisabledDesc"],
9048
+ ["helpDeferLifecycleTitle", "helpDeferLifecycleDesc"],
9049
+ ["helpNativeSearchTitle", "helpNativeSearchDesc"]
9050
+ ]
9051
+ }, {
9052
+ id: "connect",
9053
+ heading: "helpConnectHeading",
9054
+ items: [
9055
+ ["helpRegistrationScopeTitle", "helpRegistrationScopeDesc"],
9056
+ ["helpProComboTitle", "helpProComboDesc"],
9057
+ ["helpConnectContextTitle", "helpConnectContextDesc"]
9058
+ ]
9059
+ }];
9060
+ const status = updateSnapshot?.status ?? "idle";
9061
+ const currentVersion = updateSnapshot?.currentVersion;
9062
+ const hasUpdate = status === "update-available" && updateSnapshot?.latestVersion !== void 0;
9063
+ return (0, react_jsx_runtime.jsxs)("section", {
9064
+ "aria-label": t("settingsHelpPage"),
9065
+ className: "codex-harness-stack",
9066
+ children: [cards.map((card) => (0, react_jsx_runtime.jsxs)("div", {
9067
+ className: "codex-harness-card codex-harness-group",
9068
+ "data-help-section": card.id,
9069
+ children: [
9070
+ (0, react_jsx_runtime.jsx)("h4", { children: t(card.heading) }),
9071
+ (0, react_jsx_runtime.jsx)("ul", {
9072
+ className: "codex-harness-help-list",
9073
+ children: card.items.map(([titleKey, descKey]) => (0, react_jsx_runtime.jsxs)("li", { children: [(0, react_jsx_runtime.jsx)("strong", { children: t(titleKey) }), (0, react_jsx_runtime.jsx)("span", { children: t(descKey) })] }, titleKey))
9074
+ }),
9075
+ card.id === "connect" && (0, react_jsx_runtime.jsxs)("div", {
9076
+ className: "codex-harness-inline-row",
9077
+ style: {
9078
+ marginTop: 10,
9079
+ paddingTop: 8,
9080
+ borderTop: "0.5px solid var(--dsw-alias-border-l1)"
9081
+ },
9082
+ children: [(0, react_jsx_runtime.jsxs)("span", {
9083
+ className: "codex-harness-cap-detail",
9084
+ children: [
9085
+ t("helpConnectLinkLabel"),
9086
+ " · ",
9087
+ (0, react_jsx_runtime.jsx)("code", { children: "@shuind/dsh-codex-connect" })
9088
+ ]
9089
+ }), (0, react_jsx_runtime.jsx)("a", {
9090
+ className: "codex-harness-link",
9091
+ href: "https://github.com/shuind/dsh-codex-connect",
9092
+ target: "_blank",
9093
+ rel: "noopener noreferrer",
9094
+ children: "github.com/shuind/dsh-codex-connect"
9095
+ })]
9096
+ })
9097
+ ]
9098
+ }, card.id)), (0, react_jsx_runtime.jsxs)("div", {
9099
+ className: "codex-harness-card codex-harness-group",
9100
+ "data-help-section": "updates",
9101
+ children: [
9102
+ (0, react_jsx_runtime.jsx)("h4", { children: t("helpUpdateHeading") }),
9103
+ (0, react_jsx_runtime.jsxs)("div", {
9104
+ className: "codex-harness-inline-row",
9105
+ style: { marginBottom: 8 },
9106
+ children: [(0, react_jsx_runtime.jsxs)("div", {
9107
+ className: "codex-harness-cap-head",
9108
+ children: [
9109
+ (0, react_jsx_runtime.jsxs)("span", {
9110
+ className: "codex-harness-cap-title",
9111
+ children: ["Codex Harness", currentVersion ? ` v${currentVersion}` : ""]
9112
+ }),
9113
+ hasUpdate && (0, react_jsx_runtime.jsxs)("span", {
9114
+ className: "codex-harness-badge",
9115
+ "data-tone": "ok",
9116
+ children: [
9117
+ t("updateAvailable"),
9118
+ " v",
9119
+ updateSnapshot.latestVersion
9120
+ ]
9121
+ }),
9122
+ status === "up-to-date" && (0, react_jsx_runtime.jsx)("span", {
9123
+ className: "codex-harness-badge",
9124
+ children: t("updateUpToDate")
9125
+ }),
9126
+ status === "checking" && (0, react_jsx_runtime.jsx)("span", {
9127
+ className: "codex-harness-badge",
9128
+ children: t("updateChecking")
9129
+ }),
9130
+ status === "unavailable" && (0, react_jsx_runtime.jsx)("span", {
9131
+ className: "codex-harness-badge",
9132
+ children: t("updateUnavailable")
9133
+ })
9134
+ ]
9135
+ }), updateStore && (0, react_jsx_runtime.jsx)("button", {
9136
+ type: "button",
9137
+ className: "codex-harness-btn",
9138
+ disabled: status === "checking",
9139
+ onClick: () => {
9140
+ updateStore.refresh(true);
9141
+ },
9142
+ children: t("updateCheckNow")
9143
+ })]
9144
+ }),
9145
+ (0, react_jsx_runtime.jsx)("p", {
9146
+ className: "codex-harness-note",
9147
+ style: { marginBottom: 6 },
9148
+ children: t("updateHowTo")
9149
+ }),
9150
+ (0, react_jsx_runtime.jsxs)("div", {
9151
+ className: "codex-harness-cap-head",
9152
+ children: [hasUpdate && updateSnapshot.releaseUrl && (0, react_jsx_runtime.jsxs)("a", {
9153
+ className: "codex-harness-link",
9154
+ href: updateSnapshot.releaseUrl,
9155
+ target: "_blank",
9156
+ rel: "noopener noreferrer",
9157
+ children: [
9158
+ t("updateOpenRelease"),
9159
+ " (v",
9160
+ updateSnapshot.latestVersion,
9161
+ ")"
9162
+ ]
9163
+ }), (0, react_jsx_runtime.jsx)("a", {
9164
+ className: "codex-harness-link",
9165
+ href: CODEX_HARNESS_RELEASES_URL,
9166
+ target: "_blank",
9167
+ rel: "noopener noreferrer",
9168
+ children: "GitHub Releases"
9169
+ })]
9170
+ })
9171
+ ]
9172
+ })]
9173
+ });
9174
+ }
7963
9175
  function CodexSettingsTab(props) {
7964
- const { toolPolicy, presetManager, getCodexConnectScope, t } = props;
9176
+ const { toolPolicy, presetManager, getCodexConnectScope, updateStore, t } = props;
7965
9177
  const [page, setPage] = (0, react.useState)(props.initialPage ?? "tools");
9178
+ const [toolsVersion, setToolsVersion] = (0, react.useState)(0);
7966
9179
  const settingsSnapshot = typeof props.useSettings === "function" ? props.useSettings((state) => state) : void 0;
7967
9180
  const connectScope = getCodexConnectScope?.();
7968
9181
  const connectSnapshot = (0, react.useSyncExternalStore)(connectScope ? connectScope.subscribe : EMPTY_CONNECT_SUBSCRIBE, connectScope ? connectScope.getSnapshot : EMPTY_CONNECT_SNAPSHOT, connectScope ? connectScope.getSnapshot : EMPTY_CONNECT_SNAPSHOT);
9182
+ const updateSnapshot = (0, react.useSyncExternalStore)(updateStore ? updateStore.subscribe : EMPTY_CONNECT_SUBSCRIBE, updateStore ? updateStore.getSnapshot : EMPTY_UPDATE_SNAPSHOT, updateStore ? updateStore.getSnapshot : EMPTY_UPDATE_SNAPSHOT);
9183
+ const hasUpdate = updateSnapshot?.status === "update-available" && updateSnapshot.latestVersion !== void 0;
9184
+ const imageEnabled = connectSnapshot?.status === "ready" ? connectSnapshot.imageGenerationEnabled === true : void 0;
9185
+ const subagentEnabled = settingsSnapshot?.status === "ready" ? settingsSnapshot.value?.codexSubagentEnabled === true : void 0;
9186
+ const prevRegistration = (0, react.useRef)();
9187
+ const registrationKey = `${String(imageEnabled)}:${String(subagentEnabled)}`;
9188
+ (0, react.useEffect)(() => {
9189
+ if (prevRegistration.current !== void 0 && prevRegistration.current !== registrationKey) {
9190
+ if (presetManager !== void 0) invalidatePresetTools(presetManager);
9191
+ setToolsVersion((version) => version + 1);
9192
+ }
9193
+ prevRegistration.current = registrationKey;
9194
+ }, [registrationKey, presetManager]);
7969
9195
  const gptCapabilities = resolveGptCapabilities(settingsSnapshot?.value, connectSnapshot);
7970
9196
  const mode = page === "tools" ? "tools" : "inactive";
7971
9197
  return (0, react_jsx_runtime.jsxs)("section", {
@@ -7975,16 +9201,48 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7975
9201
  (0, react_jsx_runtime.jsxs)("nav", {
7976
9202
  className: "codex-harness-nav",
7977
9203
  "aria-label": t("settingsTabLabel"),
7978
- children: [(0, react_jsx_runtime.jsx)("button", {
7979
- type: "button",
7980
- "aria-pressed": page === "tools",
7981
- onClick: () => setPage("tools"),
7982
- children: t("settingsToolsPage")
7983
- }), (0, react_jsx_runtime.jsx)("button", {
7984
- type: "button",
7985
- "aria-pressed": page === "runtime",
7986
- onClick: () => setPage("runtime"),
7987
- children: t("settingsRuntimePage")
9204
+ children: [
9205
+ (0, react_jsx_runtime.jsx)("button", {
9206
+ type: "button",
9207
+ "aria-pressed": page === "tools",
9208
+ onClick: () => setPage("tools"),
9209
+ children: t("settingsToolsPage")
9210
+ }),
9211
+ (0, react_jsx_runtime.jsx)("button", {
9212
+ type: "button",
9213
+ "aria-pressed": page === "runtime",
9214
+ onClick: () => setPage("runtime"),
9215
+ children: t("settingsRuntimePage")
9216
+ }),
9217
+ (0, react_jsx_runtime.jsx)("button", {
9218
+ type: "button",
9219
+ "data-nav-align": "end",
9220
+ "aria-pressed": page === "help",
9221
+ onClick: () => setPage("help"),
9222
+ children: hasUpdate ? (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [t("settingsHelpPage"), (0, react_jsx_runtime.jsx)("span", {
9223
+ className: "codex-harness-badge",
9224
+ "data-tone": "ok",
9225
+ style: { marginLeft: 6 },
9226
+ children: t("updateBadge")
9227
+ })] }) : t("settingsHelpPage")
9228
+ })
9229
+ ]
9230
+ }),
9231
+ hasUpdate && (0, react_jsx_runtime.jsxs)("div", {
9232
+ className: "codex-harness-update-bar",
9233
+ role: "status",
9234
+ "data-codex-update-banner": true,
9235
+ children: [(0, react_jsx_runtime.jsxs)("span", { children: [
9236
+ "Codex Harness ",
9237
+ t("updateAvailable"),
9238
+ " v",
9239
+ updateSnapshot.latestVersion
9240
+ ] }), updateSnapshot.releaseUrl && (0, react_jsx_runtime.jsx)("a", {
9241
+ className: "codex-harness-link",
9242
+ href: updateSnapshot.releaseUrl,
9243
+ target: "_blank",
9244
+ rel: "noopener noreferrer",
9245
+ children: t("updateOpenRelease")
7988
9246
  })]
7989
9247
  }),
7990
9248
  toolPolicy !== void 0 && (0, react_jsx_runtime.jsx)(ToolPolicySection, {
@@ -7992,11 +9250,24 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7992
9250
  presetManager,
7993
9251
  mode,
7994
9252
  gptCapabilities,
9253
+ toolsVersion,
7995
9254
  t
7996
9255
  }),
7997
9256
  (0, react_jsx_runtime.jsx)(RuntimeSettingsEditor, {
7998
9257
  ...props,
7999
- active: page === "runtime"
9258
+ active: page === "runtime",
9259
+ connectScope,
9260
+ connectSnapshot,
9261
+ onImageRegistrationChanged: () => {
9262
+ if (presetManager !== void 0) invalidatePresetTools(presetManager);
9263
+ setToolsVersion((version) => version + 1);
9264
+ }
9265
+ }),
9266
+ (0, react_jsx_runtime.jsx)(HelpGuideSection, {
9267
+ active: page === "help",
9268
+ updateStore,
9269
+ updateSnapshot,
9270
+ t
8000
9271
  })
8001
9272
  ]
8002
9273
  });
@@ -8004,6 +9275,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8004
9275
  function apply$1(ctx) {
8005
9276
  let form;
8006
9277
  let connectScope;
9278
+ let llmProvidersScope;
8007
9279
  const getCodexConnectScope = () => {
8008
9280
  try {
8009
9281
  return connectScope ??= bindCodexConnectScope(ctx.configForms);
@@ -8011,13 +9283,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8011
9283
  return;
8012
9284
  }
8013
9285
  };
9286
+ const getLlmProvidersScope = () => {
9287
+ try {
9288
+ return llmProvidersScope ??= bindLlmProvidersScope(ctx.configForms);
9289
+ } catch {
9290
+ return;
9291
+ }
9292
+ };
8014
9293
  applyWithSettingsApi(ctx, {
8015
9294
  bind: (host) => {
8016
9295
  form = host.configForms.get("codex");
8017
9296
  return adaptConfigForm(form);
8018
9297
  },
8019
9298
  getCodexConnectScope,
8020
- register: (host, settings, manager) => {
9299
+ getLlmProvidersScope,
9300
+ register: (host, settings, manager, updateStore) => {
8021
9301
  const desktop = host;
8022
9302
  const presetManager = {
8023
9303
  ...manager,
@@ -8031,6 +9311,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8031
9311
  unsetSetting: (field) => settings.unset(field),
8032
9312
  presetManager,
8033
9313
  toolPolicy,
9314
+ updateStore,
8034
9315
  getCodexConnectScope,
8035
9316
  saveSettings: async (edits, revision) => {
8036
9317
  await saveDesktopSettings(form, edits, revision);