dsh-hive-panel 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/README.md +7 -3
- package/SPEC.md +23 -4
- package/docs/DESIGN.md +15 -4
- package/lib/client.js +191 -12
- package/lib/index.js +34 -12
- package/lib/queen.js +6 -3
- package/package.json +1 -1
- package/scripts/verify.mjs +73 -2
- package/src/panel.css +17 -0
- package/src/panel.js +190 -11
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,42 @@ All notable changes to this project are documented in this file. The format is
|
|
|
4
4
|
based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and this project
|
|
5
5
|
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [1.0.6] - 2026-12-05
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- The shared renderer and stylesheet are re-synced from hive-panel 1.0.2: agent details
|
|
12
|
+
open in a centered dialog with a readable list, the header count prioritises live
|
|
13
|
+
workers, and the technical detail block is collapsed. The browser bundle is rebuilt.
|
|
14
|
+
|
|
15
|
+
### Tests
|
|
16
|
+
|
|
17
|
+
- 41 checks pass, including the synced renderer and the rebuilt client bundle.
|
|
18
|
+
|
|
19
|
+
## [1.0.5] - 2026-12-05
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- **The queen repository is registered with the supervisor from the first prompt
|
|
24
|
+
assembly.** When a Session's cwd is an initialised repository, the queen injection now
|
|
25
|
+
also calls `hiveSupervisor.addRepo(cwd)` with the full path, so a repository outside
|
|
26
|
+
the static `repos` config is supervised immediately instead of only after the panel is
|
|
27
|
+
opened. Registration is idempotent; relative or uninitialised paths are ignored.
|
|
28
|
+
- **The injected queen invariants now cover mutation tools and claim.** The
|
|
29
|
+
`QUEEN_INVARIANTS` block names the forbidden tools explicitly — `write`, `edit`,
|
|
30
|
+
`bash`, `cua` … — and states that `claim` is a worker action; read-only and
|
|
31
|
+
`hive_*` tools stay allowed. This sits above the untrusted workspace role file, so an
|
|
32
|
+
older `hive init` contract cannot widen the queen's tool surface.
|
|
33
|
+
|
|
34
|
+
### Tests
|
|
35
|
+
|
|
36
|
+
- 41 checks cover the `addRepo` registration path, initialised-marker discovery, the
|
|
37
|
+
widened invariants copy and the unchanged suppression rules.
|
|
38
|
+
|
|
39
|
+
### Published
|
|
40
|
+
|
|
41
|
+
- npm: `dsh-hive-panel@1.0.5` on 2026-12-05.
|
|
42
|
+
|
|
7
43
|
## [1.0.4] - 2026-12-05
|
|
8
44
|
|
|
9
45
|
### Fixed
|
|
@@ -25,6 +61,10 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
25
61
|
registration, subagent exclusion, `/queen off` suppression and the unchanged
|
|
26
62
|
invariants / role cap paths.
|
|
27
63
|
|
|
64
|
+
### Published
|
|
65
|
+
|
|
66
|
+
- npm: `dsh-hive-panel@1.0.4` on 2026-12-05.
|
|
67
|
+
|
|
28
68
|
## [1.0.3] - 2026-12-05
|
|
29
69
|
|
|
30
70
|
### Fixed
|
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ the Hive CLI writes them.
|
|
|
43
43
|
| **Task actions** | Claim, complete, fail, retry and delete a task from its details; create tasks, ask the Queen for a task plan and pause or resume claiming from the toolbar |
|
|
44
44
|
| **Task details** | ID, role, state and file scope, plus the last run: output, the **Also writing** overlap announcements and the lessons read. **Open agent chat** jumps to that worker's conversation when DSH can navigate to it |
|
|
45
45
|
| **Settings** | The toolbar gear opens per-role concurrency limits (0–999, 0 pauses the role; needs `dsh-hive-runner`) and role management (add a role with adapter, model and responsibilities; delete a role) |
|
|
46
|
-
| **Supervisor status** | When [dsh-hive-runner](https://github.com/d86e/dsh-hive-runner) is installed, the toolbar shows the current repository's supervisor state (idle, running, backoff, paused) with the running agent count, and **Resume** while paused |
|
|
46
|
+
| **Supervisor status** | When [dsh-hive-runner](https://github.com/d86e/dsh-hive-runner) is installed, the toolbar shows the current repository's supervisor state (idle, running, backoff, paused) with the running agent count, and **Resume** while paused. A repository that becomes the queen is added to the supervisor automatically, so it starts dispatching even when it is not listed in the runner's `repos` config |
|
|
47
47
|
| **Read-only by default** | Watching the board is safe out of the box; mutations (including settings writes) are opt-in |
|
|
48
48
|
|
|
49
49
|
## Requirements
|
|
@@ -283,8 +283,12 @@ supervisor registration happens on the same first assembly.
|
|
|
283
283
|
low-trust input: it is labelled as untrusted, has a built-in coordinator fallback and is
|
|
284
284
|
capped at 24576 characters. A plugin-owned **trusted invariants** block is always injected
|
|
285
285
|
above it (never call `subagent`/`subagent_fork`/`subagent_claude_code` or execution tools to
|
|
286
|
-
implement;
|
|
287
|
-
|
|
286
|
+
implement; never call `write`/`edit`/`apply_patch`/`bash`/`cua` or any file-mutating or
|
|
287
|
+
command-executing tool; tasks and state use only `hive_*` tools; `claim`/`done`/`fail` are
|
|
288
|
+
worker actions the queen must not call; implementation is delegated to the supervisor). The
|
|
289
|
+
tool-boundary sentence is injected in English and Chinese, so an older `hive init` role file
|
|
290
|
+
gets it without re-running init. Goals become Hive tasks; discussion creates tasks only when
|
|
291
|
+
asked to execute, so a stale or custom workspace role file cannot remove the boundary.
|
|
288
292
|
- If you expose DSH Web beyond your machine, add authentication or a reverse proxy at the
|
|
289
293
|
DSH layer first.
|
|
290
294
|
|
package/SPEC.md
CHANGED
|
@@ -340,6 +340,17 @@ the registration on the first assembly, so the supervisor is ready even when no
|
|
|
340
340
|
open; registration is in-memory, idempotent and repeated on each activation/snapshot, so a
|
|
341
341
|
plugin restart restores it. The supervisor then parents task workers to that conversation.
|
|
342
342
|
|
|
343
|
+
Repository registration: the same registrar also adds the Session's cwd to the supervisor
|
|
344
|
+
(with `hiveSupervisor.addRepo(repo)`) so a repository that was never in
|
|
345
|
+
`config.repos` is still dispatched. It only runs when that cwd has
|
|
346
|
+
`.hive/roles/queen.md` (an initialised queen repository); `addRepo` is idempotent by
|
|
347
|
+
normalised path, so prompt assemblies, snapshots and init/queen-on may all repeat it
|
|
348
|
+
safely. The registration is deliberately **one-way**: `/queen off`, agent disposal,
|
|
349
|
+
plugin unload and process restart never remove it, and the supervisor's
|
|
350
|
+
`status().repos` list (what the panel's supervisor strip renders) shows the repository.
|
|
351
|
+
When the mounted supervisor predates `addRepo`, the repository step is skipped with a
|
|
352
|
+
log line and only the queen Session is registered.
|
|
353
|
+
|
|
343
354
|
Injection: a system-prompt section `hive:queen` (order 520) evaluated on each prompt
|
|
344
355
|
assembly with the Session's `agent`; it auto-activates from the agent's cwd on the first
|
|
345
356
|
assembly (see Activation 1), renders role + invariants for the marked Session and an empty
|
|
@@ -350,8 +361,13 @@ naming the absolute source path, capped at 24576 characters and marked `[truncat
|
|
|
350
361
|
when cut; a built-in fallback is labelled when the file is missing. Between the label and the
|
|
351
362
|
workspace body the plugin always injects a **trusted invariants** block (`QUEEN_INVARIANTS`):
|
|
352
363
|
never call `subagent`/`subagent_fork`/`subagent_claude_code` or execution tools to implement;
|
|
353
|
-
|
|
354
|
-
|
|
364
|
+
never call `write`/`edit`/`apply_patch`/`bash`/`cua` or any other file-mutating or
|
|
365
|
+
command-executing tool; tasks and state use only `hive_*` tools; `claim`/`done`/`fail` are
|
|
366
|
+
worker actions the queen must not call; implementation is delegated to the supervisor. The
|
|
367
|
+
tool-boundary sentence is injected in English and Chinese, so a repository initialised by an
|
|
368
|
+
older `hive init` (whose role file predates this contract) gets it without re-running init.
|
|
369
|
+
Goals become Hive tasks and the supervisor dispatches them; discussion creates tasks only when
|
|
370
|
+
the human asks to execute. The block is plugin-owned and cannot be overridden by the workspace file.
|
|
355
371
|
The fallback and the exit hint both carry the coordinator contract (fine-grained tasks,
|
|
356
372
|
acceptance commands, supervise/review/report, `hive-queen` skill) and never grant code-writing.
|
|
357
373
|
|
|
@@ -369,5 +385,8 @@ acceptance commands, supervise/review/report, `hive-queen` skill) and never gran
|
|
|
369
385
|
Host APIs used: `connection.fetch.register`, `sessions`, `workingDirectory`, `shell`,
|
|
370
386
|
`systemPrompt.section`, `commands.register` (and `agents` in the inject list), plus
|
|
371
387
|
`ctx.effect` and `ctx.on('agent/disposed')`. `sandboxPolicy`, `sessionPersistence`
|
|
372
|
-
and `hiveSupervisor` are optional and read through `ctx.get`.
|
|
373
|
-
|
|
388
|
+
and `hiveSupervisor` are optional and read through `ctx.get`. The supervisor contract
|
|
389
|
+
used here is `setQueenSession(sessionId)` plus the optional `addRepo(repo)` /
|
|
390
|
+
`hasRepo(repo)` from dsh-hive-runner's `HiveSupervisor` (feature-detected; older
|
|
391
|
+
supervisors get no repository registration). A DSH upgrade can change any of these:
|
|
392
|
+
re-run `npm run check` against the installed DSH before releasing.
|
package/docs/DESIGN.md
CHANGED
|
@@ -293,7 +293,14 @@ token(PATH 名或绝对路径)。
|
|
|
293
293
|
就在**首次组装时**自动 mark(source auto)、注入角色文本 + `QUEEN_INVARIANTS`,并调用
|
|
294
294
|
`registerQueenSession(sessionId)` 向 `ctx.get('hiveSupervisor')` 幂等登记。这条路径不需要
|
|
295
295
|
打开面板,所以 DSH 重启后面板没开、或用户直接对 chat 说目标时,会话仍是女王而不是普通
|
|
296
|
-
coding agent;只看**当前会话的 cwd
|
|
296
|
+
coding agent;只看**当前会话的 cwd**,不同仓库互不影响。同一钩子还会把该会话 cwd
|
|
297
|
+
通过 `hiveSupervisor.addRepo(cwd)` 登记给 supervisor(仅当 cwd 有
|
|
298
|
+
`.hive/roles/queen.md`;`addRepo` 按规范化路径幂等去重),否则 supervisor 只对
|
|
299
|
+
`config.repos` 里的仓库派发、从面板 init/queen-on 打开的新仓库永远不会被跑。登记是
|
|
300
|
+
**单向**的:`/queen off`、agent dispose、插件卸载、进程重启都不会 `removeRepo`;
|
|
301
|
+
supervisor 的 `status().repos`(面板 supervisor 条的数据源)随即可见该仓库。
|
|
302
|
+
旧版 supervisor 没有 `addRepo` 时跳过仓库登记并记一条日志,仍登记 queen Session。
|
|
303
|
+
subagent 会话
|
|
297
304
|
(`session.header.origin === 'subagent'` 或 `delegationDepth > 0`)被排除:卡 worker 与父会话
|
|
298
305
|
共享仓库 cwd,若自动注入会污染 worker 并把 supervisor 的 queen 登记顶掉。
|
|
299
306
|
- **面板触发的自动标记**:`op=snapshot` 返回前已经跑过 `refs/hive/v1` 探针;若仓库已初始化、
|
|
@@ -318,7 +325,9 @@ token(PATH 名或绝对路径)。
|
|
|
318
325
|
“`[hive:queen] role loaded from <绝对路径> … untrusted`” 开头,随后是无条件注入的
|
|
319
326
|
**插件自有 trusted invariants**(禁止 subagent/直接执行实现;目标只转成 Hive 任务;讨论只在
|
|
320
327
|
人类明确要执行时建任务)——旧版 `hive init` 写出的工作区角色文件无法覆盖它,因此生产红线不依赖
|
|
321
|
-
仓库是否重新 init
|
|
328
|
+
仓库是否重新 init。invariants 另含**工具边界**(中英各一句):禁止 `write`/`edit`/`apply_patch`/
|
|
329
|
+
`bash`/`cua` 等修改文件或执行命令的工具,任务与状态只用 `hive_*` 工具,`claim`/`done`/`fail` 是
|
|
330
|
+
worker 动作女王不得调用,实现交给 supervisor;这样老仓库不重跑 init 也能拿到该边界。总长 **≤ 24576 字符**;超长截断并标注
|
|
322
331
|
`[truncated]`。文件缺失时用内置兜底角色,并标注 `missing; built-in fallback`;兜底与退出提示
|
|
323
332
|
都写明协调者契约(细粒度卡、每卡必须有验收命令、排序/监督/审查/汇报,永不写码)。
|
|
324
333
|
- **不污染会话日志**:不 append 自定义 session 事件(第三方未知事件会让 resume 拒绝解释日志),
|
|
@@ -433,7 +442,7 @@ npm run check
|
|
|
433
442
|
# ok - node --check lib/queen.js
|
|
434
443
|
# ok - node --check lib/client.js
|
|
435
444
|
# ...
|
|
436
|
-
#
|
|
445
|
+
# 41 checks passed
|
|
437
446
|
```
|
|
438
447
|
|
|
439
448
|
覆盖:语法、package/bundle 声明、无代理残留、client bundle 的 `/api/hive` URL 与 Session 注入、
|
|
@@ -447,7 +456,9 @@ Connection Fetch 路由注册、快照走 `ctx.shell` 且 cwd/policy 正确、
|
|
|
447
456
|
另有 `initialised` 只靠 `.hive/roles.yaml`/`.hive/config.json` 即为 true、init 动作后立即 true、
|
|
448
457
|
两者与 ref 都无才为 false,以及 client bundle 的 init 成功即时切面检查;prompt 首次组装自动注入
|
|
449
458
|
(含 `QUEEN_INVARIANTS`、supervisor 幂等登记、跨仓库隔离)、`/queen off` 后不注入、
|
|
450
|
-
`autoQueen=false`
|
|
459
|
+
`autoQueen=false` 不注入、未初始化仓库不注入;prompt/init/queen-on 路径对
|
|
460
|
+
`hiveSupervisor.addRepo` 的登记(幂等去重、只登记有 queen.md 的仓库、退出与卸载不删除);
|
|
461
|
+
invariants 的工具边界断言(write/edit/apply_patch/bash/cua/claim、hive_*、中英两句)。
|
|
451
462
|
|
|
452
463
|
不启动、不重启任何 DSH 进程,也不写运行中的 `~/.dsh`。
|
|
453
464
|
|
package/lib/client.js
CHANGED
|
@@ -2090,6 +2090,22 @@ dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow:
|
|
|
2090
2090
|
}
|
|
2091
2091
|
.hive-agent-count { font: inherit; cursor: pointer; }
|
|
2092
2092
|
.hive-agent-count:disabled { cursor: default; }
|
|
2093
|
+
/* Agents dialog */
|
|
2094
|
+
.hive-agents-dialog { width: min(560px, 92vw); max-height: 80vh; }
|
|
2095
|
+
.hive-agents-body { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow: auto; }
|
|
2096
|
+
.hive-agents-empty-note { padding: 10px 0; color: var(--hive-fg-soft); font-size: 12px; line-height: 1.5; }
|
|
2097
|
+
.hive-agent-row { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--hive-line-2); }
|
|
2098
|
+
.hive-agent-row-main { display: flex; flex: 1 1 auto; flex-direction: column; gap: 2px; min-width: 0; }
|
|
2099
|
+
.hive-agent-row-name { color: var(--hive-fg); font-size: 14px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
|
|
2100
|
+
.hive-agent-row-task { color: var(--hive-fg-soft); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
|
|
2101
|
+
.hive-agent-row-meta { color: var(--hive-fg-faint); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
|
|
2102
|
+
.hive-agents-workers-title { padding-top: 4px; color: var(--hive-fg); font-size: 14px; font-weight: 700; line-height: 1.5; }
|
|
2103
|
+
.hive-agent-worker-row { padding: 8px 0; border-bottom: 1px solid var(--hive-line-2); }
|
|
2104
|
+
.hive-agent-worker-task { color: var(--hive-fg); font-size: 14px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
|
|
2105
|
+
.hive-agent-worker-meta { color: var(--hive-fg-soft); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
|
|
2106
|
+
.hive-agents-technical { border-top: 1px solid var(--hive-line-2); padding-top: 8px; }
|
|
2107
|
+
.hive-agents-technical-summary { color: var(--hive-fg-soft); font-size: 12px; line-height: 1.5; cursor: pointer; }
|
|
2108
|
+
.hive-agents-technical-json { max-height: 220px; margin-top: 8px; }
|
|
2093
2109
|
`;
|
|
2094
2110
|
|
|
2095
2111
|
const LANE_LABEL_KEYS = Object.freeze({
|
|
@@ -2148,6 +2164,14 @@ const messages = Object.freeze({
|
|
|
2148
2164
|
"status.actionFailed": "action failed",
|
|
2149
2165
|
"status.disconnected": "disconnected",
|
|
2150
2166
|
"agents.openAria": "Open agent",
|
|
2167
|
+
"agents.runningTooltip": "Running {running} / board identities {identities}",
|
|
2168
|
+
"agents.fallbackTooltip": "Board identities {identities} (supervisor disconnected or repository not registered)",
|
|
2169
|
+
"agents.modalEmpty": "No agents.",
|
|
2170
|
+
"agents.fileCount": "{count} files",
|
|
2171
|
+
"agents.workersTitle": "Active work units",
|
|
2172
|
+
"agents.workerStarted": "Started {time}",
|
|
2173
|
+
"agents.workerElapsed": "Running for {duration}",
|
|
2174
|
+
"agents.technical": "Technical details",
|
|
2151
2175
|
"agent.idle": "idle",
|
|
2152
2176
|
"agent.task": "task",
|
|
2153
2177
|
"agent.unknown": "unknown",
|
|
@@ -2389,6 +2413,14 @@ const messages = Object.freeze({
|
|
|
2389
2413
|
"status.actionFailed": "操作失败",
|
|
2390
2414
|
"status.disconnected": "连接断开",
|
|
2391
2415
|
"agents.openAria": "打开智能体",
|
|
2416
|
+
"agents.runningTooltip": "运行中 {running} / 公告板身份 {identities}",
|
|
2417
|
+
"agents.fallbackTooltip": "公告板身份 {identities}(监督器未连接或未注册该仓库)",
|
|
2418
|
+
"agents.modalEmpty": "暂无智能体。",
|
|
2419
|
+
"agents.fileCount": "{count} 个文件",
|
|
2420
|
+
"agents.workersTitle": "运行中的工作单元",
|
|
2421
|
+
"agents.workerStarted": "开始于 {time}",
|
|
2422
|
+
"agents.workerElapsed": "已运行 {duration}",
|
|
2423
|
+
"agents.technical": "技术详情",
|
|
2392
2424
|
"agent.idle": "空闲",
|
|
2393
2425
|
"agent.task": "任务",
|
|
2394
2426
|
"agent.unknown": "未知",
|
|
@@ -2962,7 +2994,7 @@ function normalizeSupervisorRoles(source) {
|
|
|
2962
2994
|
const ensure = (role) => {
|
|
2963
2995
|
const name = asString(role).trim();
|
|
2964
2996
|
if (!name) return null;
|
|
2965
|
-
if (!rows.has(name)) rows.set(name, { role: name, limit: null, inFlight: null, queued: null });
|
|
2997
|
+
if (!rows.has(name)) rows.set(name, { role: name, limit: null, live: null, inFlight: null, queued: null });
|
|
2966
2998
|
return rows.get(name);
|
|
2967
2999
|
};
|
|
2968
3000
|
const setLimit = (role, value) => {
|
|
@@ -2996,6 +3028,12 @@ function normalizeSupervisorRoles(source) {
|
|
|
2996
3028
|
break;
|
|
2997
3029
|
}
|
|
2998
3030
|
}
|
|
3031
|
+
for (const field of ["live", "liveCount", "live_count", "workers", "workerCount"]) {
|
|
3032
|
+
if (supervisorNumber(raw[field]) !== null) {
|
|
3033
|
+
row.live = supervisorNumber(raw[field]);
|
|
3034
|
+
break;
|
|
3035
|
+
}
|
|
3036
|
+
}
|
|
2999
3037
|
for (const field of ["queued", "queue", "queued_count", "pending", "pending_count", "waiting", "waiting_count", "backlog"]) {
|
|
3000
3038
|
if (supervisorNumber(raw[field]) !== null) {
|
|
3001
3039
|
row.queued = supervisorNumber(raw[field]);
|
|
@@ -3082,6 +3120,26 @@ function supervisorEntriesFrom(payload, depth = 0) {
|
|
|
3082
3120
|
}
|
|
3083
3121
|
|
|
3084
3122
|
/** Normalize the supervisor status endpoint into per-repository rows. */
|
|
3123
|
+
function normalizeSupervisorWorkers(source) {
|
|
3124
|
+
const raw = source && Array.isArray(source.workers) ? source.workers : [];
|
|
3125
|
+
const rows = [];
|
|
3126
|
+
for (const entry of raw) {
|
|
3127
|
+
if (!isRecord(entry)) continue;
|
|
3128
|
+
const cardId = asString(entry.cardId || entry.card || entry.task || entry.id);
|
|
3129
|
+
if (!cardId) continue;
|
|
3130
|
+
rows.push({
|
|
3131
|
+
cardId,
|
|
3132
|
+
role: asString(entry.role),
|
|
3133
|
+
agent: asString(entry.agent || entry.adapter),
|
|
3134
|
+
agentName: asString(entry.agentName || entry.agent_name || entry.name),
|
|
3135
|
+
sessionId: asString(entry.sessionId || entry.session_id),
|
|
3136
|
+
startedAt: asString(entry.startedAt || entry.started_at),
|
|
3137
|
+
lastOutputAt: asString(entry.lastOutputAt || entry.last_output_at),
|
|
3138
|
+
});
|
|
3139
|
+
}
|
|
3140
|
+
return rows;
|
|
3141
|
+
}
|
|
3142
|
+
|
|
3085
3143
|
function normalizeSupervisorStatus(payload) {
|
|
3086
3144
|
const rows = new Map();
|
|
3087
3145
|
for (const raw of supervisorEntriesFrom(payload)) {
|
|
@@ -3104,11 +3162,30 @@ function normalizeSupervisorStatus(payload) {
|
|
|
3104
3162
|
else if (/run|active|busy|working/.test(rawState)) state = "running";
|
|
3105
3163
|
else if (/idle|ready|free/.test(rawState)) state = "idle";
|
|
3106
3164
|
else if (running !== null && running > 0) state = "running";
|
|
3107
|
-
rows.set(repo, { repo, state, running, roles: normalizeSupervisorRoles(source) });
|
|
3165
|
+
rows.set(repo, { repo, state, running, roles: normalizeSupervisorRoles(source), workers: normalizeSupervisorWorkers(source) });
|
|
3108
3166
|
}
|
|
3109
3167
|
return [...rows.values()].sort((left, right) => left.repo.localeCompare(right.repo));
|
|
3110
3168
|
}
|
|
3111
3169
|
|
|
3170
|
+
function supervisorWorkerCount(row) {
|
|
3171
|
+
if (!row) return null;
|
|
3172
|
+
if (Array.isArray(row.workers) && row.workers.length > 0) return row.workers.length;
|
|
3173
|
+
const direct = supervisorNumber(row.running);
|
|
3174
|
+
if (direct !== null) return direct;
|
|
3175
|
+
let total = 0;
|
|
3176
|
+
let found = false;
|
|
3177
|
+
for (const role of Array.isArray(row.roles) ? row.roles : []) {
|
|
3178
|
+
if (!isRecord(role)) continue;
|
|
3179
|
+
const live = supervisorNumber(role.live);
|
|
3180
|
+
const inFlight = live !== null ? live : supervisorNumber(role.inFlight);
|
|
3181
|
+
if (inFlight !== null) {
|
|
3182
|
+
total += inFlight;
|
|
3183
|
+
found = true;
|
|
3184
|
+
}
|
|
3185
|
+
}
|
|
3186
|
+
return found ? total : null;
|
|
3187
|
+
}
|
|
3188
|
+
|
|
3112
3189
|
function element(doc, tag, className, text) {
|
|
3113
3190
|
const node = doc.createElement(tag);
|
|
3114
3191
|
if (className) node.className = className;
|
|
@@ -3636,7 +3713,7 @@ function mount(root, options = {}) {
|
|
|
3636
3713
|
const agentsCount = element(doc, "button", "hive-stat hive-agent-count");
|
|
3637
3714
|
setAttr(agentsCount, "type", "button");
|
|
3638
3715
|
agentsCount.addEventListener("click", () => {
|
|
3639
|
-
|
|
3716
|
+
openAgentsDialog();
|
|
3640
3717
|
});
|
|
3641
3718
|
bar.appendChild(agentsCount);
|
|
3642
3719
|
|
|
@@ -5228,6 +5305,101 @@ function mount(root, options = {}) {
|
|
|
5228
5305
|
return body;
|
|
5229
5306
|
}
|
|
5230
5307
|
|
|
5308
|
+
function taskTitleForId(id) {
|
|
5309
|
+
const wanted = asString(id);
|
|
5310
|
+
if (!wanted || !lastModel) return "";
|
|
5311
|
+
for (const lane of LANE_ORDER) {
|
|
5312
|
+
for (const card of lastModel.lanes[lane] || []) {
|
|
5313
|
+
if (asString(card.id) === wanted) return card.title || wanted;
|
|
5314
|
+
}
|
|
5315
|
+
}
|
|
5316
|
+
return wanted;
|
|
5317
|
+
}
|
|
5318
|
+
|
|
5319
|
+
function openAgentsDialog() {
|
|
5320
|
+
closeHelp(false);
|
|
5321
|
+
closePlanDialog(false);
|
|
5322
|
+
closeAddDialog(false);
|
|
5323
|
+
closeDrawer(false);
|
|
5324
|
+
closeLimitsDialog(false);
|
|
5325
|
+
|
|
5326
|
+
const dialog = element(doc, "dialog", "hive-dialog hive-agents-dialog");
|
|
5327
|
+
setAttr(dialog, "role", "dialog");
|
|
5328
|
+
setAttr(dialog, "aria-modal", "true");
|
|
5329
|
+
setAttr(dialog, "aria-label", translate("pane.agents"));
|
|
5330
|
+
bindDialogDismiss(dialog, () => {
|
|
5331
|
+
closeModalDialog(dialog);
|
|
5332
|
+
if (!destroyed) focusNode(agentsCount);
|
|
5333
|
+
});
|
|
5334
|
+
|
|
5335
|
+
const head = element(doc, "div", "hive-dialog-head");
|
|
5336
|
+
const titleBox = element(doc, "div", "hive-dialog-head-title");
|
|
5337
|
+
titleBox.appendChild(element(doc, "h2", "hive-dialog-title", translate("pane.agents")));
|
|
5338
|
+
head.appendChild(titleBox);
|
|
5339
|
+
const closeButton = dialogCloseButton(() => {
|
|
5340
|
+
closeModalDialog(dialog);
|
|
5341
|
+
if (!destroyed) focusNode(agentsCount);
|
|
5342
|
+
});
|
|
5343
|
+
head.appendChild(closeButton);
|
|
5344
|
+
dialog.appendChild(head);
|
|
5345
|
+
|
|
5346
|
+
const body = element(doc, "div", "hive-dialog-body hive-agents-body");
|
|
5347
|
+
const agents = lastModel && Array.isArray(lastModel.agents) ? lastModel.agents : [];
|
|
5348
|
+
if (agents.length === 0) {
|
|
5349
|
+
body.appendChild(element(doc, "div", "hive-agents-empty-note", translate("agents.modalEmpty")));
|
|
5350
|
+
}
|
|
5351
|
+
for (const agent of agents) {
|
|
5352
|
+
const row = element(doc, "div", "hive-agent-row");
|
|
5353
|
+
const dot = element(doc, "span", "hive-dot is-" + safeClassToken(agent.state));
|
|
5354
|
+
setAttr(dot, "title", agent.state || translate("agent.idle"));
|
|
5355
|
+
row.appendChild(dot);
|
|
5356
|
+
const content = element(doc, "div", "hive-agent-row-main");
|
|
5357
|
+
content.appendChild(element(doc, "div", "hive-agent-row-name", agent.agent || translate("agent.unknown")));
|
|
5358
|
+
const task = taskTitleForId(agent.task);
|
|
5359
|
+
content.appendChild(
|
|
5360
|
+
element(doc, "div", "hive-agent-row-task", task || translate("agent.idle")),
|
|
5361
|
+
);
|
|
5362
|
+
const meta = [translate("agents.fileCount").replace("{count}", String((agent.files || []).length))];
|
|
5363
|
+
const activity = elapsedLabel(agent.updatedAt);
|
|
5364
|
+
if (activity) meta.push(activity);
|
|
5365
|
+
const metaNode = element(doc, "div", "hive-agent-row-meta", meta.join(" · "));
|
|
5366
|
+
if (agent.updatedAt) setAttr(metaNode, "title", agent.updatedAt);
|
|
5367
|
+
content.appendChild(metaNode);
|
|
5368
|
+
row.appendChild(content);
|
|
5369
|
+
body.appendChild(row);
|
|
5370
|
+
}
|
|
5371
|
+
|
|
5372
|
+
const supervisor = currentSupervisorRow();
|
|
5373
|
+
const workers = supervisor && Array.isArray(supervisor.workers) ? supervisor.workers : [];
|
|
5374
|
+
if (workers.length > 0) {
|
|
5375
|
+
body.appendChild(element(doc, "div", "hive-agents-workers-title", translate("agents.workersTitle")));
|
|
5376
|
+
for (const worker of workers) {
|
|
5377
|
+
const row = element(doc, "div", "hive-agent-worker-row");
|
|
5378
|
+
row.appendChild(
|
|
5379
|
+
element(doc, "div", "hive-agent-worker-task", taskTitleForId(worker.cardId) || worker.cardId),
|
|
5380
|
+
);
|
|
5381
|
+
const meta = [];
|
|
5382
|
+
if (worker.role) meta.push(worker.role);
|
|
5383
|
+
if (worker.startedAt) meta.push(translate("agents.workerStarted").replace("{time}", formatRunStamp(worker.startedAt)));
|
|
5384
|
+
const elapsed = elapsedLabel(worker.startedAt);
|
|
5385
|
+
if (elapsed) meta.push(translate("agents.workerElapsed").replace("{duration}", elapsed));
|
|
5386
|
+
row.appendChild(element(doc, "div", "hive-agent-worker-meta", meta.join(" · ") || worker.agentName || worker.agent || ""));
|
|
5387
|
+
body.appendChild(row);
|
|
5388
|
+
}
|
|
5389
|
+
}
|
|
5390
|
+
|
|
5391
|
+
const technical = element(doc, "details", "hive-agents-technical");
|
|
5392
|
+
technical.appendChild(element(doc, "summary", "hive-agents-technical-summary", translate("agents.technical")));
|
|
5393
|
+
technical.appendChild(
|
|
5394
|
+
element(doc, "pre", "hive-json hive-agents-technical-json", JSON.stringify({ agents, workers }, null, 2)),
|
|
5395
|
+
);
|
|
5396
|
+
body.appendChild(technical);
|
|
5397
|
+
dialog.appendChild(body);
|
|
5398
|
+
|
|
5399
|
+
showModalDialog(dialog);
|
|
5400
|
+
focusNode(closeButton);
|
|
5401
|
+
}
|
|
5402
|
+
|
|
5231
5403
|
function openAgentDrawer(agent) {
|
|
5232
5404
|
const raw = findRawAgent(agent) || { ...agent };
|
|
5233
5405
|
const title = agent.agent || translate("agent.unknown");
|
|
@@ -5832,6 +6004,7 @@ function mount(root, options = {}) {
|
|
|
5832
6004
|
function setSupervisorData(rows) {
|
|
5833
6005
|
supervisorData = Array.isArray(rows) ? rows : [];
|
|
5834
6006
|
renderSupervisor();
|
|
6007
|
+
if (lastModel) renderAgents(lastModel);
|
|
5835
6008
|
}
|
|
5836
6009
|
|
|
5837
6010
|
async function refreshSupervisor(force = false) {
|
|
@@ -5993,16 +6166,22 @@ function mount(root, options = {}) {
|
|
|
5993
6166
|
agentsCount.disabled = true;
|
|
5994
6167
|
return;
|
|
5995
6168
|
}
|
|
5996
|
-
const
|
|
6169
|
+
const identities = model.agents.length;
|
|
6170
|
+
const row = currentSupervisorRow();
|
|
6171
|
+
const workers = supervisorWorkerCount(row);
|
|
6172
|
+
const running = workers !== null ? workers : identities;
|
|
5997
6173
|
agentsCount.className = "hive-stat hive-agent-count";
|
|
5998
|
-
agentsCount.textContent = translate("pane.agents") + " " + String(
|
|
5999
|
-
const first =
|
|
6174
|
+
agentsCount.textContent = translate("pane.agents") + " " + String(running);
|
|
6175
|
+
const first = identities > 0 ? model.agents[0] : null;
|
|
6000
6176
|
agentsCount._agent = first;
|
|
6001
|
-
agentsCount.disabled =
|
|
6002
|
-
const message =
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
6177
|
+
agentsCount.disabled = false;
|
|
6178
|
+
const message =
|
|
6179
|
+
workers !== null
|
|
6180
|
+
? translate("agents.runningTooltip")
|
|
6181
|
+
.replace("{running}", String(running))
|
|
6182
|
+
.replace("{identities}", String(identities))
|
|
6183
|
+
: translate("agents.fallbackTooltip").replace("{identities}", String(identities));
|
|
6184
|
+
const label = model.boardError ? message + " · " + model.boardError : message;
|
|
6006
6185
|
setAttr(agentsCount, "title", label);
|
|
6007
6186
|
setAttr(agentsCount, "aria-label", label);
|
|
6008
6187
|
}
|
|
@@ -6474,7 +6653,7 @@ function mount(root, options = {}) {
|
|
|
6474
6653
|
|
|
6475
6654
|
return { mount: mount, renderModel: renderModel, messages: messages }
|
|
6476
6655
|
})()
|
|
6477
|
-
var HIVE_PANEL_CSS = "/*\n * hive-panel-ui\n * Dark-first, host-themed through four variables:\n * --hive-bg, --hive-fg, --hive-line, --hive-accent\n * Defaults live on a zero-specificity :root rule and every rule keeps a fallback,\n * so a host can override the variables on :root, body, a wrapper, or .hive.\n */\n\n.hive,\n.hive *,\n.hive *::before,\n.hive *::after {\n box-sizing: border-box;\n}\n\n.hive {\n /* Derived helpers; the four required variables use inline fallbacks. */\n --hive-fg-soft: color-mix(in srgb, var(--hive-fg) 62%, transparent);\n --hive-fg-faint: color-mix(in srgb, var(--hive-fg) 40%, transparent);\n --hive-surface: color-mix(in srgb, var(--hive-fg) 4%, transparent);\n --hive-surface-strong: color-mix(in srgb, var(--hive-fg) 8%, transparent);\n --hive-surface-hover: color-mix(in srgb, var(--hive-fg) 11%, transparent);\n --hive-accent-soft: color-mix(in srgb, var(--hive-accent) 17%, transparent);\n --hive-mono: ui-monospace, \"SFMono-Regular\", \"JetBrains Mono\", Menlo, Consolas, monospace;\n\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n min-height: 480px;\n overflow: hidden;\n border: 1px solid var(--hive-line);\n border-radius: var(--hive-radius-lg);\n background: var(--hive-bg);\n color: var(--hive-fg);\n font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;\n color-scheme: light dark;\n}\n\n.hive ::selection {\n background: color-mix(in srgb, var(--hive-accent) 35%, transparent);\n}\n\n/* ------------------------------------------------------------------ top bar */\n\n.hive-bar {\n display: flex;\n flex: 0 0 auto;\n flex-wrap: wrap;\n align-items: center;\n gap: 8px 12px;\n padding: 9px 14px;\n border-bottom: 1px solid var(--hive-line);\n background: color-mix(in srgb, var(--hive-fg) 2%, transparent);\n}\n\n.hive-ident {\n display: flex;\n align-items: baseline;\n gap: 8px;\n min-width: 0;\n}\n\n.hive-brand {\n color: var(--hive-accent);\n font-size: 10px;\n font-weight: 750;\n letter-spacing: 0.18em;\n text-transform: uppercase;\n}\n\n.hive-repo {\n max-width: min(34vw, 360px);\n overflow: hidden;\n color: var(--hive-fg-soft);\n font-family: var(--hive-mono);\n font-size: 11.5px;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.hive-time {\n color: var(--hive-fg-soft);\n font-family: var(--hive-mono);\n font-size: 11px;\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n}\n\n.hive-badge {\n padding: 2px 8px;\n border: 1px solid var(--hive-line);\n border-radius: 999px;\n font-size: 10px;\n font-weight: 650;\n letter-spacing: 0.09em;\n line-height: 1.5;\n text-transform: uppercase;\n white-space: nowrap;\n}\n\n.hive-badge.is-free {\n border-color: color-mix(in srgb, var(--hive-accent) 45%, transparent);\n background: var(--hive-accent-soft);\n color: var(--hive-accent);\n}\n\n.hive-badge.is-freeze {\n border-color: color-mix(in srgb, var(--hive-warn) 45%, transparent);\n background: color-mix(in srgb, var(--hive-warn) 14%, transparent);\n color: var(--hive-warn);\n}\n\n.hive-badge.is-custom {\n color: var(--hive-fg-soft);\n}\n\n.hive-stats {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 5px;\n min-width: 0;\n}\n\n.hive-stat {\n padding: 1px 7px;\n border: 1px solid transparent;\n border-radius: var(--hive-radius-sm);\n background: var(--hive-surface);\n color: var(--hive-fg-soft);\n font-size: 10.5px;\n font-variant-numeric: tabular-nums;\n line-height: 1.7;\n white-space: nowrap;\n}\n\n.hive-stat strong {\n color: var(--hive-fg);\n font-weight: 650;\n}\n\n.hive-stat.is-total {\n color: var(--hive-fg);\n}\n\n.hive-stat.is-warn {\n color: var(--hive-warn);\n background: color-mix(in srgb, var(--hive-warn) 10%, transparent);\n}\n\n.hive-status {\n color: var(--hive-danger);\n font-size: 10px;\n font-weight: 700;\n letter-spacing: 0.09em;\n text-transform: uppercase;\n white-space: nowrap;\n}\n\n.hive-status:empty {\n display: none;\n}\n\n.hive-status::before {\n content: \"● \";\n font-size: 9px;\n}\n\n.hive-status.is-error {\n color: var(--hive-danger);\n}\n\n.hive-status.is-info {\n color: var(--hive-info);\n}\n\n.hive-actions {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n margin-left: auto;\n}\n\n/* ------------------------------------------------------------------ buttons */\n\n.hive-btn {\n appearance: none;\n padding: 4px 10px;\n border: 1px solid var(--hive-line);\n border-radius: var(--hive-radius-md);\n background: var(--hive-surface-strong);\n color: var(--hive-fg);\n font: inherit;\n font-size: 11.5px;\n font-weight: 550;\n line-height: 1.5;\n cursor: pointer;\n transition: border-color 120ms ease, background 120ms ease, color 120ms ease;\n}\n\n.hive-btn:hover {\n border-color: color-mix(in srgb, var(--hive-accent) 55%, var(--hive-line));\n background: var(--hive-accent-soft);\n}\n\n.hive-btn:active {\n transform: translateY(1px);\n}\n\n.hive-btn:focus-visible {\n outline: 2px solid var(--hive-accent);\n outline-offset: 1px;\n}\n\n.hive-btn-ghost {\n padding: 3px 8px;\n border-color: transparent;\n background: transparent;\n color: var(--hive-fg-soft);\n font-size: 11px;\n}\n\n/* ------------------------------------------------------------------- layout */\n\n.hive-main {\n display: grid;\n flex: 1 1 auto;\n grid-template-columns: minmax(185px, 230px) minmax(0, 1fr) minmax(215px, 300px);\n min-height: 0;\n}\n\n.hive-pane {\n display: flex;\n flex-direction: column;\n min-width: 0;\n min-height: 0;\n}\n\n.hive-agents {\n border-right: 1px solid var(--hive-line);\n background: color-mix(in srgb, var(--hive-fg) 1.5%, transparent);\n}\n\n.hive-events {\n border-left: 1px solid var(--hive-line);\n background: color-mix(in srgb, var(--hive-fg) 1.5%, transparent);\n}\n\n.hive-pane-head {\n display: flex;\n flex: 0 0 auto;\n align-items: center;\n gap: 7px;\n padding: 8px 12px;\n border-bottom: 1px solid var(--hive-line);\n color: var(--hive-fg-soft);\n font-size: 10px;\n font-weight: 650;\n letter-spacing: 0.12em;\n text-transform: uppercase;\n}\n\n.hive-hint {\n color: var(--hive-fg-faint);\n font-size: 9.5px;\n font-weight: 500;\n letter-spacing: 0.04em;\n text-transform: none;\n}\n\n.hive-count {\n min-width: 18px;\n margin-left: auto;\n padding: 0 6px;\n border-radius: 999px;\n background: var(--hive-surface);\n color: var(--hive-fg-soft);\n font-family: var(--hive-mono);\n font-size: 10px;\n font-variant-numeric: tabular-nums;\n line-height: 17px;\n text-align: center;\n}\n\n.hive-scroll {\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n gap: 7px;\n min-height: 0;\n padding: 10px;\n overflow-x: hidden;\n overflow-y: auto;\n scrollbar-color: var(--hive-line) transparent;\n scrollbar-width: thin;\n}\n\n.hive-empty {\n padding: 14px 10px;\n color: var(--hive-fg-faint);\n font-size: 11px;\n text-align: center;\n}\n\n/* ------------------------------------------------------------------- agents */\n\n.hive-agent {\n padding: 8px 10px;\n border: 1px solid var(--hive-line);\n border-radius: var(--hive-radius-md);\n background: var(--hive-surface);\n}\n\n.hive-agent-head {\n display: flex;\n align-items: center;\n gap: 7px;\n font-weight: 600;\n}\n\n.hive-agent-name {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.hive-dot {\n width: 7px;\n height: 7px;\n flex: 0 0 auto;\n border-radius: 50%;\n background: var(--hive-fg-faint);\n box-shadow: none;\n}\n\n.hive-dot.is-working {\n background: var(--hive-accent);\n box-shadow: none;\n}\n\n.hive-dot.is-idle {\n background: var(--hive-fg-faint);\n}\n\n.hive-dot.is-failed {\n background: var(--hive-danger);\n}\n\n.hive-dot.is-done {\n background: var(--hive-ok);\n}\n\n.hive-meta {\n margin-top: 3px;\n overflow: hidden;\n color: var(--hive-fg-soft);\n font-size: 10.5px;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.hive-agent-files {\n color: var(--hive-fg-faint);\n font-family: var(--hive-mono);\n}\n\n/* -------------------------------------------------------------------- lanes */\n\n.hive-board { background: var(--hive-bg); }\n\n.hive-lanes {\n display: flex;\n flex: 1 1 auto;\n align-items: stretch;\n gap: 9px;\n min-height: 0;\n padding: 10px;\n overflow-x: auto;\n overflow-y: hidden;\n scrollbar-color: var(--hive-line) transparent;\n scrollbar-width: thin;\n}\n\n.hive-lane {\n display: flex;\n flex: 0 0 232px;\n flex-direction: column;\n min-height: 0;\n overflow: hidden;\n border: 1px solid var(--hive-line);\n border-radius: var(--hive-radius-md);\n background: color-mix(in srgb, var(--hive-fg) 2%, transparent);\n}\n\n.hive-lane-head {\n display: flex;\n flex: 0 0 auto;\n align-items: center;\n gap: 7px;\n padding: 8px 10px;\n border-bottom: 1px solid var(--hive-line);\n color: var(--hive-fg-soft);\n font-size: 10px;\n font-weight: 700;\n letter-spacing: 0.1em;\n text-transform: uppercase;\n}\n\n.hive-lane-head::before {\n width: 3px;\n height: 10px;\n border-radius: var(--hive-radius-sm);\n background: var(--hive-fg-faint);\n content: \"\";\n}\n\n.hive-lane-name {\n color: var(--hive-fg);\n}\n\n.hive-lane-pending .hive-lane-head::before {\n background: var(--hive-accent);\n}\n\n.hive-lane-claimed .hive-lane-head::before {\n background: var(--hive-info);\n}\n\n.hive-lane-done .hive-lane-head::before {\n background: var(--hive-ok);\n}\n\n.hive-lane-failed .hive-lane-head::before {\n background: var(--hive-danger);\n}\n\n.hive-lane-cards {\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n gap: 7px;\n min-height: 0;\n padding: 7px;\n overflow-x: hidden;\n overflow-y: auto;\n scrollbar-color: var(--hive-line) transparent;\n scrollbar-width: thin;\n}\n\n.hive-card {\n padding: 8px 9px;\n border: 1px solid var(--hive-line);\n border-radius: var(--hive-radius-md);\n background: var(--hive-surface);\n cursor: pointer;\n transition: border-color 120ms ease, background 120ms ease;\n}\n\n.hive-card:hover {\n border-color: color-mix(in srgb, var(--hive-accent) 55%, var(--hive-line));\n background: var(--hive-surface-hover);\n}\n\n.hive-card:focus-visible {\n outline: 2px solid var(--hive-accent);\n outline-offset: 1px;\n}\n\n.hive-card-title {\n overflow-wrap: anywhere;\n font-size: 12.5px;\n font-weight: 600;\n line-height: 1.35;\n}\n\n.hive-card-meta {\n margin-top: 4px;\n color: var(--hive-fg-soft);\n font-size: 10.5px;\n}\n\n.hive-scopes {\n display: flex;\n flex-wrap: wrap;\n gap: 3px;\n margin-top: 6px;\n}\n\n.hive-scope {\n max-width: 100%;\n overflow: hidden;\n padding: 1px 5px;\n border: 1px solid var(--hive-line);\n border-radius: var(--hive-radius-sm);\n background: var(--hive-surface-strong);\n color: var(--hive-fg-soft);\n font-family: var(--hive-mono);\n font-size: 9.5px;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.hive-reason {\n margin-top: 6px;\n padding: 3px 6px;\n overflow-wrap: anywhere;\n border-left: 1px solid var(--hive-danger);\n border-radius: 0 var(--hive-radius-sm) var(--hive-radius-sm) 0;\n background: color-mix(in srgb, var(--hive-danger) 10%, transparent);\n color: color-mix(in srgb, var(--hive-danger) 82%, var(--hive-fg));\n font-size: 10.5px;\n}\n\n.hive-card-foot {\n display: flex;\n justify-content: space-between;\n gap: 6px;\n margin-top: 7px;\n color: var(--hive-fg-faint);\n font-family: var(--hive-mono);\n font-size: 9.5px;\n}\n\n.hive-card-id,\n.hive-card-state {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.hive-card-state {\n text-transform: uppercase;\n}\n\n/* ------------------------------------------------------------------- events */\n\n.hive-event {\n display: grid;\n grid-template-columns: auto minmax(0, 1fr);\n gap: 2px 7px;\n padding: 6px 7px;\n border: 1px solid transparent;\n border-radius: var(--hive-radius-sm);\n background: var(--hive-surface);\n font-size: 10.5px;\n}\n\n.hive-event-time {\n color: var(--hive-fg-faint);\n font-family: var(--hive-mono);\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n}\n\n.hive-event-kind {\n justify-self: start;\n overflow: hidden;\n color: var(--hive-accent);\n font-weight: 600;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.hive-event-text {\n grid-column: 1 / -1;\n overflow-wrap: anywhere;\n color: var(--hive-fg-soft);\n font-family: var(--hive-mono);\n font-size: 10px;\n}\n\n/* ------------------------------------------------------------------- drawer */\n\n.hive-drawer {\n position: fixed;\n z-index: 2147483000;\n top: 0;\n right: 0;\n bottom: 0;\n display: flex;\n flex-direction: column;\n width: min(440px, 92vw);\n border-left: 1px solid var(--hive-line);\n background: color-mix(in srgb, var(--hive-bg) 97%, var(--hive-fg) 3%);\n color: var(--hive-fg);\n box-shadow: none;\n font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;\n color-scheme: light dark;\n animation: hive-drawer-in 150ms ease-out;\n}\n\n.hive-drawer-head {\n display: flex;\n align-items: flex-start;\n gap: 10px;\n padding: 14px;\n border-bottom: 1px solid var(--hive-line);\n}\n\n.hive-drawer-titlebox {\n min-width: 0;\n}\n\n.hive-drawer-eyebrow {\n overflow: hidden;\n color: var(--hive-fg-faint);\n font-family: var(--hive-mono);\n font-size: 9.5px;\n letter-spacing: 0.05em;\n text-overflow: ellipsis;\n text-transform: uppercase;\n white-space: nowrap;\n}\n\n.hive-drawer-title {\n margin: 3px 0 0;\n overflow-wrap: anywhere;\n color: var(--hive-fg);\n font-size: 15px;\n font-weight: 650;\n line-height: 1.35;\n}\n\n.hive-drawer-head .hive-btn-ghost {\n flex: 0 0 auto;\n margin-left: auto;\n}\n\n.hive-drawer-body {\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n gap: 10px;\n min-height: 0;\n padding: 14px;\n overflow-y: auto;\n scrollbar-color: var(--hive-line) transparent;\n scrollbar-width: thin;\n}\n\n.hive-actions-row {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n}\n\n.hive-note {\n color: var(--hive-fg-faint);\n font-size: 11px;\n}\n\n.hive-section-label {\n margin-top: 2px;\n color: var(--hive-fg-faint);\n font-size: 9.5px;\n font-weight: 650;\n letter-spacing: 0.1em;\n text-transform: uppercase;\n}\n\n.hive-json {\n max-height: 55vh;\n margin: 0;\n padding: 10px;\n overflow: auto;\n border: 1px solid var(--hive-line);\n border-radius: var(--hive-radius-md);\n background: color-mix(in srgb, var(--hive-fg) 3%, transparent);\n color: var(--hive-fg-soft);\n font-family: var(--hive-mono);\n font-size: 10.5px;\n line-height: 1.55;\n overflow-wrap: anywhere;\n scrollbar-color: var(--hive-line) transparent;\n scrollbar-width: thin;\n white-space: pre-wrap;\n}\n\n@keyframes hive-drawer-in {\n from {\n opacity: 0;\n transform: translateX(18px);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .hive-card,\n .hive-btn {\n transition: none;\n }\n\n .hive-drawer {\n animation: none;\n }\n}\n\n/* ------------------------------------------------------------------ compact */\n\n@media (max-width: 920px) {\n .hive {\n min-height: 100dvh;\n height: 100dvh;\n border-radius: 0;\n }\n\n .hive-main {\n grid-template-columns: minmax(0, 1fr);\n grid-template-rows: minmax(110px, 17vh) minmax(280px, 1fr) minmax(120px, 20vh);\n }\n\n .hive-agents {\n border-right: 0;\n border-bottom: 1px solid var(--hive-line);\n }\n\n .hive-events {\n border-top: 1px solid var(--hive-line);\n border-left: 0;\n }\n\n .hive-agent-list {\n flex-direction: row;\n overflow-x: auto;\n overflow-y: hidden;\n }\n\n .hive-agent {\n flex: 0 0 190px;\n }\n\n .hive-drawer {\n width: 100vw;\n }\n}\n/* DSH design-token bridge. Neutral grayscale fallbacks keep standalone pages readable. */\n.hive, .hive-portal, .hive-dialog {\n --hive-bg: var(--dsw-alias-bg-base, #fff);\n --hive-bg-layer-1: var(--dsw-alias-bg-layer-1, #fff);\n --hive-bg-layer-2: var(--dsw-alias-bg-layer-2, #fff);\n --hive-bg-layer-3: var(--dsw-alias-bg-layer-3, #f5f5f5);\n --hive-line: var(--dsw-alias-border-l1, #d9d9d9);\n --hive-line-2: var(--dsw-alias-border-l2, #e8e8e8);\n --hive-fg: var(--dsw-alias-label-primary, #000);\n --hive-fg-soft: var(--dsw-alias-label-secondary, #4d4d4d);\n --hive-fg-faint: var(--dsw-alias-label-tertiary, #808080);\n --hive-accent: var(--dsw-alias-brand-primary, #000);\n --hive-hover: var(--dsw-alias-interactive-bg-hover, #f2f2f2);\n --hive-selected: var(--dsw-alias-border-selected, #000);\n --hive-danger: var(--dsw-alias-state-error-primary, #000);\n --hive-ok: var(--dsw-alias-state-success-primary, #000);\n --hive-warn: var(--dsw-alias-state-warn-primary, #000);\n --hive-info: var(--dsw-alias-brand-primary, #000);\n --hive-radius-sm: var(--dsw-radius-sm, 4px);\n --hive-radius-md: var(--dsw-radius-md, 8px);\n --hive-radius-lg: var(--dsw-radius-lg, 12px);\n --hive-elevation: var(--dsw-elevation-panel, 0 12px 32px rgba(0, 0, 0, 0.18));\n --hive-surface: var(--hive-bg-layer-1);\n --hive-surface-strong: var(--hive-bg-layer-2);\n --hive-surface-hover: var(--hive-hover);\n --hive-accent-soft: color-mix(in srgb, var(--hive-accent) 14%, transparent);\n --hive-label-on-brand: var(--hive-bg);\n --hive-mono: ui-monospace, \"SFMono-Regular\", \"JetBrains Mono\", Menlo, Consolas, monospace;\n}\n\n/* Tokenized component treatment. */\n.hive { background: var(--hive-bg); color: var(--hive-fg); border-color: var(--hive-line); border-radius: var(--hive-radius-lg); }\n.hive-bar { background: var(--hive-bg-layer-1); border-bottom-color: var(--hive-line); gap: 8px; }\n.hive-main,\n.hive-board { background: var(--hive-bg); }\n.hive-agents,\n.hive-events { background: var(--hive-bg-layer-1); border-color: var(--hive-line); }\n.hive-lane { background: var(--hive-bg-layer-1); border-color: var(--hive-line); border-radius: var(--hive-radius-md); }\n.hive-card { background: var(--hive-bg-layer-1); border: 1px solid var(--hive-line); border-radius: var(--hive-radius-md); box-shadow: none; }\n.hive-card:hover { background: var(--hive-hover); border-color: var(--hive-line); }\n.hive-btn { background: transparent; border: 1px solid var(--hive-line); color: var(--hive-fg); border-radius: var(--hive-radius-md); }\n.hive-btn:hover { background: var(--hive-hover); border-color: var(--hive-line); color: var(--hive-fg); }\n.hive-btn-ghost { background: transparent; border-color: transparent; color: var(--hive-fg-soft); }\n.hive-btn-ghost:hover { background: var(--hive-hover); border-color: transparent; color: var(--hive-fg); }\n.hive-btn-danger { background: transparent; border-color: var(--hive-danger); color: var(--hive-danger); }\n.hive-btn-danger:hover:not(:disabled) { background: var(--hive-hover); border-color: var(--hive-danger); color: var(--hive-danger); }\n.hive-settings-primary,\n.hive-add-submit { background: var(--hive-accent); border-color: var(--hive-accent); color: var(--hive-label-on-brand); }\n.hive-settings-primary:hover:not(:disabled),\n.hive-add-submit:hover:not(:disabled) { background: var(--hive-accent); border-color: var(--hive-accent); color: var(--hive-label-on-brand); }\n.hive-settings-secondary { background: transparent; border-color: var(--hive-line); color: var(--hive-fg); }\n.hive-settings-secondary:hover { background: var(--hive-hover); border-color: var(--hive-line); color: var(--hive-fg); }\n.hive-input,\n.hive-textarea,\n.hive-limits-input { background: var(--hive-bg-layer-1); border: 1px solid var(--hive-line); color: var(--hive-fg); border-radius: var(--hive-radius-sm); }\n.hive-input:focus,\n.hive-textarea:focus,\n.hive-limits-input:focus { outline: 1px solid var(--hive-selected); outline-offset: 0; }\n.hive-dialog,\n.hive-add-dialog,\n.hive-settings-dialog,\n.hive-card-dialog { background: var(--hive-bg-layer-2); border: 1px solid var(--hive-line); border-radius: var(--hive-radius-lg); box-shadow: var(--hive-elevation); color: var(--hive-fg); }\n.hive-toast { background: var(--hive-bg-layer-2); border: 1px solid var(--hive-line); border-radius: var(--hive-radius-lg); box-shadow: none; color: var(--hive-fg); }\n.hive-drawer { background: var(--hive-bg-layer-2); border-left: 1px solid var(--hive-line); box-shadow: none; }\n.hive-json,\n.hive-plan-raw,\n.hive-plan-item,\n.hive-scope,\n.hive-init-card,\n.hive-limits-error,\n.hive-settings-note { background: var(--hive-bg-layer-1); border-color: var(--hive-line); border-radius: var(--hive-radius-sm); }\n.hive-limits-row { border-top-color: var(--hive-line-2); }\n.hive-limits-row:not(.is-head):hover { background: var(--hive-hover); }\n.hive-settings-tab[aria-selected=\"true\"] { border-bottom-color: var(--hive-selected); }\n.hive-lane-head,\n.hive-dialog-head,\n.hive-dialog-foot,\n.hive-drawer-head,\n.hive-settings-tabs { border-color: var(--hive-line-2); }\n.hive-freeze-banner { background: transparent; border-bottom-color: var(--hive-warn); color: var(--hive-warn); }\n.hive-freeze-banner .hive-btn { background: transparent; border-color: var(--hive-line); color: var(--hive-fg); }\n.hive-queen-hint { background: var(--hive-bg-layer-1); border-color: var(--hive-line); }\n.hive-supervisor-inline,\n.hive-stat,\n.hive-status,\n.hive-queen-badge {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n height: 22px;\n padding: 0 8px;\n border: 1px solid var(--hive-line);\n border-radius: 999px;\n background: transparent;\n color: var(--hive-fg-soft);\n font-size: 12px;\n font-weight: 400;\n line-height: 1;\n white-space: nowrap;\n}\n.hive-supervisor-inline { gap: 6px; }\n.hive-supervisor-inline-label { color: var(--hive-fg-soft); font-weight: 400; }\n.hive-supervisor-inline-state { display: inline-flex; align-items: center; gap: 6px; color: var(--hive-fg-soft); font-size: 12px; font-weight: 400; }\n.hive-supervisor-inline-state::before { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: var(--hive-fg-faint); content: \"\"; }\n.hive-supervisor-inline-state.is-running::before { background: var(--hive-accent); }\n.hive-supervisor-inline-state.is-backoff::before { background: var(--hive-warn); }\n.hive-supervisor-inline-state.is-paused::before { background: var(--hive-fg-faint); }\n.hive-supervisor-inline-resume { height: auto; min-height: 0; padding: 0; border: 0; background: transparent; color: var(--hive-fg-soft); font-size: 12px; line-height: 1; }\n.hive-supervisor-inline-resume:hover { background: transparent; color: var(--hive-fg); }\n.hive-stats { flex-wrap: wrap; gap: 8px; }\n.hive-stat.is-warn { color: var(--hive-fg-soft); background: transparent; }\n.hive-stat strong { color: var(--hive-fg-soft); font-weight: 400; }\n.hive-status { color: var(--hive-fg-soft); }\n.hive-status::before { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: var(--hive-danger); content: \"\"; font-size: 0; }\n.hive-status.is-info::before { background: var(--hive-accent); }\n.hive-queen-badge { color: var(--hive-fg-soft); }\n\n\n.hive-portal {\n position: fixed;\n inset: 0;\n z-index: 2147483600;\n pointer-events: none;\n}\n\n.hive-portal > .hive-overlay { pointer-events: auto; }\n\n/* Buttons: two explicit tiers. */\n.hive-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n height: 28px;\n padding: 0 12px;\n border: 1px solid var(--hive-line-2);\n border-radius: var(--hive-radius-md);\n background: transparent;\n color: var(--hive-fg);\n font-size: 14px;\n font-weight: 600;\n line-height: 1.5;\n}\n\n.hive-btn:hover {\n border-color: var(--hive-line-2);\n background: var(--hive-hover);\n color: var(--hive-fg);\n}\n\n.hive-btn-ghost {\n border-color: transparent;\n background: transparent;\n color: var(--hive-fg-soft);\n}\n\n.hive-btn-ghost:hover {\n border-color: transparent;\n background: var(--hive-hover);\n color: var(--hive-fg);\n}\n\n.hive-btn-danger {\n border-color: var(--hive-danger);\n background: transparent;\n color: var(--hive-danger);\n}\n\n.hive-btn-danger:hover:not(:disabled) {\n border-color: var(--hive-danger);\n background: var(--hive-hover);\n color: var(--hive-danger);\n}\n\n.hive-settings-primary,\n.hive-add-submit {\n border-color: var(--hive-accent);\n background: var(--hive-accent);\n color: var(--hive-label-on-brand);\n font-weight: 600;\n}\n\n.hive-settings-primary:hover:not(:disabled),\n.hive-add-submit:hover:not(:disabled) {\n border-color: var(--hive-accent);\n background: color-mix(in srgb, var(--hive-accent) 92%, #000);\n color: var(--hive-label-on-brand);\n}\n\n.hive-settings-primary:active:not(:disabled),\n.hive-add-submit:active:not(:disabled) {\n border-color: var(--hive-accent);\n background: color-mix(in srgb, var(--hive-accent) 84%, #000);\n color: var(--hive-label-on-brand);\n}\n\n.hive-settings-primary:focus-visible,\n.hive-add-submit:focus-visible {\n outline: 2px solid var(--hive-accent);\n outline-offset: 2px;\n}\n\n.hive-settings-secondary {\n border-color: var(--hive-line-2);\n background: transparent;\n color: var(--hive-fg);\n}\n\n.hive-settings-secondary:hover {\n border-color: var(--hive-line-2);\n background: var(--hive-hover);\n color: var(--hive-fg);\n}\n\n.hive-icon-button,\n.hive-dialog-close {\n height: 28px;\n padding: 0;\n border: 0;\n background: transparent;\n color: var(--hive-fg-soft);\n}\n\n.hive-icon-button:hover,\n.hive-dialog-close:hover {\n border: 0;\n background: var(--hive-hover);\n color: var(--hive-fg);\n}\n\n.hive-role-remove {\n height: 28px;\n min-height: 28px;\n padding: 0;\n border-color: transparent;\n background: transparent;\n color: var(--hive-danger);\n}\n\n/* Dialogs are portaled to the document body; keep them above the panel. */\n.hive-dialog,\n.hive-add-dialog,\n.hive-settings-dialog,\n.hive-card-dialog {\n border: 1px solid var(--hive-line);\n background: var(--hive-bg-layer-2);\n box-shadow: var(--dsw-elevation-panel, 0 12px 32px rgba(0, 0, 0, 0.18));\n}\n\n/* toolbar action rhythm */\n.hive-actions { gap: 8px; }\n.hive-actions > .hive-btn { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; }\n\n/* Dialog form containment: portal content must not create horizontal scroll. */\n.hive-portal,\n.hive-portal *,\n.hive-portal *::before,\n.hive-portal *::after { box-sizing: border-box; }\n\n.hive-portal .hive-dialog { max-width: 92vw; overflow-x: hidden; }\n.hive-portal .hive-dialog-head,\n.hive-portal .hive-dialog-body,\n.hive-portal .hive-dialog-foot { padding-left: 16px; padding-right: 16px; }\n.hive-portal .hive-dialog-body { width: auto; min-width: 0; max-width: 100%; }\n.hive-portal .hive-dialog-body > * { margin-left: 0; margin-right: 0; max-width: 100%; min-width: 0; }\n.hive-portal .hive-field,\n.hive-portal .hive-field-row,\n.hive-portal .hive-settings-section,\n.hive-portal .hive-settings-tabpanel,\n.hive-portal .hive-limits-table { width: 100%; max-width: 100%; min-width: 0; margin-left: 0; margin-right: 0; }\n.hive-portal .hive-field-row > .hive-field { width: auto; flex: 1 1 160px; }\n.hive-portal .hive-input,\n.hive-portal .hive-textarea,\n.hive-portal select { width: 100%; min-width: 0; max-width: 100%; }\n.hive-portal .hive-limits-row {\n width: 100%;\n max-width: 100%;\n min-width: 0;\n grid-template-columns: minmax(0, 1fr) 96px 48px 48px 28px;\n}\n.hive-portal .hive-limits-cell,\n.hive-portal .hive-limits-role,\n.hive-portal .hive-dialog-title,\n.hive-portal .hive-card-subline,\n.hive-portal .hive-settings-role-name { min-width: 0; overflow-wrap: anywhere; }\n.hive-portal .hive-dialog-foot { flex-wrap: wrap; }\n\n.hive-portal .hive-dialog-body { overflow-x: hidden; }\n.hive-portal .hive-settings-tabs { flex-wrap: wrap; }\n.hive-portal .hive-card-actions,\n.hive-portal .hive-settings-form-actions { max-width: 100%; }\n\n/* Native <dialog>: top layer, browser-managed backdrop and focus trap. */\n.hive-dialog,\n.hive-dialog *,\n.hive-dialog *::before,\n.hive-dialog *::after { box-sizing: border-box; }\n\ndialog.hive-dialog {\n position: fixed;\n inset: 0;\n margin: auto;\n padding: 0;\n width: min(560px, 100%);\n max-width: 92vw;\n max-height: 80vh;\n overflow: hidden;\n border: 1px solid var(--hive-line);\n border-radius: var(--hive-radius-lg);\n background: var(--hive-bg-layer-2);\n color: var(--hive-fg);\n box-shadow: var(--dsw-elevation-panel, 0 12px 32px rgba(0, 0, 0, 0.18));\n color-scheme: light dark;\n}\n\ndialog.hive-card-dialog { width: min(720px, 92vw); }\n\ndialog.hive-dialog::backdrop {\n background: var(--dsw-alias-bg-mask-1, rgba(0, 0, 0, 0.24));\n backdrop-filter: var(--dsw-mask-blur, none);\n}\n\ndialog.hive-dialog .hive-dialog-head,\ndialog.hive-dialog .hive-dialog-body,\ndialog.hive-dialog .hive-dialog-foot { padding-left: 16px; padding-right: 16px; }\ndialog.hive-dialog .hive-dialog-body { width: auto; min-width: 0; max-width: 100%; overflow-x: hidden; }\ndialog.hive-dialog .hive-dialog-body > * { margin-left: 0; margin-right: 0; max-width: 100%; min-width: 0; }\ndialog.hive-dialog .hive-field,\ndialog.hive-dialog .hive-field-row,\ndialog.hive-dialog .hive-settings-section,\ndialog.hive-dialog .hive-settings-tabpanel,\ndialog.hive-dialog .hive-limits-table { width: 100%; max-width: 100%; min-width: 0; margin-left: 0; margin-right: 0; }\ndialog.hive-dialog .hive-field-row > .hive-field { width: auto; flex: 1 1 160px; }\ndialog.hive-dialog .hive-input,\ndialog.hive-dialog .hive-textarea,\ndialog.hive-dialog select { width: 100%; min-width: 0; max-width: 100%; }\ndialog.hive-dialog .hive-limits-row {\n width: 100%;\n max-width: 100%;\n min-width: 0;\n grid-template-columns: minmax(0, 1fr) 96px 48px 48px 28px;\n}\ndialog.hive-dialog .hive-limits-cell,\ndialog.hive-dialog .hive-limits-role,\ndialog.hive-dialog .hive-dialog-title,\ndialog.hive-dialog .hive-card-subline,\ndialog.hive-dialog .hive-settings-role-name { min-width: 0; overflow-wrap: anywhere; }\ndialog.hive-dialog .hive-dialog-foot { flex-wrap: wrap; }\n\ndialog.hive-dialog {\n display: flex;\n flex-direction: column;\n max-height: 80vh;\n}\ndialog.hive-dialog .hive-dialog-head,\ndialog.hive-dialog .hive-dialog-foot { flex: 0 0 auto; }\ndialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow: auto; }\n.hive-card-run-output { max-height: 20lh; overflow: auto; }\n.hive-card-actions { flex-wrap: wrap; justify-content: flex-end; }\n\n/* Virtual lanes: fixed 26px cards, 2px gaps, 28px stride. */\n.hive-lane-cards {\n display: block;\n flex: 1 1 auto;\n min-height: 0;\n padding: 7px;\n overflow-x: hidden;\n overflow-y: auto;\n}\n.hive-lane-virtual { position: relative; width: 100%; min-width: 0; }\n.hive-lane-virtual .hive-card {\n position: absolute;\n left: 0;\n right: 0;\n display: flex;\n align-items: center;\n height: 26px;\n min-height: 26px;\n padding: 2px 8px;\n overflow: hidden;\n border-radius: var(--hive-radius-sm);\n}\n.hive-lane-virtual .hive-card-title {\n width: 100%;\n overflow: hidden;\n font-size: 12px;\n line-height: 16px;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.hive-agent-count { font: inherit; cursor: pointer; }\n.hive-agent-count:disabled { cursor: default; }\n\n\n/* The DSH design-token bridge is bundled in panel.css; this file is kept for package layout compatibility. */\n"
|
|
6656
|
+
var HIVE_PANEL_CSS = "/*\n * hive-panel-ui\n * Dark-first, host-themed through four variables:\n * --hive-bg, --hive-fg, --hive-line, --hive-accent\n * Defaults live on a zero-specificity :root rule and every rule keeps a fallback,\n * so a host can override the variables on :root, body, a wrapper, or .hive.\n */\n\n.hive,\n.hive *,\n.hive *::before,\n.hive *::after {\n box-sizing: border-box;\n}\n\n.hive {\n /* Derived helpers; the four required variables use inline fallbacks. */\n --hive-fg-soft: color-mix(in srgb, var(--hive-fg) 62%, transparent);\n --hive-fg-faint: color-mix(in srgb, var(--hive-fg) 40%, transparent);\n --hive-surface: color-mix(in srgb, var(--hive-fg) 4%, transparent);\n --hive-surface-strong: color-mix(in srgb, var(--hive-fg) 8%, transparent);\n --hive-surface-hover: color-mix(in srgb, var(--hive-fg) 11%, transparent);\n --hive-accent-soft: color-mix(in srgb, var(--hive-accent) 17%, transparent);\n --hive-mono: ui-monospace, \"SFMono-Regular\", \"JetBrains Mono\", Menlo, Consolas, monospace;\n\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n min-height: 480px;\n overflow: hidden;\n border: 1px solid var(--hive-line);\n border-radius: var(--hive-radius-lg);\n background: var(--hive-bg);\n color: var(--hive-fg);\n font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;\n color-scheme: light dark;\n}\n\n.hive ::selection {\n background: color-mix(in srgb, var(--hive-accent) 35%, transparent);\n}\n\n/* ------------------------------------------------------------------ top bar */\n\n.hive-bar {\n display: flex;\n flex: 0 0 auto;\n flex-wrap: wrap;\n align-items: center;\n gap: 8px 12px;\n padding: 9px 14px;\n border-bottom: 1px solid var(--hive-line);\n background: color-mix(in srgb, var(--hive-fg) 2%, transparent);\n}\n\n.hive-ident {\n display: flex;\n align-items: baseline;\n gap: 8px;\n min-width: 0;\n}\n\n.hive-brand {\n color: var(--hive-accent);\n font-size: 10px;\n font-weight: 750;\n letter-spacing: 0.18em;\n text-transform: uppercase;\n}\n\n.hive-repo {\n max-width: min(34vw, 360px);\n overflow: hidden;\n color: var(--hive-fg-soft);\n font-family: var(--hive-mono);\n font-size: 11.5px;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.hive-time {\n color: var(--hive-fg-soft);\n font-family: var(--hive-mono);\n font-size: 11px;\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n}\n\n.hive-badge {\n padding: 2px 8px;\n border: 1px solid var(--hive-line);\n border-radius: 999px;\n font-size: 10px;\n font-weight: 650;\n letter-spacing: 0.09em;\n line-height: 1.5;\n text-transform: uppercase;\n white-space: nowrap;\n}\n\n.hive-badge.is-free {\n border-color: color-mix(in srgb, var(--hive-accent) 45%, transparent);\n background: var(--hive-accent-soft);\n color: var(--hive-accent);\n}\n\n.hive-badge.is-freeze {\n border-color: color-mix(in srgb, var(--hive-warn) 45%, transparent);\n background: color-mix(in srgb, var(--hive-warn) 14%, transparent);\n color: var(--hive-warn);\n}\n\n.hive-badge.is-custom {\n color: var(--hive-fg-soft);\n}\n\n.hive-stats {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 5px;\n min-width: 0;\n}\n\n.hive-stat {\n padding: 1px 7px;\n border: 1px solid transparent;\n border-radius: var(--hive-radius-sm);\n background: var(--hive-surface);\n color: var(--hive-fg-soft);\n font-size: 10.5px;\n font-variant-numeric: tabular-nums;\n line-height: 1.7;\n white-space: nowrap;\n}\n\n.hive-stat strong {\n color: var(--hive-fg);\n font-weight: 650;\n}\n\n.hive-stat.is-total {\n color: var(--hive-fg);\n}\n\n.hive-stat.is-warn {\n color: var(--hive-warn);\n background: color-mix(in srgb, var(--hive-warn) 10%, transparent);\n}\n\n.hive-status {\n color: var(--hive-danger);\n font-size: 10px;\n font-weight: 700;\n letter-spacing: 0.09em;\n text-transform: uppercase;\n white-space: nowrap;\n}\n\n.hive-status:empty {\n display: none;\n}\n\n.hive-status::before {\n content: \"● \";\n font-size: 9px;\n}\n\n.hive-status.is-error {\n color: var(--hive-danger);\n}\n\n.hive-status.is-info {\n color: var(--hive-info);\n}\n\n.hive-actions {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n margin-left: auto;\n}\n\n/* ------------------------------------------------------------------ buttons */\n\n.hive-btn {\n appearance: none;\n padding: 4px 10px;\n border: 1px solid var(--hive-line);\n border-radius: var(--hive-radius-md);\n background: var(--hive-surface-strong);\n color: var(--hive-fg);\n font: inherit;\n font-size: 11.5px;\n font-weight: 550;\n line-height: 1.5;\n cursor: pointer;\n transition: border-color 120ms ease, background 120ms ease, color 120ms ease;\n}\n\n.hive-btn:hover {\n border-color: color-mix(in srgb, var(--hive-accent) 55%, var(--hive-line));\n background: var(--hive-accent-soft);\n}\n\n.hive-btn:active {\n transform: translateY(1px);\n}\n\n.hive-btn:focus-visible {\n outline: 2px solid var(--hive-accent);\n outline-offset: 1px;\n}\n\n.hive-btn-ghost {\n padding: 3px 8px;\n border-color: transparent;\n background: transparent;\n color: var(--hive-fg-soft);\n font-size: 11px;\n}\n\n/* ------------------------------------------------------------------- layout */\n\n.hive-main {\n display: grid;\n flex: 1 1 auto;\n grid-template-columns: minmax(185px, 230px) minmax(0, 1fr) minmax(215px, 300px);\n min-height: 0;\n}\n\n.hive-pane {\n display: flex;\n flex-direction: column;\n min-width: 0;\n min-height: 0;\n}\n\n.hive-agents {\n border-right: 1px solid var(--hive-line);\n background: color-mix(in srgb, var(--hive-fg) 1.5%, transparent);\n}\n\n.hive-events {\n border-left: 1px solid var(--hive-line);\n background: color-mix(in srgb, var(--hive-fg) 1.5%, transparent);\n}\n\n.hive-pane-head {\n display: flex;\n flex: 0 0 auto;\n align-items: center;\n gap: 7px;\n padding: 8px 12px;\n border-bottom: 1px solid var(--hive-line);\n color: var(--hive-fg-soft);\n font-size: 10px;\n font-weight: 650;\n letter-spacing: 0.12em;\n text-transform: uppercase;\n}\n\n.hive-hint {\n color: var(--hive-fg-faint);\n font-size: 9.5px;\n font-weight: 500;\n letter-spacing: 0.04em;\n text-transform: none;\n}\n\n.hive-count {\n min-width: 18px;\n margin-left: auto;\n padding: 0 6px;\n border-radius: 999px;\n background: var(--hive-surface);\n color: var(--hive-fg-soft);\n font-family: var(--hive-mono);\n font-size: 10px;\n font-variant-numeric: tabular-nums;\n line-height: 17px;\n text-align: center;\n}\n\n.hive-scroll {\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n gap: 7px;\n min-height: 0;\n padding: 10px;\n overflow-x: hidden;\n overflow-y: auto;\n scrollbar-color: var(--hive-line) transparent;\n scrollbar-width: thin;\n}\n\n.hive-empty {\n padding: 14px 10px;\n color: var(--hive-fg-faint);\n font-size: 11px;\n text-align: center;\n}\n\n/* ------------------------------------------------------------------- agents */\n\n.hive-agent {\n padding: 8px 10px;\n border: 1px solid var(--hive-line);\n border-radius: var(--hive-radius-md);\n background: var(--hive-surface);\n}\n\n.hive-agent-head {\n display: flex;\n align-items: center;\n gap: 7px;\n font-weight: 600;\n}\n\n.hive-agent-name {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.hive-dot {\n width: 7px;\n height: 7px;\n flex: 0 0 auto;\n border-radius: 50%;\n background: var(--hive-fg-faint);\n box-shadow: none;\n}\n\n.hive-dot.is-working {\n background: var(--hive-accent);\n box-shadow: none;\n}\n\n.hive-dot.is-idle {\n background: var(--hive-fg-faint);\n}\n\n.hive-dot.is-failed {\n background: var(--hive-danger);\n}\n\n.hive-dot.is-done {\n background: var(--hive-ok);\n}\n\n.hive-meta {\n margin-top: 3px;\n overflow: hidden;\n color: var(--hive-fg-soft);\n font-size: 10.5px;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.hive-agent-files {\n color: var(--hive-fg-faint);\n font-family: var(--hive-mono);\n}\n\n/* -------------------------------------------------------------------- lanes */\n\n.hive-board { background: var(--hive-bg); }\n\n.hive-lanes {\n display: flex;\n flex: 1 1 auto;\n align-items: stretch;\n gap: 9px;\n min-height: 0;\n padding: 10px;\n overflow-x: auto;\n overflow-y: hidden;\n scrollbar-color: var(--hive-line) transparent;\n scrollbar-width: thin;\n}\n\n.hive-lane {\n display: flex;\n flex: 0 0 232px;\n flex-direction: column;\n min-height: 0;\n overflow: hidden;\n border: 1px solid var(--hive-line);\n border-radius: var(--hive-radius-md);\n background: color-mix(in srgb, var(--hive-fg) 2%, transparent);\n}\n\n.hive-lane-head {\n display: flex;\n flex: 0 0 auto;\n align-items: center;\n gap: 7px;\n padding: 8px 10px;\n border-bottom: 1px solid var(--hive-line);\n color: var(--hive-fg-soft);\n font-size: 10px;\n font-weight: 700;\n letter-spacing: 0.1em;\n text-transform: uppercase;\n}\n\n.hive-lane-head::before {\n width: 3px;\n height: 10px;\n border-radius: var(--hive-radius-sm);\n background: var(--hive-fg-faint);\n content: \"\";\n}\n\n.hive-lane-name {\n color: var(--hive-fg);\n}\n\n.hive-lane-pending .hive-lane-head::before {\n background: var(--hive-accent);\n}\n\n.hive-lane-claimed .hive-lane-head::before {\n background: var(--hive-info);\n}\n\n.hive-lane-done .hive-lane-head::before {\n background: var(--hive-ok);\n}\n\n.hive-lane-failed .hive-lane-head::before {\n background: var(--hive-danger);\n}\n\n.hive-lane-cards {\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n gap: 7px;\n min-height: 0;\n padding: 7px;\n overflow-x: hidden;\n overflow-y: auto;\n scrollbar-color: var(--hive-line) transparent;\n scrollbar-width: thin;\n}\n\n.hive-card {\n padding: 8px 9px;\n border: 1px solid var(--hive-line);\n border-radius: var(--hive-radius-md);\n background: var(--hive-surface);\n cursor: pointer;\n transition: border-color 120ms ease, background 120ms ease;\n}\n\n.hive-card:hover {\n border-color: color-mix(in srgb, var(--hive-accent) 55%, var(--hive-line));\n background: var(--hive-surface-hover);\n}\n\n.hive-card:focus-visible {\n outline: 2px solid var(--hive-accent);\n outline-offset: 1px;\n}\n\n.hive-card-title {\n overflow-wrap: anywhere;\n font-size: 12.5px;\n font-weight: 600;\n line-height: 1.35;\n}\n\n.hive-card-meta {\n margin-top: 4px;\n color: var(--hive-fg-soft);\n font-size: 10.5px;\n}\n\n.hive-scopes {\n display: flex;\n flex-wrap: wrap;\n gap: 3px;\n margin-top: 6px;\n}\n\n.hive-scope {\n max-width: 100%;\n overflow: hidden;\n padding: 1px 5px;\n border: 1px solid var(--hive-line);\n border-radius: var(--hive-radius-sm);\n background: var(--hive-surface-strong);\n color: var(--hive-fg-soft);\n font-family: var(--hive-mono);\n font-size: 9.5px;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.hive-reason {\n margin-top: 6px;\n padding: 3px 6px;\n overflow-wrap: anywhere;\n border-left: 1px solid var(--hive-danger);\n border-radius: 0 var(--hive-radius-sm) var(--hive-radius-sm) 0;\n background: color-mix(in srgb, var(--hive-danger) 10%, transparent);\n color: color-mix(in srgb, var(--hive-danger) 82%, var(--hive-fg));\n font-size: 10.5px;\n}\n\n.hive-card-foot {\n display: flex;\n justify-content: space-between;\n gap: 6px;\n margin-top: 7px;\n color: var(--hive-fg-faint);\n font-family: var(--hive-mono);\n font-size: 9.5px;\n}\n\n.hive-card-id,\n.hive-card-state {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.hive-card-state {\n text-transform: uppercase;\n}\n\n/* ------------------------------------------------------------------- events */\n\n.hive-event {\n display: grid;\n grid-template-columns: auto minmax(0, 1fr);\n gap: 2px 7px;\n padding: 6px 7px;\n border: 1px solid transparent;\n border-radius: var(--hive-radius-sm);\n background: var(--hive-surface);\n font-size: 10.5px;\n}\n\n.hive-event-time {\n color: var(--hive-fg-faint);\n font-family: var(--hive-mono);\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n}\n\n.hive-event-kind {\n justify-self: start;\n overflow: hidden;\n color: var(--hive-accent);\n font-weight: 600;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.hive-event-text {\n grid-column: 1 / -1;\n overflow-wrap: anywhere;\n color: var(--hive-fg-soft);\n font-family: var(--hive-mono);\n font-size: 10px;\n}\n\n/* ------------------------------------------------------------------- drawer */\n\n.hive-drawer {\n position: fixed;\n z-index: 2147483000;\n top: 0;\n right: 0;\n bottom: 0;\n display: flex;\n flex-direction: column;\n width: min(440px, 92vw);\n border-left: 1px solid var(--hive-line);\n background: color-mix(in srgb, var(--hive-bg) 97%, var(--hive-fg) 3%);\n color: var(--hive-fg);\n box-shadow: none;\n font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;\n color-scheme: light dark;\n animation: hive-drawer-in 150ms ease-out;\n}\n\n.hive-drawer-head {\n display: flex;\n align-items: flex-start;\n gap: 10px;\n padding: 14px;\n border-bottom: 1px solid var(--hive-line);\n}\n\n.hive-drawer-titlebox {\n min-width: 0;\n}\n\n.hive-drawer-eyebrow {\n overflow: hidden;\n color: var(--hive-fg-faint);\n font-family: var(--hive-mono);\n font-size: 9.5px;\n letter-spacing: 0.05em;\n text-overflow: ellipsis;\n text-transform: uppercase;\n white-space: nowrap;\n}\n\n.hive-drawer-title {\n margin: 3px 0 0;\n overflow-wrap: anywhere;\n color: var(--hive-fg);\n font-size: 15px;\n font-weight: 650;\n line-height: 1.35;\n}\n\n.hive-drawer-head .hive-btn-ghost {\n flex: 0 0 auto;\n margin-left: auto;\n}\n\n.hive-drawer-body {\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n gap: 10px;\n min-height: 0;\n padding: 14px;\n overflow-y: auto;\n scrollbar-color: var(--hive-line) transparent;\n scrollbar-width: thin;\n}\n\n.hive-actions-row {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n}\n\n.hive-note {\n color: var(--hive-fg-faint);\n font-size: 11px;\n}\n\n.hive-section-label {\n margin-top: 2px;\n color: var(--hive-fg-faint);\n font-size: 9.5px;\n font-weight: 650;\n letter-spacing: 0.1em;\n text-transform: uppercase;\n}\n\n.hive-json {\n max-height: 55vh;\n margin: 0;\n padding: 10px;\n overflow: auto;\n border: 1px solid var(--hive-line);\n border-radius: var(--hive-radius-md);\n background: color-mix(in srgb, var(--hive-fg) 3%, transparent);\n color: var(--hive-fg-soft);\n font-family: var(--hive-mono);\n font-size: 10.5px;\n line-height: 1.55;\n overflow-wrap: anywhere;\n scrollbar-color: var(--hive-line) transparent;\n scrollbar-width: thin;\n white-space: pre-wrap;\n}\n\n@keyframes hive-drawer-in {\n from {\n opacity: 0;\n transform: translateX(18px);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .hive-card,\n .hive-btn {\n transition: none;\n }\n\n .hive-drawer {\n animation: none;\n }\n}\n\n/* ------------------------------------------------------------------ compact */\n\n@media (max-width: 920px) {\n .hive {\n min-height: 100dvh;\n height: 100dvh;\n border-radius: 0;\n }\n\n .hive-main {\n grid-template-columns: minmax(0, 1fr);\n grid-template-rows: minmax(110px, 17vh) minmax(280px, 1fr) minmax(120px, 20vh);\n }\n\n .hive-agents {\n border-right: 0;\n border-bottom: 1px solid var(--hive-line);\n }\n\n .hive-events {\n border-top: 1px solid var(--hive-line);\n border-left: 0;\n }\n\n .hive-agent-list {\n flex-direction: row;\n overflow-x: auto;\n overflow-y: hidden;\n }\n\n .hive-agent {\n flex: 0 0 190px;\n }\n\n .hive-drawer {\n width: 100vw;\n }\n}\n/* DSH design-token bridge. Neutral grayscale fallbacks keep standalone pages readable. */\n.hive, .hive-portal, .hive-dialog {\n --hive-bg: var(--dsw-alias-bg-base, #fff);\n --hive-bg-layer-1: var(--dsw-alias-bg-layer-1, #fff);\n --hive-bg-layer-2: var(--dsw-alias-bg-layer-2, #fff);\n --hive-bg-layer-3: var(--dsw-alias-bg-layer-3, #f5f5f5);\n --hive-line: var(--dsw-alias-border-l1, #d9d9d9);\n --hive-line-2: var(--dsw-alias-border-l2, #e8e8e8);\n --hive-fg: var(--dsw-alias-label-primary, #000);\n --hive-fg-soft: var(--dsw-alias-label-secondary, #4d4d4d);\n --hive-fg-faint: var(--dsw-alias-label-tertiary, #808080);\n --hive-accent: var(--dsw-alias-brand-primary, #000);\n --hive-hover: var(--dsw-alias-interactive-bg-hover, #f2f2f2);\n --hive-selected: var(--dsw-alias-border-selected, #000);\n --hive-danger: var(--dsw-alias-state-error-primary, #000);\n --hive-ok: var(--dsw-alias-state-success-primary, #000);\n --hive-warn: var(--dsw-alias-state-warn-primary, #000);\n --hive-info: var(--dsw-alias-brand-primary, #000);\n --hive-radius-sm: var(--dsw-radius-sm, 4px);\n --hive-radius-md: var(--dsw-radius-md, 8px);\n --hive-radius-lg: var(--dsw-radius-lg, 12px);\n --hive-elevation: var(--dsw-elevation-panel, 0 12px 32px rgba(0, 0, 0, 0.18));\n --hive-surface: var(--hive-bg-layer-1);\n --hive-surface-strong: var(--hive-bg-layer-2);\n --hive-surface-hover: var(--hive-hover);\n --hive-accent-soft: color-mix(in srgb, var(--hive-accent) 14%, transparent);\n --hive-label-on-brand: var(--hive-bg);\n --hive-mono: ui-monospace, \"SFMono-Regular\", \"JetBrains Mono\", Menlo, Consolas, monospace;\n}\n\n/* Tokenized component treatment. */\n.hive { background: var(--hive-bg); color: var(--hive-fg); border-color: var(--hive-line); border-radius: var(--hive-radius-lg); }\n.hive-bar { background: var(--hive-bg-layer-1); border-bottom-color: var(--hive-line); gap: 8px; }\n.hive-main,\n.hive-board { background: var(--hive-bg); }\n.hive-agents,\n.hive-events { background: var(--hive-bg-layer-1); border-color: var(--hive-line); }\n.hive-lane { background: var(--hive-bg-layer-1); border-color: var(--hive-line); border-radius: var(--hive-radius-md); }\n.hive-card { background: var(--hive-bg-layer-1); border: 1px solid var(--hive-line); border-radius: var(--hive-radius-md); box-shadow: none; }\n.hive-card:hover { background: var(--hive-hover); border-color: var(--hive-line); }\n.hive-btn { background: transparent; border: 1px solid var(--hive-line); color: var(--hive-fg); border-radius: var(--hive-radius-md); }\n.hive-btn:hover { background: var(--hive-hover); border-color: var(--hive-line); color: var(--hive-fg); }\n.hive-btn-ghost { background: transparent; border-color: transparent; color: var(--hive-fg-soft); }\n.hive-btn-ghost:hover { background: var(--hive-hover); border-color: transparent; color: var(--hive-fg); }\n.hive-btn-danger { background: transparent; border-color: var(--hive-danger); color: var(--hive-danger); }\n.hive-btn-danger:hover:not(:disabled) { background: var(--hive-hover); border-color: var(--hive-danger); color: var(--hive-danger); }\n.hive-settings-primary,\n.hive-add-submit { background: var(--hive-accent); border-color: var(--hive-accent); color: var(--hive-label-on-brand); }\n.hive-settings-primary:hover:not(:disabled),\n.hive-add-submit:hover:not(:disabled) { background: var(--hive-accent); border-color: var(--hive-accent); color: var(--hive-label-on-brand); }\n.hive-settings-secondary { background: transparent; border-color: var(--hive-line); color: var(--hive-fg); }\n.hive-settings-secondary:hover { background: var(--hive-hover); border-color: var(--hive-line); color: var(--hive-fg); }\n.hive-input,\n.hive-textarea,\n.hive-limits-input { background: var(--hive-bg-layer-1); border: 1px solid var(--hive-line); color: var(--hive-fg); border-radius: var(--hive-radius-sm); }\n.hive-input:focus,\n.hive-textarea:focus,\n.hive-limits-input:focus { outline: 1px solid var(--hive-selected); outline-offset: 0; }\n.hive-dialog,\n.hive-add-dialog,\n.hive-settings-dialog,\n.hive-card-dialog { background: var(--hive-bg-layer-2); border: 1px solid var(--hive-line); border-radius: var(--hive-radius-lg); box-shadow: var(--hive-elevation); color: var(--hive-fg); }\n.hive-toast { background: var(--hive-bg-layer-2); border: 1px solid var(--hive-line); border-radius: var(--hive-radius-lg); box-shadow: none; color: var(--hive-fg); }\n.hive-drawer { background: var(--hive-bg-layer-2); border-left: 1px solid var(--hive-line); box-shadow: none; }\n.hive-json,\n.hive-plan-raw,\n.hive-plan-item,\n.hive-scope,\n.hive-init-card,\n.hive-limits-error,\n.hive-settings-note { background: var(--hive-bg-layer-1); border-color: var(--hive-line); border-radius: var(--hive-radius-sm); }\n.hive-limits-row { border-top-color: var(--hive-line-2); }\n.hive-limits-row:not(.is-head):hover { background: var(--hive-hover); }\n.hive-settings-tab[aria-selected=\"true\"] { border-bottom-color: var(--hive-selected); }\n.hive-lane-head,\n.hive-dialog-head,\n.hive-dialog-foot,\n.hive-drawer-head,\n.hive-settings-tabs { border-color: var(--hive-line-2); }\n.hive-freeze-banner { background: transparent; border-bottom-color: var(--hive-warn); color: var(--hive-warn); }\n.hive-freeze-banner .hive-btn { background: transparent; border-color: var(--hive-line); color: var(--hive-fg); }\n.hive-queen-hint { background: var(--hive-bg-layer-1); border-color: var(--hive-line); }\n.hive-supervisor-inline,\n.hive-stat,\n.hive-status,\n.hive-queen-badge {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n height: 22px;\n padding: 0 8px;\n border: 1px solid var(--hive-line);\n border-radius: 999px;\n background: transparent;\n color: var(--hive-fg-soft);\n font-size: 12px;\n font-weight: 400;\n line-height: 1;\n white-space: nowrap;\n}\n.hive-supervisor-inline { gap: 6px; }\n.hive-supervisor-inline-label { color: var(--hive-fg-soft); font-weight: 400; }\n.hive-supervisor-inline-state { display: inline-flex; align-items: center; gap: 6px; color: var(--hive-fg-soft); font-size: 12px; font-weight: 400; }\n.hive-supervisor-inline-state::before { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: var(--hive-fg-faint); content: \"\"; }\n.hive-supervisor-inline-state.is-running::before { background: var(--hive-accent); }\n.hive-supervisor-inline-state.is-backoff::before { background: var(--hive-warn); }\n.hive-supervisor-inline-state.is-paused::before { background: var(--hive-fg-faint); }\n.hive-supervisor-inline-resume { height: auto; min-height: 0; padding: 0; border: 0; background: transparent; color: var(--hive-fg-soft); font-size: 12px; line-height: 1; }\n.hive-supervisor-inline-resume:hover { background: transparent; color: var(--hive-fg); }\n.hive-stats { flex-wrap: wrap; gap: 8px; }\n.hive-stat.is-warn { color: var(--hive-fg-soft); background: transparent; }\n.hive-stat strong { color: var(--hive-fg-soft); font-weight: 400; }\n.hive-status { color: var(--hive-fg-soft); }\n.hive-status::before { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: var(--hive-danger); content: \"\"; font-size: 0; }\n.hive-status.is-info::before { background: var(--hive-accent); }\n.hive-queen-badge { color: var(--hive-fg-soft); }\n\n\n.hive-portal {\n position: fixed;\n inset: 0;\n z-index: 2147483600;\n pointer-events: none;\n}\n\n.hive-portal > .hive-overlay { pointer-events: auto; }\n\n/* Buttons: two explicit tiers. */\n.hive-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n height: 28px;\n padding: 0 12px;\n border: 1px solid var(--hive-line-2);\n border-radius: var(--hive-radius-md);\n background: transparent;\n color: var(--hive-fg);\n font-size: 14px;\n font-weight: 600;\n line-height: 1.5;\n}\n\n.hive-btn:hover {\n border-color: var(--hive-line-2);\n background: var(--hive-hover);\n color: var(--hive-fg);\n}\n\n.hive-btn-ghost {\n border-color: transparent;\n background: transparent;\n color: var(--hive-fg-soft);\n}\n\n.hive-btn-ghost:hover {\n border-color: transparent;\n background: var(--hive-hover);\n color: var(--hive-fg);\n}\n\n.hive-btn-danger {\n border-color: var(--hive-danger);\n background: transparent;\n color: var(--hive-danger);\n}\n\n.hive-btn-danger:hover:not(:disabled) {\n border-color: var(--hive-danger);\n background: var(--hive-hover);\n color: var(--hive-danger);\n}\n\n.hive-settings-primary,\n.hive-add-submit {\n border-color: var(--hive-accent);\n background: var(--hive-accent);\n color: var(--hive-label-on-brand);\n font-weight: 600;\n}\n\n.hive-settings-primary:hover:not(:disabled),\n.hive-add-submit:hover:not(:disabled) {\n border-color: var(--hive-accent);\n background: color-mix(in srgb, var(--hive-accent) 92%, #000);\n color: var(--hive-label-on-brand);\n}\n\n.hive-settings-primary:active:not(:disabled),\n.hive-add-submit:active:not(:disabled) {\n border-color: var(--hive-accent);\n background: color-mix(in srgb, var(--hive-accent) 84%, #000);\n color: var(--hive-label-on-brand);\n}\n\n.hive-settings-primary:focus-visible,\n.hive-add-submit:focus-visible {\n outline: 2px solid var(--hive-accent);\n outline-offset: 2px;\n}\n\n.hive-settings-secondary {\n border-color: var(--hive-line-2);\n background: transparent;\n color: var(--hive-fg);\n}\n\n.hive-settings-secondary:hover {\n border-color: var(--hive-line-2);\n background: var(--hive-hover);\n color: var(--hive-fg);\n}\n\n.hive-icon-button,\n.hive-dialog-close {\n height: 28px;\n padding: 0;\n border: 0;\n background: transparent;\n color: var(--hive-fg-soft);\n}\n\n.hive-icon-button:hover,\n.hive-dialog-close:hover {\n border: 0;\n background: var(--hive-hover);\n color: var(--hive-fg);\n}\n\n.hive-role-remove {\n height: 28px;\n min-height: 28px;\n padding: 0;\n border-color: transparent;\n background: transparent;\n color: var(--hive-danger);\n}\n\n/* Dialogs are portaled to the document body; keep them above the panel. */\n.hive-dialog,\n.hive-add-dialog,\n.hive-settings-dialog,\n.hive-card-dialog {\n border: 1px solid var(--hive-line);\n background: var(--hive-bg-layer-2);\n box-shadow: var(--dsw-elevation-panel, 0 12px 32px rgba(0, 0, 0, 0.18));\n}\n\n/* toolbar action rhythm */\n.hive-actions { gap: 8px; }\n.hive-actions > .hive-btn { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; }\n\n/* Dialog form containment: portal content must not create horizontal scroll. */\n.hive-portal,\n.hive-portal *,\n.hive-portal *::before,\n.hive-portal *::after { box-sizing: border-box; }\n\n.hive-portal .hive-dialog { max-width: 92vw; overflow-x: hidden; }\n.hive-portal .hive-dialog-head,\n.hive-portal .hive-dialog-body,\n.hive-portal .hive-dialog-foot { padding-left: 16px; padding-right: 16px; }\n.hive-portal .hive-dialog-body { width: auto; min-width: 0; max-width: 100%; }\n.hive-portal .hive-dialog-body > * { margin-left: 0; margin-right: 0; max-width: 100%; min-width: 0; }\n.hive-portal .hive-field,\n.hive-portal .hive-field-row,\n.hive-portal .hive-settings-section,\n.hive-portal .hive-settings-tabpanel,\n.hive-portal .hive-limits-table { width: 100%; max-width: 100%; min-width: 0; margin-left: 0; margin-right: 0; }\n.hive-portal .hive-field-row > .hive-field { width: auto; flex: 1 1 160px; }\n.hive-portal .hive-input,\n.hive-portal .hive-textarea,\n.hive-portal select { width: 100%; min-width: 0; max-width: 100%; }\n.hive-portal .hive-limits-row {\n width: 100%;\n max-width: 100%;\n min-width: 0;\n grid-template-columns: minmax(0, 1fr) 96px 48px 48px 28px;\n}\n.hive-portal .hive-limits-cell,\n.hive-portal .hive-limits-role,\n.hive-portal .hive-dialog-title,\n.hive-portal .hive-card-subline,\n.hive-portal .hive-settings-role-name { min-width: 0; overflow-wrap: anywhere; }\n.hive-portal .hive-dialog-foot { flex-wrap: wrap; }\n\n.hive-portal .hive-dialog-body { overflow-x: hidden; }\n.hive-portal .hive-settings-tabs { flex-wrap: wrap; }\n.hive-portal .hive-card-actions,\n.hive-portal .hive-settings-form-actions { max-width: 100%; }\n\n/* Native <dialog>: top layer, browser-managed backdrop and focus trap. */\n.hive-dialog,\n.hive-dialog *,\n.hive-dialog *::before,\n.hive-dialog *::after { box-sizing: border-box; }\n\ndialog.hive-dialog {\n position: fixed;\n inset: 0;\n margin: auto;\n padding: 0;\n width: min(560px, 100%);\n max-width: 92vw;\n max-height: 80vh;\n overflow: hidden;\n border: 1px solid var(--hive-line);\n border-radius: var(--hive-radius-lg);\n background: var(--hive-bg-layer-2);\n color: var(--hive-fg);\n box-shadow: var(--dsw-elevation-panel, 0 12px 32px rgba(0, 0, 0, 0.18));\n color-scheme: light dark;\n}\n\ndialog.hive-card-dialog { width: min(720px, 92vw); }\n\ndialog.hive-dialog::backdrop {\n background: var(--dsw-alias-bg-mask-1, rgba(0, 0, 0, 0.24));\n backdrop-filter: var(--dsw-mask-blur, none);\n}\n\ndialog.hive-dialog .hive-dialog-head,\ndialog.hive-dialog .hive-dialog-body,\ndialog.hive-dialog .hive-dialog-foot { padding-left: 16px; padding-right: 16px; }\ndialog.hive-dialog .hive-dialog-body { width: auto; min-width: 0; max-width: 100%; overflow-x: hidden; }\ndialog.hive-dialog .hive-dialog-body > * { margin-left: 0; margin-right: 0; max-width: 100%; min-width: 0; }\ndialog.hive-dialog .hive-field,\ndialog.hive-dialog .hive-field-row,\ndialog.hive-dialog .hive-settings-section,\ndialog.hive-dialog .hive-settings-tabpanel,\ndialog.hive-dialog .hive-limits-table { width: 100%; max-width: 100%; min-width: 0; margin-left: 0; margin-right: 0; }\ndialog.hive-dialog .hive-field-row > .hive-field { width: auto; flex: 1 1 160px; }\ndialog.hive-dialog .hive-input,\ndialog.hive-dialog .hive-textarea,\ndialog.hive-dialog select { width: 100%; min-width: 0; max-width: 100%; }\ndialog.hive-dialog .hive-limits-row {\n width: 100%;\n max-width: 100%;\n min-width: 0;\n grid-template-columns: minmax(0, 1fr) 96px 48px 48px 28px;\n}\ndialog.hive-dialog .hive-limits-cell,\ndialog.hive-dialog .hive-limits-role,\ndialog.hive-dialog .hive-dialog-title,\ndialog.hive-dialog .hive-card-subline,\ndialog.hive-dialog .hive-settings-role-name { min-width: 0; overflow-wrap: anywhere; }\ndialog.hive-dialog .hive-dialog-foot { flex-wrap: wrap; }\n\ndialog.hive-dialog {\n display: flex;\n flex-direction: column;\n max-height: 80vh;\n}\ndialog.hive-dialog .hive-dialog-head,\ndialog.hive-dialog .hive-dialog-foot { flex: 0 0 auto; }\ndialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow: auto; }\n.hive-card-run-output { max-height: 20lh; overflow: auto; }\n.hive-card-actions { flex-wrap: wrap; justify-content: flex-end; }\n\n/* Virtual lanes: fixed 26px cards, 2px gaps, 28px stride. */\n.hive-lane-cards {\n display: block;\n flex: 1 1 auto;\n min-height: 0;\n padding: 7px;\n overflow-x: hidden;\n overflow-y: auto;\n}\n.hive-lane-virtual { position: relative; width: 100%; min-width: 0; }\n.hive-lane-virtual .hive-card {\n position: absolute;\n left: 0;\n right: 0;\n display: flex;\n align-items: center;\n height: 26px;\n min-height: 26px;\n padding: 2px 8px;\n overflow: hidden;\n border-radius: var(--hive-radius-sm);\n}\n.hive-lane-virtual .hive-card-title {\n width: 100%;\n overflow: hidden;\n font-size: 12px;\n line-height: 16px;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.hive-agent-count { font: inherit; cursor: pointer; }\n.hive-agent-count:disabled { cursor: default; }\n\n/* Agents dialog */\n.hive-agents-dialog { width: min(560px, 92vw); max-height: 80vh; }\n.hive-agents-body { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow: auto; }\n.hive-agents-empty-note { padding: 10px 0; color: var(--hive-fg-soft); font-size: 12px; line-height: 1.5; }\n.hive-agent-row { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--hive-line-2); }\n.hive-agent-row-main { display: flex; flex: 1 1 auto; flex-direction: column; gap: 2px; min-width: 0; }\n.hive-agent-row-name { color: var(--hive-fg); font-size: 14px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }\n.hive-agent-row-task { color: var(--hive-fg-soft); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }\n.hive-agent-row-meta { color: var(--hive-fg-faint); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }\n.hive-agents-workers-title { padding-top: 4px; color: var(--hive-fg); font-size: 14px; font-weight: 700; line-height: 1.5; }\n.hive-agent-worker-row { padding: 8px 0; border-bottom: 1px solid var(--hive-line-2); }\n.hive-agent-worker-task { color: var(--hive-fg); font-size: 14px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }\n.hive-agent-worker-meta { color: var(--hive-fg-soft); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }\n.hive-agents-technical { border-top: 1px solid var(--hive-line-2); padding-top: 8px; }\n.hive-agents-technical-summary { color: var(--hive-fg-soft); font-size: 12px; line-height: 1.5; cursor: pointer; }\n.hive-agents-technical-json { max-height: 220px; margin-top: 8px; }\n\n\n/* The DSH design-token bridge is bundled in panel.css; this file is kept for package layout compatibility. */\n"
|
|
6478
6657
|
function ensureHivePanelCss() {
|
|
6479
6658
|
if (typeof document === 'undefined') return
|
|
6480
6659
|
if (document.querySelector('style[data-hive-panel-css]') !== null) return
|
package/lib/index.js
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
*/
|
|
31
31
|
import fs from 'node:fs'
|
|
32
32
|
import path from 'node:path'
|
|
33
|
-
import { createQueen, QUEEN_OFF_ACTION, QUEEN_ON_ACTION } from './queen.js'
|
|
33
|
+
import { createQueen, hasQueenRole, QUEEN_OFF_ACTION, QUEEN_ON_ACTION } from './queen.js'
|
|
34
34
|
|
|
35
35
|
/** Cordis plugin name used in logs and fiber diagnostics. */
|
|
36
36
|
export const name = 'hive-panel'
|
|
@@ -823,17 +823,23 @@ function createLog(ctx) {
|
|
|
823
823
|
|
|
824
824
|
/**
|
|
825
825
|
* Build the registrar that tells the resident Hive runner which Session is the
|
|
826
|
-
* queen
|
|
827
|
-
*
|
|
828
|
-
*
|
|
829
|
-
*
|
|
826
|
+
* queen and which repository it drives.
|
|
827
|
+
*
|
|
828
|
+
* The supervisor only dispatches repositories it tracks, so a Session that
|
|
829
|
+
* becomes queen by prompt auto-injection (or a panel init/queen-on) must also
|
|
830
|
+
* add its cwd. When the mounted supervisor exposes `addRepo(repo)` (the
|
|
831
|
+
* `hiveSupervisor` service in dsh-hive-runner does; it is idempotent by
|
|
832
|
+
* normalised path and its `status().repos` list then shows the repository) we
|
|
833
|
+
* register the cwd first; otherwise the repo step is skipped and only the
|
|
834
|
+
* queen Session is registered. Nothing is removed on unload/exit: the repo
|
|
835
|
+
* registration is deliberately one-way.
|
|
830
836
|
*
|
|
831
837
|
* @param {object} ctx - host Cordis context (may expose `hiveSupervisor`).
|
|
832
838
|
* @param {(message: string, error?: unknown) => void} [log] - diagnostics sink.
|
|
833
|
-
* @returns {(sessionId: string) => boolean} true when a runner accepted the id.
|
|
839
|
+
* @returns {(sessionId: string, cwd?: string) => boolean} true when a runner accepted the id.
|
|
834
840
|
*/
|
|
835
841
|
export function createQueenSessionRegistrar(ctx, log = () => {}) {
|
|
836
|
-
return function registerQueenSession(sessionId) {
|
|
842
|
+
return function registerQueenSession(sessionId, cwd) {
|
|
837
843
|
if (typeof sessionId !== 'string' || sessionId === '') return false
|
|
838
844
|
let runner
|
|
839
845
|
try {
|
|
@@ -842,7 +848,23 @@ export function createQueenSessionRegistrar(ctx, log = () => {}) {
|
|
|
842
848
|
log('hive-runner queen registration lookup failed', error)
|
|
843
849
|
return false
|
|
844
850
|
}
|
|
845
|
-
if (runner === undefined
|
|
851
|
+
if (runner === undefined) return false
|
|
852
|
+
|
|
853
|
+
// Repository step: only an initialised repository (queen role file present)
|
|
854
|
+
// is added; addRepo is idempotent, so repeated activations/snapshots are safe.
|
|
855
|
+
if (typeof cwd === 'string' && cwd !== '' && hasQueenRole(cwd)) {
|
|
856
|
+
if (typeof runner.addRepo === 'function') {
|
|
857
|
+
try {
|
|
858
|
+
runner.addRepo(cwd)
|
|
859
|
+
} catch (error) {
|
|
860
|
+
log('hive-runner repository registration failed: ' + cwd, error)
|
|
861
|
+
}
|
|
862
|
+
} else if (typeof runner.hasRepo === 'function' && runner.hasRepo(cwd) !== true) {
|
|
863
|
+
log('hive-runner supervisor does not expose addRepo(); repository not registered: ' + cwd)
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
if (typeof runner.setQueenSession !== 'function') return false
|
|
846
868
|
try {
|
|
847
869
|
runner.setQueenSession(sessionId)
|
|
848
870
|
return true
|
|
@@ -1107,7 +1129,7 @@ export function createBridge(ctx, config = {}) {
|
|
|
1107
1129
|
const initialised = isHiveInitialised(cwd, refsText)
|
|
1108
1130
|
if (initialised) autoActivateQueen(sessionId, cwd)
|
|
1109
1131
|
payload.queen = queenSnapshot(sessionId, cwd)
|
|
1110
|
-
if (payload.queen.active) registerQueenSession(sessionId)
|
|
1132
|
+
if (payload.queen.active) registerQueenSession(sessionId, cwd)
|
|
1111
1133
|
if (!initialised) {
|
|
1112
1134
|
payload.events = readEvents(cwd)
|
|
1113
1135
|
return payload
|
|
@@ -1172,7 +1194,7 @@ export function createBridge(ctx, config = {}) {
|
|
|
1172
1194
|
if (!isHiveInitialised(cwd, refsText)) return false
|
|
1173
1195
|
try {
|
|
1174
1196
|
queen.mark({ sessionId, cwd })
|
|
1175
|
-
registerQueenSession(sessionId)
|
|
1197
|
+
registerQueenSession(sessionId, cwd)
|
|
1176
1198
|
return true
|
|
1177
1199
|
} catch (error) {
|
|
1178
1200
|
log('queen activation failed', error)
|
|
@@ -1192,7 +1214,7 @@ export function createBridge(ctx, config = {}) {
|
|
|
1192
1214
|
throw new HiveRequestError('hive/queen-unavailable', 'queen controller is unavailable', 500)
|
|
1193
1215
|
}
|
|
1194
1216
|
queen.mark({ sessionId, cwd, source: 'manual' })
|
|
1195
|
-
registerQueenSession(sessionId)
|
|
1217
|
+
registerQueenSession(sessionId, cwd)
|
|
1196
1218
|
return { status: 200, body: { ok: true, code: 0, stdout: '', stderr: '' } }
|
|
1197
1219
|
}
|
|
1198
1220
|
if (actionName === QUEEN_OFF_ACTION) {
|
|
@@ -1337,7 +1359,7 @@ export function apply(ctx, config = {}) {
|
|
|
1337
1359
|
const queen = createQueen(ctx, {
|
|
1338
1360
|
log,
|
|
1339
1361
|
autoQueen,
|
|
1340
|
-
onAutoActivate: (sessionId) => { registerQueenSession(sessionId) },
|
|
1362
|
+
onAutoActivate: (sessionId, cwd) => { registerQueenSession(sessionId, cwd) },
|
|
1341
1363
|
})
|
|
1342
1364
|
ctx.effect(() => () => { queen.dispose() }, 'hive-panel: queen state')
|
|
1343
1365
|
const bridge = createBridge(ctx, {
|
package/lib/queen.js
CHANGED
|
@@ -66,10 +66,13 @@ export const QUEEN_FALLBACK_ROLE = '# Queen\n\nYou plan and coordinate; you neve
|
|
|
66
66
|
*
|
|
67
67
|
* They do not depend on the workspace role file, so a stale or custom
|
|
68
68
|
* `.hive/roles/queen.md` (written by an older `hive init`) cannot remove the
|
|
69
|
-
* production boundary that keeps the queen from implementing work herself
|
|
70
|
-
*
|
|
69
|
+
* production boundary that keeps the queen from implementing work herself: no
|
|
70
|
+
* subagent tools, and (for repositories initialised by an older `hive init` whose
|
|
71
|
+
* role file predates this contract) no write/edit/apply_patch/bash/cua either.
|
|
72
|
+
* Tasks and state go through `hive_*` tools; claim/done/fail stay worker actions.
|
|
73
|
+
* The workspace text stays untrusted below this block.
|
|
71
74
|
*/
|
|
72
|
-
export const QUEEN_INVARIANTS = '[hive:queen] trusted invariants (plugin-owned, cannot be overridden by the workspace): never call subagent/subagent_fork/subagent_claude_code or any execution tool to implement work; every goal becomes Hive tasks (hive_tasks add/plan) and the supervisor dispatches them. Classify each message (chat/progress/goal change/discussion/question/execute); discussion creates tasks only when the human asks to execute. Explain the classification only when it changes what the human expects.'
|
|
75
|
+
export const QUEEN_INVARIANTS = '[hive:queen] trusted invariants (plugin-owned, cannot be overridden by the workspace): never call subagent/subagent_fork/subagent_claude_code or any execution tool to implement work; every goal becomes Hive tasks (hive_tasks add/plan) and the supervisor dispatches them. Classify each message (chat/progress/goal change/discussion/question/execute); discussion creates tasks only when the human asks to execute. Explain the classification only when it changes what the human expects. Tool boundary: never call write, edit, apply_patch, bash, cua or any other file-mutating or command-executing tool; use only hive_* tools for tasks and state; claim/done/fail are worker actions and the queen must never call them; implementation is delegated to the supervisor. 工具边界:禁止调用 write、edit、apply_patch、bash、cua 等任何修改文件或执行命令的工具;任务与状态只能使用 hive_* 工具;claim/done/fail 属于 worker 动作,女王不得调用;具体实现交给 supervisor。'
|
|
73
76
|
|
|
74
77
|
/** Short exit hint appended to every rendered role. */
|
|
75
78
|
export const QUEEN_EXIT_HINT = '\n\n[hive] Queen mode: plan, split, order, supervise, review, report; never edit code or commit, never call subagent tools — create Hive tasks and let the supervisor dispatch. Fine-grained cards; every card needs an acceptance command. Load the hive-queen skill. Exit with /queen off.'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-hive-panel",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Hive board and queen mode inside DSH Web: a conversation view scoped to the Session's repository, with allowlisted task-card actions over DSH's shell seam.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
package/scripts/verify.mjs
CHANGED
|
@@ -917,7 +917,14 @@ async function call(route, { method = 'GET', query = {}, body } = {}) {
|
|
|
917
917
|
// ── 11b. prompt auto-injection works without the panel ─────────────────────
|
|
918
918
|
{
|
|
919
919
|
const calls = []
|
|
920
|
-
const
|
|
920
|
+
const repos = []
|
|
921
|
+
const removals = []
|
|
922
|
+
const supervisor = {
|
|
923
|
+
setQueenSession(sessionId) { calls.push(sessionId) },
|
|
924
|
+
addRepo(repo) { if (!repos.includes(repo)) repos.push(repo); return { repo } },
|
|
925
|
+
hasRepo(repo) { return repos.includes(repo) },
|
|
926
|
+
removeRepo(repo) { removals.push(repo) },
|
|
927
|
+
}
|
|
921
928
|
const shim = createCtx({
|
|
922
929
|
live: new Map([
|
|
923
930
|
['s-auto', { id: 's-auto', header: { id: 's-auto', cwd: repo } }],
|
|
@@ -941,10 +948,13 @@ async function call(route, { method = 'GET', query = {}, body } = {}) {
|
|
|
941
948
|
assert.ok(text.includes(join(repo, '.hive', 'roles', 'queen.md')), 'the auto-injected text must name its role file')
|
|
942
949
|
assert.ok(text.includes('[hive:queen] trusted invariants'), 'prompt auto-injection must carry the trusted invariants')
|
|
943
950
|
assert.deepEqual(calls, ['s-auto'], 'prompt auto-injection must register the queen Session with the supervisor')
|
|
951
|
+
assert.deepEqual(repos, [repo], 'prompt auto-injection must register the queen repository with the supervisor')
|
|
944
952
|
assert.equal(section.text({ agent: autoAgent }), text, 'repeat assemblies reuse the same injection')
|
|
945
953
|
assert.deepEqual(calls, ['s-auto'], 'the supervisor registration must be idempotent')
|
|
954
|
+
assert.deepEqual(repos, [repo], 'the supervisor repository registration must be deduplicated')
|
|
946
955
|
assert.equal(section.text({ agent: plainAgent }), '', 'a Session whose cwd has no queen role file must not be injected')
|
|
947
956
|
assert.deepEqual(calls, ['s-auto'], 'a Session in another repository is never registered')
|
|
957
|
+
assert.deepEqual(repos, [repo], 'an uninitialised repository is never registered as a supervisor repo')
|
|
948
958
|
// Card workers / delegated children share the repo cwd but must never be queens.
|
|
949
959
|
const workerAgent = { session: { id: 's-worker', header: { id: 's-worker', cwd: repo, origin: 'subagent', delegationDepth: 1 } } }
|
|
950
960
|
assert.equal(section.text({ agent: workerAgent }), '', 'a subagent Session must never be auto-queened')
|
|
@@ -955,7 +965,9 @@ async function call(route, { method = 'GET', query = {}, body } = {}) {
|
|
|
955
965
|
assert.deepEqual(snap.body.queen, { active: true, source: 'auto', repo })
|
|
956
966
|
const plainSnap = await call(shim.routes.get('/api/hive'), { query: { op: 'snapshot', sessionId: 's-plain' } })
|
|
957
967
|
assert.deepEqual(plainSnap.body.queen, { active: false, source: null, repo: other })
|
|
958
|
-
|
|
968
|
+
assert.deepEqual(repos, [repo], 'the snapshot path must not register an uninitialised repository either')
|
|
969
|
+
assert.deepEqual(removals, [], 'no path may remove a repository registration')
|
|
970
|
+
ok('the first system-prompt assembly auto-injects the queen and registers the repo + supervisor, without a panel request')
|
|
959
971
|
}
|
|
960
972
|
|
|
961
973
|
// ── 11c. prompt auto-injection respects /queen off, autoQueen and init state ──
|
|
@@ -991,6 +1003,53 @@ async function call(route, { method = 'GET', query = {}, body } = {}) {
|
|
|
991
1003
|
ok('prompt auto-injection honours /queen off, autoQueen=false and uninitialised repositories')
|
|
992
1004
|
}
|
|
993
1005
|
|
|
1006
|
+
// ── 11d. panel init/queen-on register the queen repo with the supervisor ───
|
|
1007
|
+
{
|
|
1008
|
+
const repos = []
|
|
1009
|
+
const removals = []
|
|
1010
|
+
const sessions = []
|
|
1011
|
+
const supervisor = {
|
|
1012
|
+
addRepo(repo) { if (!repos.includes(repo)) repos.push(repo); return { repo } },
|
|
1013
|
+
hasRepo(repo) { return repos.includes(repo) },
|
|
1014
|
+
removeRepo(repo) { removals.push(repo) },
|
|
1015
|
+
setQueenSession(sessionId) { sessions.push(sessionId) },
|
|
1016
|
+
}
|
|
1017
|
+
const shim = createCtx({
|
|
1018
|
+
live: new Map([
|
|
1019
|
+
['s-live', { id: 's-live', header: { id: 's-live', cwd: repo } }],
|
|
1020
|
+
['s-other', { id: 's-other', header: { id: 's-other', cwd: other } }],
|
|
1021
|
+
]),
|
|
1022
|
+
cwdOf,
|
|
1023
|
+
supervisor,
|
|
1024
|
+
})
|
|
1025
|
+
host.apply(shim.ctx, { writable: true })
|
|
1026
|
+
const route = shim.routes.get('/api/hive')
|
|
1027
|
+
|
|
1028
|
+
const init = await call(route, { method: 'POST', query: { op: 'action', name: 'init', sessionId: 's-live' }, body: {} })
|
|
1029
|
+
assert.equal(init.status, 200)
|
|
1030
|
+
assert.equal(init.body.ok, true)
|
|
1031
|
+
assert.deepEqual(repos, [repo], 'the init action must register the queen cwd with the supervisor')
|
|
1032
|
+
assert.deepEqual(sessions, ['s-live'], 'the init action must also register the queen Session')
|
|
1033
|
+
|
|
1034
|
+
// Repeated activation (queen-on + snapshot) is deduplicated by the supervisor.
|
|
1035
|
+
await call(route, { method: 'POST', query: { op: 'action', name: 'queen-on', sessionId: 's-live' }, body: {} })
|
|
1036
|
+
await call(route, { query: { op: 'snapshot', sessionId: 's-live' } })
|
|
1037
|
+
assert.deepEqual(repos, [repo], 're-registering the same repo must stay a single entry')
|
|
1038
|
+
|
|
1039
|
+
// Only repositories with .hive/roles/queen.md are registered.
|
|
1040
|
+
const otherOn = await call(route, { method: 'POST', query: { op: 'action', name: 'queen-on', sessionId: 's-other' }, body: {} })
|
|
1041
|
+
assert.equal(otherOn.status, 200)
|
|
1042
|
+
assert.deepEqual(repos, [repo], 'an uninitialised repository must never be added to the supervisor')
|
|
1043
|
+
assert.deepEqual([...new Set(sessions)], ['s-live', 's-other'], 'the fallback queen Session still registers itself (idempotent at the supervisor)')
|
|
1044
|
+
|
|
1045
|
+
// Leaving queen mode never removes the repository registration (one-way).
|
|
1046
|
+
await call(route, { method: 'POST', query: { op: 'action', name: 'queen-off', sessionId: 's-live' }, body: {} })
|
|
1047
|
+
await call(route, { query: { op: 'snapshot', sessionId: 's-live' } })
|
|
1048
|
+
assert.deepEqual(repos, [repo], 'queen-off must not drop the repository registration')
|
|
1049
|
+
assert.deepEqual(removals, [], 'the panel must never call removeRepo on exit/unload')
|
|
1050
|
+
ok('panel init/queen-on register the queen cwd with the supervisor (idempotent, initialised repos only, one-way)')
|
|
1051
|
+
}
|
|
1052
|
+
|
|
994
1053
|
// ── 12. queen activation / scope / exit ─────────────────────────────────────
|
|
995
1054
|
{
|
|
996
1055
|
const shim = createCtx({
|
|
@@ -1027,6 +1086,17 @@ async function call(route, { method = 'GET', query = {}, body } = {}) {
|
|
|
1027
1086
|
assert.ok(text.length <= 24576, 'the role text must be capped at 24576 characters')
|
|
1028
1087
|
assert.ok(text.includes('[hive:queen] trusted invariants'), 'the trusted invariants block must be injected')
|
|
1029
1088
|
assert.match(text, /never call subagent/, 'the trusted invariants must forbid subagent implementation')
|
|
1089
|
+
// Tool boundary: an old repository whose role file predates this contract must
|
|
1090
|
+
// still be forbidden from mutating files or running commands.
|
|
1091
|
+
for (const keyword of ['write', 'edit', 'apply_patch', 'bash', 'cua']) {
|
|
1092
|
+
assert.ok(queenModule.QUEEN_INVARIANTS.includes(keyword), 'QUEEN_INVARIANTS must ban ' + keyword)
|
|
1093
|
+
assert.ok(text.includes(keyword), 'the injected queen text must ban ' + keyword)
|
|
1094
|
+
}
|
|
1095
|
+
assert.ok(queenModule.QUEEN_INVARIANTS.includes('claim'), 'QUEEN_INVARIANTS must reserve claim/done/fail for workers')
|
|
1096
|
+
assert.ok(text.includes('claim/done/fail are worker actions'), 'the injected text must say claim/done/fail are worker actions')
|
|
1097
|
+
assert.ok(text.includes('hive_*'), 'the injected text must route tasks and state through hive_* tools')
|
|
1098
|
+
assert.ok(text.includes('工具边界'), 'the injected invariants must carry the Chinese tool-boundary line')
|
|
1099
|
+
assert.ok(text.includes('never call write, edit, apply_patch, bash, cua'), 'the English tool-boundary sentence must be injected')
|
|
1030
1100
|
assert.ok(text.indexOf('trusted invariants') < text.indexOf('Exit with /queen off.'), 'invariants come before the exit hint')
|
|
1031
1101
|
assert.ok(text.includes('Fine-grained cards; every card needs an acceptance command.'), 'the exit hint must carry the coordinator contract')
|
|
1032
1102
|
assert.ok(text.includes('Exit with /queen off.'), 'the exit hint must name /queen off')
|
|
@@ -1053,6 +1123,7 @@ async function call(route, { method = 'GET', query = {}, body } = {}) {
|
|
|
1053
1123
|
assert.match(fallbackText, /Load the hive-queen skill/)
|
|
1054
1124
|
assert.ok(fallbackText.length <= 24576)
|
|
1055
1125
|
assert.ok(fallbackText.includes('[hive:queen] trusted invariants'), 'the fallback path must keep the trusted invariants')
|
|
1126
|
+
ok('the trusted invariants ban file/command tools (write/edit/apply_patch/bash/cua, claim) and route state through hive_* tools')
|
|
1056
1127
|
ok('init + refs/hive/v1 marks only that Session; /queen off and name=queen-off both clear it; a missing role file uses the coordinator fallback')
|
|
1057
1128
|
}
|
|
1058
1129
|
|
package/src/panel.css
CHANGED
|
@@ -1131,3 +1131,20 @@ dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow:
|
|
|
1131
1131
|
.hive-agent-count { font: inherit; cursor: pointer; }
|
|
1132
1132
|
.hive-agent-count:disabled { cursor: default; }
|
|
1133
1133
|
|
|
1134
|
+
/* Agents dialog */
|
|
1135
|
+
.hive-agents-dialog { width: min(560px, 92vw); max-height: 80vh; }
|
|
1136
|
+
.hive-agents-body { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow: auto; }
|
|
1137
|
+
.hive-agents-empty-note { padding: 10px 0; color: var(--hive-fg-soft); font-size: 12px; line-height: 1.5; }
|
|
1138
|
+
.hive-agent-row { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--hive-line-2); }
|
|
1139
|
+
.hive-agent-row-main { display: flex; flex: 1 1 auto; flex-direction: column; gap: 2px; min-width: 0; }
|
|
1140
|
+
.hive-agent-row-name { color: var(--hive-fg); font-size: 14px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
|
|
1141
|
+
.hive-agent-row-task { color: var(--hive-fg-soft); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
|
|
1142
|
+
.hive-agent-row-meta { color: var(--hive-fg-faint); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
|
|
1143
|
+
.hive-agents-workers-title { padding-top: 4px; color: var(--hive-fg); font-size: 14px; font-weight: 700; line-height: 1.5; }
|
|
1144
|
+
.hive-agent-worker-row { padding: 8px 0; border-bottom: 1px solid var(--hive-line-2); }
|
|
1145
|
+
.hive-agent-worker-task { color: var(--hive-fg); font-size: 14px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
|
|
1146
|
+
.hive-agent-worker-meta { color: var(--hive-fg-soft); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
|
|
1147
|
+
.hive-agents-technical { border-top: 1px solid var(--hive-line-2); padding-top: 8px; }
|
|
1148
|
+
.hive-agents-technical-summary { color: var(--hive-fg-soft); font-size: 12px; line-height: 1.5; cursor: pointer; }
|
|
1149
|
+
.hive-agents-technical-json { max-height: 220px; margin-top: 8px; }
|
|
1150
|
+
|
package/src/panel.js
CHANGED
|
@@ -2017,6 +2017,22 @@ dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow:
|
|
|
2017
2017
|
}
|
|
2018
2018
|
.hive-agent-count { font: inherit; cursor: pointer; }
|
|
2019
2019
|
.hive-agent-count:disabled { cursor: default; }
|
|
2020
|
+
/* Agents dialog */
|
|
2021
|
+
.hive-agents-dialog { width: min(560px, 92vw); max-height: 80vh; }
|
|
2022
|
+
.hive-agents-body { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow: auto; }
|
|
2023
|
+
.hive-agents-empty-note { padding: 10px 0; color: var(--hive-fg-soft); font-size: 12px; line-height: 1.5; }
|
|
2024
|
+
.hive-agent-row { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--hive-line-2); }
|
|
2025
|
+
.hive-agent-row-main { display: flex; flex: 1 1 auto; flex-direction: column; gap: 2px; min-width: 0; }
|
|
2026
|
+
.hive-agent-row-name { color: var(--hive-fg); font-size: 14px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
|
|
2027
|
+
.hive-agent-row-task { color: var(--hive-fg-soft); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
|
|
2028
|
+
.hive-agent-row-meta { color: var(--hive-fg-faint); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
|
|
2029
|
+
.hive-agents-workers-title { padding-top: 4px; color: var(--hive-fg); font-size: 14px; font-weight: 700; line-height: 1.5; }
|
|
2030
|
+
.hive-agent-worker-row { padding: 8px 0; border-bottom: 1px solid var(--hive-line-2); }
|
|
2031
|
+
.hive-agent-worker-task { color: var(--hive-fg); font-size: 14px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
|
|
2032
|
+
.hive-agent-worker-meta { color: var(--hive-fg-soft); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
|
|
2033
|
+
.hive-agents-technical { border-top: 1px solid var(--hive-line-2); padding-top: 8px; }
|
|
2034
|
+
.hive-agents-technical-summary { color: var(--hive-fg-soft); font-size: 12px; line-height: 1.5; cursor: pointer; }
|
|
2035
|
+
.hive-agents-technical-json { max-height: 220px; margin-top: 8px; }
|
|
2020
2036
|
`;
|
|
2021
2037
|
|
|
2022
2038
|
const LANE_LABEL_KEYS = Object.freeze({
|
|
@@ -2075,6 +2091,14 @@ export const messages = Object.freeze({
|
|
|
2075
2091
|
"status.actionFailed": "action failed",
|
|
2076
2092
|
"status.disconnected": "disconnected",
|
|
2077
2093
|
"agents.openAria": "Open agent",
|
|
2094
|
+
"agents.runningTooltip": "Running {running} / board identities {identities}",
|
|
2095
|
+
"agents.fallbackTooltip": "Board identities {identities} (supervisor disconnected or repository not registered)",
|
|
2096
|
+
"agents.modalEmpty": "No agents.",
|
|
2097
|
+
"agents.fileCount": "{count} files",
|
|
2098
|
+
"agents.workersTitle": "Active work units",
|
|
2099
|
+
"agents.workerStarted": "Started {time}",
|
|
2100
|
+
"agents.workerElapsed": "Running for {duration}",
|
|
2101
|
+
"agents.technical": "Technical details",
|
|
2078
2102
|
"agent.idle": "idle",
|
|
2079
2103
|
"agent.task": "task",
|
|
2080
2104
|
"agent.unknown": "unknown",
|
|
@@ -2316,6 +2340,14 @@ export const messages = Object.freeze({
|
|
|
2316
2340
|
"status.actionFailed": "操作失败",
|
|
2317
2341
|
"status.disconnected": "连接断开",
|
|
2318
2342
|
"agents.openAria": "打开智能体",
|
|
2343
|
+
"agents.runningTooltip": "运行中 {running} / 公告板身份 {identities}",
|
|
2344
|
+
"agents.fallbackTooltip": "公告板身份 {identities}(监督器未连接或未注册该仓库)",
|
|
2345
|
+
"agents.modalEmpty": "暂无智能体。",
|
|
2346
|
+
"agents.fileCount": "{count} 个文件",
|
|
2347
|
+
"agents.workersTitle": "运行中的工作单元",
|
|
2348
|
+
"agents.workerStarted": "开始于 {time}",
|
|
2349
|
+
"agents.workerElapsed": "已运行 {duration}",
|
|
2350
|
+
"agents.technical": "技术详情",
|
|
2319
2351
|
"agent.idle": "空闲",
|
|
2320
2352
|
"agent.task": "任务",
|
|
2321
2353
|
"agent.unknown": "未知",
|
|
@@ -2889,7 +2921,7 @@ function normalizeSupervisorRoles(source) {
|
|
|
2889
2921
|
const ensure = (role) => {
|
|
2890
2922
|
const name = asString(role).trim();
|
|
2891
2923
|
if (!name) return null;
|
|
2892
|
-
if (!rows.has(name)) rows.set(name, { role: name, limit: null, inFlight: null, queued: null });
|
|
2924
|
+
if (!rows.has(name)) rows.set(name, { role: name, limit: null, live: null, inFlight: null, queued: null });
|
|
2893
2925
|
return rows.get(name);
|
|
2894
2926
|
};
|
|
2895
2927
|
const setLimit = (role, value) => {
|
|
@@ -2923,6 +2955,12 @@ function normalizeSupervisorRoles(source) {
|
|
|
2923
2955
|
break;
|
|
2924
2956
|
}
|
|
2925
2957
|
}
|
|
2958
|
+
for (const field of ["live", "liveCount", "live_count", "workers", "workerCount"]) {
|
|
2959
|
+
if (supervisorNumber(raw[field]) !== null) {
|
|
2960
|
+
row.live = supervisorNumber(raw[field]);
|
|
2961
|
+
break;
|
|
2962
|
+
}
|
|
2963
|
+
}
|
|
2926
2964
|
for (const field of ["queued", "queue", "queued_count", "pending", "pending_count", "waiting", "waiting_count", "backlog"]) {
|
|
2927
2965
|
if (supervisorNumber(raw[field]) !== null) {
|
|
2928
2966
|
row.queued = supervisorNumber(raw[field]);
|
|
@@ -3009,6 +3047,26 @@ function supervisorEntriesFrom(payload, depth = 0) {
|
|
|
3009
3047
|
}
|
|
3010
3048
|
|
|
3011
3049
|
/** Normalize the supervisor status endpoint into per-repository rows. */
|
|
3050
|
+
function normalizeSupervisorWorkers(source) {
|
|
3051
|
+
const raw = source && Array.isArray(source.workers) ? source.workers : [];
|
|
3052
|
+
const rows = [];
|
|
3053
|
+
for (const entry of raw) {
|
|
3054
|
+
if (!isRecord(entry)) continue;
|
|
3055
|
+
const cardId = asString(entry.cardId || entry.card || entry.task || entry.id);
|
|
3056
|
+
if (!cardId) continue;
|
|
3057
|
+
rows.push({
|
|
3058
|
+
cardId,
|
|
3059
|
+
role: asString(entry.role),
|
|
3060
|
+
agent: asString(entry.agent || entry.adapter),
|
|
3061
|
+
agentName: asString(entry.agentName || entry.agent_name || entry.name),
|
|
3062
|
+
sessionId: asString(entry.sessionId || entry.session_id),
|
|
3063
|
+
startedAt: asString(entry.startedAt || entry.started_at),
|
|
3064
|
+
lastOutputAt: asString(entry.lastOutputAt || entry.last_output_at),
|
|
3065
|
+
});
|
|
3066
|
+
}
|
|
3067
|
+
return rows;
|
|
3068
|
+
}
|
|
3069
|
+
|
|
3012
3070
|
function normalizeSupervisorStatus(payload) {
|
|
3013
3071
|
const rows = new Map();
|
|
3014
3072
|
for (const raw of supervisorEntriesFrom(payload)) {
|
|
@@ -3031,11 +3089,30 @@ function normalizeSupervisorStatus(payload) {
|
|
|
3031
3089
|
else if (/run|active|busy|working/.test(rawState)) state = "running";
|
|
3032
3090
|
else if (/idle|ready|free/.test(rawState)) state = "idle";
|
|
3033
3091
|
else if (running !== null && running > 0) state = "running";
|
|
3034
|
-
rows.set(repo, { repo, state, running, roles: normalizeSupervisorRoles(source) });
|
|
3092
|
+
rows.set(repo, { repo, state, running, roles: normalizeSupervisorRoles(source), workers: normalizeSupervisorWorkers(source) });
|
|
3035
3093
|
}
|
|
3036
3094
|
return [...rows.values()].sort((left, right) => left.repo.localeCompare(right.repo));
|
|
3037
3095
|
}
|
|
3038
3096
|
|
|
3097
|
+
function supervisorWorkerCount(row) {
|
|
3098
|
+
if (!row) return null;
|
|
3099
|
+
if (Array.isArray(row.workers) && row.workers.length > 0) return row.workers.length;
|
|
3100
|
+
const direct = supervisorNumber(row.running);
|
|
3101
|
+
if (direct !== null) return direct;
|
|
3102
|
+
let total = 0;
|
|
3103
|
+
let found = false;
|
|
3104
|
+
for (const role of Array.isArray(row.roles) ? row.roles : []) {
|
|
3105
|
+
if (!isRecord(role)) continue;
|
|
3106
|
+
const live = supervisorNumber(role.live);
|
|
3107
|
+
const inFlight = live !== null ? live : supervisorNumber(role.inFlight);
|
|
3108
|
+
if (inFlight !== null) {
|
|
3109
|
+
total += inFlight;
|
|
3110
|
+
found = true;
|
|
3111
|
+
}
|
|
3112
|
+
}
|
|
3113
|
+
return found ? total : null;
|
|
3114
|
+
}
|
|
3115
|
+
|
|
3039
3116
|
function element(doc, tag, className, text) {
|
|
3040
3117
|
const node = doc.createElement(tag);
|
|
3041
3118
|
if (className) node.className = className;
|
|
@@ -3563,7 +3640,7 @@ export function mount(root, options = {}) {
|
|
|
3563
3640
|
const agentsCount = element(doc, "button", "hive-stat hive-agent-count");
|
|
3564
3641
|
setAttr(agentsCount, "type", "button");
|
|
3565
3642
|
agentsCount.addEventListener("click", () => {
|
|
3566
|
-
|
|
3643
|
+
openAgentsDialog();
|
|
3567
3644
|
});
|
|
3568
3645
|
bar.appendChild(agentsCount);
|
|
3569
3646
|
|
|
@@ -5155,6 +5232,101 @@ export function mount(root, options = {}) {
|
|
|
5155
5232
|
return body;
|
|
5156
5233
|
}
|
|
5157
5234
|
|
|
5235
|
+
function taskTitleForId(id) {
|
|
5236
|
+
const wanted = asString(id);
|
|
5237
|
+
if (!wanted || !lastModel) return "";
|
|
5238
|
+
for (const lane of LANE_ORDER) {
|
|
5239
|
+
for (const card of lastModel.lanes[lane] || []) {
|
|
5240
|
+
if (asString(card.id) === wanted) return card.title || wanted;
|
|
5241
|
+
}
|
|
5242
|
+
}
|
|
5243
|
+
return wanted;
|
|
5244
|
+
}
|
|
5245
|
+
|
|
5246
|
+
function openAgentsDialog() {
|
|
5247
|
+
closeHelp(false);
|
|
5248
|
+
closePlanDialog(false);
|
|
5249
|
+
closeAddDialog(false);
|
|
5250
|
+
closeDrawer(false);
|
|
5251
|
+
closeLimitsDialog(false);
|
|
5252
|
+
|
|
5253
|
+
const dialog = element(doc, "dialog", "hive-dialog hive-agents-dialog");
|
|
5254
|
+
setAttr(dialog, "role", "dialog");
|
|
5255
|
+
setAttr(dialog, "aria-modal", "true");
|
|
5256
|
+
setAttr(dialog, "aria-label", translate("pane.agents"));
|
|
5257
|
+
bindDialogDismiss(dialog, () => {
|
|
5258
|
+
closeModalDialog(dialog);
|
|
5259
|
+
if (!destroyed) focusNode(agentsCount);
|
|
5260
|
+
});
|
|
5261
|
+
|
|
5262
|
+
const head = element(doc, "div", "hive-dialog-head");
|
|
5263
|
+
const titleBox = element(doc, "div", "hive-dialog-head-title");
|
|
5264
|
+
titleBox.appendChild(element(doc, "h2", "hive-dialog-title", translate("pane.agents")));
|
|
5265
|
+
head.appendChild(titleBox);
|
|
5266
|
+
const closeButton = dialogCloseButton(() => {
|
|
5267
|
+
closeModalDialog(dialog);
|
|
5268
|
+
if (!destroyed) focusNode(agentsCount);
|
|
5269
|
+
});
|
|
5270
|
+
head.appendChild(closeButton);
|
|
5271
|
+
dialog.appendChild(head);
|
|
5272
|
+
|
|
5273
|
+
const body = element(doc, "div", "hive-dialog-body hive-agents-body");
|
|
5274
|
+
const agents = lastModel && Array.isArray(lastModel.agents) ? lastModel.agents : [];
|
|
5275
|
+
if (agents.length === 0) {
|
|
5276
|
+
body.appendChild(element(doc, "div", "hive-agents-empty-note", translate("agents.modalEmpty")));
|
|
5277
|
+
}
|
|
5278
|
+
for (const agent of agents) {
|
|
5279
|
+
const row = element(doc, "div", "hive-agent-row");
|
|
5280
|
+
const dot = element(doc, "span", "hive-dot is-" + safeClassToken(agent.state));
|
|
5281
|
+
setAttr(dot, "title", agent.state || translate("agent.idle"));
|
|
5282
|
+
row.appendChild(dot);
|
|
5283
|
+
const content = element(doc, "div", "hive-agent-row-main");
|
|
5284
|
+
content.appendChild(element(doc, "div", "hive-agent-row-name", agent.agent || translate("agent.unknown")));
|
|
5285
|
+
const task = taskTitleForId(agent.task);
|
|
5286
|
+
content.appendChild(
|
|
5287
|
+
element(doc, "div", "hive-agent-row-task", task || translate("agent.idle")),
|
|
5288
|
+
);
|
|
5289
|
+
const meta = [translate("agents.fileCount").replace("{count}", String((agent.files || []).length))];
|
|
5290
|
+
const activity = elapsedLabel(agent.updatedAt);
|
|
5291
|
+
if (activity) meta.push(activity);
|
|
5292
|
+
const metaNode = element(doc, "div", "hive-agent-row-meta", meta.join(" · "));
|
|
5293
|
+
if (agent.updatedAt) setAttr(metaNode, "title", agent.updatedAt);
|
|
5294
|
+
content.appendChild(metaNode);
|
|
5295
|
+
row.appendChild(content);
|
|
5296
|
+
body.appendChild(row);
|
|
5297
|
+
}
|
|
5298
|
+
|
|
5299
|
+
const supervisor = currentSupervisorRow();
|
|
5300
|
+
const workers = supervisor && Array.isArray(supervisor.workers) ? supervisor.workers : [];
|
|
5301
|
+
if (workers.length > 0) {
|
|
5302
|
+
body.appendChild(element(doc, "div", "hive-agents-workers-title", translate("agents.workersTitle")));
|
|
5303
|
+
for (const worker of workers) {
|
|
5304
|
+
const row = element(doc, "div", "hive-agent-worker-row");
|
|
5305
|
+
row.appendChild(
|
|
5306
|
+
element(doc, "div", "hive-agent-worker-task", taskTitleForId(worker.cardId) || worker.cardId),
|
|
5307
|
+
);
|
|
5308
|
+
const meta = [];
|
|
5309
|
+
if (worker.role) meta.push(worker.role);
|
|
5310
|
+
if (worker.startedAt) meta.push(translate("agents.workerStarted").replace("{time}", formatRunStamp(worker.startedAt)));
|
|
5311
|
+
const elapsed = elapsedLabel(worker.startedAt);
|
|
5312
|
+
if (elapsed) meta.push(translate("agents.workerElapsed").replace("{duration}", elapsed));
|
|
5313
|
+
row.appendChild(element(doc, "div", "hive-agent-worker-meta", meta.join(" · ") || worker.agentName || worker.agent || ""));
|
|
5314
|
+
body.appendChild(row);
|
|
5315
|
+
}
|
|
5316
|
+
}
|
|
5317
|
+
|
|
5318
|
+
const technical = element(doc, "details", "hive-agents-technical");
|
|
5319
|
+
technical.appendChild(element(doc, "summary", "hive-agents-technical-summary", translate("agents.technical")));
|
|
5320
|
+
technical.appendChild(
|
|
5321
|
+
element(doc, "pre", "hive-json hive-agents-technical-json", JSON.stringify({ agents, workers }, null, 2)),
|
|
5322
|
+
);
|
|
5323
|
+
body.appendChild(technical);
|
|
5324
|
+
dialog.appendChild(body);
|
|
5325
|
+
|
|
5326
|
+
showModalDialog(dialog);
|
|
5327
|
+
focusNode(closeButton);
|
|
5328
|
+
}
|
|
5329
|
+
|
|
5158
5330
|
function openAgentDrawer(agent) {
|
|
5159
5331
|
const raw = findRawAgent(agent) || { ...agent };
|
|
5160
5332
|
const title = agent.agent || translate("agent.unknown");
|
|
@@ -5759,6 +5931,7 @@ export function mount(root, options = {}) {
|
|
|
5759
5931
|
function setSupervisorData(rows) {
|
|
5760
5932
|
supervisorData = Array.isArray(rows) ? rows : [];
|
|
5761
5933
|
renderSupervisor();
|
|
5934
|
+
if (lastModel) renderAgents(lastModel);
|
|
5762
5935
|
}
|
|
5763
5936
|
|
|
5764
5937
|
async function refreshSupervisor(force = false) {
|
|
@@ -5920,16 +6093,22 @@ export function mount(root, options = {}) {
|
|
|
5920
6093
|
agentsCount.disabled = true;
|
|
5921
6094
|
return;
|
|
5922
6095
|
}
|
|
5923
|
-
const
|
|
6096
|
+
const identities = model.agents.length;
|
|
6097
|
+
const row = currentSupervisorRow();
|
|
6098
|
+
const workers = supervisorWorkerCount(row);
|
|
6099
|
+
const running = workers !== null ? workers : identities;
|
|
5924
6100
|
agentsCount.className = "hive-stat hive-agent-count";
|
|
5925
|
-
agentsCount.textContent = translate("pane.agents") + " " + String(
|
|
5926
|
-
const first =
|
|
6101
|
+
agentsCount.textContent = translate("pane.agents") + " " + String(running);
|
|
6102
|
+
const first = identities > 0 ? model.agents[0] : null;
|
|
5927
6103
|
agentsCount._agent = first;
|
|
5928
|
-
agentsCount.disabled =
|
|
5929
|
-
const message =
|
|
5930
|
-
|
|
5931
|
-
|
|
5932
|
-
|
|
6104
|
+
agentsCount.disabled = false;
|
|
6105
|
+
const message =
|
|
6106
|
+
workers !== null
|
|
6107
|
+
? translate("agents.runningTooltip")
|
|
6108
|
+
.replace("{running}", String(running))
|
|
6109
|
+
.replace("{identities}", String(identities))
|
|
6110
|
+
: translate("agents.fallbackTooltip").replace("{identities}", String(identities));
|
|
6111
|
+
const label = model.boardError ? message + " · " + model.boardError : message;
|
|
5933
6112
|
setAttr(agentsCount, "title", label);
|
|
5934
6113
|
setAttr(agentsCount, "aria-label", label);
|
|
5935
6114
|
}
|