@d86e/hive-panel 0.0.0-stage → 0.3.5
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/LICENSE +21 -0
- package/README.md +132 -2
- package/README.zh-CN.md +106 -0
- package/SPEC.md +135 -0
- package/bin/hive-panel.js +28 -0
- package/package.json +44 -4
- package/public/app.js +11 -0
- package/public/index.html +13 -0
- package/public/panel.css +758 -0
- package/public/panel.js +4326 -0
- package/src/actions.js +59 -0
- package/src/data.js +58 -0
- package/src/server.js +81 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Tommy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,133 @@
|
|
|
1
|
-
#
|
|
1
|
+
# hive-panel
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**English** · [简体中文](README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](https://www.npmjs.com/package/@d86e/hive-panel)
|
|
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.**
|
|
9
|
+
|
|
10
|
+
> zero dependencies · one local HTTP server, bound to 127.0.0.1 · no database
|
|
11
|
+
|
|
12
|
+
## Quick start
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npx @d86e/hive-panel --repo ~/Codes/project
|
|
16
|
+
# → http://127.0.0.1:7717
|
|
17
|
+
```
|
|
18
|
+
|
|
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`.
|
|
21
|
+
|
|
22
|
+
Ask the OS for a free port and read the real one from the startup output:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx @d86e/hive-panel --repo ~/Codes/project --port 0
|
|
26
|
+
# hive-panel http://127.0.0.1:52341
|
|
27
|
+
# port 52341
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
From a checkout of this repository (the same entry point the npm package ships):
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
node bin/hive-panel.js --repo .
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
If the Hive CLIs are not on PATH, point at them:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
HIVE_TASKS_BIN=/path/to/hive-tasks/bin/hive-tasks.js \
|
|
40
|
+
HIVE_BIN=/path/to/hive-consensus/bin/hive.js \
|
|
41
|
+
npx @d86e/hive-panel --repo .
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## DSH does not need this panel
|
|
45
|
+
|
|
46
|
+
DSH's Web UI has its own **Hive / 蜂群** tab, provided by the separate
|
|
47
|
+
`dsh-hive-panel` plugin. That plugin registers a same-origin route over DSH's
|
|
48
|
+
`connection.fetch` and runs the Hive CLIs through DSH's command layer
|
|
49
|
+
(`ctx.shell`) in the Session's working directory. It never calls this server,
|
|
50
|
+
never uses port `7717`, and does not expect `hive-panel` to be running.
|
|
51
|
+
|
|
52
|
+
Use this standalone panel when you are outside DSH: a terminal, another editor,
|
|
53
|
+
CI, or a second browser tab. The two share only the repository — the refs and
|
|
54
|
+
`.hive/` — not a process, a port or a database.
|
|
55
|
+
|
|
56
|
+
## What it shows
|
|
57
|
+
|
|
58
|
+
| Column | Source |
|
|
59
|
+
| --- | --- |
|
|
60
|
+
| Agents | `hive board --json` (state, current card, files, last seen) |
|
|
61
|
+
| Tasks | `hive-tasks list --json`, split into pending / claimed / done / blocked / failed |
|
|
62
|
+
| Events | the last 80 lines of `.hive/events.jsonl` |
|
|
63
|
+
| Header | mode (free / freeze) and `hive-tasks stats --json` |
|
|
64
|
+
|
|
65
|
+
The page polls `/api/snapshot` every 3 seconds. One process serves one repository.
|
|
66
|
+
|
|
67
|
+
## When the repository is not initialised
|
|
68
|
+
|
|
69
|
+
`GET /api/snapshot` always answers `200`. Its `initialised` field turns `true`
|
|
70
|
+
once git has a ref under `refs/hive/v1` (the ref itself or a sub-ref such as
|
|
71
|
+
`refs/hive/v1/mode`). While it is `false` the server does not run the Hive
|
|
72
|
+
CLIs: `board` and `tasks` are `[]`, `stats` is `null` and the page shows the
|
|
73
|
+
"Initialise Hive" pane. That lets a launcher watch a repository from "not
|
|
74
|
+
initialised" to ready without treating it as an error.
|
|
75
|
+
|
|
76
|
+
## Write mode
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npx @d86e/hive-panel --repo ~/Codes/project --write
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Adds a freeze toggle, `New task` (add), `Give the Queen a goal` (plan),
|
|
83
|
+
`Commit`, and per-card actions (claim / done / fail / retry), backed by
|
|
84
|
+
`/api/actions/*` for every CLI verb the panel knows. Each action is a fixed argv
|
|
85
|
+
builder — nothing else is callable. The page still only reads: it posts, then
|
|
86
|
+
polls.
|
|
87
|
+
|
|
88
|
+
## API
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
GET /api/snapshot -> { at, repo, initialised, mode, board, tasks, stats, events, writable }
|
|
92
|
+
GET /api/health -> { ok, repo, port, pid }
|
|
93
|
+
GET /api/actions -> { writable, actions: [...] }
|
|
94
|
+
POST /api/actions/<name> the table in SPEC.md
|
|
95
|
+
POST /api/mode { mode, reason }
|
|
96
|
+
POST /api/retry { id }
|
|
97
|
+
GET / -> the page
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
- `GET /api/snapshot` is the whole board in one response. `initialised` is
|
|
101
|
+
described above; `writable` mirrors `--write`.
|
|
102
|
+
- `GET /api/health` reports the port the server is actually listening on — the
|
|
103
|
+
resolved port when started with `--port 0` — plus the repository path and
|
|
104
|
+
`pid`. It always answers `200` and is not gated by `--write`.
|
|
105
|
+
- `GET /api/actions` lists the callable action names and the current write flag.
|
|
106
|
+
- `POST /api/actions/<name>` returns `{ ok, code, stdout, stderr }`; without
|
|
107
|
+
`--write` every POST answers `403`.
|
|
108
|
+
- `POST /api/mode` and `POST /api/retry` are aliases for the matching actions.
|
|
109
|
+
- `--port 0` picks a free port; the startup output then prints the real port on
|
|
110
|
+
both the URL line and a `port <n>` line, so a launcher can parse it and call
|
|
111
|
+
`/api/health` to confirm.
|
|
112
|
+
|
|
113
|
+
## Design
|
|
114
|
+
|
|
115
|
+
- Read-only by default: the page never claims, completes or edits a card; writes
|
|
116
|
+
are opt-in with `--write` and go through the fixed action table.
|
|
117
|
+
- Contract-only: it shells out to the documented CLIs and never imports the
|
|
118
|
+
core. A missing CLI degrades to empty data instead of failing the page.
|
|
119
|
+
- Standalone: it needs only the repository. DSH uses its own plugin instead (see
|
|
120
|
+
above), so this board is for use outside DSH.
|
|
121
|
+
|
|
122
|
+
## Limits
|
|
123
|
+
|
|
124
|
+
- Local only: binds `127.0.0.1` and has no authentication. Do not expose it to a
|
|
125
|
+
network; put an authenticating reverse proxy in front if you really need
|
|
126
|
+
remote access.
|
|
127
|
+
- One repository per process and one port per process.
|
|
128
|
+
- The agents column needs `hive-consensus` installed.
|
|
129
|
+
- Polling, not streaming; 3 seconds is fine for a swarm.
|
|
130
|
+
|
|
131
|
+
## License
|
|
132
|
+
|
|
133
|
+
MIT
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# hive-panel
|
|
2
|
+
|
|
3
|
+
[English](README.md) · **简体中文**
|
|
4
|
+
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](https://www.npmjs.com/package/@d86e/hive-panel)
|
|
7
|
+
|
|
8
|
+
**独立的 Hive 蜂群浏览器看板:谁在线、每个 agent 在做什么、四列任务泳道、事件尾巴——数据全部来自工具已经写下的 refs 和文件。**
|
|
9
|
+
|
|
10
|
+
> 零依赖 · 一个本地 HTTP 服务,只绑 127.0.0.1 · 没有数据库
|
|
11
|
+
|
|
12
|
+
## 快速开始
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npx @d86e/hive-panel --repo ~/Codes/project
|
|
16
|
+
# 打开 http://127.0.0.1:7717
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`--repo` 默认是当前目录,`--port` 默认是 `7717`。服务只绑 `127.0.0.1`;不加 `--write` 时是只读的。
|
|
20
|
+
|
|
21
|
+
让系统分配一个空闲端口,并从启动输出里读真实端口:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npx @d86e/hive-panel --repo ~/Codes/project --port 0
|
|
25
|
+
# hive-panel http://127.0.0.1:52341
|
|
26
|
+
# port 52341
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
直接从这个仓库跑(和 npm 包是同一个入口):
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
node bin/hive-panel.js --repo .
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Hive 的 CLI 不在 PATH 上时,指给它们:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
HIVE_TASKS_BIN=/path/to/hive-tasks/bin/hive-tasks.js \
|
|
39
|
+
HIVE_BIN=/path/to/hive-consensus/bin/hive.js \
|
|
40
|
+
npx @d86e/hive-panel --repo .
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## DSH 内不需要它
|
|
44
|
+
|
|
45
|
+
DSH Web 界面自带 **Hive / 蜂群** 标签页,由另一个插件 `dsh-hive-panel` 提供:它在 DSH 的 `connection.fetch` 上注册同源路由,并通过 DSH 的命令执行层(`ctx.shell`)在会话的工作目录里跑 Hive CLI。它不调用这个服务、不经过 `7717`,也不要求 `hive-panel` 在跑。
|
|
46
|
+
|
|
47
|
+
这个独立看板留给 DSH 之外的场景:终端、别的编辑器、CI,或者第二个浏览器标签页。两者只共享仓库——refs 和 `.hive/`——不共享进程、端口或数据库。
|
|
48
|
+
|
|
49
|
+
## 显示什么
|
|
50
|
+
|
|
51
|
+
| 列 | 来源 |
|
|
52
|
+
| --- | --- |
|
|
53
|
+
| Agents | `hive board --json`(状态、当前卡、文件、最后出现) |
|
|
54
|
+
| Tasks | `hive-tasks list --json`,分成 pending / claimed / done / blocked / failed |
|
|
55
|
+
| Events | `.hive/events.jsonl` 最后 80 行 |
|
|
56
|
+
| 顶部 | 模式(free / freeze)与 `hive-tasks stats --json` |
|
|
57
|
+
|
|
58
|
+
页面每 3 秒轮询一次 `/api/snapshot`。一个进程服务一个仓库。
|
|
59
|
+
|
|
60
|
+
## 仓库还没初始化时
|
|
61
|
+
|
|
62
|
+
`GET /api/snapshot` 永远返回 `200`。`initialised` 在 git 里出现 `refs/hive/v1` 下的 ref(ref 本身,或像 `refs/hive/v1/mode` 这样的子 ref)之后变成 `true`。在它是 `false` 时,服务不去跑 Hive CLI:`board` 和 `tasks` 是 `[]`、`stats` 是 `null`,页面显示「初始化 Hive」面板。这样启动器可以从「还没初始化」一直观察到就绪,而不用把中间状态当成错误。
|
|
63
|
+
|
|
64
|
+
## 写模式
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npx @d86e/hive-panel --repo ~/Codes/project --write
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
多出冻结开关、新建任务(add)、给女王下目标(plan)、提交(commit),以及卡片动作(认领/完成/失败/重试);每个动作对应 `/api/actions/*` 里一个固定入口,参数由固定构造函数拼装,别的一概不可调用。页面本身仍然只读——它发 POST,然后靠轮询刷新。
|
|
71
|
+
|
|
72
|
+
## API
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
GET /api/snapshot -> { at, repo, initialised, mode, board, tasks, stats, events, writable }
|
|
76
|
+
GET /api/health -> { ok, repo, port, pid }
|
|
77
|
+
GET /api/actions -> { writable, actions: [...] }
|
|
78
|
+
POST /api/actions/<name> 见 SPEC.md 的动作表
|
|
79
|
+
POST /api/mode { mode, reason }
|
|
80
|
+
POST /api/retry { id }
|
|
81
|
+
GET / -> 页面
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
- `GET /api/snapshot` 一次返回整块看板;`initialised` 见上,`writable` 对应 `--write`。
|
|
85
|
+
- `GET /api/health` 返回服务**真正在监听**的端口(`--port 0` 时就是系统分配的那个)、仓库路径和 `pid`;永远 `200`,不受 `--write` 影响。
|
|
86
|
+
- `GET /api/actions` 列出可调用的动作名和当前写标志。
|
|
87
|
+
- `POST /api/actions/<name>` 返回 `{ ok, code, stdout, stderr }`;不加 `--write` 时所有 POST 都是 `403`。
|
|
88
|
+
- `POST /api/mode`、`POST /api/retry` 是对应动作的别名。
|
|
89
|
+
- `--port 0` 让系统选端口,启动输出会在 URL 行和 `port <n>` 行打印真实端口,启动器可以解析它,再调 `/api/health` 确认。
|
|
90
|
+
|
|
91
|
+
## 设计
|
|
92
|
+
|
|
93
|
+
- 默认只读:页面从不认领、完成或修改卡片;写操作要 `--write` 显式打开,并且只走固定的动作表。
|
|
94
|
+
- 只走契约:shell 调文档化的 CLI,不 import 核心代码。缺 CLI 时退化成空数据,页面不报错。
|
|
95
|
+
- 独立:只需要仓库。DSH 里用另一个插件(见上),这个看板是给 DSH 之外用的。
|
|
96
|
+
|
|
97
|
+
## 限制
|
|
98
|
+
|
|
99
|
+
- 只在本机:绑 `127.0.0.1`,没有认证。不要暴露到网络;确实要远程访问,就在前面加一层带认证的反向代理。
|
|
100
|
+
- 一个进程一个仓库、一个端口。
|
|
101
|
+
- Agents 列需要安装 `hive-consensus`。
|
|
102
|
+
- 轮询而非推流;3 秒对蜂群够用。
|
|
103
|
+
|
|
104
|
+
## 许可
|
|
105
|
+
|
|
106
|
+
MIT
|
package/SPEC.md
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# hive-panel contract
|
|
2
|
+
|
|
3
|
+
Status: 0.3.3. Read-only by default; writes are opt-in with `--write`.
|
|
4
|
+
|
|
5
|
+
## 1. Process
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
hive-panel [--port 7717] [--repo PATH] [--write]
|
|
9
|
+
```
|
|
10
|
+
|
|
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.
|
|
13
|
+
|
|
14
|
+
`--port 0` asks the OS for a free port. The startup output then carries the port
|
|
15
|
+
that is actually listening — both in the URL line and on a `port <n>` line — so a
|
|
16
|
+
launcher can parse it and call `GET /api/health`.
|
|
17
|
+
|
|
18
|
+
## 2. Snapshot
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
GET /api/snapshot
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"at": "ISO-8601",
|
|
27
|
+
"repo": "/abs/path",
|
|
28
|
+
"initialised": true,
|
|
29
|
+
"mode": { "mode": "free" },
|
|
30
|
+
"board": [ { "agent": "w1", "state": "working", "task": "auth-1a2b" } ],
|
|
31
|
+
"tasks": [ "<card as written by hive-tasks>" ],
|
|
32
|
+
"stats": { "total": 0, "byState": {}, "byRole": {}, "oldestPending": null },
|
|
33
|
+
"events": [ "<last 80 lines of .hive/events.jsonl, newest first>" ],
|
|
34
|
+
"writable": false
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
A missing CLI yields an empty array or null; the page degrades, it never fails.
|
|
39
|
+
|
|
40
|
+
`initialised` is true once git has a ref under `refs/hive/v1` (the ref itself or a
|
|
41
|
+
sub-ref such as `refs/hive/v1/mode`). While it is false the server does not spawn
|
|
42
|
+
the CLIs: `board` and `tasks` are `[]`, `stats` is `null`, and the response is
|
|
43
|
+
still `200` — never `404` — so a launcher can poll until `hive init` lands.
|
|
44
|
+
|
|
45
|
+
## 3. Health
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
GET /api/health -> { "ok": true, "repo": "/abs/path", "port": 7717, "pid": 12345 }
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
`port` is the port the server is actually listening on (the resolved port when it
|
|
52
|
+
was started with `--port 0`); `pid` is the server process. Health is always `200`
|
|
53
|
+
and is not gated by `--write`.
|
|
54
|
+
|
|
55
|
+
## 4. Action inventory
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
GET /api/actions -> { "writable": false, "actions": ["init", "add", ...] }
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
POST /api/actions/<name> body: JSON -> { "ok": true, "code": 0, "stdout": "", "stderr": "" }
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Only the names below are callable; anything else is `400 unknown action`. Each row is
|
|
66
|
+
one shell-out with a fixed argv builder — the panel never imports the core.
|
|
67
|
+
|
|
68
|
+
| Action | Binary (env) | argv |
|
|
69
|
+
| --- | --- | --- |
|
|
70
|
+
| `init` | HIVE_BIN | `init [--force]` |
|
|
71
|
+
| `add` | HIVE_TASKS_BIN | `add --title T [--role R] [--scope P]... [--after ID]... [--acceptance CMD] [--priority N]` |
|
|
72
|
+
| `plan` | HIVE_RUN_BIN | `plan --goal G --max-cards N [--apply]` |
|
|
73
|
+
| `claim` | HIVE_TASKS_BIN | `claim <id> --agent A --ttl 5m` |
|
|
74
|
+
| `done` | HIVE_TASKS_BIN | `done <id> [--sha S] [--verdict pass\|fail]` |
|
|
75
|
+
| `fail` | HIVE_TASKS_BIN | `fail <id> --reason R` |
|
|
76
|
+
| `retry` | HIVE_TASKS_BIN | `retry <id>` |
|
|
77
|
+
| `block` | HIVE_TASKS_BIN | `block <id> --reason R` |
|
|
78
|
+
| `renew` | HIVE_TASKS_BIN | `renew <id> --ttl 5m [--agent A]` |
|
|
79
|
+
| `mode` | HIVE_BIN | `mode free\|freeze --reason R` |
|
|
80
|
+
| `learn` | HIVE_BIN | `lesson add --scope G TEXT` |
|
|
81
|
+
| `recall` | HIVE_BIN | `recall <scope> [--limit N]` |
|
|
82
|
+
| `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
|
+
| `commit` | MOC_BIN | `commit -m MSG [--set PATH]...` |
|
|
85
|
+
| `doctor` | HIVE_BIN | `doctor` |
|
|
86
|
+
|
|
87
|
+
Defaults applied when the body omits a field: agent `panel`, ttl `5m`, concurrency `3`,
|
|
88
|
+
timeout `15m`, message `panel commit`.
|
|
89
|
+
|
|
90
|
+
Aliases kept for the page:
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
POST /api/mode { "mode": "free|freeze", "reason": "..." } -> mode
|
|
94
|
+
POST /api/retry { "id": "<card>" } -> retry
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## 5. Binaries
|
|
98
|
+
|
|
99
|
+
| Variable | Default | Used for |
|
|
100
|
+
| --- | --- | --- |
|
|
101
|
+
| HIVE_BIN | hive | board, init, mode, learn, recall, verdict |
|
|
102
|
+
| HIVE_TASKS_BIN | hive-tasks | list, stats, add, claim, done, fail, retry, block, renew |
|
|
103
|
+
| HIVE_RUN_BIN | hive-run | plan, run |
|
|
104
|
+
| MOC_BIN | moc | commit |
|
|
105
|
+
|
|
106
|
+
## 6. Refresh
|
|
107
|
+
|
|
108
|
+
The page polls every 3 seconds. The server caches nothing.
|
|
109
|
+
|
|
110
|
+
## 7. Non-goals
|
|
111
|
+
|
|
112
|
+
- 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.
|
|
115
|
+
|
|
116
|
+
## 8. Gaps — what the next session picks up
|
|
117
|
+
|
|
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.
|
|
120
|
+
|
|
121
|
+
| Surface | Endpoint that already exists | Still missing |
|
|
122
|
+
| --- | --- | --- |
|
|
123
|
+
| 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.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { createServer } from "../src/server.js";
|
|
4
|
+
|
|
5
|
+
const args = process.argv.slice(2);
|
|
6
|
+
let repo = process.cwd();
|
|
7
|
+
let port = 7717;
|
|
8
|
+
let writable = false;
|
|
9
|
+
|
|
10
|
+
for (let i = 0; i < args.length; i++) {
|
|
11
|
+
if (args[i] === "--port") port = Number(args[++i]);
|
|
12
|
+
else if (args[i] === "--repo") repo = path.resolve(args[++i]);
|
|
13
|
+
else if (args[i] === "--write") writable = true;
|
|
14
|
+
else if (args[i] === "-h" || args[i] === "--help") {
|
|
15
|
+
process.stdout.write("hive-panel [--port 7717] [--repo PATH] [--write]\n");
|
|
16
|
+
process.exit(0);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const publicDir = path.resolve(import.meta.dirname, "..", "public");
|
|
21
|
+
const server = createServer({ repo: path.resolve(repo), publicDir, writable });
|
|
22
|
+
server.listen(port, "127.0.0.1", () => {
|
|
23
|
+
const address = server.address();
|
|
24
|
+
const actualPort = address && typeof address === "object" ? address.port : port;
|
|
25
|
+
process.stdout.write("hive-panel http://127.0.0.1:" + actualPort + "\n");
|
|
26
|
+
process.stdout.write("port " + actualPort + "\n");
|
|
27
|
+
process.stdout.write("repo " + path.resolve(repo) + "\n");
|
|
28
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d86e/hive-panel",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.3.5",
|
|
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
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"hive-panel": "bin/hive-panel.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin",
|
|
11
|
+
"src",
|
|
12
|
+
"public",
|
|
13
|
+
"SPEC.md",
|
|
14
|
+
"README.md",
|
|
15
|
+
"README.zh-CN.md",
|
|
16
|
+
"LICENSE"
|
|
17
|
+
],
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=20"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"test": "node --test test/*.test.mjs",
|
|
23
|
+
"start": "node bin/hive-panel.js"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"git",
|
|
27
|
+
"agents",
|
|
28
|
+
"dashboard",
|
|
29
|
+
"panel",
|
|
30
|
+
"hive",
|
|
31
|
+
"multi-agent"
|
|
32
|
+
],
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"author": "Tommy <thf85@qq.com>",
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "git+https://github.com/d86e/hive-panel.git"
|
|
38
|
+
},
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/d86e/hive-panel/issues"
|
|
41
|
+
},
|
|
42
|
+
"homepage": "https://github.com/d86e/hive-panel#readme",
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
}
|
|
46
|
+
}
|
package/public/app.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// The page is a thin host: panel.js owns rendering, polling and the actions.
|
|
2
|
+
import { mount } from "/panel.js";
|
|
3
|
+
|
|
4
|
+
const panel = mount(document.getElementById("hive"), {
|
|
5
|
+
snapshotUrl: "/api/snapshot",
|
|
6
|
+
actionsUrl: "/api/actions",
|
|
7
|
+
onError: (error) => console.error("[hive-panel]", error),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
// Kept for debugging from the console.
|
|
11
|
+
window.hivePanel = panel;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>Hive panel</title>
|
|
7
|
+
<link rel="stylesheet" href="/panel.css">
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="hive"></div>
|
|
11
|
+
<script type="module" src="/app.js"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|