@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.
Files changed (86) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +21 -43
  3. package/docs/preset-library.md +2 -2
  4. package/docs/tool-policy.md +1 -1
  5. package/lib/client.js +1738 -327
  6. package/lib/compact-command.js +7 -1
  7. package/lib/compaction.js +7 -1
  8. package/lib/hybrid-executor.js +23 -12
  9. package/lib/index.js +1266 -36
  10. package/lib/preferences.js +21 -2
  11. package/lib/tool-policy.js +11 -2
  12. package/lib/typert.js +42 -1
  13. package/lib/types/client/desktop.d.ts +20 -42
  14. package/lib/types/client/desktop.js +191 -126
  15. package/lib/types/client/index.d.ts +104 -28
  16. package/lib/types/client/index.js +97 -15
  17. package/lib/types/client/policy-drafts.d.ts +18 -0
  18. package/lib/types/client/policy-drafts.js +27 -0
  19. package/lib/types/client/policy-locale.d.ts +80 -20
  20. package/lib/types/client/policy-locale.js +197 -80
  21. package/lib/types/client/preset-manager.d.ts +25 -2
  22. package/lib/types/client/preset-manager.js +89 -5
  23. package/lib/types/client/preset-requests.d.ts +44 -1
  24. package/lib/types/client/preset-requests.js +150 -0
  25. package/lib/types/client/tool-policy.d.ts +7 -2
  26. package/lib/types/client/tool-policy.js +48 -6
  27. package/lib/types/contracts/preset-editor-schema.d.ts +35 -0
  28. package/lib/types/contracts/preset-editor-schema.js +39 -0
  29. package/lib/types/contracts/settings.d.ts +12 -0
  30. package/lib/types/contracts/settings.js +10 -1
  31. package/lib/types/contracts/ui-contracts.d.ts +52 -0
  32. package/lib/types/contracts/ui-contracts.js +58 -0
  33. package/lib/types/contracts/update.d.ts +73 -0
  34. package/lib/types/contracts/update.js +291 -0
  35. package/lib/types/entries/index.js +20 -2
  36. package/lib/types/entries/preferences.d.ts +2 -0
  37. package/lib/types/entries/preferences.js +9 -0
  38. package/lib/types/hybrid/hybrid-sdk.d.ts +1 -1
  39. package/lib/types/hybrid/hybrid-sdk.js +27 -13
  40. package/lib/types/presets/preset-editor.d.ts +13 -1
  41. package/lib/types/presets/preset-editor.js +24 -1
  42. package/lib/types/presets/pro-mode-store.d.ts +13 -0
  43. package/lib/types/presets/pro-mode-store.js +69 -0
  44. package/lib/types/responses/background-sse-codec.d.ts +23 -0
  45. package/lib/types/responses/background-sse-codec.js +230 -0
  46. package/lib/types/responses/background-stream.d.ts +28 -0
  47. package/lib/types/responses/background-stream.js +351 -0
  48. package/lib/types/responses/compact-checkpoint.js +3 -10
  49. package/lib/types/responses/fetch-transport.js +24 -9
  50. package/lib/types/responses/remote-compact.js +39 -11
  51. package/lib/types/responses/wire-rewrite.d.ts +4 -0
  52. package/lib/types/responses/wire-rewrite.js +30 -4
  53. package/lib/types/tools/codex-subagent.d.ts +14 -0
  54. package/lib/types/tools/codex-subagent.js +269 -0
  55. package/lib/types/update/checker.d.ts +14 -0
  56. package/lib/types/update/checker.js +166 -0
  57. package/locale/en.json +1 -1
  58. package/locale/hybrid-executor/en.json +1 -1
  59. package/locale/hybrid-executor/zh.json +1 -1
  60. package/locale/zh.json +1 -1
  61. package/package.json +6 -2
  62. package/src/client/desktop.tsx +370 -153
  63. package/src/client/index.tsx +122 -22
  64. package/src/client/policy-drafts.ts +45 -0
  65. package/src/client/policy-locale.ts +197 -80
  66. package/src/client/preset-manager.tsx +125 -4
  67. package/src/client/preset-requests.ts +185 -1
  68. package/src/client/tool-policy.tsx +63 -9
  69. package/src/contracts/preset-editor-schema.ts +44 -0
  70. package/src/contracts/settings.ts +20 -1
  71. package/src/contracts/ui-contracts.ts +91 -0
  72. package/src/contracts/update.ts +307 -0
  73. package/src/entries/index.ts +25 -2
  74. package/src/entries/preferences.ts +9 -0
  75. package/src/hybrid/hybrid-sdk.ts +28 -12
  76. package/src/presets/preset-editor.ts +31 -3
  77. package/src/presets/pro-mode-store.ts +80 -0
  78. package/src/responses/background-sse-codec.ts +237 -0
  79. package/src/responses/background-stream.ts +371 -0
  80. package/src/responses/compact-checkpoint.ts +2 -8
  81. package/src/responses/fetch-transport.ts +28 -9
  82. package/src/responses/remote-compact.ts +41 -11
  83. package/src/responses/wire-rewrite.ts +34 -3
  84. package/src/tools/codex-subagent.ts +290 -0
  85. package/src/update/checker.ts +193 -0
  86. package/tsdown.config.ts +4 -0
@@ -1,4 +1,5 @@
1
- import type { PresetCatalog } from '../contracts/ui-contracts.ts';
1
+ import type { CodexConnectScope, CodexSubagentModelCatalog, LlmProvidersScope, PresetCatalog } from '../contracts/ui-contracts.ts';
2
+ import type { CodexScope } from './index.tsx';
2
3
  import type { PresetManagerActions } from './preset-manager.tsx';
3
4
  import type { PresetPromptCatalog, PresetToolCatalog } from '../contracts/tool-policy-contract.ts';
4
5
  export declare function cachedPresetCatalog(manager: PresetManagerActions): PresetCatalog | undefined;
