@oh-my-dsh/dsh-better-subagent 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/docs/DEVELOPMENT.md +4 -3
- package/package.json +1 -1
- package/src/client.js +397 -334
- package/src/config.js +17 -5
- package/src/prompt.js +6 -15
package/src/client.js
CHANGED
|
@@ -55,10 +55,25 @@ window.__ModuleLoader__.load({
|
|
|
55
55
|
const BACKENDS = [CODEX, CLAUDE];
|
|
56
56
|
|
|
57
57
|
const zh = {
|
|
58
|
+
modelRecommendations: "主代理按任务参考这两档模型;「沿用」使用主会话模型。",
|
|
59
|
+
routingTitle: "模型路由",
|
|
60
|
+
mainAgent: "主代理",
|
|
61
|
+
mainAgentNote: "当前会话使用的模型",
|
|
62
|
+
routingNote: "这两档只是工程预设的推荐,不做强制限制;实际调用仍需使用允许使用的模型。",
|
|
63
|
+
backendsTitle: "本机代理",
|
|
64
|
+
expertSettings: "专家设置",
|
|
65
|
+
expertDefault: "默认启动命令",
|
|
66
|
+
expertCurrent: "{executable} · 配置 {profile}",
|
|
67
|
+
trustedHostsAdvanced: "反向代理信任主机",
|
|
68
|
+
readonlyShort: "只读",
|
|
69
|
+
chooseModel: "选择模型",
|
|
70
|
+
changeModel: "更改模型",
|
|
71
|
+
backendsIntro: "通过本机安装的 Codex 或 Claude 运行子代理,使用各自的默认模型与权限。",
|
|
72
|
+
effortHint: "思考强度决定模型的推理投入,留空使用模型默认值。",
|
|
58
73
|
advanced: "高级",
|
|
59
74
|
configureBackend: '配置 {backend}',
|
|
60
75
|
modelsEmptyTitle: '配置第一个模型',
|
|
61
|
-
effortsFirst:
|
|
76
|
+
effortsFirst: "先填写可选思考强度",
|
|
62
77
|
trustedCount: '{count} 个主机',
|
|
63
78
|
behaviorTitle: '行为',
|
|
64
79
|
defaults: "默认",
|
|
@@ -67,12 +82,11 @@ window.__ModuleLoader__.load({
|
|
|
67
82
|
draftPreview: "草稿预览",
|
|
68
83
|
changeCount: "{count} 项改动",
|
|
69
84
|
resetConfirm: "再次点击放弃",
|
|
70
|
-
backendOff: "
|
|
71
|
-
routingPreview: "
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
profileChoose: "使用 Profile {profile}",
|
|
85
|
+
backendOff: "启用后可选择默认模型与操作权限。",
|
|
86
|
+
routingPreview: "选择子代理使用的模型",
|
|
87
|
+
tierFastTask: "快速档 · 探索与批量检查",
|
|
88
|
+
tierQualityTask: "质量档 · 实现、调试与审查",
|
|
89
|
+
profileChoose: "使用 Codex 配置 {profile}",
|
|
76
90
|
permissionReadOnly: "只读检查,不写入文件。",
|
|
77
91
|
permissionWrite: "可修改工作区文件,外部访问仍受限。",
|
|
78
92
|
permissionFull: "可修改文件并访问外部资源,跳过权限确认。",
|
|
@@ -82,12 +96,12 @@ window.__ModuleLoader__.load({
|
|
|
82
96
|
permissionAcceptEdits: "自动允许文件修改,其它操作仍需确认。",
|
|
83
97
|
permissionAuto: "由 Claude 自动评估操作权限。",
|
|
84
98
|
permissionBypass: "跳过所有权限确认。",
|
|
85
|
-
trustedDefault: "
|
|
99
|
+
trustedDefault: "仅本机(localhost)",
|
|
86
100
|
modelCatalog: "模型目录",
|
|
87
101
|
diagnosticsLink: "查看连接诊断",
|
|
88
102
|
tabGeneral: "概览",
|
|
89
|
-
tabCli: "
|
|
90
|
-
tabTiers: "
|
|
103
|
+
tabCli: "本机代理",
|
|
104
|
+
tabTiers: "模型选择",
|
|
91
105
|
tabConnection: "连接",
|
|
92
106
|
details: "说明",
|
|
93
107
|
configured: "已启用",
|
|
@@ -95,69 +109,72 @@ window.__ModuleLoader__.load({
|
|
|
95
109
|
scopeInactive: "范围已关闭",
|
|
96
110
|
unsaved: "未保存",
|
|
97
111
|
upToDate: "已同步",
|
|
98
|
-
trustedHostsLabel: "
|
|
99
|
-
trustedHostsHint: "
|
|
112
|
+
trustedHostsLabel: "允许访问的主机",
|
|
113
|
+
trustedHostsHint: "每行填写主机名或主机名:端口,不含协议和路径;留空仅允许本机访问模型与检测信息,不授予设置写入权限。",
|
|
100
114
|
invalidTrustedHosts: "受信主机格式有误,请填写主机名或 host:port。",
|
|
101
115
|
connectionMode: "配置连接",
|
|
102
116
|
connectionWritable: "可写",
|
|
103
117
|
connectionReadonly: "只读",
|
|
104
118
|
capabilitiesLabel: "CLI 探测",
|
|
105
|
-
routesLabel: "
|
|
119
|
+
routesLabel: "允许使用的模型",
|
|
106
120
|
refresh: "刷新探测",
|
|
107
121
|
ready: "可用",
|
|
108
122
|
failed: "读取失败",
|
|
109
123
|
modelCount: "{count} 个模型",
|
|
110
|
-
saveBeforeDiscover: "
|
|
124
|
+
saveBeforeDiscover: "先保存启动命令或 Codex 配置,再检测或查找模型。",
|
|
111
125
|
permissionElevated: "此权限档允许绕过 CLI 的权限确认。",
|
|
112
|
-
invalidTierEffort: "{backend}
|
|
113
|
-
route: "
|
|
114
|
-
effort: "
|
|
115
|
-
globalOverrides: "
|
|
116
|
-
summary:
|
|
126
|
+
invalidTierEffort: "{backend}所选思考强度不适用于当前模型,请重新选择。",
|
|
127
|
+
route: "模型",
|
|
128
|
+
effort: "思考强度",
|
|
129
|
+
globalOverrides: "所有预设已包含工程预设。",
|
|
130
|
+
summary: "子代理模型、本机 Codex / Claude 与运行设置",
|
|
117
131
|
title: '子代理',
|
|
118
|
-
intro:
|
|
119
|
-
loading:
|
|
120
|
-
waitingForm:
|
|
121
|
-
noFormHint:
|
|
122
|
-
unavailable:
|
|
123
|
-
readonly:
|
|
124
|
-
childExitGuardLabel:
|
|
125
|
-
childExitGuardHint:
|
|
126
|
-
|
|
127
|
-
|
|
132
|
+
intro: "保存后即时生效。",
|
|
133
|
+
loading: "正在加载设置…",
|
|
134
|
+
waitingForm: "正在加载设置…",
|
|
135
|
+
noFormHint: "暂时无法加载设置,请刷新页面或检查连接。",
|
|
136
|
+
unavailable: "当前连接无法访问设置,请在运行 DSH 的电脑上通过 localhost 打开,或联系管理员。",
|
|
137
|
+
readonly: "当前连接仅供查看,无法保存设置。",
|
|
138
|
+
childExitGuardLabel: "等待子代理完成",
|
|
139
|
+
childExitGuardHint: "子代理仍在运行时继续等待;按 Esc 仍可中断。",
|
|
140
|
+
delegationPromptLabel: "委派提示词",
|
|
141
|
+
delegationPromptHint: "把委派纪律与模型分档写进系统提示词,对所有预设生效;与 CLI 接入范围无关。",
|
|
142
|
+
tiersTitle: "子代理模型选择",
|
|
143
|
+
tiersIntro: "为工程预设推荐子代理模型;实际调用仍需符合允许使用的模型范围。",
|
|
128
144
|
tierFast: '快速档',
|
|
129
145
|
tierQuality: '质量档',
|
|
130
|
-
tierFastHint:
|
|
131
|
-
tierQualityHint:
|
|
132
|
-
tierInherit:
|
|
146
|
+
tierFastHint: "探索、检索与批量检查时优先推荐。",
|
|
147
|
+
tierQualityHint: "实现、调试、评审与设计时优先推荐。",
|
|
148
|
+
tierInherit: "沿用主会话模型",
|
|
133
149
|
tierEffortDefault: '模型默认',
|
|
134
|
-
tierRouteLabel:
|
|
135
|
-
tierEffortLabel:
|
|
136
|
-
tierOffList:
|
|
137
|
-
tiersInactive:
|
|
138
|
-
routesLoading:
|
|
139
|
-
routesError:
|
|
140
|
-
invalidTierRoute:
|
|
141
|
-
scopeTitle:
|
|
142
|
-
scopeEng:
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
150
|
+
tierRouteLabel: "{tier}模型",
|
|
151
|
+
tierEffortLabel: "{tier}思考强度",
|
|
152
|
+
tierOffList: "(不可用) {route}",
|
|
153
|
+
tiersInactive: "请先在「插件 → 子代理 → 模型选择」启用并添加可用模型;当前仍可沿用主会话模型。",
|
|
154
|
+
routesLoading: "正在读取可用模型…",
|
|
155
|
+
routesError: "暂时无法读取可用模型,请刷新重试。",
|
|
156
|
+
invalidTierRoute: "{backend}所选模型不可用,请改选或沿用主会话模型。",
|
|
157
|
+
scopeTitle: "本机代理可用范围",
|
|
158
|
+
scopeEng: "仅工程预设",
|
|
159
|
+
scopeEngIncluded: "工程预设(已包含)",
|
|
160
|
+
scopeEngHint: "在 eng 和 eng-ptc 会话中提供已启用的 Codex / Claude。",
|
|
161
|
+
scopeGlobal: "所有预设",
|
|
162
|
+
scopeGlobalHint: "在所有会话中提供已启用的 Codex / Claude,包含工程预设。",
|
|
163
|
+
scopeNone: "未选择可用范围,所有会话都无法使用这些本机代理。",
|
|
164
|
+
codexTitle: "Codex 本机代理",
|
|
165
|
+
claudeTitle: "Claude 本机代理",
|
|
149
166
|
backendEnable: '启用',
|
|
150
|
-
executableLabel:
|
|
151
|
-
executableHint:
|
|
152
|
-
profileLabel:
|
|
153
|
-
profileHint:
|
|
167
|
+
executableLabel: "启动命令",
|
|
168
|
+
executableHint: "填写命令名或完整路径,例如 codex 或 /usr/local/bin/codex。",
|
|
169
|
+
profileLabel: "Codex 配置",
|
|
170
|
+
profileHint: "选择已有的 Codex 配置,留空使用默认配置。",
|
|
154
171
|
profileNone: '(不指定)',
|
|
155
|
-
permissionLabel:
|
|
156
|
-
permissionHint:
|
|
172
|
+
permissionLabel: "文件与操作权限",
|
|
173
|
+
permissionHint: "本机代理使用此处权限,不沿用主会话权限。",
|
|
157
174
|
defaultModelLabel: '默认模型',
|
|
158
175
|
defaultModelNone: '(未指定)',
|
|
159
|
-
modelsLabel:
|
|
160
|
-
modelsHint:
|
|
176
|
+
modelsLabel: "模型与思考强度",
|
|
177
|
+
modelsHint: "思考强度控制模型的推理投入;每行填写模型 ID、可选值和默认值。",
|
|
161
178
|
modelsEmpty: '还没有配置模型;启用后端前至少加一个模型。',
|
|
162
179
|
discover: '自动发现模型',
|
|
163
180
|
discovering: '正在发现…',
|
|
@@ -176,7 +193,7 @@ window.__ModuleLoader__.load({
|
|
|
176
193
|
discoverReasonTooLarge: '返回内容过大',
|
|
177
194
|
modelIdPlaceholder: '模型 id',
|
|
178
195
|
modelEffortsPlaceholder: 'low, medium, high',
|
|
179
|
-
modelDefaultEffort:
|
|
196
|
+
modelDefaultEffort: "默认思考强度",
|
|
180
197
|
modelEffortNone: '(无默认)',
|
|
181
198
|
modelAdd: '添加模型',
|
|
182
199
|
modelRemove: '移除',
|
|
@@ -189,23 +206,37 @@ window.__ModuleLoader__.load({
|
|
|
189
206
|
saving: '保存中…',
|
|
190
207
|
reset: '放弃改动',
|
|
191
208
|
saved: '已保存,即时生效。',
|
|
192
|
-
conflict:
|
|
209
|
+
conflict: "未能保存,已重新读取当前设置;请检查后重试。",
|
|
193
210
|
saveFailed: '保存失败:',
|
|
194
211
|
invalidEmptyId: '{backend}里有模型缺少 id,请补齐后再保存。',
|
|
195
212
|
invalidDuplicateId: '{backend}的模型 id 不能重复。',
|
|
196
213
|
invalidNoModels: '{backend}已启用,但还没有配置任何模型。',
|
|
197
214
|
invalidDefaultModel: '{backend}已启用,请把默认模型设为模型列表里的一个。',
|
|
198
215
|
invalidDefaultEffort: '{backend}的默认模型需要 effort 列表,并指定一个属于它的默认 effort。',
|
|
199
|
-
readonlyShort: '只读',
|
|
200
216
|
readonlyNote: '只读:当前无法写入宿主配置。',
|
|
201
217
|
unavailableNote: '不可写:当前连接下该配置不可用。',
|
|
202
218
|
};
|
|
203
219
|
|
|
204
220
|
const en = {
|
|
221
|
+
modelRecommendations: "The main agent uses these tiers as recommendations. Inherit uses the main conversation’s provider and model.",
|
|
222
|
+
routingTitle: "Model routing",
|
|
223
|
+
mainAgent: "Main agent",
|
|
224
|
+
mainAgentNote: "The model used by this conversation",
|
|
225
|
+
routingNote: "These tiers are recommendations for engineering presets, not enforcement; every call must still use a permitted model.",
|
|
226
|
+
backendsTitle: "Local agents",
|
|
227
|
+
expertSettings: "Expert settings",
|
|
228
|
+
expertDefault: "Default command",
|
|
229
|
+
expertCurrent: "{executable} · profile {profile}",
|
|
230
|
+
trustedHostsAdvanced: "Reverse-proxy trusted hosts",
|
|
231
|
+
readonlyShort: "Read-only",
|
|
232
|
+
chooseModel: "Choose model",
|
|
233
|
+
changeModel: "Change model",
|
|
234
|
+
backendsIntro: "Run subagents through Codex or Claude installed on this computer, with their own default model and permissions.",
|
|
235
|
+
effortHint: "Thinking effort controls how much reasoning the model uses. Leave blank for the model default.",
|
|
205
236
|
advanced: "Advanced",
|
|
206
237
|
configureBackend: 'Configure {backend}',
|
|
207
238
|
modelsEmptyTitle: 'Set up your first model',
|
|
208
|
-
effortsFirst:
|
|
239
|
+
effortsFirst: "Add effort options first",
|
|
209
240
|
trustedCount: '{count} hosts',
|
|
210
241
|
behaviorTitle: 'Behavior',
|
|
211
242
|
defaults: "Default",
|
|
@@ -214,12 +245,11 @@ window.__ModuleLoader__.load({
|
|
|
214
245
|
draftPreview: "Draft preview",
|
|
215
246
|
changeCount: "{count} changes",
|
|
216
247
|
resetConfirm: "Click again to discard",
|
|
217
|
-
backendOff: "Enable to
|
|
218
|
-
routingPreview: "
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
profileChoose: "Use Profile {profile}",
|
|
248
|
+
backendOff: "Enable to choose its default model and operation permissions.",
|
|
249
|
+
routingPreview: "Choose models for subagents",
|
|
250
|
+
tierFastTask: "Fast tier · Explore and check",
|
|
251
|
+
tierQualityTask: "Quality tier · Build, debug and review",
|
|
252
|
+
profileChoose: "Use Codex configuration {profile}",
|
|
223
253
|
permissionReadOnly: "Inspect files without writing.",
|
|
224
254
|
permissionWrite: "Edit workspace files with restricted external access.",
|
|
225
255
|
permissionFull: "Edit files and access external resources without approval prompts.",
|
|
@@ -229,12 +259,12 @@ window.__ModuleLoader__.load({
|
|
|
229
259
|
permissionAcceptEdits: "Allow file edits; other operations still require approval.",
|
|
230
260
|
permissionAuto: "Let Claude assess operation permissions.",
|
|
231
261
|
permissionBypass: "Skip all permission prompts.",
|
|
232
|
-
trustedDefault: "
|
|
262
|
+
trustedDefault: "This computer only (localhost)",
|
|
233
263
|
modelCatalog: "Model catalog",
|
|
234
264
|
diagnosticsLink: "View connection diagnostics",
|
|
235
265
|
tabGeneral: "Overview",
|
|
236
|
-
tabCli: "
|
|
237
|
-
tabTiers: "Model
|
|
266
|
+
tabCli: "Local agents",
|
|
267
|
+
tabTiers: "Model selection",
|
|
238
268
|
tabConnection: "Connection",
|
|
239
269
|
details: "Details",
|
|
240
270
|
configured: "Enabled",
|
|
@@ -242,69 +272,72 @@ window.__ModuleLoader__.load({
|
|
|
242
272
|
scopeInactive: "Scope off",
|
|
243
273
|
unsaved: "Unsaved changes",
|
|
244
274
|
upToDate: "Up to date",
|
|
245
|
-
trustedHostsLabel: "
|
|
246
|
-
trustedHostsHint: "
|
|
275
|
+
trustedHostsLabel: "Allowed hosts",
|
|
276
|
+
trustedHostsHint: "Enter a hostname or host:port per line, without a scheme or path. Blank allows only this computer to read model and detection information; this does not grant settings write access.",
|
|
247
277
|
invalidTrustedHosts: "Enter a hostname or host:port for each trusted host.",
|
|
248
278
|
connectionMode: "Settings connection",
|
|
249
279
|
connectionWritable: "Writable",
|
|
250
280
|
connectionReadonly: "Read-only",
|
|
251
281
|
capabilitiesLabel: "CLI detection",
|
|
252
|
-
routesLabel: "
|
|
282
|
+
routesLabel: "Permitted models",
|
|
253
283
|
refresh: "Refresh detection",
|
|
254
284
|
ready: "Available",
|
|
255
285
|
failed: "Request failed",
|
|
256
286
|
modelCount: "{count} models",
|
|
257
|
-
saveBeforeDiscover: "Save the
|
|
287
|
+
saveBeforeDiscover: "Save the launch command or Codex configuration before detecting agents or finding models.",
|
|
258
288
|
permissionElevated: "This permission mode can bypass CLI approval prompts.",
|
|
259
|
-
invalidTierEffort: "The {backend} effort is unavailable for this model. Select another.",
|
|
260
|
-
route: "
|
|
261
|
-
effort: "
|
|
262
|
-
globalOverrides: "All presets includes
|
|
263
|
-
summary:
|
|
289
|
+
invalidTierEffort: "The {backend} thinking effort is unavailable for this model. Select another.",
|
|
290
|
+
route: "Model",
|
|
291
|
+
effort: "Thinking effort",
|
|
292
|
+
globalOverrides: "All presets already includes engineering presets.",
|
|
293
|
+
summary: "Subagent models, local Codex / Claude and run settings",
|
|
264
294
|
title: 'Subagents',
|
|
265
|
-
intro:
|
|
266
|
-
loading:
|
|
267
|
-
waitingForm:
|
|
268
|
-
noFormHint:
|
|
269
|
-
unavailable:
|
|
270
|
-
readonly:
|
|
271
|
-
childExitGuardLabel:
|
|
272
|
-
childExitGuardHint:
|
|
273
|
-
|
|
274
|
-
|
|
295
|
+
intro: "Changes apply after saving.",
|
|
296
|
+
loading: "Loading settings…",
|
|
297
|
+
waitingForm: "Loading settings…",
|
|
298
|
+
noFormHint: "Settings are not loading. Refresh the page or check your connection.",
|
|
299
|
+
unavailable: "Settings are unavailable on this connection. Open DSH through localhost on the computer running it, or contact your administrator.",
|
|
300
|
+
readonly: "This connection is view-only. Settings cannot be saved.",
|
|
301
|
+
childExitGuardLabel: "Wait for subagents to finish",
|
|
302
|
+
childExitGuardHint: "Keep waiting while subagents run. You can still interrupt with Esc.",
|
|
303
|
+
delegationPromptLabel: "Delegation prompt",
|
|
304
|
+
delegationPromptHint: "Adds the delegation rules and model tiers to the system prompt for every preset; independent of the CLI scope.",
|
|
305
|
+
tiersTitle: "Subagent model selection",
|
|
306
|
+
tiersIntro: "Recommend subagent models in engineering presets; calls must still use a permitted model.",
|
|
275
307
|
tierFast: 'Fast tier',
|
|
276
308
|
tierQuality: 'Quality tier',
|
|
277
|
-
tierFastHint:
|
|
278
|
-
tierQualityHint:
|
|
279
|
-
tierInherit:
|
|
309
|
+
tierFastHint: "Recommended for exploration, search and batch checks.",
|
|
310
|
+
tierQualityHint: "Recommended for implementation, debugging, review and design.",
|
|
311
|
+
tierInherit: "Use main conversation model",
|
|
280
312
|
tierEffortDefault: 'Model default',
|
|
281
|
-
tierRouteLabel:
|
|
282
|
-
tierEffortLabel:
|
|
283
|
-
tierOffList:
|
|
284
|
-
tiersInactive:
|
|
285
|
-
routesLoading:
|
|
286
|
-
routesError:
|
|
287
|
-
invalidTierRoute:
|
|
288
|
-
scopeTitle:
|
|
289
|
-
scopeEng:
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
313
|
+
tierRouteLabel: "{tier} model",
|
|
314
|
+
tierEffortLabel: "{tier} thinking effort",
|
|
315
|
+
tierOffList: "(unavailable) {route}",
|
|
316
|
+
tiersInactive: "Enable and add models in Plugins → Subagent → Model selection first. You can still use the main conversation model.",
|
|
317
|
+
routesLoading: "Loading available models…",
|
|
318
|
+
routesError: "Available models could not be loaded. Refresh to try again.",
|
|
319
|
+
invalidTierRoute: "The {backend} model is unavailable. Choose another or use the main conversation model.",
|
|
320
|
+
scopeTitle: "Where local agents are available",
|
|
321
|
+
scopeEng: "Engineering presets only",
|
|
322
|
+
scopeEngIncluded: "Engineering presets (included)",
|
|
323
|
+
scopeEngHint: "Offer enabled Codex / Claude agents in eng and eng-ptc conversations.",
|
|
324
|
+
scopeGlobal: "All presets",
|
|
325
|
+
scopeGlobalHint: "Offer enabled Codex / Claude agents in every conversation, including engineering presets.",
|
|
326
|
+
scopeNone: "No scope is selected. These local agents are unavailable in all conversations.",
|
|
327
|
+
codexTitle: "Local Codex agent",
|
|
328
|
+
claudeTitle: "Local Claude agent",
|
|
296
329
|
backendEnable: 'Enabled',
|
|
297
|
-
executableLabel:
|
|
298
|
-
executableHint:
|
|
299
|
-
profileLabel:
|
|
300
|
-
profileHint:
|
|
330
|
+
executableLabel: "Launch command",
|
|
331
|
+
executableHint: "Enter a command name or full path, such as codex or /usr/local/bin/codex.",
|
|
332
|
+
profileLabel: "Codex configuration",
|
|
333
|
+
profileHint: "Choose an existing Codex configuration, or leave blank to use its default.",
|
|
301
334
|
profileNone: '(none)',
|
|
302
|
-
permissionLabel:
|
|
303
|
-
permissionHint:
|
|
335
|
+
permissionLabel: "File and operation permissions",
|
|
336
|
+
permissionHint: "Local agents use these permissions, independently of the main conversation.",
|
|
304
337
|
defaultModelLabel: 'Default model',
|
|
305
338
|
defaultModelNone: '(unset)',
|
|
306
|
-
modelsLabel:
|
|
307
|
-
modelsHint:
|
|
339
|
+
modelsLabel: "Models and thinking effort",
|
|
340
|
+
modelsHint: "Thinking effort controls how much reasoning a model uses. Enter its ID, effort options and default on each row.",
|
|
308
341
|
modelsEmpty: 'No model yet; add at least one before enabling the backend.',
|
|
309
342
|
discover: 'Discover models',
|
|
310
343
|
discovering: 'Discovering…',
|
|
@@ -323,7 +356,7 @@ window.__ModuleLoader__.load({
|
|
|
323
356
|
discoverReasonTooLarge: 'the reply is too large',
|
|
324
357
|
modelIdPlaceholder: 'model id',
|
|
325
358
|
modelEffortsPlaceholder: 'low, medium, high',
|
|
326
|
-
modelDefaultEffort:
|
|
359
|
+
modelDefaultEffort: "Default thinking effort",
|
|
327
360
|
modelEffortNone: '(none)',
|
|
328
361
|
modelAdd: 'Add model',
|
|
329
362
|
modelRemove: 'Remove',
|
|
@@ -336,14 +369,13 @@ window.__ModuleLoader__.load({
|
|
|
336
369
|
saving: 'Saving…',
|
|
337
370
|
reset: 'Discard',
|
|
338
371
|
saved: 'Saved and applied.',
|
|
339
|
-
conflict:
|
|
372
|
+
conflict: "Could not save. Current settings were reloaded; review them and try again.",
|
|
340
373
|
saveFailed: 'Save failed: ',
|
|
341
374
|
invalidEmptyId: 'Every model in {backend} needs an id before saving.',
|
|
342
375
|
invalidDuplicateId: 'Model ids in {backend} must be unique.',
|
|
343
376
|
invalidNoModels: '{backend} is enabled but has no model configured.',
|
|
344
377
|
invalidDefaultModel: '{backend} is enabled: set the default model to one of its model ids.',
|
|
345
378
|
invalidDefaultEffort: '{backend}’s default model needs an effort list and a default effort from that list.',
|
|
346
|
-
readonlyShort: 'Read-only',
|
|
347
379
|
readonlyNote: 'Read-only: host configuration cannot be written.',
|
|
348
380
|
unavailableNote: 'Not writable: this configuration is unavailable on the current connection.',
|
|
349
381
|
};
|
|
@@ -373,152 +405,148 @@ window.__ModuleLoader__.load({
|
|
|
373
405
|
// ── 样式(组件树内的 <style>;复用 DSH 设计令牌,与官方设置页同观感)──────────
|
|
374
406
|
|
|
375
407
|
const STYLE_ID = '@oh-my-dsh/dsh-better-subagent/settings.css';
|
|
376
|
-
const CSS = `.bs-root{--cfg-accent
|
|
377
|
-
|
|
378
|
-
.bs-root,.bs-root *{box-sizing:border-box}
|
|
408
|
+
const CSS = `.bs-root{--cfg-accent:var(--dsw-alias-state-business-primary,#4176e6);--cfg-accent-solid:var(--dsw-alias-button-primary-fill,#0f1115);--cfg-accent-fg:var(--dsw-alias-label-primary-foreground,#fff);--cfg-accent-text:color-mix(in srgb,var(--cfg-accent) 72%,var(--cfg-ink));--cfg-accent-hover:color-mix(in srgb,var(--cfg-accent-solid) 88%,var(--cfg-bg));--cfg-accent-soft:color-mix(in srgb,var(--cfg-accent) 10%,transparent);--cfg-bg:var(--dsw-alias-bg-layer-1);--cfg-raised:var(--dsw-alias-bg-layer-2);--cfg-overlay:var(--dsw-alias-bg-layer-3);--cfg-sunken:color-mix(in srgb,var(--dsw-alias-label-primary) 4%,var(--dsw-alias-bg-layer-1));--cfg-ink:var(--dsw-alias-label-primary);--cfg-muted:var(--dsw-alias-label-secondary);--cfg-dim:color-mix(in srgb,var(--dsw-alias-label-tertiary) 80%,var(--cfg-ink));--cfg-line:var(--dsw-alias-border-l2);--cfg-line-strong:var(--dsw-alias-border-l3);--cfg-hover:var(--dsw-alias-interactive-bg-hover);--cfg-danger:var(--dsw-alias-state-error-primary);--cfg-warn:color-mix(in srgb,var(--dsw-alias-state-warn-primary) 60%,var(--cfg-ink));--cfg-success:color-mix(in srgb,var(--dsw-alias-state-success-primary) 60%,var(--cfg-ink));--cfg-mono:var(--dsw-font-family-mono,ui-monospace,SFMono-Regular,Menlo,Consolas,monospace);color:var(--cfg-ink);font:inherit;font-size:13px;line-height:20px;font-variant-numeric:tabular-nums;min-width:0;width:100%;--bs-action-size:32px;container:bs-settings / inline-size}
|
|
409
|
+
.bs-root *{box-sizing:border-box}
|
|
379
410
|
.bs-root [hidden]{display:none!important}
|
|
380
|
-
.bs-cfg{display:flex;flex-direction:column;gap:
|
|
381
|
-
.bs-header{display:flex;align-items:
|
|
382
|
-
.bs-
|
|
383
|
-
.bs-
|
|
384
|
-
.bs-
|
|
385
|
-
.bs-
|
|
386
|
-
.bs-
|
|
387
|
-
.bs-
|
|
388
|
-
.bs-
|
|
389
|
-
.bs-
|
|
411
|
+
.bs-cfg{display:flex;flex-direction:column;gap:20px;max-width:960px;width:100%;margin:0 auto;min-width:0}
|
|
412
|
+
.bs-header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;min-height:32px}
|
|
413
|
+
.bs-headerMain{display:flex;flex-direction:column;gap:2px;min-width:0}
|
|
414
|
+
.bs-headerIntro{color:var(--cfg-dim);font-size:12px;line-height:18px}
|
|
415
|
+
.bs-headerMeta{display:flex;align-items:center;gap:6px;flex-wrap:wrap;justify-content:flex-end}
|
|
416
|
+
.bs-title{margin:0;font-size:12px;line-height:18px;font-weight:500;color:var(--cfg-dim)}
|
|
417
|
+
.bs-header .bs-title{font-size:20px;line-height:28px;letter-spacing:-.01em;color:var(--cfg-ink)}
|
|
418
|
+
.bs-sectionTitle{margin:0;font-size:12px;line-height:18px;font-weight:500;color:var(--cfg-dim)}
|
|
419
|
+
.bs-cardTitle{margin:0;font-size:13px;line-height:20px;font-weight:500;color:var(--cfg-ink)}
|
|
420
|
+
.bs-hint,.bs-status{margin:0;color:var(--cfg-dim);font-size:12px;line-height:18px}
|
|
421
|
+
.bs-hintWarn{color:var(--cfg-warn)}
|
|
422
|
+
.bs-note{margin:0;padding:8px 10px;border:1px solid var(--cfg-line);border-radius:8px;background:var(--cfg-sunken);color:var(--cfg-muted);font-size:12px;line-height:18px}
|
|
390
423
|
.bs-note[data-tone=error],.bs-hint[data-tone=error],.bs-status[data-tone=error]{color:var(--cfg-danger)}
|
|
391
|
-
.bs-
|
|
392
|
-
.bs-
|
|
393
|
-
.bs-tabs
|
|
394
|
-
.bs-tab{appearance:none;position:relative;display:inline-flex;align-items:center;justify-content:center;gap:
|
|
395
|
-
.bs-tab:hover{
|
|
396
|
-
.bs-tab[aria-selected=true]{
|
|
397
|
-
.bs-tab
|
|
398
|
-
.bs-subtabs{
|
|
399
|
-
.bs-subtabs .bs-tab{height:
|
|
400
|
-
.bs-
|
|
401
|
-
.bs-
|
|
402
|
-
.bs-
|
|
403
|
-
.bs-
|
|
404
|
-
.bs-sectionHead{
|
|
405
|
-
.bs-
|
|
406
|
-
.bs-
|
|
407
|
-
.bs-
|
|
408
|
-
.bs-
|
|
409
|
-
.bs-
|
|
410
|
-
.bs-
|
|
411
|
-
.bs-
|
|
424
|
+
.bs-note[data-tone=warn]{border-color:var(--cfg-warn);color:var(--cfg-warn)}
|
|
425
|
+
.bs-hint[data-tone=ok],.bs-status[data-tone=ok]{color:var(--cfg-success)}
|
|
426
|
+
.bs-tabs{display:flex;gap:20px;padding:0;border-bottom:1px solid var(--cfg-line);overflow-x:auto;scrollbar-width:thin}
|
|
427
|
+
.bs-tab{appearance:none;position:relative;flex:none;display:inline-flex;align-items:center;justify-content:center;gap:7px;height:32px;padding:0 0 8px;border:0;border-radius:0;background:transparent;color:var(--cfg-muted);font:inherit;font-weight:500;cursor:pointer;white-space:nowrap}
|
|
428
|
+
.bs-tab:hover{color:var(--cfg-ink)}
|
|
429
|
+
.bs-tab[aria-selected=true]{color:var(--cfg-ink)}
|
|
430
|
+
.bs-tab[aria-selected=true]::after{content:"";position:absolute;inset-inline:0;bottom:0;height:1px;background:var(--cfg-accent)}
|
|
431
|
+
.bs-subtabs{align-self:flex-start;gap:16px;padding:0;border:0;border-bottom:1px solid var(--cfg-line);border-radius:0;background:transparent}
|
|
432
|
+
.bs-subtabs .bs-tab{height:32px;padding:0 0 7px;border:0;border-radius:0;font-weight:400}
|
|
433
|
+
.bs-subtabs .bs-tab:hover{background:transparent;color:var(--cfg-ink)}
|
|
434
|
+
.bs-subtabs .bs-tab[aria-selected=true]{background:transparent;border:0;color:var(--cfg-ink);font-weight:500}
|
|
435
|
+
.bs-tabpanel{display:flex;flex-direction:column;gap:20px;min-width:0}
|
|
436
|
+
.bs-section{display:flex;flex-direction:column;gap:6px;min-width:0}
|
|
437
|
+
.bs-sectionHead,.bs-cardHead{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:28px}
|
|
438
|
+
.bs-toolbar{display:flex;align-items:center;gap:8px;min-width:0}
|
|
439
|
+
.bs-card{display:flex;flex-direction:column;gap:8px;min-width:0;padding:12px 14px;border:1px solid var(--cfg-line);border-radius:8px;background:var(--cfg-raised)}
|
|
440
|
+
.bs-cardBody{display:flex;flex-direction:column;gap:8px;min-width:0}
|
|
441
|
+
.bs-cardHead .bs-switchRow{padding:0;gap:10px}
|
|
442
|
+
.bs-cardHead .bs-switchLabel{color:var(--cfg-muted);font-weight:400}
|
|
443
|
+
.bs-field{display:grid;grid-template-columns:140px minmax(0,1fr);gap:6px 16px;padding:4px 0;align-items:start}
|
|
444
|
+
.bs-fieldLabel{display:flex;align-items:center;gap:5px;padding-top:5px;font-weight:500}
|
|
445
|
+
.bs-fieldBody{display:flex;flex-direction:column;gap:4px;min-width:0;width:100%}
|
|
446
|
+
.bs-fieldWide{grid-template-columns:minmax(0,1fr);padding-top:4px}
|
|
412
447
|
.bs-fieldWide>.bs-fieldLabel{padding:0}
|
|
413
|
-
.bs-fieldGrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:
|
|
414
|
-
.bs-fieldGrid .bs-field{
|
|
415
|
-
.bs-fieldGrid .bs-fieldLabel{padding:0
|
|
416
|
-
.bs-
|
|
417
|
-
.bs-
|
|
418
|
-
.bs-
|
|
419
|
-
.bs-input,.bs-select,.bs-textarea{appearance:none;width:100%;min-width:0;height:32px;padding:0 10px;border:1px solid var(--cfg-line-strong);border-radius:8px;background:var(--cfg-raised);color:var(--cfg-ink);font:inherit;font-size:13px;line-height:20px;transition:border-color 140ms ease,box-shadow 140ms ease,background-color 140ms ease}
|
|
420
|
-
.bs-textarea{height:auto;min-height:88px;max-height:220px;padding:8px 10px;resize:vertical}
|
|
421
|
-
.bs-input:hover:not(:disabled),.bs-select:hover:not(:disabled),.bs-textarea:hover:not(:disabled){border-color:var(--cfg-muted)}
|
|
422
|
-
.bs-input:focus-visible,.bs-select:focus-visible,.bs-textarea:focus-visible{outline:none;border-color:var(--cfg-accent);box-shadow:0 0 0 2px var(--cfg-accent-soft)}
|
|
423
|
-
.bs-root [aria-invalid=true]{border-color:var(--cfg-danger)}
|
|
448
|
+
.bs-fieldGrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:2px 20px;align-items:start;min-width:0}
|
|
449
|
+
.bs-fieldGrid .bs-field{grid-template-columns:minmax(0,1fr);gap:4px;padding:2px 0}
|
|
450
|
+
.bs-fieldGrid .bs-fieldLabel{padding:0}
|
|
451
|
+
.bs-input,.bs-select,.bs-textarea{appearance:none;width:100%;min-width:0;height:32px;padding:5px 10px;border:1px solid var(--cfg-line);border-radius:6px;background:var(--cfg-bg);color:var(--cfg-ink);font:inherit;line-height:20px}
|
|
452
|
+
.bs-textarea{height:auto;min-height:72px;max-height:240px;padding:8px 10px;resize:vertical}
|
|
453
|
+
.bs-input:hover:not(:disabled),.bs-select:hover:not(:disabled),.bs-textarea:hover:not(:disabled){border-color:var(--cfg-line-strong)}
|
|
424
454
|
.bs-input::placeholder,.bs-textarea::placeholder{color:var(--cfg-dim)}
|
|
425
|
-
.bs-
|
|
426
|
-
.bs-
|
|
455
|
+
.bs-root [aria-invalid=true]{border-color:var(--cfg-danger)}
|
|
456
|
+
.bs-root :is(input,textarea,button,summary,a,[role=combobox]):focus-visible{outline:2px solid var(--cfg-accent);outline-offset:1px}
|
|
457
|
+
.bs-root :is(input,textarea,button):disabled{opacity:.4;cursor:not-allowed}
|
|
458
|
+
.bs-mono,.bs-model .bs-input,.bs-textarea{font-family:var(--cfg-mono);font-variant-numeric:tabular-nums}
|
|
427
459
|
.bs-mono{overflow-wrap:anywhere}
|
|
428
460
|
.bs-selectWrap{position:relative;min-width:0}
|
|
429
461
|
.bs-select{display:flex;align-items:center;justify-content:space-between;gap:8px;text-align:left;cursor:pointer}
|
|
430
462
|
.bs-selectValue{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
431
463
|
.bs-select svg{flex:none;color:var(--cfg-dim)}
|
|
432
|
-
.bs-selectMenu{position:absolute;inset-inline:0;top:calc(100% + 4px);z-index:
|
|
464
|
+
.bs-selectMenu{position:absolute;inset-inline:0;top:calc(100% + 4px);z-index:20;min-width:0;max-height:240px;overflow:auto;padding:4px;border:1px solid var(--cfg-line-strong);border-radius:10px;background:var(--cfg-overlay)}
|
|
433
465
|
.bs-selectMenu[data-side=top]{top:auto;bottom:calc(100% + 4px)}
|
|
434
|
-
.bs-option{display:flex;align-items:center;gap:8px;min-height:30px;padding:
|
|
466
|
+
.bs-option{display:flex;align-items:center;gap:8px;min-height:30px;padding:4px 8px;border-radius:6px;color:var(--cfg-ink);cursor:pointer;overflow-wrap:anywhere}
|
|
435
467
|
.bs-option[data-active=true]{background:var(--cfg-hover)}
|
|
436
|
-
.bs-option[aria-selected=true]{
|
|
437
|
-
.bs-optionCheck{width:12px;flex:none
|
|
468
|
+
.bs-option[aria-selected=true]{color:var(--cfg-accent-text);background:var(--cfg-accent-soft)}
|
|
469
|
+
.bs-optionCheck{width:12px;flex:none}
|
|
438
470
|
.bs-optionLabel{min-width:0}
|
|
439
|
-
.bs-switchRow{position:relative;display:flex;align-items:center;justify-content:space-between;gap:16px;
|
|
440
|
-
.bs-switchRow:last-child{border-bottom:0}
|
|
471
|
+
.bs-switchRow{position:relative;display:flex;align-items:center;justify-content:space-between;gap:16px;padding:4px 0}
|
|
441
472
|
.bs-switchMain{flex:1;min-width:0}
|
|
442
|
-
.bs-switchLabel{font-
|
|
443
|
-
.bs-
|
|
444
|
-
.bs-
|
|
445
|
-
.bs-switch{appearance:none;position:relative;display:inline-flex;align-items:center;justify-content:center;flex:none;width:34px;height:20px;padding:0;border:0;border-radius:999px;background:transparent;cursor:pointer}
|
|
446
|
-
.bs-switchTrack{display:block;width:34px;height:20px;padding:2px;border:1px solid var(--cfg-line-strong);border-radius:999px;background:var(--cfg-sunken);transition:background-color 140ms ease,border-color 140ms ease}
|
|
473
|
+
.bs-switchLabel{font-weight:500}
|
|
474
|
+
.bs-switch{appearance:none;display:flex;align-items:center;justify-content:center;flex:none;width:32px;height:32px;padding:0;border:0;border-radius:6px;background:transparent;cursor:pointer}
|
|
475
|
+
.bs-switchTrack{display:block;width:32px;height:18px;padding:2px;border:1px solid var(--cfg-line-strong);border-radius:9px;background:var(--cfg-sunken)}
|
|
447
476
|
.bs-switch:hover:not(:disabled) .bs-switchTrack{border-color:var(--cfg-muted)}
|
|
448
477
|
.bs-switch[aria-checked=true] .bs-switchTrack{background:var(--cfg-accent-solid);border-color:var(--cfg-accent-solid)}
|
|
449
|
-
.bs-switchThumb{display:block;width:
|
|
478
|
+
.bs-switchThumb{display:block;width:12px;height:12px;border-radius:50%;background:var(--cfg-muted);transition:transform 150ms ease}
|
|
450
479
|
.bs-switch[aria-checked=true] .bs-switchThumb{transform:translateX(14px);background:var(--cfg-accent-fg)}
|
|
451
|
-
.bs-
|
|
452
|
-
.bs-
|
|
453
|
-
.bs-
|
|
454
|
-
.bs-
|
|
480
|
+
.bs-srOnly{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
|
|
481
|
+
.bs-advanced{display:flex;flex-direction:column;min-width:0}
|
|
482
|
+
.bs-advanced>summary{appearance:none;display:flex;align-items:center;gap:8px;min-height:32px;padding:4px 6px;margin-inline:-6px;list-style:none;border-radius:6px;cursor:pointer;font-weight:500;color:var(--cfg-muted)}
|
|
483
|
+
.bs-advanced>summary:hover{background:var(--cfg-hover);color:var(--cfg-ink)}
|
|
484
|
+
.bs-advanced>summary::-webkit-details-marker{display:none}
|
|
485
|
+
.bs-advanced>summary::before{content:"";flex:none;width:6px;height:6px;border-right:1px solid currentColor;border-bottom:1px solid currentColor;transform:rotate(-45deg);margin:0 3px}
|
|
486
|
+
.bs-advanced[open]>summary::before{transform:rotate(45deg)}
|
|
487
|
+
.bs-advanced[open]>summary{margin-bottom:4px}
|
|
488
|
+
.bs-advancedSummary{margin-inline-start:auto;color:var(--cfg-dim);font-weight:400;font-size:.92em;overflow-wrap:anywhere}
|
|
489
|
+
.bs-profileChoices{display:flex;gap:4px;flex-wrap:wrap}
|
|
490
|
+
.bs-actions{display:flex;flex-wrap:wrap;align-items:center;gap:6px}
|
|
491
|
+
.bs-button,.bs-iconButton{appearance:none;display:inline-flex;align-items:center;justify-content:center;gap:6px;height:32px;padding:5px 12px;border:1px solid transparent;border-radius:6px;font:inherit;line-height:20px;font-weight:500;color:var(--cfg-ink);background:transparent;cursor:pointer}
|
|
492
|
+
.bs-button[data-variant=outline]{border-color:var(--cfg-line-strong)}
|
|
455
493
|
.bs-button:hover:not(:disabled),.bs-iconButton:hover:not(:disabled){background:var(--cfg-hover)}
|
|
456
|
-
.bs-button
|
|
494
|
+
.bs-button:active:not(:disabled){background:var(--cfg-overlay)}
|
|
495
|
+
.bs-button[data-variant=primary]{height:32px;min-width:80px;background:var(--cfg-accent-solid);color:var(--cfg-accent-fg)}
|
|
457
496
|
.bs-button[data-variant=primary]:hover:not(:disabled){background:var(--cfg-accent-hover)}
|
|
458
|
-
.bs-iconButton{width:
|
|
497
|
+
.bs-iconButton{width:32px;flex:none;padding:5px;color:var(--cfg-muted)}
|
|
459
498
|
.bs-iconButton[data-danger]:hover:not(:disabled){color:var(--cfg-danger)}
|
|
460
|
-
.bs-
|
|
461
|
-
.bs-
|
|
462
|
-
.bs-
|
|
463
|
-
.bs-model
|
|
464
|
-
.bs-
|
|
465
|
-
.bs-
|
|
466
|
-
.bs-
|
|
467
|
-
.bs-
|
|
468
|
-
.bs-
|
|
469
|
-
.bs-
|
|
470
|
-
.bs-tierInherit{grid-template-columns:minmax(0,1fr)}
|
|
471
|
-
.bs-tierPurpose{grid-column:1/-1;color:var(--cfg-muted);font-size:12px;line-height:18px}
|
|
472
|
-
.bs-controlLabel{font-size:12px;line-height:18px;color:var(--cfg-muted)}
|
|
473
|
-
.bs-badge{display:inline-flex;align-items:center;gap:6px;height:20px;padding:0 8px;border:1px solid var(--cfg-line);border-radius:999px;background:var(--cfg-raised);color:var(--cfg-muted);font-size:11px;line-height:18px;font-weight:400;white-space:nowrap}
|
|
499
|
+
.bs-modelsBlock{display:flex;flex-direction:column;gap:6px;min-width:0}
|
|
500
|
+
.bs-models{display:flex;flex-direction:column;gap:2px;min-width:0}
|
|
501
|
+
.bs-model,.bs-modelHead{display:grid;grid-template-columns:minmax(100px,1.2fr) minmax(100px,1.2fr) minmax(100px,.8fr) var(--bs-action-size);gap:8px;align-items:start}
|
|
502
|
+
.bs-model{padding:4px 6px;margin-inline:-6px;border-radius:6px}
|
|
503
|
+
.bs-model:hover{background:var(--cfg-hover)}
|
|
504
|
+
.bs-modelHead{padding:0 6px 2px;color:var(--cfg-dim);font-size:.92em}
|
|
505
|
+
.bs-modelCell{display:flex;flex-direction:column;gap:4px;min-width:0}
|
|
506
|
+
.bs-cellLabel{display:none;color:var(--cfg-muted)}
|
|
507
|
+
.bs-badge{display:inline-flex;align-items:center;gap:6px;padding:1px 6px;border:1px solid var(--cfg-line);border-radius:6px;line-height:18px;font-weight:400;color:var(--cfg-muted);white-space:nowrap;font-size:.92em}
|
|
508
|
+
.bs-badge[data-active=true]{border-color:var(--cfg-accent);color:var(--cfg-accent-text)}
|
|
474
509
|
.bs-dot{width:6px;height:6px;flex:none;border-radius:50%;background:var(--cfg-dim)}
|
|
475
510
|
.bs-dot[data-active=true]{background:var(--cfg-accent)}
|
|
476
|
-
.bs-overview{display:flex;flex-direction:column;
|
|
477
|
-
.bs-
|
|
478
|
-
.bs-
|
|
479
|
-
.bs-overviewRow:
|
|
480
|
-
.bs-overviewRow:
|
|
481
|
-
.bs-overviewGlyph{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;flex:none;border:1px solid var(--cfg-line);border-radius:6px;background:var(--cfg-sunken);color:var(--cfg-muted)}
|
|
511
|
+
.bs-overview{display:flex;flex-direction:column;gap:2px}
|
|
512
|
+
.bs-overviewGlyph{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;flex:none;border:1px solid var(--cfg-line);border-radius:6px;background:var(--cfg-raised);color:var(--cfg-muted)}
|
|
513
|
+
.bs-overviewMeta{font-size:12px;line-height:18px;color:var(--cfg-dim);overflow-wrap:anywhere}
|
|
514
|
+
.bs-overviewRow{appearance:none;display:flex;align-items:center;gap:12px;width:100%;padding:8px 6px;margin-inline:-6px;border:0;border-radius:6px;background:transparent;color:inherit;font:inherit;cursor:pointer;text-align:left}
|
|
515
|
+
.bs-overviewRow:hover,.bs-overviewRow:active{background:var(--cfg-hover)}
|
|
482
516
|
.bs-overviewName{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}
|
|
483
517
|
.bs-overviewName>span:first-child{font-weight:500}
|
|
484
|
-
.bs-overviewMeta{display:inline-flex;align-items:center;gap:6px;min-width:0;color:var(--cfg-muted);font-size:12px;line-height:18px;overflow-wrap:anywhere}
|
|
485
518
|
.bs-overviewRow>svg{color:var(--cfg-dim);flex:none}
|
|
486
|
-
.bs-
|
|
487
|
-
.bs-
|
|
488
|
-
.bs-
|
|
489
|
-
.bs-
|
|
490
|
-
.bs-
|
|
491
|
-
.bs-
|
|
492
|
-
.bs-
|
|
493
|
-
.bs-
|
|
494
|
-
.bs-
|
|
495
|
-
.bs-
|
|
496
|
-
.bs-
|
|
497
|
-
.bs-
|
|
498
|
-
.bs-
|
|
499
|
-
.bs-
|
|
500
|
-
.bs-
|
|
501
|
-
.bs-
|
|
502
|
-
.bs-
|
|
503
|
-
.bs-
|
|
504
|
-
.bs-
|
|
505
|
-
.bs-
|
|
506
|
-
.bs-
|
|
507
|
-
.bs-
|
|
508
|
-
.bs-
|
|
509
|
-
.bs-
|
|
510
|
-
.bs-
|
|
511
|
-
.bs-status{flex:1;min-width:140px}
|
|
512
|
-
.bs-feedback{display:flex;align-items:center;gap:8px;min-width:0;padding:8px 0 0;border-top:1px solid var(--cfg-line);font-size:12px}
|
|
513
|
-
.bs-errorLink{height:auto;min-height:28px;padding:0;border:0;color:var(--cfg-danger);font-size:12px;font-weight:400;text-align:left;white-space:normal}
|
|
514
|
-
.bs-errorLink:hover:not(:disabled){background:transparent;color:var(--cfg-danger)}
|
|
515
|
-
.bs-srOnly{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
|
|
516
|
-
.bs-spinner{width:12px;height:12px;flex:none;border:1px solid currentColor;border-right-color:transparent;border-radius:50%;animation:bs-spin .7s linear infinite}
|
|
519
|
+
.bs-routingDiagram{display:flex;flex-direction:column;gap:2px;padding:2px 0 0;min-width:0}
|
|
520
|
+
.bs-routingSource{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:6px 8px;border:1px solid var(--cfg-line);border-radius:8px;background:var(--cfg-sunken);min-width:0}
|
|
521
|
+
.bs-routingSourceLabel{display:inline-flex;align-items:center;gap:6px;font-weight:500}
|
|
522
|
+
.bs-routingSourceLabel::before{content:"";width:6px;height:6px;flex:none;border-radius:50%;background:var(--cfg-accent)}
|
|
523
|
+
.bs-routing{display:grid;grid-template-columns:auto minmax(0,1fr) minmax(0,1.1fr) auto;gap:8px 12px;align-items:center;padding:8px 8px 8px 12px;border:0;border-radius:8px;min-width:0}
|
|
524
|
+
.bs-routing:hover{background:var(--cfg-hover)}
|
|
525
|
+
.bs-routingBranchGlyph{color:var(--cfg-dim);font-family:var(--cfg-mono)}
|
|
526
|
+
.bs-routingLabel{font-weight:500}
|
|
527
|
+
.bs-routingModel{font-size:12px;line-height:18px;color:var(--cfg-muted);overflow-wrap:anywhere}
|
|
528
|
+
.bs-routingNote{margin:2px 0 0}
|
|
529
|
+
.bs-tierGrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;align-items:start;min-width:0}
|
|
530
|
+
.bs-tierCard{min-width:0}
|
|
531
|
+
.bs-tierHead{display:flex;flex-direction:column;gap:2px;min-width:0}
|
|
532
|
+
.bs-empty{display:flex;flex-direction:column;gap:4px;padding:8px 10px;border:1px solid var(--cfg-line);border-radius:6px;background:var(--cfg-sunken)}
|
|
533
|
+
.bs-connectionRow{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:32px;padding:2px 0}
|
|
534
|
+
.bs-connectionRow .bs-hint{text-align:end}
|
|
535
|
+
.bs-metricGrid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
|
|
536
|
+
.bs-metric{display:flex;flex-direction:column;gap:2px;min-width:0;padding:8px 10px;border:1px solid var(--cfg-line);border-radius:6px;background:var(--cfg-sunken)}
|
|
537
|
+
.bs-metricLabel{font-size:12px;line-height:18px;color:var(--cfg-dim)}
|
|
538
|
+
.bs-metricValue{font-size:13px;line-height:20px;font-weight:500;overflow-wrap:anywhere}
|
|
539
|
+
.bs-footer{position:sticky;bottom:0;z-index:10;display:flex;align-items:center;flex-wrap:wrap;gap:8px;padding:10px 0;border-top:1px solid var(--cfg-line);background:var(--cfg-bg)}
|
|
540
|
+
.bs-footer .bs-status{flex:1;min-width:140px;font-size:12px;line-height:18px;color:var(--cfg-dim)}
|
|
541
|
+
.bs-errorLink{color:var(--cfg-danger);text-align:left;white-space:normal;height:auto;min-height:28px}
|
|
542
|
+
.bs-feedback{min-height:20px}
|
|
543
|
+
.bs-spinner{width:12px;height:12px;flex:none;border:1.5px solid currentColor;border-right-color:transparent;border-radius:50%;animation:bs-spin .7s linear infinite}
|
|
517
544
|
@keyframes bs-spin{to{transform:rotate(360deg)}}
|
|
518
545
|
.bs-pulse{animation:bs-pulse 2s ease infinite}
|
|
519
546
|
@keyframes bs-pulse{50%{opacity:.55}}
|
|
520
|
-
@
|
|
521
|
-
@
|
|
547
|
+
@container bs-settings (max-width:760px){.bs-fieldGrid,.bs-tierGrid{grid-template-columns:minmax(0,1fr)}.bs-metricGrid{grid-template-columns:repeat(2,minmax(0,1fr))}}
|
|
548
|
+
@container bs-settings (max-width:640px){.bs-header .bs-title{font-size:18px}.bs-sectionHead,.bs-cardHead,.bs-toolbar{flex-wrap:wrap}.bs-field{grid-template-columns:minmax(0,1fr);gap:4px}.bs-fieldLabel{padding:0}.bs-modelHead{display:none}.bs-model{grid-template-columns:minmax(0,1fr) var(--bs-action-size);gap:8px}.bs-modelCell{grid-column:1}.bs-cellLabel{display:block;font-size:12px;line-height:18px}.bs-model .bs-iconButton{grid-column:2;grid-row:1}.bs-footer .bs-status{flex-basis:100%}.bs-connectionRow{align-items:flex-start;flex-direction:column;gap:4px;padding:6px 0}.bs-connectionRow .bs-hint{text-align:start}.bs-routing{grid-template-columns:minmax(0,1fr);gap:4px;padding:8px}.bs-routingBranchGlyph{display:none}.bs-overviewRow{flex-wrap:wrap}.bs-overviewRow>.bs-badge{white-space:normal}.bs-advancedSummary{white-space:normal}}
|
|
549
|
+
@media(pointer:coarse),(max-width:640px){.bs-root{--bs-action-size:44px}.bs-input,.bs-select,.bs-button,.bs-iconButton,.bs-switch,.bs-tab,.bs-subtabs .bs-tab{height:44px;min-height:44px}.bs-textarea{min-height:88px}.bs-switch,.bs-iconButton{width:44px}.bs-option,.bs-advanced>summary{min-height:44px}}
|
|
522
550
|
@media(prefers-reduced-motion:reduce){.bs-root *{animation:none!important;transition:none!important}}`;
|
|
523
551
|
|
|
524
552
|
|
|
@@ -579,6 +607,7 @@ window.__ModuleLoader__.load({
|
|
|
579
607
|
const tiers = isRecord(source.tiers) ? source.tiers : {};
|
|
580
608
|
const result = {
|
|
581
609
|
childExitGuard: source.childExitGuard === true,
|
|
610
|
+
delegationPrompt: !isRecord(source.delegation) || source.delegation.prompt !== false,
|
|
582
611
|
trustedHosts: Array.isArray(source.trustedHosts) ? [...new Set(source.trustedHosts.filter((item) => typeof item === 'string').map((item) => item.trim()).filter(Boolean))] : [],
|
|
583
612
|
tiers: {},
|
|
584
613
|
subagents: {
|
|
@@ -611,6 +640,9 @@ window.__ModuleLoader__.load({
|
|
|
611
640
|
if (host.childExitGuard !== current.childExitGuard) {
|
|
612
641
|
ops.push({ op: 'set', path: ['childExitGuard'], value: current.childExitGuard });
|
|
613
642
|
}
|
|
643
|
+
if (host.delegationPrompt !== current.delegationPrompt) {
|
|
644
|
+
ops.push({ op: 'set', path: ['delegation', 'prompt'], value: current.delegationPrompt });
|
|
645
|
+
}
|
|
614
646
|
for (const tier of TIERS) {
|
|
615
647
|
if (JSON.stringify(host.tiers[tier]) === JSON.stringify(current.tiers[tier])) continue;
|
|
616
648
|
ops.push({ op: 'set', path: ['tiers', tier], value: tierShape(current.tiers[tier]) });
|
|
@@ -880,7 +912,7 @@ window.__ModuleLoader__.load({
|
|
|
880
912
|
}, item.active === undefined ? null : h('span', { className: 'bs-dot', 'data-active': item.active, 'aria-hidden': true }), item.label)));
|
|
881
913
|
}
|
|
882
914
|
|
|
883
|
-
function Field({ id, label, hint, showHint, wide, children }) {
|
|
915
|
+
function Field({ id, label, hint, showHint = true, wide, children }) {
|
|
884
916
|
const hintId = 'bs-hint-' + useId().replace(/[^a-zA-Z0-9_-]/g, '');
|
|
885
917
|
const control = hint === undefined || children === null || typeof children !== 'object'
|
|
886
918
|
? children
|
|
@@ -900,7 +932,7 @@ window.__ModuleLoader__.load({
|
|
|
900
932
|
return h('div', { className: 'bs-switchRow' },
|
|
901
933
|
h('div', { className: 'bs-switchMain' },
|
|
902
934
|
h('label', { className: 'bs-switchLabel', id: labelId, htmlFor: id }, label),
|
|
903
|
-
hint === undefined ? null : h('p', { className: 'bs-
|
|
935
|
+
hint === undefined ? null : h('p', { className: 'bs-hint', id: hintId }, hint)),
|
|
904
936
|
h('button', {
|
|
905
937
|
type: 'button', id, role: 'switch', className: 'bs-switch',
|
|
906
938
|
'aria-checked': checked === true, 'aria-labelledby': labelId, 'aria-describedby': hintId,
|
|
@@ -998,7 +1030,7 @@ window.__ModuleLoader__.load({
|
|
|
998
1030
|
}
|
|
999
1031
|
|
|
1000
1032
|
/**
|
|
1001
|
-
*
|
|
1033
|
+
* 一个分档:一张可见的模型卡(用途 + 模型下拉 + 思考强度),主选项不藏进折叠区。
|
|
1002
1034
|
* 已保存但不在白名单里的路由仍作为选项保留(白名单读到时标注出来),不被静默改掉。
|
|
1003
1035
|
*/
|
|
1004
1036
|
function TierRow({ tier, value, allowed, disabled, t: translate, onPatch }) {
|
|
@@ -1025,24 +1057,27 @@ window.__ModuleLoader__.load({
|
|
|
1025
1057
|
disabled: disabled || current === '',
|
|
1026
1058
|
onChange: (event) => onPatch({ reasoningEffort: event.target.value }),
|
|
1027
1059
|
}, optionNodes(selected.efforts, value.reasoningEffort, translate('tierEffortDefault')))
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
return h(
|
|
1041
|
-
h('div', { className:
|
|
1042
|
-
h('
|
|
1043
|
-
|
|
1044
|
-
h('
|
|
1045
|
-
|
|
1060
|
+
: h('input', {
|
|
1061
|
+
className: 'bs-input',
|
|
1062
|
+
type: 'text',
|
|
1063
|
+
id: 'bs-tier-' + tier + '-effort',
|
|
1064
|
+
'aria-label': effortLabel,
|
|
1065
|
+
value: value.reasoningEffort,
|
|
1066
|
+
placeholder: translate('tierEffortDefault'),
|
|
1067
|
+
spellCheck: false,
|
|
1068
|
+
autoComplete: 'off',
|
|
1069
|
+
disabled: disabled || current === '',
|
|
1070
|
+
onChange: (event) => onPatch({ reasoningEffort: event.target.value.trim() }),
|
|
1071
|
+
});
|
|
1072
|
+
return h('section', { className: 'bs-card bs-tierCard', 'aria-label': title },
|
|
1073
|
+
h('div', { className: 'bs-cardHead' },
|
|
1074
|
+
h('div', { className: 'bs-tierHead' },
|
|
1075
|
+
h('h3', { className: 'bs-cardTitle' }, title),
|
|
1076
|
+
h('p', { className: 'bs-hint' }, translate(TIER_HINT_KEYS[tier]))),
|
|
1077
|
+
h('span', { className: 'bs-badge', 'data-active': current !== '' },
|
|
1078
|
+
current === '' ? translate('tierInherit') : (selected?.model ?? value.model))),
|
|
1079
|
+
h(Field, { id: 'bs-tier-' + tier + '-route', label: translate('route') },
|
|
1080
|
+
h(Select, {
|
|
1046
1081
|
className: 'bs-select',
|
|
1047
1082
|
id: 'bs-tier-' + tier + '-route',
|
|
1048
1083
|
'aria-label': translate('tierRouteLabel', { tier: title }),
|
|
@@ -1051,10 +1086,13 @@ window.__ModuleLoader__.load({
|
|
|
1051
1086
|
// 换路由即清空 effort(旧值未必属于新模型)。
|
|
1052
1087
|
onChange: (event) => onPatch({ ...parseRouteKey(event.target.value), reasoningEffort: '' }),
|
|
1053
1088
|
}, routeOptions)),
|
|
1054
|
-
|
|
1089
|
+
current === '' ? null : h(Field, { id: 'bs-tier-' + tier + '-effort', label: translate('effort'), hint: translate('effortHint') }, effort));
|
|
1055
1090
|
}
|
|
1056
1091
|
|
|
1057
|
-
/**
|
|
1092
|
+
/**
|
|
1093
|
+
* 本机代理卡:启用、默认模型、权限后果与模型列表都在明面;
|
|
1094
|
+
* 折叠区只放真正需要专家的启动命令与 Codex 配置。
|
|
1095
|
+
*/
|
|
1058
1096
|
function BackendCard({ spec, backend, disabled, capabilities, discovery, discoveryMatches, scopeActive, t: translate, onPatch, onModelPatch, onModelAdd, onModelRemove, onDiscover, onDiagnostics, generation }) {
|
|
1059
1097
|
const title = spec.cli === 'codex' ? 'Codex' : 'Claude';
|
|
1060
1098
|
const status = discovery[spec.cli];
|
|
@@ -1065,21 +1103,23 @@ window.__ModuleLoader__.load({
|
|
|
1065
1103
|
plan: 'permissionPlan', manual: 'permissionManual', dontAsk: 'permissionDontAsk', acceptEdits: 'permissionAcceptEdits', auto: 'permissionAuto', bypassPermissions: 'permissionBypass' };
|
|
1066
1104
|
const elevated = ['danger-full-access', 'bypassPermissions'].includes(backend.permissionMode);
|
|
1067
1105
|
const modelListRef = useRef(null);
|
|
1068
|
-
const advancedRef = useRef(null);
|
|
1069
1106
|
const focusNewModel = useRef(false);
|
|
1070
1107
|
useEffect(() => {
|
|
1071
1108
|
if (!focusNewModel.current) return;
|
|
1072
1109
|
focusNewModel.current = false;
|
|
1073
1110
|
const inputs = modelListRef.current?.querySelectorAll('input[data-model-id]');
|
|
1074
|
-
inputs?.[inputs.length - 1]?.focus();
|
|
1111
|
+
inputs?.[inputs.length - 1]?.focus?.();
|
|
1075
1112
|
}, [backend.models.length]);
|
|
1076
|
-
const
|
|
1113
|
+
const expertSummary = backend.profile
|
|
1114
|
+
? translate('expertCurrent', { executable: backend.executable, profile: backend.profile })
|
|
1115
|
+
: translate('expertDefault');
|
|
1077
1116
|
return h('section', { className: 'bs-card', 'aria-label': title },
|
|
1078
1117
|
h('div', { className: 'bs-cardHead' },
|
|
1079
1118
|
h('h3', { className: 'bs-cardTitle' }, title),
|
|
1080
1119
|
h(SwitchRow, { id: 'bs-' + spec.cli + '-enabled', label: translate('backendEnable'),
|
|
1081
1120
|
checked: backend.enabled, disabled, onChange: (enabled) => onPatch({ enabled }) })),
|
|
1082
|
-
!backend.enabled ? h('p', { className: 'bs-
|
|
1121
|
+
!backend.enabled ? h('p', { className: 'bs-hint' }, translate('backendOff')) : h('div', { className: 'bs-cardBody' },
|
|
1122
|
+
!scopeActive ? h('p', { className: 'bs-note', 'data-tone': 'warn' }, translate('scopeNone')) : null,
|
|
1083
1123
|
h('div', { className: 'bs-fieldGrid' },
|
|
1084
1124
|
h(Field, { id: 'bs-' + spec.cli + '-default-model', label: translate('defaultModelLabel') },
|
|
1085
1125
|
h(Select, { className: 'bs-select', id: 'bs-' + spec.cli + '-default-model', value: backend.defaultModel,
|
|
@@ -1089,20 +1129,29 @@ window.__ModuleLoader__.load({
|
|
|
1089
1129
|
h(Select, { className: 'bs-select', id: 'bs-' + spec.cli + '-permission', value: backend.permissionMode, disabled,
|
|
1090
1130
|
onChange: (event) => onPatch({ permissionMode: event.target.value }) }, optionNodes(spec.permissions, backend.permissionMode)),
|
|
1091
1131
|
h('p', { className: elevated ? 'bs-hint bs-hintWarn' : 'bs-hint' }, translate(permissionKeys[backend.permissionMode])))),
|
|
1092
|
-
|
|
1093
|
-
h('
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1132
|
+
h('div', { className: 'bs-modelsBlock' },
|
|
1133
|
+
h('div', { className: 'bs-cardHead' },
|
|
1134
|
+
h('h4', { className: 'bs-cardTitle' }, translate('modelsLabel')),
|
|
1135
|
+
h('div', { className: 'bs-actions' },
|
|
1136
|
+
h('button', { type: 'button', id: 'bs-' + spec.cli + '-discover', className: 'bs-button', 'data-variant': 'outline',
|
|
1137
|
+
disabled: disabled || !discoveryMatches || status?.status === 'loading', 'aria-busy': status?.status === 'loading', onClick: onDiscover },
|
|
1138
|
+
status?.status === 'loading' ? h('span', { className: 'bs-spinner', 'aria-hidden': true }) : null,
|
|
1139
|
+
status?.status === 'loading' ? translate('discovering') : translate('discover')),
|
|
1140
|
+
h('button', { type: 'button', id: 'bs-' + spec.cli + '-add-model', className: 'bs-button', 'data-variant': 'outline', disabled,
|
|
1141
|
+
onClick: () => { focusNewModel.current = true; onModelAdd(); } },
|
|
1142
|
+
h('svg', { width: 14, height: 14, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', 'aria-hidden': true }, h('path', { d: 'M12 5v14M5 12h14' })), translate('modelAdd')),
|
|
1143
|
+
h('button', { type: 'button', className: 'bs-button', onClick: onDiagnostics }, translate('diagnosticsLink')))),
|
|
1144
|
+
h('p', { className: 'bs-hint' }, translate('modelsHint') + ' ' + translate('discoverHint')),
|
|
1145
|
+
!discoveryMatches ? h('p', { className: 'bs-hint' }, translate('saveBeforeDiscover')) : null,
|
|
1146
|
+
status?.text ? h('p', { className: 'bs-hint', role: status.status === 'error' ? 'alert' : 'status', 'data-tone': status.status === 'error' ? 'error' : 'ok' }, status.text) : null,
|
|
1147
|
+
backend.models.length === 0
|
|
1148
|
+
? h('div', { className: 'bs-empty', id: 'bs-' + spec.cli + '-models-empty' }, h('p', { className: 'bs-hint' }, translate('modelsEmpty')))
|
|
1149
|
+
: h('div', { className: 'bs-models', id: 'bs-' + spec.cli + '-models', ref: modelListRef },
|
|
1150
|
+
h('div', { className: 'bs-modelHead', 'aria-hidden': true }, h('span', null, translate('modelIdPlaceholder')), h('span', null, translate('effort')), h('span', null, translate('modelDefaultEffort')), h('span')),
|
|
1151
|
+
backend.models.map((model, index) => h(ModelRow, { key: generation + ':' + index, model, index, disabled,
|
|
1152
|
+
requiredDefault: model.id.trim() === backend.defaultModel.trim(), t: translate,
|
|
1153
|
+
onPatch: (patch) => onModelPatch(index, patch), onRemove: () => onModelRemove(index) })))),
|
|
1154
|
+
h(Advanced, { label: translate('expertSettings'), summary: expertSummary },
|
|
1106
1155
|
h(Field, { id: 'bs-' + spec.cli + '-executable', label: translate('executableLabel'), hint: translate('executableHint') },
|
|
1107
1156
|
h('input', { className: 'bs-input bs-mono', type: 'text', id: 'bs-' + spec.cli + '-executable',
|
|
1108
1157
|
value: backend.executable, placeholder: spec.executable, spellCheck: false, autoComplete: 'off', disabled,
|
|
@@ -1113,16 +1162,9 @@ window.__ModuleLoader__.load({
|
|
|
1113
1162
|
h('div', { className: 'bs-profileChoices', id: 'bs-' + spec.cli + '-profiles' }, profileNames.map((profile) => h('button', {
|
|
1114
1163
|
key: profile, type: 'button', className: 'bs-button bs-mono', disabled, 'aria-label': translate('profileChoose', { profile }),
|
|
1115
1164
|
'aria-pressed': backend.profile === profile, onClick: () => onPatch({ profile }),
|
|
1116
|
-
}, profile)))) : null
|
|
1117
|
-
h(Field, { wide: true, label: translate('modelsLabel'), hint: translate('modelsHint') + ' ' + translate('discoverHint') },
|
|
1118
|
-
backend.models.length === 0 ? null : h('div', { className: 'bs-models', ref: modelListRef },
|
|
1119
|
-
h('div', { className: 'bs-modelHead', 'aria-hidden': true }, h('span', null, translate('modelIdPlaceholder')), h('span', null, translate('effort')), h('span', null, translate('modelDefaultEffort')), h('span')),
|
|
1120
|
-
backend.models.map((model, index) => h(ModelRow, { key: generation + ':' + index, model, index, disabled,
|
|
1121
|
-
requiredDefault: model.id.trim() === backend.defaultModel.trim(), t: translate,
|
|
1122
|
-
onPatch: (patch) => onModelPatch(index, patch), onRemove: () => onModelRemove(index) })))))));
|
|
1165
|
+
}, profile)))) : null)));
|
|
1123
1166
|
}
|
|
1124
1167
|
|
|
1125
|
-
|
|
1126
1168
|
/** 行配置页面主体。 */
|
|
1127
1169
|
function BetterSubagentConfigPage({ form, t: translate }) {
|
|
1128
1170
|
const state = form?.state;
|
|
@@ -1161,7 +1203,8 @@ window.__ModuleLoader__.load({
|
|
|
1161
1203
|
// 官方页面在镜像读到该命名空间前不传 form:这是正常加载窗口,
|
|
1162
1204
|
// 长期停在这里才说明本部署缺少 settings/config-editor。
|
|
1163
1205
|
return h('div', { className: 'bs-cfg' },
|
|
1164
|
-
h('p', { className: 'bs-note bs-pulse', role: 'status'
|
|
1206
|
+
h('p', { className: 'bs-note bs-pulse', role: 'status' }, translate('waitingForm')),
|
|
1207
|
+
h('p', { className: 'bs-hint' }, translate('noFormHint')));
|
|
1165
1208
|
}
|
|
1166
1209
|
if (state.status === 'loading') {
|
|
1167
1210
|
return h('div', { className: 'bs-cfg' },
|
|
@@ -1350,47 +1393,53 @@ window.__ModuleLoader__.load({
|
|
|
1350
1393
|
const panelProps = (name) => ({ id: 'bs-settings-panel-' + name, className: 'bs-tabpanel', role: 'tabpanel',
|
|
1351
1394
|
'aria-labelledby': 'bs-settings-tab-' + name, tabIndex: 0, hidden: tab !== name });
|
|
1352
1395
|
return h('div', { className: 'bs-cfg', 'data-settings-dirty': dirty, 'data-settings-busy': busy },
|
|
1353
|
-
h('div', { className: 'bs-header' },
|
|
1354
|
-
|
|
1396
|
+
h('div', { className: 'bs-header' },
|
|
1397
|
+
h('div', { className: 'bs-headerMain' },
|
|
1398
|
+
h('h2', { className: 'bs-title' }, translate('title')),
|
|
1399
|
+
h('span', { className: 'bs-headerIntro' }, translate('intro'))),
|
|
1400
|
+
h('div', { className: 'bs-headerMeta' },
|
|
1401
|
+
dirty ? h('span', { className: 'bs-badge' }, translate('draftPreview')) : null,
|
|
1402
|
+
writable ? null : h('span', { className: 'bs-badge', role: 'status', title: translate('readonly') }, translate('readonlyShort')))),
|
|
1355
1403
|
h(Tabs, { id: 'bs-settings', label: translate('title'), value: tab, onChange: setTab, tabRefs: navigationTabs, items: [
|
|
1356
1404
|
{ id: 'general', label: translate('tabGeneral') }, { id: 'cli', label: translate('tabCli') },
|
|
1357
1405
|
{ id: 'tiers', label: translate('tabTiers') }, { id: 'connection', label: translate('tabConnection') }] }),
|
|
1358
1406
|
h('div', panelProps('general'),
|
|
1407
|
+
h('section', { className: 'bs-section', 'aria-label': translate('routingTitle') },
|
|
1408
|
+
h('div', { className: 'bs-sectionHead' }, h('h3', { className: 'bs-sectionTitle' }, translate('routingTitle'))),
|
|
1409
|
+
h('p', { className: 'bs-hint' }, translate('modelRecommendations')),
|
|
1410
|
+
h('div', { className: 'bs-routingDiagram', 'data-routing': 'main-agent' },
|
|
1411
|
+
h('div', { className: 'bs-routingSource', id: 'bs-routing-source' },
|
|
1412
|
+
h('span', { className: 'bs-routingSourceLabel' }, translate('mainAgent')),
|
|
1413
|
+
h('span', { className: 'bs-hint' }, translate('mainAgentNote'))),
|
|
1414
|
+
...TIERS.map((tier) => {
|
|
1415
|
+
const value = live.tiers[tier];
|
|
1416
|
+
const current = routeKey(value);
|
|
1417
|
+
const title = translate(TIER_TITLE_KEYS[tier]);
|
|
1418
|
+
return h('div', { key: tier, className: 'bs-routing' },
|
|
1419
|
+
h('span', { className: 'bs-routingBranchGlyph', 'aria-hidden': true }, '↳'),
|
|
1420
|
+
h('div', { className: 'bs-overviewName' },
|
|
1421
|
+
h('span', { className: 'bs-routingLabel' }, title),
|
|
1422
|
+
h('span', { className: 'bs-overviewMeta' }, translate(TIER_HINT_KEYS[tier]))),
|
|
1423
|
+
h('span', { className: 'bs-routingModel bs-mono' }, current === '' ? translate('tierInherit') : current),
|
|
1424
|
+
h('button', { type: 'button', id: 'bs-tier-' + tier + '-change', className: 'bs-button', 'data-variant': 'outline',
|
|
1425
|
+
'data-tier-change': tier, onClick: () => navigate('tiers') },
|
|
1426
|
+
translate(current === '' ? 'chooseModel' : 'changeModel')));
|
|
1427
|
+
})),
|
|
1428
|
+
h('p', { className: 'bs-hint bs-routingNote' }, translate('routingNote'))),
|
|
1359
1429
|
h('section', { className: 'bs-section' },
|
|
1360
|
-
h('div', { className: 'bs-sectionHead' }, h('h3', { className: 'bs-
|
|
1361
|
-
|
|
1362
|
-
h('span', { className: 'bs-routingLabel' }, translate(tier === 'fast' ? 'tierFastTask' : 'tierQualityTask')),
|
|
1363
|
-
h('span', { className: 'bs-routingArrow', 'aria-hidden': true }, '→'),
|
|
1364
|
-
h('button', { type: 'button', className: 'bs-routingTarget bs-mono', onClick: () => navigate('tiers') },
|
|
1365
|
-
routeKey(live.tiers[tier]) || translate('tierInherit'))))),
|
|
1366
|
-
h('section', { className: 'bs-section' },
|
|
1367
|
-
h('div', { className: 'bs-sectionHead' }, h('h3', { className: 'bs-title bs-sectionTitle' }, translate('backendsTitle'))),
|
|
1430
|
+
h('div', { className: 'bs-sectionHead' }, h('h3', { className: 'bs-sectionTitle' }, translate('backendsTitle'))),
|
|
1431
|
+
h('p', { className: 'bs-hint' }, translate('backendsIntro')),
|
|
1368
1432
|
h('div', { className: 'bs-overview' }, BACKENDS.map((spec) => {
|
|
1369
1433
|
const backend = live.subagents[spec.cli];
|
|
1370
1434
|
const title = spec.cli === 'codex' ? 'Codex' : 'Claude';
|
|
1371
1435
|
return h('button', { key: spec.cli, type: 'button', id: 'bs-open-' + spec.cli, className: 'bs-overviewRow',
|
|
1372
1436
|
'aria-label': translate('configureBackend', { backend: title }), onClick: () => navigate('cli', spec.cli) },
|
|
1373
1437
|
h('span', { className: 'bs-overviewGlyph', 'aria-hidden': true }, h('svg', { width: 16, height: 16, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 1.5, strokeLinecap: 'round', strokeLinejoin: 'round' }, h('path', { d: 'M4 5h16v14H4Zm4 5 2 2-2 2m5 0h3' }))),
|
|
1374
|
-
h('span', { className: 'bs-overviewName' },
|
|
1375
|
-
h('span',
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
backend.enabled && backend.defaultModel ? h('span', { className: 'bs-mono' }, ' · ' + backend.defaultModel) : null)),
|
|
1380
|
-
h(Chevron));
|
|
1381
|
-
}))),
|
|
1382
|
-
h('section', { className: 'bs-section' },
|
|
1383
|
-
h('div', { className: 'bs-sectionHead' }, h('h3', { className: 'bs-title bs-sectionTitle' }, translate('scopeTitle'))),
|
|
1384
|
-
h(SwitchRow, { id: 'bs-scope-eng', label: translate('scopeEng'), hint: translate('scopeEngHint'),
|
|
1385
|
-
checked: live.subagents.global ? true : live.subagents.eng, disabled: !writable || busy || live.subagents.global,
|
|
1386
|
-
onChange: (eng) => edit((current) => ({ ...current, subagents: { ...current.subagents, eng } })) }),
|
|
1387
|
-
h(SwitchRow, { id: 'bs-scope-global', label: translate('scopeGlobal'), hint: translate('scopeGlobalHint'), checked: live.subagents.global,
|
|
1388
|
-
disabled: !writable || busy, onChange: (global) => edit((current) => ({ ...current, subagents: { ...current.subagents, global } })) }),
|
|
1389
|
-
!scopeActive ? h('p', { className: 'bs-note', 'data-tone': 'warn' }, translate('scopeNone')) : null),
|
|
1390
|
-
h('section', { className: 'bs-section' },
|
|
1391
|
-
h('div', { className: 'bs-sectionHead' }, h('h3', { className: 'bs-title bs-sectionTitle' }, translate('behaviorTitle'))),
|
|
1392
|
-
h(SwitchRow, { id: 'bs-child-exit-guard', label: translate('childExitGuardLabel'), hint: translate('childExitGuardHint'),
|
|
1393
|
-
checked: live.childExitGuard, disabled: !writable || busy, onChange: (childExitGuard) => edit((current) => ({ ...current, childExitGuard })) }))),
|
|
1438
|
+
h('span', { className: 'bs-overviewName' }, h('span', null, title),
|
|
1439
|
+
h('span', { className: 'bs-overviewMeta bs-mono' }, backend.enabled ? (translate('modelCount', { count: backend.models.length }) + (backend.defaultModel ? ' · ' + backend.defaultModel : '')) : '')),
|
|
1440
|
+
h('span', { className: 'bs-badge', 'data-active': backend.enabled && scopeActive }, h('span', { className: 'bs-dot', 'data-active': backend.enabled && scopeActive, 'aria-hidden': true }),
|
|
1441
|
+
translate(!backend.enabled ? 'inactive' : !scopeActive ? 'scopeInactive' : 'configured')), h(Chevron));
|
|
1442
|
+
})))),
|
|
1394
1443
|
h('div', panelProps('cli'),
|
|
1395
1444
|
h(Tabs, { id: 'bs-backend', label: translate('tabCli'), compact: true, value: backendTab, onChange: setBackendTab,
|
|
1396
1445
|
items: BACKENDS.map((spec) => ({ id: spec.cli, label: spec.cli === 'codex' ? 'Codex' : 'Claude', active: live.subagents[spec.cli].enabled && scopeActive })) }),
|
|
@@ -1402,36 +1451,50 @@ window.__ModuleLoader__.load({
|
|
|
1402
1451
|
onModelAdd: () => addModel(spec), onModelRemove: (index) => removeModel(spec, index), onDiscover: () => discoverModels(spec), onDiagnostics: () => navigate('connection') })))),
|
|
1403
1452
|
h('div', panelProps('tiers'),
|
|
1404
1453
|
h('section', { className: 'bs-section' },
|
|
1454
|
+
h('div', { className: 'bs-sectionHead' }, h('h3', { className: 'bs-sectionTitle' }, translate('tiersTitle'))),
|
|
1455
|
+
h('p', { className: 'bs-hint' }, translate('tiersIntro')),
|
|
1405
1456
|
routesState.status === 'loading' ? h('p', { className: 'bs-hint', role: 'status' }, translate('routesLoading'))
|
|
1406
1457
|
: allowed === null ? h('p', { className: 'bs-note', 'data-tone': 'warn' }, translate('routesError'))
|
|
1407
1458
|
: !allowed.enabled || allowed.routes.length === 0 ? h('p', { className: 'bs-note', 'data-tone': 'warn' }, translate('tiersInactive')) : null,
|
|
1408
|
-
h('div', { className: 'bs-tierGrid' },
|
|
1409
|
-
|
|
1410
|
-
t: translate, onPatch: (patch) => patchTier(tier, patch) }))))),
|
|
1459
|
+
h('div', { className: 'bs-tierGrid' }, ...TIERS.map((tier) => h(TierRow, { key: tier, tier, value: live.tiers[tier], allowed, disabled: !writable || busy,
|
|
1460
|
+
t: translate, onPatch: (patch) => patchTier(tier, patch) }))))),
|
|
1411
1461
|
h('div', panelProps('connection'),
|
|
1412
1462
|
h('section', { className: 'bs-section' },
|
|
1413
|
-
h(
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1463
|
+
h('div', { className: 'bs-sectionHead' }, h('h3', { className: 'bs-sectionTitle' }, translate('scopeTitle'))),
|
|
1464
|
+
h(SwitchRow, { id: 'bs-scope-eng', label: live.subagents.global ? translate('scopeEngIncluded') : translate('scopeEng'),
|
|
1465
|
+
hint: live.subagents.global ? translate('globalOverrides') : translate('scopeEngHint'),
|
|
1466
|
+
checked: live.subagents.global ? true : live.subagents.eng, disabled: !writable || busy || live.subagents.global,
|
|
1467
|
+
onChange: (eng) => edit((current) => ({ ...current, subagents: { ...current.subagents, eng } })) }),
|
|
1468
|
+
h(SwitchRow, { id: 'bs-scope-global', label: translate('scopeGlobal'), hint: translate('scopeGlobalHint'), checked: live.subagents.global,
|
|
1469
|
+
disabled: !writable || busy, onChange: (global) => edit((current) => ({ ...current, subagents: { ...current.subagents, global } })) }),
|
|
1470
|
+
!scopeActive ? h('p', { className: 'bs-note', 'data-tone': 'warn' }, translate('scopeNone')) : null),
|
|
1471
|
+
h('section', { className: 'bs-section' },
|
|
1472
|
+
h('div', { className: 'bs-sectionHead' }, h('h3', { className: 'bs-sectionTitle' }, translate('behaviorTitle'))),
|
|
1473
|
+
h(SwitchRow, { id: 'bs-delegation-prompt', label: translate('delegationPromptLabel'), hint: translate('delegationPromptHint'),
|
|
1474
|
+
checked: live.delegationPrompt, disabled: !writable || busy, onChange: (delegationPrompt) => edit((current) => ({ ...current, delegationPrompt })) }),
|
|
1475
|
+
h(SwitchRow, { id: 'bs-child-exit-guard', label: translate('childExitGuardLabel'), hint: translate('childExitGuardHint'),
|
|
1476
|
+
checked: live.childExitGuard, disabled: !writable || busy, onChange: (childExitGuard) => edit((current) => ({ ...current, childExitGuard })) })),
|
|
1417
1477
|
h('section', { className: 'bs-section', 'aria-label': translate('readonlyDiagnostics') },
|
|
1418
|
-
h('div', { className: 'bs-sectionHead' },
|
|
1419
|
-
h('div', { className: 'bs-toolbar' }, h('h3', { className: 'bs-title bs-sectionTitle' }, translate('readonlyDiagnostics'))),
|
|
1478
|
+
h('div', { className: 'bs-sectionHead' }, h('h3', { className: 'bs-sectionTitle' }, translate('readonlyDiagnostics')),
|
|
1420
1479
|
h('button', { type: 'button', id: 'bs-refresh', className: 'bs-button', 'data-variant': 'outline',
|
|
1421
1480
|
disabled: capabilities.status === 'loading' || routesState.status === 'loading', 'aria-busy': capabilities.status === 'loading' || routesState.status === 'loading',
|
|
1422
1481
|
onClick: () => { capabilities.reload(); routesState.reload(); } }, translate('refresh'))),
|
|
1423
|
-
h('div', { className: 'bs-
|
|
1482
|
+
h('div', { className: 'bs-metricGrid' },
|
|
1424
1483
|
h('div', { className: 'bs-metric' }, h('span', { className: 'bs-metricLabel' }, translate('connectionMode')),
|
|
1425
1484
|
h('span', { className: 'bs-metricValue' }, translate(writable ? 'connectionWritable' : 'connectionReadonly'))),
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
h('
|
|
1434
|
-
|
|
1485
|
+
h('div', { className: 'bs-metric' }, h('span', { className: 'bs-metricLabel' }, translate('capabilitiesLabel')),
|
|
1486
|
+
h('span', { className: 'bs-metricValue', role: 'status' }, capabilities.status === 'ready' ? translate('ready') : capabilities.status === 'loading' ? translate('loading') : translate('failed'))),
|
|
1487
|
+
h('div', { className: 'bs-metric' }, h('span', { className: 'bs-metricLabel' }, translate('routesLabel')),
|
|
1488
|
+
h('span', { className: 'bs-metricValue', role: 'status' }, routesState.status === 'loading' ? translate('loading')
|
|
1489
|
+
: allowed === null ? translate('failed') : !allowed.enabled ? translate('inactive') : translate('modelCount', { count: allowed.routes.length })))),
|
|
1490
|
+
...BACKENDS.map((spec) => h('div', { key: spec.cli, className: 'bs-connectionRow', 'data-backend': spec.cli },
|
|
1491
|
+
h('span', null, spec.cli === 'codex' ? 'Codex' : 'Claude'),
|
|
1492
|
+
h('p', { className: 'bs-hint bs-mono', role: 'status' }, detectionOf(capabilities, spec, host.subagents[spec.cli], translate))))),
|
|
1493
|
+
h('section', { className: 'bs-section' },
|
|
1494
|
+
h(Advanced, { label: translate('trustedHostsAdvanced'), summary: live.trustedHosts.length ? translate('trustedCount', { count: live.trustedHosts.length }) : translate('trustedDefault') },
|
|
1495
|
+
h(Field, { id: 'bs-trusted-hosts', label: translate('trustedHostsLabel'), hint: translate('trustedHostsHint') },
|
|
1496
|
+
h(HostList, { key: generation, hosts: live.trustedHosts, disabled: !writable || busy, t: translate,
|
|
1497
|
+
onChange: (trustedHosts) => edit((current) => ({ ...current, trustedHosts })) }))))),
|
|
1435
1498
|
notice !== null || invalid !== null ? h('div', { className: 'bs-feedback' }, status) : null,
|
|
1436
1499
|
dirty ? h('div', { className: 'bs-footer' },
|
|
1437
1500
|
h('span', { className: 'bs-status' }, translate('changeCount', { count: changeCount })),
|