dsh-hive-panel 0.1.8 → 0.2.0

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 CHANGED
@@ -1,3 +1,25 @@
1
+ ## [0.2.0] - 2026-12-04
2
+
3
+ ### Changed
4
+
5
+ - The Hive tab has four lanes (pending / claimed / done / failed), matching hive-tasks
6
+ 1.6.0. The blocked lane and its filter chip, copy and styles are gone; a failed card
7
+ keeps the retry action.
8
+ - Wide boards lay the four lanes out from 820px of container width, each lane at least
9
+ 200px; narrower boards keep the state chips and the single card list. Lane cards keep
10
+ 12px horizontal padding, a 14px title and a 12px meta line.
11
+ - The shared renderer and stylesheet are re-synced from hive-panel 0.4.0 and the browser
12
+ bundle is rebuilt.
13
+
14
+ ### Removed
15
+
16
+ - The `block` action from the native allowlist. Record a failure with `fail` and requeue
17
+ it with `retry`.
18
+
19
+ ### Tests
20
+
21
+ - `npm run check` passes with the action catalog at 18 allowlisted actions.
22
+
1
23
  ## [0.1.8] - 2026-12-04
2
24
 
3
25
  ### Fixed
@@ -6,6 +28,10 @@
6
28
  - The queen notice only documents `/queen off` as the exit; the "dismissing does not
7
29
  change state" clarification moved into the close button's title/aria-label.
8
30
 
31
+ ### Published
32
+
33
+ - npm: `dsh-hive-panel@0.1.8` on 2026-12-04.
34
+
9
35
  ## [0.1.6] - 2026-12-04
10
36
 
11
37
  ### Changed
package/README.md CHANGED
@@ -37,10 +37,10 @@ the Hive CLI writes them.
37
37
 
38
38
  | Capability | What it means |
