@infinity_cheng/dsh-hello-plugin 0.0.0-stage → 0.1.0

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
@@ -1,3 +1,115 @@
1
- # Temporary Holding Version
1
+ # dsh-hello-plugin
2
+
3
+ 一个最小可用的 DeepSeek Harness 插件:向模型注册 `hello` 工具,问候语可配置。
4
+
5
+ ## 结构
6
+
7
+ | 文件 | 作用 |
8
+ |---|---|
9
+ | `index.js` | 宿主插件:`name` / `inject` / `Config` / `apply` |
10
+ | `cordis.patch.yml` | 作为 bundle 被安装时,向 profile 插入的插件行 |
11
+ | `package.json` | 声明 `dsh.bundle.patch`,让 `dsh plugin add` 把它当作组合包 |
12
+
13
+ `index.js` 里的三件事:
14
+
15
+ - `inject = ['tools']`:等工具注册表就绪后再执行 `apply`。
16
+ - `Config`:Schemastery schema,用户在 patch 里给的值会先校验、再补默认值。
17
+ - `apply(ctx, config)`:注册工具。所有注册都挂在 `ctx` 上,插件卸载时自动清理。
18
+
19
+ ## 方式 A:不改 profile,用 patch 直接加载
20
+
21
+ 直接用仓库里的 `overlay.example.yml`(里面的 `name` 是指向本目录的绝对路径;移动目录后要改):
22
+
23
+ ```sh
24
+ cd /Users/wu/Desktop
25
+ dsh --profile web --patch ./dsh-hello-plugin/overlay.example.yml
26
+ ```
27
+
28
+ 打开 http://127.0.0.1:3080 ,对模型说「用 hello 工具向 Ada 问好」。
29
+
30
+ > 注意:overlay 加载的插件按普通 Node 规则解析依赖,不会自动拿到宿主的 peer 包。
31
+ > 本目录已放一个开发用的 `node_modules/@deepseek-ai` 符号链接,指向本机 DSH 安装;
32
+ > 换机器或升级 DSH 后需要重建,或改用方式 B 安装成 bundle(由 profile 解析 peer)。
33
+
34
+ ## 方式 B:打包成 bundle 安装进 profile
35
+
36
+ `dsh plugin` 会把参数转发给 pnpm,所以先确保有 pnpm:
37
+
38
+ ```sh
39
+ npm i -g pnpm
40
+ ```
41
+
42
+ 安装到 `web` profile(也可以换成自己的开发 profile):
43
+
44
+ ```sh
45
+ dsh plugin --profile web add ./dsh-hello-plugin
46
+ dsh --profile web --dump-config # 能看到 "# == dsh-hello-plugin" 这一层
47
+ dsh web
48
+ ```
49
+
50
+ 移除:
51
+
52
+ ```sh
53
+ dsh plugin --profile web remove dsh-hello-plugin
54
+ ```
55
+
56
+ 层顺序:`@deepseek-ai/dsh-base` → 各 bundle(按 `dsh.profile.bundles` 顺序)→ profile 的 `cordis.patch.yml` → `--patch`。后应用的层按行胜出,并且会整段替换该行的 `config`,不是深合并。
57
+
58
+ ## 覆盖配置
59
+
60
+ 在 profile 的 `cordis.patch.yml` 里按 id 覆盖(需要重述该行要保留的所有键):
61
+
62
+ ```yaml
63
+ - id: hello
64
+ config:
65
+ greeting: 早上好
66
+ ```
67
+
68
+ ## 发布与让别人安装
69
+
70
+ ### 1. 发布到 npm
71
+
72
+ 先改名:`dsh-hello-plugin` 这个名字在 npm 上已被占用。换成自己的 scope,并同步改
73
+ `cordis.patch.yml` 里的 `name`:
74
+
75
+ ```json
76
+ "name": "@your-scope/dsh-hello-plugin"
77
+ ```
78
+
79
+ 然后发布(scoped 包要显式 public):
80
+
81
+ ```sh
82
+ npm login
83
+ npm publish --access public
84
+ ```
85
+
86
+ 发布到桌面端 0.2.x 时,建议在 `package.json` 里声明目标版本:
87
+
88
+ ```json
89
+ "engines": { "dsh": ">=0.2.0 <0.3.0" }
90
+ ```
91
+
92
+ ### 2. 按包名安装(无需上架)
93
+
94
+ 桌面端:**插件 → 添加插件**,输入包名,安装后选**立即启用**。这个输入框也接受 Git 地址、
95
+ tarball 和本地绝对路径,所以自测时可以直接填本目录的绝对路径。
96
+
97
+ ### 3. 出现在「发现」里被搜索:需要索引源
98
+
99
+ 桌面端默认没有官方公共索引;**发现**标签页只搜索用户自己添加的索引源。索引是一个
100
+ format-1 JSON,示例见 [`market-index.example.json`](market-index.example.json)。把它托管到
101
+ HTTPS(GitHub Pages、自己的服务器等),再让用户:
102
+
103
+ **插件 → 实验性插件 → 开启「自定义插件索引」→ 发现 → 添加索引源 → 填索引 URL**
104
+
105
+ 索引里的 `name` 必须等于 npm 包名,`versions[].version` 必须是已发布的版本,
106
+ `publishTimestamp` 是 Unix 秒,`engines.dsh` 与包声明一致。
107
+
108
+ ## Desktop 说明
109
+
110
+ Desktop 的 `desktop` profile 由 Electron 托管,CLI 会拒绝 `dsh plugin --profile desktop`。
111
+ 开发阶段用独立 profile 验证;要进 Desktop,按上面的方式发布后从桌面端安装。
112
+
113
+ 带前端界面的插件还需要 `dsh.client` 客户端入口(`./client`,`platform: 'web'`),
114
+ 并按 DSH 的 lazy-CJS factory 格式构建,复杂度高于纯宿主插件。
2
115
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
@@ -0,0 +1,7 @@
1
+ # This bundle's contribution to a profile: one inserted plugin row.
2
+ # The row addresses the package by name, so Node resolves the installed copy.
3
+ - insert:
4
+ - id: hello
5
+ name: '@infinity_cheng/dsh-hello-plugin'
6
+ config:
7
+ greeting: Hello
package/icon.svg ADDED
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-label="Hello plugin">
2
+ <rect width="64" height="64" rx="14" fill="#1f6feb"/>
3
+ <path d="M18 18v28M18 32h20M38 18v28" fill="none" stroke="#ffffff" stroke-width="6" stroke-linecap="round"/>
4
+ </svg>
package/index.js ADDED
@@ -0,0 +1,39 @@
1
+ import Schema from '@deepseek-ai/schemastery'
2
+ import { defineTool } from '@deepseek-ai/dsh-tools'
3
+
4
+ /** Loader identity shown in the plugin inventory. */
5
+ export const name = 'hello-plugin'
6
+
7
+ /** Wait until the tool registry exists before apply() runs. */
8
+ export const inject = ['tools']
9
+
10
+ /** User-editable configuration; defaults live in the schema. */
11
+ export const Config = Schema.object({
12
+ greeting: Schema.string().default('Hello'),
13
+ })
14
+
15
+ /**
16
+ * Register the `hello` tool.
17
+ * @param {import('@deepseek-ai/cordis').Context} ctx
18
+ * @param {{ greeting: string }} config
19
+ */
20
+ export function apply(ctx, config) {
21
+ ctx.tools.register(defineTool({
22
+ name: 'hello',
23
+ description: 'Greet someone by name. Use when the user asks for a greeting.',
24
+ parameters: {
25
+ name: {
26
+ type: 'string',
27
+ required: true,
28
+ description: 'The name to greet',
29
+ },
30
+ },
31
+ output: {
32
+ schema: { type: 'string' },
33
+ render: (_args, value) => [{ type: 'text', text: value }],
34
+ },
35
+ async execute(args) {
36
+ return `${config.greeting}, ${args.name}!`
37
+ },
38
+ }))
39
+ }
package/package.json CHANGED
@@ -1,6 +1,38 @@
1
1
  {
2
2
  "name": "@infinity_cheng/dsh-hello-plugin",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Minimal DeepSeek Harness plugin: a configurable hello tool",
5
+ "icon": "icon.svg",
6
+ "type": "module",
7
+ "main": "index.js",
8
+ "files": [
9
+ "index.js",
10
+ "cordis.patch.yml",
11
+ "icon.svg"
12
+ ],
13
+ "keywords": [
14
+ "dsh",
15
+ "dsh-plugin",
16
+ "deepseek-harness",
17
+ "cordis",
18
+ "hello"
19
+ ],
20
+ "license": "MIT",
21
+ "engines": {
22
+ "dsh": ">=0.2.0 <0.3.0"
23
+ },
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "peerDependencies": {
28
+ "@deepseek-ai/cordis": "^4.0.0",
29
+ "@deepseek-ai/dsh-tools": ">=0.1.5-rc.1",
30
+ "@deepseek-ai/schemastery": "^3.18.0"
31
+ },
32
+ "dsh": {
33
+ "bundle": {
34
+ "patch": "./cordis.patch.yml"
35
+ }
36
+ },
37
+ "author": "infinity_cheng"
38
+ }