dsh-dot-life 0.12.3 → 0.13.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 +148 -0
- package/README.md +242 -101
- package/docs/SETTINGS.md +194 -0
- package/docs/phone.md +4 -0
- package/package.json +1 -1
- package/src/computer/gate.js +2 -1
- package/src/computer/vm.js +4 -1
- package/src/dot/core.js +8 -3
- package/src/dot/panel.js +1 -1
- package/src/interlude/core.js +3 -1
- package/src/memory/memory.js +5 -2
- package/src/phone/phone.js +33 -3
- package/src/qq/qq.js +4 -2
- package/src/settings.js +40 -0
package/README.en.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# ◎ dsh-dot
|
|
4
|
+
|
|
5
|
+
**A character who lives on her own phone · a companion plugin for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)**
|
|
6
|
+
|
|
7
|
+
She has her own Android phone, her own QQ, her own days and diary.<br>
|
|
8
|
+
Between your conversations, she keeps living.
|
|
9
|
+
|
|
10
|
+
[](https://www.npmjs.com/package/dsh-dot-life)
|
|
11
|
+
[](LICENSE)
|
|
12
|
+
[](https://github.com/deepseek-ai/deepseek-harness)
|
|
13
|
+
[](package.json)
|
|
14
|
+
[](https://github.com/Kevinwu901113/dsh-dot/stargazers)
|
|
15
|
+
|
|
16
|
+
[简体中文](README.md) · **English**
|
|
17
|
+
|
|
18
|
+
[Quick start](#-quick-start) · [Features](#-features) · [Settings](#%EF%B8%8F-settings) · [Architecture](#-architecture) · [Commands](#%EF%B8%8F-commands) · [Coexistence](#-coexisting-with-other-plugins)
|
|
19
|
+
|
|
20
|
+
<img src="docs/demo.gif" alt="dsh-dot demo" width="820">
|
|
21
|
+
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## ✨ Features
|
|
27
|
+
|
|
28
|
+
- 📱 **A real phone** — the plugin downloads, builds and boots an Android emulator (no Java / Android Studio). No app store: **she installs her own apps**.
|
|
29
|
+
- 💬 **Her own QQ** — NapCat or SnowLuma (OneBot 11), same account as on her phone. Your message wakes her in **1–2 s**; she replies in several short messages and sends stickers.
|
|
30
|
+
- 🌙 **A life between conversations** — the interlude, ported from [HDS-Interlude](https://github.com/REcklessNOLOve117/HDS-Interlude): she writes down her days, keeps intents, goes to look at what she's curious about, and sometimes has a real reason to message you.
|
|
31
|
+
- 🧠 **Memory** — profile, people cards, fragments, handoff at 150k tokens, and (0.12+) automatic recall of the most relevant past turns. Public memory benchmark: **74 → 95 / 108**. A diary every night at 23:30.
|
|
32
|
+
- 🎮 **She browses and plays** — likes, comments and follows in the apps she installed herself. How much is her own habit, not a quota.
|
|
33
|
+
- 🖥️ **An optional computer** — a bundled microVM (no Docker): shell, browser, desktop, live view, approval gates, audit log.
|
|
34
|
+
|
|
35
|
+
> [!NOTE]
|
|
36
|
+
> **She can look, but never act behind your back.** Looking is read-only; anything with consequences (installing, passwords, payments, messaging strangers) goes through approval or isn't allowed at all.
|
|
37
|
+
|
|
38
|
+
## 🚀 Quick start
|
|
39
|
+
|
|
40
|
+
Requires dsh ≥ 0.2.1 and hardware virtualization (Apple silicon / Intel Mac, Linux with KVM, Windows with WHPX). Quit the dsh desktop app first:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# macOS
|
|
44
|
+
"/Applications/DeepSeek Harness.app/Contents/Resources/runtime/cli/bin/dsh" plugin --profile desktop add \
|
|
45
|
+
dsh-dot-life @xmanrui/dsh-im
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```powershell
|
|
49
|
+
# Windows
|
|
50
|
+
& "$env:LOCALAPPDATA\Programs\DeepSeek Harness\resources\runtime\cli\bin\dsh.cmd" plugin --profile desktop add `
|
|
51
|
+
dsh-dot-life @xmanrui/dsh-im
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Web: `dsh plugin --profile web add dsh-dot-life`. From source: use `github:Kevinwu901113/dsh-dot`.
|
|
55
|
+
|
|
56
|
+
Then, in dsh:
|
|
57
|
+
|
|
58
|
+
```text
|
|
59
|
+
/phone accept # accept the Android SDK license; the phone installs itself (~2 GB)
|
|
60
|
+
/interlude preset 6QA0-1PD6 # import an HDSI persona from typ0.space
|
|
61
|
+
/qq install → /qq account <alt account> → /qq start → /qq qr
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Use alt accounts.** No platform's terms allow automation.
|
|
65
|
+
|
|
66
|
+
## ⚙️ Settings
|
|
67
|
+
|
|
68
|
+
Every personal setting lives in **one file**: `~/.dsh/dsh-dot.json` (Windows: `%USERPROFILE%\.dsh\dsh-dot.json`), one section per component. Upgrades never overwrite it; restart dsh after editing.
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"phone": { "dataGb": 32 },
|
|
73
|
+
"computer": { "rootDisk": "32G", "memory": "6G" },
|
|
74
|
+
"interlude": { "activeHours": "09:00-01:00", "speak": true }
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Every key, which ones only apply to a newly created phone / VM, and rules for agents editing the file: **[docs/SETTINGS.md](docs/SETTINGS.md)** (Chinese). Or just ask dsh: "follow docs/SETTINGS.md and set dsh-dot's phone storage to 32 GB".
|
|
79
|
+
|
|
80
|
+
## 🧩 Architecture
|
|
81
|
+
|
|
82
|
+
One plugin, six components. Each can be turned off on its own; the rest keep running.
|
|
83
|
+
|
|
84
|
+
```mermaid
|
|
85
|
+
flowchart LR
|
|
86
|
+
you(["👤 You<br/>QQ / WeChat / Feishu"])
|
|
87
|
+
subgraph dot["dsh-dot"]
|
|
88
|
+
direction TB
|
|
89
|
+
contact["dot<br/>contact layer"]
|
|
90
|
+
interlude["interlude<br/>life between chats"]
|
|
91
|
+
memory["memory<br/>memory · recall · diary"]
|
|
92
|
+
phone["phone<br/>Android emulator"]
|
|
93
|
+
qq["qq<br/>NapCat / SnowLuma"]
|
|
94
|
+
computer["computer<br/>microVM (optional)"]
|
|
95
|
+
end
|
|
96
|
+
session(["her session<br/>run by dsh"])
|
|
97
|
+
|
|
98
|
+
you <-->|messages| qq
|
|
99
|
+
you <-->|dsh-im| contact
|
|
100
|
+
phone -->|notifications wake| session
|
|
101
|
+
qq -->|wake in 1–2 s| session
|
|
102
|
+
interlude -->|look · play · reach out| session
|
|
103
|
+
memory -->|profile + recall| session
|
|
104
|
+
session -->|mcp__dot-phone__*| phone
|
|
105
|
+
session -->|mcp__dot-vm__*| computer
|
|
106
|
+
qq -.runs in.-> computer
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
| Component | What it is | Off switch |
|
|
110
|
+
|---|---|---|
|
|
111
|
+
| **`phone`** | Android emulator exposed as `mcp__dot-phone__*` via [mobile-mcp](https://github.com/mobile-next/mobile-mcp) · [docs](docs/phone.md) | `DSH_DOT_PHONE=off` |
|
|
112
|
+
| **`interlude`** | Canon persona, script, continuity, intents, read-only looking, optional proactive contact · [docs](docs/interlude.md) | `DSH_DOT_INTERLUDE=off` |
|
|
113
|
+
| **`qq`** | Her QQ inside the computer VM, same account as her phone · [docs](docs/qq.md) | `DSH_DOT_QQ=off` |
|
|
114
|
+
| **`memory`** | Profile, people, fragments, diary, handoff, auto-recall (local bge-small-zh by default; SiliconFlow / DashScope optional) · [docs](docs/memory.md) | `DSH_DOT_MEMORY=off` |
|
|
115
|
+
| **`dot`** | Scheduled results → IM, approval and device notices, working rules, sidebar status panel | `DSH_DOT_CONTACT=off` |
|
|
116
|
+
| **`computer`** | Bundled microVM ([microsandbox](https://github.com/zerocore-ai/microsandbox)) or Docker · [docs](docs/computer.md) | `DSH_DOT_COMPUTER=off` |
|
|
117
|
+
|
|
118
|
+
## ⌨️ Commands
|
|
119
|
+
|
|
120
|
+
```text
|
|
121
|
+
/phone [accept|restart|screenshot]
|
|
122
|
+
/interlude [now|advance|seed|preset <code>|canon]
|
|
123
|
+
/dot [test|check]
|
|
124
|
+
/dot memory [now|diary|handoff|recall …]
|
|
125
|
+
/dot people [approve <id>|drop <id>|forget <name>]
|
|
126
|
+
/qq [install|account|start|qr|backend|owner]
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
The **◎** button at the top of a conversation opens the dot panel: device status, handoff progress, what she's doing now, today's tokens, and her **last 30 scenes**.
|
|
130
|
+
|
|
131
|
+
## 🤝 Coexisting with other plugins
|
|
132
|
+
|
|
133
|
+
- With the computer on, dsh-dot replaces the subprocess provider, sets `sandbox-policy` to `danger-full-access` (the VM is the boundary) and rewrites permission presets — don't combine with other sandbox / subprocess / permission plugins, or set `DSH_DOT_COMPUTER=off`.
|
|
134
|
+
- MCP tools are namespaced: `mcp__dot-vm__*`, `mcp__dot-phone__*`.
|
|
135
|
+
- Memory coexistence (`DSH_DOT_MEMORY_COEXIST=auto`) drops to `people-only` when another memory service is found.
|
|
136
|
+
- One QQ account, one responder. `bash` also passes the computer gate.
|
|
137
|
+
|
|
138
|
+
See the [Chinese README](README.md#-与其他插件共存) for injected message `source` tags (for context-compression plugins) and upgrade notes.
|
|
139
|
+
|
|
140
|
+
## 📄 License
|
|
141
|
+
|
|
142
|
+
[AGPL-3.0-only](LICENSE). The interlude uses HDS-Interlude's (AGPL-3.0) prompts verbatim, so the whole package is AGPL. Computer / dot code released under MIT before v0.3 remains MIT in those versions.
|
|
143
|
+
|
|
144
|
+
<div align="center">
|
|
145
|
+
|
|
146
|
+
If she made you smile, leave a ⭐
|
|
147
|
+
|
|
148
|
+
</div>
|
package/README.md
CHANGED
|
@@ -1,145 +1,286 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# ◎ dsh-dot
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**一个在自己手机上过日子的角色 · 给 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 的养鱼插件**
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
她有自己的安卓手机、自己的 QQ、自己的作息和日记。<br>
|
|
8
|
+
你们不聊天的时候,她也在过日子。
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
| **`dsh-dot/memory`** | What she remembers: you, her own notes, the people she meets, what happened; recalls the old turns most like the message that woke her (local embedding by default, cloud optional); hands her conversation over to a fresh session past 150k tokens. `DSH_DOT_MEMORY=off` turns it off. [Details](docs/memory.md) | — |
|
|
15
|
-
| **`dsh-dot/dot`** | The contact layer: scheduled results → IM unless the reply is `DOT_SILENT`, approval and device notices on IM, working rules as a prompt section. `DSH_DOT_CONTACT=off` turns it off | [dsh-im](https://github.com/xmanrui/dsh-im) for IM; dsh's built-in schedule service |
|
|
16
|
-
| **`dsh-dot/computer`** (optional) | A bundled microVM (no Docker needed) with shell, browser, desktop, live view, approval gates and an audit log — the isolation boundary for work. `DSH_DOT_COMPUTER=off` turns it off. [Details](docs/computer.md) | [microsandbox](https://github.com/zerocore-ai/microsandbox) (bundled) or Docker |
|
|
10
|
+
[](https://www.npmjs.com/package/dsh-dot-life)
|
|
11
|
+
[](LICENSE)
|
|
12
|
+
[](https://github.com/deepseek-ai/deepseek-harness)
|
|
13
|
+
[](package.json)
|
|
14
|
+
[](https://github.com/Kevinwu901113/dsh-dot/stargazers)
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
**简体中文** · [English](README.en.md)
|
|
17
|
+
|
|
18
|
+
[快速开始](#-快速开始) · [她能做什么](#-她能做什么) · [设置](#%EF%B8%8F-设置) · [架构](#-架构) · [命令](#%EF%B8%8F-命令与文件) · [共存](#-与其他插件共存) · [路线图](docs/ROADMAP.md)
|
|
19
|
+
|
|
20
|
+
<img src="docs/demo.gif" alt="dsh-dot demo" width="820">
|
|
23
21
|
|
|
24
|
-
|
|
22
|
+
</div>
|
|
25
23
|
|
|
26
24
|
---
|
|
27
25
|
|
|
28
|
-
|
|
26
|
+
## ✨ 她能做什么
|
|
27
|
+
|
|
28
|
+
<table>
|
|
29
|
+
<tr>
|
|
30
|
+
<td width="50%" valign="top">
|
|
31
|
+
|
|
32
|
+
### 📱 有一部真的手机
|
|
33
|
+
插件自己下载、建好、开机一台 Android 模拟器,不需要 Java / Android Studio。App 和登录态都在里面,重启不丢。手机没带应用商店,**App 让她自己去装**。
|
|
34
|
+
|
|
35
|
+
</td>
|
|
36
|
+
<td width="50%" valign="top">
|
|
37
|
+
|
|
38
|
+
### 💬 有自己的 QQ
|
|
39
|
+
NapCat / SnowLuma(OneBot 11)和她手机上同一个账号。你发消息 **1–2 秒叫醒她**,她分条回、会发表情包、会存别人发的图。
|
|
40
|
+
|
|
41
|
+
</td>
|
|
42
|
+
</tr>
|
|
43
|
+
<tr>
|
|
44
|
+
<td valign="top">
|
|
45
|
+
|
|
46
|
+
### 🌙 两次对话之间也在生活
|
|
47
|
+
「幕间」移植自 [HDS-Interlude](https://github.com/REcklessNOLOve117/HDS-Interlude):写下这段时间的日子、记下打算、拿手机去看她好奇的东西,偶尔有真实的理由来找你。
|
|
48
|
+
|
|
49
|
+
</td>
|
|
50
|
+
<td valign="top">
|
|
51
|
+
|
|
52
|
+
### 🧠 记得你,也记得她遇到的人
|
|
53
|
+
画像 + 碎片 + 交班,每个人一张卡;0.12 起叫醒前自动召回最相关的旧对话。公开记忆基准 **74 → 95 / 108**。每天 23:30 写日记。
|
|
54
|
+
|
|
55
|
+
</td>
|
|
56
|
+
</tr>
|
|
57
|
+
<tr>
|
|
58
|
+
<td valign="top">
|
|
29
59
|
|
|
30
|
-
|
|
60
|
+
### 🎮 自己逛、自己玩
|
|
61
|
+
小黑盒、B 站、微博、小红书……她装了哪个就逛哪个,点赞、评论、关注。玩多少不设配额,由她自己养成的习惯决定。
|
|
31
62
|
|
|
32
|
-
|
|
63
|
+
</td>
|
|
64
|
+
<td valign="top">
|
|
33
65
|
|
|
34
|
-
###
|
|
66
|
+
### 🖥️ 想让她干活?给她一台电脑
|
|
67
|
+
可选的 microVM(不需要 Docker):shell、浏览器、桌面、实时画面、审批闸门、审计日志。定时任务有结果推到 IM,没有就安静。
|
|
35
68
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
| **`dsh-dot/interlude`** 幕间 | 按 [HDS-Interlude](https://github.com/REcklessNOLOve117/HDS-Interlude):Canon(人设,HDSI 分享码导入)作为系统提示的一段;两次对话之间的生活——剧本、连续性、打算;想看什么就拿手机(或电脑浏览器)去看,只读、无审批;可选的主动联系。`DSH_DOT_INTERLUDE=off` 关掉。详见 [docs/interlude.md](docs/interlude.md) | — |
|
|
40
|
-
| **`dsh-dot/qq`** 她电脑上的 QQ | [NapCat](https://github.com/NapNeko/NapCatQQ) 或 [SnowLuma](https://github.com/SnowLuma/SnowLuma)(OneBot 11,`/qq backend` 切换)跑在她的电脑 VM 里,和手机上的 QQ 同一个账号;消息到的瞬间叫醒她,她用 `qq_send` 秒回;dot 的提醒和她的主动联系也走这里,官方机器人退为后备。`DSH_DOT_QQ=off` 关掉(电脑关了它也关)。详见 [docs/qq.md](docs/qq.md) | 电脑组件 |
|
|
41
|
-
| **`dsh-dot/memory`** 她记得的 | 关于你的画像和她自己的笔记(按 Hermes 的做法,有字数上限,她自己能改),她在各个 App 里遇到的人(每人一张卡:互动次数由代码根据真实事件记,印象和事由模型写;只在帖子里互动过的人只记次数和一句印象;关于别人的事先进待核实区),发生过的事(按 dsh-whale-inurqq:碎片带重要度、被说起几次、会老化)。她的对话到 15 万 token 就交班换一个新会话,远早于 dsh 自己在 80% 窗口时的压缩。0.12 起每次她被叫醒,还会用叫醒她的那句话从以前的聊天里自动翻出最相关的原话放在她面前(默认本机 bge-small-zh,不要 key,第一次用时下载;也可以切 SiliconFlow / DashScope 或关掉,一条 `/dot memory recall …` 命令,不用重启)。公开记忆基准 108 题上从 74 题提到 93 题。`DSH_DOT_MEMORY=off` 关掉。详见 [docs/memory.md](docs/memory.md) | — |
|
|
42
|
-
| **`dsh-dot/dot`** 联系人层 | 定时任务的结果推到 IM(回复只是 `DOT_SILENT` 就不发)、审批和设备状况的提醒、工作规则作为系统提示的一段。`DSH_DOT_CONTACT=off` 关掉 | IM 用 [dsh-im](https://github.com/xmanrui/dsh-im);定时用 dsh 内置的定时服务 |
|
|
43
|
-
| **`dsh-dot/computer`**(可选)她的电脑 | 自带 microVM(不需要 Docker),里面有 shell、浏览器、桌面;实时画面、审批闸门、审计日志。干活时的隔离边界。`DSH_DOT_COMPUTER=off` 关掉。详见 [docs/computer.md](docs/computer.md) | [microsandbox](https://github.com/zerocore-ai/microsandbox)(自带)或 Docker |
|
|
69
|
+
</td>
|
|
70
|
+
</tr>
|
|
71
|
+
</table>
|
|
44
72
|
|
|
45
|
-
|
|
73
|
+
> [!NOTE]
|
|
74
|
+
> **她只能看,不能瞒着你动。** 「去看」是只读的;装 App、输密码、付款、给陌生人发消息这类有后果的动作,要么走审批,要么根本不给。
|
|
46
75
|
|
|
47
|
-
|
|
76
|
+
## 🚀 快速开始
|
|
48
77
|
|
|
49
|
-
需要 dsh ≥ 0.2.1
|
|
78
|
+
需要 dsh ≥ 0.2.1,以及硬件虚拟化(Apple silicon / Intel Mac;Linux 需 KVM;Windows 需 WHPX)。先退出 dsh 桌面版:
|
|
79
|
+
|
|
80
|
+
<details open>
|
|
81
|
+
<summary><b>macOS</b></summary>
|
|
50
82
|
|
|
51
83
|
```bash
|
|
52
|
-
# macOS
|
|
53
84
|
"/Applications/DeepSeek Harness.app/Contents/Resources/runtime/cli/bin/dsh" plugin --profile desktop add \
|
|
54
85
|
dsh-dot-life @xmanrui/dsh-im
|
|
55
86
|
open -a "DeepSeek Harness"
|
|
56
87
|
```
|
|
88
|
+
</details>
|
|
89
|
+
|
|
90
|
+
<details>
|
|
91
|
+
<summary><b>Windows(PowerShell)</b></summary>
|
|
57
92
|
|
|
58
93
|
```powershell
|
|
59
|
-
# Windows(PowerShell;需要开启 Windows 虚拟机监控程序平台 WHPX,手机才能跑)
|
|
60
94
|
& "$env:LOCALAPPDATA\Programs\DeepSeek Harness\resources\runtime\cli\bin\dsh.cmd" plugin --profile desktop add `
|
|
61
95
|
dsh-dot-life @xmanrui/dsh-im
|
|
62
96
|
```
|
|
97
|
+
</details>
|
|
63
98
|
|
|
64
|
-
|
|
99
|
+
<details>
|
|
100
|
+
<summary><b>Web 版 / 从源码</b></summary>
|
|
65
101
|
|
|
66
|
-
|
|
102
|
+
```bash
|
|
103
|
+
dsh plugin --profile web add dsh-dot-life
|
|
104
|
+
dsh plugin --profile desktop add github:Kevinwu901113/dsh-dot # 源码
|
|
105
|
+
```
|
|
106
|
+
</details>
|
|
107
|
+
|
|
108
|
+
然后在 dsh 里:
|
|
109
|
+
|
|
110
|
+
```text
|
|
111
|
+
/phone accept # 接受 Android SDK 许可,手机开始自己装(约 2 GB;/phone accept 32 给 32 GB 存储)
|
|
112
|
+
/interlude preset 6QA0-1PD6 # 从 typ0.space 导入一份 HDSI 人设,换成你喜欢的分享码
|
|
113
|
+
/qq install → /qq account <小号> → /qq start → /qq qr # 她用手机摄像头扫码登录电脑 QQ
|
|
114
|
+
```
|
|
67
115
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
3. **人设**:`/interlude preset <分享码>` 从 [typ0.space](https://typ0.space) 导入一份 HDSI 预设,或者把 `examples/canon.minase-style.json` 放到 `~/dot/interlude/canon.json`。
|
|
71
|
-
4. **她在手机上看什么、玩什么**:不用配。常见社区 App(小黑盒、B 站、微博、小红书、知乎、抖音、酷安、贴吧、豆瓣)的站 → 包名表是内置的,只对她**自己装了**的 App 生效:有 App 的站她用手机去看(只读、无审批、每天有上限),幕间里想点赞 / 评论 / 关注就在那些 App 里做。别的 App 在 profile 的 `cordis.patch.yml` 里给 `dot-interlude` 加 `phoneApps` / `playApps`。
|
|
72
|
-
5. **她的 QQ**:`/qq install` → `/qq account <小号>` → `/qq start` → `/qq qr`,在「手机」标签页里用她手机上的 QQ 扫一扫(码会出现在她的摄像头画面里)确认电脑登录(详见 [docs/qq.md](docs/qq.md))。之后你在 QQ 里给她发消息,1–2 秒叫醒她,她用 `qq_send` 回。不想用协议端的,按 dsh-im 的说明接一个官方机器人也行。
|
|
73
|
-
6. **电脑(可选)**:默认装上并启动;不想要就在环境里设 `DSH_DOT_COMPUTER=off`。要公网实时画面按 [docs/computer.md](docs/computer.md) 用 `tailscale serve`。
|
|
116
|
+
<details>
|
|
117
|
+
<summary><b>第一次设置的完整说明</b></summary>
|
|
74
118
|
|
|
75
|
-
|
|
119
|
+
1. **手机**:`/phone accept` 后插件下载模拟器、platform-tools、系统镜像(进度在 `~/.dsh/dsh-phone.log`),装完自动开机,桌面出现手机窗口。存储大小建好后不能再改。`/phone` 看状态。
|
|
120
|
+
2. **装 App、登录**:在手机窗口里像真手机一样操作,或者让她自己装(`mobile_install_app` 会弹审批)。登录、验证码、人脸由你亲手过,她遇到会停下来叫你。**用小号**,各平台条款都不允许自动化。
|
|
121
|
+
3. **人设**:`/interlude preset <分享码>`,或把 [`examples/canon.minase-style.json`](examples/canon.minase-style.json) 放到 `~/dot/interlude/canon.json`。
|
|
122
|
+
4. **她逛什么**:不用配。常见社区 App 的站点 → 包名表是内置的,只对她**自己装了**的 App 生效。其他 App 在 `cordis.patch.yml` 里给 `dot-interlude` 加 `phoneApps` / `playApps`。
|
|
123
|
+
5. **QQ**:详见 [docs/qq.md](docs/qq.md)。不想用协议端,也可以按 dsh-im 的说明接官方机器人。
|
|
124
|
+
6. **电脑(可选)**:默认装上并启动;不要就设 `DSH_DOT_COMPUTER=off`。公网看实时画面见 [docs/computer.md](docs/computer.md)。
|
|
76
125
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
126
|
+
</details>
|
|
127
|
+
|
|
128
|
+
## ⚙️ 设置
|
|
129
|
+
|
|
130
|
+
所有个人设置都在**一个文件**:`~/.dsh/dsh-dot.json`(Windows:`%USERPROFILE%\.dsh\dsh-dot.json`),按组件分段,升级插件不会覆盖,改完重启 dsh。
|
|
131
|
+
|
|
132
|
+
```json
|
|
133
|
+
{
|
|
134
|
+
"phone": { "dataGb": 32 },
|
|
135
|
+
"computer": { "rootDisk": "32G", "memory": "6G" },
|
|
136
|
+
"interlude": { "activeHours": "09:00-01:00", "speak": true }
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
存储、作息、主动联系、群聊规则、省 token、网络镜像……每一项怎么改、哪些只在新建手机 / 虚拟机时生效,都在 **[docs/SETTINGS.md](docs/SETTINGS.md)**。
|
|
141
|
+
|
|
142
|
+
> [!TIP]
|
|
143
|
+
> 懒得自己改?直接对 dsh 说「按 docs/SETTINGS.md 把 dsh-dot 的手机存储改成 32 GB」。文档里有写给 agent 的规则,dsh 或其他 agent 照着就能改对。
|
|
144
|
+
|
|
145
|
+
## 🧩 架构
|
|
146
|
+
|
|
147
|
+
一个插件,六个组件。每个都能单独关,缺了哪个其余照常跑。
|
|
148
|
+
|
|
149
|
+
```mermaid
|
|
150
|
+
flowchart LR
|
|
151
|
+
you(["👤 你<br/>QQ / 微信 / 飞书"])
|
|
152
|
+
subgraph dot["dsh-dot"]
|
|
153
|
+
direction TB
|
|
154
|
+
contact["dot<br/>联系人层"]
|
|
155
|
+
interlude["interlude<br/>幕间生活"]
|
|
156
|
+
memory["memory<br/>记忆 · 召回 · 日记"]
|
|
157
|
+
phone["phone<br/>Android 模拟器"]
|
|
158
|
+
qq["qq<br/>NapCat / SnowLuma"]
|
|
159
|
+
computer["computer<br/>microVM(可选)"]
|
|
160
|
+
end
|
|
161
|
+
session(["她的会话<br/>dsh 跑对话"])
|
|
162
|
+
|
|
163
|
+
you <-->|消息| qq
|
|
164
|
+
you <-->|dsh-im| contact
|
|
165
|
+
phone -->|通知叫醒| session
|
|
166
|
+
qq -->|1–2 s 叫醒| session
|
|
167
|
+
interlude -->|去看 · 玩 · 主动联系| session
|
|
168
|
+
memory -->|画像 + 召回注入| session
|
|
169
|
+
session -->|mcp__dot-phone__*| phone
|
|
170
|
+
session -->|mcp__dot-vm__*| computer
|
|
171
|
+
qq -.运行在.-> computer
|
|
172
|
+
```
|
|
86
173
|
|
|
87
|
-
|
|
174
|
+
| 组件 | 是什么 | 依赖 | 关掉 |
|
|
175
|
+
|---|---|---|---|
|
|
176
|
+
| **`phone`** 📱 | Android 模拟器,以 `mcp__dot-phone__*` 暴露([mobile-mcp](https://github.com/mobile-next/mobile-mcp) 走 adb);任何 App 的通知都能叫醒她 · [文档](docs/phone.md) | 硬件虚拟化 | `DSH_DOT_PHONE=off` |
|
|
177
|
+
| **`interlude`** 🌙 | 幕间:Canon 人设、剧本、连续性、打算、只读的「去看」、可选的主动联系 · [文档](docs/interlude.md) | — | `DSH_DOT_INTERLUDE=off` |
|
|
178
|
+
| **`qq`** 💬 | 她电脑 VM 里的 QQ,和手机同号;`qq_send` 回复、表情包 · [文档](docs/qq.md) | computer | `DSH_DOT_QQ=off` |
|
|
179
|
+
| **`memory`** 🧠 | 画像、人物卡、碎片、日记;15 万 token 交班;自动召回(默认本机 bge-small-zh,可切 SiliconFlow / DashScope) · [文档](docs/memory.md) | — | `DSH_DOT_MEMORY=off` |
|
|
180
|
+
| **`dot`** ◎ | 定时结果 → IM、审批与设备提醒、工作规则、右侧栏状态面板 | [dsh-im](https://github.com/xmanrui/dsh-im) | `DSH_DOT_CONTACT=off` |
|
|
181
|
+
| **`computer`** 🖥️ | 自带 microVM:shell、浏览器、桌面、实时画面、审批、审计 · [文档](docs/computer.md) | [microsandbox](https://github.com/zerocore-ai/microsandbox)(自带)或 Docker | `DSH_DOT_COMPUTER=off` |
|
|
88
182
|
|
|
89
|
-
|
|
183
|
+
## 🕰️ 她的一天
|
|
184
|
+
|
|
185
|
+
| 时刻 | 发生什么 |
|
|
90
186
|
|---|---|
|
|
91
|
-
|
|
|
92
|
-
|
|
|
93
|
-
|
|
|
187
|
+
| **你找她** | QQ 消息 1–2 秒叫醒她的对话;她忙时来的消息攒到那轮结束一起处理,回复按行拆成多条 |
|
|
188
|
+
| **手机响了** | 任何 App 的新通知叫醒她:`[手机通知] QQ · 宽:在吗`。她自己去回,或者不理 |
|
|
189
|
+
| **拿起手机** | 没响也会隔一阵(默认 30 分钟)看一眼,有没回的就回,没事就放下 |
|
|
190
|
+
| **安静下来** | 跑一轮**幕间**:写下这段日子、更新打算、想去看点什么 |
|
|
191
|
+
| **去看 · 玩** | 在独立的「跑腿」会话里用手机看、点赞、评论;截图不进你们的对话,只留一句「刚才拿起手机看了一眼」 |
|
|
192
|
+
| **想找你** | 过了活跃时段、意愿值、每日上限、投递目标四道闸,才发消息给你 |
|
|
193
|
+
| **23:30** | 写今天的日记 |
|
|
194
|
+
|
|
195
|
+
## ⌨️ 命令与文件
|
|
196
|
+
|
|
197
|
+
```text
|
|
198
|
+
/phone [accept|restart|screenshot]
|
|
199
|
+
/interlude [now|advance|seed|preset <code>|canon]
|
|
200
|
+
/dot [test|check]
|
|
201
|
+
/dot memory [now|diary|handoff|recall …]
|
|
202
|
+
/dot people [approve <id>|drop <id>|forget <名字>]
|
|
203
|
+
/qq [install|account|start|qr|backend|owner]
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
**状态面板**:会话顶部 ◎ 按钮打开右侧栏 dot 标签页——设备状态、交班进度、她此刻在做什么、今天的 token,以及**最近 30 场**(每次被叫醒到结束是一场,展开看她做了什么、说了什么)。
|
|
207
|
+
|
|
208
|
+
<details>
|
|
209
|
+
<summary><b>数据都在哪</b></summary>
|
|
210
|
+
|
|
211
|
+
| 路径 | 内容 |
|
|
212
|
+
|---|---|
|
|
213
|
+
| `~/dot/interlude/` | 人设 `canon.json`、剧本 `script.md`、连续性 `state.json`、打算 `intents.json`、看到的东西、每轮原始回复与 token |
|
|
214
|
+
| `~/dot/memory/` | `memory.md`(给你看的)、`diary.md`、`transcript.jsonl`、召回索引 `recall/`、交班记录 |
|
|
215
|
+
| `~/.dsh/phone/` | 模拟器、镜像、AVD;`~/.dsh/dsh-phone*.{log,jsonl,json}` 日志 / 审计 / 设置 |
|
|
94
216
|
| `~/.dsh/dsh-computer*` | 电脑的日志、审计、状态 |
|
|
95
|
-
| `/phone [accept\|restart\|screenshot]` · `/interlude [now\|advance\|seed\|preset <code>\|canon]` · `/dot [test\|check]` · `/dot memory [now\|diary\|handoff\|recall …]` · `/dot people [approve <id>\|drop <id>\|forget <名字>]` | 各组件的状态和操作 |
|
|
96
|
-
| 右侧栏 **dot** 标签页(会话顶部 ◎ 按钮) | 一页看全:手机 / 电脑 QQ / 电脑 状态、她的对话交班进度、她此刻在做什么和打算、今天的轮数 / 玩 / 去看 / 叫醒 / token、**最近 30 场**(每次被叫醒到那轮结束是一场:时间 · 进行中/完成 · 来源〔你 / QQ 某人 / 手机·某 App / 拿手机 / 幕间 / 定时 / 玩〕,展开是这一场做的事——回 QQ、发图、存表情、看了、点赞、写日记、去看、主动联系、审批……每条带她的原话,底部是工具 / 模型次数和 token;全部从已有的审计、记录尾部读出,不另写文件)、记忆用量、日记、最近两段剧本。只读,3 秒刷新;页面由 `dsh-dot/dot` 挂在 dsh 自己的 web server 上(`/dsh-dot/panel/`),不开新端口 |
|
|
97
|
-
| 安全边界 | 手机实时画面与控制(`/dsh-dot/phone/`)和 dot 面板都挂在 dsh 的 web server 上,每个请求先过 dsh 的 `connection` 服务(dsh 登录态 + Host/Origin 围栏,不信任任何转发头)——插件不自带鉴权、不开自己的端口。电脑的实时桌面同样挂在 dsh 的 web server 上(`/dsh-dot/computer/`,含 VNC 的 WebSocket),由插件带密钥中继给虚拟机网关;网关端口(`127.0.0.1:18080`)只绑本机回环且要求密钥(`SANDBOX_API_KEY`,每台机器自动生成在 `~/.dsh/dsh-computer.key`),只有插件内部持有。若要从外面看,请暴露 dsh 本身而不是这个端口 |
|
|
98
217
|
|
|
99
|
-
|
|
218
|
+
</details>
|
|
100
219
|
|
|
101
|
-
|
|
220
|
+
<details>
|
|
221
|
+
<summary><b>安全边界</b></summary>
|
|
102
222
|
|
|
103
|
-
-
|
|
104
|
-
-
|
|
105
|
-
-
|
|
106
|
-
-
|
|
107
|
-
- **用小号**。
|
|
223
|
+
- 手机实时画面、dot 面板、电脑实时桌面都挂在 dsh 自己的 web server 上(`/dsh-dot/*`),每个请求先过 dsh 的 `connection` 服务(登录态 + Host/Origin 围栏)。插件不开自己的端口、不自带鉴权。
|
|
224
|
+
- 虚拟机网关只绑 `127.0.0.1:18080`,要求密钥(每台机器自动生成在 `~/.dsh/dsh-computer.key`),只有插件内部持有。
|
|
225
|
+
- **「你」只有一个来源**:`/qq owner` 指定的号。手机通知上的昵称谁都能改,永远不算你的指令。
|
|
226
|
+
- 她看到什么、为什么没出声、哪次工具被拒,`calls.jsonl` 和审计日志里都有。
|
|
108
227
|
|
|
109
|
-
|
|
228
|
+
</details>
|
|
110
229
|
|
|
111
|
-
|
|
230
|
+
## 🤝 与其他插件共存
|
|
112
231
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
- **每个组件都能单独关**,在启动 dsh 的环境里设:
|
|
232
|
+
<details>
|
|
233
|
+
<summary><b>装别的插件前先看一眼</b></summary>
|
|
116
234
|
|
|
117
|
-
|
|
235
|
+
- **电脑组件开着时会改全局设置**:subprocess provider 换成虚拟机里的、`sandbox-policy` 设为 `danger-full-access`(虚拟机才是隔离边界)、权限预设改写成 `computer` / `computer-auto`。所以不要同时装别的沙箱 / subprocess / 权限预设插件;要用就 `DSH_DOT_COMPUTER=off`。
|
|
236
|
+
- **MCP 工具名有命名空间**:`mcp__dot-vm__*`、`mcp__dot-phone__*`,前缀定义在 `src/tool-prefixes.js`。
|
|
237
|
+
- **记忆共存**:`DSH_DOT_MEMORY_COEXIST` 默认 `auto`,发现 `hermesMemory` / `autoMemory` / `dshMemory` / `memoryBank` 等就切到 `people-only`,只保留人物卡、碎片、日记,免得两个插件一起"讲记忆"。`full` / `people-only` 可强制。
|
|
238
|
+
- **一个 QQ 号只能有一个应答者**:不要在她的号上再跑别的 OneBot 机器人。
|
|
239
|
+
- **`bash` 也过电脑闸门**:别的插件再给 `bash` 加审批,同一条命令会弹两次。
|
|
240
|
+
- **上下文压缩插件**:dsh-dot 注入的消息带固定 `source`,压缩时请保留、别当成用户原话:
|
|
241
|
+
|
|
242
|
+
| source | 含义 |
|
|
118
243
|
|---|---|
|
|
119
|
-
|
|
|
120
|
-
| phone |
|
|
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
|
-
|
|
244
|
+
| `{ kind: 'dsh-dot', form: 'phone-notification' }` | 手机通知叫醒 |
|
|
245
|
+
| `{ kind: 'dsh-dot', form: 'phone-check' }` | 定时看手机 |
|
|
246
|
+
| `{ kind: 'dsh-dot', form: 'errand-note' }` | 跑腿结果回写 |
|
|
247
|
+
| `{ kind: 'dsh-interlude', form: 'observation' \| 'play' }` | 幕间观察 / 玩 |
|
|
248
|
+
| `{ kind: 'handoff', generation }` | 记忆交班 |
|
|
249
|
+
| `{ kind: 'user', rpcId: 'qq-…' }` | 主人的 QQ 消息(普通用户消息) |
|
|
250
|
+
|
|
251
|
+
</details>
|
|
252
|
+
|
|
253
|
+
<details>
|
|
254
|
+
<summary><b>从旧版本升级</b></summary>
|
|
255
|
+
|
|
256
|
+
- **v0.9 起 npm 包名是 `dsh-dot-life`**(`dsh-dot` 在 npm 上被占;v0.8.x 的 `@kevinwu901113/dsh-dot` 已 deprecated)。装过旧名的先 `dsh plugin --profile desktop remove @kevinwu901113/dsh-dot` 再装,`~/dot`、`~/.dsh/phone`、虚拟机都不用动。
|
|
257
|
+
- **v0.9.2 起工具名带命名空间**:`mcp__vm__*` → `mcp__dot-vm__*`,`mcp__phone__*` → `mcp__dot-phone__*`。
|
|
258
|
+
- `dsh-computer`(v0.1–0.5)和 `dsh-interlude` 曾是独立插件,v0.3 / v0.4 起并入,git 历史一并合入。装过的先 `remove dsh-computer dsh-interlude`。
|
|
259
|
+
|
|
260
|
+
</details>
|
|
261
|
+
|
|
262
|
+
## 💡 设计原则
|
|
263
|
+
|
|
264
|
+
- **最好的代码是不写代码**:手机用 Google 官方模拟器 + mobile-mcp,电脑用 microsandbox,IM 用 dsh-im,定时用 dsh 内置的,人设用 HDSI 社区预设。
|
|
265
|
+
- **不替她做她该自己做的事**:App 她自己装,日常她自己过。
|
|
266
|
+
- **她只能看,不能瞒着你动**:有后果的动作走审批,或者根本不给。
|
|
267
|
+
- **可审计**:每一轮的原始回复、每一次工具调用都有记录。
|
|
268
|
+
- **用小号**。
|
|
269
|
+
|
|
270
|
+
## 🙏 致谢
|
|
271
|
+
|
|
272
|
+
[HDS-Interlude](https://github.com/REcklessNOLOve117/HDS-Interlude) · [mobile-mcp](https://github.com/mobile-next/mobile-mcp) · [microsandbox](https://github.com/zerocore-ai/microsandbox) · [NapCatQQ](https://github.com/NapNeko/NapCatQQ) · [SnowLuma](https://github.com/SnowLuma/SnowLuma) · [dsh-im](https://github.com/xmanrui/dsh-im) · [Moltbook](https://www.moltbook.com/heartbeat.md) · [memory-system-benchmark](https://github.com/Ornn8/memory-system-benchmark)
|
|
273
|
+
|
|
274
|
+
## 📄 许可证
|
|
275
|
+
|
|
276
|
+
[AGPL-3.0-only](LICENSE)。幕间组件按原文使用 HDS-Interlude(AGPL-3.0)的提示词,所以整个包按 AGPL 发布;v0.3 之前以 MIT 发布的 computer / dot 代码,那些版本仍按 MIT 可用。
|
|
277
|
+
|
|
278
|
+
<div align="center">
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
如果她让你会心一笑,点个 ⭐ 吧
|
|
283
|
+
|
|
284
|
+
[](https://star-history.com/#Kevinwu901113/dsh-dot&Date)
|
|
285
|
+
|
|
286
|
+
</div>
|
package/docs/SETTINGS.md
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# 设置:`~/.dsh/dsh-dot.json`
|
|
2
|
+
|
|
3
|
+
dsh-dot 的所有个人设置都写在**一个文件**里:
|
|
4
|
+
|
|
5
|
+
| 系统 | 路径 |
|
|
6
|
+
|---|---|
|
|
7
|
+
| macOS / Linux | `~/.dsh/dsh-dot.json` |
|
|
8
|
+
| Windows | `%USERPROFILE%\.dsh\dsh-dot.json` |
|
|
9
|
+
| 设了 `DSH_HOME` 时 | `$DSH_HOME/dsh-dot.json` |
|
|
10
|
+
|
|
11
|
+
- 文件不存在就是全用默认值,需要时自己建。
|
|
12
|
+
- 它在插件包外面,**升级插件不会覆盖**;桌面版拿不到终端环境变量,也能用它配置。
|
|
13
|
+
- **改完重启 dsh 才生效**(退出桌面版再打开)。
|
|
14
|
+
- 文件写坏了(不是合法 JSON)会被整个忽略,日志里有一行 `dsh-dot.json ignored`。
|
|
15
|
+
|
|
16
|
+
## 让 dsh(或别的 agent)帮你改
|
|
17
|
+
|
|
18
|
+
把下面这段连同你的需求发给 dsh 即可:
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
帮我改 dsh-dot 的设置:<你的需求,例如"手机存储改成 32 GB,晚上 1 点前都算她的活跃时间">。
|
|
22
|
+
设置文件是 ~/.dsh/dsh-dot.json,说明在 https://github.com/Kevinwu901113/dsh-dot/blob/main/docs/SETTINGS.md 。
|
|
23
|
+
先读这份说明,再读现有的设置文件,只改需要的键,保留其他内容,改完告诉我要不要重启、有没有只在新建时生效的项。
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**给 agent 的规则**(dsh、Claude、Codex 等改这个文件时照做):
|
|
27
|
+
|
|
28
|
+
1. 先读现有文件;不存在就新建 `{}`。只增改相关的键,**不要删别的段和键**。
|
|
29
|
+
2. 顶层按组件分段:`phone`、`computer`、`gate`、`qq`、`memory`、`interlude`、`dot`。键名和类型照下面的表,不要发明新键。
|
|
30
|
+
3. 写合法 JSON(不能有注释、尾逗号)。想留说明就用 `_` 开头的键,如 `"_note": "..."`,会被忽略。
|
|
31
|
+
4. 下文标 **🔒 建立时** 的项只对新建的手机 / 虚拟机生效,改之前先告诉用户要重建、会丢什么,得到同意再动。
|
|
32
|
+
5. 有专门命令的(`/phone size`、`/dot memory recall …`、`/qq owner` 等),优先告诉用户用命令,命令不用重启。
|
|
33
|
+
6. 改完提醒用户重启 dsh。
|
|
34
|
+
|
|
35
|
+
## 示例
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"phone": { "dataGb": 32, "ramMb": 4096 },
|
|
40
|
+
"computer": { "rootDisk": "32G", "memory": "6G", "cpus": 4 },
|
|
41
|
+
"qq": { "githubProxy": "https://ghfast.top/", "groupPolicy": "score" },
|
|
42
|
+
"memory": { "dailyAt": "01:30" },
|
|
43
|
+
"interlude": { "activeHours": "09:00-01:00", "speak": true },
|
|
44
|
+
"dot": { "phoneCheckEveryMinutes": 60 }
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 常见需求
|
|
49
|
+
|
|
50
|
+
| 我想… | 改什么 | 注意 |
|
|
51
|
+
|---|---|---|
|
|
52
|
+
| **手机存储大一点** | 建手机前:`/phone size 32`,或 `/phone accept 32`,或 `phone.dataGb`(8–256) | 🔒 建立时。手机建好后**扩不了**(改 AVD 的 `config.ini` 实测无效)。已经满了:卸 App、清 App 数据;或者删掉 `~/.dsh/phone/avd/dot.avd/` 和 `dot.ini` 重建(手机里的 App 和登录全丢),重建前先 `/phone size <GB>` |
|
|
53
|
+
| 手机内存 / 机型 / 语言 / 时区 | `phone.ramMb`、`phone.device`、`phone.locale`、`phone.timezone` | `ramMb`、`device` 🔒 建立时(同上,删 AVD 重建) |
|
|
54
|
+
| 不显示模拟器窗口 | `phone.window: false` | 画面仍可在 dsh 的手机标签页看 |
|
|
55
|
+
| **电脑磁盘大一点** | `computer.rootDisk`,如 `"32G"` | 🔒 建立时。已有虚拟机扩不了,要重建:`msb rm -f dsh-computer` 并删 `~/.microsandbox/snapshots/dsh-computer/`(见 [computer.md](computer.md#六维护)),装过的东西和 QQ 登录会丢。0.11.3 之前建的虚拟机只有约 4 GB |
|
|
56
|
+
| 电脑内存 / CPU | `computer.memory`(如 `"6G"`)、`computer.cpus` | 重启 dsh 生效 |
|
|
57
|
+
| 电脑里 QQ 报 `no space left` / `ENOSPC` | 先 `/qq clean`(清缓存和残留),还不够 `/qq clean napcat`(用 SnowLuma 时删掉 NapCat) | 根治是加大 `computer.rootDisk` 重建 |
|
|
58
|
+
| 共享文件夹给电脑 | `computer.mounts: ["/Users/你/Projects/a"]` | |
|
|
59
|
+
| 国内网络下载慢 | QQ 安装:`qq.githubProxy`;召回模型:`/dot memory recall mirror <url>`(默认已走 hf-mirror);虚拟机镜像:`computer.image` 换镜像源 | |
|
|
60
|
+
| 召回换云端 / 关掉 | `/dot memory recall backend siliconflow`,再 `/dot memory recall key siliconflow <key>` | 命令即时生效,不用重启,也不用改这个文件 |
|
|
61
|
+
| **她的作息** | `interlude.activeHours`(如 `"09:00-01:00"`,可跨午夜)、`interlude.advanceEveryMinutes`(自己过日子的间隔,0 关)、`interlude.maxRoundsPerDay` | 活跃时段外不跑幕间、不主动找你 |
|
|
62
|
+
| 日记时间 | `memory.dailyAt`(默认 `"23:30"`) | |
|
|
63
|
+
| **让她主动找你** | `interlude.speak: true`,`interlude.maxContactsPerDay`、`interlude.willingnessThreshold`(0–1,越低越爱找你) | 默认关 |
|
|
64
|
+
| 拿手机看的频率 | `dot.phoneCheckEveryMinutes`(默认 30,0 关) | |
|
|
65
|
+
| 夜里通知不叫醒她 | `dot.notifyHours: "08:00-23:00"`(只有这个时段内通知才叫醒) | 默认空 = 任何时候都叫醒 |
|
|
66
|
+
| 某个 App 的通知别叫醒她 | `/phone notify mute <包名>` | 命令即时生效 |
|
|
67
|
+
| 群聊里插话的规则 | `qq.groupPolicy`:`mention`(被 @ 才回,默认)/ `score`(按价值评分,配 `qq.scoreThreshold` 0–10)/ `all` / `none` | |
|
|
68
|
+
| 回复不拆条、不模拟打字 | `qq.typingMsPerChar: 0` | |
|
|
69
|
+
| 发 QQ 的审批松紧 | `qq.sendPolicy`:`reply`(默认)/ `always` / `off` | |
|
|
70
|
+
| 她逛 / 玩的 App | `interlude.phoneApps`(站点 → 包名)、`interlude.playApps`(名字 → 包名)、`interlude.play: false` 关掉「玩」 | 只对她自己装了的 App 生效 |
|
|
71
|
+
| 省 token | `interlude.maxRoundsPerDay`、`interlude.browseDailyCap`、`memory.handoffTokens`(交班阈值,默认 150000)、`dot.phoneCheckEveryMinutes` 调大 | 每轮用量在 `~/dot/interlude/calls.jsonl`、`~/dot/memory/calls.jsonl` |
|
|
72
|
+
| 和别的记忆插件一起用 | `memory.coexist`:`auto`(默认)/ `people-only` / `full` | |
|
|
73
|
+
| 电脑审批多 / 少 | `gate.mode`:`risky`(默认)/ `browser`(每个浏览器动作都问)/ `off` | |
|
|
74
|
+
| 换她的家目录 | `dot.home`、`memory.home`、`interlude.home` **三处写同一个路径** | 默认 `~/dot` |
|
|
75
|
+
| **没有硬件虚拟化 / 不要手机** | `phone.enabled: false` | |
|
|
76
|
+
| 关掉某个组件 | `qq.enabled`、`memory.enabled`、`interlude.enabled`、`dot.enabled` 设 `false` | 其余组件照常 |
|
|
77
|
+
| **不要电脑** | 只能用环境变量 `DSH_DOT_COMPUTER=off`(见下) | 电脑组件会改 dsh 的全局沙箱设置,必须在插件加载前决定,设置文件来不及 |
|
|
78
|
+
|
|
79
|
+
### 设置环境变量(只有关电脑等少数项需要)
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# macOS 桌面版:设完退出并重开 dsh
|
|
83
|
+
launchctl setenv DSH_DOT_COMPUTER off
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
```powershell
|
|
87
|
+
# Windows:设完重开 dsh
|
|
88
|
+
setx DSH_DOT_COMPUTER off
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## 全部键
|
|
92
|
+
|
|
93
|
+
只列常改的;完整列表和含义见各组件文档:[phone](phone.md)、[computer](computer.md)、[qq](qq.md)、[memory](memory.md)、[interlude](interlude.md)。源码里每个组件的 `defaults` 就是全集。
|
|
94
|
+
|
|
95
|
+
### `phone`
|
|
96
|
+
|
|
97
|
+
| 键 | 默认 | 作用 |
|
|
98
|
+
|---|---|---|
|
|
99
|
+
| `enabled` | `true` | `false` 关掉手机 |
|
|
100
|
+
| `dataGb` | `16` | 存储(GB,8–256)🔒 建立时 |
|
|
101
|
+
| `ramMb` | `3072` | 内存 🔒 建立时 |
|
|
102
|
+
| `device` | `"pixel_6"` | 机型 🔒 建立时 |
|
|
103
|
+
| `api` / `abi` | `35` / 跟随 CPU | 系统镜像 🔒 建立时 |
|
|
104
|
+
| `locale` / `timezone` | `"zh-CN"` / `"Asia/Shanghai"` | 语言、时区 |
|
|
105
|
+
| `window` | `true` | 显示模拟器窗口 |
|
|
106
|
+
| `gpu` | `"auto"` | 模拟器 GPU 模式 |
|
|
107
|
+
| `notifyMuted` | `[]` | 不叫醒她的包名(也可用 `/phone notify mute`) |
|
|
108
|
+
| `keepAppsAlive` | `true` | 不让后台 App 被冻结(聊天 App 收消息靠它) |
|
|
109
|
+
| `publicUrl` | `""` | 你对外暴露的 dsh 地址,用于实时画面链接 |
|
|
110
|
+
|
|
111
|
+
### `computer`
|
|
112
|
+
|
|
113
|
+
| 键 | 默认 | 作用 |
|
|
114
|
+
|---|---|---|
|
|
115
|
+
| `rootDisk` | `"16G"` | 磁盘 🔒 建立时 |
|
|
116
|
+
| `memory` / `cpus` | `"4G"` / `2` | 资源上限 |
|
|
117
|
+
| `mounts` | `[]` | 共享文件夹 |
|
|
118
|
+
| `backend` | `"auto"` | `microsandbox` / `docker` |
|
|
119
|
+
| `image` | `ghcr.io/agent-infra/sandbox:latest` | 镜像 |
|
|
120
|
+
| `publicUrl` | `""` | 你对外暴露的 dsh 地址 |
|
|
121
|
+
|
|
122
|
+
网关端口只能用环境变量 `DSH_COMPUTER_PORT` 改。
|
|
123
|
+
|
|
124
|
+
### `gate`
|
|
125
|
+
|
|
126
|
+
| 键 | 默认 | 作用 |
|
|
127
|
+
|---|---|---|
|
|
128
|
+
| `mode` | `"risky"` | `off` / `risky` / `browser` |
|
|
129
|
+
|
|
130
|
+
分类表(`readOnlyTools`、`alwaysAskTools`、`protectedPaths`、`shellPatterns` 等)也可以在这里覆盖,见 [computer.md](computer.md)。
|
|
131
|
+
|
|
132
|
+
### `qq`
|
|
133
|
+
|
|
134
|
+
| 键 | 默认 | 作用 |
|
|
135
|
+
|---|---|---|
|
|
136
|
+
| `enabled` | `true` | `false` 关掉 |
|
|
137
|
+
| `backend` | `"napcat"` | `snowluma`(也可 `/qq backend`) |
|
|
138
|
+
| `qq` / `owner` | `""` | 她的号 / 你的号(建议用 `/qq account`、`/qq owner`) |
|
|
139
|
+
| `githubProxy` | `""` | GitHub 下载镜像前缀,如 `https://ghfast.top/` |
|
|
140
|
+
| `groupPolicy` | `"mention"` | `mention` / `score` / `all` / `none` |
|
|
141
|
+
| `scoreThreshold` | `7` | `score` 模式的插话门槛(0–10) |
|
|
142
|
+
| `sendPolicy` | `"reply"` | `reply` / `always` / `off` |
|
|
143
|
+
| `replyWindowMinutes` | `30` | `reply` 模式下多久内算"对方找过她" |
|
|
144
|
+
| `typingMsPerChar` | `60` | 分条发送的打字停顿,0 一次发完 |
|
|
145
|
+
| `tidy` | `true` | 去掉句号、引号、破折号等书面符号 |
|
|
146
|
+
|
|
147
|
+
### `memory`
|
|
148
|
+
|
|
149
|
+
| 键 | 默认 | 作用 |
|
|
150
|
+
|---|---|---|
|
|
151
|
+
| `enabled` | `true` | `false` 关掉 |
|
|
152
|
+
| `home` | `~/dot` | 和 `dot.home`、`interlude.home` 保持一致 |
|
|
153
|
+
| `handoffTokens` | `150000` | 对话多长换新会话 |
|
|
154
|
+
| `dailyAt` | `"23:30"` | 每天整理 + 写日记的时间 |
|
|
155
|
+
| `coexist` | `"auto"` | `auto` / `people-only` / `full` |
|
|
156
|
+
| `recallBackend` | `"local"` | `local` / `siliconflow` / `dashscope` / `off`(建议用 `/dot memory recall backend`,命令设的值优先) |
|
|
157
|
+
| `recallTopK` / `recallMaxTokens` / `recallMinScore` | `8` / `1500` / `0.45` | 每次叫醒注入多少旧对话 |
|
|
158
|
+
| `recallMirror` | `""` | 本机模型下载镜像,默认 hf-mirror |
|
|
159
|
+
|
|
160
|
+
### `interlude`
|
|
161
|
+
|
|
162
|
+
| 键 | 默认 | 作用 |
|
|
163
|
+
|---|---|---|
|
|
164
|
+
| `enabled` | `true` | `false` 关掉 |
|
|
165
|
+
| `home` | `~/dot` | 和另外两处保持一致 |
|
|
166
|
+
| `activeHours` | `"08:00-23:00"` | 活跃时段 |
|
|
167
|
+
| `idleMinutes` | `10` | 聊天安静多久后跑一轮 |
|
|
168
|
+
| `advanceEveryMinutes` | `180` | 自己过日子的间隔,0 关 |
|
|
169
|
+
| `maxRoundsPerDay` | `12` | 每天最多几轮 |
|
|
170
|
+
| `browseDailyCap` / `vmDailyCap` | `6` / `2` | 每天「去看」上限 |
|
|
171
|
+
| `vmSites` | `[]` | 用电脑浏览器看的网站(她登录过的) |
|
|
172
|
+
| `phoneApps` / `playApps` | 内置表 | 逛 / 玩的 App |
|
|
173
|
+
| `play` | `true` | 「玩」(点赞、评论、关注) |
|
|
174
|
+
| `speak` | `false` | 主动找你 |
|
|
175
|
+
| `maxContactsPerDay` / `willingnessThreshold` | `2` / `0.6` | 主动联系的上限和门槛 |
|
|
176
|
+
| `presetHub` | `https://typ0.space` | HDSI 预设站 |
|
|
177
|
+
|
|
178
|
+
### `dot`
|
|
179
|
+
|
|
180
|
+
| 键 | 默认 | 作用 |
|
|
181
|
+
|---|---|---|
|
|
182
|
+
| `enabled` | `true` | `false` 关掉联系人层 |
|
|
183
|
+
| `home` | `~/dot` | 和另外两处保持一致 |
|
|
184
|
+
| `phoneCheckEveryMinutes` | `30` | 隔多久拿起手机看一眼,0 关 |
|
|
185
|
+
| `notifyHours` | `""` | 只在这个时段内通知叫醒她;空 = 一直 |
|
|
186
|
+
| `notifyBatchMs` | `1000` | 多少毫秒内的通知合并成一次叫醒 |
|
|
187
|
+
| `errandMaxTokens` | `60000` | 跑腿会话多长换新 |
|
|
188
|
+
| `imBot` / `imTarget` | `""` | dsh-im 的投递目标,空 = 第一个 |
|
|
189
|
+
|
|
190
|
+
## 优先级和旧文件
|
|
191
|
+
|
|
192
|
+
从弱到强:组件默认值 → 旧的单组件文件(`~/.dsh/dsh-phone.json`、`dsh-computer.json`、`dsh-qq.json`)→ 插件自带的 `cordis.patch.yml` → **`dsh-dot.json`** → 命令设的值(`/phone size`、`/phone accept`、`/dot memory recall …` 写进 `dsh-phone.json` / `dsh-memory.json`)。
|
|
193
|
+
|
|
194
|
+
旧文件继续有效,不用迁移;新设置写进 `dsh-dot.json` 就行。不要去改 `node_modules` 里插件自带的 `cordis.patch.yml`,升级会被覆盖。
|
package/docs/phone.md
CHANGED
|
@@ -70,3 +70,7 @@ An Android phone the plugin installs and runs for the character, exposed to the
|
|
|
70
70
|
- mobile-mcp 的工具每次调用都要带 `device`,模型偶尔会忘;提示段里给了设备号。
|
|
71
71
|
- 多台手机未做。
|
|
72
72
|
- 数据分区建好后不能扩大(改 `config.ini` 的 `disk.dataPartition.size` 不生效,实测);满了只能清 App 数据、卸 App,或清空重建。
|
|
73
|
+
|
|
74
|
+
## 模拟器挂了
|
|
75
|
+
|
|
76
|
+
接管的模拟器(上次 dsh 留下的)不是我们的子进程,QEMU 卡死崩溃(11-03:所有 QEMU 线程 15 秒无响应后 crash)时没有退出事件。所以就绪后每 `aliveEveryMs`(15 s)问一次 `adb get-state`,连续 3 次没回应就记 `emulator-gone`、状态转 error、停通知监听,`restartDelayMs` 后像退出一样重开。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-dot-life",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.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/src/computer/gate.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
import { VM_TOOL_PREFIX } from '../tool-prefixes.js';
|
|
12
12
|
import { clip } from './audit.js';
|
|
13
|
+
import { sectionOf } from '../settings.js';
|
|
13
14
|
|
|
14
15
|
export const name = 'dot-gate';
|
|
15
16
|
export const inject = ['tools', 'dshComputer'];
|
|
@@ -84,7 +85,7 @@ export function decide(call, cfg, compiled = compile(cfg)) {
|
|
|
84
85
|
}
|
|
85
86
|
|
|
86
87
|
export function apply(ctx, config = {}) {
|
|
87
|
-
const cfg = { ...defaults, ...config };
|
|
88
|
+
const cfg = { ...defaults, ...config, ...sectionOf('gate', (m) => ctx.logger?.('dsh-dot/gate')?.warn?.(m)) };
|
|
88
89
|
const vm = ctx.dshComputer;
|
|
89
90
|
const audit = (entry) => vm.audit?.(entry);
|
|
90
91
|
const sessionOf = (exec) => exec.agent?.session?.id;
|
package/src/computer/vm.js
CHANGED
|
@@ -13,6 +13,7 @@ import { createAudit } from './audit.js';
|
|
|
13
13
|
import { computerApiKey, keyHeaders, KEY_HEADER } from './key.js';
|
|
14
14
|
import { mountComputerView, LIVE_VIEW_PAGE } from './live-view.js';
|
|
15
15
|
import { localUrl, publicUrlOf } from '../web-auth.js';
|
|
16
|
+
import { sectionOf, setValues } from '../settings.js';
|
|
16
17
|
|
|
17
18
|
export const name = 'dot-computer';
|
|
18
19
|
|
|
@@ -203,8 +204,10 @@ export async function ensureServices(config, computer, logger) {
|
|
|
203
204
|
}
|
|
204
205
|
|
|
205
206
|
export function apply(ctx, config = {}) {
|
|
206
|
-
const cfg = { ...defaults, ...readSettingsFile(), ...Object.fromEntries(Object.entries(config).filter(([, v]) => v !== undefined && v !== '' && !(Array.isArray(v) && !v.length))) };
|
|
207
207
|
const logger = withFileLog(ctx.logger('dsh-computer'));
|
|
208
|
+
// The gateway port is fixed by the patch (DSH_COMPUTER_PORT): the UI relay and the gate read the same value.
|
|
209
|
+
const { port: _port, ...user } = sectionOf('computer', (m) => logger.warn(m));
|
|
210
|
+
const cfg = { ...defaults, ...readSettingsFile(), ...setValues(config, { dropEmptyArrays: true }), ...user };
|
|
208
211
|
const apiKey = computerApiKey(cfg.apiKey);
|
|
209
212
|
const backend = pickBackend({ ...cfg, apiKey }, logger);
|
|
210
213
|
const base = `http://127.0.0.1:${cfg.port}`;
|
package/src/dot/core.js
CHANGED
|
@@ -18,6 +18,7 @@ import { homedir } from 'node:os';
|
|
|
18
18
|
import { join, relative, isAbsolute } from 'node:path';
|
|
19
19
|
import { createUserMessage } from '@deepseek-ai/dsh-llm';
|
|
20
20
|
import { mountPanel } from './panel.js';
|
|
21
|
+
import { sectionOf, setValues } from '../settings.js';
|
|
21
22
|
|
|
22
23
|
export const name = 'dsh-dot';
|
|
23
24
|
// Devices are optional components: the computer (dshComputer) and the phone (dshPhone). dot works
|
|
@@ -34,7 +35,7 @@ export const PHONE_NOTIFICATION_SOURCE = Object.freeze({ kind: 'dsh-dot', form:
|
|
|
34
35
|
* treats them as direct human input — which is what lets a QQ message start a long task (goal).
|
|
35
36
|
* Nobody else's messages get this.
|
|
36
37
|
*/
|
|
37
|
-
export const ownerSource = () => ({ kind: 'user', rpcId: `qq-${Math.random().toString(36).slice(2)}${Date.now().toString(36)}` });
|
|
38
|
+
export const ownerSource = () => ({ kind: 'user', rpcId: `qq-dot-${Math.random().toString(36).slice(2)}${Date.now().toString(36)}` });
|
|
38
39
|
/** Source of the periodic "pick up your phone" turn; not pushed to IM either. */
|
|
39
40
|
export const PHONE_CHECK_SOURCE = Object.freeze({ kind: 'dsh-dot', form: 'phone-check' });
|
|
40
41
|
/** The periodic turn: she picks up her phone the way people do between things. */
|
|
@@ -130,7 +131,10 @@ export function errandNote(origin, text) {
|
|
|
130
131
|
const dshHome = () => process.env.DSH_HOME || join(homedir(), '.dsh');
|
|
131
132
|
/** dsh-im tags messages it relays with an rpcId of `<channel>-<uuid>`; the desktop UI does not. */
|
|
132
133
|
export const IM_RPC = /^(weixin|wechat|qq|feishu|lark|dingtalk|wecom|wework|telegram|discord|slack|whatsapp|email|office)-/i;
|
|
133
|
-
|
|
134
|
+
// "qq-dot-…" is our own tag (ownerSource): his QQ words relayed by dot, not a dsh-im bot session —
|
|
135
|
+
// counting those made her conversation an "IM bot session", which the memory handoff leaves alone
|
|
136
|
+
// (11-03: 456k tokens, no handoff since 10-29).
|
|
137
|
+
export const isImMessage = (m) => { const r = String(m?.source?.rpcId ?? ''); return IM_RPC.test(r) && !r.startsWith('qq-dot-'); };
|
|
134
138
|
const inside = (root, p) => { const r = relative(root, p); return r === '' || (!r.startsWith('..') && !isAbsolute(r)); };
|
|
135
139
|
/** 'HH:MM-HH:MM' (may wrap midnight) → is `date` inside it? Empty spec = always. */
|
|
136
140
|
export function inHours(spec, date = new Date()) {
|
|
@@ -207,8 +211,9 @@ export function createNotifier(getIm, cfg, logger, getQq = () => undefined) {
|
|
|
207
211
|
|
|
208
212
|
export function apply(ctx, config = {}) {
|
|
209
213
|
// An empty string means "not set", except for notifyHours, where '' is documented as "always".
|
|
210
|
-
const cfg = { ...defaults, ...Object.fromEntries(Object.entries(config).filter(([k, v]) => v !== undefined && (v !== '' || k === 'notifyHours'))) };
|
|
211
214
|
const logger = ctx.logger('dsh-dot');
|
|
215
|
+
const cfg = { ...defaults, ...setValues(config, { keepEmpty: ['notifyHours'] }), ...sectionOf('dot', (m) => logger.warn(m)) };
|
|
216
|
+
if (cfg.enabled === false) { logger.info('off (dsh-dot.json: dot.enabled = false)'); return; }
|
|
212
217
|
const computer = () => ctx.get('dshComputer');
|
|
213
218
|
const phone = () => ctx.get('dshPhone');
|
|
214
219
|
const audit = (event, data = {}) => (computer()?.audit ?? phone()?.audit)?.({ kind: 'dot', event, ...data });
|
package/src/dot/panel.js
CHANGED
|
@@ -106,7 +106,7 @@ const at=(ms)=>ms?new Date(ms).toLocaleString('zh-CN',{month:'numeric',day:'nume
|
|
|
106
106
|
const badge=(cls,label,text)=>'<span class="badge '+cls+'"><i class="dotc"></i>'+esc(label)+(text?' <span class="mute">'+esc(text)+'</span>':'')+'</span>';
|
|
107
107
|
const tile=(n,label)=>'<div class="tile"><b>'+esc(n)+'</b><span>'+esc(label)+'</span></div>';
|
|
108
108
|
const bar=(v,max)=>'<div class="bar"><i style="width:'+Math.min(100,Math.round(100*(v||0)/(max||1)))+'%"></i></div>';
|
|
109
|
-
const ZH
|
|
109
|
+
const ZH=true; // the rest of this page is Chinese; Electron's navigator.language said en on a Chinese Mac
|
|
110
110
|
const T=ZH?{title:(n)=>'最近 '+n+' 场',none:'还没有记录(她被叫醒、幕间、玩过之后这里会出现)',run:'进行中',done:'完成',fail:'出错',quiet:'没出声',tools:'工具',model:'模型',times:' 次',tin:'token 入',tout:'出',
|
|
111
111
|
src:{owner:'你',qq:'QQ',phone:'手机',check:'拿手机',interlude:'幕间',schedule:'定时',play:'玩'},
|
|
112
112
|
phase:{advance:'推进','follow-up':'跟进',intent:'打算到点',seed:'开场',diary:'日记'},
|
package/src/interlude/core.js
CHANGED
|
@@ -20,6 +20,7 @@ import { appendFileSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
|
|
|
20
20
|
import { homedir } from 'node:os';
|
|
21
21
|
import { join, relative, isAbsolute } from 'node:path';
|
|
22
22
|
import { createUserMessage } from '@deepseek-ai/dsh-llm';
|
|
23
|
+
import { sectionOf, setValues } from '../settings.js';
|
|
23
24
|
|
|
24
25
|
export const name = 'dot-interlude';
|
|
25
26
|
export const inject = ['llm', 'agentDefaultModel'];
|
|
@@ -500,8 +501,9 @@ export async function fetchPreset(hub, code, fetchImpl = globalThis.fetch) {
|
|
|
500
501
|
}
|
|
501
502
|
|
|
502
503
|
export function apply(ctx, config = {}) {
|
|
503
|
-
const cfg = { ...defaults, ...Object.fromEntries(Object.entries(config).filter(([, v]) => v !== undefined && v !== '')) };
|
|
504
504
|
const logger = ctx.logger('dsh-interlude');
|
|
505
|
+
const cfg = { ...defaults, ...setValues(config), ...sectionOf('interlude', (m) => logger.warn(m)) };
|
|
506
|
+
if (cfg.enabled === false) { logger.info('off (dsh-dot.json: interlude.enabled = false)'); return; }
|
|
505
507
|
const home = cfg.home || join(homedir(), 'dot');
|
|
506
508
|
const dir = join(home, 'interlude');
|
|
507
509
|
const files = {
|
package/src/memory/memory.js
CHANGED
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
resolvePerson, setOwner, ownerOf, proposeMerge, approveMerge, mergePeople, syncFriends,
|
|
27
27
|
} from './store.js';
|
|
28
28
|
import { createRecall } from './recall.js';
|
|
29
|
+
import { sectionOf, setValues } from '../settings.js';
|
|
29
30
|
|
|
30
31
|
export const name = 'dot-memory';
|
|
31
32
|
export const inject = ['llm', 'agentDefaultModel'];
|
|
@@ -222,9 +223,11 @@ export function renderHandoff(h, tail, gen) {
|
|
|
222
223
|
}
|
|
223
224
|
|
|
224
225
|
export function apply(ctx, config = {}) {
|
|
225
|
-
const cfg = { ...defaults, ...Object.fromEntries(Object.entries(config).filter(([, v]) => v !== undefined && v !== '')) };
|
|
226
|
-
cfg.limits = { ...DEFAULT_LIMITS, ...(config.limits ?? {}) };
|
|
227
226
|
const logger = ctx.logger('dsh-dot/memory');
|
|
227
|
+
const user = sectionOf('memory', (m) => logger.warn(m));
|
|
228
|
+
const cfg = { ...defaults, ...setValues(config), ...user };
|
|
229
|
+
cfg.limits = { ...DEFAULT_LIMITS, ...(config.limits ?? {}), ...(user.limits ?? {}) };
|
|
230
|
+
if (cfg.enabled === false) { logger.info('off (dsh-dot.json: memory.enabled = false)'); return; }
|
|
228
231
|
const home = cfg.home || join(homedir(), 'dot');
|
|
229
232
|
const dir = join(home, 'memory');
|
|
230
233
|
const files = { memory: join(dir, 'memory.json'), md: join(dir, 'memory.md'), transcript: join(dir, 'transcript.jsonl'), handoffs: join(dir, 'handoffs.jsonl'), calls: join(dir, 'calls.jsonl'), diary: join(dir, 'diary.md') };
|
package/src/phone/phone.js
CHANGED
|
@@ -17,6 +17,7 @@ import { systemProxyEnv } from '../computer/backends/proxy.js';
|
|
|
17
17
|
import { mountLiveView, LIVE_VIEW_PATH } from './live-view.js';
|
|
18
18
|
import { localUrl, publicUrlOf } from '../web-auth.js';
|
|
19
19
|
import { createShadeWatch, createPolicy, parseShade } from './notifications.js';
|
|
20
|
+
import { sectionOf, setValues } from '../settings.js';
|
|
20
21
|
|
|
21
22
|
/** The virtual scene's "wall" poster, moved to 1.5 m straight in front of the camera's start pose (1 m square). */
|
|
22
23
|
const WALL_POSTER = ['poster wall', 'size 1 1', 'position 0 0 -1.5', 'rotation 0 0 0', 'default poster.png', ''].join('\n');
|
|
@@ -50,6 +51,7 @@ export const defaults = {
|
|
|
50
51
|
channel: 'stable', // emulator release channel
|
|
51
52
|
bootTimeoutMs: 300_000,
|
|
52
53
|
restartDelayMs: 10_000, // relaunch the emulator this long after it exits by itself
|
|
54
|
+
aliveEveryMs: 15_000, // once ready, adb is asked this often whether the emulator still answers; 3 misses = relaunch
|
|
53
55
|
liveView: true, // the live view page (screen + tap/swipe/type) at /dsh-dot/phone/ on dsh's own web server, behind dsh's login
|
|
54
56
|
publicUrl: '', // the public origin of THIS dsh (your own exposure, e.g. tailscale serve of dsh's port); the live view is <publicUrl>/dsh-dot/phone/
|
|
55
57
|
// Notifications: the phone's notification shade is polled (adb dumpsys) and new ones are handed to
|
|
@@ -213,13 +215,15 @@ async function unzip(zip, into) {
|
|
|
213
215
|
}
|
|
214
216
|
|
|
215
217
|
export function apply(ctx, config = {}, deps = {}) {
|
|
218
|
+
const logger = withFileLog(ctx.logger('dsh-dot/phone'));
|
|
216
219
|
const settings = readSettingsFile();
|
|
217
|
-
const
|
|
220
|
+
const user = sectionOf('phone', (m) => logger.warn(m));
|
|
221
|
+
const cfg = { ...defaults, ...settings, ...setValues(config, { dropEmptyArrays: true }), ...user };
|
|
222
|
+
if (cfg.enabled === false) { logger.info('off (dsh-dot.json: phone.enabled = false)'); return; }
|
|
218
223
|
// The license, once accepted (settings file), stays accepted whatever the patch's default says.
|
|
219
224
|
cfg.acceptLicense = Boolean(cfg.acceptLicense || settings.acceptLicense);
|
|
220
|
-
// The storage size the owner chose (/phone size, /phone accept <GB>) wins over
|
|
225
|
+
// The storage size the owner chose (/phone size, /phone accept <GB>) wins over any file.
|
|
221
226
|
if (settings.dataGb) cfg.dataGb = settings.dataGb;
|
|
222
|
-
const logger = withFileLog(ctx.logger('dsh-dot/phone'));
|
|
223
227
|
const fetchImpl = deps.fetch ?? globalThis.fetch;
|
|
224
228
|
const spawnImpl = deps.spawn ?? spawn;
|
|
225
229
|
const exec = deps.run ?? run;
|
|
@@ -517,6 +521,7 @@ export function apply(ctx, config = {}, deps = {}) {
|
|
|
517
521
|
markReady();
|
|
518
522
|
if (cfg.notifications) shade.start();
|
|
519
523
|
logger.info(`phone ready — ${serial}, Android API ${cfg.api} (${abi}), ${cfg.window ? 'window on the desktop' : 'headless'}`);
|
|
524
|
+
watchAlive();
|
|
520
525
|
await mountMcp();
|
|
521
526
|
} catch (err) {
|
|
522
527
|
if (phone.state !== 'needs-license') {
|
|
@@ -525,6 +530,30 @@ export function apply(ctx, config = {}, deps = {}) {
|
|
|
525
530
|
}
|
|
526
531
|
}
|
|
527
532
|
}
|
|
533
|
+
// An attached emulator (left from an earlier run) is not our child: when QEMU hangs and crashes
|
|
534
|
+
// (11-03: all QEMU threads unresponsive 15 s, then a crash dump), nothing fires 'exit' and the
|
|
535
|
+
// phone stayed "ready" while every adb call said "device not found". So: once ready, ask adb every
|
|
536
|
+
// aliveEveryMs; three misses in a row = gone → error, shade off, relaunch like an exit.
|
|
537
|
+
let aliveTimer = null;
|
|
538
|
+
function watchAlive() {
|
|
539
|
+
if (aliveTimer) clearInterval(aliveTimer);
|
|
540
|
+
let misses = 0;
|
|
541
|
+
aliveTimer = setInterval(async () => {
|
|
542
|
+
if (stopping || phone.state !== 'ready') return;
|
|
543
|
+
let ok = false;
|
|
544
|
+
try { ok = /^device\s*$/.test(String((await exec(paths.adb, ['-s', serial, 'get-state'], { env: env(), timeout: 8_000 })).stdout)); } catch {}
|
|
545
|
+
if (ok) { misses = 0; return; }
|
|
546
|
+
if (++misses < 3) return;
|
|
547
|
+
clearInterval(aliveTimer); aliveTimer = null;
|
|
548
|
+
shade.stop?.();
|
|
549
|
+
audit({ kind: 'emulator-gone', serial });
|
|
550
|
+
setState('error', 'the emulator is gone (crashed or killed); relaunching');
|
|
551
|
+
logger.warn(`${serial} no longer answers adb; relaunching in ${cfg.restartDelayMs / 1000}s`);
|
|
552
|
+
const ours = child; child = null; ours?.removeAllListeners('exit'); try { ours?.kill('SIGKILL'); } catch {}
|
|
553
|
+
setTimeout(() => { if (!stopping) void start(); }, cfg.restartDelayMs).unref?.();
|
|
554
|
+
}, cfg.aliveEveryMs);
|
|
555
|
+
aliveTimer.unref?.();
|
|
556
|
+
}
|
|
528
557
|
/**
|
|
529
558
|
* Stop the emulator and start it again. An emulator dsh attached to (left from an earlier run) is
|
|
530
559
|
* not our child, so nothing would relaunch it on exit: wait until adb no longer lists it, then start.
|
|
@@ -610,6 +639,7 @@ export function apply(ctx, config = {}, deps = {}) {
|
|
|
610
639
|
void start();
|
|
611
640
|
return () => {
|
|
612
641
|
stopping = true;
|
|
642
|
+
if (aliveTimer) { clearInterval(aliveTimer); aliveTimer = null; }
|
|
613
643
|
// The phone keeps running across dsh restarts, like the computer does; only the MCP child is ours.
|
|
614
644
|
mcpFork?.dispose?.();
|
|
615
645
|
};
|
package/src/qq/qq.js
CHANGED
|
@@ -18,6 +18,7 @@ import { join, dirname } from 'node:path';
|
|
|
18
18
|
import { createAudit } from '../computer/audit.js';
|
|
19
19
|
import { QQ_SERVER, QQ_TOOL_PREFIX } from '../tool-prefixes.js';
|
|
20
20
|
import { createStickers, isSticker, STICKER_MAX_BYTES } from './stickers.js';
|
|
21
|
+
import { sectionOf, setValues } from '../settings.js';
|
|
21
22
|
|
|
22
23
|
export const name = 'dot-qq';
|
|
23
24
|
export const inject = [];
|
|
@@ -379,9 +380,10 @@ function withFileLog(logger) {
|
|
|
379
380
|
}
|
|
380
381
|
|
|
381
382
|
export function apply(ctx, config = {}, deps = {}) {
|
|
382
|
-
const settings = readSettingsFile();
|
|
383
|
-
const cfg = { ...defaults, ...settings, ...Object.fromEntries(Object.entries(config).filter(([, v]) => v !== undefined && v !== '')) };
|
|
384
383
|
const logger = withFileLog(ctx.logger('dsh-dot/qq'));
|
|
384
|
+
const settings = readSettingsFile();
|
|
385
|
+
const cfg = { ...defaults, ...settings, ...setValues(config), ...sectionOf('qq', (m) => logger.warn(m)) };
|
|
386
|
+
if (cfg.enabled === false) { logger.info('off (dsh-dot.json: qq.enabled = false)'); return; }
|
|
385
387
|
// Everything below may reach a root shell in the VM: what does not pass is treated as unset.
|
|
386
388
|
const sanitise = (key, check, fallback) => { if (cfg[key] === '' || cfg[key] === undefined) return; try { cfg[key] = check(cfg[key]); } catch (err) { logger.warn(`${key} ignored: ${err.message}`); cfg[key] = fallback; } };
|
|
387
389
|
sanitise('qq', (v) => assertSafeQQ(v), '');
|
package/src/settings.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// One settings file for every component: $DSH_HOME/dsh-dot.json (default ~/.dsh/dsh-dot.json).
|
|
2
|
+
// It lives outside the plugin package, so upgrades never touch it, and the desktop app (which has no
|
|
3
|
+
// shell environment) can still be configured. Each component reads its own section:
|
|
4
|
+
// { "phone": { "dataGb": 32 }, "computer": { "rootDisk": "32G" }, "interlude": { "activeHours": "09:00-01:00" } }
|
|
5
|
+
// Order, weakest first: component defaults → the component's older file (dsh-phone.json …) →
|
|
6
|
+
// the bundled cordis.patch.yml → this file. Values set by commands (/phone size, /dot memory recall …)
|
|
7
|
+
// are applied by each component on top. Read once at startup: restart dsh after editing.
|
|
8
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
9
|
+
import { homedir } from 'node:os';
|
|
10
|
+
import { join } from 'node:path';
|
|
11
|
+
|
|
12
|
+
export const SECTIONS = ['phone', 'computer', 'gate', 'qq', 'memory', 'interlude', 'dot'];
|
|
13
|
+
|
|
14
|
+
export const dshHome = () => process.env.DSH_HOME || join(homedir(), '.dsh');
|
|
15
|
+
export const settingsPath = () => join(dshHome(), 'dsh-dot.json');
|
|
16
|
+
|
|
17
|
+
/** The whole file, or {} when it is missing. A broken file is reported once per read through `warn`. */
|
|
18
|
+
export function readAll(warn) {
|
|
19
|
+
const file = settingsPath();
|
|
20
|
+
if (!existsSync(file)) return {};
|
|
21
|
+
try {
|
|
22
|
+
const all = JSON.parse(readFileSync(file, 'utf8'));
|
|
23
|
+
return all && typeof all === 'object' && !Array.isArray(all) ? all : {};
|
|
24
|
+
} catch (err) {
|
|
25
|
+
warn?.(`${file} ignored: ${err.message}`);
|
|
26
|
+
return {};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** One component's section. Keys starting with '_' (comments) are dropped. */
|
|
31
|
+
export function sectionOf(name, warn) {
|
|
32
|
+
const s = readAll(warn)[name];
|
|
33
|
+
if (!s || typeof s !== 'object' || Array.isArray(s)) return {};
|
|
34
|
+
return Object.fromEntries(Object.entries(s).filter(([k, v]) => !k.startsWith('_') && v !== undefined));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Patch config without the values that mean "not set" (undefined, '', and optionally []). */
|
|
38
|
+
export const setValues = (config = {}, { dropEmptyArrays = false, keepEmpty = [] } = {}) =>
|
|
39
|
+
Object.fromEntries(Object.entries(config).filter(([k, v]) =>
|
|
40
|
+
v !== undefined && (v !== '' || keepEmpty.includes(k)) && !(dropEmptyArrays && Array.isArray(v) && !v.length)));
|