@tinyforge/dsh-plugin-manager-wj 1.3.1 → 1.3.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/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 Skills view needs two optional client services: the skills Remote and a live session. Both are read 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 — which would take the whole tab down. The view therefore degrades instead of 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.
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,19 +49,23 @@ npm install @tinyforge/dsh-plugin-manager-wj
49
49
  ## Release
50
50
 
51
51
  ```sh
52
- npm test # node --test: 4 view tests + 3 patch checks
52
+ npm test # node --test: 13 checks (views, inject contract, module id, 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.1 && git push --tags`) so the GitHub history matches the registry.
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.3 && git push --tags`) so the GitHub history matches the registry.
57
57
 
58
58
  ## Development
59
59
 
60
60
  The package is an ES module. `index.js` is the Host entry point and `client.js` contains the browser UI. Localized package metadata is in `locale/`; the UI's full dictionaries are registered in `client.js`.
61
61
 
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.
62
+ `client.js` registers with `__ModuleLoader__.load({ id: '@tinyforge/dsh-plugin-manager-wj', … })`. That id must be the bare package name, scope included: the client module loader keys each Loader row by package name, and a bundle that registers any other id is reported as loaded without registering its row, which leaves the plugin without a fiber and the settings tab missing entirely. Renaming the package means updating that id in the same commit.
63
+
64
+ - `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, a transient catalog failure recovers from the inline retry, and the tab still registers on a Host that mounts no optional services.
63
65
  - `node --check client.js` checks the browser bundle syntax.
64
66
  - `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.
67
+ - `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.
68
+ - `tests/module-id.test.js` asserts the registered module id equals `package.json`'s `name`, so a rename cannot silently detach the browser bundle from its Loader row.
65
69
  - `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
70
  - `tests/parse-check.html` is a minimal browser smoke page: it confirms `client.js` parses and registers `settings.plugins.tab`.
67
71
 
package/README.zh.md CHANGED
@@ -30,7 +30,7 @@
30
30
 
31
31
  需要提供插件管理 Remote、设置表单和运行时清单的 Harness Host。较旧 Host 可能只能查看清单,或显示诊断不可用;升级 Harness 后才能执行管理操作。只有当前 Profile 可寻址的插件可以启停。
32
32
 
33
- Skill 视图需要两个可选客户端服务:skills Remote 与一个存活会话。两者都在调用时通过 `ctx.get` 读取,不写进 `inject`——把可选服务写进 `inject` 会让客户端插件在缺少该服务的 Host 上一直处于 pending 状态,整个标签页都不会出现。因此该视图只会降级而不会消失:没有 Remote 时给出说明;没有会话时进入等待状态,一旦出现会话或活动会话切换,就自动加载目录,无需手动刷新。命名空间是探测出来的而不是写死的(依次尝试 `skills`、`skill`、`skillCatalog`,再扫描任何含 “skill” 的已注册 `remote.*`),所以 Host 改名也不需要改代码。Skill 在这里是只读的,界面不会加载 skill 正文。此界面不安装或卸载包、不编辑凭据,也不运行任意修复命令。
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,19 +49,23 @@ npm install @tinyforge/dsh-plugin-manager-wj
49
49
  ## 发布
50
50
 
51
51
  ```sh
52
- npm test # node --test:4 个视图测试 + 3 个 patch 检查
52
+ npm test # node --test:13 项检查(视图、inject 契约、模块 id、patch 结构)
53
53
  npm publish --access public # 发布到 registry.npmjs.org
