dsh-mobile-plugin 0.5.32 → 0.5.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/config/agent-presets/supervisor/agent.cordis.yml +237 -0
- package/config/agent-presets/supervisor/preset.yml +3 -0
- package/extensions/catalog.json +1 -1
- package/extensions/magpie/app.css +2 -2
- package/extensions/magpie/manifest.json +1 -1
- package/extensions/magpie.zip +0 -0
- package/lib/cli/pair.cjs +1 -1
- package/lib/impl.js +7 -0
- package/lib/mobile/events.js +12 -0
- package/lib/mobile/knowledge-base.js +481 -0
- package/lib/mobile/stats-collect.cjs +538 -139
- package/lib/mobile/stats-ledger.cjs +144 -25
- package/lib/mobile/stats-scheduler.cjs +7 -3
- package/lib/mobile/subagents.js +3 -1
- package/lib/mobile/supervisor-broadcast.js +456 -0
- package/lib/mobile/supervisor-memory/index.js +305 -0
- package/lib/mobile/supervisor-runtime/index.js +54 -0
- package/lib/mobile/supervisor-runtime/inject.js +218 -0
- package/lib/mobile/supervisor-runtime/judgment.js +113 -0
- package/lib/mobile/supervisor-tools.js +419 -0
- package/lib/mobile/task-ledger.js +381 -0
- package/lib/panel/index.html +3 -3
- package/lib/relay/pairing-payload.cjs +26 -4
- package/lib/routes/control-plane.js +7 -3
- package/lib/routes/mobile-api.js +5 -0
- package/lib/session-cleanup.cjs +27 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|

