dsh-plugin-marketplace 0.2.8 → 0.3.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/README.md +7 -0
- package/README.zh.md +5 -0
- package/client.js +45 -23
- package/index.js +20 -10
- package/package.json +54 -54
package/README.md
CHANGED
|
@@ -56,6 +56,13 @@ therefore require DSH `0.1.0-rc.7` or newer. DSH `0.1.0-rc.6` users must pin
|
|
|
56
56
|
`dsh-plugin-marketplace@0.2.6`, the last release carrying the legacy
|
|
57
57
|
settings-allowlist compatibility patch.
|
|
58
58
|
|
|
59
|
+
DSH `0.1.2-rc.1` removed the client-side `connection.api` (the legacy settings
|
|
60
|
+
RPC face); version 0.3.1 therefore writes through the bound `settingsScope`'s
|
|
61
|
+
own `mutate` (hosts older than `0.1.2-rc.1` still use the legacy channel).
|
|
62
|
+
Note: when dsh web is opened from a non-loopback origin (a LAN IP, say), DSH
|
|
63
|
+
keeps settings writes process-local, so install / AI-explain requests never
|
|
64
|
+
reach the host.
|
|
65
|
+
|
|
59
66
|
## How it works
|
|
60
67
|
|
|
61
68
|
| Layer | File | Role |
|
package/README.zh.md
CHANGED
|
@@ -46,6 +46,11 @@ DSH `0.1.0-rc.7` 起会公开全部已注册的 settings 命名空间,插件
|
|
|
46
46
|
请锁定 `dsh-plugin-marketplace@0.2.6`;这是最后一个包含旧 settings 白名单兼容
|
|
47
47
|
补丁的版本。
|
|
48
48
|
|
|
49
|
+
DSH `0.1.2-rc.1` 移除了客户端的 `connection.api`(旧 settings RPC 入口),
|
|
50
|
+
`0.3.1` 起改用 `settingsScope` 自带的 `mutate` 写入(`0.1.2-rc.1` 之前的主机仍走
|
|
51
|
+
旧通道)。注意:非本机回环(如局域网 IP)访问 dsh web 时,DSH 的设置写入是
|
|
52
|
+
进程本地的,安装 / AI 解释请求不会到达宿主。
|
|
53
|
+
|
|
49
54
|
## 实现方式
|
|
50
55
|
|
|
51
56
|
| 层 | 文件 | 作用 |
|
package/client.js
CHANGED
|
@@ -82,7 +82,7 @@ window.__ModuleLoader__.load({
|
|
|
82
82
|
aiExplain: "🤖 AI 解释",
|
|
83
83
|
aiExplaining: "AI 解释中,请稍候…",
|
|
84
84
|
aiExplainErr: "AI 解释失败:{msg}",
|
|
85
|
-
notExposed: "
|
|
85
|
+
notExposed: "无法写入插件市场的设置通道:DSH 版本过旧(需 0.1.0-rc.7+)、宿主半端未挂载,或当前页面不是本机回环访问;请通过 127.0.0.1 打开 dsh web 后重试。"
|
|
86
86
|
};
|
|
87
87
|
var en = {
|
|
88
88
|
nav: "Plugin Marketplace",
|
|
@@ -113,7 +113,7 @@ window.__ModuleLoader__.load({
|
|
|
113
113
|
aiExplain: "🤖 AI Explain",
|
|
114
114
|
aiExplaining: "AI is explaining…",
|
|
115
115
|
aiExplainErr: "AI explain failed: {msg}",
|
|
116
|
-
notExposed: "
|
|
116
|
+
notExposed: "The plugin-marketplace settings channel is not writable here: the DSH version is too old (0.1.0-rc.7+ required), the host half is not mounted, or this page is not a loopback connection. Open dsh web via 127.0.0.1 and try again."
|
|
117
117
|
};
|
|
118
118
|
|
|
119
119
|
// ── GitHub API ────────────────────────────────────────────────────────
|
|
@@ -184,6 +184,38 @@ window.__ModuleLoader__.load({
|
|
|
184
184
|
return promise;
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
+
// ── settings write channel ────────────────────────────────────────────
|
|
188
|
+
/**
|
|
189
|
+
* Write one namespace field through whichever settings channel this host
|
|
190
|
+
* exposes. dsh 0.1.2-rc.1 dropped `connection.api` (the old raw settings
|
|
191
|
+
* RPC); there the bound scope's own `mutate` (the remote.settings RPC) is
|
|
192
|
+
* the only write path. Older hosts (0.1.0-rc.7 / 0.1.1.x) have no public
|
|
193
|
+
* scope mutate but keep `connection.api`, whose structured error responses
|
|
194
|
+
* the UI can show verbatim. Always resolves `{ok, error?}` — refused or
|
|
195
|
+
* failed writes surface as a result, never as a rejection.
|
|
196
|
+
*/
|
|
197
|
+
function writeField(scope, api, field, value) {
|
|
198
|
+
if (scope && typeof scope.mutate === "function") {
|
|
199
|
+
return scope.mutate([{ op: "set", path: [field], value: value }]).then(function () {
|
|
200
|
+
// A refused write leaves the namespace view absent (the scope folds
|
|
201
|
+
// the outcome into its snapshot before the promise settles).
|
|
202
|
+
var snap = scope.getSnapshot();
|
|
203
|
+
if (!snap || snap.status !== "ready") return { ok: false, error: { code: "settings-not-exposed" } };
|
|
204
|
+
return { ok: true };
|
|
205
|
+
}, function (e) {
|
|
206
|
+
return { ok: false, error: { message: String(e && e.message || e) } };
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
return api.settings.mutate({
|
|
210
|
+
ns: "plugin-marketplace",
|
|
211
|
+
ops: [{ op: "set", path: [field], value: value }]
|
|
212
|
+
}).then(function (response) {
|
|
213
|
+
return (response && response.result) ? response.result : { ok: false, error: { message: "malformed settings response" } };
|
|
214
|
+
}, function (e) {
|
|
215
|
+
return { ok: false, error: { message: String(e && e.message || e) } };
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
|
|
187
219
|
// ── components ────────────────────────────────────────────────────────
|
|
188
220
|
function PluginCard(props) {
|
|
189
221
|
return h("li", null,
|
|
@@ -305,33 +337,21 @@ window.__ModuleLoader__.load({
|
|
|
305
337
|
};
|
|
306
338
|
var onInstall = react.useCallback(function (pkg) {
|
|
307
339
|
set(function (prev) { return Object.assign({}, prev, { installError: null }); });
|
|
308
|
-
api.
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
}).then(function (response) {
|
|
312
|
-
if (!response.result.ok) {
|
|
313
|
-
var detail = response.result.error || {};
|
|
314
|
-
set(function (prev) { return Object.assign({}, prev, { installError: mutateError(detail, "unknown") }); });
|
|
340
|
+
writeField(scope, api, "install", { pkg: pkg, ts: Date.now() }).then(function (result) {
|
|
341
|
+
if (!result.ok) {
|
|
342
|
+
set(function (prev) { return Object.assign({}, prev, { installError: mutateError(result.error, "unknown") }); });
|
|
315
343
|
}
|
|
316
|
-
}).catch(function (e) {
|
|
317
|
-
set(function (prev) { return Object.assign({}, prev, { installError: String(e && e.message || e) }); });
|
|
318
344
|
});
|
|
319
|
-
}, [api, t]);
|
|
345
|
+
}, [scope, api, t]);
|
|
320
346
|
// AI-explain request: the host answers over the same settings channel.
|
|
321
347
|
var onExplain = react.useCallback(function (repo, desc, readme) {
|
|
322
348
|
set(function (prev) { return Object.assign({}, prev, { explainError: null }); });
|
|
323
|
-
api.
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
}).then(function (response) {
|
|
327
|
-
if (!response.result.ok) {
|
|
328
|
-
var detail = response.result.error || {};
|
|
329
|
-
set(function (prev) { return Object.assign({}, prev, { explainError: mutateError(detail, "unknown") }); });
|
|
349
|
+
writeField(scope, api, "aiExplain", { repo: repo, desc: desc, readme: readme, ts: Date.now() }).then(function (result) {
|
|
350
|
+
if (!result.ok) {
|
|
351
|
+
set(function (prev) { return Object.assign({}, prev, { explainError: mutateError(result.error, "unknown") }); });
|
|
330
352
|
}
|
|
331
|
-
}).catch(function (e) {
|
|
332
|
-
set(function (prev) { return Object.assign({}, prev, { explainError: String(e && e.message || e) }); });
|
|
333
353
|
});
|
|
334
|
-
}, [api, t]);
|
|
354
|
+
}, [scope, api, t]);
|
|
335
355
|
var load = react.useCallback(function (q, sort, page, append) {
|
|
336
356
|
set(function (prev) { return Object.assign({}, prev, { loading: true, error: null }); });
|
|
337
357
|
fetchPage(q, sort, page).then(function (out) {
|
|
@@ -414,7 +434,9 @@ window.__ModuleLoader__.load({
|
|
|
414
434
|
var t = ctx.locale.bind(NS);
|
|
415
435
|
ctx.effect(function () { return ctx.locale.register(NS, { zh: zh, en: en }); }, "dsh-plugin-marketplace: dictionaries");
|
|
416
436
|
var scope = ctx.settingsScope.bind({ namespace: "plugin-marketplace" });
|
|
417
|
-
|
|
437
|
+
// dsh 0.1.2-rc.1 dropped connection.api; only older hosts still carry
|
|
438
|
+
// the raw settings face there. writeField picks whichever exists.
|
|
439
|
+
var api = (ctx.connection && ctx.connection.api) ? ctx.connection.api : null;
|
|
418
440
|
ctx.slots.inject("settings.section", function () {
|
|
419
441
|
return ctx.slots.register({
|
|
420
442
|
name: "settings.section",
|
package/index.js
CHANGED
|
@@ -16,14 +16,13 @@ import { join } from "node:path";
|
|
|
16
16
|
import os from "node:os";
|
|
17
17
|
import z from "@deepseek-ai/schemastery";
|
|
18
18
|
import { BlockAssembler, createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
19
|
-
import { installSettingsSection, settingsNamespace } from "@deepseek-ai/dsh-settings";
|
|
20
19
|
|
|
21
20
|
/** Cordis plugin name. */
|
|
22
21
|
const name = "plugin-marketplace";
|
|
23
22
|
/** Services this plugin needs injected from the host tree (ctx.get requires inject). */
|
|
24
23
|
const inject = ["llm", "agentDefaultModel"];
|
|
25
24
|
/** Settings namespace owned by this plugin (Web UI settings section + install channel). */
|
|
26
|
-
const NS =
|
|
25
|
+
const NS = "plugin-marketplace";
|
|
27
26
|
|
|
28
27
|
/** Runtime schema: the install request + the install state report. */
|
|
29
28
|
const Config = z.object({
|
|
@@ -63,16 +62,27 @@ function apply(ctx, config) {
|
|
|
63
62
|
let lastExplainTs = 0;
|
|
64
63
|
|
|
65
64
|
// ── settings-backed configuration ─────────────────────────────────────────
|
|
66
|
-
// The browser half edits this namespace;
|
|
67
|
-
// which is what turns an `install` request into a real
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
65
|
+
// The browser half edits this namespace; every write fires the onChange
|
|
66
|
+
// handler below, which is what turns an `install` request into a real
|
|
67
|
+
// install.
|
|
68
|
+
// Compat shim: dsh-settings 0.1.2-rc.1 removed the module-level
|
|
69
|
+
// `installSettingsSection` export (the provider now lives at ctx.settings).
|
|
70
|
+
// Inline the same logic via ctx.inject(["settings"]) — works on both
|
|
71
|
+
// 0.1.1 (module export wrapper) and 0.1.2 (ctx.settings) hosts.
|
|
72
|
+
ctx.inject(["settings"], (sctx) => {
|
|
73
|
+
const scope = sctx.settings.register(NS, Config, { base: config });
|
|
74
|
+
sourceGetter = () => scope.get();
|
|
75
|
+
sctx.effect(() => () => {
|
|
76
|
+
sourceGetter = null;
|
|
77
|
+
});
|
|
78
|
+
// Mirror the old installSettingsSection contract: fire once at attach so a
|
|
79
|
+
// request persisted across restarts is consumed, then on every write.
|
|
80
|
+
void maybeRunInstall();
|
|
81
|
+
void maybeRunExplain();
|
|
82
|
+
scope.watch(() => {
|
|
73
83
|
void maybeRunInstall();
|
|
74
84
|
void maybeRunExplain();
|
|
75
|
-
}
|
|
85
|
+
});
|
|
76
86
|
});
|
|
77
87
|
|
|
78
88
|
// DSH 0.1.0-rc.7+ exposes registered settings namespaces natively, allowing
|
package/package.json
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name":
|
|
3
|
-
"version":
|
|
4
|
-
"description":
|
|
5
|
-
"type":
|
|
6
|
-
"main":
|
|
7
|
-
"exports":
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"dsh":
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"files":
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"homepage":
|
|
30
|
-
"keywords":
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"license":
|
|
38
|
-
"engines":
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"repository":
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"bugs":
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"peerDependencies":
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"dependencies":
|
|
54
|
-
|
|
55
|
-
|
|
2
|
+
"name": "dsh-plugin-marketplace",
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"description": "DeepSeek Harness Web UI 内置插件市场:在设置页直接浏览 github.com/topics/dsh-plugin,支持搜索、按 Star 排序、查看安装方式。",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./index.js",
|
|
9
|
+
"./client": "./client.js",
|
|
10
|
+
"./package.json": "./package.json"
|
|
11
|
+
},
|
|
12
|
+
"dsh": {
|
|
13
|
+
"bundle": {
|
|
14
|
+
"patch": "./cordis.patch.yml"
|
|
15
|
+
},
|
|
16
|
+
"client": {
|
|
17
|
+
"platform": "web"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"index.js",
|
|
22
|
+
"client.js",
|
|
23
|
+
"cordis.patch.yml",
|
|
24
|
+
"README.md",
|
|
25
|
+
"README.zh.md",
|
|
26
|
+
"LICENSE",
|
|
27
|
+
"vendor"
|
|
28
|
+
],
|
|
29
|
+
"homepage": "https://github.com/Scorp1o117/dsh-plugin-marketplace",
|
|
30
|
+
"keywords": [
|
|
31
|
+
"dsh",
|
|
32
|
+
"dsh-plugin",
|
|
33
|
+
"deepseek-harness",
|
|
34
|
+
"marketplace",
|
|
35
|
+
"web-ui"
|
|
36
|
+
],
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=20.18"
|
|
40
|
+
},
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "git+https://github.com/Scorp1o117/dsh-plugin-marketplace.git"
|
|
44
|
+
},
|
|
45
|
+
"bugs": {
|
|
46
|
+
"url": "https://github.com/Scorp1o117/dsh-plugin-marketplace/issues"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"react": "^18.2.0",
|
|
50
|
+
"@deepseek-ai/dsh-settings": "^0.1.0-rc.7 || ^0.1.1-rc.1 || ^0.1.2-rc.1",
|
|
51
|
+
"@deepseek-ai/dsh-llm": "^0.1.0-rc.7 || ^0.1.1-rc.1 || ^0.1.2-rc.1"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@deepseek-ai/schemastery": "^3.18.1"
|
|
55
|
+
}
|
|
56
56
|
}
|