@shuind/dsh-codex-harness 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js CHANGED
@@ -172,7 +172,7 @@ window.__ModuleLoader__.load({
172
172
  };
173
173
  }
174
174
  //#endregion
175
- //#region node_modules/zod/v4/core/util.js
175
+ //#region node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/util.js
176
176
  function getEnumValues(entries) {
177
177
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
178
178
  return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
@@ -706,7 +706,7 @@ window.__ModuleLoader__.load({
706
706
  return fn;
707
707
  }
708
708
  //#endregion
709
- //#region node_modules/zod/v4/core/core.js
709
+ //#region node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/core.js
710
710
  var _a$1;
711
711
  const _zodDesc = {
712
712
  value: void 0,
@@ -812,7 +812,7 @@ window.__ModuleLoader__.load({
812
812
  return globalConfig;
813
813
  }
814
814
  //#endregion
815
- //#region node_modules/zod/v4/core/errors.js
815
+ //#region node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/errors.js
816
816
  function _getMessage() {
817
817
  const internals = this._zod;
818
818
  internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
@@ -928,7 +928,7 @@ window.__ModuleLoader__.load({
928
928
  return fieldErrors;
929
929
  }
930
930
  //#endregion
931
- //#region node_modules/zod/v4/core/parse.js
931
+ //#region node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/parse.js
932
932
  function finalizeParams(callee, params) {
933
933
  return {
934
934
  callee: params?.callee ?? callee,
@@ -1131,7 +1131,7 @@ window.__ModuleLoader__.load({
1131
1131
  return _safeParseAsync(_Err)(schema, value, _ctx);
1132
1132
  };
1133
1133
  //#endregion
1134
- //#region node_modules/zod/v4/core/regexes.js
1134
+ //#region node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/regexes.js
1135
1135
  /**
1136
1136
  * @deprecated CUID v1 is deprecated by its authors due to information leakage
1137
1137
  * (timestamps embedded in the id). Use {@link cuid2} instead.
@@ -1202,7 +1202,7 @@ window.__ModuleLoader__.load({
1202
1202
  const lowercase = /^[^A-Z]*$/;
1203
1203
  const uppercase = /^[^a-z]*$/;
1204
1204
  //#endregion
1205
- //#region node_modules/zod/v4/core/checks.js
1205
+ //#region node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/checks.js
1206
1206
  const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
1207
1207
  var _a;
1208
1208
  inst._zod ?? (inst._zod = {});
@@ -1498,7 +1498,7 @@ window.__ModuleLoader__.load({
1498
1498
  };
1499
1499
  });
1500
1500
  //#endregion
1501
- //#region node_modules/zod/v4/core/doc.js
1501
+ //#region node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/doc.js
1502
1502
  var Doc = class {
1503
1503
  constructor(args = [], closed = {}) {
1504
1504
  this.content = [];
@@ -1532,14 +1532,14 @@ window.__ModuleLoader__.load({
1532
1532
  }
1533
1533
  };
1534
1534
  //#endregion
1535
- //#region node_modules/zod/v4/core/versions.js
1535
+ //#region node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/versions.js
1536
1536
  const version = {
1537
1537
  major: 4,
1538
1538
  minor: 6,
1539
1539
  patch: 6
1540
1540
  };
1541
1541
  //#endregion
1542
- //#region node_modules/zod/v4/core/schemas.js
1542
+ //#region node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/schemas.js
1543
1543
  const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
1544
1544
  var _a;
1545
1545
  inst ?? (inst = {});
@@ -2798,7 +2798,7 @@ window.__ModuleLoader__.load({
2798
2798
  }
2799
2799
  }
2800
2800
  //#endregion
2801
- //#region node_modules/zod/v4/core/memoizer.js
2801
+ //#region node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/memoizer.js
2802
2802
  var $ZodCyclicError = class extends Error {
2803
2803
  constructor() {
2804
2804
  super(`Cannot parse a reference cycle that closes through a transform`);
@@ -3051,7 +3051,7 @@ window.__ModuleLoader__.load({
3051
3051
  return backEdges !== void 0 && isRef(value) && backEdges.has(value);
3052
3052
  }
3053
3053
  //#endregion
3054
- //#region node_modules/zod/v4/locales/en.js
3054
+ //#region node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/locales/en.js
3055
3055
  const error = () => {
3056
3056
  const Sizable = {
3057
3057
  string: {
@@ -3159,7 +3159,7 @@ window.__ModuleLoader__.load({
3159
3159
  return { localeError: error() };
3160
3160
  }
3161
3161
  //#endregion
3162
- //#region node_modules/zod/v4/core/registries.js
3162
+ //#region node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/registries.js
3163
3163
  var _a;
3164
3164
  var $ZodRegistry = class {
3165
3165
  constructor() {
@@ -3206,7 +3206,7 @@ window.__ModuleLoader__.load({
3206
3206
  (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
3207
3207
  const globalRegistry = globalThis.__zod_globalRegistry;
3208
3208
  //#endregion
3209
- //#region node_modules/zod/v4/core/api.js
3209
+ //#region node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/api.js
3210
3210
  function snapshotChecks(def) {
3211
3211
  if (def.checks) def.checks = [...def.checks];
3212
3212
  return def;
@@ -3715,7 +3715,7 @@ window.__ModuleLoader__.load({
3715
3715
  return ch;
3716
3716
  }
3717
3717
  //#endregion
3718
- //#region node_modules/zod/v4/core/to-json-schema.js
3718
+ //#region node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/to-json-schema.js
3719
3719
  function assignProps(target, ...sources) {
3720
3720
  for (const source of sources) for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProp(target, key, source[key]);
3721
3721
  return target;
@@ -4159,7 +4159,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4159
4159
  return finalize(ctx, schema);
4160
4160
  };
4161
4161
  //#endregion
4162
- //#region node_modules/zod/v4/core/json-schema-processors.js
4162
+ //#region node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/json-schema-processors.js
4163
4163
  const narrowMin = (agg, key, value) => {
4164
4164
  if (agg[key] === void 0 || value > agg[key]) agg[key] = value;
4165
4165
  };
@@ -4506,7 +4506,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4506
4506
  seen.ref = def.innerType;
4507
4507
  };
4508
4508
  //#endregion
4509
- //#region node_modules/zod/v4/classic/errors.js
4509
+ //#region node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/classic/errors.js
4510
4510
  const _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
4511
4511
  function _lazyMethod(proto, key, make) {
4512
4512
  Object.defineProperty(proto, key, {
@@ -4556,7 +4556,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4556
4556
  };
4557
4557
  const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, void 0, { Parent: Error });
4558
4558
  //#endregion
4559
- //#region node_modules/zod/v4/classic/parse.js
4559
+ //#region node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/classic/parse.js
4560
4560
  const parse = /* @__PURE__ */ _parse(ZodRealError);
4561
4561
  const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
4562
4562
  const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
@@ -4570,7 +4570,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4570
4570
  const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
4571
4571
  const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
4572
4572
  //#endregion
4573
- //#region node_modules/zod/v4/classic/schemas.js
4573
+ //#region node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/classic/schemas.js
4574
4574
  function _ensureDefaultLocale() {
4575
4575
  if (!globalConfig.localeError) config(en_default());
4576
4576
  }
@@ -6112,6 +6112,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6112
6112
  toolPolicyConditional: "Conditional",
6113
6113
  toolPolicyTargetExists: "Replacement target already exists",
6114
6114
  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",
6115
6126
  toolPolicyCommandGroup: "Commands & runtime",
6116
6127
  toolPolicyFileGroup: "Files & search",
6117
6128
  toolPolicyPlanGroup: "Planning & interaction",
@@ -6279,6 +6290,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6279
6290
  toolPolicyConditional: "按条件可用",
6280
6291
  toolPolicyTargetExists: "替换目标已存在",
6281
6292
  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: "非工具 · 运行偏好控制",
6282
6304
  toolPolicyCommandGroup: "命令与执行",
6283
6305
  toolPolicyFileGroup: "文件与检索",
6284
6306
  toolPolicyPlanGroup: "规划与交互",
@@ -6456,7 +6478,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6456
6478
  "team_task_list",
6457
6479
  "team_task_update"
6458
6480
  ]);
6459
- function groupOf(tool) {
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";
6460
6484
  if (commandNames.has(tool.name) || tool.replacements.some((item) => item.action === "codex-exec")) return "command";
6461
6485
  if (fileNames.has(tool.name) || tool.replacements.some((item) => item.action === "codex-patch")) return "file";
6462
6486
  if (planNames.has(tool.name) || tool.replacements.some((item) => item.action === "codex-plan")) return "plan";
@@ -6583,6 +6607,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6583
6607
  .codex-tool-policy .codex-tool-policy-description { font-size:12px; color:var(--dsw-alias-label-secondary); }
6584
6608
  .codex-tool-policy .codex-badge { font-size:11px; line-height:16px; padding:1px 6px; 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); }
6585
6609
  .codex-tool-policy .codex-badge[data-tone=blue] { background:var(--dsw-alias-interactive-bg-selected, rgba(59,130,246,0.12)); color:var(--dsw-static-blue-500, var(--dsw-alias-brand-primary)); border-color:transparent; }
6610
+ .codex-tool-policy .codex-badge[data-tone=gpt] { 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; }
6586
6611
  .codex-tool-policy .codex-badge[data-tone=warn] { color:var(--dsw-alias-state-warn-primary); }
6587
6612
  .codex-tool-policy .codex-tool-policy-action { display:flex; align-items:center; gap:6px; flex-shrink:0; }
6588
6613
  .codex-tool-policy .codex-tool-policy-prompts { display:flex; flex-direction:column; gap:10px; }
@@ -6661,8 +6686,31 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6661
6686
  value
6662
6687
  }], revision);
6663
6688
  }
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
+ }
6664
6708
  const isPromptName = (name) => PRESET_PROMPT_NAMES.includes(name);
6665
6709
  const GROUP_META = [
6710
+ {
6711
+ id: "gpt",
6712
+ labelKey: "toolPolicyGptGroup"
6713
+ },
6666
6714
  {
6667
6715
  id: "command",
6668
6716
  labelKey: "toolPolicyCommandGroup"
@@ -6691,7 +6739,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6691
6739
  ...props
6692
6740
  });
6693
6741
  }
6694
- function ToolPolicySettingsCard({ form, presetManager, mode = "tools", t }) {
6742
+ function ToolPolicySettingsCard({ form, presetManager, mode = "tools", gptCapabilities, t }) {
6695
6743
  const snapshot = (0, react.useSyncExternalStore)((listener) => form.subscribe(listener), () => form.getSnapshot(), () => form.getSnapshot());
6696
6744
  const [subMode, setSubMode] = (0, react.useState)(mode === "prompts" || mode === "definition" ? mode : "tools");
6697
6745
  const prevMode = (0, react.useRef)(mode);
@@ -6950,131 +6998,200 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6950
6998
  const changedPrompts = currentDraft ? [...new Set([...beforeRule?.promptOverrides ?? [], ...rule?.promptOverrides ?? []].map((entry) => entry.name))].filter((name) => JSON.stringify(beforeRule?.promptOverrides?.find((entry) => entry.name === name)) !== JSON.stringify(rule?.promptOverrides?.find((entry) => entry.name === name))) : [];
6951
6999
  const changeSummary = [...changedNames.length ? [`${t("presetSummaryTools")}: ${changedNames.slice(0, 4).join(", ")}${changedNames.length > 4 ? ` (+${changedNames.length - 4})` : ""}`] : [], ...changedPrompts.length ? [`${t("presetSummaryPrompts")}: ${changedPrompts.map((name) => promptCatalog?.sections.find((section) => section.name === name)?.label || name).join(", ")}`] : []].join(" · ") || t(currentDraft && !sameRules(beforeTarget, currentDraft.rules) ? "toolPolicyRuleChanged" : "toolPolicyNoToolDelta");
6952
7000
  const unavailable = (reason) => t(reason === "conditional" ? "toolPolicyConditional" : reason === "target-exists" ? "toolPolicyTargetExists" : "toolPolicyUnsupported");
6953
- const renderRows = (tools) => (0, react_jsx_runtime.jsxs)("div", {
7001
+ const gptSearchActive = gptCapabilities?.hostedWebSearch === true || gptCapabilities?.codexSearch === true;
7002
+ const gptBadgeFor = (tool) => {
7003
+ if (tool.name === "codex_connect_image_generate") return {
7004
+ label: formatGptImageBadge(gptCapabilities?.imageModelHint),
7005
+ title: t("toolPolicyGptImageTitle")
7006
+ };
7007
+ if (tool.name === "web_search" && gptSearchActive) {
7008
+ const model = gptCapabilities?.codexSearchModel;
7009
+ if (gptCapabilities?.hostedWebSearch && gptCapabilities?.codexSearch) return {
7010
+ label: t("toolPolicyGptDualSearch"),
7011
+ title: model ? `${t("toolPolicyGptDualSearchTitle")} (${model})` : t("toolPolicyGptDualSearchTitle")
7012
+ };
7013
+ if (gptCapabilities?.hostedWebSearch) return {
7014
+ label: t("toolPolicyGptHostedSearch"),
7015
+ title: t("toolPolicyGptHostedSearchTitle")
7016
+ };
7017
+ return {
7018
+ label: model ? `${t("toolPolicyGptCodexSearch")} · ${model}` : t("toolPolicyGptCodexSearch"),
7019
+ title: model ? `${t("toolPolicyGptCodexSearchTitle")} (${model})` : t("toolPolicyGptCodexSearchTitle")
7020
+ };
7021
+ }
7022
+ };
7023
+ const renderRows = (tools, includeCompaction = false) => (0, react_jsx_runtime.jsxs)("div", {
6954
7024
  className: "codex-tool-policy-table",
6955
7025
  role: "table",
6956
7026
  "aria-label": t("toolPolicyTitle"),
6957
- children: [tools.map((tool) => {
6958
- const action = chosen(tool);
6959
- const deferReason = deferUnavailableReason(tool);
6960
- const supported = action === "keep" || action === "hide" || action === "defer" || tool.replacements.some((option) => option.action === action);
6961
- const custom = customized(tool);
6962
- const hasOverride = !!rule?.tools?.some((choice) => choice.name === tool.name);
6963
- return (0, react_jsx_runtime.jsxs)("div", {
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", {
6964
7146
  role: "row",
6965
7147
  className: "codex-tool-policy-tool",
6966
- "data-tool-name": tool.name,
6967
- "data-tool-action": action,
7148
+ "data-gpt-capability": "compaction",
6968
7149
  children: [(0, react_jsx_runtime.jsxs)("div", {
6969
7150
  role: "cell",
6970
7151
  className: "codex-tool-policy-name",
6971
7152
  children: [
6972
7153
  (0, react_jsx_runtime.jsx)("code", {
6973
7154
  className: "codex-tool-policy-identifier",
6974
- children: tool.name
7155
+ children: "/compact"
6975
7156
  }),
6976
7157
  (0, react_jsx_runtime.jsx)("span", {
6977
7158
  className: "codex-tool-policy-description",
6978
- title: tool.description,
6979
- children: human(tool)
6980
- }),
6981
- tool.defaultDeferred && !custom && (0, react_jsx_runtime.jsx)("span", {
6982
- className: "codex-badge",
6983
- "data-tone": "blue",
6984
- children: t("toolPolicyDefaultDeferred")
6985
- }),
6986
- custom && (0, react_jsx_runtime.jsx)("span", {
6987
- className: "codex-badge",
6988
- "data-tone": "blue",
6989
- children: t("toolPolicyModified")
7159
+ children: t("toolPolicyGptCompactionDesc")
6990
7160
  }),
6991
- tool.codexTool?.presetEnabled === false && (0, react_jsx_runtime.jsx)("span", {
6992
- className: "codex-badge",
6993
- "data-tone": "warn",
6994
- children: t("toolPolicyPresetDisabled")
6995
- }),
6996
- tool.conditional && tool.codexTool === void 0 && (0, react_jsx_runtime.jsx)("span", {
7161
+ (0, react_jsx_runtime.jsx)("span", {
6997
7162
  className: "codex-badge",
6998
- children: t("toolPolicyConditional")
7163
+ "data-tone": "gpt",
7164
+ children: t("toolPolicyGptCompactionBadge")
6999
7165
  })
7000
7166
  ]
7001
- }), (0, react_jsx_runtime.jsxs)("div", {
7167
+ }), (0, react_jsx_runtime.jsx)("div", {
7002
7168
  role: "cell",
7003
7169
  className: "codex-tool-policy-action",
7004
- children: [
7005
- (0, react_jsx_runtime.jsxs)("div", {
7006
- className: "codex-seg",
7007
- role: "group",
7008
- "aria-label": `${t("toolPolicyAction")} ${tool.name}`,
7009
- children: [
7010
- (0, react_jsx_runtime.jsx)("button", {
7011
- type: "button",
7012
- "data-action": "keep",
7013
- "aria-pressed": action === "keep",
7014
- disabled: duplicate,
7015
- onClick: () => chooseAction(tool, "keep"),
7016
- children: t("toolPolicyKeep")
7017
- }),
7018
- tool.replacements.map((option) => (0, react_jsx_runtime.jsx)("button", {
7019
- type: "button",
7020
- "data-action": option.action,
7021
- "aria-pressed": action === option.action,
7022
- disabled: duplicate || !option.available,
7023
- title: option.available ? option.tools.join(" + ") : `${option.tools.join(" + ")} · ${unavailable(option.reason)}`,
7024
- onClick: () => chooseAction(tool, option.action),
7025
- children: t("toolPolicyReplaceShort")
7026
- }, option.action)),
7027
- (0, react_jsx_runtime.jsx)("button", {
7028
- type: "button",
7029
- "data-action": "defer",
7030
- "aria-pressed": action === "defer",
7031
- disabled: duplicate || deferReason !== void 0,
7032
- title: deferReason !== void 0 ? unavailable(deferReason) : t("toolPolicyDeferHint"),
7033
- onClick: () => chooseAction(tool, "defer"),
7034
- children: t("toolPolicyDefer")
7035
- }),
7036
- (0, react_jsx_runtime.jsx)("button", {
7037
- type: "button",
7038
- "data-action": "hide",
7039
- "aria-pressed": action === "hide",
7040
- disabled: duplicate,
7041
- onClick: () => chooseAction(tool, "hide"),
7042
- children: t("toolPolicyHide")
7043
- })
7044
- ]
7045
- }),
7046
- !supported && (0, react_jsx_runtime.jsxs)("span", {
7047
- className: "codex-tool-policy-warning",
7048
- children: [
7049
- t("toolPolicyUnsupported"),
7050
- " (",
7051
- action,
7052
- ")"
7053
- ]
7054
- }),
7055
- hasOverride && (0, react_jsx_runtime.jsx)("button", {
7056
- type: "button",
7057
- className: "codex-btn",
7058
- "aria-label": `${t("toolPolicyRestoreChoice")} ${tool.name}`,
7059
- title: t("toolPolicyRestoreChoice"),
7060
- onClick: () => removeChoice(tool.name),
7061
- children: "↶"
7062
- })
7063
- ]
7170
+ children: (0, react_jsx_runtime.jsx)("span", {
7171
+ className: "codex-badge",
7172
+ children: t("toolPolicyGptCompactionReadOnly")
7173
+ })
7064
7174
  })]
7065
- }, tool.name);
7066
- }), tools.length === 0 && (0, react_jsx_runtime.jsx)("p", {
7067
- className: "codex-tool-policy-note",
7068
- style: { padding: "12px 14px" },
7069
- children: t("toolPolicyNoMatches")
7070
- })]
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
+ ]
7071
7182
  });
7072
7183
  if (snapshot.status !== "ready" || snapshot.value === void 0 || mode === "inactive") return null;
7073
7184
  const text = query.trim().toLowerCase();
7074
7185
  const isFiltering = text.length > 0 || filter !== "all";
7075
7186
  const allTools = inventory?.tools ?? [];
7076
7187
  const hasReplaceable = allTools.some((tool) => tool.replacements.some((option) => option.available));
7077
- const shown = allTools.filter((tool) => (!text || `${human(tool)} ${tool.name} ${tool.description}`.toLowerCase().includes(text)) && (filter === "all" || (filter === "modified" ? customized(tool) : filter === "deferred" ? chosen(tool) === "defer" : tool.replacements.some((option) => option.available))));
7188
+ const shown = allTools.filter((tool) => {
7189
+ const gptBadge = gptBadgeFor(tool);
7190
+ const haystack = `${human(tool)} ${tool.name} ${tool.description} ${gptBadge?.label ?? ""}`.toLowerCase();
7191
+ return (!text || haystack.includes(text)) && (filter === "all" || (filter === "modified" ? customized(tool) : filter === "deferred" ? chosen(tool) === "defer" : tool.replacements.some((option) => option.available)));
7192
+ });
7193
+ const compactionSearchText = `/compact compaction ${t("toolPolicyGptCompactionDesc")} ${t("toolPolicyGptCompactionBadge")} gpt`.toLowerCase();
7194
+ const showCompactionRow = gptCapabilities?.remoteCompaction === true && filter === "all" && (!text || compactionSearchText.includes(text));
7078
7195
  return (0, react_jsx_runtime.jsxs)("section", {
7079
7196
  className: "codex-tool-policy",
7080
7197
  "aria-label": t(activeSub === "prompts" ? "settingsPresetPrompts" : "toolPolicyTitle"),
@@ -7206,14 +7323,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7206
7323
  })
7207
7324
  ]
7208
7325
  }),
7209
- inventory && !duplicate && (isFiltering && shown.length === 0 ? (0, react_jsx_runtime.jsx)("div", {
7326
+ inventory && !duplicate && (isFiltering && shown.length === 0 && !showCompactionRow ? (0, react_jsx_runtime.jsx)("div", {
7210
7327
  className: "codex-card",
7211
7328
  children: renderRows(shown)
7212
7329
  }) : GROUP_META.map((group) => {
7213
- const tools = shown.filter((tool) => groupOf(tool) === group.id);
7214
- if (!tools.length) return null;
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;
7215
7333
  const changes = tools.filter(customized).length;
7216
7334
  const key = `${selectedId}/${group.id}`;
7335
+ const count = tools.length + (includeCompaction ? 1 : 0);
7217
7336
  return (0, react_jsx_runtime.jsxs)("details", {
7218
7337
  className: "codex-group",
7219
7338
  "data-tool-group": group.id,
@@ -7224,8 +7343,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7224
7343
  },
7225
7344
  children: [(0, react_jsx_runtime.jsxs)("summary", { children: [(0, react_jsx_runtime.jsx)("span", { children: t(group.labelKey) }), (0, react_jsx_runtime.jsxs)("span", {
7226
7345
  className: "codex-tool-policy-note",
7227
- children: [tools.length, changes ? ` · ${changes} ${t("toolPolicyCustomized")}` : ""]
7228
- })] }), renderRows(tools)]
7346
+ children: [count, changes ? ` · ${changes} ${t("toolPolicyCustomized")}` : ""]
7347
+ })] }), renderRows(tools, includeCompaction)]
7229
7348
  }, group.id);
7230
7349
  }))