|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
|
-
<a href="https://app.wnluo.com/public/apps/14"><img alt="安卓 分发下载" src="https://img.shields.io/badge/%E5%AE%89%E5%8D%93-%E5%88%86%E5%8F%91%E4%B8%8B%E8%BD%BD-3DDC84?style=for-the-badge&logo=android&logoColor=white"></a>
|
|
6
|
+
<a href="https://app.wnluo.com/api/public/apps/14/download-latest"><img alt="安卓 分发下载" src="https://img.shields.io/badge/%E5%AE%89%E5%8D%93-%E5%88%86%E5%8F%91%E4%B8%8B%E8%BD%BD-3DDC84?style=for-the-badge&logo=android&logoColor=white"></a>
|
|
7
7
|
<a href="https://github.com/WNLUO/dsh-mobile-plugin/releases/latest/download/ai-hub-android.apk"><img alt="安卓 GitHub 下载" src="https://img.shields.io/badge/%E5%AE%89%E5%8D%93-GitHub%E4%B8%8B%E8%BD%BD-181717?style=for-the-badge&logo=github"></a>
|
|
8
8
|
<a href="https://apps.apple.com/us/app/ai-hub/id6821681438"><img alt="App Store" src="https://img.shields.io/badge/App_Store-%E4%B8%8B%E8%BD%BD-black?style=for-the-badge&logo=appstore&logoColor=white"></a>
|
|
9
9
|
<a href="https://testflight.apple.com/join/4fn5PCMD"><img alt="苹果测试版 下载" src="https://img.shields.io/badge/%E8%8B%B9%E6%9E%9C%E6%B5%8B%E8%AF%95%E7%89%88-%E4%B8%8B%E8%BD%BD-0D96F6?style=for-the-badge&logo=apple&logoColor=white"></a>
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# 「总管」的人设:complete: true 让这段文字成为这一档会话**整份**系统提示词
|
|
2
|
+
# (其余身份、后缀、工具说明全部压掉),includeRuntimeContext: false 再关掉可选
|
|
3
|
+
# 运行时上下文。所以下面这段必须自足 —— 工具仍然照常提供,但没有额外的工具说明
|
|
4
|
+
# 文字会追加进来。改这里时记住:这是在改一个 agent 的人格,不是加一条提示。
|
|
5
|
+
- id: persona
|
|
6
|
+
name: '@deepseek-ai/dsh-persona'
|
|
7
|
+
config:
|
|
8
|
+
prefix: |
|
|
9
|
+
你是用户的「总管」——他手机那头一个能说话的对象。你们在一通电话里交流:他看到屏幕,听到你的声音。
|
|
10
|
+
|
|
11
|
+
## 你不干什么
|
|
12
|
+
你不亲自写代码、不跑命令、不替项目干活。真正干活的是各条会话里的对话。你的价值是看得全、说得清、调度得对。
|
|
13
|
+
|
|
14
|
+
## 你怎么说话
|
|
15
|
+
- 口语、短句,像人在电话里说话。一口气能说完;一次别超过两三句。
|
|
16
|
+
- 不念代码、表格、链接、文件路径。要细看的东西留在屏幕上,你只说结论。
|
|
17
|
+
- 用户随时可能打断你。被打断就立刻停嘴,听他说。
|
|
18
|
+
|
|
19
|
+
## 你手上有什么
|
|
20
|
+
- 所有电脑上、所有正在跑的会话:谁在跑、谁跑完了、谁报错、谁在等人回答。
|
|
21
|
+
- 一组工具:列会话、看某条会话的进度、读某条会话的内容、往某条会话发消息、新建会话、中断会话。
|
|
22
|
+
|
|
23
|
+
## 什么时候开口
|
|
24
|
+
- 有事才说,别一条条地蹦。几件事一起发生,先说最要紧的,合成一句话。
|
|
25
|
+
- 没活的时候,用户想聊就陪他聊;不要主动翻出几天前的旧事。
|
|
26
|
+
- 不确定的别硬说。连不上电脑,就直说没连上;不知道就说不知道。
|
|
27
|
+
|
|
28
|
+
## 打断与停活是两件事
|
|
29
|
+
- 用户说「停」「别说了」——那是让你先闭嘴,不是取消任务。活照样在电脑上跑。
|
|
30
|
+
- 只有他明确说「那个停掉」,才去中断那条会话,并且做完告诉他。
|
|
31
|
+
|
|
32
|
+
## 记住的三本账
|
|
33
|
+
- 任务账:他手上还挂着几件事、每件到哪一步、哪个在等人答。每次开口前先过一眼。
|
|
34
|
+
- 会话历史:宿主自己管,会压缩,细节可能丢,接受它。
|
|
35
|
+
- 知识库:他说过、定下来的事,只往里面加,不改旧条目。要删要改,让他在手机上自己来。
|
|
36
|
+
|
|
37
|
+
## 动手之前先对一下
|
|
38
|
+
要开新会话、要往某条会话发东西,先把「我准备让哪条、做什么」跟他一句话说清,他点头再动。他说得含糊就先问一句,别自己猜。
|
|
39
|
+
complete: true
|
|
40
|
+
includeRuntimeContext: false
|
|
41
|
+
- id: agent-instructions
|
|
42
|
+
name: '@deepseek-ai/dsh-agent-instructions'
|
|
43
|
+
config:
|
|
44
|
+
maxBytes: 65536
|
|
45
|
+
- id: tool-bash
|
|
46
|
+
name: '@deepseek-ai/dsh-tool-bash'
|
|
47
|
+
disabled: !!js process.platform === 'win32'
|
|
48
|
+
- id: tool-pwsh
|
|
49
|
+
name: '@deepseek-ai/dsh-tool-pwsh'
|
|
50
|
+
disabled: !!js process.platform !== 'win32'
|
|
51
|
+
- id: tool-fs
|
|
52
|
+
name: '@deepseek-ai/dsh-tool-fs'
|
|
53
|
+
- id: tool-fs-search
|
|
54
|
+
name: '@deepseek-ai/dsh-tool-fs-search'
|
|
55
|
+
config:
|
|
56
|
+
sampleOverCapGlobResults: false
|
|
57
|
+
- id: tool-jobs
|
|
58
|
+
name: '@deepseek-ai/dsh-tool-jobs'
|
|
59
|
+
- id: skill-filesystem
|
|
60
|
+
name: '@deepseek-ai/dsh-skill-filesystem'
|
|
61
|
+
- id: tool-skill
|
|
62
|
+
name: '@deepseek-ai/dsh-tool-skill'
|
|
63
|
+
- id: command-goal
|
|
64
|
+
name: '@deepseek-ai/dsh-command-goal'
|
|
65
|
+
- id: tool-goal
|
|
66
|
+
name: '@deepseek-ai/dsh-tool-goal'
|
|
67
|
+
- id: planning
|
|
68
|
+
name: cordis:group
|
|
69
|
+
group: true
|
|
70
|
+
isolate:
|
|
71
|
+
planMode: true
|
|
72
|
+
config:
|
|
73
|
+
- id: plan-mode
|
|
74
|
+
name: '@deepseek-ai/dsh-plan-mode'
|
|
75
|
+
config:
|
|
76
|
+
section: >
|
|
77
|
+
You are in plan mode. Stay in plan mode until exit_plan_mode
|
|
78
|
+
succeeds or the user switches the session mode. Imperative
|
|
79
|
+
language to implement changes means plan the implementation, not
|
|
80
|
+
execute it. A user's conversational agreement — including an
|
|
81
|
+
answer confirming something you asked — approves nothing and
|
|
82
|
+
does not end plan mode; fold the confirmed decision into the
|
|
83
|
+
plan and submit it through exit_plan_mode.
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
Explore first. Use non-mutating reads, searches, static
|
|
87
|
+
analysis, and checks to ground the plan in the actual
|
|
88
|
+
repository. Do not edit or write files, change configuration,
|
|
89
|
+
run formatters or code generation that rewrites tracked files,
|
|
90
|
+
commit, or otherwise carry out the plan. Prefer existing
|
|
91
|
+
functions and patterns over new machinery.
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
The tool catalog stays the same across modes for request-cache
|
|
95
|
+
stability. These plan-mode rules override any later tool
|
|
96
|
+
description or guidance that suggests using mutation tools;
|
|
97
|
+
those tools remain listed to keep the tool catalog unchanged. Do
|
|
98
|
+
not use todo_write to track this planning phase: it tracks
|
|
99
|
+
implementation after an approved plan, while the plan itself
|
|
100
|
+
belongs in exit_plan_mode.
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
Resolve discoverable facts by inspection. Use ask_user_question
|
|
104
|
+
only for user-owned choices or material ambiguity that
|
|
105
|
+
inspection cannot answer. Do not ask the user where code lives
|
|
106
|
+
or how current behavior works when you can find out.
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
Make the plan decision-complete: state the goal and success
|
|
110
|
+
criteria; group implementation changes by subsystem; identify
|
|
111
|
+
public API, schema, and data-flow changes; cover edge cases,
|
|
112
|
+
failure modes, tests, acceptance criteria, and explicit
|
|
113
|
+
assumptions. Keep it concise enough to review but detailed
|
|
114
|
+
enough that another engineer can implement it without making
|
|
115
|
+
design decisions.
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
When ready, call exit_plan_mode with the complete plan markdown,
|
|
119
|
+
starting with a # title. Make exit_plan_mode the only and final
|
|
120
|
+
tool call in that assistant response: it presents the plan for
|
|
121
|
+
approval, and implementation begins only in a later step after
|
|
122
|
+
approval. Do not paste the final plan as a plain reply or ask
|
|
123
|
+
"should I proceed?" through prose or ask_user_question. If
|
|
124
|
+
review rejects it, incorporate the feedback and present again.
|
|
125
|
+
If the review channel is unavailable or aborted, stay in plan
|
|
126
|
+
mode and ask the user to switch modes manually; do not proceed
|
|
127
|
+
with implementation.
|
|
128
|
+
- id: compaction
|
|
129
|
+
name: cordis:group
|
|
130
|
+
group: true
|
|
131
|
+
isolate:
|
|
132
|
+
compaction: true
|
|
133
|
+
toolResultPruner: true
|
|
134
|
+
config:
|
|
135
|
+
- id: compaction-basic
|
|
136
|
+
name: '@deepseek-ai/dsh-compaction-basic'
|
|
137
|
+
- id: command-compact
|
|
138
|
+
name: '@deepseek-ai/dsh-command-compact'
|
|
139
|
+
- id: tool-result-pruner
|
|
140
|
+
name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
|
|
141
|
+
config:
|
|
142
|
+
thresholdChars: 8192
|
|
143
|
+
headChars: 4096
|
|
144
|
+
tailChars: 1024
|
|
145
|
+
- id: delegation
|
|
146
|
+
name: cordis:group
|
|
147
|
+
group: true
|
|
148
|
+
isolate:
|
|
149
|
+
workflowEngine: true
|
|
150
|
+
config:
|
|
151
|
+
- id: tool-subagent-control
|
|
152
|
+
name: '@deepseek-ai/dsh-tool-subagent-control'
|
|
153
|
+
# 独立的 `list_agents` 入口只在 0.2.1 及更早存在;0.2.2 把它并进了主包,
|
|
154
|
+
# 子路径没了。这一行保留是为了老运行时,启动时宿主会按「这一代认不认这个
|
|
155
|
+
# 子路径」把副本里的这一行整行拿掉(见 lib/host-compat.cjs 的 dropRows)。
|
|
156
|
+
- id: tool-subagent-list-agents
|
|
157
|
+
name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
|
|
158
|
+
# 子代理挑模型的开关,两代运行时键名不同:0.2.1 及更早读
|
|
159
|
+
# `modelSelectionSettings`,0.2.2 起改成 `modelSelection`(另加
|
|
160
|
+
# `modelDiscovery` 才让模型查得到可选模型)。两个键都写:各自的 schema 只认
|
|
161
|
+
# 自己那个、另一个原样忽略,所以同一份预设挂到哪一代都对。
|
|
162
|
+
- id: tool-subagent
|
|
163
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
164
|
+
config:
|
|
165
|
+
provider: spawn
|
|
166
|
+
toolName: subagent
|
|
167
|
+
modelSelectionSettings: true
|
|
168
|
+
modelSelection: true
|
|
169
|
+
modelDiscovery: true
|
|
170
|
+
backgroundMode: continuable
|
|
171
|
+
- id: tool-subagent-fork
|
|
172
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
173
|
+
config:
|
|
174
|
+
provider: fork
|
|
175
|
+
toolName: subagent_fork
|
|
176
|
+
backgroundMode: continuable
|
|
177
|
+
- id: tool-subagent-codex
|
|
178
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
179
|
+
disabled: true
|
|
180
|
+
config:
|
|
181
|
+
provider: codex
|
|
182
|
+
toolName: subagent_codex
|
|
183
|
+
backgroundMode: one-shot
|
|
184
|
+
maxDepth: provider-managed
|
|
185
|
+
- id: tool-subagent-claude-code
|
|
186
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
187
|
+
disabled: true
|
|
188
|
+
config:
|
|
189
|
+
provider: claude-code
|
|
190
|
+
toolName: subagent_claude_code
|
|
191
|
+
backgroundMode: one-shot
|
|
192
|
+
maxDepth: provider-managed
|
|
193
|
+
# `tool-workflow` is deliberately absent: it injects `workflowEngine`,
|
|
194
|
+
# which only `@deepseek-ai/dsh-workflow-ptc` provides, and that package
|
|
195
|
+
# has no 0.1.1-rc.2 release (its earliest is 0.1.6-alpha.1). The App's
|
|
196
|
+
# workflow surfaces therefore have nothing to run on this host.
|
|
197
|
+
- id: tool-ralph
|
|
198
|
+
name: '@deepseek-ai/dsh-tool-ralph'
|
|
199
|
+
disabled: true
|
|
200
|
+
config:
|
|
201
|
+
subagentProvider: spawn
|
|
202
|
+
maxRounds: 64
|
|
203
|
+
- id: tool-todo
|
|
204
|
+
name: '@deepseek-ai/dsh-tool-todo'
|
|
205
|
+
config:
|
|
206
|
+
allowParallelInProgress: true
|
|
207
|
+
- id: tool-web
|
|
208
|
+
name: '@deepseek-ai/dsh-tool-web'
|
|
209
|
+
config:
|
|
210
|
+
fetch: true
|
|
211
|
+
searchTimeoutMs: 60000
|
|
212
|
+
# Without this row the mobile host's tool catalog has no `ask_user_question`,
|
|
213
|
+
# so the App's question dock could never appear: the model simply reports that
|
|
214
|
+
# the tool is unavailable. The plugin's `lib/mobile/questions.js` listens on
|
|
215
|
+
# the `user-questions/request` hook (0.2.x shape) and answers it — only the
|
|
216
|
+
# tool row was missing.
|
|
217
|
+
#
|
|
218
|
+
# 这里的 `name` 是**占位**:无头宿主启动时会把同代那一份的入口绝对路径写进
|
|
219
|
+
# 一份副本(`host.js` 的 syncPresetDir),挂载的是运行时自己的那一代。这个包的
|
|
220
|
+
# peerDependencies 逐版本紧咬,对不上时 `dsh-app-boot` 会**整行禁用**(不是降级),
|
|
221
|
+
# 而钉死哪一代都不可能覆盖每台机器上装的 DSH —— 判据交给运行期,别在这里写死。
|
|
222
|
+
- id: tool-ask-user
|
|
223
|
+
name: '@deepseek-ai/dsh-tool-ask-user'
|
|
224
|
+
# `present` 是模型**显式声明交付文件**的那一行。桌面 `standard` preset 里一直有它
|
|
225
|
+
# (`@deepseek-ai/dsh-web-app/presets/standard.patch.yml`),手机这份漏了 —— 于是手机
|
|
226
|
+
# 上的模型完全没有「把文件交付给用户」这个动作,只能写完文件什么也不说;App 那边只好
|
|
227
|
+
# 拿 write/edit 成功去反推,结果「每改一次都冒一张卡、用命令行改的却一张都没有」。
|
|
228
|
+
#
|
|
229
|
+
# 它只做两件事:校验路径是会话文件系统里真实存在的普通文件,然后把
|
|
230
|
+
# `deliverables/presented` 事件追加进会话日志。卡片该不该出现,由**模型叫不叫这个工具**
|
|
231
|
+
# 决定,不由「有没有文件被改」决定 —— 这是桌面的口径。
|
|
232
|
+
#
|
|
233
|
+
# 版本同样由运行期决定(见上面 tool-ask-user 那段):0.2.1 的 `present` 要
|
|
234
|
+
# `dsh-agent` 恰好是同一代,对不上时 `dsh-app-boot` 会整行禁用,模型只会说
|
|
235
|
+
# 「没有这个工具」。`name` 是占位,宿主启动时换成本次运行时的入口。
|
|
236
|
+
- id: tool-present
|
|
237
|
+
name: '@deepseek-ai/dsh-tool-present'
|
package/extensions/catalog.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"slug": "magpie",
|
|
5
5
|
"description": "在手机上打开 magpie 的完整界面(Agents / Providers / Routing / Usage / Settings)。前端整份按需下载,数据经宿主代取。",
|
|
6
6
|
"author": "DSH Mobile",
|
|
7
|
-
"releaseNotes": "
|
|
7
|
+
"releaseNotes": "手机上不再顶出一条状态栏高度的空白:顶部安全区统一由 App 让,页面不再自己再让一次。"
|
|
8
8
|
}
|
|
9
9
|
]
|
|
10
10
|
}
|
|
@@ -345,7 +345,7 @@ body:not(.side-nav) #nav button[data-view="groups"], body.side-nav .rt-togroups
|
|
|
345
345
|
@media (max-width: 760px), (pointer: coarse) and (max-width: 1024px) {
|
|
346
346
|
body.web .top {
|
|
347
347
|
height: auto; min-height: 48px; flex-wrap: wrap; gap: 4px 8px;
|
|
348
|
-
padding: calc(6px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
|
|
348
|
+
padding: calc(6px + var(--dsh-safe-top, env(safe-area-inset-top))) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
|
|
349
349
|
}
|
|
350
350
|
body.web .top .brand, body.web .top .actions { min-height: 40px; align-items: center; }
|
|
351
351
|
body.web .top #nav {
|
|
@@ -4248,7 +4248,7 @@ body.panel .modal { padding: 16px 12px; }
|
|
|
4248
4248
|
body.web .connect .val { height: auto; min-height: 44px; }
|
|
4249
4249
|
body.web input:not([type="range"]):not([type="checkbox"]):not([type="radio"]),
|
|
4250
4250
|
body.web textarea, body.web select { font-size: 16px; min-height: 44px; }
|
|
4251
|
-
body.web .modal { padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
|
|
4251
|
+
body.web .modal { padding: max(8px, var(--dsh-safe-top, env(safe-area-inset-top))) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
|
|
4252
4252
|
body.web .modal .editor.framed > .ebody, body.web .editor { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 12px; }
|
|
4253
4253
|
body.web .editor label { text-align: left; padding-top: 8px; }
|
|
4254
4254
|
body.web .editor .segs { max-width: 100%; flex-wrap: wrap; }
|
package/extensions/magpie.zip
CHANGED
|
Binary file
|
package/lib/cli/pair.cjs
CHANGED
|
@@ -92,7 +92,7 @@ async function main(argv) {
|
|
|
92
92
|
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
93
93
|
// 静区给 4 个模块(规范值)与 512 边长:这份 SVG 多半是存下来再转给手机扫,
|
|
94
94
|
// 白边不够、边长只有 280 的时候,手机从相册里认常常读不出来。
|
|
95
|
-
fs.writeFileSync(target, await QRCode.toString(text, { type: 'svg', errorCorrectionLevel: 'M', margin: 4, width:
|
|
95
|
+
fs.writeFileSync(target, await QRCode.toString(text, { type: 'svg', errorCorrectionLevel: 'M', margin: 4, width: 1024 }));
|
|
96
96
|
process.stdout.write(`二维码已存成图片:${target}\n如果终端太窄扫不动,把这个文件拿下来用看图软件打开再扫。\n\n`);
|
|
97
97
|
}
|
|
98
98
|
|
package/lib/impl.js
CHANGED
|
@@ -45,6 +45,7 @@ const { createApiProxy } = require('./mobile/host-bridge.js')
|
|
|
45
45
|
const { installApprovalBridge } = require('./mobile/approvals.js')
|
|
46
46
|
const { installQuestionBridge } = require('./mobile/questions.js')
|
|
47
47
|
const { installNarration } = require('./mobile/narration.js') // 过程播报:默认关,开关真值每步现读
|
|
48
|
+
const { mountSupervisorRuntime } = require('./mobile/supervisor-runtime/index.js') // 总管运行期:有活/没活判断 + 每次开口带任务账。
|
|
48
49
|
// 「手机上最近来过没有」:守卫记、控制面状态读。单独一个模块,装配层只转交。
|
|
49
50
|
const activity = require('./mobile/activity.cjs')
|
|
50
51
|
const { installSessionCleanup } = require('./session-cleanup.cjs')
|
|
@@ -57,6 +58,8 @@ const { mountPhoneControl } = require('./mobile/phone/index.js') // 「让 AI
|
|
|
57
58
|
// 公众号文章库:给 AI 的两个工具(写 / 读),见 mobile/wechat-tools.js。
|
|
58
59
|
const { installWechatTools } = require('./mobile/wechat-tools.js')
|
|
59
60
|
const { installPetTools } = require('./mobile/pet-tools.js') // 悬浮宠物的两个工具(看 / 写),见 mobile/pet-tools.js。
|
|
61
|
+
const { mountSupervisorTools } = require('./mobile/supervisor-tools.js') // 总管那组读写工具(列会话 / 看进度 / 读正文 / 发消息 / 开新会话 / 中断)。
|
|
62
|
+
const { mount: mountSupervisorMemory } = require('./mobile/supervisor-memory/index.js') // 总管的两本账(任务账 + 知识库)。
|
|
60
63
|
const { activeGuard } = require('./host-guard.cjs')
|
|
61
64
|
// 桌面端侧栏展开态的快照存储。桌面把这份状态只记在浏览器 localStorage 里,宿主必须
|
|
62
65
|
// 有一个落盘处:客户端半边(lib/client.js)上报 → 这里 → 移动端读取。
|
|
@@ -392,8 +395,12 @@ function apply(ctx) {
|
|
|
392
395
|
return undefined
|
|
393
396
|
}, `${name}: wechat article tools`)
|
|
394
397
|
mount('宠物工具', () => installPetTools(ctx)) // 缺 tools 注入的 profile 只少这两个,包目录与路由照常可用。
|
|
398
|
+
mount('总管工具', () => mountSupervisorTools(ctx)) // 同宠物工具:缺 tools 注入只少这六条,其余照常。
|
|
399
|
+
mount('总管两本账', () => ctx.effect(() => mountSupervisorMemory(ctx).dispose, `${name}: supervisor memory`)) // 任务账 + 知识库:跟着会话事件自动记,实现都在 mobile/supervisor-memory/。
|
|
395
400
|
mount('统计采集', () => ctx.effect(() => statsScheduler.start(ctx), `${name}: stats collect`))
|
|
396
401
|
mount('过程播报', () => ctx.effect(() => installNarration(ctx), `${name}: process narration`))
|
|
402
|
+
mount('总管运行期', () => ctx.effect(() => mountSupervisorRuntime(ctx), `${name}: supervisor runtime`)) // 只在总管那条会话上注入「有活/没活 + 任务账」。
|
|
403
|
+
mount('总管播报', () => ctx.effect(() => require('./mobile/supervisor-broadcast.js').installDeviceBroadcast(ctx), `${name}: supervisor broadcast`)) // 攒批合并成一句,出口是设备事件流的 supervisor/broadcast 帧。
|
|
397
404
|
|
|
398
405
|
const status = createStatusView({
|
|
399
406
|
state,
|
package/lib/mobile/events.js
CHANGED
|
@@ -16,6 +16,7 @@ const { createFrameSealer } = require('./stream.js');
|
|
|
16
16
|
const { listSignal: sharedListSignal } = require('../shared/list-signal.js');
|
|
17
17
|
const { sessionSignal: sharedSessionSignal } = require('../shared/session-signal.js');
|
|
18
18
|
const { desktopViewSignal: sharedDesktopViewSignal } = require('../shared/desktop-view-signal.js');
|
|
19
|
+
const { broadcastSignal: sharedBroadcastSignal } = require('./supervisor-broadcast.js');
|
|
19
20
|
const { writeSse: sharedWriteSse, stableEventId: sharedEventId, waitForDrain } = require('../shared/sse-write.js');
|
|
20
21
|
|
|
21
22
|
const DEDUP_WINDOW = 2048;
|
|
@@ -224,6 +225,16 @@ async function handleDeviceStream(ctx, req, res) {
|
|
|
224
225
|
if (ac.signal.aborted) return;
|
|
225
226
|
if (!writeFrame({ type: 'device/desktop-view-changed', updatedAt: event.updatedAt, at: event.at })) ac.abort();
|
|
226
227
|
});
|
|
228
|
+
/**
|
|
229
|
+
* 自产的「总管要开口了」帧:插件把几条会话的动静合成一句话,手机在通话里念出来。
|
|
230
|
+
*
|
|
231
|
+
* 与心跳、清单信号一样是直订 + 收尾注销。**不补发**:说话的时机是「此刻」,断流期间
|
|
232
|
+
* 漏掉的那一句没有补的价值(补回去只会让它在一分钟后突然开口)。
|
|
233
|
+
*/
|
|
234
|
+
const unsubscribeBroadcast = sharedBroadcastSignal.onBroadcast((frame) => {
|
|
235
|
+
if (ac.signal.aborted) return;
|
|
236
|
+
if (!writeFrame({ type: 'supervisor/broadcast', text: frame.text, at: frame.at })) ac.abort();
|
|
237
|
+
});
|
|
227
238
|
/**
|
|
228
239
|
* 连上就先补一帧「当前状态」。
|
|
229
240
|
*
|
|
@@ -316,6 +327,7 @@ async function handleDeviceStream(ctx, req, res) {
|
|
|
316
327
|
unsubscribeSignal();
|
|
317
328
|
unsubscribeActivity();
|
|
318
329
|
unsubscribeDesktopView();
|
|
330
|
+
unsubscribeBroadcast();
|
|
319
331
|
releaseSignal();
|
|
320
332
|
try {
|
|
321
333
|
if (!res.writableEnded) {
|