dsh-agent-plugins-market 0.5.3 → 0.6.1

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.
Files changed (86) hide show
  1. package/README.md +29 -3
  2. package/README.zh.md +29 -3
  3. package/client/client.js +1395 -202
  4. package/client/client.js.map +1 -1
  5. package/lib/application/catalog.js +537 -71
  6. package/lib/application/details.js +39 -12
  7. package/lib/catalog/archive.js +341 -0
  8. package/lib/catalog/git.js +85 -12
  9. package/lib/catalog/legacy-root-migration.js +51 -0
  10. package/lib/catalog/lsp-spec.js +87 -0
  11. package/lib/catalog/manifests.js +84 -32
  12. package/lib/catalog/paths.js +65 -7
  13. package/lib/catalog/scan-pipeline.js +50 -0
  14. package/lib/catalog/scan-resolvers.js +402 -0
  15. package/lib/catalog/source-catalog.js +22 -8
  16. package/lib/catalog/suite-scanner.js +5 -176
  17. package/lib/catalog/surfaces.js +80 -30
  18. package/lib/contracts/lsp-status.js +2 -0
  19. package/lib/contracts/market.js +8 -1
  20. package/lib/index.js +118 -13
  21. package/lib/model/state.js +14 -1
  22. package/lib/model/types.js +21 -2
  23. package/lib/routes.js +88 -6
  24. package/lib/runtime/commands-mounts.js +6 -2
  25. package/lib/runtime/hooks-mounts.js +9 -6
  26. package/lib/runtime/lsp-direct-config.js +44 -0
  27. package/lib/runtime/lsp-mounts.js +236 -0
  28. package/lib/runtime/lsp-status.js +96 -0
  29. package/lib/runtime/mcp-backend.js +60 -0
  30. package/lib/runtime/mcp-client/bridge.js +126 -0
  31. package/lib/runtime/mcp-client/config.js +42 -0
  32. package/lib/runtime/mcp-client/connection.js +380 -0
  33. package/lib/runtime/mcp-client/host-seams.js +88 -0
  34. package/lib/runtime/mcp-client/json-schema-subset.js +181 -0
  35. package/lib/runtime/mcp-client/oauth.js +379 -0
  36. package/lib/runtime/mcp-client/tools.js +432 -0
  37. package/lib/runtime/mcp-client/transport.js +103 -0
  38. package/lib/runtime/mcp-config.js +202 -56
  39. package/lib/runtime/mcp-credentials.js +20 -0
  40. package/lib/runtime/mcp-mounts.js +245 -27
  41. package/lib/runtime/mcp-overrides.js +64 -6
  42. package/lib/runtime/mcp-redaction.js +92 -0
  43. package/lib/runtime/mcp-status.js +74 -31
  44. package/lib/runtime/reconciler.js +35 -1
  45. package/lib/runtime/regions.js +56 -0
  46. package/lib/types/application/catalog.d.ts +191 -14
  47. package/lib/types/application/details.d.ts +1 -6
  48. package/lib/types/application/queries.d.ts +28 -1
  49. package/lib/types/catalog/archive.d.ts +48 -0
  50. package/lib/types/catalog/git.d.ts +27 -3
  51. package/lib/types/catalog/legacy-root-migration.d.ts +14 -0
  52. package/lib/types/catalog/lsp-spec.d.ts +14 -0
  53. package/lib/types/catalog/manifests.d.ts +16 -1
  54. package/lib/types/catalog/paths.d.ts +23 -2
  55. package/lib/types/catalog/scan-pipeline.d.ts +76 -0
  56. package/lib/types/catalog/scan-resolvers.d.ts +81 -0
  57. package/lib/types/catalog/source-catalog.d.ts +5 -0
  58. package/lib/types/catalog/suite-scanner.d.ts +14 -7
  59. package/lib/types/catalog/surfaces.d.ts +3 -3
  60. package/lib/types/contracts/lsp-status.d.ts +53 -0
  61. package/lib/types/contracts/market.d.ts +55 -1
  62. package/lib/types/contracts/mcp-status.d.ts +14 -2
  63. package/lib/types/index.d.ts +24 -8
  64. package/lib/types/model/types.d.ts +52 -3
  65. package/lib/types/runtime/lsp-direct-config.d.ts +12 -0
  66. package/lib/types/runtime/lsp-mounts.d.ts +89 -0
  67. package/lib/types/runtime/lsp-status.d.ts +30 -0
  68. package/lib/types/runtime/mcp-backend.d.ts +49 -0
  69. package/lib/types/runtime/mcp-client/bridge.d.ts +37 -0
  70. package/lib/types/runtime/mcp-client/config.d.ts +123 -0
  71. package/lib/types/runtime/mcp-client/connection.d.ts +82 -0
  72. package/lib/types/runtime/mcp-client/host-seams.d.ts +89 -0
  73. package/lib/types/runtime/mcp-client/json-schema-subset.d.ts +58 -0
  74. package/lib/types/runtime/mcp-client/oauth.d.ts +121 -0
  75. package/lib/types/runtime/mcp-client/tools.d.ts +136 -0
  76. package/lib/types/runtime/mcp-client/transport.d.ts +36 -0
  77. package/lib/types/runtime/mcp-config.d.ts +38 -15
  78. package/lib/types/runtime/mcp-credentials.d.ts +9 -0
  79. package/lib/types/runtime/mcp-mounts.d.ts +56 -6
  80. package/lib/types/runtime/mcp-overrides.d.ts +23 -4
  81. package/lib/types/runtime/mcp-redaction.d.ts +7 -0
  82. package/lib/types/runtime/mcp-status.d.ts +4 -2
  83. package/lib/types/runtime/reconciler.d.ts +22 -4
  84. package/lib/types/runtime/regions.d.ts +37 -0
  85. package/package.json +16 -12
  86. package/schemas/1.0.0/mcp.schema.json +22 -0
