@restregular/dsh-skill-center 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -3
- package/client/client.js +18 -1
- package/cordis.patch.yml +6 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# dsh-skill-center · 技能中心
|
|
1
|
+
# dsh-skill-center · 技能中心
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@restregular/dsh-skill-center)
|
|
4
4
|
[](./LICENSE)
|
|
@@ -67,7 +67,7 @@ Then add the package to the profile's bundle list and restart:
|
|
|
67
67
|
// <profile>/package.json
|
|
68
68
|
{
|
|
69
69
|
"dsh": { "profile": { "bundles": [/* … */ "@restregular/dsh-skill-center"] } },
|
|
70
|
-
"dependencies": { "@restregular/dsh-skill-center": "^0.
|
|
70
|
+
"dependencies": { "@restregular/dsh-skill-center": "^0.2.2" }
|
|
71
71
|
}
|
|
72
72
|
```
|
|
73
73
|
|
|
@@ -75,8 +75,51 @@ The package ships its own `cordis.patch.yml`, so no manual loader edit is requir
|
|
|
75
75
|
host plugin (`id: skill-center`) and the client half. The sidebar row appears **below Plugins**,
|
|
76
76
|
because the client registers `sidebar.panellist` with `order: 1`.
|
|
77
77
|
|
|
78
|
+
> [!IMPORTANT]
|
|
79
|
+
> The loader row's `name` **must equal the package name verbatim**
|
|
80
|
+
> (`@restregular/dsh-skill-center`). `@deepseek-ai/dsh-client-modules` locates a row's
|
|
81
|
+
> `package.json` by that name and compares it strictly (`nearestPackage`). With a bare
|
|
82
|
+
> `dsh-skill-center` the host half still mounts, but the client half is dropped **silently**:
|
|
83
|
+
> no sidebar row, `/plugins/@restregular/dsh-skill-center/client.js` returns `404`, and nothing is
|
|
84
|
+
> logged. 0.2.1 fixed exactly this; 0.2.0 shipped the bare name.
|
|
85
|
+
|
|
86
|
+
> [!IMPORTANT]
|
|
87
|
+
> The client bundle must also call `__ModuleLoader__.load({ id: '@restregular/dsh-skill-center' })` —
|
|
88
|
+
> **the package name, not the plugin id**. The browser module graph numbers rows by package name, and
|
|
89
|
+
> `ClientModuleSystem.invalidate(id, rev)` (what the HMR `rebuilt` frame and `entries.reload` use)
|
|
90
|
+
> deletes factory entries **by row id only**. A registration id that differs from the row id leaves
|
|
91
|
+
> the stale factory in place, so the next bundle revision throws
|
|
92
|
+
> `client-modules: duplicate factory registration … (bundle executed twice without invalidate?)`
|
|
93
|
+
> and the whole web boot reports `1 entry did not activate`. 0.2.2 fixed this; 0.2.0/0.2.1 used the
|
|
94
|
+
> bare plugin id. The bundle additionally skips registration when that id is already present, so a
|
|
95
|
+
> double execution can no longer take the boot down.
|
|
96
|
+
|
|
78
97
|
To uninstall: remove the bundle entry and the dependency, then restart.
|
|
79
98
|
|
|
99
|
+
> [!WARNING]
|
|
100
|
+
> Do not leave a bare-name junction/link for this package in the profile's `node_modules`
|
|
101
|
+
> (e.g. `node_modules\dsh-skill-center` → the repo). Both the link and the scoped package register
|
|
102
|
+
> the same plugin, which is exactly the two-sources situation behind the duplicate-registration
|
|
103
|
+
> crash. Install the scoped package and nothing else.
|
|
104
|
+
|
|
105
|
+
## Troubleshooting
|
|
106
|
+
|
|
107
|
+
Nothing appears in the sidebar after install + restart? Check in this order:
|
|
108
|
+
|
|
109
|
+
1. **Is the host half alive?** `http://127.0.0.1:19387/dsh-skill-center/api?op=ping` should answer
|
|
110
|
+
`{"ok":true,…}`. A `404` means the loader row never mounted — the package is not in the profile's
|
|
111
|
+
`dsh.profile.bundles`, or is not installed under the profile's `node_modules`.
|
|
112
|
+
2. **Did the client half reach the browser module graph?**
|
|
113
|
+
`http://127.0.0.1:19387/dsh-skill-center/api?op=diagnose` — `client.inGraph` must be `true`.
|
|
114
|
+
`false` while `host.mounted` is `true` is the loader-row-name / package-name mismatch above.
|
|
115
|
+
3. **Is the bundle served?** `http://127.0.0.1:19387/plugins/@restregular/dsh-skill-center/client.js`
|
|
116
|
+
should return JavaScript, not `404`.
|
|
117
|
+
4. **Re-run the offline composition check** (no host restart needed):
|
|
118
|
+
`node verify-compose.mjs <profileDir>` — it now fails loudly on a loader row name that cannot be
|
|
119
|
+
resolved back to the package.
|
|
120
|
+
5. `pnpm add` inside the profile is what makes the package resolvable; installing it elsewhere
|
|
121
|
+
(a global `npm i -g`, an unrelated directory) installs nothing the profile can compose.
|
|
122
|
+
|
|
80
123
|
## Usage
|
|
81
124
|
|
|
82
125
|
1. Open a session (or stay on the home screen — see *Known limits*).
|
|
@@ -243,15 +286,51 @@ pnpm add @restregular/dsh-skill-center
|
|
|
243
286
|
// <profile>/package.json
|
|
244
287
|
{
|
|
245
288
|
"dsh": { "profile": { "bundles": [/* … */ "@restregular/dsh-skill-center"] } },
|
|
246
|
-
"dependencies": { "@restregular/dsh-skill-center": "^0.
|
|
289
|
+
"dependencies": { "@restregular/dsh-skill-center": "^0.2.2" }
|
|
247
290
|
}
|
|
248
291
|
```
|
|
249
292
|
|
|
250
293
|
包自带 `cordis.patch.yml`,**不需要**手改 loader:它会插入宿主半边(`id: skill-center`)与浏览器半边。
|
|
251
294
|
侧栏那一行排在「插件」下方,因为客户端以 `order: 1` 注册 `sidebar.panellist`。
|
|
252
295
|
|
|
296
|
+
> [!IMPORTANT]
|
|
297
|
+
> patch 里那条 loader 行的 `name` **必须逐字等于包名**(`@restregular/dsh-skill-center`)。
|
|
298
|
+
> 宿主 `@deepseek-ai/dsh-client-modules` 是按这个行名去定位该行的 `package.json` 并**严格比对**
|
|
299
|
+
> `name` 的(`nearestPackage`)。写成裸名 `dsh-skill-center` 时:宿主半边照样挂得上,
|
|
300
|
+
> 但浏览器半边会被**静默丢弃** —— 侧栏没有「技能中心」、`/plugins/@restregular/dsh-skill-center/client.js`
|
|
301
|
+
> 返回 `404`,而且日志里一个字都没有。0.2.1 修的就是这个;0.2.0 发出去的是裸名。
|
|
302
|
+
|
|
303
|
+
> [!IMPORTANT]
|
|
304
|
+
> 客户端 bundle 还必须用**包名**注册:`__ModuleLoader__.load({ id: '@restregular/dsh-skill-center' })`,
|
|
305
|
+
> 不能用插件 id `dsh-skill-center`。浏览器模块图是按包名给行编号的,而
|
|
306
|
+
> `ClientModuleSystem.invalidate(id, rev)`(HMR 的 `rebuilt` 帧 → `entries.reload` 走的正是它)
|
|
307
|
+
> **只按行 id** 删工厂表里的条目:注册 id 与行 id 不一致 → 旧工厂删不掉 → 下一版 bundle 一执行就
|
|
308
|
+
> `client-modules: duplicate factory registration … (bundle executed twice without invalidate?)`,
|
|
309
|
+
> 整条 web boot 变成「1 entry did not activate」并弹「应用无法启动或已意外停止」。
|
|
310
|
+
> 0.2.2 修的就是这个。bundle 另外加了一道幂等保护:该 id 已在工厂表里就跳过注册,
|
|
311
|
+
> 重复执行最多是空转,不会再打挂启动。
|
|
312
|
+
|
|
253
313
|
卸载:删掉上面两处清单项,重启即可。
|
|
254
314
|
|
|
315
|
+
> [!WARNING]
|
|
316
|
+
> 不要在 profile 的 `node_modules` 里给这个包留裸名链接/junction
|
|
317
|
+
> (例如 `node_modules\dsh-skill-center` → 本仓库)。链接和真正的 scoped 包会各自注册同一个插件,
|
|
318
|
+
> 正好构成「同一插件两个来源」——也就是上面那个 duplicate registration 崩溃的现场。
|
|
319
|
+
> 只装 scoped 包,别的都清掉。
|
|
320
|
+
|
|
321
|
+
### 装完侧栏没出现?按顺序查这五步
|
|
322
|
+
|
|
323
|
+
1. **宿主半边活着吗**:`http://127.0.0.1:19387/dsh-skill-center/api?op=ping` 应回 `{"ok":true,…}`。
|
|
324
|
+
回 `404` 说明 loader 行压根没挂上 —— 包不在 profile 的 `dsh.profile.bundles` 里,或者没装进
|
|
325
|
+
profile 的 `node_modules`。
|
|
326
|
+
2. **浏览器半边进模块图了吗**:`…/api?op=diagnose` 里的 `client.inGraph` 必须是 `true`。
|
|
327
|
+
若 `host.mounted` 为 `true` 而它是 `false`,就是上面那个「行名 ≠ 包名」。
|
|
328
|
+
3. **bundle 有没有被服务**:`http://127.0.0.1:19387/plugins/@restregular/dsh-skill-center/client.js`
|
|
329
|
+
应返回 JavaScript 而不是 `404`。
|
|
330
|
+
4. **跑离线合成自检**(不用重启宿主):`node verify-compose.mjs <profileDir>`,
|
|
331
|
+
现在它会因为「行名解析不回本包」直接 FAIL。
|
|
332
|
+
5. `pnpm add` 必须**在 profile 目录里**执行;装到别处(全局 `npm i -g`、别的目录)profile 合成不到。
|
|
333
|
+
|
|
255
334
|
### 它怎么接进 Harness
|
|
256
335
|
|
|
257
336
|
**宿主半边**(`lib/index.js`)挂载一条**仅回环**的 HTTP 路由 `/dsh-skill-center/api`:
|
package/client/client.js
CHANGED
|
@@ -6,11 +6,27 @@
|
|
|
6
6
|
* `order: 1` 使其排在 `plugins`(order 0)下方;
|
|
7
7
|
* 2. `main`(keyed, root, key = "skill-center")— 中央区域的面板本体。
|
|
8
8
|
*
|
|
9
|
+
* 注册 id **必须逐字等于包名**(`@restregular/dsh-skill-center`)。浏览器模块图是按
|
|
10
|
+
* 包名给行编号的,`ClientModuleSystem.invalidate`/`reload`(HMR 的 `rebuilt` 帧走的
|
|
11
|
+
* 就是它)只按**行 id** 清理工厂表:注册 id 与行 id 不一致时,旧工厂不会被删掉,
|
|
12
|
+
* 新版 bundle 一到就撞成
|
|
13
|
+
* `client-modules: duplicate factory registration ... (bundle executed twice without invalidate?)`,
|
|
14
|
+
* 于是整条 web boot 变成 "1 entry did not activate"。
|
|
15
|
+
*
|
|
9
16
|
* 数据与写操作全部走宿主同源回环路由 `/dsh-skill-center/api`(见 ../lib/index.js)。
|
|
10
17
|
* 样式只用宿主主题令牌 `--dsw-*`,不 import 任何 Harness Client 包。
|
|
11
18
|
*/
|
|
19
|
+
const MODULE_ID = '@restregular/dsh-skill-center';
|
|
20
|
+
|
|
21
|
+
/** 该 id 是否已经注册过工厂(宿主 facade 暴露 factories 表;取不到就当作没注册)。 */
|
|
22
|
+
function alreadyRegistered() {
|
|
23
|
+
const factories = window.__ModuleLoader__?.factories;
|
|
24
|
+
return factories !== undefined && typeof factories.has === 'function' && factories.has(MODULE_ID);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (!alreadyRegistered()) {
|
|
12
28
|
window.__ModuleLoader__.load({
|
|
13
|
-
id:
|
|
29
|
+
id: MODULE_ID,
|
|
14
30
|
factory: (require) => {
|
|
15
31
|
const React = require('react');
|
|
16
32
|
const h = React.createElement;
|
|
@@ -765,3 +781,4 @@ window.__ModuleLoader__.load({
|
|
|
765
781
|
return { apply, inject };
|
|
766
782
|
},
|
|
767
783
|
});
|
|
784
|
+
}
|
package/cordis.patch.yml
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
# dsh-skill-center bundle patch: inserts the host plugin (skill catalog API over
|
|
2
2
|
# the loopback Web route /dsh-skill-center) and the client plugin (a 「技能中心」
|
|
3
3
|
# row in the sidebar's global panel list plus its central page).
|
|
4
|
-
#
|
|
4
|
+
#
|
|
5
|
+
# `name` 必须逐字等于本包 package.json 的 name。宿主 @deepseek-ai/dsh-client-modules
|
|
6
|
+
# 是按 **loader 行名 = 包名** 去定位 package.json 的(nearestPackage 严格比对 name):
|
|
7
|
+
# 写成裸名 'dsh-skill-center' 时宿主半边照样挂得上,但客户端半边会被静默丢弃 ——
|
|
8
|
+
# `/plugins/<包名>/client.js` 404、侧栏不出「技能中心」,而且没有任何报错。
|
|
5
9
|
- insert:
|
|
6
10
|
- id: skill-center
|
|
7
|
-
name: 'dsh-skill-center'
|
|
11
|
+
name: '@restregular/dsh-skill-center'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@restregular/dsh-skill-center",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "技能中心 — DeepSeek Harness 技能管理面板:浏览当前会话可见的所有技能、查看正文、开关模型/用户调用、新建与删除。 · Skill Center for DeepSeek Harness: browse and manage the skills visible to the current session.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|