dsh-folia 4.26.0-pre.78 → 4.26.0-pre.79

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.
@@ -0,0 +1,288 @@
1
+ /**
2
+ * capabilities-curated.js — 能力页「精选」20 套组合(静态数据,不联网)。
3
+ *
4
+ * 纪律:
5
+ * · 这里只有**展示数据 + 命令**,没有安装器:页面复制 `dsh plugin --profile web add <pkg>` 给用户自己装;
6
+ * · 不扫描安装路径/注册表;是否已装由路由用 profile node_modules 的 package.json 只读探测;
7
+ * · 20 套包名均来自交接单(已用 npm registry 校验存在);
8
+ * · risk: low|medium|high;budget: free|key|software|paid;
9
+ * · `steps[].alt` / `optional` 用于二选一与可选项,不在数据层执行安装。
10
+ */
11
+
12
+ export const CURATED_COMMAND_PREFIX = 'dsh plugin --profile web add ';
13
+
14
+ export const CURATED_FAMILIES = Object.freeze([
15
+ { id: 'all', label: '全部' },
16
+ { id: 'basic', label: '基础' },
17
+ { id: 'work', label: '工作' },
18
+ { id: 'dev', label: '开发' },
19
+ { id: 'creative', label: '创意' },
20
+ { id: 'life', label: '生活' },
21
+ { id: 'advanced', label: '进阶' },
22
+ ]);
23
+
24
+ const step = (pkg, why, extra = {}) => ({ pkg, why, ...extra });
25
+
26
+ export const CURATED_BUNDLES = Object.freeze([
27
+ {
28
+ id: 'starter', family: 'basic', icon: '🧰', name: '新手必装',
29
+ goal: '一次补齐省钱、可信、可管的基础件',
30
+ requires: '无', risk: 'low', budget: ['free'],
31
+ steps: [
32
+ step('dsh-unlag', '让卡顿的对话/输出先顺起来'),
33
+ step('dsh-cost-meter', '看见每次调用花了多少,避免无感烧钱'),
34
+ step('dsh-trust-check', '装第三方插件前先过一遍安全检查'),
35
+ step('dsh-config-manager', '集中管理插件配置,换机器好迁移'),
36
+ ],
37
+ },
38
+ {
39
+ id: 'search-notify', family: 'basic', icon: '🔎', name: '联网与对比',
40
+ goal: '让助手能查、能比、能在有结果时叫你',
41
+ requires: '无', risk: 'low', budget: ['free'],
42
+ steps: [
43
+ step('dsh-free-search', '不用 Key 的联网搜索入口'),
44
+ step('dsh-agent-compare', '同一问题让多个模型/Agent 对比'),
45
+ step('dsh-notify-me', '长任务跑完后主动通知'),
46
+ ],
47
+ },
48
+ {
49
+ id: 'office', family: 'work', icon: '📄', name: '办公文档',
50
+ goal: '把 Word / PDF / Excel 串成一条工作流',
51
+ requires: 'Office/WPS 可选', risk: 'low', budget: ['free'],
52
+ steps: [
53
+ step('@deepseek-ai/dsh-skill-office', 'Office 文档读写的基础技能'),
54
+ step('dsh-pdf-mineru', 'PDF 解析/抽取,扫描件也能处理'),
55
+ step('dsh-excel-chat', '用自然语言改表格、做汇总'),
56
+ step('@copylee/dsh-office', '更完整的 Office 集成(可选)', { optional: true }),
57
+ ],
58
+ },
59
+ {
60
+ id: 'data', family: 'work', icon: '📊', name: '数据分析',
61
+ goal: '从数据库到图表到对账,一条链路跑通',
62
+ requires: '数据库(SQLite 免配置)', risk: 'low', budget: ['free'],
63
+ steps: [
64
+ step('dsh-sql', '直连数据库做查询与导出'),
65
+ step('dsh-genui', '把查询结果直接生成可交互图表'),
66
+ step('dsh-excel-reconcile', '表格对账,找差异'),
67
+ step('@chengxianglibra/dsh-data-analysis', '更完整的数据分析套件(可选)', { optional: true }),
68
+ ],
69
+ },
70
+ {
71
+ id: 'research', family: 'work', icon: '🎓', name: '学术研究',
72
+ goal: '读论文、翻译、记住要点、再写成文档',
73
+ requires: '无', risk: 'low', budget: ['free'],
74
+ steps: [
75
+ step('dsh-pdf-mineru', '先解析论文 PDF'),
76
+ step('dsh-pdf-translator', '边读边译,保留版式'),
77
+ step('dsh-mnemon', '把关键结论记成可检索的记忆'),
78
+ step('@deepseek-ai/dsh-skill-office', '最后产出 Word/汇报'),
79
+ ],
80
+ },
81
+ {
82
+ id: 'meeting', family: 'work', icon: '🗣️', name: '会议与沟通',
83
+ goal: '会议信息进得来、归档得住、结论叫得到人',
84
+ requires: '微信/飞书/QQ 等账号', risk: 'medium', budget: ['free'],
85
+ steps: [
86
+ step('@xmanrui/dsh-im', '接入常用即时通讯'),
87
+ step('@michengai/dsh-archive-manager', '把聊天/会议资料归档'),
88
+ step('dsh-notify-me', '结论和待办主动提醒'),
89
+ ],
90
+ },
91
+ {
92
+ id: 'ops-report', family: 'work', icon: '📈', name: '运营与报表',
93
+ goal: '数据表 → 查询 → 图表 → 配图,做周报/月报',
94
+ requires: '数据表/数据库;图像 Key(可选)', risk: 'low', budget: ['free', 'key'],
95
+ steps: [
96
+ step('dsh-excel-chat', '读取并汇总运营表格'),
97
+ step('dsh-sql', '需要时直连业务库'),
98
+ step('dsh-genui', '把指标做成图表'),
99
+ step('dsh-image-gen', '给报表配图(可选,需 Key)', { optional: true }),
100
+ ],
101
+ },
102
+ {
103
+ id: 'coding', family: 'dev', icon: '💻', name: '编程开发',
104
+ goal: '写代码、看 diff、管 Git,少切窗口',
105
+ requires: 'Git 仓库', risk: 'low', budget: ['free'],
106
+ steps: [
107
+ step('@michengai/dsh-code-review', '对改动做结构化 Code Review'),
108
+ step('@xbzbing/dsh-git-panel', '在 DSH 里看分支/提交/差异'),
109
+ step('dsh-vscode-connect', '和 VS Code 联动(可选)', { optional: true }),
110
+ ],
111
+ },
112
+ {
113
+ id: 'gamedev', family: 'dev', icon: '🎮', name: '游戏开发',
114
+ goal: '资产 → 引擎 → 审查,一条游戏制作链',
115
+ requires: 'Blender 4.x + Unity/UE + Git', risk: 'medium', budget: ['software'],
116
+ steps: [
117
+ step('dsh-blender-plugin', '从 Blender 出资产/改场景'),
118
+ step('dsh-unity-mcp-bridge', '接 Unity 编辑器;UE 用 dsh-unreal-mcp', { alt: 'dsh-unreal-mcp' }),
119
+ step('@michengai/dsh-code-review', '审查脚本与引擎代码'),
120
+ step('@xbzbing/dsh-git-panel', '管理工程仓库'),
121
+ ],
122
+ conflicts: ['Unity 与 Unreal 二选一:装 dsh-unity-mcp-bridge 或 dsh-unreal-mcp,不要同时装'],
123
+ },
124
+ {
125
+ id: 'rpa', family: 'dev', icon: '🖱️', name: '自动化 / RPA',
126
+ goal: '让桌面操作、定时任务和通知自己跑',
127
+ requires: 'Windows', risk: 'medium', budget: ['free'],
128
+ steps: [
129
+ step('dsh-windows-mcp', '操作 Windows 窗口/控件'),
130
+ step('@aiwayds/dsh-cron', '定时触发自动化任务'),
131
+ step('dsh-notify-me', '跑完/失败都通知'),
132
+ ],
133
+ },
134
+ {
135
+ id: 'agents', family: 'dev', icon: '🤖', name: '多 Agent 协作',
136
+ goal: '把一个大任务拆给多个 Agent 并行做',
137
+ requires: '无', risk: 'medium', budget: ['free'],
138
+ steps: [
139
+ step('@nanmicoder/dsh-agent-teams', '多 Agent 编队与任务分配'),
140
+ step('ds-bot', '给 Agent 一个可对话的入口'),
141
+ step('dsh-agent-compare', '比较不同 Agent 的结果,选优'),
142
+ ],
143
+ },
144
+ {
145
+ id: 'remote', family: 'dev', icon: '📡', name: '远程办公',
146
+ goal: '人在外面,也能连回自己的开发环境',
147
+ requires: '服务器/手机', risk: 'medium', budget: ['free'],
148
+ steps: [
149
+ step('dsh-remote', '从远程连回 DSH'),
150
+ step('dsh-mobile', '手机端入口'),
151
+ step('dsh-config-manager', '多端配置同步/迁移'),
152
+ ],
153
+ },
154
+ {
155
+ id: 'design', family: 'creative', icon: '🎨', name: '设计视觉',
156
+ goal: 'Figma 读设计 → 生图 → 安全兜底',
157
+ requires: 'Figma 账号;图像 Key', risk: 'medium', budget: ['key'],
158
+ steps: [
159
+ step('dsh-figma-mcp', '读取 Figma 文件/图层'),
160
+ step('dsh-image-gen', '按描述生成配图/素材'),
161
+ step('dsh-trust-check', '生图/第三方 MCP 的安全检查'),
162
+ ],
163
+ },
164
+ {
165
+ id: 'video', family: 'creative', icon: '🎬', name: '视频剪辑',
166
+ goal: '分镜 → 剪辑软件 → 系统操作兜底',
167
+ requires: 'PR / DaVinci / 剪映', risk: 'high', budget: ['software'],
168
+ steps: [
169
+ step('dsh-video-storyboard', '先把脚本拆成分镜'),
170
+ step('@iflow-mcp/leancoderkavy-premiere-pro-mcp', '接 Premiere Pro;DaVinci 用 davinci-resolve-mcp', { alt: 'davinci-resolve-mcp' }),
171
+ step('dsh-windows-mcp', '剪映等无 MCP 的软件用桌面操作兜底'),
172
+ ],
173
+ conflicts: ['Premiere 与 DaVinci MCP 二选一;high 风险,先装 dsh-trust-check 再装第三方 MCP'],
174
+ },
175
+ {
176
+ id: 'content', family: 'creative', icon: '✍️', name: '内容创作',
177
+ goal: '梗图/配图/PPT,从灵感到成稿',
178
+ requires: '图像 Key(可选)', risk: 'low', budget: ['free', 'key'],
179
+ steps: [
180
+ step('dsh-meme', '梗图/表情包快速产出'),
181
+ step('dsh-image-gen', '生成配图(可选,需 Key)', { optional: true }),
182
+ step('dsh-ppt', '把内容直接排成 PPT'),
183
+ ],
184
+ },
185
+ {
186
+ id: 'engineering', family: 'creative', icon: '📐', name: '3D 与工程',
187
+ goal: 'Blender / CAD 模型进 DSH,做检查与说明',
188
+ requires: 'Blender / AutoCAD', risk: 'high', budget: ['software'],
189
+ steps: [
190
+ step('dsh-blender-plugin', 'Blender 场景/资产接入'),
191
+ step('autocad-mcp', '接 AutoCAD;替代方案 @aryacode/dsh-engineering', { alt: '@aryacode/dsh-engineering' }),
192
+ step('dsh-trust-check', '第三方 MCP 先过安全检查'),
193
+ ],
194
+ conflicts: ['AutoCAD MCP 与 dsh-engineering 二选一;high 风险,先 trust-check'],
195
+ },
196
+ {
197
+ id: 'companion', family: 'life', icon: '🐟', name: '情绪陪伴与桌宠',
198
+ goal: '让桌宠会说话,也能被你叫醒/提醒',
199
+ requires: '无', risk: 'low', budget: ['free'],
200
+ steps: [
201
+ step('dsh-folia', '本插件(当前已装)'),
202
+ step('dsh-speak-up', '让桌面角色主动开口'),
203
+ step('dsh-notify-me', '提醒/待办叫得到你'),
204
+ ],
205
+ conflicts: ['dsh-pet / dsh-fish-soul / dsh-soul-md 与本插件部分功能重叠,二选一'],
206
+ },
207
+ {
208
+ id: 'learn', family: 'life', icon: '📚', name: '学习成长',
209
+ goal: '读材料、记知识、产出学习文档',
210
+ requires: '无', risk: 'low', budget: ['free'],
211
+ steps: [
212
+ step('dsh-pdf-mineru', '拆开教材/论文/课件'),
213
+ step('dsh-mnemon', '把知识点记成长期记忆'),
214
+ step('@deepseek-ai/dsh-skill-office', '整理成笔记/Word'),
215
+ step('dsh-notify-me', '复习提醒'),
216
+ ],
217
+ },
218
+ {
219
+ id: 'security', family: 'advanced', icon: '🛡️', name: '安全与治理',
220
+ goal: '先审、再限权、最后可回滚',
221
+ requires: '无', risk: 'low', budget: ['free'],
222
+ steps: [
223
+ step('dsh-trust-check', '插件信任检查'),
224
+ step('dsh-perm-gate', '给工具/文件权限加闸'),
225
+ step('dsh-config-manager', '配置变更可回滚/可迁移'),
226
+ ],
227
+ },
228
+ {
229
+ id: 'models', family: 'advanced', icon: '🧠', name: '模型与订阅',
230
+ goal: '控制成本,接上更多可用模型',
231
+ requires: '对应账号', risk: 'medium', budget: ['free', 'paid'],
232
+ steps: [
233
+ step('dsh-cost-meter', '按调用看成本'),
234
+ step('@ebony-vinyl/dsh-our-free-model', '接入免费的模型通道;替代 dsh-connect-workbuddy', { alt: 'dsh-connect-workbuddy' }),
235
+ step('dsh-config-manager', '模型/端点配置集中管理'),
236
+ ],
237
+ },
238
+ ]);
239
+
240
+ /** 按顺序生成可执行安装命令(每行一条)。 */
241
+ export function curatedCommands(bundle) {
242
+ const steps = bundle && Array.isArray(bundle.steps) ? bundle.steps : [];
243
+ return steps.map((item) => CURATED_COMMAND_PREFIX + item.pkg);
244
+ }
245
+
246
+ /** 场景向导(纯规则,不调模型):返回 1–2 个 bundle id。 */
247
+ export function curatedRecommend(role, software) {
248
+ const r = String(role || '').toLowerCase();
249
+ const s = String(software || '').toLowerCase();
250
+ if (r === 'secure' || /安全|trust/.test(s)) return ['security', 'starter'];
251
+ if (r === 'work' || r === 'office') {
252
+ if (/excel|data|数据/.test(s)) return ['data', 'ops-report'];
253
+ return ['starter', 'office'];
254
+ }
255
+ if (r === 'dev' || r === 'develop') {
256
+ if (/blender|unity|unreal|ue|game|游戏/.test(s)) return ['gamedev', 'coding'];
257
+ return ['coding', 'starter'];
258
+ }
259
+ if (r === 'creative' || r === 'create') {
260
+ if (/pr|davinci|video|剪辑/.test(s)) return ['video', 'content'];
261
+ if (/ps|figma|design|设计/.test(s)) return ['design', 'content'];
262
+ return ['content', 'design'];
263
+ }
264
+ if (r === 'life' || r === 'learn') return ['companion', 'learn'];
265
+ return ['starter'];
266
+ }
267
+
268
+ /** 导出:powershell / bash / json。JSON 同时带命令,方便分享。 */
269
+ export function curatedExport(bundle, format = 'json') {
270
+ const commands = curatedCommands(bundle);
271
+ if (format === 'powershell' || format === 'pwsh') {
272
+ return "$ErrorActionPreference = 'Stop'\n" + commands.join('\n') + '\n';
273
+ }
274
+ if (format === 'bash' || format === 'sh') {
275
+ return '#!/usr/bin/env bash\nset -euo pipefail\n' + commands.join('\n') + '\n';
276
+ }
277
+ return JSON.stringify({
278
+ id: bundle.id,
279
+ name: bundle.name,
280
+ family: bundle.family,
281
+ goal: bundle.goal,
282
+ requires: bundle.requires,
283
+ risk: bundle.risk,
284
+ budget: bundle.budget,
285
+ commands,
286
+ steps: bundle.steps,
287
+ }, null, 2) + '\n';
288
+ }
package/lib/client.js CHANGED
@@ -998,6 +998,60 @@ window.__ModuleLoader__.load({
998
998
  "前提:": "Requires: ",
999
999
  "读取失败,重开设置页再试": "Failed to load; reopen settings and retry",
1000
1000
  "这些是可选插件:装好后能力给 DSH 助手用,桌宠本身不受影响。不做一键安装,复制命令自行安装。": "Optional plugins: they add abilities to the DSH assistant, not the pet. No one-click install — copy the command and install it yourself.",
1001
+ // pre.79:能力页精选(20 套组合 / 场景向导 / 筛选 / 导出)
1002
+ "精选": "Curated",
1003
+ "场景向导": "Scenario guide",
1004
+ "你主要做什么?": "What do you mainly do?",
1005
+ "开发": "Development",
1006
+ "创作": "Create",
1007
+ "生活": "Life",
1008
+ "安全治理": "Security",
1009
+ "装了什么软件?": "Which software do you use?",
1010
+ "无": "None",
1011
+ "Excel/数据": "Excel / data",
1012
+ "PS/Figma": "PS / Figma",
1013
+ "PR/DaVinci": "PR / DaVinci",
1014
+ "Blender/Unity": "Blender / Unity",
1015
+ "CAD": "CAD",
1016
+ "愿意付费吗?": "Willing to pay?",
1017
+ "免费": "Free",
1018
+ "可买 Key": "Can buy a key",
1019
+ "可订阅": "Can subscribe",
1020
+ "不限": "Any",
1021
+ "推荐": "Recommended",
1022
+ "收藏": "Favorite",
1023
+ "取消收藏": "Remove favorite",
1024
+ "前置:": "Requires: ",
1025
+ "只高亮推荐,不折叠其它组合。": "Only recommends and highlights; other bundles stay visible.",
1026
+ "推荐:": "Recommended: ",
1027
+ "全部": "All",
1028
+ "基础": "Basics",
1029
+ "创意": "Creative",
1030
+ "进阶": "Advanced",
1031
+ "搜索组合": "Search bundles",
1032
+ "只看收藏": "Favorites only",
1033
+ "复制全部命令": "Copy all commands",
1034
+ "导出 JSON": "Export JSON",
1035
+ "共 {n} 套;已装状态来自 profile 的 node_modules(只读,不联网)。": "{n} bundles; installed state comes from profile node_modules (read-only, offline).",
1036
+ "还没有收藏:点组合卡右上角的 ☆": "No favorites yet — click ☆ on a bundle card.",
1037
+ "没有匹配的组合": "No matching bundles",
1038
+ "已装 v{ver}": "Installed v{ver}",
1039
+ "未装": "Not installed",
1040
+ "可选": "Optional",
1041
+ "可替代": "Alternative",
1042
+ "替代:": "Alternative: ",
1043
+ "第三方 MCP,先 trust-check": "Third-party MCP — run trust-check first",
1044
+ "冲突:": "Conflict: ",
1045
+ "展开步骤": "Show steps",
1046
+ "收起步骤": "Hide steps",
1047
+ "已装 {n}/{m}": "Installed {n}/{m}",
1048
+ "精选读取失败,重开设置页再试": "Failed to load curated bundles; reopen settings and retry",
1049
+ "低风险": "Low risk",
1050
+ "中风险": "Medium risk",
1051
+ "高风险": "High risk",
1052
+ "需 Key": "Key required",
1053
+ "需正版软件": "Licensed software required",
1054
+ "需订阅": "Subscription required",
1001
1055
  "正在读取…": "Loading…",
1002
1056
  "冲突提醒:": "Conflict: ",
1003
1057
  "站点上还没有桌宠。": "No pets on the site yet.",
@@ -22030,11 +22084,13 @@ window.__ModuleLoader__.load({
22030
22084
  * panel-tabs-work.js — 「能力」一级设置项(与「壁纸引擎」并列的第二个 settings.section)。
22031
22085
  *
22032
22086
  * 定位:**只做展示与指引,不做一键安装**(用户明确要求)。
22033
- * · 工作能力 / 娱乐 两片独立区域(各自标题 + 卡片网格)
22034
- * · 卡片外观对齐 web-all 的插件列表:左侧图标方块 + 名称 + 描述 + 元信息 + 右侧状态点
22035
- * · 「详情」行内展开:功能点 / 使用示例 / 前提 / 安装命令(可复制)
22087
+ * · 精选(默认) / 工作能力 / 娱乐 三片独立页面
22088
+ * · 精选:20 套组合、场景向导(只高亮)、6 家族筛选、收藏、复制全部/单条、导出脚本/JSON
22089
+ * · 工作能力/娱乐:保留原有卡片与详情
22036
22090
  *
22037
- * 数据来自宿主 `GET /folia/pet-chat/capabilities`(catalog 写死在宿主侧,前端只渲染)。
22091
+ * 数据来自宿主:
22092
+ * GET /folia/pet-chat/capabilities/catalog (原有市场快照)
22093
+ * GET /folia/pet-chat/capabilities/curated (20 套组合 + profile node_modules 版本)
22038
22094
  */
22039
22095
  const CAP_STATUS_TEXT = (item) => (item.installed ? weT('已安装') : weT('未安装'));
22040
22096
 
@@ -22158,36 +22214,337 @@ window.__ModuleLoader__.load({
22158
22214
  : null));
22159
22215
  }
22160
22216
 
22217
+ /* ── 精选:命令/导出/收藏(纯前端,不执行安装)────────────────────────── */
22218
+
22219
+ const CURATED_PREFIX = 'dsh plugin --profile web add ';
22220
+ const CURATED_FAV_KEY = 'we-curated-favorites';
22221
+ const CURATED_FAMILY_LABELS = {
22222
+ all: '全部', basic: '基础', work: '工作', dev: '开发', creative: '创意', life: '生活', advanced: '进阶',
22223
+ };
22224
+ const CURATED_RISK_LABELS = { low: '低风险', medium: '中风险', high: '高风险' };
22225
+ const CURATED_BUDGET_LABELS = { free: '免费', key: '需 Key', software: '需正版软件', paid: '需订阅' };
22226
+
22227
+ function curatedCommands(bundle) {
22228
+ return (bundle && Array.isArray(bundle.steps) ? bundle.steps : []).map((s) => CURATED_PREFIX + s.pkg);
22229
+ }
22230
+
22231
+ function curatedExportText(bundle, format) {
22232
+ const commands = curatedCommands(bundle);
22233
+ if (format === 'powershell') {
22234
+ return "$ErrorActionPreference = 'Stop'\n" + commands.join('\n') + '\n';
22235
+ }
22236
+ if (format === 'bash') {
22237
+ return '#!/usr/bin/env bash\nset -euo pipefail\n' + commands.join('\n') + '\n';
22238
+ }
22239
+ return JSON.stringify({
22240
+ id: bundle.id, name: bundle.name, family: bundle.family, goal: bundle.goal,
22241
+ requires: bundle.requires, risk: bundle.risk, budget: bundle.budget,
22242
+ commands, steps: bundle.steps,
22243
+ }, null, 2) + '\n';
22244
+ }
22245
+
22246
+ function curatedRecommend(role, software) {
22247
+ const r = String(role || '').toLowerCase();
22248
+ const s = String(software || '').toLowerCase();
22249
+ if (r === 'secure' || /安全|trust/.test(s)) return ['security', 'starter'];
22250
+ if (r === 'work') {
22251
+ if (/excel|data|数据/.test(s)) return ['data', 'ops-report'];
22252
+ return ['starter', 'office'];
22253
+ }
22254
+ if (r === 'dev') {
22255
+ if (/blender|unity|unreal|ue|game|游戏/.test(s)) return ['gamedev', 'coding'];
22256
+ return ['coding', 'starter'];
22257
+ }
22258
+ if (r === 'creative') {
22259
+ if (/pr|davinci|video|剪辑/.test(s)) return ['video', 'content'];
22260
+ if (/ps|figma|design|设计/.test(s)) return ['design', 'content'];
22261
+ if (/cad/.test(s)) return ['engineering', 'design'];
22262
+ return ['content', 'design'];
22263
+ }
22264
+ if (r === 'life') return ['companion', 'learn'];
22265
+ return ['starter'];
22266
+ }
22267
+
22268
+ function readCuratedFavorites() {
22269
+ try {
22270
+ const raw = localStorage.getItem(CURATED_FAV_KEY);
22271
+ const list = raw ? JSON.parse(raw) : [];
22272
+ return Array.isArray(list) ? list.map(String) : [];
22273
+ } catch { return []; }
22274
+ }
22275
+ function writeCuratedFavorites(list) {
22276
+ try { localStorage.setItem(CURATED_FAV_KEY, JSON.stringify(Array.from(new Set(list)))); } catch { /* ignore */ }
22277
+ }
22278
+ function copyPlainText(text) {
22279
+ try {
22280
+ if (typeof navigator !== 'undefined' && navigator.clipboard && navigator.clipboard.writeText) {
22281
+ void navigator.clipboard.writeText(String(text || ''));
22282
+ return true;
22283
+ }
22284
+ } catch { /* fall through */ }
22285
+ return false;
22286
+ }
22287
+ function downloadTextFile(name, text, mime) {
22288
+ try {
22289
+ const blob = new Blob([String(text || '')], { type: mime || 'text/plain' });
22290
+ const url = URL.createObjectURL(blob);
22291
+ const a = document.createElement('a');
22292
+ a.href = url;
22293
+ a.download = name;
22294
+ a.style.display = 'none';
22295
+ document.body.appendChild(a);
22296
+ a.click();
22297
+ setTimeout(() => { try { URL.revokeObjectURL(url); a.remove(); } catch { /* ignore */ } }, 500);
22298
+ return true;
22299
+ } catch { return false; }
22300
+ }
22301
+
22302
+ function CuratedTag({ children, tone }) {
22303
+ const color = tone === 'high' ? '#f87171' : tone === 'medium' ? '#fbbf24' : tone === 'ok' ? '#4caf7d' : undefined;
22304
+ return React.createElement('span', {
22305
+ style: {
22306
+ display: 'inline-block', padding: '1px 6px', borderRadius: '999px',
22307
+ border: '1px solid rgba(255,255,255,0.16)', fontSize: '10px', lineHeight: '1.5',
22308
+ color, whiteSpace: 'nowrap',
22309
+ },
22310
+ }, children);
22311
+ }
22312
+
22313
+ function CuratedStep({ step, version, onCopy }) {
22314
+ const [copied, setCopied] = React.useState(false);
22315
+ const command = CURATED_PREFIX + step.pkg;
22316
+ return React.createElement('div', {
22317
+ style: {
22318
+ padding: '7px 8px', borderRadius: '8px', background: 'rgba(255,255,255,0.04)',
22319
+ border: '1px solid rgba(255,255,255,0.08)',
22320
+ },
22321
+ },
22322
+ React.createElement('div', { style: { display: 'flex', alignItems: 'baseline', gap: '6px', flexWrap: 'wrap' } },
22323
+ React.createElement('span', { style: { fontSize: '12px', fontWeight: 600 } }, step.pkg),
22324
+ version ? React.createElement(CuratedTag, { tone: 'ok' }, weT('已装 v{ver}', { ver: version })) : React.createElement(CuratedTag, null, weT('未装')),
22325
+ step.optional ? React.createElement(CuratedTag, null, weT('可选')) : null,
22326
+ step.alt ? React.createElement(CuratedTag, null, weT('可替代')) : null),
22327
+ React.createElement('div', { className: 'we-picker__hint', style: { marginTop: '2px' } }, step.why || ''),
22328
+ step.alt ? React.createElement('div', { className: 'we-picker__hint', style: { marginTop: '2px' } },
22329
+ weT('替代:') + step.alt + '(' + CURATED_PREFIX + step.alt + ')') : null,
22330
+ React.createElement('div', { style: { display: 'flex', gap: '6px', alignItems: 'center', marginTop: '4px' } },
22331
+ React.createElement('code', { style: { flex: 1, minWidth: 0, fontSize: '10px', opacity: 0.8, wordBreak: 'break-all' } }, command),
22332
+ !version ? React.createElement('button', {
22333
+ type: 'button', className: 'we-picker__btn', style: { fontSize: '10px', padding: '1px 7px' },
22334
+ onClick: () => {
22335
+ copyPlainText(command);
22336
+ setCopied(true);
22337
+ if (onCopy) onCopy(command);
22338
+ setTimeout(() => setCopied(false), 1500);
22339
+ },
22340
+ }, copied ? weT('已复制') : weT('复制')) : null));
22341
+ }
22342
+
22343
+ function CuratedCard({ bundle, installed, favorite, recommended, onToggleFavorite, onCopy, onExport }) {
22344
+ const [open, setOpen] = React.useState(false);
22345
+ const steps = Array.isArray(bundle.steps) ? bundle.steps : [];
22346
+ const installedCount = steps.filter((s) => installed && installed[s.pkg]).length;
22347
+ const commands = curatedCommands(bundle);
22348
+ const risk = CURATED_RISK_LABELS[bundle.risk] || bundle.risk || '';
22349
+ const budgets = (Array.isArray(bundle.budget) ? bundle.budget : []).map((b) => CURATED_BUDGET_LABELS[b] || b).join(' / ');
22350
+ const high = bundle.risk === 'high';
22351
+ return React.createElement('div', {
22352
+ style: {
22353
+ ...CAP_CARD,
22354
+ border: recommended ? '1px solid rgba(124,108,255,0.8)' : CAP_CARD.border,
22355
+ boxShadow: recommended ? '0 0 0 1px rgba(124,108,255,0.25) inset' : undefined,
22356
+ },
22357
+ },
22358
+ React.createElement('div', { style: { display: 'flex', gap: '8px', alignItems: 'flex-start' } },
22359
+ React.createElement('div', { style: CAP_ICON }, bundle.icon || '🧩'),
22360
+ React.createElement('div', { style: { flex: 1, minWidth: 0 } },
22361
+ React.createElement('div', { style: { fontWeight: 600, fontSize: '13px', display: 'flex', gap: '6px', flexWrap: 'wrap', alignItems: 'center' } },
22362
+ bundle.name,
22363
+ recommended ? React.createElement(CuratedTag, { tone: 'ok' }, weT('推荐')) : null),
22364
+ React.createElement('div', { className: 'we-picker__hint' }, bundle.goal),
22365
+ React.createElement('div', { style: { display: 'flex', gap: '4px', flexWrap: 'wrap', marginTop: '4px' } },
22366
+ React.createElement(CuratedTag, { tone: bundle.risk }, risk),
22367
+ React.createElement(CuratedTag, null, budgets),
22368
+ high ? React.createElement(CuratedTag, { tone: 'high' }, weT('第三方 MCP,先 trust-check')) : null)),
22369
+ React.createElement('button', {
22370
+ type: 'button', className: 'we-picker__btn', title: favorite ? weT('取消收藏') : weT('收藏'),
22371
+ onClick: () => onToggleFavorite(bundle.id),
22372
+ style: { padding: '0 6px' },
22373
+ }, favorite ? '★' : '☆')),
22374
+ React.createElement('div', { className: 'we-picker__hint' }, weT('前置:') + (bundle.requires || '—')),
22375
+ React.createElement('div', { style: { display: 'flex', gap: '4px', flexWrap: 'wrap', alignItems: 'center', fontSize: '11px' } },
22376
+ steps.map((step, index) => React.createElement(React.Fragment, { key: step.pkg },
22377
+ index ? React.createElement('span', { style: { opacity: 0.4 } }, '→') : null,
22378
+ React.createElement('span', {
22379
+ style: {
22380
+ padding: '2px 6px', borderRadius: '6px',
22381
+ background: installed && installed[step.pkg] ? 'rgba(76,175,125,0.16)' : 'rgba(255,255,255,0.05)',
22382
+ },
22383
+ }, step.pkg + (installed && installed[step.pkg] ? ' v' + installed[step.pkg] : ' · ' + weT('未装')))))),
22384
+ React.createElement('div', { className: 'we-picker__hint' },
22385
+ weT('已装 {n}/{m}', { n: installedCount, m: steps.length })),
22386
+ (bundle.conflicts || []).length
22387
+ ? React.createElement('div', { className: 'we-picker__hint', style: { color: '#fbbf24' } },
22388
+ weT('冲突:') + bundle.conflicts.join(';'))
22389
+ : null,
22390
+ React.createElement('div', { style: { display: 'flex', gap: '6px', flexWrap: 'wrap' } },
22391
+ React.createElement('button', { type: 'button', className: 'we-picker__btn', onClick: () => onCopy(commands.join('\n')) },
22392
+ weT('复制全部命令')),
22393
+ React.createElement('button', { type: 'button', className: 'we-picker__btn', onClick: () => setOpen((v) => !v) },
22394
+ open ? weT('收起步骤') : weT('展开步骤')),
22395
+ React.createElement('button', { type: 'button', className: 'we-picker__btn', onClick: () => onExport(bundle, 'powershell') }, 'PowerShell'),
22396
+ React.createElement('button', { type: 'button', className: 'we-picker__btn', onClick: () => onExport(bundle, 'bash') }, 'bash'),
22397
+ React.createElement('button', { type: 'button', className: 'we-picker__btn', onClick: () => onExport(bundle, 'json') }, 'JSON')),
22398
+ open ? React.createElement('div', { style: { display: 'flex', flexDirection: 'column', gap: '4px' } },
22399
+ steps.map((step) => React.createElement(CuratedStep, {
22400
+ key: step.pkg, step, version: installed ? installed[step.pkg] : null, onCopy,
22401
+ }))) : null);
22402
+ }
22403
+
22404
+ function CuratedWizard({ value, onChange, recommended, bundleById }) {
22405
+ const role = value.role || '';
22406
+ const software = value.software || '';
22407
+ const budget = value.budget || '';
22408
+ const select = (key, label, options) => React.createElement('label', {
22409
+ style: { display: 'flex', gap: '4px', alignItems: 'center', fontSize: '11px' },
22410
+ }, weT(label), React.createElement('select', {
22411
+ className: 'we-picker__playlist-select', value: value[key] || '', style: { fontSize: '11px' },
22412
+ onChange: (e) => onChange({ ...value, [key]: e.target.value }),
22413
+ }, React.createElement('option', { value: '' }, weT('不限')), options.map(([id, text]) =>
22414
+ React.createElement('option', { key: id, value: id }, weT(text)))));
22415
+ return React.createElement('div', {
22416
+ style: { padding: '8px 10px', borderRadius: '10px', border: '1px solid rgba(255,255,255,0.1)', background: 'rgba(255,255,255,0.03)' },
22417
+ },
22418
+ React.createElement('div', { style: { fontSize: '12px', fontWeight: 600, marginBottom: '4px' } }, weT('场景向导')),
22419
+ React.createElement('div', { className: 'we-picker__hint' }, weT('只高亮推荐,不折叠其它组合。')),
22420
+ React.createElement('div', { style: { display: 'flex', gap: '8px', flexWrap: 'wrap', marginTop: '4px' } },
22421
+ select('role', '你主要做什么?', [['work', '工作'], ['dev', '开发'], ['creative', '创作'], ['life', '生活'], ['secure', '安全治理']]),
22422
+ select('software', '装了什么软件?', [['', '无'], ['excel', 'Excel/数据'], ['ps', 'PS/Figma'], ['pr', 'PR/DaVinci'], ['blender', 'Blender/Unity'], ['cad', 'CAD']]),
22423
+ select('budget', '愿意付费吗?', [['free', '免费'], ['key', '可买 Key'], ['subscription', '可订阅']])),
22424
+ recommended.length ? React.createElement('div', { className: 'we-picker__hint', style: { marginTop: '4px' } },
22425
+ weT('推荐:') + recommended.map((id) => (bundleById[id] ? bundleById[id].name : id)).join(' / ')) : null);
22426
+ }
22427
+
22428
+ function CuratedPanel({ data, favorites, onToggleFavorite }) {
22429
+ const [family, setFamily] = React.useState('all');
22430
+ const [favOnly, setFavOnly] = React.useState(false);
22431
+ const [query, setQuery] = React.useState('');
22432
+ const [wizard, setWizard] = React.useState({ role: '', software: '', budget: '' });
22433
+ const [copiedAll, setCopiedAll] = React.useState(false);
22434
+ const bundles = data && Array.isArray(data.bundles) ? data.bundles : [];
22435
+ const installed = (data && data.installed) || {};
22436
+ const bundleById = React.useMemo(() => {
22437
+ const map = {};
22438
+ bundles.forEach((b) => { map[b.id] = b; });
22439
+ return map;
22440
+ }, [bundles]);
22441
+ const recommended = React.useMemo(() => curatedRecommend(wizard.role, wizard.software), [wizard.role, wizard.software]);
22442
+ const filterText = String(query || '').trim().toLowerCase();
22443
+ const list = bundles.filter((b) => {
22444
+ if (family !== 'all' && b.family !== family) return false;
22445
+ if (favOnly && !favorites.has(b.id)) return false;
22446
+ if (!filterText) return true;
22447
+ return [b.name, b.goal, b.family, ...(b.steps || []).map((s) => s.pkg)].join(' ').toLowerCase().includes(filterText);
22448
+ });
22449
+ const allCommands = list.flatMap((b) => curatedCommands(b));
22450
+ const copyAll = () => {
22451
+ if (!allCommands.length) return;
22452
+ copyPlainText(allCommands.join('\n'));
22453
+ setCopiedAll(true);
22454
+ setTimeout(() => setCopiedAll(false), 1500);
22455
+ };
22456
+ const exportAllJson = () => {
22457
+ downloadTextFile('folia-curated.json', JSON.stringify({ bundles: list, commands: allCommands }, null, 2), 'application/json');
22458
+ };
22459
+ return React.createElement('div', { style: { marginTop: '8px' } },
22460
+ React.createElement(CuratedWizard, { value: wizard, onChange: setWizard, recommended, bundleById }),
22461
+ React.createElement('div', { style: { display: 'flex', gap: '4px', flexWrap: 'wrap', marginTop: '8px' } },
22462
+ Object.keys(CURATED_FAMILY_LABELS).map((id) => React.createElement('button', {
22463
+ key: id, type: 'button',
22464
+ className: 'we-picker__btn' + (family === id ? ' we-picker__btn--primary' : ''),
22465
+ onClick: () => setFamily(id),
22466
+ }, weT(CURATED_FAMILY_LABELS[id])))),
22467
+ React.createElement('div', { style: { display: 'flex', gap: '8px', alignItems: 'center', flexWrap: 'wrap', marginTop: '6px' } },
22468
+ React.createElement('input', {
22469
+ type: 'text', value: query, placeholder: weT('搜索组合'),
22470
+ onChange: (e) => setQuery(e.target.value),
22471
+ style: { flex: '1 1 160px', minWidth: '120px', fontSize: '11px', padding: '4px 6px', borderRadius: '6px', border: '1px solid rgba(255,255,255,0.16)', background: 'transparent', color: 'inherit' },
22472
+ }),
22473
+ React.createElement('label', { style: { display: 'flex', gap: '4px', alignItems: 'center', fontSize: '11px' } },
22474
+ React.createElement('input', { type: 'checkbox', checked: favOnly, onChange: (e) => setFavOnly(e.target.checked) }),
22475
+ weT('只看收藏')),
22476
+ React.createElement('button', { type: 'button', className: 'we-picker__btn', onClick: copyAll, disabled: !list.length },
22477
+ copiedAll ? weT('已复制') : weT('复制全部命令')),
22478
+ React.createElement('button', { type: 'button', className: 'we-picker__btn', onClick: exportAllJson, disabled: !list.length },
22479
+ weT('导出 JSON'))),
22480
+ React.createElement('div', { className: 'we-picker__hint', style: { marginTop: '4px' } },
22481
+ weT('共 {n} 套;已装状态来自 profile 的 node_modules(只读,不联网)。', { n: list.length })),
22482
+ list.length
22483
+ ? React.createElement('div', {
22484
+ style: { display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(340px, 1fr))', gap: '8px', marginTop: '8px' },
22485
+ }, list.map((bundle) => React.createElement(CuratedCard, {
22486
+ key: bundle.id, bundle, installed, favorite: favorites.has(bundle.id),
22487
+ recommended: recommended.includes(bundle.id),
22488
+ onToggleFavorite, onCopy: copyPlainText,
22489
+ onExport: (b, format) => downloadTextFile(
22490
+ 'folia-curated-' + b.id + '.' + (format === 'json' ? 'json' : format === 'bash' ? 'sh' : 'ps1'),
22491
+ curatedExportText(b, format),
22492
+ format === 'json' ? 'application/json' : 'text/plain',
22493
+ ),
22494
+ })))
22495
+ : React.createElement('div', { className: 'we-picker__hint', style: { marginTop: '10px' } },
22496
+ favOnly && !favorites.size ? weT('还没有收藏:点组合卡右上角的 ☆') : weT('没有匹配的组合')));
22497
+ }
22498
+
22161
22499
  function CapabilitiesSection() {
22162
- // items = 数据;page = 当前停在哪一页(工作能力 / 娱乐)—— 两个独立页面,不并排堆在一起
22163
- const [state, setState] = React.useState({ items: null, page: "work", error: null });
22500
+ // items = 市场快照;curated = 20 套组合;page = 精选/工作能力/娱乐(精选默认)
22501
+ const [state, setState] = React.useState({ items: null, curated: null, page: "curated", error: null });
22502
+ const [favorites, setFavorites] = React.useState(() => new Set(readCuratedFavorites()));
22164
22503
 
22165
22504
  React.useEffect(() => {
22166
22505
  void (async () => {
22167
- const resp = await apiJson("/pet-chat/capabilities/catalog", { parse: "always" }).catch(() => null);
22168
- const doc = (resp && resp.data) || null;
22169
- if (doc && Array.isArray(doc.items)) setState((prev) => ({ ...prev, items: doc.items, error: null }));
22170
- else setState((prev) => ({ ...prev, error: weT("读取失败,重开设置页再试") }));
22506
+ const [catResp, curResp] = await Promise.all([
22507
+ apiJson("/pet-chat/capabilities/catalog", { parse: "always" }).catch(() => null),
22508
+ apiJson("/pet-chat/capabilities/curated", { parse: "always" }).catch(() => null),
22509
+ ]);
22510
+ const catDoc = (catResp && catResp.data) || null;
22511
+ const curDoc = (curResp && curResp.data) || null;
22512
+ setState((prev) => ({
22513
+ ...prev,
22514
+ items: catDoc && Array.isArray(catDoc.items) ? catDoc.items : prev.items,
22515
+ curated: curDoc && Array.isArray(curDoc.bundles) ? curDoc : prev.curated,
22516
+ error: !catDoc && !curDoc ? weT("读取失败,重开设置页再试") : null,
22517
+ }));
22171
22518
  })();
22172
22519
  }, []);
22173
22520
 
22521
+ const toggleFavorite = React.useCallback((id) => {
22522
+ setFavorites((prev) => {
22523
+ const next = new Set(prev);
22524
+ if (next.has(id)) next.delete(id); else next.add(id);
22525
+ writeCuratedFavorites(Array.from(next));
22526
+ return next;
22527
+ });
22528
+ }, []);
22529
+
22174
22530
  if (state.error) return React.createElement("div", { className: "we-picker__hint" }, state.error);
22175
- if (!state.items) return React.createElement("div", { className: "we-picker__hint" }, weT("正在读取…"));
22531
+ if (!state.items && !state.curated) return React.createElement("div", { className: "we-picker__hint" }, weT("正在读取…"));
22176
22532
 
22177
- const page = state.page === "fun" ? "fun" : "work";
22533
+ const page = ["curated", "work", "fun"].includes(state.page) ? state.page : "curated";
22178
22534
  const tabs = [
22535
+ { id: "curated", label: weT("精选") },
22179
22536
  { id: "work", label: weT("工作能力") },
22180
22537
  { id: "fun", label: weT("娱乐") },
22181
22538
  ];
22182
- const items = page === "work"
22183
- ? state.items.filter((it) => it.section === "work")
22184
- : state.items.filter((it) => it.section === "fun");
22539
+ const items = state.items || [];
22540
+ const workItems = items.filter((it) => it.section === "work");
22541
+ const funItems = items.filter((it) => it.section === "fun");
22185
22542
 
22186
22543
  return React.createElement("div", { style: { padding: "4px 2px" } },
22187
22544
  React.createElement("div", { style: { fontSize: "14px", fontWeight: 600 } }, weT("能力")),
22188
22545
  React.createElement("div", { className: "we-picker__hint", style: { marginTop: "2px" } },
22189
22546
  weT("这些是可选插件:装好后能力给 DSH 助手用,桌宠本身不受影响。不做一键安装,复制命令自行安装。")),
22190
- // 两个页面之间切换(页内 tab),每个页面只渲染自己那一组
22547
+ // 三个页面之间切换(页内 tab),精选默认打开
22191
22548
  React.createElement("div", { style: { display: "flex", gap: "6px", marginTop: "10px" } },
22192
22549
  tabs.map((tab) => React.createElement("button", {
22193
22550
  key: tab.id,
@@ -22195,11 +22552,15 @@ window.__ModuleLoader__.load({
22195
22552
  className: "we-picker__btn" + (page === tab.id ? " we-picker__btn--primary" : ""),
22196
22553
  onClick: () => setState((prev) => ({ ...prev, page: tab.id })),
22197
22554
  }, tab.label))),
22198
- React.createElement(CapGroup, {
22199
- title: page === "work" ? weT("工作能力") : weT("娱乐"),
22200
- hint: page === "work" ? weT("提高日常办事效率") : weT("让界面和对话更有趣"),
22201
- items,
22202
- }));
22555
+ page === "curated"
22556
+ ? (state.curated
22557
+ ? React.createElement(CuratedPanel, { data: state.curated, favorites, onToggleFavorite: toggleFavorite })
22558
+ : React.createElement("div", { className: "we-picker__hint", style: { marginTop: "10px" } }, weT("精选读取失败,重开设置页再试")))
22559
+ : React.createElement(CapGroup, {
22560
+ title: page === "work" ? weT("工作能力") : weT("娱乐"),
22561
+ hint: page === "work" ? weT("提高日常办事效率") : weT("让界面和对话更有趣"),
22562
+ items: page === "work" ? workItems : funItems,
22563
+ }));
22203
22564
  }
22204
22565
 
22205
22566
  // ── 内联模块:src/pet-layer.js —— 桌宠渲染层:canvas 逐帧绘 sprite2d 雪碧图 + 拖动 + 状态机(自渲染,不依赖第三方宠物插件)(构建期注入;勿手改本段)──
@@ -43,6 +43,7 @@ import {
43
43
  } from '../tts/voice-center.js';
44
44
  import { appendToolLog } from '../persona-tool-log.js';
45
45
  import { CAPABILITIES } from '../capabilities-catalog.js';
46
+ import { CURATED_BUNDLES } from '../capabilities-curated.js';
46
47
 
47
48
  import {
48
49
  buildEnvContext, buildSystemPrompt, buildPersonaSystemPrompt, personaToolAllowed, personaToolRegistry,
@@ -2401,6 +2402,29 @@ export function registerPetChatRoutes(webServer, c) {
2401
2402
  }
2402
2403
  }
2403
2404
 
2405
+ /**
2406
+ * 只读探测 profile 的 node_modules(能力页/精选页共用;不联网、不扫安装路径/注册表)。
2407
+ * 返回 { version, engines } 或 null。
2408
+ */
2409
+ function findProfilePkg(name) {
2410
+ const profileRoot = join(homedir(), 'AppData', 'Roaming', 'dsh-desktop', 'harness', 'profiles', 'web');
2411
+ const roots = [
2412
+ join(profileRoot, 'node_modules'),
2413
+ join(profileRoot, 'node_modules', 'dsh-folia', 'node_modules'),
2414
+ join(profileRoot, '..', '.generations', 'live'),
2415
+ ];
2416
+ for (const root of roots) {
2417
+ const f = join(root, ...String(name || '').split('/'), 'package.json');
2418
+ try {
2419
+ if (existsSync(f)) {
2420
+ const j = JSON.parse(readFileSync(f, 'utf8'));
2421
+ return { version: j.version || null, engines: j.engines || null };
2422
+ }
2423
+ } catch { /* ignore */ }
2424
+ }
2425
+ return null;
2426
+ }
2427
+
2404
2428
  /**
2405
2429
  * GET /pet-chat/capabilities —— 「能力」页签的数据源。
2406
2430
  * 只读:每个条目的简介 / 用法 / 前提 / 安装命令(不做一键安装),
@@ -2412,34 +2436,33 @@ export function registerPetChatRoutes(webServer, c) {
2412
2436
  res.setHeader('Content-Type', 'application/json; charset=utf-8');
2413
2437
  res.end(JSON.stringify(payload));
2414
2438
  };
2415
- const profileRoot = join(homedir(), 'AppData', 'Roaming', 'dsh-desktop', 'harness', 'profiles', 'web');
2416
- // ⚠️ ESM 没有 __dirname;这里只拼真实存在的位置(上一版用 __dirname 导致 400)
2417
- const roots = [
2418
- join(profileRoot, 'node_modules'),
2419
- join(profileRoot, 'node_modules', 'dsh-folia', 'node_modules'),
2420
- join(profileRoot, '..', '.generations', 'live'),
2421
- ];
2422
- const findPkg = (name) => {
2423
- for (const root of roots) {
2424
- const f = join(root, ...name.split('/'), 'package.json');
2425
- try {
2426
- if (existsSync(f)) {
2427
- const j = JSON.parse(readFileSync(f, 'utf8'));
2428
- return { version: j.version || null };
2429
- }
2430
- } catch { /* ignore */ }
2431
- }
2432
- return null;
2433
- };
2434
2439
  // 数据源:lib/capabilities-catalog.js(市场快照生成,按下载降序)
2435
2440
  const catalog = CAPABILITIES;
2436
2441
 
2437
2442
  const items = catalog.map((item) => {
2438
- const hit = findPkg(item.pkg);
2443
+ const hit = findProfilePkg(item.pkg);
2439
2444
  return { ...item, installed: !!hit, installedVersion: hit ? hit.version : null };
2440
2445
  });
2441
2446
  send({ ok: true, items });
2442
2447
  }