package/README.md CHANGED
@@ -64,6 +64,7 @@ Build artifacts (`lib/`, `client/`) are not committed; npm publishes them via `p
64
64
  - **Runtime injection**
65
65
  - **Skills** — a `ctx.skills` SkillProvider (project rank 250 / user rank 450); `${CLAUDE_PLUGIN_ROOT}` is substituted so Claude Code-authored skills work verbatim, and appear in the `/` slash menu.
66
66
  - **MCP servers** — every valid `mcp.json` server of an enabled plugin mounts a live `dsh-mcp-client` child; tools appear as `mcp__<plugin>__<server>__<tool>`.
67
+ - **MCP credentials** — `${ENV_NAME}` references resolve through the optional DSH credentials service before a child starts; missing references block the spawn and surface as `needs-credentials`. The Web detail view uses write-only credentials operations and never persists token values in suite state or overrides.
67
68
  - **Hooks** — a plugin's `hooks/hooks.json` mounts the `dsh-hooks-claude-code` bridge on the harness interception points (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, Stop, SubagentStart, SubagentStop).
68
69
  - **Commands / subagents** — `commands/*.md` register as dsh slash commands; `agents/*.md` register as `agent-<name>` skills.
69
70
  - **Model context** — skills flow through the host-native skill catalog and MCP tools register directly through `dsh-mcp-client`; suite inventory and source metadata remain available in the Web market page without adding a redundant model-facing inventory tool.
@@ -97,9 +98,28 @@ Sources persist in `~/.dsh/agent-plugins/state.json`; cordis config seeds them (
97
98
  - { id: claude-plugins-official, url: 'https://github.com/anthropics/claude-plugins-official' }
98
99
  - { id: ui-ux-pro-max, url: 'https://github.com/nextlevelbuilder/ui-ux-pro-max-skill.git' }
99
100
  - { id: my-local-plugin, url: '/Users/me/work/my-plugin', local: true }
101
+ - { id: packaged-plugin, url: 'https://example.com/plugin-0.1.zip', kind: archive, sha256: '<64-hex digest>' }
100
102
  ```
101
103
 
102
- A `local: true` source reads the directory in place (live working tree; never deleted on removal).
104
+ A `local: true` source reads the directory in place (live working tree; never deleted on removal). Discovery results are cached for up to 30 seconds and reused across install/enable/panel actions, so working-tree edits of local sources appear on the next cache refresh (any source mutation, the refresh button, or the 30 s TTL). An `archive` source downloads an HTTPS `.zip` / `.tar.gz` / `.tgz` / `.tar` payload (256 MiB cap, optional `sha256` integrity pin) and extracts it as the checkout.
105
+
106
+ ### Manual clones, adoption, and network tuning
107
+
108
+ Cloning from the UI times out on a restricted network? Clone the repository yourself into the checkout root (`~/.dsh/agent-plugins/.sources/<id>/`) — the market page lists it under **unregistered local checkouts** with a one-click **adopt** action that registers it in place (no re-clone, no deletion, ever). Adding a URL whose checkout already exists with a matching `origin` remote adopts it automatically instead of cloning a second copy.
109
+
110
+ Git/archive acquisition is tunable through the host config:
111
+
112
+ ```yaml
113
+ - id: dsh-agent-plugins-market
114
+ config:
115
+ git:
116
+ proxy: 'http://127.0.0.1:7890' # injected as git http/https proxy
117
+ insteadOf: { 'https://github.com/': 'https://mirror.example/https://github.com/' }
118
+ timeoutMs: 300000 # per git invocation (default 120000)
119
+ cloneRetry: true # one automatic retry (default)
120
+ fallbackTarball: false # retry a failed github.com clone as a codeload tarball download
121
+ allowHttpArchives: false # permit plain-http archive URLs (intranet mirrors)
122
+ ```
103
123
 
104
124
  ## Comparison with other DSH ↔ Claude Code bridges
105
125
 
@@ -135,6 +155,10 @@ Yes — through this plugin. It reads `.claude-plugin/marketplace.json` + per-pl
135
155
 
136
156
  Yes. Every valid `mcp.json` server of an enabled suite mounts a live `dsh-mcp-client` child, so MCP tools are callable by the DSH agent. `mcp.json` is validated strictly; `.mcp.json` is parsed leniently with placeholder support (`${CLAUDE_PLUGIN_ROOT}`, `${CLAUDE_PLUGIN_DATA}`, `${NAME:-default}`).
137
157
 
158
+ ### How do MCP servers that require an environment token work?
159
+
160
+ Declare the server's environment value as a reference, for example `"env": { "FOO_TOKEN": "${FOO_TOKEN}" }`. Before starting the child, the market resolves that reference through DSH credentials. Open the suite detail view to configure a writable credential through the Host credentials service; the value is write-only and is never stored in the suite or override JSON. A read-only launch-environment credential must be changed before restarting DSH. Missing references block the child start and show `needs-credentials` instead of silently starting an unusable server.
161
+
138
162
  ### What about Claude Code hooks?
139
163
 
140
164
  A suite's `hooks/hooks.json` is mounted through the official `@deepseek-ai/dsh-hooks-claude-code` bridge onto the harness interception points (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, Stop, SubagentStart, SubagentStop). Only the mapped command-hook subset runs — see the bridge's README for the exact mapping.
@@ -159,14 +183,16 @@ Yes — MIT licensed, published on [npm](https://www.npmjs.com/package/dsh-agent
159
183
 
160
184
  - `ctx.skills` (dsh-skill) is required.
161
185
  - Optional peers: `@deepseek-ai/dsh-mcp-client` (MCP injection), `@deepseek-ai/dsh-hooks-claude-code` (hooks bridge); missing capabilities degrade gracefully.
186
+ - The Host credentials service is optional: standard DSH profiles provide it for write-only token configuration and live remounts; without it, `${ENV_NAME}` falls back to the launch environment and requires a restart after changes.
162
187
  - Web GUI ≥ 0.1.0-rc.6.
163
188
 
164
189
  ## Security model
165
190
 
166
- - Git sources clone through `git` via `execFile` (no shell), depth 1, `--ff-only` pulls, 120s timeouts; local sources are read in place and never deleted.
191
+ - Git sources clone through `git` via `execFile` (no shell), depth 1, shallow `fetch` + `reset` updates, configurable timeouts/proxy/mirrors with a low-speed guard; local sources are read in place and never deleted. Archive sources are HTTPS-only by default, capped at 256 MiB, extracted with path-traversal guards, and optionally pinned to a SHA-256 digest.
167
192
  - Mutating HTTP routes accept same-origin POSTs only; bodies capped at 64 KiB.
168
193
  - Portable paths must start with `./` and resolve inside the plugin root (symlink escapes rejected); `${PLUGIN_ROOT}` / `${PLUGIN_DATA}` expand.
169
- - Third-party failures are always contained: broken manifests, invalid skills, escaping paths, unknown MCP transports, and mount failures are per-plugin diagnostics.
194
+ - Third-party failures are always contained: broken manifests, invalid skills, escaping paths, unknown MCP transports, missing MCP credentials, and mount failures are per-plugin diagnostics.
195
+ - MCP credential values are resolved in memory through the Host credentials service; status/detail projections redact sensitive fields and credential writes never persist literal values in suite state or overrides.
170
196
  - An error boundary wraps the whole market section and the detail modal: any preview render failure degrades to a notice instead of crashing the UI.
171
197
 
172
198
  ## Known limitations
package/README.zh.md CHANGED
@@ -64,6 +64,7 @@ dsh plugin --profile <名字> add github:Sivan757/dsh-agent-plugins-market
64
64
  - **运行时注入**
65
65
  - **技能**:注册 `ctx.skills` SkillProvider(项目 rank 250 / 用户 rank 450),`${CLAUDE_PLUGIN_ROOT}` 自动替换,Claude Code 生态技能原样可用,出现在「/」斜杠菜单;
66
66
  - **MCP 服务器**:启用套件的 `mcp.json` 每个合法 server 动态挂载 `dsh-mcp-client` 子插件,工具名 `mcp__<套件>__<server>__<工具>`;
67
+ - **MCP 凭据**:`${ENV_NAME}` 引用在子进程启动前通过可选的 DSH credentials service 解析;缺失引用会阻止启动并显示 `needs-credentials`。Web 详情页使用只写凭据操作,token 不会写入套件 state 或 override 文件;
67
68
  - **Hooks**:套件 `hooks/hooks.json` 挂载 `dsh-hooks-claude-code` 桥,映射到宿主拦截点(SessionStart、UserPromptSubmit、PreToolUse、PostToolUse、Stop、SubagentStart、SubagentStop);
68
69
  - **命令 / 子代理**:`commands/*.md` 注册为 dsh 斜杠命令;`agents/*.md` 注册为 `agent-<name>` 技能;
69
70
  - **模型上下文**:技能通过宿主原生 skill catalog 注入,MCP 工具通过 `dsh-mcp-client` 直接注册;套件清单与来源信息通过 Web 市场页查询,不注册冗余的模型侧 inventory 工具。
@@ -97,9 +98,28 @@ dsh plugin --profile <名字> add github:Sivan757/dsh-agent-plugins-market
97
98
  - { id: claude-plugins-official, url: 'https://github.com/anthropics/claude-plugins-official' }
98
99
  - { id: ui-ux-pro-max, url: 'https://github.com/nextlevelbuilder/ui-ux-pro-max-skill.git' }
99
100
  - { id: my-local-plugin, url: '/Users/me/work/my-plugin', local: true }
101
+ - { id: packaged-plugin, url: 'https://example.com/plugin-0.1.zip', kind: archive, sha256: '<64 位十六进制摘要>' }
100
102
  ```
101
103
 
102
- `local: true` 的源直接读取本地目录(实时反映工作树,移除源时不会删除目录)。
104
+ `local: true` 的源直接读取本地目录(实时反映工作树,移除源时不会删除目录)。扫描结果会缓存最多 30 秒,并在安装/启用/面板切换等操作间复用,因此本地源的工作树改动会在下一次缓存刷新时可见(任何源变更、刷新按钮,或 30 秒 TTL 到期)。`archive` 源下载 HTTPS 压缩包(`.zip` / `.tar.gz` / `.tgz` / `.tar`,256 MiB 上限,可选 `sha256` 完整性校验)并解压为 checkout。
105
+
106
+ ### 手动克隆、收编与网络调优
107
+
108
+ 界面上克隆超时?你可以自己把仓库克隆到 checkout 根(`~/.dsh/agent-plugins/.sources/<id>/`)——市场页会在「未登记的本地仓库」中列出它,并提供一键**收编**:原样登记、不重新克隆、永不删除。在 UI 里添加 URL 时,若已存在 `origin` 匹配的 checkout,也会自动收编而不是二次克隆。
109
+
110
+ git/压缩包获取可通过宿主配置调优:
111
+
112
+ ```yaml
113
+ - id: dsh-agent-plugins-market
114
+ config:
115
+ git:
116
+ proxy: 'http://127.0.0.1:7890' # 以 git http/https 代理注入
117
+ insteadOf: { 'https://github.com/': 'https://mirror.example/https://github.com/' }
118
+ timeoutMs: 300000 # 每次 git 调用超时(默认 120000)
119
+ cloneRetry: true # 失败自动重试一次(默认开)
120
+ fallbackTarball: false # github.com 克隆失败时回退为 codeload tarball 下载
121
+ allowHttpArchives: false # 允许明文 http 压缩包地址(内网镜像)
122
+ ```
103
123
 
104
124
  ## 与其他 DSH ↔ Claude Code 桥接项目的对比
105
125
 
@@ -135,6 +155,10 @@ dsh plugin --profile <名字> add dsh-agent-plugins-market
135
155
 
136
156
  可以。启用套件的每个合法 `mcp.json` server 都会挂载一个活的 `dsh-mcp-client` 子插件,DSH agent 可直接调用其工具。`mcp.json` 严格校验;`.mcp.json` 宽容解析并支持占位符(`${CLAUDE_PLUGIN_ROOT}`、`${CLAUDE_PLUGIN_DATA}`、`${NAME:-default}`)。
137
157
 
158
+ ### 只支持环境变量 token 的 MCP server 如何配置?
159
+
160
+ 在配置中把环境变量值写成引用,例如 `"env": { "FOO_TOKEN": "${FOO_TOKEN}" }`。子进程启动前,市场插件会通过 DSH credentials 解析该引用。打开套件详情即可通过 Host credentials service 配置可写凭据;token 只写入凭据存储,不写入套件或 override JSON,也不会回显。若凭据来自只读启动环境,需要在重启 DSH 前修改环境变量。引用缺失时会阻止子进程启动,并显示 `needs-credentials`,而不是静默启动一个不可用的 server。
161
+
138
162
  ### Claude Code hooks 呢?
139
163
 
140
164
  套件的 `hooks/hooks.json` 会通过官方 `@deepseek-ai/dsh-hooks-claude-code` 桥挂载到宿主拦截点(SessionStart、UserPromptSubmit、PreToolUse、PostToolUse、Stop、SubagentStart、SubagentStop)。仅支持该桥映射的命令 hooks 子集,具体映射见桥的 README。
@@ -159,14 +183,16 @@ dsh plugin --profile <名字> add dsh-agent-plugins-market
159
183
 
160
184
  - 必需 `ctx.skills`(dsh-skill)。
161
185
  - 可选 peer:`@deepseek-ai/dsh-mcp-client`(MCP 注入)、`@deepseek-ai/dsh-hooks-claude-code`(hooks 桥),缺失时对应能力受控降级。
186
+ - Host credentials service 为可选能力:标准 DSH profile 会提供它,用于只写 token 配置和实时重挂载;缺失时 `${ENV_NAME}` 回退到启动环境,修改后需要重启 DSH。
162
187
  - Web GUI ≥ 0.1.0-rc.6。
163
188
 
164
189
  ## 安全模型
165
190
 
166
- - git 源经 `execFile` 克隆(无 shell),`--depth 1`,`--ff-only`,120s 超时;本地源原地读取、移除不删除。
191
+ - git 源经 `execFile` 克隆(无 shell),`--depth 1`,shallow `fetch` + `reset` 更新,超时/代理/镜像可配置并带低速熔断;本地源原地读取、移除不删除。压缩包源默认仅 HTTPS、256 MiB 上限、带路径穿越防护的解压,可选 SHA-256 校验。
167
192
  - 变更类 HTTP 路由仅接受同源 POST,请求体上限 64 KiB。
168
193
  - 便携包路径必须 `./` 开头且解析后留在套件根内(拒绝 symlink 逃逸);`${PLUGIN_ROOT}`/`${PLUGIN_DATA}` 展开。
169
- - 第三方套件故障永远受控:坏清单、非法技能、逃逸路径、未知 MCP transport、挂载失败均为逐套件诊断。
194
+ - 第三方套件故障永远受控:坏清单、非法技能、逃逸路径、未知 MCP transport、缺失 MCP 凭据、挂载失败均为逐套件诊断。
195
+ - MCP 凭据值通过 Host credentials service 在内存中解析;状态和详情投影会脱敏敏感字段,凭据写入不会把字面 token 持久化到套件 state 或 override。
170
196
  - 错误边界包裹整个市场区与详情弹窗:任何预览渲染异常降级为提示,不会崩掉界面。
171
197
 
172
198
  ## 已知限制