7231
7350
  ] }),
@@ -7619,6 +7738,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7619
7738
  for (const [k, v] of Object.entries(record)) if (v === null || typeof v === "number" && Number.isSafeInteger(v) && v > 0) out[k] = v;
7620
7739
  return out;
7621
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
+ }
7622
7756
  function bindCodexConnectScope(configForms) {
7623
7757
  const form = configForms.get(OPENAI_CODEX_SETTINGS_NAMESPACE);
7624
7758
  const mirror = configForms.describe?.();
@@ -7636,13 +7770,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7636
7770
  lastFormSnap = formSnap;
7637
7771
  lastMirrorSnap = mirrorSnap;
7638
7772
  const formRecord = formSnap.status === "ready" ? asRecord(formSnap.value) : void 0;
7639
- if (formRecord !== void 0) return projected = {
7640
- status: "ready",
7641
- writable: formSnap.writable,
7642
- overrides: asOverrides(formRecord.contextWindowOverrides),
7643
- baseOverrides: asOverrides(asRecord(formSnap.base)?.contextWindowOverrides),
7644
- ...typeof formRecord.enableNativeCompaction === "boolean" ? { nativeCompaction: formRecord.enableNativeCompaction } : {}
7645
- };
7773
+ if (formRecord !== void 0) return projected = projectCodexConnectRecord(formRecord, asRecord(formSnap.base), formSnap.writable);
7646
7774
  const view = mirrorSnap?.view;
7647
7775
  if (view !== void 0) {
7648
7776
  const row = view.namespaces?.find((candidate) => candidate.ns === OPENAI_CODEX_SETTINGS_NAMESPACE);
@@ -7651,13 +7779,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7651
7779
  status: "unavailable",
7652
7780
  writable: false
7653
7781
  };
7654
- return projected = {
7655
- status: "ready",
7656
- writable: view.writable ?? formSnap.writable,
7657
- overrides: asOverrides(rowRecord.contextWindowOverrides),
7658
- baseOverrides: asOverrides(asRecord(row.base)?.contextWindowOverrides),
7659
- ...typeof rowRecord.enableNativeCompaction === "boolean" ? { nativeCompaction: rowRecord.enableNativeCompaction } : {}
7660
- };
7782
+ return projected = projectCodexConnectRecord(rowRecord, asRecord(row.base), view.writable ?? formSnap.writable);
7661
7783
  }
