dsh-plugin-trim 0.3.4 → 0.3.6
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 +6 -2
- package/client.js +997 -287
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -23,6 +23,183 @@ window.__ModuleLoader__.load({
|
|
|
23
23
|
['research', '调研'],
|
|
24
24
|
]
|
|
25
25
|
|
|
26
|
+
const LOCALE_KEY = 'dsh-experience-optimizer.locale'
|
|
27
|
+
const ONBOARDING_KEY = 'dsh-experience-optimizer.onboarding.v1'
|
|
28
|
+
const ABOUT_LINKS = {
|
|
29
|
+
repo: 'https://github.com/Starlit-Sky-code/dsh-experience-optimizer',
|
|
30
|
+
npmTrim: 'https://www.npmjs.com/package/dsh-plugin-trim',
|
|
31
|
+
npmRecipe: 'https://www.npmjs.com/package/dsh-plugin-recipe',
|
|
32
|
+
releases: 'https://github.com/Starlit-Sky-code/dsh-experience-optimizer/releases',
|
|
33
|
+
issues: 'https://github.com/Starlit-Sky-code/dsh-experience-optimizer/issues',
|
|
34
|
+
homepage: 'https://github.com/Starlit-Sky-code/dsh-experience-optimizer',
|
|
35
|
+
qqGroup: '1134419871',
|
|
36
|
+
qqLink: '',
|
|
37
|
+
donate: [],
|
|
38
|
+
}
|
|
39
|
+
const COPYRIGHT = 'Copyright © 2026 Starlit Sky · AGPL-3.0-only'
|
|
40
|
+
const TABS = [
|
|
41
|
+
{ id: 'trim', zh: '插件减负', en: 'Plugin diet', icon: 'gauge' },
|
|
42
|
+
{ id: 'recipe', zh: '工作流配方', en: 'Workflow recipe', icon: 'recipe' },
|
|
43
|
+
{ id: 'tutorial', zh: '教程', en: 'Guide', icon: 'book' },
|
|
44
|
+
{ id: 'about', zh: '关于', en: 'About', icon: 'info' },
|
|
45
|
+
{ id: 'settings', zh: '设置', en: 'Settings', icon: 'settings' },
|
|
46
|
+
]
|
|
47
|
+
const EN_TEXT = {
|
|
48
|
+
'插件减负': 'Plugin diet',
|
|
49
|
+
'工作流配方': 'Workflow recipe',
|
|
50
|
+
'教程': 'Guide',
|
|
51
|
+
'关于': 'About',
|
|
52
|
+
'设置': 'Settings',
|
|
53
|
+
'减负与兼容': 'Diet & compatibility',
|
|
54
|
+
'可归属上下文': 'Attributable context',
|
|
55
|
+
'启用插件': 'Enabled plugins',
|
|
56
|
+
'兼容性': 'Compatibility',
|
|
57
|
+
'写操作': 'Write access',
|
|
58
|
+
'可应用': 'Ready',
|
|
59
|
+
'只读': 'Read-only',
|
|
60
|
+
'上下文成本': 'Context cost',
|
|
61
|
+
'插件清单': 'Plugin inventory',
|
|
62
|
+
'精简方案': 'Slim plan',
|
|
63
|
+
'兼容性检查': 'Compatibility check',
|
|
64
|
+
'搜索插件': 'Search plugins',
|
|
65
|
+
'搜索兼容性': 'Search findings',
|
|
66
|
+
'名称 / 描述': 'Name / description',
|
|
67
|
+
'代码 / 标题 / 对象': 'Code / title / subject',
|
|
68
|
+
'全部': 'All',
|
|
69
|
+
'启用': 'Enabled',
|
|
70
|
+
'禁用': 'Disabled',
|
|
71
|
+
'受保护': 'Protected',
|
|
72
|
+
'已启用': 'Enabled',
|
|
73
|
+
'已禁用': 'Disabled',
|
|
74
|
+
'正常': 'OK',
|
|
75
|
+
'不兼容': 'Incompatible',
|
|
76
|
+
'警告': 'Warning',
|
|
77
|
+
'插件': 'Plugin',
|
|
78
|
+
'状态': 'Status',
|
|
79
|
+
'保护': 'Protected',
|
|
80
|
+
'兼容状态': 'Compatibility',
|
|
81
|
+
'上下文': 'Context',
|
|
82
|
+
'占比': 'Share',
|
|
83
|
+
'调用': 'Calls',
|
|
84
|
+
'查看全部': 'Show all',
|
|
85
|
+
'收起': 'Collapse',
|
|
86
|
+
'刷新': 'Refresh',
|
|
87
|
+
'读取中…': 'Loading…',
|
|
88
|
+
'生成方案': 'Build plan',
|
|
89
|
+
'生成中…': 'Building…',
|
|
90
|
+
'任务类型': 'Task type',
|
|
91
|
+
'任务目标(可选)': 'Goal (optional)',
|
|
92
|
+
'自动识别': 'Auto-detect',
|
|
93
|
+
'保留': 'Keep',
|
|
94
|
+
'复核': 'Review',
|
|
95
|
+
'建议关闭': 'Close candidate',
|
|
96
|
+
'未用可关闭': 'Unused candidate',
|
|
97
|
+
'人工复核': 'Review',
|
|
98
|
+
'任务:': 'Task: ',
|
|
99
|
+
'风险:': 'Risk: ',
|
|
100
|
+
'评分': 'Score',
|
|
101
|
+
'周期/触发器': 'Scheduled / trigger',
|
|
102
|
+
'有调用记录': 'Used before',
|
|
103
|
+
'窗口内 0 调用': 'No calls in window',
|
|
104
|
+
'无使用账本': 'No usage ledger',
|
|
105
|
+
'证据强': 'Strong evidence',
|
|
106
|
+
'证据弱': 'Weak evidence',
|
|
107
|
+
'证据不足': 'Insufficient evidence',
|
|
108
|
+
'判断依据:描述匹配只说明“可能相关”;出现定时/触发语义、已有调用记录、无使用账本或任务置信度不足时,只进入人工复核。只有“窗口内 0 调用 + 有上下文成本 + 非周期 + 任务高置信”才会标为建议关闭,且仍需确认与安全确认。': 'Evidence rule: a description match only means “possibly relevant”. Scheduled/trigger plugins, plugins with calls, an empty usage ledger, or low task confidence go to review. A close candidate requires zero calls in the window, attributable context cost, no schedule/trigger hint, and high task confidence — and still needs confirmation and host approval.',
|
|
109
|
+
'全选低风险': 'Select low-risk',
|
|
110
|
+
'清空': 'Clear',
|
|
111
|
+
'应用选中': 'Apply selected',
|
|
112
|
+
'恢复最近': 'Restore latest',
|
|
113
|
+
'显示信息': 'Show info',
|
|
114
|
+
'隐藏信息': 'Hide info',
|
|
115
|
+
'需要处理': 'Needs attention',
|
|
116
|
+
'无阻断': 'No blockers',
|
|
117
|
+
'没有匹配的兼容性问题。': 'No matching compatibility findings.',
|
|
118
|
+
'没有匹配的插件。': 'No matching plugins.',
|
|
119
|
+
'当前配置': 'Current profile',
|
|
120
|
+
'兼容状态': 'Compatibility',
|
|
121
|
+
'运行模式': 'Mode',
|
|
122
|
+
'审批策略': 'Approval',
|
|
123
|
+
'审批阈值': 'Approval threshold',
|
|
124
|
+
'建议策略': 'Suggestion policy',
|
|
125
|
+
'使用账本': 'Usage ledger',
|
|
126
|
+
'账本保留': 'Ledger retention',
|
|
127
|
+
'草稿/还原点上限': 'Draft/snapshot limit',
|
|
128
|
+
'复制片段': 'Copy snippet',
|
|
129
|
+
'配置片段': 'Configuration snippet',
|
|
130
|
+
'说明': 'Notes',
|
|
131
|
+
'项目信息': 'Project',
|
|
132
|
+
'交流与支持': 'Community & support',
|
|
133
|
+
'项目链接': 'Links',
|
|
134
|
+
'版权': 'Copyright',
|
|
135
|
+
'新手引导': 'First-run guide',
|
|
136
|
+
'重新查看新手引导': 'Replay first-run guide',
|
|
137
|
+
'开始使用': 'Get started',
|
|
138
|
+
'查看完整教程': 'Open full guide',
|
|
139
|
+
'跳过': 'Skip',
|
|
140
|
+
'下一步': 'Next',
|
|
141
|
+
'上一步': 'Back',
|
|
142
|
+
'完成': 'Done',
|
|
143
|
+
'待补充': 'To be added',
|
|
144
|
+
'捐赠方式:待补充': 'Donation methods: to be added',
|
|
145
|
+
'QQ 群:待补充': 'QQ group: to be added',
|
|
146
|
+
'复制安装命令': 'Copy install command',
|
|
147
|
+
'打开完整教程': 'Open full guide',
|
|
148
|
+
'仅建议,先确认': 'Suggestion only — confirm first',
|
|
149
|
+
'先量成本': 'Measure first',
|
|
150
|
+
'再生成方案': 'Build a plan',
|
|
151
|
+
'最后安全确认': 'Confirm safely',
|
|
152
|
+
}
|
|
153
|
+
let CURRENT_LOCALE = 'zh'
|
|
154
|
+
function tr(zh, en) {
|
|
155
|
+
return CURRENT_LOCALE === 'zh' ? zh : (en === undefined ? (EN_TEXT[zh] === undefined ? zh : EN_TEXT[zh]) : en)
|
|
156
|
+
}
|
|
157
|
+
function browserStorage() {
|
|
158
|
+
try {
|
|
159
|
+
return typeof window !== 'undefined' && window.localStorage ? window.localStorage : undefined
|
|
160
|
+
} catch {
|
|
161
|
+
return undefined
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function detectLocale() {
|
|
165
|
+
const storage = browserStorage()
|
|
166
|
+
try {
|
|
167
|
+
const saved = storage && storage.getItem(LOCALE_KEY)
|
|
168
|
+
if (saved === 'zh' || saved === 'en') return saved
|
|
169
|
+
} catch {
|
|
170
|
+
// localStorage may be unavailable
|
|
171
|
+
}
|
|
172
|
+
try {
|
|
173
|
+
return String(navigator.language || '').toLowerCase().startsWith('zh') ? 'zh' : 'en'
|
|
174
|
+
} catch {
|
|
175
|
+
return 'zh'
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function persistLocale(locale) {
|
|
179
|
+
const storage = browserStorage()
|
|
180
|
+
try { if (storage) storage.setItem(LOCALE_KEY, locale) } catch { /* ignore */ }
|
|
181
|
+
}
|
|
182
|
+
function readOnboarding() {
|
|
183
|
+
const storage = browserStorage()
|
|
184
|
+
try { return storage ? storage.getItem(ONBOARDING_KEY) === '1' : false } catch { return false }
|
|
185
|
+
}
|
|
186
|
+
function writeOnboarding() {
|
|
187
|
+
const storage = browserStorage()
|
|
188
|
+
try { if (storage) storage.setItem(ONBOARDING_KEY, '1') } catch { /* ignore */ }
|
|
189
|
+
}
|
|
190
|
+
function resetOnboarding() {
|
|
191
|
+
const storage = browserStorage()
|
|
192
|
+
try { if (storage) storage.removeItem(ONBOARDING_KEY) } catch { /* ignore */ }
|
|
193
|
+
}
|
|
194
|
+
function readPref(key, fallback) {
|
|
195
|
+
const storage = browserStorage()
|
|
196
|
+
try { return (storage && storage.getItem('dsh-experience-optimizer.' + key)) || fallback } catch { return fallback }
|
|
197
|
+
}
|
|
198
|
+
function writePref(key, value) {
|
|
199
|
+
const storage = browserStorage()
|
|
200
|
+
try { if (storage) storage.setItem('dsh-experience-optimizer.' + key, value) } catch { /* ignore */ }
|
|
201
|
+
}
|
|
202
|
+
|
|
26
203
|
const CSS = `
|
|
27
204
|
.eo-root{--eo-primary:var(--dsw-alias-label-primary,#1a1a1a);--eo-secondary:var(--dsw-alias-label-secondary,#5f6b7a);--eo-tertiary:var(--dsw-alias-label-tertiary,#8b96a5);--eo-border:var(--dsw-alias-border-l2,rgba(127,127,127,.16));--eo-border-strong:var(--dsw-alias-border-l3,rgba(127,127,127,.24));--eo-card-bg:var(--dsw-alias-settings-card-fill,transparent);--eo-card-stroke:var(--dsw-alias-settings-card-stroke,var(--dsw-alias-border-l2,rgba(127,127,127,.16)));--eo-hover:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.06));--eo-error:var(--dsw-alias-state-error-primary,#c4314b);--eo-success:var(--dsw-alias-state-success-primary,#1a7f37);--eo-code:var(--ds-font-family-code,"JetBrains Maple Mono",ui-monospace,monospace);--eo-radius:var(--dsw-radius-lg,12px);max-width:760px;color:var(--eo-primary);font-size:13px;line-height:20px;display:flex;flex-direction:column;gap:14px}
|
|
28
205
|
.eo-root *{box-sizing:border-box}
|
|
@@ -32,15 +209,49 @@ window.__ModuleLoader__.load({
|
|
|
32
209
|
.eo-sub{margin:4px 0 0;color:var(--eo-tertiary);font-size:13px;line-height:20px}
|
|
33
210
|
.eo-hero-actions{display:flex;align-items:center;gap:8px;flex:0 0 auto}
|
|
34
211
|
.eo-status{font:400 11px/1 var(--eo-code);color:var(--eo-tertiary);max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
35
|
-
.eo-tabs{display:flex;gap:18px;border-bottom:.5px solid var(--eo-border);margin:0}
|
|
36
|
-
.eo-
|
|
212
|
+
.eo-tabs{display:flex;gap:18px;border-bottom:.5px solid var(--eo-border);margin:0;overflow-x:auto;scrollbar-width:none}
|
|
213
|
+
.eo-tabs::-webkit-scrollbar{display:none}
|
|
214
|
+
.eo-tab{appearance:none;border:0;background:transparent;color:var(--eo-tertiary);font:inherit;font-size:13px;line-height:20px;padding:7px 1px 9px;cursor:pointer;position:relative;border-radius:0;display:inline-flex;align-items:center;gap:6px;white-space:nowrap}
|
|
215
|
+
.eo-icon{flex:0 0 auto}
|
|
216
|
+
.eo-progress-track{display:block;width:100%;min-width:40px;height:4px;border-radius:4px;background:var(--dsw-alias-bg-module-platform,rgba(127,127,127,.1));overflow:hidden;margin-top:5px}
|
|
217
|
+
.eo-progress-track i{display:block;height:100%;border-radius:4px;background:var(--eo-primary);opacity:.65;transition:width .2s ease;min-width:2px}
|
|
218
|
+
.eo-severity-bar{display:flex;gap:3px;height:5px;margin:0 0 10px}
|
|
219
|
+
.eo-severity-bar span{display:block;height:100%;border-radius:3px}
|
|
220
|
+
.eo-severity-error{background:var(--eo-error)}
|
|
221
|
+
.eo-severity-warn{background:var(--dsw-alias-state-warning-primary,#9a6700)}
|
|
222
|
+
.eo-severity-info{background:var(--dsw-alias-state-business-primary,#4a7fd6)}
|
|
223
|
+
.eo-severity-empty{background:var(--dsw-alias-bg-module-platform,rgba(127,127,127,.12));flex:1}
|
|
224
|
+
.eo-progress-ok i{background:var(--eo-success)}
|
|
225
|
+
.eo-progress-warn i{background:var(--dsw-alias-state-warning-primary,#9a6700)}
|
|
226
|
+
.eo-progress-danger i{background:var(--eo-error)}
|
|
227
|
+
.eo-progress-dots{display:flex;gap:6px;align-items:center;margin:12px 0 2px}
|
|
228
|
+
.eo-progress-dot{width:6px;height:6px;border-radius:50%;background:var(--eo-border-strong)}
|
|
229
|
+
.eo-progress-dot-active{width:18px;border-radius:4px;background:var(--eo-primary)}
|
|
230
|
+
.eo-onboarding{width:min(560px,100%)}
|
|
231
|
+
.eo-onboarding-head{display:flex;gap:12px;align-items:flex-start;margin-bottom:10px}
|
|
232
|
+
.eo-onboarding-icon{width:38px;height:38px;border-radius:10px;display:grid;place-items:center;background:var(--dsw-alias-bg-module-platform,rgba(127,127,127,.08));color:var(--eo-primary);flex:0 0 auto}
|
|
233
|
+
.eo-onboarding-kicker{font:500 10px/16px var(--eo-code);letter-spacing:.12em;text-transform:uppercase;color:var(--eo-tertiary)}
|
|
234
|
+
.eo-onboarding h3{margin:2px 0 0;font-size:18px;line-height:26px}
|
|
235
|
+
.eo-about-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
|
|
236
|
+
.eo-about-card{border:.5px solid var(--eo-border);border-radius:10px;padding:12px;background:var(--dsw-alias-bg-module-platform,rgba(127,127,127,.03))}
|
|
237
|
+
.eo-about-card h4{margin:0 0 6px;font-size:13px;line-height:20px;font-weight:500}
|
|
238
|
+
.eo-about-card p,.eo-about-card li{font-size:12px;line-height:19px;color:var(--eo-tertiary)}
|
|
239
|
+
.eo-link-list{display:flex;flex-direction:column;gap:6px;margin:0;padding:0;list-style:none}
|
|
240
|
+
.eo-link-list a{color:var(--eo-primary);text-decoration:none;font-size:12px;line-height:19px;display:inline-flex;gap:6px;align-items:center;word-break:break-all}
|
|
241
|
+
.eo-link-list a:hover{text-decoration:underline}
|
|
242
|
+
.eo-about-icon{width:64px;height:64px;border-radius:18px;object-fit:cover;display:block;margin:0 auto}
|
|
243
|
+
.eo-copyright{text-align:center;color:var(--eo-tertiary);font-size:11px;line-height:17px;margin-top:8px}
|
|
244
|
+
.eo-install-command{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
|
|
245
|
+
.eo-table-wrap{overflow-x:auto}
|
|
246
|
+
.eo-share-cell{min-width:64px}
|
|
247
|
+
@media(max-width:680px){.eo-col-secondary{display:none}.eo-about-grid{grid-template-columns:1fr}}
|
|
37
248
|
.eo-tab:hover{color:var(--eo-primary)}
|
|
38
249
|
.eo-tab-active{color:var(--eo-primary);font-weight:500}
|
|
39
250
|
.eo-tab-active:after{content:"";position:absolute;left:0;right:0;bottom:-1px;height:1.5px;background:var(--eo-primary);border-radius:1px}
|
|
40
251
|
.eo-stack{display:flex;flex-direction:column;gap:14px}
|
|
41
252
|
.eo-stack>.eo-metrics{order:0}
|
|
42
|
-
.eo-stack>[data-section="
|
|
43
|
-
.eo-stack>[data-section="
|
|
253
|
+
.eo-stack>[data-section="draft"]{order:1}
|
|
254
|
+
.eo-stack>[data-section="inventory"]{order:2}
|
|
44
255
|
.eo-stack>[data-section="compat"]{order:3}
|
|
45
256
|
.eo-stack>[data-section="context"]{order:4}
|
|
46
257
|
.eo-stack>[data-section="result"]{order:5}
|
|
@@ -58,6 +269,24 @@ window.__ModuleLoader__.load({
|
|
|
58
269
|
.eo-metric-hint{font-size:11px;line-height:16px;color:var(--eo-tertiary);margin-top:1px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
59
270
|
.eo-card{padding:14px;border:.5px solid var(--eo-card-stroke);border-radius:var(--eo-radius);background:var(--eo-card-bg)}
|
|
60
271
|
.eo-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:10px}
|
|
272
|
+
.eo-card-toggle{appearance:none;border:0;background:transparent;color:inherit;font:inherit;padding:0;margin:0;display:flex;align-items:flex-start;gap:7px;text-align:left;cursor:pointer;min-width:0}
|
|
273
|
+
.eo-card-toggle:hover .eo-card-title{text-decoration:underline;text-underline-offset:3px}
|
|
274
|
+
.eo-card-chevron{display:inline-flex;align-items:center;color:var(--eo-tertiary);margin-top:3px;transition:transform .15s ease}
|
|
275
|
+
.eo-card-toggle[aria-expanded="false"] .eo-card-chevron{transform:rotate(-90deg)}
|
|
276
|
+
.eo-card-body{min-width:0}
|
|
277
|
+
.eo-viewbar{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin:0 0 2px;padding:8px 10px;border:.5px solid var(--eo-border);border-radius:8px;background:var(--dsw-alias-bg-module-platform,rgba(127,127,127,.03))}
|
|
278
|
+
.eo-viewbar-label{font-size:11px;color:var(--eo-tertiary);white-space:nowrap}
|
|
279
|
+
.eo-viewbar .eo-inline{gap:4px}
|
|
280
|
+
.eo-viewbar .eo-btn{height:26px;font-size:11px;padding:0 8px;border-radius:6px}
|
|
281
|
+
.eo-viewbar .eo-btn-active{border-color:var(--eo-primary);color:var(--eo-primary);background:var(--dsw-alias-bg-layer-1,rgba(127,127,127,.06))}
|
|
282
|
+
.eo-density-compact .eo-card{padding:10px}
|
|
283
|
+
.eo-density-compact .eo-stack,.eo-stack.eo-density-compact{gap:8px}
|
|
284
|
+
.eo-density-compact .eo-item{padding:7px 0}
|
|
285
|
+
.eo-density-compact .eo-metric{padding:9px 11px}
|
|
286
|
+
.eo-layout-two.eo-stack{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
|
|
287
|
+
.eo-layout-two>.eo-viewbar,.eo-layout-two>.eo-metrics,.eo-layout-two>[data-section="draft"],.eo-layout-two>[data-section="inventory"],.eo-layout-two>[data-section="result"],.eo-layout-two>[data-section="dedupe"],.eo-layout-two>[data-section="diagnostics"]{grid-column:1/-1}
|
|
288
|
+
.eo-layout-two>[data-section="compat"],.eo-layout-two>[data-section="context"]{grid-column:span 1}
|
|
289
|
+
.eo-about-hero{display:block;width:100%;height:auto;border-radius:12px;background:#0b1422;margin:0 0 10px}
|
|
61
290
|
.eo-card-title{margin:0;font-size:14px;line-height:22px;font-weight:500;letter-spacing:0}
|
|
62
291
|
.eo-card-sub{margin:2px 0 0;font-size:12px;line-height:18px;color:var(--eo-tertiary)}
|
|
63
292
|
.eo-btn{appearance:none;height:32px;padding:0 12px;border:.5px solid var(--eo-border-strong);border-radius:var(--dsw-radius-md,8px);background:transparent;color:var(--eo-primary);font:inherit;font-size:13px;line-height:20px;font-weight:500;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:6px;white-space:nowrap;transition:background .14s ease,border-color .14s ease,opacity .14s ease}
|
|
@@ -165,7 +394,7 @@ window.__ModuleLoader__.load({
|
|
|
165
394
|
.eo-spacer{height:0}
|
|
166
395
|
@keyframes eo-spin{to{transform:rotate(360deg)}}
|
|
167
396
|
@keyframes eo-in{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
|
|
168
|
-
@media(max-width:820px){.eo-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.eo-metric:nth-child(2){border-right:0}.eo-metric:nth-child(-n+2){border-bottom:.5px solid var(--eo-border)}.eo-form-grid{grid-template-columns:1fr}.eo-hero{flex-wrap:wrap}.eo-hero-actions{margin-left:0}}
|
|
397
|
+
@media(max-width:820px){.eo-layout-two.eo-stack{grid-template-columns:1fr}.eo-layout-two>*{grid-column:1/-1!important}.eo-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.eo-metric:nth-child(2){border-right:0}.eo-metric:nth-child(-n+2){border-bottom:.5px solid var(--eo-border)}.eo-form-grid{grid-template-columns:1fr}.eo-hero{flex-wrap:wrap}.eo-hero-actions{margin-left:0}}
|
|
169
398
|
@media(max-width:520px){.eo-metrics{grid-template-columns:1fr}.eo-metric{border-right:0;border-bottom:.5px solid var(--eo-border)}.eo-metric:last-child{border-bottom:0}}
|
|
170
399
|
`
|
|
171
400
|
|
|
@@ -197,17 +426,24 @@ window.__ModuleLoader__.load({
|
|
|
197
426
|
return h('span', { className: 'eo-badge eo-badge-' + tone }, children)
|
|
198
427
|
}
|
|
199
428
|
|
|
200
|
-
function Metric({ label, value, hint, tone = 'neutral' }) {
|
|
429
|
+
function Metric({ label, value, hint, tone = 'neutral', progress, progressTone = 'neutral' }) {
|
|
201
430
|
return h(
|
|
202
431
|
'div',
|
|
203
432
|
{ className: 'eo-metric' },
|
|
204
433
|
h('div', { className: 'eo-metric-label' }, label),
|
|
205
434
|
h('div', { className: 'eo-metric-value', 'data-tone': tone }, value),
|
|
206
435
|
hint ? h('div', { className: 'eo-metric-hint' }, hint) : null,
|
|
436
|
+
progress !== undefined ? h(Progress, { value: progress, tone: progressTone, label: label }) : null,
|
|
207
437
|
)
|
|
208
438
|
}
|
|
209
439
|
|
|
210
|
-
function Card({ title, subtitle, extra, children, className = '', section }) {
|
|
440
|
+
function Card({ title, subtitle, extra, children, className = '', section, collapsible = false, collapsed = false, onToggle }) {
|
|
441
|
+
const heading = h(
|
|
442
|
+
'div',
|
|
443
|
+
null,
|
|
444
|
+
title ? h('h3', { className: 'eo-card-title' }, title) : null,
|
|
445
|
+
subtitle ? h('p', { className: 'eo-card-sub' }, subtitle) : null,
|
|
446
|
+
)
|
|
211
447
|
return h(
|
|
212
448
|
'section',
|
|
213
449
|
{ className: 'eo-card ' + className, 'data-section': section },
|
|
@@ -215,16 +451,25 @@ window.__ModuleLoader__.load({
|
|
|
215
451
|
? h(
|
|
216
452
|
'div',
|
|
217
453
|
{ className: 'eo-card-head' },
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
454
|
+
collapsible
|
|
455
|
+
? h(
|
|
456
|
+
'button',
|
|
457
|
+
{
|
|
458
|
+
type: 'button',
|
|
459
|
+
className: 'eo-card-toggle',
|
|
460
|
+
'aria-expanded': !collapsed,
|
|
461
|
+
onClick: onToggle,
|
|
462
|
+
},
|
|
463
|
+
h('span', { className: 'eo-card-chevron' }, h(Icon, { name: 'chevron', size: 14 })),
|
|
464
|
+
heading,
|
|
465
|
+
)
|
|
466
|
+
: heading,
|
|
224
467
|
extra || null,
|
|
225
468
|
)
|
|
226
469
|
: null,
|
|
227
|
-
|
|
470
|
+
collapsible && collapsed
|
|
471
|
+
? null
|
|
472
|
+
: h('div', { className: 'eo-card-body' }, children),
|
|
228
473
|
)
|
|
229
474
|
}
|
|
230
475
|
|
|
@@ -253,15 +498,15 @@ window.__ModuleLoader__.load({
|
|
|
253
498
|
}
|
|
254
499
|
|
|
255
500
|
function actionLabel(action) {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
)
|
|
501
|
+
const map = {
|
|
502
|
+
keep: ['保留', 'Keep'],
|
|
503
|
+
enable: ['建议启用', 'Enable candidate'],
|
|
504
|
+
'suggest-disable': ['建议关闭', 'Close candidate'],
|
|
505
|
+
'disable-if-unused': ['未用可关闭', 'Unused candidate'],
|
|
506
|
+
review: ['人工复核', 'Review'],
|
|
507
|
+
}
|
|
508
|
+
const pair = map[action]
|
|
509
|
+
return pair ? tr(pair[0], pair[1]) : action
|
|
265
510
|
}
|
|
266
511
|
|
|
267
512
|
function actionTone(action) {
|
|
@@ -289,7 +534,7 @@ window.__ModuleLoader__.load({
|
|
|
289
534
|
{
|
|
290
535
|
'plugin-runtime': '插件 ↔ DSH',
|
|
291
536
|
'plugin-plugin': '插件 ↔ 插件',
|
|
292
|
-
profile: '
|
|
537
|
+
profile: tr('当前配置', 'Current profile'),
|
|
293
538
|
workspace: '工作区',
|
|
294
539
|
}[domain] || domain
|
|
295
540
|
)
|
|
@@ -304,41 +549,49 @@ window.__ModuleLoader__.load({
|
|
|
304
549
|
}
|
|
305
550
|
|
|
306
551
|
function taskLabel(tag) {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
)
|
|
552
|
+
const map = {
|
|
553
|
+
bugfix: ['修复', 'Bugfix'],
|
|
554
|
+
feature: ['新功能', 'Feature'],
|
|
555
|
+
review: ['审查', 'Review'],
|
|
556
|
+
docs: ['文档', 'Docs'],
|
|
557
|
+
release: ['发布', 'Release'],
|
|
558
|
+
report: ['报告', 'Report'],
|
|
559
|
+
research: ['调研', 'Research'],
|
|
560
|
+
unknown: ['未知', 'Unknown'],
|
|
561
|
+
}
|
|
562
|
+
const pair = map[tag]
|
|
563
|
+
return pair ? tr(pair[0], pair[1]) : tag
|
|
319
564
|
}
|
|
320
565
|
|
|
321
566
|
function riskLabel(risk) {
|
|
322
|
-
|
|
567
|
+
const pair = { low: ['低', 'Low'], medium: ['中', 'Medium'], high: ['高', 'High'] }[risk]
|
|
568
|
+
return pair ? tr(pair[0], pair[1]) : risk
|
|
323
569
|
}
|
|
324
570
|
|
|
325
571
|
function guardLabel(status) {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
)
|
|
572
|
+
const pair = {
|
|
573
|
+
ok: ['正常', 'OK'],
|
|
574
|
+
protected: ['受保护', 'Protected'],
|
|
575
|
+
incompatible: ['不兼容', 'Incompatible'],
|
|
576
|
+
warn: ['警告', 'Warning'],
|
|
577
|
+
}[status]
|
|
578
|
+
return pair ? tr(pair[0], pair[1]) : status
|
|
334
579
|
}
|
|
335
580
|
|
|
336
581
|
function usageLabel(state) {
|
|
337
|
-
return state === 'used'
|
|
582
|
+
return state === 'used'
|
|
583
|
+
? tr('有调用记录', 'Used before')
|
|
584
|
+
: state === 'unused'
|
|
585
|
+
? tr('窗口内 0 调用', 'No calls in window')
|
|
586
|
+
: tr('无使用账本', 'No usage ledger')
|
|
338
587
|
}
|
|
339
588
|
|
|
340
589
|
function evidenceLabel(level) {
|
|
341
|
-
return level === 'strong'
|
|
590
|
+
return level === 'strong'
|
|
591
|
+
? tr('证据强', 'Strong evidence')
|
|
592
|
+
: level === 'weak'
|
|
593
|
+
? tr('证据弱', 'Weak evidence')
|
|
594
|
+
: tr('证据不足', 'Insufficient evidence')
|
|
342
595
|
}
|
|
343
596
|
|
|
344
597
|
function splitList(value) {
|
|
@@ -371,8 +624,222 @@ window.__ModuleLoader__.load({
|
|
|
371
624
|
return body.data
|
|
372
625
|
}
|
|
373
626
|
|
|
627
|
+
const ICON_PATHS = {
|
|
628
|
+
gauge: [
|
|
629
|
+
['path', { d: 'M4 15a8 8 0 1 1 16 0' }],
|
|
630
|
+
['path', { d: 'M12 15l4-5' }],
|
|
631
|
+
['circle', { cx: '12', cy: '15', r: '1.4', fill: 'currentColor', stroke: 'none' }],
|
|
632
|
+
],
|
|
633
|
+
recipe: [
|
|
634
|
+
['path', { d: 'M5 4h11a2 2 0 0 1 2 2v14H7a2 2 0 0 1-2-2z' }],
|
|
635
|
+
['path', { d: 'M8 8h7M8 12h7M8 16h4' }],
|
|
636
|
+
],
|
|
637
|
+
book: [
|
|
638
|
+
['path', { d: 'M4 5.5A2.5 2.5 0 0 1 6.5 3H11v17H6.5A2.5 2.5 0 0 0 4 22z' }],
|
|
639
|
+
['path', { d: 'M20 5.5A2.5 2.5 0 0 0 17.5 3H13v17h4.5A2.5 2.5 0 0 1 20 22z' }],
|
|
640
|
+
],
|
|
641
|
+
info: [
|
|
642
|
+
['circle', { cx: '12', cy: '12', r: '9' }],
|
|
643
|
+
['path', { d: 'M12 11v6M12 7.5h.01' }],
|
|
644
|
+
],
|
|
645
|
+
settings: [
|
|
646
|
+
['circle', { cx: '12', cy: '12', r: '3' }],
|
|
647
|
+
['path', { d: 'M19.4 15a1.7 1.7 0 0 0 .3 1.9l.1.1-2.8 2.8-.1-.1a1.7 1.7 0 0 0-1.9-.3 1.7 1.7 0 0 0-1 1.6v.2h-4v-.2a1.7 1.7 0 0 0-1-1.6 1.7 1.7 0 0 0-1.9.3l-.1.1L4.2 17l.1-.1a1.7 1.7 0 0 0 .3-1.9 1.7 1.7 0 0 0-1.6-1H3v-4h.2a1.7 1.7 0 0 0 1.6-1 1.7 1.7 0 0 0-.3-1.9L4.4 7 7.2 4.2l.1.1a1.7 1.7 0 0 0 1.9.3 1.7 1.7 0 0 0 1-1.6V3h4v.2a1.7 1.7 0 0 0 1 1.6 1.7 1.7 0 0 0 1.9-.3l.1-.1L19.8 7l-.1.1a1.7 1.7 0 0 0-.3 1.9 1.7 1.7 0 0 0 1.6 1h.2v4H21a1.7 1.7 0 0 0-1.6 1z' }],
|
|
648
|
+
],
|
|
649
|
+
shield: [
|
|
650
|
+
['path', { d: 'M12 3l7 3v5c0 4.5-3 7.7-7 10-4-2.3-7-5.5-7-10V6z' }],
|
|
651
|
+
['path', { d: 'M9 12l2 2 4-5' }],
|
|
652
|
+
],
|
|
653
|
+
restore: [
|
|
654
|
+
['path', { d: 'M4 10a8 8 0 1 1 2 5.3' }],
|
|
655
|
+
['path', { d: 'M4 4v6h6' }],
|
|
656
|
+
],
|
|
657
|
+
context: [
|
|
658
|
+
['path', { d: 'M12 3l9 5-9 5-9-5z' }],
|
|
659
|
+
['path', { d: 'M3 12l9 5 9-5M3 16l9 5 9-5' }],
|
|
660
|
+
],
|
|
661
|
+
plugin: [
|
|
662
|
+
['rect', { x: '4', y: '4', width: '6', height: '6', rx: '1' }],
|
|
663
|
+
['rect', { x: '14', y: '4', width: '6', height: '6', rx: '1' }],
|
|
664
|
+
['rect', { x: '4', y: '14', width: '6', height: '6', rx: '1' }],
|
|
665
|
+
['rect', { x: '14', y: '14', width: '6', height: '6', rx: '1' }],
|
|
666
|
+
],
|
|
667
|
+
chevron: [['path', { d: 'M6 9l6 6 6-6' }]],
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
function Icon({ name, size = 16 }) {
|
|
671
|
+
const paths = ICON_PATHS[name] || ICON_PATHS.info
|
|
672
|
+
return h(
|
|
673
|
+
'svg',
|
|
674
|
+
{
|
|
675
|
+
width: size,
|
|
676
|
+
height: size,
|
|
677
|
+
viewBox: '0 0 24 24',
|
|
678
|
+
fill: 'none',
|
|
679
|
+
stroke: 'currentColor',
|
|
680
|
+
strokeWidth: 1.7,
|
|
681
|
+
strokeLinecap: 'round',
|
|
682
|
+
strokeLinejoin: 'round',
|
|
683
|
+
'aria-hidden': 'true',
|
|
684
|
+
focusable: 'false',
|
|
685
|
+
className: 'eo-icon',
|
|
686
|
+
},
|
|
687
|
+
paths.map(([tag, props], index) => h(tag, { key: index, ...props })),
|
|
688
|
+
)
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
function Progress({ value, tone = 'neutral', label }) {
|
|
692
|
+
const pct = Math.max(0, Math.min(100, Number(value) || 0))
|
|
693
|
+
return h(
|
|
694
|
+
'div',
|
|
695
|
+
{
|
|
696
|
+
className: 'eo-progress-track eo-progress-' + tone,
|
|
697
|
+
role: 'progressbar',
|
|
698
|
+
'aria-valuenow': Math.round(pct),
|
|
699
|
+
'aria-valuemin': 0,
|
|
700
|
+
'aria-valuemax': 100,
|
|
701
|
+
'aria-label': label,
|
|
702
|
+
title: label,
|
|
703
|
+
},
|
|
704
|
+
h('i', { style: { width: pct + '%' } }),
|
|
705
|
+
)
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
function OnboardingModal({ step, setStep, onFinish, onTutorial, onClose }) {
|
|
709
|
+
const steps = [
|
|
710
|
+
{
|
|
711
|
+
icon: 'gauge',
|
|
712
|
+
zh: '先量成本',
|
|
713
|
+
en: 'Measure first',
|
|
714
|
+
zhBody: '插件清单会显示每个插件占用的上下文比例;未归属部分单独标出。你砍掉的不只是工具白名单。',
|
|
715
|
+
enBody: 'The plugin inventory shows each plugin’s share of attributable context. Unattributed context is kept separate — the cost is not only the tool allowlist.',
|
|
716
|
+
},
|
|
717
|
+
{
|
|
718
|
+
icon: 'recipe',
|
|
719
|
+
zh: '再生成方案',
|
|
720
|
+
en: 'Build a plan',
|
|
721
|
+
zhBody: '选任务类型或写一句目标,点击“生成方案”。默认只生成草稿,不会改任何插件。',
|
|
722
|
+
enBody: 'Pick a task or describe the goal, then build a plan. It is a draft by default and changes nothing.',
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
icon: 'shield',
|
|
726
|
+
zh: '最后安全确认',
|
|
727
|
+
en: 'Confirm safely',
|
|
728
|
+
zhBody: '只有依据充分才标建议关闭;定时/触发插件、有调用记录的插件只进入复核。应用前写入还原点,随时恢复。',
|
|
729
|
+
enBody: 'Only strong evidence becomes a close candidate. Scheduled/trigger plugins and plugins with calls go to review. A restore point is written before any change.',
|
|
730
|
+
},
|
|
731
|
+
]
|
|
732
|
+
const current = steps[step] || steps[0]
|
|
733
|
+
useEffect(() => {
|
|
734
|
+
const onKey = (event) => { if (event.key === 'Escape') onClose() }
|
|
735
|
+
window.addEventListener('keydown', onKey)
|
|
736
|
+
return () => window.removeEventListener('keydown', onKey)
|
|
737
|
+
}, [onClose])
|
|
738
|
+
return h(
|
|
739
|
+
'div',
|
|
740
|
+
{
|
|
741
|
+
className: 'eo-modal-backdrop',
|
|
742
|
+
onClick: onClose,
|
|
743
|
+
role: 'presentation',
|
|
744
|
+
},
|
|
745
|
+
h(
|
|
746
|
+
'div',
|
|
747
|
+
{
|
|
748
|
+
className: 'eo-modal eo-onboarding',
|
|
749
|
+
role: 'dialog',
|
|
750
|
+
'aria-modal': 'true',
|
|
751
|
+
'aria-labelledby': 'eo-onboarding-title',
|
|
752
|
+
onClick: (event) => event.stopPropagation(),
|
|
753
|
+
},
|
|
754
|
+
h(
|
|
755
|
+
'div',
|
|
756
|
+
{ className: 'eo-onboarding-head' },
|
|
757
|
+
h('span', { className: 'eo-onboarding-icon' }, h(Icon, { name: current.icon, size: 22 })),
|
|
758
|
+
h(
|
|
759
|
+
'div',
|
|
760
|
+
null,
|
|
761
|
+
h('div', { className: 'eo-onboarding-kicker' }, tr('新手引导', 'First-run guide')),
|
|
762
|
+
h('h3', { id: 'eo-onboarding-title' }, tr(current.zh, current.en)),
|
|
763
|
+
),
|
|
764
|
+
),
|
|
765
|
+
h('p', null, tr(current.zhBody, current.enBody)),
|
|
766
|
+
h(
|
|
767
|
+
'div',
|
|
768
|
+
{ className: 'eo-progress-dots', 'aria-label': tr('新手引导进度', 'Guide progress') },
|
|
769
|
+
steps.map((item, index) =>
|
|
770
|
+
h('span', {
|
|
771
|
+
key: item.en,
|
|
772
|
+
className: index === step ? 'eo-progress-dot eo-progress-dot-active' : 'eo-progress-dot',
|
|
773
|
+
}),
|
|
774
|
+
),
|
|
775
|
+
),
|
|
776
|
+
h(
|
|
777
|
+
'div',
|
|
778
|
+
{ className: 'eo-modal-actions' },
|
|
779
|
+
h(Button, { variant: 'ghost', onClick: onClose }, tr('跳过', 'Skip')),
|
|
780
|
+
step > 0
|
|
781
|
+
? h(Button, { variant: 'ghost', onClick: () => setStep(step - 1) }, tr('上一步', 'Back'))
|
|
782
|
+
: null,
|
|
783
|
+
h(Button, { variant: 'ghost', onClick: onTutorial }, tr('查看完整教程', 'Open full guide')),
|
|
784
|
+
step < steps.length - 1
|
|
785
|
+
? h(Button, { variant: 'accent', onClick: () => setStep(step + 1) }, tr('下一步', 'Next'))
|
|
786
|
+
: h(Button, { variant: 'accent', onClick: () => onFinish() }, tr('开始使用', 'Get started')),
|
|
787
|
+
),
|
|
788
|
+
),
|
|
789
|
+
)
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
function AboutHero() {
|
|
793
|
+
return h(
|
|
794
|
+
'svg',
|
|
795
|
+
{
|
|
796
|
+
viewBox: '0 0 1200 300',
|
|
797
|
+
className: 'eo-about-hero',
|
|
798
|
+
role: 'img',
|
|
799
|
+
'aria-label': tr('DSH 体验优化器', 'DSH Experience Optimizer'),
|
|
800
|
+
},
|
|
801
|
+
h('defs', null,
|
|
802
|
+
h('linearGradient', { id: 'eo-about-bg', x1: '0', y1: '0', x2: '1', y2: '1' },
|
|
803
|
+
h('stop', { offset: '0', stopColor: '#0a1220' }),
|
|
804
|
+
h('stop', { offset: '1', stopColor: '#101f34' }),
|
|
805
|
+
),
|
|
806
|
+
),
|
|
807
|
+
h('rect', { width: '1200', height: '300', rx: '18', fill: 'url(#eo-about-bg)' }),
|
|
808
|
+
h('circle', { cx: '1010', cy: '150', r: '94', fill: 'none', stroke: '#2a405e' }),
|
|
809
|
+
h('circle', { cx: '1010', cy: '150', r: '58', fill: 'none', stroke: '#355070' }),
|
|
810
|
+
h('path', { d: 'M944 116 L1004 88 L1076 112 L1092 174 L1038 214 L962 190 Z', fill: 'none', stroke: '#45658a', strokeWidth: '1.4' }),
|
|
811
|
+
h('path', { d: 'M944 116 L1038 214 M1004 88 L962 190 M1076 112 L944 116', stroke: '#334d6b' }),
|
|
812
|
+
[[944,116],[1004,88],[1076,112],[1092,174],[1038,214],[962,190]].map(([cx,cy],i) =>
|
|
813
|
+
h('circle', { key: i, cx, cy, r: 8, fill: '#0f1b2c', stroke: '#5eead4', strokeWidth: 1.5 }),
|
|
814
|
+
),
|
|
815
|
+
h('circle', { cx: '1010', cy: '150', r: '34', fill: '#0c1728', stroke: '#fbbf24', strokeWidth: 1.5 }),
|
|
816
|
+
h('path', { d: 'M1010 127 L1028 136 L1028 154 C1028 168 1019 177 1010 181 C1001 177 992 168 992 154 L992 136 Z', fill: 'none', stroke: '#fbbf24', strokeWidth: 1.8 }),
|
|
817
|
+
h('path', { d: 'M1002 151 L1008 157 L1019 144', fill: 'none', stroke: '#fbbf24', strokeWidth: 2, strokeLinecap: 'round', strokeLinejoin: 'round' }),
|
|
818
|
+
h('text', { x: '64', y: '72', fill: '#5eead4', fontFamily: 'ui-monospace, monospace', fontSize: '13', letterSpacing: '2.4' }, 'DSH PLUGIN SUITE · AGPL-3.0'),
|
|
819
|
+
h('text', { x: '62', y: '142', fill: '#f2f7ff', fontFamily: 'Noto Sans SC, sans-serif', fontSize: '44', fontWeight: '700' }, tr('DSH 体验优化器', 'DSH Experience Optimizer')),
|
|
820
|
+
h('text', { x: '64', y: '184', fill: '#c3d3e8', fontFamily: 'Noto Sans SC, sans-serif', fontSize: '20' }, tr('少一点插件负担,多一点兼容确定性。', 'Less plugin overhead, more compatibility certainty.')),
|
|
821
|
+
h('g', { transform: 'translate(64 220)' },
|
|
822
|
+
[tr('插件减负', 'Plugin diet'), tr('兼容性', 'Compatibility'), tr('工作流配方', 'Workflow recipe')].map((label, i) =>
|
|
823
|
+
h('g', { key: label, transform: `translate(${i * 150} 0)` },
|
|
824
|
+
h('rect', { width: '138', height: '30', rx: '15', fill: 'rgba(94,234,212,.08)', stroke: 'rgba(94,234,212,.35)' }),
|
|
825
|
+
h('circle', { cx: '16', cy: '15', r: '3', fill: ['#5eead4','#60a5fa','#fbbf24'][i] }),
|
|
826
|
+
h('text', { x: '28', y: '20', fill: '#dce9f9', fontFamily: 'Noto Sans SC, sans-serif', fontSize: '13' }, label),
|
|
827
|
+
),
|
|
828
|
+
),
|
|
829
|
+
),
|
|
830
|
+
h('text', { x: '64', y: '286', fill: '#7f93b0', fontFamily: 'ui-monospace, monospace', fontSize: '11', letterSpacing: '1.2' }, 'github.com/Starlit-Sky-code/dsh-experience-optimizer'),
|
|
831
|
+
)
|
|
832
|
+
}
|
|
833
|
+
|
|
374
834
|
function ExperiencePanel() {
|
|
835
|
+
|
|
375
836
|
const [tab, setTab] = useState('trim')
|
|
837
|
+
const [locale, setLocale] = useState(detectLocale)
|
|
838
|
+
const [showOnboarding, setShowOnboarding] = useState(false)
|
|
839
|
+
const [onboardingStep, setOnboardingStep] = useState(0)
|
|
840
|
+
const [collapsedCards, setCollapsedCards] = useState({ context: true })
|
|
841
|
+
const [layout, setLayout] = useState(() => readPref('layout', 'standard'))
|
|
842
|
+
const [density, setDensity] = useState(() => readPref('density', 'comfortable'))
|
|
376
843
|
const [overview, setOverview] = useState(null)
|
|
377
844
|
const [loading, setLoading] = useState(true)
|
|
378
845
|
const [error, setError] = useState('')
|
|
@@ -409,6 +876,7 @@ window.__ModuleLoader__.load({
|
|
|
409
876
|
const [settings, setSettings] = useState(null)
|
|
410
877
|
const [settingsBusy, setSettingsBusy] = useState(false)
|
|
411
878
|
const [settingsError, setSettingsError] = useState('')
|
|
879
|
+
CURRENT_LOCALE = locale
|
|
412
880
|
|
|
413
881
|
const notify = useCallback((message, kind) => {
|
|
414
882
|
setToast({ message, kind: kind || 'ok', id: Date.now() })
|
|
@@ -437,6 +905,49 @@ window.__ModuleLoader__.load({
|
|
|
437
905
|
void refresh()
|
|
438
906
|
}, [refresh])
|
|
439
907
|
|
|
908
|
+
useEffect(() => {
|
|
909
|
+
if (typeof document !== 'undefined') document.documentElement.lang = locale === 'zh' ? 'zh-CN' : 'en'
|
|
910
|
+
persistLocale(locale)
|
|
911
|
+
}, [locale])
|
|
912
|
+
|
|
913
|
+
useEffect(() => {
|
|
914
|
+
if (!readOnboarding()) setShowOnboarding(true)
|
|
915
|
+
}, [])
|
|
916
|
+
|
|
917
|
+
const switchLocale = useCallback((next) => {
|
|
918
|
+
setLocale(next)
|
|
919
|
+
persistLocale(next)
|
|
920
|
+
}, [])
|
|
921
|
+
|
|
922
|
+
const finishOnboarding = useCallback((destination) => {
|
|
923
|
+
writeOnboarding()
|
|
924
|
+
setShowOnboarding(false)
|
|
925
|
+
setOnboardingStep(0)
|
|
926
|
+
if (destination === 'tutorial') setTab('tutorial')
|
|
927
|
+
}, [])
|
|
928
|
+
|
|
929
|
+
const replayOnboarding = useCallback(() => {
|
|
930
|
+
resetOnboarding()
|
|
931
|
+
setOnboardingStep(0)
|
|
932
|
+
setShowOnboarding(true)
|
|
933
|
+
}, [])
|
|
934
|
+
|
|
935
|
+
const toggleCard = useCallback((id) => {
|
|
936
|
+
setCollapsedCards((current) => ({ ...current, [id]: !current[id] }))
|
|
937
|
+
}, [])
|
|
938
|
+
const collapseAllCards = useCallback(() => {
|
|
939
|
+
setCollapsedCards({ draft: true, inventory: true, compat: true, context: true, result: true, dedupe: true, diagnostics: true })
|
|
940
|
+
}, [])
|
|
941
|
+
const expandAllCards = useCallback(() => setCollapsedCards({}), [])
|
|
942
|
+
const changeLayout = useCallback((value) => {
|
|
943
|
+
setLayout(value)
|
|
944
|
+
writePref('layout', value)
|
|
945
|
+
}, [])
|
|
946
|
+
const changeDensity = useCallback((value) => {
|
|
947
|
+
setDensity(value)
|
|
948
|
+
writePref('density', value)
|
|
949
|
+
}, [])
|
|
950
|
+
|
|
440
951
|
const loadSettings = useCallback(async () => {
|
|
441
952
|
setSettingsBusy(true)
|
|
442
953
|
setSettingsError('')
|
|
@@ -493,7 +1004,13 @@ window.__ModuleLoader__.load({
|
|
|
493
1004
|
: 0
|
|
494
1005
|
const totalBundles = overview ? overview.bundles.length : 0
|
|
495
1006
|
const totalContextTokens = overview ? overview.context.totalTokens : 0
|
|
1007
|
+
const attributedContext = overview
|
|
1008
|
+
? Math.max(0, overview.context.totalTokens - overview.context.unattributedTokens)
|
|
1009
|
+
: 0
|
|
1010
|
+
const contextPct = totalContextTokens > 0 ? (attributedContext / totalContextTokens) * 100 : 0
|
|
1011
|
+
const enabledPct = totalBundles > 0 ? (enabledBundles / totalBundles) * 100 : 0
|
|
496
1012
|
const compat = overview ? overview.compat : { error: 0, warn: 0, info: 0 }
|
|
1013
|
+
const compatPct = compat.error > 0 ? 0 : compat.warn > 0 ? 50 : 100
|
|
497
1014
|
const byOwner = overview ? overview.context.byOwner : []
|
|
498
1015
|
const maxOwner = Math.max(1, ...byOwner.map((owner) => owner.tokens))
|
|
499
1016
|
const selectedIds = Object.keys(selected).filter((id) => selected[id])
|
|
@@ -574,7 +1091,7 @@ window.__ModuleLoader__.load({
|
|
|
574
1091
|
if (result.token) setRollbackToken(result.token)
|
|
575
1092
|
notify(
|
|
576
1093
|
result.rolledBack
|
|
577
|
-
? '
|
|
1094
|
+
? '应用未完成,已自动恢复'
|
|
578
1095
|
: '已应用 ' +
|
|
579
1096
|
result.items.filter((item) => item.status === 'applied').length +
|
|
580
1097
|
' 项',
|
|
@@ -604,7 +1121,7 @@ window.__ModuleLoader__.load({
|
|
|
604
1121
|
setApplyResult(null)
|
|
605
1122
|
setRollbackToken('')
|
|
606
1123
|
notify(
|
|
607
|
-
'
|
|
1124
|
+
'已恢复 ' +
|
|
608
1125
|
result.items.filter((item) => item.status === 'restored').length +
|
|
609
1126
|
' 项',
|
|
610
1127
|
)
|
|
@@ -677,8 +1194,8 @@ window.__ModuleLoader__.load({
|
|
|
677
1194
|
h(
|
|
678
1195
|
'div',
|
|
679
1196
|
{ className: 'eo-hero-copy' },
|
|
680
|
-
h('h2', { className: 'eo-title' }, '体验优化'),
|
|
681
|
-
h('p', { className: 'eo-sub' }, '插件减负、兼容性体检与工作流蓝图。'),
|
|
1197
|
+
h('h2', { className: 'eo-title' }, tr('体验优化', 'Experience Optimizer')),
|
|
1198
|
+
h('p', { className: 'eo-sub' }, tr('插件减负、兼容性体检与工作流蓝图。', 'Plugin diet, compatibility checks, and workflow recipes.')),
|
|
682
1199
|
),
|
|
683
1200
|
h(
|
|
684
1201
|
'div',
|
|
@@ -686,56 +1203,44 @@ window.__ModuleLoader__.load({
|
|
|
686
1203
|
h(
|
|
687
1204
|
'span',
|
|
688
1205
|
{ className: 'eo-status', title: overview ? overview.profile.dir : '' },
|
|
689
|
-
overview ? '
|
|
1206
|
+
overview ? tr('当前配置:', 'Profile: ') + overview.profile.name : tr('读取中', 'Loading'),
|
|
1207
|
+
),
|
|
1208
|
+
h(
|
|
1209
|
+
Button,
|
|
1210
|
+
{
|
|
1211
|
+
variant: 'ghost',
|
|
1212
|
+
onClick: () => switchLocale(locale === 'zh' ? 'en' : 'zh'),
|
|
1213
|
+
title: tr('切换语言', 'Switch language'),
|
|
1214
|
+
},
|
|
1215
|
+
locale === 'zh' ? 'EN' : '中文',
|
|
690
1216
|
),
|
|
691
1217
|
h(
|
|
692
1218
|
Button,
|
|
693
1219
|
{ onClick: refresh, disabled: loading, variant: 'ghost' },
|
|
694
|
-
loading ? '刷新中…' : '刷新',
|
|
1220
|
+
loading ? tr('刷新中…', 'Refreshing…') : tr('刷新', 'Refresh'),
|
|
695
1221
|
),
|
|
696
1222
|
),
|
|
697
1223
|
),
|
|
698
1224
|
h(
|
|
699
1225
|
'div',
|
|
700
|
-
{ className: 'eo-tabs' },
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
className: 'eo-tab' + (tab === 'recipe' ? ' eo-tab-active' : ''),
|
|
715
|
-
onClick: () => setTab('recipe'),
|
|
716
|
-
},
|
|
717
|
-
'工作流配方',
|
|
718
|
-
),
|
|
719
|
-
h(
|
|
720
|
-
'button',
|
|
721
|
-
{
|
|
722
|
-
type: 'button',
|
|
723
|
-
className: 'eo-tab' + (tab === 'tutorial' ? ' eo-tab-active' : ''),
|
|
724
|
-
onClick: () => setTab('tutorial'),
|
|
725
|
-
},
|
|
726
|
-
'教程',
|
|
727
|
-
),
|
|
728
|
-
h(
|
|
729
|
-
'button',
|
|
730
|
-
{
|
|
731
|
-
type: 'button',
|
|
732
|
-
className: 'eo-tab' + (tab === 'settings' ? ' eo-tab-active' : ''),
|
|
733
|
-
onClick: () => {
|
|
734
|
-
setTab('settings')
|
|
735
|
-
if (settings === null && !settingsBusy) void loadSettings()
|
|
1226
|
+
{ className: 'eo-tabs', role: 'tablist' },
|
|
1227
|
+
TABS.map((item) =>
|
|
1228
|
+
h(
|
|
1229
|
+
'button',
|
|
1230
|
+
{
|
|
1231
|
+
key: item.id,
|
|
1232
|
+
type: 'button',
|
|
1233
|
+
role: 'tab',
|
|
1234
|
+
'aria-selected': tab === item.id,
|
|
1235
|
+
className: 'eo-tab' + (tab === item.id ? ' eo-tab-active' : ''),
|
|
1236
|
+
onClick: () => {
|
|
1237
|
+
setTab(item.id)
|
|
1238
|
+
if (item.id === 'settings' && settings === null && !settingsBusy) void loadSettings()
|
|
1239
|
+
},
|
|
736
1240
|
},
|
|
737
|
-
|
|
738
|
-
|
|
1241
|
+
h(Icon, { name: item.icon, size: 15 }),
|
|
1242
|
+
tr(item.zh, item.en),
|
|
1243
|
+
),
|
|
739
1244
|
),
|
|
740
1245
|
),
|
|
741
1246
|
error
|
|
@@ -758,11 +1263,13 @@ window.__ModuleLoader__.load({
|
|
|
758
1263
|
? renderTutorial()
|
|
759
1264
|
: tab === 'settings'
|
|
760
1265
|
? renderSettings()
|
|
761
|
-
:
|
|
762
|
-
?
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
1266
|
+
: tab === 'about'
|
|
1267
|
+
? renderAbout()
|
|
1268
|
+
: overview
|
|
1269
|
+
? tab === 'trim'
|
|
1270
|
+
? renderTrim()
|
|
1271
|
+
: renderRecipe()
|
|
1272
|
+
: null,
|
|
766
1273
|
confirmState
|
|
767
1274
|
? h(ConfirmModal, {
|
|
768
1275
|
state: confirmState,
|
|
@@ -775,90 +1282,100 @@ window.__ModuleLoader__.load({
|
|
|
775
1282
|
toast
|
|
776
1283
|
? h('div', { className: 'eo-toast eo-toast-' + toast.kind }, toast.message)
|
|
777
1284
|
: null,
|
|
1285
|
+
showOnboarding
|
|
1286
|
+
? h(OnboardingModal, {
|
|
1287
|
+
step: onboardingStep,
|
|
1288
|
+
setStep: setOnboardingStep,
|
|
1289
|
+
onFinish: () => finishOnboarding(),
|
|
1290
|
+
onTutorial: () => finishOnboarding('tutorial'),
|
|
1291
|
+
onClose: () => finishOnboarding(),
|
|
1292
|
+
})
|
|
1293
|
+
: null,
|
|
778
1294
|
)
|
|
779
1295
|
|
|
780
1296
|
function renderTutorial() {
|
|
781
1297
|
const quickStarts = [
|
|
782
1298
|
{
|
|
783
|
-
|
|
784
|
-
|
|
1299
|
+
zhLabel: '代码审查', enLabel: 'Code review',
|
|
1300
|
+
zhDesc: '先看兼容性,再生成审查任务的精简方案', enDesc: 'Check compatibility, then build a review plan',
|
|
785
1301
|
run: () => {
|
|
786
1302
|
setTaskTag('review')
|
|
787
|
-
setGoal('审查当前改动,指出风险、回归点和需要补测的地方')
|
|
1303
|
+
setGoal(tr('审查当前改动,指出风险、回归点和需要补测的地方', 'Review current changes: risks, regressions, and missing tests'))
|
|
788
1304
|
setTab('trim')
|
|
789
|
-
notify('已填入审查任务,点击“生成方案”继续')
|
|
1305
|
+
notify(tr('已填入审查任务,点击“生成方案”继续', 'Review task filled; click “Build plan” to continue'))
|
|
790
1306
|
},
|
|
791
1307
|
},
|
|
792
1308
|
{
|
|
793
|
-
|
|
794
|
-
|
|
1309
|
+
zhLabel: '修复问题', enLabel: 'Fix an issue',
|
|
1310
|
+
zhDesc: '排除无关插件,保留调试与文件工具', enDesc: 'Drop unrelated plugins; keep debugging and file tools',
|
|
795
1311
|
run: () => {
|
|
796
1312
|
setTaskTag('bugfix')
|
|
797
|
-
setGoal('修复一个可复现的 bug,并验证没有回归')
|
|
1313
|
+
setGoal(tr('修复一个可复现的 bug,并验证没有回归', 'Fix a reproducible bug and verify no regressions'))
|
|
798
1314
|
setTab('trim')
|
|
799
|
-
notify('已填入修复任务,点击“生成方案”继续')
|
|
1315
|
+
notify(tr('已填入修复任务,点击“生成方案”继续', 'Bugfix task filled; click “Build plan” to continue'))
|
|
800
1316
|
},
|
|
801
1317
|
},
|
|
802
1318
|
{
|
|
803
|
-
|
|
804
|
-
|
|
1319
|
+
zhLabel: '整理周报', enLabel: 'Weekly report',
|
|
1320
|
+
zhDesc: '进入工作流配方,生成可导出的周报蓝图', enDesc: 'Open the recipe builder for an exportable report blueprint',
|
|
805
1321
|
run: () => {
|
|
806
1322
|
setTab('recipe')
|
|
807
|
-
notify('已打开工作流配方,按表单确认范围与交付方式')
|
|
1323
|
+
notify(tr('已打开工作流配方,按表单确认范围与交付方式', 'Recipe builder opened; confirm scope and delivery'))
|
|
808
1324
|
},
|
|
809
1325
|
},
|
|
810
1326
|
]
|
|
1327
|
+
const steps = [
|
|
1328
|
+
['先扫描。', 'Scan first.', ' 打开「插件减负」,看可归属上下文、兼容性和插件清单;清单里的“占比”就是常驻成本的可见化。', ' Open Plugin diet to see attributable context, compatibility, and inventory. The Share column makes resident cost visible.'],
|
|
1329
|
+
['再生成方案。', 'Build a plan.', ' 选任务类型或写一句目标,点击“生成方案”。默认只生成草稿,不会改任何插件。', ' Pick a task or write a goal, then Build plan. It only creates a draft; no plugin is changed.'],
|
|
1330
|
+
['看判断依据。', 'Read the evidence.', ' 只有“窗口内 0 调用 + 有上下文成本 + 非周期 + 任务高置信”才会标为建议关闭;其余进入人工复核。', ' Only zero calls in the window, attributable cost, no schedule/trigger hint, and high task confidence produce a close candidate. Everything else goes to review.'],
|
|
1331
|
+
['确认后应用。', 'Confirm and apply.', ' 勾选低风险项,点击“应用选中”,核对弹窗后写入还原点并应用;需要时可一键恢复。', ' Select low-risk items, apply, review the dialog, then write a restore point and apply. Recover in one click if needed.'],
|
|
1332
|
+
['需要工作流时。', 'Need a workflow?', ' 打开「工作流配方」,生成带审批级别的蓝图,导出 Markdown/JSON 运行手册。', ' Open Workflow recipe to generate a blueprint with approval levels and export Markdown/JSON.'],
|
|
1333
|
+
]
|
|
1334
|
+
const faq = [
|
|
1335
|
+
[tr('为什么我几乎没有“建议关闭”?', 'Why do I see almost no close candidates?'), tr('这是默认的保守策略:没有使用账本、当前任务置信度不够、插件带周期/触发器语义,或已经有调用记录时,只会进入人工复核。', 'This is the conservative default: no usage ledger, low task confidence, schedule/trigger hints, or existing calls all route to review.')],
|
|
1336
|
+
[tr('每月才用一次的插件会被误伤吗?', 'Will a once-a-month plugin be hurt?'), tr('带“每月/每周/定时/提醒/日程/dream”等语义的插件会被硬保护。仍不放心时,把它加入配置的 protect 列表。', 'Plugins with monthly/weekly/schedule/reminder/calendar/dream hints are hard-protected. Add it to the protect list if you want extra safety.')],
|
|
1337
|
+
[tr('应用后出问题怎么办?', 'What if something breaks after apply?'), tr('每次应用前都会写入还原点;在精简方案底部点击“恢复最近”,或让 Agent 调用 trim_rollback_profile。恢复同样需要安全确认。', 'A restore point is written before every apply. Use Restore latest, or call trim_rollback_profile. Rollback also requires host approval.')],
|
|
1338
|
+
[tr('为什么应用还需要确认和审批?', 'Why do apply actions need confirmation and approval?'), tr('confirm: true 只是提案标记,真正授权来自安全确认返回 allowed-once;被拒绝、取消或审批服务不可用时一律不写入。', 'confirm: true is only a proposal marker. Host approval returning allowed-once is the real grant; rejection, cancellation, or unavailable approval never writes.')],
|
|
1339
|
+
]
|
|
811
1340
|
return h(
|
|
812
1341
|
'div',
|
|
813
1342
|
{ className: 'eo-stack' },
|
|
814
1343
|
h(
|
|
815
1344
|
Card,
|
|
816
|
-
{ title: '5 分钟上手', subtitle: '
|
|
1345
|
+
{ title: tr('5 分钟上手', 'Five-minute guide'), subtitle: tr('从扫描到应用,每一步都可恢复', 'From scan to apply, every step is recoverable') },
|
|
817
1346
|
h(
|
|
818
1347
|
'ol',
|
|
819
1348
|
{ className: 'eo-steps' },
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
h('li', null, h('strong', null, '确认后应用。'), ' 勾选低风险项,点击“应用选中”,核对弹窗后写入快照并应用;需要时可一键回滚。'),
|
|
824
|
-
h('li', null, h('strong', null, '需要工作流时。'), ' 打开「工作流配方」,生成带审批级别的蓝图,导出 Markdown/JSON 运行手册。'),
|
|
1349
|
+
steps.map(([zhTitle, enTitle, zhBody, enBody], index) =>
|
|
1350
|
+
h('li', { key: enTitle }, h('strong', null, tr(zhTitle, enTitle)), tr(zhBody, enBody)),
|
|
1351
|
+
),
|
|
825
1352
|
),
|
|
826
1353
|
),
|
|
827
1354
|
h(
|
|
828
1355
|
Card,
|
|
829
|
-
{ title: '按任务快速开始', subtitle: '只是填入表单,不会直接修改插件' },
|
|
1356
|
+
{ title: tr('按任务快速开始', 'Quick start by task'), subtitle: tr('只是填入表单,不会直接修改插件', 'Only fills the form; changes nothing') },
|
|
830
1357
|
h(
|
|
831
1358
|
'div',
|
|
832
1359
|
{ className: 'eo-inline' },
|
|
833
1360
|
quickStarts.map((item) =>
|
|
834
1361
|
h(
|
|
835
1362
|
'div',
|
|
836
|
-
{ key: item.
|
|
837
|
-
h('strong', null, item.
|
|
838
|
-
h('span', { className: 'eo-muted' }, item.
|
|
839
|
-
h(Button, { variant: 'ghost', onClick: item.run }, '开始'),
|
|
1363
|
+
{ key: item.enLabel, className: 'eo-issue', style: { flex: '1 1 180px', flexDirection: 'column', alignItems: 'flex-start' } },
|
|
1364
|
+
h('strong', null, tr(item.zhLabel, item.enLabel)),
|
|
1365
|
+
h('span', { className: 'eo-muted' }, tr(item.zhDesc, item.enDesc)),
|
|
1366
|
+
h(Button, { variant: 'ghost', onClick: item.run }, tr('开始', 'Start')),
|
|
840
1367
|
),
|
|
841
1368
|
),
|
|
842
1369
|
),
|
|
843
1370
|
),
|
|
844
1371
|
h(
|
|
845
1372
|
Card,
|
|
846
|
-
{ title: '常见问题', subtitle: '
|
|
847
|
-
|
|
848
|
-
h('
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
h('summary', null, '每月才用一次的插件会被误伤吗?'),
|
|
853
|
-
h('p', null, '带“每月/每周/定时/提醒/日程/dream”等语义的插件会被硬保护。仍不放心时,把它加入配置的 protect 列表。'),
|
|
854
|
-
),
|
|
855
|
-
h('details', { className: 'eo-faq' },
|
|
856
|
-
h('summary', null, '应用后出问题怎么办?'),
|
|
857
|
-
h('p', null, '每次应用前都会写入快照;在精简方案底部点击“回滚最近”,或让 Agent 调用 trim_rollback_profile。回滚同样需要宿主审批。'),
|
|
858
|
-
),
|
|
859
|
-
h('details', { className: 'eo-faq' },
|
|
860
|
-
h('summary', null, '为什么应用还需要确认和审批?'),
|
|
861
|
-
h('p', null, 'confirm: true 只是提案标记,真正授权来自宿主审批返回 allowed-once;被拒绝、取消或审批服务不可用时一律不写入。'),
|
|
1373
|
+
{ title: tr('常见问题', 'FAQ'), subtitle: tr('先看依据,再做决定', 'Read the evidence first') },
|
|
1374
|
+
faq.map(([q, a]) =>
|
|
1375
|
+
h('details', { className: 'eo-faq', key: q },
|
|
1376
|
+
h('summary', null, q),
|
|
1377
|
+
h('p', null, a),
|
|
1378
|
+
),
|
|
862
1379
|
),
|
|
863
1380
|
),
|
|
864
1381
|
)
|
|
@@ -890,113 +1407,291 @@ window.__ModuleLoader__.load({
|
|
|
890
1407
|
async function copyConfig(data) {
|
|
891
1408
|
try {
|
|
892
1409
|
await navigator.clipboard.writeText(configPatch(data))
|
|
893
|
-
notify('配置片段已复制;写入配置补丁后生效')
|
|
1410
|
+
notify(tr('配置片段已复制;写入配置补丁后生效', 'Snippet copied; apply it to the profile patch'))
|
|
894
1411
|
} catch {
|
|
895
|
-
notify('无法访问剪贴板,请手动复制配置片段', 'warn')
|
|
1412
|
+
notify(tr('无法访问剪贴板,请手动复制配置片段', 'Clipboard unavailable; copy the snippet manually'), 'warn')
|
|
896
1413
|
}
|
|
897
1414
|
}
|
|
898
1415
|
|
|
899
1416
|
function renderSettings() {
|
|
900
1417
|
if (settingsBusy && settings === null) {
|
|
901
|
-
return h('div', { className: 'eo-loading' }, h('span', { className: 'eo-spinner' }), '正在读取当前生效设置…')
|
|
1418
|
+
return h('div', { className: 'eo-loading' }, h('span', { className: 'eo-spinner' }), tr('正在读取当前生效设置…', 'Loading effective settings…'))
|
|
902
1419
|
}
|
|
903
1420
|
if (settingsError && settings === null) {
|
|
904
|
-
return h('div', { className: 'eo-error' }, h('span', null, settingsError), h(Button, { variant: 'ghost', onClick: loadSettings }, '重试'))
|
|
1421
|
+
return h('div', { className: 'eo-error' }, h('span', null, settingsError), h(Button, { variant: 'ghost', onClick: loadSettings }, tr('重试', 'Retry')))
|
|
905
1422
|
}
|
|
906
|
-
if (!settings) return h('div', { className: 'eo-empty' }, '暂无设置数据。')
|
|
907
|
-
const policyLabel = settings.suggestionPolicy === 'balanced' ? '旧评分(仍保护周期与已用插件)' : '证据优先(推荐)'
|
|
908
|
-
const approvalLabel = settings.approvalMode === 'risk-based' ? '仅超过阈值时审批' : '每次工具写入都审批'
|
|
1423
|
+
if (!settings) return h('div', { className: 'eo-empty' }, tr('暂无设置数据。', 'No settings data.'))
|
|
1424
|
+
const policyLabel = settings.suggestionPolicy === 'balanced' ? tr('旧评分(仍保护周期与已用插件)', 'Legacy score (still protects scheduled/used plugins)') : tr('证据优先(推荐)', 'Evidence-first (recommended)')
|
|
1425
|
+
const approvalLabel = settings.approvalMode === 'risk-based' ? tr('仅超过阈值时审批', 'Approve only above threshold') : tr('每次工具写入都审批', 'Approve every tool write')
|
|
909
1426
|
return h(
|
|
910
1427
|
'div',
|
|
911
1428
|
{ className: 'eo-stack' },
|
|
912
1429
|
h(
|
|
913
1430
|
Card,
|
|
914
1431
|
{
|
|
915
|
-
title: '当前生效设置',
|
|
916
|
-
subtitle: '只读视图;修改请写入配置补丁',
|
|
917
|
-
extra: h(Button, { variant: 'ghost', onClick: loadSettings, disabled: settingsBusy }, settingsBusy ? '读取中…' : '刷新'),
|
|
1432
|
+
title: tr('当前生效设置', 'Effective settings'),
|
|
1433
|
+
subtitle: tr('只读视图;修改请写入配置补丁', 'Read-only; edit the profile patch to change'),
|
|
1434
|
+
extra: h(Button, { variant: 'ghost', onClick: loadSettings, disabled: settingsBusy }, settingsBusy ? tr('读取中…', 'Loading…') : tr('刷新', 'Refresh')),
|
|
918
1435
|
},
|
|
919
1436
|
h(
|
|
920
1437
|
'div',
|
|
921
1438
|
{ className: 'eo-settings-grid' },
|
|
922
|
-
h('div', { className: 'eo-settings-row' }, h('span', null, '
|
|
923
|
-
h('div', { className: 'eo-settings-row' }, h('span', null, '运行模式'), h('code', null, settings.mode === 'auto-safe' ? '自动安全(收窄建议)' : '建议模式')),
|
|
924
|
-
h('div', { className: 'eo-settings-row' }, h('span', null, '审批策略'), h('code', null, approvalLabel)),
|
|
925
|
-
h('div', { className: 'eo-settings-row' }, h('span', null, '审批阈值'), h('code', null, String(settings.approvalThreshold) + ' 项')),
|
|
926
|
-
h('div', { className: 'eo-settings-row' }, h('span', null, '建议策略'), h('code', null, policyLabel)),
|
|
927
|
-
h('div', { className: 'eo-settings-row' }, h('span', null, '使用账本'), h('code', null, settings.trackUsage ? '开启' : '关闭')),
|
|
928
|
-
h('div', { className: 'eo-settings-row' }, h('span', null, '账本保留'), h('code', null, settings.usageRetentionDays + ' 天')),
|
|
929
|
-
h('div', { className: 'eo-settings-row' }, h('span', null, '
|
|
1439
|
+
h('div', { className: 'eo-settings-row' }, h('span', null, tr('当前配置', 'Profile')), h('code', null, settings.profile)),
|
|
1440
|
+
h('div', { className: 'eo-settings-row' }, h('span', null, tr('运行模式', 'Mode')), h('code', null, settings.mode === 'auto-safe' ? tr('自动安全(收窄建议)', 'Auto-safe (narrower)') : tr('建议模式', 'Advice mode'))),
|
|
1441
|
+
h('div', { className: 'eo-settings-row' }, h('span', null, tr('审批策略', 'Approval')), h('code', null, approvalLabel)),
|
|
1442
|
+
h('div', { className: 'eo-settings-row' }, h('span', null, tr('审批阈值', 'Approval threshold')), h('code', null, String(settings.approvalThreshold) + tr(' 项', ' items'))),
|
|
1443
|
+
h('div', { className: 'eo-settings-row' }, h('span', null, tr('建议策略', 'Suggestion policy')), h('code', null, policyLabel)),
|
|
1444
|
+
h('div', { className: 'eo-settings-row' }, h('span', null, tr('使用账本', 'Usage ledger')), h('code', null, settings.trackUsage ? tr('开启', 'On') : tr('关闭', 'Off'))),
|
|
1445
|
+
h('div', { className: 'eo-settings-row' }, h('span', null, tr('账本保留', 'Ledger retention')), h('code', null, settings.usageRetentionDays + tr(' 天', ' days'))),
|
|
1446
|
+
h('div', { className: 'eo-settings-row' }, h('span', null, tr('草稿/还原点上限', 'Draft/snapshot limit')), h('code', null, String(settings.maxDrafts))),
|
|
930
1447
|
),
|
|
931
|
-
h('div', { className: 'eo-muted', style: { marginTop: '10px' } }, '配置目录:' + settings.profileDir),
|
|
1448
|
+
h('div', { className: 'eo-muted', style: { marginTop: '10px' } }, tr('配置目录:', 'Config directory: ') + settings.profileDir),
|
|
932
1449
|
),
|
|
933
1450
|
h(
|
|
934
1451
|
Card,
|
|
935
|
-
{ title: '保护与固定', subtitle: '这些插件永远不会进入自动建议' },
|
|
1452
|
+
{ title: tr('保护与固定', 'Protect & pin'), subtitle: tr('这些插件永远不会进入自动建议', 'These plugins never become automatic candidates') },
|
|
936
1453
|
settings.protect.length === 0 && settings.pinned.length === 0
|
|
937
|
-
? h('div', { className: 'eo-empty' }, '尚未配置保护 / 固定名单。可在配置补丁中添加需要保底的插件。')
|
|
1454
|
+
? h('div', { className: 'eo-empty' }, tr('尚未配置保护 / 固定名单。可在配置补丁中添加需要保底的插件。', 'No protect/pinned entries. Add must-keep plugins to the profile patch.'))
|
|
938
1455
|
: h(
|
|
939
1456
|
'div',
|
|
940
1457
|
{ className: 'eo-inline' },
|
|
941
|
-
settings.protect.map((name) => h(Badge, { key: 'protect-' + name, tone: 'warn' }, '保护 · ' + name)),
|
|
942
|
-
settings.pinned.map((name) => h(Badge, { key: 'pinned-' + name, tone: 'neutral' }, '固定 · ' + name)),
|
|
1458
|
+
settings.protect.map((name) => h(Badge, { key: 'protect-' + name, tone: 'warn' }, tr('保护 · ', 'Protect · ') + name)),
|
|
1459
|
+
settings.pinned.map((name) => h(Badge, { key: 'pinned-' + name, tone: 'neutral' }, tr('固定 · ', 'Pinned · ') + name)),
|
|
943
1460
|
),
|
|
944
1461
|
),
|
|
945
1462
|
h(
|
|
946
1463
|
Card,
|
|
947
1464
|
{
|
|
948
|
-
title: '配置片段',
|
|
949
|
-
subtitle: '复制到配置补丁;写入后由 DSH 重新加载',
|
|
950
|
-
extra: h(Button, { variant: 'accent', onClick: () => void copyConfig(settings) }, '复制片段'),
|
|
1465
|
+
title: tr('配置片段', 'Configuration snippet'),
|
|
1466
|
+
subtitle: tr('复制到配置补丁;写入后由 DSH 重新加载', 'Copy into the profile patch; DSH reloads after writing'),
|
|
1467
|
+
extra: h(Button, { variant: 'accent', onClick: () => void copyConfig(settings) }, tr('复制片段', 'Copy snippet')),
|
|
951
1468
|
},
|
|
952
1469
|
h('pre', { className: 'eo-codeblock' }, configPatch(settings)),
|
|
953
1470
|
),
|
|
954
1471
|
h(
|
|
955
1472
|
Card,
|
|
956
|
-
{ title: '说明', subtitle: '设置页不会直接改配置' },
|
|
957
|
-
h('div', { className: 'eo-muted' }, '为避免 UI 绕过 DSH 的配置边界,这里只展示当前生效值与可复制片段。修改后请重新加载插件;审批与保护逻辑不会因为改设置而跳过。'),
|
|
1473
|
+
{ title: tr('说明', 'Notes'), subtitle: tr('设置页不会直接改配置', 'This page does not edit config directly') },
|
|
1474
|
+
h('div', { className: 'eo-muted' }, tr('为避免 UI 绕过 DSH 的配置边界,这里只展示当前生效值与可复制片段。修改后请重新加载插件;审批与保护逻辑不会因为改设置而跳过。', 'To avoid bypassing DSH configuration boundaries, this page only shows effective values and a copyable snippet. Reload the plugin after editing; approval and protection are never skipped.')),
|
|
958
1475
|
),
|
|
959
1476
|
)
|
|
960
1477
|
}
|
|
961
1478
|
|
|
962
|
-
function
|
|
1479
|
+
async function copyInstall() {
|
|
1480
|
+
try {
|
|
1481
|
+
await navigator.clipboard.writeText('dsh plugin --profile web add dsh-plugin-trim\ndsh plugin --profile web add dsh-plugin-recipe')
|
|
1482
|
+
notify(tr('安装命令已复制', 'Install commands copied'))
|
|
1483
|
+
} catch {
|
|
1484
|
+
notify(tr('无法访问剪贴板,请手动复制安装命令', 'Clipboard unavailable; copy the commands manually'), 'warn')
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
function renderAbout() {
|
|
1489
|
+
const links = [
|
|
1490
|
+
['GitHub', ABOUT_LINKS.repo],
|
|
1491
|
+
[tr('npm · 插件减负', 'npm · plugin diet'), ABOUT_LINKS.npmTrim],
|
|
1492
|
+
[tr('npm · 工作流配方', 'npm · workflow recipe'), ABOUT_LINKS.npmRecipe],
|
|
1493
|
+
[tr('发布记录', 'Releases'), ABOUT_LINKS.releases],
|
|
1494
|
+
[tr('问题反馈', 'Issues'), ABOUT_LINKS.issues],
|
|
1495
|
+
]
|
|
963
1496
|
return h(
|
|
964
1497
|
'div',
|
|
965
1498
|
{ className: 'eo-stack' },
|
|
1499
|
+
h(
|
|
1500
|
+
Card,
|
|
1501
|
+
{
|
|
1502
|
+
title: tr('关于项目', 'About the project'),
|
|
1503
|
+
subtitle: tr('插件减负、兼容性检查与工作流蓝图', 'Plugin diet, compatibility checks, and workflow recipes'),
|
|
1504
|
+
section: 'about',
|
|
1505
|
+
},
|
|
1506
|
+
h(AboutHero),
|
|
1507
|
+
h(
|
|
1508
|
+
'div',
|
|
1509
|
+
{ className: 'eo-about-grid' },
|
|
1510
|
+
h(
|
|
1511
|
+
'div',
|
|
1512
|
+
{ className: 'eo-about-card' },
|
|
1513
|
+
h('div', { className: 'eo-inline', style: { marginBottom: '8px' } }, h(Icon, { name: 'shield', size: 24 }), h('strong', null, 'DSH Experience Optimizer')),
|
|
1514
|
+
h('p', null, tr('少一点插件负担,多一点兼容确定性。', 'Less plugin overhead, more compatibility certainty.')),
|
|
1515
|
+
h('p', null, tr('版本:', 'Version: ') + '0.3.6 · AGPL-3.0-only'),
|
|
1516
|
+
h('p', null, tr('作者:Starlit Sky', 'Author: Starlit Sky')),
|
|
1517
|
+
),
|
|
1518
|
+
h(
|
|
1519
|
+
'div',
|
|
1520
|
+
{ className: 'eo-about-card' },
|
|
1521
|
+
h('h4', null, tr('项目链接', 'Project links')),
|
|
1522
|
+
h(
|
|
1523
|
+
'ul',
|
|
1524
|
+
{ className: 'eo-link-list' },
|
|
1525
|
+
links.map(([label, href]) =>
|
|
1526
|
+
h('li', { key: label }, h('a', { href, target: '_blank', rel: 'noreferrer' }, label, ' ↗')),
|
|
1527
|
+
),
|
|
1528
|
+
),
|
|
1529
|
+
),
|
|
1530
|
+
),
|
|
1531
|
+
h(
|
|
1532
|
+
'div',
|
|
1533
|
+
{ className: 'eo-inline', style: { marginTop: '12px' } },
|
|
1534
|
+
h(Button, { variant: 'accent', onClick: () => void copyInstall() }, tr('复制安装命令', 'Copy install commands')),
|
|
1535
|
+
h(Button, { variant: 'ghost', onClick: () => setTab('tutorial') }, tr('打开完整教程', 'Open full guide')),
|
|
1536
|
+
h(Button, { variant: 'ghost', onClick: replayOnboarding }, tr('重新查看新手引导', 'Replay first-run guide')),
|
|
1537
|
+
),
|
|
1538
|
+
),
|
|
1539
|
+
h(
|
|
1540
|
+
Card,
|
|
1541
|
+
{
|
|
1542
|
+
title: tr('交流与支持', 'Community & support'),
|
|
1543
|
+
subtitle: tr('真实链接优先;未填写的内容明确标为待补充', 'Real links first; unset items are clearly marked'),
|
|
1544
|
+
section: 'about',
|
|
1545
|
+
},
|
|
1546
|
+
h(
|
|
1547
|
+
'div',
|
|
1548
|
+
{ className: 'eo-about-grid' },
|
|
1549
|
+
h(
|
|
1550
|
+
'div',
|
|
1551
|
+
{ className: 'eo-about-card' },
|
|
1552
|
+
h('h4', null, tr('交流群', 'Community')),
|
|
1553
|
+
h('p', null, tr('QQ 群:', 'QQ group: ') + (ABOUT_LINKS.qqGroup || tr('待补充', 'To be added'))),
|
|
1554
|
+
ABOUT_LINKS.qqLink
|
|
1555
|
+
? h('a', { href: ABOUT_LINKS.qqLink, target: '_blank', rel: 'noreferrer' }, tr('加入群聊', 'Join group'))
|
|
1556
|
+
: h('span', { className: 'eo-muted' }, tr('群号/链接待补充', 'Group number/link to be added')),
|
|
1557
|
+
),
|
|
1558
|
+
h(
|
|
1559
|
+
'div',
|
|
1560
|
+
{ className: 'eo-about-card' },
|
|
1561
|
+
h('h4', null, tr('支持项目', 'Support the project')),
|
|
1562
|
+
ABOUT_LINKS.donate.length === 0
|
|
1563
|
+
? h('p', null, tr('捐赠方式:待补充。当前可通过反馈、文档和插件试用支持项目。', 'Donation methods: to be added. Feedback, docs, and trying the plugins are the best support today.'))
|
|
1564
|
+
: ABOUT_LINKS.donate.map((item) =>
|
|
1565
|
+
h('p', { key: item.label }, h('a', { href: item.href, target: '_blank', rel: 'noreferrer' }, item.label)),
|
|
1566
|
+
),
|
|
1567
|
+
),
|
|
1568
|
+
),
|
|
1569
|
+
h('p', { className: 'eo-copyright' }, COPYRIGHT),
|
|
1570
|
+
),
|
|
1571
|
+
h(
|
|
1572
|
+
Card,
|
|
1573
|
+
{
|
|
1574
|
+
title: tr('隐私与边界', 'Privacy & boundaries'),
|
|
1575
|
+
subtitle: tr('本地优先,只读分析,写入需确认', 'Local-first, read-only analysis, confirmed writes'),
|
|
1576
|
+
section: 'about',
|
|
1577
|
+
},
|
|
1578
|
+
h(
|
|
1579
|
+
'ul',
|
|
1580
|
+
{ className: 'eo-link-list' },
|
|
1581
|
+
h('li', null, tr('不执行 !!js、不 import 未加载插件、不联网分析。', 'No !!js execution, no importing unloaded plugins, no network analysis.')),
|
|
1582
|
+
h('li', null, tr('应用前写入还原点;恢复同样需要安全确认。', 'A restore point is written before apply; rollback also needs host approval.')),
|
|
1583
|
+
h('li', null, tr('定时/触发插件、已有调用记录、无使用账本项不会自动建议关闭。', 'Scheduled/trigger plugins, used plugins, and items without a ledger never become automatic close candidates.')),
|
|
1584
|
+
h('li', null, tr('Copyright © 2026 Starlit Sky · AGPL-3.0-only', 'Copyright © 2026 Starlit Sky · AGPL-3.0-only')),
|
|
1585
|
+
),
|
|
1586
|
+
),
|
|
1587
|
+
)
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1590
|
+
function renderTrim() {
|
|
1591
|
+
return h(
|
|
1592
|
+
'div',
|
|
1593
|
+
{
|
|
1594
|
+
className:
|
|
1595
|
+
'eo-stack' +
|
|
1596
|
+
(layout === 'two' ? ' eo-layout-two' : '') +
|
|
1597
|
+
(density === 'compact' ? ' eo-density-compact' : ''),
|
|
1598
|
+
},
|
|
1599
|
+
h(
|
|
1600
|
+
'div',
|
|
1601
|
+
{ className: 'eo-viewbar' },
|
|
1602
|
+
h('span', { className: 'eo-viewbar-label' }, tr('视图', 'View')),
|
|
1603
|
+
h(
|
|
1604
|
+
'div',
|
|
1605
|
+
{ className: 'eo-inline' },
|
|
1606
|
+
h(
|
|
1607
|
+
Button,
|
|
1608
|
+
{
|
|
1609
|
+
variant: 'ghost',
|
|
1610
|
+
className: layout === 'standard' ? 'eo-btn-active' : '',
|
|
1611
|
+
onClick: () => changeLayout('standard'),
|
|
1612
|
+
},
|
|
1613
|
+
tr('标准', 'Standard'),
|
|
1614
|
+
),
|
|
1615
|
+
h(
|
|
1616
|
+
Button,
|
|
1617
|
+
{
|
|
1618
|
+
variant: 'ghost',
|
|
1619
|
+
className: layout === 'two' ? 'eo-btn-active' : '',
|
|
1620
|
+
onClick: () => changeLayout('two'),
|
|
1621
|
+
},
|
|
1622
|
+
tr('双列', 'Two-column'),
|
|
1623
|
+
),
|
|
1624
|
+
),
|
|
1625
|
+
h('span', { className: 'eo-viewbar-label' }, tr('密度', 'Density')),
|
|
1626
|
+
h(
|
|
1627
|
+
'div',
|
|
1628
|
+
{ className: 'eo-inline' },
|
|
1629
|
+
h(
|
|
1630
|
+
Button,
|
|
1631
|
+
{
|
|
1632
|
+
variant: 'ghost',
|
|
1633
|
+
className: density === 'comfortable' ? 'eo-btn-active' : '',
|
|
1634
|
+
onClick: () => changeDensity('comfortable'),
|
|
1635
|
+
},
|
|
1636
|
+
tr('舒适', 'Comfortable'),
|
|
1637
|
+
),
|
|
1638
|
+
h(
|
|
1639
|
+
Button,
|
|
1640
|
+
{
|
|
1641
|
+
variant: 'ghost',
|
|
1642
|
+
className: density === 'compact' ? 'eo-btn-active' : '',
|
|
1643
|
+
onClick: () => changeDensity('compact'),
|
|
1644
|
+
},
|
|
1645
|
+
tr('紧凑', 'Compact'),
|
|
1646
|
+
),
|
|
1647
|
+
),
|
|
1648
|
+
h('span', { className: 'eo-viewbar-label', style: { marginLeft: 'auto' } }, tr('折叠', 'Collapse')),
|
|
1649
|
+
h(
|
|
1650
|
+
'div',
|
|
1651
|
+
{ className: 'eo-inline' },
|
|
1652
|
+
h(Button, { variant: 'ghost', onClick: collapseAllCards }, tr('全部折叠', 'Collapse all')),
|
|
1653
|
+
h(Button, { variant: 'ghost', onClick: expandAllCards }, tr('全部展开', 'Expand all')),
|
|
1654
|
+
),
|
|
1655
|
+
),
|
|
966
1656
|
h('div', { className: 'eo-grid eo-metrics' }, [
|
|
967
1657
|
h(Metric, {
|
|
968
1658
|
key: 'tokens',
|
|
969
|
-
label: '可归属上下文',
|
|
1659
|
+
label: tr('可归属上下文', 'Attributable context'),
|
|
970
1660
|
value: formatTokens(overview.context.totalTokens),
|
|
971
|
-
hint: 'tokens · 不含未归属',
|
|
1661
|
+
hint: tr('tokens · 不含未归属', 'tokens · excludes unattributed') + ' · ' + Math.round(contextPct) + '%',
|
|
1662
|
+
progress: contextPct,
|
|
1663
|
+
progressTone: 'ok',
|
|
972
1664
|
}),
|
|
973
1665
|
h(Metric, {
|
|
974
1666
|
key: 'bundles',
|
|
975
|
-
label: '启用插件',
|
|
1667
|
+
label: tr('启用插件', 'Enabled plugins'),
|
|
976
1668
|
value: enabledBundles + ' / ' + totalBundles,
|
|
977
|
-
hint: '已启用 / 全部插件',
|
|
1669
|
+
hint: tr('已启用 / 全部插件', 'enabled / total plugins'),
|
|
1670
|
+
progress: enabledPct,
|
|
978
1671
|
}),
|
|
979
1672
|
h(Metric, {
|
|
980
1673
|
key: 'compat',
|
|
981
|
-
label: '兼容性',
|
|
982
|
-
value: compat.error + ' 错 · ' + compat.warn + ' 警',
|
|
983
|
-
hint: '错误 / 警告 · 信息 ' + compat.info,
|
|
1674
|
+
label: tr('兼容性', 'Compatibility'),
|
|
1675
|
+
value: compat.error + tr(' 错 · ', ' err · ') + compat.warn + tr(' 警', ' warn'),
|
|
1676
|
+
hint: tr('错误 / 警告 · 信息 ', 'errors / warnings · info ') + compat.info,
|
|
984
1677
|
tone: compat.error > 0 ? 'danger' : compat.warn > 0 ? 'warn' : 'ok',
|
|
1678
|
+
progress: compatPct,
|
|
1679
|
+
progressTone: compat.error > 0 ? 'danger' : compat.warn > 0 ? 'warn' : 'ok',
|
|
985
1680
|
}),
|
|
986
1681
|
h(Metric, {
|
|
987
1682
|
key: 'manage',
|
|
988
|
-
label: '写操作',
|
|
989
|
-
value: overview.managementAvailable ? '可应用' : '只读',
|
|
990
|
-
hint: overview.managementAvailable ? '插件管理器可用' : '缺少插件管理器',
|
|
1683
|
+
label: tr('写操作', 'Write access'),
|
|
1684
|
+
value: overview.managementAvailable ? tr('可应用', 'Ready') : tr('只读', 'Read-only'),
|
|
1685
|
+
hint: overview.managementAvailable ? tr('插件管理器可用', 'Plugin manager available') : tr('缺少插件管理器', 'Plugin manager unavailable'),
|
|
991
1686
|
tone: overview.managementAvailable ? 'ok' : 'danger',
|
|
992
1687
|
}),
|
|
993
1688
|
]),
|
|
994
1689
|
h(
|
|
995
1690
|
Card,
|
|
996
1691
|
{
|
|
997
|
-
title: '
|
|
998
|
-
subtitle: '插件 ↔ 插件 · 插件 ↔ DSH ·
|
|
999
|
-
section: 'compat',
|
|
1692
|
+
title: tr('兼容性检查', 'Compatibility check'),
|
|
1693
|
+
subtitle: tr('插件 ↔ 插件 · 插件 ↔ DSH · 当前配置 / 工作区', 'Plugin ↔ plugin · plugin ↔ DSH · profile / workspace'),
|
|
1694
|
+
section: 'compat', collapsible: true, collapsed: collapsedCards.compat === true, onToggle: () => toggleCard('compat'),
|
|
1000
1695
|
extra: h(
|
|
1001
1696
|
'div',
|
|
1002
1697
|
{ className: 'eo-inline' },
|
|
@@ -1007,7 +1702,7 @@ window.__ModuleLoader__.load({
|
|
|
1007
1702
|
variant: 'ghost',
|
|
1008
1703
|
onClick: () => setShowAllFindings((value) => !value),
|
|
1009
1704
|
},
|
|
1010
|
-
showAllFindings ? '收起' : '查看全部 ' + findings.length,
|
|
1705
|
+
showAllFindings ? tr('收起', 'Collapse') : tr('查看全部', 'Show all') + ' ' + findings.length,
|
|
1011
1706
|
)
|
|
1012
1707
|
: null,
|
|
1013
1708
|
h(
|
|
@@ -1016,9 +1711,9 @@ window.__ModuleLoader__.load({
|
|
|
1016
1711
|
variant: 'ghost',
|
|
1017
1712
|
onClick: () => setShowInfo((value) => !value),
|
|
1018
1713
|
},
|
|
1019
|
-
showInfo ? '隐藏信息' : '显示信息',
|
|
1714
|
+
showInfo ? tr('隐藏信息', 'Hide info') : tr('显示信息', 'Show info'),
|
|
1020
1715
|
),
|
|
1021
|
-
h(Badge, { tone: compat.error ? 'danger' : 'ok' }, compat.error ? '需要处理' : '无阻断'),
|
|
1716
|
+
h(Badge, { tone: compat.error ? 'danger' : 'ok' }, compat.error ? tr('需要处理', 'Needs attention') : tr('无阻断', 'No blockers')),
|
|
1022
1717
|
),
|
|
1023
1718
|
},
|
|
1024
1719
|
h(
|
|
@@ -1026,17 +1721,17 @@ window.__ModuleLoader__.load({
|
|
|
1026
1721
|
{ className: 'eo-toolbar', style: { marginBottom: '10px' } },
|
|
1027
1722
|
h(
|
|
1028
1723
|
Field,
|
|
1029
|
-
{ label: '搜索兼容性' },
|
|
1724
|
+
{ label: tr('搜索兼容性', 'Search findings') },
|
|
1030
1725
|
h('input', {
|
|
1031
1726
|
className: 'eo-input',
|
|
1032
|
-
placeholder: '代码 / 标题 / 对象',
|
|
1727
|
+
placeholder: tr('代码 / 标题 / 对象', 'Code / title / subject'),
|
|
1033
1728
|
value: findingQuery,
|
|
1034
1729
|
onChange: (event) => setFindingQuery(event.target.value),
|
|
1035
1730
|
}),
|
|
1036
1731
|
),
|
|
1037
1732
|
h(
|
|
1038
1733
|
Field,
|
|
1039
|
-
{ label: '级别' },
|
|
1734
|
+
{ label: tr('级别', 'Severity') },
|
|
1040
1735
|
h(
|
|
1041
1736
|
'select',
|
|
1042
1737
|
{
|
|
@@ -1044,15 +1739,26 @@ window.__ModuleLoader__.load({
|
|
|
1044
1739
|
value: findingSeverity,
|
|
1045
1740
|
onChange: (event) => setFindingSeverity(event.target.value),
|
|
1046
1741
|
},
|
|
1047
|
-
h('option', { value: 'all' }, '全部'),
|
|
1048
|
-
h('option', { value: 'error' }, '错误'),
|
|
1049
|
-
h('option', { value: 'warn' }, '警告'),
|
|
1050
|
-
h('option', { value: 'info' }, '信息'),
|
|
1742
|
+
h('option', { value: 'all' }, tr('全部', 'All')),
|
|
1743
|
+
h('option', { value: 'error' }, tr('错误', 'Error')),
|
|
1744
|
+
h('option', { value: 'warn' }, tr('警告', 'Warning')),
|
|
1745
|
+
h('option', { value: 'info' }, tr('信息', 'Info')),
|
|
1051
1746
|
),
|
|
1052
1747
|
),
|
|
1053
1748
|
),
|
|
1749
|
+
h(
|
|
1750
|
+
'div',
|
|
1751
|
+
{ className: 'eo-severity-bar', 'aria-label': tr('兼容性分布', 'Compatibility distribution') },
|
|
1752
|
+
compat.error + compat.warn + compat.info === 0
|
|
1753
|
+
? h('span', { className: 'eo-severity-empty' })
|
|
1754
|
+
: [
|
|
1755
|
+
compat.error > 0 ? h('span', { key: 'e', className: 'eo-severity-error', style: { flex: compat.error } }) : null,
|
|
1756
|
+
compat.warn > 0 ? h('span', { key: 'w', className: 'eo-severity-warn', style: { flex: compat.warn } }) : null,
|
|
1757
|
+
compat.info > 0 ? h('span', { key: 'i', className: 'eo-severity-info', style: { flex: compat.info } }) : null,
|
|
1758
|
+
],
|
|
1759
|
+
),
|
|
1054
1760
|
findings.length === 0
|
|
1055
|
-
? h('div', { className: 'eo-empty' }, '没有匹配的兼容性问题。')
|
|
1761
|
+
? h('div', { className: 'eo-empty' }, tr('没有匹配的兼容性问题。', 'No matching compatibility findings.'))
|
|
1056
1762
|
: h(
|
|
1057
1763
|
'div',
|
|
1058
1764
|
{ className: 'eo-findings' },
|
|
@@ -1094,8 +1800,8 @@ window.__ModuleLoader__.load({
|
|
|
1094
1800
|
h(
|
|
1095
1801
|
Card,
|
|
1096
1802
|
{
|
|
1097
|
-
title: '上下文成本',
|
|
1098
|
-
section: 'context',
|
|
1803
|
+
title: tr('上下文成本', 'Context cost'),
|
|
1804
|
+
section: 'context', collapsible: true, collapsed: collapsedCards.context === true, onToggle: () => toggleCard('context'),
|
|
1099
1805
|
subtitle:
|
|
1100
1806
|
'总计 ' +
|
|
1101
1807
|
formatNumber(overview.context.totalTokens) +
|
|
@@ -1104,7 +1810,7 @@ window.__ModuleLoader__.load({
|
|
|
1104
1810
|
extra: h(
|
|
1105
1811
|
Button,
|
|
1106
1812
|
{ variant: 'ghost', onClick: () => setShowContext((value) => !value) },
|
|
1107
|
-
showContext ? '收起明细' : '查看明细',
|
|
1813
|
+
showContext ? tr('收起明细', 'Collapse details') : tr('查看明细', 'View details'),
|
|
1108
1814
|
),
|
|
1109
1815
|
},
|
|
1110
1816
|
h(
|
|
@@ -1142,7 +1848,7 @@ window.__ModuleLoader__.load({
|
|
|
1142
1848
|
null,
|
|
1143
1849
|
h('th', null, 'Section / Tool'),
|
|
1144
1850
|
h('th', null, 'Owner'),
|
|
1145
|
-
h('th', null, '上下文'),
|
|
1851
|
+
h('th', null, tr('上下文', 'Context')),
|
|
1146
1852
|
),
|
|
1147
1853
|
),
|
|
1148
1854
|
h(
|
|
@@ -1184,9 +1890,9 @@ window.__ModuleLoader__.load({
|
|
|
1184
1890
|
h(
|
|
1185
1891
|
Card,
|
|
1186
1892
|
{
|
|
1187
|
-
title: '插件清单',
|
|
1188
|
-
subtitle: `${filteredBundles.length} / ${totalBundles} 个匹配 ·
|
|
1189
|
-
section: 'inventory',
|
|
1893
|
+
title: tr('插件清单', 'Plugin inventory'),
|
|
1894
|
+
subtitle: `${filteredBundles.length} / ${totalBundles} ` + tr('个匹配 · 只读', 'matched · read-only'),
|
|
1895
|
+
section: 'inventory', collapsible: true, collapsed: collapsedCards.inventory === true, onToggle: () => toggleCard('inventory'),
|
|
1190
1896
|
extra: h(
|
|
1191
1897
|
Button,
|
|
1192
1898
|
{ variant: 'ghost', onClick: () => setShowAllBundles((value) => !value) },
|
|
@@ -1198,7 +1904,7 @@ window.__ModuleLoader__.load({
|
|
|
1198
1904
|
{ className: 'eo-toolbar', style: { marginBottom: '10px' } },
|
|
1199
1905
|
h(
|
|
1200
1906
|
Field,
|
|
1201
|
-
{ label: '搜索插件' },
|
|
1907
|
+
{ label: tr('搜索插件', 'Search plugins') },
|
|
1202
1908
|
h('input', {
|
|
1203
1909
|
className: 'eo-input',
|
|
1204
1910
|
placeholder: '名称 / 描述',
|
|
@@ -1208,7 +1914,7 @@ window.__ModuleLoader__.load({
|
|
|
1208
1914
|
),
|
|
1209
1915
|
h(
|
|
1210
1916
|
Field,
|
|
1211
|
-
{ label: '状态' },
|
|
1917
|
+
{ label: tr('状态', 'Status') },
|
|
1212
1918
|
h(
|
|
1213
1919
|
'select',
|
|
1214
1920
|
{
|
|
@@ -1216,15 +1922,15 @@ window.__ModuleLoader__.load({
|
|
|
1216
1922
|
value: bundleFilter,
|
|
1217
1923
|
onChange: (event) => setBundleFilter(event.target.value),
|
|
1218
1924
|
},
|
|
1219
|
-
h('option', { value: 'all' }, '全部'),
|
|
1220
|
-
h('option', { value: 'enabled' }, '启用'),
|
|
1221
|
-
h('option', { value: 'disabled' }, '禁用'),
|
|
1222
|
-
h('option', { value: 'protected' }, '受保护'),
|
|
1925
|
+
h('option', { value: 'all' }, tr('全部', 'All')),
|
|
1926
|
+
h('option', { value: 'enabled' }, tr('启用', 'Enabled')),
|
|
1927
|
+
h('option', { value: 'disabled' }, tr('禁用', 'Disabled')),
|
|
1928
|
+
h('option', { value: 'protected' }, tr('受保护', 'Protected')),
|
|
1223
1929
|
),
|
|
1224
1930
|
),
|
|
1225
1931
|
h(
|
|
1226
1932
|
Field,
|
|
1227
|
-
{ label: '排序' },
|
|
1933
|
+
{ label: tr('排序', 'Sort') },
|
|
1228
1934
|
h(
|
|
1229
1935
|
'select',
|
|
1230
1936
|
{
|
|
@@ -1232,15 +1938,18 @@ window.__ModuleLoader__.load({
|
|
|
1232
1938
|
value: bundleSort,
|
|
1233
1939
|
onChange: (event) => setBundleSort(event.target.value),
|
|
1234
1940
|
},
|
|
1235
|
-
h('option', { value: 'tokens' }, '上下文 tokens'),
|
|
1236
|
-
h('option', { value: 'usage' }, '调用次数'),
|
|
1237
|
-
h('option', { value: 'name' }, '名称'),
|
|
1941
|
+
h('option', { value: 'tokens' }, tr('上下文 tokens', 'Context tokens')),
|
|
1942
|
+
h('option', { value: 'usage' }, tr('调用次数', 'Call count')),
|
|
1943
|
+
h('option', { value: 'name' }, tr('名称', 'Name')),
|
|
1238
1944
|
),
|
|
1239
1945
|
),
|
|
1240
1946
|
),
|
|
1241
1947
|
filteredBundles.length === 0
|
|
1242
|
-
? h('div', { className: 'eo-empty' }, '没有匹配的插件。')
|
|
1948
|
+
? h('div', { className: 'eo-empty' }, tr('没有匹配的插件。', 'No matching plugins.'))
|
|
1243
1949
|
: h(
|
|
1950
|
+
'div',
|
|
1951
|
+
{ className: 'eo-table-wrap' },
|
|
1952
|
+
h(
|
|
1244
1953
|
'table',
|
|
1245
1954
|
{ className: 'eo-table' },
|
|
1246
1955
|
h(
|
|
@@ -1249,13 +1958,13 @@ window.__ModuleLoader__.load({
|
|
|
1249
1958
|
h(
|
|
1250
1959
|
'tr',
|
|
1251
1960
|
null,
|
|
1252
|
-
h('th', null, '插件'),
|
|
1253
|
-
h('th', null, '状态'),
|
|
1254
|
-
h('th',
|
|
1255
|
-
h('th',
|
|
1256
|
-
h('th', null, '上下文'),
|
|
1257
|
-
h('th', null, '占比'),
|
|
1258
|
-
h('th', null, '调用'),
|
|
1961
|
+
h('th', null, tr('插件', 'Plugin')),
|
|
1962
|
+
h('th', null, tr('状态', 'Status')),
|
|
1963
|
+
h('th', { className: 'eo-col-secondary' }, tr('保护', 'Protected')),
|
|
1964
|
+
h('th', { className: 'eo-col-secondary' }, tr('兼容状态', 'Compatibility')),
|
|
1965
|
+
h('th', null, tr('上下文', 'Context')),
|
|
1966
|
+
h('th', null, tr('占比', 'Share')),
|
|
1967
|
+
h('th', null, tr('调用', 'Calls')),
|
|
1259
1968
|
),
|
|
1260
1969
|
),
|
|
1261
1970
|
h(
|
|
@@ -1279,19 +1988,19 @@ window.__ModuleLoader__.load({
|
|
|
1279
1988
|
h(
|
|
1280
1989
|
Badge,
|
|
1281
1990
|
{ tone: bundle.enabled ? 'ok' : 'neutral' },
|
|
1282
|
-
bundle.enabled ? '已启用' : '已禁用',
|
|
1991
|
+
bundle.enabled ? tr('已启用', 'Enabled') : tr('已禁用', 'Disabled'),
|
|
1283
1992
|
),
|
|
1284
1993
|
),
|
|
1285
1994
|
h(
|
|
1286
1995
|
'td',
|
|
1287
|
-
|
|
1288
|
-
bundle.protected ? h(Badge, { tone: 'warn' }, '受保护') : '—',
|
|
1996
|
+
{ className: 'eo-col-secondary' },
|
|
1997
|
+
bundle.protected ? h(Badge, { tone: 'warn' }, tr('受保护', 'Protected')) : '—',
|
|
1289
1998
|
),
|
|
1290
|
-
h('td', { className: 'eo-muted' }, bundle.guardStatus ? guardLabel(bundle.guardStatus) : '—'),
|
|
1999
|
+
h('td', { className: 'eo-muted eo-col-secondary' }, bundle.guardStatus ? guardLabel(bundle.guardStatus) : '—'),
|
|
1291
2000
|
h('td', null, formatNumber(bundle.contextTokens)),
|
|
1292
2001
|
h(
|
|
1293
2002
|
'td',
|
|
1294
|
-
{ className: 'eo-muted', title: '占可归属上下文的比例' },
|
|
2003
|
+
{ className: 'eo-muted eo-share-cell', title: tr('占可归属上下文的比例', 'Share of attributable context') },
|
|
1295
2004
|
totalContextTokens > 0
|
|
1296
2005
|
? Math.round((bundle.contextTokens / totalContextTokens) * 100) + '%'
|
|
1297
2006
|
: '—',
|
|
@@ -1307,20 +2016,21 @@ window.__ModuleLoader__.load({
|
|
|
1307
2016
|
),
|
|
1308
2017
|
),
|
|
1309
2018
|
),
|
|
2019
|
+
),
|
|
1310
2020
|
),
|
|
1311
2021
|
h(
|
|
1312
2022
|
Card,
|
|
1313
2023
|
{
|
|
1314
|
-
title: '
|
|
1315
|
-
subtitle: '先建议,后确认;受保护项永不改动',
|
|
1316
|
-
section: 'draft',
|
|
2024
|
+
title: tr('插件减负方案', 'Slim plan'),
|
|
2025
|
+
subtitle: tr('先建议,后确认;受保护项永不改动', 'Suggest first, confirm later; protected items never change'),
|
|
2026
|
+
section: 'draft', collapsible: true, collapsed: collapsedCards.draft === true, onToggle: () => toggleCard('draft'),
|
|
1317
2027
|
},
|
|
1318
2028
|
h(
|
|
1319
2029
|
'div',
|
|
1320
2030
|
{ className: 'eo-toolbar' },
|
|
1321
2031
|
h(
|
|
1322
2032
|
Field,
|
|
1323
|
-
{ label: '任务类型' },
|
|
2033
|
+
{ label: tr('任务类型', 'Task type') },
|
|
1324
2034
|
h(
|
|
1325
2035
|
'select',
|
|
1326
2036
|
{
|
|
@@ -1328,18 +2038,18 @@ window.__ModuleLoader__.load({
|
|
|
1328
2038
|
value: taskTag,
|
|
1329
2039
|
onChange: (event) => setTaskTag(event.target.value),
|
|
1330
2040
|
},
|
|
1331
|
-
TASK_TAGS.map(([value
|
|
1332
|
-
h('option', { value, key: value },
|
|
2041
|
+
TASK_TAGS.map(([value]) =>
|
|
2042
|
+
h('option', { value, key: value }, value === 'unknown' ? tr('自动识别', 'Auto-detect') : taskLabel(value)),
|
|
1333
2043
|
),
|
|
1334
2044
|
),
|
|
1335
2045
|
),
|
|
1336
2046
|
h(
|
|
1337
2047
|
Field,
|
|
1338
|
-
{ label: '任务目标(可选)' },
|
|
2048
|
+
{ label: tr('任务目标(可选)', 'Goal (optional)') },
|
|
1339
2049
|
h('input', {
|
|
1340
2050
|
className: 'eo-input',
|
|
1341
2051
|
value: goal,
|
|
1342
|
-
placeholder: '例如:修复登录页崩溃',
|
|
2052
|
+
placeholder: tr('例如:修复登录页崩溃', 'e.g. fix a login crash'),
|
|
1343
2053
|
onChange: (event) => setGoal(event.target.value),
|
|
1344
2054
|
onKeyDown: (event) => {
|
|
1345
2055
|
if (event.key === 'Enter') void generateDraft()
|
|
@@ -1349,7 +2059,7 @@ window.__ModuleLoader__.load({
|
|
|
1349
2059
|
h(
|
|
1350
2060
|
Button,
|
|
1351
2061
|
{ variant: 'accent', onClick: generateDraft, disabled: draftBusy },
|
|
1352
|
-
draftBusy ? '生成中…' : '生成方案',
|
|
2062
|
+
draftBusy ? tr('生成中…', 'Building…') : tr('生成方案', 'Build plan'),
|
|
1353
2063
|
),
|
|
1354
2064
|
),
|
|
1355
2065
|
draft
|
|
@@ -1359,25 +2069,25 @@ window.__ModuleLoader__.load({
|
|
|
1359
2069
|
h(
|
|
1360
2070
|
'div',
|
|
1361
2071
|
{ className: 'eo-note' },
|
|
1362
|
-
'
|
|
2072
|
+
tr('判断依据:描述匹配只说明“可能相关”;出现定时/触发语义、已有调用记录、无使用账本或任务置信度不足时,只进入人工复核。只有“窗口内 0 调用 + 有上下文成本 + 非周期 + 任务高置信”才会标为建议关闭,且仍需确认与安全确认。', 'Evidence rule: a description match only means “possibly relevant”. Scheduled/trigger plugins, plugins with calls, an empty usage ledger, or low task confidence go to review. A close candidate requires zero calls in the window, attributable context cost, no schedule/trigger hint, and high task confidence — and still needs confirmation and host approval.'),
|
|
1363
2073
|
),
|
|
1364
2074
|
h(
|
|
1365
2075
|
'div',
|
|
1366
2076
|
{ className: 'eo-summary', style: { marginTop: '10px' } },
|
|
1367
|
-
h(Badge, { tone: 'neutral' }, '保留 ' + draft.summary.keep),
|
|
1368
|
-
h(Badge, { tone: 'ok' }, '启用 ' + draft.summary.enable),
|
|
1369
|
-
h(Badge, { tone: 'danger' }, '建议关闭 ' + draft.summary.disable),
|
|
1370
|
-
h(Badge, { tone: 'info' }, '复核 ' + draft.summary.review),
|
|
1371
|
-
h(Badge, { tone: 'neutral' }, '受保护 ' + draft.summary.protected),
|
|
1372
|
-
h(Badge, { tone: 'warn' }, '周期保护 ' + periodicDraftCount),
|
|
1373
|
-
h(Badge, { tone: 'ok' }, '证据强 ' + strongDraftCount),
|
|
1374
|
-
h(Badge, { tone: 'warn' }, '任务:' + taskLabel(draft.task.tag)),
|
|
2077
|
+
h(Badge, { tone: 'neutral' }, tr('保留', 'Keep') + ' ' + draft.summary.keep),
|
|
2078
|
+
h(Badge, { tone: 'ok' }, tr('启用', 'Enable') + ' ' + draft.summary.enable),
|
|
2079
|
+
h(Badge, { tone: 'danger' }, tr('建议关闭', 'Close') + ' ' + draft.summary.disable),
|
|
2080
|
+
h(Badge, { tone: 'info' }, tr('复核', 'Review') + ' ' + draft.summary.review),
|
|
2081
|
+
h(Badge, { tone: 'neutral' }, tr('受保护', 'Protected') + ' ' + draft.summary.protected),
|
|
2082
|
+
h(Badge, { tone: 'warn' }, tr('周期保护', 'Scheduled') + ' ' + periodicDraftCount),
|
|
2083
|
+
h(Badge, { tone: 'ok' }, tr('证据强', 'Strong evidence') + ' ' + strongDraftCount),
|
|
2084
|
+
h(Badge, { tone: 'warn' }, tr('任务:', 'Task: ') + taskLabel(draft.task.tag)),
|
|
1375
2085
|
),
|
|
1376
2086
|
actionableDraftItems.length === 0
|
|
1377
2087
|
? h(
|
|
1378
2088
|
'div',
|
|
1379
2089
|
{ className: 'eo-empty' },
|
|
1380
|
-
'本轮没有强证据候选:周期/触发器、已有调用记录、无使用账本或低置信项只进入人工复核。',
|
|
2090
|
+
tr('本轮没有强证据候选:周期/触发器、已有调用记录、无使用账本或低置信项只进入人工复核。', 'No strong candidates this round: scheduled/trigger plugins, used plugins, missing ledger, or low confidence all go to review.'),
|
|
1381
2091
|
)
|
|
1382
2092
|
: h(
|
|
1383
2093
|
'div',
|
|
@@ -1397,9 +2107,9 @@ window.__ModuleLoader__.load({
|
|
|
1397
2107
|
type: 'checkbox',
|
|
1398
2108
|
checked: selected[item.id] === true,
|
|
1399
2109
|
onChange: () => toggleItem(item.id),
|
|
1400
|
-
'aria-label': '选择 ' + item.name,
|
|
2110
|
+
'aria-label': tr('选择 ', 'Select ') + item.name,
|
|
1401
2111
|
})
|
|
1402
|
-
: h('span', { className: 'eo-lock', title: '受保护或非低风险' }),
|
|
2112
|
+
: h('span', { className: 'eo-lock', title: tr('受保护或非低风险', 'Protected or not low-risk') }),
|
|
1403
2113
|
h(
|
|
1404
2114
|
'div',
|
|
1405
2115
|
{ className: 'eo-item-main' },
|
|
@@ -1412,9 +2122,9 @@ window.__ModuleLoader__.load({
|
|
|
1412
2122
|
{ tone: actionTone(item.action) },
|
|
1413
2123
|
actionLabel(item.action),
|
|
1414
2124
|
),
|
|
1415
|
-
h(Badge, { tone: riskTone(item.risk) }, '风险:' + riskLabel(item.risk)),
|
|
1416
|
-
item.protected ? h(Badge, { tone: 'neutral' }, '受保护') : null,
|
|
1417
|
-
item.periodic ? h(Badge, { tone: 'warn' }, '周期/触发器') : null,
|
|
2125
|
+
h(Badge, { tone: riskTone(item.risk) }, tr('风险:', 'Risk: ') + riskLabel(item.risk)),
|
|
2126
|
+
item.protected ? h(Badge, { tone: 'neutral' }, tr('受保护', 'Protected')) : null,
|
|
2127
|
+
item.periodic ? h(Badge, { tone: 'warn' }, tr('周期/触发器', 'Scheduled / trigger')) : null,
|
|
1418
2128
|
item.usageState
|
|
1419
2129
|
? h(
|
|
1420
2130
|
Badge,
|
|
@@ -1430,9 +2140,9 @@ window.__ModuleLoader__.load({
|
|
|
1430
2140
|
)
|
|
1431
2141
|
: null,
|
|
1432
2142
|
item.evidenceLevel === 'strong'
|
|
1433
|
-
? h(Badge, { tone: 'ok' }, '证据强')
|
|
2143
|
+
? h(Badge, { tone: 'ok' }, tr('证据强', 'Strong evidence'))
|
|
1434
2144
|
: item.evidenceLevel === 'insufficient'
|
|
1435
|
-
? h(Badge, { tone: 'neutral' }, '证据不足')
|
|
2145
|
+
? h(Badge, { tone: 'neutral' }, tr('证据不足', 'Insufficient evidence'))
|
|
1436
2146
|
: null,
|
|
1437
2147
|
),
|
|
1438
2148
|
h('div', { className: 'eo-item-reason' }, item.reason),
|
|
@@ -1452,7 +2162,7 @@ window.__ModuleLoader__.load({
|
|
|
1452
2162
|
'div',
|
|
1453
2163
|
{ className: 'eo-item-side' },
|
|
1454
2164
|
h('span', null, Number(item.score).toFixed(2)),
|
|
1455
|
-
h('small', null, '评分'),
|
|
2165
|
+
h('small', null, tr('评分', 'Score')),
|
|
1456
2166
|
),
|
|
1457
2167
|
),
|
|
1458
2168
|
),
|
|
@@ -1463,13 +2173,13 @@ window.__ModuleLoader__.load({
|
|
|
1463
2173
|
h(
|
|
1464
2174
|
'span',
|
|
1465
2175
|
{ className: 'eo-applybar-text' },
|
|
1466
|
-
selectedCount + ' 个低风险项已选择 ·
|
|
2176
|
+
selectedCount + tr(' 个低风险项已选择 · 应用前会写入还原点', ' low-risk items selected · a restore point is written before apply'),
|
|
1467
2177
|
),
|
|
1468
2178
|
h(
|
|
1469
2179
|
'div',
|
|
1470
2180
|
{ className: 'eo-inline' },
|
|
1471
|
-
h(Button, { variant: 'ghost', onClick: selectAll }, '全选低风险'),
|
|
1472
|
-
h(Button, { variant: 'ghost', onClick: clearSelection }, '清空'),
|
|
2181
|
+
h(Button, { variant: 'ghost', onClick: selectAll }, tr('全选低风险', 'Select low-risk')),
|
|
2182
|
+
h(Button, { variant: 'ghost', onClick: clearSelection }, tr('清空', 'Clear')),
|
|
1473
2183
|
h(
|
|
1474
2184
|
Button,
|
|
1475
2185
|
{
|
|
@@ -1477,12 +2187,12 @@ window.__ModuleLoader__.load({
|
|
|
1477
2187
|
onClick: openApply,
|
|
1478
2188
|
disabled: selectedCount === 0 || draftBusy,
|
|
1479
2189
|
},
|
|
1480
|
-
'应用选中',
|
|
2190
|
+
tr('应用选中', 'Apply selected'),
|
|
1481
2191
|
),
|
|
1482
2192
|
h(
|
|
1483
2193
|
Button,
|
|
1484
2194
|
{ variant: 'danger', onClick: openRollback, disabled: draftBusy },
|
|
1485
|
-
'
|
|
2195
|
+
tr('恢复最近', 'Restore latest'),
|
|
1486
2196
|
),
|
|
1487
2197
|
),
|
|
1488
2198
|
),
|
|
@@ -1490,20 +2200,20 @@ window.__ModuleLoader__.load({
|
|
|
1490
2200
|
: h(
|
|
1491
2201
|
'div',
|
|
1492
2202
|
{ className: 'eo-empty' },
|
|
1493
|
-
'生成方案后,这里会出现可解释的保留/启用/禁用建议。建议默认不会改动任何插件。',
|
|
2203
|
+
tr('生成方案后,这里会出现可解释的保留/启用/禁用建议。建议默认不会改动任何插件。', 'After building a plan, explainable keep/enable/disable suggestions appear here. Nothing changes by default.'),
|
|
1494
2204
|
),
|
|
1495
2205
|
),
|
|
1496
2206
|
applyResult
|
|
1497
2207
|
? h(
|
|
1498
2208
|
Card,
|
|
1499
2209
|
{
|
|
1500
|
-
title: '应用结果',
|
|
1501
|
-
subtitle: applyResult.rolledBack ? '
|
|
1502
|
-
section: 'result',
|
|
2210
|
+
title: tr('应用结果', 'Apply result'),
|
|
2211
|
+
subtitle: applyResult.rolledBack ? tr('中途失败,已自动恢复', 'Failed midway; automatically restored') : tr('变更已写入当前配置', 'Changes written to the current profile'),
|
|
2212
|
+
section: 'result', collapsible: true, collapsed: collapsedCards.result === true, onToggle: () => toggleCard('result'),
|
|
1503
2213
|
extra: h(
|
|
1504
2214
|
Badge,
|
|
1505
2215
|
{ tone: applyResult.rolledBack ? 'warn' : 'ok' },
|
|
1506
|
-
applyResult.rolledBack ? '
|
|
2216
|
+
applyResult.rolledBack ? tr('已恢复', 'Restored') : tr('完成', 'Done'),
|
|
1507
2217
|
),
|
|
1508
2218
|
},
|
|
1509
2219
|
h(
|
|
@@ -1515,10 +2225,10 @@ window.__ModuleLoader__.load({
|
|
|
1515
2225
|
h(
|
|
1516
2226
|
'tr',
|
|
1517
2227
|
null,
|
|
1518
|
-
h('th', null, 'Item'),
|
|
1519
|
-
h('th', null, 'Status'),
|
|
1520
|
-
h('th', null, 'Application'),
|
|
1521
|
-
h('th', null, 'Note'),
|
|
2228
|
+
h('th', null, tr('项目', 'Item')),
|
|
2229
|
+
h('th', null, tr('状态', 'Status')),
|
|
2230
|
+
h('th', null, tr('应用方式', 'Application')),
|
|
2231
|
+
h('th', null, tr('说明', 'Note')),
|
|
1522
2232
|
),
|
|
1523
2233
|
),
|
|
1524
2234
|
h(
|
|
@@ -1570,7 +2280,7 @@ window.__ModuleLoader__.load({
|
|
|
1570
2280
|
onClick: () => {
|
|
1571
2281
|
if (navigator.clipboard) {
|
|
1572
2282
|
void navigator.clipboard.writeText(applyResult.token)
|
|
1573
|
-
notify('
|
|
2283
|
+
notify(tr('还原点已复制', 'Restore point copied'))
|
|
1574
2284
|
}
|
|
1575
2285
|
},
|
|
1576
2286
|
},
|
|
@@ -1590,7 +2300,7 @@ window.__ModuleLoader__.load({
|
|
|
1590
2300
|
draft && draft.dedupe && draft.dedupe.length > 0
|
|
1591
2301
|
? h(
|
|
1592
2302
|
Card,
|
|
1593
|
-
{ title: '
|
|
2303
|
+
{ title: tr('跨插件提示词重复', 'Cross-plugin prompt duplication'), subtitle: tr('只建议,不修改第三方源码', 'Suggestion only; never edits third-party source'), section: 'dedupe', collapsible: true, collapsed: collapsedCards.dedupe === true, onToggle: () => toggleCard('dedupe') },
|
|
1594
2304
|
h(
|
|
1595
2305
|
'div',
|
|
1596
2306
|
{ className: 'eo-list' },
|
|
@@ -1645,26 +2355,26 @@ window.__ModuleLoader__.load({
|
|
|
1645
2355
|
h(
|
|
1646
2356
|
Card,
|
|
1647
2357
|
{
|
|
1648
|
-
title: '工作流配方',
|
|
1649
|
-
subtitle: '把业务目标翻译成可校验、可导出的工作流蓝图',
|
|
1650
|
-
extra: h(Badge, { tone: 'info' }, '最多 4 组追问'),
|
|
2358
|
+
title: tr('工作流配方', 'Workflow recipe'),
|
|
2359
|
+
subtitle: tr('把业务目标翻译成可校验、可导出的工作流蓝图', 'Turn a business goal into a validated, exportable workflow blueprint'),
|
|
2360
|
+
extra: h(Badge, { tone: 'info' }, tr('最多 4 组追问', 'At most 4 question groups')),
|
|
1651
2361
|
},
|
|
1652
2362
|
h(
|
|
1653
2363
|
'div',
|
|
1654
2364
|
{ className: 'eo-form-grid' },
|
|
1655
2365
|
h(
|
|
1656
2366
|
Field,
|
|
1657
|
-
{ label: '业务目标', className: 'eo-wide' },
|
|
2367
|
+
{ label: tr('业务目标', 'Goal'), className: 'eo-wide' },
|
|
1658
2368
|
h('textarea', {
|
|
1659
2369
|
className: 'eo-textarea',
|
|
1660
2370
|
value: recipeForm.goal,
|
|
1661
|
-
placeholder: '例如:我想每周自动整理项目周报,数据来自 Git log',
|
|
2371
|
+
placeholder: tr('例如:我想每周自动整理项目周报,数据来自 Git log', 'e.g. a weekly project report from Git log'),
|
|
1662
2372
|
onChange: (event) => updateRecipe('goal', event.target.value),
|
|
1663
2373
|
}),
|
|
1664
2374
|
),
|
|
1665
2375
|
h(
|
|
1666
2376
|
Field,
|
|
1667
|
-
{ label: '项目 / 范围' },
|
|
2377
|
+
{ label: tr('项目 / 范围', 'Project / scope') },
|
|
1668
2378
|
h('input', {
|
|
1669
2379
|
className: 'eo-input',
|
|
1670
2380
|
value: recipeForm.scope,
|
|
@@ -1673,7 +2383,7 @@ window.__ModuleLoader__.load({
|
|
|
1673
2383
|
),
|
|
1674
2384
|
h(
|
|
1675
2385
|
Field,
|
|
1676
|
-
{ label: '频率' },
|
|
2386
|
+
{ label: tr('频率', 'Frequency') },
|
|
1677
2387
|
h('input', {
|
|
1678
2388
|
className: 'eo-input',
|
|
1679
2389
|
value: recipeForm.frequency,
|
|
@@ -1682,7 +2392,7 @@ window.__ModuleLoader__.load({
|
|
|
1682
2392
|
),
|
|
1683
2393
|
h(
|
|
1684
2394
|
Field,
|
|
1685
|
-
{ label: '数据来源', hint: '逗号分隔' },
|
|
2395
|
+
{ label: tr('数据来源', 'Sources'), hint: tr('逗号分隔', 'comma-separated') },
|
|
1686
2396
|
h('input', {
|
|
1687
2397
|
className: 'eo-input',
|
|
1688
2398
|
value: recipeForm.sources,
|
|
@@ -1691,7 +2401,7 @@ window.__ModuleLoader__.load({
|
|
|
1691
2401
|
),
|
|
1692
2402
|
h(
|
|
1693
2403
|
Field,
|
|
1694
|
-
{ label: '输出格式' },
|
|
2404
|
+
{ label: tr('输出格式', 'Output format') },
|
|
1695
2405
|
h('input', {
|
|
1696
2406
|
className: 'eo-input',
|
|
1697
2407
|
value: recipeForm.outputFormat,
|
|
@@ -1700,7 +2410,7 @@ window.__ModuleLoader__.load({
|
|
|
1700
2410
|
),
|
|
1701
2411
|
h(
|
|
1702
2412
|
Field,
|
|
1703
|
-
{ label: '交付方式' },
|
|
2413
|
+
{ label: tr('交付方式', 'Delivery') },
|
|
1704
2414
|
h('input', {
|
|
1705
2415
|
className: 'eo-input',
|
|
1706
2416
|
value: recipeForm.delivery,
|
|
@@ -1709,7 +2419,7 @@ window.__ModuleLoader__.load({
|
|
|
1709
2419
|
),
|
|
1710
2420
|
h(
|
|
1711
2421
|
Field,
|
|
1712
|
-
{ label: '失败处理' },
|
|
2422
|
+
{ label: tr('失败处理', 'Failure handling') },
|
|
1713
2423
|
h('input', {
|
|
1714
2424
|
className: 'eo-input',
|
|
1715
2425
|
value: recipeForm.onFailure,
|
|
@@ -1718,7 +2428,7 @@ window.__ModuleLoader__.load({
|
|
|
1718
2428
|
),
|
|
1719
2429
|
h(
|
|
1720
2430
|
Field,
|
|
1721
|
-
{ label: '验收标准', hint: '逗号分隔', className: 'eo-wide' },
|
|
2431
|
+
{ label: tr('验收标准', 'Acceptance criteria'), hint: tr('逗号分隔', 'comma-separated'), className: 'eo-wide' },
|
|
1722
2432
|
h('input', {
|
|
1723
2433
|
className: 'eo-input',
|
|
1724
2434
|
value: recipeForm.acceptance,
|
|
@@ -1732,12 +2442,12 @@ window.__ModuleLoader__.load({
|
|
|
1732
2442
|
h(
|
|
1733
2443
|
'span',
|
|
1734
2444
|
{ className: 'eo-muted' },
|
|
1735
|
-
'UI 预览按内置能力目录判断可用性;精确 agent-scope 校验以 recipe_plan_workflow 工具为准。',
|
|
2445
|
+
tr('UI 预览按内置能力目录判断可用性;精确 agent-scope 校验以 recipe_plan_workflow 工具为准。', 'The UI preview uses the built-in capability catalog; exact agent-scope validation is provided by recipe_plan_workflow.'),
|
|
1736
2446
|
),
|
|
1737
2447
|
h(
|
|
1738
2448
|
Button,
|
|
1739
2449
|
{ variant: 'accent', onClick: generateRecipe, disabled: recipeBusy },
|
|
1740
|
-
recipeBusy ? '生成中…' : '生成工作流蓝图',
|
|
2450
|
+
recipeBusy ? tr('生成中…', 'Building…') : tr('生成工作流蓝图', 'Build workflow blueprint'),
|
|
1741
2451
|
),
|
|
1742
2452
|
),
|
|
1743
2453
|
),
|
|
@@ -1746,7 +2456,7 @@ window.__ModuleLoader__.load({
|
|
|
1746
2456
|
: h(
|
|
1747
2457
|
'div',
|
|
1748
2458
|
{ className: 'eo-empty' },
|
|
1749
|
-
'填写目标后生成蓝图。这里只生成计划,不会创建 schedule,也不会修改插件。',
|
|
2459
|
+
tr('填写目标后生成蓝图。这里只生成计划,不会创建 schedule,也不会修改插件。', 'Fill in a goal to generate a blueprint. This only plans; it creates no schedule and changes no plugin.'),
|
|
1750
2460
|
),
|
|
1751
2461
|
)
|
|
1752
2462
|
}
|
|
@@ -1759,19 +2469,19 @@ window.__ModuleLoader__.load({
|
|
|
1759
2469
|
h(
|
|
1760
2470
|
Card,
|
|
1761
2471
|
{
|
|
1762
|
-
title: '蓝图预览',
|
|
2472
|
+
title: tr('蓝图预览', 'Blueprint preview'),
|
|
1763
2473
|
subtitle:
|
|
1764
|
-
'模板 ' +
|
|
2474
|
+
tr('模板 ', 'Template ') +
|
|
1765
2475
|
blueprint.template +
|
|
1766
2476
|
' · ' +
|
|
1767
2477
|
blueprint.steps.length +
|
|
1768
|
-
' 个步骤 · ' +
|
|
2478
|
+
tr(' 个步骤 · ', ' steps · ') +
|
|
1769
2479
|
blueprint.minPluginSet.length +
|
|
1770
|
-
' 个最小插件',
|
|
2480
|
+
tr(' 个最小插件', ' minimum plugins'),
|
|
1771
2481
|
extra: h(
|
|
1772
2482
|
'div',
|
|
1773
2483
|
{ className: 'eo-inline' },
|
|
1774
|
-
h(Button, { variant: 'ghost', onClick: exportRecipe }, '导出运行手册'),
|
|
2484
|
+
h(Button, { variant: 'ghost', onClick: exportRecipe }, tr('导出运行手册', 'Export runbook')),
|
|
1775
2485
|
),
|
|
1776
2486
|
},
|
|
1777
2487
|
h(
|
|
@@ -1849,7 +2559,7 @@ window.__ModuleLoader__.load({
|
|
|
1849
2559
|
h(
|
|
1850
2560
|
'div',
|
|
1851
2561
|
{ className: 'eo-issue' },
|
|
1852
|
-
h('span', null, h('strong', null, '
|
|
2562
|
+
h('span', null, h('strong', null, tr('恢复:', 'Restore: ')), blueprint.rollback),
|
|
1853
2563
|
),
|
|
1854
2564
|
),
|
|
1855
2565
|
h(
|
|
@@ -1939,13 +2649,13 @@ window.__ModuleLoader__.load({
|
|
|
1939
2649
|
h(
|
|
1940
2650
|
'div',
|
|
1941
2651
|
{ className: 'eo-modal', onClick: (event) => event.stopPropagation() },
|
|
1942
|
-
h('h3', null, isApply ? '确认应用精简方案' : '
|
|
2652
|
+
h('h3', null, isApply ? tr('确认应用精简方案', 'Confirm slim plan') : tr('确认恢复', 'Confirm restore')),
|
|
1943
2653
|
h(
|
|
1944
2654
|
'p',
|
|
1945
2655
|
null,
|
|
1946
2656
|
isApply
|
|
1947
|
-
? '
|
|
1948
|
-
: '将恢复最近一次应用前的插件启用状态;已被外部改动的项会跳过。',
|
|
2657
|
+
? tr('只会应用低风险项;受保护项不会被改动。应用前会写入还原点。', 'Only low-risk items are applied; protected items never change. A restore point is written first.')
|
|
2658
|
+
: tr('将恢复最近一次应用前的插件启用状态;已被外部改动的项会跳过。', 'Restores plugin state before the latest apply; externally changed items are skipped.'),
|
|
1949
2659
|
),
|
|
1950
2660
|
isApply
|
|
1951
2661
|
? h(
|
|
@@ -1963,7 +2673,7 @@ window.__ModuleLoader__.load({
|
|
|
1963
2673
|
{ className: 'eo-item-title' },
|
|
1964
2674
|
h('span', { className: 'eo-item-name' }, item.name),
|
|
1965
2675
|
h(Badge, { tone: actionTone(item.action) }, actionLabel(item.action)),
|
|
1966
|
-
h(Badge, { tone: riskTone(item.risk) }, '风险:' + riskLabel(item.risk)),
|
|
2676
|
+
h(Badge, { tone: riskTone(item.risk) }, tr('风险:', 'Risk: ') + riskLabel(item.risk)),
|
|
1967
2677
|
),
|
|
1968
2678
|
h('div', { className: 'eo-item-reason' }, item.reason),
|
|
1969
2679
|
),
|
|
@@ -1974,11 +2684,11 @@ window.__ModuleLoader__.load({
|
|
|
1974
2684
|
h(
|
|
1975
2685
|
'div',
|
|
1976
2686
|
{ className: 'eo-modal-actions' },
|
|
1977
|
-
h(Button, { variant: 'ghost', onClick: onCancel, disabled: busy }, '取消'),
|
|
2687
|
+
h(Button, { variant: 'ghost', onClick: onCancel, disabled: busy }, tr('取消', 'Cancel')),
|
|
1978
2688
|
h(
|
|
1979
2689
|
Button,
|
|
1980
2690
|
{ variant: isApply ? 'accent' : 'danger', onClick: onConfirm, disabled: busy },
|
|
1981
|
-
busy ? '处理中…' : isApply ? '确认应用' : '
|
|
2691
|
+
busy ? tr('处理中…', 'Working…') : isApply ? tr('确认应用', 'Confirm apply') : tr('确认恢复', 'Confirm restore'),
|
|
1982
2692
|
),
|
|
1983
2693
|
),
|
|
1984
2694
|
),
|