@d86e/hive-panel 0.4.0 → 0.5.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 +47 -18
- package/README.zh-CN.md +28 -13
- package/SPEC.md +73 -30
- package/package.json +1 -1
- package/public/panel.css +45 -0
- package/public/panel.js +369 -150
- package/src/actions.js +2 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[](LICENSE)
|
|
6
6
|
[](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,
|
|
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
|
|
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
|
|
64
|
-
| Tasks | `hive-tasks list --json`, split into pending / claimed / done / failed |
|
|
65
|
-
| Events | the
|
|
66
|
-
| Header |
|
|
67
|
-
|
|
68
|
-
|
|
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
|
|
86
|
-
|
|
87
|
-
`/api/actions/*` for every CLI verb the panel knows. Each
|
|
88
|
-
builder — nothing else is callable. The page still only
|
|
89
|
-
|
|
90
|
-
a
|
|
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
|
|
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
|
|
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
|
-
-
|
|
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)
|
|
6
6
|
[](https://www.npmjs.com/package/@d86e/hive-panel)
|
|
7
7
|
|
|
8
|
-
**独立的 Hive
|
|
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
|
-
|
|
|
56
|
-
|
|
|
57
|
-
|
|
|
58
|
-
| 顶部 |
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
-
|
|
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
|
-
-
|
|
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
|
+
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
|
|
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": [ "<
|
|
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
|
|
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
|
|
88
|
-
|
|
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"
|
|
94
|
-
POST /api/retry { "id": "<
|
|
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
|
|
109
|
-
|
|
110
|
-
|
|
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
|
|
114
|
-
|
|
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
|
-
##
|
|
157
|
+
## 9. Gaps — what the next session picks up
|
|
117
158
|
|
|
118
|
-
The
|
|
119
|
-
|
|
159
|
+
The write API is complete for the CLI verbs above; several surfaces still have
|
|
160
|
+
no UI.
|
|
120
161
|
|
|
121
|
-
| Surface |
|
|
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
|
|
125
|
-
|
|
|
126
|
-
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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
package/public/panel.css
CHANGED
|
@@ -1086,3 +1086,48 @@ dialog.hive-dialog .hive-card-subline,
|
|
|
1086
1086
|
dialog.hive-dialog .hive-settings-role-name { min-width: 0; overflow-wrap: anywhere; }
|
|
1087
1087
|
dialog.hive-dialog .hive-dialog-foot { flex-wrap: wrap; }
|
|
1088
1088
|
|
|
1089
|
+
dialog.hive-dialog {
|
|
1090
|
+
display: flex;
|
|
1091
|
+
flex-direction: column;
|
|
1092
|
+
max-height: 80vh;
|
|
1093
|
+
}
|
|
1094
|
+
dialog.hive-dialog .hive-dialog-head,
|
|
1095
|
+
dialog.hive-dialog .hive-dialog-foot { flex: 0 0 auto; }
|
|
1096
|
+
dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow: auto; }
|
|
1097
|
+
.hive-card-run-output { max-height: 20lh; overflow: auto; }
|
|
1098
|
+
.hive-card-actions { flex-wrap: wrap; justify-content: flex-end; }
|
|
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.
|
|
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 =
|
|
38
|
+
const MIN_PLAN_CARDS = 0;
|
|
39
|
+
const DEFAULT_PLAN_CARDS = 50;
|
|
39
40
|
|
|
40
41
|
const PANEL_STYLES = `.hive { position: relative; }
|
|
41
42
|
|
|
@@ -404,6 +405,14 @@ const PANEL_STYLES = `.hive { position: relative; }
|
|
|
404
405
|
font-size: 12px;
|
|
405
406
|
}
|
|
406
407
|
|
|
408
|
+
.hive-agents-error {
|
|
409
|
+
min-width: 0;
|
|
410
|
+
overflow-wrap: anywhere;
|
|
411
|
+
color: var(--hive-danger);
|
|
412
|
+
font-family: var(--hive-mono);
|
|
413
|
+
font-size: 12px;
|
|
414
|
+
}
|
|
415
|
+
|
|
407
416
|
.hive-stage-chips {
|
|
408
417
|
display: flex;
|
|
409
418
|
flex: 0 0 auto;
|
|
@@ -1498,7 +1507,8 @@ const PANEL_STYLES = `.hive { position: relative; }
|
|
|
1498
1507
|
}
|
|
1499
1508
|
|
|
1500
1509
|
.hive-card-run-output {
|
|
1501
|
-
max-height: 360px;
|
|
1510
|
+
max-height: 360px;
|
|
1511
|
+
max-height: 20lh; /* longer output scrolls inside the pre */
|
|
1502
1512
|
margin: 0;
|
|
1503
1513
|
padding: 10px;
|
|
1504
1514
|
overflow: auto;
|
|
@@ -1965,6 +1975,48 @@ dialog.hive-dialog .hive-dialog-title,
|
|
|
1965
1975
|
dialog.hive-dialog .hive-card-subline,
|
|
1966
1976
|
dialog.hive-dialog .hive-settings-role-name { min-width: 0; overflow-wrap: anywhere; }
|
|
1967
1977
|
dialog.hive-dialog .hive-dialog-foot { flex-wrap: wrap; }
|
|
1978
|
+
dialog.hive-dialog {
|
|
1979
|
+
display: flex;
|
|
1980
|
+
flex-direction: column;
|
|
1981
|
+
max-height: 80vh;
|
|
1982
|
+
}
|
|
1983
|
+
dialog.hive-dialog .hive-dialog-head,
|
|
1984
|
+
dialog.hive-dialog .hive-dialog-foot { flex: 0 0 auto; }
|
|
1985
|
+
dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow: auto; }
|
|
1986
|
+
.hive-card-run-output { max-height: 20lh; overflow: auto; }
|
|
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; }
|
|
1968
2020
|
`;
|
|
1969
2021
|
|
|
1970
2022
|
const LANE_LABEL_KEYS = Object.freeze({
|
|
@@ -2022,7 +2074,6 @@ export const messages = Object.freeze({
|
|
|
2022
2074
|
"stats.byRoleTitle": "by role: ",
|
|
2023
2075
|
"status.actionFailed": "action failed",
|
|
2024
2076
|
"status.disconnected": "disconnected",
|
|
2025
|
-
"agents.empty": "No agents yet.",
|
|
2026
2077
|
"agents.openAria": "Open agent",
|
|
2027
2078
|
"agent.idle": "idle",
|
|
2028
2079
|
"agent.task": "task",
|
|
@@ -2042,6 +2093,9 @@ export const messages = Object.freeze({
|
|
|
2042
2093
|
"drawer.removeClaimed": "A claimed task must be released or reopened before it can be deleted.",
|
|
2043
2094
|
"drawer.rawJson": "raw json",
|
|
2044
2095
|
"drawer.lastRun": "Last run",
|
|
2096
|
+
"drawer.runOverlaps": "Also writing",
|
|
2097
|
+
"drawer.runLessons": "Read {count} lessons",
|
|
2098
|
+
"drawer.runNoLessons": "No lessons to read",
|
|
2045
2099
|
"drawer.noRuns": "No runs yet",
|
|
2046
2100
|
"drawer.copyOutput": "Copy output",
|
|
2047
2101
|
"drawer.openChat": "Open agent chat",
|
|
@@ -2177,17 +2231,17 @@ export const messages = Object.freeze({
|
|
|
2177
2231
|
"help.action.unfreeze": "Resume: agents can claim pending tasks again.",
|
|
2178
2232
|
"help.action.add": "New task: create a pending task with a role and file scope.",
|
|
2179
2233
|
"help.action.plan": "Set the Queen a goal: split a goal into tasks, preview the plan, then write it to the board.",
|
|
2180
|
-
"help.action.claim": "Claim:
|
|
2234
|
+
"help.action.claim": "Claim: take a pending task for an agent; the claim lasts 5 minutes.",
|
|
2181
2235
|
"help.action.done": "Done: mark a claimed task complete, optionally with a commit sha.",
|
|
2182
2236
|
"help.action.fail": "Fail: mark a claimed task failed and record the reason.",
|
|
2183
2237
|
"help.action.retry": "Retry: put a failed task back in the queue.",
|
|
2184
|
-
"help.action.remove": "Delete this task
|
|
2238
|
+
"help.action.remove": "Delete this task permanently. A claimed task has to be released or reopened first.",
|
|
2185
2239
|
"plan.dialogTitle": "Set the Queen a goal",
|
|
2186
2240
|
"plan.dialogAria": "Plan tasks from a goal",
|
|
2187
2241
|
"plan.goal": "Goal",
|
|
2188
2242
|
"plan.goalHint": "Describe the outcome; the Queen will split it into tasks.",
|
|
2189
2243
|
"plan.maxCards": "Max tasks",
|
|
2190
|
-
"plan.maxCardsHint": "
|
|
2244
|
+
"plan.maxCardsHint": "0 = no limit",
|
|
2191
2245
|
"plan.preview": "Preview plan",
|
|
2192
2246
|
"plan.previewAria": "Ask the Queen to draft a task plan without writing it",
|
|
2193
2247
|
"plan.previewing": "Planning…",
|
|
@@ -2207,7 +2261,7 @@ export const messages = Object.freeze({
|
|
|
2207
2261
|
"plan.deps": "deps",
|
|
2208
2262
|
"plan.none": "—",
|
|
2209
2263
|
"plan.goalRequired": "Enter a goal first.",
|
|
2210
|
-
"plan.maxInvalid": "Max tasks must be a
|
|
2264
|
+
"plan.maxInvalid": "Max tasks must be a whole number of 0 or more (0 = no limit).",
|
|
2211
2265
|
"plan.previewFirst": "Preview the plan before writing tasks.",
|
|
2212
2266
|
"plan.previewFailed": "Could not read the plan.",
|
|
2213
2267
|
"plan.applyHint": "The preview is read-only; writing calls plan again with apply=true.",
|
|
@@ -2261,7 +2315,6 @@ export const messages = Object.freeze({
|
|
|
2261
2315
|
"stats.byRoleTitle": "按角色:",
|
|
2262
2316
|
"status.actionFailed": "操作失败",
|
|
2263
2317
|
"status.disconnected": "连接断开",
|
|
2264
|
-
"agents.empty": "后台暂无智能体。",
|
|
2265
2318
|
"agents.openAria": "打开智能体",
|
|
2266
2319
|
"agent.idle": "空闲",
|
|
2267
2320
|
"agent.task": "任务",
|
|
@@ -2281,6 +2334,9 @@ export const messages = Object.freeze({
|
|
|
2281
2334
|
"drawer.removeClaimed": "已认领的任务必须先释放或重开才能删除。",
|
|
2282
2335
|
"drawer.rawJson": "原始 JSON",
|
|
2283
2336
|
"drawer.lastRun": "最近一次执行",
|
|
2337
|
+
"drawer.runOverlaps": "同时写入",
|
|
2338
|
+
"drawer.runLessons": "读取了 {count} 条经验",
|
|
2339
|
+
"drawer.runNoLessons": "没有可读取的经验",
|
|
2284
2340
|
"drawer.noRuns": "还没有执行记录",
|
|
2285
2341
|
"drawer.copyOutput": "复制输出",
|
|
2286
2342
|
"drawer.openChat": "打开智能体对话",
|
|
@@ -2416,17 +2472,17 @@ export const messages = Object.freeze({
|
|
|
2416
2472
|
"help.action.unfreeze": "恢复:恢复认领,智能体可以继续接取待办任务。",
|
|
2417
2473
|
"help.action.add": "新建任务:添加一条带角色和文件范围的待办任务。",
|
|
2418
2474
|
"help.action.plan": "给女王设目标:让女王把目标拆成任务计划,预览后再写入看板。",
|
|
2419
|
-
"help.action.claim": "
|
|
2475
|
+
"help.action.claim": "认领:以某个智能体的名义接取一条待办任务,认领有效期 5 分钟。",
|
|
2420
2476
|
"help.action.done": "完成:把已认领的任务标为完成,可选填写提交 SHA。",
|
|
2421
2477
|
"help.action.fail": "标记失败:把已认领的任务标为失败,并写明原因。",
|
|
2422
2478
|
"help.action.retry": "重试:把失败或受阻的任务放回队列。",
|
|
2423
|
-
"help.action.remove": "
|
|
2479
|
+
"help.action.remove": "永久删除这张任务;已认领的任务需要先释放或重开。",
|
|
2424
2480
|
"plan.dialogTitle": "给女王设目标",
|
|
2425
2481
|
"plan.dialogAria": "按目标规划任务",
|
|
2426
2482
|
"plan.goal": "目标",
|
|
2427
2483
|
"plan.goalHint": "描述想达成的结果,女王会把它拆成任务。",
|
|
2428
2484
|
"plan.maxCards": "最大任务数",
|
|
2429
|
-
"plan.maxCardsHint": "
|
|
2485
|
+
"plan.maxCardsHint": "0 = 不限",
|
|
2430
2486
|
"plan.preview": "预览计划",
|
|
2431
2487
|
"plan.previewAria": "让女王先给出任务计划,不写入看板",
|
|
2432
2488
|
"plan.previewing": "规划中…",
|
|
@@ -2446,7 +2502,7 @@ export const messages = Object.freeze({
|
|
|
2446
2502
|
"plan.deps": "依赖",
|
|
2447
2503
|
"plan.none": "—",
|
|
2448
2504
|
"plan.goalRequired": "请先填写目标。",
|
|
2449
|
-
"plan.maxInvalid": "
|
|
2505
|
+
"plan.maxInvalid": "最大任务数必须是 0 或更大的整数。",
|
|
2450
2506
|
"plan.previewFirst": "请先预览计划,再写入任务。",
|
|
2451
2507
|
"plan.previewFailed": "无法解析计划。",
|
|
2452
2508
|
"plan.applyHint": "预览不会写入;写入时会带 apply=true 再调用一次 plan。",
|
|
@@ -2456,7 +2512,7 @@ export const messages = Object.freeze({
|
|
|
2456
2512
|
"toast.dismiss": "关闭",
|
|
2457
2513
|
"toast.planWritten": "任务已写入",
|
|
2458
2514
|
"toast.taskRemoved": "任务已删除",
|
|
2459
|
-
"toast.pickupHint": "supervisor
|
|
2515
|
+
"toast.pickupHint": "supervisor 会自动接任务。",
|
|
2460
2516
|
}),
|
|
2461
2517
|
});
|
|
2462
2518
|
|
|
@@ -2493,12 +2549,56 @@ function normalizeScope(scope) {
|
|
|
2493
2549
|
return [];
|
|
2494
2550
|
}
|
|
2495
2551
|
|
|
2552
|
+
/**
|
|
2553
|
+
* Normalize the optional `overlaps` announcements of a run record: other agents
|
|
2554
|
+
* have declared they are writing the same paths too. An entry without a
|
|
2555
|
+
* non-empty agent is dropped; a missing or malformed list is empty, so the
|
|
2556
|
+
* drawer renders no overlap row.
|
|
2557
|
+
* @param {unknown} value
|
|
2558
|
+
* @returns {Array<{key:string,agent:string,task:string,expiresAt:string}>}
|
|
2559
|
+
*/
|
|
2560
|
+
function normalizeOverlaps(value) {
|
|
2561
|
+
const overlaps = [];
|
|
2562
|
+
for (const entry of asArray(value)) {
|
|
2563
|
+
if (!isRecord(entry)) continue;
|
|
2564
|
+
const agent = asString(entry.agent);
|
|
2565
|
+
if (agent.trim() === "") continue;
|
|
2566
|
+
overlaps.push({
|
|
2567
|
+
key: asString(entry.key),
|
|
2568
|
+
agent,
|
|
2569
|
+
task: asString(entry.task),
|
|
2570
|
+
expiresAt: asString(entry.expiresAt),
|
|
2571
|
+
});
|
|
2572
|
+
}
|
|
2573
|
+
return overlaps;
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2576
|
+
/**
|
|
2577
|
+
* Normalize the optional `lessons` recall summary of a run record. A missing
|
|
2578
|
+
* or malformed record is null; a count-only, scopes-only or error-only record
|
|
2579
|
+
* survives so the drawer can still render its "no lessons" line.
|
|
2580
|
+
* @param {unknown} value
|
|
2581
|
+
* @returns {null|{count:number,scopes:string[],error?:string}}
|
|
2582
|
+
*/
|
|
2583
|
+
function normalizeLessons(value) {
|
|
2584
|
+
if (!isRecord(value)) return null;
|
|
2585
|
+
const lessons = {
|
|
2586
|
+
count: asCount(value.count, 0),
|
|
2587
|
+
scopes: asArray(value.scopes)
|
|
2588
|
+
.map((scope) => asString(scope))
|
|
2589
|
+
.filter((scope) => scope.trim() !== ""),
|
|
2590
|
+
};
|
|
2591
|
+
const error = asString(value.error);
|
|
2592
|
+
if (error !== "") lessons.error = error;
|
|
2593
|
+
return lessons;
|
|
2594
|
+
}
|
|
2595
|
+
|
|
2496
2596
|
/**
|
|
2497
2597
|
* Normalize `lastRun` (written by hive-runner to .hive/runs/<cardId>.json).
|
|
2498
2598
|
* A missing record is null; a malformed one is dropped instead of leaking
|
|
2499
2599
|
* half-parsed values into the drawer.
|
|
2500
2600
|
* @param {unknown} value
|
|
2501
|
-
* @returns {null|{agent:string,startedAt:string,endedAt:string,status:string,commit:string,exitCode:number|null,sessionId:string,output:string}}
|
|
2601
|
+
* @returns {null|{agent:string,startedAt:string,endedAt:string,status:string,commit:string,exitCode:number|null,sessionId:string,output:string,overlaps:Array<{key:string,agent:string,task:string,expiresAt:string}>,lessons:null|{count:number,scopes:string[],error?:string}}}
|
|
2502
2602
|
*/
|
|
2503
2603
|
function normalizeLastRun(value) {
|
|
2504
2604
|
if (!isRecord(value)) return null;
|
|
@@ -2515,6 +2615,10 @@ function normalizeLastRun(value) {
|
|
|
2515
2615
|
// navigate can open that conversation, an older record simply has none.
|
|
2516
2616
|
sessionId: asString(value.sessionId),
|
|
2517
2617
|
output: asString(value.output),
|
|
2618
|
+
// Consensus announcements from the other writers of these paths.
|
|
2619
|
+
overlaps: normalizeOverlaps(value.overlaps),
|
|
2620
|
+
// Memory recall summary: how many lessons the worker read before its run.
|
|
2621
|
+
lessons: normalizeLessons(value.lessons),
|
|
2518
2622
|
};
|
|
2519
2623
|
}
|
|
2520
2624
|
|
|
@@ -2526,6 +2630,9 @@ function normalizeCard(task) {
|
|
|
2526
2630
|
owner: asString(task.owner),
|
|
2527
2631
|
scope: normalizeScope(task.scope),
|
|
2528
2632
|
reason: asString(task.reason),
|
|
2633
|
+
stateChangedAt: asString(task.stateChangedAt),
|
|
2634
|
+
createdAt: asString(task.createdAt),
|
|
2635
|
+
updatedAt: asString(task.updatedAt),
|
|
2529
2636
|
lastRun: normalizeLastRun(task.lastRun),
|
|
2530
2637
|
};
|
|
2531
2638
|
}
|
|
@@ -2671,6 +2778,7 @@ function toolbarActions(writable, mode) {
|
|
|
2671
2778
|
* laneOrder: string[],
|
|
2672
2779
|
* stats: {total:number, byState:Record<string,number>, byRole:Record<string,number>, oldestPending:{id:string,createdAt:string}|null},
|
|
2673
2780
|
* agents: Array<{agent:string,state:string,task:string,files:string[],updatedAt:string}>,
|
|
2781
|
+
* boardError: string|null,
|
|
2674
2782
|
* events: Array<{ts:string,kind:string,task:string,actor:string}>,
|
|
2675
2783
|
* actions: Array<{name:string,labelKey:string,body?:object}>
|
|
2676
2784
|
* }}
|
|
@@ -2749,6 +2857,9 @@ export function renderModel(snapshot) {
|
|
|
2749
2857
|
laneOrder: [...LANE_ORDER],
|
|
2750
2858
|
stats: normalizeStats(source.stats, tasks),
|
|
2751
2859
|
agents: normalizeAgents(source.board),
|
|
2860
|
+
// A board read that failed is not the same as an idle swarm: keep the
|
|
2861
|
+
// diagnostic so the agents strip can show it instead of "no agents".
|
|
2862
|
+
boardError: asString(source.boardError) || null,
|
|
2752
2863
|
events: normalizeEvents(source.events),
|
|
2753
2864
|
actions: initialised ? toolbarActions(writable, mode) : [],
|
|
2754
2865
|
};
|
|
@@ -3393,6 +3504,7 @@ export function mount(root, options = {}) {
|
|
|
3393
3504
|
let toastNode = null;
|
|
3394
3505
|
let stageFilter = "all";
|
|
3395
3506
|
let stageChipEntries = [];
|
|
3507
|
+
const laneRenderState = new Map();
|
|
3396
3508
|
let eventsExpanded = false;
|
|
3397
3509
|
let initBusy = false;
|
|
3398
3510
|
let initOutput = null;
|
|
@@ -3448,6 +3560,13 @@ export function mount(root, options = {}) {
|
|
|
3448
3560
|
const statsNode = element(doc, "div", "hive-stats");
|
|
3449
3561
|
bar.appendChild(statsNode);
|
|
3450
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
|
+
|
|
3451
3570
|
const queenBadge = element(doc, "span", "hive-queen-badge is-hidden", "");
|
|
3452
3571
|
bar.appendChild(queenBadge);
|
|
3453
3572
|
|
|
@@ -3555,23 +3674,8 @@ export function mount(root, options = {}) {
|
|
|
3555
3674
|
initPane.appendChild(initCard);
|
|
3556
3675
|
main.appendChild(initPane);
|
|
3557
3676
|
|
|
3558
|
-
// Agents strip.
|
|
3559
|
-
const agentsStrip = element(doc, "section", "hive-agents-strip");
|
|
3560
|
-
setAttr(agentsStrip, "aria-label", translate("pane.agents"));
|
|
3561
|
-
const agentsLabel = element(doc, "span", "hive-strip-label", "");
|
|
3562
|
-
agentsStrip.appendChild(agentsLabel);
|
|
3563
|
-
const agentsCount = element(doc, "span", "hive-count", "0");
|
|
3564
|
-
agentsStrip.appendChild(agentsCount);
|
|
3565
|
-
const agentPills = element(doc, "div", "hive-agent-pills");
|
|
3566
|
-
agentsStrip.appendChild(agentPills);
|
|
3567
|
-
|
|
3568
3677
|
// Board pane.
|
|
3569
3678
|
const boardPane = element(doc, "section", "hive-pane hive-board");
|
|
3570
|
-
const boardHead = element(doc, "div", "hive-pane-head");
|
|
3571
|
-
const boardLabel = element(doc, "span", null, "");
|
|
3572
|
-
boardHead.appendChild(boardLabel);
|
|
3573
|
-
const boardCount = element(doc, "span", "hive-count", "0");
|
|
3574
|
-
boardHead.appendChild(boardCount);
|
|
3575
3679
|
const stage = element(doc, "div", "hive-stage");
|
|
3576
3680
|
const stageChips = element(doc, "div", "hive-stage-chips");
|
|
3577
3681
|
setAttr(stageChips, "aria-label", translate("board.filtersAria"));
|
|
@@ -3580,7 +3684,6 @@ export function mount(root, options = {}) {
|
|
|
3580
3684
|
stage.appendChild(stageChips);
|
|
3581
3685
|
stage.appendChild(filterEmpty);
|
|
3582
3686
|
stage.appendChild(lanesNode);
|
|
3583
|
-
boardPane.appendChild(boardHead);
|
|
3584
3687
|
boardPane.appendChild(stage);
|
|
3585
3688
|
main.appendChild(boardPane);
|
|
3586
3689
|
|
|
@@ -3607,7 +3710,6 @@ export function mount(root, options = {}) {
|
|
|
3607
3710
|
frame.appendChild(bar);
|
|
3608
3711
|
frame.appendChild(freezeSlot);
|
|
3609
3712
|
frame.appendChild(queenHint);
|
|
3610
|
-
frame.appendChild(agentsStrip);
|
|
3611
3713
|
frame.appendChild(main);
|
|
3612
3714
|
frame.appendChild(eventsDrawer);
|
|
3613
3715
|
|
|
@@ -3698,10 +3800,7 @@ export function mount(root, options = {}) {
|
|
|
3698
3800
|
setAttr(actionsNode, "aria-label", translate("actions.aria"));
|
|
3699
3801
|
setAttr(helpButton, "title", translate("menu.open"));
|
|
3700
3802
|
setAttr(helpButton, "aria-label", translate("menu.open"));
|
|
3701
|
-
setAttr(agentsStrip, "aria-label", translate("pane.agents"));
|
|
3702
3803
|
setAttr(stageChips, "aria-label", translate("board.filtersAria"));
|
|
3703
|
-
agentsLabel.textContent = translate("pane.agents");
|
|
3704
|
-
boardLabel.textContent = translate("pane.board");
|
|
3705
3804
|
eventsLabel.textContent = translate("pane.events");
|
|
3706
3805
|
const eventsToggleLabel = eventsExpanded ? translate("events.collapse") : translate("events.showAll");
|
|
3707
3806
|
setAttr(eventsToggle, "title", eventsToggleLabel);
|
|
@@ -4086,7 +4185,7 @@ export function mount(root, options = {}) {
|
|
|
4086
4185
|
setAttr(maxInput, "min", String(MIN_PLAN_CARDS));
|
|
4087
4186
|
setAttr(maxInput, "step", "1");
|
|
4088
4187
|
setAttr(maxInput, "aria-label", translate("plan.maxCards"));
|
|
4089
|
-
maxInput.value =
|
|
4188
|
+
maxInput.value = String(DEFAULT_PLAN_CARDS);
|
|
4090
4189
|
maxField.appendChild(maxInput);
|
|
4091
4190
|
maxField.appendChild(element(doc, "span", "hive-field-hint", translate("plan.maxCardsHint")));
|
|
4092
4191
|
row.appendChild(maxField);
|
|
@@ -4144,7 +4243,7 @@ export function mount(root, options = {}) {
|
|
|
4144
4243
|
cards: [],
|
|
4145
4244
|
previewed: false,
|
|
4146
4245
|
goal: "",
|
|
4147
|
-
maxCards:
|
|
4246
|
+
maxCards: DEFAULT_PLAN_CARDS,
|
|
4148
4247
|
token: 0,
|
|
4149
4248
|
busy: false,
|
|
4150
4249
|
nodes: {
|
|
@@ -4730,17 +4829,24 @@ export function mount(root, options = {}) {
|
|
|
4730
4829
|
}
|
|
4731
4830
|
}
|
|
4732
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
|
+
|
|
4733
4839
|
async function previewPlan() {
|
|
4734
4840
|
const state = planState;
|
|
4735
4841
|
if (!state || state.busy) return;
|
|
4736
4842
|
const goal = fieldValue(state.nodes.goal).trim();
|
|
4737
|
-
const maxCards =
|
|
4843
|
+
const maxCards = readPlanMaxCards(state);
|
|
4738
4844
|
if (!goal) {
|
|
4739
4845
|
setPlanError(state, translate("plan.goalRequired"));
|
|
4740
4846
|
focusNode(state.nodes.goal);
|
|
4741
4847
|
return;
|
|
4742
4848
|
}
|
|
4743
|
-
if (
|
|
4849
|
+
if (maxCards === null) {
|
|
4744
4850
|
setPlanError(state, translate("plan.maxInvalid"));
|
|
4745
4851
|
focusNode(state.nodes.maxCards);
|
|
4746
4852
|
return;
|
|
@@ -4783,12 +4889,12 @@ export function mount(root, options = {}) {
|
|
|
4783
4889
|
const state = planState;
|
|
4784
4890
|
if (!state || state.busy) return;
|
|
4785
4891
|
const goal = fieldValue(state.nodes.goal).trim();
|
|
4786
|
-
const maxCards =
|
|
4892
|
+
const maxCards = readPlanMaxCards(state);
|
|
4787
4893
|
if (!state.previewed || state.cards.length === 0) {
|
|
4788
4894
|
setPlanError(state, translate("plan.previewFirst"));
|
|
4789
4895
|
return;
|
|
4790
4896
|
}
|
|
4791
|
-
if (
|
|
4897
|
+
if (maxCards === null) {
|
|
4792
4898
|
setPlanError(state, translate("plan.maxInvalid"));
|
|
4793
4899
|
return;
|
|
4794
4900
|
}
|
|
@@ -5066,13 +5172,20 @@ export function mount(root, options = {}) {
|
|
|
5066
5172
|
* The card drawer's "Last run" block. With no record it is one muted line;
|
|
5067
5173
|
* with a record it shows status, agent, timestamps and the short commit above
|
|
5068
5174
|
* the worker output (monospace, internally scrollable) and a copy button.
|
|
5069
|
-
* A record
|
|
5070
|
-
*
|
|
5175
|
+
* A record with overlapping writers adds one "Also writing" row, a record with
|
|
5176
|
+
* a lessons summary adds one recall row, and a record whose worker Session is
|
|
5177
|
+
* known, on a host that provides `openSession`, also gets the "Open agent
|
|
5178
|
+
* chat" button.
|
|
5071
5179
|
* @param {object|null} run - normalized `lastRun` (see normalizeLastRun)
|
|
5072
5180
|
* @returns {HTMLElement}
|
|
5073
5181
|
*/
|
|
5074
|
-
function buildRunSection(run) {
|
|
5182
|
+
function buildRunSection(run, actionHost) {
|
|
5075
5183
|
const section = element(doc, "div", "hive-card-run");
|
|
5184
|
+
const addAction = (node) => {
|
|
5185
|
+
if (Array.isArray(actionHost)) actionHost.push(node);
|
|
5186
|
+
else if (actionHost && typeof actionHost.appendChild === "function") actionHost.appendChild(node);
|
|
5187
|
+
else section.appendChild(node);
|
|
5188
|
+
};
|
|
5076
5189
|
section.appendChild(element(doc, "div", "hive-card-run-title", translate("drawer.lastRun")));
|
|
5077
5190
|
if (!run) {
|
|
5078
5191
|
section.appendChild(element(doc, "div", "hive-note hive-card-run-empty", translate("drawer.noRuns")));
|
|
@@ -5087,6 +5200,30 @@ export function mount(root, options = {}) {
|
|
|
5087
5200
|
const meta = element(doc, "div", "hive-card-run-meta", metaPartsText);
|
|
5088
5201
|
setAttr(meta, "title", metaPartsText);
|
|
5089
5202
|
section.appendChild(meta);
|
|
5203
|
+
// Consensus announcements: the other agents that announced the same paths. Invalid
|
|
5204
|
+
// entries are dropped by normalizeLastRun, duplicates collapse to one name,
|
|
5205
|
+
// and no overlapping writer means no row at all.
|
|
5206
|
+
const writers = [];
|
|
5207
|
+
for (const overlap of run.overlaps) {
|
|
5208
|
+
const agent = asString(overlap.agent);
|
|
5209
|
+
if (agent !== "" && !writers.includes(agent)) writers.push(agent);
|
|
5210
|
+
}
|
|
5211
|
+
if (writers.length > 0) {
|
|
5212
|
+
const overlapsLabel = translate("drawer.runOverlaps");
|
|
5213
|
+
// The zh dictionary copy uses the full-width colon elsewhere in the panel.
|
|
5214
|
+
const separator = /[\u4e00-\u9fff]/.test(overlapsLabel) ? ":" : ": ";
|
|
5215
|
+
section.appendChild(
|
|
5216
|
+
element(doc, "div", "hive-card-run-meta", overlapsLabel + separator + writers.join(", ")),
|
|
5217
|
+
);
|
|
5218
|
+
}
|
|
5219
|
+
// Memory recall: the worker always reports whether it read lessons, so the
|
|
5220
|
+
// block keeps one line even when the record predates that field.
|
|
5221
|
+
const lessonCount = run.lessons ? asCount(run.lessons.count, 0) : 0;
|
|
5222
|
+
const lessonsText =
|
|
5223
|
+
lessonCount > 0
|
|
5224
|
+
? translate("drawer.runLessons").replace("{count}", String(lessonCount))
|
|
5225
|
+
: translate("drawer.runNoLessons");
|
|
5226
|
+
section.appendChild(element(doc, "div", "hive-card-run-meta", lessonsText));
|
|
5090
5227
|
section.appendChild(element(doc, "pre", "hive-card-run-output", run.output));
|
|
5091
5228
|
const foot = element(doc, "div", "hive-card-run-foot");
|
|
5092
5229
|
const copy = element(doc, "button", "hive-btn hive-btn-ghost hive-card-run-copy", translate("drawer.copyOutput"));
|
|
@@ -5096,10 +5233,14 @@ export function mount(root, options = {}) {
|
|
|
5096
5233
|
copy.addEventListener("click", () => {
|
|
5097
5234
|
copyToClipboard(doc, run.output);
|
|
5098
5235
|
});
|
|
5099
|
-
|
|
5236
|
+
if (Array.isArray(actionHost) || actionHost) addAction(copy);
|
|
5237
|
+
else foot.appendChild(copy);
|
|
5100
5238
|
// Only render the jump-to-chat control when both halves exist: a recorded
|
|
5101
|
-
// worker Session and a host navigation callback.
|
|
5102
|
-
|
|
5239
|
+
// worker Session and a host navigation callback. The status does not matter:
|
|
5240
|
+
// a running card exposes its Session as soon as the worker starts, and the
|
|
5241
|
+
// button must be there while the card is still in progress. No disabled stub.
|
|
5242
|
+
const canOpenChat = asString(run.sessionId) !== "" && typeof openSession === "function";
|
|
5243
|
+
if (canOpenChat) {
|
|
5103
5244
|
const chat = element(doc, "button", "hive-btn hive-btn-ghost hive-card-run-open", translate("drawer.openChat"));
|
|
5104
5245
|
setAttr(chat, "type", "button");
|
|
5105
5246
|
setAttr(chat, "title", translate("drawer.openChat"));
|
|
@@ -5111,9 +5252,10 @@ export function mount(root, options = {}) {
|
|
|
5111
5252
|
reportError(error);
|
|
5112
5253
|
}
|
|
5113
5254
|
});
|
|
5114
|
-
|
|
5255
|
+
if (Array.isArray(actionHost) || actionHost) addAction(chat);
|
|
5256
|
+
else foot.appendChild(chat);
|
|
5115
5257
|
}
|
|
5116
|
-
section.appendChild(foot);
|
|
5258
|
+
if (!actionHost) section.appendChild(foot);
|
|
5117
5259
|
return section;
|
|
5118
5260
|
}
|
|
5119
5261
|
|
|
@@ -5153,7 +5295,17 @@ export function mount(root, options = {}) {
|
|
|
5153
5295
|
dialog.appendChild(head);
|
|
5154
5296
|
|
|
5155
5297
|
const body = element(doc, "div", "hive-dialog-body hive-card-body");
|
|
5156
|
-
|
|
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
|
+
}
|
|
5307
|
+
const runActions = [];
|
|
5308
|
+
body.appendChild(buildRunSection(card.lastRun, runActions));
|
|
5157
5309
|
dialog.appendChild(body);
|
|
5158
5310
|
|
|
5159
5311
|
const actions = actionsForState(lane, lastModel ? lastModel.writable : false);
|
|
@@ -5167,9 +5319,10 @@ export function mount(root, options = {}) {
|
|
|
5167
5319
|
),
|
|
5168
5320
|
);
|
|
5169
5321
|
}
|
|
5170
|
-
if (actions.length > 0) {
|
|
5322
|
+
if (runActions.length > 0 || actions.length > 0) {
|
|
5171
5323
|
const foot = element(doc, "div", "hive-dialog-foot hive-card-actions");
|
|
5172
5324
|
setAttr(foot, "aria-label", translate("drawer.cardActions"));
|
|
5325
|
+
for (const runAction of runActions) foot.appendChild(runAction);
|
|
5173
5326
|
const claimed = asString(card.state || lane) === "claimed";
|
|
5174
5327
|
for (const action of actions) {
|
|
5175
5328
|
const destructive = action.name === "remove";
|
|
@@ -5752,90 +5905,51 @@ export function mount(root, options = {}) {
|
|
|
5752
5905
|
}
|
|
5753
5906
|
|
|
5754
5907
|
function renderAgents(model) {
|
|
5755
|
-
clearNode(agentPills);
|
|
5756
5908
|
if (model.initialised === false) {
|
|
5757
|
-
agentsCount.
|
|
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;
|
|
5758
5913
|
return;
|
|
5759
5914
|
}
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
setAttr(
|
|
5779
|
-
setAttr(
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
const dot = element(doc, "span", "hive-dot is-" + safeClassToken(agent.state));
|
|
5783
|
-
setAttr(dot, "title", agent.state || translate("agent.idle"));
|
|
5784
|
-
pill.appendChild(dot);
|
|
5785
|
-
const taskNode = element(doc, "span", "hive-agent-pill-task", task);
|
|
5786
|
-
setAttr(taskNode, "title", task);
|
|
5787
|
-
pill.appendChild(taskNode);
|
|
5788
|
-
|
|
5789
|
-
pill.addEventListener("click", () => {
|
|
5790
|
-
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);
|
|
5791
5937
|
});
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
node
|
|
5805
|
-
|
|
5806
|
-
const meta = [];
|
|
5807
|
-
if (card.role) meta.push(translate("card.role") + " " + card.role);
|
|
5808
|
-
if (card.owner) meta.push(translate("card.owner") + " " + card.owner);
|
|
5809
|
-
if (meta.length) node.appendChild(element(doc, "div", "hive-card-meta", meta.join(" · ")));
|
|
5810
|
-
|
|
5811
|
-
if (card.scope.length) {
|
|
5812
|
-
const scopes = element(doc, "div", "hive-scopes");
|
|
5813
|
-
for (const scope of card.scope) {
|
|
5814
|
-
const chip = element(doc, "span", "hive-scope", scope);
|
|
5815
|
-
setAttr(chip, "title", scope);
|
|
5816
|
-
scopes.appendChild(chip);
|
|
5817
|
-
}
|
|
5818
|
-
node.appendChild(scopes);
|
|
5819
|
-
}
|
|
5820
|
-
|
|
5821
|
-
if (card.reason) {
|
|
5822
|
-
node.appendChild(element(doc, "div", "hive-reason", card.reason));
|
|
5823
|
-
}
|
|
5824
|
-
|
|
5825
|
-
const foot = element(doc, "div", "hive-card-foot");
|
|
5826
|
-
foot.appendChild(element(doc, "span", "hive-card-id", card.id || translate("card.noId")));
|
|
5827
|
-
foot.appendChild(element(doc, "span", "hive-card-state", laneLabel(lane)));
|
|
5828
|
-
node.appendChild(foot);
|
|
5829
|
-
|
|
5830
|
-
node.addEventListener("click", () => openDrawer(card, lane, node));
|
|
5831
|
-
node.addEventListener("keydown", (event) => {
|
|
5832
|
-
if (!event || (event.key !== "Enter" && event.key !== " ")) return;
|
|
5833
|
-
if (typeof event.preventDefault === "function") event.preventDefault();
|
|
5834
|
-
openDrawer(card, lane, node);
|
|
5835
|
-
});
|
|
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);
|
|
5836
5951
|
return node;
|
|
5837
5952
|
}
|
|
5838
|
-
|
|
5839
5953
|
function renderStageChips(model) {
|
|
5840
5954
|
clearNode(stageChips);
|
|
5841
5955
|
setAttr(stageChips, "aria-label", translate("board.filtersAria"));
|
|
@@ -5876,34 +5990,112 @@ export function mount(root, options = {}) {
|
|
|
5876
5990
|
if (lastModel) renderLanes(lastModel);
|
|
5877
5991
|
}
|
|
5878
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
|
+
|
|
5879
6071
|
function renderLanes(model) {
|
|
5880
|
-
clearNode(lanesNode);
|
|
5881
6072
|
if (model.initialised === false) {
|
|
5882
|
-
|
|
6073
|
+
clearNode(lanesNode);
|
|
6074
|
+
laneRenderState.clear();
|
|
5883
6075
|
filterEmpty.textContent = "";
|
|
5884
6076
|
filterEmpty.className = "hive-filter-empty";
|
|
5885
6077
|
return;
|
|
5886
6078
|
}
|
|
5887
|
-
|
|
6079
|
+
const seen = new Set();
|
|
5888
6080
|
for (const lane of LANE_ORDER) {
|
|
5889
|
-
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;
|
|
5890
6088
|
const classes = ["hive-lane", "hive-lane-" + lane];
|
|
5891
6089
|
if (cards.length === 0) classes.push("is-empty");
|
|
5892
6090
|
if (stageFilter !== "all" && stageFilter !== lane) classes.push("is-filtered-out");
|
|
5893
|
-
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
list.appendChild(emptyState("—"));
|
|
5902
|
-
} else {
|
|
5903
|
-
for (const card of cards) list.appendChild(renderCard(card, lane));
|
|
5904
|
-
}
|
|
5905
|
-
column.appendChild(list);
|
|
5906
|
-
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);
|
|
5907
6099
|
}
|
|
5908
6100
|
|
|
5909
6101
|
const visible = stageFilter === "all" ? model.lanes : { [stageFilter]: model.lanes[stageFilter] || [] };
|
|
@@ -6101,6 +6293,9 @@ export function mount(root, options = {}) {
|
|
|
6101
6293
|
unschedule(timer);
|
|
6102
6294
|
timer = null;
|
|
6103
6295
|
}
|
|
6296
|
+
if (typeof doc.removeEventListener === "function") {
|
|
6297
|
+
doc.removeEventListener("visibilitychange", onVisibilityChange);
|
|
6298
|
+
}
|
|
6104
6299
|
closeHelp(false);
|
|
6105
6300
|
closePlanDialog(false);
|
|
6106
6301
|
closeLimitsDialog(false);
|
|
@@ -6164,9 +6359,33 @@ export function mount(root, options = {}) {
|
|
|
6164
6359
|
}
|
|
6165
6360
|
}
|
|
6166
6361
|
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
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();
|
|
6170
6389
|
void refresh();
|
|
6171
6390
|
|
|
6172
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
|
-
|
|
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")],
|