@matrixfu/skill-set-manager 0.0.0-stage → 1.1.3
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 +1618 -0
- package/cordis.patch.yml +5 -0
- package/icon.svg +7 -0
- package/index.js +1091 -0
- package/lib/core/atomic.js +16 -0
- package/lib/core/backup.js +123 -0
- package/lib/core/binding.js +22 -0
- package/lib/core/commandLine.js +31 -0
- package/lib/core/dataPlane.js +81 -0
- package/lib/core/diagnose.js +167 -0
- package/lib/core/effective.js +237 -0
- package/lib/core/giterr.js +22 -0
- package/lib/core/github.js +256 -0
- package/lib/core/gitignore.js +35 -0
- package/lib/core/gitnet.js +112 -0
- package/lib/core/lifecycle.js +88 -0
- package/lib/core/linkx.js +92 -0
- package/lib/core/managed.js +24 -0
- package/lib/core/manifest.js +169 -0
- package/lib/core/migrate.js +145 -0
- package/lib/core/opgate.js +62 -0
- package/lib/core/paths.js +52 -0
- package/lib/core/pending.js +210 -0
- package/lib/core/plan.js +33 -0
- package/lib/core/projectRoot.js +20 -0
- package/lib/core/providerSkills.js +26 -0
- package/lib/core/provision.js +32 -0
- package/lib/core/resident.js +98 -0
- package/lib/core/resolver.js +136 -0
- package/lib/core/search.js +28 -0
- package/lib/core/sets.js +250 -0
- package/lib/core/source.js +64 -0
- package/lib/core/storage.js +87 -0
- package/lib/core/translateExec.js +122 -0
- package/lib/core/translations.js +62 -0
- package/lib/core/updates.js +181 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +63 -4
- package/README.md +0 -3
package/client.js
ADDED
|
@@ -0,0 +1,1618 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* skill-set-manager client 半:单一入口(composer 工具行左缘;§12 的侧边栏入口经用户决定移除,
|
|
3
|
+
* 会话绑定/状态预拉本就在 composer 半)打开同一个 shell.overlay 面板;
|
|
4
|
+
* 操作一律经 host 半(Remote 面优先、同源 fetch 兜底)——无第二实现(#15)。
|
|
5
|
+
* 正常切换不设模态(§6.5),仅「项目根 ≠ 会话目录」时经 overlay 确认;撤销入口在面板内。
|
|
6
|
+
*/
|
|
7
|
+
window.__ModuleLoader__.load({
|
|
8
|
+
id: '@matrixfu/skill-set-manager',
|
|
9
|
+
factory(require) {
|
|
10
|
+
const React = require('react');
|
|
11
|
+
const h = React.createElement;
|
|
12
|
+
const PKG = '@matrixfu/skill-set-manager';
|
|
13
|
+
|
|
14
|
+
const DICTS = {
|
|
15
|
+
zh: {
|
|
16
|
+
chip: '技能集', panel: '技能集管理器', close: '关闭', sets: '技能集', projectRoot: '项目根',
|
|
17
|
+
rootDrift: '(≠ 会话目录——切换影响该仓库全部会话)', // 「全局常驻」纯文本行口径随美化退役(死键 resident 已删,呈现见 residentRow/徽章族)
|
|
18
|
+
managedSec: '技能集提供(受管)', override: '临时覆盖', overrideOn: '临时覆盖中', endOverride: '结束覆盖',
|
|
19
|
+
ovRemoved: '已被剔除', ovRestoreTip: '重新勾选即恢复本会话生效', overrideHint: '临时覆盖中:在「受管」区取消勾选 = 仅本会话剔除(不改技能集);重新勾选或「结束覆盖」即恢复;要从集合里永久移除请用集合区「编辑成员」',
|
|
20
|
+
undo: '撤销切换(回到上一份生效清单)', switchTo: '切换', current: '当前', saveAs: '另存为当前清单',
|
|
21
|
+
newName: '新名称', copy: '复制', rename: '改名', del: '删除', confirmDel: '确认删除该技能集?受影响项目将冻结绑定',
|
|
22
|
+
confirmSwitch: '确认切换:将改写仓库根的 .agents/skills/(仅托管条目)', exportJson: '导出', importJson: '导入',
|
|
23
|
+
regen: '重新生成', claimForeign: '接管失配条目', claimForeignHint: '把「名字在本集里、盘上已存在、且确实指向库/生效区」的链接补回托管台账(只补台账,不动盘上条目)', pruneMissing: '从集合移除缺失成员', draftHint: '未绑定:勾选即本会话临时生效(会话结束自动撤下);要固化:勾好技能 → 点本条右侧「另存为当前清单」→ 输入集合名 → 确认,即创建并绑定本项目(常驻全局技能不在候选中)', noBinding: '未绑定技能集', skillsCount: '个技能', loadFailed: '加载失败',
|
|
24
|
+
opFailed: '操作失败', empty: '(暂无技能集)', hintP2: '技能变化下一轮请求生效;本面板操作后 / 菜单列表即同步刷新',
|
|
25
|
+
copyClip: '复制到剪贴板', copied: '已复制 ✓', copyFail: '复制失败',
|
|
26
|
+
noSession: '先在对话页打开一个会话',
|
|
27
|
+
settingsLabel: '技能集管理器', tabLibrary: '库', tabOps: '安装与更新', tabDiag: '诊断',
|
|
28
|
+
filterPh: '按名称/来源过滤', managedTag: '受管', unmanagedTag: '未登记', modifiedTag: '本地改动',
|
|
29
|
+
backupsTitle: '回收站', restoreGo: '恢复', applyUp: '应用更新', checkingUp: '检查更新中…', applyingUp: '应用更新中…', // 死键 checkUp 已删(行内图标钮用 sAriaCheckUpd,无其它使用者)
|
|
30
|
+
upToDate: '已是最新', upActions: '差异', skipNote: '本地改动的文件已跳过', noContentDiff: '内容已一致', claimNoCommit: '来源为认领,未记 commit',
|
|
31
|
+
uninstallGo: '卸载', confirmUn: '确认卸载?(先备份→从所有集移除→各项目回收托管条目)',
|
|
32
|
+
installTitle: '从 GitHub 安装', installSpecPh: '仓库规格 owner/repo[@ref][/subpath]', installGo: '安装', overwriteChk: '覆盖同名(先备份)',
|
|
33
|
+
batchCheckUpd: '批量检查更新', clearCache: '清空上游缓存', // 2026-11-17 加固 T5(GLOSSARY「批量检查更新」「上游缓存」)
|
|
34
|
+
migrateTitle: '旧通用区迁移(~/.dsh/skills,一次性)', migratePreview: '预览迁移', migrateApply: '执行迁移', migrateUndo: '回滚迁移',
|
|
35
|
+
migrateMoves: '将移动', migrateKeep: '保留不搬',
|
|
36
|
+
migrateReasonExists: '库同名', migrateReasonLink: '外部链接', migrateReasonManifest: '他人记账', migrateReasonResident: '已是常驻链接',
|
|
37
|
+
migrateAgentsTitle: '跨 harness 通用区迁移(~/.agents/skills,一次性)', migrateAgentsGo: '预览并迁移',
|
|
38
|
+
migrateAgentsHint: '把与其他 harness 共用的通用区技能移入技能库;只移无 manifest 的纯目录,其他工具的条目与同名保留不动,可一键回滚。',
|
|
39
|
+
diagRun: '运行诊断', fixReclaim: '回收失效链接', fixRebuild: '按当前集重建',
|
|
40
|
+
diagPartition: '分区说明', diagCopies: '副本漂移', diagDangling: '悬空引用',
|
|
41
|
+
diagDeadLinks: '失效链接', diagStructure: '结构问题', diagEnv: '环境',
|
|
42
|
+
none: '(无)', opDone: '完成', backupAt: '备份位置', moreFiles: '…(其余略)',
|
|
43
|
+
unbindGo: '解绑', unbindCurrent: '解绑当前技能集', confirmUnbind: '确认解绑?托管条目将被回收,用户自有条目不动',
|
|
44
|
+
foreignLine: '外来条目(不接管、切换不覆盖)',
|
|
45
|
+
settingsHint: '安装/升级/卸载/回收站/诊断在「设置 → 技能集管理器」',
|
|
46
|
+
searchPh: '按名称/用途搜索技能…', hitCount: '命中', pendingTag: '待翻译',
|
|
47
|
+
residentRow: '全局常驻 · 已在所有项目生效', foreignRow: '外来常驻 · 其他工具放入 ~/.agents/skills',
|
|
48
|
+
providerSec: '插件/Preset 提供', providerHint: '插件或 agent preset 注入,不受技能集管控:切换技能集不移除;停用对应插件即消失', providerRow: '插件/Preset 提供 · 不受技能集管控', providerRowGo: '在「设置 → 插件」停用来源插件',
|
|
49
|
+
goSettings: '去设置 → 技能集管理器管理 ›', // 设计 2026-10-28:未绑定也可起盘临时覆盖(host 台账 setSlug:null),旧 N6「未绑定不可覆盖」口径已废;死键 unboundHint 已删(无使用者,verify 锚同删,用户 2026-11-17)
|
|
50
|
+
tabGlobal: '全局技能集', globalTabHint: '常驻技能在所有项目生效;链接落在下行所示目录(跨 harness 共享,其他工具可见)。外来常驻条目只读。',
|
|
51
|
+
residentOnly: '只看常驻', batchTranslate: '批量翻译', translateGo: '翻译', translateDone: '翻译结果', failedRetryable: '条此前失败 · 点击一并重试',
|
|
52
|
+
translateProgress: '翻译中', translateStop: '停止', translateStopping: '停止中(等在途条目收尾)',
|
|
53
|
+
modelSelect: '翻译模型(默认 = 当前会话模型)', currentModel: '当前模型(默认)',
|
|
54
|
+
autoTranslateHint: '自动翻译默认关(零出网);关闭时用手动批量按钮。中文写缓存、不改技能原文。',
|
|
55
|
+
tabTitle: '技能集详情', tabDesc: '完整生效清单、状态分区与诊断摘要', openRight: '在右栏打开技能集详情',
|
|
56
|
+
rpEffective: '生效清单', rpSelf: '状态自检', rpDiag: '诊断摘要',
|
|
57
|
+
rpFrozen: '技能集已删除(冻结:清单原样保留)', rpClick: '点击查看 SKILL.md', rpNoSession: '(右栏 tab 未绑定会话)',
|
|
58
|
+
rpForeign: '外来', rpMissing: '缺失', rpDead: '失效',
|
|
59
|
+
rpEmpty: '(无生效技能)', rpDiagFail: '诊断加载失败',
|
|
60
|
+
rpGlobalActiveUnbound: '未绑定技能集:全局常驻技能已生效({n} 项,不逐条列出)', rpGlobalActiveHint: '全局常驻技能已生效({n} 项,不逐条列出)',
|
|
61
|
+
importPreviewBtn: '预览导入', importApply: '应用导入', importConflict: '显示名已存在(该项跳过)',
|
|
62
|
+
importAllPresent: '技能齐备', importMissing: '本机缺失', importNoPin: '无来源 pin,装不了',
|
|
63
|
+
importChoiceInstall: '按 pin 安装', importChoicePlaceholder: '先占位', importChoiceIgnore: '忽略',
|
|
64
|
+
importDefaultHint: '每个缺失技能选一项;不选 = 忽略(插件不自动联网安装)', importApplied: '导入完成',
|
|
65
|
+
claimGo: '认领来源', claimEdit: '改认领', claimSourcePh: '来源 owner/repo[/subpath]', claimCommitPh: 'commit(可空)',
|
|
66
|
+
claimUndo: '撤认领', claimHint: '认领 = 以当前盘上内容为基线写 manifest(此后本地改动可被升级识别并跳过)',
|
|
67
|
+
editMembers: '成员', editTitle: '编辑成员', saveBtn: '保存',
|
|
68
|
+
memberHint: '勾选 = 该集包含,保存即写回;当前绑定集会立即重新生成生效清单(会话临时覆盖保留);全局常驻技能所有集自动包含,故不进候选(用户 2026-10-26)', memberMissing: '不在库', memberResidentTag: '已是全局常驻·自动包含',
|
|
69
|
+
// 长任务态(设计 2026-10-29):阶段文案只描述「还在等 host」,不假装知道真实边界
|
|
70
|
+
taskConnect: '正在连接 GitHub…', taskFetching: '正在浅克隆仓库并检出文件…', taskSlowRepo: '仍在拉取:大仓库可能要 1–2 分钟',
|
|
71
|
+
taskImport: '正在按 pin 安装所选技能…', taskUpdateCheck: '正在比对远端 commit…', taskUpdateApply: '正在拉取远端并写回本地…',
|
|
72
|
+
taskUninstall: '正在卸载并回收托管条目…', taskMigrate: '正在迁移存量条目…',
|
|
73
|
+
taskElapsed: '已等待 {n}s', taskBusyWith: '正在{n},请先等它跑完', taskDismiss: '清除',
|
|
74
|
+
taskOpInstall: '安装', taskOpImport: '导入', taskOpUninstall: '卸载', taskOpMigrate: '迁移', taskOpCheck: '检查更新', taskOpApply: '应用更新',
|
|
75
|
+
taskOpCheckAll: '批量检查更新', taskUpdateCheckAll: '检查更新中', checkUpdFailed: '{n} 个来源仓库检查失败(其余照常)', retryFailedSrcs: '重试失败仓库', // 2026-11-17 加固 T5
|
|
76
|
+
opPartial: '部分完成:{n} 装入 · {m} 未装(逐条结果见「运维」页签)',
|
|
77
|
+
// 面板美化(spec 2026-11-06):新结构文案键(Task 2/3/4 消费)
|
|
78
|
+
effTitle: '生效清单', candidates: '候选', notActive: '未生效',
|
|
79
|
+
ovBanner: '临时覆盖中 · 剔除 {n} 项 · 加入 {m} 项',
|
|
80
|
+
grayResident: '全局常驻', grayForeign: '外来常驻', grayProvider: '插件/Preset 提供', grayItems: '项',
|
|
81
|
+
otherSec: '其他(不受技能集管控)',
|
|
82
|
+
descPh: '描述(可空)', emptySearch: '没有匹配的技能', emptyList: '当前没有生效技能', updatedAt: '更新于',
|
|
83
|
+
ariaExpand: '展开', ariaCollapse: '收起', ariaPick: '勾选',
|
|
84
|
+
// 设置页/右栏美化(spec 2026-11-07):基座新键,一次补齐(Task 3–6 消费;zh/en 同键集)
|
|
85
|
+
rpModified: '本地改动',
|
|
86
|
+
sAriaCheckUpd: '检查更新', sAriaTrashBin: '移入回收站', sAriaClaim: '改认领', sAriaUninstall: '卸载', sAriaReload: '刷新',
|
|
87
|
+
sEmptyLib: '技能库还没有技能:到「安装与更新」页签从 GitHub 安装', sLoading: '加载技能库中…', sEmptyGlobal: '还没有全局常驻技能:勾选候选即在所有项目生效', sEmptyDiag: '未发现异常',
|
|
88
|
+
},
|
|
89
|
+
en: {
|
|
90
|
+
chip: 'Skill sets', panel: 'Skill Set Manager', close: 'Close', sets: 'Skill sets', projectRoot: 'Project root',
|
|
91
|
+
rootDrift: '(≠ session dir — switching affects every session in this repo)', // 死键 resident 已删(无使用者,见 zh 侧同注)
|
|
92
|
+
managedSec: 'Set-provided (managed)', override: 'Session override', overrideOn: 'Override active', endOverride: 'End override',
|
|
93
|
+
ovRemoved: 'removed by override', ovRestoreTip: 'Tick again to restore for this session', overrideHint: 'Override active: unticking in the managed area removes it for this session only (the set is unchanged); tick again or "End override" to restore; to remove from the set permanently use "Edit members" in the sets area',
|
|
94
|
+
undo: 'Undo switch (restore previous effective set)', switchTo: 'Switch', current: 'current', saveAs: 'Save current as set',
|
|
95
|
+
newName: 'New name', copy: 'Copy', rename: 'Rename', del: 'Delete', confirmDel: 'Delete this set? Affected projects freeze their binding.',
|
|
96
|
+
confirmSwitch: 'Confirm switch: rewrites .agents/skills/ at the repo root (managed entries only)', exportJson: 'Export', importJson: 'Import',
|
|
97
|
+
regen: 'Regenerate', claimForeign: 'Claim mismatched entries', claimForeignHint: 'Re-register links that are named in this set, already on disk and really pointing at the library/active zones back into the managed ledger (ledger only, disk entries untouched)', pruneMissing: 'Remove missing members', draftHint: 'No set bound: ticking a skill activates it for this session only (auto-removed when the session ends); to keep it, tick the skills you want, then click "Save current as set" on the right of this banner, name the set and confirm — it will be created and bound to this project (global resident skills are not candidates)', noBinding: 'No skill set bound', skillsCount: 'skills', loadFailed: 'Load failed',
|
|
98
|
+
opFailed: 'Operation failed', empty: '(no skill sets yet)', hintP2: 'Skill changes take effect on the next request; the / menu list refreshes right after panel operations',
|
|
99
|
+
copyClip: 'Copy to clipboard', copied: 'Copied ✓', copyFail: 'Copy failed',
|
|
100
|
+
noSession: 'Open a conversation session first',
|
|
101
|
+
settingsLabel: 'Skill Sets', tabLibrary: 'Library', tabOps: 'Install & update', tabDiag: 'Diagnose',
|
|
102
|
+
filterPh: 'Filter by name/source', managedTag: 'managed', unmanagedTag: 'untracked', modifiedTag: 'locally modified',
|
|
103
|
+
backupsTitle: 'Trash', restoreGo: 'Restore', applyUp: 'Apply update', checkingUp: 'Checking…', applyingUp: 'Applying…', // 死键 checkUp 已删(见 zh 侧同注)
|
|
104
|
+
upToDate: 'Up to date', upActions: 'Diff', skipNote: 'locally modified files skipped', noContentDiff: 'contents already match', claimNoCommit: 'source claimed without a recorded commit',
|
|
105
|
+
uninstallGo: 'Uninstall', confirmUn: 'Uninstall? (backup → remove from all sets → reclaim managed entries per project)',
|
|
106
|
+
installTitle: 'Install from GitHub', installSpecPh: 'repo spec owner/repo[@ref][/subpath]', installGo: 'Install', overwriteChk: 'overwrite same name (backup first)',
|
|
107
|
+
batchCheckUpd: 'Batch check updates', clearCache: 'Clear upstream cache', // hardening T5 (GLOSSARY Batch Update Check / Upstream Cache)
|
|
108
|
+
migrateTitle: 'Migrate legacy shared area (~/.dsh/skills, one-time)', migratePreview: 'Preview', migrateApply: 'Apply', migrateUndo: 'Undo migration',
|
|
109
|
+
migrateMoves: 'Will move', migrateKeep: 'Kept',
|
|
110
|
+
migrateReasonExists: 'name clash', migrateReasonLink: 'external link', migrateReasonManifest: 'other tool', migrateReasonResident: 'already resident',
|
|
111
|
+
migrateAgentsTitle: 'Migrate cross-harness skills (~/.agents/skills, one-time)', migrateAgentsGo: 'Preview & migrate',
|
|
112
|
+
migrateAgentsHint: 'Move skills from the shared cross-harness dir into the library; only plain dirs without a manifest move — other tools’ entries and same-name collisions stay put, undoable.',
|
|
113
|
+
diagRun: 'Run diagnose', fixReclaim: 'Reclaim dead links', fixRebuild: 'Rebuild from set',
|
|
114
|
+
diagPartition: 'Partition', diagCopies: 'Copy drift', diagDangling: 'Dangling refs',
|
|
115
|
+
diagDeadLinks: 'Dead links', diagStructure: 'Structure', diagEnv: 'Environment',
|
|
116
|
+
none: '(none)', opDone: 'Done', backupAt: 'Backup at', moreFiles: '… (rest omitted)',
|
|
117
|
+
unbindGo: 'Unbind', unbindCurrent: 'Unbind current set', confirmUnbind: 'Unbind? Managed entries are reclaimed; your own entries stay.',
|
|
118
|
+
foreignLine: 'Foreign entries (untouched by switching)',
|
|
119
|
+
settingsHint: 'Install/update/uninstall/trash/diagnose live in Settings → Skill Sets',
|
|
120
|
+
searchPh: 'Search skills by name or purpose…', hitCount: 'matches', pendingTag: 'untranslated',
|
|
121
|
+
residentRow: 'Global resident · active in every project', foreignRow: 'Foreign resident · from ~/.agents/skills',
|
|
122
|
+
providerSec: 'Plugin / preset-provided', providerHint: 'Injected by a plugin or agent preset, outside skill-set control: switching sets will not remove them; disable the plugin to hide', providerRow: 'Plugin / preset-provided · not skill-set managed', providerRowGo: 'disable the source plugin in Settings → Plugins',
|
|
123
|
+
goSettings: 'manage in Settings → Skill Sets ›', // 死键 unboundHint 已删(无使用者,verify 锚同删,见 zh 侧同注,用户 2026-11-17)
|
|
124
|
+
tabGlobal: 'Global Skills', globalTabHint: 'Resident skills apply to every project; links live in the dir shown below (shared across harnesses). Foreign residents are read-only.',
|
|
125
|
+
residentOnly: 'Resident only', batchTranslate: 'Batch translate', translateGo: 'Translate', translateDone: 'Translation result', failedRetryable: 'previously failed · click to retry all',
|
|
126
|
+
translateProgress: 'Translating', translateStop: 'Stop', translateStopping: 'stopping (waiting for in-flight items)',
|
|
127
|
+
modelSelect: 'Translate model (default = current model)', currentModel: 'Current model (default)',
|
|
128
|
+
autoTranslateHint: 'Auto-translate is off by default (no outbound traffic); use the batch button any time. Translations are cached; originals untouched.',
|
|
129
|
+
tabTitle: 'Skill set detail', tabDesc: 'Full effective list, status partition and diagnose summary', openRight: 'Open skill set detail in right sidebar',
|
|
130
|
+
rpEffective: 'Effective list', rpSelf: 'Self-check', rpDiag: 'Diagnose summary',
|
|
131
|
+
rpFrozen: 'Set deleted (frozen: list kept as-is)', rpClick: 'Click to open SKILL.md', rpNoSession: '(right tab has no bound session)',
|
|
132
|
+
rpForeign: 'foreign', rpMissing: 'missing', rpDead: 'dead',
|
|
133
|
+
rpEmpty: '(no effective skills)', rpDiagFail: 'diagnose failed',
|
|
134
|
+
rpGlobalActiveUnbound: 'No skill set bound: global resident skills are active ({n} items, not listed one by one)', rpGlobalActiveHint: 'Global resident skills are active ({n} items, not listed one by one)',
|
|
135
|
+
importPreviewBtn: 'Preview import', importApply: 'Apply import', importConflict: 'name exists (this item is skipped)',
|
|
136
|
+
importAllPresent: 'all skills present', importMissing: 'missing locally', importNoPin: 'no source pin — cannot install',
|
|
137
|
+
importChoiceInstall: 'Install by pin', importChoicePlaceholder: 'Placeholder', importChoiceIgnore: 'Ignore',
|
|
138
|
+
importDefaultHint: 'Pick one per missing skill; unpicked = ignore (no automatic network install)', importApplied: 'Import done',
|
|
139
|
+
claimGo: 'Claim source', claimEdit: 'Re-claim', claimSourcePh: 'source owner/repo[/subpath]', claimCommitPh: 'commit (optional)',
|
|
140
|
+
claimUndo: 'Unclaim', claimHint: 'Claiming writes a manifest with the current files as baseline (later local edits are then detected and skipped on update)',
|
|
141
|
+
editMembers: 'Members', editTitle: 'Edit members', saveBtn: 'Save',
|
|
142
|
+
memberHint: 'Checked = in this set; Save writes it back. The bound set rebuilds its effective list immediately (session overrides stay). Global resident skills are auto-included in every set, so they are not offered as candidates', memberMissing: 'not in library', memberResidentTag: 'already global resident · auto-included',
|
|
143
|
+
taskConnect: 'Connecting to GitHub…', taskFetching: 'Shallow-cloning the repo and checking out files…', taskSlowRepo: 'Still fetching: large repos can take 1–2 minutes',
|
|
144
|
+
taskImport: 'Installing the selected skills by pin…', taskUpdateCheck: 'Comparing against the remote commit…', taskUpdateApply: 'Fetching the remote and writing files back…',
|
|
145
|
+
taskUninstall: 'Uninstalling and reclaiming managed entries…', taskMigrate: 'Migrating legacy entries…',
|
|
146
|
+
taskElapsed: 'Waiting {n}s', taskBusyWith: '{n} in progress — wait for it to finish', taskDismiss: 'Dismiss',
|
|
147
|
+
taskOpInstall: 'Install', taskOpImport: 'Import', taskOpUninstall: 'Uninstall', taskOpMigrate: 'Migrate', taskOpCheck: 'Update check', taskOpApply: 'Apply update',
|
|
148
|
+
taskOpCheckAll: 'Batch check updates', taskUpdateCheckAll: 'Checking updates', checkUpdFailed: '{n} source repo(s) failed to check (others checked)', retryFailedSrcs: 'Retry failed repos', // hardening T5
|
|
149
|
+
opPartial: 'Partially done: {n} installed · {m} skipped (per-skill results are in the Ops tab)',
|
|
150
|
+
// panel beautify (spec 2026-11-06): keys for the new structure (consumed by Tasks 2-4)
|
|
151
|
+
effTitle: 'Effective list', candidates: 'Candidates', notActive: 'not active',
|
|
152
|
+
ovBanner: 'Session override active · {n} removed · {m} added',
|
|
153
|
+
grayResident: 'Global resident', grayForeign: 'Foreign resident', grayProvider: 'Plugin / preset-provided', grayItems: 'items',
|
|
154
|
+
otherSec: 'Other (outside skill-set control)',
|
|
155
|
+
descPh: 'Description (optional)', emptySearch: 'no matching skills', emptyList: 'no skills are active right now', updatedAt: 'updated',
|
|
156
|
+
ariaExpand: 'expand', ariaCollapse: 'collapse', ariaPick: 'tick',
|
|
157
|
+
// settings/right-panel beautify (spec 2026-11-07): base keys, added up front (consumed by Tasks 3-6; same key set as zh)
|
|
158
|
+
rpModified: 'locally modified',
|
|
159
|
+
sAriaCheckUpd: 'check for updates', sAriaTrashBin: 'move to trash', sAriaClaim: 're-claim source', sAriaUninstall: 'uninstall', sAriaReload: 'reload',
|
|
160
|
+
sEmptyLib: 'No skills in the library yet — install from GitHub in the Install & update tab', sLoading: 'Loading skill library…', sEmptyGlobal: 'No global resident skills yet: tick candidates to make them active in every project', sEmptyDiag: 'No issues found',
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
/** 入口与 overlay 面板共享的模块级总线(overlay 是 root scope,拿不到 sessionId prop)。 */
|
|
165
|
+
const bus = {
|
|
166
|
+
open: false, sessionId: null, state: null, subs: new Set(), token: 0,
|
|
167
|
+
setOpen(v) { this.open = v; this.subs.forEach((f) => f()); },
|
|
168
|
+
setSession(id) { if (id && id !== this.sessionId) { this.sessionId = id; this.subs.forEach((f) => f()); } },
|
|
169
|
+
clearSessionIf(id) { if (id && this.sessionId === id) { this.sessionId = null; this.subs.forEach((f) => f()); } },
|
|
170
|
+
setState(s) { this.state = s; this.subs.forEach((f) => f()); },
|
|
171
|
+
// 右栏详情刷新信号(用户报告 2026-10-27):v0.25 起 betterSidebar 的原生 tab 体常驻挂载,
|
|
172
|
+
// 已打开的 tab 再点 ⇥ 既不重挂载、visible 也不翻转 → 组件自带的 visible/load 效应永不触发,
|
|
173
|
+
// 右栏停在旧集快照。onOpen/onActivate 与面板 run() 统一广播本信号;只广播当前会话防串台。
|
|
174
|
+
refresh(id) { if (id && id === this.sessionId) { this.token += 1; this.subs.forEach((f) => f()); } },
|
|
175
|
+
};
|
|
176
|
+
function useBus() {
|
|
177
|
+
const [, bump] = React.useState(0);
|
|
178
|
+
React.useEffect(() => {
|
|
179
|
+
const fn = () => bump((v) => v + 1);
|
|
180
|
+
bus.subs.add(fn);
|
|
181
|
+
return () => bus.subs.delete(fn);
|
|
182
|
+
}, []);
|
|
183
|
+
return bus;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* 慢操作登记表(设计 2026-10-29):键 = RPC 名。T = 进度条时间常数(ms);
|
|
188
|
+
* stages = [文案键, 起始 ms] 递增阶梯;label = 被挡住按钮 title 里的短名。
|
|
189
|
+
* 阶段与百分比都是按耗时的猜测——真边界要 host 把 git 改异步 spawn 并解析 --progress,本期明确排除。
|
|
190
|
+
*/
|
|
191
|
+
const SLOW_OPS = {
|
|
192
|
+
installApply: { T: 25000, label: 'taskOpInstall', stages: [['taskConnect', 0], ['taskFetching', 10000], ['taskSlowRepo', 60000]] },
|
|
193
|
+
importApply: { T: 25000, label: 'taskOpImport', stages: [['taskImport', 0], ['taskSlowRepo', 60000]] },
|
|
194
|
+
updateCheck: { T: 15000, label: 'taskOpCheck', stages: [['taskUpdateCheck', 0]] },
|
|
195
|
+
updateApply: { T: 20000, label: 'taskOpApply', stages: [['taskUpdateApply', 0]] },
|
|
196
|
+
updateCheckAll: { T: 30000, label: 'taskOpCheckAll', stages: [['taskUpdateCheckAll', 0], ['taskSlowRepo', 60000]] }, // 批量 = 每仓一拉,常态比逐技能重拉快一个量级(2026-11-17 加固 T5)
|
|
197
|
+
uninstallSkill: { T: 6000, label: 'taskOpUninstall', stages: [['taskUninstall', 0]] },
|
|
198
|
+
migrateApply: { T: 6000, label: 'taskOpMigrate', stages: [['taskMigrate', 0]] },
|
|
199
|
+
migrateUndo: { T: 6000, label: 'taskOpMigrate', stages: [['taskMigrate', 0]] },
|
|
200
|
+
migrateAgentsApply: { T: 6000, label: 'taskOpMigrate', stages: [['taskMigrate', 0]] },
|
|
201
|
+
migrateAgentsUndo: { T: 6000, label: 'taskOpMigrate', stages: [['taskMigrate', 0]] },
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* 模块级长任务态(用户 2026-10-29:安装中退出设置界面,回来必须仍见进度与最终结果)。
|
|
206
|
+
* promise 本来就与组件无关(host 侧无人取消),丢的一直是 UI 侧的状态与结果——所以状态不放 useState。
|
|
207
|
+
* 单飞:host 没有取消能力(git 走 spawnSync),并行没有真实收益,同名技能还会互踩,故全局只允许一个。
|
|
208
|
+
*/
|
|
209
|
+
const tasks = { seq: 0, running: null, last: null, subs: new Set() };
|
|
210
|
+
const emitTasks = () => tasks.subs.forEach((f) => f());
|
|
211
|
+
function useTasks() {
|
|
212
|
+
const [, bump] = React.useState(0);
|
|
213
|
+
React.useEffect(() => {
|
|
214
|
+
const fn = () => bump((v) => v + 1);
|
|
215
|
+
tasks.subs.add(fn);
|
|
216
|
+
return () => tasks.subs.delete(fn);
|
|
217
|
+
}, []);
|
|
218
|
+
return tasks;
|
|
219
|
+
}
|
|
220
|
+
/** 起一个长任务。已在飞 → 返回 false 且不改任何状态;调用方据此给按钮挂 title 说明被谁挡住。 */
|
|
221
|
+
function startLong(ctx, op, target, args, opts = {}) {
|
|
222
|
+
if (tasks.running) return false;
|
|
223
|
+
const task = {
|
|
224
|
+
id: (tasks.seq += 1), op, target, args, note: null, T: opts.T ?? SLOW_OPS[op].T,
|
|
225
|
+
startedAt: Date.now(), doneAt: null, status: 'running', result: null, error: null, warnings: [],
|
|
226
|
+
};
|
|
227
|
+
tasks.running = task; tasks.last = task; emitTasks();
|
|
228
|
+
const settle = (s) => {
|
|
229
|
+
task.status = s.ok ? 'ok' : 'err';
|
|
230
|
+
task.result = s.value; task.error = s.error; task.warnings = s.warnings; try { task.note = opts.noteOf?.(s) ?? s.note ?? null; } catch { task.note = null; } // noteOf 只是附加说明,抛错不得卡住 settle(终审 N1)
|
|
231
|
+
task.doneAt = Date.now(); tasks.running = null; emitTasks();
|
|
232
|
+
// 收尾回调拿同一份 settled:调用方只在 ok 时写回,失败不再被 run() 的 catch 降级成「操作失败」
|
|
233
|
+
opts.onDone?.({ ok: s.ok, value: s.value, error: s.error, warnings: s.warnings });
|
|
234
|
+
};
|
|
235
|
+
call(ctx, op, args).then(
|
|
236
|
+
(value) => settle({ ok: true, value, error: null, warnings: Array.isArray(value?.warnings) ? value.warnings : [] }),
|
|
237
|
+
(error) => {
|
|
238
|
+
// host 闸门说「别的长任务在跑」:置为该次被挡,并把在跑者拉回来(按钮 title/单飞随之校正)
|
|
239
|
+
const busy = /^BUSY:/.test(String(error?.message ?? ''));
|
|
240
|
+
settle({ ok: false, value: null, error, warnings: [] });
|
|
241
|
+
if (busy) syncHostTasks(ctx);
|
|
242
|
+
},
|
|
243
|
+
);
|
|
244
|
+
return true;
|
|
245
|
+
}
|
|
246
|
+
/** 清除已结束的任务。在飞不提供清除:隐藏一个还在跑的任务,等于回到本次要修的「点了没反应」。 */
|
|
247
|
+
function clearTask() { if (!tasks.running) { tasks.last = null; emitTasks(); } }
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* host 真相源 → 本地任务态(GLOSSARY「长任务」:进行中与结果不随界面关闭而消失)。
|
|
251
|
+
* host 的 opgate 是单飞与最近结果的唯一真相:界面关掉再回来,在跑者与最终结果从这里复原;
|
|
252
|
+
* 本地已有在飞任务时不覆盖(本地那份带着进度条与收尾回调)。
|
|
253
|
+
*/
|
|
254
|
+
function adoptHostTask(rec, running) {
|
|
255
|
+
if (!rec?.name) return false;
|
|
256
|
+
const t2 = {
|
|
257
|
+
id: 0, op: rec.name, target: rec.target ?? null, args: null, note: null,
|
|
258
|
+
T: SLOW_OPS[rec.name]?.T ?? 15000, startedAt: rec.startedAt, doneAt: rec.doneAt ?? null,
|
|
259
|
+
status: rec.status, result: rec.result ?? null,
|
|
260
|
+
error: rec.error ? { message: rec.error } : null, warnings: rec.warnings ?? [],
|
|
261
|
+
};
|
|
262
|
+
if (running) { if (tasks.running) return true; tasks.running = t2; tasks.last = t2; emitTasks(); return true; }
|
|
263
|
+
const sameAsLocal = tasks.last && tasks.last.doneAt && tasks.last.doneAt === rec.doneAt;
|
|
264
|
+
if (!tasks.running && !sameAsLocal) { tasks.last = t2; emitTasks(); }
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
/** 拉一次 host 长任务态;返回 host 是否仍在跑(调用方据此继续轮询)。旧 host 无此 RPC 时静默降级。 */
|
|
268
|
+
async function syncHostTasks(ctx) {
|
|
269
|
+
try {
|
|
270
|
+
const st = await call(ctx, 'longStatus');
|
|
271
|
+
if (st?.running) return adoptHostTask(st.running, true);
|
|
272
|
+
if (st?.last) adoptHostTask(st.last, false);
|
|
273
|
+
} catch { /* 无 longStatus:纯客户端任务态照常工作 */ }
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
/** 运行中永不到 100%(封顶 95):条子自己爬满就是在谎报完成(反目标 #1);只有 RPC 真返回才 100。 */
|
|
277
|
+
const taskPercent = (task, now) => task.status !== 'running' ? 100
|
|
278
|
+
: Math.min(95, Math.round(95 * (1 - Math.exp(-(now - task.startedAt) / task.T))));
|
|
279
|
+
/** 按耗时挑当前阶段文案键:只说「还在等 host」,不假装知道 fetch / 写库的真实边界。 */
|
|
280
|
+
const taskStageKey = (task, now) => {
|
|
281
|
+
const st = SLOW_OPS[task.op]?.stages ?? [];
|
|
282
|
+
const el = now - task.startedAt;
|
|
283
|
+
let key = st[0]?.[0] ?? 'taskConnect';
|
|
284
|
+
for (const [k, from] of st) if (el >= from) key = k;
|
|
285
|
+
return key;
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* 长任务条(设计 2026-10-29):设置页页签条下方与会话面板顶部各挂一条,切页签照样看得见。
|
|
290
|
+
* now 每次渲染现算 ⇒ 关掉界面再重开,耗时与阶段按 startedAt 续算、进度条不重置(Review Focus #1)。
|
|
291
|
+
* 秒表只在「有任务在飞」且组件挂载时跑,卸载即 clearInterval——不挂载就不刷。
|
|
292
|
+
*/
|
|
293
|
+
function TaskStrip({ t, tasks }) {
|
|
294
|
+
const [now, setNow] = React.useState(() => Date.now());
|
|
295
|
+
React.useEffect(() => {
|
|
296
|
+
if (!tasks.running) return undefined;
|
|
297
|
+
const tick = () => setNow(Date.now());
|
|
298
|
+
tick();
|
|
299
|
+
const id = setInterval(tick, 500);
|
|
300
|
+
return () => clearInterval(id);
|
|
301
|
+
}, [tasks, tasks.running]);
|
|
302
|
+
const task = tasks.last;
|
|
303
|
+
if (!task) return null;
|
|
304
|
+
const pct = taskPercent(task, now);
|
|
305
|
+
const secs = Math.max(0, Math.floor(((task.doneAt ?? now) - task.startedAt) / 1000));
|
|
306
|
+
return h('div', { className: 'ssm-p-task' },
|
|
307
|
+
h('div', { className: 'ssm-p-task-row' },
|
|
308
|
+
task.status === 'running' ? h('span', { className: 'ssm-spin' }, null) : null,
|
|
309
|
+
h('span', { className: 'ssm-cur' }, t(SLOW_OPS[task.op].label)),
|
|
310
|
+
task.target ? h('span', { className: 'ssm-n' }, task.target) : null,
|
|
311
|
+
// 失败不在这行重复「操作失败」:下方 error 横幅已带同一个 key 的前缀(终审 N3)
|
|
312
|
+
h('span', { className: 'ssm-n' }, task.status === 'running' ? t(taskStageKey(task, now)) : task.status === 'ok' ? t('opDone') : null),
|
|
313
|
+
h('span', { className: 'ssm-grow' }, null),
|
|
314
|
+
h('span', { className: 'ssm-n' }, t('taskElapsed').replace('{n}', `${secs}`)),
|
|
315
|
+
// 在飞不提供 ×:隐藏一个还在跑的任务,等于回到本次要修的「点了没反应」(设计末条判断)
|
|
316
|
+
tasks.running ? null : h('button', { className: 'ssm-p-icon-btn', onClick: () => clearTask(), title: t('taskDismiss') }, h(Icon, { n: 'x' }))),
|
|
317
|
+
h('div', { className: 'ssm-bar' },
|
|
318
|
+
h('div', { className: task.status === 'err' ? 'ssm-bar-fill ssm-bar-err' : task.status === 'ok' ? 'ssm-bar-fill ssm-bar-ok' : 'ssm-bar-fill', style: { width: pct + '%' } })),
|
|
319
|
+
// 明细行换 .ssm-p-banner 语态(Task 2 转交项:横幅壳下不再挂旧 .ssm-err/.ssm-warn 小底行;文案与语义零改动,⚠ 由 alert 图标承载)
|
|
320
|
+
task.status === 'err' ? h('div', { className: 'ssm-p-banner ssm-p-banner-error' }, h(Icon, { n: 'alert' }), `${t('opFailed')}: ${String(task.error?.message ?? task.error ?? '')}`) : null,
|
|
321
|
+
task.note ? h('div', { className: 'ssm-p-descwrap' }, task.note) : null,
|
|
322
|
+
// warnings 必须逐行可见:台账失配态下盘上什么都没做,理由只存在于 warnings(历史教训 2026-10-27)
|
|
323
|
+
...(task.warnings ?? []).map((w, i) => h('div', { key: 'tw' + i, className: 'ssm-p-banner ssm-p-banner-warn' }, h(Icon, { n: 'alert' }), w)));
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/** Remote 面优先(RemoteResult 归一化);任何失败退同源 fetch(同一 host 实现)。 */
|
|
327
|
+
async function call(ctx, method, args) {
|
|
328
|
+
const face = ctx.get('remote')?.['skill-set-manager'];
|
|
329
|
+
let faceErr = null;
|
|
330
|
+
if (face && typeof face[method] === 'function') {
|
|
331
|
+
let r;
|
|
332
|
+
try { r = await face[method](args ?? {}); } catch (e) { faceErr = e; }
|
|
333
|
+
if (r !== undefined) {
|
|
334
|
+
if (r && typeof r === 'object' && ('value' in r || 'error' in r)) {
|
|
335
|
+
// 业务错误:直接上报,不走 fetch 重试(副作用操作避免跑两遍)
|
|
336
|
+
if (r.error) throw new Error(typeof r.error === 'string' ? r.error : r.error?.message ?? JSON.stringify(r.error));
|
|
337
|
+
return r.value;
|
|
338
|
+
}
|
|
339
|
+
return r;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
try {
|
|
343
|
+
const res = await fetch('/api/skill-set-manager', {
|
|
344
|
+
method: 'POST', headers: { 'content-type': 'application/json' },
|
|
345
|
+
body: JSON.stringify({ method, args: args ?? {} }), credentials: 'same-origin',
|
|
346
|
+
});
|
|
347
|
+
const j = await res.json().catch(() => ({}));
|
|
348
|
+
if (!res.ok || j.error) throw new Error(j.error || `HTTP ${res.status}`);
|
|
349
|
+
return j.value;
|
|
350
|
+
} catch (e2) {
|
|
351
|
+
if (faceErr && !(ctx.get('remote')?.['skill-set-manager'])) throw faceErr;
|
|
352
|
+
throw e2;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* 搜索匹配器——唯一权威 = lib/core/search.js;client bundle 是 __ModuleLoader__.factory,
|
|
358
|
+
* require 解析不了相对路径(预裁定),故此处保留逐字镜像:verify `search-single-source` 逐字
|
|
359
|
+
* 比对两份(去空白后必须相等),改一处即红,不存在第三条口径。
|
|
360
|
+
*/
|
|
361
|
+
function normalize(s) {
|
|
362
|
+
if (typeof s !== 'string') return '';
|
|
363
|
+
return s
|
|
364
|
+
.toLowerCase()
|
|
365
|
+
.replace(/[\uFF01-\uFF5E]/g, (ch) => String.fromCharCode(ch.charCodeAt(0) - 0xFEE0)) // 全角 ASCII → 半角
|
|
366
|
+
.replace(/\u3000/g, ' '); // 全角空格
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
function searchRows(rows, query, fields = ['name', 'source', 'description', 'descriptionZh']) {
|
|
370
|
+
const list = Array.isArray(rows) ? rows : [];
|
|
371
|
+
const tokens = normalize(query).split(/\s+/).filter(Boolean);
|
|
372
|
+
if (!tokens.length) return list.slice();
|
|
373
|
+
const scored = [];
|
|
374
|
+
for (const row of list) {
|
|
375
|
+
const vals = fields.map((f) => normalize(row?.[f]));
|
|
376
|
+
if (!tokens.every((t) => vals.some((v) => v.includes(t)))) continue; // token AND、字段 OR
|
|
377
|
+
const name = vals[0];
|
|
378
|
+
const rank = tokens.every((t) => name.startsWith(t)) ? 0 : tokens.every((t) => name.includes(t)) ? 1 : 2;
|
|
379
|
+
scored.push({ row, rank });
|
|
380
|
+
}
|
|
381
|
+
scored.sort((a, b) => a.rank - b.rank || String(a.row?.name ?? '').localeCompare(String(b.row?.name ?? '')));
|
|
382
|
+
return scored.map((s) => s.row);
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* 生效行的唯一选择器(架构评审候选 6):面板左列与右栏此前各推导一遍
|
|
386
|
+
* 「生效行集合 + 缺失/死链/外来三集 + 徽章列表」,口径已漂移(右栏多常驻徽章、顺序不同)。
|
|
387
|
+
* 行渲染仍各自负责(面板要复选框、右栏要打开文件),这里只收状态推导。
|
|
388
|
+
*/
|
|
389
|
+
function selectEffective(st) {
|
|
390
|
+
const sc = st?.selfCheck ?? {};
|
|
391
|
+
const resident = new Set(st?.resident ?? []);
|
|
392
|
+
const managed = new Set(Object.keys(st?.managed ?? {}));
|
|
393
|
+
const broken = new Set(sc.brokenLinks ?? []);
|
|
394
|
+
const missing = new Set(st?.effective?.missing ?? []);
|
|
395
|
+
const foreign = new Set(sc.foreign ?? []);
|
|
396
|
+
const names = [...new Set([...(st?.effective?.names ?? []).filter((n) => !resident.has(n)), ...managed, ...foreign])].sort();
|
|
397
|
+
return { sc, resident, managed, broken, missing, foreign, names };
|
|
398
|
+
}
|
|
399
|
+
/** 生效行徽章(视觉优先级):受管 → 全局常驻 → 外来 → 死链 → 缺失 → 本地改动。 */
|
|
400
|
+
function effectiveBadges(t, name, rows, { localModified = false } = {}) {
|
|
401
|
+
const badges = [];
|
|
402
|
+
if (rows.managed.has(name)) badges.push({ kind: 'brand', text: t('managedTag') });
|
|
403
|
+
if (rows.resident.has(name)) badges.push({ kind: 'muted', text: t('grayResident') });
|
|
404
|
+
if (rows.foreign.has(name)) badges.push({ kind: 'muted', text: t('rpForeign') });
|
|
405
|
+
if (rows.broken.has(name)) badges.push({ kind: 'error', text: t('rpDead') });
|
|
406
|
+
if (rows.missing.has(name)) badges.push({ kind: 'error', text: t('rpMissing') });
|
|
407
|
+
if (localModified) badges.push({ kind: 'warn', text: t('modifiedTag') });
|
|
408
|
+
return badges;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* 共享行壳(spec 2026-11-07 §6.2):设置页/右栏共用的行卡骨架(Task 6 起弹框 SkillRow 也收口到这里)。
|
|
413
|
+
* 槽位:leading(复选框/色点)+ 名称 + 徽章组(PBadge 数组)+ 第二行 desc + 第三行 sub + 尾部动作条 actions;
|
|
414
|
+
* gray=灰态(.ssm-p-gray 语汇)、removed=删除线、onClick=整行点击(右栏开 SKILL.md、composer 勾选行);
|
|
415
|
+
* 无 leading 的行加 tabIndex + role=button + onKeyDown(Enter/Space 触发 onClick)键盘可达(AC#13,focus 环见 .ssm-p-rowcard-click);
|
|
416
|
+
* 有 leading(行首已是可聚焦控件——composer 生效清单的裸复选框)则不挂 role/tabIndex/onKeyDown:复选框作唯一 tab 停靠点,
|
|
417
|
+
* 避免每行两个停靠点、且读屏器把 button 当叶子节点吞掉内层勾选态(终审 Important 1);行 onClick 鼠标路径与 cursor/clickTitle 照旧。
|
|
418
|
+
* 行形态同款 .ssm-p-row:hover 底色 8%、:focus-visible brand 环、hover/focus-within 显形动作条;
|
|
419
|
+
* 常驻动作(confirm 态)不在「.ssm-p-row 直接子级 .ssm-p-icon-btn」显形选择器覆盖范围内,天然常显。
|
|
420
|
+
* desc/sub 传 React 元素时原样透传(调用方可自带 .ssm-p-desc 与 title),纯内容则包 .ssm-p-desc;空串同样跳过(空行不渲染空 div)。
|
|
421
|
+
* 顶层段声明(client-scope):Panel/SettingsSection/RightPanel 三段都要消费,不能塞进某段内部。
|
|
422
|
+
* t 预留:Task 3/5/6 的 aria/文案收口再消费。
|
|
423
|
+
* title=非点击行的 hover 提示(库行 = 来源 @commit(7),spec 2026-11-07 §6.5);onClick 行 clickTitle 优先、缺省回落 title。
|
|
424
|
+
*/
|
|
425
|
+
function RowShell({ t, name, badges, desc, sub, actions, gray, onClick, clickTitle, leading, removed, title }) {
|
|
426
|
+
const line = (v) => v == null || v === '' ? null
|
|
427
|
+
: typeof v === 'object' && v && v.$$typeof ? v : h('div', { className: 'ssm-p-desc' }, v);
|
|
428
|
+
return h('div', {
|
|
429
|
+
className: 'ssm-p-rowcard' + (gray ? ' ssm-p-gray' : '') + (onClick ? ' ssm-p-rowcard-click' : ''),
|
|
430
|
+
// Enter/Space 触发整行点击(Task 6.2 a11y:修右栏/设置页行卡 Enter 不触发的遗留);Space 阻止页面滚动;
|
|
431
|
+
// 只认行自身的焦点(target!==currentTarget 即放行),行内控件保持原生键盘语义不被劫持。
|
|
432
|
+
// leading 有值 = 行首已是可聚焦控件(composer 复选框):不再挂 role=button/tabIndex/onKeyDown,复选框作唯一 tab 停靠点
|
|
433
|
+
// (终审 Important 1:旧版一行双停靠点 + AT 扁平化);onClick(鼠标)与 title/clickTitle 照旧,无 leading 的行键盘行为不变。
|
|
434
|
+
...(onClick ? {
|
|
435
|
+
...(leading == null ? {
|
|
436
|
+
tabIndex: 0, role: 'button',
|
|
437
|
+
onKeyDown: (e) => {
|
|
438
|
+
if (e.target !== e.currentTarget) return;
|
|
439
|
+
if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); onClick(e); }
|
|
440
|
+
},
|
|
441
|
+
} : {}),
|
|
442
|
+
onClick, title: clickTitle ?? title,
|
|
443
|
+
} : (title ? { title } : {})),
|
|
444
|
+
},
|
|
445
|
+
h('div', { className: 'ssm-p-row' },
|
|
446
|
+
leading ?? null,
|
|
447
|
+
h('span', { className: 'ssm-p-name' + (removed ? ' ssm-p-strike' : '') }, name),
|
|
448
|
+
...(badges ?? []).map((b) => h(PBadge, { key: b.text, kind: b.kind, text: b.text })),
|
|
449
|
+
h('span', { className: 'ssm-grow' }, null),
|
|
450
|
+
...(actions ?? [])),
|
|
451
|
+
line(desc), line(sub));
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
function Panel({ ctx, t, sessionId, onClose, bs, seed }) {
|
|
455
|
+
const tasks = useTasks(); // 与设置页同一份模块级任务态:面板关掉后,导入的进行中与结果仍在这份状态里
|
|
456
|
+
// 秒开:chip 挂载即预拉过同一会话的 state(ComposerChip),那份快照就是首屏数据源,
|
|
457
|
+
// 不必再等一轮 RPC——旧口径每次开面板都从 null 起,骨架屏必然等满一个来回(host 侧当时实测 ~1.5s)。
|
|
458
|
+
// seed 由 OverlayHost 比对过 sessionId 才传入,跨会话快照不得串台。
|
|
459
|
+
const [state, setState] = React.useState(seed ?? null);
|
|
460
|
+
const [error, setError] = React.useState(null);
|
|
461
|
+
const [busy, setBusy] = React.useState(false);
|
|
462
|
+
const [confirm, setConfirm] = React.useState(null); // {kind:'switch'|'del', slug}
|
|
463
|
+
const [draft, setDraft] = React.useState('');
|
|
464
|
+
const [saveOpen, setSaveOpen] = React.useState(false); // 另存为收进操作条(Task 2),展开成一行输入
|
|
465
|
+
const saveNameRef = React.useRef(null); // 另存为名称输入:生效清单卡横幅的 CTA 点击后要展开并聚焦到这里(用户 2026-11-17)
|
|
466
|
+
const [saveDesc, setSaveDesc] = React.useState('');
|
|
467
|
+
const [descDraft, setDescDraft] = React.useState(''); // 改名行的描述输入(spec §6.6)
|
|
468
|
+
const [openZones, setOpenZones] = React.useState({}); // 折叠灰区展开态(spec §6.3:常驻/外来常驻/插件提供)
|
|
469
|
+
const [renaming, setRenaming] = React.useState(null); // slug | null(面板内改名,Electron 无 window.prompt)
|
|
470
|
+
const [renameDraft, setRenameDraft] = React.useState('');
|
|
471
|
+
const [io, setIo] = React.useState(null); // {mode:'export'|'import', text, copied?}
|
|
472
|
+
const [confirmUnbind, setConfirmUnbind] = React.useState(false);
|
|
473
|
+
const [edit, setEdit] = React.useState(null); // {slug, picked:{name:true}}——编辑成员表单(§5#2)
|
|
474
|
+
const [q, setQ] = React.useState(''); // P3 搜索框(设计 §6.3):非空 → 结果列表替换三区
|
|
475
|
+
const [mq, setMq] = React.useState(''); // P3 成员编辑表单过滤(§6.2;勾选态 picked 按名字存,过滤不丢)
|
|
476
|
+
const locked = !!tasks.running || busy; // 长任务在飞时 host 事件循环也被 spawnSync 占住,此处不再另起 RPC
|
|
477
|
+
const busyTitle = tasks.running ? t('taskBusyWith').replace('{n}', t(SLOW_OPS[tasks.running.op].label)) : undefined;
|
|
478
|
+
// 导入结果改从任务态读(原 io.applied 是组件 state,一关面板就没了)
|
|
479
|
+
const importDone = tasks.last?.op === 'importApply' && tasks.last.status === 'ok' ? tasks.last.result : null;
|
|
480
|
+
const reload = React.useCallback(async () => {
|
|
481
|
+
if (!sessionId) return;
|
|
482
|
+
try { const v = await call(ctx, 'panelSnapshot', { sessionId }); setState(v); bus.setState(v); } catch (e) { setError(`${t('loadFailed')}: ${e?.message ?? e}`); }
|
|
483
|
+
}, [ctx, sessionId]);
|
|
484
|
+
React.useEffect(() => { reload(); }, [reload]);
|
|
485
|
+
// host 闸门是单飞真相:打开面板补拉一次;host 仍在跑则每 2s 跟一次,跑完自动收尾
|
|
486
|
+
React.useEffect(() => {
|
|
487
|
+
let alive = true; let timer = null;
|
|
488
|
+
const tick = async () => { const live = await syncHostTasks(ctx); if (alive && live) timer = setTimeout(tick, 2000); };
|
|
489
|
+
tick();
|
|
490
|
+
return () => { alive = false; clearTimeout(timer); };
|
|
491
|
+
}, [ctx]);
|
|
492
|
+
React.useEffect(() => {
|
|
493
|
+
const onKey = (e) => { if (e.key === 'Escape') onClose(); };
|
|
494
|
+
window.addEventListener('keydown', onKey);
|
|
495
|
+
return () => window.removeEventListener('keydown', onKey);
|
|
496
|
+
}, [onClose]);
|
|
497
|
+
const run = async (fn) => {
|
|
498
|
+
setBusy(true); setError(null);
|
|
499
|
+
try {
|
|
500
|
+
const r = await fn();
|
|
501
|
+
// 返回的 warnings 必须可见:台账失配态下「重新生成」盘上什么都不做,理由只存在于 warnings,
|
|
502
|
+
// 丢弃就等于「点了没反应」(活体复盘 2026-10-27,另一作用域 line run(key,fn) 早已这么做)。
|
|
503
|
+
const w = r && Array.isArray(r.warnings) && r.warnings.length ? r.warnings : null;
|
|
504
|
+
if (w) setError(`${t('opDone')} ⚠ ${w.join('; ')}`);
|
|
505
|
+
} catch (e) { setError(`${t('opFailed')}: ${e?.message ?? e}`); }
|
|
506
|
+
finally { setBusy(false); setConfirm(null); await reload(); bus.refresh(sessionId); } // 面板切集/重生成后右栏详情同步刷新(用户 2026-10-27)
|
|
507
|
+
};
|
|
508
|
+
if (!state && !error) return h('div', { className: 'ssm-p-panel', role: 'dialog', 'aria-label': t('panel'), onClick: (e) => e.stopPropagation() },
|
|
509
|
+
h('div', { className: 'ssm-p-head' },
|
|
510
|
+
h(Dot, { st: null }), h('span', { className: 'ssm-p-cur' }, '…'), h('span', { className: 'ssm-grow' }, null),
|
|
511
|
+
h('button', { className: 'ssm-p-icon-btn', onClick: onClose, 'aria-label': t('close') }, h(Icon, { n: 'x' }))),
|
|
512
|
+
h('div', { style: { display: 'flex', flexDirection: 'column', gap: 8 } },
|
|
513
|
+
h('div', { className: 'ssm-p-skel' }), h('div', { className: 'ssm-p-skel' }), h('div', { className: 'ssm-p-skel' })));
|
|
514
|
+
const st = state ?? {};
|
|
515
|
+
// 「已在项目」口径 = JSON 生效清单 ∪ 托管台账:临时覆盖加的技能只进台账、不进 state.effective
|
|
516
|
+
// 的 JSON 口径,加完必须即从候选区撤回(受管区即显示为选中勾选),否则复选框永远显未勾(用户报)。
|
|
517
|
+
const eff = new Set([...(st.effective?.names ?? []), ...Object.keys(st.managed ?? {})]);
|
|
518
|
+
const resident = new Set(st.resident ?? []);
|
|
519
|
+
const managed = Object.keys(st.managed ?? {}); // 一套勾选(设计 2026-10-28):已绑定=集提供的条目;未绑定=本会话临时生效的条目
|
|
520
|
+
// P3 搜索结果(设计 §6.3/§6.4):语料 = 库行 ∪ 常驻名单 ∪ 盘上外来常驻(灰行判定 = 名单 ∪ 实扫)
|
|
521
|
+
const foreignRes = new Set(st.residentForeign ?? []);
|
|
522
|
+
const bound = !!st.binding?.setSlug;
|
|
523
|
+
const qq = q.trim();
|
|
524
|
+
const corpus = [...(st.library ?? [])];
|
|
525
|
+
for (const n of new Set([...(st.resident ?? []), ...foreignRes])) if (!corpus.some((l) => l.name === n)) corpus.push({ name: n, source: 'resident', description: null, descriptionZh: null });
|
|
526
|
+
// 插件/Preset 提供也入搜索语料(灰行只读):搜 archify / office-docx 不再「查无此技能」
|
|
527
|
+
const providerSet = new Set((st.unmanaged ?? []).map((e) => e.name));
|
|
528
|
+
for (const e of st.unmanaged ?? []) if (!corpus.some((l) => l.name === e.name)) corpus.push({ name: e.name, source: e.provider, provider: true, description: null, descriptionZh: null });
|
|
529
|
+
const hits = qq ? searchRows(corpus, qq) : [];
|
|
530
|
+
const doSwitch = (slug) => {
|
|
531
|
+
if (st.rootDrift) { setConfirm({ kind: 'switch', slug }); return; } // 仅根漂移需确认(§6.5)
|
|
532
|
+
run(() => call(ctx, 'switchSet', { sessionId, slug }));
|
|
533
|
+
};
|
|
534
|
+
// —— 生效清单卡数据面(Task 3,spec §6.4):行集合与徽章走唯一选择器(selectEffective/effectiveBadges)——
|
|
535
|
+
const rows = selectEffective(st);
|
|
536
|
+
const { sc } = rows;
|
|
537
|
+
const foreignSet = rows.foreign;
|
|
538
|
+
const ov = st.sessionOverride ?? {};
|
|
539
|
+
const srcOf = (n) => (st.library ?? []).find((l) => l.name === n);
|
|
540
|
+
const effNames = rows.names;
|
|
541
|
+
const rowModel = (n) => {
|
|
542
|
+
const l = srcOf(n) ?? { name: n, source: 'unknown', description: null, descriptionZh: null };
|
|
543
|
+
const badges = effectiveBadges(t, n, rows, { localModified: !!l.localModified });
|
|
544
|
+
const title = l.source && l.source !== 'unknown' ? `${l.name} · ${l.source}${l.commit ? '@' + String(l.commit).slice(0, 7) : ''}` : (l.descriptionZh ?? l.name);
|
|
545
|
+
return { l, badges, title };
|
|
546
|
+
};
|
|
547
|
+
// 同款列表行(Task 4 成员抽屉复用):on=null → 只读无复选框;ro → 灰区只读行;removed → 删除线
|
|
548
|
+
// Task 6.1 收口(spec 2026-11-07 §6.2):骨架换成共享 RowShell——同一批 .ssm-p-* 原子件,DOM 由 rowwrap 换行卡;
|
|
549
|
+
// 勾选语义照旧:原 label 包整行(点名字=勾选)现由行 onClick 承接——点复选框本身走 input onChange,
|
|
550
|
+
// 点击目标命中 input 即跳过,绝不双跑 RPC;busy 时不挂 onClick=整行不可点,同「被禁 input 的 label 不激活」口径。
|
|
551
|
+
const SkillRow = ({ key, l, on, ro, removed, onChange, badges, title }) => {
|
|
552
|
+
const desc = l.descriptionZh
|
|
553
|
+
? h('div', { className: 'ssm-p-desc', title: l.description ?? undefined }, l.descriptionZh)
|
|
554
|
+
: l.description
|
|
555
|
+
? h('div', { className: 'ssm-p-desc', title: l.description }, l.description, ' ', h(PBadge, { kind: 'muted', text: t('pendingTag') }))
|
|
556
|
+
: null;
|
|
557
|
+
return h(RowShell, {
|
|
558
|
+
key, t, name: l.name, badges, desc, gray: !!ro, removed,
|
|
559
|
+
title: title ?? l.descriptionZh ?? undefined,
|
|
560
|
+
leading: on == null ? null : h('input', { type: 'checkbox', checked: on === true, disabled: busy, 'aria-label': l.name, onChange: () => onChange?.() }),
|
|
561
|
+
...(on != null && !busy ? { onClick: (e) => { if (e.target?.closest?.('input')) return; onChange?.(); } } : {}),
|
|
562
|
+
});
|
|
563
|
+
};
|
|
564
|
+
// 折叠灰区一行(3.3):默认收起「图标 标签 · N 项 ▸」,展开 = 只读同款行 + 既有 hint 文案
|
|
565
|
+
const ZoneRow = (zone, label, icon, names, hint) => names.length
|
|
566
|
+
? h(React.Fragment, { key: 'zone-' + zone },
|
|
567
|
+
h('button', { className: 'ssm-p-collapse', disabled: busy, 'aria-expanded': openZones[zone] ? 'true' : 'false', 'aria-label': openZones[zone] ? t('ariaCollapse') : t('ariaExpand'), onClick: () => setOpenZones({ ...openZones, [zone]: !openZones[zone] }) },
|
|
568
|
+
h(Icon, { n: icon, s: 13 }), label, ' · ', String(names.length), ' ', t('grayItems'),
|
|
569
|
+
h('span', { className: 'ssm-grow' }, null), h(Icon, { n: 'chevron', s: 12 })),
|
|
570
|
+
openZones[zone]
|
|
571
|
+
? h(React.Fragment, null,
|
|
572
|
+
...names.map((n) => SkillRow({ key: 'z-' + n, l: srcOf(n) ?? { name: n, source: '', description: null, descriptionZh: null }, on: null, ro: true, badges: [], title: hint })),
|
|
573
|
+
h('div', { className: 'ssm-hint' }, hint))
|
|
574
|
+
: null)
|
|
575
|
+
: null;
|
|
576
|
+
return h('div', { className: 'ssm-p-panel', role: 'dialog', 'aria-label': t('panel'), onClick: (e) => e.stopPropagation() },
|
|
577
|
+
h('div', { className: 'ssm-p-head' },
|
|
578
|
+
h(Dot, { st: state }),
|
|
579
|
+
st.binding?.setSlug ? h('span', { className: 'ssm-p-cur' }, st.set?.name ?? st.binding.setSlug) : h('span', { className: 'ssm-p-cur' }, t('noBinding')),
|
|
580
|
+
st.set?.skills?.length ? h(PBadge, { kind: 'muted', text: `${st.set.skills.length} ${t('skillsCount')}` }) : null,
|
|
581
|
+
h('span', { className: 'ssm-grow' }, null),
|
|
582
|
+
bs || ctx.get('betterSidebar') ? h('button', { className: 'ssm-p-icon-btn', title: t('openRight'), 'aria-label': t('openRight'), onClick: () => (bs ?? ctx.get('betterSidebar'))?.openTab({ type: 'skill-set-manager:detail', title: t('tabTitle') }, { sessionId }) }, h(Icon, { n: 'external' })) : null,
|
|
583
|
+
h('button', { className: 'ssm-p-icon-btn', onClick: onClose, 'aria-label': t('close') }, h(Icon, { n: 'x' }))),
|
|
584
|
+
h(TaskStrip, { t, tasks }), // 面板顶部一条:导入块(io)被关掉后,进度与结果仍在这行上(设计 §5)
|
|
585
|
+
st.projectRoot ? h('div', { className: 'ssm-p-rootline' }, h('span', { title: st.projectRoot }, t('projectRoot'), ':', st.projectRoot), st.rootDrift ? h(PBadge, { kind: 'warn', text: t('rootDrift') }) : null) : null,
|
|
586
|
+
st.presetWarn ? h('div', { className: 'ssm-p-banner ssm-p-banner-warn' }, h(Icon, { n: 'alert' }), st.presetWarn) : null,
|
|
587
|
+
sc.ok === false && !sc.unbound
|
|
588
|
+
? h('div', { className: `ssm-p-banner ${sc.frozen ? 'ssm-p-banner-warn' : 'ssm-p-banner-error'}` }, h(Icon, { n: 'alert' }), sc.detail, ' ',
|
|
589
|
+
sc.frozen ? null : h('button', { disabled: busy, onClick: () => run(() => call(ctx, 'bind', { sessionId, slug: st.binding?.setSlug })) }, t('regen')),
|
|
590
|
+
// 接管(认领):台账与盘上失配时 regen 只会空转(planEffective 一律判外来而跳过),
|
|
591
|
+
// 唯一恢复通道是把自家链接补回台账——只在确实有外来条目时出现(活体实锤 2026-10-27)
|
|
592
|
+
(sc.foreign ?? []).length && !sc.frozen
|
|
593
|
+
? h('button', { disabled: busy, title: t('claimForeignHint'), onClick: () => run(() => call(ctx, 'claimForeign', { sessionId })) }, t('claimForeign'))
|
|
594
|
+
: null,
|
|
595
|
+
// 幽灵名快捷修复(用户报告 2026-10-26:speckit-* 实体被外部删除,regen 无源可重建,唯一出路是从集合剔除)
|
|
596
|
+
st.set && (st.effective?.missing ?? []).length
|
|
597
|
+
? h('button', { disabled: busy, className: 'ssm-danger', onClick: () => run(async () => {
|
|
598
|
+
const miss = new Set(st.effective.missing);
|
|
599
|
+
await call(ctx, 'saveSet', { set: { ...st.set, skills: (st.set.skills ?? []).filter((n) => !miss.has(n)) } }); // 刷新由 run() 的 finally reload() 负责;Panel 作用域里没有 load(误写会 ReferenceError)
|
|
600
|
+
}) }, t('pruneMissing'))
|
|
601
|
+
: null)
|
|
602
|
+
: null,
|
|
603
|
+
error ? h('div', { className: 'ssm-p-banner ssm-p-banner-error' }, h(Icon, { n: 'alert' }), error) : null,
|
|
604
|
+
confirm?.kind === 'switch'
|
|
605
|
+
? h('div', { className: 'ssm-confirm' }, t('confirmSwitch'), ' ', st.projectRoot, ' ',
|
|
606
|
+
h('button', { autoFocus: true, disabled: busy, onClick: () => run(() => call(ctx, 'switchSet', { sessionId, slug: confirm.slug })) }, t('switchTo')),
|
|
607
|
+
h('button', { onClick: () => setConfirm(null) }, '×'))
|
|
608
|
+
: null,
|
|
609
|
+
confirm?.kind === 'del'
|
|
610
|
+
? h('div', { className: 'ssm-confirm' }, t('confirmDel'), ' ', confirm.slug, ' ',
|
|
611
|
+
h('button', { autoFocus: true, disabled: busy, className: 'ssm-danger', onClick: () => run(() => call(ctx, 'deleteSet', { slug: confirm.slug })) }, t('del')),
|
|
612
|
+
h('button', { onClick: () => setConfirm(null) }, '×'))
|
|
613
|
+
: null,
|
|
614
|
+
h('div', { className: 'ssm-p-card' },
|
|
615
|
+
h('div', { className: 'ssm-p-card-title' }, t('sets'), (st.sets ?? []).length ? h(PBadge, { kind: 'muted', text: String((st.sets ?? []).length) }) : null),
|
|
616
|
+
(st.sets ?? []).length === 0 ? h('div', { className: 'ssm-p-desc' }, t('empty')) : null,
|
|
617
|
+
...(st.sets ?? []).map((s) => h('div', { key: s.slug, className: 'ssm-p-setrow' + (st.binding?.setSlug === s.slug ? ' ssm-p-setrow-cur' : '') },
|
|
618
|
+
h('div', { className: 'ssm-p-row' },
|
|
619
|
+
h('button', { className: 'ssm-p-pick', disabled: busy || st.binding?.setSlug === s.slug, title: st.binding?.setSlug === s.slug ? undefined : t('switchTo'), onClick: () => doSwitch(s.slug) },
|
|
620
|
+
h('span', { className: 'ssm-p-setname' }, s.name),
|
|
621
|
+
st.binding?.setSlug === s.slug ? h(PBadge, { kind: 'brand', text: t('current') }) : null,
|
|
622
|
+
h(PBadge, { kind: 'muted', text: `${(s.skills ?? []).length} ${t('skillsCount')}` }),
|
|
623
|
+
s.updatedAt ? h('span', { className: 'ssm-p-desc' }, `${t('updatedAt')} ${String(s.updatedAt).slice(0, 10)}`) : null),
|
|
624
|
+
h('span', { className: 'ssm-grow' }, null),
|
|
625
|
+
h('button', { className: 'ssm-p-icon-btn', disabled: busy, title: t('editMembers'), 'aria-label': t('editMembers'), onClick: () => setEdit({ slug: s.slug, picked: Object.fromEntries((s.skills ?? []).map((n) => [n, true])), desc: s.description ?? '' }) }, h(Icon, { n: 'users' })),
|
|
626
|
+
h('button', { className: 'ssm-p-icon-btn', disabled: busy, title: t('copy'), 'aria-label': t('copy'), onClick: () => run(() => call(ctx, 'copySet', { slug: s.slug })) }, h(Icon, { n: 'copy' })),
|
|
627
|
+
h('button', { className: 'ssm-p-icon-btn', disabled: busy, title: t('rename'), 'aria-label': t('rename'), onClick: () => { setRenaming(s.slug); setRenameDraft(s.name); setDescDraft(s.description ?? ''); } }, h(Icon, { n: 'pencil' })),
|
|
628
|
+
h('button', { className: 'ssm-p-icon-btn ssm-p-icon-danger', disabled: busy, title: t('del'), 'aria-label': t('del'), onClick: () => setConfirm({ kind: 'del', slug: s.slug }) }, h(Icon, { n: 'trash' }))),
|
|
629
|
+
s.description ? h('div', { className: 'ssm-p-desc' }, s.description) : null,
|
|
630
|
+
renaming === s.slug
|
|
631
|
+
? h('div', { className: 'ssm-p-row' },
|
|
632
|
+
h('input', { className: 'ssm-input', autoFocus: true, value: renameDraft, disabled: busy, 'aria-label': t('rename'), onChange: (e) => setRenameDraft(e.target.value) }),
|
|
633
|
+
h('input', { className: 'ssm-input', placeholder: t('descPh'), value: descDraft, disabled: busy, 'aria-label': t('descPh'), onChange: (e) => setDescDraft(e.target.value) }),
|
|
634
|
+
h('button', { disabled: busy || !renameDraft.trim(), onClick: () => run(async () => { const name = renameDraft.trim(); if (name !== s.name) await call(ctx, 'renameSet', { slug: s.slug, name }); if (descDraft !== (s.description ?? '')) await call(ctx, 'saveSet', { set: { slug: s.slug, name, description: descDraft, skills: s.skills ?? [] } }); setRenaming(null); }) }, '✓'),
|
|
635
|
+
h('button', { disabled: busy, onClick: () => setRenaming(null) }, '×'))
|
|
636
|
+
: null,
|
|
637
|
+
// 编辑成员抽屉(Task 4,spec §6.5):chips → 同款 SkillRow;顶部描述输入(§6.6 入口③);saveSet 写回语义不变
|
|
638
|
+
// ——该路径仍由 verify case edit-members 固化(摘旧加新、台账无残留、自检绿)。
|
|
639
|
+
edit?.slug === s.slug
|
|
640
|
+
? h('div', { className: 'ssm-p-card' },
|
|
641
|
+
h('div', { className: 'ssm-p-card-title' }, t('editTitle'), ' ', s.name,
|
|
642
|
+
h('span', { className: 'ssm-grow' }, null),
|
|
643
|
+
h(Icon, { n: 'search', s: 12 }),
|
|
644
|
+
h('input', { className: 'ssm-p-search', placeholder: t('searchPh'), value: mq, disabled: busy, 'aria-label': t('searchPh'), onChange: (e) => setMq(e.target.value) }),
|
|
645
|
+
mq ? h('button', { className: 'ssm-p-icon-btn', disabled: busy, 'aria-label': t('none'), onClick: () => setMq('') }, h(Icon, { n: 'x', s: 12 })) : null),
|
|
646
|
+
h('div', { className: 'ssm-p-row' },
|
|
647
|
+
h('input', { className: 'ssm-input', placeholder: t('descPh'), value: edit.desc ?? '', disabled: busy, 'aria-label': t('descPh'), onChange: (e) => setEdit({ ...edit, desc: e.target.value }) })),
|
|
648
|
+
...searchRows(
|
|
649
|
+
// 常驻 = 所有集自动包含(§17#3)→ 不进成员候选(用户报告 2026-10-26,与另存为 excludeResident 同口径);
|
|
650
|
+
// 已存进本集的常驻名仍列出并标注,避免保存时被静默剔除
|
|
651
|
+
[...new Set([...(st.library ?? []).map((l) => l.name), ...(s.skills ?? [])])]
|
|
652
|
+
.filter((n) => !(resident.has(n) || foreignRes.has(n)) || (s.skills ?? []).includes(n))
|
|
653
|
+
.sort()
|
|
654
|
+
.map((n) => {
|
|
655
|
+
const l = (st.library ?? []).find((x) => x.name === n); // 语料带三字段 → 中文用途也能搜(§6.2)
|
|
656
|
+
return { name: n, source: l?.source ?? '', description: l?.description ?? null, descriptionZh: l?.descriptionZh ?? null };
|
|
657
|
+
}),
|
|
658
|
+
mq,
|
|
659
|
+
).map((row) => SkillRow({ key: row.name, l: row, on: !!edit.picked[row.name],
|
|
660
|
+
badges: [
|
|
661
|
+
...((st.library ?? []).some((l) => l.name === row.name) ? [] : [{ kind: 'warn', text: t('memberMissing') }]),
|
|
662
|
+
...((resident.has(row.name) || foreignRes.has(row.name)) ? [{ kind: 'muted', text: t('memberResidentTag') }] : []),
|
|
663
|
+
],
|
|
664
|
+
onChange: () => setEdit({ ...edit, picked: { ...edit.picked, [row.name]: !edit.picked[row.name] } }) })),
|
|
665
|
+
h('div', { className: 'ssm-hint' }, t('memberHint')),
|
|
666
|
+
h('div', { className: 'ssm-row' },
|
|
667
|
+
h('button', { disabled: busy, onClick: () => run(async () => {
|
|
668
|
+
await call(ctx, 'saveSet', { set: { slug: s.slug, name: s.name, description: edit.desc ?? '', skills: Object.keys(edit.picked).filter((n) => edit.picked[n]) } }); // 描述随保存一并写回(§6.6 入口③,host 透传)
|
|
669
|
+
if (st.binding?.setSlug === s.slug) await call(ctx, 'bind', { sessionId, slug: s.slug }); // 立即收敛生效清单,不留「改了但没生效」窗口
|
|
670
|
+
setEdit(null);
|
|
671
|
+
}) }, t('saveBtn')),
|
|
672
|
+
h('button', { disabled: busy, onClick: () => setEdit(null) }, '×')))
|
|
673
|
+
: null)),
|
|
674
|
+
h('div', { className: 'ssm-p-actions' },
|
|
675
|
+
saveOpen
|
|
676
|
+
? h('div', { className: 'ssm-p-row', style: { width: '100%' } },
|
|
677
|
+
h('input', { className: 'ssm-input', ref: saveNameRef, autoFocus: true, placeholder: t('newName'), value: draft, disabled: busy, 'aria-label': t('newName'), onChange: (e) => setDraft(e.target.value) }),
|
|
678
|
+
h('input', { className: 'ssm-input', placeholder: t('descPh'), value: saveDesc, disabled: busy, 'aria-label': t('descPh'), onChange: (e) => setSaveDesc(e.target.value) }),
|
|
679
|
+
h('button', { disabled: busy || !draft.trim() || (!bound && !managed.length), onClick: () => run(async () => {
|
|
680
|
+
const name = draft.trim();
|
|
681
|
+
// 未绑定走当前临时清单(候选已剔常驻);已绑定隐式 = 生效清单,host 端剔常驻(save-as-resident CASE)
|
|
682
|
+
const s = await call(ctx, 'saveAsFromEffective', { sessionId, name, ...(bound ? {} : { names: [...managed] }) });
|
|
683
|
+
if (saveDesc.trim() && s?.slug) await call(ctx, 'saveSet', { set: { slug: s.slug, name, description: saveDesc.trim(), skills: s.skills ?? [] } }); // 描述补写入(spec §6.6,host 透传)
|
|
684
|
+
if (!bound && s?.slug) await call(ctx, 'bind', { sessionId, slug: s.slug }); // 存集即生效(dropOverrideOnBind)
|
|
685
|
+
setDraft(''); setSaveDesc(''); setSaveOpen(false);
|
|
686
|
+
}) }, '✓'),
|
|
687
|
+
h('button', { disabled: busy, onClick: () => { setSaveOpen(false); setDraft(''); setSaveDesc(''); } }, '×'))
|
|
688
|
+
: null,
|
|
689
|
+
h('button', { className: 'ssm-p-text-btn', disabled: busy || (!bound && !managed.length), title: !bound && !managed.length ? t('draftHint') : t('saveAs'), 'aria-label': t('saveAs'), onClick: () => setSaveOpen(true) }, h(Icon, { n: 'save', s: 12 }), t('saveAs')),
|
|
690
|
+
h('button', { className: 'ssm-p-icon-btn', disabled: busy, title: t('importJson'), 'aria-label': t('importJson'), onClick: () => setIo({ mode: 'import', text: '{"sets":[]}', copied: false }) }, h(Icon, { n: 'download' })),
|
|
691
|
+
h('button', { className: 'ssm-p-icon-btn', disabled: busy, title: t('exportJson'), 'aria-label': t('exportJson'), onClick: async () => { try { const arr = await Promise.all((st.sets ?? []).map((x) => call(ctx, 'exportSet', { slug: x.slug }))); setIo({ mode: 'export', text: JSON.stringify({ sets: arr.flatMap((j) => j.sets ?? []) }, null, 2), copied: false }); } catch (e) { setError(`${t('opFailed')}: ${e?.message ?? e}`); } } }, h(Icon, { n: 'upload' })),
|
|
692
|
+
st.undoAvailable ? h('button', { className: 'ssm-p-icon-btn', disabled: busy, title: t('undo'), 'aria-label': t('undo'), onClick: () => run(() => call(ctx, 'undoSwitch', { sessionId })) }, h(Icon, { n: 'undo' })) : null,
|
|
693
|
+
h('span', { className: 'ssm-grow' }, null),
|
|
694
|
+
st.binding?.setSlug ? h('button', { className: 'ssm-p-text-btn ssm-p-text-danger', disabled: busy, 'aria-label': t('unbindCurrent'), onClick: () => setConfirmUnbind(true) }, h(Icon, { n: 'linkOff', s: 12 }), t('unbindCurrent')) : null),
|
|
695
|
+
),
|
|
696
|
+
// 另存为/导入行已收进技能集卡底部操作条(Task 2,spec §6.3)
|
|
697
|
+
io
|
|
698
|
+
? h('div', { className: 'ssm-p-card' },
|
|
699
|
+
h('textarea', {
|
|
700
|
+
className: 'ssm-textarea', rows: 8, spellCheck: false,
|
|
701
|
+
readOnly: io.mode === 'export' || !!io.preview, value: io.text, disabled: busy,
|
|
702
|
+
onChange: (e) => setIo({ ...io, text: e.target.value, copied: false, preview: null }),
|
|
703
|
+
}),
|
|
704
|
+
// 导入第二步(§5.6):预览只读结果 → 每个缺失技能三选一「按 pin 安装 / 先占位 / 忽略」
|
|
705
|
+
io.mode === 'import' && io.preview
|
|
706
|
+
? h('div', { className: 'ssm-io' },
|
|
707
|
+
...(io.preview.errors ?? []).map((er, i) => h('div', { key: 'e' + i, className: 'ssm-warn' }, `⚠ ${er}`)),
|
|
708
|
+
...(io.preview.items ?? []).map((it) => h('div', { key: it.name, className: 'ssm-row' },
|
|
709
|
+
h('span', null, it.name, h('span', { className: 'ssm-n' }, ` ${(it.skills ?? []).length} ${t('skillsCount')}`)),
|
|
710
|
+
it.conflict ? h('span', { className: 'ssm-warn-inline' }, ' ' + t('importConflict')) : null,
|
|
711
|
+
(it.missing ?? []).length
|
|
712
|
+
? h('span', { className: 'ssm-n' }, ` ${t('importMissing')}:${(it.missing ?? []).map((m) => m.name).join('、')}`)
|
|
713
|
+
: h('span', { className: 'ssm-ok' }, ' ' + t('importAllPresent')))),
|
|
714
|
+
(io.preview.items ?? []).some((it) => (it.missing ?? []).length)
|
|
715
|
+
? h('div', { className: 'ssm-hint' }, t('importDefaultHint')) : null,
|
|
716
|
+
...(io.preview.items ?? []).flatMap((it) => (it.missing ?? []).map((m) => h('div', { key: `${it.slug}/${m.name}`, className: 'ssm-row' },
|
|
717
|
+
h('span', null, m.name, m.pin ? h('span', { className: 'ssm-n' }, ` ${String(m.pin.source).replace('github:', '')}${m.pin.commit ? ` @${String(m.pin.commit).slice(0, 7)}` : ''}`) : null),
|
|
718
|
+
h('span', { className: 'ssm-grow' }, null),
|
|
719
|
+
h('button', {
|
|
720
|
+
disabled: busy || !m.pin || io.choices[m.name] === 'install',
|
|
721
|
+
title: m.pin ? '' : t('importNoPin'),
|
|
722
|
+
onClick: () => setIo({ ...io, choices: { ...io.choices, [m.name]: 'install' } }),
|
|
723
|
+
}, (io.choices[m.name] === 'install' ? '✓ ' : '') + t('importChoiceInstall')),
|
|
724
|
+
h('button', {
|
|
725
|
+
disabled: busy || io.choices[m.name] === 'placeholder',
|
|
726
|
+
onClick: () => setIo({ ...io, choices: { ...io.choices, [m.name]: 'placeholder' } }),
|
|
727
|
+
}, (io.choices[m.name] === 'placeholder' ? '✓ ' : '') + t('importChoicePlaceholder')),
|
|
728
|
+
h('button', {
|
|
729
|
+
disabled: busy || io.choices[m.name] === 'ignore',
|
|
730
|
+
onClick: () => setIo({ ...io, choices: { ...io.choices, [m.name]: 'ignore' } }),
|
|
731
|
+
}, (io.choices[m.name] === 'ignore' ? '✓ ' : '') + t('importChoiceIgnore'))))))
|
|
732
|
+
: null,
|
|
733
|
+
// 导入结果回显(评审 I2 + 用户 2026-10-29):四组计数从任务态读;warnings 由上方 TaskStrip 逐行显示,不重复一遍
|
|
734
|
+
importDone
|
|
735
|
+
? h('div', { className: 'ssm-io' },
|
|
736
|
+
h('div', { className: 'ssm-ok' },
|
|
737
|
+
`${t('importApplied')}:` + ([[importDone.created?.length ?? 0, t('sets')], [importDone.installed?.length ?? 0, t('importChoiceInstall')], [importDone.placeholders?.length ?? 0, t('importChoicePlaceholder')], [importDone.ignored?.length ?? 0, t('importChoiceIgnore')], [(importDone.nameConflicts?.length ?? 0) + (importDone.errors?.length ?? 0), t('importConflict')]].filter((p) => p[0]).map((p) => `${p[1]} ${p[0]}`).join(' · ') || t('none')),
|
|
738
|
+
(importDone.created ?? []).length ? `(${importDone.created.map((c) => c.slug).join('、')})` : ''))
|
|
739
|
+
: null,
|
|
740
|
+
h('div', { className: 'ssm-row' },
|
|
741
|
+
io.mode === 'export'
|
|
742
|
+
? h('button', {
|
|
743
|
+
disabled: busy,
|
|
744
|
+
onClick: async () => {
|
|
745
|
+
try { await navigator.clipboard.writeText(io.text); setIo({ ...io, copied: true }); }
|
|
746
|
+
catch (e) { setError(`${t('copyFail')}: ${e?.message ?? e}`); }
|
|
747
|
+
},
|
|
748
|
+
}, t('copyClip'))
|
|
749
|
+
: io.preview
|
|
750
|
+
? h('button', {
|
|
751
|
+
disabled: locked, title: busyTitle,
|
|
752
|
+
onClick: () => startLong(ctx, 'importApply', null, { payload: io.payload, choices: io.choices }, {
|
|
753
|
+
// 预期耗时按「按 pin 安装」的技能数放大:每个技能各自浅克隆一次仓库,25s 是单个的量级
|
|
754
|
+
T: 25000 * Math.max(1, Object.values(io.choices ?? {}).filter((c) => c === 'install').length),
|
|
755
|
+
onDone: () => { reload(); bus.refresh(sessionId); }, // 左面板与右栏详情同步刷新(用户 2026-10-27)
|
|
756
|
+
}),
|
|
757
|
+
}, t('importApply'))
|
|
758
|
+
: h('button', {
|
|
759
|
+
disabled: busy || !io.text.trim(),
|
|
760
|
+
onClick: async () => {
|
|
761
|
+
let payload;
|
|
762
|
+
try { payload = JSON.parse(io.text); } catch (e) { setError(`${t('importJson')}: JSON ${e?.message ?? e}`); return; }
|
|
763
|
+
setBusy(true); setError(null);
|
|
764
|
+
try { setIo({ ...io, payload, preview: await call(ctx, 'importPreview', { payload }), choices: {} }); }
|
|
765
|
+
catch (e) { setError(`${t('importPreviewBtn')}: ${e?.message ?? e}`); }
|
|
766
|
+
finally { setBusy(false); } // 预览只读,无需 reload
|
|
767
|
+
},
|
|
768
|
+
}, t('importPreviewBtn')),
|
|
769
|
+
io.mode === 'export' && io.copied ? h('span', { className: 'ssm-ok' }, t('copied')) : null,
|
|
770
|
+
h('span', { className: 'ssm-grow' }, null),
|
|
771
|
+
h('button', { disabled: busy, onClick: () => setIo(null) }, '×')))
|
|
772
|
+
: null,
|
|
773
|
+
st.binding?.setSlug && confirmUnbind
|
|
774
|
+
? h('div', { className: 'ssm-confirm' }, t('confirmUnbind'), ' ',
|
|
775
|
+
h('button', { autoFocus: true, disabled: busy, className: 'ssm-danger', onClick: () => run(() => call(ctx, 'unbind', { sessionId })) }, t('unbindGo')),
|
|
776
|
+
h('button', { onClick: () => setConfirmUnbind(false) }, '×'))
|
|
777
|
+
: null,
|
|
778
|
+
(sc.foreign?.length ? h('div', { className: 'ssm-hint' }, t('foreignLine'), ':', (sc.foreign ?? []).join(', ')) : null),
|
|
779
|
+
// 生效清单卡(甲案,spec §6.4):搜索框并进标题行;默认视图 = 生效行 + 折叠灰区;搜索 = 生效中/候选两段
|
|
780
|
+
h('div', { className: 'ssm-p-card' },
|
|
781
|
+
h('div', { className: 'ssm-p-card-title' },
|
|
782
|
+
t('effTitle'), h(PBadge, { kind: 'muted', text: String(effNames.length) }),
|
|
783
|
+
h('span', { className: 'ssm-grow' }, null),
|
|
784
|
+
h(Icon, { n: 'search', s: 12 }),
|
|
785
|
+
h('input', { className: 'ssm-p-search', placeholder: t('searchPh'), value: q, disabled: busy, 'aria-label': t('searchPh'), onChange: (e) => setQ(e.target.value) }),
|
|
786
|
+
q ? h('button', { className: 'ssm-p-icon-btn', disabled: busy, 'aria-label': t('none'), onClick: () => setQ('') }, h(Icon, { n: 'x', s: 12 })) : null),
|
|
787
|
+
bound && st.sessionOverrideActive
|
|
788
|
+
? h('div', { className: 'ssm-p-banner ssm-p-banner-warn' }, h(Icon, { n: 'alert' }),
|
|
789
|
+
t('ovBanner').replace('{n}', String((ov.removed ?? []).length)).replace('{m}', String((ov.added ?? []).length)),
|
|
790
|
+
h('span', { className: 'ssm-grow' }, null),
|
|
791
|
+
h('button', { disabled: busy, onClick: () => run(() => call(ctx, 'endOverride', { sessionId })) }, t('endOverride')))
|
|
792
|
+
: null,
|
|
793
|
+
!bound ? h('div', { className: 'ssm-p-banner ssm-p-banner-muted' }, h(Icon, { n: 'linkOff' }), t('draftHint'),
|
|
794
|
+
h('span', { className: 'ssm-grow' }, null),
|
|
795
|
+
h('button', { disabled: busy || !managed.length, title: !managed.length ? t('draftHint') : undefined, onClick: () => { setSaveOpen(true); requestAnimationFrame(() => { if (saveNameRef.current) { saveNameRef.current.scrollIntoView({ block: 'nearest' }); saveNameRef.current.focus(); } }); } }, t('saveAs'))) : null,
|
|
796
|
+
qq
|
|
797
|
+
? h(React.Fragment, null,
|
|
798
|
+
...(() => { // 搜索两段视图(3.4)+「其他」灰段(review#5:搜常驻/插件名不再假阴性,旧灰行命中能力保留)
|
|
799
|
+
const hitSet = new Set(hits.map((l) => l.name));
|
|
800
|
+
const act = effNames.filter((n) => hitSet.has(n));
|
|
801
|
+
const cand = (st.library ?? []).filter((l) => !eff.has(l.name) && (bound || (!resident.has(l.name) && !foreignRes.has(l.name)))).filter((l) => hitSet.has(l.name));
|
|
802
|
+
const other = hits
|
|
803
|
+
.filter((l) => !act.includes(l.name) && !cand.some((c) => c.name === l.name) && (resident.has(l.name) || foreignRes.has(l.name) || providerSet.has(l.name)))
|
|
804
|
+
.map((l) => SkillRow({ key: 'oth-' + l.name, l, on: null, ro: true,
|
|
805
|
+
badges: [{ kind: 'muted', text: resident.has(l.name) ? t('grayResident') : foreignRes.has(l.name) ? t('grayForeign') : t('grayProvider') }],
|
|
806
|
+
title: resident.has(l.name) ? t('residentRow') : foreignRes.has(l.name) ? t('foreignRow') : t('providerRowGo') }));
|
|
807
|
+
if (!act.length && !cand.length && !other.length) return [h('div', { className: 'ssm-p-empty' }, h(Icon, { n: 'fileWarn', s: 16 }), t('emptySearch'))];
|
|
808
|
+
return [
|
|
809
|
+
...(act.length ? [
|
|
810
|
+
h('div', { className: 'ssm-p-seclabel' }, t('effTitle'), ' ', String(act.length)),
|
|
811
|
+
...act.map((n) => { const { l, badges, title } = rowModel(n); return SkillRow({ key: n, l, on: foreignSet.has(n) ? null : eff.has(n), badges, title, onChange: () => run(() => call(ctx, 'startOverride', { sessionId, ...(eff.has(n) ? { remove: [n] } : { add: [n] }) })) }); }),
|
|
812
|
+
] : []),
|
|
813
|
+
...(cand.length ? [
|
|
814
|
+
h('div', { className: 'ssm-p-seclabel' }, t('candidates'), ' ', String(cand.length)),
|
|
815
|
+
...cand.map((l) => SkillRow({ key: l.name, l, on: bound ? false : managed.includes(l.name), badges: [{ kind: 'muted', text: t('notActive') }], title: l.descriptionZh ?? undefined, onChange: () => run(() => call(ctx, 'startOverride', { sessionId, ...(managed.includes(l.name) ? { remove: [l.name] } : { add: [l.name] }) })) })),
|
|
816
|
+
] : []),
|
|
817
|
+
...(other.length ? [
|
|
818
|
+
h('div', { className: 'ssm-p-seclabel' }, t('otherSec'), ' ', String(other.length)),
|
|
819
|
+
...other,
|
|
820
|
+
] : [])];
|
|
821
|
+
})())
|
|
822
|
+
: h(React.Fragment, null,
|
|
823
|
+
effNames.length ? null : h('div', { className: 'ssm-p-empty' }, h(Icon, { n: 'fileWarn', s: 16 }), t('emptyList')),
|
|
824
|
+
// 勾选语义照抄现 chips:勾上取消 = startOverride remove;未勾勾上 = add(不许反)
|
|
825
|
+
...effNames.map((n) => { const { l, badges, title } = rowModel(n); return SkillRow({ key: n, l, on: foreignSet.has(n) ? null : true, badges, title, onChange: () => run(() => call(ctx, 'startOverride', { sessionId, remove: [n] })) }); }),
|
|
826
|
+
// 被覆盖剔除的集成员(用户 2026-10-26):挪列表底部,删除线 + 「已被剔除」,勾回 = add
|
|
827
|
+
...(ov.removed ?? []).map((n) => { const { l, badges } = rowModel(n); return SkillRow({ key: 'ovr-' + n, l, on: false, removed: true, badges: [...badges, { kind: 'warn', text: t('ovRemoved') }], title: t('ovRestoreTip'), onChange: () => run(() => call(ctx, 'startOverride', { sessionId, add: [n] })) }); }),
|
|
828
|
+
// 候选折叠段(用户报告 2026-11-06:默认视图候选只能靠搜索、入口太深):点开=旧「临时覆盖」区同款可勾选列表
|
|
829
|
+
// 口径与搜索视图候选段一致:bound = 库−生效;未绑定 = 库−常驻−外来常驻,勾上=add、取消=remove(草稿语义照旧)
|
|
830
|
+
(() => {
|
|
831
|
+
const cand = (st.library ?? []).filter((l) => !eff.has(l.name) && (bound || (!resident.has(l.name) && !foreignRes.has(l.name))));
|
|
832
|
+
return cand.length
|
|
833
|
+
? h(React.Fragment, null,
|
|
834
|
+
h('button', { className: 'ssm-p-collapse', disabled: busy, 'aria-expanded': openZones.cand ? 'true' : 'false', 'aria-label': openZones.cand ? t('ariaCollapse') : t('ariaExpand'), onClick: () => setOpenZones({ ...openZones, cand: !openZones.cand }) },
|
|
835
|
+
h(Icon, { n: 'search', s: 13 }), t('candidates'), ' · ', String(cand.length), ' ', t('grayItems'),
|
|
836
|
+
h('span', { className: 'ssm-grow' }, null), h(Icon, { n: 'chevron', s: 12 })),
|
|
837
|
+
openZones.cand
|
|
838
|
+
? h(React.Fragment, null,
|
|
839
|
+
...cand.map((l) => SkillRow({ key: 'cand-' + l.name, l, on: bound ? false : managed.includes(l.name), badges: [{ kind: 'muted', text: t('notActive') }], title: l.descriptionZh ?? undefined, onChange: () => run(() => call(ctx, 'startOverride', { sessionId, ...(managed.includes(l.name) ? { remove: [l.name] } : { add: [l.name] }) })) })),
|
|
840
|
+
h('div', { className: 'ssm-hint' }, t('hintP2')))
|
|
841
|
+
: null)
|
|
842
|
+
: null;
|
|
843
|
+
})(),
|
|
844
|
+
ZoneRow('res', t('grayResident'), 'globe', [...resident].sort(), t('residentRow')),
|
|
845
|
+
ZoneRow('fres', t('grayForeign'), 'foreign', [...foreignRes].sort(), t('foreignRow')),
|
|
846
|
+
// unmanaged=null(host 未提供该字段)→ 整段不渲染(3.3)
|
|
847
|
+
st.unmanaged ? ZoneRow('prov', t('grayProvider'), 'box', (st.unmanaged ?? []).map((e) => e.name).sort(), t('providerRowGo')) : null),
|
|
848
|
+
h('div', { className: 'ssm-hint' }, bound ? (st.sessionOverrideActive ? t('overrideHint') : t('hintP2')) : t('hintP2')),
|
|
849
|
+
h('div', { className: 'ssm-hint' }, t('settingsHint'))));
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
function Dot({ st }) {
|
|
853
|
+
const sc = st?.selfCheck;
|
|
854
|
+
const cls = !st || st.unbound || sc?.unbound ? 'ssm-dot-idle' : sc && !sc.ok ? 'ssm-dot-red' : 'ssm-dot-ok';
|
|
855
|
+
return h('span', { className: `ssm-dot ${cls}` }, null);
|
|
856
|
+
}
|
|
857
|
+
function Name({ st }) {
|
|
858
|
+
return st?.binding?.setSlug ? h('span', { className: 'ssm-cur' }, st.set?.name ?? st.binding.setSlug) : null;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
function ComposerChip({ ctx, t, sessionId }) {
|
|
862
|
+
const b = useBus();
|
|
863
|
+
React.useEffect(() => {
|
|
864
|
+
bus.setSession(sessionId);
|
|
865
|
+
(async () => { // §12 P0:徽标/集名常驻显示——挂载即拉一次状态,不必先开面板
|
|
866
|
+
try { const v = await call(ctx, 'state', { sessionId }); if (bus.sessionId === sessionId) bus.setState(v); } catch {}
|
|
867
|
+
})();
|
|
868
|
+
return () => bus.clearSessionIf(sessionId);
|
|
869
|
+
}, [ctx, sessionId]);
|
|
870
|
+
return h('button', { className: 'ssm-chip-btn', title: t('panel'), onClick: () => bus.setOpen(!b.open) },
|
|
871
|
+
h(Dot, { st: b.state }), t('chip'), h(Name, { st: b.state }),
|
|
872
|
+
b.state?.selfCheck && !b.state.selfCheck.ok && !b.state.selfCheck.unbound ? h('span', { className: 'ssm-badge' }, '!') : null);
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
/**
|
|
876
|
+
* 右栏详情 tab(§12.209,betterSidebar 服务契约源码取证:TabDescriptor.component(props)
|
|
877
|
+
* 收 { ctx, store, scope, tab, visible, onOpenFile })。数据只走既有 Remote 面(#15)。
|
|
878
|
+
*/
|
|
879
|
+
function RightPanel({ ctx, t, scope, visible, onOpenFile }) {
|
|
880
|
+
const [st, setSt] = React.useState(null);
|
|
881
|
+
const [dg, setDg] = React.useState(null);
|
|
882
|
+
const [dgErr, setDgErr] = React.useState(null);
|
|
883
|
+
const [err, setErr] = React.useState(null);
|
|
884
|
+
const [token, setToken] = React.useState(bus.token); // 刷新信号快照(⇥ 再点/面板操作即刷新,见 bus.refresh)
|
|
885
|
+
const [openProv, setOpenProv] = React.useState(false); // 插件/Preset 灰段折叠态(spec §6.9 同款灰区语汇:默认收起,纯呈现态)
|
|
886
|
+
const sessionId = scope?.sessionId ?? null;
|
|
887
|
+
React.useEffect(() => { setSt(null); setDg(null); setDgErr(null); setToken(bus.token); setOpenProv(false); }, [sessionId]); // scope 切换先清旧数据(含旧会话的刷新信号)、插件灰段收回默认收起(纯呈现态,Task 5 转交),防瞬态串会话
|
|
888
|
+
React.useEffect(() => { // 订阅刷新信号:bus.refresh 只广播当前会话,token 变即触发下方重载
|
|
889
|
+
const fn = () => setToken(bus.token);
|
|
890
|
+
bus.subs.add(fn);
|
|
891
|
+
return () => bus.subs.delete(fn);
|
|
892
|
+
}, []);
|
|
893
|
+
const load = React.useCallback(async () => {
|
|
894
|
+
if (!sessionId) return;
|
|
895
|
+
try {
|
|
896
|
+
const v = await call(ctx, 'state', { sessionId });
|
|
897
|
+
setSt(v);
|
|
898
|
+
if (bus.sessionId === sessionId) bus.setState(v); // 迟到响应不得覆盖他会话的 bus 单例(review M1,对齐 :282 口径)
|
|
899
|
+
try { setDg(await call(ctx, 'diagnoseRun', { sessionId })); setDgErr(null); }
|
|
900
|
+
catch (e) { setDgErr(`${e?.message ?? e}`); } // 挂了什么得看得见,不得与「无问题」同形(review n6)
|
|
901
|
+
setErr(null);
|
|
902
|
+
} catch (e) { setErr(`${t('loadFailed')}: ${e?.message ?? e}`); }
|
|
903
|
+
}, [ctx, sessionId]);
|
|
904
|
+
React.useEffect(() => { if (visible !== false) load(); }, [load, visible, token]); // parked 时暂停拉取(计划 T0 口径,review m3);token=bus 刷新信号:tab 常驻挂载下 ⇥ 再点/面板切集都靠它触发重载(用户报告 2026-10-27)
|
|
905
|
+
if (!sessionId) return h('div', { className: 'ssm-s-rp' }, t('rpNoSession')); // 早退只渲染 rpNoSession(数据机制照旧)
|
|
906
|
+
const rows = selectEffective(st);
|
|
907
|
+
const { sc, resident, managed, foreign } = rows;
|
|
908
|
+
const libMap = new Map((st?.library ?? []).map((l) => [l.name, l]));
|
|
909
|
+
// 右栏列表口径(用户 2026-10-27):已绑定 = 集成员 ∪ 托管台账 ∪ 外来条目(冻结/集被删回退生效清单),
|
|
910
|
+
// 且剔除「仅全局常驻」行——不逐条列出全部全局技能,改由下方计数提示如实告知常驻已生效;
|
|
911
|
+
// 绑定常驻伪集(_resident,loadSet 返回 null)例外:列表本身就是常驻名册。
|
|
912
|
+
const bound = !!st?.binding?.setSlug;
|
|
913
|
+
const residentSlugBound = st?.binding?.setSlug === '_resident';
|
|
914
|
+
const setNames = new Set(st?.set?.skills ?? []);
|
|
915
|
+
const baseNames = st?.set?.skills ?? (bound ? st?.effective?.names ?? [] : []);
|
|
916
|
+
let names = [...new Set([...baseNames, ...managed, ...foreign])].sort();
|
|
917
|
+
if (bound && !residentSlugBound) names = names.filter((n) => !resident.has(n) || setNames.has(n) || managed.has(n));
|
|
918
|
+
const row = (n) => {
|
|
919
|
+
const l = libMap.get(n);
|
|
920
|
+
const open = l?.skillMd && onOpenFile ? () => onOpenFile(l.skillMd) : null;
|
|
921
|
+
// 徽章组走唯一选择器(spec §6.9):受管 / 全局常驻 / 外来 / 失效 / 缺失 / 本地改动
|
|
922
|
+
const badges = effectiveBadges(t, n, rows, { localModified: !!l?.localModified });
|
|
923
|
+
// 第二行中文用途(漂移补齐,与库页签 §6.5 同款回退:未翻译显英文 + 待翻译角标)
|
|
924
|
+
const desc = l?.descriptionZh
|
|
925
|
+
? h('div', { className: 'ssm-p-desc', title: l.description ?? undefined }, l.descriptionZh)
|
|
926
|
+
: l?.description
|
|
927
|
+
? h('div', { className: 'ssm-p-desc', title: l.description }, l.description, ' ', h(PBadge, { kind: 'muted', text: t('pendingTag') }))
|
|
928
|
+
: null;
|
|
929
|
+
// 点击开 SKILL.md 与 title=rpClick 照旧(RowShell 点击态:tabIndex+role 键盘可达)
|
|
930
|
+
return h(RowShell, { key: n, t, name: n, badges, desc, ...(open ? { onClick: open, clickTitle: t('rpClick') } : {}) });
|
|
931
|
+
};
|
|
932
|
+
// 诊断摘要保持紧凑(spec §6.9):5 组 × 前 3 条、仅 label: what,不展开 where/fix;角色点换已入库 .ssm-p-lvl*
|
|
933
|
+
const dgRows = dg ? Object.entries({ dangling: t('diagDangling'), deadLinks: t('diagDeadLinks'), copies: t('diagCopies'), structure: t('diagStructure'), env: t('diagEnv') })
|
|
934
|
+
.flatMap(([g, label]) => (dg.groups?.[g] ?? []).slice(0, 3).map((r, i) => h('div', { key: `${g}${i}`, className: 'ssm-s-dgrow' },
|
|
935
|
+
h('span', { className: `ssm-p-lvl ssm-p-lvl-${r.level}` }, null), h('span', null, `${label}: ${r.what}`)))) : [];
|
|
936
|
+
const dgCount = dg ? Object.entries(dg.groups).filter(([k]) => k !== 'partition').reduce((a, [, v]) => a + v.length, 0) : 0;
|
|
937
|
+
return h('div', { className: 'ssm-s-rp' },
|
|
938
|
+
// sticky 头部(spec §6.9):集名(或 noBinding)+ frozen warn 徽章 + grow + ⟳ 图标钮(aria);管内滚动时头不滚走
|
|
939
|
+
h('div', { className: 'ssm-s-head' },
|
|
940
|
+
h('b', null, t('rpEffective')), ' ', st?.set?.name ?? st?.binding?.setSlug ?? t('noBinding'),
|
|
941
|
+
sc.frozen ? h(PBadge, { kind: 'warn', text: t('rpFrozen') }) : null,
|
|
942
|
+
h('span', { className: 'ssm-grow' }, null),
|
|
943
|
+
h('button', { className: 'ssm-p-icon-btn', onClick: load, title: t('regen'), 'aria-label': t('sAriaReload') }, h(Icon, { n: 'refresh' }))),
|
|
944
|
+
st?.projectRoot ? h('div', { className: 'ssm-p-rootline' }, h('span', { title: st.projectRoot }, t('projectRoot'), ':', st.projectRoot)) : null,
|
|
945
|
+
err ? h('div', { className: 'ssm-p-banner ssm-p-banner-error' }, h(Icon, { n: 'alert' }), err) : null,
|
|
946
|
+
// 空态三态(§6.9):未到位保留「…」文本行(未到位≠空:不得先渲染空态,review m4);未绑定/空清单图标化
|
|
947
|
+
!st && !err ? h('div', { className: 'ssm-p-empty' }, '…') : null,
|
|
948
|
+
st && !st.binding?.setSlug && (st.resident ?? []).length ? h('div', { className: 'ssm-p-empty' }, h(Icon, { n: 'globe', s: 16 }), t('rpGlobalActiveUnbound').replace('{n}', st.resident.length)) : null,
|
|
949
|
+
st && (!st.binding?.setSlug ? !(st.resident ?? []).length : names.length === 0) ? h('div', { className: 'ssm-p-empty' }, h(Icon, { n: 'fileWarn', s: 16 }), t('rpEmpty')) : null,
|
|
950
|
+
st && bound && (st.resident ?? []).length ? h('div', { className: 'ssm-p-descwrap' }, t('rpGlobalActiveHint').replace('{n}', st.resident.length)) : null, // 未绑定时由上方专属文案告知,不重复;常驻计数 hint 保留
|
|
951
|
+
st ? h('div', null, ...names.map(row)) : null,
|
|
952
|
+
// 插件/Preset 灰段(用户疑问 2026-10-26):运行时注入、不在生效清单内,只读不可勾;null = 服务不可知不渲染。
|
|
953
|
+
// 折叠语汇同款 composer 灰区(§6.9):默认收起「图标 标签 + 计数胶囊 ▸」,展开 = 灰态只读行 + 既有 hint(providerHint 文案照旧)。
|
|
954
|
+
// 计数钮只在有条目时渲染(对齐 composer ZoneRow 的 names.length 口径;unmanaged=null=不可知也不渲染)
|
|
955
|
+
st?.unmanaged?.length ? h(React.Fragment, null,
|
|
956
|
+
h('button', { className: 'ssm-p-collapse', 'aria-expanded': openProv ? 'true' : 'false', 'aria-label': openProv ? t('ariaCollapse') : t('ariaExpand'), onClick: () => setOpenProv(!openProv) },
|
|
957
|
+
h(Icon, { n: 'box', s: 13 }), t('providerSec'), h(PBadge, { kind: 'muted', text: String(st.unmanaged.length) }),
|
|
958
|
+
h('span', { className: 'ssm-grow' }, null), h(Icon, { n: 'chevron', s: 12 })),
|
|
959
|
+
openProv ? h(React.Fragment, null,
|
|
960
|
+
...st.unmanaged.map((e) => h(RowShell, { key: `p-${e.name}`, t, gray: true, name: e.name, badges: [{ kind: 'muted', text: e.provider }], title: e.source ?? undefined })),
|
|
961
|
+
h('div', { className: 'ssm-p-descwrap' }, t('providerHint'))) : null) : null,
|
|
962
|
+
// rpSelf 自检行语态(§6.9):ok→ok 语态 ✓、detail→error 语态、frozen→warn PBadge(detail 行随冻结保留,warn 语态)
|
|
963
|
+
h('div', { className: 'ssm-p-card-title' }, t('rpSelf'),
|
|
964
|
+
!st ? '—' : sc.ok === false ? (sc.frozen ? h(PBadge, { kind: 'warn', text: t('rpFrozen') }) : null) : h('span', { className: 'ssm-p-ok' }, '✓')),
|
|
965
|
+
sc.ok === false ? h('div', { className: sc.frozen ? 'ssm-p-warn' : 'ssm-p-err' }, sc.detail) : null,
|
|
966
|
+
// 节标题计数随 composer 同场景口径:PBadge muted(§7 裁量项);rpDiagFail/dgErr 文案照旧
|
|
967
|
+
h('div', { className: 'ssm-p-card-title' }, t('rpDiag'),
|
|
968
|
+
dg ? h(PBadge, { kind: 'muted', text: String(dgCount) }) : dgErr ? `⚠ ${t('rpDiagFail')}` : '—'),
|
|
969
|
+
dgErr ? h('div', { className: 'ssm-p-descwrap' }, dgErr) : null,
|
|
970
|
+
...dgRows);
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
function OverlayHost({ ctx, t, bs }) {
|
|
974
|
+
const b = useBus();
|
|
975
|
+
if (!b.open) return null;
|
|
976
|
+
return h('div', { className: 'ssm-p-overlay', onClick: () => bus.setOpen(false) },
|
|
977
|
+
b.sessionId
|
|
978
|
+
? h(Panel, { ctx, t, sessionId: b.sessionId, onClose: () => bus.setOpen(false), bs, seed: b.state?.sessionId === b.sessionId ? b.state : null })
|
|
979
|
+
: h('div', { className: 'ssm-p-panel', style: { padding: 14 } }, t('noSession')));
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
const ICON_PATHS = {
|
|
983
|
+
check: 'M20 6 9 17l-5-5',
|
|
984
|
+
pencil: 'M17 3a2.83 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z',
|
|
985
|
+
copy: 'M9 9h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V11a2 2 0 0 1 2-2ZM5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1',
|
|
986
|
+
save: 'M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2ZM17 21v-8H7v8M7 3v5h8', // 另存为磁盘图标(feather save 同款,用户 2026-11-17 图标重排:另存为=磁盘、导入=download、导出=upload)
|
|
987
|
+
users: 'M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8M23 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75',
|
|
988
|
+
trash: 'M3 6h18M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2',
|
|
989
|
+
download: 'M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3',
|
|
990
|
+
upload: 'M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12',
|
|
991
|
+
undo: 'M9 14 4 9l5-5M4 9h10.5a5.5 5.5 0 0 1 0 11H11',
|
|
992
|
+
refresh: 'M23 4v6h-6M20.49 15a9 9 0 1 1-2.12-9.36L23 10', // 右栏 ⟳ 刷新钮(feather rotate-cw 同款)
|
|
993
|
+
linkOff: 'M9 17H7a5 5 0 0 1 0-10h2M15 7h2a5 5 0 0 1 0 10h-2M8 12h8M3 3l18 18',
|
|
994
|
+
search: 'M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16M21 21l-4.35-4.35',
|
|
995
|
+
chevron: 'M6 9l6 6 6-6',
|
|
996
|
+
external: 'M15 3h6v6M10 14 21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6',
|
|
997
|
+
x: 'M18 6 6 18M6 6l12 12',
|
|
998
|
+
alert: 'M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0ZM12 9v4M12 17h.01',
|
|
999
|
+
fileWarn: 'M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8ZM14 2v6h6M12 10v4M12 18h.01',
|
|
1000
|
+
globe: 'M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18ZM3.6 9h16.8M3.6 15h16.8M11.3 3a17 17 0 0 0 0 18M12.7 3a17 17 0 0 1 0 18',
|
|
1001
|
+
box: 'M21 8 12 3 3 8v8l9 5 9-5ZM3 8l9 5 9-5M12 13v8',
|
|
1002
|
+
foreign: 'M7 17 17 7M8 7h9v9',
|
|
1003
|
+
};
|
|
1004
|
+
function Icon({ n, s = 14 }) {
|
|
1005
|
+
return h('svg', { className: 'ssm-p-icon', viewBox: '0 0 24 24', width: s, height: s, fill: 'none', stroke: 'currentColor', strokeWidth: 1.5, strokeLinecap: 'round', strokeLinejoin: 'round', 'aria-hidden': true }, h('path', { d: ICON_PATHS[n] }));
|
|
1006
|
+
}
|
|
1007
|
+
function PBadge({ kind, text }) { return h('span', { className: `ssm-p-tag ssm-p-tag-${kind}` }, text); }
|
|
1008
|
+
|
|
1009
|
+
/**
|
|
1010
|
+
* 设置页(§10.1.4 settings.section:注册仅 id/order/label,ownerProps 只给 close;
|
|
1011
|
+
* 四页签自绘(库/全局技能集/安装与更新/诊断))。数据全部走同一 host Remote 面(call 兜底 fetch)——无第二实现(#15)。
|
|
1012
|
+
*/
|
|
1013
|
+
/** 保留理由 → 人话:resident = 插件自家常驻链(不是同名冲突,用户报告 2026-10-26);
|
|
1014
|
+
* 未知 reason 原样显示,避免新版 core 加了分类而字典缺键时 UI 空白。 */
|
|
1015
|
+
const keepReasonText = (t, reason) => {
|
|
1016
|
+
const r = String(reason ?? '');
|
|
1017
|
+
const key = 'migrateReason' + r.charAt(0).toUpperCase() + r.slice(1);
|
|
1018
|
+
const v = t(key);
|
|
1019
|
+
return v === key ? r : v;
|
|
1020
|
+
};
|
|
1021
|
+
|
|
1022
|
+
function SettingsSection({ ctx, t }) {
|
|
1023
|
+
const tasks = useTasks(); // 模块级长任务态:关掉设置页也不丢进度与结果(用户 2026-10-29)
|
|
1024
|
+
const [tab, setTab] = React.useState('library');
|
|
1025
|
+
const [lib, setLib] = React.useState(null); // null=首屏未回:未回≠空库(2026-11-19 用户报:批量在飞时重进设置页渲染成「技能库还没有技能」)
|
|
1026
|
+
const [filter, setFilter] = React.useState('');
|
|
1027
|
+
const [busy, setBusy] = React.useState(null);
|
|
1028
|
+
const [msg, setMsg] = React.useState(null); // {kind:'err'|'ok', text}
|
|
1029
|
+
const [claimOf, setClaimOf] = React.useState(null); // 认领来源行内编辑中的技能名(Electron 无 window.prompt,§6.4)
|
|
1030
|
+
const [claimDraft, setClaimDraft] = React.useState({ source: '', commit: '' });
|
|
1031
|
+
const [confirmUn, setConfirmUn] = React.useState(null); // name
|
|
1032
|
+
const [backupsOf, setBackupsOf] = React.useState(null); // {name, list}
|
|
1033
|
+
const [upRes, setUpRes] = React.useState({}); // name -> checkUpdate result
|
|
1034
|
+
const [chkFail, setChkFail] = React.useState(null); // 批量检查失败 {failed:[{source,error}], errors:[行级文案]}(2026-11-17 加固 T5)
|
|
1035
|
+
const [spec, setSpec] = React.useState('');
|
|
1036
|
+
const [overwrite, setOverwrite] = React.useState(false);
|
|
1037
|
+
const [mig, setMig] = React.useState(null); // {preview, applied}
|
|
1038
|
+
// P3 全局技能集 tab + 翻译/agents 迁移(设计 §6.4/§6.1/§6.6)
|
|
1039
|
+
const [gq, setGq] = React.useState('');
|
|
1040
|
+
const [gOnly, setGOnly] = React.useState(false);
|
|
1041
|
+
const [resident, setResident] = React.useState([]);
|
|
1042
|
+
const [foreign, setForeign] = React.useState([]);
|
|
1043
|
+
const [rTarget, setRTarget] = React.useState('');
|
|
1044
|
+
const [tr, setTr] = React.useState(null); // {pending, failed, models, model, result, progress}
|
|
1045
|
+
const trStop = React.useRef(false); // 批量翻译「停止」标志(逐条 RPC 循环检查,用户反馈 2026-10-26:无进度不可知)
|
|
1046
|
+
const [migA, setMigA] = React.useState(null); // {preview, applied}
|
|
1047
|
+
const [diag, setDiag] = React.useState(null);
|
|
1048
|
+
// 在飞时关掉设置页,onDone 写回的是点击那一刻的实例,那次写入被 React 丢弃;
|
|
1049
|
+
// 重开时从任务态把最近一次「检查更新」的结果补回来(终审 I2);批量检查同口径(加固 T5)
|
|
1050
|
+
// ran=null 全量口径整体替换;ran=sources 子集只替换本轮重拉过的来源,
|
|
1051
|
+
// 其余仓库的失败记录原样保留(终审 S4:子集重试不得吞别家的红)
|
|
1052
|
+
const mergeChkAll = (r, ran = null) => {
|
|
1053
|
+
setUpRes((m) => { const nx = { ...m }; for (const e of r.results ?? []) if (e.chk) nx[e.name] = e.chk; return nx; });
|
|
1054
|
+
const freshF = r.failedSources ?? [];
|
|
1055
|
+
const freshE = (r.results ?? []).filter((e) => !e.chk && e.error).map((e) => `${e.name}: ${e.error}`);
|
|
1056
|
+
setChkFail((prev) => {
|
|
1057
|
+
if (!ran) return freshF.length || freshE.length ? { failed: freshF, errors: freshE } : null;
|
|
1058
|
+
const ranSet = new Set(ran);
|
|
1059
|
+
const ranNames = new Set((r.results ?? []).map((e) => e.name));
|
|
1060
|
+
const keptF = (prev?.failed ?? []).filter((x) => !ranSet.has(x.source));
|
|
1061
|
+
const keptE = (prev?.errors ?? []).filter((x) => !ranNames.has(x.split(':')[0]));
|
|
1062
|
+
const failed = [...keptF, ...freshF];
|
|
1063
|
+
const errors = [...keptE, ...freshE];
|
|
1064
|
+
return failed.length || errors.length ? { failed, errors } : null;
|
|
1065
|
+
});
|
|
1066
|
+
};
|
|
1067
|
+
React.useEffect(() => {
|
|
1068
|
+
const last = tasks.last;
|
|
1069
|
+
if (last?.op === 'updateCheckAll') { if (last.status === 'ok' && last.result) mergeChkAll(last.result, last.args?.sources ?? null); return; }
|
|
1070
|
+
if (last?.op !== 'updateCheck' || last.status !== 'ok' || !last.result) return;
|
|
1071
|
+
setUpRes((m) => (m[last.target] ? m : { ...m, [last.target]: last.result }));
|
|
1072
|
+
}, [tasks.last]);
|
|
1073
|
+
const load = React.useCallback(async () => {
|
|
1074
|
+
try { const v = await call(ctx, 'libraryList', {}); setLib(v.library ?? []); }
|
|
1075
|
+
catch (e) { setMsg({ kind: 'err', text: `${t('loadFailed')}: ${e?.message ?? e}` }); }
|
|
1076
|
+
}, [ctx]);
|
|
1077
|
+
React.useEffect(() => { load(); }, [load]);
|
|
1078
|
+
const loadState = React.useCallback(async () => {
|
|
1079
|
+
try {
|
|
1080
|
+
const v = await call(ctx, 'state', bus.sessionId ? { sessionId: bus.sessionId } : {});
|
|
1081
|
+
setResident(v.resident ?? []); setForeign(v.residentForeign ?? []); setRTarget(v.residentTarget ?? '');
|
|
1082
|
+
} catch { /* 无会话时项目面可能拒;全局字段照常取 */ }
|
|
1083
|
+
}, [ctx]);
|
|
1084
|
+
React.useEffect(() => { loadState(); }, [loadState]);
|
|
1085
|
+
// 设置页常驻挂载:进来/切回来时把 host 在跑的长任务与最近结果拉回来(关掉界面再回来仍见)
|
|
1086
|
+
React.useEffect(() => {
|
|
1087
|
+
let alive = true; let timer = null;
|
|
1088
|
+
const tick = async () => { const live = await syncHostTasks(ctx); if (alive && live) timer = setTimeout(tick, 2000); };
|
|
1089
|
+
tick();
|
|
1090
|
+
return () => { alive = false; clearTimeout(timer); };
|
|
1091
|
+
}, [ctx]);
|
|
1092
|
+
const run = async (key, fn) => {
|
|
1093
|
+
setBusy(key); setMsg(null);
|
|
1094
|
+
try {
|
|
1095
|
+
const r = await fn();
|
|
1096
|
+
const w = r && Array.isArray(r.warnings) && r.warnings.length ? r.warnings.join('; ') : null;
|
|
1097
|
+
setMsg(w ? { kind: 'err', text: `${t('opDone')} ⚠ ${w}` } : { kind: 'ok', text: (r && r.noteText) || t('opDone') }); // 警告可见(review m4)
|
|
1098
|
+
return r;
|
|
1099
|
+
} catch (e) { setMsg({ kind: 'err', text: `${t('opFailed')}: ${e?.message ?? e}` }); }
|
|
1100
|
+
finally { setBusy(null); }
|
|
1101
|
+
};
|
|
1102
|
+
/** 在飞判定读模块级任务态(组件卸载也看得见):只有「就是这个 op、就是这个目标」才亮转圈。 */
|
|
1103
|
+
const rowBusy = (op, name) => !!tasks.running && tasks.running.op === op && tasks.running.target === name;
|
|
1104
|
+
const locked = !!tasks.running || !!busy;
|
|
1105
|
+
// 被单飞挡住的按钮必须写明在跑什么(反目标:不得制造新的「点了没反应」)
|
|
1106
|
+
const busyTitle = tasks.running ? t('taskBusyWith').replace('{n}', t(SLOW_OPS[tasks.running.op].label)) : undefined;
|
|
1107
|
+
/** 图标钮 title:动作名打头,被单飞挡住时追加「正在跑什么」(反目标:不得制造新的「点了没反应」)。 */
|
|
1108
|
+
const iTitle = (label) => (busyTitle ? `${label} · ${busyTitle}` : label);
|
|
1109
|
+
// 安装结果改从任务态读:原 instRes 是组件 state,关掉设置页就没了(Review Focus #1)
|
|
1110
|
+
const instDone = tasks.last?.op === 'installApply' && tasks.last.status === 'ok' ? tasks.last.result : null;
|
|
1111
|
+
const sess = () => (bus.sessionId ? { sessionId: bus.sessionId } : {}); // 项目面必须带活动会话(review M2)
|
|
1112
|
+
const rows = searchRows(lib ?? [], filter); // P3:过滤框 = 同款匹配器(名称/来源/描述/中文用途)
|
|
1113
|
+
const gCorpus = [...(lib ?? []), ...foreign.filter((n) => !lib?.some((l) => l.name === n)).map((n) => ({ name: n, source: 'foreign', foreign: true, descriptionZh: null }))];
|
|
1114
|
+
const grows = searchRows(gCorpus, gq).filter((r) => !gOnly || resident.includes(r.name) || foreign.includes(r.name));
|
|
1115
|
+
const counts = (files) => {
|
|
1116
|
+
const c = { update: 0, add: 0, remove: 0, 'skip-modified': 0 };
|
|
1117
|
+
for (const f of files ?? []) if (c[f.action] !== undefined) c[f.action] += 1;
|
|
1118
|
+
return c;
|
|
1119
|
+
};
|
|
1120
|
+
// 等待期不禁用页签(用户 2026-10-29:装一个仓库要几十秒,连切页签都做不到)
|
|
1121
|
+
const tabBtn = (id, label) => h('button', { className: 'ssm-s-tab' + (tab === id ? ' ssm-s-tab-on' : ''), onClick: () => setTab(id) }, label); // 页签不加 disabled(spec §5.4/AC#1);文案沿用 tab* 键(verify 字面锚点)
|
|
1122
|
+
return h('div', { className: 'ssm-s-settings' },
|
|
1123
|
+
h('div', { className: 'ssm-s-tabs' }, tabBtn('library', t('tabLibrary')), tabBtn('global', t('tabGlobal')), tabBtn('ops', t('tabOps')), tabBtn('diag', t('tabDiag'))),
|
|
1124
|
+
h(TaskStrip, { t, tasks }), // 条子挂在页签下方:切到任何页签都看得见(Review Focus #1/#5)
|
|
1125
|
+
msg ? h('div', { className: `ssm-p-banner ${msg.kind === 'err' ? 'ssm-p-banner-error' : 'ssm-p-banner-ok'}` }, h(Icon, { n: msg.kind === 'err' ? 'alert' : 'check' }), msg.text) : null, // msg 换 banner 语态:成功 ok 底、失败 error 底(spec §6.4)
|
|
1126
|
+
tab === 'library' ? h(React.Fragment, null,
|
|
1127
|
+
h('div', { className: 'ssm-p-row' }, // 过滤框换同款 .ssm-p-search(spec §6.5);宽度归 flex-basis 管,不再 inline maxWidth
|
|
1128
|
+
h('input', { className: 'ssm-p-search', placeholder: t('filterPh'), value: filter, 'aria-label': t('filterPh'), onChange: (e) => setFilter(e.target.value) }),
|
|
1129
|
+
// 批量检查更新(GLOSSARY「批量检查更新」):每仓一拉长任务;清空上游缓存 = 纯本地 IO 普通 call(加固 T5)
|
|
1130
|
+
h('button', { className: 'ssm-s-btn', disabled: locked, title: busyTitle, onClick: () => startLong(ctx, 'updateCheckAll', t('batchCheckUpd'), {}, { onDone: (s) => { if (s.ok) mergeChkAll(s.value); } }) }, t('batchCheckUpd')),
|
|
1131
|
+
h('button', { className: 'ssm-p-icon-btn', disabled: locked, title: iTitle(t('clearCache')), 'aria-label': t('clearCache'), onClick: () => run('cacheClear', async () => { await call(ctx, 'cacheClear', {}); }) }, h(Icon, { n: 'trash' }))),
|
|
1132
|
+
// P3 翻译入口(设计 §6.1:默认关出网,手动批量)+ agents 存量迁移向导(§6.6,Task 5 RPC)
|
|
1133
|
+
// 翻译行同迁新语态(评审 2026-11-07:库页签内容属本任务,禁「半迁移裂缝」):
|
|
1134
|
+
// 按钮走 .ssm-s-btn(.ssm-p-row>button 的特异性坑已由 .ssm-p-row>.ssm-s-btn 抬回规则接住)、
|
|
1135
|
+
// select 复用 .ssm-p-search 同款底样、计数提示走 .ssm-p-desc。RPC 与分组/并发流程一字未动。
|
|
1136
|
+
h('div', { className: 'ssm-p-row' },
|
|
1137
|
+
h('button', { className: 'ssm-s-btn', disabled: locked, title: iTitle(t('batchTranslate')), onClick: () => run('trP', async () => { const p = await call(ctx, 'translatePending', {}); const m = await call(ctx, 'translateModels', {}).catch(() => ({ options: [] })); setTr({ pending: p.pending ?? [], failed: p.failed ?? [], models: m, model: '', result: null }); }) }, t('batchTranslate')),
|
|
1138
|
+
(tr?.pending?.length || tr?.failed?.length)
|
|
1139
|
+
? h(React.Fragment, null,
|
|
1140
|
+
h('select', { className: 'ssm-p-search', style: { flex: '0 1 280px', maxWidth: 280 }, disabled: locked, title: t('modelSelect'), 'aria-label': t('modelSelect'), value: tr.model, onChange: (e) => setTr({ ...tr, model: e.target.value }) },
|
|
1141
|
+
h('option', { value: '' }, t('currentModel')),
|
|
1142
|
+
...(tr.models?.options ?? []).map((o, i) => h('option', { key: `${o.provider}/${o.model}`, value: String(i) }, o.label))), // N7:value 用下标,免 provider/model 含 | 时碎裂
|
|
1143
|
+
tr.failed?.length ? h('span', { className: 'ssm-p-desc' }, `${tr.failed.length} ${t('failedRetryable')}`) : null,
|
|
1144
|
+
h('button', { className: 'ssm-s-btn', disabled: locked, title: iTitle(t('translateGo')), onClick: () => run('trR', async () => {
|
|
1145
|
+
const o = tr.model !== '' ? (tr.models?.options ?? [])[Number(tr.model)] ?? null : null; // M2:pending ∪ failed 一并(failed 同哈希不自愈,此处即重试入口,AC#2)
|
|
1146
|
+
const names = [...(tr.pending ?? []).map((p) => p.name), ...(tr.failed ?? []).map((f) => f.name)];
|
|
1147
|
+
// 分组 RPC(每组 5 条 = host 一个 prompt,reasoning 模型思考次数 ÷5)+ 并发 2:
|
|
1148
|
+
// 每组返回即刷进度;host 组内即落盘,停止不丢已完成(用户反馈 2026-10-26:无进度 + 逐条太慢)
|
|
1149
|
+
trStop.current = false;
|
|
1150
|
+
const base = { ...tr, result: null };
|
|
1151
|
+
const st = { done: [], failed: [], running: [] };
|
|
1152
|
+
let i = 0;
|
|
1153
|
+
const paint = () => setTr({ ...base, progress: { total: names.length, done: st.done.length, failed: st.failed.length, running: st.running.slice(), stopping: trStop.current } });
|
|
1154
|
+
paint();
|
|
1155
|
+
const worker = async () => {
|
|
1156
|
+
while (i < names.length && !trStop.current) {
|
|
1157
|
+
const g = names.slice(i, i + 5); i += g.length;
|
|
1158
|
+
st.running.push(...g); paint();
|
|
1159
|
+
try {
|
|
1160
|
+
const r = await call(ctx, 'translateRun', { names: g, provider: o?.provider ?? null, model: o?.model ?? null });
|
|
1161
|
+
if (r?.done?.length) st.done.push(...r.done);
|
|
1162
|
+
st.failed.push(...(r?.failed ?? []));
|
|
1163
|
+
} catch (e) { g.forEach((n) => st.failed.push({ name: n, error: String(e?.message ?? e) })); }
|
|
1164
|
+
st.running = st.running.filter((x) => !g.includes(x)); paint();
|
|
1165
|
+
}
|
|
1166
|
+
};
|
|
1167
|
+
await Promise.all([worker(), worker()]);
|
|
1168
|
+
const stopped = trStop.current; trStop.current = false;
|
|
1169
|
+
setTr({ ...base, progress: null, result: { done: st.done, failed: st.failed, skipped: stopped ? names.length - st.done.length - st.failed.length : 0 } });
|
|
1170
|
+
await load();
|
|
1171
|
+
}) }, `${t('translateGo')}(${(tr.pending?.length ?? 0) + (tr.failed?.length ?? 0)})`),
|
|
1172
|
+
tr?.progress ? h('button', { className: 'ssm-s-btn', disabled: !tr.progress, onClick: () => { trStop.current = true; } }, t('translateStop')) : null)
|
|
1173
|
+
: null),
|
|
1174
|
+
// 进行中 = banner 语态 + 转圈(与 TaskStrip 同族信号);逐行 running 名单走 .ssm-p-desc
|
|
1175
|
+
tr?.progress
|
|
1176
|
+
? h(React.Fragment, null,
|
|
1177
|
+
h('div', { className: 'ssm-p-banner ssm-p-banner-muted' }, h('span', { className: 'ssm-spin' }, null),
|
|
1178
|
+
`${t('translateProgress')} ${tr.progress.done + tr.progress.failed}/${tr.progress.total}(✓${tr.progress.done} ×${tr.progress.failed})${tr.progress.stopping ? ` · ${t('translateStopping')}` : ''}`),
|
|
1179
|
+
tr.progress.running.length ? h('div', { className: 'ssm-p-desc' }, `⋯ ${tr.progress.running.slice(0, 2).join(', ')}${tr.progress.running.length > 2 ? ` +${tr.progress.running.length - 2}` : ''}`) : null)
|
|
1180
|
+
: null,
|
|
1181
|
+
// 结果 = banner 语态:全成就 ok,有可重试失败就 warn;失败明细逐行(key 照旧)
|
|
1182
|
+
tr?.result
|
|
1183
|
+
? h(React.Fragment, null,
|
|
1184
|
+
h('div', { className: `ssm-p-banner ${(tr.result.failed ?? []).length ? 'ssm-p-banner-warn' : 'ssm-p-banner-ok'}` },
|
|
1185
|
+
h(Icon, { n: (tr.result.failed ?? []).length ? 'alert' : 'check' }),
|
|
1186
|
+
`${t('translateDone')}: ✓${(tr.result.done ?? []).length} ×${(tr.result.failed ?? []).length}${tr.result.skipped ? ` ⏭${tr.result.skipped}` : ''}`),
|
|
1187
|
+
...(tr.result.failed ?? []).map((f) => h('div', { key: f.name, className: 'ssm-p-desc' }, `${f.name}: ${f.error ?? ''}`)))
|
|
1188
|
+
: null,
|
|
1189
|
+
h('div', { className: 'ssm-p-desc' }, t('autoTranslateHint')),
|
|
1190
|
+
// 批量检查失败 banner(加固 T5):仓库级失败可一键重试(sources 子集只拉失败仓库);
|
|
1191
|
+
// 行级失败(上游删了该技能)逐行 muted 列出,不伪装成检查通过
|
|
1192
|
+
chkFail ? h(React.Fragment, null,
|
|
1193
|
+
h('div', { className: 'ssm-p-banner ssm-p-banner-warn' },
|
|
1194
|
+
h(Icon, { n: 'alert' }),
|
|
1195
|
+
t('checkUpdFailed').replace('{n}', String(chkFail.failed.length)),
|
|
1196
|
+
chkFail.failed.length ? h('button', { className: 'ssm-p-banner-cta', disabled: locked, title: busyTitle, onClick: () => startLong(ctx, 'updateCheckAll', t('retryFailedSrcs'), { sources: chkFail.failed.map((x) => x.source) }, { onDone: (s) => { if (s.ok) mergeChkAll(s.value, chkFail.failed.map((x) => x.source)); } }) }, t('retryFailedSrcs')) : null),
|
|
1197
|
+
...chkFail.failed.map((x) => h('div', { key: x.source, className: 'ssm-p-desc', title: x.error }, `${x.source}: ${x.error}`)),
|
|
1198
|
+
...chkFail.errors.map((x) => h('div', { key: x, className: 'ssm-p-desc' }, x))) : null,
|
|
1199
|
+
// 空态(§6.5 同款 .ssm-p-empty + 图标):库为空=引导去安装;有过滤词无命中=没有匹配
|
|
1200
|
+
lib === null ? h('div', { className: 'ssm-p-empty' }, h(Icon, { n: 'refresh' }), t('sLoading'))
|
|
1201
|
+
: rows.length === 0 ? h('div', { className: 'ssm-p-empty' }, h(Icon, { n: filter.trim() ? 'search' : 'box' }), filter.trim() ? t('emptySearch') : t('sEmptyLib')) : null,
|
|
1202
|
+
// 技能行 = 行壳卡片(spec §6.5):徽章组 + 中文用途第二行 + 图标动作条;状态变体(认领编辑/diff/confirm/回收站)
|
|
1203
|
+
// 一律经 RowShell 的 sub 槽嵌进同一张卡——操作前后不掉样式(AC#3);RPC 调用面与参数字面一字未动。
|
|
1204
|
+
...rows.map((x) => {
|
|
1205
|
+
const isGh = String(x.source).startsWith('github:');
|
|
1206
|
+
const chk = rowBusy('updateCheck', x.name);
|
|
1207
|
+
const ap = rowBusy('updateApply', x.name);
|
|
1208
|
+
const up = upRes[x.name];
|
|
1209
|
+
// 徽章组(§6.5):受管 brand / 未登记(本地技能,GLOSSARY「本地技能 = Unmanaged Skill」)muted /
|
|
1210
|
+
// 本地改动 warn / 目录缺 SKILL.md(不会被加载,diagnose structure 同款判定)error
|
|
1211
|
+
const badges = [x.managed ? { kind: 'brand', text: t('managedTag') } : { kind: 'muted', text: t('unmanagedTag') }];
|
|
1212
|
+
if (x.localModified) badges.push({ kind: 'warn', text: t('modifiedTag') });
|
|
1213
|
+
if (x.hasSkillMd === false) badges.push({ kind: 'error', text: t('rpDead') });
|
|
1214
|
+
// 第二行中文用途(§6.1 同款回退:未翻译显英文 + 待翻译角标)
|
|
1215
|
+
const desc = x.descriptionZh
|
|
1216
|
+
? h('div', { className: 'ssm-p-desc', title: x.description ?? undefined }, x.descriptionZh)
|
|
1217
|
+
: x.description
|
|
1218
|
+
? h('div', { className: 'ssm-p-desc', title: x.description }, x.description, ' ', h(PBadge, { kind: 'muted', text: t('pendingTag') }))
|
|
1219
|
+
: null;
|
|
1220
|
+
// hover title = 来源 @commit(7)(§6.5):本地/占位行无来源可展示,回落中文/名称(同款拼法)
|
|
1221
|
+
const srcTitle = x.source === 'unknown' || x.source === 'placeholder'
|
|
1222
|
+
? (x.descriptionZh ?? x.name)
|
|
1223
|
+
: `${String(x.source).replace('github:', '')}${x.commit ? ` @${String(x.commit).slice(0, 7)}` : ''}`;
|
|
1224
|
+
return h(RowShell, {
|
|
1225
|
+
key: x.name, t, name: x.name, badges, desc, title: srcTitle,
|
|
1226
|
+
// 动作条 = 图标按钮 + aria/title(§6.5):检查更新 download / 回收站 trash / 改认领 pencil / 卸载 trash-danger
|
|
1227
|
+
actions: [
|
|
1228
|
+
isGh ? h('button', { className: 'ssm-p-icon-btn', disabled: locked, title: chk ? t('checkingUp') : iTitle(t('sAriaCheckUpd')), 'aria-label': t('sAriaCheckUpd'), onClick: () => startLong(ctx, 'updateCheck', x.name, { name: x.name }, { onDone: (s) => { if (s.ok) setUpRes((m) => ({ ...m, [x.name]: s.value })); } }) }, chk ? h('span', { className: 'ssm-spin' }, null) : h(Icon, { n: 'download' })) : null,
|
|
1229
|
+
// 应用更新 = 拉远端写回本地,图标用 upload 与「检查更新」的 download 区分(两个都是 download 会读成同一件事)
|
|
1230
|
+
up && !up.upToDate ? h('button', { className: 'ssm-p-icon-btn', disabled: locked, title: ap ? t('applyingUp') : iTitle(t('applyUp')), 'aria-label': t('applyUp'), onClick: () => startLong(ctx, 'updateApply', x.name, { name: x.name }, {
|
|
1231
|
+
noteOf: (s) => s.ok && s.value?.backup ? `${t('opDone')} · ${t('backupAt')} ${s.value.backup}` : null,
|
|
1232
|
+
onDone: (s) => {
|
|
1233
|
+
if (!s.ok) return; // 失败由 TaskStrip 染红并报原因,不再被 run() 的 catch 混成「操作失败」
|
|
1234
|
+
setUpRes((m) => ({ ...m, [x.name]: null }));
|
|
1235
|
+
load();
|
|
1236
|
+
},
|
|
1237
|
+
}) }, ap ? h('span', { className: 'ssm-spin' }, null) : h(Icon, { n: 'upload' })) : null,
|
|
1238
|
+
x.backupCount ? h('button', { className: 'ssm-p-icon-btn', disabled: locked, title: iTitle(`${t('backupsTitle')}(${x.backupCount})`), 'aria-label': t('sAriaTrashBin'), onClick: () => {
|
|
1239
|
+
if (backupsOf?.name === x.name) { setBackupsOf(null); return; }
|
|
1240
|
+
run(`bk:${x.name}`, async () => setBackupsOf({ name: x.name, list: (await call(ctx, 'backupsList', { name: x.name })).backups ?? [] }));
|
|
1241
|
+
} }, h(Icon, { n: 'trash' })) : null,
|
|
1242
|
+
h('button', { className: 'ssm-p-icon-btn', disabled: locked, title: iTitle(isGh ? t('sAriaClaim') : t('claimGo')), 'aria-label': isGh ? t('sAriaClaim') : t('claimGo'), onClick: () => {
|
|
1243
|
+
const on = claimOf === x.name;
|
|
1244
|
+
setClaimOf(on ? null : x.name);
|
|
1245
|
+
// github 行预填现值(改认领:换来源或补 commit),本地/占位行留空
|
|
1246
|
+
if (!on) setClaimDraft({ source: isGh ? String(x.source) : '', commit: x.commit ? String(x.commit) : '' });
|
|
1247
|
+
} }, h(Icon, { n: 'pencil' })),
|
|
1248
|
+
h('button', { className: 'ssm-p-icon-btn ssm-p-icon-danger', disabled: locked, title: iTitle(t('sAriaUninstall')), 'aria-label': t('sAriaUninstall'), onClick: () => setConfirmUn(x.name) }, h(Icon, { n: 'trash' })),
|
|
1249
|
+
],
|
|
1250
|
+
sub: h(React.Fragment, null,
|
|
1251
|
+
// 行内认领来源(§8.1):输入行嵌进卡内,保存/撤认领/取消收进图标钮(Electron 无 window.prompt,§6.4)
|
|
1252
|
+
claimOf === x.name
|
|
1253
|
+
? h(React.Fragment, null,
|
|
1254
|
+
h('div', { className: 'ssm-p-row' },
|
|
1255
|
+
h('input', { className: 'ssm-p-search', style: { maxWidth: 230 }, autoFocus: true, placeholder: t('claimSourcePh'), value: claimDraft.source, disabled: locked, 'aria-label': t('claimSourcePh'), onChange: (e) => setClaimDraft({ ...claimDraft, source: e.target.value }) }),
|
|
1256
|
+
h('input', { className: 'ssm-p-search', style: { maxWidth: 120 }, placeholder: t('claimCommitPh'), value: claimDraft.commit, disabled: locked, 'aria-label': t('claimCommitPh'), onChange: (e) => setClaimDraft({ ...claimDraft, commit: e.target.value }) }),
|
|
1257
|
+
h('button', { className: 'ssm-p-icon-btn', disabled: locked || !claimDraft.source.trim(), title: iTitle(t('saveBtn')), 'aria-label': t('saveBtn'), onClick: () => run(`claim:${x.name}`, async () => { await call(ctx, 'claimSource', { name: x.name, source: claimDraft.source.trim(), commit: claimDraft.commit.trim() || null }); setClaimOf(null); await load(); }) }, h(Icon, { n: 'check' })),
|
|
1258
|
+
x.source !== 'unknown' && x.source !== 'placeholder'
|
|
1259
|
+
? h('button', { className: 'ssm-p-icon-btn', disabled: locked, title: iTitle(t('claimUndo')), 'aria-label': t('claimUndo'), onClick: () => run(`claim:${x.name}`, async () => { await call(ctx, 'claimSource', { name: x.name, source: 'unknown' }); setClaimOf(null); await load(); }) }, h(Icon, { n: 'undo' }))
|
|
1260
|
+
: null,
|
|
1261
|
+
h('button', { className: 'ssm-p-icon-btn', disabled: locked, title: t('close'), 'aria-label': t('close'), onClick: () => setClaimOf(null) }, h(Icon, { n: 'x' }))),
|
|
1262
|
+
h('div', { className: 'ssm-p-desc' }, t('claimHint')))
|
|
1263
|
+
: null,
|
|
1264
|
+
// 检查更新结果 = banner 语态(§6.5);文件级 diff 名单仍逐行(§13.6 / review m5)
|
|
1265
|
+
up
|
|
1266
|
+
? h(React.Fragment, null,
|
|
1267
|
+
h('div', { className: 'ssm-p-banner ssm-p-banner-muted' }, h(Icon, { n: 'download' }), up.upToDate
|
|
1268
|
+
? (() => {
|
|
1269
|
+
const sk = counts(up.files)['skip-modified'];
|
|
1270
|
+
return `${t('upToDate')} @${String(up.current ?? '').slice(0, 7)}${sk ? ` ⚠ ${sk} ${t('skipNote')}` : ''}`;
|
|
1271
|
+
})()
|
|
1272
|
+
: (() => {
|
|
1273
|
+
const c = counts(up.files);
|
|
1274
|
+
// 远端 commit 前进了但一个文件都没变(或来源是认领的、current 为空无法比 commit):
|
|
1275
|
+
// 报「差异 ↑0 +0 −0」会被读成“有更新可装”,直说内容已一致(用户报告 2026-10-26 连带场景)
|
|
1276
|
+
if (!c.update && !c.add && !c.remove && !c['skip-modified'])
|
|
1277
|
+
return `${t('noContentDiff')} → @${String(up.remote ?? '').slice(0, 7)}${up.current ? '' : `(${t('claimNoCommit')})`}`;
|
|
1278
|
+
return `${t('upActions')}: ↑${c.update} +${c.add} −${c.remove} ⚠${c['skip-modified']} → ${String(up.remote ?? '').slice(0, 7)}${c['skip-modified'] ? ` (${t('skipNote')})` : ''}`;
|
|
1279
|
+
})()),
|
|
1280
|
+
...(up.files ?? []).filter((f) => f.action !== 'same').slice(0, 15)
|
|
1281
|
+
.map((f) => h('div', { key: f.path, className: 'ssm-p-desc' }, `${f.action === 'skip-modified' ? '⚠' : f.action === 'update' ? '↑' : f.action === 'add' ? '+' : '−'} ${f.path}`)),
|
|
1282
|
+
(up.files ?? []).filter((f) => f.action !== 'same').length > 15 ? h('div', { className: 'ssm-p-desc' }, t('moreFiles')) : null)
|
|
1283
|
+
: null,
|
|
1284
|
+
// 卸载二次确认(§6.5):banner 语态 + 常驻可见——动作条是 hover 显形,确认条不能被藏;文案与流程照旧
|
|
1285
|
+
confirmUn === x.name
|
|
1286
|
+
? h('div', { className: 'ssm-p-banner ssm-p-banner-error' }, h(Icon, { n: 'alert' }), t('confirmUn'), ' ', x.name, ' ',
|
|
1287
|
+
h('button', { className: 'ssm-p-banner-cta', autoFocus: true, disabled: locked, title: busyTitle, onClick: () => startLong(ctx, 'uninstallSkill', x.name, { name: x.name }, { onDone: (s) => { if (!s.ok) return; setConfirmUn(null); setUpRes((m) => ({ ...m, [x.name]: null })); load(); } }) }, t('uninstallGo')),
|
|
1288
|
+
h('button', { onClick: () => setConfirmUn(null) }, '×'))
|
|
1289
|
+
: null,
|
|
1290
|
+
// 回收站展开(§6.5):行卡同款 + 备份标签胶囊 muted + 恢复按钮品牌软底复刻
|
|
1291
|
+
backupsOf?.name === x.name
|
|
1292
|
+
? h('div', { className: 'ssm-p-card' }, backupsOf.list.length === 0
|
|
1293
|
+
? h('div', { className: 'ssm-p-empty' }, h(Icon, { n: 'trash' }), t('none'))
|
|
1294
|
+
: backupsOf.list.map((b) => h(RowShell, {
|
|
1295
|
+
key: b.dir, t, name: b.ts, badges: [{ kind: 'muted', text: `(${b.fileCount})` }],
|
|
1296
|
+
actions: [h('button', { className: 'ssm-s-btn', disabled: locked, title: busyTitle ?? t('restoreGo'), 'aria-label': t('restoreGo'), onClick: () => run(`rs:${b.dir}`, async () => { await call(ctx, 'backupRestore', { name: x.name, dir: b.dir }); setBackupsOf(null); await load(); }) }, t('restoreGo'))],
|
|
1297
|
+
})))
|
|
1298
|
+
: null),
|
|
1299
|
+
});
|
|
1300
|
+
}),
|
|
1301
|
+
) : null,
|
|
1302
|
+
tab === 'global' ? h(React.Fragment, null, // P3 全局技能集 tab(spec §6.6):行卡 + 复选胶囊(选中 brand 软底),外来常驻灰态只读
|
|
1303
|
+
h('div', { className: 'ssm-p-descwrap' }, t('globalTabHint'), rTarget ? ` ${rTarget}` : ''),
|
|
1304
|
+
h('div', { className: 'ssm-p-row' }, // 过滤框/只看常驻换同款 .ssm-p-search + .ssm-p-check 语汇(§6.6)
|
|
1305
|
+
h('input', { className: 'ssm-p-search', placeholder: t('searchPh'), value: gq, disabled: locked, 'aria-label': t('searchPh'), onChange: (e) => setGq(e.target.value) }),
|
|
1306
|
+
h('label', { className: 'ssm-p-check' }, h('input', { type: 'checkbox', checked: gOnly, disabled: locked, onChange: (e) => setGOnly(e.target.checked) }), t('residentOnly'))),
|
|
1307
|
+
// 空态(§6.6 同款 .ssm-p-empty + 图标):无过滤词 = 引导勾选候选;有过滤词无命中 = 没有匹配
|
|
1308
|
+
grows.length === 0 ? h('div', { className: 'ssm-p-empty' }, h(Icon, { n: gq.trim() ? 'search' : 'box' }), gq.trim() ? t('emptySearch') : t('sEmptyGlobal')) : null,
|
|
1309
|
+
...grows.map((r) => {
|
|
1310
|
+
if (r.foreign) return h(RowShell, { key: r.name, t, name: r.name, gray: true, badges: [{ kind: 'warn', text: t('foreignRow') }] }); // N5:已在设置页内,不再挂「去设置管理」文案;灰态只读(§6.6)
|
|
1311
|
+
const on = resident.includes(r.name);
|
|
1312
|
+
// 描述第二行(用户反馈 2026-10-26:同行挤压显乱,与库 tab 同款回退口径)
|
|
1313
|
+
const desc = r.descriptionZh
|
|
1314
|
+
? h('div', { className: 'ssm-p-desc', title: r.description ?? undefined }, r.descriptionZh)
|
|
1315
|
+
: r.description
|
|
1316
|
+
? h('div', { className: 'ssm-p-desc', title: r.description }, r.description, ' ', h(PBadge, { kind: 'muted', text: t('pendingTag') }))
|
|
1317
|
+
: null;
|
|
1318
|
+
return h(RowShell, {
|
|
1319
|
+
key: r.name, t, name: r.name, desc,
|
|
1320
|
+
// 复选胶囊(§6.6):label 包住复选框即胶囊,选中态 brand 软底走新区变体 .ssm-p-check-on——
|
|
1321
|
+
// 不动 composer 在用的 .ssm-p-check 基样(AC#14 composer 观感零变化);setResident 勾选语义一字未动(AC#5)
|
|
1322
|
+
leading: h('label', { className: 'ssm-p-check' + (on ? ' ssm-p-check-on' : '') },
|
|
1323
|
+
h('input', { type: 'checkbox', checked: on, disabled: locked, 'aria-label': r.name, onChange: () => run(`res:${r.name}`, async () => {
|
|
1324
|
+
const next = on ? resident.filter((n) => n !== r.name) : [...resident, r.name];
|
|
1325
|
+
await call(ctx, 'setResident', { names: next });
|
|
1326
|
+
await loadState();
|
|
1327
|
+
}) })),
|
|
1328
|
+
// github 来源展示口径照旧:截断片段进第三行 muted 文本
|
|
1329
|
+
sub: String(r.source).startsWith('github:') ? h('div', { className: 'ssm-p-desc' }, String(r.source).replace('github:', '').slice(0, 20)) : null,
|
|
1330
|
+
});
|
|
1331
|
+
})) : null,
|
|
1332
|
+
tab === 'ops' ? h(React.Fragment, null, // 分节卡片化(spec §6.7):GitHub 安装 / 两级迁移各一张 .ssm-p-card;动作按钮 = 新区品牌软底复刻 .ssm-s-btn(.ssm-p-row>button 特异性坑由已入库 .ssm-p-row>.ssm-s-btn 抬回规则接住)
|
|
1333
|
+
h('div', { className: 'ssm-p-card' },
|
|
1334
|
+
h('div', { className: 'ssm-p-card-title' }, t('installTitle')),
|
|
1335
|
+
h('div', { className: 'ssm-p-row' },
|
|
1336
|
+
h('input', { className: 'ssm-p-search', placeholder: t('installSpecPh'), value: spec, disabled: locked, 'aria-label': t('installSpecPh'), onChange: (e) => setSpec(e.target.value) }),
|
|
1337
|
+
h('label', { className: 'ssm-p-check' }, h('input', { type: 'checkbox', checked: overwrite, disabled: locked, onChange: (e) => setOverwrite(e.target.checked) }), t('overwriteChk')),
|
|
1338
|
+
h('button', { className: 'ssm-s-btn', disabled: locked || !spec.trim(), title: busyTitle, onClick: () => { if (startLong(ctx, 'installApply', spec.trim(), { spec: spec.trim(), overwrite }, { noteOf: (s) => { const rs = s.ok ? s.value?.results ?? [] : []; const bad = rs.filter((r) => !r.ok).length; return bad ? t('opPartial').replace('{n}', String(rs.length - bad)).replace('{m}', String(bad)) : null; }, onDone: () => load() })) setSpec(''); } }, t('installGo'))),
|
|
1339
|
+
// 安装结果胶囊换 .ssm-p-tag-muted(§6.6);commit 短哈希与逐条 ✓/× reason 文案照旧
|
|
1340
|
+
// 安装结果徽章行允许换行(Task 5 转交:多条结果时 .ssm-p-row 不换行 → 徽章 flex:none 撑出横溢)
|
|
1341
|
+
instDone ? h('div', { className: 'ssm-p-row ssm-s-wrap' }, h('span', { className: 'ssm-p-desc' }, `@${String(instDone.commit ?? '').slice(0, 7)}`),
|
|
1342
|
+
...(instDone.results ?? []).map((r) => h(PBadge, { key: r.name, kind: 'muted', text: `${r.name}: ${r.ok ? '✓' : `× ${r.reason ?? ''}`}` }))) : null),
|
|
1343
|
+
h('div', { className: 'ssm-p-card' },
|
|
1344
|
+
h('div', { className: 'ssm-p-card-title' }, t('migrateAgentsTitle')),
|
|
1345
|
+
h('div', { className: 'ssm-p-row' },
|
|
1346
|
+
h('button', { className: 'ssm-s-btn', disabled: locked, title: busyTitle, onClick: () => run('migAP', async () => setMigA({ preview: await call(ctx, 'migrateAgentsPreview', {}), applied: false })) }, t('migrateAgentsGo')),
|
|
1347
|
+
migA?.applied ? h('button', { className: 'ssm-s-btn', disabled: locked, title: busyTitle, onClick: () => startLong(ctx, 'migrateAgentsUndo', null, {}, { onDone: (s) => { if (!s.ok) return; setMigA(null); load(); } }) }, t('migrateUndo')) : null,
|
|
1348
|
+
migA && !migA.applied ? h('button', { className: 'ssm-s-btn', disabled: locked || !(migA.preview?.moves?.length), title: busyTitle, onClick: () => startLong(ctx, 'migrateAgentsApply', null, {}, { onDone: (s) => { if (!s.ok) return; setMigA({ preview: null, applied: true }); load(); } }) }, t('migrateApply')) : null, // M3:空预览禁用执行(host 侧 null-ledger 崩溃已另修)
|
|
1349
|
+
!migA ? h('span', { className: 'ssm-p-desc' }, t('migrateAgentsHint')) : null),
|
|
1350
|
+
// 预览展示口径照旧(§13#6):moves/keep 名单、警告、notes 只换文本语态——
|
|
1351
|
+
// .ssm-p-descwrap 复刻旧 .ssm-hint(长名单不截断)、.ssm-p-warn 复刻旧 .ssm-warn-inline
|
|
1352
|
+
migA?.preview
|
|
1353
|
+
? h(React.Fragment, null,
|
|
1354
|
+
h('div', { className: 'ssm-p-descwrap' },
|
|
1355
|
+
`${t('migrateMoves')}: ${(migA.preview.moves ?? []).map((m) => m.name).join(', ') || t('none')};${t('migrateKeep')}: ${(migA.preview.keep ?? []).map((k) => `${k.name}(${keepReasonText(t, k.reason)})`).join(', ') || t('none')}`),
|
|
1356
|
+
...(migA.preview.warnings ?? []).map((w, i) => h('div', { key: 'ma' + i, className: 'ssm-p-warn' }, w)),
|
|
1357
|
+
...(migA.preview.notes ?? []).map((n, i) => h('div', { key: 'mn' + i, className: 'ssm-p-descwrap' }, n)))
|
|
1358
|
+
: null),
|
|
1359
|
+
h('div', { className: 'ssm-p-card' },
|
|
1360
|
+
h('div', { className: 'ssm-p-card-title' }, t('migrateTitle')),
|
|
1361
|
+
h('div', { className: 'ssm-p-row' },
|
|
1362
|
+
h('button', { className: 'ssm-s-btn', disabled: locked, title: busyTitle, onClick: () => run('migP', async () => setMig({ preview: await call(ctx, 'migratePreview', {}), applied: false })) }, t('migratePreview')),
|
|
1363
|
+
mig ? h('button', { className: 'ssm-s-btn', disabled: locked, title: busyTitle, onClick: () => startLong(ctx, mig.applied ? 'migrateUndo' : 'migrateApply', null, {}, { onDone: (s) => { if (!s.ok) return; setMig(null); load(); } }) }, mig.applied ? t('migrateUndo') : t('migrateApply')) : null),
|
|
1364
|
+
mig?.preview
|
|
1365
|
+
? h(React.Fragment, null,
|
|
1366
|
+
h('div', { className: 'ssm-p-descwrap' },
|
|
1367
|
+
`${t('migrateMoves')}: ${(mig.preview.moves ?? []).map((m) => m.name).join(', ') || t('none')};${t('migrateKeep')}: ${(mig.preview.keep ?? []).map((k) => k.name).join(', ') || t('none')}`),
|
|
1368
|
+
...(mig.preview.warnings ?? []).map((w, i) => h('div', { key: i, className: 'ssm-p-warn' }, w)))
|
|
1369
|
+
: null)
|
|
1370
|
+
) : null,
|
|
1371
|
+
tab === 'diag' ? h(React.Fragment, null,
|
|
1372
|
+
h('div', { className: 'ssm-p-row' }, // 动作按钮品牌软底复刻同款语态(§6.7/§6.8);无会话提示换 .ssm-p-desc
|
|
1373
|
+
h('button', { className: 'ssm-s-btn', disabled: locked || !bus.sessionId, title: busyTitle, onClick: () => run('diag', async () => setDiag(await call(ctx, 'diagnoseRun', sess()))) }, t('diagRun')),
|
|
1374
|
+
diag?.fixable?.reclaimDeadLinks?.count
|
|
1375
|
+
? h('button', { className: 'ssm-s-btn', disabled: locked || !bus.sessionId, title: busyTitle, onClick: () => run('reclaim', async () => { await call(ctx, 'reclaimDeadLinks', sess()); setDiag(await call(ctx, 'diagnoseRun', sess())); }) }, `${t('fixReclaim')}(${diag.fixable.reclaimDeadLinks.count})`)
|
|
1376
|
+
: null,
|
|
1377
|
+
h('button', { className: 'ssm-s-btn', disabled: locked || !bus.sessionId, title: busyTitle, onClick: () => run('rebuild', async () => { const r = await call(ctx, 'rebuildManaged', sess()); setDiag(await call(ctx, 'diagnoseRun', sess())); return r; }) }, t('fixRebuild')),
|
|
1378
|
+
!bus.sessionId ? h('span', { className: 'ssm-p-desc' }, t('noSession')) : null),
|
|
1379
|
+
diag
|
|
1380
|
+
? h(React.Fragment, null, ...Object.entries({ // 六类分组各一节卡片(§6.8):节标题 .ssm-p-card-title + 计数;每条诊断 = 行卡,左角色点 .ssm-p-lvl* 复刻旧 .ssm-lvl* 语义(token 配色升级)
|
|
1381
|
+
partition: t('diagPartition'), copies: t('diagCopies'), dangling: t('diagDangling'),
|
|
1382
|
+
deadLinks: t('diagDeadLinks'), structure: t('diagStructure'), env: t('diagEnv'),
|
|
1383
|
+
}).map(([g, label]) => h('div', { key: g, className: 'ssm-p-card' },
|
|
1384
|
+
h('div', { className: 'ssm-p-card-title' }, label, h(PBadge, { kind: 'muted', text: String((diag.groups?.[g] ?? []).length) })),
|
|
1385
|
+
(diag.groups?.[g] ?? []).length === 0 ? h('div', { className: 'ssm-p-empty' }, h(Icon, { n: 'check' }), t('sEmptyDiag')) : null,
|
|
1386
|
+
// what 首行、where/fix 二三行展示保留(§13#7 可复制修复动作 = 可选中复制的文本行,语态照旧、不新增机制)
|
|
1387
|
+
...(diag.groups?.[g] ?? []).map((r, i) => h('div', { key: i, className: 'ssm-p-rowcard' },
|
|
1388
|
+
h('div', { className: 'ssm-p-row' },
|
|
1389
|
+
h('span', { className: `ssm-p-lvl ssm-p-lvl-${r.level}` }, null),
|
|
1390
|
+
h('span', null, r.what)),
|
|
1391
|
+
r.where ? h('div', { className: 'ssm-p-descwrap' }, r.where) : null,
|
|
1392
|
+
r.fix ? h('div', { className: 'ssm-p-descwrap' }, r.fix) : null)))))
|
|
1393
|
+
: null
|
|
1394
|
+
) : null);
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
const CSS = `
|
|
1398
|
+
.ssm-chip-btn{display:inline-flex;align-items:center;gap:5px;font:inherit;font-size:12px;color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l2);padding:3px 9px;border-radius:999px;cursor:pointer}
|
|
1399
|
+
.ssm-chip-btn:hover{background:color-mix(in srgb, var(--dsw-alias-brand-primary) 10%, transparent);border-color:color-mix(in srgb, var(--dsw-alias-brand-primary) 60%, transparent);color:var(--dsw-alias-label-primary)}
|
|
1400
|
+
.ssm-dot{width:7px;height:7px;border-radius:50%;display:inline-block;flex:none}
|
|
1401
|
+
.ssm-dot-ok{background:var(--dsw-alias-state-success-primary,#22c55e)}.ssm-dot-red{background:var(--dsw-alias-state-error-primary,#e5484d)}.ssm-dot-idle{background:var(--dsw-alias-label-secondary)}
|
|
1402
|
+
.ssm-cur{color:var(--dsw-alias-label-primary);font-weight:600;max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
1403
|
+
.ssm-badge{min-width:14px;height:14px;border-radius:7px;background:var(--dsw-alias-state-error-primary,#e5484d);color:#fff;font-size:10px;display:inline-flex;align-items:center;justify-content:center;padding:0 4px}
|
|
1404
|
+
.ssm-grow{flex:1}
|
|
1405
|
+
.ssm-warn-inline{color:var(--dsw-alias-state-warn-primary,#f5a623)}
|
|
1406
|
+
.ssm-spin{display:inline-block;width:.7em;height:.7em;border:1.5px solid currentColor;border-top-color:transparent;border-radius:50%;animation:ssm-spin .7s linear infinite;vertical-align:-1px;margin-right:5px}
|
|
1407
|
+
@keyframes ssm-spin{to{transform:rotate(360deg)}}
|
|
1408
|
+
.ssm-bar{height:5px;border-radius:999px;background:color-mix(in srgb,var(--dsw-alias-label-primary) 12%,transparent);overflow:hidden}
|
|
1409
|
+
.ssm-bar-fill{height:100%;border-radius:999px;background:var(--dsw-alias-brand-primary);transition:width .4s}
|
|
1410
|
+
.ssm-bar-ok{background:var(--dsw-alias-state-success-primary,#22c55e)}
|
|
1411
|
+
.ssm-bar-err{background:var(--dsw-alias-state-error-primary,#e5484d)}
|
|
1412
|
+
.ssm-warn{font-size:11px;padding:4px 6px;border-radius:6px;background:color-mix(in srgb,var(--dsw-alias-state-warn-primary,#f5a623) 18%,transparent)} /* 只剩 io 预览警告行在用;.ssm-err 随 TaskStrip 明细行迁 banner 语态退役(Task 6.3) */
|
|
1413
|
+
.ssm-hint{font-size:10px;color:var(--dsw-alias-label-secondary)}
|
|
1414
|
+
.ssm-row{display:flex;align-items:center;gap:4px;font-size:12px}
|
|
1415
|
+
.ssm-n{color:var(--dsw-alias-label-secondary);font-size:11px}
|
|
1416
|
+
.ssm-row button{font:inherit;font-size:11px;color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--dsw-alias-brand-primary) 18%, transparent);border:1px solid color-mix(in srgb, var(--dsw-alias-brand-primary) 50%, transparent);border-radius:6px;padding:4px 10px;cursor:pointer} /* 品牌色软底(用户 2026-10-26:要一眼可辨的按钮;原 :not() 豁免随其目标类删除一并简化,同款复刻见新区 .ssm-s-btn) */
|
|
1417
|
+
.ssm-row button:hover{background:color-mix(in srgb, var(--dsw-alias-brand-primary) 30%, transparent);border-color:color-mix(in srgb, var(--dsw-alias-brand-primary) 70%, transparent)}
|
|
1418
|
+
.ssm-row button.ssm-danger,.ssm-confirm button.ssm-danger{color:var(--dsw-alias-state-error-primary);background:color-mix(in srgb, var(--dsw-alias-state-error-primary) 16%, transparent);border:1px solid color-mix(in srgb, var(--dsw-alias-state-error-primary) 55%, transparent)} /* 高危操作(解绑/卸载/删除)错误色(用户 2026-10-26);.ssm-settings … 片段随设置页迁移退役(Task 6.3:多选择器规则只摘死片段) */
|
|
1419
|
+
.ssm-row button.ssm-danger:hover,.ssm-confirm button.ssm-danger:hover{background:color-mix(in srgb, var(--dsw-alias-state-error-primary) 28%, transparent);border-color:color-mix(in srgb, var(--dsw-alias-state-error-primary) 75%, transparent)}
|
|
1420
|
+
.ssm-input{flex:1;font:inherit;font-size:12px;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l2);border-radius:6px;padding:4px 7px;min-width:0}
|
|
1421
|
+
.ssm-io{display:flex;flex-direction:column;gap:6px;margin:6px 0}
|
|
1422
|
+
.ssm-textarea{width:100%;box-sizing:border-box;resize:vertical;font:11px/1.5 ui-monospace,Consolas,monospace;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l2);border-radius:6px;padding:6px 8px}
|
|
1423
|
+
.ssm-ok{font-size:11px;color:var(--dsw-alias-state-success-primary,#22c55e)}
|
|
1424
|
+
.ssm-confirm{font-size:11px;padding:5px 7px;border-radius:6px;background:var(--dsw-alias-bg-layer-1);display:flex;gap:6px;align-items:center;flex-wrap:wrap}
|
|
1425
|
+
.ssm-confirm button{font:inherit;font-size:11px;border:1px solid var(--dsw-alias-border-l2);background:color-mix(in srgb, var(--dsw-alias-label-primary) 12%, transparent);color:var(--dsw-alias-label-primary);border-radius:6px;padding:3px 8px;cursor:pointer}
|
|
1426
|
+
/* 面板美化(spec 2026-11-06 · ADR-0004):新结构全部 .ssm-p-* 原子件 + 页面布局类 .ssm-s-*(spec 2026-11-07 §6.1 白名单);
|
|
1427
|
+
旧 .ssm-* 只留 composer Panel/TaskStrip 仍在用的(§5.5 使用矩阵)——设置页/右栏迁移后归零的旧类与 .ssm-settings 后代规则已于 Task 6.3 删除,残留检查进 ui-gates ⑤ */
|
|
1428
|
+
.ssm-p-overlay{position:fixed;inset:0;z-index:1000;background:rgba(0,0,0,.35);backdrop-filter:blur(4px);display:flex;align-items:flex-end;justify-content:center;padding:0 12px 12px;pointer-events:auto}
|
|
1429
|
+
.ssm-p-panel{width:min(760px,94vw);max-height:78vh;overflow:auto;background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);border-radius:14px;padding:0 14px 10px;display:flex;flex-direction:column;gap:10px;box-shadow:0 16px 48px rgba(0,0,0,.4);font-size:13px;animation:ssm-pop .12s ease-out}
|
|
1430
|
+
@keyframes ssm-pop{from{transform:translateY(12px);opacity:0}to{transform:none;opacity:1}}
|
|
1431
|
+
@media (prefers-reduced-motion:reduce){.ssm-p-panel{animation:none}.ssm-p-skel{animation:none}}
|
|
1432
|
+
.ssm-p-head{position:sticky;top:0;z-index:3;display:flex;align-items:center;gap:8px;margin:0 -14px;padding:10px 14px;background:var(--dsw-alias-bg-layer-2);border-bottom:1px solid var(--dsw-alias-border-l2);border-radius:14px 14px 0 0;font-size:15px}
|
|
1433
|
+
.ssm-p-cur{font-size:15px;font-weight:600;color:var(--dsw-alias-label-primary);max-width:300px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
1434
|
+
.ssm-p-rootline{display:flex;align-items:center;gap:6px;font-size:11px;color:var(--dsw-alias-label-secondary);min-width:0}
|
|
1435
|
+
.ssm-p-rootline>span:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
1436
|
+
.ssm-p-card{border:1px solid var(--dsw-alias-border-l2);border-radius:12px;background:var(--dsw-alias-bg-layer-1);padding:8px 10px;display:flex;flex-direction:column;gap:6px}
|
|
1437
|
+
.ssm-p-card-title{display:flex;align-items:center;gap:8px;font-size:11px;font-weight:700;color:var(--dsw-alias-label-secondary)}
|
|
1438
|
+
.ssm-p-row{display:flex;align-items:center;gap:6px;font-size:13px;min-width:0}
|
|
1439
|
+
.ssm-p-desc{font-size:11px;color:var(--dsw-alias-label-secondary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
1440
|
+
.ssm-p-tag{font-size:10px;padding:1px 7px;border-radius:999px;border:1px solid transparent;flex:none;line-height:1.6}
|
|
1441
|
+
.ssm-p-tag-brand{color:var(--dsw-alias-brand-primary);background:color-mix(in srgb,var(--dsw-alias-brand-primary) 14%,transparent);border-color:color-mix(in srgb,var(--dsw-alias-brand-primary) 45%,transparent)}
|
|
1442
|
+
.ssm-p-tag-warn{color:var(--dsw-alias-state-warn-primary,#f5a623);background:color-mix(in srgb,var(--dsw-alias-state-warn-primary,#f5a623) 16%,transparent);border-color:color-mix(in srgb,var(--dsw-alias-state-warn-primary,#f5a623) 45%,transparent)}
|
|
1443
|
+
.ssm-p-tag-error{color:var(--dsw-alias-state-error-primary,#e5484d);background:color-mix(in srgb,var(--dsw-alias-state-error-primary,#e5484d) 14%,transparent);border-color:color-mix(in srgb,var(--dsw-alias-state-error-primary,#e5484d) 45%,transparent)}
|
|
1444
|
+
.ssm-p-tag-muted{color:var(--dsw-alias-label-secondary);background:color-mix(in srgb,var(--dsw-alias-label-primary) 8%,transparent);border-color:var(--dsw-alias-border-l2)}
|
|
1445
|
+
.ssm-p-check{display:flex;align-items:flex-start;gap:8px;border-radius:8px;padding:4px 6px;cursor:pointer}
|
|
1446
|
+
.ssm-p-check:hover{background:color-mix(in srgb,var(--dsw-alias-label-primary) 7%,transparent)}
|
|
1447
|
+
.ssm-p-check input[type=checkbox]{margin-top:3px;flex:none;accent-color:var(--dsw-alias-brand-primary)}
|
|
1448
|
+
.ssm-p-pick:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px;border-radius:6px}
|
|
1449
|
+
.ssm-p-search:focus-visible{outline:none;border-color:var(--dsw-alias-brand-primary)}
|
|
1450
|
+
.ssm-p-check:has(input:focus-visible){outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}
|
|
1451
|
+
.ssm-p-icon{flex:none}
|
|
1452
|
+
.ssm-p-icon-btn{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;flex:none;border:1px solid transparent;border-radius:6px;background:transparent;color:var(--dsw-alias-label-secondary);cursor:pointer;padding:0}
|
|
1453
|
+
.ssm-p-icon-btn:hover{background:color-mix(in srgb,var(--dsw-alias-label-primary) 12%,transparent);color:var(--dsw-alias-label-primary)}
|
|
1454
|
+
.ssm-p-icon-btn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}
|
|
1455
|
+
.ssm-p-icon-danger{color:var(--dsw-alias-state-error-primary,#e5484d)}
|
|
1456
|
+
.ssm-p-banner{display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:12px;padding:7px 10px;border-radius:10px;border:1px solid}
|
|
1457
|
+
.ssm-p-banner-warn{color:var(--dsw-alias-state-warn-primary,#f5a623);background:color-mix(in srgb,var(--dsw-alias-state-warn-primary,#f5a623) 12%,transparent);border-color:color-mix(in srgb,var(--dsw-alias-state-warn-primary,#f5a623) 40%,transparent)}
|
|
1458
|
+
.ssm-p-banner-error{color:var(--dsw-alias-state-error-primary,#e5484d);background:color-mix(in srgb,var(--dsw-alias-state-error-primary,#e5484d) 12%,transparent);border-color:color-mix(in srgb,var(--dsw-alias-state-error-primary,#e5484d) 40%,transparent)}
|
|
1459
|
+
.ssm-p-collapse{display:flex;align-items:center;gap:8px;width:100%;font:inherit;font-size:12px;color:var(--dsw-alias-label-secondary);padding:5px 6px;border:0;border-radius:8px;background:0;cursor:pointer;text-align:left}
|
|
1460
|
+
.ssm-p-collapse:hover{background:color-mix(in srgb,var(--dsw-alias-label-primary) 7%,transparent);color:var(--dsw-alias-label-primary)}
|
|
1461
|
+
.ssm-p-collapse:focus-visible{outline:2px solid var(--dsw-alias-brand-primary)}
|
|
1462
|
+
.ssm-p-collapse[aria-expanded="true"]>svg:last-of-type{transform:rotate(180deg)}
|
|
1463
|
+
.ssm-p-skel{height:34px;border-radius:8px;background:linear-gradient(90deg,color-mix(in srgb,var(--dsw-alias-label-primary) 8%,transparent) 25%,color-mix(in srgb,var(--dsw-alias-label-primary) 16%,transparent) 50%,color-mix(in srgb,var(--dsw-alias-label-primary) 8%,transparent) 75%);background-size:200% 100%;animation:ssm-skel 1.2s linear infinite}
|
|
1464
|
+
@keyframes ssm-skel{from{background-position:100% 0}to{background-position:-100% 0}}
|
|
1465
|
+
.ssm-p-actions{display:flex;align-items:center;gap:2px;flex-wrap:wrap;border-top:1px solid var(--dsw-alias-border-l2);padding-top:6px;margin-top:2px} /* flex-wrap:另存为展开行 width:100% 时独占一行,文字钮(另存为/解绑)上线后才不会把输入行挤扁(用户 2026-11-17) */
|
|
1466
|
+
.ssm-p-actions .ssm-p-icon-btn{opacity:1}
|
|
1467
|
+
.ssm-p-text-btn{display:inline-flex;align-items:center;gap:5px;flex:none;font:inherit;font-size:11px;color:var(--dsw-alias-label-primary);background:color-mix(in srgb,var(--dsw-alias-label-primary) 12%,transparent);border:1px solid var(--dsw-alias-border-l2);border-radius:6px;padding:3px 8px;cursor:pointer} /* 卡底主行动钮带文字(另存为/解绑),裸图标只留次级操作 */
|
|
1468
|
+
.ssm-p-text-btn:hover{background:color-mix(in srgb,var(--dsw-alias-label-primary) 20%,transparent)}
|
|
1469
|
+
.ssm-p-text-btn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}
|
|
1470
|
+
.ssm-p-text-btn:disabled{opacity:.55;cursor:default}
|
|
1471
|
+
.ssm-p-text-danger{color:var(--dsw-alias-state-error-primary,#e5484d)} /* 解绑=破坏性动作 error 色不填充底(ADR-0004 口径) */
|
|
1472
|
+
.ssm-p-setrow>.ssm-p-row .ssm-p-icon-btn{opacity:0;transition:opacity .12s}
|
|
1473
|
+
.ssm-p-setrow:hover>.ssm-p-row .ssm-p-icon-btn,.ssm-p-setrow:focus-within>.ssm-p-row .ssm-p-icon-btn{opacity:1}
|
|
1474
|
+
@media (prefers-reduced-motion:reduce){.ssm-p-setrow>.ssm-p-row .ssm-p-icon-btn{opacity:1;transition:none}}
|
|
1475
|
+
.ssm-p-setrow{border-radius:8px;padding:5px 6px;display:flex;flex-direction:column;gap:2px}
|
|
1476
|
+
.ssm-p-setrow:hover{background:color-mix(in srgb,var(--dsw-alias-label-primary) 7%,transparent)}
|
|
1477
|
+
.ssm-p-setrow-cur{border-left:2px solid var(--dsw-alias-brand-primary);background:color-mix(in srgb,var(--dsw-alias-brand-primary) 8%,transparent)}
|
|
1478
|
+
.ssm-p-row .ssm-p-pick{flex:1;display:flex;align-items:center;gap:8px;min-width:0;background:0;border:0;color:var(--dsw-alias-label-primary);cursor:pointer;padding:2px 0;text-align:left;font:inherit;font-size:13px}
|
|
1479
|
+
.ssm-p-row .ssm-p-pick:disabled{cursor:default}
|
|
1480
|
+
.ssm-p-row .ssm-p-pick:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px;border-radius:6px}
|
|
1481
|
+
.ssm-p-setname{font-weight:600;color:var(--dsw-alias-label-primary);max-width:230px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
1482
|
+
.ssm-p-banner button{font:inherit;font-size:11px;border:1px solid currentColor;border-radius:6px;background:transparent;color:inherit;padding:2px 8px;cursor:pointer;opacity:.85}
|
|
1483
|
+
.ssm-p-banner button:hover{opacity:1}
|
|
1484
|
+
.ssm-p-banner .ssm-p-banner-cta{background:color-mix(in srgb,var(--dsw-alias-state-error-primary,#e5484d) 26%,transparent);border-color:var(--dsw-alias-state-error-primary,#e5484d);color:var(--dsw-alias-label-primary);opacity:1} /* 卸载二次确认的破坏性动作钮强调变体(终审 Minor 2):error 软底实心,与同条 × 取消(透明描边)视觉可辨 */
|
|
1485
|
+
.ssm-p-banner .ssm-p-banner-cta:hover{background:color-mix(in srgb,var(--dsw-alias-state-error-primary,#e5484d) 38%,transparent);opacity:1}
|
|
1486
|
+
.ssm-p-banner .ssm-spin{margin:0} /* 转圈自带 margin-right:5px 与 banner gap:8px 叠加多约 13px(终审 Minor 观感):banner 内归零,间距交给 gap 统一 */
|
|
1487
|
+
.ssm-p-search{flex:0 1 220px;min-width:120px;font:inherit;font-size:12px;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l2);border-radius:999px;padding:3px 10px}
|
|
1488
|
+
.ssm-p-search:focus{outline:none;border-color:var(--dsw-alias-brand-primary)}
|
|
1489
|
+
.ssm-p-row>button{font:inherit;font-size:11px;border:1px solid var(--dsw-alias-border-l2);background:color-mix(in srgb,var(--dsw-alias-label-primary) 12%,transparent);color:var(--dsw-alias-label-primary);border-radius:6px;padding:3px 8px;cursor:pointer}
|
|
1490
|
+
.ssm-p-row>.ssm-p-icon-btn{background:transparent;border-color:transparent;color:var(--dsw-alias-label-secondary);width:24px;height:24px;padding:0}
|
|
1491
|
+
.ssm-p-row>button:hover{background:color-mix(in srgb,var(--dsw-alias-label-primary) 20%,transparent)}
|
|
1492
|
+
.ssm-p-row>.ssm-p-icon-btn:hover{background:color-mix(in srgb,var(--dsw-alias-label-primary) 12%,transparent);color:var(--dsw-alias-label-primary)}
|
|
1493
|
+
.ssm-p-gray{opacity:.55}
|
|
1494
|
+
.ssm-p-name{color:var(--dsw-alias-label-primary);font-size:13px;flex:none;max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
1495
|
+
.ssm-p-strike{text-decoration:line-through;color:var(--dsw-alias-label-secondary)}
|
|
1496
|
+
.ssm-p-seclabel{font-size:11px;font-weight:700;color:var(--dsw-alias-label-secondary);margin-top:4px}
|
|
1497
|
+
.ssm-p-empty{display:flex;align-items:center;gap:8px;padding:14px 6px;color:var(--dsw-alias-label-secondary);font-size:12px}
|
|
1498
|
+
.ssm-p-banner-muted{color:var(--dsw-alias-label-secondary);background:color-mix(in srgb,var(--dsw-alias-label-primary) 6%,transparent);border-color:var(--dsw-alias-border-l2)}
|
|
1499
|
+
/* 设置页+右栏美化基座(spec 2026-11-07 §6.2/§6.3):TaskStrip 横幅壳 + RowShell 行卡 + 品牌软底复刻 */
|
|
1500
|
+
.ssm-p-task{display:flex;flex-direction:column;gap:5px;padding:8px 10px;border:1px solid var(--dsw-alias-border-l2);border-radius:10px;background:var(--dsw-alias-bg-layer-1)}
|
|
1501
|
+
.ssm-p-task-row{display:flex;align-items:center;gap:6px;font-size:12px}
|
|
1502
|
+
.ssm-p-rowcard{display:flex;flex-direction:column;gap:1px;border-radius:8px;padding:4px 6px}
|
|
1503
|
+
.ssm-p-rowcard:hover{background:color-mix(in srgb,var(--dsw-alias-label-primary) 8%,transparent)}
|
|
1504
|
+
.ssm-p-rowcard.ssm-p-gray:not(.ssm-p-rowcard-click):hover{background:transparent} /* 灰态只读行(无 onClick:设置页外来常驻行 / 右栏 provider 灰行)不显 hover 底(终审 Minor 6):不可点的灰行用 hover 暗示可交互是误导;带 -click 的可点灰行不受此收窄影响 */
|
|
1505
|
+
.ssm-p-rowcard-click{cursor:pointer}
|
|
1506
|
+
.ssm-p-rowcard-click:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}
|
|
1507
|
+
/* composer 行卡(Task 6.1 收口)leading 槽裸复选框:首行居中(原 .ssm-p-check label 的 margin-top:3px 顶对齐语汇随 label 退役)、focus 环、禁用不手型 */
|
|
1508
|
+
.ssm-p-rowcard>.ssm-p-row>input[type=checkbox]{margin:0;flex:none;accent-color:var(--dsw-alias-brand-primary);cursor:pointer}
|
|
1509
|
+
.ssm-p-rowcard>.ssm-p-row>input[type=checkbox]:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}
|
|
1510
|
+
.ssm-p-rowcard>.ssm-p-row>input[type=checkbox]:disabled{cursor:default}
|
|
1511
|
+
.ssm-p-rowcard>.ssm-p-row>.ssm-p-icon-btn{opacity:0;transition:opacity .12s}
|
|
1512
|
+
.ssm-p-rowcard:hover>.ssm-p-row>.ssm-p-icon-btn,.ssm-p-rowcard:focus-within>.ssm-p-row>.ssm-p-icon-btn{opacity:1}
|
|
1513
|
+
@media (prefers-reduced-motion:reduce){.ssm-p-rowcard>.ssm-p-row>.ssm-p-icon-btn{opacity:1;transition:none}}
|
|
1514
|
+
.ssm-s-btn{font:inherit;font-size:11px;color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--dsw-alias-brand-primary) 18%, transparent);border:1px solid color-mix(in srgb, var(--dsw-alias-brand-primary) 50%, transparent);border-radius:6px;padding:4px 10px;cursor:pointer} /* 品牌软底复刻:供 .ssm-s-* 界面使用,承接旧区按钮软底选择器的 :not() 豁免职责(spec §5.5/§6.1) */
|
|
1515
|
+
.ssm-s-btn:hover{background:color-mix(in srgb, var(--dsw-alias-brand-primary) 30%, transparent);border-color:color-mix(in srgb, var(--dsw-alias-brand-primary) 70%, transparent)}
|
|
1516
|
+
/* 库页签(spec 2026-11-07 §6.5):行内品牌软底按钮需抬回——「.ssm-p-row>button」语态兜底比「.ssm-s-btn」高一级(回收站恢复按钮);图标钮内转圈去偏移 */
|
|
1517
|
+
.ssm-p-row>.ssm-s-btn{background:color-mix(in srgb,var(--dsw-alias-brand-primary) 18%,transparent);border-color:color-mix(in srgb,var(--dsw-alias-brand-primary) 50%,transparent);padding:4px 10px}
|
|
1518
|
+
.ssm-p-row>.ssm-s-btn:hover{background:color-mix(in srgb,var(--dsw-alias-brand-primary) 30%,transparent);border-color:color-mix(in srgb,var(--dsw-alias-brand-primary) 70%,transparent)}
|
|
1519
|
+
.ssm-p-icon-btn .ssm-spin{margin:0}
|
|
1520
|
+
/* 设置页壳 + 页签分段控件 + msg 横幅(spec 2026-11-07 §6.4):软底分段页签(选中 brand 14% 药丸、纯文字)+ banner ok 语态;根布局照旧 920px */
|
|
1521
|
+
.ssm-s-settings{display:flex;flex-direction:column;gap:8px;padding:4px 2px;max-width:920px}
|
|
1522
|
+
.ssm-s-tabs{display:flex;align-self:flex-start;gap:4px;padding:3px;border:1px solid var(--dsw-alias-border-l2);border-radius:10px;background:var(--dsw-alias-bg-layer-1)}
|
|
1523
|
+
.ssm-s-tab{font:inherit;font-size:12px;border:0;background:0;color:var(--dsw-alias-label-secondary);padding:5px 12px;border-radius:999px;cursor:pointer}
|
|
1524
|
+
.ssm-s-tab:hover{color:var(--dsw-alias-label-primary)}
|
|
1525
|
+
.ssm-s-tab-on{color:var(--dsw-alias-label-primary);background:color-mix(in srgb,var(--dsw-alias-brand-primary) 14%,transparent)}
|
|
1526
|
+
.ssm-s-tab:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}
|
|
1527
|
+
.ssm-p-banner-ok{color:var(--dsw-alias-state-success-primary,#22c55e);background:color-mix(in srgb,var(--dsw-alias-state-success-primary,#22c55e) 12%,transparent);border-color:color-mix(in srgb,var(--dsw-alias-state-success-primary,#22c55e) 40%,transparent)} /* 成功语态复刻(spec §6.4 msg ok 底;warn/error/muted 见上) */
|
|
1528
|
+
/* 全局/ops/diag 页签(spec 2026-11-07 §6.6–§6.8):复选胶囊选中态 brand 软底变体(不动 composer 在用的 .ssm-p-check 基样,AC#14 零变化)+ diag 角色点复刻 + 长文本语态复刻(旧 hint/warn-inline 只换名不换相) */
|
|
1529
|
+
.ssm-p-check-on{background:color-mix(in srgb,var(--dsw-alias-brand-primary) 14%,transparent)}
|
|
1530
|
+
.ssm-p-check-on:hover{background:color-mix(in srgb,var(--dsw-alias-brand-primary) 22%,transparent)}
|
|
1531
|
+
.ssm-p-lvl{width:7px;height:7px;border-radius:50%;flex:none;background:var(--dsw-alias-label-secondary)} /* 诊断角色点复刻(§6.8 token 配色升级):warn/error/info/未知级语义照旧 */
|
|
1532
|
+
.ssm-p-lvl-warn{background:var(--dsw-alias-state-warn-primary,#f5a623)}
|
|
1533
|
+
.ssm-p-lvl-error{background:var(--dsw-alias-state-error-primary,#e5484d)}
|
|
1534
|
+
.ssm-p-lvl-info{background:var(--dsw-alias-brand-primary)}
|
|
1535
|
+
.ssm-p-descwrap{font-size:11px;color:var(--dsw-alias-label-secondary);white-space:normal} /* 长文本语态(11px 次级色;旧 .ssm-hint 是 10px,收口时升一档,spec 2026-11-07 §6.5/§6.8):长名单/路径/where/fix 不截断(.ssm-p-desc 是 nowrap 兜底) */
|
|
1536
|
+
.ssm-p-warn{font-size:11px;color:var(--dsw-alias-state-warn-primary,#f5a623);white-space:normal} /* 旧 .ssm-warn-inline 复刻:迁移预览警告行 */
|
|
1537
|
+
/* 右栏详情 tab(spec 2026-11-07 §6.9):sticky 头 + 行卡 + 紧凑诊断;宽度由 betterSidebar 决定,本组类只管内(§5.7)——管内边距/滚动值照旧搬自旧 .ssm-rp(该类已随迁移退役) */
|
|
1538
|
+
.ssm-s-rp{display:flex;flex-direction:column;gap:6px;height:100%;overflow:auto;padding:6px 8px;font-size:12px}
|
|
1539
|
+
.ssm-s-head{position:sticky;top:0;z-index:2;display:flex;align-items:center;gap:8px;margin:0 -8px;padding:6px 8px;background:var(--dsw-alias-bg-layer-1);border-bottom:1px solid var(--dsw-alias-border-l2)} /* 头伸出管内边距成通栏(同款 .ssm-p-head 手法);opaque 底遮住滚动穿行的内容 */
|
|
1540
|
+
.ssm-s-dgrow{display:flex;align-items:center;gap:6px;font-size:11px;padding:2px 0;flex-wrap:wrap} /* 旧 .ssm-diag-row 复刻:诊断摘要紧凑行(5 组 × 前 3 条,不含 where/fix) */
|
|
1541
|
+
.ssm-p-ok{font-size:11px;color:var(--dsw-alias-state-success-primary,#22c55e)} /* 旧 .ssm-ok 复刻:rpSelf ok 语态 ✓ */
|
|
1542
|
+
.ssm-p-err{font-size:11px;color:var(--dsw-alias-state-error-primary,#e5484d);white-space:normal} /* 旧 .ssm-err 文本语态复刻(与 .ssm-p-warn 同族):rpSelf detail 行 */
|
|
1543
|
+
/* 多徽章结果行换行防横溢(Task 5 转交:ops 安装结果行;徽章 .ssm-p-tag 是 flex:none,长名单撑破 920px 卡宽) */
|
|
1544
|
+
.ssm-s-wrap{flex-wrap:wrap}
|
|
1545
|
+
`;
|
|
1546
|
+
|
|
1547
|
+
return {
|
|
1548
|
+
inject: ['slots', 'locale'],
|
|
1549
|
+
apply(ctx) {
|
|
1550
|
+
for (const [lang, dict] of Object.entries(DICTS)) ctx.effect(() => ctx.locale.register(PKG, lang, dict));
|
|
1551
|
+
ctx.effect(() => ctx.locale.register(PKG, 'zh-cn', DICTS.zh));
|
|
1552
|
+
const t = (key) => {
|
|
1553
|
+
const tr = ctx.locale.bind(PKG);
|
|
1554
|
+
const v = tr?.(key);
|
|
1555
|
+
return typeof v === 'string' && v !== key ? v : (DICTS.zh[key] ?? DICTS.en[key] ?? key);
|
|
1556
|
+
};
|
|
1557
|
+
ctx.effect(() => {
|
|
1558
|
+
const style = document.createElement('style');
|
|
1559
|
+
style.setAttribute('data-plugin', PKG);
|
|
1560
|
+
style.textContent = CSS;
|
|
1561
|
+
document.head.append(style);
|
|
1562
|
+
return () => style.remove();
|
|
1563
|
+
});
|
|
1564
|
+
// 右栏详情 tab(§12.209):betterSidebar 是第三方服务,启动顺序不保证——
|
|
1565
|
+
// apply 时取不到则每秒重试直到成功;注册 disposer 恒挂 ctx.effect(重复 id 抛错,泄漏即永久失去 tab)。
|
|
1566
|
+
ctx.effect(() => {
|
|
1567
|
+
const TAB_ID = 'skill-set-manager:detail'; // 命名空间 id:第三方 tab 类型惯例(review n1)
|
|
1568
|
+
let off = null;
|
|
1569
|
+
let warned = false;
|
|
1570
|
+
const tryReg = () => {
|
|
1571
|
+
const svc = ctx.get('betterSidebar');
|
|
1572
|
+
if (!svc) return false;
|
|
1573
|
+
try { off = svc.registerTab({
|
|
1574
|
+
id: TAB_ID,
|
|
1575
|
+
title: () => t('tabTitle'),
|
|
1576
|
+
description: () => t('tabDesc'),
|
|
1577
|
+
order: 40,
|
|
1578
|
+
single: true,
|
|
1579
|
+
// 刷新接线(用户报告 2026-10-27,betterSidebar 源码取证):surface 分支每次 openTab
|
|
1580
|
+
// (含已开 reveal)必发 onOpen;底栏分支激活既有 tab 发 onActivate——两钩子广播信号,
|
|
1581
|
+
// 常驻挂载的 tab 体据此重载,不再停在旧集快照(手动 ⟳ 仍保留)。
|
|
1582
|
+
onOpen: (_tab, scope) => bus.refresh(scope?.sessionId),
|
|
1583
|
+
onActivate: (_tab, scope) => bus.refresh(scope?.sessionId),
|
|
1584
|
+
badge: (_c, scope) => (bus.state && scope?.sessionId === bus.sessionId && bus.state.selfCheck && !bus.state.selfCheck.ok && !bus.state.selfCheck.unbound) ? '!' : null,
|
|
1585
|
+
component: (props) => h(RightPanel, { ctx, t, scope: props.scope, visible: props.visible, onOpenFile: props.onOpenFile }),
|
|
1586
|
+
}); } catch (e) {
|
|
1587
|
+
if (!warned) { warned = true; console.warn('[skill-set-manager] rightTab 注册失败,看门狗持续重试:', e?.message ?? e); }
|
|
1588
|
+
off = null; return false;
|
|
1589
|
+
}
|
|
1590
|
+
return true;
|
|
1591
|
+
};
|
|
1592
|
+
tryReg();
|
|
1593
|
+
// 3s 看门狗:服务缺席、热替换竞态、以及 betterSidebar 自身热重载后新注册表
|
|
1594
|
+
// 丢我方注册(review m2)——getTab 探活失败即重挂,openTab 不再静默 no-op。
|
|
1595
|
+
const id = setInterval(() => {
|
|
1596
|
+
const svc = ctx.get('betterSidebar');
|
|
1597
|
+
if (!svc) return;
|
|
1598
|
+
let alive = false;
|
|
1599
|
+
try { alive = !!off && !!svc.getTab?.(TAB_ID); } catch { alive = false; }
|
|
1600
|
+
if (alive) return;
|
|
1601
|
+
off = null; tryReg();
|
|
1602
|
+
}, 3000);
|
|
1603
|
+
return () => { clearInterval(id); off?.(); };
|
|
1604
|
+
}, 'skill-set-manager.rightTab');
|
|
1605
|
+
ctx.slots.inject('conversation.input.left', () => ctx.slots.register({
|
|
1606
|
+
name: 'conversation.input.left', id: PKG, order: 30, label: () => t('chip'),
|
|
1607
|
+
}, (props) => h(ComposerChip, { ctx, t, sessionId: props?.sessionId })));
|
|
1608
|
+
ctx.slots.inject('shell.overlay', () => ctx.slots.register({
|
|
1609
|
+
name: 'shell.overlay', id: PKG, order: 30,
|
|
1610
|
+
}, () => h(OverlayHost, { ctx, t, bs: ctx.get('betterSidebar') })));
|
|
1611
|
+
// 设置页(§10.1.4 探针事实:注册面仅 id/order/label;label thunk 随 locale 自动跟随)
|
|
1612
|
+
ctx.slots.inject('settings.section', () => ctx.slots.register({
|
|
1613
|
+
name: 'settings.section', id: PKG, order: 90, label: () => t('settingsLabel'),
|
|
1614
|
+
}, () => h(SettingsSection, { ctx, t })));
|
|
1615
|
+
},
|
|
1616
|
+
};
|
|
1617
|
+
},
|
|
1618
|
+
});
|