2448
+
2449
+ /**
2450
+ * GET /pet-chat/capabilities/curated —— 「精选」20 套组合 + 各包安装版本。
2451
+ * `installed` 的 key 是包名,value 是版本或 null;只读 profile node_modules,不联网。
2452
+ */
2453
+ function handleCuratedCapabilities(res) {
2454
+ const installed = {};
2455
+ for (const bundle of CURATED_BUNDLES) {
2456
+ for (const step of (bundle.steps || [])) {
2457
+ if (!step || !step.pkg || Object.prototype.hasOwnProperty.call(installed, step.pkg)) continue;
2458
+ const hit = findProfilePkg(step.pkg);
2459
+ installed[step.pkg] = hit ? hit.version : null;
2460
+ }
2461
+ }
2462
+ res.statusCode = 200;
2463
+ res.setHeader('Content-Type', 'application/json; charset=utf-8');
2464
+ res.end(JSON.stringify({ ok: true, bundles: CURATED_BUNDLES, installed }));
2465
+ }
2443
2466
  /**
2444
2467
  * GET /pet-chat/work-plugins —— 工作能力插件(聚合携带)的安装状态。
2445
2468
  * 只读探测(不 import 它们,坏插件不拖慢路由):装没装 / 版本 / 要不要配置。
@@ -4803,6 +4826,7 @@ async function handleMicTest(req, res) {
4803
4826
  // 自检:一次性跑「ffmpeg → 设备 → 录音 → 转写」四步,把每步结果原样返回。
4804
4827
  // 目的:发版前/真机排查时**一个请求就能看到哪一步坏了**,不用来回猜。
4805
4828
  if (tail === '/selftest' && (method === 'GET' || method === 'HEAD')) { void handleSelfTest(res); return; }
4829
+ if (tail === '/capabilities/curated' && (method === 'GET' || method === 'HEAD')) { handleCuratedCapabilities(res); return; }
4806
4830
  if (tail === '/capabilities/catalog' && (method === 'GET' || method === 'HEAD')) { handleCapabilities(res); return; }
4807
4831
  if (tail === '/work-plugins' && (method === 'GET' || method === 'HEAD')) { handleWorkPlugins(res); return; }
4808
4832
  if (tail === '/asr' && (method === 'GET' || method === 'HEAD')) { handleAsrStatus(res); return; }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-folia",
3
3
  "displayName": "dshAI · 壁纸引擎与 AI 桌宠",
4
- "version": "4.26.0-pre.78",
4
+ "version": "4.26.0-pre.79",
5
5
  "description": "dshAI:壁纸引擎 + AI 桌宠语音助手 + 多人设角色卡 + 皮肤/开机动画 + 能力市场,一站式桌面伴侣。",
6
6
  "type": "module",
7
7
  "engines": {
@@ -98,6 +98,7 @@
98
98
  "lib/media-selfheal.js",
99
99
  "lib/media-origin.js",
100
100
  "lib/capabilities-catalog.js",
101
+ "lib/capabilities-curated.js",
101
102
  "lib/inventory.js",
102
103
  "lib/serve.js",
103
104
  "lib/faststart.js",