@shuind/dsh-codex-harness 0.3.1 → 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 +29 -0
- package/README.md +21 -43
- package/docs/preset-library.md +2 -2
- package/docs/tool-policy.md +1 -1
- package/lib/client.js +1738 -327
- package/lib/compact-command.js +7 -1
- package/lib/compaction.js +7 -1
- package/lib/hybrid-executor.js +23 -12
- package/lib/index.js +1266 -36
- 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 +191 -126
- package/lib/types/client/index.d.ts +104 -28
- 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 +80 -20
- package/lib/types/client/policy-locale.js +197 -80
- 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 +7 -2
- package/lib/types/client/tool-policy.js +48 -6
- 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 +52 -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/compact-checkpoint.js +3 -10
- package/lib/types/responses/fetch-transport.js +24 -9
- package/lib/types/responses/remote-compact.js +39 -11
- 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 +370 -153
- package/src/client/index.tsx +122 -22
- package/src/client/policy-drafts.ts +45 -0
- package/src/client/policy-locale.ts +197 -80
- package/src/client/preset-manager.tsx +125 -4
- package/src/client/preset-requests.ts +185 -1
- package/src/client/tool-policy.tsx +63 -9
- package/src/contracts/preset-editor-schema.ts +44 -0
- package/src/contracts/settings.ts +20 -1
- package/src/contracts/ui-contracts.ts +91 -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/compact-checkpoint.ts +2 -8
- package/src/responses/fetch-transport.ts +28 -9
- package/src/responses/remote-compact.ts +41 -11
- 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
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: "
|
|
6297
|
+
display: "flex",
|
|
5728
6298
|
alignItems: "center",
|
|
5729
6299
|
gap: 5,
|
|
5730
6300
|
height: 28,
|
|
5731
6301
|
border: 0,
|
|
5732
|
-
borderRadius:
|
|
5733
|
-
padding: "
|
|
6302
|
+
borderRadius: "var(--dsw-radius-sm, 7px)",
|
|
6303
|
+
padding: "3px 6px 0",
|
|
5734
6304
|
font: "inherit",
|
|
5735
|
-
fontSize:
|
|
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,6 +6554,101 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5984
6554
|
]
|
|
5985
6555
|
}), document.body) : null] });
|
|
5986
6556
|
}
|
|
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
|
+
}
|
|
5987
6652
|
//#endregion
|
|
5988
6653
|
//#region lib/types/contracts/tool-policy-contract.js
|
|
5989
6654
|
/** Legacy configuration remains a baseline, never a live second veto of an explicit choice. */
|
|
@@ -6006,6 +6671,28 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
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: "
|
|
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
|
|
6784
|
+
settingsPreferHostedSearch: "Prefer native search",
|
|
6071
6785
|
settingsPreferRemoteCompaction: "Prefer remote compaction",
|
|
6072
|
-
settingsSharedFailed: "
|
|
6073
|
-
settingsRuntimeScope: "Shared in this environment",
|
|
6074
|
-
|
|
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
|
|
6814
|
+
settingsDefinitionAbsent: "Choose a preset first.",
|
|
6078
6815
|
globalGroupRequest: "Model requests",
|
|
6079
6816
|
globalGroupDisplay: "Display",
|
|
6080
6817
|
globalPending: "Unsaved",
|
|
@@ -6104,14 +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: "
|
|
6844
|
+
toolPolicyDeferHint: "Load on demand via activate_tools",
|
|
6108
6845
|
toolPolicyHide: "Hide",
|
|
6109
6846
|
toolPolicyReplaceShort: "Replace",
|
|
6110
|
-
toolPolicyRestoreChoice: "Restore default
|
|
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",
|
|
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).",
|
|
6115
6860
|
toolPolicyCommandGroup: "Commands & runtime",
|
|
6116
6861
|
toolPolicyFileGroup: "Files & search",
|
|
6117
6862
|
toolPolicyPlanGroup: "Planning & interaction",
|
|
@@ -6153,6 +6898,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6153
6898
|
toolLabelSubagent: "Spawn isolated subagent for a subtask",
|
|
6154
6899
|
toolLabelSubagentFork: "Fork subagent from current context",
|
|
6155
6900
|
toolLabelSubagentCodex: "Delegate task to Codex subagent",
|
|
6901
|
+
toolLabelCodexSubagent: "Delegate task to Codex subscription subagent",
|
|
6156
6902
|
toolLabelSubagentClaude: "Delegate task to Claude Code subagent",
|
|
6157
6903
|
toolLabelSubagentOar: "Run experimental OAR subagent",
|
|
6158
6904
|
toolLabelSubagentModels: "List available models for subagents",
|
|
@@ -6171,8 +6917,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6171
6917
|
toolLabelTeamGet: "Read latest shared Team task state",
|
|
6172
6918
|
toolLabelTeamList: "List shared Team tasks and blockers",
|
|
6173
6919
|
toolLabelTeamUpdate: "Update shared Team task with revision check",
|
|
6174
|
-
toolLabelWebSearch: "Search the web
|
|
6175
|
-
toolLabelWebFetch: "Fetch
|
|
6920
|
+
toolLabelWebSearch: "Search the web",
|
|
6921
|
+
toolLabelWebFetch: "Fetch text from HTTP(S) URL",
|
|
6176
6922
|
toolLabelSkill: "Load full instructions for a skill",
|
|
6177
6923
|
toolLabelActivateTools: "Activate deferred (deferLoading) tools",
|
|
6178
6924
|
toolLabelSchedule: "Manage scheduled tasks",
|
|
@@ -6199,30 +6945,30 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6199
6945
|
toolLabelStagehandObserve: "Observe interactive page elements (Stagehand)",
|
|
6200
6946
|
toolLabelStagehandShot: "Capture browser screenshot (Stagehand)",
|
|
6201
6947
|
toolLabelStagehandTabs: "Manage browser tabs (Stagehand)",
|
|
6202
|
-
toolLabelViewImage: "View local or HTTP(S) image
|
|
6203
|
-
toolLabelCodexImageGen: "Generate or edit images
|
|
6204
|
-
toolLabelCodexQuota: "Query
|
|
6948
|
+
toolLabelViewImage: "View local or HTTP(S) image",
|
|
6949
|
+
toolLabelCodexImageGen: "Generate or edit images",
|
|
6950
|
+
toolLabelCodexQuota: "Query Codex account quota",
|
|
6205
6951
|
toolLabelMcpDynamic: "MCP server tool",
|
|
6206
6952
|
toolLabelOther: "Other tool",
|
|
6207
6953
|
toolPolicyToolsLoading: "Loading tools…",
|
|
6208
6954
|
toolPolicyToolsEmpty: "No registered tools.",
|
|
6209
6955
|
toolPolicyNoMatches: "No matching tools.",
|
|
6210
|
-
toolPolicyToolsFailed: "
|
|
6956
|
+
toolPolicyToolsFailed: "Could not load tools; saved rules are kept.",
|
|
6211
6957
|
toolPolicyToolsRefresh: "Refresh tools",
|
|
6212
6958
|
toolPolicyCatalogLoading: "Loading presets…",
|
|
6213
6959
|
toolPolicyCatalogEmpty: "No presets found.",
|
|
6214
|
-
toolPolicyCatalogFailed: "
|
|
6960
|
+
toolPolicyCatalogFailed: "Could not load presets; saved IDs remain selectable.",
|
|
6215
6961
|
toolPolicyCatalogRetry: "Reload presets",
|
|
6216
6962
|
toolPolicyEmpty: "Choose a preset",
|
|
6217
|
-
toolPolicySave: "Save
|
|
6963
|
+
toolPolicySave: "Save",
|
|
6218
6964
|
toolPolicySaving: "Saving…",
|
|
6219
6965
|
toolPolicyDiscard: "Discard draft",
|
|
6220
|
-
toolPolicySaved: "
|
|
6966
|
+
toolPolicySaved: "Saved.",
|
|
6221
6967
|
toolPolicyInvalidPreset: "An empty preset ID cannot be saved.",
|
|
6222
6968
|
toolPolicyDuplicatePreset: "Duplicate preset IDs cannot be saved.",
|
|
6223
|
-
toolPolicyRefused: "
|
|
6969
|
+
toolPolicyRefused: "Save conflict. Discard draft to reload.",
|
|
6224
6970
|
toolPolicyFailed: "Save failed. Draft is kept.",
|
|
6225
|
-
toolPolicyReadOnly: "
|
|
6971
|
+
toolPolicyReadOnly: "Settings are read-only.",
|
|
6226
6972
|
pmRefresh: "Refresh",
|
|
6227
6973
|
peLoading: "Loading preset…",
|
|
6228
6974
|
peReadError: "Preset definition unavailable."
|
|
@@ -6230,18 +6976,68 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6230
6976
|
const toolPolicyZh = {
|
|
6231
6977
|
settingsTabLabel: "Codex Harness",
|
|
6232
6978
|
settingsToolsPage: "预设方案",
|
|
6233
|
-
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。",
|
|
6234
7007
|
settingsSubTools: "工具",
|
|
6235
7008
|
settingsPresetPrompts: "提示词",
|
|
6236
7009
|
settingsDefinition: "原始定义",
|
|
6237
|
-
settingsPreferHostedSearch: "
|
|
7010
|
+
settingsPreferHostedSearch: "优先使用原生搜索",
|
|
6238
7011
|
settingsPreferRemoteCompaction: "优先使用远程压缩",
|
|
6239
|
-
settingsSharedFailed: "
|
|
6240
|
-
settingsRuntimeScope: "
|
|
6241
|
-
|
|
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: "更新注册状态失败。",
|
|
6242
7038
|
settingsBundleSummary: "请在独立的 Codex Harness 设置页配置。",
|
|
6243
7039
|
settingsBundlePath: "设置 → 内置插件 → Codex Harness",
|
|
6244
|
-
settingsDefinitionAbsent: "
|
|
7040
|
+
settingsDefinitionAbsent: "请先选择一个预设。",
|
|
6245
7041
|
globalGroupRequest: "模型请求",
|
|
6246
7042
|
globalGroupDisplay: "界面",
|
|
6247
7043
|
globalPending: "未保存",
|
|
@@ -6260,135 +7056,144 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6260
7056
|
presetSummaryPrompts: "提示词",
|
|
6261
7057
|
toolPolicyDraftSummary: "本次修改",
|
|
6262
7058
|
toolPolicyRuleChanged: "预设方案调整",
|
|
6263
|
-
toolPolicyNoToolDelta: "
|
|
7059
|
+
toolPolicyNoToolDelta: "无待保存修改",
|
|
6264
7060
|
toolPolicySearch: "搜索工具",
|
|
6265
7061
|
toolPolicyFilter: "工具筛选",
|
|
6266
7062
|
toolPolicyAll: "全部",
|
|
6267
7063
|
toolPolicyModified: "已修改",
|
|
6268
|
-
toolPolicyDeferredFilter: "
|
|
7064
|
+
toolPolicyDeferredFilter: "已延迟",
|
|
6269
7065
|
toolPolicyReplaceable: "可替换",
|
|
6270
7066
|
toolPolicyDefaultDeferred: "默认延迟",
|
|
6271
7067
|
toolPolicyAction: "工具操作",
|
|
6272
7068
|
toolPolicyKeep: "启用",
|
|
6273
7069
|
toolPolicyDefer: "延迟",
|
|
6274
|
-
toolPolicyDeferHint: "
|
|
7070
|
+
toolPolicyDeferHint: "按需加载(调用时再激活)",
|
|
6275
7071
|
toolPolicyHide: "隐藏",
|
|
6276
7072
|
toolPolicyReplaceShort: "替换",
|
|
6277
|
-
toolPolicyRestoreChoice: "
|
|
7073
|
+
toolPolicyRestoreChoice: "恢复默认",
|
|
6278
7074
|
toolPolicyUnsupported: "已保存的替换当前不可用",
|
|
6279
7075
|
toolPolicyConditional: "按条件可用",
|
|
6280
7076
|
toolPolicyTargetExists: "替换目标已存在",
|
|
6281
7077
|
toolPolicyPresetDisabled: "原预设未启用",
|
|
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 订阅模型全局注册的子代理工具(在「全局设置」管理)。",
|
|
6282
7086
|
toolPolicyCommandGroup: "命令与执行",
|
|
6283
7087
|
toolPolicyFileGroup: "文件与检索",
|
|
6284
7088
|
toolPolicyPlanGroup: "规划与交互",
|
|
6285
7089
|
toolPolicyCollabGroup: "子代理与工作流",
|
|
6286
7090
|
toolPolicyOtherGroup: "网络与扩展",
|
|
6287
7091
|
toolPolicyCustomized: "项修改",
|
|
6288
|
-
toolLabelExec: "
|
|
6289
|
-
toolLabelStdin: "
|
|
7092
|
+
toolLabelExec: "运行终端命令(Shell / PTY)",
|
|
7093
|
+
toolLabelStdin: "读写交互式终端(PTY)",
|
|
6290
7094
|
toolLabelPwsh: "执行 PowerShell 命令",
|
|
6291
7095
|
toolLabelBash: "执行 Bash 命令",
|
|
6292
|
-
toolLabelRunCode: "
|
|
6293
|
-
toolLabelJobList: "
|
|
6294
|
-
toolLabelJobOutput: "
|
|
6295
|
-
toolLabelJobKill: "
|
|
6296
|
-
toolLabelTermOpen: "
|
|
6297
|
-
toolLabelTermList: "
|
|
6298
|
-
toolLabelTermRead: "
|
|
6299
|
-
toolLabelTermSend: "
|
|
6300
|
-
toolLabelTermSignal: "
|
|
6301
|
-
toolLabelTermClose: "
|
|
6302
|
-
toolLabelWorkdir: "
|
|
6303
|
-
toolLabelWorktree: "新建 Git
|
|
6304
|
-
toolLabelPatch: "
|
|
6305
|
-
toolLabelRead: "
|
|
6306
|
-
toolLabelWrite: "
|
|
6307
|
-
toolLabelEdit: "
|
|
6308
|
-
toolLabelStrReplace: "
|
|
6309
|
-
toolLabelGlob: "
|
|
6310
|
-
toolLabelGrep: "
|
|
6311
|
-
toolLabelImage: "
|
|
6312
|
-
toolLabelLsp: "
|
|
6313
|
-
toolLabelPlan: "
|
|
6314
|
-
toolLabelTodo: "
|
|
6315
|
-
toolLabelExitPlan: "
|
|
6316
|
-
toolLabelAskUser: "
|
|
6317
|
-
toolLabelPresent: "
|
|
6318
|
-
toolLabelProposeAction: "
|
|
6319
|
-
toolLabelApprove: "
|
|
6320
|
-
toolLabelSubagent: "
|
|
6321
|
-
toolLabelSubagentFork: "
|
|
6322
|
-
toolLabelSubagentCodex: "
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
|
|
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)",
|
|
6368
7173
|
toolLabelStagehandTabs: "管理浏览器标签页(Stagehand)",
|
|
6369
|
-
toolLabelViewImage: "
|
|
6370
|
-
toolLabelCodexImageGen: "
|
|
6371
|
-
toolLabelCodexQuota: "
|
|
7174
|
+
toolLabelViewImage: "查看本地或网络图片",
|
|
7175
|
+
toolLabelCodexImageGen: "生成或编辑图片",
|
|
7176
|
+
toolLabelCodexQuota: "查询 Codex 账号额度",
|
|
6372
7177
|
toolLabelMcpDynamic: "MCP 扩展工具",
|
|
6373
7178
|
toolLabelOther: "其它工具",
|
|
6374
7179
|
toolPolicyToolsLoading: "正在读取工具…",
|
|
6375
7180
|
toolPolicyToolsEmpty: "没有已注册工具。",
|
|
6376
7181
|
toolPolicyNoMatches: "没有匹配工具。",
|
|
6377
|
-
toolPolicyToolsFailed: "
|
|
7182
|
+
toolPolicyToolsFailed: "无法加载工具列表,已保存规则不受影响。",
|
|
6378
7183
|
toolPolicyToolsRefresh: "刷新工具",
|
|
6379
7184
|
toolPolicyCatalogLoading: "正在读取预设…",
|
|
6380
7185
|
toolPolicyCatalogEmpty: "没有可选预设。",
|
|
6381
|
-
toolPolicyCatalogFailed: "
|
|
7186
|
+
toolPolicyCatalogFailed: "无法加载预设列表,仍可选择已保存项。",
|
|
6382
7187
|
toolPolicyCatalogRetry: "重新读取预设",
|
|
6383
7188
|
toolPolicyEmpty: "请选择预设",
|
|
6384
|
-
toolPolicySave: "
|
|
7189
|
+
toolPolicySave: "保存",
|
|
6385
7190
|
toolPolicySaving: "正在保存…",
|
|
6386
7191
|
toolPolicyDiscard: "放弃草稿",
|
|
6387
|
-
toolPolicySaved: "
|
|
7192
|
+
toolPolicySaved: "已保存。",
|
|
6388
7193
|
toolPolicyInvalidPreset: "预设 ID 为空,无法保存。",
|
|
6389
7194
|
toolPolicyDuplicatePreset: "预设 ID 重复,无法保存。",
|
|
6390
|
-
toolPolicyRefused: "
|
|
6391
|
-
toolPolicyFailed: "
|
|
7195
|
+
toolPolicyRefused: "保存冲突,请放弃草稿后重试。",
|
|
7196
|
+
toolPolicyFailed: "保存失败,草稿已保留。",
|
|
6392
7197
|
toolPolicyReadOnly: "当前设置为只读。",
|
|
6393
7198
|
pmRefresh: "刷新",
|
|
6394
7199
|
peLoading: "正在读取预设…",
|
|
@@ -6437,6 +7242,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6437
7242
|
"subagent",
|
|
6438
7243
|
"subagent_fork",
|
|
6439
7244
|
"subagent_codex",
|
|
7245
|
+
"codex_subagent",
|
|
6440
7246
|
"subagent_claude_code",
|
|
6441
7247
|
"subagent_oar",
|
|
6442
7248
|
"list_subagent_models",
|
|
@@ -6499,6 +7305,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6499
7305
|
subagent: "toolLabelSubagent",
|
|
6500
7306
|
subagent_fork: "toolLabelSubagentFork",
|
|
6501
7307
|
subagent_codex: "toolLabelSubagentCodex",
|
|
7308
|
+
codex_subagent: "toolLabelCodexSubagent",
|
|
6502
7309
|
subagent_claude_code: "toolLabelSubagentClaude",
|
|
6503
7310
|
subagent_oar: "toolLabelSubagentOar",
|
|
6504
7311
|
list_subagent_models: "toolLabelSubagentModels",
|
|
@@ -6583,6 +7390,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6583
7390
|
.codex-tool-policy .codex-tool-policy-description { font-size:12px; color:var(--dsw-alias-label-secondary); }
|
|
6584
7391
|
.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
7392
|
.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; }
|
|
7393
|
+
.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
7394
|
.codex-tool-policy .codex-badge[data-tone=warn] { color:var(--dsw-alias-state-warn-primary); }
|
|
6587
7395
|
.codex-tool-policy .codex-tool-policy-action { display:flex; align-items:center; gap:6px; flex-shrink:0; }
|
|
6588
7396
|
.codex-tool-policy .codex-tool-policy-prompts { display:flex; flex-direction:column; gap:10px; }
|
|
@@ -6691,7 +7499,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6691
7499
|
...props
|
|
6692
7500
|
});
|
|
6693
7501
|
}
|
|
6694
|
-
function ToolPolicySettingsCard({ form, presetManager, mode = "tools", t }) {
|
|
7502
|
+
function ToolPolicySettingsCard({ form, presetManager, mode = "tools", gptCapabilities, toolsVersion = 0, t }) {
|
|
6695
7503
|
const snapshot = (0, react.useSyncExternalStore)((listener) => form.subscribe(listener), () => form.getSnapshot(), () => form.getSnapshot());
|
|
6696
7504
|
const [subMode, setSubMode] = (0, react.useState)(mode === "prompts" || mode === "definition" ? mode : "tools");
|
|
6697
7505
|
const prevMode = (0, react.useRef)(mode);
|
|
@@ -6787,6 +7595,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6787
7595
|
toolsRequest.current++;
|
|
6788
7596
|
};
|
|
6789
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
|
+
]);
|
|
6790
7610
|
const cached = presetManager && selectedId ? cachedPresetTools(presetManager, selectedId) : void 0;
|
|
6791
7611
|
const inventory = toolsView?.preset === selectedId && toolsView.status === "error" ? void 0 : toolsView?.preset === selectedId && toolsView.status === "ready" ? toolsView.value : cached;
|
|
6792
7612
|
const toolsStatus = inventory ? "ready" : toolsView?.preset === selectedId ? toolsView.status : selectedId ? "loading" : "error";
|
|
@@ -6950,6 +7770,35 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6950
7770
|
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
7771
|
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
7772
|
const unavailable = (reason) => t(reason === "conditional" ? "toolPolicyConditional" : reason === "target-exists" ? "toolPolicyTargetExists" : "toolPolicyUnsupported");
|
|
7773
|
+
const gptSearchActive = gptCapabilities?.hostedWebSearch === true || gptCapabilities?.codexSearch === true;
|
|
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
|
+
}
|
|
7782
|
+
if (tool.name === "codex_connect_image_generate") return {
|
|
7783
|
+
label: `${t("toolPolicyGptCodexSearch")} · ${formatGptImageBadge(gptCapabilities?.imageModelHint)}`,
|
|
7784
|
+
title: t("toolPolicyGptImageTitle")
|
|
7785
|
+
};
|
|
7786
|
+
if (tool.name === "web_search" && gptSearchActive) {
|
|
7787
|
+
const model = gptCapabilities?.codexSearchModel;
|
|
7788
|
+
if (gptCapabilities?.hostedWebSearch && gptCapabilities?.codexSearch) return {
|
|
7789
|
+
label: t("toolPolicyGptDualSearch"),
|
|
7790
|
+
title: model ? `${t("toolPolicyGptDualSearchTitle")} (${model})` : t("toolPolicyGptDualSearchTitle")
|
|
7791
|
+
};
|
|
7792
|
+
if (gptCapabilities?.hostedWebSearch) return {
|
|
7793
|
+
label: t("toolPolicyGptHostedSearch"),
|
|
7794
|
+
title: t("toolPolicyGptHostedSearchTitle")
|
|
7795
|
+
};
|
|
7796
|
+
return {
|
|
7797
|
+
label: model ? `${t("toolPolicyGptCodexSearch")} · ${model}` : t("toolPolicyGptCodexSearch"),
|
|
7798
|
+
title: model ? `${t("toolPolicyGptCodexSearchTitle")} (${model})` : t("toolPolicyGptCodexSearchTitle")
|
|
7799
|
+
};
|
|
7800
|
+
}
|
|
7801
|
+
};
|
|
6953
7802
|
const renderRows = (tools) => (0, react_jsx_runtime.jsxs)("div", {
|
|
6954
7803
|
className: "codex-tool-policy-table",
|
|
6955
7804
|
role: "table",
|
|
@@ -6960,6 +7809,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6960
7809
|
const supported = action === "keep" || action === "hide" || action === "defer" || tool.replacements.some((option) => option.action === action);
|
|
6961
7810
|
const custom = customized(tool);
|
|
6962
7811
|
const hasOverride = !!rule?.tools?.some((choice) => choice.name === tool.name);
|
|
7812
|
+
const gptBadge = gptBadgeFor(tool);
|
|
6963
7813
|
return (0, react_jsx_runtime.jsxs)("div", {
|
|
6964
7814
|
role: "row",
|
|
6965
7815
|
className: "codex-tool-policy-tool",
|
|
@@ -6978,6 +7828,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6978
7828
|
title: tool.description,
|
|
6979
7829
|
children: human(tool)
|
|
6980
7830
|
}),
|
|
7831
|
+
gptBadge && (0, react_jsx_runtime.jsx)("span", {
|
|
7832
|
+
className: "codex-badge",
|
|
7833
|
+
"data-tone": "gpt",
|
|
7834
|
+
title: gptBadge.title,
|
|
7835
|
+
children: gptBadge.label
|
|
7836
|
+
}),
|
|
6981
7837
|
tool.defaultDeferred && !custom && (0, react_jsx_runtime.jsx)("span", {
|
|
6982
7838
|
className: "codex-badge",
|
|
6983
7839
|
"data-tone": "blue",
|
|
@@ -7074,7 +7930,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7074
7930
|
const isFiltering = text.length > 0 || filter !== "all";
|
|
7075
7931
|
const allTools = inventory?.tools ?? [];
|
|
7076
7932
|
const hasReplaceable = allTools.some((tool) => tool.replacements.some((option) => option.available));
|
|
7077
|
-
const shown = allTools.filter((tool) =>
|
|
7933
|
+
const shown = allTools.filter((tool) => {
|
|
7934
|
+
const gptBadge = gptBadgeFor(tool);
|
|
7935
|
+
const haystack = `${human(tool)} ${tool.name} ${tool.description} ${gptBadge?.label ?? ""}`.toLowerCase();
|
|
7936
|
+
return (!text || haystack.includes(text)) && (filter === "all" || (filter === "modified" ? customized(tool) : filter === "deferred" ? chosen(tool) === "defer" : tool.replacements.some((option) => option.available)));
|
|
7937
|
+
});
|
|
7078
7938
|
return (0, react_jsx_runtime.jsxs)("section", {
|
|
7079
7939
|
className: "codex-tool-policy",
|
|
7080
7940
|
"aria-label": t(activeSub === "prompts" ? "settingsPresetPrompts" : "toolPolicyTitle"),
|
|
@@ -7360,24 +8220,28 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7360
8220
|
...toolPolicyEn,
|
|
7361
8221
|
fast: "Fast mode",
|
|
7362
8222
|
fastModeControl: "Show fast mode control",
|
|
8223
|
+
proModeControl: "Show API Pro mode control",
|
|
7363
8224
|
contextWindowControl: "Show context window control",
|
|
7364
8225
|
fastOn: "Fast mode on (priority tier)",
|
|
7365
8226
|
fastOff: "Fast mode off",
|
|
7366
8227
|
fastStateOn: "On",
|
|
7367
8228
|
fastStateOff: "Off",
|
|
8229
|
+
pro: "Pro",
|
|
8230
|
+
proOn: "Pro mode on",
|
|
8231
|
+
proOff: "Pro mode off",
|
|
7368
8232
|
contextSize: "Context size",
|
|
7369
8233
|
contextShortDefault: "Ctx",
|
|
7370
8234
|
contextDefaultOption: "Default",
|
|
7371
8235
|
contextCustomPlaceholder: "≥16k (e.g. 64)",
|
|
7372
8236
|
contextApply: "Set",
|
|
7373
8237
|
compactRemote: "Remote compaction",
|
|
7374
|
-
compactRemoteHint: "Use
|
|
7375
|
-
compactLocal: "
|
|
7376
|
-
compactLocalHint: "
|
|
8238
|
+
compactRemoteHint: "Use provider remote compaction first.",
|
|
8239
|
+
compactLocal: "Model summary",
|
|
8240
|
+
compactLocalHint: "Compact context with a model summary.",
|
|
7377
8241
|
capabilityActivity: "Activity indicator",
|
|
7378
8242
|
promptDiscard: "Discard",
|
|
7379
8243
|
promptSaving: "Saving...",
|
|
7380
|
-
promptReadOnly: "
|
|
8244
|
+
promptReadOnly: "Settings are read-only.",
|
|
7381
8245
|
activityCompacting: "Compacting context...",
|
|
7382
8246
|
activityRequestingModel: "Requesting model...",
|
|
7383
8247
|
activityModelReply: "Model replying..."
|
|
@@ -7385,25 +8249,29 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7385
8249
|
const zh = {
|
|
7386
8250
|
...toolPolicyZh,
|
|
7387
8251
|
fastModeControl: "显示快速模式开关",
|
|
8252
|
+
proModeControl: "显示 API Pro 模式开关",
|
|
7388
8253
|
contextWindowControl: "显示上下文大小快捷按钮",
|
|
7389
8254
|
fast: "快速模式",
|
|
7390
8255
|
fastOn: "快速模式已开启(优先通道)",
|
|
7391
8256
|
fastOff: "快速模式已关闭",
|
|
7392
8257
|
fastStateOn: "开",
|
|
7393
8258
|
fastStateOff: "关",
|
|
8259
|
+
pro: "Pro",
|
|
8260
|
+
proOn: "Pro 模式已开启",
|
|
8261
|
+
proOff: "Pro 模式已关闭",
|
|
7394
8262
|
contextSize: "上下文大小",
|
|
7395
8263
|
contextShortDefault: "上下文",
|
|
7396
8264
|
contextDefaultOption: "默认",
|
|
7397
8265
|
contextCustomPlaceholder: "≥16k (如 64)",
|
|
7398
8266
|
contextApply: "确定",
|
|
7399
8267
|
compactRemote: "远程压缩",
|
|
7400
|
-
compactRemoteHint: "
|
|
7401
|
-
compactLocal: "
|
|
7402
|
-
compactLocalHint: "
|
|
8268
|
+
compactRemoteHint: "优先使用服务端远程压缩。",
|
|
8269
|
+
compactLocal: "模型摘要",
|
|
8270
|
+
compactLocalHint: "使用模型摘要压缩上下文。",
|
|
7403
8271
|
capabilityActivity: "活动状态",
|
|
7404
8272
|
promptDiscard: "放弃",
|
|
7405
8273
|
promptSaving: "保存中...",
|
|
7406
|
-
promptReadOnly: "
|
|
8274
|
+
promptReadOnly: "当前设置为只读。",
|
|
7407
8275
|
activityCompacting: "正在压缩上下文...",
|
|
7408
8276
|
activityRequestingModel: "请求中...",
|
|
7409
8277
|
activityModelReply: "回复中..."
|
|
@@ -7435,14 +8303,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7435
8303
|
children: [(0, react_jsx_runtime.jsx)("span", { children: t("fast") }), (0, react_jsx_runtime.jsx)("span", {
|
|
7436
8304
|
style: {
|
|
7437
8305
|
color: "var(--dsw-alias-label-secondary)",
|
|
7438
|
-
fontSize:
|
|
8306
|
+
fontSize: 12
|
|
7439
8307
|
},
|
|
7440
8308
|
children: fast ? t("fastStateOn") : t("fastStateOff")
|
|
7441
8309
|
})]
|
|
7442
8310
|
});
|
|
7443
8311
|
}
|
|
7444
8312
|
function ComposerControls(props) {
|
|
7445
|
-
return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
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
|
+
] });
|
|
7446
8318
|
}
|
|
7447
8319
|
function elapsedSeconds(startedAt, now) {
|
|
7448
8320
|
return Math.max(0, Math.floor((now - startedAt) / 1e3));
|
|
@@ -7535,11 +8407,119 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7535
8407
|
}, "codex client: preset editor remote");
|
|
7536
8408
|
});
|
|
7537
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
|
+
};
|
|
7538
8427
|
return {
|
|
7539
|
-
remote,
|
|
8428
|
+
remote: new Proxy(remote ?? {}, { get(target, prop, receiver) {
|
|
8429
|
+
if (prop === "codexPresetEditor") return resolveCodexPresetEditor();
|
|
8430
|
+
return Reflect.get(target, prop, receiver);
|
|
8431
|
+
} }),
|
|
7540
8432
|
ready
|
|
7541
8433
|
};
|
|
7542
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
|
+
}
|
|
7543
8523
|
function applyWithSettingsApi(ctx, api) {
|
|
7544
8524
|
ctx.effect(() => ctx.locale.register(NS, {
|
|
7545
8525
|
en,
|
|
@@ -7580,6 +8560,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7580
8560
|
}), "codex client: /compact mode picker");
|
|
7581
8561
|
const settings = api.bind(ctx);
|
|
7582
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");
|
|
7583
8580
|
const injected = () => ({
|
|
7584
8581
|
hooks: { settings },
|
|
7585
8582
|
setSetting: (field, value) => settings.set(field, value),
|
|
@@ -7593,7 +8590,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7593
8590
|
locale: NS,
|
|
7594
8591
|
inject: (sessionId) => ({
|
|
7595
8592
|
...injected(),
|
|
8593
|
+
injectedSessionId: typeof sessionId === "string" ? sessionId : sessionId !== void 0 && sessionId !== null ? String(sessionId) : void 0,
|
|
7596
8594
|
getCodexConnectScope: api.getCodexConnectScope,
|
|
8595
|
+
getLlmProvidersScope: api.getLlmProvidersScope,
|
|
7597
8596
|
modelDirectory: sessionId === void 0 ? void 0 : ctx.get("modelDirectories")?.directoryFor(sessionId)?.store
|
|
7598
8597
|
})
|
|
7599
8598
|
}, ComposerControls));
|
|
@@ -7604,130 +8603,70 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7604
8603
|
locale: NS,
|
|
7605
8604
|
inject: injected
|
|
7606
8605
|
}, ActivityLine));
|
|
7607
|
-
ctx.
|
|
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));
|
|
7608
8614
|
}
|
|
7609
8615
|
//#endregion
|
|
7610
8616
|
//#region lib/types/client/desktop.js
|
|
7611
8617
|
/** A single Settings workspace; the bundle page is only a signpost. */
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
for (const [k, v] of Object.entries(record)) if (v === null || typeof v === "number" && Number.isSafeInteger(v) && v > 0) out[k] = v;
|
|
7620
|
-
return out;
|
|
7621
|
-
}
|
|
7622
|
-
function bindCodexConnectScope(configForms) {
|
|
7623
|
-
const form = configForms.get(OPENAI_CODEX_SETTINGS_NAMESPACE);
|
|
7624
|
-
const mirror = configForms.describe?.();
|
|
7625
|
-
Promise.resolve(mirror?.ensure?.()).catch(() => {});
|
|
7626
|
-
let lastFormSnap;
|
|
7627
|
-
let lastMirrorSnap;
|
|
7628
|
-
let projected = {
|
|
7629
|
-
status: "loading",
|
|
7630
|
-
writable: false
|
|
7631
|
-
};
|
|
7632
|
-
const getSnapshot = () => {
|
|
7633
|
-
const formSnap = form.getSnapshot();
|
|
7634
|
-
const mirrorSnap = mirror?.getSnapshot();
|
|
7635
|
-
if (formSnap === lastFormSnap && mirrorSnap === lastMirrorSnap) return projected;
|
|
7636
|
-
lastFormSnap = formSnap;
|
|
7637
|
-
lastMirrorSnap = mirrorSnap;
|
|
7638
|
-
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
|
-
};
|
|
7646
|
-
const view = mirrorSnap?.view;
|
|
7647
|
-
if (view !== void 0) {
|
|
7648
|
-
const row = view.namespaces?.find((candidate) => candidate.ns === OPENAI_CODEX_SETTINGS_NAMESPACE);
|
|
7649
|
-
const rowRecord = row === void 0 ? void 0 : asRecord(row.value);
|
|
7650
|
-
if (row === void 0 || rowRecord === void 0) return projected = {
|
|
7651
|
-
status: "unavailable",
|
|
7652
|
-
writable: false
|
|
7653
|
-
};
|
|
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
|
-
};
|
|
7661
|
-
}
|
|
7662
|
-
return projected = {
|
|
7663
|
-
status: formSnap.status,
|
|
7664
|
-
writable: formSnap.writable
|
|
7665
|
-
};
|
|
7666
|
-
};
|
|
7667
|
-
return {
|
|
7668
|
-
getSnapshot,
|
|
7669
|
-
subscribe: (listener) => {
|
|
7670
|
-
const stopForm = form.subscribe(listener);
|
|
7671
|
-
const stopMirror = mirror?.subscribe(listener);
|
|
7672
|
-
return () => {
|
|
7673
|
-
stopForm();
|
|
7674
|
-
stopMirror?.();
|
|
7675
|
-
};
|
|
7676
|
-
},
|
|
7677
|
-
setModelOverride: async (modelId, tokens) => {
|
|
7678
|
-
const snap = getSnapshot();
|
|
7679
|
-
const next = nextOpenAICodexOverrides(snap.overrides, snap.baseOverrides, modelId, tokens);
|
|
7680
|
-
if (!(next === void 0 ? await form.unset("contextWindowOverrides") : await form.set("contextWindowOverrides", next))) throw new Error("The host did not accept the settings change.");
|
|
7681
|
-
},
|
|
7682
|
-
setNativeCompaction: async (enabled) => {
|
|
7683
|
-
if (!await form.set("enableNativeCompaction", enabled)) throw new Error("The host did not accept the settings change.");
|
|
7684
|
-
}
|
|
7685
|
-
};
|
|
7686
|
-
}
|
|
7687
|
-
function adaptConfigForm(form) {
|
|
7688
|
-
const accepted = async (result) => {
|
|
7689
|
-
if (!await result) throw new Error("The host did not accept the settings change.");
|
|
7690
|
-
};
|
|
7691
|
-
return {
|
|
7692
|
-
getSnapshot: () => form.getSnapshot(),
|
|
7693
|
-
subscribe: (listener) => form.subscribe(listener),
|
|
7694
|
-
set: (field, value) => accepted(form.set(field, value)),
|
|
7695
|
-
unset: (field) => accepted(form.unset(field))
|
|
7696
|
-
};
|
|
7697
|
-
}
|
|
7698
|
-
async function saveDesktopSettings(form, edits, expectedRevision) {
|
|
7699
|
-
const ops = Object.entries(edits).map(([field, value]) => value === void 0 ? {
|
|
7700
|
-
op: "unset",
|
|
7701
|
-
path: [field]
|
|
7702
|
-
} : {
|
|
7703
|
-
op: "set",
|
|
7704
|
-
path: [field],
|
|
7705
|
-
value
|
|
7706
|
-
});
|
|
7707
|
-
if (!ops.length) return;
|
|
7708
|
-
if (!(expectedRevision === void 0 ? await form.mutate(ops) : await form.mutate(ops, expectedRevision))) throw new Error("The host did not accept the settings change.");
|
|
7709
|
-
}
|
|
8618
|
+
const DEFAULT_EFFORTS = [
|
|
8619
|
+
"low",
|
|
8620
|
+
"medium",
|
|
8621
|
+
"high",
|
|
8622
|
+
"xhigh",
|
|
8623
|
+
"max"
|
|
8624
|
+
];
|
|
7710
8625
|
const desktopStyles = `
|
|
7711
8626
|
.codex-harness-settings { max-width:760px; min-width:0; font-size:13px; color:var(--dsw-alias-label-primary); }
|
|
7712
8627
|
.codex-harness-settings h3 { font-size:14px; margin:0 0 10px; }
|
|
7713
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); }
|
|
7714
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; }
|
|
7715
8631
|
.codex-harness-settings .codex-harness-nav button[aria-pressed=true] { color:var(--dsw-alias-label-primary); font-weight:500; }
|
|
7716
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; }
|
|
7717
8641
|
.codex-harness-settings button { box-sizing:border-box; min-width:0; max-width:100%; font:inherit; color:inherit; }
|
|
7718
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; }
|
|
7719
8643
|
.codex-harness-settings .codex-harness-btn:disabled { opacity:.48; cursor:default; }
|
|
7720
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; }
|
|
7721
|
-
.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; }
|
|
7722
8646
|
.codex-harness-settings fieldset { min-width:0; border:0; padding:0; margin:0; display:flex; flex-direction:column; gap:12px; }
|
|
7723
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; }
|
|
7724
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); }
|
|
7725
8653
|
.codex-harness-settings .codex-harness-group h4 { margin:0 0 6px; font-size:12px; font-weight:600; color:var(--dsw-alias-label-secondary); }
|
|
7726
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); }
|
|
7727
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; }
|
|
7728
8667
|
.codex-harness-settings .codex-harness-note { margin:0 0 12px; color:var(--dsw-alias-label-secondary); font-size:12px; line-height:1.5; }
|
|
7729
|
-
.codex-harness-settings .codex-harness-actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:4px; }
|
|
7730
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; }
|
|
7731
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; }
|
|
7732
8671
|
.codex-harness-settings input[role=switch]:checked { background:var(--dsw-alias-label-primary); border-color:transparent; }
|
|
7733
8672
|
.codex-harness-settings input[role=switch]:checked:before { left:16.5px; background:var(--dsw-alias-bg-base); }
|
|
@@ -7736,93 +8675,121 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7736
8675
|
function DesktopSettingsCard({ t }) {
|
|
7737
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") })] });
|
|
7738
8677
|
}
|
|
7739
|
-
|
|
7740
|
-
|
|
7741
|
-
|
|
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;
|
|
7742
8683
|
const snapshot = useSettings((state) => state);
|
|
7743
|
-
const [
|
|
7744
|
-
const [saving, setSaving] = (0, react.useState)(false);
|
|
8684
|
+
const [busyField, setBusyField] = (0, react.useState)(null);
|
|
7745
8685
|
const [error, setError] = (0, react.useState)("");
|
|
7746
|
-
const
|
|
7747
|
-
const
|
|
7748
|
-
const
|
|
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);
|
|
7749
8714
|
setError("");
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
[field]: next
|
|
7754
|
-
},
|
|
7755
|
-
revision: current === void 0 ? snapshot.revision : current.revision
|
|
7756
|
-
}));
|
|
8715
|
+
saveSettings(edits, snapshot.revision).then(() => {
|
|
8716
|
+
if (refreshTools) onImageRegistrationChanged?.();
|
|
8717
|
+
}).catch(() => setError(t("settingsSharedFailed"))).finally(() => setBusyField((current) => current === key ? null : current));
|
|
7757
8718
|
};
|
|
7758
|
-
const
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
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
|
+
});
|
|
7774
8751
|
return (0, react_jsx_runtime.jsxs)("section", {
|
|
7775
8752
|
"aria-label": t("settingsRuntimePage"),
|
|
8753
|
+
className: "codex-harness-stack",
|
|
7776
8754
|
children: [
|
|
7777
|
-
(0, react_jsx_runtime.
|
|
8755
|
+
(0, react_jsx_runtime.jsx)("p", {
|
|
7778
8756
|
className: "codex-harness-note",
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
|
|
7785
|
-
|
|
7786
|
-
|
|
7787
|
-
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
|
|
7806
|
-
|
|
7807
|
-
|
|
7808
|
-
|
|
7809
|
-
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
}), (0, react_jsx_runtime.jsx)("button", {
|
|
7816
|
-
className: "codex-harness-btn",
|
|
7817
|
-
type: "button",
|
|
7818
|
-
disabled: draft === void 0,
|
|
7819
|
-
onClick: () => {
|
|
7820
|
-
setDraft(void 0);
|
|
7821
|
-
setError("");
|
|
7822
|
-
},
|
|
7823
|
-
children: t("promptDiscard")
|
|
7824
|
-
})]
|
|
7825
|
-
})]
|
|
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))
|
|
7826
8793
|
})
|
|
7827
8794
|
}),
|
|
7828
8795
|
!snapshot.writable && (0, react_jsx_runtime.jsx)("p", {
|
|
@@ -7832,13 +8799,400 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7832
8799
|
error && (0, react_jsx_runtime.jsx)("p", {
|
|
7833
8800
|
role: "alert",
|
|
7834
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
|
+
})]
|
|
7835
9036
|
})
|
|
7836
9037
|
]
|
|
7837
9038
|
});
|
|
7838
9039
|
}
|
|
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
|
+
}
|
|
7839
9175
|
function CodexSettingsTab(props) {
|
|
7840
|
-
const { toolPolicy, presetManager, t } = props;
|
|
9176
|
+
const { toolPolicy, presetManager, getCodexConnectScope, updateStore, t } = props;
|
|
7841
9177
|
const [page, setPage] = (0, react.useState)(props.initialPage ?? "tools");
|
|
9178
|
+
const [toolsVersion, setToolsVersion] = (0, react.useState)(0);
|
|
9179
|
+
const settingsSnapshot = typeof props.useSettings === "function" ? props.useSettings((state) => state) : void 0;
|
|
9180
|
+
const connectScope = getCodexConnectScope?.();
|
|
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]);
|
|
9195
|
+
const gptCapabilities = resolveGptCapabilities(settingsSnapshot?.value, connectSnapshot);
|
|
7842
9196
|
const mode = page === "tools" ? "tools" : "inactive";
|
|
7843
9197
|
return (0, react_jsx_runtime.jsxs)("section", {
|
|
7844
9198
|
className: "codex-harness-settings",
|
|
@@ -7847,27 +9201,73 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7847
9201
|
(0, react_jsx_runtime.jsxs)("nav", {
|
|
7848
9202
|
className: "codex-harness-nav",
|
|
7849
9203
|
"aria-label": t("settingsTabLabel"),
|
|
7850
|
-
children: [
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
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")
|
|
7860
9246
|
})]
|
|
7861
9247
|
}),
|
|
7862
9248
|
toolPolicy !== void 0 && (0, react_jsx_runtime.jsx)(ToolPolicySection, {
|
|
7863
9249
|
binding: toolPolicy,
|
|
7864
9250
|
presetManager,
|
|
7865
9251
|
mode,
|
|
9252
|
+
gptCapabilities,
|
|
9253
|
+
toolsVersion,
|
|
7866
9254
|
t
|
|
7867
9255
|
}),
|
|
7868
9256
|
(0, react_jsx_runtime.jsx)(RuntimeSettingsEditor, {
|
|
7869
9257
|
...props,
|
|
7870
|
-
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
|
|
7871
9271
|
})
|
|
7872
9272
|
]
|
|
7873
9273
|
});
|
|
@@ -7875,6 +9275,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7875
9275
|
function apply$1(ctx) {
|
|
7876
9276
|
let form;
|
|
7877
9277
|
let connectScope;
|
|
9278
|
+
let llmProvidersScope;
|
|
7878
9279
|
const getCodexConnectScope = () => {
|
|
7879
9280
|
try {
|
|
7880
9281
|
return connectScope ??= bindCodexConnectScope(ctx.configForms);
|
|
@@ -7882,13 +9283,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7882
9283
|
return;
|
|
7883
9284
|
}
|
|
7884
9285
|
};
|
|
9286
|
+
const getLlmProvidersScope = () => {
|
|
9287
|
+
try {
|
|
9288
|
+
return llmProvidersScope ??= bindLlmProvidersScope(ctx.configForms);
|
|
9289
|
+
} catch {
|
|
9290
|
+
return;
|
|
9291
|
+
}
|
|
9292
|
+
};
|
|
7885
9293
|
applyWithSettingsApi(ctx, {
|
|
7886
9294
|
bind: (host) => {
|
|
7887
9295
|
form = host.configForms.get("codex");
|
|
7888
9296
|
return adaptConfigForm(form);
|
|
7889
9297
|
},
|
|
7890
9298
|
getCodexConnectScope,
|
|
7891
|
-
|
|
9299
|
+
getLlmProvidersScope,
|
|
9300
|
+
register: (host, settings, manager, updateStore) => {
|
|
7892
9301
|
const desktop = host;
|
|
7893
9302
|
const presetManager = {
|
|
7894
9303
|
...manager,
|
|
@@ -7902,6 +9311,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7902
9311
|
unsetSetting: (field) => settings.unset(field),
|
|
7903
9312
|
presetManager,
|
|
7904
9313
|
toolPolicy,
|
|
9314
|
+
updateStore,
|
|
9315
|
+
getCodexConnectScope,
|
|
7905
9316
|
saveSettings: async (edits, revision) => {
|
|
7906
9317
|
await saveDesktopSettings(form, edits, revision);
|
|
7907
9318
|
if (typeof edits.remoteCompactionEnabled === "boolean") {
|