54
54
  ```
55
55
 
56
- 包名带 scope,发布新版本需要 `@tinyforge` npm scope 的维护者权限。发布后给对应提交打 tag(`git tag v1.3.1 && git push --tags`),让 GitHub 历史与 registry 版本对应。
56
+ 包名带 scope,发布新版本需要 `@tinyforge` npm scope 的维护者权限。发布后给对应提交打 tag(`git tag v1.3.3 && git push --tags`),让 GitHub 历史与 registry 版本对应。
57
57
 
58
58
  ## 开发
59
59
 
60
60
  本包使用 ES module。`index.js` 是 Host 入口,`client.js` 是浏览器界面。本地化包元数据位于 `locale/`,界面完整词典在 `client.js` 中注册。
61
61
 
62
- - `node --test` 运行 `tests/client.test.js` 的行为检查:四个视图渲染并可切换、访问过的视图保持挂载、搜索与启停作用于当前视图、密钥配置对象不会进入编辑器、打开会话后无需刷新即加载 Skill 目录、改名后的 skills 命名空间能被发现,以及瞬时目录失败可就地重试恢复。
62
+ `client.js` 以 `__ModuleLoader__.load({ id: '@tinyforge/dsh-plugin-manager-wj', … })` 注册。这个 id 必须是完整包名(含 scope):客户端模块加载器按包名给每个 Loader 行建索引,注册成别的 id 会被判定为"加载了却没有注册自身所在的行",插件因此拿不到 fiber,设置里的标签页完全不出现。改包名时必须在同一次提交里一起改这个 id。
63
+
64
+ - `node --test` 运行 `tests/client.test.js` 的行为检查:四个视图渲染并可切换、访问过的视图保持挂载、搜索与启停作用于当前视图、密钥配置对象不会进入编辑器、打开会话后无需刷新即加载 Skill 目录、改名后的 skills 命名空间能被发现、瞬时目录失败可就地重试恢复,以及 Host 不挂载任何可选服务时标签页仍然注册。
63
65
  - `node --check client.js` 检查浏览器 bundle 语法。
64
66
  - `tests/patch.test.js` 解析 `cordis.patch.yml`,确保没有裸标量以 YAML 保留字符开头 —— 带 scope 的包名必须保持加引号,否则 Host 会拒绝该 bundle patch。
67
+ - `tests/inject.test.js` 把插件的 `inject` 固定为仅核心服务,这样一旦有人重新硬注入可选 remote,测试就会失败,而不是在某些 Host 上悄悄把设置页清空。
68
+ - `tests/module-id.test.js` 断言注册的模块 id 等于 `package.json` 的 `name`,避免改名后浏览器 bundle 悄悄脱离自己的 Loader 行。
65
69
  - `tests/harness.html` 在浏览器中用测试夹具挂载真实 `client.js`,不依赖 Node 也能断言同一批行为;直接从磁盘打开并读取 JSON 报告。
66
70
  - `tests/parse-check.html` 是最小的浏览器冒烟页:确认 `client.js` 能解析并注册 `settings.plugins.tab`。
67
71
 
package/client.js CHANGED
@@ -1,6 +1,10 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  window.__ModuleLoader__.load({
3
- id: 'dsh-plugin-manager-wj',
3
+ // The module id must be the bare package name: dsh-client-modules attaches a package's
4
+ // browser half to its Loader row by that name and rejects a bundle that registers any other
5
+ // id ("loaded without registering ... via __ModuleLoader__.load"), which leaves the plugin
6
+ // with no fiber and therefore no slot registration.
7
+ id: '@tinyforge/dsh-plugin-manager-wj',
4
8
  factory(require) {
5
9
  const React = require('react')
6
10
  const h = React.createElement
@@ -542,7 +546,11 @@ window.__ModuleLoader__.load({
542
546
  }
543
547
 
544
548
  return {
545
- inject: ['slots', 'locale', 'remote', 'remote.pluginInventory', 'remote.pluginManager', 'configForms'],
549
+ // Only core client services are hard-injected. Remote namespaces and settings forms are
550
+ // optional per deployment, so they are resolved through `ctx.get` below: listing one of
551
+ // them here leaves the plugin pending on a Host that never mounts it, and a pending plugin
552
+ // registers no tab at all — the settings page then reports no plugin views.
553
+ inject: ['slots', 'locale'],
546
554
  apply(ctx) {
547
555
  const zh = {
548
556
  tab: '插件管理', search: '搜索当前视图的插件、配置、Skill 或 MCP', refresh: '刷新', loading: '正在读取 Host 状态…', loadingShort: '读取中…',
@@ -594,14 +602,6 @@ window.__ModuleLoader__.load({
594
602
  }
595
603
  ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'plugin-manager-wj: dictionaries')
596
604
  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
605
  const service = name => {
606
606
  try { return ctx.get(name) } catch (_error) { return undefined }
607
607
  }
@@ -610,6 +610,17 @@ window.__ModuleLoader__.load({
610
610
  if (direct) return direct
611
611
  try { return ctx.get('remote')?.[name] } catch (_error) { return undefined }
612
612
  }
613
+ const list = async () => {
614
+ const inventory = namespace('pluginInventory')
615
+ if (!inventory || typeof inventory.list !== 'function') throw new Error('pluginInventory.list: unavailable')
616
+ return unwrap(await inventory.list(), 'pluginInventory.list')
617
+ }
618
+ const forms = service('configForms')
619
+
620
+ // The skill catalog is session-scoped (`skills/list`) and optional. Both services are read
621
+ // through `ctx.get` rather than `inject`: a Client plugin that lists an optional service in
622
+ // `inject` stays pending on a Host without it, which would take the whole tab down. Names are
623
+ // probed instead of hardcoded so a differently named skills namespace needs no code change.
613
624
  const SKILL_NAMESPACE_NAMES = ['skills', 'skill', 'skillCatalog']
614
625
  const skillsRemote = () => {
615
626
  for (const name of SKILL_NAMESPACE_NAMES) {
@@ -655,7 +666,7 @@ window.__ModuleLoader__.load({
655
666
  ctx.slots.inject('settings.plugins.tab', () => ctx.slots.register({
656
667
  name: 'settings.plugins.tab', id: 'wj-registration-inventory', order: 20,
657
668
  label: () => t('tab'), locale: NS,
658
- inject: () => ({ list, manager, forms, loadSkills, readSessionId: activeSessionId, watchSessions }),
669
+ inject: () => ({ list, manager: namespace('pluginManager'), forms, loadSkills, readSessionId: activeSessionId, watchSessions }),
659
670
  }, ManagerPage))
660
671
  },
661
672
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinyforge/dsh-plugin-manager-wj",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
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",