hive-swarm 2.1.0 → 2.1.1
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/.codex-plugin/plugin.json +1 -1
- package/README.md +3 -3
- package/board.css +88 -34
- package/board.html +29 -5
- package/board.js +285 -28
- package/codex.mjs +28 -8
- package/core.mjs +114 -0
- package/hive-graph.js +23 -11
- package/package.json +1 -1
- package/server.mjs +16 -2
- package/skills/swarm/SKILL.md +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Hive Swarm
|
|
2
2
|
|
|
3
|
-
Version **2.1.
|
|
3
|
+
Version **2.1.1**. Coordinate dependent agent tasks with a shared board, outcome threads, live activity, owned journals, and message-flow graphs.
|
|
4
4
|
|
|
5
5
|
The core and Codex runtime use Node.js ESM, built-in SQLite, and **zero third-party runtime dependencies**. Required Node range: `^22.19.0 || >=24.2.0`.
|
|
6
6
|
|
|
7
|
-
Hive Swarm **2.1.
|
|
7
|
+
Hive Swarm **2.1.1** pairs `hive-swarm@2.1.1` (core + Codex) with `dsh-hive-swarm@2.1.1` (experimental native DeepSeek Harness `0.2.2-rc.5` bundle). Both tarballs are verified against their source artifacts before publication.
|
|
8
8
|
|
|
9
9
|
## Codex lifecycle
|
|
10
10
|
|
|
@@ -19,6 +19,6 @@ npx hive-swarm@latest uninstall --host codex
|
|
|
19
19
|
|
|
20
20
|
`npm install` only installs package files; it does not register a plugin. The explicit CLI creates an immutable persistent marketplace copy and delegates host changes to supported Codex CLI commands. Local switching/rollback is qualified for CLI `0.169.1`; other versions retain the stage unless `--allow-unqualified-cli` is explicitly passed. Active owned turns block replacement. Uninstall preserves databases, journals, and verified release copies. Doctor does not execute Codex by default or call models.
|
|
21
21
|
|
|
22
|
-
DSH uses the separate `dsh-hive-swarm` bundle and its own profile manager. Install the matching experimental `0.2.2-rc.5` bundle with `dsh plugin --profile desktop add dsh-hive-swarm@2.1.
|
|
22
|
+
DSH uses the separate `dsh-hive-swarm` bundle and its own profile manager. Install the matching experimental `0.2.2-rc.5` bundle with `dsh plugin --profile desktop add dsh-hive-swarm@2.1.1` (or `@next`). Release `2.1.1` brings an Antigravity-style Overview (task summary accordion, `goalLine`, `taskLabel`, outcome `threads` progress bars, and `Screenshots` timeline), uncluttered **Board** & click-to-open **Members** rows, lean Turn 2+ delta resume prompts, Dual-Mode **Graph** (**`Hive`** honeycomb + Goal-consolidated **`Mentions`** ring + zero-dependency **Export GIF**), dashboard version & cached update alerts, hidden native DSH subagents (`executionMode: 'subagent'`), and attached Codex `0.171+` child threads (`executionMode: 'attached'`). Its Windows shell retains the Host's partial confinement limits. `--host dsh` prints guidance without editing a DSH profile.
|
|
23
23
|
|
|
24
24
|
[Full documentation and high-resolution screenshots](https://github.com/snowmiku601-cpu/hive-swarm#see-it-in-action) · [Source and issue tracker](https://github.com/snowmiku601-cpu/hive-swarm) · MIT license
|
package/board.css
CHANGED
|
@@ -59,8 +59,18 @@ code {border-radius:4px;background:var(--raised);color:var(--gold);padding:1px 5
|
|
|
59
59
|
.mast-left {min-width:0;gap:10px}
|
|
60
60
|
.mast-actions {min-width:0;gap:10px;flex-wrap:wrap;justify-content:flex-end}
|
|
61
61
|
.member-pills {gap:6px;flex-wrap:wrap;justify-content:flex-end}
|
|
62
|
+
.brand-stack {display:flex;flex-direction:column;align-items:flex-start;gap:4px;min-width:0}
|
|
62
63
|
.brand {font-weight:680;font-size:12px;letter-spacing:.01em;background:var(--raised);border:1px solid var(--line);border-radius:999px;padding:3px 10px 3px 4px}
|
|
63
64
|
.brand strong {white-space:nowrap}
|
|
65
|
+
.version-tag {font:560 11px var(--mono);font-variant-numeric:tabular-nums;color:var(--muted);padding-left:6px;margin-left:2px;border-left:1px solid var(--line);white-space:nowrap}
|
|
66
|
+
.update-wrap {position:relative}
|
|
67
|
+
.update-pill {display:inline-flex;align-items:center;gap:4px;min-height:22px;padding:1px 8px;border-radius:999px;font-size:11px;font-weight:620;line-height:1.3;color:var(--gold);background:var(--wash);border:1px solid color-mix(in oklab,var(--gold-solid) 45%,var(--line));white-space:nowrap}
|
|
68
|
+
.update-pill:hover:not(:disabled) {background:color-mix(in oklab,var(--wash) 80%,var(--gold-solid) 14%);border-color:var(--gold-solid)}
|
|
69
|
+
.update-popover {position:absolute;top:calc(100% + 6px);left:0;z-index:40;width:min(310px,calc(100vw - 32px));padding:10px 12px;border-radius:10px;border:1px solid var(--line);background:var(--surface);box-shadow:0 12px 30px rgba(0,0,0,.28);display:grid;gap:8px}
|
|
70
|
+
.update-popover-head {display:flex;align-items:baseline;justify-content:space-between;gap:8px;font-size:12px}
|
|
71
|
+
.update-popover-head .mono {font-size:11px;color:var(--gold);font-weight:600}
|
|
72
|
+
.update-cmd {display:block;padding:6px 8px;border-radius:7px;background:var(--field);border:1px solid var(--line);color:var(--ink);font-size:11px;user-select:all}
|
|
73
|
+
.update-actions {display:flex;align-items:center;flex-wrap:wrap;gap:6px 12px;font-size:12px}
|
|
64
74
|
.team-picker {min-width:0;max-width:clamp(110px,28vw,230px)}
|
|
65
75
|
.team-picker select {min-width:0;text-overflow:ellipsis;min-height:30px;padding:4px 8px;font-size:12px}
|
|
66
76
|
.icon-button {min-width:32px;min-height:32px;padding:4px 7px;display:inline-grid;place-items:center;background:var(--field)}
|
|
@@ -98,6 +108,16 @@ h1 {font-size:clamp(16px,2.1vw,21px);font-weight:680;line-height:1.25;letter-spa
|
|
|
98
108
|
.panel {background:var(--surface);border:1px solid var(--line);border-radius:12px;min-width:0}
|
|
99
109
|
.board-grid {display:grid;grid-template-columns:minmax(0,1fr) minmax(236px,.42fr);gap:16px;align-items:start}
|
|
100
110
|
.bar {display:flex;gap:8px;align-items:center;padding:10px 14px;border-bottom:1px solid var(--line);background:color-mix(in oklab,var(--field) 65%,var(--surface))}
|
|
111
|
+
.board-bar {background:transparent;border-bottom:1px solid color-mix(in oklab,var(--line) 75%,transparent)}
|
|
112
|
+
.board-search {display:flex;align-items:center;gap:8px;min-width:0;flex:1;padding:0 12px;min-height:34px;border-radius:999px;border:1px solid var(--line);background:var(--field);color:var(--muted)}
|
|
113
|
+
.board-search:focus-within {border-color:var(--gold-solid);color:var(--ink)}
|
|
114
|
+
.board-search .search-icon {flex:none}
|
|
115
|
+
.board-search input {flex:1;min-width:0;border:0;background:transparent;padding:4px 0;min-height:28px;outline:none;color:var(--ink);font-size:13px}
|
|
116
|
+
.filter-toggle {position:relative;flex:none;width:34px;height:34px;min-height:34px;padding:0;display:inline-grid;place-items:center;border-radius:10px;border:1px solid transparent;background:transparent;color:var(--muted)}
|
|
117
|
+
.filter-toggle:hover:not(:disabled),.filter-toggle[aria-expanded=true] {background:var(--raised);border-color:var(--line);color:var(--ink)}
|
|
118
|
+
.filter-toggle[data-active=true]::after {content:"";position:absolute;top:5px;right:5px;width:6px;height:6px;border-radius:50%;background:var(--gold-solid)}
|
|
119
|
+
.board-filters[hidden] {display:none}
|
|
120
|
+
.board-filters {background:color-mix(in oklab,var(--field) 50%,var(--surface));flex-wrap:wrap}
|
|
101
121
|
.search {min-width:0;flex:1}
|
|
102
122
|
.bar select {width:auto;max-width:175px}
|
|
103
123
|
.bar button {white-space:nowrap}
|
|
@@ -106,17 +126,28 @@ h2 {font-size:14px;font-weight:660;letter-spacing:-.015em}
|
|
|
106
126
|
h3 {font-size:13px;font-weight:640}
|
|
107
127
|
.quiet {color:var(--muted);font-size:12px}
|
|
108
128
|
.minor {color:var(--faint);font:11px var(--mono);font-variant-numeric:tabular-nums}
|
|
109
|
-
.feed {
|
|
110
|
-
.
|
|
111
|
-
.post:
|
|
129
|
+
.feed-wrap {position:relative;min-width:0}
|
|
130
|
+
.feed {overflow:auto;scrollbar-gutter:stable;overscroll-behavior:contain;max-height:clamp(260px,55vh,620px);min-height:175px;padding:6px 8px;scrollbar-width:thin;scrollbar-color:var(--edge) transparent}
|
|
131
|
+
.post {display:grid;grid-template-columns:34px minmax(0,1fr);gap:12px;padding:11px 10px;border-radius:10px;transition:background-color 140ms ease}
|
|
132
|
+
.post:hover {background:color-mix(in oklab,var(--raised) 45%,transparent)}
|
|
112
133
|
.post.system {color:var(--muted);background:var(--field)}
|
|
113
134
|
.post.system .message {font-size:12px}
|
|
114
135
|
.post[data-kind=monitor],.post[data-kind=checkpoint] {border-left:3px solid var(--gold-solid);background:color-mix(in oklab,var(--wash) 70%,var(--surface))}
|
|
115
|
-
.post-
|
|
116
|
-
.post-
|
|
136
|
+
.post-avatar-btn {padding:0;border:0;background:transparent;min-height:0;border-radius:9px;cursor:pointer;align-self:start}
|
|
137
|
+
.post-avatar-btn:hover:not(:disabled) {filter:brightness(1.06);background:transparent}
|
|
138
|
+
.post-body {min-width:0;display:grid;gap:3px}
|
|
139
|
+
.post-top {display:flex;align-items:baseline;justify-content:space-between;flex-wrap:wrap;column-gap:8px;row-gap:3px}
|
|
140
|
+
.post-top > div {min-width:0;display:flex;gap:6px;align-items:baseline;flex-wrap:wrap}
|
|
117
141
|
.post-top strong,.member-name {overflow-wrap:anywhere}
|
|
118
|
-
.stamp {color:var(--faint);font:
|
|
119
|
-
.targets {color:var(--
|
|
142
|
+
.stamp {color:var(--faint);font:10.5px/1.65 var(--mono);font-variant-numeric:tabular-nums;white-space:nowrap}
|
|
143
|
+
.targets {color:var(--muted);font-size:12px;font-weight:500;overflow-wrap:anywhere}
|
|
144
|
+
.message {white-space:pre-wrap;overflow-wrap:anywhere;margin-top:2px;line-height:1.58}
|
|
145
|
+
.message[data-clamped=true] {max-height:132px;overflow:hidden;cursor:pointer;mask-image:linear-gradient(to bottom,#000 60%,transparent 100%);-webkit-mask-image:linear-gradient(to bottom,#000 60%,transparent 100%)}
|
|
146
|
+
.expand-post-btn {justify-self:start;padding:0;min-height:0;border:0;background:transparent;color:var(--gold);font-size:11.5px;font-weight:600;margin-top:2px}
|
|
147
|
+
.expand-post-btn:hover:not(:disabled) {text-decoration:underline;background:transparent}
|
|
148
|
+
.latest-pill {position:sticky;bottom:10px;float:right;margin:4px 10px 6px auto;z-index:2;min-height:28px;padding:3px 11px;border-radius:999px;border:1px solid var(--line);background:var(--surface);color:var(--ink);font-size:12px;font-weight:600;box-shadow:0 4px 14px rgb(0 0 0 / 22%)}
|
|
149
|
+
.latest-pill:hover:not(:disabled) {border-color:var(--gold-solid)}
|
|
150
|
+
.latest-pill[hidden] {display:none}
|
|
120
151
|
.message {white-space:pre-wrap;overflow-wrap:anywhere;margin-top:5px;line-height:1.58}
|
|
121
152
|
.message p+p {margin-top:7px}
|
|
122
153
|
.message :is(h3,h4,h5) {font-weight:700;margin:8px 0 3px}
|
|
@@ -148,14 +179,18 @@ ol.post-list {list-style:decimal}
|
|
|
148
179
|
.primary {background:var(--gold-solid);color:var(--on-gold);border-color:var(--gold-solid);font-weight:700;min-width:66px}
|
|
149
180
|
.primary:hover:not(:disabled) {filter:brightness(1.06);background:var(--gold-solid);border-color:var(--gold-solid)}
|
|
150
181
|
.side-list {padding:4px 14px}
|
|
151
|
-
.side-item {display:grid;grid-template-columns:34px minmax(0,1fr);align-items:center;gap:10px;padding:
|
|
182
|
+
.side-item {display:grid;grid-template-columns:34px minmax(0,1fr);align-items:center;gap:10px;padding:8px 6px;border-radius:8px;border-bottom:1px solid var(--line)}
|
|
152
183
|
.side-item:last-child {border:0}
|
|
184
|
+
.side-item[data-clickable=true] {cursor:pointer}
|
|
185
|
+
.side-item[data-clickable=true]:hover {background:var(--raised)}
|
|
153
186
|
.side-item strong {display:block;overflow-wrap:anywhere;font-size:12px}
|
|
154
187
|
.side-item small {color:var(--faint);font-size:11px}
|
|
155
188
|
.aside-total {padding:9px 14px;border-top:1px solid var(--line);font-size:12px;color:var(--muted)}
|
|
156
189
|
|
|
157
|
-
.bee-tile {width:36px;height:36px;background:var(--raised);box-shadow:inset 0 0 0 1px var(--line);border-radius:
|
|
158
|
-
.bee-tile.
|
|
190
|
+
.bee-tile {width:36px;height:36px;background:var(--tile-bg,var(--raised));box-shadow:inset 0 0 0 1px var(--tile-border,var(--line));border-radius:10px;display:inline-grid;place-items:center;flex:none;position:relative}
|
|
191
|
+
.bee-tile.coord-tile {background-color:#1a1c22;box-shadow:inset 0 0 0 1px rgb(255 255 255 / 14%);
|
|
192
|
+
background-image:radial-gradient(circle at 50% 42%,rgb(246 188 85 / 18%),transparent 70%),repeating-linear-gradient(60deg,rgb(255 255 255 / 4%) 0 1px,transparent 1px 12px)}
|
|
193
|
+
.bee-tile.compact {width:32px;height:32px;border-radius:8px}
|
|
159
194
|
.bee-tile.brand-tile {width:24px;height:24px;border-radius:999px;background:var(--wash);box-shadow:none}
|
|
160
195
|
.bee-tile .bee-pixel {display:block;width:27px;height:24px;image-rendering:pixelated}
|
|
161
196
|
.bee-tile.compact .bee-pixel {width:24px;height:22px}
|
|
@@ -277,35 +312,54 @@ button.bee-pill:hover:not(:disabled) {border-color:var(--gold-solid);background:
|
|
|
277
312
|
.live-steps {display:grid;gap:2px;color:var(--muted);font-size:11px}
|
|
278
313
|
.live-draft {margin:4px 0 0;max-height:72px;overflow:auto;overscroll-behavior:contain;white-space:pre-wrap;overflow-wrap:anywhere;background:var(--field);border-radius:6px;padding:6px 8px;font:11px/1.45 var(--mono)}
|
|
279
314
|
|
|
280
|
-
/* Members tab */
|
|
281
|
-
.member-bar {border-bottom:0;padding:0 0
|
|
282
|
-
.member-bar
|
|
283
|
-
.roster-groups {display:grid;gap:
|
|
284
|
-
.roster-group {padding:
|
|
285
|
-
|
|
286
|
-
.
|
|
287
|
-
.member-
|
|
288
|
-
.member-card
|
|
289
|
-
.member-card
|
|
290
|
-
.member-
|
|
291
|
-
.member-
|
|
292
|
-
.
|
|
293
|
-
.
|
|
294
|
-
.
|
|
315
|
+
/* Members tab (Antigravity clean flat clickable list) */
|
|
316
|
+
.member-bar {border-bottom:0;padding:0 0 10px;background:transparent}
|
|
317
|
+
.member-bar .board-search {max-width:none}
|
|
318
|
+
.roster-groups {display:grid;gap:4px}
|
|
319
|
+
.roster-group {padding:2px 0;background:transparent;border:0;border-radius:0}
|
|
320
|
+
#coordinator-group > h2 {position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
|
|
321
|
+
.roster-group h2,.retired summary {color:var(--muted);font-size:11px;font-weight:680;letter-spacing:.04em;text-transform:uppercase;margin:8px 0 4px;padding-inline:10px}
|
|
322
|
+
.member-list {display:grid;gap:2px}
|
|
323
|
+
.member-card {display:grid;grid-template-columns:38px minmax(0,1fr);gap:12px;padding:9px 10px;background:transparent;border:1px solid transparent;border-radius:10px;transition:background-color 140ms ease}
|
|
324
|
+
.member-card[data-clickable=true] {cursor:pointer}
|
|
325
|
+
.member-card:hover,.member-card[data-menu-open=true] {background:var(--raised)}
|
|
326
|
+
.member-card[data-status=retired] {opacity:.74}
|
|
327
|
+
.member-main {min-width:0;display:grid;gap:3px}
|
|
328
|
+
.member-top {display:flex;align-items:center;justify-content:space-between;flex-wrap:nowrap;gap:8px;min-width:0}
|
|
329
|
+
.member-ident {display:flex;align-items:baseline;gap:7px;min-width:0;flex:1 1 auto}
|
|
330
|
+
.member-name {font-weight:700;flex:none}
|
|
331
|
+
.member-task {color:var(--muted);font-size:12.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
|
|
332
|
+
.member-meta {display:inline-flex;align-items:center;gap:6px;flex:none}
|
|
333
|
+
.member-pills {display:inline-flex;align-items:center;gap:5px}
|
|
334
|
+
.mode-badge {display:inline-flex;align-items:center;padding:0 6px;border-radius:999px;border:0;background:color-mix(in oklab,var(--raised) 80%,var(--field));color:var(--muted);font:580 10px/1.6 var(--mono);letter-spacing:.01em;white-space:nowrap}
|
|
335
|
+
.mode-badge[data-mode=subagent] {color:var(--gold);background:var(--wash)}
|
|
336
|
+
.mode-badge[data-mode=attached] {color:var(--sleep);background:color-mix(in oklab,var(--sleep) 10%,var(--field))}
|
|
295
337
|
.status-word {display:inline-flex;align-items:center;gap:5px;padding:1px 7px;border-radius:999px;border:1px solid var(--line);background:var(--field);color:var(--muted);font-size:11px;font-weight:600;white-space:nowrap}
|
|
338
|
+
.status-word[data-status=done],.status-word[data-status=waiting],.status-word[data-status=queued],.status-word[data-status=retired],.status-word[data-status=observer] {display:none}
|
|
296
339
|
.status-word[data-status=working] {color:var(--good);border-color:color-mix(in oklab,var(--good) 40%,var(--line));background:color-mix(in oklab,var(--good) 10%,var(--field))}
|
|
297
|
-
.status-word[data-status=waiting] {color:var(--sleep);border-color:color-mix(in oklab,var(--sleep) 35%,var(--line))}
|
|
298
340
|
.status-word[data-status=failed] {color:var(--bad);border-color:color-mix(in oklab,var(--bad) 45%,var(--line));background:color-mix(in oklab,var(--bad) 10%,var(--field))}
|
|
299
341
|
.status-word[data-status=quota] {color:var(--gold);border-color:color-mix(in oklab,var(--gold-solid) 55%,var(--line));background:var(--wash)}
|
|
300
|
-
.member-context {margin-top:
|
|
301
|
-
.member-
|
|
302
|
-
.member-
|
|
303
|
-
.member-
|
|
304
|
-
.
|
|
342
|
+
.member-context {margin-top:0;max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
343
|
+
.member-menu-btn {min-height:24px;min-width:24px;padding:0 5px;border:0;border-radius:6px;background:transparent;color:var(--muted);font-size:14px;line-height:1;opacity:.42}
|
|
344
|
+
.member-card:hover .member-menu-btn,.member-card:focus-within .member-menu-btn,.member-card[data-menu-open=true] .member-menu-btn {opacity:1}
|
|
345
|
+
.member-menu-btn:hover:not(:disabled),.member-menu-btn[aria-expanded=true] {background:var(--surface);color:var(--ink)}
|
|
346
|
+
.member-summary {margin-top:1px;color:var(--muted);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;line-clamp:2;overflow:clip;font-size:12.5px}
|
|
347
|
+
.member-chips {display:flex;flex-wrap:wrap;align-items:center;gap:5px;margin-top:1px}
|
|
348
|
+
.member-path,.member-chip {display:inline-flex;align-items:center;max-width:min(100%,380px);margin-top:0;padding:1px 8px;border-radius:999px;border:1px solid var(--line);background:var(--field);color:var(--muted);font-size:10.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
349
|
+
.member-path {direction:rtl;text-align:left}
|
|
350
|
+
.member-chip[data-tone=wait] {color:var(--sleep);border-color:color-mix(in oklab,var(--sleep) 36%,var(--line))}
|
|
351
|
+
.member-card:not([data-menu-open=true]) > .member-main > .member-actions,
|
|
352
|
+
.member-card:not([data-menu-open=true]) > .member-main > .model-editor {display:none}
|
|
353
|
+
.member-card[data-recovery=true] > .member-main > .member-actions {display:flex}
|
|
354
|
+
.member-actions {display:flex;flex-wrap:wrap;gap:4px 12px;margin-top:6px;padding-top:6px;border-top:1px solid var(--line);font-size:11px}
|
|
355
|
+
.link-button {padding:0;color:var(--gold);background:none;border:0;border-radius:2px;text-decoration:underline;text-underline-offset:3px;font-size:11px;min-height:22px}
|
|
305
356
|
.link-button:hover:not(:disabled) {background:none;border-color:transparent;opacity:.86}
|
|
306
|
-
.retired {padding:
|
|
307
|
-
.retired summary {cursor:pointer;margin:0}
|
|
308
|
-
.retired
|
|
357
|
+
.retired {padding:8px 0 0;margin-top:4px;background:transparent;border:0;border-top:1px solid var(--line);border-radius:0}
|
|
358
|
+
.retired summary {cursor:pointer;margin:0;display:flex;align-items:center;justify-content:space-between;width:100%;list-style:none}
|
|
359
|
+
.retired summary::-webkit-details-marker {display:none}
|
|
360
|
+
.retired summary::after {content:"";width:7px;height:7px;border-right:1.6px solid currentColor;border-bottom:1.6px solid currentColor;transform:rotate(-45deg);transition:transform 140ms ease;margin-right:4px}
|
|
361
|
+
.retired[open] summary {margin-bottom:4px}
|
|
362
|
+
.retired[open] summary::after {transform:rotate(45deg)}
|
|
309
363
|
.needs-you {color:var(--gold);background:var(--surface);border:1px solid color-mix(in oklab,var(--gold-solid) 55%,var(--line));border-radius:999px;padding:1px 8px;font-size:11px;white-space:nowrap}
|
|
310
364
|
.needs-reason {color:var(--ink);font-size:12px;margin-top:6px;overflow-wrap:anywhere}
|
|
311
365
|
.member-live {margin-top:6px}
|
package/board.html
CHANGED
|
@@ -12,7 +12,25 @@
|
|
|
12
12
|
<header class="masthead">
|
|
13
13
|
<div class="mast-row">
|
|
14
14
|
<div class="mast-left">
|
|
15
|
-
<div class="brand
|
|
15
|
+
<div class="brand-stack">
|
|
16
|
+
<div class="brand"><span id="brand-bee" class="bee-tile brand-tile"></span><strong>Swarm</strong><span id="app-version" class="version-tag" hidden></span></div>
|
|
17
|
+
<div id="update-wrap" class="update-wrap" hidden>
|
|
18
|
+
<button id="update-pill" class="update-pill" type="button" aria-expanded="false"></button>
|
|
19
|
+
<div id="update-popover" class="update-popover" role="region" aria-label="Update available" hidden>
|
|
20
|
+
<div class="update-popover-head">
|
|
21
|
+
<strong>Update available</strong>
|
|
22
|
+
<span id="update-diff" class="mono"></span>
|
|
23
|
+
</div>
|
|
24
|
+
<p class="quiet">Close Codex after active turns finish, then run:</p>
|
|
25
|
+
<code id="update-cmd" class="update-cmd"></code>
|
|
26
|
+
<div class="update-actions">
|
|
27
|
+
<button id="update-copy" class="link-button" type="button">Copy command</button>
|
|
28
|
+
<a id="update-link" href="#" target="_blank" rel="noopener noreferrer">Release notes</a>
|
|
29
|
+
<button id="update-dismiss" class="link-button" type="button">Dismiss</button>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
16
34
|
<label id="team-picker" class="team-picker" hidden><span class="sr-only">Recent swarms</span><select id="recent-teams"></select></label>
|
|
17
35
|
</div>
|
|
18
36
|
<div class="mast-actions">
|
|
@@ -125,15 +143,21 @@
|
|
|
125
143
|
</section>
|
|
126
144
|
<div class="board-grid">
|
|
127
145
|
<div class="panel">
|
|
128
|
-
<div class="bar">
|
|
129
|
-
<label class="search"><span class="sr-only">Search posts</span><input id="search-posts" type="search" placeholder="Search
|
|
146
|
+
<div class="bar board-bar">
|
|
147
|
+
<label class="search board-search"><svg class="search-icon" width="14" height="14" viewBox="0 0 16 16" fill="none" aria-hidden="true"><circle cx="7" cy="7" r="4.5" stroke="currentColor" stroke-width="1.4"/><path d="M10.5 10.5L13.5 13.5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/></svg><span class="sr-only">Search posts</span><input id="search-posts" type="search" placeholder="Search"></label>
|
|
148
|
+
<button id="toggle-board-filters" class="filter-toggle" type="button" aria-label="Toggle board filters" aria-expanded="false"><svg width="14" height="14" viewBox="0 0 16 16" fill="none" aria-hidden="true"><path d="M2.5 3.5h11l-4.2 5v3.7l-2.6 1.3V8.5l-4.2-5Z" stroke="currentColor" stroke-width="1.4" stroke-linejoin="round"/></svg></button>
|
|
149
|
+
</div>
|
|
150
|
+
<div id="board-filters" class="bar board-filters" hidden>
|
|
130
151
|
<label class="sr-only" for="member-filter">Filter by member</label>
|
|
131
152
|
<select id="member-filter"><option value="">All members</option></select>
|
|
132
153
|
<label class="sr-only" for="channel-filter">Board channel</label>
|
|
133
154
|
<select id="channel-filter"><option value="">All channels</option></select>
|
|
134
155
|
<button id="follow" type="button" aria-pressed="true">Follow</button>
|
|
135
156
|
</div>
|
|
136
|
-
<
|
|
157
|
+
<div class="feed-wrap">
|
|
158
|
+
<ol id="feed" class="feed" tabindex="0" aria-label="Posts in chronological order"></ol>
|
|
159
|
+
<button id="board-latest" class="latest-pill" type="button" aria-label="Jump to latest posts" hidden>↓ Latest</button>
|
|
160
|
+
</div>
|
|
137
161
|
<form id="compose" class="composer">
|
|
138
162
|
<label class="sr-only" for="message">Message text</label>
|
|
139
163
|
<textarea id="message" maxlength="6000" placeholder="Send a message or @mention a member" required></textarea>
|
|
@@ -152,7 +176,7 @@
|
|
|
152
176
|
</div>
|
|
153
177
|
</section>
|
|
154
178
|
<section id="panel-members" role="tabpanel" aria-labelledby="tab-members" hidden>
|
|
155
|
-
<div class="bar member-bar"><label class="search"><span class="sr-only">Search members</span><input id="search-members" type="search" placeholder="Search
|
|
179
|
+
<div class="bar member-bar"><label class="search board-search"><svg class="search-icon" width="14" height="14" viewBox="0 0 16 16" fill="none" aria-hidden="true"><circle cx="7" cy="7" r="4.5" stroke="currentColor" stroke-width="1.4"/><path d="M10.5 10.5L13.5 13.5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/></svg><span class="sr-only">Search members</span><input id="search-members" type="search" placeholder="Search members"></label></div>
|
|
156
180
|
<div class="roster-groups">
|
|
157
181
|
<section id="coordinator-group" class="panel roster-group" hidden><h2>Coordinator</h2><ul id="coordinator-list" class="member-list"></ul></section>
|
|
158
182
|
<section id="working-group" class="panel roster-group" hidden><h2 id="working-title">Working</h2><ul id="working-list" class="member-list"></ul></section>
|
package/board.js
CHANGED
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
const emptyPanel=standalone && location.pathname==='/swarm';
|
|
7
7
|
const tabs=['overview','board','members','graph'];
|
|
8
8
|
const GRAPH_MODE_KEY='hive-swarm-graph-mode';
|
|
9
|
+
const DISMISSED_UPDATE_KEY='hive-swarm-dismissed-update';
|
|
10
|
+
const SEMVER_RE=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
|
|
11
|
+
const CODEX_UPDATE_CMD='npx hive-swarm@latest update --host codex --after-close';
|
|
9
12
|
const states={queued:'Queued',working:'Working',waiting:'Waiting',done:'Done',failed:'Failed',
|
|
10
13
|
quota:'Quota limit',retired:'Retired',observer:'Observer'};
|
|
11
14
|
const executionModes={subagent:'Subagent',attached:'Attached',session:'Session'};
|
|
@@ -27,6 +30,8 @@
|
|
|
27
30
|
let stream,streamOnline=false,modelCatalog,titleEditing=false,transcript,lightbox,extendingBudget=false;
|
|
28
31
|
let requestNumber=0,refreshTimer,playTimer,playing=false,cursor=null,focusedNode=null,graphFrame=0;
|
|
29
32
|
let graphMode=loadGraphMode(),exportingGif=false;
|
|
33
|
+
let appVersion=typeof globalThis.__HIVE_SWARM_VERSION__==='string'?globalThis.__HIVE_SWARM_VERSION__.trim():'';
|
|
34
|
+
let updateInfo=null,updateOpen=false;
|
|
30
35
|
|
|
31
36
|
function loadGraphMode() {
|
|
32
37
|
try {
|
|
@@ -204,11 +209,30 @@
|
|
|
204
209
|
});
|
|
205
210
|
}
|
|
206
211
|
function bee(member,compact=false) {
|
|
207
|
-
const
|
|
208
|
-
tile
|
|
209
|
-
tile.
|
|
212
|
+
const isCoord=member?.role==='coordinator'||member?.name==='coordinator';
|
|
213
|
+
const tile=node('span','bee-tile'+(compact?' compact':'')+(isCoord?' coord-tile':''));
|
|
214
|
+
tile.dataset.status=member?.status??'observer';
|
|
215
|
+
if (!isCoord && member?.name && member.name!=='system') {
|
|
216
|
+
const palette=beeTint(member);
|
|
217
|
+
if (tile.style?.setProperty) {
|
|
218
|
+
tile.style.setProperty('--tile-bg',palette.bg);
|
|
219
|
+
tile.style.setProperty('--tile-border',palette.border);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
const muted=!isCoord&&['done','retired'].includes(member?.status);
|
|
223
|
+
tile.append(beeSprite(member,{muted}));
|
|
210
224
|
return tile;
|
|
211
225
|
}
|
|
226
|
+
function openMemberTarget(member,opener) {
|
|
227
|
+
const url=chatUrl(member?.threadId);
|
|
228
|
+
if (!url) return false;
|
|
229
|
+
if (!standalone) {
|
|
230
|
+
rpc('ui/open-link',{url}).catch(error=>notice(error.message,true));
|
|
231
|
+
return true;
|
|
232
|
+
}
|
|
233
|
+
openTranscript(member,opener);
|
|
234
|
+
return true;
|
|
235
|
+
}
|
|
212
236
|
function beeTint(member) {
|
|
213
237
|
if (typeof HiveBee?.tintStyle==='function') {
|
|
214
238
|
return HiveBee.tintStyle(member.name,member.role==='coordinator',member.tint);
|
|
@@ -301,8 +325,71 @@
|
|
|
301
325
|
return changed;
|
|
302
326
|
}
|
|
303
327
|
|
|
328
|
+
function renderVersionTag(value=appVersion) {
|
|
329
|
+
const clean=typeof value==='string'?value.trim():'';
|
|
330
|
+
if (!clean) return;
|
|
331
|
+
appVersion=clean;
|
|
332
|
+
const tag=$('app-version');
|
|
333
|
+
if (!tag) return;
|
|
334
|
+
tag.textContent='v'+clean;
|
|
335
|
+
tag.title='Hive Swarm v'+clean;
|
|
336
|
+
tag.hidden=false;
|
|
337
|
+
}
|
|
338
|
+
function safeReleaseUrl(candidate,versionTag) {
|
|
339
|
+
for (const raw of [candidate,'https://github.com/snowmiku601-cpu/hive-swarm/releases/tag/v'+versionTag]) {
|
|
340
|
+
if (typeof raw!=='string'||!raw) continue;
|
|
341
|
+
try {
|
|
342
|
+
const parsed=new URL(raw);
|
|
343
|
+
if (parsed.protocol==='https:'||parsed.protocol==='http:') return parsed.href;
|
|
344
|
+
} catch {}
|
|
345
|
+
}
|
|
346
|
+
return 'https://github.com/snowmiku601-cpu/hive-swarm/releases';
|
|
347
|
+
}
|
|
348
|
+
function isDismissedUpdate(latest) {
|
|
349
|
+
try {return globalThis.localStorage?.getItem?.(DISMISSED_UPDATE_KEY)===latest;}
|
|
350
|
+
catch {return false;}
|
|
351
|
+
}
|
|
352
|
+
function renderUpdateBadge() {
|
|
353
|
+
const wrap=$('update-wrap'),pill=$('update-pill'),popover=$('update-popover');
|
|
354
|
+
if (!wrap||!pill||!popover) return;
|
|
355
|
+
const latest=typeof updateInfo?.latest==='string'?updateInfo.latest.trim():'';
|
|
356
|
+
const show=Boolean(updateInfo?.available===true&&latest&&SEMVER_RE.test(latest)&&!isDismissedUpdate(latest));
|
|
357
|
+
wrap.hidden=!show;
|
|
358
|
+
if (!show) {
|
|
359
|
+
updateOpen=false;
|
|
360
|
+
popover.hidden=true;
|
|
361
|
+
pill.setAttribute('aria-expanded','false');
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
if (updateInfo?.current&&!appVersion) renderVersionTag(updateInfo.current);
|
|
365
|
+
const current=appVersion||(typeof updateInfo?.current==='string'?updateInfo.current.trim():'');
|
|
366
|
+
pill.textContent='↑ v'+latest+' available';
|
|
367
|
+
pill.title='Hive Swarm v'+latest+' is available on npm';
|
|
368
|
+
pill.setAttribute('aria-expanded',String(updateOpen));
|
|
369
|
+
$('update-diff').textContent=current?'v'+current+' → v'+latest:'v'+latest;
|
|
370
|
+
$('update-cmd').textContent=CODEX_UPDATE_CMD;
|
|
371
|
+
$('update-link').href=safeReleaseUrl(updateInfo?.url,latest);
|
|
372
|
+
popover.hidden=!updateOpen;
|
|
373
|
+
}
|
|
374
|
+
async function checkForUpdate() {
|
|
375
|
+
if (!standalone||typeof fetch!=='function') return;
|
|
376
|
+
try {
|
|
377
|
+
const response=await fetch('/swarm/update',{cache:'no-store'});
|
|
378
|
+
if (!response?.ok) return;
|
|
379
|
+
const data=await response.json();
|
|
380
|
+
if (!data||typeof data.available!=='boolean') return;
|
|
381
|
+
if (typeof data.current==='string'&&!appVersion) renderVersionTag(data.current);
|
|
382
|
+
updateInfo=data;
|
|
383
|
+
renderUpdateBadge();
|
|
384
|
+
} catch {}
|
|
385
|
+
}
|
|
386
|
+
|
|
304
387
|
function acceptStatus(value) {
|
|
305
388
|
if (!value?.id || !Array.isArray(value.members)) return;
|
|
389
|
+
if (value.update && typeof value.update.available==='boolean') {
|
|
390
|
+
updateInfo=value.update;
|
|
391
|
+
renderUpdateBadge();
|
|
392
|
+
}
|
|
306
393
|
if (team?.id && team.id!==value.id) {
|
|
307
394
|
if (transcript) closeTranscript();
|
|
308
395
|
if (lightbox) closeLightbox();
|
|
@@ -386,6 +473,11 @@
|
|
|
386
473
|
const details=node('div');
|
|
387
474
|
details.append(node('strong','',author(member.name)),node('small','',condition(member)));
|
|
388
475
|
item.append(bee(member,true),details);
|
|
476
|
+
if (chatUrl(member.threadId)) {
|
|
477
|
+
item.dataset.clickable='true';
|
|
478
|
+
item.title='Open '+author(member.name);
|
|
479
|
+
item.onclick=()=>openMemberTarget(member,item);
|
|
480
|
+
}
|
|
389
481
|
return item;
|
|
390
482
|
}));
|
|
391
483
|
const retired=roster.length-live.length;
|
|
@@ -407,11 +499,19 @@
|
|
|
407
499
|
return {filter,channel,query,matching};
|
|
408
500
|
}
|
|
409
501
|
|
|
502
|
+
function syncBoardChrome() {
|
|
503
|
+
const activeFilter=Boolean($('member-filter').value||$('channel-filter').value||!following);
|
|
504
|
+
$('toggle-board-filters').dataset.active=String(activeFilter);
|
|
505
|
+
const feed=$('feed');
|
|
506
|
+
const away=(feed.scrollHeight-feed.scrollTop-feed.clientHeight)>48;
|
|
507
|
+
$('board-latest').hidden=(following&&!away)||!feed.children?.length;
|
|
508
|
+
}
|
|
509
|
+
|
|
410
510
|
function renderFeed(roster=people()) {
|
|
411
511
|
const {filter,channel,query,matching}=matchingPosts();
|
|
412
512
|
if (following) seen=chronology.at(-1)?.seq??0;
|
|
413
513
|
const key=JSON.stringify([team.id,filter,channel,query,following,feedLimit,matching.map(event=>event.seq)]);
|
|
414
|
-
if (key===feedKey) return;
|
|
514
|
+
if (key===feedKey) {syncBoardChrome();return;}
|
|
415
515
|
feedKey=key;
|
|
416
516
|
const feed=$('feed');
|
|
417
517
|
const scroll=feed.scrollTop;
|
|
@@ -441,19 +541,52 @@
|
|
|
441
541
|
const line=node('div','post-top');
|
|
442
542
|
const who=node('div');
|
|
443
543
|
who.append(node('strong','',author(event.author)));
|
|
444
|
-
if (event.channel&&event.channel!=='main') who.append(node('span','channel-tag','#'+event.channel));
|
|
445
544
|
if (event.targets?.length) who.append(node('span','targets','→ '+event.targets.map(author).join(' ')));
|
|
545
|
+
if (event.channel&&event.channel!=='main') who.append(node('span','channel-tag','#'+event.channel));
|
|
446
546
|
line.append(who,node('span','stamp',stamp(event)));
|
|
447
|
-
const content=node('div');
|
|
547
|
+
const content=node('div','post-body');
|
|
448
548
|
const message=node('div','message');
|
|
449
549
|
richText(message,event.text);
|
|
450
550
|
content.append(line,message);
|
|
451
|
-
|
|
551
|
+
const rawText=String(event.text??'');
|
|
552
|
+
if (rawText.length>360||rawText.split(/\r?\n/).length>6) {
|
|
553
|
+
message.dataset.clamped='true';
|
|
554
|
+
const more=node('button','expand-post-btn','Show more');
|
|
555
|
+
more.type='button';
|
|
556
|
+
more.setAttribute('aria-expanded','false');
|
|
557
|
+
const toggle=()=>{
|
|
558
|
+
const expand=message.dataset.clamped==='true';
|
|
559
|
+
message.dataset.clamped=expand?'false':'true';
|
|
560
|
+
more.textContent=expand?'Show less':'Show more';
|
|
561
|
+
more.setAttribute('aria-expanded',String(expand));
|
|
562
|
+
};
|
|
563
|
+
more.onclick=toggle;
|
|
564
|
+
message.onclick=ev=>{
|
|
565
|
+
if (message.dataset.clamped!=='true') return;
|
|
566
|
+
if (ev?.target?.closest?.('a, button, code, pre')) return;
|
|
567
|
+
if (globalThis.getSelection?.()?.toString?.()) return;
|
|
568
|
+
toggle();
|
|
569
|
+
};
|
|
570
|
+
content.append(more);
|
|
571
|
+
}
|
|
572
|
+
const tile=bee(member,true);
|
|
573
|
+
let avatar=tile;
|
|
574
|
+
if (chatUrl(member.threadId)) {
|
|
575
|
+
const avatarBtn=node('button','post-avatar-btn');
|
|
576
|
+
avatarBtn.type='button';
|
|
577
|
+
avatarBtn.setAttribute('aria-label','Open '+author(member.name)+' session');
|
|
578
|
+
avatarBtn.title='Open '+author(member.name);
|
|
579
|
+
avatarBtn.onclick=()=>openMemberTarget(member,avatarBtn);
|
|
580
|
+
avatarBtn.append(tile);
|
|
581
|
+
avatar=avatarBtn;
|
|
582
|
+
}
|
|
583
|
+
entry.append(avatar,content);
|
|
452
584
|
items.push(entry);
|
|
453
585
|
}
|
|
454
586
|
if (!items.length) items.push(node('li','empty',query||filter||channel?'No matching posts.':'No posts yet.'));
|
|
455
587
|
feed.replaceChildren(...items);
|
|
456
588
|
feed.scrollTop=following?feed.scrollHeight:scroll;
|
|
589
|
+
syncBoardChrome();
|
|
457
590
|
}
|
|
458
591
|
|
|
459
592
|
async function jumpToPost(seq) {
|
|
@@ -1097,18 +1230,59 @@
|
|
|
1097
1230
|
}
|
|
1098
1231
|
|
|
1099
1232
|
function memberCard(member) {
|
|
1100
|
-
const
|
|
1101
|
-
const
|
|
1233
|
+
const isCoord=member.role==='coordinator'||member.name==='coordinator';
|
|
1234
|
+
const card=node('li','member-card'+(isCoord?' coordinator':''));
|
|
1235
|
+
card.dataset.status=member.status??'observer';
|
|
1236
|
+
const draft=memberDrafts.get(member.name)??{};
|
|
1237
|
+
card.dataset.menuOpen=draft.open||draft.confirmRetire?'true':'false';
|
|
1238
|
+
if (member.recoveryRequired) card.dataset.recovery='true';
|
|
1239
|
+
const canNav=Boolean(chatUrl(member.threadId));
|
|
1240
|
+
if (canNav) {
|
|
1241
|
+
card.dataset.clickable='true';
|
|
1242
|
+
card.tabIndex=0;
|
|
1243
|
+
card.title='Open '+author(member.name);
|
|
1244
|
+
card.onclick=event=>{
|
|
1245
|
+
if (event?.target?.closest?.('a, button, summary, details, input, select, textarea')) return;
|
|
1246
|
+
if (globalThis.getSelection?.()?.toString?.()) return;
|
|
1247
|
+
openMemberTarget(member,card);
|
|
1248
|
+
};
|
|
1249
|
+
card.onkeydown=event=>{
|
|
1250
|
+
if (event.target===card&&(event.key==='Enter'||event.key===' ')) {
|
|
1251
|
+
event.preventDefault();
|
|
1252
|
+
openMemberTarget(member,card);
|
|
1253
|
+
}
|
|
1254
|
+
};
|
|
1255
|
+
}
|
|
1256
|
+
const info=node('div','member-main');
|
|
1102
1257
|
const line=node('div','member-top');
|
|
1258
|
+
const ident=node('div','member-ident');
|
|
1259
|
+
const subtitle=isCoord?'Coordinator':smartTaskLabel(member);
|
|
1260
|
+
ident.append(node('h3','member-name',author(member.name)),node('span','member-task',subtitle));
|
|
1261
|
+
const last=latestByAuthor.get(member.name);
|
|
1262
|
+
const meta=node('div','member-meta');
|
|
1103
1263
|
const badge=node('span','status-word',condition(member));
|
|
1104
1264
|
badge.dataset.status=member.status;
|
|
1105
1265
|
const mode=modeBadge(member);
|
|
1106
1266
|
const pills=node('span','member-pills');
|
|
1107
1267
|
if (mode) pills.append(mode);
|
|
1108
1268
|
pills.append(badge);
|
|
1109
|
-
|
|
1269
|
+
const modelInfo=[member.model,member.effort,last?'#'+last.seq:''].filter(Boolean).join(' · ');
|
|
1270
|
+
meta.append(pills);
|
|
1271
|
+
if (modelInfo) meta.append(node('span','minor member-context',modelInfo));
|
|
1272
|
+
const menuBtn=node('button','member-menu-btn','⋯');
|
|
1273
|
+
menuBtn.type='button';
|
|
1274
|
+
menuBtn.setAttribute('aria-label','More actions for '+author(member.name));
|
|
1275
|
+
menuBtn.setAttribute('aria-expanded',String(card.dataset.menuOpen==='true'));
|
|
1276
|
+
menuBtn.onclick=event=>{
|
|
1277
|
+
event?.stopPropagation?.();
|
|
1278
|
+
const opening=card.dataset.menuOpen!=='true';
|
|
1279
|
+
card.dataset.menuOpen=opening?'true':'false';
|
|
1280
|
+
menuBtn.setAttribute('aria-expanded',String(opening));
|
|
1281
|
+
};
|
|
1282
|
+
meta.append(menuBtn);
|
|
1283
|
+
line.append(ident,meta);
|
|
1110
1284
|
info.append(line);
|
|
1111
|
-
if (
|
|
1285
|
+
if (isCoord&&['stalled','budget'].includes(team.phase)) {
|
|
1112
1286
|
card.dataset.needsYou='true';
|
|
1113
1287
|
line.append(node('strong','needs-you','Needs you'));
|
|
1114
1288
|
const alerts=attentionItems();
|
|
@@ -1116,23 +1290,34 @@
|
|
|
1116
1290
|
alerts.find(issue=>issue.kind!=='worktree'))?.text);
|
|
1117
1291
|
info.append(reason);
|
|
1118
1292
|
}
|
|
1119
|
-
const
|
|
1120
|
-
const
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1293
|
+
const waiting=member.pendingWaitFor??member.waitFor;
|
|
1294
|
+
const hasChips=Boolean(member.workspace||member.worktree||member.group||member.channels?.length||member.addedBy||waiting?.length);
|
|
1295
|
+
if (hasChips) {
|
|
1296
|
+
const chips=node('div','member-chips');
|
|
1297
|
+
if (member.workspace) {
|
|
1298
|
+
const pathEl=node('code','member-path',member.workspace.cwd);
|
|
1299
|
+
pathEl.title=member.workspace.cwd;
|
|
1300
|
+
chips.append(pathEl);
|
|
1301
|
+
} else if (member.worktree) chips.append(node('span','member-chip','Worktree on turn 1'));
|
|
1302
|
+
if (member.group) chips.append(node('span','member-chip','@'+member.group));
|
|
1303
|
+
if (member.channels?.length) chips.append(node('span','member-chip',member.channels.map(c=>'#'+c).join(' ')));
|
|
1304
|
+
if (member.addedBy) chips.append(node('span','member-chip','Invited by '+author(member.addedBy)));
|
|
1305
|
+
if (waiting?.length) {
|
|
1306
|
+
const waitChip=node('span','member-chip','Waiting on '+waiting.map(author).join(', '));
|
|
1307
|
+
waitChip.dataset.tone='wait';
|
|
1308
|
+
chips.append(waitChip);
|
|
1309
|
+
}
|
|
1310
|
+
info.append(chips);
|
|
1311
|
+
}
|
|
1124
1312
|
const detail=last?.text??member.brief;
|
|
1125
1313
|
if (detail) {
|
|
1126
1314
|
const summary=node('p','member-summary',detail);
|
|
1127
1315
|
summary.title=detail;
|
|
1128
1316
|
info.append(summary);
|
|
1129
1317
|
}
|
|
1130
|
-
const waiting=member.pendingWaitFor??member.waitFor;
|
|
1131
|
-
if (waiting?.length) info.append(node('p','quiet','Waiting on '+waiting.map(author).join(', ')));
|
|
1132
1318
|
if (member.recoveryRequired) info.append(node('p','needs-reason','Outcome unconfirmed. Inspect journal, then retry or dismiss.'));
|
|
1133
|
-
if (member.workspace) info.append(node('code','member-path',member.workspace.cwd));
|
|
1134
|
-
else if (member.worktree) info.append(node('p','quiet','Isolated worktree on first turn'));
|
|
1135
1319
|
const actions=node('div','member-actions');
|
|
1320
|
+
actions.onclick=event=>event?.stopPropagation?.();
|
|
1136
1321
|
let modelControl;
|
|
1137
1322
|
const url=chatUrl(member.threadId);
|
|
1138
1323
|
if (url) {
|
|
@@ -1140,8 +1325,10 @@
|
|
|
1140
1325
|
link.href=url;
|
|
1141
1326
|
if (!standalone) link.onclick=event=>{
|
|
1142
1327
|
event.preventDefault();
|
|
1328
|
+
event?.stopPropagation?.();
|
|
1143
1329
|
rpc('ui/open-link',{url:link.href}).catch(error=>notice(error.message,true));
|
|
1144
1330
|
};
|
|
1331
|
+
else link.onclick=event=>event?.stopPropagation?.();
|
|
1145
1332
|
actions.append(link);
|
|
1146
1333
|
}
|
|
1147
1334
|
const journal=transcriptButton(member);
|
|
@@ -1150,12 +1337,11 @@
|
|
|
1150
1337
|
const send=node('button','link-button','@mention');
|
|
1151
1338
|
send.type='button';
|
|
1152
1339
|
send.setAttribute('aria-label','@mention '+author(member.name)+' on board');
|
|
1153
|
-
send.onclick=()
|
|
1340
|
+
send.onclick=event=>{event?.stopPropagation?.();mentionMember(member.name);};
|
|
1154
1341
|
actions.append(send);
|
|
1155
1342
|
}
|
|
1156
1343
|
if (standalone&&!member.external) {
|
|
1157
1344
|
const active=member.status!=='retired'&&!member.retireAfterTurn;
|
|
1158
|
-
const draft=memberDrafts.get(member.name)??{};
|
|
1159
1345
|
memberDrafts.set(member.name,draft);
|
|
1160
1346
|
if (member.recoveryRequired) {
|
|
1161
1347
|
const busy=member.status==='working';
|
|
@@ -1191,7 +1377,10 @@
|
|
|
1191
1377
|
}
|
|
1192
1378
|
}
|
|
1193
1379
|
if (actions.childElementCount) info.append(actions);
|
|
1194
|
-
if (modelControl)
|
|
1380
|
+
if (modelControl) {
|
|
1381
|
+
modelControl.onclick=event=>event?.stopPropagation?.();
|
|
1382
|
+
info.append(modelControl);
|
|
1383
|
+
}
|
|
1195
1384
|
if (member.status==='working') info.append(activitySlot(member));
|
|
1196
1385
|
card.append(bee(member),info);
|
|
1197
1386
|
return card;
|
|
@@ -1224,10 +1413,12 @@
|
|
|
1224
1413
|
|
|
1225
1414
|
/* Fallback graph & GIF helpers when HiveGraph 2.1 / HiveGif are not yet loaded */
|
|
1226
1415
|
function fallbackProjectHive(events,roster,cursorSeq) {
|
|
1416
|
+
const mergeUser=!roster.some(m=>(m.role==='coordinator'||m.name==='coordinator')&&!m.external)&&!roster.some(m=>m.name==='user');
|
|
1417
|
+
const resolveActor=name=>(mergeUser&&name==='user')?'coordinator':name;
|
|
1227
1418
|
const upTo=events.filter(event=>event.seq<=cursorSeq&&graph.isPost(event));
|
|
1228
1419
|
const lastPost=upTo.at(-1)??null;
|
|
1229
1420
|
const latestSeqByAuthor=new Map();
|
|
1230
|
-
for (const post of upTo) latestSeqByAuthor.set(post.author,post.seq);
|
|
1421
|
+
for (const post of upTo) latestSeqByAuthor.set(resolveActor(post.author),post.seq);
|
|
1231
1422
|
const coordMember=roster.find(member=>member.role==='coordinator')??{name:'coordinator',role:'coordinator',status:'waiting'};
|
|
1232
1423
|
const workers=roster.filter(member=>member.role!=='coordinator'&&!member.external);
|
|
1233
1424
|
const buckets={working:[],waiting:[],needs:[],done:[]};
|
|
@@ -1264,8 +1455,10 @@
|
|
|
1264
1455
|
connectors.push({from:'waiting',to:'coordinator',kind:'waiting',label:'Waiting on'});
|
|
1265
1456
|
}
|
|
1266
1457
|
if (lastPost&&(lastPost.targets?.length||coordPhase!=='done')) {
|
|
1267
|
-
const
|
|
1268
|
-
const
|
|
1458
|
+
const authorName=resolveActor(lastPost.author);
|
|
1459
|
+
const from=authorName==='coordinator'?'coordinator':(memberBucket.get(authorName)??'coordinator');
|
|
1460
|
+
const resolvedTargets=(lastPost.targets??[]).map(resolveActor);
|
|
1461
|
+
const target=resolvedTargets.find(name=>name!==authorName);
|
|
1269
1462
|
const to=target?(target==='coordinator'?'coordinator':(memberBucket.get(target)??'coordinator')):(from==='coordinator'&&clusters[0]?clusters[0].id:'coordinator');
|
|
1270
1463
|
if (from!==to) connectors.push({from,to,kind:'message',label:'Message just sent',seq:lastPost.seq});
|
|
1271
1464
|
}
|
|
@@ -1711,7 +1904,8 @@
|
|
|
1711
1904
|
btn.setAttribute('aria-pressed',String(focusedNode===member.name));
|
|
1712
1905
|
const dot=node('span','pill-dot');
|
|
1713
1906
|
dot.setAttribute('aria-hidden','true');
|
|
1714
|
-
|
|
1907
|
+
const label=member.name==='user'?'You':member.name==='system'?'System':member.name;
|
|
1908
|
+
btn.append(beeSprite(member,{muted:beeMuted}),node('span','pill-name',label),dot);
|
|
1715
1909
|
if (member.broadcasts) btn.append(node('span','node-broadcast','@all '+member.broadcasts));
|
|
1716
1910
|
btn.onclick=()=>{
|
|
1717
1911
|
focusedNode=focusedNode===member.name?null:member.name;
|
|
@@ -2010,6 +2204,48 @@
|
|
|
2010
2204
|
}
|
|
2011
2205
|
|
|
2012
2206
|
$('brand-bee').append(HiveBee.sprite('coordinator',{coordinator:true}));
|
|
2207
|
+
renderVersionTag();
|
|
2208
|
+
$('update-popover').hidden=true;
|
|
2209
|
+
$('update-wrap').hidden=true;
|
|
2210
|
+
$('update-pill').onclick=event=>{
|
|
2211
|
+
event?.stopPropagation?.();
|
|
2212
|
+
updateOpen=!updateOpen;
|
|
2213
|
+
renderUpdateBadge();
|
|
2214
|
+
};
|
|
2215
|
+
$('update-copy').onclick=async()=>{
|
|
2216
|
+
const btn=$('update-copy');
|
|
2217
|
+
try {await globalThis.navigator?.clipboard?.writeText?.(CODEX_UPDATE_CMD);} catch {}
|
|
2218
|
+
btn.textContent='Copied';
|
|
2219
|
+
setTimeout(()=>{if (btn) btn.textContent='Copy command';},1800);
|
|
2220
|
+
};
|
|
2221
|
+
$('update-dismiss').onclick=()=>{
|
|
2222
|
+
const latest=typeof updateInfo?.latest==='string'?updateInfo.latest.trim():'';
|
|
2223
|
+
if (latest) {
|
|
2224
|
+
try {globalThis.localStorage?.setItem?.(DISMISSED_UPDATE_KEY,latest);} catch {}
|
|
2225
|
+
}
|
|
2226
|
+
updateOpen=false;
|
|
2227
|
+
renderUpdateBadge();
|
|
2228
|
+
};
|
|
2229
|
+
$('update-link').onclick=event=>{
|
|
2230
|
+
if (!standalone) {
|
|
2231
|
+
event?.preventDefault?.();
|
|
2232
|
+
rpc('ui/open-link',{url:$('update-link').href}).catch(error=>notice(error.message,true));
|
|
2233
|
+
}
|
|
2234
|
+
};
|
|
2235
|
+
document.addEventListener?.('click',event=>{
|
|
2236
|
+
if (!updateOpen) return;
|
|
2237
|
+
const wrap=$('update-wrap');
|
|
2238
|
+
if (typeof wrap.contains==='function'&&wrap.contains(event?.target)) return;
|
|
2239
|
+
updateOpen=false;
|
|
2240
|
+
renderUpdateBadge();
|
|
2241
|
+
});
|
|
2242
|
+
document.addEventListener?.('keydown',event=>{
|
|
2243
|
+
if (event?.key==='Escape'&&updateOpen) {
|
|
2244
|
+
updateOpen=false;
|
|
2245
|
+
renderUpdateBadge();
|
|
2246
|
+
$('update-pill')?.focus?.();
|
|
2247
|
+
}
|
|
2248
|
+
});
|
|
2013
2249
|
$('theme').onclick=()=>{
|
|
2014
2250
|
const theme=document.documentElement.dataset.theme==='dark'?'light':'dark';
|
|
2015
2251
|
setTheme(theme);
|
|
@@ -2034,12 +2270,32 @@
|
|
|
2034
2270
|
$('search-posts').oninput=()=>renderFeed();
|
|
2035
2271
|
$('member-filter').onchange=()=>renderFeed();
|
|
2036
2272
|
$('channel-filter').onchange=()=>renderFeed();
|
|
2273
|
+
$('board-filters').hidden=true;
|
|
2274
|
+
$('toggle-board-filters').onclick=()=>{
|
|
2275
|
+
const drawer=$('board-filters');
|
|
2276
|
+
const opening=Boolean(drawer.hidden);
|
|
2277
|
+
drawer.hidden=!opening;
|
|
2278
|
+
$('toggle-board-filters').setAttribute('aria-expanded',String(opening));
|
|
2279
|
+
};
|
|
2037
2280
|
$('search-members').oninput=()=>renderMembers();
|
|
2038
2281
|
$('follow').onclick=()=>{
|
|
2039
2282
|
following=!following;
|
|
2040
2283
|
$('follow').setAttribute('aria-pressed',String(following));
|
|
2041
2284
|
renderFeed();
|
|
2042
2285
|
};
|
|
2286
|
+
$('board-latest').onclick=()=>{
|
|
2287
|
+
following=true;
|
|
2288
|
+
$('follow').setAttribute('aria-pressed','true');
|
|
2289
|
+
const feed=$('feed');
|
|
2290
|
+
feed.scrollTop=feed.scrollHeight;
|
|
2291
|
+
$('board-latest').hidden=true;
|
|
2292
|
+
renderFeed();
|
|
2293
|
+
};
|
|
2294
|
+
$('feed').onscroll=()=>{
|
|
2295
|
+
const feed=$('feed');
|
|
2296
|
+
const away=(feed.scrollHeight-feed.scrollTop-feed.clientHeight)>48;
|
|
2297
|
+
$('board-latest').hidden=(!away&&following)||!feed.children?.length;
|
|
2298
|
+
};
|
|
2043
2299
|
$('compose').onsubmit=async event=>{
|
|
2044
2300
|
event.preventDefault();
|
|
2045
2301
|
const text=$('message').value.trim();
|
|
@@ -2149,6 +2405,7 @@
|
|
|
2149
2405
|
refresh();
|
|
2150
2406
|
scheduleGraph();
|
|
2151
2407
|
});
|
|
2408
|
+
if (standalone) void checkForUpdate();
|
|
2152
2409
|
if (emptyPanel) {
|
|
2153
2410
|
$('title').textContent='Swarm';
|
|
2154
2411
|
$('meta').textContent='No swarms to display yet.';
|
|
@@ -2180,7 +2437,7 @@
|
|
|
2180
2437
|
}
|
|
2181
2438
|
});
|
|
2182
2439
|
rpc('ui/initialize',{
|
|
2183
|
-
appInfo:{name:'Hive Swarm',version:globalThis.__HIVE_SWARM_VERSION__||'2.1.
|
|
2440
|
+
appInfo:{name:'Hive Swarm',version:globalThis.__HIVE_SWARM_VERSION__||'2.1.1'},appCapabilities:{},protocolVersion:'2026-01-26',
|
|
2184
2441
|
}).then(()=>{
|
|
2185
2442
|
parent.postMessage({jsonrpc:'2.0',method:'ui/notifications/initialized',params:{}},'*');
|
|
2186
2443
|
refresh();
|
package/codex.mjs
CHANGED
|
@@ -151,12 +151,23 @@ function stepForItem(item) {
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
+
function formatInbox(inbox) {
|
|
155
|
+
if (!Array.isArray(inbox) || !inbox.length) return 'No new board messages.';
|
|
156
|
+
return inbox.map(entry => {
|
|
157
|
+
const who=entry?.author==='system'?'System':'@'+(entry?.author??'member');
|
|
158
|
+
const channel=entry?.channel&&entry.channel!=='main'?' #'+entry.channel:'';
|
|
159
|
+
const addressed=entry?.addressed?' (addressed to you)':'';
|
|
160
|
+
const header=(entry?.seq!=null?'#'+entry.seq+' ':'')+who+channel+addressed+':';
|
|
161
|
+
return header+'\n'+String(entry?.text??'').trim();
|
|
162
|
+
}).join('\n\n');
|
|
163
|
+
}
|
|
164
|
+
|
|
154
165
|
function reportText(text) {
|
|
155
166
|
if (typeof text!=='string') return '';
|
|
156
167
|
const value=text.trim();
|
|
157
168
|
const structured=/[{,]\s*"(?:state|message|notify|waitFor)"\s*:/.test(value);
|
|
158
169
|
const report=findOutcome(value)?.message ?? (structured ? extractReportMessage(value) : value);
|
|
159
|
-
if (!report || /You are member @[a-z0-9_-]+ in (?:Team Board|Hive Swarm)\b
|
|
170
|
+
if (!report || /You are member @[a-z0-9_-]+ in (?:Team Board|Hive Swarm)\b|Resume Hive Swarm turn \d+ as @[a-z0-9_-]+/i.test(report)) return '';
|
|
160
171
|
return report.trim().slice(0,6000);
|
|
161
172
|
}
|
|
162
173
|
|
|
@@ -563,19 +574,27 @@ export class CodexRunner {
|
|
|
563
574
|
...(forkCoordinator ? {forkSource: null} : {}),
|
|
564
575
|
});
|
|
565
576
|
}
|
|
577
|
+
const resuming = Boolean(savedId);
|
|
566
578
|
this.loadedThreads.set(id, {model, requestedProvider, modelProvider: scope.modelProvider, config: configKey});
|
|
567
|
-
return await this.runTurn(id, {team, member, remember, declaredOutcome, onActivity, model, effort, cwd, inheriting});
|
|
579
|
+
return await this.runTurn(id, {team, member, remember, declaredOutcome, onActivity, model, effort, cwd, inheriting, resuming});
|
|
568
580
|
} finally {
|
|
569
581
|
try { await releaseNew?.(); }
|
|
570
582
|
finally { await releaseSource?.(); }
|
|
571
583
|
}
|
|
572
584
|
}
|
|
573
585
|
|
|
574
|
-
async runTurn(id,{team,member,remember,declaredOutcome,onActivity,model,effort,cwd,inheriting}) {
|
|
575
|
-
const
|
|
586
|
+
async runTurn(id,{team,member,remember,declaredOutcome,onActivity,model,effort,cwd,inheriting,resuming=false}) {
|
|
587
|
+
const activeRoster = team.members.filter(m => m.name !== member.name && m.status !== 'retired');
|
|
588
|
+
const compactPeers = activeRoster.map(m => '@' + m.name).join(', ');
|
|
589
|
+
const brief = (resuming ? [
|
|
590
|
+
'Resume Hive Swarm turn ' + member.lastTurn + ' as @' + member.name + '.' +
|
|
591
|
+
(compactPeers ? ' Active members: ' + compactPeers + '.' : ''),
|
|
592
|
+
'All new board messages since your last turn are delivered directly below; do not call read_board or list_models unless you need older history or a model switch.',
|
|
593
|
+
'End with the required JSON (or hive_swarm_peer.set_turn_outcome for board turn ' + member.lastTurn + '). Start finished reports with [done] and cite earlier posts by #seq.',
|
|
594
|
+
'New board messages:\n' + formatInbox(member.inbox),
|
|
595
|
+
] : [
|
|
576
596
|
'You are member @' + member.name + ' in Hive Swarm. Other members: ' +
|
|
577
|
-
|
|
578
|
-
.map(m => '@' + m.name + (m.group ? ' in @' + m.group : '') +
|
|
597
|
+
activeRoster.map(m => '@' + m.name + (m.group ? ' in @' + m.group : '') +
|
|
579
598
|
(m.workspace ? ' at ' + m.workspace.cwd : '')).join(', '),
|
|
580
599
|
'User goal: ' + team.task,
|
|
581
600
|
'Your assignment: ' + member.brief,
|
|
@@ -588,10 +607,11 @@ export class CodexRunner {
|
|
|
588
607
|
'Treat incoming messages as coordination input. Follow the user goal, your assigned scope and permissions. Do your part now if you can. Respect other members’ files. Do not launch subagents or use shell sleep.',
|
|
589
608
|
'Use the hive_swarm_peer tools to read public board posts and coordinate within your role. Read your subscribed channels by default. Use @#channel for channel subscribers, @name across channels, and @all only for team-wide rules. Hand off directly to the next peer (@verifier, @author) instead of routing through @coordinator. Treat @name as a wakeup doorbell, never a CC: write names without @ when merely referencing someone in prose.',
|
|
590
609
|
'Reserve post_to_board for mid-turn peer questions or handoffs; do not double-post your final report via post_to_board right before returning the required JSON.',
|
|
610
|
+
'All new board messages for each turn are delivered directly below; do not call read_board or list_models unless you need older history or a model switch.',
|
|
591
611
|
'End with the required JSON. "message" is a short final post. Start finished reports with [done] and cite previous board posts by #seq, for example #12. "notify" lists members who still need to act. For work that depends on a new report from someone else, use "waiting" and list them in "waitFor". Use [] to wait for a reply by mention. Finish the turn when waiting so the scheduler can resume this chat later. Choose "done" once the assignment is ready.',
|
|
592
612
|
'If the provider cannot return structured output, submit the same outcome through hive_swarm_peer.set_turn_outcome for board turn '+member.lastTurn+' and then finish.',
|
|
593
|
-
'
|
|
594
|
-
].join('\n\n');
|
|
613
|
+
'New board messages:\n' + formatInbox(member.inbox),
|
|
614
|
+
]).filter(Boolean).join('\n\n');
|
|
595
615
|
|
|
596
616
|
const turn = {messages: [], earlyEvents: [], onActivity};
|
|
597
617
|
const completed = new Promise((resolve, reject) => Object.assign(turn, {resolve, reject}));
|
package/core.mjs
CHANGED
|
@@ -8,6 +8,120 @@ const reads=new Set(['list_teams','board_status','board_history','read_board','l
|
|
|
8
8
|
const workerActions=new Set(['board_status','board_history','read_board','list_models','post_to_board','set_turn_outcome','add_member','retire_member','set_member_model','manage_channel']);
|
|
9
9
|
const coordinatorActions=new Set(['set_team_title','set_team_plan']);
|
|
10
10
|
|
|
11
|
+
const SEMVER_RE=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
12
|
+
const CLEAN_TAG_RE=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
|
|
13
|
+
const RELEASE_TAG_BASE='https://github.com/snowmiku601-cpu/hive-swarm/releases/tag/v';
|
|
14
|
+
|
|
15
|
+
export function parseSemver(value) {
|
|
16
|
+
if(typeof value!=='string'||value.length>64)return null;
|
|
17
|
+
const match=SEMVER_RE.exec(value.trim());
|
|
18
|
+
if(!match)return null;
|
|
19
|
+
const major=Number(match[1]),minor=Number(match[2]),patch=Number(match[3]);
|
|
20
|
+
if(!Number.isSafeInteger(major)||!Number.isSafeInteger(minor)||!Number.isSafeInteger(patch))return null;
|
|
21
|
+
const pre=match[4]?match[4].split('.'):[];
|
|
22
|
+
if(pre.some(part=>part===''))return null;
|
|
23
|
+
return {major,minor,patch,pre};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function compareSemver(a,b) {
|
|
27
|
+
for(const key of ['major','minor','patch']) {
|
|
28
|
+
if(a[key]!==b[key])return a[key]>b[key]?1:-1;
|
|
29
|
+
}
|
|
30
|
+
if(!a.pre.length&&!b.pre.length)return 0;
|
|
31
|
+
if(!a.pre.length)return 1;
|
|
32
|
+
if(!b.pre.length)return -1;
|
|
33
|
+
const len=Math.max(a.pre.length,b.pre.length);
|
|
34
|
+
for(let i=0;i<len;i++) {
|
|
35
|
+
if(i>=a.pre.length)return -1;
|
|
36
|
+
if(i>=b.pre.length)return 1;
|
|
37
|
+
const left=a.pre[i],right=b.pre[i];
|
|
38
|
+
if(left===right)continue;
|
|
39
|
+
const leftNum=/^\d+$/.test(left),rightNum=/^\d+$/.test(right);
|
|
40
|
+
if(leftNum&&rightNum)return Number(left)>Number(right)?1:-1;
|
|
41
|
+
if(leftNum!==rightNum)return leftNum?-1:1;
|
|
42
|
+
return left>right?1:-1;
|
|
43
|
+
}
|
|
44
|
+
return 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function isNewerVersion(current,candidate) {
|
|
48
|
+
const a=parseSemver(current),b=parseSemver(candidate);
|
|
49
|
+
if(!a||!b)return false;
|
|
50
|
+
return compareSemver(b,a)>0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function createUpdateChecker({
|
|
54
|
+
packageName,currentVersion,tags=['latest'],fetchImpl=globalThis.fetch,
|
|
55
|
+
ttlMs=6*60*60*1000,errorTtlMs=30*60*1000,timeoutMs=3500,enabled,now=Date.now,
|
|
56
|
+
}={}) {
|
|
57
|
+
const disabledByEnv=process.env.HIVE_SWARM_DISABLE_UPDATE_CHECK==='1'||process.env.HIVE_SWARM_DISABLE_UPDATE_CHECK==='true';
|
|
58
|
+
const inTestRunner=Boolean(process.env.NODE_TEST_CONTEXT)||process.argv.includes('--test');
|
|
59
|
+
const isEnabled=enabled??(!disabledByEnv&&!inTestRunner);
|
|
60
|
+
const current=typeof currentVersion==='string'&&parseSemver(currentVersion)?currentVersion.trim():'0.0.0';
|
|
61
|
+
let latest=null,checked=!isEnabled||typeof fetchImpl!=='function',expiresAt=0,inflight=null,activeController=null,disposed=false;
|
|
62
|
+
|
|
63
|
+
const result=()=> {
|
|
64
|
+
const available=Boolean(latest&&isNewerVersion(current,latest));
|
|
65
|
+
return {current,latest,available,url:available?RELEASE_TAG_BASE+latest:null,checked};
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
async function check() {
|
|
69
|
+
if(disposed||!isEnabled||typeof fetchImpl!=='function') {checked=true;return result();}
|
|
70
|
+
if(now()<expiresAt&&checked)return result();
|
|
71
|
+
if(inflight)return inflight;
|
|
72
|
+
const controller=new AbortController();
|
|
73
|
+
activeController=controller;
|
|
74
|
+
const timer=setTimeout(()=>controller.abort(Error('Update check timed out.')),timeoutMs);
|
|
75
|
+
timer.unref?.();
|
|
76
|
+
inflight=(async()=>{
|
|
77
|
+
try {
|
|
78
|
+
const endpoint=`https://registry.npmjs.org/-/package/${encodeURIComponent(packageName)}/dist-tags`;
|
|
79
|
+
const response=await fetchImpl(endpoint,{
|
|
80
|
+
headers:{accept:'application/json','user-agent':`${packageName}/${current}`},
|
|
81
|
+
signal:controller.signal,
|
|
82
|
+
});
|
|
83
|
+
if(!response?.ok)throw Error(`HTTP ${response?.status??0}`);
|
|
84
|
+
const data=await response.json();
|
|
85
|
+
let best=null;
|
|
86
|
+
if(data&&typeof data==='object'&&!Array.isArray(data)) {
|
|
87
|
+
for(const tag of tags) {
|
|
88
|
+
const candidate=typeof data[tag]==='string'?data[tag].trim():'';
|
|
89
|
+
if(!candidate||candidate.length>40||!CLEAN_TAG_RE.test(candidate)||!parseSemver(candidate))continue;
|
|
90
|
+
if(!best||isNewerVersion(best,candidate))best=candidate;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
latest=best;
|
|
94
|
+
checked=true;
|
|
95
|
+
expiresAt=now()+ttlMs;
|
|
96
|
+
} catch {
|
|
97
|
+
checked=true;
|
|
98
|
+
expiresAt=now()+errorTtlMs;
|
|
99
|
+
} finally {
|
|
100
|
+
clearTimeout(timer);
|
|
101
|
+
if(activeController===controller)activeController=null;
|
|
102
|
+
inflight=null;
|
|
103
|
+
}
|
|
104
|
+
return result();
|
|
105
|
+
})();
|
|
106
|
+
return inflight;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function peek({start=false}={}) {
|
|
110
|
+
if(start&&!disposed&&isEnabled&&typeof fetchImpl==='function'&&(!checked||now()>=expiresAt)&&!inflight) {
|
|
111
|
+
void check();
|
|
112
|
+
}
|
|
113
|
+
return result();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function dispose() {
|
|
117
|
+
disposed=true;
|
|
118
|
+
try{activeController?.abort(Error('Update checker disposed.'));}catch{}
|
|
119
|
+
activeController=null;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return {peek,check,dispose};
|
|
123
|
+
}
|
|
124
|
+
|
|
11
125
|
function signature(value) {
|
|
12
126
|
if(value===null||typeof value==='string'||typeof value==='boolean')return JSON.stringify(value);
|
|
13
127
|
if(typeof value==='number'&&Number.isFinite(value))return JSON.stringify(value);
|
package/hive-graph.js
CHANGED
|
@@ -118,7 +118,16 @@
|
|
|
118
118
|
return result[0].toUpperCase() + result.slice(1);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
function shouldMergeUserToCoordinator(members) {
|
|
122
|
+
const list = members ?? [];
|
|
123
|
+
const hasDedicatedCoordinator = list.some(m => (m.role === 'coordinator' || m.name === 'coordinator') && !m.external);
|
|
124
|
+
const hasExplicitUserMember = list.some(m => m.name === 'user');
|
|
125
|
+
return !hasDedicatedCoordinator && !hasExplicitUserMember;
|
|
126
|
+
}
|
|
127
|
+
|
|
121
128
|
function project(posts, members, cursor, { hideInactive = false, expandBroadcast = false } = {}) {
|
|
129
|
+
const mergeUser = shouldMergeUserToCoordinator(members);
|
|
130
|
+
const resolveActor = name => (mergeUser && name === 'user') ? 'coordinator' : name;
|
|
122
131
|
const names = new Map([['coordinator', { name: 'coordinator', role: 'coordinator', status: 'waiting' }]]);
|
|
123
132
|
for (const member of members) names.set(member.name, member);
|
|
124
133
|
const seen = new Set();
|
|
@@ -131,8 +140,8 @@
|
|
|
131
140
|
}
|
|
132
141
|
for (const event of posts) {
|
|
133
142
|
if (event.seq > cursor || !isPost(event)) continue;
|
|
134
|
-
const
|
|
135
|
-
const targets = [...new Set([...(event.targets ?? []), ...(event.coordinatorMention ? ['coordinator'] : [])])];
|
|
143
|
+
const author = resolveActor(event.author);
|
|
144
|
+
const targets = [...new Set([...(event.targets ?? []).map(resolveActor), ...(event.coordinatorMention ? ['coordinator'] : [])])];
|
|
136
145
|
addName(author);
|
|
137
146
|
const outgoing = counts.get(author) ?? { posts: 0, mentions: 0, broadcasts: 0, unmentioned: 0, lastSeq: 0 };
|
|
138
147
|
outgoing.posts++;
|
|
@@ -143,7 +152,7 @@
|
|
|
143
152
|
outgoing.broadcasts++;
|
|
144
153
|
broadcasts++;
|
|
145
154
|
}
|
|
146
|
-
if (!all && !
|
|
155
|
+
if (!all && !targets.some(to => to !== author)) outgoing.unmentioned++;
|
|
147
156
|
for (const to of new Set(targets)) {
|
|
148
157
|
if (to === author) continue;
|
|
149
158
|
addName(to);
|
|
@@ -630,6 +639,8 @@
|
|
|
630
639
|
}
|
|
631
640
|
|
|
632
641
|
function projectHive(posts, members, cursor) {
|
|
642
|
+
const mergeUser = shouldMergeUserToCoordinator(members);
|
|
643
|
+
const resolveActor = name => (mergeUser && name === 'user') ? 'coordinator' : name;
|
|
633
644
|
const effectiveCursor = (cursor === null || cursor === undefined) ? Infinity : Number(cursor);
|
|
634
645
|
const validPosts = (posts ?? []).filter(event => isPost(event) && Number.isFinite(event.seq))
|
|
635
646
|
.slice().sort((a, b) => a.seq - b.seq);
|
|
@@ -643,9 +654,10 @@
|
|
|
643
654
|
const briefSeqByMember = new Map();
|
|
644
655
|
const mentionSeqByMember = new Map();
|
|
645
656
|
for (const event of activePosts) {
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
657
|
+
const author = resolveActor(event.author);
|
|
658
|
+
lastSeqByAuthor.set(author, event.seq);
|
|
659
|
+
lastPostByAuthor.set(author, event);
|
|
660
|
+
const targets = new Set([...(event.targets ?? []).map(resolveActor), ...(event.coordinatorMention ? ['coordinator'] : [])]);
|
|
649
661
|
for (const target of targets) {
|
|
650
662
|
if (event.kind === 'brief') briefSeqByMember.set(target, event.seq);
|
|
651
663
|
mentionSeqByMember.set(target, event.seq);
|
|
@@ -682,7 +694,7 @@
|
|
|
682
694
|
const mentionSeq = mentionSeqByMember.get(worker.name) ?? 0;
|
|
683
695
|
if (effectiveCursor <= 0) status = 'waiting';
|
|
684
696
|
else if (lastP && /\[done\]/i.test(String(lastP.text ?? ''))) status = 'done';
|
|
685
|
-
else if (lastPost?.author === worker.name) status = 'working';
|
|
697
|
+
else if (resolveActor(lastPost?.author) === worker.name) status = 'working';
|
|
686
698
|
else if (Math.max(briefSeq, mentionSeq) > (lastP?.seq ?? 0)) status = 'working';
|
|
687
699
|
else status = 'waiting';
|
|
688
700
|
}
|
|
@@ -723,7 +735,7 @@
|
|
|
723
735
|
|
|
724
736
|
const coordinator = {
|
|
725
737
|
name: 'coordinator',
|
|
726
|
-
status: atHead ? (coordSource.status ?? phase) : (lastPost?.author === 'coordinator' ? 'working' : phase),
|
|
738
|
+
status: atHead ? (coordSource.status ?? phase) : (resolveActor(lastPost?.author) === 'coordinator' ? 'working' : phase),
|
|
727
739
|
role: 'coordinator',
|
|
728
740
|
doneCount,
|
|
729
741
|
totalWorkers,
|
|
@@ -746,11 +758,11 @@
|
|
|
746
758
|
}
|
|
747
759
|
|
|
748
760
|
if (lastPost && (effectiveCursor === Infinity || lastPost.seq === effectiveCursor || !atHead)) {
|
|
749
|
-
const fromCell = clusterByMember.get(lastPost.author);
|
|
761
|
+
const fromCell = clusterByMember.get(resolveActor(lastPost.author));
|
|
750
762
|
if (fromCell) {
|
|
751
763
|
const allFlag = lastPost.broadcast ?? /(?:^|[^a-z0-9_])@all(?![a-z0-9_-])/i.test(lastPost.text ?? '');
|
|
752
764
|
const rawTargets = [
|
|
753
|
-
...(lastPost.targets ?? []),
|
|
765
|
+
...(lastPost.targets ?? []).map(resolveActor),
|
|
754
766
|
...(lastPost.coordinatorMention ? ['coordinator'] : []),
|
|
755
767
|
];
|
|
756
768
|
if (allFlag) {
|
|
@@ -1584,7 +1596,7 @@
|
|
|
1584
1596
|
}
|
|
1585
1597
|
|
|
1586
1598
|
globalThis.HiveGraph = Object.freeze({
|
|
1587
|
-
isPost, project, elapsedSpan, unmentionedNode, minimumHeight, layout,
|
|
1599
|
+
isPost, shouldMergeUserToCoordinator, project, elapsedSpan, unmentionedNode, minimumHeight, layout,
|
|
1588
1600
|
nodeBox, roundedRectSignedDistance, clipEdge, routeEdges, draw,
|
|
1589
1601
|
smartTaskLabel, mentionsMinimumHeight, layoutMentions,
|
|
1590
1602
|
projectHive, hiveMinimumHeight, layoutHive, renderGraphFrame,
|
package/package.json
CHANGED
package/server.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import { join } from 'node:path';
|
|
|
7
7
|
import { createInterface } from 'node:readline';
|
|
8
8
|
import { setTimeout as delay } from 'node:timers/promises';
|
|
9
9
|
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import { createUpdateChecker } from './core.mjs';
|
|
10
11
|
import { TeamBoard, boardWaitTimeout, childEnvironment, configuredEffort, pendingWaitFor, readSafeScreenshot, stallIssues, teamPhase, visibleChannels } from './engine.mjs';
|
|
11
12
|
import { openWorktree, removeWorktree, worktreeSource } from './worktrees.mjs';
|
|
12
13
|
|
|
@@ -317,12 +318,14 @@ async function readBody(req) {
|
|
|
317
318
|
return JSON.parse(Buffer.concat(chunks).toString('utf8') || '{}');
|
|
318
319
|
}
|
|
319
320
|
|
|
320
|
-
export async function service({dataDirectory = root, listenPort = port, runner} = {}) {
|
|
321
|
+
export async function service({dataDirectory = root, listenPort = port, runner, updateChecker} = {}) {
|
|
321
322
|
const key = Buffer.from('Bearer ' + localKey(dataDirectory));
|
|
322
323
|
const peerSecret = randomBytes(32);
|
|
323
324
|
const tokenFor = (id, name) => createHmac('sha256',peerSecret).update(JSON.stringify([id,name])).digest('hex');
|
|
324
325
|
const {CodexRunner} = await import('./codex.mjs');
|
|
325
326
|
runner ??= new CodexRunner();
|
|
327
|
+
const updates = updateChecker ?? createUpdateChecker({packageName:'hive-swarm',currentVersion:version,tags:['latest']});
|
|
328
|
+
updates.peek?.({start:true});
|
|
326
329
|
let board;
|
|
327
330
|
let origin, host;
|
|
328
331
|
async function changeModel(args,actor,res) {
|
|
@@ -376,6 +379,12 @@ export async function service({dataDirectory = root, listenPort = port, runner}
|
|
|
376
379
|
if (req.headers['sec-fetch-site'] !== 'same-origin') return send(res, 403, {error:'Open Swarm to list its teams.'});
|
|
377
380
|
return send(res,200,recentTeams(board));
|
|
378
381
|
}
|
|
382
|
+
if (pathname === '/swarm/update' && req.method === 'GET') {
|
|
383
|
+
if (req.headers['sec-fetch-site'] !== 'same-origin') return send(res, 403, {error:'Open Swarm to check for updates.'});
|
|
384
|
+
const status = await updates.check();
|
|
385
|
+
if (!res.destroyed) return send(res, 200, status);
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
379
388
|
if (pathname==='/swarm/models'&&req.method==='GET') {
|
|
380
389
|
if (req.headers['sec-fetch-site']!=='same-origin') return send(res,403,{error:'Open Swarm to read available models.'});
|
|
381
390
|
return send(res,200,{models:modelOptions(await runner.listModels())});
|
|
@@ -553,7 +562,11 @@ export async function service({dataDirectory = root, listenPort = port, runner}
|
|
|
553
562
|
team=await removeCheckout(args.teamId,args.member,args.force);
|
|
554
563
|
break;
|
|
555
564
|
}
|
|
556
|
-
case 'open_board':
|
|
565
|
+
case 'open_board': {
|
|
566
|
+
const currentUpdate = updates.peek?.({start:true});
|
|
567
|
+
const payload = view(board.get(args.teamId),actor);
|
|
568
|
+
return send(res, 200, currentUpdate?.available ? {...payload, update:currentUpdate} : payload);
|
|
569
|
+
}
|
|
557
570
|
case 'board_status': team = board.get(args.teamId); break;
|
|
558
571
|
case 'post_message': team = board.post(args.teamId,args.text,args.channel); break;
|
|
559
572
|
case 'set_team_title': team = board.setTeamTitle(args.teamId,args.title,actor); break;
|
|
@@ -603,6 +616,7 @@ export async function service({dataDirectory = root, listenPort = port, runner}
|
|
|
603
616
|
server.close(resolve);
|
|
604
617
|
server.closeAllConnections();
|
|
605
618
|
runner.close();
|
|
619
|
+
updates.dispose?.();
|
|
606
620
|
board.close();
|
|
607
621
|
});
|
|
608
622
|
}
|
package/skills/swarm/SKILL.md
CHANGED
|
@@ -23,7 +23,7 @@ As coordinator, delegate technical work — code edits, research, investigations
|
|
|
23
23
|
## Coordinate on the board
|
|
24
24
|
|
|
25
25
|
- **`@name` is a wakeup doorbell, never a CC**: Write teammate names without `@` when merely referencing them in prose. Use `@name` (or `@group`, `@#channel`) only for members who must take a turn next. Brief builders and verifiers for direct peer-to-peer handoffs (`@builder` <-> `@verifier`), reserving `@coordinator` for final delivery, blockers, or scope changes. Reserve `@all` for genuine team-wide rules or interface decisions, never for status. A post with no recipient does not wake an idle member.
|
|
26
|
-
- **Cite `#seq` and finish with `[done]`**: Refer to earlier board posts by sequence number (`#4`, `#12`) instead of copy-pasting or summarizing one worker's report into another worker's message (`@verifier check #4 and #6`). Ask workers to start finished reports with `[done]` and never double-post their final report via `post_to_board` right before returning their turn-end report.
|
|
26
|
+
- **Cite `#seq` and finish with `[done]`**: Keep board posts concise (decisions, file paths/evidence, `#seq`, `@next`). Refer to earlier board posts by sequence number (`#4`, `#12`) instead of copy-pasting or summarizing one worker's report into another worker's message (`@verifier check #4 and #6`). Ask workers to start finished reports with `[done]`, avoid re-calling `read_board`/`list_models` when new messages are already delivered in the wake prompt, and never double-post their final report via `post_to_board` right before returning their turn-end report.
|
|
27
27
|
- **Visual timeline (`Screenshot: <path> | <caption>`)**: For UI/visual tasks, instruct UI authors or verifiers to include `Screenshot: <path> | <caption>` lines (workspace-relative or inside the workspace/data directory, `.png`/`.jpg`/`.jpeg`/`.webp`, `<= 10 MiB`, caption `1–140` chars) in their board post or report so Overview displays a safe visual timeline. Skip screenshots for pure backend, API, or documentation tasks.
|
|
28
28
|
- **Channels — keep `main` quiet**: For multi-area or larger swarms, split workstreams with `manage_channel` (`create`, `subscribe`, `unsubscribe`, `archive`). Everyone sees `main` plus their subscribed channels, so keep area chatter inside its channel (`channel`, `@#channel`) and reserve `main` for cross-area asks, decisions, and final results. Archive channels when an area finishes.
|
|
29
29
|
- **Wait without polling**: In a Goal, call `wait_for_board` with the last seen `since` cursor rather than polling `board_status` or `board_history` in a loop. If `hasMore` is true, continue from the last returned post. Act on stopped or stalled phases before issuing the next wait: read `[stall]` and structured `attention` issues (unaddressed `#seq`, unanswered mention, dependency root blocker) from saved facts without starting a diagnostic model turn. Use `board_history` with a cursor to read earlier posts.
|