dsh-plugin-trim 0.3.2 → 0.3.4
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 +2 -2
- package/client.js +302 -36
- package/dist/index.js +23 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,13 +7,13 @@ DSH 插件生态的**减负**与**兼容性体检**插件。
|
|
|
7
7
|
从 npm 安装(推荐):
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
dsh plugin --profile web add dsh-plugin-trim@0.3.
|
|
10
|
+
dsh plugin --profile web add dsh-plugin-trim@0.3.4
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
从 GitHub Release 安装(备用,无需 npm):
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
dsh plugin --profile web add "https://github.com/Starlit-Sky-code/dsh-experience-optimizer/releases/download/v0.3.
|
|
16
|
+
dsh plugin --profile web add "https://github.com/Starlit-Sky-code/dsh-experience-optimizer/releases/download/v0.3.4/dsh-plugin-trim-0.3.4.tgz"
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
本地开发:
|
package/client.js
CHANGED
|
@@ -14,7 +14,7 @@ window.__ModuleLoader__.load({
|
|
|
14
14
|
const CSS_ID = 'dsh-experience-optimizer-ui'
|
|
15
15
|
const TASK_TAGS = [
|
|
16
16
|
['unknown', '自动识别'],
|
|
17
|
-
['bugfix', '
|
|
17
|
+
['bugfix', '修复问题'],
|
|
18
18
|
['feature', '新功能'],
|
|
19
19
|
['review', '代码审查'],
|
|
20
20
|
['docs', '文档'],
|
|
@@ -147,6 +147,20 @@ window.__ModuleLoader__.load({
|
|
|
147
147
|
.eo-muted{color:var(--eo-tertiary);font-size:12px;line-height:18px}
|
|
148
148
|
.eo-note{padding:9px 12px;border:1px solid var(--dsw-alias-border-l3);border-radius:8px;background:var(--dsw-alias-bg-layer-3);color:var(--eo-secondary);font-size:12px;line-height:19px}
|
|
149
149
|
.eo-code{font:400 11px/16px var(--eo-code);color:var(--eo-secondary);word-break:break-all}
|
|
150
|
+
.eo-steps{margin:0;padding-left:20px;color:var(--eo-secondary);font-size:13px;line-height:22px}
|
|
151
|
+
.eo-steps li{margin:0 0 8px;padding-left:2px}
|
|
152
|
+
.eo-steps strong{color:var(--eo-primary);font-weight:500}
|
|
153
|
+
.eo-settings-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 18px}
|
|
154
|
+
.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}
|
|
155
|
+
.eo-settings-row:last-child{border-bottom:0}
|
|
156
|
+
.eo-settings-row span:first-child{color:var(--eo-secondary);flex:0 0 auto}
|
|
157
|
+
.eo-settings-row code{font:400 11px/16px var(--eo-code);color:var(--eo-primary);text-align:right;word-break:break-all}
|
|
158
|
+
.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}
|
|
159
|
+
.eo-faq{border-bottom:.5px solid var(--eo-border);padding:8px 0}
|
|
160
|
+
.eo-faq:last-child{border-bottom:0}
|
|
161
|
+
.eo-faq summary{cursor:pointer;font-size:13px;line-height:20px;color:var(--eo-primary)}
|
|
162
|
+
.eo-faq p{margin:5px 0 0;color:var(--eo-tertiary);font-size:12px;line-height:19px}
|
|
163
|
+
@media(max-width:560px){.eo-settings-grid{grid-template-columns:1fr}}
|
|
150
164
|
.eo-inline{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
|
|
151
165
|
.eo-spacer{height:0}
|
|
152
166
|
@keyframes eo-spin{to{transform:rotate(360deg)}}
|
|
@@ -275,7 +289,7 @@ window.__ModuleLoader__.load({
|
|
|
275
289
|
{
|
|
276
290
|
'plugin-runtime': '插件 ↔ DSH',
|
|
277
291
|
'plugin-plugin': '插件 ↔ 插件',
|
|
278
|
-
profile: '
|
|
292
|
+
profile: '配置集',
|
|
279
293
|
workspace: '工作区',
|
|
280
294
|
}[domain] || domain
|
|
281
295
|
)
|
|
@@ -289,6 +303,36 @@ window.__ModuleLoader__.load({
|
|
|
289
303
|
)
|
|
290
304
|
}
|
|
291
305
|
|
|
306
|
+
function taskLabel(tag) {
|
|
307
|
+
return (
|
|
308
|
+
{
|
|
309
|
+
bugfix: '修复',
|
|
310
|
+
feature: '新功能',
|
|
311
|
+
review: '审查',
|
|
312
|
+
docs: '文档',
|
|
313
|
+
release: '发布',
|
|
314
|
+
report: '报告',
|
|
315
|
+
research: '调研',
|
|
316
|
+
unknown: '未知',
|
|
317
|
+
}[tag] || tag
|
|
318
|
+
)
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function riskLabel(risk) {
|
|
322
|
+
return { low: '低', medium: '中', high: '高' }[risk] || risk
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function guardLabel(status) {
|
|
326
|
+
return (
|
|
327
|
+
{
|
|
328
|
+
ok: '正常',
|
|
329
|
+
protected: '受保护',
|
|
330
|
+
incompatible: '不兼容',
|
|
331
|
+
warn: '警告',
|
|
332
|
+
}[status] || status
|
|
333
|
+
)
|
|
334
|
+
}
|
|
335
|
+
|
|
292
336
|
function usageLabel(state) {
|
|
293
337
|
return state === 'used' ? '有调用记录' : state === 'unused' ? '窗口内 0 调用' : '无使用账本'
|
|
294
338
|
}
|
|
@@ -362,6 +406,9 @@ window.__ModuleLoader__.load({
|
|
|
362
406
|
})
|
|
363
407
|
const [recipeResult, setRecipeResult] = useState(null)
|
|
364
408
|
const [recipeBusy, setRecipeBusy] = useState(false)
|
|
409
|
+
const [settings, setSettings] = useState(null)
|
|
410
|
+
const [settingsBusy, setSettingsBusy] = useState(false)
|
|
411
|
+
const [settingsError, setSettingsError] = useState('')
|
|
365
412
|
|
|
366
413
|
const notify = useCallback((message, kind) => {
|
|
367
414
|
setToast({ message, kind: kind || 'ok', id: Date.now() })
|
|
@@ -390,6 +437,18 @@ window.__ModuleLoader__.load({
|
|
|
390
437
|
void refresh()
|
|
391
438
|
}, [refresh])
|
|
392
439
|
|
|
440
|
+
const loadSettings = useCallback(async () => {
|
|
441
|
+
setSettingsBusy(true)
|
|
442
|
+
setSettingsError('')
|
|
443
|
+
try {
|
|
444
|
+
setSettings(await fetchJson(API + '/config'))
|
|
445
|
+
} catch (err) {
|
|
446
|
+
setSettingsError(err instanceof Error ? err.message : String(err))
|
|
447
|
+
} finally {
|
|
448
|
+
setSettingsBusy(false)
|
|
449
|
+
}
|
|
450
|
+
}, [])
|
|
451
|
+
|
|
393
452
|
const findings = useMemo(() => {
|
|
394
453
|
if (!overview) return []
|
|
395
454
|
const query = findingQuery.trim().toLowerCase()
|
|
@@ -627,7 +686,7 @@ window.__ModuleLoader__.load({
|
|
|
627
686
|
h(
|
|
628
687
|
'span',
|
|
629
688
|
{ className: 'eo-status', title: overview ? overview.profile.dir : '' },
|
|
630
|
-
overview ? '
|
|
689
|
+
overview ? '配置集:' + overview.profile.name : '读取中',
|
|
631
690
|
),
|
|
632
691
|
h(
|
|
633
692
|
Button,
|
|
@@ -657,6 +716,27 @@ window.__ModuleLoader__.load({
|
|
|
657
716
|
},
|
|
658
717
|
'工作流配方',
|
|
659
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()
|
|
736
|
+
},
|
|
737
|
+
},
|
|
738
|
+
'设置',
|
|
739
|
+
),
|
|
660
740
|
),
|
|
661
741
|
error
|
|
662
742
|
? h(
|
|
@@ -674,11 +754,15 @@ window.__ModuleLoader__.load({
|
|
|
674
754
|
'正在读取插件画像与兼容性数据…',
|
|
675
755
|
)
|
|
676
756
|
: null,
|
|
677
|
-
|
|
678
|
-
?
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
757
|
+
tab === 'tutorial'
|
|
758
|
+
? renderTutorial()
|
|
759
|
+
: tab === 'settings'
|
|
760
|
+
? renderSettings()
|
|
761
|
+
: overview
|
|
762
|
+
? tab === 'trim'
|
|
763
|
+
? renderTrim()
|
|
764
|
+
: renderRecipe()
|
|
765
|
+
: null,
|
|
682
766
|
confirmState
|
|
683
767
|
? h(ConfirmModal, {
|
|
684
768
|
state: confirmState,
|
|
@@ -693,6 +777,188 @@ window.__ModuleLoader__.load({
|
|
|
693
777
|
: null,
|
|
694
778
|
)
|
|
695
779
|
|
|
780
|
+
function renderTutorial() {
|
|
781
|
+
const quickStarts = [
|
|
782
|
+
{
|
|
783
|
+
label: '代码审查',
|
|
784
|
+
desc: '先看兼容性,再生成审查任务的精简方案',
|
|
785
|
+
run: () => {
|
|
786
|
+
setTaskTag('review')
|
|
787
|
+
setGoal('审查当前改动,指出风险、回归点和需要补测的地方')
|
|
788
|
+
setTab('trim')
|
|
789
|
+
notify('已填入审查任务,点击“生成方案”继续')
|
|
790
|
+
},
|
|
791
|
+
},
|
|
792
|
+
{
|
|
793
|
+
label: '修复问题',
|
|
794
|
+
desc: '排除无关插件,保留调试与文件工具',
|
|
795
|
+
run: () => {
|
|
796
|
+
setTaskTag('bugfix')
|
|
797
|
+
setGoal('修复一个可复现的 bug,并验证没有回归')
|
|
798
|
+
setTab('trim')
|
|
799
|
+
notify('已填入修复任务,点击“生成方案”继续')
|
|
800
|
+
},
|
|
801
|
+
},
|
|
802
|
+
{
|
|
803
|
+
label: '整理周报',
|
|
804
|
+
desc: '进入工作流配方,生成可导出的周报蓝图',
|
|
805
|
+
run: () => {
|
|
806
|
+
setTab('recipe')
|
|
807
|
+
notify('已打开工作流配方,按表单确认范围与交付方式')
|
|
808
|
+
},
|
|
809
|
+
},
|
|
810
|
+
]
|
|
811
|
+
return h(
|
|
812
|
+
'div',
|
|
813
|
+
{ className: 'eo-stack' },
|
|
814
|
+
h(
|
|
815
|
+
Card,
|
|
816
|
+
{ title: '5 分钟上手', subtitle: '从扫描到应用,每一步都可回滚' },
|
|
817
|
+
h(
|
|
818
|
+
'ol',
|
|
819
|
+
{ className: 'eo-steps' },
|
|
820
|
+
h('li', null, h('strong', null, '先扫描。'), ' 打开「减负与兼容」,看可归属上下文、兼容性和插件清单;清单里的“占比”就是常驻成本的可见化。'),
|
|
821
|
+
h('li', null, h('strong', null, '再生成方案。'), ' 选任务类型或写一句目标,点击“生成方案”。默认只生成草稿,不会改任何插件。'),
|
|
822
|
+
h('li', null, h('strong', null, '看判断依据。'), ' 只有“窗口内 0 调用 + 有上下文成本 + 非周期 + 任务高置信”才会标为建议关闭;其余进入人工复核。'),
|
|
823
|
+
h('li', null, h('strong', null, '确认后应用。'), ' 勾选低风险项,点击“应用选中”,核对弹窗后写入快照并应用;需要时可一键回滚。'),
|
|
824
|
+
h('li', null, h('strong', null, '需要工作流时。'), ' 打开「工作流配方」,生成带审批级别的蓝图,导出 Markdown/JSON 运行手册。'),
|
|
825
|
+
),
|
|
826
|
+
),
|
|
827
|
+
h(
|
|
828
|
+
Card,
|
|
829
|
+
{ title: '按任务快速开始', subtitle: '只是填入表单,不会直接修改插件' },
|
|
830
|
+
h(
|
|
831
|
+
'div',
|
|
832
|
+
{ className: 'eo-inline' },
|
|
833
|
+
quickStarts.map((item) =>
|
|
834
|
+
h(
|
|
835
|
+
'div',
|
|
836
|
+
{ key: item.label, className: 'eo-issue', style: { flex: '1 1 180px', flexDirection: 'column', alignItems: 'flex-start' } },
|
|
837
|
+
h('strong', null, item.label),
|
|
838
|
+
h('span', { className: 'eo-muted' }, item.desc),
|
|
839
|
+
h(Button, { variant: 'ghost', onClick: item.run }, '开始'),
|
|
840
|
+
),
|
|
841
|
+
),
|
|
842
|
+
),
|
|
843
|
+
),
|
|
844
|
+
h(
|
|
845
|
+
Card,
|
|
846
|
+
{ title: '常见问题', subtitle: '先看证据,再做决定' },
|
|
847
|
+
h('details', { className: 'eo-faq' },
|
|
848
|
+
h('summary', null, '为什么我几乎没有“建议关闭”?'),
|
|
849
|
+
h('p', null, '这是默认的保守策略:没有使用账本、当前任务置信度不够、插件带周期/触发器语义,或已经有调用记录时,只会进入人工复核,不会给出建议关闭。'),
|
|
850
|
+
),
|
|
851
|
+
h('details', { className: 'eo-faq' },
|
|
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;被拒绝、取消或审批服务不可用时一律不写入。'),
|
|
862
|
+
),
|
|
863
|
+
),
|
|
864
|
+
)
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
function configPatch(data) {
|
|
868
|
+
const lines = [
|
|
869
|
+
'- id: dsh-plugin-trim',
|
|
870
|
+
' config:',
|
|
871
|
+
' mode: ' + data.mode,
|
|
872
|
+
' approvalMode: ' + data.approvalMode,
|
|
873
|
+
' suggestionPolicy: ' + data.suggestionPolicy,
|
|
874
|
+
' approvalThreshold: ' + data.approvalThreshold,
|
|
875
|
+
' trackUsage: ' + String(data.trackUsage),
|
|
876
|
+
' usageRetentionDays: ' + data.usageRetentionDays,
|
|
877
|
+
' maxDrafts: ' + data.maxDrafts,
|
|
878
|
+
]
|
|
879
|
+
if (data.protect.length > 0) {
|
|
880
|
+
lines.push(' protect:')
|
|
881
|
+
for (const name of data.protect) lines.push(' - ' + name)
|
|
882
|
+
}
|
|
883
|
+
if (data.pinned.length > 0) {
|
|
884
|
+
lines.push(' pinned:')
|
|
885
|
+
for (const name of data.pinned) lines.push(' - ' + name)
|
|
886
|
+
}
|
|
887
|
+
return lines.join('\n')
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
async function copyConfig(data) {
|
|
891
|
+
try {
|
|
892
|
+
await navigator.clipboard.writeText(configPatch(data))
|
|
893
|
+
notify('配置片段已复制;写入配置补丁后生效')
|
|
894
|
+
} catch {
|
|
895
|
+
notify('无法访问剪贴板,请手动复制配置片段', 'warn')
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
function renderSettings() {
|
|
900
|
+
if (settingsBusy && settings === null) {
|
|
901
|
+
return h('div', { className: 'eo-loading' }, h('span', { className: 'eo-spinner' }), '正在读取当前生效设置…')
|
|
902
|
+
}
|
|
903
|
+
if (settingsError && settings === null) {
|
|
904
|
+
return h('div', { className: 'eo-error' }, h('span', null, settingsError), h(Button, { variant: 'ghost', onClick: loadSettings }, '重试'))
|
|
905
|
+
}
|
|
906
|
+
if (!settings) return h('div', { className: 'eo-empty' }, '暂无设置数据。')
|
|
907
|
+
const policyLabel = settings.suggestionPolicy === 'balanced' ? '旧评分(仍保护周期与已用插件)' : '证据优先(推荐)'
|
|
908
|
+
const approvalLabel = settings.approvalMode === 'risk-based' ? '仅超过阈值时审批' : '每次工具写入都审批'
|
|
909
|
+
return h(
|
|
910
|
+
'div',
|
|
911
|
+
{ className: 'eo-stack' },
|
|
912
|
+
h(
|
|
913
|
+
Card,
|
|
914
|
+
{
|
|
915
|
+
title: '当前生效设置',
|
|
916
|
+
subtitle: '只读视图;修改请写入配置补丁',
|
|
917
|
+
extra: h(Button, { variant: 'ghost', onClick: loadSettings, disabled: settingsBusy }, settingsBusy ? '读取中…' : '刷新'),
|
|
918
|
+
},
|
|
919
|
+
h(
|
|
920
|
+
'div',
|
|
921
|
+
{ className: 'eo-settings-grid' },
|
|
922
|
+
h('div', { className: 'eo-settings-row' }, h('span', null, '配置集'), h('code', null, settings.profile)),
|
|
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, '草稿/快照上限'), h('code', null, String(settings.maxDrafts))),
|
|
930
|
+
),
|
|
931
|
+
h('div', { className: 'eo-muted', style: { marginTop: '10px' } }, '配置目录:' + settings.profileDir),
|
|
932
|
+
),
|
|
933
|
+
h(
|
|
934
|
+
Card,
|
|
935
|
+
{ title: '保护与固定', subtitle: '这些插件永远不会进入自动建议' },
|
|
936
|
+
settings.protect.length === 0 && settings.pinned.length === 0
|
|
937
|
+
? h('div', { className: 'eo-empty' }, '尚未配置保护 / 固定名单。可在配置补丁中添加需要保底的插件。')
|
|
938
|
+
: h(
|
|
939
|
+
'div',
|
|
940
|
+
{ 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)),
|
|
943
|
+
),
|
|
944
|
+
),
|
|
945
|
+
h(
|
|
946
|
+
Card,
|
|
947
|
+
{
|
|
948
|
+
title: '配置片段',
|
|
949
|
+
subtitle: '复制到配置补丁;写入后由 DSH 重新加载',
|
|
950
|
+
extra: h(Button, { variant: 'accent', onClick: () => void copyConfig(settings) }, '复制片段'),
|
|
951
|
+
},
|
|
952
|
+
h('pre', { className: 'eo-codeblock' }, configPatch(settings)),
|
|
953
|
+
),
|
|
954
|
+
h(
|
|
955
|
+
Card,
|
|
956
|
+
{ title: '说明', subtitle: '设置页不会直接改配置' },
|
|
957
|
+
h('div', { className: 'eo-muted' }, '为避免 UI 绕过 DSH 的配置边界,这里只展示当前生效值与可复制片段。修改后请重新加载插件;审批与保护逻辑不会因为改设置而跳过。'),
|
|
958
|
+
),
|
|
959
|
+
)
|
|
960
|
+
}
|
|
961
|
+
|
|
696
962
|
function renderTrim() {
|
|
697
963
|
return h(
|
|
698
964
|
'div',
|
|
@@ -702,26 +968,26 @@ window.__ModuleLoader__.load({
|
|
|
702
968
|
key: 'tokens',
|
|
703
969
|
label: '可归属上下文',
|
|
704
970
|
value: formatTokens(overview.context.totalTokens),
|
|
705
|
-
hint: 'tokens ·
|
|
971
|
+
hint: 'tokens · 不含未归属',
|
|
706
972
|
}),
|
|
707
973
|
h(Metric, {
|
|
708
974
|
key: 'bundles',
|
|
709
975
|
label: '启用插件',
|
|
710
976
|
value: enabledBundles + ' / ' + totalBundles,
|
|
711
|
-
hint: '
|
|
977
|
+
hint: '已启用 / 全部插件',
|
|
712
978
|
}),
|
|
713
979
|
h(Metric, {
|
|
714
980
|
key: 'compat',
|
|
715
981
|
label: '兼容性',
|
|
716
|
-
value: compat.error + '
|
|
717
|
-
hint: '
|
|
982
|
+
value: compat.error + ' 错 · ' + compat.warn + ' 警',
|
|
983
|
+
hint: '错误 / 警告 · 信息 ' + compat.info,
|
|
718
984
|
tone: compat.error > 0 ? 'danger' : compat.warn > 0 ? 'warn' : 'ok',
|
|
719
985
|
}),
|
|
720
986
|
h(Metric, {
|
|
721
987
|
key: 'manage',
|
|
722
988
|
label: '写操作',
|
|
723
989
|
value: overview.managementAvailable ? '可应用' : '只读',
|
|
724
|
-
hint: overview.managementAvailable ? '
|
|
990
|
+
hint: overview.managementAvailable ? '插件管理器可用' : '缺少插件管理器',
|
|
725
991
|
tone: overview.managementAvailable ? 'ok' : 'danger',
|
|
726
992
|
}),
|
|
727
993
|
]),
|
|
@@ -729,7 +995,7 @@ window.__ModuleLoader__.load({
|
|
|
729
995
|
Card,
|
|
730
996
|
{
|
|
731
997
|
title: '兼容性矩阵',
|
|
732
|
-
subtitle: '插件 ↔ 插件 · 插件 ↔ DSH ·
|
|
998
|
+
subtitle: '插件 ↔ 插件 · 插件 ↔ DSH · 配置集 / 工作区',
|
|
733
999
|
section: 'compat',
|
|
734
1000
|
extra: h(
|
|
735
1001
|
'div',
|
|
@@ -750,7 +1016,7 @@ window.__ModuleLoader__.load({
|
|
|
750
1016
|
variant: 'ghost',
|
|
751
1017
|
onClick: () => setShowInfo((value) => !value),
|
|
752
1018
|
},
|
|
753
|
-
showInfo ? '
|
|
1019
|
+
showInfo ? '隐藏信息' : '显示信息',
|
|
754
1020
|
),
|
|
755
1021
|
h(Badge, { tone: compat.error ? 'danger' : 'ok' }, compat.error ? '需要处理' : '无阻断'),
|
|
756
1022
|
),
|
|
@@ -763,7 +1029,7 @@ window.__ModuleLoader__.load({
|
|
|
763
1029
|
{ label: '搜索兼容性' },
|
|
764
1030
|
h('input', {
|
|
765
1031
|
className: 'eo-input',
|
|
766
|
-
placeholder: '
|
|
1032
|
+
placeholder: '代码 / 标题 / 对象',
|
|
767
1033
|
value: findingQuery,
|
|
768
1034
|
onChange: (event) => setFindingQuery(event.target.value),
|
|
769
1035
|
}),
|
|
@@ -779,9 +1045,9 @@ window.__ModuleLoader__.load({
|
|
|
779
1045
|
onChange: (event) => setFindingSeverity(event.target.value),
|
|
780
1046
|
},
|
|
781
1047
|
h('option', { value: 'all' }, '全部'),
|
|
782
|
-
h('option', { value: 'error' }, '
|
|
783
|
-
h('option', { value: 'warn' }, '
|
|
784
|
-
h('option', { value: 'info' }, '
|
|
1048
|
+
h('option', { value: 'error' }, '错误'),
|
|
1049
|
+
h('option', { value: 'warn' }, '警告'),
|
|
1050
|
+
h('option', { value: 'info' }, '信息'),
|
|
785
1051
|
),
|
|
786
1052
|
),
|
|
787
1053
|
),
|
|
@@ -876,7 +1142,7 @@ window.__ModuleLoader__.load({
|
|
|
876
1142
|
null,
|
|
877
1143
|
h('th', null, 'Section / Tool'),
|
|
878
1144
|
h('th', null, 'Owner'),
|
|
879
|
-
h('th', null, '
|
|
1145
|
+
h('th', null, '上下文'),
|
|
880
1146
|
),
|
|
881
1147
|
),
|
|
882
1148
|
h(
|
|
@@ -935,7 +1201,7 @@ window.__ModuleLoader__.load({
|
|
|
935
1201
|
{ label: '搜索插件' },
|
|
936
1202
|
h('input', {
|
|
937
1203
|
className: 'eo-input',
|
|
938
|
-
placeholder: '
|
|
1204
|
+
placeholder: '名称 / 描述',
|
|
939
1205
|
value: bundleQuery,
|
|
940
1206
|
onChange: (event) => setBundleQuery(event.target.value),
|
|
941
1207
|
}),
|
|
@@ -986,10 +1252,10 @@ window.__ModuleLoader__.load({
|
|
|
986
1252
|
h('th', null, '插件'),
|
|
987
1253
|
h('th', null, '状态'),
|
|
988
1254
|
h('th', null, '保护'),
|
|
989
|
-
h('th', null, '
|
|
990
|
-
h('th', null, '
|
|
1255
|
+
h('th', null, '守卫'),
|
|
1256
|
+
h('th', null, '上下文'),
|
|
991
1257
|
h('th', null, '占比'),
|
|
992
|
-
h('th', null, '
|
|
1258
|
+
h('th', null, '调用'),
|
|
993
1259
|
),
|
|
994
1260
|
),
|
|
995
1261
|
h(
|
|
@@ -1013,15 +1279,15 @@ window.__ModuleLoader__.load({
|
|
|
1013
1279
|
h(
|
|
1014
1280
|
Badge,
|
|
1015
1281
|
{ tone: bundle.enabled ? 'ok' : 'neutral' },
|
|
1016
|
-
bundle.enabled ? '
|
|
1282
|
+
bundle.enabled ? '已启用' : '已禁用',
|
|
1017
1283
|
),
|
|
1018
1284
|
),
|
|
1019
1285
|
h(
|
|
1020
1286
|
'td',
|
|
1021
1287
|
null,
|
|
1022
|
-
bundle.protected ? h(Badge, { tone: 'warn' }, '
|
|
1288
|
+
bundle.protected ? h(Badge, { tone: 'warn' }, '受保护') : '—',
|
|
1023
1289
|
),
|
|
1024
|
-
h('td', { className: 'eo-muted' }, bundle.guardStatus
|
|
1290
|
+
h('td', { className: 'eo-muted' }, bundle.guardStatus ? guardLabel(bundle.guardStatus) : '—'),
|
|
1025
1291
|
h('td', null, formatNumber(bundle.contextTokens)),
|
|
1026
1292
|
h(
|
|
1027
1293
|
'td',
|
|
@@ -1105,7 +1371,7 @@ window.__ModuleLoader__.load({
|
|
|
1105
1371
|
h(Badge, { tone: 'neutral' }, '受保护 ' + draft.summary.protected),
|
|
1106
1372
|
h(Badge, { tone: 'warn' }, '周期保护 ' + periodicDraftCount),
|
|
1107
1373
|
h(Badge, { tone: 'ok' }, '证据强 ' + strongDraftCount),
|
|
1108
|
-
h(Badge, { tone: 'warn' }, '
|
|
1374
|
+
h(Badge, { tone: 'warn' }, '任务:' + taskLabel(draft.task.tag)),
|
|
1109
1375
|
),
|
|
1110
1376
|
actionableDraftItems.length === 0
|
|
1111
1377
|
? h(
|
|
@@ -1146,7 +1412,7 @@ window.__ModuleLoader__.load({
|
|
|
1146
1412
|
{ tone: actionTone(item.action) },
|
|
1147
1413
|
actionLabel(item.action),
|
|
1148
1414
|
),
|
|
1149
|
-
h(Badge, { tone: riskTone(item.risk) }, '
|
|
1415
|
+
h(Badge, { tone: riskTone(item.risk) }, '风险:' + riskLabel(item.risk)),
|
|
1150
1416
|
item.protected ? h(Badge, { tone: 'neutral' }, '受保护') : null,
|
|
1151
1417
|
item.periodic ? h(Badge, { tone: 'warn' }, '周期/触发器') : null,
|
|
1152
1418
|
item.usageState
|
|
@@ -1186,7 +1452,7 @@ window.__ModuleLoader__.load({
|
|
|
1186
1452
|
'div',
|
|
1187
1453
|
{ className: 'eo-item-side' },
|
|
1188
1454
|
h('span', null, Number(item.score).toFixed(2)),
|
|
1189
|
-
h('small', null, '
|
|
1455
|
+
h('small', null, '评分'),
|
|
1190
1456
|
),
|
|
1191
1457
|
),
|
|
1192
1458
|
),
|
|
@@ -1232,7 +1498,7 @@ window.__ModuleLoader__.load({
|
|
|
1232
1498
|
Card,
|
|
1233
1499
|
{
|
|
1234
1500
|
title: '应用结果',
|
|
1235
|
-
subtitle: applyResult.rolledBack ? '中途失败,已自动回滚' : '
|
|
1501
|
+
subtitle: applyResult.rolledBack ? '中途失败,已自动回滚' : '变更已写入配置集',
|
|
1236
1502
|
section: 'result',
|
|
1237
1503
|
extra: h(
|
|
1238
1504
|
Badge,
|
|
@@ -1511,10 +1777,10 @@ window.__ModuleLoader__.load({
|
|
|
1511
1777
|
h(
|
|
1512
1778
|
'div',
|
|
1513
1779
|
{ className: 'eo-summary' },
|
|
1514
|
-
h(Badge, { tone: 'info' }, '
|
|
1515
|
-
h(Badge, { tone: 'neutral' }, '
|
|
1516
|
-
h(Badge, { tone: 'warn' }, '
|
|
1517
|
-
h(Badge, { tone: 'neutral' }, '
|
|
1780
|
+
h(Badge, { tone: 'info' }, '模板:' + blueprint.template),
|
|
1781
|
+
h(Badge, { tone: 'neutral' }, '权限:' + blueprint.permissions.length),
|
|
1782
|
+
h(Badge, { tone: 'warn' }, '需审批:' + blueprint.steps.filter((step) => step.approvalLevel === 'required' || step.needsConfirm).length),
|
|
1783
|
+
h(Badge, { tone: 'neutral' }, '最小插件:' + blueprint.minPluginSet.length),
|
|
1518
1784
|
),
|
|
1519
1785
|
h(
|
|
1520
1786
|
'table',
|
|
@@ -1697,7 +1963,7 @@ window.__ModuleLoader__.load({
|
|
|
1697
1963
|
{ className: 'eo-item-title' },
|
|
1698
1964
|
h('span', { className: 'eo-item-name' }, item.name),
|
|
1699
1965
|
h(Badge, { tone: actionTone(item.action) }, actionLabel(item.action)),
|
|
1700
|
-
h(Badge, { tone: riskTone(item.risk) }, '
|
|
1966
|
+
h(Badge, { tone: riskTone(item.risk) }, '风险:' + riskLabel(item.risk)),
|
|
1701
1967
|
),
|
|
1702
1968
|
h('div', { className: 'eo-item-reason' }, item.reason),
|
|
1703
1969
|
),
|
package/dist/index.js
CHANGED
|
@@ -4641,6 +4641,13 @@ async function handle(req, res, ctx, config, ledger) {
|
|
|
4641
4641
|
});
|
|
4642
4642
|
return;
|
|
4643
4643
|
}
|
|
4644
|
+
if (req.method === "GET" && path === "/config") {
|
|
4645
|
+
sendJson(res, 200, {
|
|
4646
|
+
ok: true,
|
|
4647
|
+
data: publicConfig(ctx, config)
|
|
4648
|
+
});
|
|
4649
|
+
return;
|
|
4650
|
+
}
|
|
4644
4651
|
if (req.method === "POST" && path === "/suggest") {
|
|
4645
4652
|
sendJson(res, 200, {
|
|
4646
4653
|
ok: true,
|
|
@@ -4667,6 +4674,22 @@ async function handle(req, res, ctx, config, ledger) {
|
|
|
4667
4674
|
sendError(res, 500, error instanceof Error ? error.message : String(error));
|
|
4668
4675
|
}
|
|
4669
4676
|
}
|
|
4677
|
+
function publicConfig(ctx, config) {
|
|
4678
|
+
const profile = resolveProfileFacts(ctx);
|
|
4679
|
+
return {
|
|
4680
|
+
profile: profile.name,
|
|
4681
|
+
profileDir: profile.dir,
|
|
4682
|
+
mode: config.mode,
|
|
4683
|
+
approvalMode: config.approvalMode,
|
|
4684
|
+
suggestionPolicy: config.suggestionPolicy,
|
|
4685
|
+
approvalThreshold: config.approvalThreshold,
|
|
4686
|
+
protect: [...config.protect],
|
|
4687
|
+
pinned: [...config.pinned],
|
|
4688
|
+
trackUsage: config.trackUsage,
|
|
4689
|
+
usageRetentionDays: config.usageRetentionDays,
|
|
4690
|
+
maxDrafts: config.maxDrafts
|
|
4691
|
+
};
|
|
4692
|
+
}
|
|
4670
4693
|
async function overview(ctx, config, ledger) {
|
|
4671
4694
|
const compat = await analyzeCompatibility(ctx, config, {
|
|
4672
4695
|
scope: "current",
|