dsh-skill-importer 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.
Files changed (3) hide show
  1. package/README.md +58 -49
  2. package/README.zh.md +107 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,97 +1,106 @@
1
1
  # dsh-skill-importer
2
2
 
3
- DeepSeek Harness 的插件:**直接写盘的技能导入器**。在设置页新增「技能」分区,选中本地 `SKILL.md` 后点击导入,文件**立即写入**目标技能目录——不经过 agent、不需要会话、不需要模型、不消耗 token、无审批。
3
+ English | [中文](README.zh.md)
4
4
 
5
- ## 功能
5
+ [![npm version](https://img.shields.io/npm/v/dsh-skill-importer)](https://www.npmjs.com/package/dsh-skill-importer)
6
+ [![npm downloads](https://img.shields.io/npm/dm/dsh-skill-importer)](https://www.npmjs.com/package/dsh-skill-importer)
7
+ [![License: MIT](https://img.shields.io/npm/l/dsh-skill-importer)](LICENSE)
6
8
 
7
- - **技能入口(`/` 菜单不再直接列技能)**:① 输入框工具行技能下拉(权限选择旁边,常驻);② `/skills` 命令(弹出技能列表,同 `/model` 交互);③ 手输 `/<名称> `。三者都填入 `/名称 ` 并高亮,发送即注入技能正文:`/` 菜单隐藏技能,输入框工具行出现技能下拉框,选中后自动填入 `/<名称> `,发送即使用对应技能
8
- - **已安装列表**:扫描全部已注册工作区的项目技能根(`.dsh/skills`、`.agents/skills`)加用户技能根(`~/.dsh/skills`),**按安装位置分组展示全部副本**(不按 rank 去重,管理面能看到每一处),每项显示调用策略标记并可直接删除
9
- - **工作区感知**:项目目标写入「当前工作区」(最近活跃的已注册工作区)而非 dsh 进程的启动目录——与 `/` 斜杠菜单的解析一致,导入后立即可见
10
- - **从文件导入**:选择本地 Markdown → 浏览器内解析 frontmatter 并校验(`name` kebab-case、`description` 必填)→ 预览确认 → 直接写入 `<目标>/<name>/SKILL.md`
11
- - **从 URL 导入**:host 进程抓取 URL(`.md` 原样写入;HTML 粗略提取正文),整理为技能文件
12
- - **目标目录选择**:当前工作区 `.agents/skills` / `.dsh/skills` / 用户技能目录 `~/.dsh/skills`
9
+ A skill management plugin for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (`dsh`). Import, list, and delete skills directly from the Web UI — no agent, no session, no model tokens, no approval round-trips. Files land on disk immediately and the harness hot-discovers them.
13
10
 
14
- ## 设计原理(为什么没有"目标会话"了)
11
+ ## Features
15
12
 
16
- 框架的 client→host RPC 是硬编码白名单,没有写文件通道;但 **`dsh-host-webserver` 提供了官方路由注册扩展点**(`ctx.webServer.register`),任何插件都能在 dsh 自己的 Web 服务器(同源)上挂 HTTP 路由:
13
+ - **Three skill entry points** — the `/` menu no longer lists skills directly:
14
+ 1. **Composer tool-row picker** (next to the access-mode selector): a pill trigger with a name-filter search box, first-letter avatars, and bare skill names.
15
+ 2. **`/skills` command** — modelled on `/model`: a popup list, name-only search, select fills `/name `.
16
+ 3. **Type `/name` directly** — the native text gesture, highlighted and injected the same way.
17
+ - **Installed list, grouped by location** — every copy in `.agents/skills`, `.dsh/skills`, and `~/.dsh/skills` is shown (no rank hiding on the management surface), with invocation markers and a delete button per copy.
18
+ - **Workspace-aware targets** — project skills write into the active registered workspace (never the dsh process's cwd), matching how `/` and the model catalog resolve.
19
+ - **Import from file** — pick a Markdown file (`SKILL.md` or `<name>.md`), frontmatter is parsed and validated (`name` kebab-case, `description` required), previewed, then written to `<target>/<name>/SKILL.md`.
20
+ - **Import from URL** — the host fetches the URL (`.md` verbatim; HTML roughly extracted to text).
21
+ - **Frontmatter normalization** — special characters in descriptions are quoted automatically, so strict-YAML discovery never silently skips a skill.
22
+ - **Bilingual UI** — the settings section and picker copy follow the harness's zh/en locale, styled like the General settings rows.
23
+
24
+ ## How it works
25
+
26
+ dsh's client→host RPC is a hard-coded allowlist with no file-write channel, but [`dsh-host-webserver`](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/host/webserver) exposes the official route-registration extension point (`ctx.webServer.register`). The plugin registers `/skill-importer/*` routes on the harness's own same-origin server:
17
27
 
18
28
  ```
19
- 浏览器读文件 / 输入 URL
20
- │ fetch(同源,无 CORS)
29
+ browser reads file / user enters URL
30
+ │ fetch (same origin)
21
31
  ▼
22
- host 插件路由 /skill-importer/import(注册在 ctx.webServer 上)
23
- │ 直接写文件(host 进程自己的权限,无沙箱、无审批)
32
+ host route /skill-importer/import (registered on ctx.webServer)
33
+ │ direct filesystem write (host process permissions — no sandbox, no approval)
24
34
  ▼
25
- <目标>/<name>/SKILL.md 落地
35
+ <target>/<name>/SKILL.md lands
26
36
  │
27
37
  ▼
28
- skill-filesystem 的 watcher 发现 → skills/change → / 菜单、模型目录热刷新
38
+ skill-filesystem watcher discovers it → skills/change → hot refresh
29
39
  ```
30
40
 
31
- - **无会话**:写盘由 host 进程完成,与任何会话/agent/模型无关
32
- - **无审批**:host 进程拥有用户权限,不像 agent 工具那样受沙箱约束
33
- - **安全**:路由只监听在 dsh 的 loopback 服务器上;`POST` 会校验 `Origin`(仅放行 `127.0.0.1`/`localhost` 来源,其他网页无法调用)
41
+ - **No session**: the host process writes; no agent, model, or session involved.
42
+ - **No approval**: the host owns user permissions; the agent tool sandbox never applies.
43
+ - **Secure**: routes live on the loopback-only server; `POST` routes verify the `Origin` header (only `127.0.0.1`/`localhost` sources pass).
44
+
45
+ ## Requirements
34
46
 
35
- ## 安装
47
+ - DeepSeek Harness `>= 0.1.0-rc.6` (`npx @deepseek-ai/dsh web`)
36
48
 
37
- 要求 dsh `>= 0.1.0-rc.6`(`npx @deepseek-ai/dsh web` 方式运行)。
49
+ ## Installation
38
50
 
39
- ### 从 npm 安装(已发布后)
51
+ ### From npm
40
52
 
41
53
  ```sh
42
- # 1. 安装插件包(等价于在 profile 里 add)
54
+ # 1. Install the package into the web profile
43
55
  dsh plugin --profile web add dsh-skill-importer
44
56
 
45
- # 2. 在 $DSH_HOME/profiles/web/cordis.patch.yml 里追加一行:
57
+ # 2. Add a row to $DSH_HOME/profiles/web/cordis.patch.yml:
46
58
  # - id: skill-importer
47
59
  # name: 'dsh-skill-importer'
48
60
 
49
- # 3. 重启 dsh web
61
+ # 3. Restart dsh web
50
62
  ```
51
63
 
52
- ### 从本地路径安装(开发中)
64
+ ### From a local checkout (development)
53
65
 
54
66
  ```sh
55
- # 1. 构建
56
67
  npm install
57
68
  npm run build
58
-
59
- # 2. 装进 web profile(本地路径)
60
69
  dsh plugin --profile web add /path/to/dsh-skill-importer
61
-
62
- # 3. 同上在 cordis.patch.yml 追加插件行
63
-
64
- # 4. 重启 dsh web
70
+ # + the cordis.patch.yml row above, then restart dsh web
65
71
  ```
66
72
 
67
- 设置页左侧导航出现「技能」分区。
73
+ A **Skills** section appears in Settings.
68
74
 
69
- ## 使用
75
+ ## Usage
70
76
 
71
- 设置 → 技能 → 导入 → 从文件:选一个 Markdown(带 `name`/`description` frontmatter)→ 预览校验 → 选目标目录 → 点「导入」→ 立即写入并自动刷新列表。之后在会话输入框敲 `/` 即可使用新技能。
77
+ 1. **Import**: Settings → Skills → pick a Markdown file (or paste a URL) → choose a target directory → Import. The form resets after success; the list refreshes automatically.
78
+ 2. **Use**: in any session, pick a skill from the tool-row picker, run `/skills`, or type `/name ` — all three fill the draft with `/name ` (highlighted) and sending injects the skill's instructions.
72
79
 
73
- ## 开发
80
+ ## Development
74
81
 
75
82
  ```sh
76
83
  npm install
77
- npm run build # tsc 产出 lib/types,tsdown 产出 lib/index.js + lib/client.js
84
+ npm run build # tsc emits lib/types; tsdown emits lib/index.js + lib/client.js
78
85
  ```
79
86
 
80
- - `src/index.ts`:host 插件体——把四个路由注册到 `ctx.webServer`(`inject: ['webServer']`)
81
- - `src/server.ts`:纯 Node 逻辑(写盘、扫描、URL 抓取、HTTP 层),无 Cordis 依赖,可直接 `node` 冒烟测试
82
- - `src/types.ts`:host/client 共享的线格式类型
83
- - `src/client/index.ts`:浏览器插件体(`settings.section` 注册 + fetch 同源路由)
84
- - `src/client/SkillImporterSection.tsx`:设置页组件(纯展示)
87
+ Layout:
85
88
 
86
- 路由一览:`GET /skill-importer/health` · `GET /skill-importer/list` · `POST /skill-importer/import` · `POST /skill-importer/import-url` · `POST /skill-importer/delete`
89
+ - `src/index.ts` — host plugin body: registers the `/skill-importer/*` routes (`inject: ['webServer', 'workspaceRegistry']`)
90
+ - `src/server.ts` — pure Node logic (write/delete/list/URL fetch/HTTP layer), no Cordis imports, directly smoke-testable
91
+ - `src/types.ts` — shared wire types between host and client halves
92
+ - `src/client/index.ts` — browser plugin body: settings section, `/skills` popupSelect, hidden lexicon source
93
+ - `src/client/SkillsPicker.tsx` — composer tool-row picker (search + avatars)
94
+ - `src/client/SkillImporterSection.tsx` — settings section (General-settings row style, zh/en)
87
95
 
96
+ Routes: `GET /skill-importer/health` · `GET /skill-importer/list` · `POST /skill-importer/import` · `POST /skill-importer/import-url` · `POST /skill-importer/delete`
88
97
 
89
- ## 已知限制
98
+ ## Known limitations
90
99
 
91
- - 单文件 ≤ 256 KB
92
- - URL 导入对 HTML 页面只做粗略文本提取,推荐指向 `.md` 文件
93
- - 目标目录固定为三个标准技能根(不支持任意路径,这是安全边界)
94
- - 导入后列表由前端轮询刷新(2 秒间隔,最多 20 秒);如果目录被外部改动,点「刷新」立即同步
100
+ - Single file ≤ 256 KB.
101
+ - URL import does a rough text extraction for HTML pages — prefer `.md` sources.
102
+ - Targets are fixed to the three standard skill roots (no arbitrary paths; that is the security boundary).
103
+ - The list polls briefly after an import (2s interval, up to 20s); Refresh syncs immediately for external changes.
95
104
 
96
105
  ## License
97
106
 
package/README.zh.md ADDED
@@ -0,0 +1,107 @@
1
+ # dsh-skill-importer
2
+
3
+ [English](README.md) | 中文
4
+
5
+ [![npm version](https://img.shields.io/npm/v/dsh-skill-importer)](https://www.npmjs.com/package/dsh-skill-importer)
6
+ [![npm downloads](https://img.shields.io/npm/dm/dsh-skill-importer)](https://www.npmjs.com/package/dsh-skill-importer)
7
+ [![License: MIT](https://img.shields.io/npm/l/dsh-skill-importer)](LICENSE)
8
+
9
+ [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(`dsh`)的技能管理插件:在 Web UI 里直接导入、查看、删除技能——不经过 agent、不需要会话、不消耗模型 token、无审批。文件立即落盘,harness 自动热发现。
10
+
11
+ ## 功能
12
+
13
+ - **三个技能入口**(`/` 菜单不再直接列技能):
14
+ 1. **输入框工具行技能选择器**(权限选择旁边):pill 触发,弹出带名称筛选框的列表,首字母头像 + 纯名称
15
+ 2. **`/skills` 命令**——仿 `/model`:弹出技能列表,按名称搜索,选中自动填入 `/名称 `
16
+ 3. **直接输入 `/名称 `**——原生文本手势,同样高亮并注入技能正文
17
+ - **已安装列表按位置分组**:`.agents/skills`、`.dsh/skills`、`~/.dsh/skills` 每处副本都展示(管理面不做 rank 隐藏),含调用策略标记,每项可单独删除
18
+ - **工作区感知**:项目目标写入「当前已注册工作区」(绝不写 dsh 进程的启动目录),与 `/` 菜单、模型目录的解析一致,导入后立即可见
19
+ - **从文件导入**:选本地 Markdown(`SKILL.md` 或 `<名称>.md`),前端解析并校验 frontmatter(`name` 必须 kebab-case、`description` 必填),预览确认后写入 `<目标>/<名称>/SKILL.md`
20
+ - **从 URL 导入**:host 进程抓取(`.md` 原样写入;HTML 粗略提取正文)
21
+ - **frontmatter 规范化**:描述等字段含特殊字符时自动加引号,严格 YAML 发现永不静默跳过
22
+ - **中英双语 UI**:设置页与选择器跟随 harness 语言,样式对齐「通用设置」行
23
+
24
+ ## 设计原理(为什么不需要"目标会话")
25
+
26
+ dsh 的 client→host RPC 是硬编码白名单,没有写文件通道;但 **`dsh-host-webserver` 提供官方路由注册扩展点**(`ctx.webServer.register`)。插件在 harness 自己的同源服务器上注册 `/skill-importer/*` 路由:
27
+
28
+ ```
29
+ 浏览器读文件 / 输入 URL
30
+ │ fetch(同源)
31
+ ▼
32
+ host 路由 /skill-importer/import(注册在 ctx.webServer 上)
33
+ │ 直接写文件(host 进程权限——无沙箱、无审批)
34
+ ▼
35
+ <目标>/<名称>/SKILL.md 落地
36
+ │
37
+ ▼
38
+ skill-filesystem 的 watcher 发现 → skills/change → 热刷新
39
+ ```
40
+
41
+ - **无会话**:host 进程直接写盘,与会话/agent/模型无关
42
+ - **无审批**:host 拥有用户权限,不经过 agent 工具的沙箱
43
+ - **安全**:路由只挂在 loopback 服务器上;`POST` 校验 `Origin`(仅放行 `127.0.0.1`/`localhost`)
44
+
45
+ ## 环境要求
46
+
47
+ - DeepSeek Harness `>= 0.1.0-rc.6`(`npx @deepseek-ai/dsh web` 方式运行)
48
+
49
+ ## 安装
50
+
51
+ ### 从 npm
52
+
53
+ ```sh
54
+ # 1. 把插件装进 web profile
55
+ dsh plugin --profile web add dsh-skill-importer
56
+
57
+ # 2. 在 $DSH_HOME/profiles/web/cordis.patch.yml 追加一行:
58
+ # - id: skill-importer
59
+ # name: 'dsh-skill-importer'
60
+
61
+ # 3. 重启 dsh web
62
+ ```
63
+
64
+ ### 从本地源码(开发)
65
+
66
+ ```sh
67
+ npm install
68
+ npm run build
69
+ dsh plugin --profile web add /path/to/dsh-skill-importer
70
+ # 同样追加上面的 cordis.patch.yml 行,然后重启 dsh web
71
+ ```
72
+
73
+ 设置页左侧导航出现「技能」分区。
74
+
75
+ ## 使用
76
+
77
+ 1. **导入**:设置 → 技能 → 选本地 Markdown(或填 URL)→ 选目标目录 → 导入。成功后表单自动清空,列表自动刷新。
78
+ 2. **使用**:任意会话中,从工具行技能选择器选、运行 `/skills`、或直接输入 `/名称 `——三种方式都会在输入框填入 `/名称 `(带高亮),发送即注入技能指令。
79
+
80
+ ## 开发
81
+
82
+ ```sh
83
+ npm install
84
+ npm run build # tsc 产出 lib/types;tsdown 产出 lib/index.js + lib/client.js
85
+ ```
86
+
87
+ 结构:
88
+
89
+ - `src/index.ts` — host 插件体:注册 `/skill-importer/*` 路由(`inject: ['webServer', 'workspaceRegistry']`)
90
+ - `src/server.ts` — 纯 Node 逻辑(写盘/删除/列表/URL 抓取/HTTP 层),无 Cordis 依赖,可直接冒烟测试
91
+ - `src/types.ts` — host/client 共享线格式类型
92
+ - `src/client/index.ts` — 浏览器插件体:设置页、`/skills` popupSelect、隐形 lexicon 源
93
+ - `src/client/SkillsPicker.tsx` — 工具行技能选择器(筛选 + 首字母头像)
94
+ - `src/client/SkillImporterSection.tsx` — 设置页(通用设置行风格,中英双语)
95
+
96
+ 路由一览:`GET /skill-importer/health` · `GET /skill-importer/list` · `POST /skill-importer/import` · `POST /skill-importer/import-url` · `POST /skill-importer/delete`
97
+
98
+ ## 已知限制
99
+
100
+ - 单文件 ≤ 256 KB
101
+ - URL 导入对 HTML 页面只做粗略文本提取,推荐指向 `.md` 文件
102
+ - 目标目录固定为三个标准技能根(不支持任意路径,这是安全边界)
103
+ - 导入后列表会短暂轮询刷新(2 秒间隔,最多 20 秒);外部改动点「刷新」立即同步
104
+
105
+ ## License
106
+
107
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-skill-importer",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Web UI plugin for DeepSeek Harness: import skills from local Markdown files or URLs into the skill roots the harness discovers automatically",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",