dsh-hive-panel 0.1.0 → 0.1.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/CHANGELOG.md +23 -0
- package/README.md +6 -4
- package/README.zh-CN.md +4 -3
- package/SPEC.md +47 -16
- package/cordis.patch.yml +3 -0
- package/docs/DESIGN.md +29 -11
- package/lib/client.js +261 -38
- package/lib/index.js +76 -11
- package/lib/queen.js +129 -42
- package/package.json +1 -1
- package/scripts/verify.mjs +86 -4
- package/src/panel.js +261 -38
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,25 @@ All notable changes to this project are documented in this file. The format is
|
|
|
4
4
|
based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and this project
|
|
5
5
|
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.1.1] - 2026-12-04
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Queen mode auto-activation: a snapshot of an initialised repository marks the Session
|
|
12
|
+
as the queen (config `autoQueen`, default true). Explicitly exiting with `/queen off`
|
|
13
|
+
is remembered per Session, so later snapshots do not turn it back on; `/queen on`
|
|
14
|
+
re-enters manually.
|
|
15
|
+
- `queen-on` / `queen-off` actions (read-only safe and idempotent) and a `queen` field in
|
|
16
|
+
the snapshot: `{ active, source: 'auto'|'manual'|null, repo }`.
|
|
17
|
+
- Unknown action names are rejected before the read-only gate; host-side action failures
|
|
18
|
+
carry a stable `hive/<code>:` stderr prefix.
|
|
19
|
+
- UI: the oldest pending task renders its elapsed time and task id; queen status takeover
|
|
20
|
+
and terminology synced with the panel.
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- 22 checks now cover snapshot auto-activation, queen-off suppression and command symmetry.
|
|
25
|
+
|
|
7
26
|
## [0.1.0] - 2026-12-04
|
|
8
27
|
|
|
9
28
|
First public snapshot.
|
|
@@ -23,3 +42,7 @@ First public snapshot.
|
|
|
23
42
|
- Offline verification (`npm run check`) with a Cordis-shaped shim: route
|
|
24
43
|
registration, Session cwd, sandbox policy, allowlist and quoting, read-only
|
|
25
44
|
semantics, response contracts, cold Sessions and the queen lifecycle.
|
|
45
|
+
|
|
46
|
+
### Published
|
|
47
|
+
|
|
48
|
+
- npm: `dsh-hive-panel@0.1.0` on 2026-12-04.
|
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ the Hive CLI writes them.
|
|
|
39
39
|
| --- | --- |
|
|
40
40
|
| **A Hive tab in the conversation** | Board lanes (pending, claimed, done, blocked, failed), card details and the event tail, scoped to the Session's repository |
|
|
41
41
|
| **Initialise from the tab** | Run `hive init` on an uninitialised repository and start using it immediately |
|
|
42
|
-
| **Queen mode** |
|
|
42
|
+
| **Queen mode** | An initialised repository makes the current Session the queen automatically: it plans and splits goals into cards instead of writing code. `/queen off` exits; `/queen on` (or the panel action) re-enters |
|
|
43
43
|
| **Card actions** | Claim, complete, fail, retry, block, renew, run a round and more — from the card you are looking at |
|
|
44
44
|
| **Runner strip** | When [dsh-hive-runner](https://github.com/d86e/dsh-hive-runner) is installed, per-repository supervisor state (idle, running, paused), live worker counts and pause/resume |
|
|
45
45
|
| **Read-only by default** | Watching the board is safe out of the box; mutations are opt-in |
|
|
@@ -101,8 +101,9 @@ restarts with `dsh web` instead of the desktop app.
|
|
|
101
101
|
3. **Open the Hive view.** On a repository that is not initialised yet, click
|
|
102
102
|
**Initialise Hive**. This writes the role files, hooks and coordination refs — and
|
|
103
103
|
needs writes enabled (see [Configuration](#configuration)).
|
|
104
|
-
4. **Become the queen.** A successful initialisation
|
|
105
|
-
|
|
104
|
+
4. **Become the queen.** A successful initialisation — or opening the view on a
|
|
105
|
+
repository that is already initialised — marks the current Session as the queen: it
|
|
106
|
+
only plans and splits cards, it does not edit code. Tell it a goal in the
|
|
106
107
|
conversation, or use **Give the queen a goal**, preview the plan and write the cards.
|
|
107
108
|
5. **Work the board.** Cards appear in their lanes; open one to see details and the actions
|
|
108
109
|
available for its state. If `dsh-hive-runner` is installed, its strip at the top shows
|
|
@@ -130,6 +131,7 @@ Restart DSH after changing the config.
|
|
|
130
131
|
|
|
131
132
|
| Key | Default | Meaning |
|
|
132
133
|
| --- | --- | --- |
|
|
134
|
+
| `autoQueen` | `true` | Make the current Session the queen automatically when the view opens on an initialised repository. Set to `false` to enter queen mode only with `/queen on` or the panel action |
|
|
133
135
|
| `writable` | `false` | Allow mutating actions (init, add, claim, done, fail, mode, ...). When false the board is still readable and mutations are hidden or rejected |
|
|
134
136
|
| `bins.hive` | `hive` from PATH | `hive` executable: PATH name or absolute path |
|
|
135
137
|
| `bins.tasks` | `hive-tasks` from PATH | `hive-tasks` executable |
|
|
@@ -233,7 +235,7 @@ npm run check # node --check on the entry points + the offline verification
|
|
|
233
235
|
npm pack --dry-run # inspect the published contents
|
|
234
236
|
```
|
|
235
237
|
|
|
236
|
-
`scripts/verify.mjs` runs
|
|
238
|
+
`scripts/verify.mjs` runs 22 checks against a Cordis-shaped shim: route registration,
|
|
237
239
|
Session cwd resolution, sandbox policy, the action allowlist and quoting, read-only
|
|
238
240
|
semantics, response contracts, cold Sessions and the queen lifecycle. It never starts or
|
|
239
241
|
restarts a DSH process.
|
package/README.zh-CN.md
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
| --- | --- |
|
|
31
31
|
| **会话里的 Hive 标签页** | 按状态分列的看板(pending / claimed / done / blocked / failed)、任务卡详情和事件尾,作用域是当前 Session 的仓库 |
|
|
32
32
|
| **在标签页里初始化** | 对没初始化过的仓库执行 `hive init`,立刻可用 |
|
|
33
|
-
| **女王模式** |
|
|
33
|
+
| **女王模式** | 打开已初始化的仓库时当前会话自动成为女王:只规划、只拆卡,不写代码。`/queen off` 退出,`/queen on`(或面板动作)重新进入 |
|
|
34
34
|
| **任务卡动作** | 认领、完成、失败、重试、阻塞、续租、跑一轮等,都从正在看的那张卡上发起 |
|
|
35
35
|
| **Runner 状态条** | 装了 [dsh-hive-runner](https://github.com/d86e/dsh-hive-runner) 时,顶部显示每个仓库的 supervisor 状态(空闲 / 运行 / 暂停)、在飞 worker 数,并能暂停/恢复 |
|
|
36
36
|
| **默认只读** | 开箱即看是安全的;写操作需要显式打开 |
|
|
@@ -82,7 +82,7 @@ CLI 管理的 profile(例如 `web`)同样改这两处;只是重启方式
|
|
|
82
82
|
1. **安装**插件并重启 DSH(见上)。
|
|
83
83
|
2. **开会话**:在要协调的 git 仓库里开一个 Session。会话的 cwd 就是仓库,面板不会问你要路径。
|
|
84
84
|
3. **打开 Hive 视图**。仓库还没初始化时,点「初始化 Hive」,它会写入角色文件、钩子和协调 refs——需要先打开写权限(见[配置](#配置))。
|
|
85
|
-
4.
|
|
85
|
+
4. **进入女王模式**:初始化成功、或对已初始化的仓库打开视图,会把当前会话标记为女王;它只规划、只拆卡,不改代码。直接在对话里说目标,或者点「给女王下目标」,先预览计划、确认后写入任务卡。
|
|
86
86
|
5. **用看板干活**:任务卡出现在对应分栏;点开卡片看详情和该状态可用的动作。装了 `dsh-hive-runner` 时,顶部状态条显示各仓库的 supervisor 状态,可以直接暂停/恢复。
|
|
87
87
|
6. `/queen off` 让会话回到普通编码模式;Hive 视图照常工作。
|
|
88
88
|
|
|
@@ -106,6 +106,7 @@ CLI 管理的 profile(例如 `web`)同样改这两处;只是重启方式
|
|
|
106
106
|
|
|
107
107
|
| 配置项 | 默认 | 含义 |
|
|
108
108
|
| --- | --- | --- |
|
|
109
|
+
| `autoQueen` | `true` | 对已初始化的仓库打开视图时自动让当前会话成为女王。设为 `false` 时只能用 `/queen on` 或面板动作手动进入 |
|
|
109
110
|
| `writable` | `false` | 是否允许写动作(init、add、claim、done、fail、mode……)。关闭时看板仍可读,写动作被隐藏或拒绝 |
|
|
110
111
|
| `bins.hive` | PATH 上的 `hive` | `hive` 可执行文件:PATH 名或绝对路径 |
|
|
111
112
|
| `bins.tasks` | PATH 上的 `hive-tasks` | `hive-tasks` 可执行文件 |
|
|
@@ -181,7 +182,7 @@ npm run check # 入口语法检查 + 离线验证
|
|
|
181
182
|
npm pack --dry-run # 检查发布内容
|
|
182
183
|
```
|
|
183
184
|
|
|
184
|
-
`scripts/verify.mjs` 在 Cordis 形状的 shim 上跑
|
|
185
|
+
`scripts/verify.mjs` 在 Cordis 形状的 shim 上跑 22 项检查:路由注册、Session cwd 解析、sandbox 策略、动作白名单与转义、只读语义、响应契约、冷会话和女王生命周期。不会启动或重启任何 DSH 进程。
|
|
185
186
|
|
|
186
187
|
浏览器 bundle `lib/client.js` 是生成物:改完 `src/` 后跑 `node scripts/build-client.mjs`。线上协议见 [SPEC.md](SPEC.md),实现说明和 DSH 实测证据见 [docs/DESIGN.md](docs/DESIGN.md)。
|
|
187
188
|
|
package/SPEC.md
CHANGED
|
@@ -60,13 +60,14 @@ Requests:
|
|
|
60
60
|
| Request | Response |
|
|
61
61
|
| --- | --- |
|
|
62
62
|
| `GET ?op=snapshot&sessionId=<id>` | `200` snapshot object (§4) |
|
|
63
|
-
| `GET ?op=actions&sessionId=<id>` | `200 { writable, actions, repo }` |
|
|
63
|
+
| `GET ?op=actions&sessionId=<id>` | `200 { writable, autoQueen, actions, repo }` |
|
|
64
64
|
| `POST ?op=action&name=<action>&sessionId=<id>` with a JSON body | `200` action envelope (§5) |
|
|
65
65
|
| unknown `op` | `400 { ok:false, error:{ code:'hive/unknown-op', message } }` |
|
|
66
66
|
| wrong method | `405` |
|
|
67
67
|
| invalid JSON body | `400` |
|
|
68
68
|
|
|
69
|
-
`name=queen-off`
|
|
69
|
+
`name=queen-on` and `name=queen-off` are accepted in read-only mode because they only
|
|
70
|
+
touch host memory.
|
|
70
71
|
|
|
71
72
|
## 4. Snapshot
|
|
72
73
|
|
|
@@ -83,7 +84,8 @@ these top-level fields:
|
|
|
83
84
|
"tasks": {},
|
|
84
85
|
"stats": {},
|
|
85
86
|
"events": [],
|
|
86
|
-
"writable": false
|
|
87
|
+
"writable": false,
|
|
88
|
+
"queen": { "active": true, "source": "auto", "repo": "/abs/repo" }
|
|
87
89
|
}
|
|
88
90
|
```
|
|
89
91
|
|
|
@@ -91,8 +93,12 @@ these top-level fields:
|
|
|
91
93
|
- `board`, `tasks`, `stats` — parsed JSON from the configured Hive binaries.
|
|
92
94
|
- `events` — the newest 80 lines of `<cwd>/.hive/events.jsonl`, newest first.
|
|
93
95
|
- `writable` — the plugin configuration (`false` by default).
|
|
96
|
+
- `queen` — current host-memory queen mode for this Session: `active` is a boolean,
|
|
97
|
+
`source` is `"auto"` (snapshot auto-activation), `"manual"` (`init`, `queen-on`,
|
|
98
|
+
`/queen on`) or `null` (inactive), and `repo` repeats the resolved Session cwd.
|
|
99
|
+
The field is always present on a `200` snapshot.
|
|
94
100
|
- An uninitialised repository returns the same shape with empty reads after only the
|
|
95
|
-
refs probe.
|
|
101
|
+
refs probe; `queen` may still be active there after an explicit activation.
|
|
96
102
|
|
|
97
103
|
## 5. Action envelope
|
|
98
104
|
|
|
@@ -101,6 +107,11 @@ these top-level fields:
|
|
|
101
107
|
```
|
|
102
108
|
|
|
103
109
|
- A nonzero CLI exit maps to `ok:false` with the same envelope and the CLI's exit code.
|
|
110
|
+
- Host-side failures (unknown action, invalid argument, unknown Session, missing queen
|
|
111
|
+
controller) use `code: 2` and start `stderr` with a stable `hive/<code>: ` prefix,
|
|
112
|
+
e.g. `hive/session-unknown: no live or stored Session "…"`,
|
|
113
|
+
`hive/unknown-action: …`, `hive/invalid-argument: …`. Queen actions therefore only
|
|
114
|
+
fail with `400` when the Session cannot be resolved.
|
|
104
115
|
- In read-only mode a mutating action returns `403` with
|
|
105
116
|
`{ ok:false, code:2, stdout:'', stderr:'read-only: hive-panel writable=false' }` and
|
|
106
117
|
spawns nothing.
|
|
@@ -108,7 +119,7 @@ these top-level fields:
|
|
|
108
119
|
## 6. Action catalog
|
|
109
120
|
|
|
110
121
|
Actions: `init add plan claim done fail retry block renew mode learn recall verdict run
|
|
111
|
-
commit doctor` plus the host-memory
|
|
122
|
+
commit doctor` plus the host-memory actions `queen-on` and `queen-off`.
|
|
112
123
|
|
|
113
124
|
For every action the host builds one fixed command template. Each argument field is
|
|
114
125
|
validated (id, agent, ttl, sha, ref mode, integer ranges, string length, NUL) and every
|
|
@@ -146,17 +157,37 @@ cap and cancellation.
|
|
|
146
157
|
|
|
147
158
|
## 8. Queen mode
|
|
148
159
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
+
Queen mode is a per-Session, in-process switch. It never writes the repository and it
|
|
161
|
+
never appends Session events.
|
|
162
|
+
|
|
163
|
+
Activation:
|
|
164
|
+
|
|
165
|
+
1. **Auto (default).** Before returning a `200` snapshot, the host probes
|
|
166
|
+
`refs/hive/v1` in the Session cwd. When the ref exists, `autoQueen` is not
|
|
167
|
+
`false`, and the Session was not explicitly closed, an inactive Session is marked
|
|
168
|
+
queen with `source: "auto"`. An already active Session is not rewritten.
|
|
169
|
+
2. **`init` action.** A successful `init` followed by the `refs/hive/v1` probe marks
|
|
170
|
+
the Session with `source: "manual"`.
|
|
171
|
+
3. **`queen-on` action / `/queen on`.** Explicit activation; re-reads the role file
|
|
172
|
+
and clears a previous explicit exit.
|
|
173
|
+
|
|
174
|
+
Deactivation:
|
|
175
|
+
|
|
176
|
+
- `/queen off` (calling Session only), `queen-off` action, or `agent/disposed`.
|
|
177
|
+
- Exit is idempotent and explicit: the Session is remembered as suppressed, so snapshot
|
|
178
|
+
auto-activation does not turn it back on. `queen-on` / `/queen on` lifts it.
|
|
179
|
+
- Process restart forgets both activation and suppression (fail-safe).
|
|
180
|
+
|
|
181
|
+
Configuration: `autoQueen` on the plugin entry config, default `true`; when `false`
|
|
182
|
+
snapshots never auto-activate and only `init` / `queen-on` / `/queen on` activate.
|
|
183
|
+
|
|
184
|
+
Injection: a system-prompt section `hive:queen` (order 520) that renders text only for
|
|
185
|
+
the marked Session and an empty string for every other Session, evaluated on each prompt
|
|
186
|
+
assembly. It does not enter the conversation history.
|
|
187
|
+
|
|
188
|
+
Role text: `<cwd>/.hive/roles/queen.md`, prefixed with an "untrusted role file" label
|
|
189
|
+
naming the absolute source path, capped at 4096 characters and marked `[truncated]`
|
|
190
|
+
when cut; a built-in fallback is labelled when the file is missing.
|
|
160
191
|
|
|
161
192
|
## 9. Security invariants
|
|
162
193
|
|
package/cordis.patch.yml
CHANGED
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
config:
|
|
13
13
|
# Mutating actions (init/add/claim/done/...) stay disabled by default.
|
|
14
14
|
writable: false
|
|
15
|
+
# An initialised Session auto-enters queen mode from the snapshot loop.
|
|
16
|
+
# Set false to require /queen on or the queen-on action.
|
|
17
|
+
autoQueen: true
|
|
15
18
|
# Trusted host-side executables. Omit to use PATH names; absolute paths
|
|
16
19
|
# are useful when hive/hive-tasks are not installed on the DSH PATH.
|
|
17
20
|
# bins:
|
package/docs/DESIGN.md
CHANGED
|
@@ -158,14 +158,18 @@ interface ConnectionFetchRoute {
|
|
|
158
158
|
|
|
159
159
|
| 请求 | 响应 |
|
|
160
160
|
| --- | --- |
|
|
161
|
-
| `GET /api/hive?op=snapshot&sessionId=<id>` | 快照 JSON,字段固定 `{ at, repo, initialised, mode, board, tasks, stats, events, writable }` |
|
|
162
|
-
| `GET /api/hive?op=actions&sessionId=<id>` | `{ writable, actions: string[], repo }` |
|
|
161
|
+
| `GET /api/hive?op=snapshot&sessionId=<id>` | 快照 JSON,字段固定 `{ at, repo, initialised, mode, board, tasks, stats, events, writable, queen }` |
|
|
162
|
+
| `GET /api/hive?op=actions&sessionId=<id>` | `{ writable, autoQueen, actions: string[], repo }` |
|
|
163
163
|
| `POST /api/hive?op=action&name=<name>&sessionId=<id>`(JSON body) | 动作结果 `{ ok, code, stdout, stderr }` |
|
|
164
164
|
| 未知 `op` | `400 { ok:false, error:{ code:'hive/unknown-op', message } }` |
|
|
165
165
|
|
|
166
166
|
- `sessionId` 缺失/无法解析(活会话也没有 `sessionPersistence` 记录)返回 400。
|
|
167
167
|
- 方法不匹配返回 405;JSON body 非法返回 400,动作请求仍保持 `{ ok, code, stdout, stderr }` 形状。
|
|
168
168
|
- 快照里的 `writable` 来自插件配置(默认 `false`),与 `hive-panel` 的只读语义一致。
|
|
169
|
+
- 快照里的 `queen` 是 host 内存状态:`{ active: boolean, source: 'auto'|'manual'|null, repo }`;
|
|
170
|
+
每次 `op=snapshot` 在返回前按 §6 做一次自动激活检查。
|
|
171
|
+
- 动作失败时 `code` 为 `2`,`stderr` 以稳定前缀 `hive/<code>: ` 开头(如
|
|
172
|
+
`hive/session-unknown: …`、`hive/unknown-action: …`);CLI 非 0 退出则沿用退出码。
|
|
169
173
|
- 事件历史从 `<cwd>/.hive/events.jsonl` 读最近 80 条,倒序返回(沿用原 `hive-panel/src/data.js` 的语义)。
|
|
170
174
|
|
|
171
175
|
### 4.3 认证边界
|
|
@@ -240,12 +244,25 @@ token(PATH 名或绝对路径)。
|
|
|
240
244
|
|
|
241
245
|
`config.writable` 默认 `false`:`op=action` 返回 403
|
|
242
246
|
`{ ok:false, code:2, stdout:'', stderr:'read-only: hive-panel writable=false' }`,且不 spawn 任何进程。
|
|
243
|
-
`queen-off` 是 host
|
|
247
|
+
`queen-on` / `queen-off` 是 host 内存操作,只读模式也允许;未知动作名在只读判断之前先返回
|
|
248
|
+
`hive/unknown-action`。
|
|
244
249
|
|
|
245
250
|
## 6. 女王激活(`lib/queen.js`)
|
|
246
251
|
|
|
247
|
-
-
|
|
248
|
-
`
|
|
252
|
+
- **自动触发(默认)**:`op=snapshot` 返回前已经跑过 `refs/hive/v1` 探针;若仓库已初始化、
|
|
253
|
+
`config.autoQueen !== false` 且该 Session 没有被显式关闭,则调用
|
|
254
|
+
`queen.autoMark({ sessionId, cwd })`。`autoMark` 幂等:已激活的 Session 不重读/重写角色文件,
|
|
255
|
+
被显式关闭的 Session 直接跳过。这样在 CLI 里已经 `hive init` 过的仓库(如 queen-sandbox)
|
|
256
|
+
一打开面板快照就会进入女王模式。
|
|
257
|
+
- **手动触发**:`POST /api/hive?op=action&name=queen-on&sessionId=<id>`(body 可省略)或
|
|
258
|
+
`/queen on` 命令;重新读取角色文件、`source` 记为 `manual`,并解除显式关闭。
|
|
259
|
+
`init` 动作成功后同样走手动激活。
|
|
260
|
+
- **显式退出**:`/queen off` 命令(只影响调用它的会话)、`op=action&name=queen-off`;
|
|
261
|
+
退出是幂等的,并把 SessionId 记入 `suppressed`,后续 snapshot 的自动检查不会把它重新打开。
|
|
262
|
+
`queen-on` / `/queen on` 才解除。`agent/disposed` 清理两者;进程重启全部丢失(fail-safe)。
|
|
263
|
+
- **快照字段**:每个 200 快照都带 `queen: { active, source: 'auto'|'manual'|null, repo }`。
|
|
264
|
+
- **配置**:插件 entry config 的 `autoQueen`(默认 `true`);设为 `false` 后 snapshot 不自动激活,
|
|
265
|
+
只能手动 `init` / `queen-on` / `/queen on`。
|
|
249
266
|
- **注入**:`ctx.systemPrompt.section({ name: 'hive:queen', order: 520, text: ({ agent }) => ... })`。
|
|
250
267
|
section 在每次 `ctx.systemPrompt.assemble()` 时求值(`$D/dsh-system-prompt/src/index.ts:485,621`),
|
|
251
268
|
只有 `agent.session.id` 命中的 Session 返回文本;其他会话返回空串。下一个 model step 即生效,
|
|
@@ -253,10 +270,8 @@ token(PATH 名或绝对路径)。
|
|
|
253
270
|
- **角色文本**:读 `<cwd>/.hive/roles/queen.md`(低信任、工作区可控)。注入文本以
|
|
254
271
|
“`[hive:queen] role loaded from <绝对路径> … untrusted`” 开头,总长 **≤ 4096 字符**;超长截断并标注
|
|
255
272
|
`[truncated]`。文件缺失时用内置兜底角色,并标注 `missing; built-in fallback`。
|
|
256
|
-
- **退出**:`/queen off` 命令(只影响调用它的会话)、`op=action&name=queen-off`、`agent/disposed`;
|
|
257
|
-
进程重启后 `Map` 为空 = 自动退出(fail-safe)。
|
|
258
273
|
- **不污染会话日志**:不 append 自定义 session 事件(第三方未知事件会让 resume 拒绝解释日志),
|
|
259
|
-
状态只存在 host 内存 `Map<SessionId,
|
|
274
|
+
状态只存在 host 内存 `Map<SessionId, { text, source }>` + `Set<SessionId>`。
|
|
260
275
|
|
|
261
276
|
证据:`dsh-system-prompt/src/index.ts:42,53,485,621`、`dsh-agent/src/runtime-types.ts:19-21`
|
|
262
277
|
(`AssembleContext.agent` 由 dsh-agent 模块合并进来)、`dsh-agent/src/index.ts:580`(`ctx.agents.get`)、
|
|
@@ -276,7 +291,7 @@ token(PATH 名或绝对路径)。
|
|
|
276
291
|
| “`AssembleContext` 在 system-prompt:53-74” | `AssembleContext` 在 `:42`,`PromptSection` 在 `:53`;**`agent` 字段不在 system-prompt**,由 `dsh-agent/src/runtime-types.ts:19-21` 模块合并 | 运行时 section text 仍收到 `agent`;类型面需 import dsh-agent 类型 |
|
|
277
292
|
| `ctx.systemPrompt.section` 行号 `:485-495` | 实际 `:485` 起;`assemble()` 在 `:621` | 一致 |
|
|
278
293
|
| `commands.register` 未给行号 | `dsh-commands/src/index.ts:285`,返回同步 disposer | 已在 queen 中显式 dispose |
|
|
279
|
-
| 女王端点样例是独立路由 `/api/hive-panel/queen` | 本实现折叠进单一路由 `/api/hive?op=action&name=init\|queen-off` | 少一条路由;语义不变 |
|
|
294
|
+
| 女王端点样例是独立路由 `/api/hive-panel/queen` | 本实现折叠进单一路由 `/api/hive?op=action&name=init\|queen-on\|queen-off` | 少一条路由;语义不变 |
|
|
280
295
|
| 女王角色上限 16 KiB | 本实现按任务要求收紧到 **4096 字符**(含来源标注/退出提示) | 低信任 prompt 更保守 |
|
|
281
296
|
| “用 `resolveCore` 解析 hive 二进制” | host 侧无自动解析;本实现用受信配置 `bins` 或 PATH(`hive`/`hive-tasks`/`hive-run`/`moc`) | 找不到命令时返回干净的非 0 退出码与 stderr,不假装成功 |
|
|
282
297
|
| 组合位置行号 | `dsh-base/cordis.patch.yml`:agent `:82`、commands `:321`、system-prompt `:528`、subprocess `:234`、sandbox `:240`、sandbox-policy `:243`、bash-sandbox `:249`、shell-env `:278`;`dsh-web-app/cordis.patch.yml`:connection `:238`、tool-bash disabled `:517` | 文档行号一致;`ctx.shell` 在 host 平面,第三方 bundle patch 可直接 inject |
|
|
@@ -307,12 +322,13 @@ npm run check
|
|
|
307
322
|
# ok - node --check lib/queen.js
|
|
308
323
|
# ok - node --check lib/client.js
|
|
309
324
|
# ...
|
|
310
|
-
#
|
|
325
|
+
# 22 checks passed
|
|
311
326
|
```
|
|
312
327
|
|
|
313
328
|
覆盖:语法、package/bundle 声明、无代理残留、client bundle 的 `/api/hive` URL 与 Session 注入、
|
|
314
329
|
Connection Fetch 路由注册、快照走 `ctx.shell` 且 cwd/policy 正确、冷会话 cwd、未知 op/会话 400、
|
|
315
|
-
只读语义、动作参数校验与 argv 转义、失败信封、无 `ctx.shell`
|
|
330
|
+
只读语义、动作参数校验与 argv 转义、失败信封、无 `ctx.shell` 拒绝挂载、女王激活/隔离/退出/截断,
|
|
331
|
+
以及 snapshot 自动激活、显式关闭后的抑制、`queen-off` 幂等、`autoQueen=false` 与手动 `queen-on`。
|
|
316
332
|
|
|
317
333
|
不启动、不重启任何 DSH 进程,也不写运行中的 `~/.dsh`。
|
|
318
334
|
|
|
@@ -324,6 +340,8 @@ Connection Fetch 路由注册、快照走 `ctx.shell` 且 cwd/policy 正确、
|
|
|
324
340
|
`systemPrompt.section`、`commands.register`);升级 DSH 需要回归 `npm run check`。
|
|
325
341
|
- 冷会话只能拿 `header.cwd`;`cd` 后的有效 cwd 在 resume 前不可见。
|
|
326
342
|
- 每次轮询会 spawn 1–5 个 CLI 进程(实测单命令 ~110–124 ms),3 s 间隔足够;多客户端同时打开会叠加。
|
|
343
|
+
- 自动女王只以 `refs/hive/v1` 为准:任何已初始化的仓库在该 Session 第一次快照时即进入女王模式;
|
|
344
|
+
用户可用 `/queen off`(本进程内抑制)或配置 `autoQueen: false`(全局关闭自动)退出该行为。
|
|
327
345
|
- 面板触发的命令**不进会话审计**,也没有 approval;需要硬边界时应把操作建模成 turn 内 tool 调用。
|
|
328
346
|
- `hive`/`hive-tasks` 不在 DSH PATH 时必须在 profile config 提供 `bins`,否则动作/快照返回非 0 退出码
|
|
329
347
|
或空数据(与旧 hive-panel 的 fallback 语义一致)。
|