@zifeng1023/dsh-bot 0.0.0-stage → 0.3.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.
- package/LICENSE +21 -0
- package/README.md +108 -2
- package/assets/icon-180.png +0 -0
- package/cordis.patch.yml +37 -0
- package/dsh-plugin.json +126 -0
- package/icon.png +0 -0
- package/lib/client.js +4150 -0
- package/lib/index.js +7343 -0
- package/locale/en.json +15 -0
- package/locale/zh.json +15 -0
- package/package.json +87 -4
- package/screenshots.json +3 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 dsh-bot 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,109 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-bot — DSH 里的常驻 AI 队友
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> 一句需求交给 Bot 长期值守;每次动作先演习、可批准、可整单回滚。
|
|
4
|
+
|
|
5
|
+
一个运行在 [DeepSeek Harness](https://deepseek-harness.github.io/) 里的插件。
|
|
6
|
+
|
|
7
|
+
## 它是干什么的
|
|
8
|
+
|
|
9
|
+
**用一句自然语言,把重复性的守护工作交给一个有记忆、有预算、可回滚的 AI 队友。**
|
|
10
|
+
|
|
11
|
+
你只需要说:
|
|
12
|
+
|
|
13
|
+
> 「每过 4 小时报告一次我的服务运行状态」
|
|
14
|
+
> 「每天早上 9 点汇总一下 Git 提交」
|
|
15
|
+
> 「持续盯着这个目录,有新文件就整理归档」
|
|
16
|
+
|
|
17
|
+
Bot 会接手这件事:按时自动执行、记住每次的结果、把报告发给你——而你对它有三重控制权(见下)。
|
|
18
|
+
|
|
19
|
+
## 三分钟上手
|
|
20
|
+
|
|
21
|
+
1. **安装插件**(见下文「安装」),重启 DeepSeek Harness
|
|
22
|
+
2. **在聊天框说需求**:包含「每过 N 小时 / 每天 / 持续盯着」这类节奏词,Bot 面板会出现「新接手」角标
|
|
23
|
+
3. **确认接手**:Bot 会先复述它理解的目标与节奏,你确认后它先跑一次**演习**(dry-run,无真实副作用)
|
|
24
|
+
4. **放行真实执行**:演习没问题,说「真实执行吧」——之后到点自动运行
|
|
25
|
+
5. **看结果**:
|
|
26
|
+
- 运行完成后收到**系统通知**(可在设置里改为「仅异常时打扰」+ 免打扰时段)
|
|
27
|
+
- 打开 **DSH 设置 → Bot → 最近运行**,每一轮的状态、token、费用、渠道(免费/付费)一目了然,点开看完整详情
|
|
28
|
+
- 运行报告全文在 `~/.dsh/bot/runs/` 按月归档
|
|
29
|
+
|
|
30
|
+
## 为什么值得信任:三根支柱
|
|
31
|
+
|
|
32
|
+
### 🧠 记得住
|
|
33
|
+
具名身份、独立工作区、跨会话记忆。它知道自己上次做到哪、你偏好什么格式、目标推进到第几轮——而不是每次醒来都是陌生人。
|
|
34
|
+
|
|
35
|
+
### 🎯 守得住
|
|
36
|
+
目标驱动(一次性任务 / 常驻守护),节奏到点自动跑。Bot 只能报告进展或标记卡住,**「做完了」永远由你拍板**——它不能自己宣布胜利。
|
|
37
|
+
|
|
38
|
+
### 🔄 收得回
|
|
39
|
+
这是与其他常驻 Agent 最大的差异:
|
|
40
|
+
|
|
41
|
+
| 风险 | Grok Bot / Dots | **dsh-bot** |
|
|
42
|
+
|---|---|---|
|
|
43
|
+
| 演习会真实执行("演习发邮件" = 真发了) | 是 | **默认 dry-run,工具分发前拦截** |
|
|
44
|
+
| 停止 ≠ 撤销已完成的操作 | Dots 官方承认 | **执行前后双快照,一键整单回滚** |
|
|
45
|
+
| 成本失控 | 无上限 / 额度制黑箱 | **人民币预算熔断(运行中增量熔断)+ 花费逐轮透明** |
|
|
46
|
+
| 审计只有最近 20 条 | 是 | **全量保留,每次工具调用一条记录** |
|
|
47
|
+
|
|
48
|
+
一句话:**大厂卖「AI 同事住进云电脑」,这里卖「这位同事干活前后你有一键后悔药」。**
|
|
49
|
+
|
|
50
|
+
## 功能一览
|
|
51
|
+
|
|
52
|
+
- **24 个工具**:Bot 管理 / 目标 / 记忆 / 执行 / 流程(Routine)/ 快照回滚 / 调度 / 通用联网抓取(`http_get`,防 SSRF + `pick` 路径提取),清单见 [docs/TOOLS.md](./docs/TOOLS.md)
|
|
53
|
+
- **运行记录 UI**:设置页内固定高度滚动 / 分页器两种形态可切换,逐轮费用透明(免费渠道、付费渠道、无价目渠道三种标记分明)
|
|
54
|
+
- **系统通知**:运行完成/失败桌面提醒,仅异常打扰模式 + 免打扰时段
|
|
55
|
+
- **模型兜底**:环境变更导致绑定的模型不可用时自动切换到可运行渠道,并在运行记录中如实标注
|
|
56
|
+
- **成本三态展示**:`¥0` 有两种含义(真免费 vs 算不出来),UI 上长得不一样
|
|
57
|
+
|
|
58
|
+
## 安装
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# 从插件市场(推荐):DSH 设置 → 插件市场 搜索 dsh-bot
|
|
62
|
+
# 从 npm
|
|
63
|
+
dsh plugin add dsh-bot
|
|
64
|
+
# 本地开发
|
|
65
|
+
dsh plugin add link:D:/path/to/dsh-bot
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## 开发
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npm run verify:all # typecheck + 静态检查 + 单测 + 构建 + client 契约 + e2e
|
|
72
|
+
npm run test # 330 个单测
|
|
73
|
+
node dev/gen-tools-doc.mjs # 重新生成工具清单文档
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
改动必须过 `verify:all`;工具数量与 HTTP 路由数量有注册断言(删了/漏了会红)。
|
|
77
|
+
|
|
78
|
+
## 模型渠道建议
|
|
79
|
+
|
|
80
|
+
| 渠道 | 适配状态 | 说明 |
|
|
81
|
+
|---|---|---|
|
|
82
|
+
| **deepseek-official / deepseek-account** | ✅ 推荐 | 验证最充分:文本协议 + 双轮回喂 + 流稳定性都打磨过 |
|
|
83
|
+
| deepseek-web | ✅ 可用 | 免费网页渠道 |
|
|
84
|
+
| 其他渠道(our-free-model / zcode / qoder / trae…) | ⚠️ 逐步优化 | 可能出现空回复或流中断;每个版本公告会注明本版优化了哪个渠道 |
|
|
85
|
+
|
|
86
|
+
> **遇到「模型返回了空内容」?** 九成是渠道兼容性问题——先换 DeepSeek 系渠道试试。
|
|
87
|
+
> 渠道兼容性矩阵(含逐渠道验证结果)见 [docs/ROADMAP-v0.3.md](./docs/ROADMAP-v0.3.md) v0.5.0 节。
|
|
88
|
+
|
|
89
|
+
## 诚实限制清单
|
|
90
|
+
|
|
91
|
+
- **演习本身计费**:dry-run 拦截的是工具执行,模型调用是真实的
|
|
92
|
+
- **桌面休眠**:DSH Desktop 关闭/休眠时调度器停转,错过的轮次只补最后一次(面板有心跳指示)
|
|
93
|
+
- **单实例假设**:两个 DSH 实例共用同一 `~/.dsh/bot` 会互踩
|
|
94
|
+
- **通知依赖 GUI 进程**:系统通知由 Web GUI 页面轮询驱动,浏览器页面完全关闭时不会响(宿主未向插件暴露原生通知 API)
|
|
95
|
+
- **未知成本模型**:价格表没覆盖的模型显示「无价目」而不是 ¥0——它可能真的花钱
|
|
96
|
+
- **工具能力边界**:Bot 工具来自插件注册 + 宿主暴露两层;宿主环境差异看 `~/.dsh/bot/.plugin-loaded.json` 诊断
|
|
97
|
+
|
|
98
|
+
## 文档
|
|
99
|
+
|
|
100
|
+
- [立意与竞品](./docs/POSITIONING.md) — 为什么做「可托付」这一层
|
|
101
|
+
- [技术设计](./docs/DESIGN.md)
|
|
102
|
+
- [工具清单](./docs/TOOLS.md)(自动生成)
|
|
103
|
+
- [路线图](./docs/ROADMAP-v0.3.md) — 含版本规划与真机教训
|
|
104
|
+
- [经验教训](./docs/LESSONS.md) — 从事故文档蒸馏的工程原则
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
MIT
|
|
109
|
+
|
|
Binary file
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# dsh-bot — 常驻 AI 队友
|
|
2
|
+
#
|
|
3
|
+
# 三支柱:记得住 · 守得住 · 收得回
|
|
4
|
+
#
|
|
5
|
+
# 配置说明:
|
|
6
|
+
# homeDir 数据根目录,默认 ~/.dsh/bot
|
|
7
|
+
# defaultProvider 模型提供方。⚠️ 各环境名称不同(workbuddy / deepseek-official 等),
|
|
8
|
+
# 留 'deepseek' 时会自动探测 ctx.llm.listProviders()
|
|
9
|
+
# 也可用环境变量 DSH_BOT_PROVIDER 覆盖
|
|
10
|
+
# defaultModel 默认模型,默认 deepseek-flash
|
|
11
|
+
# defaultReasoningEffort 默认推理强度 low | high | max,默认 high
|
|
12
|
+
# defaultDryRun ⭐ 默认 dry-run(安全优先),默认 true
|
|
13
|
+
# schedulerTickMs 调度器 tick 间隔,默认 30000
|
|
14
|
+
# costSensitiveScheduling ⭐ 错峰调度(避开 DeepSeek 高峰时段),默认 true
|
|
15
|
+
# defaultDailyCny 默认每日预算(人民币),默认 5
|
|
16
|
+
# defaultMonthlyCny 默认每月预算(人民币),默认 100
|
|
17
|
+
# snapshotKeepRecent ⭐ 每个 Bot 保留多少个 workspace 快照,默认 10
|
|
18
|
+
# snapshotEnabled ⭐ 真实执行前是否自动打快照,默认 true
|
|
19
|
+
#
|
|
20
|
+
# 用户可在自己 profile 的 cordis.patch.yml 中覆盖任意一行,
|
|
21
|
+
# 注意:patch 会替换整行 config,需要重述所有需要的键。
|
|
22
|
+
|
|
23
|
+
- insert:
|
|
24
|
+
- id: dsh-bot-core
|
|
25
|
+
name: dsh-bot
|
|
26
|
+
config:
|
|
27
|
+
homeDir: '~/.dsh/bot'
|
|
28
|
+
defaultProvider: deepseek
|
|
29
|
+
defaultModel: deepseek-flash
|
|
30
|
+
defaultReasoningEffort: high
|
|
31
|
+
defaultDryRun: true
|
|
32
|
+
schedulerTickMs: 30000
|
|
33
|
+
costSensitiveScheduling: true
|
|
34
|
+
defaultDailyCny: 5
|
|
35
|
+
defaultMonthlyCny: 100
|
|
36
|
+
snapshotKeepRecent: 10
|
|
37
|
+
snapshotEnabled: true
|
package/dsh-plugin.json
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/T-Auto/dsh-std/main/packages/manifest/schema/dsh-plugin-0.15.schema.json",
|
|
3
|
+
"manifestVersion": "0.15",
|
|
4
|
+
"id": "dsh-bot.core",
|
|
5
|
+
"name": "dsh-bot",
|
|
6
|
+
"version": "0.3.1",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"facets": {
|
|
9
|
+
"host": {
|
|
10
|
+
"entry": "lib/index.js",
|
|
11
|
+
"apiVersion": "v1alpha1"
|
|
12
|
+
},
|
|
13
|
+
"client": {
|
|
14
|
+
"entry": "lib/client.js",
|
|
15
|
+
"platform": "web"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"requires": {
|
|
19
|
+
"contracts": [
|
|
20
|
+
{
|
|
21
|
+
"apiVersion": "tools.dsh/v1alpha1",
|
|
22
|
+
"kind": "Tool"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"permissions": [
|
|
27
|
+
{
|
|
28
|
+
"name": "dsh-bot.fs.read",
|
|
29
|
+
"scope": "dsh-home",
|
|
30
|
+
"reason": "读取 ~/.dsh/bot 下的 Bot 配置、记忆与运行记录"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "dsh-bot.fs.write",
|
|
34
|
+
"scope": "dsh-home",
|
|
35
|
+
"reason": "写入记忆、运行记录、目标状态与 Routine 定义"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "dsh-bot.workspace.write",
|
|
39
|
+
"scope": "filesystem-write",
|
|
40
|
+
"reason": "Bot 在各自独立工作区内读写文件,路径经 startsWith 校验防穿越"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "dsh-bot.process.spawn",
|
|
44
|
+
"scope": "subprocess",
|
|
45
|
+
"reason": "调度器与 Routine 中的 shell 步骤需要启动子进程"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "dsh-bot.network",
|
|
49
|
+
"scope": "network",
|
|
50
|
+
"reason": "通过宿主 LLM 服务调用 DeepSeek 等模型 API,以及 Routine 中的网络步骤"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"contributes": {
|
|
54
|
+
"x-display": [
|
|
55
|
+
{
|
|
56
|
+
"icon": "./icon.png",
|
|
57
|
+
"title": "DSH Bot",
|
|
58
|
+
"description": "常驻 AI 队友:记得住、守得住、收得回。每 Bot 独立工作区与预算,默认 dry-run,全量审计可回滚。",
|
|
59
|
+
"locales": [
|
|
60
|
+
"locale/zh.json",
|
|
61
|
+
"locale/en.json"
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
"x-prompt-sections": [
|
|
66
|
+
{
|
|
67
|
+
"name": "dsh-bot:always-on-teammates",
|
|
68
|
+
"order": 3300,
|
|
69
|
+
"summary": "用户提出持久型需求时主动建议转交常驻 Bot。识别信号:每 N 小时/每天/定期/持续/一直/盯着/守护/监测/每当…出现时,或「以后都要/跨会话记得」类诉求。协议(建议+确认):先复述理解的【目标 + 类型(一次性/常驻守护)+ 执行节奏 + 预算预估】征求用户同意,用户确认后调用 bot_adopt 一次完成接手(建 Bot + 设带节奏的目标 + 立即演习)。边界:一次性问题(看代码/改 bug/查资料/单次问答)不要推荐 Bot,不要在用户没确认前调用 bot_adopt。Bot 的执行默认 dry-run 演习,真实执行需用户显式同意;每次动作可快照回滚、有人民币预算熔断。"
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"x-tool-namespaces": [
|
|
73
|
+
{
|
|
74
|
+
"serverName": "dsh-bot",
|
|
75
|
+
"transport": "in-process",
|
|
76
|
+
"source": "dsh-bot plugin",
|
|
77
|
+
"publicPrefix": "bot_",
|
|
78
|
+
"tools": [
|
|
79
|
+
"create",
|
|
80
|
+
"list",
|
|
81
|
+
"show",
|
|
82
|
+
"update",
|
|
83
|
+
"delete",
|
|
84
|
+
"recall",
|
|
85
|
+
"memory_add",
|
|
86
|
+
"runs",
|
|
87
|
+
"run",
|
|
88
|
+
"snapshots",
|
|
89
|
+
"rollback",
|
|
90
|
+
"snapshot",
|
|
91
|
+
"schedule",
|
|
92
|
+
"schedules",
|
|
93
|
+
"heartbeat",
|
|
94
|
+
"goal",
|
|
95
|
+
"adopt"
|
|
96
|
+
],
|
|
97
|
+
"shellPermission": "仅读写 ~/.dsh/bot 与各 Bot 工作区"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"serverName": "dsh-bot",
|
|
101
|
+
"transport": "in-process",
|
|
102
|
+
"source": "dsh-bot plugin (routine)",
|
|
103
|
+
"publicPrefix": "routine_",
|
|
104
|
+
"tools": [
|
|
105
|
+
"list",
|
|
106
|
+
"show",
|
|
107
|
+
"draft",
|
|
108
|
+
"save",
|
|
109
|
+
"delete",
|
|
110
|
+
"run"
|
|
111
|
+
],
|
|
112
|
+
"shellPermission": "随 Routine 步骤继承,受 dry-run 与预算约束"
|
|
113
|
+
}
|
|
114
|
+
],
|
|
115
|
+
"x-components": [
|
|
116
|
+
{
|
|
117
|
+
"id": "dsh-bot-core",
|
|
118
|
+
"entry": "dsh-bot",
|
|
119
|
+
"defaultEnabled": true
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
"subscriptions": []
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
|
package/icon.png
ADDED
|
Binary file
|