dsh-plugin-resolver 0.1.0 → 0.1.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.
- package/ABLATION.md +1 -1
- package/BENCHMARK.md +1 -1
- package/README.md +15 -15
- package/logic/install.js +7 -13
- package/package.json +1 -1
package/ABLATION.md
CHANGED
package/BENCHMARK.md
CHANGED
|
@@ -71,6 +71,6 @@ node test/benchmark.mjs
|
|
|
71
71
|
## 4. 插件不能压缩的部分(诚实边界)
|
|
72
72
|
|
|
73
73
|
- **pnpm 下载与编译时间**是物理成本:镜像安装仍要 ~13 s,源码构建仍要 ~2 分钟。插件省的是决策、试错、验证与上下文,不是 CPU/带宽。
|
|
74
|
-
- **替换已加载插件**仍要重启宿主(`restart-required`):这是 loader 模块缓存 +
|
|
74
|
+
- **替换已加载插件**仍要重启宿主(`restart-required`):这是 loader 模块缓存 + 打包宿主没有 Node 内部 loader 的硬边界,插件如实报出来,不伪装成功。
|
|
75
75
|
- **同名歧义**仍需要一次人类/上层的选择(`owner=`),插件故意不猜。
|
|
76
76
|
- 目录是社区维护的第三方列表,插件只保证"按声明来源装对版本",不做安全审计。
|
package/README.md
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
[](https://github.com/sakikoTGW/dsh-plugin-resolver/actions/workflows/test.yml)
|
|
7
7
|
[](https://github.com/sakikoTGW/dsh-plugin-resolver/actions/workflows/ablation.yml)
|
|
8
|
+
[](https://www.npmjs.com/package/dsh-plugin-resolver)
|
|
8
9
|
[](LICENSE)
|
|
9
10
|
[](package.json)
|
|
10
11
|
[](https://github.com/deepseek-ai/deepseek-harness)
|
|
@@ -20,13 +21,13 @@
|
|
|
20
21
|
|
|
21
22
|
## 为什么要它
|
|
22
23
|
|
|
23
|
-
**场景**:给一台 DSH
|
|
24
|
+
**场景**:给一台 DSH 装两个真实插件——`dsh-better-sidebar`(npm 上的 latest 不保证兼容当前内核)和 `dsh-browser`(6 个同名 owner、GitHub-only、还要本地构建扩展)。当时在 agent 侧,这是这样一串手工活:
|
|
24
25
|
|
|
25
26
|
| 实际会发生的事 | 代价(真机实测) |
|
|
26
27
|
|---|---|
|
|
27
28
|
| 目录在 GitHub Pages 上,拉一次 6.4 MB | **91 s**,模型还得读一堆条目 |
|
|
28
29
|
| 同一个名字有多个 owner(`dsh-browser` 有 6 个) | 靠猜,猜错就装错来源 |
|
|
29
|
-
| `latest`
|
|
30
|
+
| `latest` 未必兼容当前内核(peer 线或 `engines.dsh` 可能高于宿主) | 装上后启动预检把它静默禁用 |
|
|
30
31
|
| 直连 npmjs 慢 | 两次 **90 s 超时**,换镜像后 13.4 s |
|
|
31
32
|
| GitHub-only 仓库不提交构建产物 | `dsh plugin add github:…` 装了个 `main` 指向不存在文件的包 |
|
|
32
33
|
| 装完不知道有没有生效 | 需要另找手段回读 loader entry / 前端 boot 表 |
|
|
@@ -55,12 +56,12 @@ flowchart LR
|
|
|
55
56
|
要求 **DSH `>=0.2.0-rc.2 <0.3.0`**(已在 `engines.dsh` 声明)。纯 JS、无构建、无 install 脚本,三种方式都不需要 `allowBuilds` 授权:
|
|
56
57
|
|
|
57
58
|
```sh
|
|
58
|
-
# npm
|
|
59
|
-
dsh plugin --profile
|
|
59
|
+
# npm(已发布 0.1.1;profile 名以你的 DSH 安装为准)
|
|
60
|
+
dsh plugin --profile <profile> add dsh-plugin-resolver
|
|
60
61
|
# GitHub 源码安装(建议锁 commit)
|
|
61
|
-
dsh plugin --profile
|
|
62
|
+
dsh plugin --profile <profile> add github:sakikoTGW/dsh-plugin-resolver#<commit>
|
|
62
63
|
# tarball
|
|
63
|
-
npm pack && dsh plugin --profile
|
|
64
|
+
npm pack && dsh plugin --profile <profile> add ./dsh-plugin-resolver-0.1.1.tgz
|
|
64
65
|
```
|
|
65
66
|
|
|
66
67
|
装完(宿主重启后最稳)直接说:
|
|
@@ -68,7 +69,7 @@ npm pack && dsh plugin --profile web add ./dsh-plugin-resolver-0.1.0.tgz
|
|
|
68
69
|
> "帮我装 dsh-browser" → 它会先问/列出 6 个同名候选;
|
|
69
70
|
> "装 dsh-builtin-browser" → 自动选到与你内核兼容的版本并装好。
|
|
70
71
|
|
|
71
|
-
|
|
72
|
+
插件市场(Discover)索引(在插件页打开实验性「自定义插件市场」,然后 `插件 → 发现 → 添加索引源`):
|
|
72
73
|
|
|
73
74
|
```text
|
|
74
75
|
https://sakikoTGW.github.io/dsh-plugin-resolver/market/index.json
|
|
@@ -78,19 +79,18 @@ https://sakikoTGW.github.io/dsh-plugin-resolver/market/index.json
|
|
|
78
79
|
|
|
79
80
|
```text
|
|
80
81
|
$ plugin_resolve dsh-builtin-browser
|
|
81
|
-
target kind: npm running DSH: 0.2.
|
|
82
|
+
target kind: npm running DSH: 0.2.1-rc.2
|
|
82
83
|
package: dsh-builtin-browser@0.4.13
|
|
83
84
|
install spec: dsh-builtin-browser@0.4.13
|
|
84
85
|
registry: https://registry.npmmirror.com/
|
|
85
86
|
notes:
|
|
86
|
-
- newest
|
|
87
|
+
- newest published version whose DSH peer range accepts the running host
|
|
87
88
|
```
|
|
88
89
|
|
|
89
90
|
```text
|
|
90
91
|
$ plugin_resolve dsh-better-sidebar
|
|
91
|
-
package: dsh-better-sidebar@0.
|
|
92
|
-
|
|
93
|
-
- 0.28.0: @deepseek-ai/dsh-agent needs ^0.2.1-rc.1, host is 0.2.0-rc.2
|
|
92
|
+
package: dsh-better-sidebar@0.28.0
|
|
93
|
+
install spec: dsh-better-sidebar@0.28.0
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
## 四个工具
|
|
@@ -128,7 +128,7 @@ logic/ 目录 / 版本 / 兼容 / 安装编排(每次调用按 mti
|
|
|
128
128
|
- **改 `logic/` 任何文件 → 下一次工具调用立即生效,不用重启宿主**
|
|
129
129
|
- 只有改动工具定义层(`index.js` / `host/register.js`)才需要重启
|
|
130
130
|
|
|
131
|
-
|
|
131
|
+
这是为无 HMR 的打包运行环境设计的:宿主拿不到真 HMR 所需的 Node 内部模块加载器,但"重新 import 一个带新 query 的模块"完全可行。
|
|
132
132
|
|
|
133
133
|
## 效果
|
|
134
134
|
|
|
@@ -163,10 +163,10 @@ npm run ablate # 消融
|
|
|
163
163
|
## 已知限制
|
|
164
164
|
|
|
165
165
|
- 兼容性以 npm 元数据里的 peer / `engines.dsh` 为准,宿主启动预检另有判断时以宿主为准;
|
|
166
|
-
- **替换已加载插件**仍需要重启宿主(loader 模块缓存 +
|
|
166
|
+
- **替换已加载插件**仍需要重启宿主(loader 模块缓存 + 打包宿主无 Node 内部 loader),插件会如实报 `restart-required`;
|
|
167
167
|
- 同名歧义不猜,需要调用方给 `owner=` 或完整 spec;
|
|
168
168
|
- 目录是社区维护的第三方列表,插件只保证"按声明来源装对版本",不做安全审计;
|
|
169
|
-
- GitHub
|
|
169
|
+
- GitHub 源码构建依赖宿主环境里的 `pnpm`(PATH 或 `DSH_PNPM_PATH`)与 `tar`,大仓库首次构建较慢。
|
|
170
170
|
|
|
171
171
|
## License
|
|
172
172
|
|
package/logic/install.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
const __v = new URL(import.meta.url).searchParams.get('v') ?? ''
|
|
3
|
-
const __q = (name) => `./${name}${__v === '' ? '' : `?v=${encodeURIComponent(__v)}`}`
|
|
4
|
-
const { dshHome, dirExists, runProcess } = await import(__q('util.js'))
|
|
5
|
-
const { registryBase } = await import(__q('resolve.js'))
|
|
1
|
+
// Reloadable module: local dependencies carry this module's `?v=` query.
|
|
2
|
+
const __v = new URL(import.meta.url).searchParams.get('v') ?? ''
|
|
3
|
+
const __q = (name) => `./${name}${__v === '' ? '' : `?v=${encodeURIComponent(__v)}`}`
|
|
4
|
+
const { dshHome, dirExists, runProcess } = await import(__q('util.js'))
|
|
5
|
+
const { registryBase } = await import(__q('resolve.js'))
|
|
6
6
|
/**
|
|
7
7
|
* Installation: drive the profile's plugin manager, build GitHub-only sources,
|
|
8
8
|
* and verify what actually landed.
|
|
@@ -162,14 +162,8 @@ export async function verifyInstall(ctx, manager, packageName) {
|
|
|
162
162
|
|
|
163
163
|
/** Locate a pnpm executable usable for a source build. */
|
|
164
164
|
export function resolvePnpm() {
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
process.platform === 'win32'
|
|
168
|
-
? [path.join(home, '.desktop-bin', 'pnpm.cmd'), path.join(home, '..', '..', '.desktop-bin', 'pnpm.cmd')]
|
|
169
|
-
: [path.join(home, '.desktop-bin', 'pnpm')]
|
|
170
|
-
for (const candidate of candidates) {
|
|
171
|
-
if (existsSync(candidate)) return candidate
|
|
172
|
-
}
|
|
165
|
+
const explicit = process.env.DSH_PNPM_PATH
|
|
166
|
+
if (typeof explicit === 'string' && explicit !== '' && existsSync(explicit)) return explicit
|
|
173
167
|
return process.platform === 'win32' ? 'pnpm.cmd' : 'pnpm'
|
|
174
168
|
}
|
|
175
169
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-resolver",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Agent-facing DSH plugin resolver: search the catalog, pick a version the running DSH accepts, install (registry or GitHub-source build), and verify - no trial and error.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|