@tinyforge/dsh-plugin-manager-wj 1.3.1 → 1.3.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 +4 -3
- package/README.zh.md +4 -3
- package/client.js +17 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ Configuration fields are discovered from each Host-provided schema. Secret field
|
|
|
30
30
|
|
|
31
31
|
Use a Harness Host that exposes the plugin-management Remote, settings forms, and runtime inventory. Older Hosts may show inventory only or report diagnostics as unavailable; upgrade Harness to use management actions. Only plugins addressable through the active profile can be toggled.
|
|
32
32
|
|
|
33
|
-
The
|
|
33
|
+
The tab hard-injects only two core client services, `slots` and `locale`. Everything else — the `pluginInventory` and `pluginManager` remotes, `configForms`, the skills Remote and the live session — is resolved through `ctx.get` at call time rather than declared in `inject`, because a Client plugin that lists an optional service in `inject` stays pending on a Host without it, and a pending plugin registers no tab at all: the settings page then shows no plugin views instead of a degraded one. The Skills view therefore degrades rather than disappearing: no Remote means an explanatory message, and no session means a waiting state that loads the catalog by itself as soon as a session appears or the active session changes, with no manual refresh. The namespace is discovered rather than hardcoded (`skills`, `skill`, `skillCatalog`, then any registered `remote.*` name containing "skill"), so a Host that renames it needs no code change. Skills are read-only here; the UI never loads skill bodies. The UI does not install/remove packages, edit credentials, or run arbitrary repair commands.
|
|
34
34
|
|
|
35
35
|
## Install
|
|
36
36
|
|
|
@@ -49,11 +49,11 @@ npm install @tinyforge/dsh-plugin-manager-wj
|
|
|
49
49
|
## Release
|
|
50
50
|
|
|
51
51
|
```sh
|
|
52
|
-
npm test # node --test:
|
|
52
|
+
npm test # node --test: 11 checks (views, inject contract, patch shape)
|
|
53
53
|
npm publish --access public # writes to registry.npmjs.org
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
The package name is scoped, so publishing a new version needs maintainer access to the `@tinyforge` npm scope. Tag the published commit (`git tag v1.3.
|
|
56
|
+
The package name is scoped, so publishing a new version needs maintainer access to the `@tinyforge` npm scope. Tag the published commit (`git tag v1.3.2 && git push --tags`) so the GitHub history matches the registry.
|
|
57
57
|
|
|
58
58
|
## Development
|
|
59
59
|
|
|
@@ -62,6 +62,7 @@ The package is an ES module. `index.js` is the Host entry point and `client.js`
|
|
|
62
62
|
- `node --test` runs the bundle behavior checks in `tests/client.test.js`: the four views render and switch, the visited views stay mounted, search and enable/disable act on the active view, a secret configuration object stays out of the editor, opening a session loads the skill catalog without a refresh, a renamed skills namespace is discovered, and a transient catalog failure recovers from the inline retry.
|
|
63
63
|
- `node --check client.js` checks the browser bundle syntax.
|
|
64
64
|
- `tests/patch.test.js` parses `cordis.patch.yml` and asserts no plain scalar starts with a reserved YAML indicator — the scoped package name must stay quoted, or the Host rejects the bundle patch.
|
|
65
|
+
- `tests/inject.test.js` pins the plugin's `inject` list to the core services only, so a regressed hard-injection of an optional remote fails the suite instead of silently emptying the settings page on some Hosts.
|
|
65
66
|
- `tests/harness.html` mounts the real `client.js` against fixtures in a browser and asserts the same behavior without Node; open it directly from disk and read the JSON report.
|
|
66
67
|
- `tests/parse-check.html` is a minimal browser smoke page: it confirms `client.js` parses and registers `settings.plugins.tab`.
|
|
67
68
|
|
package/README.zh.md
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
|
|
31
31
|
需要提供插件管理 Remote、设置表单和运行时清单的 Harness Host。较旧 Host 可能只能查看清单,或显示诊断不可用;升级 Harness 后才能执行管理操作。只有当前 Profile 可寻址的插件可以启停。
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
标签页只硬注入两个核心客户端服务:`slots` 与 `locale`。其余服务 —— `pluginInventory`、`pluginManager` 两个 remote、`configForms`、skills Remote 与存活会话 —— 都在调用时通过 `ctx.get` 解析,而不写进 `inject`:把可选服务写进 `inject` 会让客户端插件在缺少该服务的 Host 上一直处于 pending 状态,而 pending 的插件不注册任何标签页,设置页面会变成完全没有插件视图,而不是降级显示。因此 Skill 视图只会降级而不会消失:没有 Remote 时给出说明;没有会话时进入等待状态,一旦出现会话或活动会话切换,就自动加载目录,无需手动刷新。命名空间是探测出来的而不是写死的(依次尝试 `skills`、`skill`、`skillCatalog`,再扫描任何含 “skill” 的已注册 `remote.*`),所以 Host 改名也不需要改代码。Skill 在这里是只读的,界面不会加载 skill 正文。此界面不安装或卸载包、不编辑凭据,也不运行任意修复命令。
|
|
34
34
|
|
|
35
35
|
## 安装
|
|
36
36
|
|
|
@@ -49,11 +49,11 @@ npm install @tinyforge/dsh-plugin-manager-wj
|
|
|
49
49
|
## 发布
|
|
50
50
|
|
|
51
51
|
```sh
|
|
52
|
-
npm test # node --test:
|
|
52
|
+
npm test # node --test:11 项检查(视图、inject 契约、patch 结构)
|
|
53
53
|
npm publish --access public # 发布到 registry.npmjs.org
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
包名带 scope,发布新版本需要 `@tinyforge` npm scope 的维护者权限。发布后给对应提交打 tag(`git tag v1.3.
|
|
56
|
+
包名带 scope,发布新版本需要 `@tinyforge` npm scope 的维护者权限。发布后给对应提交打 tag(`git tag v1.3.2 && git push --tags`),让 GitHub 历史与 registry 版本对应。
|
|
57
57
|
|
|
58
58
|
## 开发
|
|
59
59
|
|
|
@@ -62,6 +62,7 @@ npm publish --access public # 发布到 registry.npmjs.org
|
|
|
62
62
|
- `node --test` 运行 `tests/client.test.js` 的行为检查:四个视图渲染并可切换、访问过的视图保持挂载、搜索与启停作用于当前视图、密钥配置对象不会进入编辑器、打开会话后无需刷新即加载 Skill 目录、改名后的 skills 命名空间能被发现,以及瞬时目录失败可就地重试恢复。
|
|
63
63
|
- `node --check client.js` 检查浏览器 bundle 语法。
|
|
64
64
|
- `tests/patch.test.js` 解析 `cordis.patch.yml`,确保没有裸标量以 YAML 保留字符开头 —— 带 scope 的包名必须保持加引号,否则 Host 会拒绝该 bundle patch。
|
|
65
|
+
- `tests/inject.test.js` 把插件的 `inject` 固定为仅核心服务,这样一旦有人重新硬注入可选 remote,测试就会失败,而不是在某些 Host 上悄悄把设置页清空。
|
|
65
66
|
- `tests/harness.html` 在浏览器中用测试夹具挂载真实 `client.js`,不依赖 Node 也能断言同一批行为;直接从磁盘打开并读取 JSON 报告。
|
|
66
67
|
- `tests/parse-check.html` 是最小的浏览器冒烟页:确认 `client.js` 能解析并注册 `settings.plugins.tab`。
|
|
67
68
|
|
package/client.js
CHANGED
|
@@ -542,7 +542,11 @@ window.__ModuleLoader__.load({
|
|
|
542
542
|
}
|
|
543
543
|
|
|
544
544
|
return {
|
|
545
|
-
|
|
545
|
+
// Only core client services are hard-injected. Remote namespaces and settings forms are
|
|
546
|
+
// optional per deployment, so they are resolved through `ctx.get` below: listing one of
|
|
547
|
+
// them here leaves the plugin pending on a Host that never mounts it, and a pending plugin
|
|
548
|
+
// registers no tab at all — the settings page then reports no plugin views.
|
|
549
|
+
inject: ['slots', 'locale'],
|
|
546
550
|
apply(ctx) {
|
|
547
551
|
const zh = {
|
|
548
552
|
tab: '插件管理', search: '搜索当前视图的插件、配置、Skill 或 MCP', refresh: '刷新', loading: '正在读取 Host 状态…', loadingShort: '读取中…',
|
|
@@ -594,14 +598,6 @@ window.__ModuleLoader__.load({
|
|
|
594
598
|
}
|
|
595
599
|
ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'plugin-manager-wj: dictionaries')
|
|
596
600
|
const t = ctx.locale.bind(NS)
|
|
597
|
-
const list = async () => unwrap(await ctx.remote.pluginInventory.list(), 'pluginInventory.list')
|
|
598
|
-
const manager = ctx.remote.pluginManager
|
|
599
|
-
const forms = ctx.get('configForms')
|
|
600
|
-
|
|
601
|
-
// The skill catalog is session-scoped (`skills/list`) and optional. Both services are read
|
|
602
|
-
// through `ctx.get` rather than `inject`: a Client plugin that lists an optional service in
|
|
603
|
-
// `inject` stays pending on a Host without it, which would take the whole tab down. Names are
|
|
604
|
-
// probed instead of hardcoded so a differently named skills namespace needs no code change.
|
|
605
601
|
const service = name => {
|
|
606
602
|
try { return ctx.get(name) } catch (_error) { return undefined }
|
|
607
603
|
}
|
|
@@ -610,6 +606,17 @@ window.__ModuleLoader__.load({
|
|
|
610
606
|
if (direct) return direct
|
|
611
607
|
try { return ctx.get('remote')?.[name] } catch (_error) { return undefined }
|
|
612
608
|
}
|
|
609
|
+
const list = async () => {
|
|
610
|
+
const inventory = namespace('pluginInventory')
|
|
611
|
+
if (!inventory || typeof inventory.list !== 'function') throw new Error('pluginInventory.list: unavailable')
|
|
612
|
+
return unwrap(await inventory.list(), 'pluginInventory.list')
|
|
613
|
+
}
|
|
614
|
+
const forms = service('configForms')
|
|
615
|
+
|
|
616
|
+
// The skill catalog is session-scoped (`skills/list`) and optional. Both services are read
|
|
617
|
+
// through `ctx.get` rather than `inject`: a Client plugin that lists an optional service in
|
|
618
|
+
// `inject` stays pending on a Host without it, which would take the whole tab down. Names are
|
|
619
|
+
// probed instead of hardcoded so a differently named skills namespace needs no code change.
|
|
613
620
|
const SKILL_NAMESPACE_NAMES = ['skills', 'skill', 'skillCatalog']
|
|
614
621
|
const skillsRemote = () => {
|
|
615
622
|
for (const name of SKILL_NAMESPACE_NAMES) {
|
|
@@ -655,7 +662,7 @@ window.__ModuleLoader__.load({
|
|
|
655
662
|
ctx.slots.inject('settings.plugins.tab', () => ctx.slots.register({
|
|
656
663
|
name: 'settings.plugins.tab', id: 'wj-registration-inventory', order: 20,
|
|
657
664
|
label: () => t('tab'), locale: NS,
|
|
658
|
-
inject: () => ({ list, manager, forms, loadSkills, readSessionId: activeSessionId, watchSessions }),
|
|
665
|
+
inject: () => ({ list, manager: namespace('pluginManager'), forms, loadSkills, readSessionId: activeSessionId, watchSessions }),
|
|
659
666
|
}, ManagerPage))
|
|
660
667
|
},
|
|
661
668
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinyforge/dsh-plugin-manager-wj",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Switchable plugin, configuration, skill and MCP views with health diagnostics, configuration provenance, and tool/MCP inventory for DeepSeek Harness.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|