dsh-plugin-trim 0.3.7 → 0.3.9

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/client.js CHANGED
@@ -24,8 +24,8 @@ window.__ModuleLoader__.load({
24
24
  ]
25
25
 
26
26
  const LOCALE_KEY = 'dsh-experience-optimizer.locale'
27
- const ONBOARDING_KEY = 'dsh-experience-optimizer.onboarding.v1'
28
- const MAIN_GUIDE_KEY = 'dsh-experience-optimizer.main-guide.v1'
27
+ const ONBOARDING_KEY = 'dsh-experience-optimizer.onboarding.v2'
28
+ const MAIN_GUIDE_KEY = 'dsh-experience-optimizer.main-guide.v2'
29
29
  const ABOUT_LINKS = {
30
30
  repo: 'https://github.com/Starlit-Sky-code/dsh-experience-optimizer',
31
31
  npmTrim: 'https://www.npmjs.com/package/dsh-plugin-trim',
@@ -39,19 +39,19 @@ window.__ModuleLoader__.load({
39
39
  }
40
40
  const COPYRIGHT = 'Copyright © 2026 Starlit Sky · AGPL-3.0-only'
41
41
  const TABS = [
42
- { id: 'trim', zh: '插件减负', en: 'Plugin diet', icon: 'gauge' },
42
+ { id: 'trim', zh: '插件体检', en: 'Plugin checkup', icon: 'gauge' },
43
43
  { id: 'recipe', zh: '工作流配方', en: 'Workflow recipe', icon: 'recipe' },
44
44
  { id: 'tutorial', zh: '教程', en: 'Guide', icon: 'book' },
45
45
  { id: 'about', zh: '关于', en: 'About', icon: 'info' },
46
46
  { id: 'settings', zh: '设置', en: 'Settings', icon: 'settings' },
47
47
  ]
48
48
  const EN_TEXT = {
49
- '插件减负': 'Plugin diet',
49
+ '插件体检': 'Plugin checkup',
50
50
  '工作流配方': 'Workflow recipe',
51
51
  '教程': 'Guide',
52
52
  '关于': 'About',
53
53
  '设置': 'Settings',
54
- '减负与兼容': 'Diet & compatibility',
54
+ '体检与兼容': 'Checkup & compatibility',
55
55
  '可归属上下文': 'Attributable context',
56
56
  '启用插件': 'Enabled plugins',
57
57
  '兼容性': 'Compatibility',
@@ -202,7 +202,7 @@ window.__ModuleLoader__.load({
202
202
  }
203
203
 
204
204
  const CSS = `
205
- .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}
205
+ .eo-root{--eo-ease:cubic-bezier(.16,1,.3,1);--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}
206
206
  .eo-root *{box-sizing:border-box}
207
207
  .eo-hero{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:0 0 2px}
208
208
  .eo-hero-copy{min-width:0}
@@ -214,17 +214,17 @@ window.__ModuleLoader__.load({
214
214
  .eo-tabs::-webkit-scrollbar{display:none}
215
215
  .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}
216
216
  .eo-icon{flex:0 0 auto}
217
- .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}
218
- .eo-progress-track i{display:block;height:100%;border-radius:4px;background:var(--eo-primary);opacity:.65;transition:width .2s ease;min-width:2px}
219
- .eo-severity-bar{display:flex;gap:3px;height:5px;margin:0 0 10px}
220
- .eo-severity-bar span{display:block;height:100%;border-radius:3px}
217
+ .eo-progress-track{display:block;width:100%;min-width:40px;height:6px;border-radius:6px;background:var(--dsw-alias-bg-module-platform,rgba(127,127,127,.1));overflow:hidden;margin-top:7px;box-shadow:inset 0 0 0 .5px var(--eo-border)}
218
+ .eo-progress-track i{display:block;height:100%;border-radius:6px;background:linear-gradient(90deg,var(--eo-primary),color-mix(in srgb,var(--eo-primary) 55%,var(--dsw-alias-state-business-primary,#4a7fd6)));transition:width .45s var(--eo-ease,cubic-bezier(.16,1,.3,1));min-width:2px}
219
+ .eo-severity-bar{display:flex;gap:3px;height:8px;margin:0 0 8px;border-radius:5px;overflow:hidden;background:var(--dsw-alias-bg-module-platform,rgba(127,127,127,.1))}
220
+ .eo-severity-bar span{display:block;height:100%;border-radius:4px}
221
221
  .eo-severity-error{background:var(--eo-error)}
222
222
  .eo-severity-warn{background:var(--dsw-alias-state-warning-primary,#9a6700)}
223
223
  .eo-severity-info{background:var(--dsw-alias-state-business-primary,#4a7fd6)}
224
224
  .eo-severity-empty{background:var(--dsw-alias-bg-module-platform,rgba(127,127,127,.12));flex:1}
225
- .eo-progress-ok i{background:var(--eo-success)}
226
- .eo-progress-warn i{background:var(--dsw-alias-state-warning-primary,#9a6700)}
227
- .eo-progress-danger i{background:var(--eo-error)}
225
+ .eo-progress-ok i{background:linear-gradient(90deg,var(--eo-success),color-mix(in srgb,var(--eo-success) 65%,var(--dsw-alias-state-business-primary,#4a7fd6)))}
226
+ .eo-progress-warn i{background:linear-gradient(90deg,var(--dsw-alias-state-warning-primary,#9a6700),var(--amber,#fbbf24))}
227
+ .eo-progress-danger i{background:linear-gradient(90deg,var(--eo-error),color-mix(in srgb,var(--eo-error) 70%,var(--dsw-alias-state-warning-primary,#9a6700)))}
228
228
  .eo-progress-dots{display:flex;gap:6px;align-items:center;margin:12px 0 2px}
229
229
  .eo-progress-dot{width:6px;height:6px;border-radius:50%;background:var(--eo-border-strong)}
230
230
  .eo-progress-dot-active{width:18px;border-radius:4px;background:var(--eo-primary)}
@@ -294,22 +294,30 @@ window.__ModuleLoader__.load({
294
294
  .eo-inventory-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:8px}
295
295
  .eo-inventory-card code{font:400 11px/16px var(--eo-code);word-break:break-all;color:var(--eo-secondary)}
296
296
  .eo-inventory-card-meta{display:flex;gap:10px;flex-wrap:wrap;margin-top:6px;color:var(--eo-tertiary);font-size:11px}
297
- .eo-main-guide{position:fixed;right:24px;left:auto;bottom:24px;z-index:30;width:min(340px,calc(100vw - 32px));padding:14px 16px;border:.5px solid var(--dsw-alias-border-l4,rgba(127,127,127,.25));border-radius:14px;background:var(--dsw-alias-bg-layer-1,#fff);box-shadow:0 14px 44px rgba(0,0,0,.2);color:var(--eo-primary);font-size:13px;line-height:20px}
298
- .eo-guide-arrow{position:absolute;left:-16px;top:-20px;width:44px;height:44px;border-radius:50%;display:grid;place-items:center;background:var(--dsw-alias-button-primary-fill,var(--eo-primary));color:var(--dsw-alias-label-primary-inverted,#fff);transform:rotate(-12deg);box-shadow:0 8px 20px rgba(0,0,0,.18)}
299
- .eo-guide-kicker{margin:0 0 3px;color:var(--eo-tertiary);font:500 10px/16px var(--eo-code);letter-spacing:.12em}
300
- .eo-main-guide h3{margin:0 0 8px;font-size:16px;line-height:23px}
301
- .eo-guide-path{display:flex;align-items:center;gap:5px;flex-wrap:wrap;margin:0 0 8px;font-size:12px;font-weight:500}
302
- .eo-guide-path span{padding:2px 7px;border-radius:5px;background:var(--dsw-alias-bg-module-platform,rgba(127,127,127,.08))}
297
+ .eo-main-guide{position:fixed;left:18px;right:auto;bottom:150px;z-index:30;box-sizing:border-box;width:min(380px,calc(100vw - 32px));padding:16px 18px;border:.5px solid var(--dsw-alias-border-l4,rgba(127,127,127,.25));border-radius:14px;background:var(--dsw-alias-bg-layer-1,#fff);box-shadow:0 14px 44px rgba(0,0,0,.2);color:var(--eo-primary);font-size:14px;line-height:22px}
298
+ .eo-guide-beacon{position:fixed;left:18px;bottom:84px;z-index:31;display:flex;flex-direction:column;align-items:center;gap:2px;color:var(--eo-primary);pointer-events:none;font-size:12px;line-height:17px}
299
+ .eo-guide-beacon span{padding:2px 8px;border-radius:5px;background:var(--dsw-alias-bg-layer-1,#fff);border:.5px solid var(--eo-border-strong);box-shadow:0 4px 14px rgba(0,0,0,.12)}
300
+ .eo-guide-beacon .eo-icon{color:var(--eo-primary);animation:eo-guide-bob 1.6s ease-in-out infinite}
301
+ @keyframes eo-guide-bob{0%,100%{transform:translateY(0)}50%{transform:translateY(5px)}}
302
+ .eo-guide-arrow{position:absolute;left:6px;top:auto;bottom:-27px;width:54px;height:54px;border-radius:50%;display:grid;place-items:center;background:var(--dsw-alias-button-primary-fill,var(--eo-primary));color:var(--dsw-alias-label-primary-inverted,#fff);box-shadow:0 8px 20px rgba(0,0,0,.18)}
303
+ .eo-guide-kicker{margin:0 0 4px;color:var(--eo-tertiary);font:500 11px/17px var(--eo-code);letter-spacing:.12em}
304
+ .eo-main-guide h3{margin:0 0 9px;font-size:18px;line-height:26px}
305
+ .eo-guide-path{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin:0 0 9px;font-size:13px;line-height:20px;font-weight:500}
306
+ .eo-guide-path span{padding:2px 8px;border-radius:5px;background:var(--dsw-alias-bg-module-platform,rgba(127,127,127,.08))}
303
307
  .eo-guide-path i{font-style:normal;color:var(--eo-tertiary)}
304
- .eo-guide-note{margin:0;color:var(--eo-tertiary);font-size:11px;line-height:17px}
305
- .eo-guide-steps{max-height:220px;overflow:auto;margin:10px 0 0;padding:0;list-style:none;border-top:.5px solid var(--eo-border)}
306
- .eo-guide-steps li{display:flex;gap:7px;align-items:flex-start;padding:7px 0;border-bottom:.5px solid var(--eo-border)}
307
- .eo-guide-steps b{font:500 10px/18px var(--eo-code);color:var(--eo-tertiary);flex:0 0 auto}
308
- .eo-guide-steps span{flex:0 0 auto;font-weight:500;font-size:12px}
309
- .eo-guide-steps small{color:var(--eo-tertiary);font-size:11px;line-height:17px}
308
+ .eo-guide-note{margin:0;color:var(--eo-tertiary);font-size:12.5px;line-height:19px}
309
+ .eo-guide-steps{max-height:180px;overflow:auto;margin:11px 0 0;padding:0;list-style:none;border-top:.5px solid var(--eo-border)}
310
+ .eo-guide-steps li{display:flex;gap:8px;align-items:flex-start;padding:8px 0;border-bottom:.5px solid var(--eo-border)}
311
+ .eo-guide-steps b{font:500 11px/19px var(--eo-code);color:var(--eo-tertiary);flex:0 0 auto}
312
+ .eo-guide-steps span{flex:0 0 auto;font-weight:500;font-size:13px;line-height:19px}
313
+ .eo-guide-steps small{color:var(--eo-tertiary);font-size:12px;line-height:18px}
310
314
  .eo-guide-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:12px}
311
- .eo-main-guide .eo-btn{height:28px;font-size:11px;padding:0 9px}
312
- @media(max-width:600px){.eo-main-guide{left:12px;right:12px;bottom:12px;width:auto}.eo-guide-arrow{display:none}}
315
+ .eo-main-guide .eo-btn{height:30px;font-size:12px;padding:0 10px}
316
+ @media(max-width:600px){.eo-main-guide{left:12px;right:12px;bottom:12px;width:auto;max-height:calc(100vh - 24px);overflow:auto;font-size:13px;line-height:20px}.eo-guide-beacon{position:fixed;left:18px;bottom:84px;z-index:31;display:flex;flex-direction:column;align-items:center;gap:2px;color:var(--eo-primary);pointer-events:none;font-size:12px;line-height:17px}
317
+ .eo-guide-beacon span{padding:2px 8px;border-radius:5px;background:var(--dsw-alias-bg-layer-1,#fff);border:.5px solid var(--eo-border-strong);box-shadow:0 4px 14px rgba(0,0,0,.12)}
318
+ .eo-guide-beacon .eo-icon{color:var(--eo-primary);animation:eo-guide-bob 1.6s ease-in-out infinite}
319
+ @keyframes eo-guide-bob{0%,100%{transform:translateY(0)}50%{transform:translateY(5px)}}
320
+ .eo-guide-arrow{display:none}}
313
321
  .eo-about-hero{display:block;width:100%;height:auto;border-radius:12px;background:#0b1422;margin:0 0 10px}
314
322
  .eo-card-title{margin:0;font-size:14px;line-height:22px;font-weight:500;letter-spacing:0}
315
323
  .eo-card-sub{margin:2px 0 0;font-size:12px;line-height:18px;color:var(--eo-tertiary)}
@@ -378,8 +386,31 @@ window.__ModuleLoader__.load({
378
386
  .eo-owner-list{display:flex;flex-direction:column;gap:7px}
379
387
  .eo-owner-head{display:flex;justify-content:space-between;gap:10px;font-size:12px;line-height:18px;color:var(--eo-tertiary)}
380
388
  .eo-owner-head span:first-child{font-family:var(--eo-code);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
381
- .eo-bar{height:3px;border-radius:3px;background:var(--dsw-alias-bg-module-platform,rgba(127,127,127,.1));margin-top:4px;overflow:hidden}
382
- .eo-bar i{display:block;height:100%;border-radius:3px;background:var(--eo-primary);opacity:.55}
389
+ .eo-context-mix{display:flex;align-items:center;gap:18px;padding:2px 0 12px;margin-bottom:10px;border-bottom:.5px solid var(--eo-border)}
390
+ .eo-context-donut{position:relative;width:82px;height:82px;border-radius:50%;flex:0 0 auto;background:conic-gradient(var(--eo-success) 0 var(--eo-ok,0%),var(--dsw-alias-state-warning-primary,#9a6700) var(--eo-ok,0%) 100%)}
391
+ .eo-context-donut:after{content:"";position:absolute;inset:10px;border-radius:50%;background:var(--eo-card-bg,#fff)}
392
+ .eo-context-donut-label{position:absolute;inset:10px;z-index:1;display:flex;flex-direction:column;align-items:center;justify-content:center;line-height:1}
393
+ .eo-context-donut-label b{font-size:17px;line-height:22px;font-weight:600;color:var(--eo-primary)}
394
+ .eo-context-donut-label small{font-size:9px;line-height:13px;color:var(--eo-tertiary);margin-top:2px}
395
+ .eo-context-legend{display:flex;flex-direction:column;gap:6px;min-width:0;flex:1}
396
+ .eo-context-legend-row{display:grid;grid-template-columns:8px minmax(0,1fr) auto auto;gap:7px;align-items:center;font-size:11px;line-height:17px;color:var(--eo-tertiary)}
397
+ .eo-context-legend-row strong{color:var(--eo-primary);font-weight:500;font-family:var(--eo-code);font-size:11px}
398
+ .eo-context-legend-row em{font-style:normal;color:var(--eo-tertiary);font-family:var(--eo-code);font-size:10px;min-width:34px;text-align:right}
399
+ .eo-dot-ok,.eo-dot-warn,.eo-dot-error,.eo-dot-info{display:inline-block;width:7px;height:7px;border-radius:50%;flex:0 0 auto}
400
+ .eo-dot-ok{background:var(--eo-success)}
401
+ .eo-dot-warn{background:var(--dsw-alias-state-warning-primary,#9a6700)}
402
+ .eo-dot-error{background:var(--eo-error)}
403
+ .eo-dot-info{background:var(--dsw-alias-state-business-primary,#4a7fd6)}
404
+ .eo-severity-legend{display:flex;flex-wrap:wrap;gap:12px;margin:0 0 10px;color:var(--eo-tertiary);font-size:11px;line-height:17px}
405
+ .eo-severity-legend span{display:inline-flex;align-items:center;gap:5px}
406
+ .eo-compat-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-top:12px;padding-top:12px;border-top:.5px solid var(--eo-border)}
407
+ .eo-share-cell{display:flex;flex-direction:column;gap:3px;min-width:64px}
408
+ .eo-share-bar{width:52px;height:4px;border-radius:4px;background:var(--dsw-alias-bg-module-platform,rgba(127,127,127,.1));overflow:hidden}
409
+ .eo-share-bar i{display:block;height:100%;min-width:2px;border-radius:4px;background:linear-gradient(90deg,var(--eo-primary),var(--dsw-alias-state-business-primary,#4a7fd6))}
410
+ .eo-inventory-share{height:4px;border-radius:4px;background:var(--dsw-alias-bg-module-platform,rgba(127,127,127,.1));overflow:hidden;margin-top:9px}
411
+ .eo-inventory-share i{display:block;height:100%;min-width:2px;border-radius:4px;background:linear-gradient(90deg,var(--eo-primary),var(--dsw-alias-state-business-primary,#4a7fd6));opacity:.85}
412
+ .eo-bar{height:6px;border-radius:6px;background:var(--dsw-alias-bg-module-platform,rgba(127,127,127,.1));margin-top:5px;overflow:hidden;box-shadow:inset 0 0 0 .5px var(--eo-border)}
413
+ .eo-bar i{display:block;height:100%;border-radius:6px;background:linear-gradient(90deg,var(--eo-primary),var(--dsw-alias-state-business-primary,#4a7fd6));opacity:.85;transition:width .45s var(--eo-ease,cubic-bezier(.16,1,.3,1))}
383
414
  .eo-issue{display:flex;gap:8px;align-items:flex-start;padding:8px 10px;border-radius:var(--dsw-radius-md,8px);font-size:12px;line-height:18px;background:var(--dsw-alias-bg-module-platform,rgba(127,127,127,.06));border:.5px solid var(--eo-border)}
384
415
  .eo-issue-error{border-color:color-mix(in srgb,var(--eo-error) 35%,transparent);color:var(--eo-error)}
385
416
  .eo-issue-warn{border-color:color-mix(in srgb,var(--dsw-alias-state-warning-primary,#9a6700) 35%,transparent)}
@@ -412,10 +443,38 @@ window.__ModuleLoader__.load({
412
443
  .eo-steps li{margin:0 0 8px;padding-left:2px}
413
444
  .eo-steps strong{color:var(--eo-primary);font-weight:500}
414
445
  .eo-settings-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 18px}
446
+ .eo-settings-readonly{border-left:3px solid var(--eo-primary);background:var(--dsw-alias-bg-module-platform,rgba(127,127,127,.05))}
415
447
  .eo-settings-row{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:7px 0;border-bottom:.5px solid var(--eo-border);font-size:13px;line-height:20px}
416
448
  .eo-settings-row:last-child{border-bottom:0}
417
449
  .eo-settings-row span:first-child{color:var(--eo-secondary);flex:0 0 auto}
418
450
  .eo-settings-row code{font:400 11px/16px var(--eo-code);color:var(--eo-primary);text-align:right;word-break:break-all}
451
+ .eo-settings-control{width:190px;flex:0 1 190px;height:30px;font-size:12px;line-height:18px}
452
+ .eo-settings-row-wide{flex-wrap:wrap}
453
+ .eo-settings-row-wide .eo-settings-control{width:100%;flex:1 1 240px}
454
+ .eo-check{display:inline-flex;align-items:center;gap:6px;font-size:12px;color:var(--eo-primary);cursor:pointer;min-height:30px}
455
+ .eo-check input{width:14px;height:14px;accent-color:var(--eo-primary);cursor:pointer}
456
+ .eo-param{display:flex;flex-direction:column;gap:5px;flex:1 1 220px;min-width:220px}
457
+ .eo-param-section{display:flex;flex-direction:column;gap:0;margin-top:14px;padding-top:12px;border-top:.5px solid var(--eo-border)}
458
+ .eo-param-section-head{display:flex;align-items:baseline;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-bottom:4px}
459
+ .eo-param-section-head strong{font-size:13px;line-height:20px;color:var(--eo-primary)}
460
+ .eo-param-section-head span{font-size:11px;line-height:17px;color:var(--eo-tertiary)}
461
+ .eo-param-row{display:flex;align-items:center;gap:14px;padding:8px 0;border-bottom:.5px solid var(--eo-border)}
462
+ .eo-param-row:last-child{border-bottom:0;padding-bottom:0}
463
+ .eo-param-row>span{flex:0 0 120px;color:var(--eo-secondary);font-size:12px;line-height:18px}
464
+ .eo-param-head{display:flex;align-items:center;gap:5px}
465
+ .eo-param-input{width:70px;height:30px;padding:0 7px;text-align:center;font:500 12px/18px var(--eo-code);appearance:textfield}
466
+ .eo-param-input::-webkit-inner-spin-button,.eo-param-input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
467
+ .eo-stepper{display:flex;flex-direction:column;gap:2px}
468
+ .eo-stepper-btn{width:22px;height:14px;display:grid;place-items:center;padding:0;border:.5px solid var(--eo-border-strong);border-radius:4px;background:var(--dsw-alias-bg-module-platform,rgba(127,127,127,.05));color:var(--eo-secondary);cursor:pointer;transition:background .16s ease,color .16s ease,border-color .16s ease}
469
+ .eo-stepper-btn:hover{border-color:var(--eo-primary);color:var(--eo-primary);background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.1))}
470
+ .eo-stepper-btn:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--eo-primary));outline-offset:1px}
471
+ .eo-stepper-btn .eo-icon{display:block}
472
+ .eo-stepper-up .eo-icon{transform:rotate(180deg)}
473
+ .eo-param-track{position:relative;height:6px;border-radius:6px;background:var(--eo-border)}
474
+ .eo-param-track i{display:block;height:100%;min-width:3px;border-radius:6px;background:linear-gradient(90deg,var(--eo-primary),var(--dsw-alias-state-success-primary,#1a7f37));transition:width .28s var(--eo-ease,cubic-bezier(.16,1,.3,1))}
475
+ .eo-param-track b{position:absolute;top:50%;width:9px;height:9px;border-radius:50%;background:var(--dsw-alias-bg-layer-1,#fff);border:1.5px solid var(--eo-primary);transform:translate(-50%,-50%);box-shadow:0 1px 4px rgba(0,0,0,.15)}
476
+ .eo-param-scale{display:flex;justify-content:space-between;color:var(--eo-tertiary);font:10px/14px var(--eo-code);letter-spacing:.02em}
477
+ @media(max-width:560px){.eo-settings-control{width:100%;flex:1 1 100%}.eo-param-row{align-items:flex-start;flex-direction:column;gap:5px}.eo-param-row>span{flex:0 0 auto}.eo-param{width:100%;min-width:0}}
419
478
  .eo-codeblock{margin:0;padding:12px;border:.5px solid var(--eo-border-strong);border-radius:var(--dsw-radius-md,8px);background:var(--dsw-alias-bg-module-platform,rgba(127,127,127,.05));font:400 11px/18px var(--eo-code);color:var(--eo-secondary);white-space:pre-wrap;word-break:break-word}
420
479
  .eo-faq{border-bottom:.5px solid var(--eo-border);padding:8px 0}
421
480
  .eo-faq:last-child{border-bottom:0}
@@ -424,10 +483,73 @@ window.__ModuleLoader__.load({
424
483
  @media(max-width:560px){.eo-settings-grid{grid-template-columns:1fr}}
425
484
  .eo-inline{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
426
485
  .eo-spacer{height:0}
486
+
487
+ /* Conversation checkup bubble */
488
+ .eo-bubble-toast{display:inline-flex;align-items:center;gap:8px;max-width:min(360px,calc(100vw - 32px));padding:7px 8px 7px 10px;border:.5px solid var(--dsw-alias-border-l2,rgba(127,127,127,.2));border-radius:10px;background:var(--dsw-alias-bg-layer-1,rgba(255,255,255,.8));color:var(--dsw-alias-label-secondary,#5f6b7a);box-shadow:0 8px 24px rgba(0,0,0,.1);animation:eo-bubble-in .45s var(--eo-ease,cubic-bezier(.16,1,.3,1)) both}
489
+ .eo-bubble-pulse{width:6px;height:6px;border-radius:50%;background:var(--dsw-alias-state-success-primary,#1a7f37);box-shadow:0 0 0 3px color-mix(in srgb,var(--dsw-alias-state-success-primary,#1a7f37) 16%,transparent);flex:0 0 auto;animation:eo-pulse 2.4s ease-in-out infinite}
490
+ .eo-bubble-copy{display:flex;flex-direction:column;min-width:0;gap:1px}
491
+ .eo-bubble-copy b{color:var(--dsw-alias-label-primary,#1a1a1a);font-size:11px;line-height:15px;font-weight:500}
492
+ .eo-bubble-copy span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary,#8b96a5);font-size:10.5px;line-height:15px}
493
+ .eo-bubble-close{appearance:none;border:0;background:transparent;color:var(--dsw-alias-label-tertiary,#8b96a5);font-size:16px;line-height:1;cursor:pointer;padding:0 1px;border-radius:4px;flex:0 0 auto}
494
+ .eo-bubble-close:hover{color:var(--dsw-alias-label-primary,#1a1a1a)}
495
+ .eo-bubble-close:focus-visible{outline:2px solid var(--dsw-focus-ring-color,#1a5fb4);outline-offset:2px}
496
+
497
+ /* Thought-line checkup strip */
498
+ .eo-thought{min-width:0}
499
+ .eo-thought-note{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin:0 0 8px;padding:5px 8px;border:.5px solid var(--dsw-alias-border-l2,rgba(127,127,127,.16));border-radius:6px;background:var(--dsw-alias-bg-module-platform,rgba(127,127,127,.045));font-size:10.5px;line-height:16px;color:var(--dsw-alias-label-tertiary,#8b96a5);animation:eo-thought-in .4s var(--eo-ease,cubic-bezier(.16,1,.3,1)) both}
500
+ .eo-thought-pulse{width:5px;height:5px;border-radius:50%;background:var(--dsw-alias-state-success-primary,#1a7f37);box-shadow:0 0 0 2px color-mix(in srgb,var(--dsw-alias-state-success-primary,#1a7f37) 14%,transparent)}
501
+ .eo-thought.is-running .eo-thought-pulse{animation:eo-pulse 1.4s ease-in-out infinite}
502
+ .eo-thought-label{font-weight:500;color:var(--dsw-alias-label-secondary,#5f6b7a)}
503
+ .eo-thought-meta{font:10px/16px var(--ds-font-family-code,ui-monospace,monospace);color:var(--dsw-alias-label-tertiary,#8b96a5)}
504
+ .eo-thought-warn{padding:0 5px;border-radius:4px;background:color-mix(in srgb,var(--dsw-alias-state-warning-primary,#9a6700) 12%,transparent);color:var(--dsw-alias-state-warning-primary,#9a6700);font:10px/16px var(--ds-font-family-code,ui-monospace,monospace)}
505
+ .eo-thought-body{min-width:0}
506
+
507
+ /* Micro-interactions */
508
+ .eo-tab{transition:color .18s ease,background .18s ease}
509
+ .eo-tab-active:after{transform-origin:left;animation:eo-underline .22s var(--eo-ease,cubic-bezier(.16,1,.3,1)) both}
510
+ .eo-tab-panel{animation:eo-panel-in .38s var(--eo-ease,cubic-bezier(.16,1,.3,1)) both}
511
+ .eo-btn{transition:background .14s ease,border-color .14s ease,color .14s ease,opacity .14s ease,transform .12s ease}
512
+ .eo-btn:active:not(:disabled){transform:translateY(1px) scale(.985)}
513
+ .eo-card{transition:border-color .2s ease,background .2s ease}
514
+ .eo-item{transition:background .16s ease}
515
+ .eo-item:hover{background:var(--eo-hover)}
516
+ .eo-collapse{display:grid;grid-template-rows:1fr;opacity:1;transition:grid-template-rows .32s var(--eo-ease,cubic-bezier(.16,1,.3,1)),opacity .24s ease}
517
+ .eo-collapse.is-collapsed{grid-template-rows:0fr;opacity:0;pointer-events:none}
518
+ .eo-collapse-inner{overflow:hidden;min-height:0}
519
+ .eo-modal-backdrop{animation:eo-fade-in .18s ease both}
520
+ .eo-modal{animation:eo-modal-in .32s var(--eo-ease,cubic-bezier(.16,1,.3,1)) both}
521
+ .eo-progress-track i,.eo-bar i{transition:width .4s var(--eo-ease,cubic-bezier(.16,1,.3,1))}
522
+ @keyframes eo-pulse{0%,100%{opacity:.55;transform:scale(.92)}50%{opacity:1;transform:scale(1)}}
523
+ @keyframes eo-pop-in{from{opacity:0;transform:translateY(6px) scale(.98)}to{opacity:1;transform:none}}
524
+ @keyframes eo-panel-in{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:none}}
525
+ @keyframes eo-underline{from{transform:scaleX(0)}to{transform:scaleX(1)}}
526
+ @keyframes eo-fade-in{from{opacity:0}to{opacity:1}}
527
+ @keyframes eo-modal-in{from{opacity:0;transform:translateY(8px) scale(.985)}to{opacity:1;transform:none}}
528
+ @keyframes eo-thought-in{from{opacity:0;transform:translateY(3px)}to{opacity:1;transform:none}}
529
+ @keyframes eo-bubble-in{from{opacity:0;transform:translateY(6px) scale(.97)}to{opacity:1;transform:none}}
530
+ .eo-activation{max-width:760px;padding:16px;border:.5px solid var(--dsw-alias-border-l2,rgba(127,127,127,.2));border-radius:12px;background:var(--dsw-alias-bg-layer-1,#fff);color:var(--dsw-alias-label-primary,#1a1a1a);box-shadow:0 10px 30px rgba(0,0,0,.08);animation:eo-activation-in .4s var(--eo-ease,cubic-bezier(.16,1,.3,1)) both}
531
+ .eo-activation-head{display:flex;align-items:flex-start;gap:10px}
532
+ .eo-activation-icon{width:32px;height:32px;border-radius:9px;display:grid;place-items:center;flex:0 0 auto;background:color-mix(in srgb,var(--dsw-alias-state-success-primary,#1a7f37) 10%,transparent);color:var(--dsw-alias-state-success-primary,#1a7f37)}
533
+ .eo-activation h3{margin:0;color:var(--dsw-alias-label-primary,#1a1a1a);font-size:14px;line-height:21px;font-weight:600}
534
+ .eo-activation p{margin:3px 0 0;color:var(--dsw-alias-label-tertiary,#8b96a5);font-size:12px;line-height:18px}
535
+ .eo-activation-steps{list-style:none;margin:13px 0 0;padding:0;display:grid;gap:7px}
536
+ .eo-activation-steps li{display:grid;grid-template-columns:22px minmax(0,1fr);gap:8px;align-items:start}
537
+ .eo-activation-steps b{color:var(--dsw-alias-label-tertiary,#8b96a5);font:10px/18px var(--ds-font-family-code,ui-monospace,monospace)}
538
+ .eo-activation-steps strong{display:block;color:var(--dsw-alias-label-primary,#1a1a1a);font-size:12px;line-height:18px;font-weight:500}
539
+ .eo-activation-steps small{display:block;color:var(--dsw-alias-label-tertiary,#8b96a5);font-size:11px;line-height:17px}
540
+ .eo-activation-actions{display:flex;gap:7px;margin-top:14px}
541
+ .eo-activation-btn{appearance:none;height:28px;padding:0 10px;border:.5px solid var(--dsw-alias-border-l3,rgba(127,127,127,.28));border-radius:6px;background:transparent;color:var(--dsw-alias-label-secondary,#5f6b7a);font:inherit;font-size:11px;cursor:pointer;transition:background .18s ease,color .18s ease,transform .14s ease}
542
+ .eo-activation-btn:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.08));color:var(--dsw-alias-label-primary,#1a1a1a)}
543
+ .eo-activation-btn:active{transform:translateY(1px)}
544
+ .eo-activation-primary{border-color:var(--dsw-alias-button-primary-fill,#1a1a1a);background:var(--dsw-alias-button-primary-fill,#1a1a1a);color:var(--dsw-alias-label-primary-inverted,#fff)}
545
+ .eo-activation-primary:hover{background:var(--dsw-alias-button-primary-hover,#333);color:var(--dsw-alias-label-primary-inverted,#fff)}
546
+ @keyframes eo-activation-in{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
547
+
427
548
  @keyframes eo-spin{to{transform:rotate(360deg)}}
428
549
  @keyframes eo-in{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
429
550
  @media(max-width:820px){.eo-layout-two .eo-findings,.eo-layout-two .eo-list,.eo-layout-two .eo-owner-list,.eo-inventory-grid{grid-template-columns:1fr}.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}}
430
551
  @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}}
552
+ @media(prefers-reduced-motion:reduce){.eo-bubble-toast,.eo-bubble-pulse,.eo-thought-pulse,.eo-tab-active:after,.eo-tab-panel,.eo-modal-backdrop,.eo-modal,.eo-toast,.eo-activation{animation:none}.eo-collapse,.eo-btn,.eo-bubble-close,.eo-tab{transition:none}.eo-btn:active:not(:disabled),.eo-bubble-close:active{transform:none}}
431
553
  `
432
554
 
433
555
 
@@ -503,9 +625,15 @@ window.__ModuleLoader__.load({
503
625
  extra || null,
504
626
  )
505
627
  : null,
506
- collapsible && collapsed
507
- ? null
508
- : h('div', { className: 'eo-card-body' }, children),
628
+ h(
629
+ 'div',
630
+ {
631
+ className: 'eo-collapse' + (collapsible && collapsed ? ' is-collapsed' : ''),
632
+ 'aria-hidden': collapsible && collapsed ? 'true' : undefined,
633
+ inert: collapsible && collapsed ? '' : undefined,
634
+ },
635
+ h('div', { className: 'eo-collapse-inner' }, children),
636
+ ),
509
637
  )
510
638
  }
511
639
 
@@ -527,12 +655,143 @@ window.__ModuleLoader__.load({
527
655
  return new Intl.NumberFormat('zh-CN').format(Number(value) || 0)
528
656
  }
529
657
 
658
+ const trimOverviewStore = (() => {
659
+ let state = { status: 'idle', data: null, error: '' }
660
+ let promise = null
661
+ const listeners = new Set()
662
+ const emit = () => {
663
+ listeners.forEach((listener) => listener(state))
664
+ }
665
+ return {
666
+ get: () => state,
667
+ subscribe(listener) {
668
+ listeners.add(listener)
669
+ return () => listeners.delete(listener)
670
+ },
671
+ ensure() {
672
+ if (promise || state.status === 'ready') return
673
+ state = { status: 'loading', data: null, error: '' }
674
+ emit()
675
+ promise = fetchJson(API + '/overview')
676
+ .then((data) => {
677
+ state = { status: 'ready', data, error: '' }
678
+ })
679
+ .catch((err) => {
680
+ state = {
681
+ status: 'error',
682
+ data: null,
683
+ error: err instanceof Error ? err.message : String(err),
684
+ }
685
+ })
686
+ .finally(() => {
687
+ promise = null
688
+ emit()
689
+ })
690
+ },
691
+ }
692
+ })()
693
+
694
+ function useTrimOverview() {
695
+ const [snapshot, setSnapshot] = useState(trimOverviewStore.get())
696
+ useEffect(() => {
697
+ const unsubscribe = trimOverviewStore.subscribe(setSnapshot)
698
+ trimOverviewStore.ensure()
699
+ return unsubscribe
700
+ }, [])
701
+ return snapshot
702
+ }
703
+
530
704
  function formatTokens(value) {
531
705
  const n = Number(value) || 0
532
706
  if (n >= 10000) return (n / 1000).toFixed(1) + 'k'
533
707
  return formatNumber(n)
534
708
  }
535
709
 
710
+ function CheckupBubble({ sessionId }) {
711
+ const dismissKey = 'dsh-experience-optimizer.bubble.' + (sessionId || 'default')
712
+ const [visible, setVisible] = useState(false)
713
+ const [dismissed, setDismissed] = useState(() => {
714
+ try {
715
+ return typeof sessionStorage !== 'undefined' && sessionStorage.getItem(dismissKey) === '1'
716
+ } catch {
717
+ return false
718
+ }
719
+ })
720
+
721
+ useEffect(() => {
722
+ try {
723
+ setDismissed(typeof sessionStorage !== 'undefined' && sessionStorage.getItem(dismissKey) === '1')
724
+ } catch {
725
+ setDismissed(false)
726
+ }
727
+ }, [dismissKey])
728
+
729
+ useEffect(() => {
730
+ if (dismissed) return undefined
731
+ const timer = setTimeout(() => {
732
+ setVisible(true)
733
+ try {
734
+ if (typeof sessionStorage !== 'undefined') sessionStorage.setItem(dismissKey, '1')
735
+ } catch {
736
+ // Ignore storage failures; the reminder still shows once for this mount.
737
+ }
738
+ }, 1400)
739
+ return () => clearTimeout(timer)
740
+ }, [dismissed, dismissKey])
741
+
742
+ useEffect(() => {
743
+ if (!visible) return undefined
744
+ const timer = setTimeout(() => setVisible(false), 7000)
745
+ return () => clearTimeout(timer)
746
+ }, [visible])
747
+
748
+ if (!visible || dismissed) return null
749
+
750
+ const close = () => {
751
+ setVisible(false)
752
+ setDismissed(true)
753
+ }
754
+
755
+ return h(
756
+ 'div',
757
+ { className: 'eo-bubble-toast', role: 'status' },
758
+ h('span', { className: 'eo-bubble-pulse', 'aria-hidden': 'true' }),
759
+ h(
760
+ 'div',
761
+ { className: 'eo-bubble-copy' },
762
+ h('b', null, tr('插件体检', 'Plugin checkup')),
763
+ h('span', null, tr('先量成本,再决定关什么。', 'Measure first, then decide what to close.')),
764
+ ),
765
+ h('button', { type: 'button', className: 'eo-bubble-close', onClick: close, 'aria-label': tr('关闭提醒', 'Dismiss') }, '×'),
766
+ )
767
+ }
768
+
769
+ function ReasoningCheckup({ text, running, renderFactorySlot }) {
770
+ const snapshot = useTrimOverview()
771
+ const data = snapshot.data
772
+ const content = typeof renderFactorySlot === 'function'
773
+ ? renderFactorySlot('conversation.chat.reasoning.content', { text, running })
774
+ : null
775
+ const tokens = data ? formatTokens(data.context.totalTokens) : ''
776
+ return h(
777
+ 'div',
778
+ { className: 'eo-thought' + (running ? ' is-running' : '') },
779
+ data
780
+ ? h(
781
+ 'div',
782
+ {
783
+ className: 'eo-thought-note',
784
+ title: tr('体检数据来自当前 profile;54% 是示例降幅,不是关闭目标。', 'Checkup data comes from the current profile; 54% is a sample reduction, not a close target.'),
785
+ },
786
+ h('span', { className: 'eo-thought-pulse', 'aria-hidden': 'true' }),
787
+ h('span', { className: 'eo-thought-label' }, tr('插件体检', 'Plugin checkup')),
788
+ h('span', { className: 'eo-thought-meta' }, tokens + ' tokens'),
789
+ )
790
+ : null,
791
+ h('div', { className: 'eo-thought-body' }, content),
792
+ )
793
+ }
794
+
536
795
  function actionLabel(action) {
537
796
  const map = {
538
797
  keep: ['保留', 'Keep'],
@@ -701,7 +960,8 @@ window.__ModuleLoader__.load({
701
960
  ['rect', { x: '14', y: '14', width: '6', height: '6', rx: '1' }],
702
961
  ],
703
962
  chevron: [['path', { d: 'M6 9l6 6 6-6' }]],
704
- arrow: [['path', { d: 'M19 5L5 19M5 9v10h10' }]],
963
+ arrow: [['path', { d: 'M20 12H4M10 6l-6 6 6 6' }]],
964
+ arrowDown: [['path', { d: 'M12 4v16M6 14l6 6 6-6' }]],
705
965
  }
706
966
 
707
967
  function Icon({ name, size = 16 }) {
@@ -833,7 +1093,7 @@ window.__ModuleLoader__.load({
833
1093
  viewBox: '0 0 1200 300',
834
1094
  className: 'eo-about-hero',
835
1095
  role: 'img',
836
- 'aria-label': tr('DSH 体验优化器', 'DSH Experience Optimizer'),
1096
+ 'aria-label': tr('DSH 插件体检', 'DSH Plugin Checkup'),
837
1097
  },
838
1098
  h('defs', null,
839
1099
  h('linearGradient', { id: 'eo-about-bg', x1: '0', y1: '0', x2: '1', y2: '1' },
@@ -853,10 +1113,10 @@ window.__ModuleLoader__.load({
853
1113
  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 }),
854
1114
  h('path', { d: 'M1002 151 L1008 157 L1019 144', fill: 'none', stroke: '#fbbf24', strokeWidth: 2, strokeLinecap: 'round', strokeLinejoin: 'round' }),
855
1115
  h('text', { x: '64', y: '72', fill: '#5eead4', fontFamily: 'ui-monospace, monospace', fontSize: '13', letterSpacing: '2.4' }, 'DSH PLUGIN SUITE · AGPL-3.0'),
856
- h('text', { x: '62', y: '142', fill: '#f2f7ff', fontFamily: 'Noto Sans SC, sans-serif', fontSize: '44', fontWeight: '700' }, tr('DSH 体验优化器', 'DSH Experience Optimizer')),
1116
+ h('text', { x: '62', y: '142', fill: '#f2f7ff', fontFamily: 'Noto Sans SC, sans-serif', fontSize: '44', fontWeight: '700' }, tr('DSH 插件体检', 'DSH Plugin Checkup')),
857
1117
  h('text', { x: '64', y: '184', fill: '#c3d3e8', fontFamily: 'Noto Sans SC, sans-serif', fontSize: '20' }, tr('少一点插件负担,多一点兼容确定性。', 'Less plugin overhead, more compatibility certainty.')),
858
1118
  h('g', { transform: 'translate(64 220)' },
859
- [tr('插件减负', 'Plugin diet'), tr('兼容性', 'Compatibility'), tr('工作流配方', 'Workflow recipe')].map((label, i) =>
1119
+ [tr('插件体检', 'Plugin checkup'), tr('兼容性', 'Compatibility'), tr('工作流配方', 'Workflow recipe')].map((label, i) =>
860
1120
  h('g', { key: label, transform: `translate(${i * 150} 0)` },
861
1121
  h('rect', { width: '138', height: '30', rx: '15', fill: 'rgba(94,234,212,.08)', stroke: 'rgba(94,234,212,.35)' }),
862
1122
  h('circle', { cx: '16', cy: '15', r: '3', fill: ['#5eead4','#60a5fa','#fbbf24'][i] }),
@@ -873,7 +1133,7 @@ window.__ModuleLoader__.load({
873
1133
  const storage = browserStorage()
874
1134
  try { return storage ? storage.getItem(MAIN_GUIDE_KEY) !== '1' : true } catch { return true }
875
1135
  })
876
- const [stepsOpen, setStepsOpen] = useState(false)
1136
+ const [stepsOpen, setStepsOpen] = useState(true)
877
1137
  const dismiss = () => {
878
1138
  const storage = browserStorage()
879
1139
  try { if (storage) storage.setItem(MAIN_GUIDE_KEY, '1') } catch { /* ignore */ }
@@ -883,16 +1143,25 @@ window.__ModuleLoader__.load({
883
1143
  const steps = [
884
1144
  [tr('点击「更多」', 'Open “More”'), tr('在 DSH 主界面打开更多菜单。', 'Open the More menu on the DSH main screen.')],
885
1145
  [tr('点击「设置」', 'Open “Settings”'), tr('进入设置页。', 'Open Settings.')],
886
- [tr('点击「体验优化」', 'Open “Experience Optimizer”'), tr('在 Agent 预设下方或插件页签里找到体验优化。', 'Find it below Agent presets or in the plugins tab.')],
887
- [tr('生成减负方案', 'Build a slim plan'), tr('选任务或写目标,先看依据,再决定是否应用。', 'Pick a task or goal, read the evidence, then decide.')],
1146
+ [tr('点击「插件体检」', 'Open “Plugin checkup”'), tr('在 Agent 预设下方或插件页签里找到插件体检。', 'Find it below Agent presets or in the plugins tab.')],
1147
+ [tr('生成体检方案', 'Build a checkup plan'), tr('选任务或写目标,先看依据,再决定是否应用。', 'Pick a task or goal, read the evidence, then decide.')],
888
1148
  [tr('需要时看教程', 'Open the guide'), tr('教程、常见问题和关于都在同一页。', 'Guide, FAQ, and About live in the same panel.')],
889
1149
  ]
890
1150
  return h(
1151
+ React.Fragment,
1152
+ null,
1153
+ h(
1154
+ 'div',
1155
+ { className: 'eo-guide-beacon', 'aria-hidden': 'true' },
1156
+ h('span', null, tr('更多', 'More')),
1157
+ h(Icon, { name: 'arrowDown', size: 18 }),
1158
+ ),
1159
+ h(
891
1160
  'div',
892
1161
  { className: 'eo-main-guide', role: 'dialog', 'aria-label': tr('初次使用路径', 'First-run path') },
893
- h('div', { className: 'eo-guide-arrow' }, h(Icon, { name: 'arrow', size: 22 })),
1162
+ h('div', { className: 'eo-guide-arrow' }, h(Icon, { name: 'arrowDown', size: 28 })),
894
1163
  h('p', { className: 'eo-guide-kicker' }, tr('初次使用', 'FIRST RUN')),
895
- h('h3', null, tr('从这里打开体验优化', 'Open Experience Optimizer here')),
1164
+ h('h3', null, tr('从这里打开插件体检', 'Open Plugin checkup here')),
896
1165
  h(
897
1166
  'div',
898
1167
  { className: 'eo-guide-path' },
@@ -900,9 +1169,9 @@ window.__ModuleLoader__.load({
900
1169
  h('i', null, '→'),
901
1170
  h('span', null, tr('设置', 'Settings')),
902
1171
  h('i', null, '→'),
903
- h('span', null, tr('体验优化', 'Experience Optimizer')),
1172
+ h('span', null, tr('插件体检', 'Plugin checkup')),
904
1173
  ),
905
- h('p', { className: 'eo-guide-note' }, tr('打开后会自动出现 5 步教程;也可以先看这里的路径。', 'A five-step guide opens there; you can follow this path first.')),
1174
+ h('p', { className: 'eo-guide-note' }, tr('打开后会先出现新手引导;「教程」页有完整 5 步。', 'First-run onboarding opens there; the Guide tab has the full five steps.')),
906
1175
  stepsOpen
907
1176
  ? h('ol', { className: 'eo-guide-steps' }, steps.map(([title, body], index) =>
908
1177
  h('li', { key: title }, h('b', null, String(index + 1).padStart(2, '0')), h('span', null, title), h('small', null, body)),
@@ -914,6 +1183,46 @@ window.__ModuleLoader__.load({
914
1183
  h(Button, { variant: 'ghost', onClick: () => setStepsOpen((value) => !value) }, stepsOpen ? tr('收起步骤', 'Hide steps') : tr('查看 5 步教程', 'Show 5 steps')),
915
1184
  h(Button, { variant: 'accent', onClick: dismiss }, tr('知道了', 'Got it')),
916
1185
  ),
1186
+ ),
1187
+ )
1188
+ }
1189
+
1190
+ function ActivationGuide({ onDismiss, onOpenDetails }) {
1191
+ const steps = [
1192
+ [tr('打开插件体检', 'Open Plugin checkup'), tr('设置 → 插件体检,或在插件页签里找到它。', 'Settings → Plugin checkup, or find it in the Plugins tab.')],
1193
+ [tr('先扫描', 'Scan first'), tr('看可归属上下文、兼容性和插件清单,不急着关任何东西。', 'Review attributable context, compatibility, and inventory before closing anything.')],
1194
+ [tr('生成体检方案', 'Build a checkup plan'), tr('选任务或写目标;默认只生成草稿。', 'Pick a task or write a goal; the default is a draft only.')],
1195
+ [tr('看依据再决定', 'Read the evidence'), tr('周期、已有调用、无账本都会先保护或复核。', 'Schedules, prior calls, or no ledger go to protection or review first.')],
1196
+ [tr('需要时看完整教程', 'Open the full guide'), tr('「教程」页有 5 分钟上手和常见问题。', 'The Guide tab has the five-minute walkthrough and FAQ.')],
1197
+ ]
1198
+ return h(
1199
+ 'section',
1200
+ { className: 'eo-activation', role: 'dialog', 'aria-label': tr('插件体检初次使用', 'Plugin checkup first run') },
1201
+ h(
1202
+ 'div',
1203
+ { className: 'eo-activation-head' },
1204
+ h('div', { className: 'eo-activation-icon' }, h(Icon, { name: 'gauge', size: 20 })),
1205
+ h('div', null,
1206
+ h('h3', null, tr('插件体检已启用', 'Plugin checkup is enabled')),
1207
+ h('p', null, tr('先量成本,再决定关什么。5 步上手:', 'Measure first, then decide what to close. Five steps:')),
1208
+ ),
1209
+ ),
1210
+ h(
1211
+ 'ol',
1212
+ { className: 'eo-activation-steps' },
1213
+ steps.map(([title, body], index) =>
1214
+ h('li', { key: title },
1215
+ h('b', null, String(index + 1).padStart(2, '0')),
1216
+ h('span', null, h('strong', null, title), h('small', null, body)),
1217
+ ),
1218
+ ),
1219
+ ),
1220
+ h(
1221
+ 'div',
1222
+ { className: 'eo-activation-actions' },
1223
+ h('button', { type: 'button', className: 'eo-activation-btn', onClick: onDismiss }, tr('开始使用', 'Start using it')),
1224
+ h('button', { type: 'button', className: 'eo-activation-btn eo-activation-primary', onClick: onOpenDetails }, tr('查看插件详情', 'Open plugin details')),
1225
+ ),
917
1226
  )
918
1227
  }
919
1228
 
@@ -923,7 +1232,7 @@ window.__ModuleLoader__.load({
923
1232
  const [locale, setLocale] = useState(detectLocale)
924
1233
  const [showOnboarding, setShowOnboarding] = useState(false)
925
1234
  const [onboardingStep, setOnboardingStep] = useState(0)
926
- const [collapsedCards, setCollapsedCards] = useState({ context: true })
1235
+ const [collapsedCards, setCollapsedCards] = useState({})
927
1236
  const [layout, setLayout] = useState(() => readPref('layout', 'standard'))
928
1237
  const [density, setDensity] = useState(() => readPref('density', 'comfortable'))
929
1238
  const [overview, setOverview] = useState(null)
@@ -960,7 +1269,9 @@ window.__ModuleLoader__.load({
960
1269
  const [recipeResult, setRecipeResult] = useState(null)
961
1270
  const [recipeBusy, setRecipeBusy] = useState(false)
962
1271
  const [settings, setSettings] = useState(null)
1272
+ const [settingsDraft, setSettingsDraft] = useState(null)
963
1273
  const [settingsBusy, setSettingsBusy] = useState(false)
1274
+ const [settingsApplying, setSettingsApplying] = useState(false)
964
1275
  const [settingsError, setSettingsError] = useState('')
965
1276
  const [updateInfo, setUpdateInfo] = useState(null)
966
1277
  const [updateBusy, setUpdateBusy] = useState(false)
@@ -1040,7 +1351,9 @@ window.__ModuleLoader__.load({
1040
1351
  setSettingsBusy(true)
1041
1352
  setSettingsError('')
1042
1353
  try {
1043
- setSettings(await fetchJson(API + '/config'))
1354
+ const data = await fetchJson(API + '/config')
1355
+ setSettings(data)
1356
+ setSettingsDraft(data)
1044
1357
  } catch (err) {
1045
1358
  setSettingsError(err instanceof Error ? err.message : String(err))
1046
1359
  } finally {
@@ -1048,16 +1361,65 @@ window.__ModuleLoader__.load({
1048
1361
  }
1049
1362
  }, [])
1050
1363
 
1364
+ const settingsChanged = useMemo(() => {
1365
+ if (!settings || !settingsDraft) return false
1366
+ const fields = ['mode', 'approvalMode', 'suggestionPolicy', 'approvalThreshold', 'trackUsage', 'usageRetentionDays', 'maxDrafts', 'protect', 'pinned']
1367
+ return JSON.stringify(fields.map((field) => settingsDraft[field])) !==
1368
+ JSON.stringify(fields.map((field) => settings[field]))
1369
+ }, [settings, settingsDraft])
1370
+
1371
+ const updateSettingsField = useCallback((field, value) => {
1372
+ setSettingsDraft((current) => current ? { ...current, [field]: value } : current)
1373
+ }, [])
1374
+
1375
+ const discardSettings = useCallback(() => {
1376
+ setSettingsDraft(settings ? { ...settings } : null)
1377
+ setSettingsError('')
1378
+ }, [settings])
1379
+
1380
+ const applySettings = useCallback(async () => {
1381
+ if (!settingsDraft) return
1382
+ setSettingsApplying(true)
1383
+ setSettingsError('')
1384
+ try {
1385
+ const payload = {
1386
+ mode: settingsDraft.mode,
1387
+ approvalMode: settingsDraft.approvalMode,
1388
+ suggestionPolicy: settingsDraft.suggestionPolicy,
1389
+ approvalThreshold: settingsDraft.approvalThreshold,
1390
+ trackUsage: settingsDraft.trackUsage,
1391
+ usageRetentionDays: settingsDraft.usageRetentionDays,
1392
+ maxDrafts: settingsDraft.maxDrafts,
1393
+ protect: settingsDraft.protect,
1394
+ pinned: settingsDraft.pinned,
1395
+ }
1396
+ const data = await fetchJson(API + '/config', {
1397
+ method: 'POST',
1398
+ body: JSON.stringify(payload),
1399
+ })
1400
+ setSettings(data)
1401
+ setSettingsDraft(data)
1402
+ notify(tr('设置已应用,插件会重新加载', 'Settings applied; the plugin will reload'))
1403
+ } catch (err) {
1404
+ setSettingsError(err instanceof Error ? err.message : String(err))
1405
+ } finally {
1406
+ setSettingsApplying(false)
1407
+ }
1408
+ }, [settingsDraft, notify])
1409
+
1051
1410
  const checkUpdate = useCallback(async () => {
1052
1411
  setUpdateBusy(true)
1053
1412
  try {
1054
1413
  setUpdateInfo(await fetchJson(API + '/update'))
1055
1414
  } catch (err) {
1415
+ const message = err instanceof Error ? err.message : String(err)
1056
1416
  setUpdateInfo({
1057
- current: '0.3.6',
1417
+ current: '0.3.9',
1058
1418
  latest: null,
1059
1419
  updateAvailable: false,
1060
- error: err instanceof Error ? err.message : String(err),
1420
+ error: /unknown endpoint/i.test(message)
1421
+ ? tr('当前安装版本不支持在线检查,请更新到最新版', 'This installed version does not support the online check; update to the latest version.')
1422
+ : message,
1061
1423
  })
1062
1424
  } finally {
1063
1425
  setUpdateBusy(false)
@@ -1298,8 +1660,8 @@ window.__ModuleLoader__.load({
1298
1660
  h(
1299
1661
  'div',
1300
1662
  { className: 'eo-hero-copy' },
1301
- h('h2', { className: 'eo-title' }, tr('体验优化', 'Experience Optimizer')),
1302
- h('p', { className: 'eo-sub' }, tr('插件减负、兼容性体检与工作流蓝图。', 'Plugin diet, compatibility checks, and workflow recipes.')),
1663
+ h('h2', { className: 'eo-title' }, tr('插件体检', 'Plugin checkup')),
1664
+ h('p', { className: 'eo-sub' }, tr('先量常驻成本,再判断该不该关;兼容性与工作流一起看。', 'Measure resident cost first, then decide what to close. Compatibility and workflows included.')),
1303
1665
  ),
1304
1666
  h(
1305
1667
  'div',
@@ -1318,11 +1680,6 @@ window.__ModuleLoader__.load({
1318
1680
  },
1319
1681
  locale === 'zh' ? 'EN' : '中文',
1320
1682
  ),
1321
- h(
1322
- Button,
1323
- { onClick: refresh, disabled: loading, variant: 'ghost' },
1324
- loading ? tr('刷新中…', 'Refreshing…') : tr('刷新', 'Refresh'),
1325
- ),
1326
1683
  ),
1327
1684
  ),
1328
1685
  h(
@@ -1363,17 +1720,21 @@ window.__ModuleLoader__.load({
1363
1720
  '正在读取插件画像与兼容性数据…',
1364
1721
  )
1365
1722
  : null,
1366
- tab === 'tutorial'
1367
- ? renderTutorial()
1368
- : tab === 'settings'
1369
- ? renderSettings()
1370
- : tab === 'about'
1371
- ? renderAbout()
1372
- : overview
1373
- ? tab === 'trim'
1374
- ? renderTrim()
1375
- : renderRecipe()
1376
- : null,
1723
+ h(
1724
+ 'div',
1725
+ { className: 'eo-tab-panel', key: tab },
1726
+ tab === 'tutorial'
1727
+ ? renderTutorial()
1728
+ : tab === 'settings'
1729
+ ? renderSettings()
1730
+ : tab === 'about'
1731
+ ? renderAbout()
1732
+ : overview
1733
+ ? tab === 'trim'
1734
+ ? renderTrim()
1735
+ : renderRecipe()
1736
+ : null,
1737
+ ),
1377
1738
  confirmState
1378
1739
  ? h(ConfirmModal, {
1379
1740
  state: confirmState,
@@ -1429,7 +1790,7 @@ window.__ModuleLoader__.load({
1429
1790
  },
1430
1791
  ]
1431
1792
  const steps = [
1432
- ['先扫描。', 'Scan first.', ' 打开「插件减负」,看可归属上下文、兼容性和插件清单;清单里的“占比”就是常驻成本的可见化。', ' Open Plugin diet to see attributable context, compatibility, and inventory. The Share column makes resident cost visible.'],
1793
+ ['先扫描。', 'Scan first.', ' 打开「插件体检」,看可归属上下文、兼容性和插件清单;清单里的“占比”就是常驻成本的可见化。', ' Open Plugin checkup to see attributable context, compatibility, and inventory. The Share column makes resident cost visible.'],
1433
1794
  ['再生成方案。', 'Build a plan.', ' 选任务类型或写一句目标,点击“生成方案”。默认只生成草稿,不会改任何插件。', ' Pick a task or write a goal, then Build plan. It only creates a draft; no plugin is changed.'],
1434
1795
  ['看判断依据。', '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.'],
1435
1796
  ['确认后应用。', 'Confirm and apply.', ' 勾选低风险项,点击“应用选中”,核对弹窗后写入还原点并应用;需要时可一键恢复。', ' Select low-risk items, apply, review the dialog, then write a restore point and apply. Recover in one click if needed.'],
@@ -1531,6 +1892,32 @@ window.__ModuleLoader__.load({
1531
1892
  }
1532
1893
  }
1533
1894
 
1895
+ async function copyCompatibilityPlan() {
1896
+ const all = overview ? overview.findings.filter((finding) => finding.severity !== 'info') : []
1897
+ if (all.length === 0) {
1898
+ notify(tr('没有需要处理的兼容性问题。', 'No compatibility findings to handle.'), 'warn')
1899
+ return
1900
+ }
1901
+ const lines = [
1902
+ tr('# 兼容性处理清单', '# Compatibility checklist'),
1903
+ '',
1904
+ tr('只读生成;不会自动修改任何插件。', 'Generated read-only; no plugin is changed automatically.'),
1905
+ '',
1906
+ ]
1907
+ for (const finding of all) {
1908
+ lines.push('- [ ] [' + finding.severity + '] ' + finding.code + ' — ' + finding.title)
1909
+ if (finding.subjects?.length) lines.push(' ' + tr('对象:', 'Subjects: ') + finding.subjects.join(', '))
1910
+ if (finding.fix?.summary) lines.push(' ' + tr('建议:', 'Fix: ') + finding.fix.summary)
1911
+ if (finding.evidence) lines.push(' ' + tr('证据:', 'Evidence: ') + (Array.isArray(finding.evidence) ? finding.evidence.join('; ') : String(finding.evidence)))
1912
+ }
1913
+ try {
1914
+ await navigator.clipboard.writeText(lines.join('\n'))
1915
+ notify(tr('已复制 ' + all.length + ' 项兼容性处理清单', 'Copied ' + all.length + ' compatibility items'))
1916
+ } catch {
1917
+ notify(tr('无法访问剪贴板,请手动复制问题详情', 'Clipboard unavailable; copy the findings manually'), 'warn')
1918
+ }
1919
+ }
1920
+
1534
1921
  function renderSettings() {
1535
1922
  if (settingsBusy && settings === null) {
1536
1923
  return h('div', { className: 'eo-loading' }, h('span', { className: 'eo-spinner' }), tr('正在读取当前生效设置…', 'Loading effective settings…'))
@@ -1539,46 +1926,72 @@ window.__ModuleLoader__.load({
1539
1926
  return h('div', { className: 'eo-error' }, h('span', null, settingsError), h(Button, { variant: 'ghost', onClick: loadSettings }, tr('重试', 'Retry')))
1540
1927
  }
1541
1928
  if (!settings) return h('div', { className: 'eo-empty' }, tr('暂无设置数据。', 'No settings data.'))
1542
- const policyLabel = settings.suggestionPolicy === 'balanced' ? tr('旧评分(仍保护周期与已用插件)', 'Legacy score (still protects scheduled/used plugins)') : tr('证据优先(推荐)', 'Evidence-first (recommended)')
1543
- const approvalLabel = settings.approvalMode === 'risk-based' ? tr('仅超过阈值时审批', 'Approve only above threshold') : tr('每次工具写入都审批', 'Approve every tool write')
1929
+ const form = settingsDraft || settings
1930
+ const dirty = settingsChanged
1931
+ const option = (labelZh, labelEn, value) => h('option', { key: value, value }, tr(labelZh, labelEn))
1932
+ const inputNumber = (field, min, max, displayMax = max, step = 1) => {
1933
+ const current = Math.min(max, Math.max(min, Number(form[field]) || min))
1934
+ const visualMax = Math.min(max, Math.max(min + 1, displayMax))
1935
+ const percent = Math.min(100, Math.max(0, ((current - min) / (visualMax - min)) * 100))
1936
+ const setValue = (value) => updateSettingsField(field, Math.min(max, Math.max(min, Number(value) || min)))
1937
+ return h(
1938
+ 'div',
1939
+ { className: 'eo-param' },
1940
+ h(
1941
+ 'div',
1942
+ { className: 'eo-param-head' },
1943
+ h('input', {
1944
+ className: 'eo-input eo-param-input',
1945
+ type: 'number',
1946
+ min,
1947
+ max,
1948
+ step,
1949
+ value: form[field],
1950
+ onChange: (event) => setValue(event.target.value),
1951
+ }),
1952
+ h(
1953
+ 'div',
1954
+ { className: 'eo-stepper' },
1955
+ h('button', { type: 'button', className: 'eo-stepper-btn eo-stepper-up', onClick: () => setValue(current + step), 'aria-label': tr('增加', 'Increase') }, h(Icon, { name: 'chevron', size: 11 })),
1956
+ h('button', { type: 'button', className: 'eo-stepper-btn', onClick: () => setValue(current - step), 'aria-label': tr('减少', 'Decrease') }, h(Icon, { name: 'chevron', size: 11 })),
1957
+ ),
1958
+ ),
1959
+ h('div', { className: 'eo-param-track', 'aria-hidden': 'true' }, h('i', { style: { width: percent + '%' } }), h('b', { style: { left: percent + '%' } })),
1960
+ h('div', { className: 'eo-param-scale' }, h('span', null, String(min)), h('span', null, String(visualMax) + (max > visualMax ? ' · ' + tr('上限 ', 'max ') + max : ''))),
1961
+ )
1962
+ }
1544
1963
  return h(
1545
1964
  'div',
1546
1965
  { className: 'eo-stack' },
1966
+ h(
1967
+ Card,
1968
+ {
1969
+ className: 'eo-settings-readonly',
1970
+ title: tr('修改后点击应用', 'Review changes, then apply'),
1971
+ subtitle: tr('不会自动写入;应用会更新当前 profile', 'Nothing is written until you apply'),
1972
+ },
1973
+ h('div', { className: 'eo-muted' }, tr('这里的修改先保存在页面草稿中,点击应用才会写入当前 profile 并重载插件。审批与保护逻辑不会因为改设置而跳过。', 'Changes stay as a page draft until you apply. Applying writes the current profile and reloads the plugin; approval and protection are never skipped.')),
1974
+ ),
1547
1975
  h(
1548
1976
  Card,
1549
1977
  {
1550
1978
  title: tr('界面偏好', 'Interface preferences'),
1551
- subtitle: tr('只作用于插件减负页;偏好保存在本浏览器', 'Applies to the Plugin diet page; saved in this browser'),
1979
+ subtitle: tr('即时生效;偏好保存在本浏览器', 'Applied immediately; saved in this browser'),
1552
1980
  },
1553
- h(
1554
- 'div',
1555
- { className: 'eo-settings-row' },
1556
- h('span', null, tr('内容排列', 'Content layout')),
1557
- h(
1558
- 'div',
1559
- { className: 'eo-inline' },
1981
+ h('div', { className: 'eo-settings-row' }, h('span', null, tr('内容排列', 'Content layout')),
1982
+ h('div', { className: 'eo-inline' },
1560
1983
  h(Button, { variant: 'ghost', className: layout === 'standard' ? 'eo-btn-active' : '', onClick: () => changeLayout('standard') }, tr('标准', 'Standard')),
1561
1984
  h(Button, { variant: 'ghost', className: layout === 'two' ? 'eo-btn-active' : '', onClick: () => changeLayout('two') }, tr('双列', 'Two-column')),
1562
1985
  ),
1563
1986
  ),
1564
- h(
1565
- 'div',
1566
- { className: 'eo-settings-row' },
1567
- h('span', null, tr('密度', 'Density')),
1568
- h(
1569
- 'div',
1570
- { className: 'eo-inline' },
1987
+ h('div', { className: 'eo-settings-row' }, h('span', null, tr('密度', 'Density')),
1988
+ h('div', { className: 'eo-inline' },
1571
1989
  h(Button, { variant: 'ghost', className: density === 'comfortable' ? 'eo-btn-active' : '', onClick: () => changeDensity('comfortable') }, tr('舒适', 'Comfortable')),
1572
1990
  h(Button, { variant: 'ghost', className: density === 'compact' ? 'eo-btn-active' : '', onClick: () => changeDensity('compact') }, tr('紧凑', 'Compact')),
1573
1991
  ),
1574
1992
  ),
1575
- h(
1576
- 'div',
1577
- { className: 'eo-settings-row' },
1578
- h('span', null, tr('卡片', 'Cards')),
1579
- h(
1580
- 'div',
1581
- { className: 'eo-inline' },
1993
+ h('div', { className: 'eo-settings-row' }, h('span', null, tr('卡片', 'Cards')),
1994
+ h('div', { className: 'eo-inline' },
1582
1995
  h(Button, { variant: 'ghost', onClick: collapseAllCards }, tr('全部折叠', 'Collapse all')),
1583
1996
  h(Button, { variant: 'ghost', onClick: expandAllCards }, tr('全部展开', 'Expand all')),
1584
1997
  ),
@@ -1587,21 +2000,74 @@ window.__ModuleLoader__.load({
1587
2000
  h(
1588
2001
  Card,
1589
2002
  {
1590
- title: tr('更新与反馈', 'Updates & feedback'),
1591
- subtitle: tr('检查 npm 最新版本;反馈请走 GitHub Issues', 'Check the latest npm version; feedback via GitHub Issues'),
2003
+ title: tr('插件设置', 'Plugin settings'),
2004
+ subtitle: tr('改动后才会出现应用按钮;应用会重载插件', 'The apply button appears after changes; applying reloads the plugin'),
1592
2005
  },
1593
2006
  h(
1594
2007
  'div',
1595
- { className: 'eo-settings-row' },
1596
- h('span', null, tr('当前版本', 'Current version')),
1597
- h('code', null, updateInfo?.current || '0.3.6'),
2008
+ { className: 'eo-settings-grid' },
2009
+ h('div', { className: 'eo-settings-row' }, h('span', null, tr('当前配置', 'Profile')), h('code', null, form.profile)),
2010
+ h('div', { className: 'eo-settings-row' }, h('span', null, tr('运行模式', 'Mode')),
2011
+ h('select', { className: 'eo-select eo-settings-control', value: form.mode, onChange: (event) => updateSettingsField('mode', event.target.value) },
2012
+ option('建议模式', 'Advice mode', 'advise'),
2013
+ option('自动安全(收窄建议)', 'Auto-safe (narrower)', 'auto-safe'),
2014
+ ),
2015
+ ),
2016
+ h('div', { className: 'eo-settings-row' }, h('span', null, tr('审批策略', 'Approval')),
2017
+ h('select', { className: 'eo-select eo-settings-control', value: form.approvalMode, onChange: (event) => updateSettingsField('approvalMode', event.target.value) },
2018
+ option('每次工具写入都审批', 'Approve every tool write', 'always'),
2019
+ option('仅超过阈值时审批', 'Approve only above threshold', 'risk-based'),
2020
+ ),
2021
+ ),
2022
+ h('div', { className: 'eo-settings-row' }, h('span', null, tr('建议策略', 'Suggestion policy')),
2023
+ h('select', { className: 'eo-select eo-settings-control', value: form.suggestionPolicy, onChange: (event) => updateSettingsField('suggestionPolicy', event.target.value) },
2024
+ option('证据优先(推荐)', 'Evidence-first (recommended)', 'conservative'),
2025
+ option('旧评分(仍保护周期与已用插件)', 'Legacy score', 'balanced'),
2026
+ ),
2027
+ ),
2028
+ h('div', { className: 'eo-settings-row' }, h('span', null, tr('使用账本', 'Usage ledger')),
2029
+ h('label', { className: 'eo-check' },
2030
+ h('input', { type: 'checkbox', checked: form.trackUsage, onChange: (event) => updateSettingsField('trackUsage', event.target.checked) }),
2031
+ h('span', null, form.trackUsage ? tr('开启', 'On') : tr('关闭', 'Off')),
2032
+ ),
2033
+ ),
2034
+ h('div', { className: 'eo-settings-row eo-settings-row-wide' }, h('span', null, tr('保护名单', 'Protect list')),
2035
+ h('input', { className: 'eo-input eo-settings-control', value: form.protect.join(', '), placeholder: tr('包名,用逗号分隔', 'Package names, comma separated'), onChange: (event) => updateSettingsField('protect', splitList(event.target.value)) }),
2036
+ ),
2037
+ h('div', { className: 'eo-settings-row eo-settings-row-wide' }, h('span', null, tr('固定名单', 'Pinned list')),
2038
+ h('input', { className: 'eo-input eo-settings-control', value: form.pinned.join(', '), placeholder: tr('包名,用逗号分隔', 'Package names, comma separated'), onChange: (event) => updateSettingsField('pinned', splitList(event.target.value)) }),
2039
+ ),
1598
2040
  ),
1599
2041
  h(
1600
2042
  'div',
1601
- { className: 'eo-settings-row' },
1602
- h('span', null, tr('最新版本', 'Latest version')),
1603
- h('code', null, updateInfo ? (updateInfo.latest || tr('检查失败', 'Check failed')) : tr('未检查', 'Not checked')),
2043
+ { className: 'eo-param-section' },
2044
+ h(
2045
+ 'div',
2046
+ { className: 'eo-param-section-head' },
2047
+ h('strong', null, tr('参数范围', 'Parameter ranges')),
2048
+ h('span', null, tr('上下箭头微调;进度条按推荐范围显示,右侧标注配置上限', 'Use the arrows to tune; the bar shows the recommended range, with the config cap on the right')),
2049
+ ),
2050
+ h('div', { className: 'eo-param-row' }, h('span', null, tr('审批阈值', 'Approval threshold')), inputNumber('approvalThreshold', 1, 100, 20)),
2051
+ h('div', { className: 'eo-param-row' }, h('span', null, tr('账本保留', 'Ledger retention')), inputNumber('usageRetentionDays', 1, 365, 90)),
2052
+ h('div', { className: 'eo-param-row' }, h('span', null, tr('草稿/还原点上限', 'Draft/snapshot limit')), inputNumber('maxDrafts', 1, 200, 50)),
1604
2053
  ),
2054
+ h('div', { className: 'eo-muted', style: { marginTop: '10px' } }, tr('配置目录:', 'Config directory: ') + form.profileDir),
2055
+ settingsError ? h('div', { className: 'eo-error', style: { marginTop: '10px' } }, h('span', null, settingsError)) : null,
2056
+ dirty
2057
+ ? h('div', { className: 'eo-applybar' },
2058
+ h('span', null, tr('有未应用的修改', 'Unapplied changes')),
2059
+ h('div', { className: 'eo-inline' },
2060
+ h(Button, { variant: 'ghost', onClick: discardSettings, disabled: settingsApplying }, tr('撤销', 'Discard')),
2061
+ h(Button, { variant: 'accent', onClick: () => void applySettings(), disabled: settingsApplying }, settingsApplying ? tr('应用中…', 'Applying…') : tr('应用修改', 'Apply changes')),
2062
+ ),
2063
+ )
2064
+ : h('div', { className: 'eo-muted', style: { marginTop: '10px' } }, tr('修改任意设置后,这里会出现「应用修改」。', 'The Apply button appears here after you change a setting.')),
2065
+ ),
2066
+ h(
2067
+ Card,
2068
+ { title: tr('更新与反馈', 'Updates & feedback'), subtitle: tr('检查 npm 最新版本;反馈请走 GitHub Issues', 'Check the latest npm version; feedback via GitHub Issues') },
2069
+ h('div', { className: 'eo-settings-row' }, h('span', null, tr('当前版本', 'Current version')), h('code', null, updateInfo?.current || '0.3.9')),
2070
+ h('div', { className: 'eo-settings-row' }, h('span', null, tr('最新版本', 'Latest version')), h('code', null, updateInfo ? (updateInfo.latest || tr('检查失败', 'Check failed')) : tr('未检查', 'Not checked'))),
1605
2071
  updateInfo && updateInfo.updateAvailable
1606
2072
  ? h('div', { className: 'eo-issue' }, h('span', null, tr('发现新版本:', 'New version available: ') + updateInfo.latest + ' · '), h('a', { href: updateInfo.url, target: '_blank', rel: 'noreferrer' }, tr('查看 npm', 'View npm')))
1607
2073
  : updateInfo && updateInfo.latest
@@ -1609,9 +2075,7 @@ window.__ModuleLoader__.load({
1609
2075
  : updateInfo && updateInfo.error
1610
2076
  ? h('div', { className: 'eo-issue eo-issue-warn' }, h('span', null, tr('检查失败:', 'Check failed: ') + updateInfo.error))
1611
2077
  : null,
1612
- h(
1613
- 'div',
1614
- { className: 'eo-inline', style: { marginTop: '10px' } },
2078
+ h('div', { className: 'eo-inline', style: { marginTop: '10px' } },
1615
2079
  h(Button, { variant: 'accent', onClick: () => void checkUpdate(), disabled: updateBusy }, updateBusy ? tr('检查中…', 'Checking…') : tr('检查更新', 'Check for updates')),
1616
2080
  h('a', { className: 'eo-btn eo-btn-ghost', href: 'https://github.com/Starlit-Sky-code/dsh-experience-optimizer/issues/new/choose', target: '_blank', rel: 'noreferrer' }, tr('新建 Issue', 'New issue')),
1617
2081
  h('a', { className: 'eo-btn eo-btn-ghost', href: ABOUT_LINKS.issues, target: '_blank', rel: 'noreferrer' }, tr('问题列表', 'Issues')),
@@ -1619,57 +2083,15 @@ window.__ModuleLoader__.load({
1619
2083
  ),
1620
2084
  h(
1621
2085
  Card,
1622
- {
1623
- title: tr('当前生效设置', 'Effective settings'),
1624
- subtitle: tr('只读视图;修改请写入配置补丁', 'Read-only; edit the profile patch to change'),
1625
- extra: h(Button, { variant: 'ghost', onClick: loadSettings, disabled: settingsBusy }, settingsBusy ? tr('读取中…', 'Loading…') : tr('刷新', 'Refresh')),
1626
- },
1627
- h(
1628
- 'div',
1629
- { className: 'eo-settings-grid' },
1630
- h('div', { className: 'eo-settings-row' }, h('span', null, tr('当前配置', 'Profile')), h('code', null, settings.profile)),
1631
- 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'))),
1632
- h('div', { className: 'eo-settings-row' }, h('span', null, tr('审批策略', 'Approval')), h('code', null, approvalLabel)),
1633
- h('div', { className: 'eo-settings-row' }, h('span', null, tr('审批阈值', 'Approval threshold')), h('code', null, String(settings.approvalThreshold) + tr(' 项', ' items'))),
1634
- h('div', { className: 'eo-settings-row' }, h('span', null, tr('建议策略', 'Suggestion policy')), h('code', null, policyLabel)),
1635
- h('div', { className: 'eo-settings-row' }, h('span', null, tr('使用账本', 'Usage ledger')), h('code', null, settings.trackUsage ? tr('开启', 'On') : tr('关闭', 'Off'))),
1636
- h('div', { className: 'eo-settings-row' }, h('span', null, tr('账本保留', 'Ledger retention')), h('code', null, settings.usageRetentionDays + tr(' 天', ' days'))),
1637
- h('div', { className: 'eo-settings-row' }, h('span', null, tr('草稿/还原点上限', 'Draft/snapshot limit')), h('code', null, String(settings.maxDrafts))),
1638
- ),
1639
- h('div', { className: 'eo-muted', style: { marginTop: '10px' } }, tr('配置目录:', 'Config directory: ') + settings.profileDir),
1640
- ),
1641
- h(
1642
- Card,
1643
- { title: tr('保护与固定', 'Protect & pin'), subtitle: tr('这些插件永远不会进入自动建议', 'These plugins never become automatic candidates') },
1644
- settings.protect.length === 0 && settings.pinned.length === 0
1645
- ? h('div', { className: 'eo-empty' }, tr('尚未配置保护 / 固定名单。可在配置补丁中添加需要保底的插件。', 'No protect/pinned entries. Add must-keep plugins to the profile patch.'))
1646
- : h(
1647
- 'div',
1648
- { className: 'eo-inline' },
1649
- settings.protect.map((name) => h(Badge, { key: 'protect-' + name, tone: 'warn' }, tr('保护 · ', 'Protect · ') + name)),
1650
- settings.pinned.map((name) => h(Badge, { key: 'pinned-' + name, tone: 'neutral' }, tr('固定 · ', 'Pinned · ') + name)),
1651
- ),
1652
- ),
1653
- h(
1654
- Card,
1655
- {
1656
- title: tr('配置片段', 'Configuration snippet'),
1657
- subtitle: tr('复制到配置补丁;写入后由 DSH 重新加载', 'Copy into the profile patch; DSH reloads after writing'),
1658
- extra: h(Button, { variant: 'accent', onClick: () => void copyConfig(settings) }, tr('复制片段', 'Copy snippet')),
1659
- },
1660
- h('pre', { className: 'eo-codeblock' }, configPatch(settings)),
1661
- ),
1662
- h(
1663
- Card,
1664
- { title: tr('说明', 'Notes'), subtitle: tr('设置页不会直接改配置', 'This page does not edit config directly') },
1665
- 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.')),
2086
+ { title: tr('配置片段', 'Configuration snippet'), subtitle: tr('当前草稿的可复制片段', 'Copyable snippet for the current draft'), extra: h(Button, { variant: 'accent', onClick: () => void copyConfig(form) }, tr('复制片段', 'Copy snippet')) },
2087
+ h('pre', { className: 'eo-codeblock' }, configPatch(form)),
1666
2088
  ),
1667
2089
  )
1668
2090
  }
1669
2091
 
1670
2092
  async function copyInstall() {
1671
2093
  try {
1672
- await navigator.clipboard.writeText('dsh plugin --profile web add dsh-plugin-trim\ndsh plugin --profile web add dsh-plugin-recipe')
2094
+ await navigator.clipboard.writeText('npm i dsh-plugin-trim\nnpm i dsh-plugin-recipe')
1673
2095
  notify(tr('安装命令已复制', 'Install commands copied'))
1674
2096
  } catch {
1675
2097
  notify(tr('无法访问剪贴板,请手动复制安装命令', 'Clipboard unavailable; copy the commands manually'), 'warn')
@@ -1679,7 +2101,7 @@ window.__ModuleLoader__.load({
1679
2101
  function renderAbout() {
1680
2102
  const links = [
1681
2103
  ['GitHub', ABOUT_LINKS.repo],
1682
- [tr('npm · 插件减负', 'npm · plugin diet'), ABOUT_LINKS.npmTrim],
2104
+ [tr('npm · 插件体检', 'npm · plugin checkup'), ABOUT_LINKS.npmTrim],
1683
2105
  [tr('npm · 工作流配方', 'npm · workflow recipe'), ABOUT_LINKS.npmRecipe],
1684
2106
  [tr('发布记录', 'Releases'), ABOUT_LINKS.releases],
1685
2107
  [tr('问题反馈', 'Issues'), ABOUT_LINKS.issues],
@@ -1691,7 +2113,7 @@ window.__ModuleLoader__.load({
1691
2113
  Card,
1692
2114
  {
1693
2115
  title: tr('关于项目', 'About the project'),
1694
- subtitle: tr('插件减负、兼容性检查与工作流蓝图', 'Plugin diet, compatibility checks, and workflow recipes'),
2116
+ subtitle: tr('插件体检、兼容性检查与工作流蓝图', 'Plugin checkup, compatibility checks, and workflow recipes'),
1695
2117
  section: 'about',
1696
2118
  },
1697
2119
  h(AboutHero),
@@ -1701,9 +2123,9 @@ window.__ModuleLoader__.load({
1701
2123
  h(
1702
2124
  'div',
1703
2125
  { className: 'eo-about-card' },
1704
- h('div', { className: 'eo-inline', style: { marginBottom: '8px' } }, h(Icon, { name: 'shield', size: 24 }), h('strong', null, 'DSH Experience Optimizer')),
2126
+ h('div', { className: 'eo-inline', style: { marginBottom: '8px' } }, h(Icon, { name: 'shield', size: 24 }), h('strong', null, 'DSH Plugin Checkup')),
1705
2127
  h('p', null, tr('少一点插件负担,多一点兼容确定性。', 'Less plugin overhead, more compatibility certainty.')),
1706
- h('p', null, tr('版本:', 'Version: ') + '0.3.7 · AGPL-3.0-only'),
2128
+ h('p', null, tr('版本:', 'Version: ') + '0.3.9 · AGPL-3.0-only'),
1707
2129
  h('p', null, tr('作者:Starlit Sky', 'Author: Starlit Sky')),
1708
2130
  ),
1709
2131
  h(
@@ -1779,6 +2201,9 @@ window.__ModuleLoader__.load({
1779
2201
  }
1780
2202
 
1781
2203
  function renderTrim() {
2204
+ const shareOf = (bundle) => totalContextTokens > 0
2205
+ ? Math.min(100, Math.max(0, (bundle.contextTokens / totalContextTokens) * 100))
2206
+ : 0
1782
2207
  const renderInventoryCards = () =>
1783
2208
  h(
1784
2209
  'div',
@@ -1821,6 +2246,9 @@ window.__ModuleLoader__.load({
1821
2246
  bundle.protected ? h('span', null, tr('受保护', 'Protected')) : null,
1822
2247
  h('span', null, bundle.guardStatus ? guardLabel(bundle.guardStatus) : '—'),
1823
2248
  ),
2249
+ h('div', { className: 'eo-inventory-share', title: tr('占可归属上下文的比例', 'Share of attributable context') },
2250
+ h('i', { style: { width: shareOf(bundle) + '%' } }),
2251
+ ),
1824
2252
  ),
1825
2253
  ),
1826
2254
  )
@@ -1836,8 +2264,8 @@ window.__ModuleLoader__.load({
1836
2264
  h(Metric, {
1837
2265
  key: 'tokens',
1838
2266
  label: tr('可归属上下文', 'Attributable context'),
1839
- value: formatTokens(overview.context.totalTokens),
1840
- hint: tr('tokens · 不含未归属', 'tokens · excludes unattributed') + ' · ' + Math.round(contextPct) + '%',
2267
+ value: formatTokens(attributedContext),
2268
+ hint: Math.round(contextPct) + tr('% 占比 · 未归属 ', '% share · unattributed ') + formatTokens(overview.context.unattributedTokens),
1841
2269
  progress: contextPct,
1842
2270
  progressTone: 'ok',
1843
2271
  }),
@@ -1936,6 +2364,13 @@ window.__ModuleLoader__.load({
1936
2364
  compat.info > 0 ? h('span', { key: 'i', className: 'eo-severity-info', style: { flex: compat.info } }) : null,
1937
2365
  ],
1938
2366
  ),
2367
+ compat.error + compat.warn + compat.info > 0
2368
+ ? h('div', { className: 'eo-severity-legend' },
2369
+ h('span', null, h('i', { className: 'eo-dot-error' }), compat.error + tr(' 错误', ' errors')),
2370
+ h('span', null, h('i', { className: 'eo-dot-warn' }), compat.warn + tr(' 警告', ' warnings')),
2371
+ h('span', null, h('i', { className: 'eo-dot-info' }), compat.info + tr(' 信息', ' info')),
2372
+ )
2373
+ : null,
1939
2374
  findings.length === 0
1940
2375
  ? h('div', { className: 'eo-empty' }, tr('没有匹配的兼容性问题。', 'No matching compatibility findings.'))
1941
2376
  : h(
@@ -1975,6 +2410,22 @@ window.__ModuleLoader__.load({
1975
2410
  ),
1976
2411
  ),
1977
2412
  ),
2413
+ h(
2414
+ 'div',
2415
+ { className: 'eo-compat-footer' },
2416
+ h('span', { className: 'eo-muted' }, tr('生成只读修复清单;不会自动修改插件。', 'Creates a read-only fix checklist; no plugin is changed.')),
2417
+ h(
2418
+ Button,
2419
+ {
2420
+ variant: 'accent',
2421
+ onClick: () => void copyCompatibilityPlan(),
2422
+ disabled: compat.error + compat.warn === 0,
2423
+ },
2424
+ compat.error + compat.warn > 0
2425
+ ? tr('处理兼容性 · ' + (compat.error + compat.warn) + ' 项', 'Handle compatibility · ' + (compat.error + compat.warn))
2426
+ : tr('没有待处理项', 'Nothing to handle'),
2427
+ ),
2428
+ ),
1978
2429
  ),
1979
2430
  h(
1980
2431
  Card,
@@ -1992,6 +2443,23 @@ window.__ModuleLoader__.load({
1992
2443
  showContext ? tr('收起明细', 'Collapse details') : tr('查看明细', 'View details'),
1993
2444
  ),
1994
2445
  },
2446
+ h(
2447
+ 'div',
2448
+ { className: 'eo-context-mix' },
2449
+ h('div', {
2450
+ className: 'eo-context-donut',
2451
+ style: { '--eo-ok': contextPct + '%' },
2452
+ role: 'img',
2453
+ 'aria-label': tr('可归属与未归属上下文的构成', 'Attributable vs unattributed context'),
2454
+ title: tr('可归属与未归属上下文的构成', 'Attributable vs unattributed context'),
2455
+ }, h('div', { className: 'eo-context-donut-label' }, h('b', null, Math.round(contextPct) + '%'), h('small', null, tr('可归属', 'attributed')))),
2456
+ h(
2457
+ 'div',
2458
+ { className: 'eo-context-legend' },
2459
+ h('div', { className: 'eo-context-legend-row' }, h('i', { className: 'eo-dot-ok' }), h('span', null, tr('可归属', 'Attributable')), h('strong', null, formatNumber(attributedContext)), h('em', null, Math.round(contextPct) + '%')),
2460
+ h('div', { className: 'eo-context-legend-row' }, h('i', { className: 'eo-dot-warn' }), h('span', null, tr('未归属', 'Unattributed')), h('strong', null, formatNumber(overview.context.unattributedTokens)), h('em', null, Math.round(100 - contextPct) + '%')),
2461
+ ),
2462
+ ),
1995
2463
  h(
1996
2464
  'div',
1997
2465
  { className: 'eo-owner-list' },
@@ -2003,11 +2471,11 @@ window.__ModuleLoader__.load({
2003
2471
  'div',
2004
2472
  { className: 'eo-owner-head' },
2005
2473
  h('span', null, owner.owner),
2006
- h('span', null, formatNumber(owner.tokens)),
2474
+ h('span', null, formatNumber(owner.tokens) + ' · ' + Math.round((owner.tokens / Math.max(1, totalContextTokens)) * 100) + '%'),
2007
2475
  ),
2008
2476
  h(
2009
2477
  'div',
2010
- { className: 'eo-bar' },
2478
+ { className: 'eo-bar', title: owner.owner + ' · ' + formatNumber(owner.tokens) + ' tokens' },
2011
2479
  h('i', {
2012
2480
  style: { width: Math.max(3, (owner.tokens / maxOwner) * 100) + '%' },
2013
2481
  }),
@@ -2182,9 +2650,8 @@ window.__ModuleLoader__.load({
2182
2650
  h(
2183
2651
  'td',
2184
2652
  { className: 'eo-muted eo-share-cell', title: tr('占可归属上下文的比例', 'Share of attributable context') },
2185
- totalContextTokens > 0
2186
- ? Math.round((bundle.contextTokens / totalContextTokens) * 100) + '%'
2187
- : '—',
2653
+ h('span', null, Math.round(shareOf(bundle)) + '%'),
2654
+ h('div', { className: 'eo-share-bar' }, h('i', { style: { width: shareOf(bundle) + '%' } })),
2188
2655
  ),
2189
2656
  h(
2190
2657
  'td',
@@ -2202,7 +2669,7 @@ window.__ModuleLoader__.load({
2202
2669
  h(
2203
2670
  Card,
2204
2671
  {
2205
- title: tr('插件减负方案', 'Slim plan'),
2672
+ title: tr('插件体检方案', 'Checkup plan'),
2206
2673
  subtitle: tr('先建议,后确认;受保护项永不改动', 'Suggest first, confirm later; protected items never change'),
2207
2674
  section: 'draft', collapsible: true, collapsed: collapsedCards.draft === true, onToggle: () => toggleCard('draft'),
2208
2675
  },
@@ -2900,7 +3367,36 @@ window.__ModuleLoader__.load({
2900
3367
  }
2901
3368
 
2902
3369
  function apply(ctx) {
3370
+ CURRENT_LOCALE = detectLocale()
2903
3371
  injectCss()
3372
+ ctx.slots.inject('conversation.composer.dock', () =>
3373
+ ctx.slots.register(
3374
+ {
3375
+ name: 'conversation.composer.dock',
3376
+ id: 'experience-optimizer-checkup',
3377
+ order: 20,
3378
+ },
3379
+ CheckupBubble,
3380
+ ),
3381
+ )
3382
+ ctx.slots.inject('conversation.chat.reasoning.body', () =>
3383
+ ctx.slots.register(
3384
+ {
3385
+ name: 'conversation.chat.reasoning.body',
3386
+ priority: 90,
3387
+ },
3388
+ ReasoningCheckup,
3389
+ ),
3390
+ )
3391
+ ctx.slots.inject('plugins.bundle.activation', () =>
3392
+ ctx.slots.register(
3393
+ {
3394
+ name: 'plugins.bundle.activation',
3395
+ key: 'dsh-plugin-trim',
3396
+ },
3397
+ ActivationGuide,
3398
+ ),
3399
+ )
2904
3400
  ctx.slots.inject('shell.overlay', () =>
2905
3401
  ctx.slots.register(
2906
3402
  {
@@ -2917,7 +3413,7 @@ window.__ModuleLoader__.load({
2917
3413
  name: 'settings.plugins.tab',
2918
3414
  id: 'experience-optimizer',
2919
3415
  order: 40,
2920
- label: () => '体验优化',
3416
+ label: () => '插件体检',
2921
3417
  },
2922
3418
  ExperiencePanel,
2923
3419
  ),
@@ -2928,7 +3424,7 @@ window.__ModuleLoader__.load({
2928
3424
  name: 'settings.section',
2929
3425
  id: 'experience-optimizer',
2930
3426
  order: 25,
2931
- label: () => '体验优化',
3427
+ label: () => '插件体检',
2932
3428
  },
2933
3429
  ExperiencePanel,
2934
3430
  ),