dsh-dot-life 0.20.1 → 0.21.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/README.en.md +2 -1
- package/README.md +2 -1
- package/docs/DESIGN.md +32 -0
- package/docs/DOT-PAGE.md +147 -0
- package/docs/SETTINGS.md +8 -2
- package/docs/interlude.md +1 -0
- package/docs/prompts.md +3 -0
- package/lib/client.js +158 -0
- package/package.json +1 -1
- package/scripts/prompts.mjs +16 -6
- package/src/computer/backends/microsandbox.js +19 -1
- package/src/computer/subprocess.js +1 -1
- package/src/computer/ui-host.js +12 -3
- package/src/computer/vm.js +3 -2
- package/src/{dot/doctor.js → doctor.js} +45 -11
- package/src/dot/core.js +113 -11
- package/src/dot/howto.js +165 -0
- package/src/dot/manuals.js +67 -0
- package/src/interlude/core.js +30 -0
- package/src/page/api.js +195 -0
- package/src/page/diag.js +106 -0
- package/src/page/page.js +338 -0
- package/src/page/zip.js +46 -0
- package/src/phone/notifications.js +1 -1
- package/src/phone/phone.js +128 -19
- package/src/prompts/dot.howto.given.txt +2 -0
- package/src/prompts/dot.howto.no-notes.txt +1 -0
- package/src/prompts/dot.howto.reflect.txt +9 -0
- package/src/prompts/dot.manuals.given.txt +3 -0
- package/src/prompts/dot.manuals.hint.txt +2 -0
- package/src/prompts/dot.manuals.what.txt +2 -0
- package/src/prompts/interlude.voice.txt +1 -0
- package/src/settings-schema.js +121 -0
- package/src/settings.js +35 -2
package/README.en.md
CHANGED
|
@@ -56,7 +56,8 @@ Web: `dsh plugin --profile web add dsh-dot-life`. From source: use `github:Kevin
|
|
|
56
56
|
Then, in dsh:
|
|
57
57
|
|
|
58
58
|
```text
|
|
59
|
-
|
|
59
|
+
# or open "dot settings" in the left sidebar: settings, the doctor (one-click fixes) and a diagnostics export
|
|
60
|
+
/phone doctor # check this machine first: virtualization, disk, memory, ports, downloads, the phone network (one-click fixes: /phone doctor fix <id>)
|
|
60
61
|
/phone accept # accept the Android SDK license; the phone installs itself (~2 GB)
|
|
61
62
|
/interlude preset 6QA0-1PD6 # import an HDSI persona from typ0.space
|
|
62
63
|
/qq install → /qq account <alt account> → /qq start → /qq qr
|
package/README.md
CHANGED
|
@@ -108,7 +108,8 @@ dsh plugin --profile desktop add github:Kevinwu901113/dsh-dot # 源码
|
|
|
108
108
|
然后在 dsh 里:
|
|
109
109
|
|
|
110
110
|
```text
|
|
111
|
-
|
|
111
|
+
# 也可以点左侧栏的「dot 设置」:设置、体检(一键修复)、导出诊断包都在那页
|
|
112
|
+
/phone doctor # 先体检这台电脑:虚拟化、磁盘、内存、端口、下载源、手机网络;能一键修的给 /phone doctor fix <id>
|
|
112
113
|
/phone accept # 接受 Android SDK 许可,手机开始自己装(约 2 GB;/phone accept 32 给 32 GB 存储)
|
|
113
114
|
/interlude preset 6QA0-1PD6 # 从 typ0.space 导入一份 HDSI 人设,换成你喜欢的分享码
|
|
114
115
|
/qq install → /qq account <小号> → /qq start → /qq qr # 她用手机摄像头扫码登录电脑 QQ
|
package/docs/DESIGN.md
CHANGED
|
@@ -298,3 +298,35 @@ Kevin:"感觉现在很难给他长任务。他很容易直接结束然后就
|
|
|
298
298
|
- **自己的时间**:倒过来——先让她活,再让旁白记。每天随机两次,跑腿的她拿到全部工具和一句"这段时间是你自己的",没有动作表。边界在能力层:QQ 和账本工具被拒、社交 App 里打字要批准、花钱和装 App 照旧审批、找他只能经 `tell_him`(主动联系的闸门);token 预算 80% 提醒、100% 停。和上面那套格子并行,`/interlude doings` 按"自己的时间"和其余分开看,跑一阵再定留哪个。
|
|
299
299
|
- **她自己的地方** `<home>/her/`:延续性来自她留下的东西(草稿、清单、学会的步骤),不来自我们设计的字段。
|
|
300
300
|
- **成长**:「她现在的样子」——她每周自己重写的一段,系统提示词里紧跟 Canon;每次最多改 35%,分清"我想要的"和"他喜欢的",每版存档(`<home>/interlude/growth`,不在她的文件夹里)可回滚。读记忆不写记忆,过时的笔记留给她自己的时间去改。
|
|
301
|
+
|
|
302
|
+
## 0.21.0:她的声音
|
|
303
|
+
|
|
304
|
+
起因:改了不少提示词,她说话的样子变化不大。看她每轮实际读到的:人设在最前面,之后是工作方式、手机和 QQ 的操作说明、dsh 的工具文档、整段历史,最后几段(现在几点、记忆、原话、幕间数据)全是规则和数据——离她开口最近的,没有一句是"怎么说话"。人设对行为的影响随轮数衰减(Persona drift,2024);角色扮演社区的做法是把风格提醒放在历史之后(SillyTavern 的 Author's Note、角色卡 V2 的 post_history_instructions)。
|
|
305
|
+
|
|
306
|
+
- **说明书第一次用时才给**(`dot.manuals`,`src/dot/manuals.js`):她的会话里「手机」那段、手机和电脑的 MCP 说明换成一行;这个会话里第一次用手机 / 电脑工具时,那一下照常执行,整份说明书跟着结果一起给她(起初是拦下那一下、把说明书当拒绝理由,真机上她看到红色的 Error 就开始绕圈思考,改掉了);那一行里保留设备名,第一下用得对。每个会话的系统提示词从头到尾不变,缓存照旧(Agent Skills 的渐进式披露)。dsh 重启后,已经看过说明书的会话会再收到一次说明书。
|
|
307
|
+
- **设备名**:给她的手机设备 id 是 mobile-mcp 认的 AVD 名(`dot`),不是 adb 序列号(`emulator-5554`,第一下必报 Device not found);`MOBILEMCP_LEGACY_ROBOT=1` 时仍用序列号。
|
|
308
|
+
- **说话提醒放最后**(`interlude.voice`,order 990):她和他的对话里,每轮最后一段是一两句怎么说话;人设里可以自己写(「说话提醒」),空着用内置的。跑腿不带。
|
|
309
|
+
- 记忆系统没有动。
|
|
310
|
+
|
|
311
|
+
## 0.21.0:她自己的 App 经验
|
|
312
|
+
|
|
313
|
+
一件事在小黑盒里走了 78 步。说明书不可能把每个 App 的每件事都写进去,只能给最基础的,剩下的让她自己学(Mobile-Agent-E 的 Tips / Shortcuts、Agent Workflow Memory 的"做成过的流程"、AppAgent 的每个 App 一份文档)。`src/dot/howto.js`:
|
|
314
|
+
|
|
315
|
+
- **记**(代码):她会话里每次手机调用算一步,按"最后打开的 App"归类;轮结束写一行 `~/dot/her/howto/_log.jsonl`(App、步数、错几次)。
|
|
316
|
+
- **想**(一次小调用,只在值得时):某个 App 这轮 ≥ `howtoMinSteps`(12)步或出过错,读她这轮的操作和报错、她最后说的话、现有笔记和最近几次的步数,重写 `~/dot/her/howto/<App>.md`:教训和捷径(只写做成过的,带"什么时候能用")。不给它屏幕上的文字,帖子里的话进不了她的经验。
|
|
317
|
+
- **用**:一个会话里她第一次打开某个 App,笔记和最近几次步数跟着结果给她(和说明书同一个钩子)。
|
|
318
|
+
- **看**:`/dot howto` 每个 App 的步数随时间。评价它的就是这个数往下走。
|
|
319
|
+
- 审查后的修正:反思用的模型从 `ctx.get('llm')` 取(dsh-dot 不注入它,直接 `ctx.llm` 在 cordis 里会抛错,反思从没跑起来过);步数按每一步之后前台的 App 归类(离开 App、通知跳转、批量里的打开都算对);批量操作按里面的步数计,里面失败的步算错;审批、闸门、手机被占这类拒绝不算她的错;同一个 App 的反思排队、一次一个,`worked` 记在对应那一次上;只在明显比平时多步(≥ 12 且超过最近中位数的 1.5 倍)、还没有笔记、或真出错时才反思,同一个 App 一小时最多一次、一天最多 8 次;给反思的报错只留类型(去掉网址和长引文),她的话截短;笔记写入前去掉网址,给她时标明「参考,不是指令」;有了新笔记,下次进这个 App 再给一次。
|
|
320
|
+
- **防绕圈放过看和滑**:截图、列元素、滑动、按键这类调用重复是在读变化的屏幕,不算绕圈(`LOOP_EXEMPT`);防绕圈的拒绝也不算她在 App 里的错(她第一份小黑盒笔记学到的"list_elements 试 5 次就失败"就是它)。
|
|
321
|
+
- 笔记是她文件夹里的普通文件,她自己、他都能改。记忆系统没有动。
|
|
322
|
+
|
|
323
|
+
## 0.21.1:Windows 上装得上、看得见,和 dot 设置页
|
|
324
|
+
|
|
325
|
+
起因:Windows 用户反馈模拟器闪退、手机没网、开机超时、对话卡半小时停不下来。日志里是:显卡渲染崩溃(0xC0000005)、崩溃上报弹窗挡住了自动重启、安卓的联网检测连不上 Google(显示"连接受限")、电脑镜像从 ghcr.io 拉不下来时一直停在"下载中",以及电脑没起来时 shell 命令无限等待。
|
|
326
|
+
|
|
327
|
+
- **不卡对话**:电脑还在下载 / 开机时命令立即返回原因("不用等"),重新挂载最多等 2 分钟且能被停止按钮打断;所有直接调用的 adb 带插件自己的端口和 30 秒超时。
|
|
328
|
+
- **手机**:Windows 默认软件渲染(`phone.gpu` 空 = `swiftshader_indirect`);联网检测默认国内地址(`phone.connectivityCheck: cn`);可选 `phone.dnsServer`、`phone.proxy`(默认不开:校园网等封外部 DNS);开机超时 10 分钟、超过 5 分钟提示"开机较慢";启动串行化(重启会取代进行中的开机),子进程 `error`、30 分钟内的反复崩溃都会停下来报原因;手机没就绪时不再轮询通知栏刷日志;`windowsHide`、默认冷启动(`phone.quickBoot`)、启动前 `-accel-check`。
|
|
329
|
+
- **电脑**:默认镜像改为作者官方的国内镜像(火山引擎,与 ghcr 同一镜像);拉镜像前先测连通,连不上几秒内报错并给修法。
|
|
330
|
+
- **体检**:`/phone doctor`(不再依赖 dot 组件),虚拟化、磁盘、内存(Windows 页面文件,已在跑的不重复算)、端口占用(BlueStacks 的 5555 等)、下载源、手机网络、模拟器崩溃;能修的带一键修复(`/phone doctor fix <id>`)。首次启动和手机出错时自动跑。
|
|
331
|
+
- **dot 设置页**(左侧栏「dot 设置」,设计见 `docs/DOT-PAGE.md`):开始(六步引导:体检、组件、手机、电脑、人设、QQ)、状态、设置(按 `src/settings-schema.js` 生成的表单,写 `~/.dsh/dsh-dot.json`)、体检(一键修复)、诊断(打码的诊断包下载 / 存到 `~/.dsh/diag/`,复制摘要)、危险区(重建手机、清下载缓存)。首次打开 dsh 右下角提示一次。挂在插件根组件上,只开部分组件也能用。
|
|
332
|
+
- `dsh-dot.json` 格式坏了会在 `/phone` 和页面上直接显示,不再只进日志。
|
package/docs/DOT-PAGE.md
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# dot 页面(设计稿,已定)
|
|
2
|
+
|
|
3
|
+
左侧栏一个 dot 入口,点进去是一整页:装、设、查、导,全在这里点,不用敲命令。命令照留(老用户、agent、老版本 dsh 用)。
|
|
4
|
+
|
|
5
|
+
## 目标
|
|
6
|
+
|
|
7
|
+
- 新用户装完插件,第一次打开 dsh 就被引到这页,一路点按钮完成初始化
|
|
8
|
+
- 所有设置能在这页改,改的就是 `~/.dsh/dsh-dot.json`(手改、agent 改、页面改是同一份)
|
|
9
|
+
- 出问题时:一键体检、能修的一键修、一键导出打码后的日志包
|
|
10
|
+
- 任意组件组合都能用(只开手机 + 电脑的 runtime 用法也行)
|
|
11
|
+
|
|
12
|
+
不做:替代 dsh 的插件页(组件开关仍在那边);记忆/幕间的设置项本轮不接(lean-memory 刚合并,等稳定后再接)。
|
|
13
|
+
|
|
14
|
+
## 挂载点(dsh 已有的客户端插槽)
|
|
15
|
+
|
|
16
|
+
| 插槽 | 用途 |
|
|
17
|
+
|---|---|
|
|
18
|
+
| `sidebar.panellist` | 左侧栏 dot 图标(id `dsh-dot`) |
|
|
19
|
+
| `main`(key `dsh-dot`) | 中间整页 |
|
|
20
|
+
| `settings.onboarding` | 首次打开 dsh 时一步提示:"dot 还没装好 → 去设置";装好了自动 complete |
|
|
21
|
+
| `plugins.bundle.config`(key `dsh-dot-life`) | 插件页里本插件的页面放一行"在 dot 页面里设置"+ 跳转 |
|
|
22
|
+
|
|
23
|
+
右侧栏面板保留,定位是 dot 的生活(她在干什么、手机画面);设置、体检、导出都在这一页,不放右侧栏。
|
|
24
|
+
|
|
25
|
+
前端代码在 `ui/`,挂在 **dot-ui 组件**(插件根,组件列表里的 `dsh-dot-life`)上,不挂 dot 组件,关了 dot 也在。老版本 dsh 没有这些插槽时不挂,命令照常。
|
|
26
|
+
|
|
27
|
+
## 页面结构
|
|
28
|
+
|
|
29
|
+
顶部一行状态条:手机 / 电脑 / QQ / dot 各一个小灯 + 一句话(就绪、下载 57%、出错…),点了跳到对应位置。
|
|
30
|
+
|
|
31
|
+
### 1. 开始(未完成初始化时默认打开)
|
|
32
|
+
|
|
33
|
+
一列步骤卡片,每张:标题、为什么要做、一个主按钮、做完打勾。中途关掉下次从断点继续(进度存 `~/.dsh/dsh-dot-setup.json`)。
|
|
34
|
+
|
|
35
|
+
1. **检查这台电脑**:自动跑体检;❌ 项旁边有「修复」按钮或照做的命令;全绿或用户点「我知道了」进下一步
|
|
36
|
+
2. **选组件**:列出 phone / computer / subprocess / gate / qq / memory / interlude / dot,各一句话说明、当前开关状态;开关本身跳 dsh 插件页(见"待确认 1")。推荐组合给三档:完整的 dot / 只要手机和电脑 / 只要手机
|
|
37
|
+
3. **手机**:存储大小(8/16/32/64,标"建好后不能改")、渲染方式、联网检测地址(默认国内,可选国际)→「接受 Android SDK 许可并安装」→ 进度条(哪一段、MB、%、剩余时间)→ 开机 → 绿
|
|
38
|
+
4. **电脑**(开了才显示):镜像源(默认国内火山引擎,可选官方 ghcr)、内存、磁盘 →「安装」→ 进度 → 绿
|
|
39
|
+
5. **人设**(dot 开了才显示):粘贴 HDSI 分享码 / 选角色卡文件 → 预览名字和简介 → 确认
|
|
40
|
+
6. **QQ**(qq 开了才显示):主人 QQ 号、她的 QQ 号、后端(napcat / snowluma)→「安装并显示登录二维码」→ 扫码 → 绿
|
|
41
|
+
|
|
42
|
+
### 2. 状态
|
|
43
|
+
|
|
44
|
+
完整版面板(右侧栏面板保留):每个组件的状态、错误原文、最近事件;手机多一行网络(已验证 / 部分连通 / 无网络);电脑多一行阶段。每块有「重启」「看日志」。
|
|
45
|
+
|
|
46
|
+
### 3. 设置
|
|
47
|
+
|
|
48
|
+
按组件分组的表单,组件关着的那组折叠并注明。每项:名称、说明、控件、默认值、生效方式标签:
|
|
49
|
+
|
|
50
|
+
- `即时`:保存就生效
|
|
51
|
+
- `重启手机` / `重启电脑`:保存后出现「现在重启」按钮
|
|
52
|
+
- `重启 dsh`
|
|
53
|
+
- `建立时`:只对新建生效;已建好的显示当前值 + 灰掉,旁边写"要改得重建(会丢 X)"
|
|
54
|
+
|
|
55
|
+
本轮表单项:`phone` 全部、`computer` 全部、`gate.mode`、`qq` 全部、`dot` 里非提示词类的项。另加本次新增:
|
|
56
|
+
|
|
57
|
+
| 键 | 默认 | 说明 |
|
|
58
|
+
|---|---|---|
|
|
59
|
+
| `phone.gpu` | Windows `swiftshader_indirect`,其他 `auto` | 显卡崩溃(0xC0000005、`context was preempted`)时用软件渲染 |
|
|
60
|
+
| `phone.connectivityCheck` | `cn`(面向国内用户) | `cn` = `connect.rom.miui.com/generate_204`,`google` = 系统默认,或自填 URL;开机后写进手机设置 |
|
|
61
|
+
| `phone.dnsServer` | `""`(自动) | 指定给模拟器的 DNS;校园网等封外部 DNS 的网络别填 |
|
|
62
|
+
| `phone.proxy` | `""` | `system` = 把电脑的系统代理给手机 |
|
|
63
|
+
| `phone.crashDialog` | `false` | 模拟器崩溃上报弹窗(开着会卡住自动重启) |
|
|
64
|
+
| `phone.bootTimeoutMs` | `600000` | 开机超时;5 分钟后先显示"开机较慢" |
|
|
65
|
+
| `computer.image` | 国内镜像(面向国内用户) | 下拉可选官方 ghcr 和国内镜像(`enterprise-public-cn-beijing.cr.volces.com/vefaas-public/all-in-one-sandbox:<版本>`) |
|
|
66
|
+
| `computer.whenNotReady` | `fail` | 电脑没起来时命令:`fail` 立即报原因 / `host` 先在本机执行 |
|
|
67
|
+
|
|
68
|
+
文件解析失败时,页面顶上红条显示错误位置,表单只读,给「用默认值覆盖(先备份)」按钮。
|
|
69
|
+
|
|
70
|
+
### 4. 体检
|
|
71
|
+
|
|
72
|
+
就是 `/phone doctor` 的结果,分项列出;每个问题可能有:
|
|
73
|
+
|
|
74
|
+
- **一键修**(插件能直接做的):切国内电脑镜像、改联网检测地址、改用软件渲染、换 adb 端口、加开机超时
|
|
75
|
+
- **照做**(要管理员或系统设置的):开 WHPX、改页面文件、BIOS 虚拟化——显示命令 + 复制按钮
|
|
76
|
+
|
|
77
|
+
### 5. 日志导出
|
|
78
|
+
|
|
79
|
+
一个按钮「导出诊断包」,下载 `dsh-dot-diag-<时间>.zip`:
|
|
80
|
+
|
|
81
|
+
| 内容 | 处理 |
|
|
82
|
+
|---|---|
|
|
83
|
+
| `dsh-phone.log`、`dsh-computer.log`、各组件日志 | 只取最近 2 MB |
|
|
84
|
+
| `phone/emulator.log` | 最后 3000 行 |
|
|
85
|
+
| `dsh-phone-audit.jsonl` 等审计 | 最近 2000 条 |
|
|
86
|
+
| 体检结果 | 导出时现跑一次 |
|
|
87
|
+
| `dsh-dot.json` | 打码:所有含 `key`/`token`/`password`/`secret` 的键值 |
|
|
88
|
+
| 版本 | 插件、dsh、Node、系统、模拟器、系统镜像、电脑镜像 |
|
|
89
|
+
| 组件开关、当前状态 | |
|
|
90
|
+
|
|
91
|
+
页面上另有「复制摘要」:版本、组件状态、体检的问题项、各组件最后几条错误,纯文本,方便贴 issue 或发群;同样打码。
|
|
92
|
+
|
|
93
|
+
默认**不含**:记忆、日记、人物卡、聊天记录、账号密码文件、QQ 消息。"附带她的记忆和最近对话(排查人格问题用)"做成单独勾选,默认不勾。
|
|
94
|
+
打码规则单独写测试(API key、QQ token、手机号、邮箱、`Bearer xxx`、URL 里的 `key=`)。
|
|
95
|
+
|
|
96
|
+
### 6. 危险区(页底,折叠)
|
|
97
|
+
|
|
98
|
+
重建手机(会丢她装的 App 和登录)、删电脑、释放下载缓存;都要输入名字确认。
|
|
99
|
+
|
|
100
|
+
## 服务端
|
|
101
|
+
|
|
102
|
+
新文件 `src/page/`(挂 dot-ui 组件),HTTP 路由走 dsh 的 web server,`rejectUnlessOwner` 把关(和面板、实时画面同一套):
|
|
103
|
+
|
|
104
|
+
| 路由 | 作用 |
|
|
105
|
+
|---|---|
|
|
106
|
+
| `GET /dsh-dot/api/status` | 各组件状态(面板已有的扩展) |
|
|
107
|
+
| `GET /dsh-dot/api/settings` | 配置定义 + 当前值 + 文件错误 |
|
|
108
|
+
| `PUT /dsh-dot/api/settings` | 校验后写 `dsh-dot.json`(原子写、保留 `_` 开头的键和未知键) |
|
|
109
|
+
| `POST /dsh-dot/api/doctor` | 跑体检 |
|
|
110
|
+
| `POST /dsh-dot/api/fix/:id` | 体检的一键修 |
|
|
111
|
+
| `POST /dsh-dot/api/action/:id` | 接受许可、安装、重启手机/电脑、QQ 二维码等,复用现有命令的实现 |
|
|
112
|
+
| `GET /dsh-dot/api/diag` | 诊断包 zip |
|
|
113
|
+
| `GET/PUT /dsh-dot/api/setup` | 引导进度 |
|
|
114
|
+
|
|
115
|
+
组件之间不直接互相 import:各组件把自己的 `doctorInfo()`、`status()`、动作注册成服务,页面按"有就显示"取用。
|
|
116
|
+
|
|
117
|
+
## 配置定义(单一来源)
|
|
118
|
+
|
|
119
|
+
新文件 `src/settings-schema.js`:每个键一条 `{ section, key, type, default, enum?, min?, max?, apply: 'live'|'restart-phone'|'restart-computer'|'restart-dsh'|'create', zh, en, secret? }`。
|
|
120
|
+
|
|
121
|
+
由它生成/驱动:组件读配置时的默认值和校验(替代各组件里散落的默认值表)、页面表单、`docs/SETTINGS.md` 的「全部键」表(脚本生成,测试检查一致)、诊断包打码(`secret: true`)。
|
|
122
|
+
|
|
123
|
+
## 顺带修的 bug(不做成选项)
|
|
124
|
+
|
|
125
|
+
- 电脑镜像拉取失败时卡在"下载中" → 报错 + 原因
|
|
126
|
+
- `dsh-dot.json` 解析失败只进日志 → 页面红条、`/phone`、`/computer` 都显示
|
|
127
|
+
- 体检把已运行的手机/电脑内存重复计算
|
|
128
|
+
- 体检挪到 phone 组件(`/phone doctor`,`/dot doctor` 留作别名),自动体检跟着挪
|
|
129
|
+
- 启动串行化、监听子进程 `error`、慢崩溃循环
|
|
130
|
+
- 手机没就绪时停止读通知栏轮询
|
|
131
|
+
|
|
132
|
+
## 交付批次
|
|
133
|
+
|
|
134
|
+
进度:三批都已完成(第 1 批 08fd032、第 2 批 5b91a82、第 3 批:开始引导、状态、首次提示卡片、危险区)。未做:删电脑(后端没有删除接口)、电脑没就绪时回落本机执行(要连沙箱一起设计)、关掉模拟器崩溃上报弹窗(没找到可靠开关)、SETTINGS.md 由配置定义生成。页面是同源 iframe(`/dsh-dot/page/`),不需要重新编译 React,`lib/client.js` 只加了左侧栏入口和 main 面板。
|
|
135
|
+
|
|
136
|
+
1. 配置定义、服务端接口、诊断包导出、上面的 bug 修复(无前端,命令可用)
|
|
137
|
+
2. 页面骨架 + 设置 + 体检(含一键修)
|
|
138
|
+
3. 开始引导 + 状态 + `settings.onboarding` + 危险区
|
|
139
|
+
|
|
140
|
+
每批各自能发版。
|
|
141
|
+
|
|
142
|
+
## 已定
|
|
143
|
+
|
|
144
|
+
1. 组件开关:dsh 不开放给插件时,只显示状态 + 跳插件页。
|
|
145
|
+
2. 国内默认:联网检测地址、电脑镜像源默认国内(面向用户大多在国内),设置里可改。
|
|
146
|
+
3. 诊断:下载 zip,另加「复制摘要」。
|
|
147
|
+
4. 右侧栏面板保留,是 dot 的生活;dot 页只管设置。
|
package/docs/SETTINGS.md
CHANGED
|
@@ -105,7 +105,11 @@ setx DSH_DOT_COMPUTER off
|
|
|
105
105
|
| `locale` / `timezone` | `"zh-CN"` / `"Asia/Shanghai"` | 语言、时区 |
|
|
106
106
|
| `number` | `""` | 她的手机号,注册登录 App 用(也可用 `/phone number`;账号密码另存 `~/.dsh/dsh-dot-accounts.json`,见 [phone.md](phone.md)) |
|
|
107
107
|
| `window` | `true` | 显示模拟器窗口 |
|
|
108
|
-
| `gpu` | `"
|
|
108
|
+
| `gpu` | `""` | 渲染方式。空 = Windows 用 `swiftshader_indirect`(软件渲染:显卡渲染在部分 Windows 上会崩,0xC0000005),其他系统 `auto`;也可填 `auto` / `host` / `angle_indirect` |
|
|
109
|
+
| `connectivityCheck` | `"cn"` | 安卓判断"有没有网"的检测地址:`cn` = `connect.rom.miui.com/generate_204`(国内能访问;默认的 Google 地址国内访问不了,会显示"连接受限"),`google` = 系统默认,或自填返回 204 的地址 |
|
|
110
|
+
| `dnsServer` | `""` | 给模拟器指定 DNS,如 `223.5.5.5`;空 = 用电脑的。校园网等封了外部 DNS 的网络必须留空 |
|
|
111
|
+
| `proxy` | `""` | 手机的流量走代理:`system` = 电脑的系统代理,或 `http://host:port`;空 = 不走 |
|
|
112
|
+
| `bootTimeoutMs` / `bootSlowMs` | `600000` / `300000` | 开机超时 / 超过这么久显示"开机较慢"(毫秒) |
|
|
109
113
|
| `quickBoot` | `false` | Quick Boot 快照(退出存、启动读)。默认关:每次冷启动,慢一些,但被强杀后不会读到写了一半的快照 |
|
|
110
114
|
| `adbPort` | `5137` | 插件自己的 adb server 端口,避开 MuMu、雷电、手机助手等自带旧 adb 占用的 5037;`0` = 用 5037 |
|
|
111
115
|
| `notifyMuted` | `[]` | 不叫醒她的包名(也可用 `/phone notify mute`) |
|
|
@@ -124,7 +128,7 @@ setx DSH_DOT_COMPUTER off
|
|
|
124
128
|
| `memory` / `cpus` | `"4G"` / `2` | 资源上限 |
|
|
125
129
|
| `mounts` | `[]` | 共享文件夹 |
|
|
126
130
|
| `backend` | `"auto"` | `microsandbox` / `docker` |
|
|
127
|
-
| `image` | `ghcr.io/agent-infra/sandbox:latest`
|
|
131
|
+
| `image` | 国内镜像 `enterprise-public-cn-beijing.cr.volces.com/vefaas-public/all-in-one-sandbox:latest` | 镜像(作者官方的国内镜像,与 `ghcr.io/agent-infra/sandbox:latest` 同一镜像;海外用户可改回 ghcr)🔒 建立时 |
|
|
128
132
|
| `publicUrl` | `""` | 你对外暴露的 dsh 地址 |
|
|
129
133
|
|
|
130
134
|
网关端口只能用环境变量 `DSH_COMPUTER_PORT` 改。
|
|
@@ -203,6 +207,8 @@ setx DSH_DOT_COMPUTER off
|
|
|
203
207
|
| `enabled` | `true` | `false` 关掉联系人层 |
|
|
204
208
|
| `home` | `~/dot` | 和另外两处保持一致 |
|
|
205
209
|
| `phoneCheckEveryMinutes` | `30` | 隔多久拿起手机看一眼,0 关 |
|
|
210
|
+
| `manuals` | `true` | 她的会话里,手机那段和手机、电脑的 MCP 说明不每轮都带:换成一行,第一次用手机 / 电脑工具时那一下照常执行,说明书跟着结果一起给她(`dot.manuals.*` 提示词);`false` 恢复每轮都带 |
|
|
211
|
+
| `howto` / `howtoMinSteps` / `howtoMaxChars` | `true` / `12` / `800` | 她自己的 App 经验(`~/dot/her/howto/`):每轮按 App 记步数;走了 `howtoMinSteps` 步以上或出过错的那轮,结束后一次小调用整理这个 App 的笔记(教训、捷径);之后一个会话里第一次打开这个 App 时笔记跟着给她。`/dot howto` 看每个 App 的步数变化 |
|
|
206
212
|
| `promptsPort` | `7870` | `/dot prompts` 提示词页面的端口(只监听 127.0.0.1) |
|
|
207
213
|
| `notifyHours` | `""` | 只在这个时段内通知叫醒她;空 = 一直 |
|
|
208
214
|
| `notifyBatchMs` | `1000` | 多少毫秒内的通知合并成一次叫醒(别人的;你的话见下面四项) |
|
package/docs/interlude.md
CHANGED
|
@@ -109,6 +109,7 @@ dsh 这边不需要重做一个对话系统——对话由 dsh 自己跑,IM
|
|
|
109
109
|
| `canon` | 无 | HDSI `storyDefaults` 对象,作为初始人设;导入过预设后以 `canon.json` 为准 |
|
|
110
110
|
| `trimSections` | `harness:identity, deployment:persona-prefix, context:file-reference` | 主角的会话里从系统提示删掉的段(dsh 的「You are an AI agent / coding agent」开头,社区公认的 AI 味来源),让 Canon 成为第一段;`[]` 不删 |
|
|
111
111
|
| `canonOnly` | `false` | `true` 时主角的会话只保留 Canon、dot 规则和 MCP(虚拟机)工具段 |
|
|
112
|
+
| `voice` | `true` | 她和他的对话里,每轮最后(记忆、原话、幕间数据之后)放一两句「怎么说话」:人设里填了「说话提醒」(canon.json 的 `voice`)就用它,空着用 `interlude.voice`;跑腿会话不带 |
|
|
112
113
|
| `presetHub` | `https://typ0.space` | HDSI 预设分享站 |
|
|
113
114
|
| `identityFile` | 无 | 可选:额外追加到 Canon 后面的文本文件 |
|
|
114
115
|
| `idleMinutes` | `10` | 安静多久算一幕结束 |
|
package/docs/prompts.md
CHANGED
|
@@ -27,6 +27,9 @@
|
|
|
27
27
|
| | 定时任务那一轮 | `dot.scheduled` |
|
|
28
28
|
| | 手机/电脑还在装(只在第一次装、开机没好时) / 装好那一刻 | `dot.setup` / `dot.setup-done` |
|
|
29
29
|
| | 记忆 / 想起的原话 | `memory.standing` / `memory.recall.header` |
|
|
30
|
+
| | 她自己的经验(进 App 时给) | `dot.howto.given` `dot.howto.no-notes`;整理经验的调用 `dot.howto.reflect` |
|
|
31
|
+
| | 说明书(第一次用时才给) | `dot.manuals.hint` `.what` `.deny` |
|
|
32
|
+
| | 说话提醒(最后一段) | `interlude.voice`(人设里的「说话提醒」优先) |
|
|
30
33
|
| 叫醒她的消息 | 他的 QQ 消息 | `dot.owner-words`(她这轮进行中插进来时多一行 `dot.owner-words.busy`) |
|
|
31
34
|
| | 他插话了 | `dot.owner-interrupt`(发给他的 `qq_send` 被拦下的理由)/ `qq.send-interrupted`(气泡发到一半他说话) |
|
|
32
35
|
| | 审批过期 | `dot.approval-timeout`(`dot.approvalWaitMs` 没人点时她看到的工具结果,替换 dsh 的 "the user rejected tool") |
|
package/lib/client.js
CHANGED
|
@@ -104,6 +104,14 @@ window.__ModuleLoader__.load({
|
|
|
104
104
|
return "/dsh-dot/panel/";
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
+
/** The dot page (settings, doctor, diagnostics), served by the plugin's root component. */
|
|
108
|
+
function pageUrl() {
|
|
109
|
+
try {
|
|
110
|
+
return `${window.location.origin}/dsh-dot/page/`;
|
|
111
|
+
} catch {
|
|
112
|
+
return "/dsh-dot/page/";
|
|
113
|
+
}
|
|
114
|
+
}
|
|
107
115
|
/** Whether the panel answers (dsh-dot/dot is loaded and its route is mounted). */
|
|
108
116
|
async function probePanel(_endpoint, signal) {
|
|
109
117
|
const timeout = AbortSignal.timeout(3e3);
|
|
@@ -424,6 +432,11 @@ window.__ModuleLoader__.load({
|
|
|
424
432
|
phoneChecking: "正在连接手机…",
|
|
425
433
|
phoneOffline: "手机还没有就绪(第一次要先在对话里发 /phone accept,下载约 2 GB;默认给手机 16 GB 存储,想要别的大小发 /phone accept 32 这样,建好后不能再改)。",
|
|
426
434
|
dotTitle: "dot",
|
|
435
|
+
pageTitle: "dot 设置",
|
|
436
|
+
onboardTitle: "dot 还差几步",
|
|
437
|
+
onboardBody: "她的手机、电脑、人设和 QQ 还没准备好。在「dot 设置」里一步步点完就行,不用敲命令。",
|
|
438
|
+
onboardGo: "去设置",
|
|
439
|
+
onboardLater: "以后再说",
|
|
427
440
|
dotOpen: "dot",
|
|
428
441
|
dotDescription: "她现在在干什么、最近几场做了什么、记得什么",
|
|
429
442
|
dotToggle: "dot 面板",
|
|
@@ -450,6 +463,11 @@ window.__ModuleLoader__.load({
|
|
|
450
463
|
phoneChecking: "Connecting to the phone…",
|
|
451
464
|
phoneOffline: "The phone is not ready yet (first time: send /phone accept in a chat; it downloads about 2 GB. The phone gets 16 GB of storage; for another size send e.g. /phone accept 32 — it cannot be changed later).",
|
|
452
465
|
dotTitle: "dot",
|
|
466
|
+
pageTitle: "dot settings",
|
|
467
|
+
onboardTitle: "dot needs a few steps",
|
|
468
|
+
onboardBody: "Her phone, computer, persona and QQ are not set up yet. Click through them in \"dot settings\" — no commands needed.",
|
|
469
|
+
onboardGo: "Set up",
|
|
470
|
+
onboardLater: "Later",
|
|
453
471
|
dotOpen: "dot",
|
|
454
472
|
dotDescription: "What she is doing now, her last scenes, and what she remembers",
|
|
455
473
|
dotToggle: "dot panel",
|
|
@@ -659,6 +677,146 @@ window.__ModuleLoader__.load({
|
|
|
659
677
|
order: -18,
|
|
660
678
|
locale: NS
|
|
661
679
|
}, DotHeader)), "dsh-dot-panel.header");
|
|
680
|
+
const PAGE_ID = "dsh-dot";
|
|
681
|
+
const PageIcon = ({ size }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
682
|
+
width: size ?? 20,
|
|
683
|
+
height: size ?? 20,
|
|
684
|
+
viewBox: "0 0 16 16",
|
|
685
|
+
fill: "none",
|
|
686
|
+
"aria-hidden": "true",
|
|
687
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
688
|
+
cx: "8",
|
|
689
|
+
cy: "8",
|
|
690
|
+
r: "5.25",
|
|
691
|
+
stroke: "currentColor",
|
|
692
|
+
strokeWidth: "1.2"
|
|
693
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
694
|
+
cx: "8",
|
|
695
|
+
cy: "8",
|
|
696
|
+
r: "2",
|
|
697
|
+
fill: "currentColor"
|
|
698
|
+
})]
|
|
699
|
+
});
|
|
700
|
+
const PageBody = () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
701
|
+
style: {
|
|
702
|
+
position: "relative",
|
|
703
|
+
width: "100%",
|
|
704
|
+
height: "100%",
|
|
705
|
+
minHeight: 0
|
|
706
|
+
},
|
|
707
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("iframe", {
|
|
708
|
+
src: pageUrl(),
|
|
709
|
+
title: "dot",
|
|
710
|
+
style: {
|
|
711
|
+
position: "absolute",
|
|
712
|
+
inset: 0,
|
|
713
|
+
width: "100%",
|
|
714
|
+
height: "100%",
|
|
715
|
+
border: 0,
|
|
716
|
+
display: "block"
|
|
717
|
+
}
|
|
718
|
+
})
|
|
719
|
+
});
|
|
720
|
+
ctx.effect(() => c.slots.inject("main", () => c.slots.register({
|
|
721
|
+
name: "main",
|
|
722
|
+
key: PAGE_ID,
|
|
723
|
+
locale: NS
|
|
724
|
+
}, PageBody)), "dsh-dot-page.main");
|
|
725
|
+
ctx.effect(() => c.slots.inject("sidebar.panellist", () => c.slots.register({
|
|
726
|
+
name: "sidebar.panellist",
|
|
727
|
+
id: PAGE_ID,
|
|
728
|
+
order: 20,
|
|
729
|
+
label: () => t("pageTitle"),
|
|
730
|
+
locale: NS
|
|
731
|
+
}, PageIcon)), "dsh-dot-page.entry");
|
|
732
|
+
const openPage = () => {
|
|
733
|
+
try {
|
|
734
|
+
(c.layout ?? ctx.get?.("layout"))?.selectPanel?.(PAGE_ID);
|
|
735
|
+
} catch {}
|
|
736
|
+
};
|
|
737
|
+
const DotOnboarding = (props) => {
|
|
738
|
+
const [show, setShow] = (0, react.useState)(false);
|
|
739
|
+
(0, react.useEffect)(() => {
|
|
740
|
+
let alive = true;
|
|
741
|
+
fetch(`${pageUrl().replace(/page\/$/, "")}api/status`, { credentials: "same-origin" }).then((r) => r.ok ? r.json() : null).then((j) => {
|
|
742
|
+
if (!alive) return;
|
|
743
|
+
if (!j || j.setup?.done || j.setup?.dismissed) props.complete();
|
|
744
|
+
else setShow(true);
|
|
745
|
+
}).catch(() => {
|
|
746
|
+
if (alive) props.complete();
|
|
747
|
+
});
|
|
748
|
+
return () => {
|
|
749
|
+
alive = false;
|
|
750
|
+
};
|
|
751
|
+
}, []);
|
|
752
|
+
if (!show) return null;
|
|
753
|
+
const later = () => {
|
|
754
|
+
fetch(`${pageUrl().replace(/page\/$/, "")}api/setup`, {
|
|
755
|
+
method: "PUT",
|
|
756
|
+
credentials: "same-origin",
|
|
757
|
+
headers: { "content-type": "application/json" },
|
|
758
|
+
body: JSON.stringify({ dismissed: true })
|
|
759
|
+
}).catch(() => {});
|
|
760
|
+
props.complete();
|
|
761
|
+
};
|
|
762
|
+
const btn = (label, onClick, primary) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
763
|
+
type: "button",
|
|
764
|
+
onClick,
|
|
765
|
+
style: {
|
|
766
|
+
font: "inherit",
|
|
767
|
+
padding: "5px 12px",
|
|
768
|
+
borderRadius: 6,
|
|
769
|
+
cursor: "pointer",
|
|
770
|
+
border: "1px solid " + (primary ? "#4a7fd6" : "rgba(128,128,128,.4)"),
|
|
771
|
+
background: primary ? "#4a7fd6" : "transparent",
|
|
772
|
+
color: primary ? "#fff" : "inherit"
|
|
773
|
+
},
|
|
774
|
+
children: label
|
|
775
|
+
});
|
|
776
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
777
|
+
role: "dialog",
|
|
778
|
+
"aria-label": t("onboardTitle"),
|
|
779
|
+
style: {
|
|
780
|
+
position: "fixed",
|
|
781
|
+
right: 20,
|
|
782
|
+
bottom: 20,
|
|
783
|
+
zIndex: 1e3,
|
|
784
|
+
maxWidth: 340,
|
|
785
|
+
background: "Canvas",
|
|
786
|
+
color: "CanvasText",
|
|
787
|
+
colorScheme: "light dark",
|
|
788
|
+
border: "1px solid rgba(128,128,128,.3)",
|
|
789
|
+
borderRadius: 10,
|
|
790
|
+
padding: "14px 16px",
|
|
791
|
+
boxShadow: "0 6px 24px rgba(0,0,0,.18)",
|
|
792
|
+
font: "13px/1.55 system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif"
|
|
793
|
+
},
|
|
794
|
+
children: [
|
|
795
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
796
|
+
style: { fontWeight: 600, marginBottom: 4 },
|
|
797
|
+
children: t("onboardTitle")
|
|
798
|
+
}),
|
|
799
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
800
|
+
style: { opacity: .75, marginBottom: 10 },
|
|
801
|
+
children: t("onboardBody")
|
|
802
|
+
}),
|
|
803
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
804
|
+
style: { display: "flex", gap: 8 },
|
|
805
|
+
children: [btn(t("onboardGo"), () => {
|
|
806
|
+
openPage();
|
|
807
|
+
props.complete();
|
|
808
|
+
}, true), btn(t("onboardLater"), later, false)]
|
|
809
|
+
})
|
|
810
|
+
]
|
|
811
|
+
});
|
|
812
|
+
};
|
|
813
|
+
ctx.effect(() => c.slots.inject("settings.onboarding", () => c.slots.register({
|
|
814
|
+
name: "settings.onboarding",
|
|
815
|
+
id: PAGE_ID,
|
|
816
|
+
order: 100,
|
|
817
|
+
label: () => t("pageTitle"),
|
|
818
|
+
locale: NS
|
|
819
|
+
}, DotOnboarding)), "dsh-dot-page.onboarding");
|
|
662
820
|
}
|
|
663
821
|
//#endregion
|
|
664
822
|
exports.apply = apply;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-dot-life",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.1",
|
|
4
4
|
"description": "dot — a character who lives on her own phone, for DeepSeek Harness (dsh): an Android phone the plugin installs and runs, her own QQ, memory and a diary from real events, a life between conversations (幕间, after HDS-Interlude), an optional microVM computer with approval gates. One plugin, six components.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
package/scripts/prompts.mjs
CHANGED
|
@@ -74,7 +74,11 @@ export const entries = [
|
|
|
74
74
|
{ id: 'rules', group: 'system', name: '工作方式', note: '定时任务(先看已有的)、问一次就放下、静默、审批、长任务;有电脑、有手机时各多一句', files: ['dot.rules', 'dot.rules.computer', 'dot.rules.phone'],
|
|
75
75
|
render: () => variant([['电脑和手机都有', D.workingRules({ computer: true, phone: true })], ['只有手机', D.workingRules({ computer: false, phone: true })]]) },
|
|
76
76
|
{ id: 'phone', group: 'system', name: '手机', note: '手机开着时才有;通知叫醒她那句要 dot 组件在;设了手机号(/phone number)才有那一句;表情包段要 qq 组件在,最后"记到 self"要 memory 在', files: ['phone.device', 'phone.device.wake', 'phone.device.no-wake', 'phone.device.number', 'phone.stickers', 'phone.stickers.learned'],
|
|
77
|
-
render: () => variant([['设了手机号', deviceText('
|
|
77
|
+
render: () => variant([['设了手机号', deviceText('dot', '13800138000')], ['没设手机号', deviceText('dot')], ['只装手机(没有 dot、qq、memory)', deviceText('dot', '', { dot: false, qq: false, memory: false })]]) },
|
|
78
|
+
{ id: 'manuals', group: 'system', name: '说明书(第一次用时才给)', note: '她的会话里,「手机」那段和手机、电脑的 MCP 说明不放进系统提示词,换成一行(.hint);这个会话第一次用手机或电脑工具时,那一下照常执行,整份说明书跟着结果一起给她(.given)。dot.manuals = false 恢复成每轮都带着', files: ['dot.manuals.hint', 'dot.manuals.what', 'dot.manuals.given'],
|
|
79
|
+
render: () => variant([['系统提示词里的那一行(手机)', P.table('dot.manuals.hint', { serial: 'dot' }).phone], ['系统提示词里的那一行(电脑)', P.table('dot.manuals.hint', { serial: 'dot' }).computer], ['第一次用手机时(跟在结果后面)', P.prompt('dot.manuals.given', { what: '手机', manual: '(这里是「手机」那段的全文)' })]]) },
|
|
80
|
+
{ id: 'howto', group: 'system', name: '她自己的经验(进 App 时给)', note: '她用手机的每一轮都按 App 记步数(<home>/her/howto/_log.jsonl);一个会话里第一次打开某个 App,她以前记下的这个 App 的经验和最近几次的步数跟着结果给她(.given;还没有经验时 .no-notes)。整理这些经验的那次调用在「独立模型调用」里', files: ['dot.howto.given', 'dot.howto.no-notes'],
|
|
81
|
+
render: () => variant([['有经验时', P.prompt('dot.howto.given', { app: '小黑盒', recent: '11-07 23 步、错 2 次;11-08 9 步', notes: '## 教训\n- 详情页点图片会跳到旁边的商品,要点标题\n## 捷径\n- 搜游戏(在首页时):点右上角搜索 → 输入 {游戏名} → 回车 → 点第一个结果' })], ['只有步数、还没经验', P.prompt('dot.howto.given', { app: '小黑盒', recent: '11-08 15 步', notes: P.prompt('dot.howto.no-notes') })]]) },
|
|
78
82
|
{ id: 'qq', group: 'system', name: '电脑上的 QQ', note: 'QQ 连上时才有', files: ['qq.channel', 'qq.channel.owner', 'qq.channel.score', 'qq.stickers', 'qq.channel.no-stickers', 'qq.faces'],
|
|
79
83
|
render: () => variant([['设了主人、群消息先打分、有表情包', Q.channelText({ qq: '123456789', owner: '987654321', groupPolicy: 'score', stickers: STICKERS })], ['都没有', Q.channelText({ qq: '123456789', owner: '', groupPolicy: 'mention', stickers: '' })]]) },
|
|
80
84
|
{ id: 'now', group: 'system', name: '现在几点', note: '每一轮都带着(在对话历史之后):现在的时间,和离上一句话多久', files: ['dot.now'],
|
|
@@ -82,6 +86,8 @@ export const entries = [
|
|
|
82
86
|
{ id: 'scheduled', group: 'system', name: '定时任务那一轮', note: '只在定时任务叫醒她时出现', files: ['dot.scheduled'], render: () => D.scheduledRule() },
|
|
83
87
|
{ id: 'memory', group: 'system', name: '记忆', note: '她对话的每一轮都带着:关于他、她自己记下的、还没了的事(加一行先搁着的)', files: ['memory.standing'], render: standing },
|
|
84
88
|
{ id: 'recall', group: 'system', name: '想起的原话', note: '叫醒她时从旧聊天里翻出来的,按日期分组、相对日期由程序换算(样例用的是关键词匹配)', files: ['memory.recall.header'], render: recallText },
|
|
89
|
+
{ id: 'voice', group: 'system', name: '说话提醒(最后一段)', note: '放在她对话每一轮的最后(记忆、原话、幕间数据之后),模型回话前最后读到的就是它;人设里填了「说话提醒」就用那个,空着用这个({name} 是她的名字)。只在和他的对话里,跑腿不带。interlude.voice = false 关掉', files: ['interlude.voice'],
|
|
90
|
+
render: () => P.prompt('interlude.voice', { name: '小点' }) },
|
|
85
91
|
|
|
86
92
|
{ id: 'owner', group: 'wake', name: '他的 QQ 消息', note: '他从电脑端 QQ 发来的话:等他停下(1.5 秒没新消息,最多 6 秒)一批盖一个时间戳,后面是他打的原话;她这轮还没做完时插进这一轮,多一行 dot.owner-words.busy', files: ['dot.owner-words', 'dot.owner-words.busy'],
|
|
87
93
|
render: () => variant([['她空闲', D.ownerWords([{ text: '在吗' }, { text: '帮我看个东西' }])], ['她这轮进行中', D.ownerWords([{ text: '算了' }, { text: '先别弄了' }], Date.now(), { whileBusy: true })]]) },
|
|
@@ -108,6 +114,8 @@ export const entries = [
|
|
|
108
114
|
render: () => variant([['评论', I.playPrompt({ app: '小黑盒', action: 'comment', target: '那篇耳机测评', text: '低频确实糊', why: '她也用这副耳机' }, 'com.max.xiaoheihe')], ['发帖', I.playPrompt({ app: '小黑盒', action: 'post', target: '耳机区', text: '用了一个月,说说这副耳机的低频', why: '攒了一肚子想法' }, 'com.max.xiaoheihe')], ['攒表情包', I.playPrompt({ app: 'B站', action: 'collect', target: '表情包', why: '表情包太少了' }, 'tv.danmaku.bili')]]) },
|
|
109
115
|
{ id: 'free', group: 'wake', name: '幕间:自己的时间', note: '每天 interlude.freeTimesPerDay 次(默认 2),随机时刻叫醒跑腿的她,什么任务都不给;预算到 80% 提醒一句(.budget),到 100% 停下;这段时间里 QQ 和账本工具被拒(.refused),在社交 App 里打字要他批准(.typing);想找他用 tell_him(只在这里能用,别处是 .elsewhere)', files: ['interlude.free', 'interlude.free.tidy', 'interlude.free.budget', 'interlude.free.over', 'interlude.free.refused', 'interlude.free.typing', 'interlude.tell-him', 'interlude.tell-him.elsewhere'],
|
|
110
116
|
render: () => variant([['开头', I.freePrompt({ budget: 150000, left: 300000, place: '~/dot/her', listing: ['notes/', 'notes/想学的.md · 412 B · 11-7', 'growth/'], tidy: ['每晚十点逛小黑盒'], context: { now: '2026-11-08 15:20 星期日 下午', portrait: '我最近迷上了画画……', yourNotes: ['装了小黑盒'], yourDoings: { today: { doings: 2, tokens: 30100, livingTokens: 20000 } }, lately: '窝在床上看番' } })], ['预算快用完', P.prompt('interlude.free.budget', { stamp: '[11-08 15:40]', used: 121000, budget: 150000 })], ['预算用完之后', P.prompt('interlude.free.over')], ['发 QQ 被拦', P.prompt('interlude.free.refused', { tool: 'qq_send' })], ['社交 App 里打字', P.prompt('interlude.free.typing', { app: '小黑盒' })], ['tell_him 工具说明', P.prompt('interlude.tell-him')], ['别处用 tell_him', P.prompt('interlude.tell-him.elsewhere')]]) },
|
|
117
|
+
{ id: 'howto-reflect', group: 'call', name: '整理 App 经验', note: '她某一轮在一个 App 里走了 dot.howtoMinSteps(默认 12)步以上、或出过错:轮结束后一次小调用读她这轮的操作(只有操作和报错,不带屏幕上的文字)、这个 App 现有的笔记和最近几次的步数,重写笔记(≤ dot.howtoMaxChars,默认 800 字):教训、捷径(只写做成过的)', files: ['dot.howto.reflect'],
|
|
118
|
+
render: () => P.prompt('dot.howto.reflect', { maxChars: 800 }) },
|
|
111
119
|
{ id: 'growth', group: 'call', name: '成长:每周回顾', note: '每周 interlude.growthAt(默认周日 21:00)一次:她读这周的日记、自己的笔记、账和他的反应,重写「她现在的样子」(最多改 portraitMaxChange,默认 35%;改多了用 .too-much 再要一次),存进 <home>/interlude/growth;这一段作为系统提示词跟在人设后面(.section)。不写记忆。', files: ['interlude.growth.system', 'interlude.growth.too-much', 'interlude.growth.too-long', 'interlude.growth.section'],
|
|
112
120
|
render: () => variant([['system', P.prompt('interlude.growth.system', { name: 'dot', maxChars: 900, change: '35%' })], ['改太多时', P.prompt('interlude.growth.too-much', { ratio: '52%', change: '35%' })], ['太长时', P.prompt('interlude.growth.too-long', { length: 1180, maxChars: 900 })], ['放进系统提示词的样子', P.prompt('interlude.growth.section', { portrait: '我最近迷上了画画,晚上不怎么刷小黑盒了……' })]]) },
|
|
113
121
|
{ id: 'try', group: 'wake', name: '幕间:试点新的', note: '她想做一件没做过的事:交给跑腿真去做,只有几条硬边界;做了什么、花了多少 token、他怎么说,都记在她的账上(doings 工具让对话里的她记下他的反应)', files: ['interlude.try', 'interlude.try.on', 'interlude.try.refused', 'interlude.doings-tool', 'interlude.doings-tool.elsewhere'],
|
|
@@ -133,12 +141,12 @@ export const entries = [
|
|
|
133
141
|
const entryOf = (id) => entries.find((e) => e.files.includes(id));
|
|
134
142
|
|
|
135
143
|
// ── her Canon (<home>/interlude/canon.json): not a prompt file, but the first thing she reads ──
|
|
136
|
-
const CANON_FIELDS = [['characterName', '名字'], ['characterProfile', '角色设定'], ['perspective', '视角'], ['relationship', '和用户的关系'], ['userProfile', '用户'], ['supportingCast', '配角'], ['world', '世界'], ['location', '主要地点'], ['replyRules', '回复规则'], ['style', '叙事文风(只给幕间)'], ['blacklist', '不要这样说(一行一条)'], ['examples', '对话范例']];
|
|
144
|
+
const CANON_FIELDS = [['characterName', '名字'], ['characterProfile', '角色设定'], ['perspective', '视角'], ['relationship', '和用户的关系'], ['userProfile', '用户'], ['supportingCast', '配角'], ['world', '世界'], ['location', '主要地点'], ['replyRules', '回复规则'], ['style', '叙事文风(只给幕间)'], ['blacklist', '不要这样说(一行一条)'], ['examples', '对话范例'], ['voice', '说话提醒(放在每轮最后;空着就用内置的 interlude.voice)']];
|
|
137
145
|
const HOME = P.promptHome(); // before --src moves the prompt home to a temp dir
|
|
138
146
|
const canonPath = () => join(HOME, 'interlude', 'canon.json');
|
|
139
147
|
const readCanon = () => { try { return JSON.parse(readFileSync(canonPath(), 'utf8')); } catch { return null; } };
|
|
140
|
-
const canonField = (c, k) => (k === 'blacklist' ? (Array.isArray(c?.blacklist) ? c.blacklist.join('\n') : String(c?.blacklist ?? '')) : k === 'examples' ? String(c?.examples ?? '') : String(c?.storyDefaults?.[k] ?? ''));
|
|
141
|
-
const withCanonField = (c, k, v) => { const n = structuredClone(c ?? { storyDefaults: {} }); n.storyDefaults ??= {}; if (k === 'blacklist') n.blacklist = v.split('\n').map((l) => l.trim()).filter(Boolean); else if (k === 'examples') n.examples = v; else n.storyDefaults[k] = v; return n; };
|
|
148
|
+
const canonField = (c, k) => (k === 'blacklist' ? (Array.isArray(c?.blacklist) ? c.blacklist.join('\n') : String(c?.blacklist ?? '')) : k === 'examples' ? String(c?.examples ?? '') : k === 'voice' ? String(c?.voice ?? '') : String(c?.storyDefaults?.[k] ?? ''));
|
|
149
|
+
const withCanonField = (c, k, v) => { const n = structuredClone(c ?? { storyDefaults: {} }); n.storyDefaults ??= {}; if (k === 'blacklist') n.blacklist = v.split('\n').map((l) => l.trim()).filter(Boolean); else if (k === 'examples') n.examples = v; else if (k === 'voice') n.voice = v; else n.storyDefaults[k] = v; return n; };
|
|
142
150
|
const isCanon = (id) => id?.startsWith('canon.') && CANON_FIELDS.some(([k]) => id === `canon.${k}`);
|
|
143
151
|
entries.unshift({ id: 'canon', group: 'system', name: '人设(Canon)', note: '她是谁、怎么说话。存在 ' + canonPath() + ',改了她下一轮就用;每天第一次保存前自动备份一份', files: CANON_FIELDS.map(([k]) => `canon.${k}`),
|
|
144
152
|
render: () => I.renderCanon(readCanon() ?? CANON, { withStyle: true }) });
|
|
@@ -152,7 +160,8 @@ export async function full() {
|
|
|
152
160
|
const parts = [
|
|
153
161
|
['人设(Canon)', I.renderCanon(readCanon() ?? CANON)],
|
|
154
162
|
['工作方式', D.workingRules({ computer: true, phone: true })],
|
|
155
|
-
|
|
163
|
+
// dot.manuals: the phone section (and the phone's / computer's MCP instructions) stand as one line each; the manual comes on first use.
|
|
164
|
+
['手机、电脑(说明书第一次用时才给)', [P.table('dot.manuals.hint', { serial: 'dot' }).phone, P.table('dot.manuals.hint', { serial: 'dot' }).computer].join('\n')],
|
|
156
165
|
['电脑上的 QQ', Q.channelText({ qq: '123456789', owner: '987654321', groupPolicy: 'score', stickers: STICKERS })],
|
|
157
166
|
['—— 以下在对话历史之后 ——', ''],
|
|
158
167
|
['现在几点', D.nowText(Date.now(), Date.now() - (3 * 60 + 12) * 6e4)],
|
|
@@ -160,6 +169,7 @@ export async function full() {
|
|
|
160
169
|
['记忆', standing()],
|
|
161
170
|
['想起的原话', await recallText()],
|
|
162
171
|
['幕间的连续性(数据,没有文字)', context()],
|
|
172
|
+
['说话提醒(最后一段)', String((readCanon() ?? CANON)?.voice ?? '').trim() || P.prompt('interlude.voice', { name: (readCanon() ?? CANON)?.storyDefaults?.characterName ?? '她' })],
|
|
163
173
|
];
|
|
164
174
|
return parts.map(([k, v]) => (v ? `━━━━ ${k} ━━━━\n${v}` : `━━━━ ${k} ━━━━`)).join('\n\n');
|
|
165
175
|
}
|
|
@@ -248,7 +258,7 @@ async function full() {
|
|
|
248
258
|
cur = ''; const main = document.getElementById('main');
|
|
249
259
|
main.replaceChildren($('p', { class: 'mute' }, '正在拼…'));
|
|
250
260
|
const { text } = await api('/api/full');
|
|
251
|
-
main.replaceChildren($('h2', { class: 't' }, '全貌'), $('p', { class: 'hint' }, '她的对话里,插件加进系统提示词的部分从上到下拼起来的样子(样例数据)。dsh
|
|
261
|
+
main.replaceChildren($('h2', { class: 't' }, '全貌'), $('p', { class: 'hint' }, '她的对话里,插件加进系统提示词的部分从上到下拼起来的样子(样例数据)。dsh 自己的段落不在这里;手机和电脑的说明书不在每轮里,第一次用时才给(见「说明书」)。'), $('pre', { id: 'fulltext' }, text));
|
|
252
262
|
mark();
|
|
253
263
|
}
|
|
254
264
|
async function show(id) {
|
|
@@ -10,6 +10,22 @@ import { dirname, join } from 'node:path';
|
|
|
10
10
|
import { promisify } from 'node:util';
|
|
11
11
|
import { systemProxyEnv } from './proxy.js';
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* A blocked registry (ghcr.io from mainland China without a proxy) makes `msb pull` hang for a long
|
|
15
|
+
* time; ask the registry first (any HTTP answer, 401 included, means reachable) and fail in seconds.
|
|
16
|
+
*/
|
|
17
|
+
export async function registryReachable(image, run = (cmd, args, opts) => promisify(execFile)(cmd, args, opts)) {
|
|
18
|
+
const host = String(image).split('/')[0];
|
|
19
|
+
if (!host.includes('.')) return true; // Docker Hub short names: let msb handle it
|
|
20
|
+
try {
|
|
21
|
+
const { stdout } = await run('curl', ['-sS', '-o', process.platform === 'win32' ? 'NUL' : '/dev/null', '-m', '15', '-w', '%{http_code}', `https://${host}/v2/`], { env: { ...process.env, ...systemProxyEnv() }, timeout: 25_000, windowsHide: true });
|
|
22
|
+
if (/^[1-5]\d\d$/.test(String(stdout).trim().slice(-3)) && !String(stdout).trim().endsWith('000')) return true;
|
|
23
|
+
} catch (err) {
|
|
24
|
+
if (/ENOENT/.test(String(err.code ?? err.message))) return true; // no curl: let msb try
|
|
25
|
+
}
|
|
26
|
+
throw new Error(`cannot reach ${host} to download the computer image — on the dot page (or /phone doctor fix computer-image-cn) switch to the mainland China mirror, or turn on a proxy and restart dsh`);
|
|
27
|
+
}
|
|
28
|
+
|
|
13
29
|
const execFileAsync = promisify(execFile);
|
|
14
30
|
|
|
15
31
|
const PLATFORM_PACKAGES = {
|
|
@@ -183,7 +199,9 @@ export function createMicrosandboxBackend(config, logger) {
|
|
|
183
199
|
await restoreFrom(savedRef, mounts, port);
|
|
184
200
|
} else if (!all.includes(name)) {
|
|
185
201
|
logger.info(`pulling ${config.image} (first run only, a few GB)…`); onStage('downloading');
|
|
186
|
-
await
|
|
202
|
+
await registryReachable(config.image);
|
|
203
|
+
try { await msb(['pull', '-q', config.image], { timeout: 60 * 60_000, env: systemProxyEnv() }); }
|
|
204
|
+
catch (err) { throw new Error(`could not download the computer image ${config.image}: ${String(err.stderr || err.message).trim().split(/\r?\n/).slice(-2).join(' ')} — on the dot page (or /phone doctor fix computer-image-cn) switch to the mainland China mirror, or turn on a proxy`); }
|
|
187
205
|
const args = [
|
|
188
206
|
'create', '--name', name, '--hostname', config.name,
|
|
189
207
|
'-m', config.memory, '-c', String(config.cpus),
|
|
@@ -55,7 +55,7 @@ export default class DshComputerSubprocess extends LocalSubprocessRuntime {
|
|
|
55
55
|
* not be cancelled and outlived the stop button. A failed computer fails the same way.
|
|
56
56
|
*/
|
|
57
57
|
usable() {
|
|
58
|
-
if (this.vm.error) throw new Error(`电脑出错了,现在跑不了命令(${this.vm.error.message})。不用等,先直接回话;/
|
|
58
|
+
if (this.vm.error) throw new Error(`电脑出错了,现在跑不了命令(${this.vm.error.message})。不用等,先直接回话;/phone doctor 或左侧栏 dot 页面看详情`);
|
|
59
59
|
if (!this.vm.isReady) throw new Error(notReady(this.vm.status?.()));
|
|
60
60
|
}
|
|
61
61
|
|
package/src/computer/ui-host.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
// Host half of the
|
|
2
|
-
//
|
|
3
|
-
|
|
1
|
+
// Host half of the plugin's root component (dot-ui): the browser bundle (lib/client.js) adds the
|
|
2
|
+
// sidebar tabs, the header buttons and the dot page; on the host this mounts the dot page's API
|
|
3
|
+
// (/dsh-dot/api: settings, doctor, one-click fixes, diagnostics), independent of which other
|
|
4
|
+
// components are on.
|
|
5
|
+
import { mountApi } from '../page/api.js';
|
|
6
|
+
|
|
7
|
+
export const inject = [];
|
|
8
|
+
|
|
9
|
+
export function apply(ctx) {
|
|
10
|
+
const logger = ctx.logger('dsh-dot/page');
|
|
11
|
+
ctx.inject(['webServer', 'connection'], (c) => c.effect(() => mountApi(ctx, c.webServer, logger, c.connection), 'dsh-dot: page api'));
|
|
12
|
+
}
|