@@ -6,6 +7,7 @@ export declare function cachePresetCatalog(manager: PresetManagerActions, catalo
6
7
  /** One cache and one in-flight catalog read for every surface using this manager. */
7
8
  export declare function requestPresetCatalog(manager: PresetManagerActions, refresh?: boolean): Promise<PresetCatalog>;
8
9
  export declare function cachedPresetTools(manager: PresetManagerActions, id: string): PresetToolCatalog | undefined;
10
+ export declare function invalidatePresetTools(manager: PresetManagerActions): void;
9
11
  /** The requested preset owns this snapshot; never substitute current-Agent tools. */
10
12
  export declare function requestPresetTools(manager: PresetManagerActions, id: string, refresh?: boolean): Promise<PresetToolCatalog>;
11
13
  export declare function cachedPresetPrompts(manager: PresetManagerActions, id: string): PresetPromptCatalog | undefined;
@@ -13,4 +15,45 @@ export declare function requestPresetPrompts(manager: PresetManagerActions, id:
13
15
  /** Only transport failures from a read can be retried without duplicating writes. */
14
16
  export declare function isPresetConnectionError(error: unknown): boolean;
15
17
  export declare function readPresetWithRetry<T>(read: () => Promise<T>, active: () => boolean): Promise<T>;
18
+ export declare function requestCodexSubagentModels(manager: PresetManagerActions): Promise<CodexSubagentModelCatalog>;
19
+ export interface DesktopConfigForm extends Pick<CodexScope, 'getSnapshot' | 'subscribe'> {
20
+ set(field: string, value: unknown): Promise<boolean>;
21
+ unset(field: string): Promise<boolean>;
22
+ mutate(ops: Array<{
23
+ op: 'set';
24
+ path: string[];
25
+ value: unknown;
26
+ } | {
27
+ op: 'unset';
28
+ path: string[];
29
+ }>, expectedRevision?: number | string): Promise<boolean>;
30
+ }
31
+ interface MirrorNamespaceRow {
32
+ readonly ns: string;
33
+ readonly value?: unknown;
34
+ readonly base?: unknown;
35
+ }
36
+ interface ConfigMirror {
37
+ getSnapshot(): {
38
+ readonly status?: string;
39
+ readonly view?: {
40
+ readonly writable?: boolean;
41
+ readonly namespaces?: readonly MirrorNamespaceRow[];
42
+ };
43
+ };
44
+ subscribe(listener: () => void): () => void;
45
+ ensure?(): unknown;
46
+ }
47
+ export interface DesktopSettingsContext {
48
+ configForms: {
49
+ get(entryId: string): DesktopConfigForm;
50
+ describe?(): ConfigMirror;
51
+ whileServed(namespaces: string[], register: () => () => void): () => void;
52
+ };
53
+ }
54
+ export declare function bindCodexConnectScope(configForms: DesktopSettingsContext['configForms']): CodexConnectScope;
55
+ export declare function bindLlmProvidersScope(configForms: DesktopSettingsContext['configForms']): LlmProvidersScope | undefined;
56
+ export declare function adaptConfigForm(form: Pick<DesktopConfigForm, 'getSnapshot' | 'subscribe' | 'set' | 'unset'>): CodexScope;
57
+ export declare function saveDesktopSettings(form: Pick<DesktopConfigForm, 'mutate'>, edits: Record<string, unknown>, expectedRevision?: number | string): Promise<void>;
58
+ export {};
16
59
  //# sourceMappingURL=preset-requests.d.ts.map
@@ -1,3 +1,4 @@
1
+ import { nextOpenAICodexOverrides, OPENAI_CODEX_SETTINGS_NAMESPACE, } from "../contracts/ui-contracts.js";
1
2
  const catalogs = new WeakMap();
2
3
  const catalogRequests = new WeakMap();
3
4
  export function cachedPresetCatalog(manager) {
@@ -34,6 +35,9 @@ const toolRequests = new WeakMap();
34
35
  export function cachedPresetTools(manager, id) {
35
36
  return toolCatalogs.get(manager)?.get(id);
36
37
  }
38
+ export function invalidatePresetTools(manager) {
39
+ toolCatalogs.delete(manager);
40
+ }
37
41
  /** The requested preset owns this snapshot; never substitute current-Agent tools. */
38
42
  export function requestPresetTools(manager, id, refresh = false) {
39
43
  const pending = toolRequests.get(manager)?.get(id);
@@ -117,4 +121,150 @@ export async function readPresetWithRetry(read, active) {
117
121
  return read();
118
122
  }
119
123
  }
124
+ const subagentModelRequests = new WeakMap();
125
+ export function requestCodexSubagentModels(manager) {
126
+ const pending = subagentModelRequests.get(manager);
127
+ if (pending !== undefined)
128
+ return pending;
129
+ const request = (async () => {
130
+ await manager.ready;
131
+ const remote = manager.remote.codexPresetEditor;
132
+ if (typeof remote.codexSubagentModels !== 'function')
133
+ throw new Error('codex-subagent-models-unavailable');
134
+ const result = await remote.codexSubagentModels();
135
+ if (!result.ok)
136
+ throw new Error(result.error.message ?? 'codex-subagent-models-unavailable');
137
+ return result.value;
138
+ })();
139
+ subagentModelRequests.set(manager, request);
140
+ void request.finally(() => {
141
+ if (subagentModelRequests.get(manager) === request)
142
+ subagentModelRequests.delete(manager);
143
+ }).catch(() => { });
144
+ return request;
145
+ }
146
+ function asRecord(value) {
147
+ return typeof value === 'object' && value !== null && !Array.isArray(value)
148
+ ? value
149
+ : undefined;
150
+ }
151
+ function asOverrides(value) {
152
+ const record = asRecord(value);
153
+ if (record === undefined)
154
+ return undefined;
155
+ const out = {};
156
+ for (const [k, v] of Object.entries(record)) {
157
+ if (v === null || (typeof v === 'number' && Number.isSafeInteger(v) && v > 0))
158
+ out[k] = v;
159
+ }
160
+ return out;
161
+ }
162
+ function projectCodexConnectRecord(record, baseRecord, writable) {
163
+ const searchModel = typeof record.searchModel === 'string' && record.searchModel.trim() ? record.searchModel.trim() : undefined;
164
+ const imageModelHint = typeof record.imageModelHint === 'string' ? record.imageModelHint.trim() : undefined;
165
+ return {
166
+ status: 'ready',
167
+ writable,
168
+ overrides: asOverrides(record.contextWindowOverrides),
169
+ baseOverrides: asOverrides(baseRecord?.contextWindowOverrides),
170
+ ...(typeof record.enableNativeCompaction === 'boolean' ? { nativeCompaction: record.enableNativeCompaction } : {}),
171
+ ...(typeof record.enableSearch === 'boolean' ? { searchEnabled: record.enableSearch } : {}),
172
+ ...(searchModel !== undefined ? { searchModel } : {}),
173
+ ...(typeof record.enableImageGeneration === 'boolean' ? { imageGenerationEnabled: record.enableImageGeneration } : {}),
174
+ ...(imageModelHint !== undefined ? { imageModelHint } : {}),
175
+ };
176
+ }
177
+ export function bindCodexConnectScope(configForms) {
178
+ const form = configForms.get(OPENAI_CODEX_SETTINGS_NAMESPACE);
179
+ const mirror = configForms.describe?.();
180
+ void Promise.resolve(mirror?.ensure?.()).catch(() => { });
181
+ let lastFormSnap;
182
+ let lastMirrorSnap;
183
+ let projected = { status: 'loading', writable: false };
184
+ const getSnapshot = () => {
185
+ const formSnap = form.getSnapshot();
186
+ const mirrorSnap = mirror?.getSnapshot();
187
+ if (formSnap === lastFormSnap && mirrorSnap === lastMirrorSnap)
188
+ return projected;
189
+ lastFormSnap = formSnap;
190
+ lastMirrorSnap = mirrorSnap;
191
+ const formRecord = formSnap.status === 'ready' ? asRecord(formSnap.value) : undefined;
192
+ if (formRecord !== undefined) {
193
+ return projected = projectCodexConnectRecord(formRecord, asRecord(formSnap.base), formSnap.writable);
194
+ }
195
+ const view = mirrorSnap?.view;
196
+ if (view !== undefined) {
197
+ const row = view.namespaces?.find(candidate => candidate.ns === OPENAI_CODEX_SETTINGS_NAMESPACE);
198
+ const rowRecord = row === undefined ? undefined : asRecord(row.value);
199
+ if (row === undefined || rowRecord === undefined)
200
+ return projected = { status: 'unavailable', writable: false };
201
+ return projected = projectCodexConnectRecord(rowRecord, asRecord(row.base), view.writable ?? formSnap.writable);
202
+ }
203
+ return projected = { status: formSnap.status, writable: formSnap.writable };
204
+ };
205
+ return {
206
+ getSnapshot,
207
+ subscribe: listener => {
208
+ const stopForm = form.subscribe(listener);
209
+ const stopMirror = mirror?.subscribe(listener);
210
+ return () => { stopForm(); stopMirror?.(); };
211
+ },
212
+ setModelOverride: async (modelId, tokens) => {
213
+ const snap = getSnapshot();
214
+ const next = nextOpenAICodexOverrides(snap.overrides, snap.baseOverrides, modelId, tokens);
215
+ const accepted = next === undefined
216
+ ? await form.unset('contextWindowOverrides')
217
+ : await form.set('contextWindowOverrides', next);
218
+ if (!accepted)
219
+ throw new Error('The host did not accept the settings change.');
220
+ },
221
+ setNativeCompaction: async (enabled) => {
222
+ const accepted = await form.set('enableNativeCompaction', enabled);
223
+ if (!accepted)
224
+ throw new Error('The host did not accept the settings change.');
225
+ },
226
+ setSearchEnabled: async (enabled) => {
227
+ const accepted = await form.set('enableSearch', enabled);
228
+ if (!accepted)
229
+ throw new Error('The host did not accept the settings change.');
230
+ },
231
+ setImageGenerationEnabled: async (enabled) => {
232
+ const accepted = await form.set('enableImageGeneration', enabled);
233
+ if (!accepted)
234
+ throw new Error('The host did not accept the settings change.');
235
+ },
236
+ };
237
+ }
238
+ export function bindLlmProvidersScope(configForms) {
239
+ const mirror = configForms.describe?.();
240
+ if (mirror === undefined)
241
+ return undefined;
242
+ void Promise.resolve(mirror.ensure?.()).catch(() => { });
243
+ let lastMirrorSnap;
244
+ let projected;
245
+ const getSnapshot = () => {
246
+ const mirrorSnap = mirror.getSnapshot();
247
+ if (mirrorSnap === lastMirrorSnap)
248
+ return projected;
249
+ lastMirrorSnap = mirrorSnap;
250
+ const row = mirrorSnap?.view?.namespaces?.find(candidate => candidate.ns === 'llm-pi-ai');
251
+ const providers = asRecord(asRecord(row?.value)?.providers);
252
+ return projected = providers;
253
+ };
254
+ return { getSnapshot, subscribe: listener => mirror.subscribe(listener) };
255
+ }
256
+ export function adaptConfigForm(form) {
257
+ const accepted = async (result) => { if (!await result)
258
+ throw new Error('The host did not accept the settings change.'); };
259
+ return { getSnapshot: () => form.getSnapshot(), subscribe: listener => form.subscribe(listener),
260
+ set: (field, value) => accepted(form.set(field, value)), unset: field => accepted(form.unset(field)) };
261
+ }
262
+ export async function saveDesktopSettings(form, edits, expectedRevision) {
263
+ const ops = Object.entries(edits).map(([field, value]) => value === undefined ? { op: 'unset', path: [field] } : { op: 'set', path: [field], value });
264
+ if (!ops.length)
265
+ return;
266
+ const accepted = expectedRevision === undefined ? await form.mutate(ops) : await form.mutate(ops, expectedRevision);
267
+ if (!accepted)
268
+ throw new Error('The host did not accept the settings change.');
269
+ }
120
270
  //# sourceMappingURL=preset-requests.js.map
@@ -3,9 +3,12 @@ import type { HostObservable, PropsLocale } from '@deepseek-ai/dsh-client-ui-slo
3
3
  import type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client';
4
4
  import type { PresetManagerActions } from './preset-manager.tsx';
5
5
  import type { ToolAction, ToolActionContext, ToolPolicyRule } from '../contracts/tool-policy-contract.ts';
6
+ import { formatGptImageBadge, resolveGptCapabilities } from './policy-drafts.ts';
7
+ import type { GptCapabilitiesState } from './policy-drafts.ts';
6
8
  import { toolPolicyEn, toolPolicyZh } from './policy-locale.ts';
7
9
  export type { ToolPolicyRule } from '../contracts/tool-policy-contract.ts';
8
- export { toolPolicyEn, toolPolicyZh };
10
+ export type { GptCapabilitiesState };
11
+ export { formatGptImageBadge, resolveGptCapabilities, toolPolicyEn, toolPolicyZh };
9
12
  export declare const TOOL_POLICY_NAMESPACE = "codex-tool-policy";
10
13
  export interface ToolPolicySettings {
11
14
  readonly rules: readonly ToolPolicyRule[];
@@ -23,11 +26,13 @@ export type ToolPolicyMode = ToolPolicySubMode | 'inactive';
23
26
  type PolicyProps = PropsLocale<'codex'> & {
24
27
  presetManager?: PresetManagerActions | undefined;
25
28
  mode?: ToolPolicyMode;
29
+ gptCapabilities?: GptCapabilitiesState | undefined;
30
+ toolsVersion?: number | undefined;
26
31
  };
27
32
  export declare function ToolPolicySection({ binding, ...props }: {
28
33
  binding: ToolPolicyBinding;
29
34
  } & PolicyProps): import("react").JSX.Element | null;
30
- export declare function ToolPolicySettingsCard({ form, presetManager, mode, t }: {
35
+ export declare function ToolPolicySettingsCard({ form, presetManager, mode, gptCapabilities, toolsVersion, t }: {
31
36
  form: ToolPolicyForm;
32
37
  } & PolicyProps): import("react").JSX.Element | null;
33
38
  //# sourceMappingURL=tool-policy.d.ts.map
@@ -5,9 +5,9 @@ import { PresetDefinitionCard } from "./preset-manager.js";
5
5
  import { cachedPresetCatalog, cachedPresetPrompts, cachedPresetTools, requestPresetCatalog, requestPresetPrompts, requestPresetTools, } from "./preset-requests.js";
6
6
  import { effectiveToolAction, legacyToolAction } from "../contracts/tool-policy-contract.js";
7
7
  import { PRESET_PROMPT_NAMES } from "../contracts/ui-contracts.js";
8
- import { acceptPresetSave, editPresetDraft, preparePresetSave, presetRules, sameRules } from "./policy-drafts.js";
8
+ import { acceptPresetSave, editPresetDraft, formatGptImageBadge, preparePresetSave, presetRules, resolveGptCapabilities, sameRules } from "./policy-drafts.js";
9
9
  import { groupOf, humanLabels, policyStyles, toolPolicyEn, toolPolicyZh } from "./policy-locale.js";
10
- export { toolPolicyEn, toolPolicyZh };
10
+ export { formatGptImageBadge, resolveGptCapabilities, toolPolicyEn, toolPolicyZh };
11
11
  export const TOOL_POLICY_NAMESPACE = 'codex-tool-policy';
12
12
  export function bindToolPolicy(ctx, forms) {
13
13
  let form;
@@ -82,7 +82,7 @@ export function ToolPolicySection({ binding, ...props }) {
82
82
  const form = useSyncExternalStore(binding.subscribe, binding.getSnapshot, binding.getSnapshot);
83
83
  return form === undefined ? null : _jsx(ToolPolicySettingsCard, { form: form, ...props });
84
84
  }
85
- export function ToolPolicySettingsCard({ form, presetManager, mode = 'tools', t }) {
85
+ export function ToolPolicySettingsCard({ form, presetManager, mode = 'tools', gptCapabilities, toolsVersion = 0, t }) {
86
86
  const snapshot = useSyncExternalStore(listener => form.subscribe(listener), () => form.getSnapshot(), () => form.getSnapshot());
87
87
  const [subMode, setSubMode] = useState(mode === 'prompts' || mode === 'definition' ? mode : 'tools');
88
88
  const prevMode = useRef(mode);
@@ -147,6 +147,13 @@ export function ToolPolicySettingsCard({ form, presetManager, mode = 'tools', t
147
147
  setToolsView({ preset: selectedId, status: 'error' }); });
148
148
  }
149
149
  useEffect(() => { loadTools(); return () => { toolsRequest.current++; }; }, [presetManager, selectedId]);
150
+ const loadedToolsVersion = useRef(toolsVersion);
151
+ useEffect(() => {
152
+ if (mode !== 'inactive' && loadedToolsVersion.current !== toolsVersion) {
153
+ loadedToolsVersion.current = toolsVersion;
154
+ loadTools(true);
155
+ }
156
+ }, [mode, toolsVersion, presetManager, selectedId]);
150
157
  const cached = presetManager && selectedId ? cachedPresetTools(presetManager, selectedId) : undefined;
151
158
  const inventory = toolsView?.preset === selectedId && toolsView.status === 'error' ? undefined : toolsView?.preset === selectedId && toolsView.status === 'ready' ? toolsView.value : cached;
152
159
  const toolsStatus = inventory ? 'ready' : toolsView?.preset === selectedId ? toolsView.status : selectedId ? 'loading' : 'error';
@@ -301,13 +308,44 @@ export function ToolPolicySettingsCard({ form, presetManager, mode = 'tools', t
301
308
  ];
302
309
  const changeSummary = summaryParts.join(' · ') || t(currentDraft && !sameRules(beforeTarget, currentDraft.rules) ? 'toolPolicyRuleChanged' : 'toolPolicyNoToolDelta');
303
310
  const unavailable = (reason) => t(reason === 'conditional' ? 'toolPolicyConditional' : reason === 'target-exists' ? 'toolPolicyTargetExists' : 'toolPolicyUnsupported');
311
+ const gptSearchActive = gptCapabilities?.hostedWebSearch === true || gptCapabilities?.codexSearch === true;
312
+ const gptBadgeFor = (tool) => {
313
+ if (tool.name === 'codex_subagent') {
314
+ const model = gptCapabilities?.codexSubagentModel;
315
+ return {
316
+ label: model ? `${t('toolPolicyGptCodexSearch')} · ${model}` : t('toolPolicyGptCodexSearch'),
317
+ title: t('toolPolicyGptSubagentTitle'),
318
+ };
319
+ }
320
+ if (tool.name === 'codex_connect_image_generate') {
321
+ return { label: `${t('toolPolicyGptCodexSearch')} · ${formatGptImageBadge(gptCapabilities?.imageModelHint)}`, title: t('toolPolicyGptImageTitle') };
322
+ }
323
+ if (tool.name === 'web_search' && gptSearchActive) {
324
+ const model = gptCapabilities?.codexSearchModel;
325
+ if (gptCapabilities?.hostedWebSearch && gptCapabilities?.codexSearch) {
326
+ return {
327
+ label: t('toolPolicyGptDualSearch'),
328
+ title: model ? `${t('toolPolicyGptDualSearchTitle')} (${model})` : t('toolPolicyGptDualSearchTitle'),
329
+ };
330
+ }
331
+ if (gptCapabilities?.hostedWebSearch) {
332
+ return { label: t('toolPolicyGptHostedSearch'), title: t('toolPolicyGptHostedSearchTitle') };
333
+ }
334
+ return {
335
+ label: model ? `${t('toolPolicyGptCodexSearch')} · ${model}` : t('toolPolicyGptCodexSearch'),
336
+ title: model ? `${t('toolPolicyGptCodexSearchTitle')} (${model})` : t('toolPolicyGptCodexSearchTitle'),
337
+ };
338
+ }
339
+ return undefined;
340
+ };
304
341
  const renderRows = (tools) => _jsxs("div", { className: "codex-tool-policy-table", role: "table", "aria-label": t('toolPolicyTitle'), children: [tools.map(tool => {
305
342
  const action = chosen(tool);
306
343
  const deferReason = deferUnavailableReason(tool);
307
344
  const supported = action === 'keep' || action === 'hide' || action === 'defer' || tool.replacements.some(option => option.action === action);
308
345
  const custom = customized(tool);
309
346
  const hasOverride = !!rule?.tools?.some(choice => choice.name === tool.name);
310
- return _jsxs("div", { role: "row", className: "codex-tool-policy-tool", "data-tool-name": tool.name, "data-tool-action": action, children: [_jsxs("div", { role: "cell", className: "codex-tool-policy-name", children: [_jsx("code", { className: "codex-tool-policy-identifier", children: tool.name }), _jsx("span", { className: "codex-tool-policy-description", title: tool.description, children: human(tool) }), tool.defaultDeferred && !custom && _jsx("span", { className: "codex-badge", "data-tone": "blue", children: t('toolPolicyDefaultDeferred') }), custom && _jsx("span", { className: "codex-badge", "data-tone": "blue", children: t('toolPolicyModified') }), tool.codexTool?.presetEnabled === false && _jsx("span", { className: "codex-badge", "data-tone": "warn", children: t('toolPolicyPresetDisabled') }), tool.conditional && tool.codexTool === undefined && _jsx("span", { className: "codex-badge", children: t('toolPolicyConditional') })] }), _jsxs("div", { role: "cell", className: "codex-tool-policy-action", children: [_jsxs("div", { className: "codex-seg", role: "group", "aria-label": `${t('toolPolicyAction')} ${tool.name}`, children: [_jsx("button", { type: "button", "data-action": "keep", "aria-pressed": action === 'keep', disabled: duplicate, onClick: () => chooseAction(tool, 'keep'), children: t('toolPolicyKeep') }), tool.replacements.map(option => _jsx("button", { type: "button", "data-action": option.action, "aria-pressed": action === option.action, disabled: duplicate || !option.available, title: option.available ? option.tools.join(' + ') : `${option.tools.join(' + ')} · ${unavailable(option.reason)}`, onClick: () => chooseAction(tool, option.action), children: t('toolPolicyReplaceShort') }, option.action)), _jsx("button", { type: "button", "data-action": "defer", "aria-pressed": action === 'defer', disabled: duplicate || deferReason !== undefined, title: deferReason !== undefined ? unavailable(deferReason) : t('toolPolicyDeferHint'), onClick: () => chooseAction(tool, 'defer'), children: t('toolPolicyDefer') }), _jsx("button", { type: "button", "data-action": "hide", "aria-pressed": action === 'hide', disabled: duplicate, onClick: () => chooseAction(tool, 'hide'), children: t('toolPolicyHide') })] }), !supported && _jsxs("span", { className: "codex-tool-policy-warning", children: [t('toolPolicyUnsupported'), " (", action, ")"] }), hasOverride && _jsx("button", { type: "button", className: "codex-btn", "aria-label": `${t('toolPolicyRestoreChoice')} ${tool.name}`, title: t('toolPolicyRestoreChoice'), onClick: () => removeChoice(tool.name), children: "\u21B6" })] })] }, tool.name);
347
+ const gptBadge = gptBadgeFor(tool);
348
+ return _jsxs("div", { role: "row", className: "codex-tool-policy-tool", "data-tool-name": tool.name, "data-tool-action": action, children: [_jsxs("div", { role: "cell", className: "codex-tool-policy-name", children: [_jsx("code", { className: "codex-tool-policy-identifier", children: tool.name }), _jsx("span", { className: "codex-tool-policy-description", title: tool.description, children: human(tool) }), gptBadge && _jsx("span", { className: "codex-badge", "data-tone": "gpt", title: gptBadge.title, children: gptBadge.label }), tool.defaultDeferred && !custom && _jsx("span", { className: "codex-badge", "data-tone": "blue", children: t('toolPolicyDefaultDeferred') }), custom && _jsx("span", { className: "codex-badge", "data-tone": "blue", children: t('toolPolicyModified') }), tool.codexTool?.presetEnabled === false && _jsx("span", { className: "codex-badge", "data-tone": "warn", children: t('toolPolicyPresetDisabled') }), tool.conditional && tool.codexTool === undefined && _jsx("span", { className: "codex-badge", children: t('toolPolicyConditional') })] }), _jsxs("div", { role: "cell", className: "codex-tool-policy-action", children: [_jsxs("div", { className: "codex-seg", role: "group", "aria-label": `${t('toolPolicyAction')} ${tool.name}`, children: [_jsx("button", { type: "button", "data-action": "keep", "aria-pressed": action === 'keep', disabled: duplicate, onClick: () => chooseAction(tool, 'keep'), children: t('toolPolicyKeep') }), tool.replacements.map(option => _jsx("button", { type: "button", "data-action": option.action, "aria-pressed": action === option.action, disabled: duplicate || !option.available, title: option.available ? option.tools.join(' + ') : `${option.tools.join(' + ')} · ${unavailable(option.reason)}`, onClick: () => chooseAction(tool, option.action), children: t('toolPolicyReplaceShort') }, option.action)), _jsx("button", { type: "button", "data-action": "defer", "aria-pressed": action === 'defer', disabled: duplicate || deferReason !== undefined, title: deferReason !== undefined ? unavailable(deferReason) : t('toolPolicyDeferHint'), onClick: () => chooseAction(tool, 'defer'), children: t('toolPolicyDefer') }), _jsx("button", { type: "button", "data-action": "hide", "aria-pressed": action === 'hide', disabled: duplicate, onClick: () => chooseAction(tool, 'hide'), children: t('toolPolicyHide') })] }), !supported && _jsxs("span", { className: "codex-tool-policy-warning", children: [t('toolPolicyUnsupported'), " (", action, ")"] }), hasOverride && _jsx("button", { type: "button", className: "codex-btn", "aria-label": `${t('toolPolicyRestoreChoice')} ${tool.name}`, title: t('toolPolicyRestoreChoice'), onClick: () => removeChoice(tool.name), children: "\u21B6" })] })] }, tool.name);
311
349
  }), tools.length === 0 && _jsx("p", { className: "codex-tool-policy-note", style: { padding: '12px 14px' }, children: t('toolPolicyNoMatches') })] });
312
350
  if (snapshot.status !== 'ready' || snapshot.value === undefined || mode === 'inactive')
313
351
  return null;
@@ -315,8 +353,12 @@ export function ToolPolicySettingsCard({ form, presetManager, mode = 'tools', t
315
353
  const isFiltering = text.length > 0 || filter !== 'all';
316
354
  const allTools = inventory?.tools ?? [];
317
355
  const hasReplaceable = allTools.some(tool => tool.replacements.some(option => option.available));
318
- const shown = allTools.filter(tool => (!text || `${human(tool)} ${tool.name} ${tool.description}`.toLowerCase().includes(text))
319
- && (filter === 'all' || (filter === 'modified' ? customized(tool) : filter === 'deferred' ? chosen(tool) === 'defer' : tool.replacements.some(option => option.available))));
356
+ const shown = allTools.filter(tool => {
357
+ const gptBadge = gptBadgeFor(tool);
358
+ const haystack = `${human(tool)} ${tool.name} ${tool.description} ${gptBadge?.label ?? ''}`.toLowerCase();
359
+ return (!text || haystack.includes(text))
360
+ && (filter === 'all' || (filter === 'modified' ? customized(tool) : filter === 'deferred' ? chosen(tool) === 'defer' : tool.replacements.some(option => option.available)));
361
+ });
320
362
  return _jsxs("section", { className: "codex-tool-policy", "aria-label": t(activeSub === 'prompts' ? 'settingsPresetPrompts' : 'toolPolicyTitle'), children: [_jsx("style", { children: policyStyles }), _jsxs("div", { className: "codex-card codex-preset-bar", children: [_jsxs("label", { className: "codex-preset-select-wrap", children: [_jsx("span", { className: "codex-tool-policy-note", children: t('toolPolicyPresetChoice') }), _jsxs("select", { "aria-label": t('toolPolicyPresetChoice'), value: selectedId, onChange: event => { setSelection(event.target.value); setError(''); setNotice(''); }, children: [!ids.length && _jsx("option", { value: "", children: t('toolPolicyEmpty') }), ids.map(id => _jsxs("option", { value: id, "data-preset-id": id, children: [catalog?.presets.find(preset => preset.id === id)?.name ?? id, drafts.has(id) ? ` · ${t('globalPending')}` : ''] }, id))] })] }), _jsxs("div", { className: "codex-tool-policy-action", children: [_jsx("div", { className: "codex-seg", role: "group", "aria-label": t('settingsTabLabel'), children: [['tools', 'settingsSubTools'], ['prompts', 'settingsPresetPrompts'], ['definition', 'settingsDefinition']].map(([key, labelKey]) => (_jsx("button", { type: "button", "data-submode": key, "aria-pressed": activeSub === key, onClick: () => setSubMode(key), children: t(labelKey) }, key))) }), presetManager && _jsx("button", { type: "button", className: "codex-btn", disabled: catalogState === 'loading', onClick: () => loadCatalog(true), children: t('toolPolicyCatalogRetry') })] })] }), catalogState !== 'ready' && _jsx("p", { className: "codex-tool-policy-note", role: "status", children: t(catalogState === 'loading' ? 'toolPolicyCatalogLoading' : 'toolPolicyCatalogFailed') }), catalogState === 'ready' && !ids.length && _jsx("p", { className: "codex-tool-policy-note", children: t('toolPolicyCatalogEmpty') }), duplicate && _jsx("p", { className: "codex-tool-policy-warning", children: t('toolPolicyDuplicatePreset') }), activeSub === 'definition' && (!selectedId || presetManager === undefined ? _jsx("p", { className: "codex-tool-policy-note", children: t('settingsDefinitionAbsent') }) : _jsx(PresetDefinitionCard, { presetManager: presetManager, id: selectedId, t: t })), activeSub !== 'definition' && _jsx("form", { onSubmit: event => { event.preventDefault(); saveCurrent(); }, children: _jsxs("fieldset", { disabled: !snapshot.writable || saving, children: [activeSub === 'tools' && _jsxs(_Fragment, { children: [toolsStatus !== 'ready' && _jsx("p", { className: "codex-tool-policy-note", role: "status", children: t(toolsStatus === 'loading' ? 'toolPolicyToolsLoading' : 'toolPolicyToolsFailed') }), inventory?.tools.length === 0 && _jsx("p", { className: "codex-tool-policy-note", role: "status", children: t('toolPolicyToolsEmpty') }), inventory && !duplicate && inventory.tools.length > 0 && _jsxs("div", { className: "codex-toolbar", children: [_jsx("input", { type: "text", "aria-label": t('toolPolicySearch'), placeholder: t('toolPolicySearch'), value: query, onChange: event => setQuery(event.target.value) }), _jsx("div", { className: "codex-seg", role: "group", "aria-label": t('toolPolicyFilter'), children: ['all', 'deferred', 'modified', ...(hasReplaceable ? ['replaceable'] : [])].map(item => (_jsx("button", { type: "button", "data-filter": item, "aria-pressed": filter === item, onClick: () => setFilter(item), children: t(item === 'all' ? 'toolPolicyAll' : item === 'modified' ? 'toolPolicyModified' : item === 'deferred' ? 'toolPolicyDeferredFilter' : 'toolPolicyReplaceable') }, item))) }), presetManager && selectedId && _jsx("button", { type: "button", className: "codex-btn", disabled: toolsStatus === 'loading', onClick: () => loadTools(true), children: t('toolPolicyToolsRefresh') })] }), inventory && !duplicate && (isFiltering && shown.length === 0
321
363
  ? _jsx("div", { className: "codex-card", children: renderRows(shown) })
322
364
  : GROUP_META.map(group => {
@@ -4,6 +4,41 @@ import type { InvocationDescriptor } from '@deepseek-ai/dsh-typert-protocol';
4
4
  export declare const PRESET_EDITOR_PACKAGE = "@shuind/dsh-codex-harness";
5
5
  export declare const PRESET_EDITOR_SERVICE = "codexPresetEditor";
6
6
  export declare const presetIdSchema: z.ZodString;
7
+ export declare const proModeSessionIdSchema: z.ZodString;
8
+ export declare const proModeSetInputSchema: z.ZodObject<{
9
+ sessionId: z.ZodString;
10
+ enabled: z.ZodBoolean;
11
+ }, z.core.$strip>;
12
+ export declare const proModeStateSchema: z.ZodObject<{
13
+ enabled: z.ZodBoolean;
14
+ }, z.core.$strip>;
15
+ export declare const harnessUpdateResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
16
+ status: z.ZodLiteral<"up-to-date">;
17
+ currentVersion: z.ZodString;
18
+ latestVersion: z.ZodString;
19
+ }, z.core.$strip>, z.ZodObject<{
20
+ status: z.ZodLiteral<"update-available">;
21
+ currentVersion: z.ZodString;
22
+ latestVersion: z.ZodString;
23
+ releaseUrl: z.ZodString;
24
+ }, z.core.$strip>, z.ZodObject<{
25
+ status: z.ZodLiteral<"unavailable">;
26
+ currentVersion: z.ZodString;
27
+ reason: z.ZodEnum<{
28
+ "invalid-current-version": "invalid-current-version";
29
+ "registry-unavailable": "registry-unavailable";
30
+ "invalid-registry-response": "invalid-registry-response";
31
+ }>;
32
+ }, z.core.$strip>], "status">;
33
+ export declare const codexSubagentModelsSchema: z.ZodObject<{
34
+ available: z.ZodBoolean;
35
+ models: z.ZodArray<z.ZodObject<{
36
+ id: z.ZodString;
37
+ name: z.ZodString;
38
+ efforts: z.ZodArray<z.ZodString>;
39
+ defaultEffort: z.ZodOptional<z.ZodString>;
40
+ }, z.core.$strip>>;
41
+ }, z.core.$strip>;
7
42
  export declare const presetCatalogSchema: z.ZodObject<{
8
43
  presets: z.ZodArray<z.ZodObject<{
9
44
  id: z.ZodString;
@@ -3,6 +3,41 @@ import { z } from 'zod';
3
3
  export const PRESET_EDITOR_PACKAGE = '@shuind/dsh-codex-harness';
4
4
  export const PRESET_EDITOR_SERVICE = 'codexPresetEditor';
5
5
  export const presetIdSchema = z.string().min(1).max(256);
6
+ export const proModeSessionIdSchema = z.string().min(1).max(256);
7
+ export const proModeSetInputSchema = z.object({
8
+ sessionId: proModeSessionIdSchema,
9
+ enabled: z.boolean(),
10
+ });
11
+ export const proModeStateSchema = z.object({
12
+ enabled: z.boolean(),
13
+ });
14
+ export const harnessUpdateResultSchema = z.discriminatedUnion('status', [
15
+ z.object({
16
+ status: z.literal('up-to-date'),
17
+ currentVersion: z.string(),
18
+ latestVersion: z.string(),
19
+ }),
20
+ z.object({
21
+ status: z.literal('update-available'),
22
+ currentVersion: z.string(),
23
+ latestVersion: z.string(),
24
+ releaseUrl: z.string(),
25
+ }),
26
+ z.object({
27
+ status: z.literal('unavailable'),
28
+ currentVersion: z.string(),
29
+ reason: z.enum(['invalid-current-version', 'registry-unavailable', 'invalid-registry-response']),
30
+ }),
31
+ ]);
32
+ export const codexSubagentModelsSchema = z.object({
33
+ available: z.boolean(),
34
+ models: z.array(z.object({
35
+ id: z.string(),
36
+ name: z.string(),
37
+ efforts: z.array(z.string()),
38
+ defaultEffort: z.string().optional(),
39
+ })),
40
+ });
6
41
  export const presetCatalogSchema = z.object({
7
42
  presets: z.array(z.object({
8
43
  id: z.string(),
@@ -85,6 +120,10 @@ export function buildPresetEditorDescriptors() {
85
120
  descriptor('tools', 'id', presetIdSchema, presetToolCatalogSchema),
86
121
  descriptor('prompts', 'id', presetIdSchema, presetPromptCatalogSchema),
87
122
  descriptor('read', 'id', presetIdSchema, presetDefinitionSchema),
123
+ descriptor('proModeGet', 'sessionId', proModeSessionIdSchema, proModeStateSchema),
124
+ descriptor('proModeSet', 'input', proModeSetInputSchema, proModeStateSchema),
125
+ descriptor('updateCheck', undefined, z.unknown(), harnessUpdateResultSchema),
126
+ descriptor('codexSubagentModels', undefined, z.unknown(), codexSubagentModelsSchema),
88
127
  ];
89
128
  }
90
129
  export const presetEditorRemote = {
@@ -2,6 +2,8 @@
2
2
  import type { Context } from '@deepseek-ai/cordis';
3
3
  import z from '@deepseek-ai/schemastery';
4
4
  import type { SettingsNamespace } from '@deepseek-ai/dsh-settings';
5
+ import { supportsApiProMode } from './ui-contracts.ts';
6
+ export { supportsApiProMode };
5
7
  /** Live Codex controls shared by the Web UI and agent layer. */
6
8
  export declare const CODEX_SETTINGS_NAMESPACE: SettingsNamespace;
7
9
  export interface CodexSettings {
@@ -9,6 +11,8 @@ export interface CodexSettings {
9
11
  fast: boolean;
10
12
  /** Show the Fast mode switch in the conversation composer. */
11
13
  fastModeControlEnabled: boolean;
14
+ /** Show the ephemeral per-session API Pro mode switch in the conversation composer. */
15
+ proModeControlEnabled: boolean;
12
16
  /** Show the quick context-window control in the conversation composer. */
13
17
  contextWindowControlEnabled: boolean;
14
18
  /** Optional context capacity override, in tokens. */
@@ -35,6 +39,14 @@ export interface CodexSettings {
35
39
  remoteCompactionEnabled: boolean;
36
40
  /** Show the Codex request/compaction activity indicator. */
37
41
  activityIndicatorEnabled: boolean;
42
+ /** Globally register codex_subagent backed by the openai-codex subscription provider. */
43
+ codexSubagentEnabled: boolean;
44
+ /** Optional openai-codex model id for codex_subagent (blank uses the first enabled model). */
45
+ codexSubagentModel?: string;
46
+ /** Optional reasoning effort id for codex_subagent (blank uses the model default). */
47
+ codexSubagentEffort?: string;
48
+ /** Preset for codex_subagent children ('codex-hybrid' by default, or 'inherit'). */
49
+ codexSubagentPreset: string;
38
50
  }
39
51
  /** Default settings exposed even before a Codex session is opened. */
40
52
  export declare const CODEX_SETTINGS_ENTRY: CodexSettings;
@@ -1,6 +1,7 @@
1
1
  /** Shared host-side Codex settings contract, Host reader, and GPT route matcher. */
2
2
  import z from '@deepseek-ai/schemastery';
3
- import { CODEX_CONTEXT_MAX } from "./ui-contracts.js";
3
+ import { CODEX_CONTEXT_MAX, CODEX_SUBAGENT_DEFAULT_PRESET, supportsApiProMode } from "./ui-contracts.js";
4
+ export { supportsApiProMode };
4
5
  import { DEFAULT_CODEX_PERSONA, DEFAULT_CODEX_SYSTEM_PROMPT, DEFAULT_DSH_CORE_SOURCE_PROMPT, DEFAULT_DSH_CORE_WEB_PROMPT, } from "./prompt.js";
5
6
  /** Live Codex controls shared by the Web UI and agent layer. */
6
7
  export const CODEX_SETTINGS_NAMESPACE = 'codex';
@@ -8,6 +9,7 @@ export const CODEX_SETTINGS_NAMESPACE = 'codex';
8
9
  export const CODEX_SETTINGS_ENTRY = {
9
10
  fast: false,
10
11
  fastModeControlEnabled: true,
12
+ proModeControlEnabled: true,
11
13
  contextWindowControlEnabled: true,
12
14
  persona: DEFAULT_CODEX_PERSONA,
13
15
  harnessSourcePrompt: DEFAULT_DSH_CORE_SOURCE_PROMPT,
@@ -20,10 +22,13 @@ export const CODEX_SETTINGS_ENTRY = {
20
22
  hostedWebSearchEnabled: true,
21
23
  remoteCompactionEnabled: true,
22
24
  activityIndicatorEnabled: true,
25
+ codexSubagentEnabled: false,
26
+ codexSubagentPreset: CODEX_SUBAGENT_DEFAULT_PRESET,
23
27
  };
24
28
  export const CODEX_SETTINGS_SCHEMA = z.object({
25
29
  fast: z.boolean().default(false),
26
30
  fastModeControlEnabled: z.boolean().default(true),
31
+ proModeControlEnabled: z.boolean().default(true),
27
32
  contextWindowControlEnabled: z.boolean().default(true),
28
33
  contextWindow: z.number().step(1).min(1).max(CODEX_CONTEXT_MAX).hidden(),
29
34
  persona: z.string().default(DEFAULT_CODEX_PERSONA),
@@ -37,6 +42,10 @@ export const CODEX_SETTINGS_SCHEMA = z.object({
37
42
  hostedWebSearchEnabled: z.boolean().default(true),
38
43
  remoteCompactionEnabled: z.boolean().default(true),
39
44
  activityIndicatorEnabled: z.boolean().default(true),
45
+ codexSubagentEnabled: z.boolean().default(false),
46
+ codexSubagentModel: z.string(),
47
+ codexSubagentEffort: z.string(),
48
+ codexSubagentPreset: z.string().default(CODEX_SUBAGENT_DEFAULT_PRESET),
40
49
  });
41
50
  /** Host-only reads: never expose the unredacted provider configuration to clients. */
42
51
  export function readHostSettings(ctx, namespace) {
@@ -6,6 +6,52 @@ export declare const CODEX_CONTEXT_MAX = 1000000;
6
6
  export declare const OPENAI_CODEX_PROVIDER = "openai-codex";
7
7
  export declare const OPENAI_CODEX_SETTINGS_NAMESPACE = "llm-openai-codex";
8
8
  export declare const OPENAI_CODEX_MODEL_CATALOG_PATH = "/plugins/dsh-codex-connect/models";
9
+ export declare const CODEX_SUBAGENT_TOOL_NAME = "codex_subagent";
10
+ export declare const CODEX_SUBAGENT_DEFAULT_PRESET = "codex-hybrid";
11
+ export declare const CODEX_SUBAGENT_PRESET_INHERIT = "inherit";
12
+ export interface CodexSubagentModelOption {
13
+ readonly id: string;
14
+ readonly name: string;
15
+ readonly efforts: readonly string[];
16
+ readonly defaultEffort?: string;
17
+ }
18
+ export interface CodexSubagentModelCatalog {
19
+ readonly available: boolean;
20
+ readonly models: readonly CodexSubagentModelOption[];
21
+ }
22
+ /**
23
+ * Models on the OpenAI Responses API that accept `reasoning.mode = "pro"`.
24
+ * Excludes standalone legacy `*-pro` slugs (e.g. `gpt-5.4-pro`, `gpt-5.5-pro`).
25
+ */
26
+ export declare function supportsApiProMode(model: unknown): model is string;
27
+ export interface LlmProviderRouteProfile {
28
+ readonly api?: string | undefined;
29
+ readonly baseURL?: string | undefined;
30
+ readonly baseUrl?: string | undefined;
31
+ readonly models?: readonly {
32
+ readonly id?: string;
33
+ readonly api?: string;
34
+ readonly baseURL?: string;
35
+ readonly baseUrl?: string;
36
+ }[] | undefined;
37
+ readonly modelOverrides?: Readonly<Record<string, {
38
+ readonly api?: string;
39
+ readonly baseURL?: string;
40
+ readonly baseUrl?: string;
41
+ }>> | undefined;
42
+ }
43
+ export type LlmProvidersMap = Readonly<Record<string, LlmProviderRouteProfile>>;
44
+ export interface LlmProvidersScope {
45
+ getSnapshot(): LlmProvidersMap | undefined;
46
+ subscribe(listener: () => void): () => void;
47
+ }
48
+ /** True only when `url` is an HTTPS official OpenAI API endpoint (`api.openai.com`). */
49
+ export declare function isOfficialOpenAiBaseUrl(url: unknown): boolean;
50
+ /**
51
+ * True only when `(provider, model)` routes to the official OpenAI Responses API
52
+ * (`https://api.openai.com`) on a Pro-capable GPT-5.6 / 6+ model.
53
+ */
54
+ export declare function isOfficialOpenAiApiRoute(provider: string | undefined, model: string | undefined, providers?: LlmProvidersMap | undefined): boolean;
9
55
  export interface ContextWindowBounds {
10
56
  readonly defaultTokens?: number;
11
57
  readonly maxTokens: number;
@@ -78,12 +124,18 @@ export interface CodexConnectSnapshot {
78
124
  readonly overrides?: Readonly<Record<string, number | null>> | undefined;
79
125
  readonly baseOverrides?: Readonly<Record<string, number | null>> | undefined;
80
126
  readonly nativeCompaction?: boolean | undefined;
127
+ readonly searchEnabled?: boolean | undefined;
128
+ readonly searchModel?: string | undefined;
129
+ readonly imageGenerationEnabled?: boolean | undefined;
130
+ readonly imageModelHint?: string | undefined;
81
131
  }
82
132
  export interface CodexConnectScope {
83
133
  getSnapshot(): CodexConnectSnapshot;
84
134
  subscribe(listener: () => void): () => void;
85
135
  setModelOverride(modelId: string, tokens: number | undefined): Promise<void>;
86
136
  setNativeCompaction?(enabled: boolean): Promise<void>;
137
+ setSearchEnabled?(enabled: boolean): Promise<void>;
138
+ setImageGenerationEnabled?(enabled: boolean): Promise<void>;
87
139
  }
88
140
  export interface PresetPromptCatalog {
89
141
  readonly preset: string;