@shuind/dsh-codex-harness 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +21 -41
- package/docs/preset-library.md +2 -2
- package/docs/tool-policy.md +1 -1
- package/lib/client.js +1826 -545
- package/lib/compact-command.js +7 -1
- package/lib/compaction.js +7 -1
- package/lib/hybrid-executor.js +23 -12
- package/lib/index.js +1229 -17
- package/lib/preferences.js +21 -2
- package/lib/tool-policy.js +11 -2
- package/lib/typert.js +42 -1
- package/lib/types/client/desktop.d.ts +20 -42
- package/lib/types/client/desktop.js +184 -127
- package/lib/types/client/index.d.ts +104 -39
- package/lib/types/client/index.js +97 -15
- package/lib/types/client/policy-drafts.d.ts +18 -0
- package/lib/types/client/policy-drafts.js +27 -0
- package/lib/types/client/policy-locale.d.ts +81 -32
- package/lib/types/client/policy-locale.js +197 -107
- package/lib/types/client/preset-manager.d.ts +25 -2
- package/lib/types/client/preset-manager.js +89 -5
- package/lib/types/client/preset-requests.d.ts +44 -1
- package/lib/types/client/preset-requests.js +150 -0
- package/lib/types/client/tool-policy.d.ts +6 -15
- package/lib/types/client/tool-policy.js +24 -39
- package/lib/types/contracts/preset-editor-schema.d.ts +35 -0
- package/lib/types/contracts/preset-editor-schema.js +39 -0
- package/lib/types/contracts/settings.d.ts +12 -0
- package/lib/types/contracts/settings.js +10 -1
- package/lib/types/contracts/ui-contracts.d.ts +48 -0
- package/lib/types/contracts/ui-contracts.js +58 -0
- package/lib/types/contracts/update.d.ts +73 -0
- package/lib/types/contracts/update.js +291 -0
- package/lib/types/entries/index.js +20 -2
- package/lib/types/entries/preferences.d.ts +2 -0
- package/lib/types/entries/preferences.js +9 -0
- package/lib/types/hybrid/hybrid-sdk.d.ts +1 -1
- package/lib/types/hybrid/hybrid-sdk.js +27 -13
- package/lib/types/presets/preset-editor.d.ts +13 -1
- package/lib/types/presets/preset-editor.js +24 -1
- package/lib/types/presets/pro-mode-store.d.ts +13 -0
- package/lib/types/presets/pro-mode-store.js +69 -0
- package/lib/types/responses/background-sse-codec.d.ts +23 -0
- package/lib/types/responses/background-sse-codec.js +230 -0
- package/lib/types/responses/background-stream.d.ts +28 -0
- package/lib/types/responses/background-stream.js +351 -0
- package/lib/types/responses/fetch-transport.js +24 -9
- package/lib/types/responses/wire-rewrite.d.ts +4 -0
- package/lib/types/responses/wire-rewrite.js +30 -4
- package/lib/types/tools/codex-subagent.d.ts +14 -0
- package/lib/types/tools/codex-subagent.js +269 -0
- package/lib/types/update/checker.d.ts +14 -0
- package/lib/types/update/checker.js +166 -0
- package/locale/en.json +1 -1
- package/locale/hybrid-executor/en.json +1 -1
- package/locale/hybrid-executor/zh.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +6 -2
- package/src/client/desktop.tsx +359 -160
- package/src/client/index.tsx +122 -22
- package/src/client/policy-drafts.ts +45 -0
- package/src/client/policy-locale.ts +198 -106
- package/src/client/preset-manager.tsx +125 -4
- package/src/client/preset-requests.ts +185 -1
- package/src/client/tool-policy.tsx +29 -63
- package/src/contracts/preset-editor-schema.ts +44 -0
- package/src/contracts/settings.ts +20 -1
- package/src/contracts/ui-contracts.ts +87 -0
- package/src/contracts/update.ts +307 -0
- package/src/entries/index.ts +25 -2
- package/src/entries/preferences.ts +9 -0
- package/src/hybrid/hybrid-sdk.ts +28 -12
- package/src/presets/preset-editor.ts +31 -3
- package/src/presets/pro-mode-store.ts +80 -0
- package/src/responses/background-sse-codec.ts +237 -0
- package/src/responses/background-stream.ts +371 -0
- package/src/responses/fetch-transport.ts +28 -9
- package/src/responses/wire-rewrite.ts +34 -3
- package/src/tools/codex-subagent.ts +290 -0
- package/src/update/checker.ts +193 -0
- package/tsdown.config.ts +4 -0
|
@@ -1,18 +1,68 @@
|
|
|
1
1
|
export const toolPolicyEn = {
|
|
2
2
|
settingsTabLabel: 'Codex Harness',
|
|
3
3
|
settingsToolsPage: 'Preset plans',
|
|
4
|
-
settingsRuntimePage: '
|
|
4
|
+
settingsRuntimePage: 'Global settings',
|
|
5
|
+
settingsHelpPage: 'Guide',
|
|
6
|
+
helpFaqHeading: 'Quick answers',
|
|
7
|
+
helpDeferDisabledTitle: 'Why is Defer greyed out on some tools?',
|
|
8
|
+
helpDeferDisabledDesc: 'Already deferred; hide it if you’re sure you won’t use it.',
|
|
9
|
+
helpDeferLifecycleTitle: 'What is Defer for?',
|
|
10
|
+
helpDeferLifecycleDesc: 'Saves context—loaded on demand and reclaimed after context compaction.',
|
|
11
|
+
helpNativeSearchTitle: 'Prefer native search?',
|
|
12
|
+
helpNativeSearchDesc: 'On uses OpenAI built-in search (billed per search on API); off reuses subscription search.',
|
|
13
|
+
helpConnectHeading: 'Works with Codex Connect',
|
|
14
|
+
helpRegistrationScopeTitle: 'Global subscription search, images & subagent',
|
|
15
|
+
helpRegistrationScopeDesc: 'Turn on in Global settings to share Codex Connect search, image generation, and codex_subagent across all tool-capable models; override per preset.',
|
|
16
|
+
helpProComboTitle: 'API Pro + subscription subagents + subscription search',
|
|
17
|
+
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.',
|
|
18
|
+
helpConnectContextTitle: 'Context window & compaction sync',
|
|
19
|
+
helpConnectContextDesc: 'The composer context button syncs Codex Connect model limits; Prefer remote compaction stays in sync too.',
|
|
20
|
+
helpConnectLinkLabel: 'Companion plugin',
|
|
21
|
+
helpUpdateHeading: 'Version & updates',
|
|
22
|
+
updateHeading: 'Codex Harness update',
|
|
23
|
+
updateBadge: 'Update',
|
|
24
|
+
updateAvailable: 'Update available',
|
|
25
|
+
updateUpToDate: 'Up to date',
|
|
26
|
+
updateChecking: 'Checking…',
|
|
27
|
+
updateUnavailable: 'Check failed',
|
|
28
|
+
updateCheckNow: 'Check updates',
|
|
29
|
+
updateOpenRelease: 'View release',
|
|
30
|
+
updateDismiss: 'Dismiss update notice',
|
|
31
|
+
updateHowTo: 'Update from the DSH Plugin Market, or reinstall @shuind/dsh-codex-harness@latest.',
|
|
5
32
|
settingsSubTools: 'Tools',
|
|
6
33
|
settingsPresetPrompts: 'Prompts',
|
|
7
34
|
settingsDefinition: 'YAML',
|
|
8
|
-
settingsPreferHostedSearch: 'Prefer
|
|
35
|
+
settingsPreferHostedSearch: 'Prefer native search',
|
|
9
36
|
settingsPreferRemoteCompaction: 'Prefer remote compaction',
|
|
10
|
-
settingsSharedFailed: '
|
|
11
|
-
settingsRuntimeScope: 'Shared in this environment',
|
|
12
|
-
|
|
37
|
+
settingsSharedFailed: 'Save failed. Settings may have changed—please try again.',
|
|
38
|
+
settingsRuntimeScope: 'Shared across all presets in this environment.',
|
|
39
|
+
capabilitiesConnectHeading: 'Subscription global registrations',
|
|
40
|
+
capabilitiesConnectCollapsedTitle: 'Codex Connect subscription features',
|
|
41
|
+
capabilitiesConnectInstallHint: 'Install Codex Connect to share subscription web search, image generation, and subagents across all models.',
|
|
42
|
+
capabilitiesConnectNote: 'Registered live via Codex Connect for all models. Adjust per preset in Preset plans.',
|
|
43
|
+
capabilitySearchTitle: 'Subscription web search',
|
|
44
|
+
capabilitySearchNoteAll: 'Reused by all models.',
|
|
45
|
+
capabilitySearchNoteFallback: 'GPT sessions prefer native search; other models reuse this.',
|
|
46
|
+
capabilityImageTitle: 'Subscription image generation',
|
|
47
|
+
capabilityImageNote: 'Registered globally for all tool-capable models.',
|
|
48
|
+
capabilitySubagentTitle: 'Subscription subagent',
|
|
49
|
+
capabilitySubagentNote: 'Registered globally so any tool-capable model can delegate tasks to a Codex subscription subagent.',
|
|
50
|
+
capabilitySubagentModel: 'Model',
|
|
51
|
+
capabilitySubagentNoModels: 'No enabled models',
|
|
52
|
+
capabilitySubagentRestart: 'Restart DSH required',
|
|
53
|
+
capabilitySubagentEffort: 'Effort',
|
|
54
|
+
capabilitySubagentEffortDefault: 'Default',
|
|
55
|
+
capabilitySubagentPreset: 'Preset',
|
|
56
|
+
capabilitySubagentPresetHybrid: 'Codex hybrid',
|
|
57
|
+
capabilitySubagentPresetInherit: 'Follow current chat',
|
|
58
|
+
capabilityRegistered: 'Registered',
|
|
59
|
+
capabilityNotRegistered: 'Not registered',
|
|
60
|
+
capabilityUnavailable: 'Codex Connect unavailable',
|
|
61
|
+
capabilityLoading: 'Loading registration status…',
|
|
62
|
+
capabilityWriteFailed: 'Failed to update registration.',
|
|
13
63
|
settingsBundleSummary: 'Configure Codex Harness in its dedicated Settings tab.',
|
|
14
64
|
settingsBundlePath: 'Settings → Plugins → Codex Harness',
|
|
15
|
-
settingsDefinitionAbsent: 'Choose a preset
|
|
65
|
+
settingsDefinitionAbsent: 'Choose a preset first.',
|
|
16
66
|
globalGroupRequest: 'Model requests',
|
|
17
67
|
globalGroupDisplay: 'Display',
|
|
18
68
|
globalPending: 'Unsaved',
|
|
@@ -42,25 +92,22 @@ export const toolPolicyEn = {
|
|
|
42
92
|
toolPolicyAction: 'Tool action',
|
|
43
93
|
toolPolicyKeep: 'Enable',
|
|
44
94
|
toolPolicyDefer: 'Defer',
|
|
45
|
-
toolPolicyDeferHint: '
|
|
95
|
+
toolPolicyDeferHint: 'Load on demand via activate_tools',
|
|
46
96
|
toolPolicyHide: 'Hide',
|
|
47
97
|
toolPolicyReplaceShort: 'Replace',
|
|
48
|
-
toolPolicyRestoreChoice: 'Restore default
|
|
98
|
+
toolPolicyRestoreChoice: 'Restore default',
|
|
49
99
|
toolPolicyUnsupported: 'Saved replacement unavailable',
|
|
50
100
|
toolPolicyConditional: 'Conditional',
|
|
51
101
|
toolPolicyTargetExists: 'Replacement target already exists',
|
|
52
102
|
toolPolicyPresetDisabled: 'Disabled by original preset',
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
toolPolicyGptCompactionDesc: 'Server-side native context compaction (GPT sessions only; falls back to local summary on failure)',
|
|
62
|
-
toolPolicyGptCompactionBadge: 'GPT native compaction',
|
|
63
|
-
toolPolicyGptCompactionReadOnly: 'Non-tool · Runtime preference',
|
|
103
|
+
toolPolicyGptHostedSearch: 'GPT native search',
|
|
104
|
+
toolPolicyGptHostedSearchTitle: 'GPT sessions prefer OpenAI native search (set in Global settings).',
|
|
105
|
+
toolPolicyGptCodexSearch: 'Codex Connect',
|
|
106
|
+
toolPolicyGptCodexSearchTitle: 'Registered globally by Codex Connect (manage in Global settings).',
|
|
107
|
+
toolPolicyGptDualSearch: 'GPT native / Codex Connect',
|
|
108
|
+
toolPolicyGptDualSearchTitle: 'GPT sessions prefer native search; other models reuse Codex Connect search.',
|
|
109
|
+
toolPolicyGptImageTitle: 'Registered globally by Codex Connect (manage in Global settings).',
|
|
110
|
+
toolPolicyGptSubagentTitle: 'Registered globally using Codex Connect subscription model (manage in Global settings).',
|
|
64
111
|
toolPolicyCommandGroup: 'Commands & runtime',
|
|
65
112
|
toolPolicyFileGroup: 'Files & search',
|
|
66
113
|
toolPolicyPlanGroup: 'Planning & interaction',
|
|
@@ -84,7 +131,7 @@ export const toolPolicyEn = {
|
|
|
84
131
|
toolLabelAskUser: 'Ask structured questions to the user', toolLabelPresent: 'Present deliverable files to the user',
|
|
85
132
|
toolLabelProposeAction: 'Propose action card for user approval', toolLabelApprove: 'Approve action denied by Codex Auto-review',
|
|
86
133
|
toolLabelSubagent: 'Spawn isolated subagent for a subtask', toolLabelSubagentFork: 'Fork subagent from current context',
|
|
87
|
-
toolLabelSubagentCodex: 'Delegate task to Codex subagent', toolLabelSubagentClaude: 'Delegate task to Claude Code subagent',
|
|
134
|
+
toolLabelSubagentCodex: 'Delegate task to Codex subagent', toolLabelCodexSubagent: 'Delegate task to Codex subscription subagent', toolLabelSubagentClaude: 'Delegate task to Claude Code subagent',
|
|
88
135
|
toolLabelSubagentOar: 'Run experimental OAR subagent', toolLabelSubagentModels: 'List available models for subagents',
|
|
89
136
|
toolLabelSendMessage: 'Send message to subagent or teammate', toolLabelListAgents: 'List started subagents and statuses',
|
|
90
137
|
toolLabelInterruptAgent: 'Interrupt a running subagent', toolLabelWaitAgent: 'Wait for subagent or teammate updates',
|
|
@@ -93,8 +140,8 @@ export const toolPolicyEn = {
|
|
|
93
140
|
toolLabelUpdateGoal: 'Update current session goal', toolLabelGoal: 'Manage current session goal',
|
|
94
141
|
toolLabelSpawnTeammate: 'Spawn durable Team teammate', toolLabelTeamCreate: 'Create task on shared Team board',
|
|
95
142
|
toolLabelTeamGet: 'Read latest shared Team task state', toolLabelTeamList: 'List shared Team tasks and blockers',
|
|
96
|
-
toolLabelTeamUpdate: 'Update shared Team task with revision check', toolLabelWebSearch: 'Search the web
|
|
97
|
-
toolLabelWebFetch: 'Fetch
|
|
143
|
+
toolLabelTeamUpdate: 'Update shared Team task with revision check', toolLabelWebSearch: 'Search the web',
|
|
144
|
+
toolLabelWebFetch: 'Fetch text from HTTP(S) URL', toolLabelSkill: 'Load full instructions for a skill',
|
|
98
145
|
toolLabelActivateTools: 'Activate deferred (deferLoading) tools', toolLabelSchedule: 'Manage scheduled tasks',
|
|
99
146
|
toolLabelScheduleCreate: 'Create one-shot or cron schedule', toolLabelScheduleEdit: 'Edit or toggle an existing schedule',
|
|
100
147
|
toolLabelScheduleList: 'List configured schedules', toolLabelScheduleView: 'View schedule details and history',
|
|
@@ -108,29 +155,29 @@ export const toolPolicyEn = {
|
|
|
108
155
|
toolLabelStagehandAct: 'Perform page interaction (Stagehand)', toolLabelStagehandExtract: 'Extract structured page data (Stagehand)',
|
|
109
156
|
toolLabelStagehandObserve: 'Observe interactive page elements (Stagehand)', toolLabelStagehandShot: 'Capture browser screenshot (Stagehand)',
|
|
110
157
|
toolLabelStagehandTabs: 'Manage browser tabs (Stagehand)',
|
|
111
|
-
toolLabelViewImage: 'View local or HTTP(S) image
|
|
112
|
-
toolLabelCodexImageGen: 'Generate or edit images
|
|
113
|
-
toolLabelCodexQuota: 'Query
|
|
158
|
+
toolLabelViewImage: 'View local or HTTP(S) image',
|
|
159
|
+
toolLabelCodexImageGen: 'Generate or edit images',
|
|
160
|
+
toolLabelCodexQuota: 'Query Codex account quota',
|
|
114
161
|
toolLabelMcpDynamic: 'MCP server tool', toolLabelOther: 'Other tool',
|
|
115
162
|
toolPolicyToolsLoading: 'Loading tools…',
|
|
116
163
|
toolPolicyToolsEmpty: 'No registered tools.',
|
|
117
164
|
toolPolicyNoMatches: 'No matching tools.',
|
|
118
|
-
toolPolicyToolsFailed: '
|
|
165
|
+
toolPolicyToolsFailed: 'Could not load tools; saved rules are kept.',
|
|
119
166
|
toolPolicyToolsRefresh: 'Refresh tools',
|
|
120
167
|
toolPolicyCatalogLoading: 'Loading presets…',
|
|
121
168
|
toolPolicyCatalogEmpty: 'No presets found.',
|
|
122
|
-
toolPolicyCatalogFailed: '
|
|
169
|
+
toolPolicyCatalogFailed: 'Could not load presets; saved IDs remain selectable.',
|
|
123
170
|
toolPolicyCatalogRetry: 'Reload presets',
|
|
124
171
|
toolPolicyEmpty: 'Choose a preset',
|
|
125
|
-
toolPolicySave: 'Save
|
|
172
|
+
toolPolicySave: 'Save',
|
|
126
173
|
toolPolicySaving: 'Saving…',
|
|
127
174
|
toolPolicyDiscard: 'Discard draft',
|
|
128
|
-
toolPolicySaved: '
|
|
175
|
+
toolPolicySaved: 'Saved.',
|
|
129
176
|
toolPolicyInvalidPreset: 'An empty preset ID cannot be saved.',
|
|
130
177
|
toolPolicyDuplicatePreset: 'Duplicate preset IDs cannot be saved.',
|
|
131
|
-
toolPolicyRefused: '
|
|
178
|
+
toolPolicyRefused: 'Save conflict. Discard draft to reload.',
|
|
132
179
|
toolPolicyFailed: 'Save failed. Draft is kept.',
|
|
133
|
-
toolPolicyReadOnly: '
|
|
180
|
+
toolPolicyReadOnly: 'Settings are read-only.',
|
|
134
181
|
pmRefresh: 'Refresh',
|
|
135
182
|
peLoading: 'Loading preset…',
|
|
136
183
|
peReadError: 'Preset definition unavailable.',
|
|
@@ -138,18 +185,68 @@ export const toolPolicyEn = {
|
|
|
138
185
|
export const toolPolicyZh = {
|
|
139
186
|
settingsTabLabel: 'Codex Harness',
|
|
140
187
|
settingsToolsPage: '预设方案',
|
|
141
|
-
settingsRuntimePage: '
|
|
188
|
+
settingsRuntimePage: '全局设置',
|
|
189
|
+
settingsHelpPage: '说明',
|
|
190
|
+
helpFaqHeading: '常见问题',
|
|
191
|
+
helpDeferDisabledTitle: '为什么有的工具点不了「延迟」?',
|
|
192
|
+
helpDeferDisabledDesc: '因为它已经延迟了,确定不用可隐藏。',
|
|
193
|
+
helpDeferLifecycleTitle: '「延迟」干嘛的?',
|
|
194
|
+
helpDeferLifecycleDesc: '省上下文,模型需要时再调出来;经过上下文压缩后,不常用的会自动收回。',
|
|
195
|
+
helpNativeSearchTitle: '「优先使用原生搜索」开不开?',
|
|
196
|
+
helpNativeSearchDesc: '开了 GPT 走 OpenAI 原生搜索(API 按次收费);关了统一用订阅搜索。',
|
|
197
|
+
helpConnectHeading: '与 Codex Connect 联动',
|
|
198
|
+
helpRegistrationScopeTitle: '全局复用订阅搜索、生图与子代理',
|
|
199
|
+
helpRegistrationScopeDesc: '在「全局设置」打开后,所有能调工具的模型都能直接用订阅搜索、生图和 codex_subagent;预设方案只管单个模式用不用。',
|
|
200
|
+
helpProComboTitle: 'API Pro + 订阅子代理 + 订阅搜索',
|
|
201
|
+
helpProComboDesc: '用 Pro 订阅送的 API 额度接 GPT-5.6 / 6+,开输入框右侧 Pro(只有官 key 接 GPT-5.6 / 6+ 才会显示,仅当前对话有效);子代理和联网搜索走 Codex 订阅(省 API),品尝脱离网页牢笼的 Pro。',
|
|
202
|
+
helpConnectContextTitle: '上下文与压缩联动',
|
|
203
|
+
helpConnectContextDesc: '输入框上下文按钮直接同步 Codex Connect 模型上限;「优先使用远程压缩」也会自动同步。',
|
|
204
|
+
helpConnectLinkLabel: '配套插件',
|
|
205
|
+
helpUpdateHeading: '版本与更新',
|
|
206
|
+
updateHeading: 'Codex Harness 更新',
|
|
207
|
+
updateBadge: '有更新',
|
|
208
|
+
updateAvailable: '发现新版本',
|
|
209
|
+
updateUpToDate: '已是最新',
|
|
210
|
+
updateChecking: '正在检查…',
|
|
211
|
+
updateUnavailable: '检查失败',
|
|
212
|
+
updateCheckNow: '检查更新',
|
|
213
|
+
updateOpenRelease: '查看更新',
|
|
214
|
+
updateDismiss: '关闭更新提醒',
|
|
215
|
+
updateHowTo: '在 DSH 插件市场直接更新,或重新安装 @shuind/dsh-codex-harness@latest。',
|
|
142
216
|
settingsSubTools: '工具',
|
|
143
217
|
settingsPresetPrompts: '提示词',
|
|
144
218
|
settingsDefinition: '原始定义',
|
|
145
|
-
settingsPreferHostedSearch: '
|
|
219
|
+
settingsPreferHostedSearch: '优先使用原生搜索',
|
|
146
220
|
settingsPreferRemoteCompaction: '优先使用远程压缩',
|
|
147
|
-
settingsSharedFailed: '
|
|
148
|
-
settingsRuntimeScope: '
|
|
149
|
-
|
|
221
|
+
settingsSharedFailed: '保存失败,设置可能已在别处更新,请重试。',
|
|
222
|
+
settingsRuntimeScope: '本环境共享,对所有预设生效。',
|
|
223
|
+
capabilitiesConnectHeading: '订阅能力全局注册',
|
|
224
|
+
capabilitiesConnectCollapsedTitle: 'Codex Connect 订阅能力',
|
|
225
|
+
capabilitiesConnectInstallHint: '安装 Codex Connect 后,可在此全局共享订阅搜索、生图与子代理。',
|
|
226
|
+
capabilitiesConnectNote: '通过 Codex Connect 即时注册到全环境,所有模型可复用;单预设开关请在「预设方案 → 工具」调整。',
|
|
227
|
+
capabilitySearchTitle: '订阅联网搜索',
|
|
228
|
+
capabilitySearchNoteAll: '所有模型统一复用此搜索。',
|
|
229
|
+
capabilitySearchNoteFallback: 'GPT 会话优先用原生搜索,其他模型复用此搜索。',
|
|
230
|
+
capabilityImageTitle: '订阅图片生成 / 编辑',
|
|
231
|
+
capabilityImageNote: '注册为全局工具,所有支持工具调用的模型均可调用。',
|
|
232
|
+
capabilitySubagentTitle: '订阅子代理',
|
|
233
|
+
capabilitySubagentNote: '注册为全局工具,所有支持工具调用的模型均可把任务交给 Codex 订阅子代理。',
|
|
234
|
+
capabilitySubagentModel: '模型',
|
|
235
|
+
capabilitySubagentNoModels: '无可用模型',
|
|
236
|
+
capabilitySubagentRestart: '需重启 DSH',
|
|
237
|
+
capabilitySubagentEffort: '推理',
|
|
238
|
+
capabilitySubagentEffortDefault: '默认',
|
|
239
|
+
capabilitySubagentPreset: '预设',
|
|
240
|
+
capabilitySubagentPresetHybrid: 'Codex 混合模式',
|
|
241
|
+
capabilitySubagentPresetInherit: '跟随当前对话',
|
|
242
|
+
capabilityRegistered: '已注册',
|
|
243
|
+
capabilityNotRegistered: '未注册',
|
|
244
|
+
capabilityUnavailable: '未安装 Codex Connect',
|
|
245
|
+
capabilityLoading: '正在读取注册状态…',
|
|
246
|
+
capabilityWriteFailed: '更新注册状态失败。',
|
|
150
247
|
settingsBundleSummary: '请在独立的 Codex Harness 设置页配置。',
|
|
151
248
|
settingsBundlePath: '设置 → 内置插件 → Codex Harness',
|
|
152
|
-
settingsDefinitionAbsent: '
|
|
249
|
+
settingsDefinitionAbsent: '请先选择一个预设。',
|
|
153
250
|
globalGroupRequest: '模型请求',
|
|
154
251
|
globalGroupDisplay: '界面',
|
|
155
252
|
globalPending: '未保存',
|
|
@@ -168,105 +265,102 @@ export const toolPolicyZh = {
|
|
|
168
265
|
presetSummaryPrompts: '提示词',
|
|
169
266
|
toolPolicyDraftSummary: '本次修改',
|
|
170
267
|
toolPolicyRuleChanged: '预设方案调整',
|
|
171
|
-
toolPolicyNoToolDelta: '
|
|
268
|
+
toolPolicyNoToolDelta: '无待保存修改',
|
|
172
269
|
toolPolicySearch: '搜索工具',
|
|
173
270
|
toolPolicyFilter: '工具筛选',
|
|
174
271
|
toolPolicyAll: '全部',
|
|
175
272
|
toolPolicyModified: '已修改',
|
|
176
|
-
toolPolicyDeferredFilter: '
|
|
273
|
+
toolPolicyDeferredFilter: '已延迟',
|
|
177
274
|
toolPolicyReplaceable: '可替换',
|
|
178
275
|
toolPolicyDefaultDeferred: '默认延迟',
|
|
179
276
|
toolPolicyAction: '工具操作',
|
|
180
277
|
toolPolicyKeep: '启用',
|
|
181
278
|
toolPolicyDefer: '延迟',
|
|
182
|
-
toolPolicyDeferHint: '
|
|
279
|
+
toolPolicyDeferHint: '按需加载(调用时再激活)',
|
|
183
280
|
toolPolicyHide: '隐藏',
|
|
184
281
|
toolPolicyReplaceShort: '替换',
|
|
185
|
-
toolPolicyRestoreChoice: '
|
|
282
|
+
toolPolicyRestoreChoice: '恢复默认',
|
|
186
283
|
toolPolicyUnsupported: '已保存的替换当前不可用',
|
|
187
284
|
toolPolicyConditional: '按条件可用',
|
|
188
285
|
toolPolicyTargetExists: '替换目标已存在',
|
|
189
286
|
toolPolicyPresetDisabled: '原预设未启用',
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
toolPolicyGptCompactionDesc: '使用 OpenAI 服务端原生压缩替代默认文本摘要(仅 GPT 会话,失败自动回退)',
|
|
199
|
-
toolPolicyGptCompactionBadge: 'GPT 原生压缩',
|
|
200
|
-
toolPolicyGptCompactionReadOnly: '非工具 · 运行偏好控制',
|
|
287
|
+
toolPolicyGptHostedSearch: 'GPT 原生搜索',
|
|
288
|
+
toolPolicyGptHostedSearchTitle: 'GPT 会话优先用原生搜索(在「全局设置」调整)。',
|
|
289
|
+
toolPolicyGptCodexSearch: 'Codex Connect',
|
|
290
|
+
toolPolicyGptCodexSearchTitle: '由 Codex Connect 全局注册(在「全局设置」管理)。',
|
|
291
|
+
toolPolicyGptDualSearch: 'GPT 原生 / Codex Connect',
|
|
292
|
+
toolPolicyGptDualSearchTitle: 'GPT 会话优先用原生搜索,其他模型复用订阅搜索。',
|
|
293
|
+
toolPolicyGptImageTitle: '由 Codex Connect 全局注册的生图工具(在「全局设置」管理)。',
|
|
294
|
+
toolPolicyGptSubagentTitle: '通过 Codex Connect 订阅模型全局注册的子代理工具(在「全局设置」管理)。',
|
|
201
295
|
toolPolicyCommandGroup: '命令与执行',
|
|
202
296
|
toolPolicyFileGroup: '文件与检索',
|
|
203
297
|
toolPolicyPlanGroup: '规划与交互',
|
|
204
298
|
toolPolicyCollabGroup: '子代理与工作流',
|
|
205
299
|
toolPolicyOtherGroup: '网络与扩展',
|
|
206
300
|
toolPolicyCustomized: '项修改',
|
|
207
|
-
toolLabelExec: '
|
|
301
|
+
toolLabelExec: '运行终端命令(Shell / PTY)', toolLabelStdin: '读写交互式终端(PTY)',
|
|
208
302
|
toolLabelPwsh: '执行 PowerShell 命令', toolLabelBash: '执行 Bash 命令',
|
|
209
|
-
toolLabelRunCode: '
|
|
210
|
-
toolLabelJobOutput: '
|
|
211
|
-
toolLabelTermOpen: '
|
|
212
|
-
toolLabelTermRead: '
|
|
213
|
-
toolLabelTermSignal: '
|
|
214
|
-
toolLabelWorkdir: '
|
|
215
|
-
toolLabelPatch: '
|
|
216
|
-
toolLabelWrite: '
|
|
217
|
-
toolLabelStrReplace: '
|
|
218
|
-
toolLabelGrep: '
|
|
219
|
-
toolLabelLsp: '
|
|
220
|
-
toolLabelTodo: '
|
|
221
|
-
toolLabelAskUser: '
|
|
222
|
-
toolLabelProposeAction: '
|
|
223
|
-
toolLabelSubagent: '
|
|
224
|
-
toolLabelSubagentCodex: '
|
|
225
|
-
toolLabelSubagentOar: '
|
|
226
|
-
toolLabelSendMessage: '
|
|
227
|
-
toolLabelInterruptAgent: '
|
|
228
|
-
toolLabelWorkflow: '运行多阶段 /
|
|
229
|
-
toolLabelCreateGoal: '
|
|
230
|
-
toolLabelUpdateGoal: '
|
|
231
|
-
toolLabelSpawnTeammate: '
|
|
232
|
-
toolLabelTeamGet: '
|
|
233
|
-
toolLabelTeamUpdate: '
|
|
234
|
-
toolLabelWebFetch: '
|
|
235
|
-
toolLabelActivateTools: '
|
|
236
|
-
toolLabelScheduleCreate: '
|
|
237
|
-
toolLabelScheduleList: '
|
|
238
|
-
toolLabelPluginManager: '
|
|
239
|
-
toolLabelCordisList: '
|
|
240
|
-
toolLabelSessionSearch: '
|
|
241
|
-
toolLabelSessionEventRead: '
|
|
242
|
-
toolLabelSessionEventTrace: '
|
|
243
|
-
toolLabelMcpTemplates: '列出 MCP
|
|
244
|
-
toolLabelWorkspaceDeps: '获取内置 Python
|
|
245
|
-
toolLabelStagehandAct: '
|
|
246
|
-
toolLabelStagehandObserve: '
|
|
303
|
+
toolLabelRunCode: '沙箱运行代码并批量调用工具', toolLabelJobList: '列出后台任务及状态',
|
|
304
|
+
toolLabelJobOutput: '读取后台任务输出', toolLabelJobKill: '终止后台任务',
|
|
305
|
+
toolLabelTermOpen: '打开持久终端', toolLabelTermList: '列出持久终端',
|
|
306
|
+
toolLabelTermRead: '读取持久终端输出', toolLabelTermSend: '向持久终端发送输入',
|
|
307
|
+
toolLabelTermSignal: '向持久终端发送信号', toolLabelTermClose: '关闭持久终端',
|
|
308
|
+
toolLabelWorkdir: '查看或切换工作目录(cd)', toolLabelWorktree: '新建 Git 分支与工作树',
|
|
309
|
+
toolLabelPatch: '应用补丁修改文件', toolLabelRead: '读取文本文件',
|
|
310
|
+
toolLabelWrite: '新建或覆盖文件', toolLabelEdit: '按文本替换编辑文件',
|
|
311
|
+
toolLabelStrReplace: '按文本替换查看或编辑文件', toolLabelGlob: '按通配符查找文件',
|
|
312
|
+
toolLabelGrep: '正则搜索文件内容', toolLabelImage: '读取图片',
|
|
313
|
+
toolLabelLsp: 'LSP 代码符号与引用查询', toolLabelPlan: '更新任务计划',
|
|
314
|
+
toolLabelTodo: '更新待办列表', toolLabelExitPlan: '提交方案并退出规划模式',
|
|
315
|
+
toolLabelAskUser: '向用户提问', toolLabelPresent: '向用户展示交付文件',
|
|
316
|
+
toolLabelProposeAction: '请求用户确认操作', toolLabelApprove: '批准自动审查拦截的操作',
|
|
317
|
+
toolLabelSubagent: '启动独立子代理', toolLabelSubagentFork: '派生子代理(继承上下文)',
|
|
318
|
+
toolLabelSubagentCodex: '委托 Codex 子代理', toolLabelCodexSubagent: '委托 Codex 订阅子代理', toolLabelSubagentClaude: '委托 Claude Code 子代理',
|
|
319
|
+
toolLabelSubagentOar: '启动 OAR 子代理', toolLabelSubagentModels: '列出子代理可用模型',
|
|
320
|
+
toolLabelSendMessage: '向子代理发消息', toolLabelListAgents: '列出子代理及状态',
|
|
321
|
+
toolLabelInterruptAgent: '中断子代理任务', toolLabelWaitAgent: '等待子代理状态更新',
|
|
322
|
+
toolLabelWorkflow: '运行多阶段 / 并行工作流', toolLabelRalph: '运行自动迭代循环代理',
|
|
323
|
+
toolLabelCreateGoal: '创建会话目标', toolLabelGetGoal: '读取会话目标',
|
|
324
|
+
toolLabelUpdateGoal: '更新会话目标进度', toolLabelGoal: '管理会话目标',
|
|
325
|
+
toolLabelSpawnTeammate: '创建团队协作代理', toolLabelTeamCreate: '新建团队任务',
|
|
326
|
+
toolLabelTeamGet: '读取团队任务状态', toolLabelTeamList: '列出团队任务与阻塞',
|
|
327
|
+
toolLabelTeamUpdate: '更新团队任务', toolLabelWebSearch: '搜索网页信息',
|
|
328
|
+
toolLabelWebFetch: '抓取网页文本', toolLabelSkill: '加载技能说明',
|
|
329
|
+
toolLabelActivateTools: '激活延迟加载的工具', toolLabelSchedule: '管理定时任务',
|
|
330
|
+
toolLabelScheduleCreate: '新建定时任务', toolLabelScheduleEdit: '修改或启停定时任务',
|
|
331
|
+
toolLabelScheduleList: '列出定时任务', toolLabelScheduleView: '查看定时任务详情',
|
|
332
|
+
toolLabelPluginManager: '管理当前配置插件', toolLabelPluginMarket: '浏览插件市场',
|
|
333
|
+
toolLabelCordisList: '列出宿主诊断接口', toolLabelCordisQuery: '查询宿主诊断信息',
|
|
334
|
+
toolLabelSessionSearch: '跨历史会话搜索事件', toolLabelSessionTrace: '追踪会话链路',
|
|
335
|
+
toolLabelSessionEventRead: '读取单条会话事件', toolLabelSessionEventSearch: '搜索当前会话事件',
|
|
336
|
+
toolLabelSessionEventTrace: '追踪会话事件引用链', toolLabelMcpList: '列出 MCP 资源',
|
|
337
|
+
toolLabelMcpTemplates: '列出 MCP 资源模板', toolLabelMcpRead: '读取 MCP 资源',
|
|
338
|
+
toolLabelWorkspaceDeps: '获取内置 Python 与依赖路径', toolLabelStagehandNav: '浏览器打开网页(Stagehand)',
|
|
339
|
+
toolLabelStagehandAct: '执行页面交互(Stagehand)', toolLabelStagehandExtract: '提取页面数据(Stagehand)',
|
|
340
|
+
toolLabelStagehandObserve: '识别页面可交互元素(Stagehand)', toolLabelStagehandShot: '截取浏览器页面(Stagehand)',
|
|
247
341
|
toolLabelStagehandTabs: '管理浏览器标签页(Stagehand)',
|
|
248
|
-
toolLabelViewImage: '
|
|
249
|
-
toolLabelCodexImageGen: '
|
|
250
|
-
toolLabelCodexQuota: '
|
|
342
|
+
toolLabelViewImage: '查看本地或网络图片',
|
|
343
|
+
toolLabelCodexImageGen: '生成或编辑图片',
|
|
344
|
+
toolLabelCodexQuota: '查询 Codex 账号额度',
|
|
251
345
|
toolLabelMcpDynamic: 'MCP 扩展工具', toolLabelOther: '其它工具',
|
|
252
346
|
toolPolicyToolsLoading: '正在读取工具…',
|
|
253
347
|
toolPolicyToolsEmpty: '没有已注册工具。',
|
|
254
348
|
toolPolicyNoMatches: '没有匹配工具。',
|
|
255
|
-
toolPolicyToolsFailed: '
|
|
349
|
+
toolPolicyToolsFailed: '无法加载工具列表,已保存规则不受影响。',
|
|
256
350
|
toolPolicyToolsRefresh: '刷新工具',
|
|
257
351
|
toolPolicyCatalogLoading: '正在读取预设…',
|
|
258
352
|
toolPolicyCatalogEmpty: '没有可选预设。',
|
|
259
|
-
toolPolicyCatalogFailed: '
|
|
353
|
+
toolPolicyCatalogFailed: '无法加载预设列表,仍可选择已保存项。',
|
|
260
354
|
toolPolicyCatalogRetry: '重新读取预设',
|
|
261
355
|
toolPolicyEmpty: '请选择预设',
|
|
262
|
-
toolPolicySave: '
|
|
356
|
+
toolPolicySave: '保存',
|
|
263
357
|
toolPolicySaving: '正在保存…',
|
|
264
358
|
toolPolicyDiscard: '放弃草稿',
|
|
265
|
-
toolPolicySaved: '
|
|
359
|
+
toolPolicySaved: '已保存。',
|
|
266
360
|
toolPolicyInvalidPreset: '预设 ID 为空,无法保存。',
|
|
267
361
|
toolPolicyDuplicatePreset: '预设 ID 重复,无法保存。',
|
|
268
|
-
toolPolicyRefused: '
|
|
269
|
-
toolPolicyFailed: '
|
|
362
|
+
toolPolicyRefused: '保存冲突,请放弃草稿后重试。',
|
|
363
|
+
toolPolicyFailed: '保存失败,草稿已保留。',
|
|
270
364
|
toolPolicyReadOnly: '当前设置为只读。',
|
|
271
365
|
pmRefresh: '刷新',
|
|
272
366
|
peLoading: '正在读取预设…',
|
|
@@ -280,16 +374,12 @@ const commandNames = new Set([
|
|
|
280
374
|
const fileNames = new Set(['read', 'write', 'edit', 'str_replace_editor', 'apply_patch', 'glob', 'grep', 'read_image', 'view_image', 'lsp']);
|
|
281
375
|
const planNames = new Set(['todo_write', 'update_plan', 'exit_plan_mode', 'ask_user_question', 'present', 'propose_action', 'approve']);
|
|
282
376
|
const collabNames = new Set([
|
|
283
|
-
'subagent', 'subagent_fork', 'subagent_codex', 'subagent_claude_code', 'subagent_oar', 'list_subagent_models',
|
|
377
|
+
'subagent', 'subagent_fork', 'subagent_codex', 'codex_subagent', 'subagent_claude_code', 'subagent_oar', 'list_subagent_models',
|
|
284
378
|
'send_message', 'list_agents', 'interrupt_agent', 'wait_agent', 'workflow', 'ralph',
|
|
285
379
|
'create_goal', 'get_goal', 'update_goal', 'goal', 'spawn_teammate', 'team_task_create', 'team_task_get',
|
|
286
380
|
'team_task_list', 'team_task_update',
|
|
287
381
|
]);
|
|
288
|
-
export function groupOf(tool
|
|
289
|
-
if (tool.name === 'codex_connect_image_generate')
|
|
290
|
-
return 'gpt';
|
|
291
|
-
if (tool.name === 'web_search' && gptSearchActive)
|
|
292
|
-
return 'gpt';
|
|
382
|
+
export function groupOf(tool) {
|
|
293
383
|
if (commandNames.has(tool.name) || tool.replacements.some(item => item.action === 'codex-exec'))
|
|
294
384
|
return 'command';
|
|
295
385
|
if (fileNames.has(tool.name) || tool.replacements.some(item => item.action === 'codex-patch'))
|
|
@@ -310,7 +400,7 @@ export const humanLabels = {
|
|
|
310
400
|
glob: 'toolLabelGlob', grep: 'toolLabelGrep', read_image: 'toolLabelImage', lsp: 'toolLabelLsp',
|
|
311
401
|
update_plan: 'toolLabelPlan', todo_write: 'toolLabelTodo', exit_plan_mode: 'toolLabelExitPlan',
|
|
312
402
|
ask_user_question: 'toolLabelAskUser', present: 'toolLabelPresent', propose_action: 'toolLabelProposeAction', approve: 'toolLabelApprove',
|
|
313
|
-
subagent: 'toolLabelSubagent', subagent_fork: 'toolLabelSubagentFork', subagent_codex: 'toolLabelSubagentCodex',
|
|
403
|
+
subagent: 'toolLabelSubagent', subagent_fork: 'toolLabelSubagentFork', subagent_codex: 'toolLabelSubagentCodex', codex_subagent: 'toolLabelCodexSubagent',
|
|
314
404
|
subagent_claude_code: 'toolLabelSubagentClaude', subagent_oar: 'toolLabelSubagentOar', list_subagent_models: 'toolLabelSubagentModels',
|
|
315
405
|
send_message: 'toolLabelSendMessage', list_agents: 'toolLabelListAgents', interrupt_agent: 'toolLabelInterruptAgent',
|
|
316
406
|
wait_agent: 'toolLabelWaitAgent', workflow: 'toolLabelWorkflow', ralph: 'toolLabelRalph',
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots';
|
|
2
2
|
import type { RemoteResult, TypertClientRemote } from '@deepseek-ai/dsh-typert-protocol';
|
|
3
|
-
import type { CodexConnectScope, ModelDirectorySnapshot, ModelDirectoryStore, PresetCatalog, PresetDefinitionDocument } from '../contracts/ui-contracts.ts';
|
|
3
|
+
import type { CodexConnectScope, CodexSubagentModelCatalog, LlmProvidersMap, LlmProvidersScope, ModelDirectorySnapshot, ModelDirectoryStore, PresetCatalog, PresetDefinitionDocument } from '../contracts/ui-contracts.ts';
|
|
4
4
|
import type { PresetPromptCatalog, PresetToolCatalog } from '../contracts/tool-policy-contract.ts';
|
|
5
|
+
import type { HarnessUpdateResult } from '../contracts/update.ts';
|
|
5
6
|
export interface PresetClientRemote extends TypertClientRemote {
|
|
6
7
|
codexPresetEditor: {
|
|
7
8
|
catalog(): Promise<RemoteResult<PresetCatalog>>;
|
|
8
9
|
tools?(id: string): Promise<RemoteResult<PresetToolCatalog>>;
|
|
9
10
|
prompts?(id: string): Promise<RemoteResult<PresetPromptCatalog>>;
|
|
10
11
|
read(id: string): Promise<RemoteResult<PresetDefinitionDocument>>;
|
|
12
|
+
proModeGet?(sessionId: string): Promise<RemoteResult<{
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
}>>;
|
|
15
|
+
proModeSet?(input: {
|
|
16
|
+
sessionId: string;
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
}): Promise<RemoteResult<{
|
|
19
|
+
enabled: boolean;
|
|
20
|
+
}>>;
|
|
21
|
+
updateCheck?(): Promise<RemoteResult<HarnessUpdateResult>>;
|
|
22
|
+
codexSubagentModels?(): Promise<RemoteResult<CodexSubagentModelCatalog>>;
|
|
11
23
|
};
|
|
12
24
|
}
|
|
13
25
|
export interface PresetManagerActions {
|
|
@@ -28,7 +40,7 @@ export declare function pillStyle(active: boolean, writable: boolean): {
|
|
|
28
40
|
gap: number;
|
|
29
41
|
height: number;
|
|
30
42
|
border: number;
|
|
31
|
-
borderRadius:
|
|
43
|
+
borderRadius: string;
|
|
32
44
|
padding: string;
|
|
33
45
|
font: string;
|
|
34
46
|
fontSize: number;
|
|
@@ -47,4 +59,15 @@ export interface ContextControlProps extends PropsLocale<'codex'> {
|
|
|
47
59
|
getCodexConnectScope?: (() => CodexConnectScope | undefined) | undefined;
|
|
48
60
|
}
|
|
49
61
|
export declare function ContextWindowControl(props: ContextControlProps): import("react").JSX.Element | null;
|
|
62
|
+
/** Show the ephemeral API Pro toggle only for official OpenAI API GPT-5.6/6+ models. */
|
|
63
|
+
export declare function isProModeEligible(snapshot: ModelDirectorySnapshot | undefined, hasDirectory: boolean, llmProviders?: LlmProvidersMap | undefined): boolean;
|
|
64
|
+
export interface ProModeControlProps extends PropsLocale<'codex'> {
|
|
65
|
+
sessionId?: unknown;
|
|
66
|
+
injectedSessionId?: string | undefined;
|
|
67
|
+
useSettings: (select: (state: unknown) => unknown) => unknown;
|
|
68
|
+
presetManager?: PresetManagerActions | undefined;
|
|
69
|
+
modelDirectory?: ModelDirectoryStore | undefined;
|
|
70
|
+
getLlmProvidersScope?: (() => LlmProvidersScope | undefined) | undefined;
|
|
71
|
+
}
|
|
72
|
+
export declare function ProModeControl(props: ProModeControlProps): import("react").JSX.Element | null;
|
|
50
73
|
//# sourceMappingURL=preset-manager.d.ts.map
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
/** Read-only preset definition viewer and composer context-window control for Harness 0.2.2+. */
|
|
3
3
|
import { useCallback, useEffect, useId, useRef, useState, useSyncExternalStore } from 'react';
|
|
4
4
|
import { createPortal } from 'react-dom';
|
|
5
|
-
import { contextPresetsForBounds, formatCompactTokens, OPENAI_CODEX_MODEL_CATALOG_PATH, OPENAI_CODEX_MODEL_LIMITS, OPENAI_CODEX_PROVIDER, parseCustomContextInput, resolveContextWindowBounds, } from "../contracts/ui-contracts.js";
|
|
5
|
+
import { contextPresetsForBounds, formatCompactTokens, isOfficialOpenAiApiRoute, OPENAI_CODEX_MODEL_CATALOG_PATH, OPENAI_CODEX_MODEL_LIMITS, OPENAI_CODEX_PROVIDER, parseCustomContextInput, resolveContextWindowBounds, supportsApiProMode, } from "../contracts/ui-contracts.js";
|
|
6
6
|
import { readPresetWithRetry } from "./preset-requests.js";
|
|
7
7
|
const documentCache = new WeakMap();
|
|
8
8
|
function unwrap(result) {
|
|
@@ -74,15 +74,15 @@ export function useModelDirectory(modelDirectory) {
|
|
|
74
74
|
export function pillStyle(active, writable) {
|
|
75
75
|
return {
|
|
76
76
|
boxSizing: 'border-box',
|
|
77
|
-
display: '
|
|
77
|
+
display: 'flex',
|
|
78
78
|
alignItems: 'center',
|
|
79
79
|
gap: 5,
|
|
80
80
|
height: 28,
|
|
81
81
|
border: 0,
|
|
82
|
-
borderRadius:
|
|
83
|
-
padding: '
|
|
82
|
+
borderRadius: 'var(--dsw-radius-sm, 7px)',
|
|
83
|
+
padding: '3px 6px 0',
|
|
84
84
|
font: 'inherit',
|
|
85
|
-
fontSize:
|
|
85
|
+
fontSize: 13,
|
|
86
86
|
lineHeight: '20px',
|
|
87
87
|
whiteSpace: 'nowrap',
|
|
88
88
|
color: active ? 'var(--dsw-static-blue-500)' : 'var(--dsw-alias-label-secondary)',
|
|
@@ -264,4 +264,88 @@ export function ContextWindowControl(props) {
|
|
|
264
264
|
}, children: [_jsx("input", { type: "text", inputMode: "numeric", placeholder: t('contextCustomPlaceholder'), "aria-label": t('contextCustomPlaceholder'), "aria-invalid": customInvalid, value: customInput, onChange: event => { setCustomInput(event.currentTarget.value); if (customInvalid)
|
|
265
265
|
setCustomInvalid(false); } }), _jsx("button", { type: "submit", disabled: !writable, children: t('contextApply') })] })] }), document.body) : null] });
|
|
266
266
|
}
|
|
267
|
+
/** Show the ephemeral API Pro toggle only for official OpenAI API GPT-5.6/6+ models. */
|
|
268
|
+
export function isProModeEligible(snapshot, hasDirectory, llmProviders) {
|
|
269
|
+
if (!hasDirectory || snapshot?.status !== 'ready' || snapshot.current === undefined)
|
|
270
|
+
return false;
|
|
271
|
+
return isOfficialOpenAiApiRoute(snapshot.current.provider, snapshot.current.model, llmProviders);
|
|
272
|
+
}
|
|
273
|
+
export function ProModeControl(props) {
|
|
274
|
+
const { sessionId, injectedSessionId, useSettings, presetManager, modelDirectory, getLlmProvidersScope, t } = props;
|
|
275
|
+
const dirSnapshot = useModelDirectory(modelDirectory);
|
|
276
|
+
const snapshot = useSettings(state => state);
|
|
277
|
+
const visible = snapshot.value?.proModeControlEnabled ?? true;
|
|
278
|
+
const maybeOfficial = modelDirectory !== undefined && dirSnapshot?.status === 'ready'
|
|
279
|
+
&& dirSnapshot.current?.provider !== OPENAI_CODEX_PROVIDER && supportsApiProMode(dirSnapshot.current?.model);
|
|
280
|
+
const providersScope = maybeOfficial ? getLlmProvidersScope?.() : undefined;
|
|
281
|
+
const subscribeProviders = useCallback((listener) => providersScope ? providersScope.subscribe(listener) : NOOP_SUBSCRIBE(), [providersScope]);
|
|
282
|
+
const getProvidersSnap = useCallback(() => providersScope?.getSnapshot(), [providersScope]);
|
|
283
|
+
const llmProviders = useSyncExternalStore(subscribeProviders, getProvidersSnap, getProvidersSnap);
|
|
284
|
+
const eligible = isProModeEligible(dirSnapshot, modelDirectory !== undefined, llmProviders);
|
|
285
|
+
const rawSessionId = sessionId ?? injectedSessionId;
|
|
286
|
+
const normalizedSessionId = typeof rawSessionId === 'string'
|
|
287
|
+
? rawSessionId.trim()
|
|
288
|
+
: rawSessionId !== undefined && rawSessionId !== null
|
|
289
|
+
? String(rawSessionId).trim()
|
|
290
|
+
: '';
|
|
291
|
+
const [enabled, setEnabled] = useState(false);
|
|
292
|
+
const [pending, setPending] = useState(false);
|
|
293
|
+
const activeSessionRef = useRef(normalizedSessionId);
|
|
294
|
+
const mountedRef = useRef(true);
|
|
295
|
+
activeSessionRef.current = normalizedSessionId;
|
|
296
|
+
useEffect(() => {
|
|
297
|
+
mountedRef.current = true;
|
|
298
|
+
return () => { mountedRef.current = false; };
|
|
299
|
+
}, []);
|
|
300
|
+
useEffect(() => {
|
|
301
|
+
setEnabled(false);
|
|
302
|
+
setPending(false);
|
|
303
|
+
if (!visible || !eligible || normalizedSessionId.length === 0)
|
|
304
|
+
return undefined;
|
|
305
|
+
let active = true;
|
|
306
|
+
void Promise.resolve(presetManager?.ready).then(async () => {
|
|
307
|
+
const api = presetManager?.remote?.codexPresetEditor;
|
|
308
|
+
if (!active || typeof api?.proModeGet !== 'function')
|
|
309
|
+
return;
|
|
310
|
+
const result = await api.proModeGet(normalizedSessionId);
|
|
311
|
+
if (active && result.ok)
|
|
312
|
+
setEnabled(result.value.enabled);
|
|
313
|
+
}).catch(() => { });
|
|
314
|
+
return () => { active = false; };
|
|
315
|
+
}, [visible, eligible, normalizedSessionId, presetManager]);
|
|
316
|
+
if (!visible || !eligible)
|
|
317
|
+
return null;
|
|
318
|
+
const interactive = !pending && normalizedSessionId.length > 0;
|
|
319
|
+
const label = enabled ? t('proOn') : t('proOff');
|
|
320
|
+
const toggle = () => {
|
|
321
|
+
if (!interactive)
|
|
322
|
+
return;
|
|
323
|
+
const targetSessionId = normalizedSessionId;
|
|
324
|
+
const next = !enabled;
|
|
325
|
+
setPending(true);
|
|
326
|
+
setEnabled(next);
|
|
327
|
+
void Promise.resolve(presetManager?.ready).then(async () => {
|
|
328
|
+
const api = presetManager?.remote?.codexPresetEditor;
|
|
329
|
+
if (typeof api?.proModeSet !== 'function') {
|
|
330
|
+
if (mountedRef.current && activeSessionRef.current === targetSessionId)
|
|
331
|
+
setEnabled(!next);
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
const result = await api.proModeSet({ sessionId: targetSessionId, enabled: next });
|
|
335
|
+
if (mountedRef.current && activeSessionRef.current === targetSessionId) {
|
|
336
|
+
setEnabled(result.ok ? result.value.enabled : !next);
|
|
337
|
+
}
|
|
338
|
+
}).catch(() => {
|
|
339
|
+
if (mountedRef.current && activeSessionRef.current === targetSessionId)
|
|
340
|
+
setEnabled(!next);
|
|
341
|
+
}).finally(() => {
|
|
342
|
+
if (mountedRef.current && activeSessionRef.current === targetSessionId)
|
|
343
|
+
setPending(false);
|
|
344
|
+
});
|
|
345
|
+
};
|
|
346
|
+
return (_jsxs("button", { type: "button", role: "switch", disabled: !interactive, "aria-checked": enabled, "data-codex-pro-control": enabled ? 'on' : 'off', "aria-label": label, title: label, onClick: toggle, style: {
|
|
347
|
+
...pillStyle(enabled, interactive),
|
|
348
|
+
...(enabled ? { boxShadow: 'inset 0 0 0 1px var(--dsw-static-blue-500)' } : {}),
|
|
349
|
+
}, children: [_jsx("span", { children: t('pro') }), _jsx("span", { style: { color: enabled ? 'var(--dsw-static-blue-500)' : 'var(--dsw-alias-label-secondary)', fontSize: 12 }, children: enabled ? t('fastStateOn') : t('fastStateOff') })] }));
|
|
350
|
+
}
|
|
267
351
|
//# sourceMappingURL=preset-manager.js.map
|