dsh-deeptutor 0.1.7 → 0.1.9
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 +226 -181
- package/README.zh.md +166 -133
- package/cordis.patch.yml +17 -17
- package/docs/demo/en-final-answer.png +0 -0
- package/docs/demo/en-study-page.png +0 -0
- package/docs/demo/final-answer.png +0 -0
- package/docs/demo/study-page.png +0 -0
- package/package.json +75 -66
- package/scripts/install-profile.mjs +233 -233
- package/scripts/md-to-html.js +381 -381
- package/scripts/sync-skills.mjs +46 -46
- package/skills/deeptutor/README.md +129 -129
- package/skills/deeptutor/SKILL.md +183 -183
- package/skills/html-doc/SKILL.md +91 -91
- package/skills/html-doc/scripts/md-to-html.js +381 -381
- package/src/cli-exec.ts +251 -251
- package/src/config.ts +71 -71
- package/src/html-render.ts +53 -53
- package/src/http-api.ts +98 -98
- package/src/index.ts +468 -468
- package/src/turn.ts +197 -197
package/README.md
CHANGED
|
@@ -1,181 +1,226 @@
|
|
|
1
|
-
# dsh-deeptutor
|
|
2
|
-
|
|
3
|
-
**English** | [简体中文](https://github.com/TecFancy/dsh-deeptutor/blob/main/README.zh.md)
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
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
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
##
|
|
167
|
-
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
1
|
+
# dsh-deeptutor
|
|
2
|
+
|
|
3
|
+
**English** | [简体中文](https://github.com/TecFancy/dsh-deeptutor/blob/main/README.zh.md)
|
|
4
|
+
|
|
5
|
+
A **learning-assistant extension for DeepSeek Harness (dsh)**. It connects your
|
|
6
|
+
agent to a [HKUDS/DeepTutor](https://github.com/HKUDS/DeepTutor) tutoring
|
|
7
|
+
service, so a dsh session can explain topics in depth, quiz you, plan learning
|
|
8
|
+
paths, search your personal knowledge bases, and keep a study notebook — all
|
|
9
|
+
without leaving the harness.
|
|
10
|
+
|
|
11
|
+
Ask the agent *"teach me async/await"* and it can run a deep-solve, render the
|
|
12
|
+
answer as a self-contained HTML study page you can open in a browser, and
|
|
13
|
+
archive a summary into your notebook.
|
|
14
|
+
|
|
15
|
+
Migrated from the pi coding-agent extension
|
|
16
|
+
(`TecFancy/pi-extensions`, `extensions/deeptutor` + `skills/deeptutor`).
|
|
17
|
+
|
|
18
|
+
## What it adds
|
|
19
|
+
|
|
20
|
+
Three agent-facing tools that the model uses whenever you ask for learning help:
|
|
21
|
+
|
|
22
|
+
| Tool | What it does |
|
|
23
|
+
|---|---|
|
|
24
|
+
| `deeptutor_run` | Runs one learning capability: `deep_solve` (in-depth explanation), `deep_question` (self-test questions), `deep_research`, `chat`, `mastery_path` (learning-path planning), `visualize` / `math_animator` (visualization). Can mount your knowledge bases (`kbs`) and tools (`rag`, `web_search`, `reason`, `code_execution`, …); returns a `session_id` so later turns continue the same context. |
|
|
25
|
+
| `deeptutor_kb` | Lists, searches, and inspects your personal knowledge bases (RAG) |
|
|
26
|
+
| `deeptutor_note` | Archives Markdown study notes (plans, summaries, wrong answers) into a server notebook |
|
|
27
|
+
|
|
28
|
+
The seven capabilities above are the fixed enum accepted by `deeptutor_run`.
|
|
29
|
+
The underlying DeepTutor CLI may expose more — enumerate the full command set
|
|
30
|
+
with `deeptutor --help` / `deeptutor <cmd> --help`. The `deeptutor` skill
|
|
31
|
+
instructs the agent to discover commands this way and, when the tool's enum
|
|
32
|
+
doesn't cover a capability, to drive the CLI directly (local binary or over
|
|
33
|
+
SSH).
|
|
34
|
+
|
|
35
|
+
## Example session
|
|
36
|
+
|
|
37
|
+
A typical flow when you ask your agent for learning help:
|
|
38
|
+
|
|
39
|
+
1. **Ask** — *"Explain C# generics covariance using my dotnet knowledge base, and generate a study page."*
|
|
40
|
+
2. The agent grounds the answer in your own material: `deeptutor_kb` (`action=search`, `kb=dotnet`).
|
|
41
|
+
3. It runs a deep-solve: `deeptutor_run` (`capability=deep_solve`, `kbs=[dotnet]`, `html=data/study/csharp-covariance.html`) — the answer comes back and a self-contained HTML page (plus the `.md` source) is written to disk.
|
|
42
|
+
4. It files a summary: `deeptutor_note` (`notebook=dotnet-learning`, `type=solve`).
|
|
43
|
+
|
|
44
|
+
Nothing here is a fixed script — the agent picks the tools and parameters based
|
|
45
|
+
on what you ask for.
|
|
46
|
+
|
|
47
|
+
A real recording of exactly this flow (deep-solve on the async/await state
|
|
48
|
+
machine, mounted on a `dotnet-csharp` knowledge base, rendered to an HTML
|
|
49
|
+
study page, then archived to a notebook):
|
|
50
|
+
|
|
51
|
+

|
|
52
|
+
|
|
53
|
+

|
|
54
|
+
|
|
55
|
+
## Requirements
|
|
56
|
+
|
|
57
|
+
- A working DeepSeek Harness (dsh) install. Bundle auto-registration via
|
|
58
|
+
`dsh plugin add` is verified on dsh CLI 0.1.0-rc.6 + pnpm 8.15.6.
|
|
59
|
+
- A DeepTutor deployment, either:
|
|
60
|
+
- **Local** — `deeptutor serve` running on this machine, or the `deeptutor`
|
|
61
|
+
CLI on `PATH` (used as fallback);
|
|
62
|
+
- **Remote** — DeepTutor on a server, reached through an auto-started SSH
|
|
63
|
+
tunnel (with SSH CLI fallback).
|
|
64
|
+
|
|
65
|
+
## Install into a profile (bundle)
|
|
66
|
+
|
|
67
|
+
The package is published to npm as `dsh-deeptutor`. Recommended one-liner —
|
|
68
|
+
runs the bundled installer (`scripts/install-profile.mjs`, exposed as the
|
|
69
|
+
`dsh-deeptutor` binary), which wraps `dsh plugin add` and automatically
|
|
70
|
+
handles the pnpm workspace-root check described below:
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
pnpm dlx dsh-deeptutor --profile web
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
From a checkout of this repo, the same installer runs directly:
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
node scripts/install-profile.mjs --profile web
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Or run the underlying command yourself — `dsh plugin add` forwards to pnpm
|
|
83
|
+
and then reconciles the profile's `dsh.profile.bundles` against the installed
|
|
84
|
+
state, so a `dsh.bundle`-declaring package like this one is registered
|
|
85
|
+
automatically:
|
|
86
|
+
|
|
87
|
+
```sh
|
|
88
|
+
dsh plugin --profile web add dsh-deeptutor -w
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
> **Pitfall — pnpm workspace-root check.** The dsh profile scaffold always
|
|
92
|
+
> writes a `pnpm-workspace.yaml` (`packages: ["."]`, `nodeLinker: hoisted`),
|
|
93
|
+
> which makes the profile directory itself a pnpm workspace root. On
|
|
94
|
+
> pnpm ≥ 8, `pnpm add` in a workspace root aborts with
|
|
95
|
+
> `ERR_PNPM_ADDING_TO_ROOT` unless the workspace-root flag is explicit, so
|
|
96
|
+
> the command above appends `-w`/`--workspace-root` (pnpm prints this error
|
|
97
|
+
> on stdout on Windows, which is why a plain `dsh plugin add` without the
|
|
98
|
+
> flag fails even though the output looks like a warning). Two ways to
|
|
99
|
+
> handle it:
|
|
100
|
+
>
|
|
101
|
+
> 1. Use the installer / keep `-w` in the command (recommended — the
|
|
102
|
+
> installer tries the plain command first and adds `-w` automatically
|
|
103
|
+
> only when the check trips).
|
|
104
|
+
> 2. Or allow the plain command permanently: add
|
|
105
|
+
> `ignore-workspace-root-check: true` to
|
|
106
|
+
> `~/.dsh/profiles/<name>/pnpm-workspace.yaml`, then
|
|
107
|
+
> `dsh plugin --profile web add dsh-deeptutor` works as written.
|
|
108
|
+
|
|
109
|
+
Verify the bundle is mounted, then restart dsh (the bundle list is resolved
|
|
110
|
+
at boot):
|
|
111
|
+
|
|
112
|
+
```sh
|
|
113
|
+
dsh --profile web --dump-config | grep dsh-deeptutor
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
If your dsh CLI does not auto-register the bundle (older versions, or you
|
|
117
|
+
installed the dependency manually), add it to the profile manifest
|
|
118
|
+
(`~/.dsh/profiles/<name>/package.json`) and run `dsh plugin --profile web
|
|
119
|
+
install`:
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"dependencies": { "dsh-deeptutor": "^0.1.0" },
|
|
124
|
+
"dsh": {
|
|
125
|
+
"profile": { "bundles": ["@deepseek-ai/dsh-base", "@deepseek-ai/dsh-web-app", "dsh-deeptutor"] }
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Alternatively, keep the manifest untouched and mount the bundle through a user
|
|
131
|
+
patch layer (the npm package still has to be installed first):
|
|
132
|
+
|
|
133
|
+
```yaml
|
|
134
|
+
# overlay.yml — insert the bundle row via a user patch layer
|
|
135
|
+
- insert:
|
|
136
|
+
- id: dsh-deeptutor
|
|
137
|
+
name: 'dsh-deeptutor'
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
```sh
|
|
141
|
+
dsh web --patch ./overlay.yml
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The bundle manifest (`dsh.bundle.patch → cordis.patch.yml`) inserts the plugin
|
|
145
|
+
row; later patch layers can override or disable it by id.
|
|
146
|
+
|
|
147
|
+
## Skills
|
|
148
|
+
|
|
149
|
+
Two skills ship inside this package (`skills/deeptutor` and
|
|
150
|
+
`skills/html-doc`) and the bundled installer copies them to
|
|
151
|
+
`<DSH_HOME>/skills/<name>/` (auto-discovered by dsh) whenever it runs — so
|
|
152
|
+
`pnpm dlx dsh-deeptutor` installs the bundle **and** the skills in one shot:
|
|
153
|
+
|
|
154
|
+
- `deeptutor` — the agent-facing learning workflow (`~/.dsh/skills/deeptutor/SKILL.md`)
|
|
155
|
+
- `html-doc` — renders study answers to self-contained HTML pages
|
|
156
|
+
(`~/.dsh/skills/html-doc/`); the bundle uses the same converter
|
|
157
|
+
(`scripts/md-to-html.js`) when `deeptutor_run` gets an `html` path
|
|
158
|
+
|
|
159
|
+
Installing a newer package version overwrites skill files in place; files not
|
|
160
|
+
shipped by the package are never deleted.
|
|
161
|
+
|
|
162
|
+
The files under `skills/` are byte-identical copies of the same skills in
|
|
163
|
+
`TecFancy/pi-extensions` (single source of truth, agent-neutral). Sync them
|
|
164
|
+
after upstream edits with `node scripts/sync-skills.mjs ../pi-extensions`.
|
|
165
|
+
|
|
166
|
+
## Configuration (env vars, agent-agnostic)
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# Remote deployment (DeepTutor on a server, reached through an SSH tunnel)
|
|
170
|
+
export DEEPTUTOR_SSH_HOST="tencent-cloud" # SSH host alias (set = remote mode)
|
|
171
|
+
export DEEPTUTOR_API_BASE="http://127.0.0.1:8001" # local tunnel address
|
|
172
|
+
export DEEPTUTOR_REMOTE_BIN="/home/ubuntu/my-deeptutor/.venv/bin/deeptutor"
|
|
173
|
+
export DEEPTUTOR_REMOTE_HOME="/home/ubuntu/my-deeptutor"
|
|
174
|
+
|
|
175
|
+
# Local deployment — leave DEEPTUTOR_SSH_HOST unset
|
|
176
|
+
# export DEEPTUTOR_API_BASE="http://127.0.0.1:8001" # local serve port
|
|
177
|
+
# export DEEPTUTOR_LOCAL_BIN="deeptutor" # local CLI path (default: deeptutor on PATH)
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Restart dsh after changing env vars.
|
|
181
|
+
|
|
182
|
+
## How it works
|
|
183
|
+
|
|
184
|
+
The plugin auto-detects the deployment: if a DeepTutor API is reachable (local
|
|
185
|
+
`serve`, or a remote server via tunnel), learning turns run over HTTP/WebSocket;
|
|
186
|
+
otherwise it falls back to the CLI — the local `deeptutor` binary, or the remote
|
|
187
|
+
binary over SSH. Remote mode starts the SSH tunnel on demand and tears it down
|
|
188
|
+
when the plugin unloads.
|
|
189
|
+
|
|
190
|
+
## Develop against a checkout (no publish needed)
|
|
191
|
+
|
|
192
|
+
```sh
|
|
193
|
+
dsh web --patch /path/to/dsh-deeptutor/cordis.yml
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Build & publish
|
|
197
|
+
|
|
198
|
+
```sh
|
|
199
|
+
npm install
|
|
200
|
+
npm run build # tsc → lib/ (relative .ts imports rewritten to .js)
|
|
201
|
+
npm run typecheck
|
|
202
|
+
npm test # node:test + type stripping
|
|
203
|
+
npm pack # inspect dsh-deeptutor-<version>.tgz
|
|
204
|
+
npm publish # set a scope/registry of your choice first
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Node ≥ 22.6 (type stripping) is needed to load the raw `src/*.ts` via
|
|
208
|
+
`--patch`; the published bundle ships compiled `lib/`, so installed profiles
|
|
209
|
+
run on plain Node ≥ 20 ESM.
|
|
210
|
+
|
|
211
|
+
## Layout
|
|
212
|
+
|
|
213
|
+
```
|
|
214
|
+
src/ # TypeScript sources (dev loading, typecheck)
|
|
215
|
+
lib/ # compiled ESM (published entry, from `npm run build`)
|
|
216
|
+
scripts/md-to-html.js # zero-dependency Markdown → HTML converter
|
|
217
|
+
scripts/install-profile.mjs # one-shot profile installer (exposed as the `dsh-deeptutor` binary)
|
|
218
|
+
skills/ # bundled skills: deeptutor/ + html-doc/ (installed to <DSH_HOME>/skills/)
|
|
219
|
+
cordis.yml # dev overlay: insert src/index.ts by absolute path
|
|
220
|
+
cordis.patch.yml # bundle patch: insert the package by name
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
`src/index.ts` registers the tools; `config.ts` holds env config;
|
|
224
|
+
`cli-exec.ts` local/SSH CLI execution; `http-api.ts` API probing + SSH tunnel;
|
|
225
|
+
`turn.ts` one learning turn (WebSocket / CLI event folding + formatting);
|
|
226
|
+
`html-render.ts` answer → self-contained HTML.
|