@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.
- package/CHANGELOG.md +17 -0
- package/README.md +21 -41
- package/docs/preset-library.md +2 -2
- package/docs/tool-policy.md +1 -1
- package/lib/client.js +1826 -545
- package/lib/compact-command.js +7 -1
- package/lib/compaction.js +7 -1
- package/lib/hybrid-executor.js +23 -12
- package/lib/index.js +1229 -17
- package/lib/preferences.js +21 -2
- package/lib/tool-policy.js +11 -2
- package/lib/typert.js +42 -1
- package/lib/types/client/desktop.d.ts +20 -42
- package/lib/types/client/desktop.js +184 -127
- package/lib/types/client/index.d.ts +104 -39
- package/lib/types/client/index.js +97 -15
- package/lib/types/client/policy-drafts.d.ts +18 -0
- package/lib/types/client/policy-drafts.js +27 -0
- package/lib/types/client/policy-locale.d.ts +81 -32
- package/lib/types/client/policy-locale.js +197 -107
- package/lib/types/client/preset-manager.d.ts +25 -2
- package/lib/types/client/preset-manager.js +89 -5
- package/lib/types/client/preset-requests.d.ts +44 -1
- package/lib/types/client/preset-requests.js +150 -0
- package/lib/types/client/tool-policy.d.ts +6 -15
- package/lib/types/client/tool-policy.js +24 -39
- package/lib/types/contracts/preset-editor-schema.d.ts +35 -0
- package/lib/types/contracts/preset-editor-schema.js +39 -0
- package/lib/types/contracts/settings.d.ts +12 -0
- package/lib/types/contracts/settings.js +10 -1
- package/lib/types/contracts/ui-contracts.d.ts +48 -0
- package/lib/types/contracts/ui-contracts.js +58 -0
- package/lib/types/contracts/update.d.ts +73 -0
- package/lib/types/contracts/update.js +291 -0
- package/lib/types/entries/index.js +20 -2
- package/lib/types/entries/preferences.d.ts +2 -0
- package/lib/types/entries/preferences.js +9 -0
- package/lib/types/hybrid/hybrid-sdk.d.ts +1 -1
- package/lib/types/hybrid/hybrid-sdk.js +27 -13
- package/lib/types/presets/preset-editor.d.ts +13 -1
- package/lib/types/presets/preset-editor.js +24 -1
- package/lib/types/presets/pro-mode-store.d.ts +13 -0
- package/lib/types/presets/pro-mode-store.js +69 -0
- package/lib/types/responses/background-sse-codec.d.ts +23 -0
- package/lib/types/responses/background-sse-codec.js +230 -0
- package/lib/types/responses/background-stream.d.ts +28 -0
- package/lib/types/responses/background-stream.js +351 -0
- package/lib/types/responses/fetch-transport.js +24 -9
- package/lib/types/responses/wire-rewrite.d.ts +4 -0
- package/lib/types/responses/wire-rewrite.js +30 -4
- package/lib/types/tools/codex-subagent.d.ts +14 -0
- package/lib/types/tools/codex-subagent.js +269 -0
- package/lib/types/update/checker.d.ts +14 -0
- package/lib/types/update/checker.js +166 -0
- package/locale/en.json +1 -1
- package/locale/hybrid-executor/en.json +1 -1
- package/locale/hybrid-executor/zh.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +6 -2
- package/src/client/desktop.tsx +359 -160
- package/src/client/index.tsx +122 -22
- package/src/client/policy-drafts.ts +45 -0
- package/src/client/policy-locale.ts +198 -106
- package/src/client/preset-manager.tsx +125 -4
- package/src/client/preset-requests.ts +185 -1
- package/src/client/tool-policy.tsx +29 -63
- package/src/contracts/preset-editor-schema.ts +44 -0
- package/src/contracts/settings.ts +20 -1
- package/src/contracts/ui-contracts.ts +87 -0
- package/src/contracts/update.ts +307 -0
- package/src/entries/index.ts +25 -2
- package/src/entries/preferences.ts +9 -0
- package/src/hybrid/hybrid-sdk.ts +28 -12
- package/src/presets/preset-editor.ts +31 -3
- package/src/presets/pro-mode-store.ts +80 -0
- package/src/responses/background-sse-codec.ts +237 -0
- package/src/responses/background-stream.ts +371 -0
- package/src/responses/fetch-transport.ts +28 -9
- package/src/responses/wire-rewrite.ts +34 -3
- package/src/tools/codex-subagent.ts +290 -0
- package/src/update/checker.ts +193 -0
- package/tsdown.config.ts +4 -0
|
@@ -1,126 +1,58 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
/** A single Settings workspace; the bundle page is only a signpost. */
|
|
3
|
-
import { useState, useSyncExternalStore } from 'react';
|
|
3
|
+
import { useEffect, useRef, useState, useSyncExternalStore } from 'react';
|
|
4
4
|
import { applyWithSettingsApi } from "./index.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
function asOverrides(value) {
|
|
13
|
-
const record = asRecord(value);
|
|
14
|
-
if (record === undefined)
|
|
15
|
-
return undefined;
|
|
16
|
-
const out = {};
|
|
17
|
-
for (const [k, v] of Object.entries(record)) {
|
|
18
|
-
if (v === null || (typeof v === 'number' && Number.isSafeInteger(v) && v > 0))
|
|
19
|
-
out[k] = v;
|
|
20
|
-
}
|
|
21
|
-
return out;
|
|
22
|
-
}
|
|
23
|
-
function projectCodexConnectRecord(record, baseRecord, writable) {
|
|
24
|
-
const searchModel = typeof record.searchModel === 'string' && record.searchModel.trim() ? record.searchModel.trim() : undefined;
|
|
25
|
-
const imageModelHint = typeof record.imageModelHint === 'string' ? record.imageModelHint.trim() : undefined;
|
|
26
|
-
return {
|
|
27
|
-
status: 'ready',
|
|
28
|
-
writable,
|
|
29
|
-
overrides: asOverrides(record.contextWindowOverrides),
|
|
30
|
-
baseOverrides: asOverrides(baseRecord?.contextWindowOverrides),
|
|
31
|
-
...(typeof record.enableNativeCompaction === 'boolean' ? { nativeCompaction: record.enableNativeCompaction } : {}),
|
|
32
|
-
...(typeof record.enableSearch === 'boolean' ? { searchEnabled: record.enableSearch } : {}),
|
|
33
|
-
...(searchModel !== undefined ? { searchModel } : {}),
|
|
34
|
-
...(typeof record.enableImageGeneration === 'boolean' ? { imageGenerationEnabled: record.enableImageGeneration } : {}),
|
|
35
|
-
...(imageModelHint !== undefined ? { imageModelHint } : {}),
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
export function bindCodexConnectScope(configForms) {
|
|
39
|
-
const form = configForms.get(OPENAI_CODEX_SETTINGS_NAMESPACE);
|
|
40
|
-
const mirror = configForms.describe?.();
|
|
41
|
-
void Promise.resolve(mirror?.ensure?.()).catch(() => { });
|
|
42
|
-
let lastFormSnap;
|
|
43
|
-
let lastMirrorSnap;
|
|
44
|
-
let projected = { status: 'loading', writable: false };
|
|
45
|
-
const getSnapshot = () => {
|
|
46
|
-
const formSnap = form.getSnapshot();
|
|
47
|
-
const mirrorSnap = mirror?.getSnapshot();
|
|
48
|
-
if (formSnap === lastFormSnap && mirrorSnap === lastMirrorSnap)
|
|
49
|
-
return projected;
|
|
50
|
-
lastFormSnap = formSnap;
|
|
51
|
-
lastMirrorSnap = mirrorSnap;
|
|
52
|
-
const formRecord = formSnap.status === 'ready' ? asRecord(formSnap.value) : undefined;
|
|
53
|
-
if (formRecord !== undefined) {
|
|
54
|
-
return projected = projectCodexConnectRecord(formRecord, asRecord(formSnap.base), formSnap.writable);
|
|
55
|
-
}
|
|
56
|
-
const view = mirrorSnap?.view;
|
|
57
|
-
if (view !== undefined) {
|
|
58
|
-
const row = view.namespaces?.find(candidate => candidate.ns === OPENAI_CODEX_SETTINGS_NAMESPACE);
|
|
59
|
-
const rowRecord = row === undefined ? undefined : asRecord(row.value);
|
|
60
|
-
if (row === undefined || rowRecord === undefined)
|
|
61
|
-
return projected = { status: 'unavailable', writable: false };
|
|
62
|
-
return projected = projectCodexConnectRecord(rowRecord, asRecord(row.base), view.writable ?? formSnap.writable);
|
|
63
|
-
}
|
|
64
|
-
return projected = { status: formSnap.status, writable: formSnap.writable };
|
|
65
|
-
};
|
|
66
|
-
return {
|
|
67
|
-
getSnapshot,
|
|
68
|
-
subscribe: listener => {
|
|
69
|
-
const stopForm = form.subscribe(listener);
|
|
70
|
-
const stopMirror = mirror?.subscribe(listener);
|
|
71
|
-
return () => { stopForm(); stopMirror?.(); };
|
|
72
|
-
},
|
|
73
|
-
setModelOverride: async (modelId, tokens) => {
|
|
74
|
-
const snap = getSnapshot();
|
|
75
|
-
const next = nextOpenAICodexOverrides(snap.overrides, snap.baseOverrides, modelId, tokens);
|
|
76
|
-
const accepted = next === undefined
|
|
77
|
-
? await form.unset('contextWindowOverrides')
|
|
78
|
-
: await form.set('contextWindowOverrides', next);
|
|
79
|
-
if (!accepted)
|
|
80
|
-
throw new Error('The host did not accept the settings change.');
|
|
81
|
-
},
|
|
82
|
-
setNativeCompaction: async (enabled) => {
|
|
83
|
-
const accepted = await form.set('enableNativeCompaction', enabled);
|
|
84
|
-
if (!accepted)
|
|
85
|
-
throw new Error('The host did not accept the settings change.');
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
export function adaptConfigForm(form) {
|
|
90
|
-
const accepted = async (result) => { if (!await result)
|
|
91
|
-
throw new Error('The host did not accept the settings change.'); };
|
|
92
|
-
return { getSnapshot: () => form.getSnapshot(), subscribe: listener => form.subscribe(listener),
|
|
93
|
-
set: (field, value) => accepted(form.set(field, value)), unset: field => accepted(form.unset(field)) };
|
|
94
|
-
}
|
|
95
|
-
export async function saveDesktopSettings(form, edits, expectedRevision) {
|
|
96
|
-
const ops = Object.entries(edits).map(([field, value]) => value === undefined ? { op: 'unset', path: [field] } : { op: 'set', path: [field], value });
|
|
97
|
-
if (!ops.length)
|
|
98
|
-
return;
|
|
99
|
-
const accepted = expectedRevision === undefined ? await form.mutate(ops) : await form.mutate(ops, expectedRevision);
|
|
100
|
-
if (!accepted)
|
|
101
|
-
throw new Error('The host did not accept the settings change.');
|
|
102
|
-
}
|
|
5
|
+
import { CODEX_SUBAGENT_DEFAULT_PRESET, CODEX_SUBAGENT_PRESET_INHERIT, CODEX_SUBAGENT_TOOL_NAME, } from "../contracts/ui-contracts.js";
|
|
6
|
+
import { CODEX_CONNECT_PACKAGE_NAME, CODEX_CONNECT_REPO_URL, CODEX_HARNESS_RELEASES_URL } from "../contracts/update.js";
|
|
7
|
+
import { adaptConfigForm, bindCodexConnectScope, bindLlmProvidersScope, invalidatePresetTools, requestCodexSubagentModels, saveDesktopSettings, } from "./preset-requests.js";
|
|
8
|
+
import { bindToolPolicy, formatGptImageBadge, resolveGptCapabilities, ToolPolicySection } from "./tool-policy.js";
|
|
9
|
+
export { adaptConfigForm, bindCodexConnectScope, saveDesktopSettings };
|
|
10
|
+
const DEFAULT_EFFORTS = ['low', 'medium', 'high', 'xhigh', 'max'];
|
|
103
11
|
const desktopStyles = `
|
|
104
12
|
.codex-harness-settings { max-width:760px; min-width:0; font-size:13px; color:var(--dsw-alias-label-primary); }
|
|
105
13
|
.codex-harness-settings h3 { font-size:14px; margin:0 0 10px; }
|
|
106
14
|
.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); }
|
|
107
15
|
.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; }
|
|
16
|
+
.codex-harness-settings .codex-harness-nav button[data-nav-align=end] { margin-left:auto; }
|
|
108
17
|
.codex-harness-settings .codex-harness-nav button[aria-pressed=true] { color:var(--dsw-alias-label-primary); font-weight:500; }
|
|
109
18
|
.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:''; }
|
|
19
|
+
.codex-harness-settings .codex-harness-help-list { margin:0; padding:0; list-style:none; display:flex; flex-direction:column; gap:8px; }
|
|
20
|
+
.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); }
|
|
21
|
+
.codex-harness-settings .codex-harness-help-list li:first-child { padding-top:0; border-top:0; }
|
|
22
|
+
.codex-harness-settings .codex-harness-help-list strong { font-size:13px; font-weight:600; }
|
|
23
|
+
.codex-harness-settings .codex-harness-help-list span { font-size:12px; color:var(--dsw-alias-label-secondary); line-height:1.5; }
|
|
24
|
+
.codex-harness-settings .codex-harness-link { color:var(--dsw-alias-brand-primary); text-decoration:underline; text-underline-offset:2px; font-size:12px; }
|
|
25
|
+
.codex-harness-settings .codex-harness-inline-row { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:8px; }
|
|
26
|
+
.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; }
|
|
110
27
|
.codex-harness-settings button { box-sizing:border-box; min-width:0; max-width:100%; font:inherit; color:inherit; }
|
|
111
28
|
.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; }
|
|
112
29
|
.codex-harness-settings .codex-harness-btn:disabled { opacity:.48; cursor:default; }
|
|
113
30
|
.codex-harness-settings .codex-harness-primary { background:var(--dsw-alias-label-primary); color:var(--dsw-alias-bg-base); border-color:transparent; font-weight:500; }
|
|
114
|
-
.codex-harness-settings :is(input,button):focus-visible { outline:2px solid var(--dsw-focus-ring-color, var(--dsw-alias-brand-primary)); outline-offset:2px; }
|
|
31
|
+
.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; }
|
|
115
32
|
.codex-harness-settings fieldset { min-width:0; border:0; padding:0; margin:0; display:flex; flex-direction:column; gap:12px; }
|
|
116
33
|
.codex-harness-settings .codex-harness-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,260px),1fr)); gap:12px; }
|
|
34
|
+
.codex-harness-settings .codex-harness-stack { display:flex; flex-direction:column; gap:12px; }
|
|
117
35
|
.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; }
|
|
36
|
+
.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; }
|
|
37
|
+
.codex-harness-settings details.codex-harness-collapse > summary::-webkit-details-marker { display:none; }
|
|
38
|
+
.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); }
|
|
118
39
|
.codex-harness-settings .codex-harness-group h4 { margin:0 0 6px; font-size:12px; font-weight:600; color:var(--dsw-alias-label-secondary); }
|
|
119
40
|
.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); }
|
|
120
41
|
.codex-harness-settings .codex-harness-setting-row:last-child { border-bottom:0; }
|
|
42
|
+
.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); }
|
|
43
|
+
.codex-harness-settings .codex-harness-cap-row:last-child { border-bottom:0; }
|
|
44
|
+
.codex-harness-settings .codex-harness-cap-info { min-width:0; flex:1 1 240px; display:flex; flex-direction:column; gap:4px; }
|
|
45
|
+
.codex-harness-settings .codex-harness-cap-head { display:flex; flex-wrap:wrap; align-items:center; gap:6px; }
|
|
46
|
+
.codex-harness-settings .codex-harness-cap-title { font-size:13px; font-weight:600; }
|
|
47
|
+
.codex-harness-settings .codex-harness-cap-detail { font-size:12px; color:var(--dsw-alias-label-secondary); line-height:1.45; }
|
|
48
|
+
.codex-harness-settings .codex-harness-subagent-controls { display:flex; flex-wrap:wrap; gap:8px; margin-top:4px; }
|
|
49
|
+
.codex-harness-settings .codex-harness-subagent-field { display:inline-flex; align-items:center; gap:6px; font-size:12px; color:var(--dsw-alias-label-secondary); }
|
|
50
|
+
.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; }
|
|
51
|
+
.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); }
|
|
52
|
+
.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; }
|
|
121
53
|
.codex-harness-settings .codex-harness-note { margin:0 0 12px; color:var(--dsw-alias-label-secondary); font-size:12px; line-height:1.5; }
|
|
122
|
-
.codex-harness-settings .codex-harness-actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:4px; }
|
|
123
54
|
.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; }
|
|
55
|
+
.codex-harness-settings input[role=switch]:disabled { opacity:.45; cursor:default; }
|
|
124
56
|
.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; }
|
|
125
57
|
.codex-harness-settings input[role=switch]:checked { background:var(--dsw-alias-label-primary); border-color:transparent; }
|
|
126
58
|
.codex-harness-settings input[role=switch]:checked:before { left:16.5px; background:var(--dsw-alias-bg-base); }
|
|
@@ -129,54 +61,169 @@ const desktopStyles = `
|
|
|
129
61
|
export function DesktopSettingsCard({ t }) {
|
|
130
62
|
return _jsxs("section", { children: [_jsx("p", { children: t('settingsBundleSummary') }), _jsx("p", { children: t('settingsBundlePath') })] });
|
|
131
63
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
64
|
+
const EMPTY_CONNECT_SUBSCRIBE = () => () => { };
|
|
65
|
+
const EMPTY_CONNECT_SNAPSHOT = () => undefined;
|
|
66
|
+
/** Unified environment-wide settings: live subscription registrations, model requests, and display toggles. */
|
|
67
|
+
export function RuntimeSettingsEditor({ active, connectScope, connectSnapshot, onImageRegistrationChanged, ...props }) {
|
|
68
|
+
const { useSettings, saveSettings, presetManager, t } = props;
|
|
135
69
|
const snapshot = useSettings(state => state);
|
|
136
|
-
const [
|
|
137
|
-
const [saving, setSaving] = useState(false);
|
|
70
|
+
const [busyField, setBusyField] = useState(null);
|
|
138
71
|
const [error, setError] = useState('');
|
|
139
|
-
const
|
|
140
|
-
const
|
|
141
|
-
const
|
|
72
|
+
const [capBusy, setCapBusy] = useState(null);
|
|
73
|
+
const [capError, setCapError] = useState('');
|
|
74
|
+
const [subagentModels, setSubagentModels] = useState();
|
|
75
|
+
const [subagentModelsStatus, setSubagentModelsStatus] = useState('idle');
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (!active || presetManager === undefined)
|
|
78
|
+
return undefined;
|
|
79
|
+
let alive = true;
|
|
80
|
+
setSubagentModelsStatus(current => current === 'ready' ? 'ready' : 'loading');
|
|
81
|
+
void requestCodexSubagentModels(presetManager)
|
|
82
|
+
.then(result => {
|
|
83
|
+
if (!alive)
|
|
84
|
+
return;
|
|
85
|
+
setSubagentModels(result);
|
|
86
|
+
setSubagentModelsStatus('ready');
|
|
87
|
+
})
|
|
88
|
+
.catch(() => {
|
|
89
|
+
if (alive)
|
|
90
|
+
setSubagentModelsStatus('error');
|
|
91
|
+
});
|
|
92
|
+
return () => { alive = false; };
|
|
93
|
+
}, [active, presetManager]);
|
|
94
|
+
if (!active)
|
|
95
|
+
return null;
|
|
96
|
+
const value = (field) => {
|
|
97
|
+
const raw = snapshot.value?.[field];
|
|
98
|
+
if (typeof raw === 'boolean')
|
|
99
|
+
return raw;
|
|
100
|
+
return field !== 'fast' && field !== 'codexSubagentEnabled';
|
|
101
|
+
};
|
|
102
|
+
const saveCodex = (key, edits, refreshTools = false) => {
|
|
103
|
+
if (busyField !== null || !snapshot.writable || snapshot.status !== 'ready')
|
|
104
|
+
return;
|
|
105
|
+
setBusyField(key);
|
|
142
106
|
setError('');
|
|
143
|
-
|
|
107
|
+
void saveSettings(edits, snapshot.revision)
|
|
108
|
+
.then(() => { if (refreshTools)
|
|
109
|
+
onImageRegistrationChanged?.(); })
|
|
110
|
+
.catch(() => setError(t('settingsSharedFailed')))
|
|
111
|
+
.finally(() => setBusyField(current => current === key ? null : current));
|
|
144
112
|
};
|
|
113
|
+
const connectReady = connectSnapshot?.status === 'ready';
|
|
114
|
+
const connectLoading = connectSnapshot?.status === 'loading';
|
|
115
|
+
const searchRegistered = connectReady && connectSnapshot.searchEnabled === true;
|
|
116
|
+
const imageRegistered = connectReady && connectSnapshot.imageGenerationEnabled === true;
|
|
117
|
+
const hostedWebSearch = value('hostedWebSearchEnabled');
|
|
118
|
+
const canToggleSearch = connectReady && connectSnapshot.writable && connectScope?.setSearchEnabled !== undefined && capBusy === null;
|
|
119
|
+
const canToggleImage = connectReady && connectSnapshot.writable && connectScope?.setImageGenerationEnabled !== undefined && capBusy === null;
|
|
120
|
+
const subagentAvailable = connectReady || subagentModels?.available === true;
|
|
121
|
+
const subagentNeedsRestart = subagentModelsStatus === 'error';
|
|
122
|
+
const subagentEnabled = subagentAvailable && value('codexSubagentEnabled');
|
|
123
|
+
const subagentModel = snapshot.value?.codexSubagentModel?.trim() || '';
|
|
124
|
+
const subagentEffort = snapshot.value?.codexSubagentEffort?.trim() || '';
|
|
125
|
+
const subagentPreset = snapshot.value?.codexSubagentPreset?.trim() || CODEX_SUBAGENT_DEFAULT_PRESET;
|
|
126
|
+
const availableModels = subagentModels?.models ?? [];
|
|
127
|
+
const effectiveModelId = subagentModel || availableModels[0]?.id || '';
|
|
128
|
+
const selectedModelMeta = availableModels.find(model => model.id === effectiveModelId);
|
|
129
|
+
const effortChoices = selectedModelMeta && selectedModelMeta.efforts.length > 0 ? selectedModelMeta.efforts : DEFAULT_EFFORTS;
|
|
130
|
+
const canEditSubagent = subagentAvailable && !subagentNeedsRestart && snapshot.writable && snapshot.status === 'ready' && busyField === null;
|
|
131
|
+
const toggleRegistration = (kind, next) => {
|
|
132
|
+
const write = kind === 'search' ? connectScope?.setSearchEnabled : connectScope?.setImageGenerationEnabled;
|
|
133
|
+
if (!write || capBusy !== null || !connectReady || !connectSnapshot.writable)
|
|
134
|
+
return;
|
|
135
|
+
setCapBusy(kind);
|
|
136
|
+
setCapError('');
|
|
137
|
+
void write(next)
|
|
138
|
+
.then(() => { if (kind === 'image')
|
|
139
|
+
onImageRegistrationChanged?.(); })
|
|
140
|
+
.catch(() => setCapError(t('capabilityWriteFailed')))
|
|
141
|
+
.finally(() => setCapBusy(current => current === kind ? null : current));
|
|
142
|
+
};
|
|
143
|
+
const registrationBadge = (registered, available = connectReady) => (_jsx("span", { className: "codex-harness-badge", "data-tone": registered ? 'ok' : undefined, children: available ? t(registered ? 'capabilityRegistered' : 'capabilityNotRegistered') : t('capabilityUnavailable') }));
|
|
145
144
|
const groups = [
|
|
146
145
|
{ label: 'globalGroupRequest', fields: [['fast', 'fast'], ['hostedWebSearchEnabled', 'settingsPreferHostedSearch'], ['remoteCompactionEnabled', 'settingsPreferRemoteCompaction']] },
|
|
147
|
-
{ label: 'globalGroupDisplay', fields: [['contextWindowControlEnabled', 'contextWindowControl'], ['fastModeControlEnabled', 'fastModeControl'], ['activityIndicatorEnabled', 'capabilityActivity']] },
|
|
146
|
+
{ label: 'globalGroupDisplay', fields: [['contextWindowControlEnabled', 'contextWindowControl'], ['proModeControlEnabled', 'proModeControl'], ['fastModeControlEnabled', 'fastModeControl'], ['activityIndicatorEnabled', 'capabilityActivity']] },
|
|
148
147
|
];
|
|
148
|
+
return _jsxs("section", { "aria-label": t('settingsRuntimePage'), className: "codex-harness-stack", children: [_jsx("p", { className: "codex-harness-note", style: { marginBottom: 0 }, children: t('settingsRuntimeScope') }), _jsx("fieldset", { disabled: !snapshot.writable || snapshot.status !== 'ready' || busyField !== null, children: _jsx("div", { className: "codex-harness-grid", children: groups.map(group => _jsxs("div", { className: "codex-harness-card codex-harness-group", children: [_jsx("h4", { children: t(group.label) }), group.fields.map(([field, label]) => _jsxs("label", { className: "codex-harness-setting-row", children: [_jsx("span", { children: t(label) }), _jsx("input", { type: "checkbox", role: "switch", "aria-label": t(label), "aria-checked": value(field), checked: value(field), onChange: event => saveCodex(field, { [field]: event.target.checked }) })] }, field))] }, group.label)) }) }), !snapshot.writable && _jsx("p", { className: "codex-harness-note", children: t('promptReadOnly') }), error && _jsx("p", { role: "alert", children: error }), subagentAvailable ? _jsxs("div", { className: "codex-harness-card codex-harness-group", "data-capability-group": "connect", children: [_jsx("h4", { children: t('capabilitiesConnectHeading') }), _jsx("p", { className: "codex-harness-note", children: t('capabilitiesConnectNote') }), _jsxs("div", { className: "codex-harness-cap-row", "data-global-capability": "web_search", children: [_jsxs("div", { className: "codex-harness-cap-info", children: [_jsxs("div", { className: "codex-harness-cap-head", children: [_jsx("span", { className: "codex-harness-cap-title", children: t('capabilitySearchTitle') }), _jsx("code", { children: "web_search" }), registrationBadge(searchRegistered), connectReady && connectSnapshot.searchModel && _jsx("span", { className: "codex-harness-badge", children: connectSnapshot.searchModel })] }), _jsx("span", { className: "codex-harness-cap-detail", children: t(hostedWebSearch ? 'capabilitySearchNoteFallback' : 'capabilitySearchNoteAll') })] }), _jsx("input", { type: "checkbox", role: "switch", "aria-label": t('capabilitySearchTitle'), "aria-checked": searchRegistered, checked: searchRegistered, disabled: !canToggleSearch, onChange: event => toggleRegistration('search', event.target.checked) })] }), _jsxs("div", { className: "codex-harness-cap-row", "data-global-capability": "codex_connect_image_generate", children: [_jsxs("div", { className: "codex-harness-cap-info", children: [_jsxs("div", { className: "codex-harness-cap-head", children: [_jsx("span", { className: "codex-harness-cap-title", children: t('capabilityImageTitle') }), _jsx("code", { children: "codex_connect_image_generate" }), registrationBadge(imageRegistered), connectReady && _jsx("span", { className: "codex-harness-badge", children: formatGptImageBadge(connectSnapshot.imageModelHint) })] }), _jsx("span", { className: "codex-harness-cap-detail", children: t('capabilityImageNote') })] }), _jsx("input", { type: "checkbox", role: "switch", "aria-label": t('capabilityImageTitle'), "aria-checked": imageRegistered, checked: imageRegistered, disabled: !canToggleImage, onChange: event => toggleRegistration('image', event.target.checked) })] }), _jsxs("div", { className: "codex-harness-cap-row", "data-global-capability": CODEX_SUBAGENT_TOOL_NAME, children: [_jsxs("div", { className: "codex-harness-cap-info", children: [_jsxs("div", { className: "codex-harness-cap-head", children: [_jsx("span", { className: "codex-harness-cap-title", children: t('capabilitySubagentTitle') }), _jsx("code", { children: CODEX_SUBAGENT_TOOL_NAME }), registrationBadge(subagentEnabled, subagentAvailable), effectiveModelId && _jsxs("span", { className: "codex-harness-badge", children: [effectiveModelId, subagentEffort ? ` · ${subagentEffort}` : ''] })] }), _jsx("span", { className: "codex-harness-cap-detail", children: t('capabilitySubagentNote') }), _jsxs("div", { className: "codex-harness-subagent-controls", children: [_jsxs("label", { className: "codex-harness-subagent-field", children: [_jsx("span", { children: t('capabilitySubagentModel') }), _jsxs("select", { "aria-label": t('capabilitySubagentModel'), value: effectiveModelId, disabled: !canEditSubagent || (availableModels.length === 0 && !subagentModel), onChange: event => {
|
|
149
|
+
const nextModel = event.target.value;
|
|
150
|
+
if (!nextModel)
|
|
151
|
+
return;
|
|
152
|
+
const targetMeta = availableModels.find(model => model.id === nextModel);
|
|
153
|
+
const keepEffort = !subagentEffort || !targetMeta?.efforts.length || targetMeta.efforts.includes(subagentEffort);
|
|
154
|
+
saveCodex('codexSubagentModel', {
|
|
155
|
+
codexSubagentModel: nextModel,
|
|
156
|
+
...(keepEffort ? {} : { codexSubagentEffort: undefined }),
|
|
157
|
+
});
|
|
158
|
+
}, children: [availableModels.length === 0 && !subagentModel && (_jsx("option", { value: "", children: t(subagentNeedsRestart ? 'capabilitySubagentRestart' : subagentModelsStatus === 'loading' ? 'capabilityLoading' : 'capabilitySubagentNoModels') })), subagentModel && !availableModels.some(model => model.id === subagentModel) && _jsx("option", { value: subagentModel, children: subagentModel }), availableModels.map(model => _jsx("option", { value: model.id, children: model.id }, model.id))] })] }), _jsxs("label", { className: "codex-harness-subagent-field", children: [_jsx("span", { children: t('capabilitySubagentEffort') }), _jsxs("select", { "aria-label": t('capabilitySubagentEffort'), value: subagentEffort, disabled: !canEditSubagent, onChange: event => {
|
|
159
|
+
saveCodex('codexSubagentEffort', { codexSubagentEffort: event.target.value || undefined });
|
|
160
|
+
}, children: [_jsx("option", { value: "", children: t('capabilitySubagentEffortDefault') }), subagentEffort && !effortChoices.includes(subagentEffort) && _jsx("option", { value: subagentEffort, children: subagentEffort }), effortChoices.map(effort => _jsx("option", { value: effort, children: effort }, effort))] })] }), _jsxs("label", { className: "codex-harness-subagent-field", children: [_jsx("span", { children: t('capabilitySubagentPreset') }), _jsxs("select", { "aria-label": t('capabilitySubagentPreset'), value: subagentPreset, disabled: !canEditSubagent, onChange: event => {
|
|
161
|
+
saveCodex('codexSubagentPreset', { codexSubagentPreset: event.target.value });
|
|
162
|
+
}, children: [_jsx("option", { value: CODEX_SUBAGENT_DEFAULT_PRESET, children: t('capabilitySubagentPresetHybrid') }), _jsx("option", { value: CODEX_SUBAGENT_PRESET_INHERIT, children: t('capabilitySubagentPresetInherit') }), subagentPreset !== CODEX_SUBAGENT_DEFAULT_PRESET && subagentPreset !== CODEX_SUBAGENT_PRESET_INHERIT && _jsx("option", { value: subagentPreset, children: subagentPreset })] })] })] })] }), _jsx("input", { type: "checkbox", role: "switch", "aria-label": t('capabilitySubagentTitle'), "aria-checked": subagentEnabled, checked: subagentEnabled, disabled: !canEditSubagent, onChange: event => {
|
|
163
|
+
const next = event.target.checked;
|
|
164
|
+
saveCodex('codexSubagentEnabled', {
|
|
165
|
+
codexSubagentEnabled: next,
|
|
166
|
+
...(next && !subagentModel && effectiveModelId ? { codexSubagentModel: effectiveModelId } : {}),
|
|
167
|
+
}, true);
|
|
168
|
+
} })] }), connectReady && !connectSnapshot.writable && _jsx("p", { className: "codex-harness-note", children: t('promptReadOnly') }), capError && _jsx("p", { role: "alert", children: capError })] }) : _jsxs("details", { className: "codex-harness-card codex-harness-collapse", "data-capability-group": "connect", "data-collapsed": "true", children: [_jsxs("summary", { children: [_jsx("span", { children: t('capabilitiesConnectCollapsedTitle') }), connectLoading && _jsx("span", { className: "codex-harness-badge", children: t('capabilityLoading') })] }), _jsxs("div", { className: "codex-harness-inline-row", children: [_jsx("span", { className: "codex-harness-cap-detail", children: t('capabilitiesConnectInstallHint') }), _jsx("a", { className: "codex-harness-link", href: CODEX_CONNECT_REPO_URL, target: "_blank", rel: "noopener noreferrer", children: "github.com/shuind/dsh-codex-connect" })] })] })] });
|
|
169
|
+
}
|
|
170
|
+
const EMPTY_UPDATE_SNAPSHOT = () => undefined;
|
|
171
|
+
export function HelpGuideSection({ active, updateStore, updateSnapshot, t }) {
|
|
149
172
|
if (!active)
|
|
150
173
|
return null;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
174
|
+
const cards = [
|
|
175
|
+
{ id: 'faq', heading: 'helpFaqHeading', items: [
|
|
176
|
+
['helpDeferDisabledTitle', 'helpDeferDisabledDesc'],
|
|
177
|
+
['helpDeferLifecycleTitle', 'helpDeferLifecycleDesc'],
|
|
178
|
+
['helpNativeSearchTitle', 'helpNativeSearchDesc'],
|
|
179
|
+
] },
|
|
180
|
+
{ id: 'connect', heading: 'helpConnectHeading', items: [
|
|
181
|
+
['helpRegistrationScopeTitle', 'helpRegistrationScopeDesc'],
|
|
182
|
+
['helpProComboTitle', 'helpProComboDesc'],
|
|
183
|
+
['helpConnectContextTitle', 'helpConnectContextDesc'],
|
|
184
|
+
] },
|
|
185
|
+
];
|
|
186
|
+
const status = updateSnapshot?.status ?? 'idle';
|
|
187
|
+
const currentVersion = updateSnapshot?.currentVersion;
|
|
188
|
+
const hasUpdate = status === 'update-available' && updateSnapshot?.latestVersion !== undefined;
|
|
189
|
+
return _jsxs("section", { "aria-label": t('settingsHelpPage'), className: "codex-harness-stack", children: [cards.map(card => _jsxs("div", { className: "codex-harness-card codex-harness-group", "data-help-section": card.id, children: [_jsx("h4", { children: t(card.heading) }), _jsx("ul", { className: "codex-harness-help-list", children: card.items.map(([titleKey, descKey]) => _jsxs("li", { children: [_jsx("strong", { children: t(titleKey) }), _jsx("span", { children: t(descKey) })] }, titleKey)) }), card.id === 'connect' && _jsxs("div", { className: "codex-harness-inline-row", style: { marginTop: 10, paddingTop: 8, borderTop: '0.5px solid var(--dsw-alias-border-l1)' }, children: [_jsxs("span", { className: "codex-harness-cap-detail", children: [t('helpConnectLinkLabel'), " \u00B7 ", _jsx("code", { children: CODEX_CONNECT_PACKAGE_NAME })] }), _jsx("a", { className: "codex-harness-link", href: CODEX_CONNECT_REPO_URL, target: "_blank", rel: "noopener noreferrer", children: "github.com/shuind/dsh-codex-connect" })] })] }, card.id)), _jsxs("div", { className: "codex-harness-card codex-harness-group", "data-help-section": "updates", children: [_jsx("h4", { children: t('helpUpdateHeading') }), _jsxs("div", { className: "codex-harness-inline-row", style: { marginBottom: 8 }, children: [_jsxs("div", { className: "codex-harness-cap-head", children: [_jsxs("span", { className: "codex-harness-cap-title", children: ["Codex Harness", currentVersion ? ` v${currentVersion}` : ''] }), hasUpdate && _jsxs("span", { className: "codex-harness-badge", "data-tone": "ok", children: [t('updateAvailable'), " v", updateSnapshot.latestVersion] }), status === 'up-to-date' && _jsx("span", { className: "codex-harness-badge", children: t('updateUpToDate') }), status === 'checking' && _jsx("span", { className: "codex-harness-badge", children: t('updateChecking') }), status === 'unavailable' && _jsx("span", { className: "codex-harness-badge", children: t('updateUnavailable') })] }), updateStore && _jsx("button", { type: "button", className: "codex-harness-btn", disabled: status === 'checking', onClick: () => { void updateStore.refresh(true); }, children: t('updateCheckNow') })] }), _jsx("p", { className: "codex-harness-note", style: { marginBottom: 6 }, children: t('updateHowTo') }), _jsxs("div", { className: "codex-harness-cap-head", children: [hasUpdate && updateSnapshot.releaseUrl && _jsxs("a", { className: "codex-harness-link", href: updateSnapshot.releaseUrl, target: "_blank", rel: "noopener noreferrer", children: [t('updateOpenRelease'), " (v", updateSnapshot.latestVersion, ")"] }), _jsx("a", { className: "codex-harness-link", href: CODEX_HARNESS_RELEASES_URL, target: "_blank", rel: "noopener noreferrer", children: "GitHub Releases" })] })] })] });
|
|
161
190
|
}
|
|
162
|
-
const EMPTY_CONNECT_SUBSCRIBE = () => () => { };
|
|
163
|
-
const EMPTY_CONNECT_SNAPSHOT = () => undefined;
|
|
164
191
|
export function CodexSettingsTab(props) {
|
|
165
|
-
const { toolPolicy, presetManager, getCodexConnectScope, t } = props;
|
|
192
|
+
const { toolPolicy, presetManager, getCodexConnectScope, updateStore, t } = props;
|
|
166
193
|
const [page, setPage] = useState(props.initialPage ?? 'tools');
|
|
194
|
+
const [toolsVersion, setToolsVersion] = useState(0);
|
|
167
195
|
const settingsSnapshot = typeof props.useSettings === 'function'
|
|
168
196
|
? props.useSettings(state => state)
|
|
169
197
|
: undefined;
|
|
170
198
|
const connectScope = getCodexConnectScope?.();
|
|
171
199
|
const connectSnapshot = useSyncExternalStore(connectScope ? connectScope.subscribe : EMPTY_CONNECT_SUBSCRIBE, connectScope ? connectScope.getSnapshot : EMPTY_CONNECT_SNAPSHOT, connectScope ? connectScope.getSnapshot : EMPTY_CONNECT_SNAPSHOT);
|
|
200
|
+
const updateSnapshot = useSyncExternalStore(updateStore ? updateStore.subscribe : EMPTY_CONNECT_SUBSCRIBE, updateStore ? updateStore.getSnapshot : EMPTY_UPDATE_SNAPSHOT, updateStore ? updateStore.getSnapshot : EMPTY_UPDATE_SNAPSHOT);
|
|
201
|
+
const hasUpdate = updateSnapshot?.status === 'update-available' && updateSnapshot.latestVersion !== undefined;
|
|
202
|
+
const imageEnabled = connectSnapshot?.status === 'ready' ? connectSnapshot.imageGenerationEnabled === true : undefined;
|
|
203
|
+
const subagentEnabled = settingsSnapshot?.status === 'ready' ? settingsSnapshot.value?.codexSubagentEnabled === true : undefined;
|
|
204
|
+
const prevRegistration = useRef();
|
|
205
|
+
const registrationKey = `${String(imageEnabled)}:${String(subagentEnabled)}`;
|
|
206
|
+
useEffect(() => {
|
|
207
|
+
if (prevRegistration.current !== undefined && prevRegistration.current !== registrationKey) {
|
|
208
|
+
if (presetManager !== undefined)
|
|
209
|
+
invalidatePresetTools(presetManager);
|
|
210
|
+
setToolsVersion(version => version + 1);
|
|
211
|
+
}
|
|
212
|
+
prevRegistration.current = registrationKey;
|
|
213
|
+
}, [registrationKey, presetManager]);
|
|
172
214
|
const gptCapabilities = resolveGptCapabilities(settingsSnapshot?.value, connectSnapshot);
|
|
173
215
|
const mode = page === 'tools' ? 'tools' : 'inactive';
|
|
174
|
-
return _jsxs("section", { className: "codex-harness-settings", children: [_jsx("style", { children: desktopStyles }), _jsxs("nav", { className: "codex-harness-nav", "aria-label": t('settingsTabLabel'), children: [_jsx("button", { type: "button", "aria-pressed": page === 'tools', onClick: () => setPage('tools'), children: t('settingsToolsPage') }), _jsx("button", { type: "button", "aria-pressed": page === 'runtime', onClick: () => setPage('runtime'), children: t('settingsRuntimePage') })] }), toolPolicy !== undefined && _jsx(ToolPolicySection, { binding: toolPolicy, presetManager: presetManager, mode: mode, gptCapabilities: gptCapabilities, t: t }), _jsx(RuntimeSettingsEditor, { ...props, active: page === 'runtime'
|
|
216
|
+
return _jsxs("section", { className: "codex-harness-settings", children: [_jsx("style", { children: desktopStyles }), _jsxs("nav", { className: "codex-harness-nav", "aria-label": t('settingsTabLabel'), children: [_jsx("button", { type: "button", "aria-pressed": page === 'tools', onClick: () => setPage('tools'), children: t('settingsToolsPage') }), _jsx("button", { type: "button", "aria-pressed": page === 'runtime', onClick: () => setPage('runtime'), children: t('settingsRuntimePage') }), _jsx("button", { type: "button", "data-nav-align": "end", "aria-pressed": page === 'help', onClick: () => setPage('help'), children: hasUpdate ? _jsxs(_Fragment, { children: [t('settingsHelpPage'), _jsx("span", { className: "codex-harness-badge", "data-tone": "ok", style: { marginLeft: 6 }, children: t('updateBadge') })] }) : t('settingsHelpPage') })] }), hasUpdate && _jsxs("div", { className: "codex-harness-update-bar", role: "status", "data-codex-update-banner": true, children: [_jsxs("span", { children: ["Codex Harness ", t('updateAvailable'), " v", updateSnapshot.latestVersion] }), updateSnapshot.releaseUrl && _jsx("a", { className: "codex-harness-link", href: updateSnapshot.releaseUrl, target: "_blank", rel: "noopener noreferrer", children: t('updateOpenRelease') })] }), toolPolicy !== undefined && _jsx(ToolPolicySection, { binding: toolPolicy, presetManager: presetManager, mode: mode, gptCapabilities: gptCapabilities, toolsVersion: toolsVersion, t: t }), _jsx(RuntimeSettingsEditor, { ...props, active: page === 'runtime', connectScope: connectScope, connectSnapshot: connectSnapshot, onImageRegistrationChanged: () => {
|
|
217
|
+
if (presetManager !== undefined)
|
|
218
|
+
invalidatePresetTools(presetManager);
|
|
219
|
+
setToolsVersion(version => version + 1);
|
|
220
|
+
} }), _jsx(HelpGuideSection, { active: page === 'help', updateStore: updateStore, updateSnapshot: updateSnapshot, t: t })] });
|
|
175
221
|
}
|
|
176
222
|
export const inject = ['commandUi', 'sessions', 'slots', 'locale', 'configForms', 'remote'];
|
|
177
223
|
export function apply(ctx) {
|
|
178
224
|
let form;
|
|
179
225
|
let connectScope;
|
|
226
|
+
let llmProvidersScope;
|
|
180
227
|
const getCodexConnectScope = () => {
|
|
181
228
|
try {
|
|
182
229
|
return connectScope ??= bindCodexConnectScope(ctx.configForms);
|
|
@@ -185,10 +232,19 @@ export function apply(ctx) {
|
|
|
185
232
|
return undefined;
|
|
186
233
|
}
|
|
187
234
|
};
|
|
235
|
+
const getLlmProvidersScope = () => {
|
|
236
|
+
try {
|
|
237
|
+
return llmProvidersScope ??= bindLlmProvidersScope(ctx.configForms);
|
|
238
|
+
}
|
|
239
|
+
catch {
|
|
240
|
+
return undefined;
|
|
241
|
+
}
|
|
242
|
+
};
|
|
188
243
|
applyWithSettingsApi(ctx, {
|
|
189
244
|
bind: host => { form = host.configForms.get('codex'); return adaptConfigForm(form); },
|
|
190
245
|
getCodexConnectScope,
|
|
191
|
-
|
|
246
|
+
getLlmProvidersScope,
|
|
247
|
+
register: (host, settings, manager, updateStore) => {
|
|
192
248
|
const desktop = host;
|
|
193
249
|
const presetManager = { ...manager, remote: host.remote };
|
|
194
250
|
const t = host.locale.bind('codex');
|
|
@@ -199,6 +255,7 @@ export function apply(ctx) {
|
|
|
199
255
|
unsetSetting: field => settings.unset(field),
|
|
200
256
|
presetManager,
|
|
201
257
|
toolPolicy,
|
|
258
|
+
updateStore,
|
|
202
259
|
getCodexConnectScope,
|
|
203
260
|
saveSettings: async (edits, revision) => {
|
|
204
261
|
await saveDesktopSettings(form, edits, revision);
|