@d86e/hive-panel 0.4.3 → 1.0.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/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
6
6
  [![npm](https://img.shields.io/npm/v/@d86e/hive-panel?style=flat-square&logo=npm&color=cb3837)](https://www.npmjs.com/package/@d86e/hive-panel)
7
7
 
8
- **A standalone browser board for a Hive swarm: who is online, what each agent is doing, every task lane, and the event tail — served from the refs and files the tools already write.**
8
+ **A standalone browser board for a Hive swarm: who is online, what each agent is doing, the four task lanes, and the event tail — served from the refs and files the tools already write.**
9
9
 
10
10
  > zero dependencies · one local HTTP server, bound to 127.0.0.1 · no database
11
11
 
@@ -17,7 +17,8 @@ npx @d86e/hive-panel --repo /path/to/repo
17
17
  ```
18
18
 
19
19
  `--repo` defaults to the current directory and `--port` defaults to `7717`. The
20
- server binds `127.0.0.1` only and is read-only without `--write`.
20
+ server binds `127.0.0.1` only and is read-only without `--write`. Node.js 22.19 or
21
+ newer is required.
21
22
 
22
23
  If `7717` is already taken the server exits with a one-line message instead of a
23
24
  stack trace. Ask the OS for a free port and read the real one from the startup
@@ -36,11 +37,14 @@ node bin/hive-panel.js --repo .
36
37
  ```
37
38
 
38
39
  If the Hive CLIs are not on PATH, point at them with the env vars (no file
39
- needs editing; `git` is resolved from PATH and the port bind is IPv4 loopback only):
40
+ needs editing; `git` is resolved from PATH and the port bind is IPv4 loopback
41
+ only). `HIVE_RUN_BIN` backs the plan/run actions and `MOC_BIN` backs commit:
40
42
 
41
43
  ```bash
42
44
  HIVE_TASKS_BIN=/path/to/hive-tasks/bin/hive-tasks.js \
43
45
  HIVE_BIN=/path/to/hive-consensus/bin/hive.js \
46
+ HIVE_RUN_BIN=/path/to/hive-run/bin/hive-run.js \
47
+ MOC_BIN=/path/to/moc/bin/moc.js \
44
48
  npx @d86e/hive-panel --repo .
45
49
  ```
46
50
 
@@ -60,12 +64,26 @@ CI, or a second browser tab. The two share only the repository — the refs and
60
64
 
61
65
  | Column | Source |
62
66
  | --- | --- |
63
- | Agents | `hive board --json` (state, current card, files, last seen) |
64
- | Tasks | `hive-tasks list --json`, split into pending / claimed / done / failed |
65
- | Events | the last 80 lines of `.hive/events.jsonl` |
66
- | Header | mode (free / freeze) and `hive-tasks stats --json` |
67
-
68
- The page polls `/api/snapshot` every 3 seconds. One process serves one repository.
67
+ | Agents | `hive board --json`; the header's agents chip shows the count and opens the first agent's raw record |
68
+ | Tasks | `hive-tasks list --json`, split into four lanes: pending / claimed / done / failed |
69
+ | Events | the newest 80 lines of `.hive/events.jsonl` (three shown until expanded) |
70
+ | Header | repository path, the task/agent counters and `hive-tasks stats --json`; the toolbar's `Pause` / `Resume` reflects free / freeze |
71
+
72
+ Wide boards lay the four lanes out side by side; narrower boards switch to state
73
+ chips plus a single list. Each lane is newest first by the time the task entered
74
+ that state (`stateChangedAt`, falling back to `updatedAt` and then `createdAt`),
75
+ and only a virtualized window of rows is in the DOM, so thousands of tasks stay
76
+ responsive. A lane row shows just the task title.
77
+
78
+ Click a task for its dialog: id, role, state and file scopes, the last run
79
+ (status, agent, timestamps, short commit, the agent output with a copy button,
80
+ "Also writing" overlaps from hive-consensus announcements, and the "Read N
81
+ lessons" memory-recall line), and the actions for its state. A host that can
82
+ navigate agent sessions also gets "Open agent chat" in the last-run block; the
83
+ standalone page does not.
84
+
85
+ The page polls `/api/snapshot` every 3 seconds and pauses while the tab is
86
+ hidden. One process serves one repository.
69
87
 
70
88
  ## When the repository is not initialised
71
89
 
@@ -82,12 +100,16 @@ initialised" to ready without treating it as an error.
82
100
  npx @d86e/hive-panel --repo /path/to/repo --write
83
101
  ```
84
102
 
85
- Adds a freeze toggle, `New task` (add), `Give the Queen a goal` (plan),
86
- `Commit`, and per-card actions (claim / done / fail / retry / delete), backed by
87
- `/api/actions/*` for every CLI verb the panel knows. Each action is a fixed argv
88
- builder — nothing else is callable. The page still only reads: it posts, then
89
- polls. Deleting is a red button in the card drawer behind a second confirmation;
90
- a claimed card keeps the button disabled (release or reopen it first).
103
+ Adds a `Pause` / `Resume` toggle, `New task` (add), `Give the Queen a goal`
104
+ (plan), and task actions in the detail dialog (claim / done / fail / retry /
105
+ delete), backed by `/api/actions/*` for every CLI verb the panel knows. Each
106
+ action is a fixed argv builder — nothing else is callable. The page still only
107
+ reads: it posts, then polls. The goal dialog previews the plan before writing it.
108
+ Delete is a red button in the dialog footer behind a confirmation; a claimed
109
+ task keeps it disabled until the task is done or failed.
110
+
111
+ The goal dialog's **Max tasks** field defaults to `50`; set it to `0` for no limit
112
+ (the value is passed to `--max-cards` unchanged).
91
113
 
92
114
  ## API
93
115
 
@@ -96,7 +118,7 @@ GET /api/snapshot -> { at, repo, initialised, mode, board, tasks, stats, even
96
118
  GET /api/health -> { ok, repo, port, pid }
97
119
  GET /api/actions -> { writable, actions: [...] }
98
120
  POST /api/actions/<name> the table in SPEC.md
99
- POST /api/mode { mode, reason }
121
+ POST /api/mode { mode }
100
122
  POST /api/retry { id }
101
123
  GET / -> the page
102
124
  ```
@@ -116,7 +138,7 @@ GET / -> the page
116
138
 
117
139
  ## Design
118
140
 
119
- - Read-only by default: the page never claims, completes or edits a card; writes
141
+ - Read-only by default: the page never claims, completes or edits a task; writes
120
142
  are opt-in with `--write` and go through the fixed action table.
121
143
  - Contract-only: it shells out to the documented CLIs and never imports the
122
144
  core. A missing CLI degrades to empty data instead of failing the page.
@@ -129,7 +151,14 @@ GET / -> the page
129
151
  network; put an authenticating reverse proxy in front if you really need
130
152
  remote access.
131
153
  - One repository per process and one port per process.
132
- - The agents column needs `hive-consensus` installed.
154
+ - Virtualization bounds the DOM only: every snapshot still runs the Hive CLIs and
155
+ parses the whole `hive-tasks list --json` payload.
156
+ - The agents chip counts `hive board --json` entries (`HIVE_BIN`); without that
157
+ CLI it shows 0.
158
+ - Host-only surfaces: the settings gear (agent concurrency, add role), the
159
+ supervisor strip, the Queen badge/notice and "Open agent chat" need the DSH
160
+ host bridge (`/api/hive-runner` plus host actions). The standalone server does
161
+ not implement them.
133
162
  - Polling, not streaming; 3 seconds is fine for a swarm.
134
163
 
135
164
  ## License
package/README.zh-CN.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
6
6
  [![npm](https://img.shields.io/npm/v/@d86e/hive-panel?style=flat-square&logo=npm&color=cb3837)](https://www.npmjs.com/package/@d86e/hive-panel)
7
7
 
8
- **独立的 Hive 蜂群浏览器看板:谁在线、每个 agent 在做什么、四列任务泳道、事件尾巴——数据全部来自工具已经写下的 refs 和文件。**
8
+ **独立的 Hive 蜂群浏览器看板:谁在线、每个智能体在做什么、四条任务泳道、事件尾巴——数据全部来自工具已经写下的 refs 和文件。**
9
9
 
10
10
  > 零依赖 · 一个本地 HTTP 服务,只绑 127.0.0.1 · 没有数据库
11
11
 
@@ -16,9 +16,9 @@ npx @d86e/hive-panel --repo /path/to/repo
16
16
  # 打开 http://127.0.0.1:7717
17
17
  ```
18
18
 
19
- `--repo` 默认是当前目录,`--port` 默认是 `7717`。服务只绑 `127.0.0.1`;不加 `--write` 时是只读的。
19
+ `--repo` 默认是当前目录,`--port` 默认是 `7717`。服务只绑 `127.0.0.1`;不加 `--write` 时是只读的。需要 Node.js 22.19 或更新版本。
20
20
 
21
- 如果 `7717` 已被占用,服务只打印一行提示后退出,不再抛原始堆栈。让系统分配一个空闲端口,
21
+ 如果 `7717` 已被别的进程使用,服务只打印一行提示后退出,不再抛原始堆栈。让系统分配一个空闲端口,
22
22
  并从启动输出里读真实端口(`--port 0`):
23
23
 
24
24
  ```bash
@@ -34,11 +34,13 @@ node bin/hive-panel.js --repo .
34
34
  ```
35
35
 
36
36
  Hive 的 CLI 不在 PATH 上时,用环境变量指给它们(不需要改任何文件;`git` 从 PATH 解析,
37
- 端口只绑 IPv4 回环):
37
+ 端口只绑 IPv4 回环)。`HIVE_RUN_BIN` 支撑 plan/run,`MOC_BIN` 支撑 commit:
38
38
 
39
39
  ```bash
40
40
  HIVE_TASKS_BIN=/path/to/hive-tasks/bin/hive-tasks.js \
41
41
  HIVE_BIN=/path/to/hive-consensus/bin/hive.js \
42
+ HIVE_RUN_BIN=/path/to/hive-run/bin/hive-run.js \
43
+ MOC_BIN=/path/to/moc/bin/moc.js \
42
44
  npx @d86e/hive-panel --repo .
43
45
  ```
44
46
 
@@ -52,12 +54,21 @@ DSH Web 界面自带 **Hive / 蜂群** 标签页,由另一个插件 `dsh-hive-
52
54
 
53
55
  | 列 | 来源 |
54
56
  | --- | --- |
55
- | Agents | `hive board --json`(状态、当前卡、文件、最后出现) |
56
- | Tasks | `hive-tasks list --json`,分成 pending / claimed / done / failed |
57
- | Events | `.hive/events.jsonl` 最后 80 行 |
58
- | 顶部 | 模式(free / freeze)与 `hive-tasks stats --json` |
57
+ | 智能体 | `hive board --json`;顶部智能体计数显示数量,点击打开第一个智能体的原始记录 |
58
+ | 任务 | `hive-tasks list --json`,分成四条泳道:pending / claimed / done / failed |
59
+ | 事件 | `.hive/events.jsonl` 最新的 80 行(默认折叠显示 3 行) |
60
+ | 顶部 | 仓库路径、任务/智能体计数与 `hive-tasks stats --json`;工具栏的暂停/恢复对应 free / freeze |
59
61
 
60
- 页面每 3 秒轮询一次 `/api/snapshot`。一个进程服务一个仓库。
62
+ 宽屏下四条泳道并排;窄屏切换成状态筛选条加单个列表。每条泳道按「进入该状态的时间」倒序
63
+ (`stateChangedAt`,缺省回退到 `updatedAt`、再回退到 `createdAt`),并且 DOM 里只保留一个
64
+ 虚拟滚动窗口内的行,所以几千条任务也保持流畅。任务行只显示标题。
65
+
66
+ 点任务打开详情对话框:id、角色、状态、文件范围,最近一次执行(状态、智能体、起止时间、
67
+ 短提交 SHA、可复制的智能体输出、来自 hive-consensus 公告的「同时写入」行,以及「读取了
68
+ N 条经验」的经验读取行),还有该状态可用的动作。宿主能打开智能体会话时,最近一次执行里
69
+ 还会出现「打开智能体对话」;独立的页面没有这个入口。
70
+
71
+ 页面每 3 秒轮询一次 `/api/snapshot`,标签页隐藏时暂停轮询。一个进程服务一个仓库。
61
72
 
62
73
  ## 仓库还没初始化时
63
74
 
@@ -69,7 +80,9 @@ DSH Web 界面自带 **Hive / 蜂群** 标签页,由另一个插件 `dsh-hive-
69
80
  npx @d86e/hive-panel --repo /path/to/repo --write
70
81
  ```
71
82
 
72
- 多出冻结开关、新建任务(add)、给女王下目标(plan)、提交(commit),以及卡片动作(认领/完成/失败/重试/删除);每个动作对应 `/api/actions/*` 里一个固定入口,参数由固定构造函数拼装,别的一概不可调用。页面本身仍然只读——它发 POST,然后靠轮询刷新。删除是抽屉里的红色按钮,带二次确认;已认领的卡按钮保持禁用(先释放或重开)。
83
+ 多出暂停/恢复开关、新建任务(add)、给女王设目标(plan),以及任务详情对话框里的动作(认领/完成/失败/重试/删除);每个动作对应 `/api/actions/*` 里一个固定入口,参数由固定构造函数拼装,别的一概不可调用。页面本身仍然只读——它发 POST,然后靠轮询刷新。给女王设目标的对话框会先预览计划再写入。删除是对话框底部的红色按钮,带二次确认;已认领的任务不能直接删除(按钮保持禁用),先完成或标记失败再删。
84
+
85
+ 给女王设目标的对话框里,**最大任务数**默认 `50`;填 `0` 表示不限(原样传给 `--max-cards`)。
73
86
 
74
87
  ## API
75
88
 
@@ -78,7 +91,7 @@ GET /api/snapshot -> { at, repo, initialised, mode, board, tasks, stats, even
78
91
  GET /api/health -> { ok, repo, port, pid }
79
92
  GET /api/actions -> { writable, actions: [...] }
80
93
  POST /api/actions/<name> 见 SPEC.md 的动作表
81
- POST /api/mode { mode, reason }
94
+ POST /api/mode { mode }
82
95
  POST /api/retry { id }
83
96
  GET / -> 页面
84
97
  ```
@@ -92,7 +105,7 @@ GET / -> 页面
92
105
 
93
106
  ## 设计
94
107
 
95
- - 默认只读:页面从不认领、完成或修改卡片;写操作要 `--write` 显式打开,并且只走固定的动作表。
108
+ - 默认只读:页面从不认领、完成或修改任务;写操作要 `--write` 显式打开,并且只走固定的动作表。
96
109
  - 只走契约:shell 调文档化的 CLI,不 import 核心代码。缺 CLI 时退化成空数据,页面不报错。
97
110
  - 独立:只需要仓库。DSH 里用另一个插件(见上),这个看板是给 DSH 之外用的。
98
111
 
@@ -100,7 +113,9 @@ GET / -> 页面
100
113
 
101
114
  - 只在本机:绑 `127.0.0.1`,没有认证。不要暴露到网络;确实要远程访问,就在前面加一层带认证的反向代理。
102
115
  - 一个进程一个仓库、一个端口。
103
- - Agents 列需要安装 `hive-consensus`。
116
+ - 虚拟滚动只约束 DOM:每次快照仍然会跑 Hive CLI,并解析整份 `hive-tasks list --json`。
117
+ - 顶部智能体计数来自 `hive board --json`,也就是 `HIVE_BIN`;缺了它计数显示 0。
118
+ - 只属于宿主的功能:设置齿轮(智能体并发、添加角色)、supervisor 条、女王徽标/提示、「打开智能体对话」都依赖 DSH 宿主的桥(`/api/hive-runner` 与宿主动作)。独立服务没有实现它们。
104
119
  - 轮询而非推流;3 秒对蜂群够用。
105
120
 
106
121
  ## 许可
package/SPEC.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # hive-panel contract
2
2
 
3
- Status: 0.3.3. Read-only by default; writes are opt-in with `--write`.
3
+ Status: 0.5.0. Read-only by default; writes are opt-in with `--write`.
4
4
 
5
5
  ## 1. Process
6
6
 
@@ -9,7 +9,8 @@ hive-panel [--port 7717] [--repo PATH] [--write]
9
9
  ```
10
10
 
11
11
  Binds 127.0.0.1 only. No auth: it is a local board. Without `--write` every POST
12
- answers 403 and the page shows no buttons. One process serves one repository.
12
+ answers 403 and the page hides the write-action buttons and the action menu; the
13
+ settings gear stays visible but read-only. One process serves one repository.
13
14
 
14
15
  `--port 0` asks the OS for a free port. The startup output then carries the port
15
16
  that is actually listening — both in the URL line and on a `port <n>` line — so a
@@ -28,7 +29,7 @@ GET /api/snapshot
28
29
  "initialised": true,
29
30
  "mode": { "mode": "free" },
30
31
  "board": [ { "agent": "w1", "state": "working", "task": "auth-1a2b" } ],
31
- "tasks": [ "<card as written by hive-tasks>" ],
32
+ "tasks": [ "<task as written by hive-tasks>" ],
32
33
  "stats": { "total": 0, "byState": {}, "byRole": {}, "oldestPending": null },
33
34
  "events": [ "<last 80 lines of .hive/events.jsonl, newest first>" ],
34
35
  "writable": false
@@ -80,56 +81,98 @@ one shell-out with a fixed argv builder — the panel never imports the core.
80
81
  | `learn` | HIVE_BIN | `lesson add --scope G TEXT` |
81
82
  | `recall` | HIVE_BIN | `recall <scope> [--limit N]` |
82
83
  | `verdict` | HIVE_BIN | `verdict <sha\|HEAD> --result pass\|fail [--note N]` |
83
- | `run` | HIVE_RUN_BIN | `run --once --agent A --concurrency N [--budget N] [--timeout 15m]` |
84
+ | `run` | HIVE_RUN_BIN | `run --once --agent A --concurrency N [--budget N] [--timeout DUR]` |
84
85
  | `commit` | MOC_BIN | `commit -m MSG [--set PATH]...` |
85
86
  | `doctor` | HIVE_BIN | `doctor` |
86
87
 
87
- Defaults applied when the body omits a field: agent `panel`, ttl `5m`, concurrency `3`,
88
- timeout `15m`, message `panel commit`.
88
+ Defaults applied when the body omits a field: claim agent `panel` and ttl `5m`,
89
+ renew ttl `5m`, plan max-cards `50`, run agent `panel` and concurrency `3`, fail
90
+ reason `failed from panel`, mode reason `panel`, verdict result `pass`, and commit
91
+ message `panel commit`. `run` passes `--budget` / `--timeout` only when the body
92
+ sets them. Plan max-cards `0` means no limit and is forwarded to `--max-cards`
93
+ unchanged; any whole number of 0 or more is accepted.
89
94
 
90
95
  Aliases kept for the page:
91
96
 
92
97
  ```
93
- POST /api/mode { "mode": "free|freeze", "reason": "..." } -> mode
94
- POST /api/retry { "id": "<card>" } -> retry
98
+ POST /api/mode { "mode": "free|freeze" } -> mode
99
+ POST /api/retry { "id": "<task>" } -> retry
95
100
  ```
96
101
 
102
+ `/api/mode` forwards `mode` only; the action's `--reason` keeps its `panel`
103
+ default.
104
+
97
105
  ## 5. Binaries
98
106
 
99
107
  | Variable | Default | Used for |
100
108
  | --- | --- | --- |
101
- | HIVE_BIN | hive | board, init, mode, learn, recall, verdict |
109
+ | HIVE_BIN | hive | board, init, mode, learn, recall, verdict, doctor |
102
110
  | HIVE_TASKS_BIN | hive-tasks | list, stats, add, claim, done, fail, retry, renew, remove |
103
111
  | HIVE_RUN_BIN | hive-run | plan, run |
104
112
  | MOC_BIN | moc | commit |
105
113
 
106
114
  ## 6. Refresh
107
115
 
108
- The page polls every 3 seconds. The server caches nothing.
109
-
110
- ## 7. Non-goals
116
+ The page polls `/api/snapshot` every 3 seconds and pauses while the document is
117
+ hidden. The server caches nothing: every snapshot re-runs git and the CLIs.
118
+
119
+ ## 7. Page
120
+
121
+ `public/app.js` is a thin host: it mounts `public/panel.js` with the two API URLs
122
+ and the snapshot polling. The renderer is host-agnostic; a host may supply its
123
+ own `snapshotUrl`, `supervisorUrl`, `actionsUrl` and an `openSession(sessionId)`
124
+ callback.
125
+
126
+ - The task board has four lanes — pending, claimed, done, failed. From an 820px
127
+ container width the lanes render side by side (each at least 200px); narrower
128
+ boards swap to state chips plus one list.
129
+ - Each lane is newest first by `stateChangedAt`, falling back to `updatedAt` and
130
+ then `createdAt`. Only a virtual window of rows is in the DOM.
131
+ - A lane row renders the title only. Clicking it opens the task dialog with the
132
+ file scopes, the last run and the actions for the state.
133
+ - The last-run block shows status, agent, timestamps, short commit and the agent
134
+ output, plus one "Also writing" row for `overlaps` (hive-consensus
135
+ announcements) and one `lessons` recall row. It adds "Open agent chat" only
136
+ when the host supplies `openSession`.
137
+ - The header's agents chip counts `hive board --json` entries and opens the
138
+ first agent's raw record; a host-supplied `boardError` becomes its tooltip.
139
+ The supervisor strip, Queen badge/notice and settings dialog read host
140
+ snapshot fields (`queen`, `roles`) and the host supervisor bridge
141
+ (`GET ?op=status`, `POST ?op=resume`, `POST ?op=limits`). This server provides
142
+ none of them: the standalone page hides the supervisor strip and the Queen
143
+ notice, and the settings dialog can list roles from the task data but cannot
144
+ save limits or add a role (`queen-on`, `roles-add` and `roles-remove` are host
145
+ actions, not in this server's action table).
146
+
147
+ ## 8. Non-goals
111
148
 
112
149
  - No history database; events are read from the file each time.
113
- - No multi-repo, no streaming, no auth.
114
- - No page-rendered editing forms: writes go through `/api/actions/*` and then a poll.
150
+ - No multi-repo in the server: one process reads one repository. The host bridge
151
+ can report supervisor rows for other repositories, but the page only renders
152
+ the current one.
153
+ - No streaming, no auth.
154
+ - No direct file writes: every mutation is one fixed CLI argv (or, in a host,
155
+ the host's action route), followed by a snapshot poll.
115
156
 
116
- ## 8. Gaps — what the next session picks up
157
+ ## 9. Gaps — what the next session picks up
117
158
 
118
- The action layer is complete; the UI for it is not. Two panels and two drawer
119
- buttons are missing, and two of them need CLI verbs that do not exist yet.
159
+ The write API is complete for the CLI verbs above; several surfaces still have
160
+ no UI.
120
161
 
121
- | Surface | Endpoint that already exists | Still missing |
162
+ | Surface | Action(s) that already exist | Still missing |
122
163
  | --- | --- | --- |
123
164
  | Memory panel (learn / recall) | `learn`, `recall` | any UI: a scope input, a lesson list, a recall box |
124
- | Commit panel | `commit` | a message field + path set; today nothing calls `commit` |
125
- | init / doctor | `init` only | a `doctor` action (hive doctor), and buttons for both |
126
- | Drawer abort / steer | — | `abort` and `steer` verbs in hive-runner / hive-tasks, then two actions |
127
-
128
- Two integration traps found while writing this:
129
-
130
- 1. `learn` builds `hive lesson add ...`. That works when HIVE_BIN points at
131
- hive-consensus, but the `@d86e/hive` router only forwards `learn` (not `lesson`)
132
- and hive-consensus has no `learn` verb, so the pair fails end to end. Pick one
133
- vocabulary before the memory panel ships.
134
- 2. The page's `run round` button posts `{ concurrency: 3, timeout: "15m" }` and the
135
- `run` action always runs `--once`; there is no watch toggle in the API.
165
+ | Commit panel | `commit` | any UI: a message field and a path set; nothing calls `commit` |
166
+ | Run round | `run` (always `--once`) | any button; no watch toggle in the API |
167
+ | Verdict | `verdict` | any UI |
168
+ | Renew | `renew` | any UI; claims are created with `--ttl 5m` and cannot be extended from the page |
169
+ | doctor | `doctor` | any button |
170
+ | Abort / steer | — | `abort` and `steer` verbs in hive-runner / hive-tasks, then two actions |
171
+ | Host-only surfaces | — | `queen-on`, `roles-add`, `roles-remove` and the supervisor bridge live in the DSH host, not in this action table |
172
+
173
+ Two integration notes:
174
+
175
+ 1. `learn` builds `lesson add`, unlike every other action's verb shape. Confirm the
176
+ CLI pair before wiring the memory panel.
177
+ 2. The `run` action always passes `--once`; there is no watch/loop toggle in the
178
+ API or the page.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d86e/hive-panel",
3
- "version": "0.4.3",
3
+ "version": "1.0.0",
4
4
  "description": "A read-only board for a Hive swarm: agents, task lanes and the event tail, served from the refs and files you already have.",
5
5
  "type": "module",
6
6
  "bin": {
package/public/panel.css CHANGED
@@ -1097,3 +1097,37 @@ dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow:
1097
1097
  .hive-card-run-output { max-height: 20lh; overflow: auto; }
1098
1098
  .hive-card-actions { flex-wrap: wrap; justify-content: flex-end; }
1099
1099
 
1100
+ /* Virtual lanes: fixed 26px cards, 2px gaps, 28px stride. */
1101
+ .hive-lane-cards {
1102
+ display: block;
1103
+ flex: 1 1 auto;
1104
+ min-height: 0;
1105
+ padding: 7px;
1106
+ overflow-x: hidden;
1107
+ overflow-y: auto;
1108
+ }
1109
+ .hive-lane-virtual { position: relative; width: 100%; min-width: 0; }
1110
+ .hive-lane-virtual .hive-card {
1111
+ position: absolute;
1112
+ left: 0;
1113
+ right: 0;
1114
+ display: flex;
1115
+ align-items: center;
1116
+ height: 26px;
1117
+ min-height: 26px;
1118
+ padding: 2px 8px;
1119
+ overflow: hidden;
1120
+ border-radius: var(--hive-radius-sm);
1121
+ }
1122
+ .hive-lane-virtual .hive-card-title {
1123
+ width: 100%;
1124
+ overflow: hidden;
1125
+ font-size: 12px;
1126
+ line-height: 16px;
1127
+ text-overflow: ellipsis;
1128
+ white-space: nowrap;
1129
+ }
1130
+
1131
+ .hive-agent-count { font: inherit; cursor: pointer; }
1132
+ .hive-agent-count:disabled { cursor: default; }
1133
+
package/public/panel.js CHANGED
@@ -1,4 +1,4 @@
1
- // Hive panel — zero-dependency ESM renderer for hive-panel 0.3.2 snapshots.
1
+ // Hive panel — zero-dependency ESM renderer for hive-panel 0.5.0 snapshots.
2
2
  // User-provided values are always written with textContent; no raw HTML is assigned.
3
3
  //
4
4
  // Visible copy is translated through the built-in \`messages\` dictionaries
@@ -35,7 +35,8 @@ const ACTION_META = Object.freeze({
35
35
  remove: { labelKey: "action.remove", helpKey: "help.action.remove" },
36
36
  });
37
37
 
38
- const MIN_PLAN_CARDS = 1;
38
+ const MIN_PLAN_CARDS = 0;
39
+ const DEFAULT_PLAN_CARDS = 50;
39
40
 
40
41
  const PANEL_STYLES = `.hive { position: relative; }
41
42
 
@@ -1984,6 +1985,38 @@ dialog.hive-dialog .hive-dialog-foot { flex: 0 0 auto; }
1984
1985
  dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow: auto; }
1985
1986
  .hive-card-run-output { max-height: 20lh; overflow: auto; }
1986
1987
  .hive-card-actions { flex-wrap: wrap; justify-content: flex-end; }
1988
+ /* Virtual lanes: fixed 26px cards, 2px gaps, 28px stride. */
1989
+ .hive-lane-cards {
1990
+ display: block;
1991
+ flex: 1 1 auto;
1992
+ min-height: 0;
1993
+ padding: 7px;
1994
+ overflow-x: hidden;
1995
+ overflow-y: auto;
1996
+ }
1997
+ .hive-lane-virtual { position: relative; width: 100%; min-width: 0; }
1998
+ .hive-lane-virtual .hive-card {
1999
+ position: absolute;
2000
+ left: 0;
2001
+ right: 0;
2002
+ display: flex;
2003
+ align-items: center;
2004
+ height: 26px;
2005
+ min-height: 26px;
2006
+ padding: 2px 8px;
2007
+ overflow: hidden;
2008
+ border-radius: var(--hive-radius-sm);
2009
+ }
2010
+ .hive-lane-virtual .hive-card-title {
2011
+ width: 100%;
2012
+ overflow: hidden;
2013
+ font-size: 12px;
2014
+ line-height: 16px;
2015
+ text-overflow: ellipsis;
2016
+ white-space: nowrap;
2017
+ }
2018
+ .hive-agent-count { font: inherit; cursor: pointer; }
2019
+ .hive-agent-count:disabled { cursor: default; }
1987
2020
  `;
1988
2021
 
1989
2022
  const LANE_LABEL_KEYS = Object.freeze({
@@ -2041,7 +2074,6 @@ export const messages = Object.freeze({
2041
2074
  "stats.byRoleTitle": "by role: ",
2042
2075
  "status.actionFailed": "action failed",
2043
2076
  "status.disconnected": "disconnected",
2044
- "agents.empty": "No agents yet.",
2045
2077
  "agents.openAria": "Open agent",
2046
2078
  "agent.idle": "idle",
2047
2079
  "agent.task": "task",
@@ -2199,17 +2231,17 @@ export const messages = Object.freeze({
2199
2231
  "help.action.unfreeze": "Resume: agents can claim pending tasks again.",
2200
2232
  "help.action.add": "New task: create a pending task with a role and file scope.",
2201
2233
  "help.action.plan": "Set the Queen a goal: split a goal into tasks, preview the plan, then write it to the board.",
2202
- "help.action.claim": "Claim: lease a pending task for an agent.",
2234
+ "help.action.claim": "Claim: take a pending task for an agent; the claim lasts 5 minutes.",
2203
2235
  "help.action.done": "Done: mark a claimed task complete, optionally with a commit sha.",
2204
2236
  "help.action.fail": "Fail: mark a claimed task failed and record the reason.",
2205
2237
  "help.action.retry": "Retry: put a failed task back in the queue.",
2206
- "help.action.remove": "Delete this task card permanently. A claimed task has to be released or reopened first.",
2238
+ "help.action.remove": "Delete this task permanently. A claimed task has to be released or reopened first.",
2207
2239
  "plan.dialogTitle": "Set the Queen a goal",
2208
2240
  "plan.dialogAria": "Plan tasks from a goal",
2209
2241
  "plan.goal": "Goal",
2210
2242
  "plan.goalHint": "Describe the outcome; the Queen will split it into tasks.",
2211
2243
  "plan.maxCards": "Max tasks",
2212
- "plan.maxCardsHint": "1+",
2244
+ "plan.maxCardsHint": "0 = no limit",
2213
2245
  "plan.preview": "Preview plan",
2214
2246
  "plan.previewAria": "Ask the Queen to draft a task plan without writing it",
2215
2247
  "plan.previewing": "Planning…",
@@ -2229,7 +2261,7 @@ export const messages = Object.freeze({
2229
2261
  "plan.deps": "deps",
2230
2262
  "plan.none": "—",
2231
2263
  "plan.goalRequired": "Enter a goal first.",
2232
- "plan.maxInvalid": "Max tasks must be a positive whole number.",
2264
+ "plan.maxInvalid": "Max tasks must be a whole number of 0 or more (0 = no limit).",
2233
2265
  "plan.previewFirst": "Preview the plan before writing tasks.",
2234
2266
  "plan.previewFailed": "Could not read the plan.",
2235
2267
  "plan.applyHint": "The preview is read-only; writing calls plan again with apply=true.",
@@ -2283,7 +2315,6 @@ export const messages = Object.freeze({
2283
2315
  "stats.byRoleTitle": "按角色:",
2284
2316
  "status.actionFailed": "操作失败",
2285
2317
  "status.disconnected": "连接断开",
2286
- "agents.empty": "后台暂无智能体。",
2287
2318
  "agents.openAria": "打开智能体",
2288
2319
  "agent.idle": "空闲",
2289
2320
  "agent.task": "任务",
@@ -2441,17 +2472,17 @@ export const messages = Object.freeze({
2441
2472
  "help.action.unfreeze": "恢复:恢复认领,智能体可以继续接取待办任务。",
2442
2473
  "help.action.add": "新建任务:添加一条带角色和文件范围的待办任务。",
2443
2474
  "help.action.plan": "给女王设目标:让女王把目标拆成任务计划,预览后再写入看板。",
2444
- "help.action.claim": "认领:以某个智能体的名义短期租下这条待办任务。",
2475
+ "help.action.claim": "认领:以某个智能体的名义接取一条待办任务,认领有效期 5 分钟。",
2445
2476
  "help.action.done": "完成:把已认领的任务标为完成,可选填写提交 SHA。",
2446
2477
  "help.action.fail": "标记失败:把已认领的任务标为失败,并写明原因。",
2447
2478
  "help.action.retry": "重试:把失败或受阻的任务放回队列。",
2448
- "help.action.remove": "永久删除这张任务卡;已认领的任务需要先释放或重开。",
2479
+ "help.action.remove": "永久删除这张任务;已认领的任务需要先释放或重开。",
2449
2480
  "plan.dialogTitle": "给女王设目标",
2450
2481
  "plan.dialogAria": "按目标规划任务",
2451
2482
  "plan.goal": "目标",
2452
2483
  "plan.goalHint": "描述想达成的结果,女王会把它拆成任务。",
2453
2484
  "plan.maxCards": "最大任务数",
2454
- "plan.maxCardsHint": "至少 1",
2485
+ "plan.maxCardsHint": "0 = 不限",
2455
2486
  "plan.preview": "预览计划",
2456
2487
  "plan.previewAria": "让女王先给出任务计划,不写入看板",
2457
2488
  "plan.previewing": "规划中…",
@@ -2471,7 +2502,7 @@ export const messages = Object.freeze({
2471
2502
  "plan.deps": "依赖",
2472
2503
  "plan.none": "—",
2473
2504
  "plan.goalRequired": "请先填写目标。",
2474
- "plan.maxInvalid": "最大任务数必须是正整数。",
2505
+ "plan.maxInvalid": "最大任务数必须是 0 或更大的整数。",
2475
2506
  "plan.previewFirst": "请先预览计划,再写入任务。",
2476
2507
  "plan.previewFailed": "无法解析计划。",
2477
2508
  "plan.applyHint": "预览不会写入;写入时会带 apply=true 再调用一次 plan。",
@@ -2481,7 +2512,7 @@ export const messages = Object.freeze({
2481
2512
  "toast.dismiss": "关闭",
2482
2513
  "toast.planWritten": "任务已写入",
2483
2514
  "toast.taskRemoved": "任务已删除",
2484
- "toast.pickupHint": "supervisor 会自动接卡。",
2515
+ "toast.pickupHint": "supervisor 会自动接任务。",
2485
2516
  }),
2486
2517
  });
2487
2518
 
@@ -2599,6 +2630,9 @@ function normalizeCard(task) {
2599
2630
  owner: asString(task.owner),
2600
2631
  scope: normalizeScope(task.scope),
2601
2632
  reason: asString(task.reason),
2633
+ stateChangedAt: asString(task.stateChangedAt),
2634
+ createdAt: asString(task.createdAt),
2635
+ updatedAt: asString(task.updatedAt),
2602
2636
  lastRun: normalizeLastRun(task.lastRun),
2603
2637
  };
2604
2638
  }
@@ -3470,6 +3504,7 @@ export function mount(root, options = {}) {
3470
3504
  let toastNode = null;
3471
3505
  let stageFilter = "all";
3472
3506
  let stageChipEntries = [];
3507
+ const laneRenderState = new Map();
3473
3508
  let eventsExpanded = false;
3474
3509
  let initBusy = false;
3475
3510
  let initOutput = null;
@@ -3525,6 +3560,13 @@ export function mount(root, options = {}) {
3525
3560
  const statsNode = element(doc, "div", "hive-stats");
3526
3561
  bar.appendChild(statsNode);
3527
3562
 
3563
+ const agentsCount = element(doc, "button", "hive-stat hive-agent-count");
3564
+ setAttr(agentsCount, "type", "button");
3565
+ agentsCount.addEventListener("click", () => {
3566
+ if (agentsCount._agent) openAgentDrawer(agentsCount._agent);
3567
+ });
3568
+ bar.appendChild(agentsCount);
3569
+
3528
3570
  const queenBadge = element(doc, "span", "hive-queen-badge is-hidden", "");
3529
3571
  bar.appendChild(queenBadge);
3530
3572
 
@@ -3632,23 +3674,8 @@ export function mount(root, options = {}) {
3632
3674
  initPane.appendChild(initCard);
3633
3675
  main.appendChild(initPane);
3634
3676
 
3635
- // Agents strip.
3636
- const agentsStrip = element(doc, "section", "hive-agents-strip");
3637
- setAttr(agentsStrip, "aria-label", translate("pane.agents"));
3638
- const agentsLabel = element(doc, "span", "hive-strip-label", "");
3639
- agentsStrip.appendChild(agentsLabel);
3640
- const agentsCount = element(doc, "span", "hive-count", "0");
3641
- agentsStrip.appendChild(agentsCount);
3642
- const agentPills = element(doc, "div", "hive-agent-pills");
3643
- agentsStrip.appendChild(agentPills);
3644
-
3645
3677
  // Board pane.
3646
3678
  const boardPane = element(doc, "section", "hive-pane hive-board");
3647
- const boardHead = element(doc, "div", "hive-pane-head");
3648
- const boardLabel = element(doc, "span", null, "");
3649
- boardHead.appendChild(boardLabel);
3650
- const boardCount = element(doc, "span", "hive-count", "0");
3651
- boardHead.appendChild(boardCount);
3652
3679
  const stage = element(doc, "div", "hive-stage");
3653
3680
  const stageChips = element(doc, "div", "hive-stage-chips");
3654
3681
  setAttr(stageChips, "aria-label", translate("board.filtersAria"));
@@ -3657,7 +3684,6 @@ export function mount(root, options = {}) {
3657
3684
  stage.appendChild(stageChips);
3658
3685
  stage.appendChild(filterEmpty);
3659
3686
  stage.appendChild(lanesNode);
3660
- boardPane.appendChild(boardHead);
3661
3687
  boardPane.appendChild(stage);
3662
3688
  main.appendChild(boardPane);
3663
3689
 
@@ -3684,7 +3710,6 @@ export function mount(root, options = {}) {
3684
3710
  frame.appendChild(bar);
3685
3711
  frame.appendChild(freezeSlot);
3686
3712
  frame.appendChild(queenHint);
3687
- frame.appendChild(agentsStrip);
3688
3713
  frame.appendChild(main);
3689
3714
  frame.appendChild(eventsDrawer);
3690
3715
 
@@ -3775,10 +3800,7 @@ export function mount(root, options = {}) {
3775
3800
  setAttr(actionsNode, "aria-label", translate("actions.aria"));
3776
3801
  setAttr(helpButton, "title", translate("menu.open"));
3777
3802
  setAttr(helpButton, "aria-label", translate("menu.open"));
3778
- setAttr(agentsStrip, "aria-label", translate("pane.agents"));
3779
3803
  setAttr(stageChips, "aria-label", translate("board.filtersAria"));
3780
- agentsLabel.textContent = translate("pane.agents");
3781
- boardLabel.textContent = translate("pane.board");
3782
3804
  eventsLabel.textContent = translate("pane.events");
3783
3805
  const eventsToggleLabel = eventsExpanded ? translate("events.collapse") : translate("events.showAll");
3784
3806
  setAttr(eventsToggle, "title", eventsToggleLabel);
@@ -4163,7 +4185,7 @@ export function mount(root, options = {}) {
4163
4185
  setAttr(maxInput, "min", String(MIN_PLAN_CARDS));
4164
4186
  setAttr(maxInput, "step", "1");
4165
4187
  setAttr(maxInput, "aria-label", translate("plan.maxCards"));
4166
- maxInput.value = "8";
4188
+ maxInput.value = String(DEFAULT_PLAN_CARDS);
4167
4189
  maxField.appendChild(maxInput);
4168
4190
  maxField.appendChild(element(doc, "span", "hive-field-hint", translate("plan.maxCardsHint")));
4169
4191
  row.appendChild(maxField);
@@ -4221,7 +4243,7 @@ export function mount(root, options = {}) {
4221
4243
  cards: [],
4222
4244
  previewed: false,
4223
4245
  goal: "",
4224
- maxCards: 8,
4246
+ maxCards: DEFAULT_PLAN_CARDS,
4225
4247
  token: 0,
4226
4248
  busy: false,
4227
4249
  nodes: {
@@ -4807,17 +4829,24 @@ export function mount(root, options = {}) {
4807
4829
  }
4808
4830
  }
4809
4831
 
4832
+ /** Read the Max tasks field: a whole number >= 0 (0 = unlimited), or null when invalid. */
4833
+ function readPlanMaxCards(state) {
4834
+ const raw = fieldValue(state.nodes.maxCards).trim();
4835
+ const maxCards = Number(raw);
4836
+ return raw !== "" && Number.isSafeInteger(maxCards) && maxCards >= MIN_PLAN_CARDS ? maxCards : null;
4837
+ }
4838
+
4810
4839
  async function previewPlan() {
4811
4840
  const state = planState;
4812
4841
  if (!state || state.busy) return;
4813
4842
  const goal = fieldValue(state.nodes.goal).trim();
4814
- const maxCards = Number(fieldValue(state.nodes.maxCards));
4843
+ const maxCards = readPlanMaxCards(state);
4815
4844
  if (!goal) {
4816
4845
  setPlanError(state, translate("plan.goalRequired"));
4817
4846
  focusNode(state.nodes.goal);
4818
4847
  return;
4819
4848
  }
4820
- if (!Number.isInteger(maxCards) || maxCards < MIN_PLAN_CARDS) {
4849
+ if (maxCards === null) {
4821
4850
  setPlanError(state, translate("plan.maxInvalid"));
4822
4851
  focusNode(state.nodes.maxCards);
4823
4852
  return;
@@ -4860,12 +4889,12 @@ export function mount(root, options = {}) {
4860
4889
  const state = planState;
4861
4890
  if (!state || state.busy) return;
4862
4891
  const goal = fieldValue(state.nodes.goal).trim();
4863
- const maxCards = Number(fieldValue(state.nodes.maxCards));
4892
+ const maxCards = readPlanMaxCards(state);
4864
4893
  if (!state.previewed || state.cards.length === 0) {
4865
4894
  setPlanError(state, translate("plan.previewFirst"));
4866
4895
  return;
4867
4896
  }
4868
- if (!Number.isInteger(maxCards) || maxCards < MIN_PLAN_CARDS) {
4897
+ if (maxCards === null) {
4869
4898
  setPlanError(state, translate("plan.maxInvalid"));
4870
4899
  return;
4871
4900
  }
@@ -5266,6 +5295,15 @@ export function mount(root, options = {}) {
5266
5295
  dialog.appendChild(head);
5267
5296
 
5268
5297
  const body = element(doc, "div", "hive-dialog-body hive-card-body");
5298
+ if (Array.isArray(card.scope) && card.scope.length > 0) {
5299
+ const drawerScopes = element(doc, "div", "hive-scopes");
5300
+ for (const scope of card.scope) {
5301
+ const chip = element(doc, "span", "hive-scope", scope);
5302
+ setAttr(chip, "title", scope);
5303
+ drawerScopes.appendChild(chip);
5304
+ }
5305
+ body.appendChild(drawerScopes);
5306
+ }
5269
5307
  const runActions = [];
5270
5308
  body.appendChild(buildRunSection(card.lastRun, runActions));
5271
5309
  dialog.appendChild(body);
@@ -5867,105 +5905,51 @@ export function mount(root, options = {}) {
5867
5905
  }
5868
5906
 
5869
5907
  function renderAgents(model) {
5870
- clearNode(agentPills);
5871
5908
  if (model.initialised === false) {
5872
- agentsCount.textContent = "0";
5909
+ agentsCount.className = "hive-stat hive-agent-count is-hidden";
5910
+ agentsCount.textContent = translate("pane.agents") + " 0";
5911
+ agentsCount._agent = null;
5912
+ agentsCount.disabled = true;
5873
5913
  return;
5874
5914
  }
5875
- agentsCount.textContent = String(model.agents.length);
5876
- // A failed board read must never look like an idle swarm: show the CLI
5877
- // diagnostic in the strip instead of the "no agents" empty state.
5878
- if (model.boardError) {
5879
- const error = element(
5880
- doc,
5881
- "span",
5882
- "hive-agents-error",
5883
- summarizeActionOutput(model.boardError, 400) || model.boardError,
5884
- );
5885
- setAttr(error, "title", model.boardError);
5886
- setAttr(error, "role", "status");
5887
- agentPills.appendChild(error);
5888
- }
5889
- if (model.agents.length === 0) {
5890
- if (!model.boardError) {
5891
- agentPills.appendChild(element(doc, "span", "hive-agents-empty", translate("agents.empty")));
5892
- }
5893
- return;
5894
- }
5895
- for (const agent of model.agents) {
5896
- const name = agent.agent || translate("agent.unknown");
5897
- const task = agent.task || translate("agent.idle");
5898
- const pill = element(doc, "button", "hive-agent-pill");
5899
- setAttr(pill, "type", "button");
5900
- const label =
5901
- translate("agents.openAria") +
5902
- " " +
5903
- name +
5904
- " · " +
5905
- (agent.state || translate("agent.idle")) +
5906
- " · " +
5907
- task;
5908
- setAttr(pill, "title", label);
5909
- setAttr(pill, "aria-label", label);
5910
-
5911
- pill.appendChild(element(doc, "span", "hive-agent-pill-name", name));
5912
- const dot = element(doc, "span", "hive-dot is-" + safeClassToken(agent.state));
5913
- setAttr(dot, "title", agent.state || translate("agent.idle"));
5914
- pill.appendChild(dot);
5915
- const taskNode = element(doc, "span", "hive-agent-pill-task", task);
5916
- setAttr(taskNode, "title", task);
5917
- pill.appendChild(taskNode);
5918
-
5919
- pill.addEventListener("click", () => {
5920
- openAgentDrawer(agent);
5915
+ const count = model.agents.length;
5916
+ agentsCount.className = "hive-stat hive-agent-count";
5917
+ agentsCount.textContent = translate("pane.agents") + " " + String(count);
5918
+ const first = count > 0 ? model.agents[0] : null;
5919
+ agentsCount._agent = first;
5920
+ agentsCount.disabled = !first;
5921
+ const message = first
5922
+ ? translate("agents.openAria") + " " + (first.agent || translate("agent.unknown"))
5923
+ : translate("pane.agents");
5924
+ const label = model.boardError || message;
5925
+ setAttr(agentsCount, "title", label);
5926
+ setAttr(agentsCount, "aria-label", label);
5927
+ }
5928
+
5929
+ function renderCard(card, lane, existing) {
5930
+ const node = existing || element(doc, "article", "hive-card");
5931
+ const title = card.title || translate("card.untitled");
5932
+ if (!existing) {
5933
+ setAttr(node, "tabindex", "0");
5934
+ setAttr(node, "role", "button");
5935
+ node.addEventListener("click", () => {
5936
+ if (node._hiveCard) openDrawer(node._hiveCard, node._hiveLane, node);
5921
5937
  });
5922
- agentPills.appendChild(pill);
5923
- }
5924
- }
5925
-
5926
- function renderCard(card, lane) {
5927
- const node = element(doc, "article", "hive-card");
5928
- setAttr(node, "tabindex", "0");
5929
- setAttr(node, "role", "button");
5930
- const openLabel = translate("card.openAria") + " " + (card.title || card.id || translate("card.untitled"));
5931
- setAttr(node, "aria-label", openLabel);
5932
- setAttr(node, "title", openLabel);
5933
-
5934
- node.appendChild(element(doc, "div", "hive-card-title", card.title || translate("card.untitled")));
5935
-
5936
- const meta = [];
5937
- if (card.role) meta.push(translate("card.role") + " " + card.role);
5938
- if (card.owner) meta.push(translate("card.owner") + " " + card.owner);
5939
- if (meta.length) node.appendChild(element(doc, "div", "hive-card-meta", meta.join(" · ")));
5940
-
5941
- if (card.scope.length) {
5942
- const scopes = element(doc, "div", "hive-scopes");
5943
- for (const scope of card.scope) {
5944
- const chip = element(doc, "span", "hive-scope", scope);
5945
- setAttr(chip, "title", scope);
5946
- scopes.appendChild(chip);
5947
- }
5948
- node.appendChild(scopes);
5949
- }
5950
-
5951
- if (card.reason) {
5952
- node.appendChild(element(doc, "div", "hive-reason", card.reason));
5953
- }
5954
-
5955
- const foot = element(doc, "div", "hive-card-foot");
5956
- foot.appendChild(element(doc, "span", "hive-card-id", card.id || translate("card.noId")));
5957
- foot.appendChild(element(doc, "span", "hive-card-state", laneLabel(lane)));
5958
- node.appendChild(foot);
5959
-
5960
- node.addEventListener("click", () => openDrawer(card, lane, node));
5961
- node.addEventListener("keydown", (event) => {
5962
- if (!event || (event.key !== "Enter" && event.key !== " ")) return;
5963
- if (typeof event.preventDefault === "function") event.preventDefault();
5964
- openDrawer(card, lane, node);
5965
- });
5938
+ node.addEventListener("keydown", (event) => {
5939
+ if (!event || (event.key !== "Enter" && event.key !== " ")) return;
5940
+ if (typeof event.preventDefault === "function") event.preventDefault();
5941
+ if (node._hiveCard) openDrawer(node._hiveCard, node._hiveLane, node);
5942
+ });
5943
+ node._hiveTitle = element(doc, "div", "hive-card-title", "");
5944
+ node.appendChild(node._hiveTitle);
5945
+ }
5946
+ node._hiveCard = card;
5947
+ node._hiveLane = lane;
5948
+ node._hiveTitle.textContent = title;
5949
+ setAttr(node, "aria-label", translate("card.openAria") + " " + title);
5950
+ setAttr(node, "title", title);
5966
5951
  return node;
5967
5952
  }
5968
-
5969
5953
  function renderStageChips(model) {
5970
5954
  clearNode(stageChips);
5971
5955
  setAttr(stageChips, "aria-label", translate("board.filtersAria"));
@@ -6006,34 +5990,112 @@ export function mount(root, options = {}) {
6006
5990
  if (lastModel) renderLanes(lastModel);
6007
5991
  }
6008
5992
 
5993
+ function cardSortTime(card) {
5994
+ const stateChanged = parseDate(card.stateChangedAt);
5995
+ if (stateChanged) return stateChanged.getTime();
5996
+ const updated = parseDate(card.updatedAt);
5997
+ if (updated) return updated.getTime();
5998
+ const created = parseDate(card.createdAt);
5999
+ if (created) return created.getTime();
6000
+ const id = asString(card.id);
6001
+ const numeric = id.match(/(\d+)$/);
6002
+ return numeric ? Number(numeric[1]) : Number.NaN;
6003
+ }
6004
+
6005
+ function compareCardsNewestFirst(left, right) {
6006
+ const leftTime = cardSortTime(left);
6007
+ const rightTime = cardSortTime(right);
6008
+ if (Number.isFinite(leftTime) && Number.isFinite(rightTime) && leftTime !== rightTime) {
6009
+ return rightTime - leftTime;
6010
+ }
6011
+ if (Number.isFinite(leftTime) !== Number.isFinite(rightTime)) {
6012
+ return Number.isFinite(leftTime) ? -1 : 1;
6013
+ }
6014
+ return asString(right.id).localeCompare(asString(left.id));
6015
+ }
6016
+
6017
+ const LANE_ROW_HEIGHT = 28;
6018
+ const LANE_ROW_BUFFER = 10;
6019
+ const LANE_VIEWPORT_FALLBACK = 480;
6020
+
6021
+ function createLaneState(lane) {
6022
+ const column = element(doc, "section", "hive-lane hive-lane-" + lane);
6023
+ const head = element(doc, "div", "hive-lane-head");
6024
+ head.appendChild(element(doc, "span", "hive-lane-name", laneLabel(lane)));
6025
+ const count = element(doc, "span", "hive-count", "0");
6026
+ head.appendChild(count);
6027
+ column.appendChild(head);
6028
+
6029
+ const list = element(doc, "div", "hive-lane-cards");
6030
+ const inner = element(doc, "div", "hive-lane-virtual");
6031
+ list.appendChild(inner);
6032
+ column.appendChild(list);
6033
+ lanesNode.appendChild(column);
6034
+
6035
+ const state = { lane, column, list, inner, count, cards: [], visible: new Map() };
6036
+ list.addEventListener("scroll", () => renderLaneVirtual(state));
6037
+ return state;
6038
+ }
6039
+
6040
+ function renderLaneVirtual(state) {
6041
+ const cards = state.cards;
6042
+ const total = cards.length;
6043
+ const row = LANE_ROW_HEIGHT;
6044
+ const viewport =
6045
+ Number.isFinite(state.list.clientHeight) && state.list.clientHeight > 0
6046
+ ? state.list.clientHeight
6047
+ : LANE_VIEWPORT_FALLBACK;
6048
+ const scrollTop = Number(state.list.scrollTop) || 0;
6049
+ const start = Math.max(0, Math.floor(scrollTop / row) - LANE_ROW_BUFFER);
6050
+ const end = Math.min(total, Math.ceil((scrollTop + viewport) / row) + LANE_ROW_BUFFER);
6051
+ const height = total === 0 ? 0 : total * row - 2;
6052
+ setStyle(state.inner, "height", String(height) + "px");
6053
+
6054
+ const next = new Map();
6055
+ for (let index = start; index < end; index += 1) {
6056
+ const card = cards[index];
6057
+ const key = String(card.id || "idx:" + index);
6058
+ const entry = state.visible.get(key);
6059
+ const node = renderCard(card, state.lane, entry ? entry.node : null);
6060
+ setStyle(node, "top", String(index * row) + "px");
6061
+ if (!entry) state.inner.appendChild(node);
6062
+ next.set(key, { node, index });
6063
+ }
6064
+ for (const [key, entry] of state.visible) {
6065
+ if (!next.has(key) && entry.node.parentNode) entry.node.parentNode.removeChild(entry.node);
6066
+ }
6067
+ state.visible = next;
6068
+ state.count.textContent = String(total);
6069
+ }
6070
+
6009
6071
  function renderLanes(model) {
6010
- clearNode(lanesNode);
6011
6072
  if (model.initialised === false) {
6012
- boardCount.textContent = "0";
6073
+ clearNode(lanesNode);
6074
+ laneRenderState.clear();
6013
6075
  filterEmpty.textContent = "";
6014
6076
  filterEmpty.className = "hive-filter-empty";
6015
6077
  return;
6016
6078
  }
6017
- boardCount.textContent = String(model.stats.total);
6079
+ const seen = new Set();
6018
6080
  for (const lane of LANE_ORDER) {
6019
- const cards = model.lanes[lane] || [];
6081
+ const cards = [...(model.lanes[lane] || [])].sort(compareCardsNewestFirst);
6082
+ let state = laneRenderState.get(lane);
6083
+ if (!state) {
6084
+ state = createLaneState(lane);
6085
+ laneRenderState.set(lane, state);
6086
+ }
6087
+ state.cards = cards;
6020
6088
  const classes = ["hive-lane", "hive-lane-" + lane];
6021
6089
  if (cards.length === 0) classes.push("is-empty");
6022
6090
  if (stageFilter !== "all" && stageFilter !== lane) classes.push("is-filtered-out");
6023
- const column = element(doc, "section", classes.join(" "));
6024
- const head = element(doc, "div", "hive-lane-head");
6025
- head.appendChild(element(doc, "span", "hive-lane-name", laneLabel(lane)));
6026
- head.appendChild(element(doc, "span", "hive-count", String(cards.length)));
6027
- column.appendChild(head);
6028
-
6029
- const list = element(doc, "div", "hive-lane-cards");
6030
- if (cards.length === 0) {
6031
- list.appendChild(emptyState("—"));
6032
- } else {
6033
- for (const card of cards) list.appendChild(renderCard(card, lane));
6034
- }
6035
- column.appendChild(list);
6036
- lanesNode.appendChild(column);
6091
+ state.column.className = classes.join(" ");
6092
+ renderLaneVirtual(state);
6093
+ seen.add(lane);
6094
+ }
6095
+ for (const [lane, state] of laneRenderState) {
6096
+ if (seen.has(lane)) continue;
6097
+ if (state.column.parentNode) state.column.parentNode.removeChild(state.column);
6098
+ laneRenderState.delete(lane);
6037
6099
  }
6038
6100
 
6039
6101
  const visible = stageFilter === "all" ? model.lanes : { [stageFilter]: model.lanes[stageFilter] || [] };
@@ -6231,6 +6293,9 @@ export function mount(root, options = {}) {
6231
6293
  unschedule(timer);
6232
6294
  timer = null;
6233
6295
  }
6296
+ if (typeof doc.removeEventListener === "function") {
6297
+ doc.removeEventListener("visibilitychange", onVisibilityChange);
6298
+ }
6234
6299
  closeHelp(false);
6235
6300
  closePlanDialog(false);
6236
6301
  closeLimitsDialog(false);
@@ -6294,9 +6359,33 @@ export function mount(root, options = {}) {
6294
6359
  }
6295
6360
  }
6296
6361
 
6297
- timer = schedule(() => {
6298
- void refresh();
6299
- }, intervalMs);
6362
+ function stopPolling() {
6363
+ if (timer === null) return;
6364
+ unschedule(timer);
6365
+ timer = null;
6366
+ }
6367
+
6368
+ function startPolling() {
6369
+ if (destroyed || timer !== null || doc.hidden) return;
6370
+ timer = schedule(() => {
6371
+ void refresh();
6372
+ }, intervalMs);
6373
+ }
6374
+
6375
+ function onVisibilityChange() {
6376
+ if (destroyed) return;
6377
+ if (doc.hidden) {
6378
+ stopPolling();
6379
+ } else {
6380
+ startPolling();
6381
+ void refresh();
6382
+ }
6383
+ }
6384
+
6385
+ if (typeof doc.addEventListener === "function") {
6386
+ doc.addEventListener("visibilitychange", onVisibilityChange);
6387
+ }
6388
+ startPolling();
6300
6389
  void refresh();
6301
6390
 
6302
6391
  return { setSnapshot, destroy, refresh, rerender };
package/src/actions.js CHANGED
@@ -20,7 +20,8 @@ const ACTIONS = {
20
20
  if (p.priority) args.push("--priority", String(p.priority));
21
21
  return args;
22
22
  },
23
- plan: (p) => ["plan", "--goal", String(p.goal || ""), "--max-cards", String(p.maxCards || 8), ...(p.apply ? ["--apply"] : [])],
23
+ // maxCards 0 means unlimited; it must reach argv unchanged, so no truthiness default.
24
+ plan: (p) => ["plan", "--goal", String(p.goal || ""), "--max-cards", String(p.maxCards ?? 50), ...(p.apply ? ["--apply"] : [])],
24
25
  claim: (p) => ["claim", String(p.id), "--agent", String(p.agent || "panel"), "--ttl", String(p.ttl || "5m")],
25
26
  done: (p) => ["done", String(p.id), ...(p.sha ? ["--sha", String(p.sha)] : []), ...(p.verdict ? ["--verdict", String(p.verdict)] : [])],
26
27
  fail: (p) => ["fail", String(p.id), "--reason", String(p.reason || "failed from panel")],