dsh-plugin-trim 0.3.4 → 0.3.5
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 +815 -271
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -23,6 +23,175 @@ 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: '',
|
|
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
|
+
|
|
26
195
|
const CSS = `
|
|
27
196
|
.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
197
|
.eo-root *{box-sizing:border-box}
|
|
@@ -32,15 +201,49 @@ window.__ModuleLoader__.load({
|
|
|
32
201
|
.eo-sub{margin:4px 0 0;color:var(--eo-tertiary);font-size:13px;line-height:20px}
|
|
33
202
|
.eo-hero-actions{display:flex;align-items:center;gap:8px;flex:0 0 auto}
|
|
34
203
|
.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-
|
|
204
|
+
.eo-tabs{display:flex;gap:18px;border-bottom:.5px solid var(--eo-border);margin:0;overflow-x:auto;scrollbar-width:none}
|
|
205
|
+
.eo-tabs::-webkit-scrollbar{display:none}
|
|
206
|
+
.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}
|
|
207
|
+
.eo-icon{flex:0 0 auto}
|
|
208
|
+
.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}
|
|
209
|
+
.eo-progress-track i{display:block;height:100%;border-radius:4px;background:var(--eo-primary);opacity:.65;transition:width .2s ease;min-width:2px}
|
|
210
|
+
.eo-severity-bar{display:flex;gap:3px;height:5px;margin:0 0 10px}
|
|
211
|
+
.eo-severity-bar span{display:block;height:100%;border-radius:3px}
|
|
212
|
+
.eo-severity-error{background:var(--eo-error)}
|
|
213
|
+
.eo-severity-warn{background:var(--dsw-alias-state-warning-primary,#9a6700)}
|
|
214
|
+
.eo-severity-info{background:var(--dsw-alias-state-business-primary,#4a7fd6)}
|
|
215
|
+
.eo-severity-empty{background:var(--dsw-alias-bg-module-platform,rgba(127,127,127,.12));flex:1}
|
|
216
|
+
.eo-progress-ok i{background:var(--eo-success)}
|
|
217
|
+
.eo-progress-warn i{background:var(--dsw-alias-state-warning-primary,#9a6700)}
|
|
218
|
+
.eo-progress-danger i{background:var(--eo-error)}
|
|
219
|
+
.eo-progress-dots{display:flex;gap:6px;align-items:center;margin:12px 0 2px}
|
|
220
|
+
.eo-progress-dot{width:6px;height:6px;border-radius:50%;background:var(--eo-border-strong)}
|
|
221
|
+
.eo-progress-dot-active{width:18px;border-radius:4px;background:var(--eo-primary)}
|
|
222
|
+
.eo-onboarding{width:min(560px,100%)}
|
|
223
|
+
.eo-onboarding-head{display:flex;gap:12px;align-items:flex-start;margin-bottom:10px}
|
|
224
|
+
.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}
|
|
225
|
+
.eo-onboarding-kicker{font:500 10px/16px var(--eo-code);letter-spacing:.12em;text-transform:uppercase;color:var(--eo-tertiary)}
|
|
226
|
+
.eo-onboarding h3{margin:2px 0 0;font-size:18px;line-height:26px}
|
|
227
|
+
.eo-about-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
|
|
228
|
+
.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))}
|
|
229
|
+
.eo-about-card h4{margin:0 0 6px;font-size:13px;line-height:20px;font-weight:500}
|
|
230
|
+
.eo-about-card p,.eo-about-card li{font-size:12px;line-height:19px;color:var(--eo-tertiary)}
|
|
231
|
+
.eo-link-list{display:flex;flex-direction:column;gap:6px;margin:0;padding:0;list-style:none}
|
|
232
|
+
.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}
|
|
233
|
+
.eo-link-list a:hover{text-decoration:underline}
|
|
234
|
+
.eo-about-icon{width:64px;height:64px;border-radius:18px;object-fit:cover;display:block;margin:0 auto}
|
|
235
|
+
.eo-copyright{text-align:center;color:var(--eo-tertiary);font-size:11px;line-height:17px;margin-top:8px}
|
|
236
|
+
.eo-install-command{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
|
|
237
|
+
.eo-table-wrap{overflow-x:auto}
|
|
238
|
+
.eo-share-cell{min-width:64px}
|
|
239
|
+
@media(max-width:680px){.eo-col-secondary{display:none}.eo-about-grid{grid-template-columns:1fr}}
|
|
37
240
|
.eo-tab:hover{color:var(--eo-primary)}
|
|
38
241
|
.eo-tab-active{color:var(--eo-primary);font-weight:500}
|
|
39
242
|
.eo-tab-active:after{content:"";position:absolute;left:0;right:0;bottom:-1px;height:1.5px;background:var(--eo-primary);border-radius:1px}
|
|
40
243
|
.eo-stack{display:flex;flex-direction:column;gap:14px}
|
|
41
244
|
.eo-stack>.eo-metrics{order:0}
|
|
42
|
-
.eo-stack>[data-section="
|
|
43
|
-
.eo-stack>[data-section="
|
|
245
|
+
.eo-stack>[data-section="draft"]{order:1}
|
|
246
|
+
.eo-stack>[data-section="inventory"]{order:2}
|
|
44
247
|
.eo-stack>[data-section="compat"]{order:3}
|
|
45
248
|
.eo-stack>[data-section="context"]{order:4}
|
|
46
249
|
.eo-stack>[data-section="result"]{order:5}
|
|
@@ -197,13 +400,14 @@ window.__ModuleLoader__.load({
|
|
|
197
400
|
return h('span', { className: 'eo-badge eo-badge-' + tone }, children)
|
|
198
401
|
}
|
|
199
402
|
|
|
200
|
-
function Metric({ label, value, hint, tone = 'neutral' }) {
|
|
403
|
+
function Metric({ label, value, hint, tone = 'neutral', progress, progressTone = 'neutral' }) {
|
|
201
404
|
return h(
|
|
202
405
|
'div',
|
|
203
406
|
{ className: 'eo-metric' },
|
|
204
407
|
h('div', { className: 'eo-metric-label' }, label),
|
|
205
408
|
h('div', { className: 'eo-metric-value', 'data-tone': tone }, value),
|
|
206
409
|
hint ? h('div', { className: 'eo-metric-hint' }, hint) : null,
|
|
410
|
+
progress !== undefined ? h(Progress, { value: progress, tone: progressTone, label: label }) : null,
|
|
207
411
|
)
|
|
208
412
|
}
|
|
209
413
|
|
|
@@ -253,15 +457,15 @@ window.__ModuleLoader__.load({
|
|
|
253
457
|
}
|
|
254
458
|
|
|
255
459
|
function actionLabel(action) {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
)
|
|
460
|
+
const map = {
|
|
461
|
+
keep: ['保留', 'Keep'],
|
|
462
|
+
enable: ['建议启用', 'Enable candidate'],
|
|
463
|
+
'suggest-disable': ['建议关闭', 'Close candidate'],
|
|
464
|
+
'disable-if-unused': ['未用可关闭', 'Unused candidate'],
|
|
465
|
+
review: ['人工复核', 'Review'],
|
|
466
|
+
}
|
|
467
|
+
const pair = map[action]
|
|
468
|
+
return pair ? tr(pair[0], pair[1]) : action
|
|
265
469
|
}
|
|
266
470
|
|
|
267
471
|
function actionTone(action) {
|
|
@@ -289,7 +493,7 @@ window.__ModuleLoader__.load({
|
|
|
289
493
|
{
|
|
290
494
|
'plugin-runtime': '插件 ↔ DSH',
|
|
291
495
|
'plugin-plugin': '插件 ↔ 插件',
|
|
292
|
-
profile: '
|
|
496
|
+
profile: tr('当前配置', 'Current profile'),
|
|
293
497
|
workspace: '工作区',
|
|
294
498
|
}[domain] || domain
|
|
295
499
|
)
|
|
@@ -304,41 +508,49 @@ window.__ModuleLoader__.load({
|
|
|
304
508
|
}
|
|
305
509
|
|
|
306
510
|
function taskLabel(tag) {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
)
|
|
511
|
+
const map = {
|
|
512
|
+
bugfix: ['修复', 'Bugfix'],
|
|
513
|
+
feature: ['新功能', 'Feature'],
|
|
514
|
+
review: ['审查', 'Review'],
|
|
515
|
+
docs: ['文档', 'Docs'],
|
|
516
|
+
release: ['发布', 'Release'],
|
|
517
|
+
report: ['报告', 'Report'],
|
|
518
|
+
research: ['调研', 'Research'],
|
|
519
|
+
unknown: ['未知', 'Unknown'],
|
|
520
|
+
}
|
|
521
|
+
const pair = map[tag]
|
|
522
|
+
return pair ? tr(pair[0], pair[1]) : tag
|
|
319
523
|
}
|
|
320
524
|
|
|
321
525
|
function riskLabel(risk) {
|
|
322
|
-
|
|
526
|
+
const pair = { low: ['低', 'Low'], medium: ['中', 'Medium'], high: ['高', 'High'] }[risk]
|
|
527
|
+
return pair ? tr(pair[0], pair[1]) : risk
|
|
323
528
|
}
|
|
324
529
|
|
|
325
530
|
function guardLabel(status) {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
)
|
|
531
|
+
const pair = {
|
|
532
|
+
ok: ['正常', 'OK'],
|
|
533
|
+
protected: ['受保护', 'Protected'],
|
|
534
|
+
incompatible: ['不兼容', 'Incompatible'],
|
|
535
|
+
warn: ['警告', 'Warning'],
|
|
536
|
+
}[status]
|
|
537
|
+
return pair ? tr(pair[0], pair[1]) : status
|
|
334
538
|
}
|
|
335
539
|
|
|
336
540
|
function usageLabel(state) {
|
|
337
|
-
return state === 'used'
|
|
541
|
+
return state === 'used'
|
|
542
|
+
? tr('有调用记录', 'Used before')
|
|
543
|
+
: state === 'unused'
|
|
544
|
+
? tr('窗口内 0 调用', 'No calls in window')
|
|
545
|
+
: tr('无使用账本', 'No usage ledger')
|
|
338
546
|
}
|
|
339
547
|
|
|
340
548
|
function evidenceLabel(level) {
|
|
341
|
-
return level === 'strong'
|
|
549
|
+
return level === 'strong'
|
|
550
|
+
? tr('证据强', 'Strong evidence')
|
|
551
|
+
: level === 'weak'
|
|
552
|
+
? tr('证据弱', 'Weak evidence')
|
|
553
|
+
: tr('证据不足', 'Insufficient evidence')
|
|
342
554
|
}
|
|
343
555
|
|
|
344
556
|
function splitList(value) {
|
|
@@ -371,8 +583,176 @@ window.__ModuleLoader__.load({
|
|
|
371
583
|
return body.data
|
|
372
584
|
}
|
|
373
585
|
|
|
586
|
+
const ICON_PATHS = {
|
|
587
|
+
gauge: [
|
|
588
|
+
['path', { d: 'M4 15a8 8 0 1 1 16 0' }],
|
|
589
|
+
['path', { d: 'M12 15l4-5' }],
|
|
590
|
+
['circle', { cx: '12', cy: '15', r: '1.4', fill: 'currentColor', stroke: 'none' }],
|
|
591
|
+
],
|
|
592
|
+
recipe: [
|
|
593
|
+
['path', { d: 'M5 4h11a2 2 0 0 1 2 2v14H7a2 2 0 0 1-2-2z' }],
|
|
594
|
+
['path', { d: 'M8 8h7M8 12h7M8 16h4' }],
|
|
595
|
+
],
|
|
596
|
+
book: [
|
|
597
|
+
['path', { d: 'M4 5.5A2.5 2.5 0 0 1 6.5 3H11v17H6.5A2.5 2.5 0 0 0 4 22z' }],
|
|
598
|
+
['path', { d: 'M20 5.5A2.5 2.5 0 0 0 17.5 3H13v17h4.5A2.5 2.5 0 0 1 20 22z' }],
|
|
599
|
+
],
|
|
600
|
+
info: [
|
|
601
|
+
['circle', { cx: '12', cy: '12', r: '9' }],
|
|
602
|
+
['path', { d: 'M12 11v6M12 7.5h.01' }],
|
|
603
|
+
],
|
|
604
|
+
settings: [
|
|
605
|
+
['circle', { cx: '12', cy: '12', r: '3' }],
|
|
606
|
+
['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' }],
|
|
607
|
+
],
|
|
608
|
+
shield: [
|
|
609
|
+
['path', { d: 'M12 3l7 3v5c0 4.5-3 7.7-7 10-4-2.3-7-5.5-7-10V6z' }],
|
|
610
|
+
['path', { d: 'M9 12l2 2 4-5' }],
|
|
611
|
+
],
|
|
612
|
+
restore: [
|
|
613
|
+
['path', { d: 'M4 10a8 8 0 1 1 2 5.3' }],
|
|
614
|
+
['path', { d: 'M4 4v6h6' }],
|
|
615
|
+
],
|
|
616
|
+
context: [
|
|
617
|
+
['path', { d: 'M12 3l9 5-9 5-9-5z' }],
|
|
618
|
+
['path', { d: 'M3 12l9 5 9-5M3 16l9 5 9-5' }],
|
|
619
|
+
],
|
|
620
|
+
plugin: [
|
|
621
|
+
['rect', { x: '4', y: '4', width: '6', height: '6', rx: '1' }],
|
|
622
|
+
['rect', { x: '14', y: '4', width: '6', height: '6', rx: '1' }],
|
|
623
|
+
['rect', { x: '4', y: '14', width: '6', height: '6', rx: '1' }],
|
|
624
|
+
['rect', { x: '14', y: '14', width: '6', height: '6', rx: '1' }],
|
|
625
|
+
],
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
function Icon({ name, size = 16 }) {
|
|
629
|
+
const paths = ICON_PATHS[name] || ICON_PATHS.info
|
|
630
|
+
return h(
|
|
631
|
+
'svg',
|
|
632
|
+
{
|
|
633
|
+
width: size,
|
|
634
|
+
height: size,
|
|
635
|
+
viewBox: '0 0 24 24',
|
|
636
|
+
fill: 'none',
|
|
637
|
+
stroke: 'currentColor',
|
|
638
|
+
strokeWidth: 1.7,
|
|
639
|
+
strokeLinecap: 'round',
|
|
640
|
+
strokeLinejoin: 'round',
|
|
641
|
+
'aria-hidden': 'true',
|
|
642
|
+
focusable: 'false',
|
|
643
|
+
className: 'eo-icon',
|
|
644
|
+
},
|
|
645
|
+
paths.map(([tag, props], index) => h(tag, { key: index, ...props })),
|
|
646
|
+
)
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
function Progress({ value, tone = 'neutral', label }) {
|
|
650
|
+
const pct = Math.max(0, Math.min(100, Number(value) || 0))
|
|
651
|
+
return h(
|
|
652
|
+
'div',
|
|
653
|
+
{
|
|
654
|
+
className: 'eo-progress-track eo-progress-' + tone,
|
|
655
|
+
role: 'progressbar',
|
|
656
|
+
'aria-valuenow': Math.round(pct),
|
|
657
|
+
'aria-valuemin': 0,
|
|
658
|
+
'aria-valuemax': 100,
|
|
659
|
+
'aria-label': label,
|
|
660
|
+
title: label,
|
|
661
|
+
},
|
|
662
|
+
h('i', { style: { width: pct + '%' } }),
|
|
663
|
+
)
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
function OnboardingModal({ step, setStep, onFinish, onTutorial, onClose }) {
|
|
667
|
+
const steps = [
|
|
668
|
+
{
|
|
669
|
+
icon: 'gauge',
|
|
670
|
+
zh: '先量成本',
|
|
671
|
+
en: 'Measure first',
|
|
672
|
+
zhBody: '插件清单会显示每个插件占用的上下文比例;未归属部分单独标出。你砍掉的不只是工具白名单。',
|
|
673
|
+
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.',
|
|
674
|
+
},
|
|
675
|
+
{
|
|
676
|
+
icon: 'recipe',
|
|
677
|
+
zh: '再生成方案',
|
|
678
|
+
en: 'Build a plan',
|
|
679
|
+
zhBody: '选任务类型或写一句目标,点击“生成方案”。默认只生成草稿,不会改任何插件。',
|
|
680
|
+
enBody: 'Pick a task or describe the goal, then build a plan. It is a draft by default and changes nothing.',
|
|
681
|
+
},
|
|
682
|
+
{
|
|
683
|
+
icon: 'shield',
|
|
684
|
+
zh: '最后安全确认',
|
|
685
|
+
en: 'Confirm safely',
|
|
686
|
+
zhBody: '只有依据充分才标建议关闭;定时/触发插件、有调用记录的插件只进入复核。应用前写入还原点,随时恢复。',
|
|
687
|
+
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.',
|
|
688
|
+
},
|
|
689
|
+
]
|
|
690
|
+
const current = steps[step] || steps[0]
|
|
691
|
+
useEffect(() => {
|
|
692
|
+
const onKey = (event) => { if (event.key === 'Escape') onClose() }
|
|
693
|
+
window.addEventListener('keydown', onKey)
|
|
694
|
+
return () => window.removeEventListener('keydown', onKey)
|
|
695
|
+
}, [onClose])
|
|
696
|
+
return h(
|
|
697
|
+
'div',
|
|
698
|
+
{
|
|
699
|
+
className: 'eo-modal-backdrop',
|
|
700
|
+
onClick: onClose,
|
|
701
|
+
role: 'presentation',
|
|
702
|
+
},
|
|
703
|
+
h(
|
|
704
|
+
'div',
|
|
705
|
+
{
|
|
706
|
+
className: 'eo-modal eo-onboarding',
|
|
707
|
+
role: 'dialog',
|
|
708
|
+
'aria-modal': 'true',
|
|
709
|
+
'aria-labelledby': 'eo-onboarding-title',
|
|
710
|
+
onClick: (event) => event.stopPropagation(),
|
|
711
|
+
},
|
|
712
|
+
h(
|
|
713
|
+
'div',
|
|
714
|
+
{ className: 'eo-onboarding-head' },
|
|
715
|
+
h('span', { className: 'eo-onboarding-icon' }, h(Icon, { name: current.icon, size: 22 })),
|
|
716
|
+
h(
|
|
717
|
+
'div',
|
|
718
|
+
null,
|
|
719
|
+
h('div', { className: 'eo-onboarding-kicker' }, tr('新手引导', 'First-run guide')),
|
|
720
|
+
h('h3', { id: 'eo-onboarding-title' }, tr(current.zh, current.en)),
|
|
721
|
+
),
|
|
722
|
+
),
|
|
723
|
+
h('p', null, tr(current.zhBody, current.enBody)),
|
|
724
|
+
h(
|
|
725
|
+
'div',
|
|
726
|
+
{ className: 'eo-progress-dots', 'aria-label': tr('新手引导进度', 'Guide progress') },
|
|
727
|
+
steps.map((item, index) =>
|
|
728
|
+
h('span', {
|
|
729
|
+
key: item.en,
|
|
730
|
+
className: index === step ? 'eo-progress-dot eo-progress-dot-active' : 'eo-progress-dot',
|
|
731
|
+
}),
|
|
732
|
+
),
|
|
733
|
+
),
|
|
734
|
+
h(
|
|
735
|
+
'div',
|
|
736
|
+
{ className: 'eo-modal-actions' },
|
|
737
|
+
h(Button, { variant: 'ghost', onClick: onClose }, tr('跳过', 'Skip')),
|
|
738
|
+
step > 0
|
|
739
|
+
? h(Button, { variant: 'ghost', onClick: () => setStep(step - 1) }, tr('上一步', 'Back'))
|
|
740
|
+
: null,
|
|
741
|
+
h(Button, { variant: 'ghost', onClick: onTutorial }, tr('查看完整教程', 'Open full guide')),
|
|
742
|
+
step < steps.length - 1
|
|
743
|
+
? h(Button, { variant: 'accent', onClick: () => setStep(step + 1) }, tr('下一步', 'Next'))
|
|
744
|
+
: h(Button, { variant: 'accent', onClick: () => onFinish() }, tr('开始使用', 'Get started')),
|
|
745
|
+
),
|
|
746
|
+
),
|
|
747
|
+
)
|
|
748
|
+
}
|
|
749
|
+
|
|
374
750
|
function ExperiencePanel() {
|
|
751
|
+
|
|
375
752
|
const [tab, setTab] = useState('trim')
|
|
753
|
+
const [locale, setLocale] = useState(detectLocale)
|
|
754
|
+
const [showOnboarding, setShowOnboarding] = useState(false)
|
|
755
|
+
const [onboardingStep, setOnboardingStep] = useState(0)
|
|
376
756
|
const [overview, setOverview] = useState(null)
|
|
377
757
|
const [loading, setLoading] = useState(true)
|
|
378
758
|
const [error, setError] = useState('')
|
|
@@ -409,6 +789,7 @@ window.__ModuleLoader__.load({
|
|
|
409
789
|
const [settings, setSettings] = useState(null)
|
|
410
790
|
const [settingsBusy, setSettingsBusy] = useState(false)
|
|
411
791
|
const [settingsError, setSettingsError] = useState('')
|
|
792
|
+
CURRENT_LOCALE = locale
|
|
412
793
|
|
|
413
794
|
const notify = useCallback((message, kind) => {
|
|
414
795
|
setToast({ message, kind: kind || 'ok', id: Date.now() })
|
|
@@ -437,6 +818,33 @@ window.__ModuleLoader__.load({
|
|
|
437
818
|
void refresh()
|
|
438
819
|
}, [refresh])
|
|
439
820
|
|
|
821
|
+
useEffect(() => {
|
|
822
|
+
if (typeof document !== 'undefined') document.documentElement.lang = locale === 'zh' ? 'zh-CN' : 'en'
|
|
823
|
+
persistLocale(locale)
|
|
824
|
+
}, [locale])
|
|
825
|
+
|
|
826
|
+
useEffect(() => {
|
|
827
|
+
if (!readOnboarding()) setShowOnboarding(true)
|
|
828
|
+
}, [])
|
|
829
|
+
|
|
830
|
+
const switchLocale = useCallback((next) => {
|
|
831
|
+
setLocale(next)
|
|
832
|
+
persistLocale(next)
|
|
833
|
+
}, [])
|
|
834
|
+
|
|
835
|
+
const finishOnboarding = useCallback((destination) => {
|
|
836
|
+
writeOnboarding()
|
|
837
|
+
setShowOnboarding(false)
|
|
838
|
+
setOnboardingStep(0)
|
|
839
|
+
if (destination === 'tutorial') setTab('tutorial')
|
|
840
|
+
}, [])
|
|
841
|
+
|
|
842
|
+
const replayOnboarding = useCallback(() => {
|
|
843
|
+
resetOnboarding()
|
|
844
|
+
setOnboardingStep(0)
|
|
845
|
+
setShowOnboarding(true)
|
|
846
|
+
}, [])
|
|
847
|
+
|
|
440
848
|
const loadSettings = useCallback(async () => {
|
|
441
849
|
setSettingsBusy(true)
|
|
442
850
|
setSettingsError('')
|
|
@@ -493,7 +901,13 @@ window.__ModuleLoader__.load({
|
|
|
493
901
|
: 0
|
|
494
902
|
const totalBundles = overview ? overview.bundles.length : 0
|
|
495
903
|
const totalContextTokens = overview ? overview.context.totalTokens : 0
|
|
904
|
+
const attributedContext = overview
|
|
905
|
+
? Math.max(0, overview.context.totalTokens - overview.context.unattributedTokens)
|
|
906
|
+
: 0
|
|
907
|
+
const contextPct = totalContextTokens > 0 ? (attributedContext / totalContextTokens) * 100 : 0
|
|
908
|
+
const enabledPct = totalBundles > 0 ? (enabledBundles / totalBundles) * 100 : 0
|
|
496
909
|
const compat = overview ? overview.compat : { error: 0, warn: 0, info: 0 }
|
|
910
|
+
const compatPct = compat.error > 0 ? 0 : compat.warn > 0 ? 50 : 100
|
|
497
911
|
const byOwner = overview ? overview.context.byOwner : []
|
|
498
912
|
const maxOwner = Math.max(1, ...byOwner.map((owner) => owner.tokens))
|
|
499
913
|
const selectedIds = Object.keys(selected).filter((id) => selected[id])
|
|
@@ -574,7 +988,7 @@ window.__ModuleLoader__.load({
|
|
|
574
988
|
if (result.token) setRollbackToken(result.token)
|
|
575
989
|
notify(
|
|
576
990
|
result.rolledBack
|
|
577
|
-
? '
|
|
991
|
+
? '应用未完成,已自动恢复'
|
|
578
992
|
: '已应用 ' +
|
|
579
993
|
result.items.filter((item) => item.status === 'applied').length +
|
|
580
994
|
' 项',
|
|
@@ -604,7 +1018,7 @@ window.__ModuleLoader__.load({
|
|
|
604
1018
|
setApplyResult(null)
|
|
605
1019
|
setRollbackToken('')
|
|
606
1020
|
notify(
|
|
607
|
-
'
|
|
1021
|
+
'已恢复 ' +
|
|
608
1022
|
result.items.filter((item) => item.status === 'restored').length +
|
|
609
1023
|
' 项',
|
|
610
1024
|
)
|
|
@@ -677,8 +1091,8 @@ window.__ModuleLoader__.load({
|
|
|
677
1091
|
h(
|
|
678
1092
|
'div',
|
|
679
1093
|
{ className: 'eo-hero-copy' },
|
|
680
|
-
h('h2', { className: 'eo-title' }, '体验优化'),
|
|
681
|
-
h('p', { className: 'eo-sub' }, '插件减负、兼容性体检与工作流蓝图。'),
|
|
1094
|
+
h('h2', { className: 'eo-title' }, tr('体验优化', 'Experience Optimizer')),
|
|
1095
|
+
h('p', { className: 'eo-sub' }, tr('插件减负、兼容性体检与工作流蓝图。', 'Plugin diet, compatibility checks, and workflow recipes.')),
|
|
682
1096
|
),
|
|
683
1097
|
h(
|
|
684
1098
|
'div',
|
|
@@ -686,56 +1100,44 @@ window.__ModuleLoader__.load({
|
|
|
686
1100
|
h(
|
|
687
1101
|
'span',
|
|
688
1102
|
{ className: 'eo-status', title: overview ? overview.profile.dir : '' },
|
|
689
|
-
overview ? '
|
|
1103
|
+
overview ? tr('当前配置:', 'Profile: ') + overview.profile.name : tr('读取中', 'Loading'),
|
|
1104
|
+
),
|
|
1105
|
+
h(
|
|
1106
|
+
Button,
|
|
1107
|
+
{
|
|
1108
|
+
variant: 'ghost',
|
|
1109
|
+
onClick: () => switchLocale(locale === 'zh' ? 'en' : 'zh'),
|
|
1110
|
+
title: tr('切换语言', 'Switch language'),
|
|
1111
|
+
},
|
|
1112
|
+
locale === 'zh' ? 'EN' : '中文',
|
|
690
1113
|
),
|
|
691
1114
|
h(
|
|
692
1115
|
Button,
|
|
693
1116
|
{ onClick: refresh, disabled: loading, variant: 'ghost' },
|
|
694
|
-
loading ? '刷新中…' : '刷新',
|
|
1117
|
+
loading ? tr('刷新中…', 'Refreshing…') : tr('刷新', 'Refresh'),
|
|
695
1118
|
),
|
|
696
1119
|
),
|
|
697
1120
|
),
|
|
698
1121
|
h(
|
|
699
1122
|
'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()
|
|
1123
|
+
{ className: 'eo-tabs', role: 'tablist' },
|
|
1124
|
+
TABS.map((item) =>
|
|
1125
|
+
h(
|
|
1126
|
+
'button',
|
|
1127
|
+
{
|
|
1128
|
+
key: item.id,
|
|
1129
|
+
type: 'button',
|
|
1130
|
+
role: 'tab',
|
|
1131
|
+
'aria-selected': tab === item.id,
|
|
1132
|
+
className: 'eo-tab' + (tab === item.id ? ' eo-tab-active' : ''),
|
|
1133
|
+
onClick: () => {
|
|
1134
|
+
setTab(item.id)
|
|
1135
|
+
if (item.id === 'settings' && settings === null && !settingsBusy) void loadSettings()
|
|
1136
|
+
},
|
|
736
1137
|
},
|
|
737
|
-
|
|
738
|
-
|
|
1138
|
+
h(Icon, { name: item.icon, size: 15 }),
|
|
1139
|
+
tr(item.zh, item.en),
|
|
1140
|
+
),
|
|
739
1141
|
),
|
|
740
1142
|
),
|
|
741
1143
|
error
|
|
@@ -758,11 +1160,13 @@ window.__ModuleLoader__.load({
|
|
|
758
1160
|
? renderTutorial()
|
|
759
1161
|
: tab === 'settings'
|
|
760
1162
|
? renderSettings()
|
|
761
|
-
:
|
|
762
|
-
?
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
1163
|
+
: tab === 'about'
|
|
1164
|
+
? renderAbout()
|
|
1165
|
+
: overview
|
|
1166
|
+
? tab === 'trim'
|
|
1167
|
+
? renderTrim()
|
|
1168
|
+
: renderRecipe()
|
|
1169
|
+
: null,
|
|
766
1170
|
confirmState
|
|
767
1171
|
? h(ConfirmModal, {
|
|
768
1172
|
state: confirmState,
|
|
@@ -775,90 +1179,100 @@ window.__ModuleLoader__.load({
|
|
|
775
1179
|
toast
|
|
776
1180
|
? h('div', { className: 'eo-toast eo-toast-' + toast.kind }, toast.message)
|
|
777
1181
|
: null,
|
|
1182
|
+
showOnboarding
|
|
1183
|
+
? h(OnboardingModal, {
|
|
1184
|
+
step: onboardingStep,
|
|
1185
|
+
setStep: setOnboardingStep,
|
|
1186
|
+
onFinish: () => finishOnboarding(),
|
|
1187
|
+
onTutorial: () => finishOnboarding('tutorial'),
|
|
1188
|
+
onClose: () => finishOnboarding(),
|
|
1189
|
+
})
|
|
1190
|
+
: null,
|
|
778
1191
|
)
|
|
779
1192
|
|
|
780
1193
|
function renderTutorial() {
|
|
781
1194
|
const quickStarts = [
|
|
782
1195
|
{
|
|
783
|
-
|
|
784
|
-
|
|
1196
|
+
zhLabel: '代码审查', enLabel: 'Code review',
|
|
1197
|
+
zhDesc: '先看兼容性,再生成审查任务的精简方案', enDesc: 'Check compatibility, then build a review plan',
|
|
785
1198
|
run: () => {
|
|
786
1199
|
setTaskTag('review')
|
|
787
|
-
setGoal('审查当前改动,指出风险、回归点和需要补测的地方')
|
|
1200
|
+
setGoal(tr('审查当前改动,指出风险、回归点和需要补测的地方', 'Review current changes: risks, regressions, and missing tests'))
|
|
788
1201
|
setTab('trim')
|
|
789
|
-
notify('已填入审查任务,点击“生成方案”继续')
|
|
1202
|
+
notify(tr('已填入审查任务,点击“生成方案”继续', 'Review task filled; click “Build plan” to continue'))
|
|
790
1203
|
},
|
|
791
1204
|
},
|
|
792
1205
|
{
|
|
793
|
-
|
|
794
|
-
|
|
1206
|
+
zhLabel: '修复问题', enLabel: 'Fix an issue',
|
|
1207
|
+
zhDesc: '排除无关插件,保留调试与文件工具', enDesc: 'Drop unrelated plugins; keep debugging and file tools',
|
|
795
1208
|
run: () => {
|
|
796
1209
|
setTaskTag('bugfix')
|
|
797
|
-
setGoal('修复一个可复现的 bug,并验证没有回归')
|
|
1210
|
+
setGoal(tr('修复一个可复现的 bug,并验证没有回归', 'Fix a reproducible bug and verify no regressions'))
|
|
798
1211
|
setTab('trim')
|
|
799
|
-
notify('已填入修复任务,点击“生成方案”继续')
|
|
1212
|
+
notify(tr('已填入修复任务,点击“生成方案”继续', 'Bugfix task filled; click “Build plan” to continue'))
|
|
800
1213
|
},
|
|
801
1214
|
},
|
|
802
1215
|
{
|
|
803
|
-
|
|
804
|
-
|
|
1216
|
+
zhLabel: '整理周报', enLabel: 'Weekly report',
|
|
1217
|
+
zhDesc: '进入工作流配方,生成可导出的周报蓝图', enDesc: 'Open the recipe builder for an exportable report blueprint',
|
|
805
1218
|
run: () => {
|
|
806
1219
|
setTab('recipe')
|
|
807
|
-
notify('已打开工作流配方,按表单确认范围与交付方式')
|
|
1220
|
+
notify(tr('已打开工作流配方,按表单确认范围与交付方式', 'Recipe builder opened; confirm scope and delivery'))
|
|
808
1221
|
},
|
|
809
1222
|
},
|
|
810
1223
|
]
|
|
1224
|
+
const steps = [
|
|
1225
|
+
['先扫描。', 'Scan first.', ' 打开「插件减负」,看可归属上下文、兼容性和插件清单;清单里的“占比”就是常驻成本的可见化。', ' Open Plugin diet to see attributable context, compatibility, and inventory. The Share column makes resident cost visible.'],
|
|
1226
|
+
['再生成方案。', 'Build a plan.', ' 选任务类型或写一句目标,点击“生成方案”。默认只生成草稿,不会改任何插件。', ' Pick a task or write a goal, then Build plan. It only creates a draft; no plugin is changed.'],
|
|
1227
|
+
['看判断依据。', '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.'],
|
|
1228
|
+
['确认后应用。', 'Confirm and apply.', ' 勾选低风险项,点击“应用选中”,核对弹窗后写入还原点并应用;需要时可一键恢复。', ' Select low-risk items, apply, review the dialog, then write a restore point and apply. Recover in one click if needed.'],
|
|
1229
|
+
['需要工作流时。', 'Need a workflow?', ' 打开「工作流配方」,生成带审批级别的蓝图,导出 Markdown/JSON 运行手册。', ' Open Workflow recipe to generate a blueprint with approval levels and export Markdown/JSON.'],
|
|
1230
|
+
]
|
|
1231
|
+
const faq = [
|
|
1232
|
+
[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.')],
|
|
1233
|
+
[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.')],
|
|
1234
|
+
[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.')],
|
|
1235
|
+
[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.')],
|
|
1236
|
+
]
|
|
811
1237
|
return h(
|
|
812
1238
|
'div',
|
|
813
1239
|
{ className: 'eo-stack' },
|
|
814
1240
|
h(
|
|
815
1241
|
Card,
|
|
816
|
-
{ title: '5 分钟上手', subtitle: '
|
|
1242
|
+
{ title: tr('5 分钟上手', 'Five-minute guide'), subtitle: tr('从扫描到应用,每一步都可恢复', 'From scan to apply, every step is recoverable') },
|
|
817
1243
|
h(
|
|
818
1244
|
'ol',
|
|
819
1245
|
{ className: 'eo-steps' },
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
h('li', null, h('strong', null, '确认后应用。'), ' 勾选低风险项,点击“应用选中”,核对弹窗后写入快照并应用;需要时可一键回滚。'),
|
|
824
|
-
h('li', null, h('strong', null, '需要工作流时。'), ' 打开「工作流配方」,生成带审批级别的蓝图,导出 Markdown/JSON 运行手册。'),
|
|
1246
|
+
steps.map(([zhTitle, enTitle, zhBody, enBody], index) =>
|
|
1247
|
+
h('li', { key: enTitle }, h('strong', null, tr(zhTitle, enTitle)), tr(zhBody, enBody)),
|
|
1248
|
+
),
|
|
825
1249
|
),
|
|
826
1250
|
),
|
|
827
1251
|
h(
|
|
828
1252
|
Card,
|
|
829
|
-
{ title: '按任务快速开始', subtitle: '只是填入表单,不会直接修改插件' },
|
|
1253
|
+
{ title: tr('按任务快速开始', 'Quick start by task'), subtitle: tr('只是填入表单,不会直接修改插件', 'Only fills the form; changes nothing') },
|
|
830
1254
|
h(
|
|
831
1255
|
'div',
|
|
832
1256
|
{ className: 'eo-inline' },
|
|
833
1257
|
quickStarts.map((item) =>
|
|
834
1258
|
h(
|
|
835
1259
|
'div',
|
|
836
|
-
{ key: item.
|
|
837
|
-
h('strong', null, item.
|
|
838
|
-
h('span', { className: 'eo-muted' }, item.
|
|
839
|
-
h(Button, { variant: 'ghost', onClick: item.run }, '开始'),
|
|
1260
|
+
{ key: item.enLabel, className: 'eo-issue', style: { flex: '1 1 180px', flexDirection: 'column', alignItems: 'flex-start' } },
|
|
1261
|
+
h('strong', null, tr(item.zhLabel, item.enLabel)),
|
|
1262
|
+
h('span', { className: 'eo-muted' }, tr(item.zhDesc, item.enDesc)),
|
|
1263
|
+
h(Button, { variant: 'ghost', onClick: item.run }, tr('开始', 'Start')),
|
|
840
1264
|
),
|
|
841
1265
|
),
|
|
842
1266
|
),
|
|
843
1267
|
),
|
|
844
1268
|
h(
|
|
845
1269
|
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;被拒绝、取消或审批服务不可用时一律不写入。'),
|
|
1270
|
+
{ title: tr('常见问题', 'FAQ'), subtitle: tr('先看依据,再做决定', 'Read the evidence first') },
|
|
1271
|
+
faq.map(([q, a]) =>
|
|
1272
|
+
h('details', { className: 'eo-faq', key: q },
|
|
1273
|
+
h('summary', null, q),
|
|
1274
|
+
h('p', null, a),
|
|
1275
|
+
),
|
|
862
1276
|
),
|
|
863
1277
|
),
|
|
864
1278
|
)
|
|
@@ -890,71 +1304,181 @@ window.__ModuleLoader__.load({
|
|
|
890
1304
|
async function copyConfig(data) {
|
|
891
1305
|
try {
|
|
892
1306
|
await navigator.clipboard.writeText(configPatch(data))
|
|
893
|
-
notify('配置片段已复制;写入配置补丁后生效')
|
|
1307
|
+
notify(tr('配置片段已复制;写入配置补丁后生效', 'Snippet copied; apply it to the profile patch'))
|
|
894
1308
|
} catch {
|
|
895
|
-
notify('无法访问剪贴板,请手动复制配置片段', 'warn')
|
|
1309
|
+
notify(tr('无法访问剪贴板,请手动复制配置片段', 'Clipboard unavailable; copy the snippet manually'), 'warn')
|
|
896
1310
|
}
|
|
897
1311
|
}
|
|
898
1312
|
|
|
899
1313
|
function renderSettings() {
|
|
900
1314
|
if (settingsBusy && settings === null) {
|
|
901
|
-
return h('div', { className: 'eo-loading' }, h('span', { className: 'eo-spinner' }), '正在读取当前生效设置…')
|
|
1315
|
+
return h('div', { className: 'eo-loading' }, h('span', { className: 'eo-spinner' }), tr('正在读取当前生效设置…', 'Loading effective settings…'))
|
|
902
1316
|
}
|
|
903
1317
|
if (settingsError && settings === null) {
|
|
904
|
-
return h('div', { className: 'eo-error' }, h('span', null, settingsError), h(Button, { variant: 'ghost', onClick: loadSettings }, '重试'))
|
|
1318
|
+
return h('div', { className: 'eo-error' }, h('span', null, settingsError), h(Button, { variant: 'ghost', onClick: loadSettings }, tr('重试', 'Retry')))
|
|
905
1319
|
}
|
|
906
|
-
if (!settings) return h('div', { className: 'eo-empty' }, '暂无设置数据。')
|
|
907
|
-
const policyLabel = settings.suggestionPolicy === 'balanced' ? '旧评分(仍保护周期与已用插件)' : '证据优先(推荐)'
|
|
908
|
-
const approvalLabel = settings.approvalMode === 'risk-based' ? '仅超过阈值时审批' : '每次工具写入都审批'
|
|
1320
|
+
if (!settings) return h('div', { className: 'eo-empty' }, tr('暂无设置数据。', 'No settings data.'))
|
|
1321
|
+
const policyLabel = settings.suggestionPolicy === 'balanced' ? tr('旧评分(仍保护周期与已用插件)', 'Legacy score (still protects scheduled/used plugins)') : tr('证据优先(推荐)', 'Evidence-first (recommended)')
|
|
1322
|
+
const approvalLabel = settings.approvalMode === 'risk-based' ? tr('仅超过阈值时审批', 'Approve only above threshold') : tr('每次工具写入都审批', 'Approve every tool write')
|
|
909
1323
|
return h(
|
|
910
1324
|
'div',
|
|
911
1325
|
{ className: 'eo-stack' },
|
|
912
1326
|
h(
|
|
913
1327
|
Card,
|
|
914
1328
|
{
|
|
915
|
-
title: '当前生效设置',
|
|
916
|
-
subtitle: '只读视图;修改请写入配置补丁',
|
|
917
|
-
extra: h(Button, { variant: 'ghost', onClick: loadSettings, disabled: settingsBusy }, settingsBusy ? '读取中…' : '刷新'),
|
|
1329
|
+
title: tr('当前生效设置', 'Effective settings'),
|
|
1330
|
+
subtitle: tr('只读视图;修改请写入配置补丁', 'Read-only; edit the profile patch to change'),
|
|
1331
|
+
extra: h(Button, { variant: 'ghost', onClick: loadSettings, disabled: settingsBusy }, settingsBusy ? tr('读取中…', 'Loading…') : tr('刷新', 'Refresh')),
|
|
918
1332
|
},
|
|
919
1333
|
h(
|
|
920
1334
|
'div',
|
|
921
1335
|
{ 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, '
|
|
1336
|
+
h('div', { className: 'eo-settings-row' }, h('span', null, tr('当前配置', 'Profile')), h('code', null, settings.profile)),
|
|
1337
|
+
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'))),
|
|
1338
|
+
h('div', { className: 'eo-settings-row' }, h('span', null, tr('审批策略', 'Approval')), h('code', null, approvalLabel)),
|
|
1339
|
+
h('div', { className: 'eo-settings-row' }, h('span', null, tr('审批阈值', 'Approval threshold')), h('code', null, String(settings.approvalThreshold) + tr(' 项', ' items'))),
|
|
1340
|
+
h('div', { className: 'eo-settings-row' }, h('span', null, tr('建议策略', 'Suggestion policy')), h('code', null, policyLabel)),
|
|
1341
|
+
h('div', { className: 'eo-settings-row' }, h('span', null, tr('使用账本', 'Usage ledger')), h('code', null, settings.trackUsage ? tr('开启', 'On') : tr('关闭', 'Off'))),
|
|
1342
|
+
h('div', { className: 'eo-settings-row' }, h('span', null, tr('账本保留', 'Ledger retention')), h('code', null, settings.usageRetentionDays + tr(' 天', ' days'))),
|
|
1343
|
+
h('div', { className: 'eo-settings-row' }, h('span', null, tr('草稿/还原点上限', 'Draft/snapshot limit')), h('code', null, String(settings.maxDrafts))),
|
|
930
1344
|
),
|
|
931
|
-
h('div', { className: 'eo-muted', style: { marginTop: '10px' } }, '配置目录:' + settings.profileDir),
|
|
1345
|
+
h('div', { className: 'eo-muted', style: { marginTop: '10px' } }, tr('配置目录:', 'Config directory: ') + settings.profileDir),
|
|
932
1346
|
),
|
|
933
1347
|
h(
|
|
934
1348
|
Card,
|
|
935
|
-
{ title: '保护与固定', subtitle: '这些插件永远不会进入自动建议' },
|
|
1349
|
+
{ title: tr('保护与固定', 'Protect & pin'), subtitle: tr('这些插件永远不会进入自动建议', 'These plugins never become automatic candidates') },
|
|
936
1350
|
settings.protect.length === 0 && settings.pinned.length === 0
|
|
937
|
-
? h('div', { className: 'eo-empty' }, '尚未配置保护 / 固定名单。可在配置补丁中添加需要保底的插件。')
|
|
1351
|
+
? h('div', { className: 'eo-empty' }, tr('尚未配置保护 / 固定名单。可在配置补丁中添加需要保底的插件。', 'No protect/pinned entries. Add must-keep plugins to the profile patch.'))
|
|
938
1352
|
: h(
|
|
939
1353
|
'div',
|
|
940
1354
|
{ 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)),
|
|
1355
|
+
settings.protect.map((name) => h(Badge, { key: 'protect-' + name, tone: 'warn' }, tr('保护 · ', 'Protect · ') + name)),
|
|
1356
|
+
settings.pinned.map((name) => h(Badge, { key: 'pinned-' + name, tone: 'neutral' }, tr('固定 · ', 'Pinned · ') + name)),
|
|
943
1357
|
),
|
|
944
1358
|
),
|
|
945
1359
|
h(
|
|
946
1360
|
Card,
|
|
947
1361
|
{
|
|
948
|
-
title: '配置片段',
|
|
949
|
-
subtitle: '复制到配置补丁;写入后由 DSH 重新加载',
|
|
950
|
-
extra: h(Button, { variant: 'accent', onClick: () => void copyConfig(settings) }, '复制片段'),
|
|
1362
|
+
title: tr('配置片段', 'Configuration snippet'),
|
|
1363
|
+
subtitle: tr('复制到配置补丁;写入后由 DSH 重新加载', 'Copy into the profile patch; DSH reloads after writing'),
|
|
1364
|
+
extra: h(Button, { variant: 'accent', onClick: () => void copyConfig(settings) }, tr('复制片段', 'Copy snippet')),
|
|
951
1365
|
},
|
|
952
1366
|
h('pre', { className: 'eo-codeblock' }, configPatch(settings)),
|
|
953
1367
|
),
|
|
954
1368
|
h(
|
|
955
1369
|
Card,
|
|
956
|
-
{ title: '说明', subtitle: '设置页不会直接改配置' },
|
|
957
|
-
h('div', { className: 'eo-muted' }, '为避免 UI 绕过 DSH 的配置边界,这里只展示当前生效值与可复制片段。修改后请重新加载插件;审批与保护逻辑不会因为改设置而跳过。'),
|
|
1370
|
+
{ title: tr('说明', 'Notes'), subtitle: tr('设置页不会直接改配置', 'This page does not edit config directly') },
|
|
1371
|
+
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.')),
|
|
1372
|
+
),
|
|
1373
|
+
)
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
async function copyInstall() {
|
|
1377
|
+
try {
|
|
1378
|
+
await navigator.clipboard.writeText('dsh plugin --profile web add dsh-plugin-trim\ndsh plugin --profile web add dsh-plugin-recipe')
|
|
1379
|
+
notify(tr('安装命令已复制', 'Install commands copied'))
|
|
1380
|
+
} catch {
|
|
1381
|
+
notify(tr('无法访问剪贴板,请手动复制安装命令', 'Clipboard unavailable; copy the commands manually'), 'warn')
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
function renderAbout() {
|
|
1386
|
+
const links = [
|
|
1387
|
+
['GitHub', ABOUT_LINKS.repo],
|
|
1388
|
+
[tr('npm · 插件减负', 'npm · plugin diet'), ABOUT_LINKS.npmTrim],
|
|
1389
|
+
[tr('npm · 工作流配方', 'npm · workflow recipe'), ABOUT_LINKS.npmRecipe],
|
|
1390
|
+
[tr('发布记录', 'Releases'), ABOUT_LINKS.releases],
|
|
1391
|
+
[tr('问题反馈', 'Issues'), ABOUT_LINKS.issues],
|
|
1392
|
+
]
|
|
1393
|
+
return h(
|
|
1394
|
+
'div',
|
|
1395
|
+
{ className: 'eo-stack' },
|
|
1396
|
+
h(
|
|
1397
|
+
Card,
|
|
1398
|
+
{
|
|
1399
|
+
title: tr('关于项目', 'About the project'),
|
|
1400
|
+
subtitle: tr('插件减负、兼容性检查与工作流蓝图', 'Plugin diet, compatibility checks, and workflow recipes'),
|
|
1401
|
+
section: 'about',
|
|
1402
|
+
},
|
|
1403
|
+
h(
|
|
1404
|
+
'div',
|
|
1405
|
+
{ className: 'eo-about-grid' },
|
|
1406
|
+
h(
|
|
1407
|
+
'div',
|
|
1408
|
+
{ className: 'eo-about-card' },
|
|
1409
|
+
h('div', { className: 'eo-inline', style: { marginBottom: '8px' } }, h(Icon, { name: 'shield', size: 24 }), h('strong', null, 'DSH Experience Optimizer')),
|
|
1410
|
+
h('p', null, tr('少一点插件负担,多一点兼容确定性。', 'Less plugin overhead, more compatibility certainty.')),
|
|
1411
|
+
h('p', null, tr('版本:', 'Version: ') + '0.3.5 · AGPL-3.0-only'),
|
|
1412
|
+
h('p', null, tr('作者:Starlit Sky', 'Author: Starlit Sky')),
|
|
1413
|
+
),
|
|
1414
|
+
h(
|
|
1415
|
+
'div',
|
|
1416
|
+
{ className: 'eo-about-card' },
|
|
1417
|
+
h('h4', null, tr('项目链接', 'Project links')),
|
|
1418
|
+
h(
|
|
1419
|
+
'ul',
|
|
1420
|
+
{ className: 'eo-link-list' },
|
|
1421
|
+
links.map(([label, href]) =>
|
|
1422
|
+
h('li', { key: label }, h('a', { href, target: '_blank', rel: 'noreferrer' }, label, ' ↗')),
|
|
1423
|
+
),
|
|
1424
|
+
),
|
|
1425
|
+
),
|
|
1426
|
+
),
|
|
1427
|
+
h(
|
|
1428
|
+
'div',
|
|
1429
|
+
{ className: 'eo-inline', style: { marginTop: '12px' } },
|
|
1430
|
+
h(Button, { variant: 'accent', onClick: () => void copyInstall() }, tr('复制安装命令', 'Copy install commands')),
|
|
1431
|
+
h(Button, { variant: 'ghost', onClick: () => setTab('tutorial') }, tr('打开完整教程', 'Open full guide')),
|
|
1432
|
+
h(Button, { variant: 'ghost', onClick: replayOnboarding }, tr('重新查看新手引导', 'Replay first-run guide')),
|
|
1433
|
+
),
|
|
1434
|
+
),
|
|
1435
|
+
h(
|
|
1436
|
+
Card,
|
|
1437
|
+
{
|
|
1438
|
+
title: tr('交流与支持', 'Community & support'),
|
|
1439
|
+
subtitle: tr('真实链接优先;未填写的内容明确标为待补充', 'Real links first; unset items are clearly marked'),
|
|
1440
|
+
section: 'about',
|
|
1441
|
+
},
|
|
1442
|
+
h(
|
|
1443
|
+
'div',
|
|
1444
|
+
{ className: 'eo-about-grid' },
|
|
1445
|
+
h(
|
|
1446
|
+
'div',
|
|
1447
|
+
{ className: 'eo-about-card' },
|
|
1448
|
+
h('h4', null, tr('交流群', 'Community')),
|
|
1449
|
+
h('p', null, tr('QQ 群:', 'QQ group: ') + (ABOUT_LINKS.qqGroup || tr('待补充', 'To be added'))),
|
|
1450
|
+
ABOUT_LINKS.qqLink
|
|
1451
|
+
? h('a', { href: ABOUT_LINKS.qqLink, target: '_blank', rel: 'noreferrer' }, tr('加入群聊', 'Join group'))
|
|
1452
|
+
: h('span', { className: 'eo-muted' }, tr('群号/链接待补充', 'Group number/link to be added')),
|
|
1453
|
+
),
|
|
1454
|
+
h(
|
|
1455
|
+
'div',
|
|
1456
|
+
{ className: 'eo-about-card' },
|
|
1457
|
+
h('h4', null, tr('支持项目', 'Support the project')),
|
|
1458
|
+
ABOUT_LINKS.donate.length === 0
|
|
1459
|
+
? h('p', null, tr('捐赠方式:待补充。当前可通过反馈、文档和插件试用支持项目。', 'Donation methods: to be added. Feedback, docs, and trying the plugins are the best support today.'))
|
|
1460
|
+
: ABOUT_LINKS.donate.map((item) =>
|
|
1461
|
+
h('p', { key: item.label }, h('a', { href: item.href, target: '_blank', rel: 'noreferrer' }, item.label)),
|
|
1462
|
+
),
|
|
1463
|
+
),
|
|
1464
|
+
),
|
|
1465
|
+
h('p', { className: 'eo-copyright' }, COPYRIGHT),
|
|
1466
|
+
),
|
|
1467
|
+
h(
|
|
1468
|
+
Card,
|
|
1469
|
+
{
|
|
1470
|
+
title: tr('隐私与边界', 'Privacy & boundaries'),
|
|
1471
|
+
subtitle: tr('本地优先,只读分析,写入需确认', 'Local-first, read-only analysis, confirmed writes'),
|
|
1472
|
+
section: 'about',
|
|
1473
|
+
},
|
|
1474
|
+
h(
|
|
1475
|
+
'ul',
|
|
1476
|
+
{ className: 'eo-link-list' },
|
|
1477
|
+
h('li', null, tr('不执行 !!js、不 import 未加载插件、不联网分析。', 'No !!js execution, no importing unloaded plugins, no network analysis.')),
|
|
1478
|
+
h('li', null, tr('应用前写入还原点;恢复同样需要安全确认。', 'A restore point is written before apply; rollback also needs host approval.')),
|
|
1479
|
+
h('li', null, tr('定时/触发插件、已有调用记录、无使用账本项不会自动建议关闭。', 'Scheduled/trigger plugins, used plugins, and items without a ledger never become automatic close candidates.')),
|
|
1480
|
+
h('li', null, tr('Copyright © 2026 Starlit Sky · AGPL-3.0-only', 'Copyright © 2026 Starlit Sky · AGPL-3.0-only')),
|
|
1481
|
+
),
|
|
958
1482
|
),
|
|
959
1483
|
)
|
|
960
1484
|
}
|
|
@@ -966,36 +1490,41 @@ window.__ModuleLoader__.load({
|
|
|
966
1490
|
h('div', { className: 'eo-grid eo-metrics' }, [
|
|
967
1491
|
h(Metric, {
|
|
968
1492
|
key: 'tokens',
|
|
969
|
-
label: '可归属上下文',
|
|
1493
|
+
label: tr('可归属上下文', 'Attributable context'),
|
|
970
1494
|
value: formatTokens(overview.context.totalTokens),
|
|
971
|
-
hint: 'tokens · 不含未归属',
|
|
1495
|
+
hint: tr('tokens · 不含未归属', 'tokens · excludes unattributed') + ' · ' + Math.round(contextPct) + '%',
|
|
1496
|
+
progress: contextPct,
|
|
1497
|
+
progressTone: 'ok',
|
|
972
1498
|
}),
|
|
973
1499
|
h(Metric, {
|
|
974
1500
|
key: 'bundles',
|
|
975
|
-
label: '启用插件',
|
|
1501
|
+
label: tr('启用插件', 'Enabled plugins'),
|
|
976
1502
|
value: enabledBundles + ' / ' + totalBundles,
|
|
977
|
-
hint: '已启用 / 全部插件',
|
|
1503
|
+
hint: tr('已启用 / 全部插件', 'enabled / total plugins'),
|
|
1504
|
+
progress: enabledPct,
|
|
978
1505
|
}),
|
|
979
1506
|
h(Metric, {
|
|
980
1507
|
key: 'compat',
|
|
981
|
-
label: '兼容性',
|
|
982
|
-
value: compat.error + ' 错 · ' + compat.warn + ' 警',
|
|
983
|
-
hint: '错误 / 警告 · 信息 ' + compat.info,
|
|
1508
|
+
label: tr('兼容性', 'Compatibility'),
|
|
1509
|
+
value: compat.error + tr(' 错 · ', ' err · ') + compat.warn + tr(' 警', ' warn'),
|
|
1510
|
+
hint: tr('错误 / 警告 · 信息 ', 'errors / warnings · info ') + compat.info,
|
|
984
1511
|
tone: compat.error > 0 ? 'danger' : compat.warn > 0 ? 'warn' : 'ok',
|
|
1512
|
+
progress: compatPct,
|
|
1513
|
+
progressTone: compat.error > 0 ? 'danger' : compat.warn > 0 ? 'warn' : 'ok',
|
|
985
1514
|
}),
|
|
986
1515
|
h(Metric, {
|
|
987
1516
|
key: 'manage',
|
|
988
|
-
label: '写操作',
|
|
989
|
-
value: overview.managementAvailable ? '可应用' : '只读',
|
|
990
|
-
hint: overview.managementAvailable ? '插件管理器可用' : '缺少插件管理器',
|
|
1517
|
+
label: tr('写操作', 'Write access'),
|
|
1518
|
+
value: overview.managementAvailable ? tr('可应用', 'Ready') : tr('只读', 'Read-only'),
|
|
1519
|
+
hint: overview.managementAvailable ? tr('插件管理器可用', 'Plugin manager available') : tr('缺少插件管理器', 'Plugin manager unavailable'),
|
|
991
1520
|
tone: overview.managementAvailable ? 'ok' : 'danger',
|
|
992
1521
|
}),
|
|
993
1522
|
]),
|
|
994
1523
|
h(
|
|
995
1524
|
Card,
|
|
996
1525
|
{
|
|
997
|
-
title: '
|
|
998
|
-
subtitle: '插件 ↔ 插件 · 插件 ↔ DSH ·
|
|
1526
|
+
title: tr('兼容性检查', 'Compatibility check'),
|
|
1527
|
+
subtitle: tr('插件 ↔ 插件 · 插件 ↔ DSH · 当前配置 / 工作区', 'Plugin ↔ plugin · plugin ↔ DSH · profile / workspace'),
|
|
999
1528
|
section: 'compat',
|
|
1000
1529
|
extra: h(
|
|
1001
1530
|
'div',
|
|
@@ -1007,7 +1536,7 @@ window.__ModuleLoader__.load({
|
|
|
1007
1536
|
variant: 'ghost',
|
|
1008
1537
|
onClick: () => setShowAllFindings((value) => !value),
|
|
1009
1538
|
},
|
|
1010
|
-
showAllFindings ? '收起' : '查看全部 ' + findings.length,
|
|
1539
|
+
showAllFindings ? tr('收起', 'Collapse') : tr('查看全部', 'Show all') + ' ' + findings.length,
|
|
1011
1540
|
)
|
|
1012
1541
|
: null,
|
|
1013
1542
|
h(
|
|
@@ -1016,9 +1545,9 @@ window.__ModuleLoader__.load({
|
|
|
1016
1545
|
variant: 'ghost',
|
|
1017
1546
|
onClick: () => setShowInfo((value) => !value),
|
|
1018
1547
|
},
|
|
1019
|
-
showInfo ? '隐藏信息' : '显示信息',
|
|
1548
|
+
showInfo ? tr('隐藏信息', 'Hide info') : tr('显示信息', 'Show info'),
|
|
1020
1549
|
),
|
|
1021
|
-
h(Badge, { tone: compat.error ? 'danger' : 'ok' }, compat.error ? '需要处理' : '无阻断'),
|
|
1550
|
+
h(Badge, { tone: compat.error ? 'danger' : 'ok' }, compat.error ? tr('需要处理', 'Needs attention') : tr('无阻断', 'No blockers')),
|
|
1022
1551
|
),
|
|
1023
1552
|
},
|
|
1024
1553
|
h(
|
|
@@ -1026,17 +1555,17 @@ window.__ModuleLoader__.load({
|
|
|
1026
1555
|
{ className: 'eo-toolbar', style: { marginBottom: '10px' } },
|
|
1027
1556
|
h(
|
|
1028
1557
|
Field,
|
|
1029
|
-
{ label: '搜索兼容性' },
|
|
1558
|
+
{ label: tr('搜索兼容性', 'Search findings') },
|
|
1030
1559
|
h('input', {
|
|
1031
1560
|
className: 'eo-input',
|
|
1032
|
-
placeholder: '代码 / 标题 / 对象',
|
|
1561
|
+
placeholder: tr('代码 / 标题 / 对象', 'Code / title / subject'),
|
|
1033
1562
|
value: findingQuery,
|
|
1034
1563
|
onChange: (event) => setFindingQuery(event.target.value),
|
|
1035
1564
|
}),
|
|
1036
1565
|
),
|
|
1037
1566
|
h(
|
|
1038
1567
|
Field,
|
|
1039
|
-
{ label: '级别' },
|
|
1568
|
+
{ label: tr('级别', 'Severity') },
|
|
1040
1569
|
h(
|
|
1041
1570
|
'select',
|
|
1042
1571
|
{
|
|
@@ -1044,15 +1573,26 @@ window.__ModuleLoader__.load({
|
|
|
1044
1573
|
value: findingSeverity,
|
|
1045
1574
|
onChange: (event) => setFindingSeverity(event.target.value),
|
|
1046
1575
|
},
|
|
1047
|
-
h('option', { value: 'all' }, '全部'),
|
|
1048
|
-
h('option', { value: 'error' }, '错误'),
|
|
1049
|
-
h('option', { value: 'warn' }, '警告'),
|
|
1050
|
-
h('option', { value: 'info' }, '信息'),
|
|
1576
|
+
h('option', { value: 'all' }, tr('全部', 'All')),
|
|
1577
|
+
h('option', { value: 'error' }, tr('错误', 'Error')),
|
|
1578
|
+
h('option', { value: 'warn' }, tr('警告', 'Warning')),
|
|
1579
|
+
h('option', { value: 'info' }, tr('信息', 'Info')),
|
|
1051
1580
|
),
|
|
1052
1581
|
),
|
|
1053
1582
|
),
|
|
1583
|
+
h(
|
|
1584
|
+
'div',
|
|
1585
|
+
{ className: 'eo-severity-bar', 'aria-label': tr('兼容性分布', 'Compatibility distribution') },
|
|
1586
|
+
compat.error + compat.warn + compat.info === 0
|
|
1587
|
+
? h('span', { className: 'eo-severity-empty' })
|
|
1588
|
+
: [
|
|
1589
|
+
compat.error > 0 ? h('span', { key: 'e', className: 'eo-severity-error', style: { flex: compat.error } }) : null,
|
|
1590
|
+
compat.warn > 0 ? h('span', { key: 'w', className: 'eo-severity-warn', style: { flex: compat.warn } }) : null,
|
|
1591
|
+
compat.info > 0 ? h('span', { key: 'i', className: 'eo-severity-info', style: { flex: compat.info } }) : null,
|
|
1592
|
+
],
|
|
1593
|
+
),
|
|
1054
1594
|
findings.length === 0
|
|
1055
|
-
? h('div', { className: 'eo-empty' }, '没有匹配的兼容性问题。')
|
|
1595
|
+
? h('div', { className: 'eo-empty' }, tr('没有匹配的兼容性问题。', 'No matching compatibility findings.'))
|
|
1056
1596
|
: h(
|
|
1057
1597
|
'div',
|
|
1058
1598
|
{ className: 'eo-findings' },
|
|
@@ -1094,7 +1634,7 @@ window.__ModuleLoader__.load({
|
|
|
1094
1634
|
h(
|
|
1095
1635
|
Card,
|
|
1096
1636
|
{
|
|
1097
|
-
title: '上下文成本',
|
|
1637
|
+
title: tr('上下文成本', 'Context cost'),
|
|
1098
1638
|
section: 'context',
|
|
1099
1639
|
subtitle:
|
|
1100
1640
|
'总计 ' +
|
|
@@ -1104,7 +1644,7 @@ window.__ModuleLoader__.load({
|
|
|
1104
1644
|
extra: h(
|
|
1105
1645
|
Button,
|
|
1106
1646
|
{ variant: 'ghost', onClick: () => setShowContext((value) => !value) },
|
|
1107
|
-
showContext ? '收起明细' : '查看明细',
|
|
1647
|
+
showContext ? tr('收起明细', 'Collapse details') : tr('查看明细', 'View details'),
|
|
1108
1648
|
),
|
|
1109
1649
|
},
|
|
1110
1650
|
h(
|
|
@@ -1142,7 +1682,7 @@ window.__ModuleLoader__.load({
|
|
|
1142
1682
|
null,
|
|
1143
1683
|
h('th', null, 'Section / Tool'),
|
|
1144
1684
|
h('th', null, 'Owner'),
|
|
1145
|
-
h('th', null, '上下文'),
|
|
1685
|
+
h('th', null, tr('上下文', 'Context')),
|
|
1146
1686
|
),
|
|
1147
1687
|
),
|
|
1148
1688
|
h(
|
|
@@ -1184,8 +1724,8 @@ window.__ModuleLoader__.load({
|
|
|
1184
1724
|
h(
|
|
1185
1725
|
Card,
|
|
1186
1726
|
{
|
|
1187
|
-
title: '插件清单',
|
|
1188
|
-
subtitle: `${filteredBundles.length} / ${totalBundles} 个匹配 ·
|
|
1727
|
+
title: tr('插件清单', 'Plugin inventory'),
|
|
1728
|
+
subtitle: `${filteredBundles.length} / ${totalBundles} ` + tr('个匹配 · 只读', 'matched · read-only'),
|
|
1189
1729
|
section: 'inventory',
|
|
1190
1730
|
extra: h(
|
|
1191
1731
|
Button,
|
|
@@ -1198,7 +1738,7 @@ window.__ModuleLoader__.load({
|
|
|
1198
1738
|
{ className: 'eo-toolbar', style: { marginBottom: '10px' } },
|
|
1199
1739
|
h(
|
|
1200
1740
|
Field,
|
|
1201
|
-
{ label: '搜索插件' },
|
|
1741
|
+
{ label: tr('搜索插件', 'Search plugins') },
|
|
1202
1742
|
h('input', {
|
|
1203
1743
|
className: 'eo-input',
|
|
1204
1744
|
placeholder: '名称 / 描述',
|
|
@@ -1208,7 +1748,7 @@ window.__ModuleLoader__.load({
|
|
|
1208
1748
|
),
|
|
1209
1749
|
h(
|
|
1210
1750
|
Field,
|
|
1211
|
-
{ label: '状态' },
|
|
1751
|
+
{ label: tr('状态', 'Status') },
|
|
1212
1752
|
h(
|
|
1213
1753
|
'select',
|
|
1214
1754
|
{
|
|
@@ -1216,15 +1756,15 @@ window.__ModuleLoader__.load({
|
|
|
1216
1756
|
value: bundleFilter,
|
|
1217
1757
|
onChange: (event) => setBundleFilter(event.target.value),
|
|
1218
1758
|
},
|
|
1219
|
-
h('option', { value: 'all' }, '全部'),
|
|
1220
|
-
h('option', { value: 'enabled' }, '启用'),
|
|
1221
|
-
h('option', { value: 'disabled' }, '禁用'),
|
|
1222
|
-
h('option', { value: 'protected' }, '受保护'),
|
|
1759
|
+
h('option', { value: 'all' }, tr('全部', 'All')),
|
|
1760
|
+
h('option', { value: 'enabled' }, tr('启用', 'Enabled')),
|
|
1761
|
+
h('option', { value: 'disabled' }, tr('禁用', 'Disabled')),
|
|
1762
|
+
h('option', { value: 'protected' }, tr('受保护', 'Protected')),
|
|
1223
1763
|
),
|
|
1224
1764
|
),
|
|
1225
1765
|
h(
|
|
1226
1766
|
Field,
|
|
1227
|
-
{ label: '排序' },
|
|
1767
|
+
{ label: tr('排序', 'Sort') },
|
|
1228
1768
|
h(
|
|
1229
1769
|
'select',
|
|
1230
1770
|
{
|
|
@@ -1232,15 +1772,18 @@ window.__ModuleLoader__.load({
|
|
|
1232
1772
|
value: bundleSort,
|
|
1233
1773
|
onChange: (event) => setBundleSort(event.target.value),
|
|
1234
1774
|
},
|
|
1235
|
-
h('option', { value: 'tokens' }, '上下文 tokens'),
|
|
1236
|
-
h('option', { value: 'usage' }, '调用次数'),
|
|
1237
|
-
h('option', { value: 'name' }, '名称'),
|
|
1775
|
+
h('option', { value: 'tokens' }, tr('上下文 tokens', 'Context tokens')),
|
|
1776
|
+
h('option', { value: 'usage' }, tr('调用次数', 'Call count')),
|
|
1777
|
+
h('option', { value: 'name' }, tr('名称', 'Name')),
|
|
1238
1778
|
),
|
|
1239
1779
|
),
|
|
1240
1780
|
),
|
|
1241
1781
|
filteredBundles.length === 0
|
|
1242
|
-
? h('div', { className: 'eo-empty' }, '没有匹配的插件。')
|
|
1782
|
+
? h('div', { className: 'eo-empty' }, tr('没有匹配的插件。', 'No matching plugins.'))
|
|
1243
1783
|
: h(
|
|
1784
|
+
'div',
|
|
1785
|
+
{ className: 'eo-table-wrap' },
|
|
1786
|
+
h(
|
|
1244
1787
|
'table',
|
|
1245
1788
|
{ className: 'eo-table' },
|
|
1246
1789
|
h(
|
|
@@ -1249,13 +1792,13 @@ window.__ModuleLoader__.load({
|
|
|
1249
1792
|
h(
|
|
1250
1793
|
'tr',
|
|
1251
1794
|
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, '调用'),
|
|
1795
|
+
h('th', null, tr('插件', 'Plugin')),
|
|
1796
|
+
h('th', null, tr('状态', 'Status')),
|
|
1797
|
+
h('th', { className: 'eo-col-secondary' }, tr('保护', 'Protected')),
|
|
1798
|
+
h('th', { className: 'eo-col-secondary' }, tr('兼容状态', 'Compatibility')),
|
|
1799
|
+
h('th', null, tr('上下文', 'Context')),
|
|
1800
|
+
h('th', null, tr('占比', 'Share')),
|
|
1801
|
+
h('th', null, tr('调用', 'Calls')),
|
|
1259
1802
|
),
|
|
1260
1803
|
),
|
|
1261
1804
|
h(
|
|
@@ -1279,19 +1822,19 @@ window.__ModuleLoader__.load({
|
|
|
1279
1822
|
h(
|
|
1280
1823
|
Badge,
|
|
1281
1824
|
{ tone: bundle.enabled ? 'ok' : 'neutral' },
|
|
1282
|
-
bundle.enabled ? '已启用' : '已禁用',
|
|
1825
|
+
bundle.enabled ? tr('已启用', 'Enabled') : tr('已禁用', 'Disabled'),
|
|
1283
1826
|
),
|
|
1284
1827
|
),
|
|
1285
1828
|
h(
|
|
1286
1829
|
'td',
|
|
1287
|
-
|
|
1288
|
-
bundle.protected ? h(Badge, { tone: 'warn' }, '受保护') : '—',
|
|
1830
|
+
{ className: 'eo-col-secondary' },
|
|
1831
|
+
bundle.protected ? h(Badge, { tone: 'warn' }, tr('受保护', 'Protected')) : '—',
|
|
1289
1832
|
),
|
|
1290
|
-
h('td', { className: 'eo-muted' }, bundle.guardStatus ? guardLabel(bundle.guardStatus) : '—'),
|
|
1833
|
+
h('td', { className: 'eo-muted eo-col-secondary' }, bundle.guardStatus ? guardLabel(bundle.guardStatus) : '—'),
|
|
1291
1834
|
h('td', null, formatNumber(bundle.contextTokens)),
|
|
1292
1835
|
h(
|
|
1293
1836
|
'td',
|
|
1294
|
-
{ className: 'eo-muted', title: '占可归属上下文的比例' },
|
|
1837
|
+
{ className: 'eo-muted eo-share-cell', title: tr('占可归属上下文的比例', 'Share of attributable context') },
|
|
1295
1838
|
totalContextTokens > 0
|
|
1296
1839
|
? Math.round((bundle.contextTokens / totalContextTokens) * 100) + '%'
|
|
1297
1840
|
: '—',
|
|
@@ -1307,12 +1850,13 @@ window.__ModuleLoader__.load({
|
|
|
1307
1850
|
),
|
|
1308
1851
|
),
|
|
1309
1852
|
),
|
|
1853
|
+
),
|
|
1310
1854
|
),
|
|
1311
1855
|
h(
|
|
1312
1856
|
Card,
|
|
1313
1857
|
{
|
|
1314
|
-
title: '
|
|
1315
|
-
subtitle: '先建议,后确认;受保护项永不改动',
|
|
1858
|
+
title: tr('插件减负方案', 'Slim plan'),
|
|
1859
|
+
subtitle: tr('先建议,后确认;受保护项永不改动', 'Suggest first, confirm later; protected items never change'),
|
|
1316
1860
|
section: 'draft',
|
|
1317
1861
|
},
|
|
1318
1862
|
h(
|
|
@@ -1320,7 +1864,7 @@ window.__ModuleLoader__.load({
|
|
|
1320
1864
|
{ className: 'eo-toolbar' },
|
|
1321
1865
|
h(
|
|
1322
1866
|
Field,
|
|
1323
|
-
{ label: '任务类型' },
|
|
1867
|
+
{ label: tr('任务类型', 'Task type') },
|
|
1324
1868
|
h(
|
|
1325
1869
|
'select',
|
|
1326
1870
|
{
|
|
@@ -1328,18 +1872,18 @@ window.__ModuleLoader__.load({
|
|
|
1328
1872
|
value: taskTag,
|
|
1329
1873
|
onChange: (event) => setTaskTag(event.target.value),
|
|
1330
1874
|
},
|
|
1331
|
-
TASK_TAGS.map(([value
|
|
1332
|
-
h('option', { value, key: value },
|
|
1875
|
+
TASK_TAGS.map(([value]) =>
|
|
1876
|
+
h('option', { value, key: value }, value === 'unknown' ? tr('自动识别', 'Auto-detect') : taskLabel(value)),
|
|
1333
1877
|
),
|
|
1334
1878
|
),
|
|
1335
1879
|
),
|
|
1336
1880
|
h(
|
|
1337
1881
|
Field,
|
|
1338
|
-
{ label: '任务目标(可选)' },
|
|
1882
|
+
{ label: tr('任务目标(可选)', 'Goal (optional)') },
|
|
1339
1883
|
h('input', {
|
|
1340
1884
|
className: 'eo-input',
|
|
1341
1885
|
value: goal,
|
|
1342
|
-
placeholder: '例如:修复登录页崩溃',
|
|
1886
|
+
placeholder: tr('例如:修复登录页崩溃', 'e.g. fix a login crash'),
|
|
1343
1887
|
onChange: (event) => setGoal(event.target.value),
|
|
1344
1888
|
onKeyDown: (event) => {
|
|
1345
1889
|
if (event.key === 'Enter') void generateDraft()
|
|
@@ -1349,7 +1893,7 @@ window.__ModuleLoader__.load({
|
|
|
1349
1893
|
h(
|
|
1350
1894
|
Button,
|
|
1351
1895
|
{ variant: 'accent', onClick: generateDraft, disabled: draftBusy },
|
|
1352
|
-
draftBusy ? '生成中…' : '生成方案',
|
|
1896
|
+
draftBusy ? tr('生成中…', 'Building…') : tr('生成方案', 'Build plan'),
|
|
1353
1897
|
),
|
|
1354
1898
|
),
|
|
1355
1899
|
draft
|
|
@@ -1359,25 +1903,25 @@ window.__ModuleLoader__.load({
|
|
|
1359
1903
|
h(
|
|
1360
1904
|
'div',
|
|
1361
1905
|
{ className: 'eo-note' },
|
|
1362
|
-
'
|
|
1906
|
+
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
1907
|
),
|
|
1364
1908
|
h(
|
|
1365
1909
|
'div',
|
|
1366
1910
|
{ 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)),
|
|
1911
|
+
h(Badge, { tone: 'neutral' }, tr('保留', 'Keep') + ' ' + draft.summary.keep),
|
|
1912
|
+
h(Badge, { tone: 'ok' }, tr('启用', 'Enable') + ' ' + draft.summary.enable),
|
|
1913
|
+
h(Badge, { tone: 'danger' }, tr('建议关闭', 'Close') + ' ' + draft.summary.disable),
|
|
1914
|
+
h(Badge, { tone: 'info' }, tr('复核', 'Review') + ' ' + draft.summary.review),
|
|
1915
|
+
h(Badge, { tone: 'neutral' }, tr('受保护', 'Protected') + ' ' + draft.summary.protected),
|
|
1916
|
+
h(Badge, { tone: 'warn' }, tr('周期保护', 'Scheduled') + ' ' + periodicDraftCount),
|
|
1917
|
+
h(Badge, { tone: 'ok' }, tr('证据强', 'Strong evidence') + ' ' + strongDraftCount),
|
|
1918
|
+
h(Badge, { tone: 'warn' }, tr('任务:', 'Task: ') + taskLabel(draft.task.tag)),
|
|
1375
1919
|
),
|
|
1376
1920
|
actionableDraftItems.length === 0
|
|
1377
1921
|
? h(
|
|
1378
1922
|
'div',
|
|
1379
1923
|
{ className: 'eo-empty' },
|
|
1380
|
-
'本轮没有强证据候选:周期/触发器、已有调用记录、无使用账本或低置信项只进入人工复核。',
|
|
1924
|
+
tr('本轮没有强证据候选:周期/触发器、已有调用记录、无使用账本或低置信项只进入人工复核。', 'No strong candidates this round: scheduled/trigger plugins, used plugins, missing ledger, or low confidence all go to review.'),
|
|
1381
1925
|
)
|
|
1382
1926
|
: h(
|
|
1383
1927
|
'div',
|
|
@@ -1397,9 +1941,9 @@ window.__ModuleLoader__.load({
|
|
|
1397
1941
|
type: 'checkbox',
|
|
1398
1942
|
checked: selected[item.id] === true,
|
|
1399
1943
|
onChange: () => toggleItem(item.id),
|
|
1400
|
-
'aria-label': '选择 ' + item.name,
|
|
1944
|
+
'aria-label': tr('选择 ', 'Select ') + item.name,
|
|
1401
1945
|
})
|
|
1402
|
-
: h('span', { className: 'eo-lock', title: '受保护或非低风险' }),
|
|
1946
|
+
: h('span', { className: 'eo-lock', title: tr('受保护或非低风险', 'Protected or not low-risk') }),
|
|
1403
1947
|
h(
|
|
1404
1948
|
'div',
|
|
1405
1949
|
{ className: 'eo-item-main' },
|
|
@@ -1412,9 +1956,9 @@ window.__ModuleLoader__.load({
|
|
|
1412
1956
|
{ tone: actionTone(item.action) },
|
|
1413
1957
|
actionLabel(item.action),
|
|
1414
1958
|
),
|
|
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,
|
|
1959
|
+
h(Badge, { tone: riskTone(item.risk) }, tr('风险:', 'Risk: ') + riskLabel(item.risk)),
|
|
1960
|
+
item.protected ? h(Badge, { tone: 'neutral' }, tr('受保护', 'Protected')) : null,
|
|
1961
|
+
item.periodic ? h(Badge, { tone: 'warn' }, tr('周期/触发器', 'Scheduled / trigger')) : null,
|
|
1418
1962
|
item.usageState
|
|
1419
1963
|
? h(
|
|
1420
1964
|
Badge,
|
|
@@ -1430,9 +1974,9 @@ window.__ModuleLoader__.load({
|
|
|
1430
1974
|
)
|
|
1431
1975
|
: null,
|
|
1432
1976
|
item.evidenceLevel === 'strong'
|
|
1433
|
-
? h(Badge, { tone: 'ok' }, '证据强')
|
|
1977
|
+
? h(Badge, { tone: 'ok' }, tr('证据强', 'Strong evidence'))
|
|
1434
1978
|
: item.evidenceLevel === 'insufficient'
|
|
1435
|
-
? h(Badge, { tone: 'neutral' }, '证据不足')
|
|
1979
|
+
? h(Badge, { tone: 'neutral' }, tr('证据不足', 'Insufficient evidence'))
|
|
1436
1980
|
: null,
|
|
1437
1981
|
),
|
|
1438
1982
|
h('div', { className: 'eo-item-reason' }, item.reason),
|
|
@@ -1452,7 +1996,7 @@ window.__ModuleLoader__.load({
|
|
|
1452
1996
|
'div',
|
|
1453
1997
|
{ className: 'eo-item-side' },
|
|
1454
1998
|
h('span', null, Number(item.score).toFixed(2)),
|
|
1455
|
-
h('small', null, '评分'),
|
|
1999
|
+
h('small', null, tr('评分', 'Score')),
|
|
1456
2000
|
),
|
|
1457
2001
|
),
|
|
1458
2002
|
),
|
|
@@ -1463,13 +2007,13 @@ window.__ModuleLoader__.load({
|
|
|
1463
2007
|
h(
|
|
1464
2008
|
'span',
|
|
1465
2009
|
{ className: 'eo-applybar-text' },
|
|
1466
|
-
selectedCount + ' 个低风险项已选择 ·
|
|
2010
|
+
selectedCount + tr(' 个低风险项已选择 · 应用前会写入还原点', ' low-risk items selected · a restore point is written before apply'),
|
|
1467
2011
|
),
|
|
1468
2012
|
h(
|
|
1469
2013
|
'div',
|
|
1470
2014
|
{ className: 'eo-inline' },
|
|
1471
|
-
h(Button, { variant: 'ghost', onClick: selectAll }, '全选低风险'),
|
|
1472
|
-
h(Button, { variant: 'ghost', onClick: clearSelection }, '清空'),
|
|
2015
|
+
h(Button, { variant: 'ghost', onClick: selectAll }, tr('全选低风险', 'Select low-risk')),
|
|
2016
|
+
h(Button, { variant: 'ghost', onClick: clearSelection }, tr('清空', 'Clear')),
|
|
1473
2017
|
h(
|
|
1474
2018
|
Button,
|
|
1475
2019
|
{
|
|
@@ -1477,12 +2021,12 @@ window.__ModuleLoader__.load({
|
|
|
1477
2021
|
onClick: openApply,
|
|
1478
2022
|
disabled: selectedCount === 0 || draftBusy,
|
|
1479
2023
|
},
|
|
1480
|
-
'应用选中',
|
|
2024
|
+
tr('应用选中', 'Apply selected'),
|
|
1481
2025
|
),
|
|
1482
2026
|
h(
|
|
1483
2027
|
Button,
|
|
1484
2028
|
{ variant: 'danger', onClick: openRollback, disabled: draftBusy },
|
|
1485
|
-
'
|
|
2029
|
+
tr('恢复最近', 'Restore latest'),
|
|
1486
2030
|
),
|
|
1487
2031
|
),
|
|
1488
2032
|
),
|
|
@@ -1490,20 +2034,20 @@ window.__ModuleLoader__.load({
|
|
|
1490
2034
|
: h(
|
|
1491
2035
|
'div',
|
|
1492
2036
|
{ className: 'eo-empty' },
|
|
1493
|
-
'生成方案后,这里会出现可解释的保留/启用/禁用建议。建议默认不会改动任何插件。',
|
|
2037
|
+
tr('生成方案后,这里会出现可解释的保留/启用/禁用建议。建议默认不会改动任何插件。', 'After building a plan, explainable keep/enable/disable suggestions appear here. Nothing changes by default.'),
|
|
1494
2038
|
),
|
|
1495
2039
|
),
|
|
1496
2040
|
applyResult
|
|
1497
2041
|
? h(
|
|
1498
2042
|
Card,
|
|
1499
2043
|
{
|
|
1500
|
-
title: '应用结果',
|
|
1501
|
-
subtitle: applyResult.rolledBack ? '
|
|
2044
|
+
title: tr('应用结果', 'Apply result'),
|
|
2045
|
+
subtitle: applyResult.rolledBack ? tr('中途失败,已自动恢复', 'Failed midway; automatically restored') : tr('变更已写入当前配置', 'Changes written to the current profile'),
|
|
1502
2046
|
section: 'result',
|
|
1503
2047
|
extra: h(
|
|
1504
2048
|
Badge,
|
|
1505
2049
|
{ tone: applyResult.rolledBack ? 'warn' : 'ok' },
|
|
1506
|
-
applyResult.rolledBack ? '
|
|
2050
|
+
applyResult.rolledBack ? tr('已恢复', 'Restored') : tr('完成', 'Done'),
|
|
1507
2051
|
),
|
|
1508
2052
|
},
|
|
1509
2053
|
h(
|
|
@@ -1515,10 +2059,10 @@ window.__ModuleLoader__.load({
|
|
|
1515
2059
|
h(
|
|
1516
2060
|
'tr',
|
|
1517
2061
|
null,
|
|
1518
|
-
h('th', null, 'Item'),
|
|
1519
|
-
h('th', null, 'Status'),
|
|
1520
|
-
h('th', null, 'Application'),
|
|
1521
|
-
h('th', null, 'Note'),
|
|
2062
|
+
h('th', null, tr('项目', 'Item')),
|
|
2063
|
+
h('th', null, tr('状态', 'Status')),
|
|
2064
|
+
h('th', null, tr('应用方式', 'Application')),
|
|
2065
|
+
h('th', null, tr('说明', 'Note')),
|
|
1522
2066
|
),
|
|
1523
2067
|
),
|
|
1524
2068
|
h(
|
|
@@ -1570,7 +2114,7 @@ window.__ModuleLoader__.load({
|
|
|
1570
2114
|
onClick: () => {
|
|
1571
2115
|
if (navigator.clipboard) {
|
|
1572
2116
|
void navigator.clipboard.writeText(applyResult.token)
|
|
1573
|
-
notify('
|
|
2117
|
+
notify(tr('还原点已复制', 'Restore point copied'))
|
|
1574
2118
|
}
|
|
1575
2119
|
},
|
|
1576
2120
|
},
|
|
@@ -1645,26 +2189,26 @@ window.__ModuleLoader__.load({
|
|
|
1645
2189
|
h(
|
|
1646
2190
|
Card,
|
|
1647
2191
|
{
|
|
1648
|
-
title: '工作流配方',
|
|
1649
|
-
subtitle: '把业务目标翻译成可校验、可导出的工作流蓝图',
|
|
1650
|
-
extra: h(Badge, { tone: 'info' }, '最多 4 组追问'),
|
|
2192
|
+
title: tr('工作流配方', 'Workflow recipe'),
|
|
2193
|
+
subtitle: tr('把业务目标翻译成可校验、可导出的工作流蓝图', 'Turn a business goal into a validated, exportable workflow blueprint'),
|
|
2194
|
+
extra: h(Badge, { tone: 'info' }, tr('最多 4 组追问', 'At most 4 question groups')),
|
|
1651
2195
|
},
|
|
1652
2196
|
h(
|
|
1653
2197
|
'div',
|
|
1654
2198
|
{ className: 'eo-form-grid' },
|
|
1655
2199
|
h(
|
|
1656
2200
|
Field,
|
|
1657
|
-
{ label: '业务目标', className: 'eo-wide' },
|
|
2201
|
+
{ label: tr('业务目标', 'Goal'), className: 'eo-wide' },
|
|
1658
2202
|
h('textarea', {
|
|
1659
2203
|
className: 'eo-textarea',
|
|
1660
2204
|
value: recipeForm.goal,
|
|
1661
|
-
placeholder: '例如:我想每周自动整理项目周报,数据来自 Git log',
|
|
2205
|
+
placeholder: tr('例如:我想每周自动整理项目周报,数据来自 Git log', 'e.g. a weekly project report from Git log'),
|
|
1662
2206
|
onChange: (event) => updateRecipe('goal', event.target.value),
|
|
1663
2207
|
}),
|
|
1664
2208
|
),
|
|
1665
2209
|
h(
|
|
1666
2210
|
Field,
|
|
1667
|
-
{ label: '项目 / 范围' },
|
|
2211
|
+
{ label: tr('项目 / 范围', 'Project / scope') },
|
|
1668
2212
|
h('input', {
|
|
1669
2213
|
className: 'eo-input',
|
|
1670
2214
|
value: recipeForm.scope,
|
|
@@ -1673,7 +2217,7 @@ window.__ModuleLoader__.load({
|
|
|
1673
2217
|
),
|
|
1674
2218
|
h(
|
|
1675
2219
|
Field,
|
|
1676
|
-
{ label: '频率' },
|
|
2220
|
+
{ label: tr('频率', 'Frequency') },
|
|
1677
2221
|
h('input', {
|
|
1678
2222
|
className: 'eo-input',
|
|
1679
2223
|
value: recipeForm.frequency,
|
|
@@ -1682,7 +2226,7 @@ window.__ModuleLoader__.load({
|
|
|
1682
2226
|
),
|
|
1683
2227
|
h(
|
|
1684
2228
|
Field,
|
|
1685
|
-
{ label: '数据来源', hint: '逗号分隔' },
|
|
2229
|
+
{ label: tr('数据来源', 'Sources'), hint: tr('逗号分隔', 'comma-separated') },
|
|
1686
2230
|
h('input', {
|
|
1687
2231
|
className: 'eo-input',
|
|
1688
2232
|
value: recipeForm.sources,
|
|
@@ -1691,7 +2235,7 @@ window.__ModuleLoader__.load({
|
|
|
1691
2235
|
),
|
|
1692
2236
|
h(
|
|
1693
2237
|
Field,
|
|
1694
|
-
{ label: '输出格式' },
|
|
2238
|
+
{ label: tr('输出格式', 'Output format') },
|
|
1695
2239
|
h('input', {
|
|
1696
2240
|
className: 'eo-input',
|
|
1697
2241
|
value: recipeForm.outputFormat,
|
|
@@ -1700,7 +2244,7 @@ window.__ModuleLoader__.load({
|
|
|
1700
2244
|
),
|
|
1701
2245
|
h(
|
|
1702
2246
|
Field,
|
|
1703
|
-
{ label: '交付方式' },
|
|
2247
|
+
{ label: tr('交付方式', 'Delivery') },
|
|
1704
2248
|
h('input', {
|
|
1705
2249
|
className: 'eo-input',
|
|
1706
2250
|
value: recipeForm.delivery,
|
|
@@ -1709,7 +2253,7 @@ window.__ModuleLoader__.load({
|
|
|
1709
2253
|
),
|
|
1710
2254
|
h(
|
|
1711
2255
|
Field,
|
|
1712
|
-
{ label: '失败处理' },
|
|
2256
|
+
{ label: tr('失败处理', 'Failure handling') },
|
|
1713
2257
|
h('input', {
|
|
1714
2258
|
className: 'eo-input',
|
|
1715
2259
|
value: recipeForm.onFailure,
|
|
@@ -1718,7 +2262,7 @@ window.__ModuleLoader__.load({
|
|
|
1718
2262
|
),
|
|
1719
2263
|
h(
|
|
1720
2264
|
Field,
|
|
1721
|
-
{ label: '验收标准', hint: '逗号分隔', className: 'eo-wide' },
|
|
2265
|
+
{ label: tr('验收标准', 'Acceptance criteria'), hint: tr('逗号分隔', 'comma-separated'), className: 'eo-wide' },
|
|
1722
2266
|
h('input', {
|
|
1723
2267
|
className: 'eo-input',
|
|
1724
2268
|
value: recipeForm.acceptance,
|
|
@@ -1732,12 +2276,12 @@ window.__ModuleLoader__.load({
|
|
|
1732
2276
|
h(
|
|
1733
2277
|
'span',
|
|
1734
2278
|
{ className: 'eo-muted' },
|
|
1735
|
-
'UI 预览按内置能力目录判断可用性;精确 agent-scope 校验以 recipe_plan_workflow 工具为准。',
|
|
2279
|
+
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
2280
|
),
|
|
1737
2281
|
h(
|
|
1738
2282
|
Button,
|
|
1739
2283
|
{ variant: 'accent', onClick: generateRecipe, disabled: recipeBusy },
|
|
1740
|
-
recipeBusy ? '生成中…' : '生成工作流蓝图',
|
|
2284
|
+
recipeBusy ? tr('生成中…', 'Building…') : tr('生成工作流蓝图', 'Build workflow blueprint'),
|
|
1741
2285
|
),
|
|
1742
2286
|
),
|
|
1743
2287
|
),
|
|
@@ -1746,7 +2290,7 @@ window.__ModuleLoader__.load({
|
|
|
1746
2290
|
: h(
|
|
1747
2291
|
'div',
|
|
1748
2292
|
{ className: 'eo-empty' },
|
|
1749
|
-
'填写目标后生成蓝图。这里只生成计划,不会创建 schedule,也不会修改插件。',
|
|
2293
|
+
tr('填写目标后生成蓝图。这里只生成计划,不会创建 schedule,也不会修改插件。', 'Fill in a goal to generate a blueprint. This only plans; it creates no schedule and changes no plugin.'),
|
|
1750
2294
|
),
|
|
1751
2295
|
)
|
|
1752
2296
|
}
|
|
@@ -1759,19 +2303,19 @@ window.__ModuleLoader__.load({
|
|
|
1759
2303
|
h(
|
|
1760
2304
|
Card,
|
|
1761
2305
|
{
|
|
1762
|
-
title: '蓝图预览',
|
|
2306
|
+
title: tr('蓝图预览', 'Blueprint preview'),
|
|
1763
2307
|
subtitle:
|
|
1764
|
-
'模板 ' +
|
|
2308
|
+
tr('模板 ', 'Template ') +
|
|
1765
2309
|
blueprint.template +
|
|
1766
2310
|
' · ' +
|
|
1767
2311
|
blueprint.steps.length +
|
|
1768
|
-
' 个步骤 · ' +
|
|
2312
|
+
tr(' 个步骤 · ', ' steps · ') +
|
|
1769
2313
|
blueprint.minPluginSet.length +
|
|
1770
|
-
' 个最小插件',
|
|
2314
|
+
tr(' 个最小插件', ' minimum plugins'),
|
|
1771
2315
|
extra: h(
|
|
1772
2316
|
'div',
|
|
1773
2317
|
{ className: 'eo-inline' },
|
|
1774
|
-
h(Button, { variant: 'ghost', onClick: exportRecipe }, '导出运行手册'),
|
|
2318
|
+
h(Button, { variant: 'ghost', onClick: exportRecipe }, tr('导出运行手册', 'Export runbook')),
|
|
1775
2319
|
),
|
|
1776
2320
|
},
|
|
1777
2321
|
h(
|
|
@@ -1849,7 +2393,7 @@ window.__ModuleLoader__.load({
|
|
|
1849
2393
|
h(
|
|
1850
2394
|
'div',
|
|
1851
2395
|
{ className: 'eo-issue' },
|
|
1852
|
-
h('span', null, h('strong', null, '
|
|
2396
|
+
h('span', null, h('strong', null, tr('恢复:', 'Restore: ')), blueprint.rollback),
|
|
1853
2397
|
),
|
|
1854
2398
|
),
|
|
1855
2399
|
h(
|
|
@@ -1939,13 +2483,13 @@ window.__ModuleLoader__.load({
|
|
|
1939
2483
|
h(
|
|
1940
2484
|
'div',
|
|
1941
2485
|
{ className: 'eo-modal', onClick: (event) => event.stopPropagation() },
|
|
1942
|
-
h('h3', null, isApply ? '确认应用精简方案' : '
|
|
2486
|
+
h('h3', null, isApply ? tr('确认应用精简方案', 'Confirm slim plan') : tr('确认恢复', 'Confirm restore')),
|
|
1943
2487
|
h(
|
|
1944
2488
|
'p',
|
|
1945
2489
|
null,
|
|
1946
2490
|
isApply
|
|
1947
|
-
? '
|
|
1948
|
-
: '将恢复最近一次应用前的插件启用状态;已被外部改动的项会跳过。',
|
|
2491
|
+
? tr('只会应用低风险项;受保护项不会被改动。应用前会写入还原点。', 'Only low-risk items are applied; protected items never change. A restore point is written first.')
|
|
2492
|
+
: tr('将恢复最近一次应用前的插件启用状态;已被外部改动的项会跳过。', 'Restores plugin state before the latest apply; externally changed items are skipped.'),
|
|
1949
2493
|
),
|
|
1950
2494
|
isApply
|
|
1951
2495
|
? h(
|
|
@@ -1963,7 +2507,7 @@ window.__ModuleLoader__.load({
|
|
|
1963
2507
|
{ className: 'eo-item-title' },
|
|
1964
2508
|
h('span', { className: 'eo-item-name' }, item.name),
|
|
1965
2509
|
h(Badge, { tone: actionTone(item.action) }, actionLabel(item.action)),
|
|
1966
|
-
h(Badge, { tone: riskTone(item.risk) }, '风险:' + riskLabel(item.risk)),
|
|
2510
|
+
h(Badge, { tone: riskTone(item.risk) }, tr('风险:', 'Risk: ') + riskLabel(item.risk)),
|
|
1967
2511
|
),
|
|
1968
2512
|
h('div', { className: 'eo-item-reason' }, item.reason),
|
|
1969
2513
|
),
|
|
@@ -1974,11 +2518,11 @@ window.__ModuleLoader__.load({
|
|
|
1974
2518
|
h(
|
|
1975
2519
|
'div',
|
|
1976
2520
|
{ className: 'eo-modal-actions' },
|
|
1977
|
-
h(Button, { variant: 'ghost', onClick: onCancel, disabled: busy }, '取消'),
|
|
2521
|
+
h(Button, { variant: 'ghost', onClick: onCancel, disabled: busy }, tr('取消', 'Cancel')),
|
|
1978
2522
|
h(
|
|
1979
2523
|
Button,
|
|
1980
2524
|
{ variant: isApply ? 'accent' : 'danger', onClick: onConfirm, disabled: busy },
|
|
1981
|
-
busy ? '处理中…' : isApply ? '确认应用' : '
|
|
2525
|
+
busy ? tr('处理中…', 'Working…') : isApply ? tr('确认应用', 'Confirm apply') : tr('确认恢复', 'Confirm restore'),
|
|
1982
2526
|
),
|
|
1983
2527
|
),
|
|
1984
2528
|
),
|