dsh-learning-assistant 0.0.0-stage → 0.0.2
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/LICENSE +21 -0
- package/README.md +55 -2
- package/cordis.patch.yml +5 -0
- package/docs//345/215/217/344/275/234/345/274/200/345/217/221.md +118 -0
- package/docs//345/217/221/345/270/203/346/211/213/345/206/214.md +78 -0
- package/docs//350/256/276/350/256/241/350/267/257/347/272/277.md +51 -0
- package/lib/client.d.mts +10 -0
- package/lib/client.mjs +87 -0
- package/lib/index.d.mts +31 -0
- package/lib/index.mjs +29 -0
- package/package.json +78 -4
- package/src/client/index.tsx +29 -0
- package/src/client/settings.tsx +94 -0
- package/src/index.ts +64 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 dsh-learning-assistant contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,56 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-learning-assistant
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
DeepSeek Harness 的「学习助手」插件:把现在手工跑的一套带学流程固化成插件。
|
|
4
|
+
|
|
5
|
+
> 现状:**骨架**。目录、清单、`settings.section` 注册都已就位,`apply()` 里只有 TODO;
|
|
6
|
+
> 依赖未安装、未构建、未装进 profile。下一步见 `docs/设计路线.md`。
|
|
7
|
+
|
|
8
|
+
## 三个板块
|
|
9
|
+
|
|
10
|
+
| 板块 | 内容 | 现状 |
|
|
11
|
+
|---|---|---|
|
|
12
|
+
| 资料整理 | QQ(NapCat)自动收群文件落盘;企微走 UIA 采集;微信 4.x 待社区适配 | 脚本已跑通,待封装 |
|
|
13
|
+
| 知识整理与讲解 | 按学科选讲解方案;思维导图 + 讲解提示词 | 技能已有,待内嵌 |
|
|
14
|
+
| 学习助手数据 | 现有练习台:课程计划、学习历史、作答记录 | 代码可搬,待接线 |
|
|
15
|
+
|
|
16
|
+
使用侧:用户说「帮我学 xx」→ 按所选方案整理并讲解 → 出题自测(与现有练习台机制一致)。
|
|
17
|
+
|
|
18
|
+
## 目录
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
src/index.ts 宿主半:tools / skills / 路由 / 配置 schema
|
|
22
|
+
src/client/index.tsx 浏览器半:slot 注册入口
|
|
23
|
+
src/client/settings.tsx 设置 → 学习助手(三分区页面)
|
|
24
|
+
cordis.patch.yml 把插件插进 profile 层叠栈
|
|
25
|
+
docs/设计路线.md 分阶段路线、岔路口、成本
|
|
26
|
+
docs/发布手册.md 发 npm、别人怎么装、怎么收到新版本
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 开发
|
|
30
|
+
|
|
31
|
+
```powershell
|
|
32
|
+
npm install # 或 pnpm install
|
|
33
|
+
npm run typecheck
|
|
34
|
+
npm run build # 产出 lib/index.js + lib/client.js
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
装进本机 profile 验证(在装好后):
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
plugin_manager install_bundle target=<本目录绝对路径> # 本地目录安装,验证用
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## 与学习区的关系
|
|
44
|
+
|
|
45
|
+
本仓库只放**代码与文档**,不放个人数据(题库、答卷、笔迹、收件箱、学习进度都在
|
|
46
|
+
`..\练习台\` 与 `..\学习助手数据\`,已由 `.gitignore` 排除)。素材迁移按
|
|
47
|
+
`docs/设计路线.md` 的「阶段 0」做,不复制、只改路径。
|
|
48
|
+
|
|
49
|
+
## 一起开发
|
|
50
|
+
|
|
51
|
+
clone → `npm install` → `npm run build` → 装到自己的 DSH 里试 → 提 PR。
|
|
52
|
+
分支规矩、评审口径、谁能发版,见 [docs/协作开发.md](docs/协作开发.md)。
|
|
53
|
+
|
|
54
|
+
## License
|
|
55
|
+
|
|
56
|
+
MIT
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# 一起开发:仓库、分支、怎么装到自己机器上试
|
|
2
|
+
|
|
3
|
+
## 1. 一次性准备(每个开发者各做一遍)
|
|
4
|
+
|
|
5
|
+
```powershell
|
|
6
|
+
git clone https://github.com/shinkontokitoki/dsh-learning-assistant.git
|
|
7
|
+
cd dsh-learning-assistant
|
|
8
|
+
npm install
|
|
9
|
+
npm run build # 产出 lib/index.mjs、lib/client.mjs
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
装进自己的 DSH 里试(不要装到别人的 profile):
|
|
13
|
+
|
|
14
|
+
- 用 DSH 插件管理器「从本地目录安装」,指向 clone 下来的目录;
|
|
15
|
+
- 或命令行 `plugin_manager` 的 `install_bundle`,`target` 填这个目录的绝对路径。
|
|
16
|
+
|
|
17
|
+
改完代码后:`npm run build` → 在插件管理器里停用再启用(或重启 DSH),才会加载新产物。
|
|
18
|
+
|
|
19
|
+
## 2. 日常循环
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
改代码 → npm run typecheck → npm run build → 本机启用插件自测 → 提 PR
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
三条硬规矩:
|
|
26
|
+
|
|
27
|
+
1. **不要直接往 main 推**。main 永远是可安装状态,坏代码进 main 会连累所有人。
|
|
28
|
+
2. 一个 PR 只做一件事(修一个 bug / 加一个功能)。混着改,评审和回滚都会变难。
|
|
29
|
+
3. PR 描述里写清「改了什么、怎么自测的、有没有影响数据格式」。改了题库/答卷/进度
|
|
30
|
+
的字段必须说明兼容性——老数据要能继续读。
|
|
31
|
+
|
|
32
|
+
## 3. 分支与提交
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
feat/practice-desk-panel 新功能
|
|
36
|
+
fix/settings-section-order 修 bug
|
|
37
|
+
docs/collab-guide 只改文档
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
提交信息用中文,前缀 `feat:` / `fix:` / `docs:` / `chore:`,一行说清做了什么。
|
|
41
|
+
|
|
42
|
+
## 4. 评审
|
|
43
|
+
|
|
44
|
+
- 改动涉及 `src/index.ts` 的 `apply()`、配置 schema、数据目录结构 → 至少一个人看过再合。
|
|
45
|
+
- 只改文档、注释、样式 → 自己 merge 即可。
|
|
46
|
+
- 评审关注三件事:会不会让别人的 DSH 起不来、会不会改坏老数据、有没有把个人数据
|
|
47
|
+
(题库/答卷/笔迹/路径)带进仓库。
|
|
48
|
+
|
|
49
|
+
## 5. 发布(只有维护者做)
|
|
50
|
+
|
|
51
|
+
```powershell
|
|
52
|
+
npm version patch # 或 minor
|
|
53
|
+
git push --follow-tags
|
|
54
|
+
npm publish # 首次若用了 scope 需加 --access public
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
发布前必须 `npm run check` 全绿。版本号规则与更新语义见 [发布手册](发布手册.md)。
|
|
58
|
+
**不要在 PR 里改 `version`**——版本号由维护者在发布时统一升,否则多人同时改会撞车。
|
|
59
|
+
|
|
60
|
+
## 6. 谁负责什么
|
|
61
|
+
|
|
62
|
+
| 角色 | 职责 |
|
|
63
|
+
|---|---|
|
|
64
|
+
| 维护者 | 合并 PR、升版本、发 npm、答复 issue |
|
|
65
|
+
| 开发者 | 自己的分支 + PR + 自测;装在自己机器上验证,不碰别人的 profile |
|
|
66
|
+
|
|
67
|
+
## 7. 仓库现在是 public:两种参与方式
|
|
68
|
+
|
|
69
|
+
仓库地址 <https://github.com/shinkontokitoki/dsh-learning-assistant> 已公开,任何人可 clone、读代码、提 issue。
|
|
70
|
+
|
|
71
|
+
**方式一:fork + PR(不用等邀请,推荐给不常一起改的人)**
|
|
72
|
+
fork → 在自己的 fork 上开分支改 → 向上游提 PR。维护者合并。
|
|
73
|
+
|
|
74
|
+
**方式二:直接被加进仓库(能推分支,适合长期一起改的朋友)**
|
|
75
|
+
需要维护者按用户名或邮箱逐个邀请(GitHub 个人仓库没有「邀请链接」):
|
|
76
|
+
|
|
77
|
+
```powershell
|
|
78
|
+
# permission: pull(只读) / push(可推) / admin
|
|
79
|
+
gh api -X PUT repos/shinkontokitoki/dsh-learning-assistant/collaborators/<GitHub用户名> -f permission=push
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
或网页 Settings → Collaborators → Invite(可填用户名或邮箱)。对方收邮件/通知点接受即可。
|
|
83
|
+
|
|
84
|
+
> 注意:仓库若日后要重新转回 private,已 fork 的副本不会收回——转 public 前请确认代码里没有密钥、个人路径。
|
|
85
|
+
|
|
86
|
+
## 8. 推不上去时(本机实测过)
|
|
87
|
+
|
|
88
|
+
本机装了 Steam++/Watt Toolkit 的「GitHub 加速」,它把 `github.com` 写进 hosts 指向
|
|
89
|
+
`127.0.0.1`,并在 443 端口起自己的 MITM 代理。表现是:`gh` 能用(走 api.github.com),
|
|
90
|
+
但 `git push` 报 `schannel: failed to receive handshake` / `Could not connect to server`。
|
|
91
|
+
|
|
92
|
+
仓库级一次性修复(已在本机设好,换机器要重设):
|
|
93
|
+
|
|
94
|
+
```powershell
|
|
95
|
+
git config http.schannelCheckRevoke false
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
顺带:仓库里不要留 `http.proxy`,代理开着时它和 Steam++ 的 MITM 会互相打架。
|
|
99
|
+
|
|
100
|
+
如果连 `gh` 也不通,先在任务管理器把 `Steam++.Accelerator` 停掉再试。
|
|
101
|
+
|
|
102
|
+
## 9. CI 现状(2026-11-18)
|
|
103
|
+
|
|
104
|
+
`.github/workflows/ci.yml` 已写好(Windows 上 `npm ci` + typecheck + build),但**当前账号的
|
|
105
|
+
GitHub Actions 被停用**,实际不会跑(手动触发报 `HTTP 422: Actions has been disabled for this user`)。
|
|
106
|
+
去 Settings → Actions → General 允许 Actions(可能要先验证邮箱)之后即可用。
|
|
107
|
+
|
|
108
|
+
在此之前用本地钩子兜底(push 前自动检查):
|
|
109
|
+
|
|
110
|
+
```powershell
|
|
111
|
+
git config core.hooksPath .githooks
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## 10. 环境差异
|
|
115
|
+
|
|
116
|
+
- 采集功能(QQ/企微)**只能 Windows**,其他人(mac/Linux)跑测试时会跳过这些用例。
|
|
117
|
+
- Node ≥ 20,npm ≥ 10。宿主 DSH 版本要求写在 `package.json` 的 `engines.dsh`,
|
|
118
|
+
版本不满足时插件管理器会拒绝安装——这是故意的,别改宽去"绕过"。'
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# 发布手册:走 npm,别人怎么装、怎么更新
|
|
2
|
+
|
|
3
|
+
## 1. 一次性准备
|
|
4
|
+
|
|
5
|
+
**包名**。两种:
|
|
6
|
+
|
|
7
|
+
- 无 scope:`dsh-learning-assistant`。省事,但名字先到先得,被占用只能换名。
|
|
8
|
+
- 有 scope:`@<你的npm用户名>/dsh-learning-assistant`。推荐——自己的 scope 随便发,
|
|
9
|
+
且永远不会被别人抢;代价是发布要带 `--access public`(scoped 包默认私有)。
|
|
10
|
+
|
|
11
|
+
改名时同步三处:`package.json` 的 `name`、`cordis.patch.yml` 的 `name` 与 `insert[].name`。
|
|
12
|
+
|
|
13
|
+
**登录**(本机现在还没登录:`npm whoami` 报 ENEEDAUTH)
|
|
14
|
+
|
|
15
|
+
```powershell
|
|
16
|
+
npm login # 浏览器授权,或 npm adduser
|
|
17
|
+
npm whoami # 确认
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**首次发布**
|
|
21
|
+
|
|
22
|
+
```powershell
|
|
23
|
+
npm run check # typecheck + test + build,必须绿
|
|
24
|
+
npm version 0.1.0 # 建议从 0.1.0 起,0.x 阶段小版本就可以有破坏性改动
|
|
25
|
+
git push --follow-tags
|
|
26
|
+
npm publish --access public # 无 scope 时去掉 --access public
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 2. 版本号与更新语义
|
|
30
|
+
|
|
31
|
+
npm 的更新是**拉取式**的:别人不会自动收到新版本,但他的下一次安装会解析到最新版。
|
|
32
|
+
|
|
33
|
+
- `patch`(0.1.0 → 0.1.1):修 bug,用户重装即得。
|
|
34
|
+
- `minor`(0.1 → 0.2):加功能。0.x 阶段允许破坏性改动,但要在 CHANGELOG 写明。
|
|
35
|
+
- `major`(0.x → 1.0):API/数据格式冻结,之后破坏性改动才升 major。
|
|
36
|
+
|
|
37
|
+
**`engines.dsh` 是护栏**:写 `">=0.2.0-rc.1 <0.3.0"`。DSH 版本不满足时插件管理器会
|
|
38
|
+
直接拒绝安装/启用,而不是装上去崩掉。宿主升级到 0.3 之后,本包要发一版放宽范围,
|
|
39
|
+
否则老用户升宿主就装不上了。
|
|
40
|
+
|
|
41
|
+
## 3. 用户侧怎么装
|
|
42
|
+
|
|
43
|
+
1. 打开 DSH → 设置 → 插件(插件管理器)→ 安装,填 npm 包名(可带版本或 tag:
|
|
44
|
+
`dsh-learning-assistant@0.1.2`)。
|
|
45
|
+
2. 等安装完成 → 重启会话(或按提示重载)→ 设置里出现「学习助手」。
|
|
46
|
+
3. 首次打开按引导填数据根目录、练习台端口、群白名单。
|
|
47
|
+
|
|
48
|
+
命令行等价物是 `plugin_manager` 的 `install_bundle`,`target` 填同一个 spec。
|
|
49
|
+
官方市场收录是另一件事(要单独提登记),**没被收录也能用包名装**。
|
|
50
|
+
|
|
51
|
+
## 4. 用户侧怎么更新
|
|
52
|
+
|
|
53
|
+
- **重新安装同一 spec**:`install_bundle` 对已安装包执行就是升级,会解析到最新版本。
|
|
54
|
+
- **指定版本回退**:`dsh-learning-assistant@0.1.0` 即可降级,排查问题用。
|
|
55
|
+
- **不要承诺自动更新**:DSH 没有静默自更新;发版后由用户重装,或在 CHANGELOG 里
|
|
56
|
+
告诉他「重装一次即可」。真要做强提醒,只能在插件里检查 registry 的 latest 并弹提示。
|
|
57
|
+
|
|
58
|
+
## 5. CI(可选,但强烈建议)
|
|
59
|
+
|
|
60
|
+
`.github/workflows/publish.yml`:tag 触发 → `npm ci` → `npm run check` → `npm publish --provenance`,
|
|
61
|
+
token 放仓库 secret `NPM_TOKEN`。这样「发新版」= 打 tag,不用在本机记住发布步骤。
|
|
62
|
+
|
|
63
|
+
## 6. 还没上 npm 时的替代通道
|
|
64
|
+
|
|
65
|
+
- GitHub tarball:`npm i https://github.com/<你>/dsh-learning-assistant/archive/refs/tags/v0.1.0.tar.gz`
|
|
66
|
+
- git 直装:`npm i github:<你>/dsh-learning-assistant#v0.1.0`
|
|
67
|
+
- 本地目录:开发期最常用,`install_bundle` 的 `target` 直接给绝对路径。
|
|
68
|
+
|
|
69
|
+
三条都能让插件管理器装上,区别只是「更新」要重新指向新地址或新 tag。
|
|
70
|
+
## 7. 已核实的事实(2026-11-18,registry 实测)
|
|
71
|
+
|
|
72
|
+
- 包名 `dsh-learning-assistant` **尚未被占用**(`npm view` 返回 E404)。想改名要趁现在。
|
|
73
|
+
- 宿主版本:npm 上 `@deepseek-ai/dsh` 的 latest = **0.2.2-rc.1**,与本机桌面端一致。
|
|
74
|
+
- `@deepseek-ai/*` 的 dist-tags 有点坑:`latest` 停在旧的 `0.0.1-rc.1`,
|
|
75
|
+
真正的新版在 `next`(0.2.2-rc.4)。所以依赖**一律写具体版本**,别写 `latest`。
|
|
76
|
+
- `engines.dsh` 的 prerelease 规则:semver 只在「major.minor.patch 完全相同」时才让
|
|
77
|
+
预发布版匹配。所以 `>=0.2.0-rc.1` **匹配不到** 0.2.2-rc.1;要写成 `>=0.2.2-0`。
|
|
78
|
+
同理 peer 依赖用 `^0.2.0-rc.1 || ^0.2.1-0 || ^0.2.2-0` 这种叠加写法。
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# 设计路线
|
|
2
|
+
|
|
3
|
+
写于 2026-11-18。目标:把学习区现有的「资料整理 → 知识整理与讲解 → 练习台自测」
|
|
4
|
+
链条做成 DSH 插件,可自用、可开源。
|
|
5
|
+
|
|
6
|
+
## 复用盘点
|
|
7
|
+
|
|
8
|
+
| 资产 | 位置 | 复用方式 |
|
|
9
|
+
|---|---|---|
|
|
10
|
+
| 练习台后端 | `..\练习台\服务.mjs` + `learn\*.mjs` | 直接搬进 `src/`,只换启动方式与路径来源 |
|
|
11
|
+
| 练习台前端 | `..\练习台\public\` | 阶段一声明式保留(webview),阶段二再组件化 |
|
|
12
|
+
| 技能 | `..\.dsh\skills\`(course-material-digest / one-to-one-tutor / course-inbox-sync) | 改成插件内 `ctx.skills.registerProvider` |
|
|
13
|
+
| QQ 采集 | NapCat OneBot(群文件列表 + 直链下载 + 对账) | 封装成插件服务,管子进程生命周期 |
|
|
14
|
+
| 企微采集 | `wecom-automation` UIA 脚本 | 插件调 Python 子进程 |
|
|
15
|
+
| 微信 4.x | 无(UIA 封死) | 不做,占位 |
|
|
16
|
+
|
|
17
|
+
## 阶段
|
|
18
|
+
|
|
19
|
+
**阶段 0 · 骨架(本次)**:仓库 + 清单 + 设置页 slot + 设计文档。
|
|
20
|
+
**阶段 1 · 练习台插件化**:按需起服务、数据根可配、侧栏 webview 打开、迁移脚本。
|
|
21
|
+
**阶段 2 · 技能内嵌 + 主线工具**:`learn_*` 工具 + 学习状态机(中断/回归要覆盖)。
|
|
22
|
+
**阶段 3 · 方案层**:每学科一份讲解方案 JSON + 切换/自建 UI;思维导图渲染。
|
|
23
|
+
**阶段 4 · 采集**:QQ 服务化(起停、扫码态、白名单 UI)→ 企微服务化。
|
|
24
|
+
**阶段 5 · 开源化**:README/示例数据/多机器安装/宿主版本兼容垫片/CI。
|
|
25
|
+
|
|
26
|
+
## 四个岔路口(未定,需拍板)
|
|
27
|
+
|
|
28
|
+
1. **平台**:UIA 采集只能 Windows;建议 Windows-first,采集做可选模块。
|
|
29
|
+
2. **练习台内嵌**:webview(快)→ 原生 React 组件(慢、好看)。先前者。
|
|
30
|
+
3. **数据根**:默认插件自己的 data 目录,可配指向任意工作区(开源用户没有 learning)。
|
|
31
|
+
4. **开源边界**:不含个人数据;带一个空题库示例学科。
|
|
32
|
+
|
|
33
|
+
## 成本(1 轮 = 一次会话内能做完并自测的闭环)
|
|
34
|
+
|
|
35
|
+
| 工作包 | 轮数 |
|
|
36
|
+
|---|---|
|
|
37
|
+
| 骨架 + 装进 profile + 设置页空壳 | 0.5–1 |
|
|
38
|
+
| 练习台 webview 化 + 数据根 + 迁移 | 1.5–2 |
|
|
39
|
+
| 技能内嵌 + `learn_*` 工具 + 状态机 | 1.5–2 |
|
|
40
|
+
| 方案层(JSON + 切换 UI) | 1 |
|
|
41
|
+
| 思维导图渲染(markmap) | 2–3(可跳过,先用 visualize) |
|
|
42
|
+
| QQ 采集服务化 | 1.5–2 |
|
|
43
|
+
| 企微采集服务化 | 1–1.5 |
|
|
44
|
+
| 开源化(文档/示例/兼容/CI) | 3–5 |
|
|
45
|
+
| **合计** | 自用 MVP 6–8;可开源 15–20 |
|
|
46
|
+
|
|
47
|
+
## 风险
|
|
48
|
+
|
|
49
|
+
- DSH 仍是 rc 版本,插件 API 与版本门槛会漂;`engines.dsh` 写窄一点。
|
|
50
|
+
- 微信 4.x 无解,别在文档里承诺。
|
|
51
|
+
- 「学科方案」是内容设计,不是代码问题,得自己试几轮。
|
package/lib/client.d.mts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
declare const name = "dsh-learning-assistant";
|
|
3
|
+
/** 只要 slot 注册表;其余能力(locale、configForms)在页面里按需查找。 */
|
|
4
|
+
declare const inject: string[];
|
|
5
|
+
/**
|
|
6
|
+
* 注册设置页分区。
|
|
7
|
+
* @param ctx - 客户端根上下文。
|
|
8
|
+
*/
|
|
9
|
+
declare function apply(ctx: Context): void;
|
|
10
|
+
export { apply, inject, name };
|
package/lib/client.mjs
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
// src/client/settings.tsx
|
|
4
|
+
/** 设置对话框里的分区 id。 */
|
|
5
|
+
const SECTION_ID = "dsh-learning-assistant";
|
|
6
|
+
/** 三个板块,顺序即页面顺序。 */
|
|
7
|
+
const TABS = [
|
|
8
|
+
{
|
|
9
|
+
id: "material",
|
|
10
|
+
label: "资料整理"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
id: "teach",
|
|
14
|
+
label: "知识整理与讲解"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: "data",
|
|
18
|
+
label: "学习助手数据"
|
|
19
|
+
}
|
|
20
|
+
];
|
|
21
|
+
/**
|
|
22
|
+
* 三分区页面。
|
|
23
|
+
* @returns 设置页内容。
|
|
24
|
+
*/
|
|
25
|
+
function LearningAssistantSection() {
|
|
26
|
+
const [active, setActive] = useState(TABS[0].id);
|
|
27
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
28
|
+
style: {
|
|
29
|
+
display: "flex",
|
|
30
|
+
flexDirection: "column",
|
|
31
|
+
gap: 12
|
|
32
|
+
},
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ jsx("nav", {
|
|
35
|
+
style: {
|
|
36
|
+
display: "flex",
|
|
37
|
+
gap: 8,
|
|
38
|
+
borderBottom: "1px solid var(--dsh-border, #e5e7eb)"
|
|
39
|
+
},
|
|
40
|
+
children: TABS.map((tab) => /* @__PURE__ */ jsx("button", {
|
|
41
|
+
onClick: () => setActive(tab.id),
|
|
42
|
+
style: {
|
|
43
|
+
padding: "6px 10px",
|
|
44
|
+
border: "none",
|
|
45
|
+
background: "none",
|
|
46
|
+
cursor: "pointer",
|
|
47
|
+
fontWeight: active === tab.id ? 600 : 400,
|
|
48
|
+
borderBottom: active === tab.id ? "2px solid currentColor" : "2px solid transparent"
|
|
49
|
+
},
|
|
50
|
+
children: tab.label
|
|
51
|
+
}, tab.id))
|
|
52
|
+
}),
|
|
53
|
+
active === "material" && /* @__PURE__ */ jsxs("section", { children: [
|
|
54
|
+
/* @__PURE__ */ jsx("h3", { children: "资料整理" }),
|
|
55
|
+
/* @__PURE__ */ jsx("p", { children: "QQ(NapCat)已通;企业微信走 UIA 采集;微信 4.x 待社区适配。" }),
|
|
56
|
+
/* @__PURE__ */ jsx("p", { children: "白名单:只采集下面配置里点名的群。" })
|
|
57
|
+
] }),
|
|
58
|
+
active === "teach" && /* @__PURE__ */ jsxs("section", { children: [/* @__PURE__ */ jsx("h3", { children: "知识整理与讲解" }), /* @__PURE__ */ jsx("p", { children: "按学科选择讲解方案(粒度、是否先出导图、例题风格),可自建方案。" })] }),
|
|
59
|
+
active === "data" && /* @__PURE__ */ jsxs("section", { children: [/* @__PURE__ */ jsx("h3", { children: "学习助手数据" }), /* @__PURE__ */ jsx("p", { children: "课程计划、学习历史、作答记录;练习台在此打开。" })] })
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* 注册设置页分区。
|
|
65
|
+
* @param ctx - 客户端根上下文。
|
|
66
|
+
*/
|
|
67
|
+
function registerSettingsSection(ctx) {
|
|
68
|
+
const slots = ctx.slots;
|
|
69
|
+
slots.inject("settings.section", () => slots.register({
|
|
70
|
+
name: "settings.section",
|
|
71
|
+
id: SECTION_ID,
|
|
72
|
+
order: 96,
|
|
73
|
+
label: () => "学习助手"
|
|
74
|
+
}, LearningAssistantSection));
|
|
75
|
+
}
|
|
76
|
+
// src/client/index.tsx
|
|
77
|
+
const name = "dsh-learning-assistant";
|
|
78
|
+
/** 只要 slot 注册表;其余能力(locale、configForms)在页面里按需查找。 */
|
|
79
|
+
const inject = ["slots"];
|
|
80
|
+
/**
|
|
81
|
+
* 注册设置页分区。
|
|
82
|
+
* @param ctx - 客户端根上下文。
|
|
83
|
+
*/
|
|
84
|
+
function apply(ctx) {
|
|
85
|
+
registerSettingsSection(ctx);
|
|
86
|
+
}
|
|
87
|
+
export { apply, inject, name };
|
package/lib/index.d.mts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import z from "@deepseek-ai/schemastery";
|
|
2
|
+
import { Context } from "@deepseek-ai/cordis";
|
|
3
|
+
/** Cordis 插件名,与 package.json 的 name、cordis.patch.yml 的 entry id 一致。 */
|
|
4
|
+
declare const name = "dsh-learning-assistant";
|
|
5
|
+
/** 需要宿主提供的服务:工具注册表、技能注册表、文件系统接缝。 */
|
|
6
|
+
declare const inject: string[];
|
|
7
|
+
/** 部署配置(设置页表单由 schemastery 自动生成)。 */
|
|
8
|
+
interface Config {
|
|
9
|
+
/**
|
|
10
|
+
* 数据根目录:题库、答卷、笔迹、收件箱、学习进度都落在这里。
|
|
11
|
+
* 开源用户不该被绑死在某个工作区,所以默认空字符串 = 由插件决定
|
|
12
|
+
* (<profile>/data/dsh-learning-assistant),也可指向任意工作区。
|
|
13
|
+
*/
|
|
14
|
+
dataRoot: string;
|
|
15
|
+
/** 练习台端口;0 表示由宿主分配一个空闲端口。 */
|
|
16
|
+
practiceDeskPort: number;
|
|
17
|
+
/** 板块一的白名单:只碰这些群,其他群一律不读。 */
|
|
18
|
+
collectGroups: {
|
|
19
|
+
qq: string[];
|
|
20
|
+
wecom: string[];
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/** Loader 校验的配置 schema。 */
|
|
24
|
+
declare const Config: z<Config>;
|
|
25
|
+
/**
|
|
26
|
+
* 注册全部能力。
|
|
27
|
+
* @param ctx - 注册上下文。
|
|
28
|
+
* @param config - 已校验的部署配置。
|
|
29
|
+
*/
|
|
30
|
+
declare function apply(ctx: Context, config: Config): void;
|
|
31
|
+
export { Config, apply, inject, name };
|
package/lib/index.mjs
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import z from "@deepseek-ai/schemastery";
|
|
2
|
+
// src/index.ts
|
|
3
|
+
/** Cordis 插件名,与 package.json 的 name、cordis.patch.yml 的 entry id 一致。 */
|
|
4
|
+
const name = "dsh-learning-assistant";
|
|
5
|
+
/** 需要宿主提供的服务:工具注册表、技能注册表、文件系统接缝。 */
|
|
6
|
+
const inject = [
|
|
7
|
+
"tools",
|
|
8
|
+
"skills",
|
|
9
|
+
"fs"
|
|
10
|
+
];
|
|
11
|
+
/** Loader 校验的配置 schema。 */
|
|
12
|
+
const Config = z.object({
|
|
13
|
+
dataRoot: z.string().default("").description("数据根目录 / Data root"),
|
|
14
|
+
practiceDeskPort: z.natural().default(18800).description("练习台端口 / Practice desk port"),
|
|
15
|
+
collectGroups: z.object({
|
|
16
|
+
qq: z.array(z.string()).default([]).description("QQ 群号白名单"),
|
|
17
|
+
wecom: z.array(z.string()).default([]).description("企微群名白名单")
|
|
18
|
+
}).default({
|
|
19
|
+
qq: [],
|
|
20
|
+
wecom: []
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* 注册全部能力。
|
|
25
|
+
* @param ctx - 注册上下文。
|
|
26
|
+
* @param config - 已校验的部署配置。
|
|
27
|
+
*/
|
|
28
|
+
function apply(ctx, config) {}
|
|
29
|
+
export { Config, apply, inject, name };
|
package/package.json
CHANGED
|
@@ -1,6 +1,80 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-learning-assistant",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "DSH 学习助手插件(占位版本,功能开发中):资料整理 / 知识整理与讲解 / 学习助手数据(练习台)三分区",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "lib/index.mjs",
|
|
7
|
+
"types": "lib/index.d.mts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./lib/index.d.mts",
|
|
11
|
+
"default": "./lib/index.mjs"
|
|
12
|
+
},
|
|
13
|
+
"./client": "./lib/client.mjs",
|
|
14
|
+
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"lib",
|
|
19
|
+
"src",
|
|
20
|
+
"assets",
|
|
21
|
+
"cordis.patch.yml",
|
|
22
|
+
"docs",
|
|
23
|
+
"README.md",
|
|
24
|
+
"LICENSE"
|
|
25
|
+
],
|
|
26
|
+
"dsh": {
|
|
27
|
+
"bundle": {
|
|
28
|
+
"patch": "./cordis.patch.yml"
|
|
29
|
+
},
|
|
30
|
+
"client": {
|
|
31
|
+
"platform": "web"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"engines": {
|
|
35
|
+
"dsh": ">=0.2.2-0 <0.3.0"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsdown",
|
|
39
|
+
"prepublishOnly": "npm run check",
|
|
40
|
+
"typecheck": "tsc --noEmit",
|
|
41
|
+
"test": "vitest run --passWithNoTests",
|
|
42
|
+
"check": "npm run typecheck && npm run test && npm run build"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
46
|
+
"@deepseek-ai/dsh-fs": "^0.2.0-rc.1 || ^0.2.1-0 || ^0.2.2-0",
|
|
47
|
+
"@deepseek-ai/dsh-session": "^0.2.0-rc.1 || ^0.2.1-0 || ^0.2.2-0",
|
|
48
|
+
"@deepseek-ai/dsh-skill": "^0.2.0-rc.1 || ^0.2.1-0 || ^0.2.2-0",
|
|
49
|
+
"@deepseek-ai/dsh-tools": "^0.2.0-rc.1 || ^0.2.1-0 || ^0.2.2-0",
|
|
50
|
+
"@deepseek-ai/schemastery": "^3.18.1",
|
|
51
|
+
"react": "^18.2.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
55
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.2.2-rc.1",
|
|
56
|
+
"@deepseek-ai/dsh-fs": "0.2.2-rc.1",
|
|
57
|
+
"@deepseek-ai/dsh-session": "0.2.2-rc.1",
|
|
58
|
+
"@deepseek-ai/dsh-skill": "0.2.2-rc.1",
|
|
59
|
+
"@deepseek-ai/dsh-tools": "0.2.2-rc.1",
|
|
60
|
+
"@deepseek-ai/schemastery": "^3.18.4",
|
|
61
|
+
"@types/node": "^22.0.0",
|
|
62
|
+
"@types/react": "~18.3.1",
|
|
63
|
+
"@types/react-dom": "~18.3.1",
|
|
64
|
+
"react": "^18.2.0",
|
|
65
|
+
"react-dom": "^18.2.0",
|
|
66
|
+
"tsdown": "^0.22.2",
|
|
67
|
+
"typescript": "^5.9.3",
|
|
68
|
+
"vitest": "^4.1.1"
|
|
69
|
+
},
|
|
70
|
+
"license": "MIT",
|
|
71
|
+
"private": false,
|
|
72
|
+
"repository": {
|
|
73
|
+
"type": "git",
|
|
74
|
+
"url": "git+https://github.com/shinkontokitoki/dsh-learning-assistant.git"
|
|
75
|
+
},
|
|
76
|
+
"homepage": "https://github.com/shinkontokitoki/dsh-learning-assistant#readme",
|
|
77
|
+
"bugs": {
|
|
78
|
+
"url": "https://github.com/shinkontokitoki/dsh-learning-assistant/issues"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-learning-assistant,浏览器半(web)。
|
|
3
|
+
*
|
|
4
|
+
* 只做两件事(本文件目前只有第一件):
|
|
5
|
+
* 1. 在宿主设置对话框里挂一个「学习助手」分区(settings.section)
|
|
6
|
+
* 2. 打开练习台侧栏(ctx.sidebarRight.openTab('browser', { url }))
|
|
7
|
+
*
|
|
8
|
+
* 依赖宿主 slot 声明;宿主没声明该 slot 时注册不会执行,插件照常加载。
|
|
9
|
+
*
|
|
10
|
+
* @module dsh-learning-assistant/client
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import type { Context as ClientContext } from '@deepseek-ai/cordis'
|
|
14
|
+
// 仅类型:把宿主渲染器声明的 `ctx.slots` 合并进 Context(不产生运行时代码)。
|
|
15
|
+
import type {} from '@deepseek-ai/dsh-client-ui-renderer/client'
|
|
16
|
+
import { registerSettingsSection } from './settings.tsx'
|
|
17
|
+
|
|
18
|
+
export const name = 'dsh-learning-assistant'
|
|
19
|
+
|
|
20
|
+
/** 只要 slot 注册表;其余能力(locale、configForms)在页面里按需查找。 */
|
|
21
|
+
export const inject = ['slots']
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 注册设置页分区。
|
|
25
|
+
* @param ctx - 客户端根上下文。
|
|
26
|
+
*/
|
|
27
|
+
export function apply(ctx: ClientContext): void {
|
|
28
|
+
registerSettingsSection(ctx)
|
|
29
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 设置 → 学习助手:三分区页面(资料整理 / 知识整理与讲解 / 学习助手数据)。
|
|
3
|
+
*
|
|
4
|
+
* 注册方式照抄 dsh-visualize 的 settings.section 用法:宿主在设置对话框里
|
|
5
|
+
* 声明 `settings.section` slot,本插件 inject 之后 register 一个条目,
|
|
6
|
+
* label 用函数以便跟随界面语言。
|
|
7
|
+
*
|
|
8
|
+
* 现状:三分区都是占位面板,只验证 slot 与布局能挂上。
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { Context as ClientContext } from '@deepseek-ai/cordis'
|
|
12
|
+
import { useState } from 'react'
|
|
13
|
+
|
|
14
|
+
/** 设置对话框里的分区 id。 */
|
|
15
|
+
export const SECTION_ID = 'dsh-learning-assistant'
|
|
16
|
+
|
|
17
|
+
/** slot 注册表的最小形状(本包不依赖宿主的 slot 类型)。 */
|
|
18
|
+
interface LooseSlots {
|
|
19
|
+
inject(name: string, register: () => () => void): unknown
|
|
20
|
+
register(options: Record<string, unknown>, component: (props: never) => unknown): () => void
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** 三个板块,顺序即页面顺序。 */
|
|
24
|
+
const TABS = [
|
|
25
|
+
{ id: 'material', label: '资料整理' },
|
|
26
|
+
{ id: 'teach', label: '知识整理与讲解' },
|
|
27
|
+
{ id: 'data', label: '学习助手数据' },
|
|
28
|
+
] as const
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 三分区页面。
|
|
32
|
+
* @returns 设置页内容。
|
|
33
|
+
*/
|
|
34
|
+
export function LearningAssistantSection() {
|
|
35
|
+
const [active, setActive] = useState<string>(TABS[0].id)
|
|
36
|
+
return (
|
|
37
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
|
|
38
|
+
<nav style={{ display: 'flex', gap: 8, borderBottom: '1px solid var(--dsh-border, #e5e7eb)' }}>
|
|
39
|
+
{TABS.map(tab => (
|
|
40
|
+
<button
|
|
41
|
+
key={tab.id}
|
|
42
|
+
onClick={() => setActive(tab.id)}
|
|
43
|
+
style={{
|
|
44
|
+
padding: '6px 10px',
|
|
45
|
+
border: 'none',
|
|
46
|
+
background: 'none',
|
|
47
|
+
cursor: 'pointer',
|
|
48
|
+
fontWeight: active === tab.id ? 600 : 400,
|
|
49
|
+
borderBottom: active === tab.id ? '2px solid currentColor' : '2px solid transparent',
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
{tab.label}
|
|
53
|
+
</button>
|
|
54
|
+
))}
|
|
55
|
+
</nav>
|
|
56
|
+
{active === 'material' && (
|
|
57
|
+
<section>
|
|
58
|
+
<h3>资料整理</h3>
|
|
59
|
+
<p>QQ(NapCat)已通;企业微信走 UIA 采集;微信 4.x 待社区适配。</p>
|
|
60
|
+
<p>白名单:只采集下面配置里点名的群。</p>
|
|
61
|
+
</section>
|
|
62
|
+
)}
|
|
63
|
+
{active === 'teach' && (
|
|
64
|
+
<section>
|
|
65
|
+
<h3>知识整理与讲解</h3>
|
|
66
|
+
<p>按学科选择讲解方案(粒度、是否先出导图、例题风格),可自建方案。</p>
|
|
67
|
+
</section>
|
|
68
|
+
)}
|
|
69
|
+
{active === 'data' && (
|
|
70
|
+
<section>
|
|
71
|
+
<h3>学习助手数据</h3>
|
|
72
|
+
<p>课程计划、学习历史、作答记录;练习台在此打开。</p>
|
|
73
|
+
</section>
|
|
74
|
+
)}
|
|
75
|
+
</div>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* 注册设置页分区。
|
|
81
|
+
* @param ctx - 客户端根上下文。
|
|
82
|
+
*/
|
|
83
|
+
export function registerSettingsSection(ctx: ClientContext): void {
|
|
84
|
+
const slots = ctx.slots as unknown as LooseSlots
|
|
85
|
+
slots.inject('settings.section', () => slots.register(
|
|
86
|
+
{
|
|
87
|
+
name: 'settings.section',
|
|
88
|
+
id: SECTION_ID,
|
|
89
|
+
order: 96,
|
|
90
|
+
label: () => '学习助手',
|
|
91
|
+
},
|
|
92
|
+
LearningAssistantSection as unknown as (props: never) => unknown,
|
|
93
|
+
))
|
|
94
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-learning-assistant,宿主半(node)。
|
|
3
|
+
*
|
|
4
|
+
* 三个板块都从这里接线:
|
|
5
|
+
* 1. 资料整理 → 采集服务(QQ / NapCat、企微 UIA),落盘到 dataRoot/_收件箱
|
|
6
|
+
* 2. 知识整理 → ctx.skills.registerProvider(内嵌 course-material-digest、
|
|
7
|
+
* one-to-one-tutor 等技能),让「帮我学 xx」能被自动命中
|
|
8
|
+
* 3. 学习助手数据 → 练习台服务 + 数据根目录(题库 / 答卷 / 进度)
|
|
9
|
+
*
|
|
10
|
+
* 现状:骨架。apply() 只登记配置与占位,未实现任何行为。
|
|
11
|
+
*
|
|
12
|
+
* @module dsh-learning-assistant
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import type { Context } from '@deepseek-ai/cordis'
|
|
16
|
+
import z from '@deepseek-ai/schemastery'
|
|
17
|
+
|
|
18
|
+
/** Cordis 插件名,与 package.json 的 name、cordis.patch.yml 的 entry id 一致。 */
|
|
19
|
+
export const name = 'dsh-learning-assistant'
|
|
20
|
+
|
|
21
|
+
/** 需要宿主提供的服务:工具注册表、技能注册表、文件系统接缝。 */
|
|
22
|
+
export const inject = ['tools', 'skills', 'fs']
|
|
23
|
+
|
|
24
|
+
/** 部署配置(设置页表单由 schemastery 自动生成)。 */
|
|
25
|
+
export interface Config {
|
|
26
|
+
/**
|
|
27
|
+
* 数据根目录:题库、答卷、笔迹、收件箱、学习进度都落在这里。
|
|
28
|
+
* 开源用户不该被绑死在某个工作区,所以默认空字符串 = 由插件决定
|
|
29
|
+
* (<profile>/data/dsh-learning-assistant),也可指向任意工作区。
|
|
30
|
+
*/
|
|
31
|
+
dataRoot: string
|
|
32
|
+
/** 练习台端口;0 表示由宿主分配一个空闲端口。 */
|
|
33
|
+
practiceDeskPort: number
|
|
34
|
+
/** 板块一的白名单:只碰这些群,其他群一律不读。 */
|
|
35
|
+
collectGroups: {
|
|
36
|
+
qq: string[]
|
|
37
|
+
wecom: string[]
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Loader 校验的配置 schema。 */
|
|
42
|
+
export const Config: z<Config> = z.object({
|
|
43
|
+
dataRoot: z.string().default('').description('数据根目录 / Data root'),
|
|
44
|
+
practiceDeskPort: z.natural().default(18800).description('练习台端口 / Practice desk port'),
|
|
45
|
+
collectGroups: z
|
|
46
|
+
.object({
|
|
47
|
+
qq: z.array(z.string()).default([]).description('QQ 群号白名单'),
|
|
48
|
+
wecom: z.array(z.string()).default([]).description('企微群名白名单'),
|
|
49
|
+
})
|
|
50
|
+
.default({ qq: [], wecom: [] }),
|
|
51
|
+
}) as unknown as z<Config>
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* 注册全部能力。
|
|
55
|
+
* @param ctx - 注册上下文。
|
|
56
|
+
* @param config - 已校验的部署配置。
|
|
57
|
+
*/
|
|
58
|
+
export function apply(ctx: Context, config: Config): void {
|
|
59
|
+
// TODO(板块3) practiceDesk(ctx, config):按需起服务、挂 /api 路由、提供侧栏 URL
|
|
60
|
+
// TODO(板块2) registerSkills(ctx, config):ctx.skills.registerProvider(...)
|
|
61
|
+
// TODO(板块1) collect(ctx, config):NapCat HTTP + 企微 UIA 子进程
|
|
62
|
+
void ctx
|
|
63
|
+
void config
|
|
64
|
+
}
|