7662
7784
  return projected = {
7663
7785
  status: formSnap.status,
@@ -7836,9 +7958,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7836
7958
  ]
7837
7959
  });
7838
7960
  }
7961
+ const EMPTY_CONNECT_SUBSCRIBE = () => () => {};
7962
+ const EMPTY_CONNECT_SNAPSHOT = () => void 0;
7839
7963
  function CodexSettingsTab(props) {
7840
- const { toolPolicy, presetManager, t } = props;
7964
+ const { toolPolicy, presetManager, getCodexConnectScope, t } = props;
7841
7965
  const [page, setPage] = (0, react.useState)(props.initialPage ?? "tools");
7966
+ const settingsSnapshot = typeof props.useSettings === "function" ? props.useSettings((state) => state) : void 0;
7967
+ const connectScope = getCodexConnectScope?.();
7968
+ const connectSnapshot = (0, react.useSyncExternalStore)(connectScope ? connectScope.subscribe : EMPTY_CONNECT_SUBSCRIBE, connectScope ? connectScope.getSnapshot : EMPTY_CONNECT_SNAPSHOT, connectScope ? connectScope.getSnapshot : EMPTY_CONNECT_SNAPSHOT);
7969
+ const gptCapabilities = resolveGptCapabilities(settingsSnapshot?.value, connectSnapshot);
7842
7970
  const mode = page === "tools" ? "tools" : "inactive";
7843
7971
  return (0, react_jsx_runtime.jsxs)("section", {
7844
7972
  className: "codex-harness-settings",
@@ -7863,6 +7991,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7863
7991
  binding: toolPolicy,
7864
7992
  presetManager,
7865
7993
  mode,
7994
+ gptCapabilities,
7866
7995
  t
7867
7996
  }),
7868
7997
  (0, react_jsx_runtime.jsx)(RuntimeSettingsEditor, {
@@ -7902,6 +8031,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7902
8031
  unsetSetting: (field) => settings.unset(field),
7903
8032
  presetManager,
7904
8033
  toolPolicy,
8034
+ getCodexConnectScope,
7905
8035
  saveSettings: async (edits, revision) => {
7906
8036
  await saveDesktopSettings(form, edits, revision);
7907
8037
  if (typeof edits.remoteCompactionEnabled === "boolean") {