39
39
  | --- | --- |
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 |
40
+ | **A Hive tab in the conversation** | Board lanes (pending, claimed, done, 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
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
- | **Card actions** | Claim, complete, fail, retry, block, renew, run a round and more — from the card you are looking at |
43
+ | **Card actions** | Claim, complete, fail, retry, 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 |
46
46
 
@@ -51,41 +51,61 @@ the Hive CLI writes them.
51
51
  - Node 22.19 or newer (the DSH runtime).
52
52
  - The Hive CLI packages: [`@d86e/hive`](https://github.com/d86e/hive) and
53
53
  [hive-tasks](https://github.com/d86e/hive-tasks). `hive-runner` and `merge-on-commit`
54
- are optional; their actions are disabled when the binaries are not configured.
54
+ are optional. The panel runs them by their PATH names and retries through `npx` when
55
+ one is not on the shell PATH (see [Configuration](#configuration)).
55
56
  - [dsh-hive-runner](https://github.com/d86e/dsh-hive-runner) is optional; it adds the
56
57
  resident supervisor and its status strip.
57
58
 
58
59
  ## Install
59
60
 
60
- The **desktop** profile is managed by the DSH Desktop application, so
61
- `dsh plugin --profile desktop ...` refuses to edit it. Edit it by hand:
62
-
63
- 1. In `~/.dsh/profiles/desktop/package.json`, add the linked checkout to
64
- `dependencies` and the package name to `dsh.profile.bundles`:
65
-
66
- ```diff
67
- "dependencies": {
68
- + "dsh-hive-panel": "link:/path/to/dsh-hive-panel",
69
- },
70
- "dsh": {
71
- "profile": {
72
- "bundles": [
73
- + "dsh-hive-panel"
74
- ]
75
- }
76
- }
77
- ```
61
+ The `desktop` profile belongs to the DSH Desktop application, but the `dsh` CLI can
62
+ install into it while the app is not running. Use the CLI of the same version as the
63
+ Desktop runtime (the plugin declares compatibility with DSH 0.2.2-rc.5):
78
64
 
79
- Keep the JSON valid: leave the trailing comma only when another entry follows.
65
+ 1. **Quit DSH Desktop completely.** The profile is locked while the app runs.
66
+ If the Desktop app has never been opened, start it once so it creates
67
+ `~/.dsh/profiles/desktop/package.json`, then quit it.
80
68
 
81
- 2. Install the profile dependencies:
69
+ 2. **Install the plugin into the profile.** `dsh` and `pnpm` must be on your PATH;
70
+ the command updates both `dependencies` and `dsh.profile.bundles` for you:
82
71
 
83
72
  ```bash
84
- cd ~/.dsh/profiles/desktop && pnpm install
73
+ dsh plugin --profile desktop add dsh-hive-panel
85
74
  ```
86
75
 
87
- 3. Quit DSH Desktop completely and start it again. Refreshing the page is not enough:
88
- host plugins and browser bundles are loaded at startup.
76
+ For a CLI-managed profile use the same command with that profile name, for example
77
+ `dsh plugin --profile web add dsh-hive-panel`; restart with `dsh web` instead of
78
+ the Desktop app.
79
+
80
+ 3. **Start DSH Desktop again.** Refreshing the page is not enough: host plugins and
81
+ browser bundles are loaded at startup.
82
+
83
+ <details>
84
+ <summary>Manual profile edit (same result, only needed when the CLI is unavailable)</summary>
85
+
86
+ Edit `~/.dsh/profiles/desktop/package.json` while DSH Desktop is not running: add the
87
+ published package to `dependencies`, add the package name to `dsh.profile.bundles`,
88
+ then run `pnpm install` in the profile directory. Keep the JSON valid: leave the
89
+ trailing comma only when another entry follows.
90
+
91
+ ```diff
92
+ "dependencies": {
93
+ + "dsh-hive-panel": "^0.1.8",
94
+ },
95
+ "dsh": {
96
+ "profile": {
97
+ "bundles": [
98
+ + "dsh-hive-panel"
99
+ ]
100
+ }
101
+ }
102
+ ```
103
+
104
+ ```bash
105
+ cd ~/.dsh/profiles/desktop && pnpm install
106
+ ```
107
+
108
+ </details>
89
109
 
90
110
  After the restart the conversation view has an extra **Hive** entry (labelled 蜂群 in a
91
111
  Chinese UI).
@@ -113,18 +133,20 @@ restarts with `dsh web` instead of the desktop app.
113
133
  ## Configuration
114
134
 
115
135
  The plugin ships defaults (read-only). Override them in your profile's
116
- `cordis.patch.yml` by plugin id:
136
+ `cordis.patch.yml` by plugin id; every key is optional and the defaults work on a
137
+ clean machine:
117
138
 
118
139
  ```yaml
119
140
  - id: hive-panel
120
141
  name: dsh-hive-panel
121
142
  config:
122
143
  writable: true
123
- bins:
124
- hive: /path/to/hive/bin/hive.js
125
- tasks: /path/to/hive-tasks/bin/hive-tasks.js
126
- run: /path/to/hive-runner/bin/hive-run.js
127
- moc: /path/to/merge-on-commit/bin/moc.js
144
+ # Optional: pin an executable (PATH name or absolute path).
145
+ # The defaults are the PATH names in the table below; when one is missing the
146
+ # host retries the same command through npx before reporting an error.
147
+ # bins:
148
+ # hive: /path/to/hive/bin/hive.js
149
+ # tasks: /path/to/hive-tasks/bin/hive-tasks.js
128
150
  ```
129
151
 
130
152
  Restart DSH after changing the config.
@@ -133,14 +155,19 @@ Restart DSH after changing the config.
133
155
  | --- | --- | --- |
134
156
  | `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 |
135
157
  | `writable` | `false` | Allow mutating actions (init, add, claim, done, fail, mode, ...). When false the board is still readable and mutations are hidden or rejected |
136
- | `bins.hive` | `hive` from PATH | `hive` executable: PATH name or absolute path |
137
- | `bins.tasks` | `hive-tasks` from PATH | `hive-tasks` executable |
138
- | `bins.run` | `hive-run` from PATH | `hive-run` executable (the run action) |
139
- | `bins.moc` | `moc` from PATH | `moc` executable (merge-on-commit hooks) |
140
-
141
- DSH's host process usually does not inherit your shell PATH, so configure absolute paths
142
- for the Hive binaries if the board is empty or actions fail with a command-not-found
143
- error.
158
+ | `bins.hive` | `hive` from PATH | `hive` executable: PATH name or absolute path. When missing, retried through `npx -y -p @d86e/hive -p hive-consensus -p hive-tasks -p hive-runner -p merge-on-commit hive` |
159
+ | `bins.tasks` | `hive-tasks` from PATH | `hive-tasks` executable; npx fallback `-p hive-tasks` |
160
+ | `bins.run` | `hive-run` from PATH | `hive-run` executable (the run action); npx fallback `-p hive-runner` |
161
+ | `bins.moc` | `moc` from PATH | `moc` executable (merge-on-commit hooks); npx fallback `-p merge-on-commit` |
162
+
163
+ **PATH first, `npx` second.** The defaults are the PATH names above, so a machine with
164
+ `npm i -g` installs works without any config. DSH's host process often does not inherit
165
+ your shell PATH; in that case the host retries the same command once through `npx -y -p
166
+ <package> ...` and only then reports the failure. First use needs network access so npx
167
+ can populate its cache; for an offline machine, install the CLIs globally or set the
168
+ `bins` entries to absolute paths. A configured absolute path is used as-is and is never
169
+ replaced by npx. When the PATH lookup and the npx fallback both fail, the response
170
+ carries an actionable hint (`npm i -g <packages>` plus the `bins.<key>` to set).
144
171
 
145
172
  ## Architecture
146
173
 
@@ -189,7 +216,8 @@ lines prefixed with `[hive-panel]` say whether the host half mounted.
189
216
  **The board is empty.** Check `initialised` in the view. A repository that is not under
190
217
  git, or has not been initialised, shows an initialise button. If the repository is
191
218
  initialised but empty, the Hive binaries are probably not reachable from the host process:
192
- run `hive-tasks list --json` in a terminal, then set `bins` to absolute paths.
219
+ the panel already retries each one through `npx`. Follow the install hint in the error
220
+ (or run `hive-tasks list --json` in a terminal and pin `bins` to that executable).
193
221
 
194
222
  **Every button is disabled or the view says read-only.** `writable` is still `false`.
195
223
  Set it to `true` in the profile config and restart DSH. Read-only mode also disables the
@@ -235,7 +263,7 @@ npm run check # node --check on the entry points + the offline verification
235
263
  npm pack --dry-run # inspect the published contents
236
264
  ```
237
265
 
238
- `scripts/verify.mjs` runs 22 checks against a Cordis-shaped shim: route registration,
266
+ `scripts/verify.mjs` runs 31 checks against a Cordis-shaped shim: route registration,
239
267
  Session cwd resolution, sandbox policy, the action allowlist and quoting, read-only
240
268
  semantics, response contracts, cold Sessions and the queen lifecycle. It never starts or
241
269
  restarts a DSH process.
package/README.zh-CN.md CHANGED
@@ -28,10 +28,10 @@
28
28
 
29
29
  | 能力 | 说明 |
30
30
  | --- | --- |
31
- | **会话里的 Hive 标签页** | 按状态分列的看板(pending / claimed / done / blocked / failed)、任务卡详情和事件尾,作用域是当前 Session 的仓库 |
31
+ | **会话里的 Hive 标签页** | 按状态分列的看板(pending / claimed / done / 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
  | **默认只读** | 开箱即看是安全的;写操作需要显式打开 |
37
37
 
@@ -41,41 +41,55 @@
41
41
  - Node 22.19 或更新(DSH 运行时)。
42
42
  - Hive 命令行包:[`@d86e/hive`](https://github.com/d86e/hive) 与
43
43
  [hive-tasks](https://github.com/d86e/hive-tasks)。`hive-runner` 和
44
- `merge-on-commit` 是可选的,没配置对应二进制时相关动作不可用。
44
+ `merge-on-commit` 是可选的。面板默认用 PATH 名调用,找不到时自动退到 `npx`(见[配置](#配置))。
45
45
  - [dsh-hive-runner](https://github.com/d86e/dsh-hive-runner) 可选:装了才有常驻 supervisor 和状态条。
46
46
 
47
47
  ## 安装
48
48
 
49
- **desktop** profile 由 DSH Desktop 应用独占管理,`dsh plugin --profile desktop ...` 会拒绝修改,需要手工编辑:
50
-
51
- 1. 在 `~/.dsh/profiles/desktop/package.json` 的 `dependencies` 里加这个仓库的 link,并在 `dsh.profile.bundles` 里加包名:
52
-
53
- ```diff
54
- "dependencies": {
55
- + "dsh-hive-panel": "link:/path/to/dsh-hive-panel",
56
- },
57
- "dsh": {
58
- "profile": {
59
- "bundles": [
60
- + "dsh-hive-panel"
61
- ]
62
- }
63
- }
64
- ```
49
+ `desktop` profile 归 DSH Desktop 应用管理,但应用没在运行时可以用 `dsh` CLI 装进去。请使用与桌面运行时同版本的 CLI(插件声明兼容 DSH 0.2.2-rc.5):
65
50
 
66
- JSON 逗号按实际位置调整:新行后面还有依赖就保留行尾逗号,是最后一项就去掉。
51
+ 1. **完全退出 DSH Desktop。** 应用运行时 profile 是被锁住的。
52
+ 如果桌面应用从没打开过,先启动一次让它生成 `~/.dsh/profiles/desktop/package.json`,再退出。
67
53
 
68
- 2. 在 profile 目录安装依赖:
54
+ 2. **把插件装进 profile。** `dsh` 和 `pnpm` 需要在 PATH 上;
55
+ 下面这条命令会同时更新 `dependencies` 和 `dsh.profile.bundles`:
69
56
 
70
57
  ```bash
71
- cd ~/.dsh/profiles/desktop && pnpm install
58
+ dsh plugin --profile desktop add dsh-hive-panel
72
59
  ```
73
60
 
74
- 3. 完全退出并重新打开 DSH Desktop。刷新页面不够:host 插件和浏览器 bundle 都在启动时装载。
61
+ CLI 管理的 profile 用同样的命令换 profile 名,例如
62
+ `dsh plugin --profile web add dsh-hive-panel`;重启方式换成 `dsh web`。
63
+
64
+ 3. **重新启动 DSH Desktop。** 刷新页面不够:host 插件和浏览器 bundle 都在启动时装载。
75
65
 
76
66
  重启后会话视图里会多出 **Hive** 一项(中文界面显示「蜂群」)。
77
67
 
78
- CLI 管理的 profile(例如 `web`)同样改这两处;只是重启方式换成 `dsh web`,而不是桌面应用。
68
+ <details>
69
+ <summary>手工改 profile(效果相同,仅在 CLI 不可用时使用)</summary>
70
+
71
+ 在 DSH Desktop 退出时编辑 `~/.dsh/profiles/desktop/package.json`:把已发布包加进
72
+ `dependencies`,把包名加进 `dsh.profile.bundles`,然后在 profile 目录执行
73
+ `pnpm install`。JSON 逗号按实际位置调整:新行后面还有依赖就保留行尾逗号,是最后一项就去掉。
74
+
75
+ ```diff
76
+ "dependencies": {
77
+ + "dsh-hive-panel": "^0.1.8",
78
+ },
79
+ "dsh": {
80
+ "profile": {
81
+ "bundles": [
82
+ + "dsh-hive-panel"
83
+ ]
84
+ }
85
+ }
86
+ ```
87
+
88
+ ```bash
89
+ cd ~/.dsh/profiles/desktop && pnpm install
90
+ ```
91
+
92
+ </details>
79
93
 
80
94
  ## 五分钟上手
81
95
 
@@ -88,18 +102,19 @@ CLI 管理的 profile(例如 `web`)同样改这两处;只是重启方式
88
102
 
89
103
  ## 配置
90
104
 
91
- 插件自带默认值(只读)。要改就在 profile 的 `cordis.patch.yml` 里按插件 id 覆盖:
105
+ 插件自带默认值(只读)。要改就在 profile 的 `cordis.patch.yml` 里按插件 id 覆盖;
106
+ 每个键都可选,默认值在干净机器上就能用:
92
107
 
93
108
  ```yaml
94
109
  - id: hive-panel
95
110
  name: dsh-hive-panel
96
111
  config:
97
112
  writable: true
98
- bins:
99
- hive: /path/to/hive/bin/hive.js
100
- tasks: /path/to/hive-tasks/bin/hive-tasks.js
101
- run: /path/to/hive-runner/bin/hive-run.js
102
- moc: /path/to/merge-on-commit/bin/moc.js
113
+ # 可选:固定某个可执行文件(PATH 名或绝对路径)。
114
+ # 默认值就是下面表格里的 PATH 名;找不到时宿主会用 npx 重试同一条命令。
115
+ # bins:
116
+ # hive: /path/to/hive/bin/hive.js
117
+ # tasks: /path/to/hive-tasks/bin/hive-tasks.js
103
118
  ```
104
119
 
105
120
  改完重启 DSH 生效。
@@ -108,12 +123,16 @@ CLI 管理的 profile(例如 `web`)同样改这两处;只是重启方式
108
123
  | --- | --- | --- |
109
124
  | `autoQueen` | `true` | 对已初始化的仓库打开视图时自动让当前会话成为女王。设为 `false` 时只能用 `/queen on` 或面板动作手动进入 |
110
125
  | `writable` | `false` | 是否允许写动作(init、add、claim、done、fail、mode……)。关闭时看板仍可读,写动作被隐藏或拒绝 |
111
- | `bins.hive` | PATH 上的 `hive` | `hive` 可执行文件:PATH 名或绝对路径 |
112
- | `bins.tasks` | PATH 上的 `hive-tasks` | `hive-tasks` 可执行文件 |
113
- | `bins.run` | PATH 上的 `hive-run` | `hive-run` 可执行文件(跑一轮动作) |
114
- | `bins.moc` | PATH 上的 `moc` | `moc` 可执行文件(merge-on-commit) |
126
+ | `bins.hive` | PATH 上的 `hive` | `hive` 可执行文件:PATH 名或绝对路径。找不到时用 `npx -y -p @d86e/hive -p hive-consensus -p hive-tasks -p hive-runner -p merge-on-commit hive` 重试 |
127
+ | `bins.tasks` | PATH 上的 `hive-tasks` | `hive-tasks` 可执行文件;npx 回退 `-p hive-tasks` |
128
+ | `bins.run` | PATH 上的 `hive-run` | `hive-run` 可执行文件(跑一轮动作);npx 回退 `-p hive-runner` |
129
+ | `bins.moc` | PATH 上的 `moc` | `moc` 可执行文件(merge-on-commit);npx 回退 `-p merge-on-commit` |
115
130
 
116
- DSH 宿主进程通常拿不到你 shell 的 PATH:如果看板是空的、动作报 command not found,就把 Hive 二进制配成绝对路径。
131
+ **先 PATH,再 npx。** 默认值就是上面的 PATH 名,所以用 `npm i -g` 装过的机器不需要任何配置。
132
+ DSH 宿主进程通常拿不到你 shell 的 PATH,这时宿主会把同一条命令用 `npx -y -p <包> ...` 重试一次,
133
+ 仍然失败才报错。首次使用需要联网让 npx 填充缓存;离线机器请全局安装或用绝对路径固定 `bins`。
134
+ 显式配置的绝对路径按原样使用,不会被 npx 替换。PATH 和 npx 都失败时,响应里会带可执行的提示
135
+ (`npm i -g <包列表>` 和该设置的 `bins.<键>`)。
117
136
 
118
137
  ## 架构
119
138
 
@@ -155,7 +174,7 @@ DSH 宿主进程
155
174
 
156
175
  **Hive 视图没出现。** 浏览器 bundle 在启动时装载。确认 profile 的 `dependencies` 和 `dsh.profile.bundles` 两处都有 `dsh-hive-panel`、`pnpm install` 成功、DSH 是完全重启的。DSH 日志里 `[hive-panel]` 前缀的行会说明 host 半有没有挂上。
157
176
 
158
- **看板是空的。** 先看视图里的 `initialised`。仓库不在 git 下、或还没初始化时会显示初始化按钮;已初始化但空,通常是宿主进程找不到 Hive 二进制——先在终端跑 `hive-tasks list --json`,再把 `bins` 配成绝对路径。
177
+ **看板是空的。** 先看视图里的 `initialised`。仓库不在 git 下、或还没初始化时会显示初始化按钮;已初始化但空,通常是宿主进程找不到 Hive 二进制——面板已经会自动用 `npx` 重试。按报错里的安装提示处理(或者在终端跑 `hive-tasks list --json`,把 `bins` 固定到那个可执行文件)。
159
178
 
160
179
  **按钮全灰 / 提示只读。** `writable` 还是 `false`。在 profile 配置里改成 `true` 并重启 DSH。只读模式下「初始化 Hive」也不可用。
161
180
 
@@ -182,7 +201,7 @@ npm run check # 入口语法检查 + 离线验证
182
201
  npm pack --dry-run # 检查发布内容
183
202
  ```
184
203
 
185
- `scripts/verify.mjs` 在 Cordis 形状的 shim 上跑 22 项检查:路由注册、Session cwd 解析、sandbox 策略、动作白名单与转义、只读语义、响应契约、冷会话和女王生命周期。不会启动或重启任何 DSH 进程。
204
+ `scripts/verify.mjs` 在 Cordis 形状的 shim 上跑 29 项检查:路由注册、Session cwd 解析、sandbox 策略、动作白名单与转义、只读语义、响应契约、冷会话和女王生命周期。不会启动或重启任何 DSH 进程。
186
205
 
187
206
  浏览器 bundle `lib/client.js` 是生成物:改完 `src/` 后跑 `node scripts/build-client.mjs`。线上协议见 [SPEC.md](SPEC.md),实现说明和 DSH 实测证据见 [docs/DESIGN.md](docs/DESIGN.md)。
188
207
 
package/SPEC.md CHANGED
@@ -134,8 +134,9 @@ these top-level fields:
134
134
 
135
135
  ## 6. Action catalog
136
136
 
137
- Actions: `init add plan claim done fail retry block renew mode learn recall verdict run
138
- commit doctor roles-add remove` plus the host-memory actions `queen-on` and `queen-off`.
137
+ Actions: `init add plan claim done fail retry renew mode learn recall verdict run
138
+ commit doctor roles-add roles-remove remove` plus the host-memory actions `queen-on`
139
+ and `queen-off`.
139
140
 
140
141
  ### 6.1 `roles-add`
141
142
 
@@ -188,6 +189,33 @@ hive-tasks (`bin: 'hive'`, argv `['tasks', 'rm', <id>]`), through the same shell
188
189
  The card disappears from the next snapshot poll. Mutating action: requires
189
190
  `writable: true`, otherwise `403` read-only.
190
191
 
192
+ ### 6.3 `roles-remove`
193
+
194
+ `POST ?op=action&name=roles-remove&sessionId=<id>` with JSON body:
195
+
196
+ ```json
197
+ { "name": "reviewer" }
198
+ ```
199
+
200
+ Maps to `hive roles rm <name>` in the Session cwd through the shell seam (argv tokens,
201
+ single-quoted). It drops the role from `.hive/roles.yaml`; the CLI keeps the contract
202
+ file `.hive/roles/<name>.md` and says so on stdout.
203
+
204
+ - `name` (required) — `^[a-z][a-z0-9-]{1,31}$` (2–32 chars); anything else is a
205
+ `400 hive/invalid-argument` before execution.
206
+ - Neither `--force` nor `--keep-file` is ever sent, so the CLI owns every decision.
207
+ A missing role is a normal CLI refusal: exit `2` with
208
+ `hive roles: role "<name>" not found in .hive/roles.yaml` on stderr, returned
209
+ unchanged as `{ ok:false, code:2, stdout:"", stderr:<that text> }`.
210
+ - The host does not pre-check in-flight work or limits: `hive roles rm` itself does not
211
+ inspect cards, so deletion succeeds while cards still name the role (they keep their
212
+ `role` field; the supervisor simply has no definition/limit entry for it). A stale
213
+ `<role>` key can remain in `.hive/limits.json`; this action does not edit that file.
214
+ - Success: `200 { ok:true, code:0, stdout:"removed role <name> from .hive/roles.yaml\n
215
+ kept .hive/roles/<name>.md (pass --keep-file to silence)\n", stderr:"" }`.
216
+ The role disappears from snapshot `roles.list` on the next poll. Mutating action:
217
+ requires `writable: true`, otherwise `403` read-only.
218
+
191
219
  For every action the host builds one fixed command template. Each argument field is
192
220
  validated (id, agent, ttl, sha, ref mode, integer ranges, string length, NUL) and every
193
221
  token is single-quoted before it enters the shell seam:
@@ -199,7 +227,10 @@ command = [bin, ...argv].map(quote).join(' ')
199
227
 
200
228
  Invalid input is rejected with `400` before execution. `bins` (hive, hive-tasks,
201
229
  hive-run, moc) come only from trusted host configuration and must each be a single
202
- executable token: a PATH name or an absolute path.
230
+ executable token: a PATH name or an absolute path. The default for every key is its
231
+ PATH name; a bare default that the shell cannot resolve is retried once as
232
+ `npx -y -p <published package> ... <bin>`, and a configured absolute path is never
233
+ replaced. When both attempts fail, the error carries an install hint.
203
234
 
204
235
  ## 7. Execution
205
236
 
package/cordis.patch.yml CHANGED
@@ -15,10 +15,12 @@
15
15
  # An initialised Session auto-enters queen mode from the snapshot loop.
16
16
  # Set false to require /queen on or the queen-on action.
17
17
  autoQueen: true
18
- # Trusted host-side executables. Omit to use PATH names; absolute paths
19
- # are useful when hive/hive-tasks are not installed on the DSH PATH.
18
+ # Trusted host-side executables. Omit to use the PATH names below; a
19
+ # missing PATH name is retried once through npx (-y -p <package> ...).
20
+ # An explicit absolute path is used as-is and never replaced.
21
+ # Defaults: hive, hive-tasks, hive-run, moc.
20
22
  # bins:
21
- # hive: "/path/to/hive-consensus/bin/hive.js"
23
+ # hive: "/path/to/hive/bin/hive.js"
22
24
  # tasks: "/path/to/hive-tasks/bin/hive-tasks.js"
23
25
  # run: "/path/to/hive-runner/bin/hive-run.js"
24
- # moc: "moc"
26
+ # moc: "/path/to/merge-on-commit/bin/moc.js"
package/docs/DESIGN.md CHANGED
@@ -17,7 +17,7 @@
17
17
  | `lib/index.js` | Host 半:`/api/hive` Connection Fetch 路由、cwd 解析、`ctx.shell` 执行、动作白名单 |
18
18
  | `lib/queen.js` | 女王模式:每 Session 内存开关、`hive:queen` system-prompt section、`/queen` 命令 |
19
19
  | `lib/client.js` | 浏览器半:`window.__ModuleLoader__.load({ id, factory })`,注册 `conversation.view` 条目 |
20
- | `src/client.template.js` | client bundle 模板(slot 注册、字典、locale) |
20
+ | `src/client.template.js` | client bundle 模板(slot 注册、字典、locale、打开 worker 会话的 `openSession` 回调) |
21
21
  | `scripts/build-client.mjs` | 把 `src/panel.js` 内联进 `lib/client.js`,并注入同源 URL |
22
22
  | `scripts/verify.mjs` | 离线验证(Cordis 形状 shim,不启动 DSH) |
23
23
  | `docs/DESIGN.md` | 本文件 |
@@ -86,6 +86,8 @@ ctx.slots.inject('conversation.view', () => ctx.slots.register({
86
86
  hiveSessionId: typeof sessionId === 'string' ? sessionId : '',
87
87
  hiveTranslate: t,
88
88
  hiveLocaleSubscribe: listener => ctx.locale.subscribe(listener),
89
+ // 仅当宿主暴露 ctx.uiWorkspace.openSession 时才有这一项(见 §7)。
90
+ hiveOpenSession: childSessionId => { /* ... */ },
89
91
  }),
90
92
  }, HivePanelMount))
91
93
  ```
@@ -118,6 +120,11 @@ actionsUrl: HIVE_API_PREFIX + '?op=action&name={name}' + suffix,
118
120
  `src/panel.js` 的 `requestAction()` 支持 `{name}` 占位符(独立页面仍用旧的
119
121
  `/api/actions/<name>` 形式,保持向后兼容)。**浏览器不传 cwd**;cwd 永远由 host 从 Session 状态推导。
120
122
 
123
+ `hiveOpenSession` 不在 `inject(sessionId)` 里无条件出现:只有 `ctx.get('uiWorkspace')`
124
+ 的 `openSession` 是函数时才注入,`HivePanelMount` 再把它作为
125
+ `HIVE_PANEL.mount({ openSession })` 传给渲染器。独立页面没有这个选项,卡片详情里就没有
126
+ 「打开智能体对话」按钮(见 §7)。
127
+
121
128
  ## 4. 通道(结论:Connection exact Fetch route)
122
129
 
123
130
  ### 4.1 服务与注册
@@ -222,7 +229,7 @@ child_process 会绕过 Session sandbox mode、凭证擦除、超时/输出上
222
229
  | --- | --- |
223
230
  | 快照 | `hive board --json`、`hive-tasks list --json`、`hive-tasks stats --json`、`hive roles list --json` |
224
231
  | 快照探针 | `git for-each-ref --format=%(refname) refs/hive/v1`、`git cat-file -p refs/hive/v1/mode` |
225
- | 动作 | `init add plan claim done fail retry block renew mode learn recall verdict run commit doctor roles-add` |
232
+ | 动作 | `init add plan claim done fail retry renew mode learn recall verdict run commit doctor roles-add roles-remove remove` |
226
233
 
227
234
  动作表沿用 `hive-panel/src/actions.js` 的 argv 构造;每个字段先校验(id/agent/ttl/sha/mode/整数范围/
228
235
  字符串长度/NUL),再作为独立 argv token 用单引号严格转义:
@@ -236,7 +243,7 @@ command = [bin, ...argv].map(quote).join(' ')
236
243
  不会变成 shell 语法。`bins`(hive/hive-tasks/hive-run/moc)只能来自受信 host 配置,必须是单个可执行
237
244
  token(PATH 名或绝对路径)。
238
245
 
239
- `roles-add` 是唯一新增的角色写动作:body `{ name, adapter?, model?, description? }` 映射为
246
+ `roles-add` 是角色写动作:body `{ name, adapter?, model?, description? }` 映射为
240
247
  `hive roles add <name> [--adapter dsh|claude|codex] [--model M] [--description TEXT]`;`name` 必须匹配
241
248
  `^[a-z][a-z0-9-]{1,31}$`,`adapter` 只允许 `dsh|claude|codex`,`model` 只允许
242
249
  `[A-Za-z0-9._:-]{1,64}`,`description` 是可选自由文本(≤2000 字符;`""`/`null`/省略都等价于
@@ -244,6 +251,13 @@ token(PATH 名或绝对路径)。
244
251
  `## Contract` 段)。绝不发送 `--force`:已存在的角色由 CLI 以退出码 2 + stderr 返回,
245
252
  动作信封原样带回(`ok:false, code:2, stderr:"hive roles: role \"name\" already exists; …"`)。
246
253
 
254
+ `roles-remove` 是与之配对的删除动作:body `{ name }`(同样 `^[a-z][a-z0-9-]{1,31}$`)映射为
255
+ `hive roles rm <name>`,cwd 同为会话仓库,**不发** `--force`/`--keep-file`;成功返回 CLI 的
256
+ `removed role … / kept .hive/roles/<name>.md` stdout,角色不存在时 CLI 退出 2 + stderr
257
+ (`role "<name>" not found …`)原样进动作信封。host 不预检在飞任务/限额:`hive roles rm` 本身
258
+ 不检查卡片,登记表删除后卡片仍保留 `role` 字段,`.hive/limits.json` 里的旧 key 不会被本动作清理;
259
+ 新角色列表在下一次 snapshot `roles.list` 轮询中消失。该动作需要 `writable: true`。
260
+
247
261
  ### 5.4 权限与审计(明确取舍)
248
262
 
249
263
  - 有:Session sandbox policy(read-only 会话里的写命令会被沙箱拒绝,`result.sandbox.denied` 可在结果里
@@ -292,7 +306,67 @@ token(PATH 名或绝对路径)。
292
306
  `dsh-commands/src/index.ts:285`(`commands.register` 返回 disposer)、
293
307
  `dsh-agent/src/runtime-types.ts:300`(`agent/disposed` 载荷 `{ agent }`)。
294
308
 
295
- ## 7. 0.2.2-rc.5 实测差异(文档 vs asar 实际代码)
309
+ ## 7. 打开 worker 的子智能体会话(结论:客户端导航 API,无 URL)
310
+
311
+ 卡片详情里「最近一次执行」的「打开智能体对话 / Open agent chat」等价于点击顶部
312
+ “子智能体”下拉里的某一项:**只能在客户端插件里调用
313
+ `ctx.uiWorkspace.openSession(target)`**。DSH Web 没有 `/session/<id>` 路由;会话导航
314
+ 没有 URL 参与(选择只存在 `dsh.sessions.current` persist store 里),`history.pushState` 不可行。
315
+
316
+ ### 7.1 顶部列表属于哪个包
317
+
318
+ 顶部列表是 Conversation header actions band 里的 `SubagentCatalogAction` /
319
+ `SubagentHeaderLineage`,来自 **`@deepseek-ai/dsh-client-ui-subagent`**;
320
+ `dsh-client-ui-agent-team` 是共享任务板(TeamBoard),不是子智能体列表。
321
+
322
+ 点击一行(`$D/dsh-client-ui-subagent/src/client/SubagentHeaderLineage.tsx:324-332`):
323
+
324
+ ```ts
325
+ openChild({ parentSessionId, childSessionId: entry.id, mode: entry.mode }) // SubagentAddress
326
+ ```
327
+
328
+ 在 `$D/dsh-client-ui-subagent/src/client/index.ts:60-66` 落到:
329
+
330
+ ```ts
331
+ ctx.uiWorkspace.openSession(address /* SubagentAddress */)
332
+ ```
333
+
334
+ ### 7.2 确切 API 与参数(0.2.2-rc.5 asar)
335
+
336
+ | 项 | 结论 | 证据(asar 内路径) |
337
+ | --- | --- | --- |
338
+ | 服务 | `ctx.uiWorkspace`(`UiWorkspaceService`,`Service(ctx, 'uiWorkspace')`) | `dsh-client-ui-workspace/src/client/navigation.ts:166,195` |
339
+ | 方法 | `openSession(target: SessionTarget): void` | `…/navigation.ts:45,293` |
340
+ | 参数 | `SessionTarget = SessionId \| SubagentAddress`;`SubagentAddress = { parentSessionId, childSessionId, mode: 'one-shot' \| 'continuable' \| 'unknown' }` | `dsh-api-session-controller/src/client/contract/sessions.ts:22`、`dsh-subagent/src/control-types.ts:62-71` |
341
+ | 语义 | `replaceMain(target, lifetime.signal, 'reveal')` → `ctx.sessions.retain(target, { source: 'mainView' })`,把选择写进 `dsh.sessions.current`(persist store)并 `ctx.layout.selectPanel(null)`;纯内存选中,不改 URL | `…/navigation.ts:293-295,523-553` |
342
+ | 裸 id 何时可用 | `resolveTarget` 接受裸 `SessionId`:`ctx.sessions.has(id)` 或宿主 `session.list` 里有该行、或能由 `subagentAddress(id)` 推导;否则同步抛 `sessions.retain: unknown session <id>` | `dsh-api-session-controller/src/client/sessions/manager.ts:140-152` |
343
+ | 子会话地址 | `ctx.sessions.subagentAddress(id)`:依次取已 retained 地址、父 Session 的 `subagentCatalog` 行、`origin: 'subagent'` 的列表行(mode 记为 `unknown`);返回它在面包屑里显示 parent/mode | `…/manager.ts:160-181`、`…/sessions/service.ts:356-358` |
344
+ | 其它入口 | `dsh-client-ui-workspace` 的 `WorkspaceBrowserInjected['open']` 只是再导出一遍 `uiWorkspace.openSession`,不是另一条 API | `…/src/client/index.ts:190-192,303,341` |
345
+ | URL | 会话导航没有 URL 路由,不存在 `/session/<id>`。全 asar 逐文件扫描 `pushState`/`replaceState`:`dsh-client-ui-*` 里只有文档预览的 excel/pdf vendor 产物命中,另有 `dsh-experimental-inspector` 的 DevTools vendor chunk,均与会话导航无关 | 扫描 18783 个文本文件(约 190 MB) |
346
+
347
+ ### 7.3 本插件的落地方式
348
+
349
+ 1. client 半在 `apply` 里实现 `openSession(sessionId)`(`src/client.template.js`):用
350
+ `ctx.get('uiWorkspace')` 懒解析可选服务;再用 `ctx.get('sessions')?.subagentAddress(id)`
351
+ 优先取 catalog 地址(与点列表项完全一致),拿不到就传裸 id 让 client 自己解析。
352
+ 用 `ctx.get` 读可选依赖、不写进 `inject`,所以没有 Workspace 导航的 profile 仍能加载插件。
353
+ 2. 只有 `uiWorkspace.openSession` 可用时才把 `hiveOpenSession` 放进
354
+ `conversation.view` 的 `inject(sessionId)` props;`scripts/build-client.mjs` 把它作为
355
+ `HIVE_PANEL.mount({ openSession })` 传给渲染器。
356
+ 3. 渲染器(独立页面与 DSH 共用的 `src/panel.js`)只在 `lastRun.sessionId` 非空**且**
357
+ `openSession` 是函数时渲染按钮;缺任一半都不渲染(不置灰占位)。点击只调用宿主回调,
358
+ 浏览器从不自己拼路由或 URL。
359
+ 4. snapshot 的 `lastRun` 由 `lib/index.js` 原样透传 runner 0.6.4 写入的
360
+ `sessionId`/`agentName`(有则带、无则省略,legacy 记录形状不变);不新增 HTTP 路由。
361
+
362
+ ### 7.4 不重启进程的验证边界
363
+
364
+ 客户端导航是浏览器内行为:`scripts/verify.mjs` 用 Cordis 形状 shim 断言
365
+ `inject(sessionId).hiveOpenSession` 存在时把 catalog 地址转发给 `uiWorkspace.openSession`、
366
+ 无 `uiWorkspace` 时该 prop 不出现、client bundle 把 `openSession` 传进 mount;真正的
367
+ “切到 worker 会话”仍需在浏览器里点一次确认。
368
+
369
+ ## 8. 0.2.2-rc.5 实测差异(文档 vs asar 实际代码)
296
370
 
297
371
  研读 `docs/RESEARCH.md` 与 `docs/QUEEN-ACTIVATION.md` 时核对 asar,记录差异如下(以实际代码为准):
298
372
 
@@ -310,7 +384,7 @@ token(PATH 名或绝对路径)。
310
384
  | “用 `resolveCore` 解析 hive 二进制” | host 侧无自动解析;本实现用受信配置 `bins` 或 PATH(`hive`/`hive-tasks`/`hive-run`/`moc`) | 找不到命令时返回干净的非 0 退出码与 stderr,不假装成功 |
311
385
  | 组合位置行号 | `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 |
312
386
 
313
- ## 8. 安装与重启
387
+ ## 9. 安装与重启
314
388
 
315
389
  `~/.dsh/profiles/web/package.json`:
316
390
 
@@ -327,7 +401,7 @@ token(PATH 名或绝对路径)。
327
401
  通过内置 Plugins 页面 / `plugin_manager` 安装时通常由 live profile recompose,无需重启。
328
402
  只改 `lib/client.js` 的 UI 代码时,有 client HMR watcher 可不重启 Host。
329
403
 
330
- ## 9. 验证(已跑通)
404
+ ## 10. 验证(已跑通)
331
405
 
332
406
  ```bash
333
407
  cd /path/to/dsh-hive-panel
@@ -336,27 +410,35 @@ npm run check
336
410
  # ok - node --check lib/queen.js
337
411
  # ok - node --check lib/client.js
338
412
  # ...
339
- # 24 checks passed
413
+ # 31 checks passed
340
414
  ```
341
415
 
342
416
  覆盖:语法、package/bundle 声明、无代理残留、client bundle 的 `/api/hive` URL 与 Session 注入、
417
+ client 的 `openSession` 回调注入(有/无 `uiWorkspace` 两种宿主)、snapshot `lastRun` 的
418
+ `sessionId`/`agentName` 透传与 legacy 记录形状、
343
419
  Connection Fetch 路由注册、快照走 `ctx.shell` 且 cwd/policy 正确、冷会话 cwd、未知 op/会话 400、
344
420
  只读语义、动作参数校验与 argv 转义、失败信封、无 `ctx.shell` 拒绝挂载、女王激活/隔离/退出/截断,
345
421
  以及 snapshot 自动激活、显式关闭后的抑制、`queen-off` 幂等、`autoQueen=false` 与手动 `queen-on`、
346
- `roles` 快照(角色列表 + 持久限额)、`roles-add` 的参数校验/argv/仓库 cwd、重复角色的 CLI stderr 透传。
422
+ `roles` 快照(角色列表 + 持久限额)、`roles-add`(含 description)的参数校验/argv/仓库 cwd、
423
+ 重复角色的 CLI stderr 透传、`roles-remove` 的 argv/非法名/只读 403/CLI 失败透传,以及 `remove` 的卡片 id 校验。
347
424
 
348
425
  不启动、不重启任何 DSH 进程,也不写运行中的 `~/.dsh`。
349
426
 
350
- ## 10. 风险与未验证点
427
+ ## 11. 风险与未验证点
351
428
 
352
429
  - **未在真实 DSH Web 页面里端到端跑过**(硬约束:不重启运行中的 dsh web)。挂载点/通道/执行层均按
353
430
  asar 公开 API + 官方包用法交叉验证;首次加载若 slot 对 `inject` 有额外要求,需要在浏览器控制台确认。
354
431
  - **依赖 0.2.2-rc.5 的公开 API**(`connection.fetch.register`、`ctx.shell`、`workingDirectory`、
355
- `systemPrompt.section`、`commands.register`);升级 DSH 需要回归 `npm run check`。
432
+ `systemPrompt.section`、`commands.register`,以及浏览器端的
433
+ `ctx.uiWorkspace.openSession(SessionTarget)`);升级 DSH 需要回归 `npm run check`。
434
+ - 打开 worker 会话只验证到 shim 层:`uiWorkspace` 服务缺失时插件仍加载且按钮不渲染,
435
+ 但“真的切过去”没有在运行中的页面里点过(不重启进程);worker 激活产生的子会话只有在
436
+ runner 0.6.4+ 写完 `.hive/runs/<id>.json` 后才会出现按钮。
356
437
  - 冷会话只能拿 `header.cwd`;`cd` 后的有效 cwd 在 resume 前不可见。
357
438
  - 每次轮询会 spawn 1–5 个 CLI 进程(实测单命令 ~110–124 ms),3 s 间隔足够;多客户端同时打开会叠加。
358
439
  - 自动女王只以 `refs/hive/v1` 为准:任何已初始化的仓库在该 Session 第一次快照时即进入女王模式;
359
440
  用户可用 `/queen off`(本进程内抑制)或配置 `autoQueen: false`(全局关闭自动)退出该行为。
360
441
  - 面板触发的命令**不进会话审计**,也没有 approval;需要硬边界时应把操作建模成 turn 内 tool 调用。
361
- - `hive`/`hive-tasks` 不在 DSH PATH 时必须在 profile config 提供 `bins`,否则动作/快照返回非 0 退出码
362
- 或空数据(与旧 hive-panel 的 fallback 语义一致)。
442
+ - `hive`/`hive-tasks` 不在 DSH PATH 时,宿主先按 PATH 名执行,失败后自动用
443
+ `npx -y -p <包> ...` 重试一次;两者都失败才返回带安装提示的非 0 退出码或空数据。显式配置的
444
+ 绝对路径不会被替换。