dsh-deeptutor 0.1.3 → 0.1.5
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 +177 -136
- package/README.zh.md +131 -107
- package/cordis.patch.yml +17 -17
- package/package.json +62 -56
- package/scripts/install-profile.mjs +233 -0
- package/scripts/md-to-html.js +353 -353
- package/skills/deeptutor/README.md +106 -0
- package/skills/deeptutor/SKILL.md +182 -0
- package/skills/html-doc/SKILL.md +91 -0
- package/skills/html-doc/assets/template.html +420 -0
- package/skills/html-doc/scripts/md-to-html.js +353 -0
- package/src/cli-exec.ts +251 -251
- package/src/config.ts +70 -70
- package/src/html-render.ts +53 -53
- package/src/http-api.ts +83 -83
- package/src/index.ts +449 -449
- package/src/turn.ts +174 -174
package/README.md
CHANGED
|
@@ -1,136 +1,177 @@
|
|
|
1
|
-
# dsh-deeptutor
|
|
2
|
-
|
|
3
|
-
**English** | [简体中文](https://github.com/TecFancy/dsh-deeptutor/blob/main/README.zh.md)
|
|
4
|
-
|
|
5
|
-
DeepTutor bridge **bundle** for **DeepSeek Harness (dsh)**, migrated from the
|
|
6
|
-
pi coding-agent extension (`TecFancy/pi-extensions`, `extensions/deeptutor` +
|
|
7
|
-
`skills/deeptutor`).
|
|
8
|
-
|
|
9
|
-
Registers three model-facing tools that drive the
|
|
10
|
-
[HKUDS/DeepTutor](https://github.com/HKUDS/DeepTutor) tutoring service:
|
|
11
|
-
|
|
12
|
-
| Tool | Purpose |
|
|
13
|
-
|---|---|
|
|
14
|
-
| `deeptutor_run` | Run a learning capability: `deep_solve` / `deep_question` / `deep_research` / `chat` / `mastery_path` / `visualize` / `math_animator` (HTTP/WS first, CLI fallback) |
|
|
15
|
-
| `deeptutor_kb` | List / search / info the user's personal knowledge bases (RAG) |
|
|
16
|
-
| `deeptutor_note` | Archive Markdown learning notes to a server notebook |
|
|
17
|
-
|
|
18
|
-
The seven capabilities above are the fixed enum accepted by `deeptutor_run`.
|
|
19
|
-
The underlying DeepTutor CLI may expose more — enumerate the full command set
|
|
20
|
-
with `deeptutor --help` / `deeptutor <cmd> --help`. The `deeptutor` skill
|
|
21
|
-
instructs the agent to discover commands this way and, when the tool's enum
|
|
22
|
-
doesn't cover a capability, to drive the CLI directly (local binary or over
|
|
23
|
-
SSH).
|
|
24
|
-
|
|
25
|
-
Deployment auto-detects local vs. remote: local `serve` (or local CLI) on this
|
|
26
|
-
machine, or a server reached through an auto-started SSH tunnel (with SSH CLI
|
|
27
|
-
fallback).
|
|
28
|
-
|
|
29
|
-
## Install into a profile (bundle)
|
|
30
|
-
|
|
31
|
-
The package is published to npm as `dsh-deeptutor`.
|
|
32
|
-
|
|
33
|
-
`dsh
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
dsh
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
dsh
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
`
|
|
135
|
-
|
|
136
|
-
`
|
|
1
|
+
# dsh-deeptutor
|
|
2
|
+
|
|
3
|
+
**English** | [简体中文](https://github.com/TecFancy/dsh-deeptutor/blob/main/README.zh.md)
|
|
4
|
+
|
|
5
|
+
DeepTutor bridge **bundle** for **DeepSeek Harness (dsh)**, migrated from the
|
|
6
|
+
pi coding-agent extension (`TecFancy/pi-extensions`, `extensions/deeptutor` +
|
|
7
|
+
`skills/deeptutor`).
|
|
8
|
+
|
|
9
|
+
Registers three model-facing tools that drive the
|
|
10
|
+
[HKUDS/DeepTutor](https://github.com/HKUDS/DeepTutor) tutoring service:
|
|
11
|
+
|
|
12
|
+
| Tool | Purpose |
|
|
13
|
+
|---|---|
|
|
14
|
+
| `deeptutor_run` | Run a learning capability: `deep_solve` / `deep_question` / `deep_research` / `chat` / `mastery_path` / `visualize` / `math_animator` (HTTP/WS first, CLI fallback) |
|
|
15
|
+
| `deeptutor_kb` | List / search / info the user's personal knowledge bases (RAG) |
|
|
16
|
+
| `deeptutor_note` | Archive Markdown learning notes to a server notebook |
|
|
17
|
+
|
|
18
|
+
The seven capabilities above are the fixed enum accepted by `deeptutor_run`.
|
|
19
|
+
The underlying DeepTutor CLI may expose more — enumerate the full command set
|
|
20
|
+
with `deeptutor --help` / `deeptutor <cmd> --help`. The `deeptutor` skill
|
|
21
|
+
instructs the agent to discover commands this way and, when the tool's enum
|
|
22
|
+
doesn't cover a capability, to drive the CLI directly (local binary or over
|
|
23
|
+
SSH).
|
|
24
|
+
|
|
25
|
+
Deployment auto-detects local vs. remote: local `serve` (or local CLI) on this
|
|
26
|
+
machine, or a server reached through an auto-started SSH tunnel (with SSH CLI
|
|
27
|
+
fallback).
|
|
28
|
+
|
|
29
|
+
## Install into a profile (bundle)
|
|
30
|
+
|
|
31
|
+
The package is published to npm as `dsh-deeptutor`. Recommended one-liner —
|
|
32
|
+
runs the bundled installer (`scripts/install-profile.mjs`, exposed as the
|
|
33
|
+
`dsh-deeptutor` binary), which wraps `dsh plugin add` and automatically
|
|
34
|
+
handles the pnpm workspace-root check described below:
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
pnpm dlx dsh-deeptutor --profile web
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
From a checkout of this repo, the same installer runs directly:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
node scripts/install-profile.mjs --profile web
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Or run the underlying command yourself — `dsh plugin add` forwards to pnpm
|
|
47
|
+
and then reconciles the profile's `dsh.profile.bundles` against the installed
|
|
48
|
+
state, so a `dsh.bundle`-declaring package like this one is registered
|
|
49
|
+
automatically (verified on dsh CLI 0.1.0-rc.6 + pnpm 8.15.6):
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
dsh plugin --profile web add dsh-deeptutor -w
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
> **Pitfall — pnpm workspace-root check.** The dsh profile scaffold always
|
|
56
|
+
> writes a `pnpm-workspace.yaml` (`packages: ["."]`, `nodeLinker: hoisted`),
|
|
57
|
+
> which makes the profile directory itself a pnpm workspace root. On
|
|
58
|
+
> pnpm ≥ 8, `pnpm add` in a workspace root aborts with
|
|
59
|
+
> `ERR_PNPM_ADDING_TO_ROOT` unless the workspace-root flag is explicit, so
|
|
60
|
+
> the command above appends `-w`/`--workspace-root` (pnpm prints this error
|
|
61
|
+
> on stdout on Windows, which is why a plain `dsh plugin add` without the
|
|
62
|
+
> flag fails even though the output looks like a warning). Two ways to
|
|
63
|
+
> handle it:
|
|
64
|
+
>
|
|
65
|
+
> 1. Use the installer / keep `-w` in the command (recommended — the
|
|
66
|
+
> installer tries the plain command first and adds `-w` automatically
|
|
67
|
+
> only when the check trips).
|
|
68
|
+
> 2. Or allow the plain command permanently: add
|
|
69
|
+
> `ignore-workspace-root-check: true` to
|
|
70
|
+
> `~/.dsh/profiles/<name>/pnpm-workspace.yaml`, then
|
|
71
|
+
> `dsh plugin --profile web add dsh-deeptutor` works as written.
|
|
72
|
+
|
|
73
|
+
Verify the bundle is mounted, then restart dsh (the bundle list is resolved
|
|
74
|
+
at boot):
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
dsh --profile web --dump-config | grep dsh-deeptutor
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
If your dsh CLI does not auto-register the bundle (older versions, or you
|
|
81
|
+
installed the dependency manually), add it to the profile manifest
|
|
82
|
+
(`~/.dsh/profiles/<name>/package.json`) and run `dsh plugin --profile web
|
|
83
|
+
install`:
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"dependencies": { "dsh-deeptutor": "^0.1.0" },
|
|
88
|
+
"dsh": {
|
|
89
|
+
"profile": { "bundles": ["@deepseek-ai/dsh-base", "@deepseek-ai/dsh-web-app", "dsh-deeptutor"] }
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Alternatively, keep the manifest untouched and mount the bundle through a user
|
|
95
|
+
patch layer (the npm package still has to be installed first):
|
|
96
|
+
|
|
97
|
+
```yaml
|
|
98
|
+
# overlay.yml — insert the bundle row via a user patch layer
|
|
99
|
+
- insert:
|
|
100
|
+
- id: dsh-deeptutor
|
|
101
|
+
name: 'dsh-deeptutor'
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
```sh
|
|
105
|
+
dsh web --patch ./overlay.yml
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The bundle manifest (`dsh.bundle.patch → cordis.patch.yml`) inserts the plugin
|
|
109
|
+
row; later patch layers can override or disable it by id.
|
|
110
|
+
|
|
111
|
+
## Develop against a checkout (no publish needed)
|
|
112
|
+
|
|
113
|
+
```sh
|
|
114
|
+
dsh web --patch /path/to/dsh-deeptutor/cordis.yml
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Build & publish
|
|
118
|
+
|
|
119
|
+
```sh
|
|
120
|
+
npm install
|
|
121
|
+
npm run build # tsc → lib/ (relative .ts imports rewritten to .js)
|
|
122
|
+
npm run typecheck
|
|
123
|
+
npm pack # inspect dsh-deeptutor-0.1.0.tgz
|
|
124
|
+
npm publish # set a scope/registry of your choice first
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Node ≥ 22.6 (type stripping) is needed to load the raw `src/*.ts` via
|
|
128
|
+
`--patch`; the published bundle ships compiled `lib/`, so installed profiles
|
|
129
|
+
run on plain Node ≥ 20 ESM.
|
|
130
|
+
|
|
131
|
+
## Skills
|
|
132
|
+
|
|
133
|
+
Two skills ship inside this package (`skills/deeptutor` and
|
|
134
|
+
`skills/html-doc`) and the bundled installer copies them to
|
|
135
|
+
`<DSH_HOME>/skills/<name>/` (auto-discovered by dsh) whenever it runs — so
|
|
136
|
+
`pnpm dlx dsh-deeptutor` installs the bundle **and** the skills in one shot:
|
|
137
|
+
|
|
138
|
+
- `deeptutor` — the agent-facing learning workflow (`~/.dsh/skills/deeptutor/SKILL.md`)
|
|
139
|
+
- `html-doc` — renders study answers to self-contained HTML pages
|
|
140
|
+
(`~/.dsh/skills/html-doc/`); the bundle uses the same converter
|
|
141
|
+
(`scripts/md-to-html.js`) when `deeptutor_run` gets an `html` path
|
|
142
|
+
|
|
143
|
+
Installing a newer package version overwrites skill files in place; files not
|
|
144
|
+
shipped by the package are never deleted.
|
|
145
|
+
|
|
146
|
+
## Configuration (env vars, agent-agnostic)
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# Remote deployment (DeepTutor on a server, reached through an SSH tunnel)
|
|
150
|
+
export DEEPTUTOR_SSH_HOST="tencent-cloud" # SSH host alias (set = remote mode)
|
|
151
|
+
export DEEPTUTOR_API_BASE="http://127.0.0.1:8001" # local tunnel address
|
|
152
|
+
export DEEPTUTOR_REMOTE_BIN="/home/ubuntu/my-deeptutor/.venv/bin/deeptutor"
|
|
153
|
+
export DEEPTUTOR_REMOTE_HOME="/home/ubuntu/my-deeptutor"
|
|
154
|
+
|
|
155
|
+
# Local deployment — leave DEEPTUTOR_SSH_HOST unset
|
|
156
|
+
# export DEEPTUTOR_API_BASE="http://127.0.0.1:8001" # local serve port
|
|
157
|
+
# export DEEPTUTOR_LOCAL_BIN="deeptutor" # local CLI path (default: deeptutor on PATH)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Restart dsh after changing env vars.
|
|
161
|
+
|
|
162
|
+
## Layout
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
src/ # TypeScript sources (dev loading, typecheck)
|
|
166
|
+
lib/ # compiled ESM (published entry, from `npm run build`)
|
|
167
|
+
scripts/md-to-html.js # zero-dependency Markdown → HTML converter
|
|
168
|
+
scripts/install-profile.mjs # one-shot profile installer (exposed as the `dsh-deeptutor` binary)
|
|
169
|
+
skills/ # bundled skills: deeptutor/ + html-doc/ (installed to <DSH_HOME>/skills/)
|
|
170
|
+
cordis.yml # dev overlay: insert src/index.ts by absolute path
|
|
171
|
+
cordis.patch.yml # bundle patch: insert the package by name
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
`src/index.ts` registers the tools; `config.ts` holds env config;
|
|
175
|
+
`cli-exec.ts` local/SSH CLI execution; `http-api.ts` API probing + SSH tunnel;
|
|
176
|
+
`turn.ts` one learning turn (WebSocket / CLI event folding + formatting);
|
|
177
|
+
`html-render.ts` answer → self-contained HTML.
|
package/README.zh.md
CHANGED
|
@@ -1,107 +1,131 @@
|
|
|
1
|
-
# dsh-deeptutor
|
|
2
|
-
|
|
3
|
-
[English](https://github.com/TecFancy/dsh-deeptutor/blob/main/README.md) | **简体中文**
|
|
4
|
-
|
|
5
|
-
面向 **DeepSeek Harness (dsh)** 的 DeepTutor 桥接 **bundle**,从 pi 编码 agent 扩展迁移而来(`TecFancy/pi-extensions`,`extensions/deeptutor` + `skills/deeptutor`)。
|
|
6
|
-
|
|
7
|
-
注册三个模型可见工具,驱动 [HKUDS/DeepTutor](https://github.com/HKUDS/DeepTutor) 辅导服务:
|
|
8
|
-
|
|
9
|
-
| 工具 | 用途 |
|
|
10
|
-
|---|---|
|
|
11
|
-
| `deeptutor_run` | 运行学习能力: `deep_solve` / `deep_question` / `deep_research` / `chat` / `mastery_path` / `visualize` / `math_animator`(优先 HTTP/WS,CLI 回退) |
|
|
12
|
-
| `deeptutor_kb` | 列出 / 搜索 / 查看个人知识库(RAG)信息 |
|
|
13
|
-
| `deeptutor_note` | 将 Markdown 学习笔记归档到服务端 notebook |
|
|
14
|
-
|
|
15
|
-
上表 7 个 capability 是 `deeptutor_run` 工具接受的固定枚举。底层 DeepTutor CLI 可能支持更多命令——用 `deeptutor --help` / `deeptutor <cmd> --help` 可枚举完整命令集。`deeptutor` skill 会指示 agent 用这种方式动态发现命令;当工具的枚举未覆盖某能力时,agent 可直接调用 CLI(本地二进制或经 SSH)来驱动。
|
|
16
|
-
|
|
17
|
-
部署模式自动适配:本机本地 `serve`(或本地 CLI),或通过自动建立的 SSH 隧道访问服务器(含 SSH CLI 回退)。
|
|
18
|
-
|
|
19
|
-
## 安装到 profile(bundle 方式)
|
|
20
|
-
|
|
21
|
-
包已发布到 npm(`dsh-deeptutor`)
|
|
22
|
-
|
|
23
|
-
```sh
|
|
24
|
-
dsh
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
```sh
|
|
30
|
-
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
|
|
1
|
+
# dsh-deeptutor
|
|
2
|
+
|
|
3
|
+
[English](https://github.com/TecFancy/dsh-deeptutor/blob/main/README.md) | **简体中文**
|
|
4
|
+
|
|
5
|
+
面向 **DeepSeek Harness (dsh)** 的 DeepTutor 桥接 **bundle**,从 pi 编码 agent 扩展迁移而来(`TecFancy/pi-extensions`,`extensions/deeptutor` + `skills/deeptutor`)。
|
|
6
|
+
|
|
7
|
+
注册三个模型可见工具,驱动 [HKUDS/DeepTutor](https://github.com/HKUDS/DeepTutor) 辅导服务:
|
|
8
|
+
|
|
9
|
+
| 工具 | 用途 |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `deeptutor_run` | 运行学习能力: `deep_solve` / `deep_question` / `deep_research` / `chat` / `mastery_path` / `visualize` / `math_animator`(优先 HTTP/WS,CLI 回退) |
|
|
12
|
+
| `deeptutor_kb` | 列出 / 搜索 / 查看个人知识库(RAG)信息 |
|
|
13
|
+
| `deeptutor_note` | 将 Markdown 学习笔记归档到服务端 notebook |
|
|
14
|
+
|
|
15
|
+
上表 7 个 capability 是 `deeptutor_run` 工具接受的固定枚举。底层 DeepTutor CLI 可能支持更多命令——用 `deeptutor --help` / `deeptutor <cmd> --help` 可枚举完整命令集。`deeptutor` skill 会指示 agent 用这种方式动态发现命令;当工具的枚举未覆盖某能力时,agent 可直接调用 CLI(本地二进制或经 SSH)来驱动。
|
|
16
|
+
|
|
17
|
+
部署模式自动适配:本机本地 `serve`(或本地 CLI),或通过自动建立的 SSH 隧道访问服务器(含 SSH CLI 回退)。
|
|
18
|
+
|
|
19
|
+
## 安装到 profile(bundle 方式)
|
|
20
|
+
|
|
21
|
+
包已发布到 npm(`dsh-deeptutor`)。推荐一条命令——运行随包发布的安装器(`scripts/install-profile.mjs`,以 `dsh-deeptutor` 二进制暴露),它包装 `dsh plugin add` 并自动处理下文所述的 pnpm workspace-root 检查:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
pnpm dlx dsh-deeptutor --profile web
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
从本仓库检出目录运行同一个安装器:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
node scripts/install-profile.mjs --profile web
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
或者自己执行底层命令:`dsh plugin add` 会转发给 pnpm 安装依赖,并把 profile 的 `dsh.profile.bundles` 与已安装状态对账,因此声明了 `dsh.bundle` 的包(如本插件)会被自动登记(已在 dsh CLI 0.1.0-rc.6 + pnpm 8.15.6 上验证):
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
dsh plugin --profile web add dsh-deeptutor -w
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
> **坑:pnpm workspace-root 检查。** dsh 的 profile 脚手架**总是**写入 `pnpm-workspace.yaml`(`packages: ["."]`、`nodeLinker: hoisted`),profile 目录本身就是 pnpm workspace 根。在 pnpm ≥ 8 上,`pnpm add` 在 workspace 根目录执行会因 `ERR_PNPM_ADDING_TO_ROOT` 中止,必须显式加 workspace-root 标志,所以上面的命令追加了 `-w`/`--workspace-root`(注意:Windows 上 pnpm 把这条错误打在 **stdout**,看起来像警告,实际是失败)。两种处理方式:
|
|
40
|
+
>
|
|
41
|
+
> 1. 使用安装器 / 命令保留 `-w`(推荐——安装器先试裸命令,只有检查触发时才自动补 `-w`)。
|
|
42
|
+
> 2. 或者永久放行裸命令:在 `~/.dsh/profiles/<name>/pnpm-workspace.yaml` 中加入 `ignore-workspace-root-check: true`,之后 `dsh plugin --profile web add dsh-deeptutor` 按原样即可。
|
|
43
|
+
|
|
44
|
+
验证挂载,然后重启 dsh(bundle 列表在启动时解析):
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
dsh --profile web --dump-config | grep dsh-deeptutor
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
如果你的 dsh CLI 不会自动登记 bundle(旧版本,或手动安装依赖),请在 profile 清单(`~/.dsh/profiles/<name>/package.json`)中手动加入,再运行 `dsh plugin --profile web install`:
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"dependencies": { "dsh-deeptutor": "^0.1.0" },
|
|
55
|
+
"dsh": {
|
|
56
|
+
"profile": { "bundles": ["@deepseek-ai/dsh-base", "@deepseek-ai/dsh-web-app", "dsh-deeptutor"] }
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
也可以不动清单,改用用户 patch 层挂载 bundle(仍需先安装 npm 包):
|
|
62
|
+
|
|
63
|
+
```yaml
|
|
64
|
+
# overlay.yml —— 通过用户 patch 层插入 bundle 行
|
|
65
|
+
- insert:
|
|
66
|
+
- id: dsh-deeptutor
|
|
67
|
+
name: 'dsh-deeptutor'
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
dsh web --patch ./overlay.yml
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
bundle 清单(`dsh.bundle.patch → cordis.patch.yml`)负责插入插件行;上层 patch 层可按 id 覆盖或禁用。
|
|
75
|
+
|
|
76
|
+
## 源码开发(无需发布)
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
dsh web --patch /path/to/dsh-deeptutor/cordis.yml
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## 构建与发布
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
npm install
|
|
86
|
+
npm run build # tsc → lib/(相对 .ts import 改写为 .js)
|
|
87
|
+
npm run typecheck
|
|
88
|
+
npm pack # 检查 dsh-deeptutor-0.1.0.tgz
|
|
89
|
+
npm publish
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
通过 `--patch` 直接加载 `src/*.ts` 需要 Node ≥ 22.6(type stripping);发布的 bundle 自带编译后的 `lib/`,安装到 profile 后仅需普通 Node ≥ 20 ESM。
|
|
93
|
+
|
|
94
|
+
## Skills
|
|
95
|
+
|
|
96
|
+
本包携带两个 skill(`skills/deeptutor` 与 `skills/html-doc`),随包安装器每次运行时都会把它们复制到 `<DSH_HOME>/skills/<name>/`(dsh 自动发现)——所以 `pnpm dlx dsh-deeptutor` 一次装齐插件 **和** skill:
|
|
97
|
+
|
|
98
|
+
- `deeptutor` — 面向 agent 的学习工作流(`~/.dsh/skills/deeptutor/SKILL.md`)
|
|
99
|
+
- `html-doc` — 将学习内容渲染为自包含 HTML 页面(`~/.dsh/skills/html-doc/`);`deeptutor_run` 传入 `html` 路径时,插件内部使用同一转换器(`scripts/md-to-html.js`)
|
|
100
|
+
|
|
101
|
+
升级包版本时会就地覆盖 skill 文件;包未携带的文件不会被删除。
|
|
102
|
+
|
|
103
|
+
## 配置(环境变量,与 agent 无关)
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# 远程部署(DeepTutor 在服务器上,通过 SSH 隧道访问)
|
|
107
|
+
export DEEPTUTOR_SSH_HOST="tencent-cloud" # SSH 主机别名(设置 = 远程模式)
|
|
108
|
+
export DEEPTUTOR_API_BASE="http://127.0.0.1:8001" # 本地隧道地址
|
|
109
|
+
export DEEPTUTOR_REMOTE_BIN="/home/ubuntu/my-deeptutor/.venv/bin/deeptutor"
|
|
110
|
+
export DEEPTUTOR_REMOTE_HOME="/home/ubuntu/my-deeptutor"
|
|
111
|
+
|
|
112
|
+
# 本地部署 —— 不要设置 DEEPTUTOR_SSH_HOST
|
|
113
|
+
# export DEEPTUTOR_API_BASE="http://127.0.0.1:8001" # 本地 serve 端口
|
|
114
|
+
# export DEEPTUTOR_LOCAL_BIN="deeptutor" # 本地 CLI 路径(默认: PATH 上的 deeptutor)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
修改环境变量后需重启 dsh。
|
|
118
|
+
|
|
119
|
+
## 目录结构
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
src/ # TypeScript 源码(开发加载、类型检查)
|
|
123
|
+
lib/ # 编译产物(发布入口,由 npm run build 生成)
|
|
124
|
+
scripts/md-to-html.js # 零依赖 Markdown → HTML 转换器
|
|
125
|
+
scripts/install-profile.mjs # 一键 profile 安装器(以 `dsh-deeptutor` 二进制暴露)
|
|
126
|
+
skills/ # 随包 skill:deeptutor/ + html-doc/(安装到 <DSH_HOME>/skills/)
|
|
127
|
+
cordis.yml # 开发 overlay:按绝对路径插入 src/index.ts
|
|
128
|
+
cordis.patch.yml # bundle patch:按包名插入插件
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
`src/index.ts` 注册工具;`config.ts` 环境配置;`cli-exec.ts` 本地/SSH CLI 执行;`http-api.ts` API 探测 + SSH 隧道;`turn.ts` 单次学习回合(WebSocket / CLI 事件折叠与格式化);`html-render.ts` 答案 → 自包含 HTML。
|
package/cordis.patch.yml
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
# dsh-deeptutor bundle patch: inserts the DeepTutor bridge plugin.
|
|
2
|
-
#
|
|
3
|
-
# Mount into a profile either by adding "dsh-deeptutor" to the profile's
|
|
4
|
-
# `dsh.profile.bundles` list (recommended), or by inserting the same row
|
|
5
|
-
# through a user patch layer:
|
|
6
|
-
#
|
|
7
|
-
# - insert:
|
|
8
|
-
# - id: dsh-deeptutor
|
|
9
|
-
# name: 'dsh-deeptutor'
|
|
10
|
-
#
|
|
11
|
-
# The `name` is the npm package itself; the loader resolves it from the
|
|
12
|
-
# profile's node_modules (installed via `dsh plugin` or the profile's own
|
|
13
|
-
# package manager).
|
|
14
|
-
|
|
15
|
-
- insert:
|
|
16
|
-
- id: dsh-deeptutor
|
|
17
|
-
name: 'dsh-deeptutor'
|
|
1
|
+
# dsh-deeptutor bundle patch: inserts the DeepTutor bridge plugin.
|
|
2
|
+
#
|
|
3
|
+
# Mount into a profile either by adding "dsh-deeptutor" to the profile's
|
|
4
|
+
# `dsh.profile.bundles` list (recommended), or by inserting the same row
|
|
5
|
+
# through a user patch layer:
|
|
6
|
+
#
|
|
7
|
+
# - insert:
|
|
8
|
+
# - id: dsh-deeptutor
|
|
9
|
+
# name: 'dsh-deeptutor'
|
|
10
|
+
#
|
|
11
|
+
# The `name` is the npm package itself; the loader resolves it from the
|
|
12
|
+
# profile's node_modules (installed via `dsh plugin` or the profile's own
|
|
13
|
+
# package manager).
|
|
14
|
+
|
|
15
|
+
- insert:
|
|
16
|
+
- id: dsh-deeptutor
|
|
17
|
+
name: 'dsh-deeptutor'
|