@hivey/cli 0.9.70 → 0.9.73
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/native/darwin-arm64/hivey +0 -0
- package/package.json +1 -1
- package/repo/skills/hivey-agent-map/SKILL.md +15 -12
- package/repo/skills/hivey-agent-map/scripts/agent_map.py +8 -6
- package/repo/skills/hivey-agent-map/scripts/enhance.py +23 -3
- package/repo/skills/hivey-agent-map/scripts/{office/office.html → fleet/fleet.html} +13 -8
- package/repo/skills/hivey-agent-map/scripts/{office/office.js → fleet/fleet.js} +71 -48
- package/repo/skills/hivey-agent-map/scripts/{office → fleet}/music/README.txt +1 -1
- package/repo/skills/hivey-agent-map/scripts/{office → fleet}/ship.js +2 -2
- package/repo/skills/hivey-agent-map/scripts/{office.py → fleet.py} +25 -23
- package/repo/skills/hivey-agent-map/scripts/report.py +36 -9
- package/repo/skills/hivey-agent-map/scripts/serve.py +117 -62
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/OutlineEffect.js +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/RoomEnvironment.js +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/loaders/GLTFLoader.js +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/models/LICENSE-kenney-space-kit.txt +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/models/LICENSE-kenney-space-station-kit.txt +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/models/LICENSE-robot.txt +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/models/astronautA.glb.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/models/astronautB.glb.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/models/barrels.glb.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/models/barrels_rail.glb.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/models/craft_cargoA.glb.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/models/craft_racer.glb.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/models/craft_speederA.glb.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/models/desk_chairArms.glb.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/models/desk_computer.glb.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/models/machine_generator.glb.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/models/machine_generatorLarge.glb.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/models/machine_wireless.glb.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/models/robot.glb.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/models/satelliteDish_detailed.glb.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/models/satelliteDish_large.glb.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/models/station/Textures/colormap.png.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/models/station/chair-cushion-headrest.glb.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/models/station/computer-system.glb.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/models/station/computer-wide.glb.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/models/station/container-flat.glb.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/models/station/container-tall.glb.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/models/station/container-wide.glb.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/models/station/display-wall-wide.glb.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/models/station/pipe-ring-colored.glb.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/music/space.mp3.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/music/space_02.mp3.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/music/track_01.mp3.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/music/track_02.mp3.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/music/track_03.mp3.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/music/track_04.mp3.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/music/track_05.mp3.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/music/track_06.mp3.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/music/track_07.mp3.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/music/track_08.mp3.b64 +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/postprocessing/EffectComposer.js +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/postprocessing/MaskPass.js +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/postprocessing/OutputPass.js +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/postprocessing/Pass.js +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/postprocessing/RenderPass.js +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/postprocessing/ShaderPass.js +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/postprocessing/UnrealBloomPass.js +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/shaders/CopyShader.js +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/shaders/LuminosityHighPassShader.js +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/shaders/OutputShader.js +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/three.module.min.js +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/utils/BufferGeometryUtils.js +0 -0
- /package/repo/skills/hivey-agent-map/scripts/{office → fleet}/utils/SkeletonUtils.js +0 -0
|
Binary file
|
package/package.json
CHANGED
|
@@ -77,7 +77,10 @@ schemas, `finalize`, repair rules).
|
|
|
77
77
|
X content, radars, trading, research swarms). Draw only confirmed links, labelled with what flows
|
|
78
78
|
(≤ 17 characters: "top-20 tweets", "transcripts"). Fold the rest: a job that belongs to an agent
|
|
79
79
|
merges into it ("+ nightly 03:15" in its sublabel), many similar jobs become one node ("12 trading
|
|
80
|
-
jobs"), and unlinked housekeeping (git auto-commits, upgrades, purges)
|
|
80
|
+
jobs"), and unlinked housekeeping (git auto-commits, upgrades, purges) becomes one box ("8 housekeeping
|
|
81
|
+
jobs"). **Every scanned job is on the map**: its own box, a group box or its agent's box, listed in that
|
|
82
|
+
box's `map-meta.json` refs. The nightly run gives the model the jobs last night's map left out
|
|
83
|
+
(`enhance.jobs_off_map`), and the map page names any still missing under its legend.
|
|
81
84
|
**Node tags do not show at default zoom: put cost and status in the sublabel** ("$110 · posts → n8n",
|
|
82
85
|
"launchd 04:30 · exit 1"). Put an agent that shares no data at a free cell where no line crosses it.
|
|
83
86
|
Providers and totals go in cards (spend by provider and model, needs attention, spend gaps, not
|
|
@@ -108,7 +111,7 @@ hivey agent-map nightly [--model sonnet] # a full report now (also: --no-llm,
|
|
|
108
111
|
hivey agent-map schedule install [--at 06:30] [--model sonnet] # | remove | status
|
|
109
112
|
```
|
|
110
113
|
|
|
111
|
-
- **hivey menu → agent
|
|
114
|
+
- **hivey menu → agent fleet → 📊 Jobs tab** (key 4, or `/fleet/?view=jobs`) shows these pages inside the fleet page: the frame loads `/hv-jobs`, which the server redirects to the latest map (else stats, logs, sessions); with no report yet it starts the first build (`agent_map.py open --no-open`) and shows a page that reloads until it is ready. Every jobs page's navbar starts with 🚀 Fleet (hidden inside the frame). `hivey agent-map open` still opens `agent-stats.html`,
|
|
112
115
|
`agent-map.html` and `agent-logs.html` from `~/.hivey/agent-map/reports/latest`.
|
|
113
116
|
- **hivey's layer on the archify pages** (`enhance.py`, after finalize; `agent_map.py enhance [folder]`
|
|
114
117
|
re-applies it): a Stats · Map · Logs navbar on every page; map boxes coloured by spend (green: none →
|
|
@@ -130,7 +133,7 @@ hivey agent-map schedule install [--at 06:30] [--model sonnet] # | remove | st
|
|
|
130
133
|
People chatting with agents (Claude Code, Codex, Grok in a terminal; snapshot `interactive`, with one
|
|
131
134
|
entry per session) go to **`agent-sessions.html`**: cost by agent and by day, the costliest sessions with
|
|
132
135
|
their peak context (⚠️ over 300k tokens), length and first message, and tips to spend less.
|
|
133
|
-
- **Open:** `hivey agent-map open` (
|
|
136
|
+
- **Open:** `hivey agent-map open` (or the fleet page's 📊 Jobs tab) opens `http://127.0.0.1:42817/latest/agent-map.html`
|
|
134
137
|
(the map first; the stats page when there is no map yet). With no report yet it builds the pages without
|
|
135
138
|
a model in seconds, opens them, then draws the map in the background (`first-run.json` stops a second
|
|
136
139
|
click from starting another build). If a stats page fails, the logs and sessions pages still publish.
|
|
@@ -181,25 +184,25 @@ hivey agent-map schedule install [--at 06:30] [--model sonnet] # | remove | st
|
|
|
181
184
|
|
|
182
185
|
## Agent fleet (what every agent does now)
|
|
183
186
|
|
|
184
|
-
`hivey agent-map fleet` (or `
|
|
185
|
-
agent in hivey at a desk in a 3D
|
|
187
|
+
`hivey agent-map fleet` (or `fleet`; hivey menu → agent fleet) opens http://127.0.0.1:42817/fleet/ (old /fleet/ links redirect there; files in `reports/fleet/`): every live
|
|
188
|
+
agent in hivey at a desk in a 3D fleet, one room per space, and one spaceship per hivey session (`hivey session list`: the default session flies the classic frigate, the others a carrier, an explorer or a recoloured frigate, their name painted on the hull; a stopped session's ship has cold engines and its agents asleep at their desks, read from its saved `session.json`; a running one's engines burn). Click an agent to open its session in a terminal: the one already showing it, or a new Terminal/iTerm window running `hivey session attach <name>`, which also starts a stopped session. Click the name painted on a ship's hull for its menu (hover shows its agent count): open/start the session, or stop it (a second click confirms; `hivey session stop` ends all its agents and closes its terminal; never the default session). The space outside is one of six scenes (violet, emerald, crimson, deep blue, golden twin suns, a singularity with its lensed accretion disk), chosen with the page's 🌌 setting: a new one on every load, or always the one you pick (saved with the ⏱ setting; `?space=1..6` in the address overrides it). Drag the hull name to move the ship; positions are kept in `~/.hivey/agent-map/fleet-settings.json` with the ⏱ setting. Open, compact and clear reach the agent through its own session's socket. The details panel (right-click an agent, or ⓘ) has a 📚 Wiki section: the agent's own `<name>-wiki/` (in its folder, or the folder named after its space under `~/agents` or `~/swarms`), its 8 newest pages and reports and its latest `log.md` entries; click one to open it in Obsidian (`obsidian://open`; a wiki that is not an Obsidian vault yet opens in the default Markdown app). After a /compact the context shown is the compacted size until the agent's next reply. Solo agents, extra sessions in a space and
|
|
186
189
|
each swarm's coordinator get a desk; a swarm's workers and critics stand beside their coordinator's desk.
|
|
187
190
|
|
|
188
191
|
- **Reads** each desk's terminal (`hivey pane read`, any CLI) and its Claude Code session log (context
|
|
189
192
|
size = input + cache tokens of the last reply, model, last prompt, the session recap, last replies and
|
|
190
|
-
tools). `
|
|
193
|
+
tools). `fleet.py run` writes `~/.hivey/agent-map/reports/fleet/fleet.json`.
|
|
191
194
|
- **Summarizes** with Haiku (`claude -p --model haiku`, no tools, no settings, no session saved), in
|
|
192
|
-
batches of 10, only the desks whose terminal or log changed (`~/.hivey/agent-map/
|
|
195
|
+
batches of 10, only the desks whose terminal or log changed (`~/.hivey/agent-map/fleet-cache.json`):
|
|
193
196
|
current job, a speech-bubble line, up to 3 achievements, next step, what to answer when it waits
|
|
194
197
|
for you, and keep / compact / clear advice. `--no-llm` (or a failed call) falls back to the recap.
|
|
195
|
-
- **Refreshes** while the page is open (the server's
|
|
198
|
+
- **Refreshes** while the page is open (the server's fleet clock; the page polls every 15 s): a live
|
|
196
199
|
pass every minute and when the page loads (`run --quick`: status, context and terminal are fresh,
|
|
197
200
|
only desks whose status changed go to the model) and a full pass every 5 minutes (every desk whose
|
|
198
201
|
terminal changed), or a full pass now with ⟳ / `r`. The page's ⏱ setting picks every minute (that),
|
|
199
202
|
every 5 min, 15 min or hour (full passes only) or on reload only (no clock: a full pass when the page loads or on ⟳),
|
|
200
|
-
saved in `~/.hivey/agent-map/
|
|
203
|
+
saved in `~/.hivey/agent-map/fleet-settings.json`. The header shows the time of the last update, of
|
|
201
204
|
the last full summary pass and of the next update.
|
|
202
|
-
- **Page** (titled "hivey fleet", with the hivey logo; the ⚙ button holds the 🎵 music, ⏱ updates and 🌌 background settings): Fleet (Three.js r160, MIT, vendored in `scripts/
|
|
205
|
+
- **Page** (titled "hivey fleet", with the hivey logo; the ⚙ button holds the 🎵 music, ⏱ updates and 🌌 background settings): Fleet (Three.js r160, MIT, vendored in `scripts/fleet/` with RoomEnvironment, OutlineEffect and the bloom
|
|
203
206
|
post-processing; `ship.js` builds the scene: the deck of a spacecraft floating in front of a galaxy, viewports, hull
|
|
204
207
|
light strips, an observation lounge with a holotable, galley, server racks, plant pods; the crew are mini robots,
|
|
205
208
|
one per desk, glass visor eyes in the status colour, team-coloured ear pods; ✨ HD (bloom) or 🎨 comic, `t`; only working agents move, a blocked one waves, labels
|
|
@@ -209,8 +212,8 @@ each swarm's coordinator get a desk; a swarm's workers and critics stand beside
|
|
|
209
212
|
terminal tail). Compact / Clear type `/compact` or `/clear` into an agent that is not working (two
|
|
210
213
|
clicks).
|
|
211
214
|
|
|
212
|
-
- **Models and music** (`scripts/
|
|
213
|
-
`
|
|
215
|
+
- **Models and music** (`scripts/fleet/models/`, `music/`, stored as `.b64` because skills install text files;
|
|
216
|
+
`fleet.py` decodes them into the page folder): the animated crew robot (RobotExpressive, Tomás Laulhé /
|
|
214
217
|
Quaternius, CC0: Idle + nods when working, Wave when blocked, ThumbsUp when done, Sitting when idle), Kenney
|
|
215
218
|
Space Kit and Space Station Kit pieces (CC0: desks, chairs, generators, dishes, small craft, astronauts,
|
|
216
219
|
consoles, crates), licences in `models/LICENSE-*`; 10 MusicGen electronic space tracks (`music/README.txt` has their prompts), 🔇/🎵 or `m`; the 🎵 menu plays a new one each time (moving on when one ends) or always one (saved with the other settings). Browsers allow sound only after you touch the page, so when playing at once is refused the music starts with your first click or key press anywhere.
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
agent_map.py nightly [--model sonnet] [--no-llm] [--open]
|
|
12
12
|
a full report in ~/.hivey/agent-map/reports/<date>/
|
|
13
13
|
agent_map.py open open the latest report (hivey menu → agent jobs)
|
|
14
|
-
agent_map.py
|
|
14
|
+
agent_map.py fleet [open|run] [--no-llm] the agent fleet: every live agent at a desk, its current
|
|
15
15
|
job (terminal + session log, summed up by Sonnet), context
|
|
16
16
|
and compact/clear advice (hivey menu → agent fleet)
|
|
17
17
|
agent_map.py schedule [install|remove|status|offer] [--at 06:30] [--model sonnet]
|
|
@@ -1067,6 +1067,8 @@ def main() -> int:
|
|
|
1067
1067
|
en.add_argument("folder", nargs="?", default=str(STATE / "reports" / "latest"))
|
|
1068
1068
|
op = sub.add_parser("open", help="open the latest report (builds the first one if there is none)")
|
|
1069
1069
|
op.add_argument("--model", default="sonnet")
|
|
1070
|
+
op.add_argument("--no-open", action="store_true", help="build the first report if there is none, open nothing "
|
|
1071
|
+
"(the fleet page's Jobs tab)")
|
|
1070
1072
|
sc = sub.add_parser("schedule", help="the nightly launchd run: install | remove | status")
|
|
1071
1073
|
sc.add_argument("action", choices=["install", "remove", "status", "offer", "token"], nargs="?", default="status")
|
|
1072
1074
|
sc.add_argument("--command", help='token: the command printing the `claude setup-token` token, '
|
|
@@ -1076,7 +1078,7 @@ def main() -> int:
|
|
|
1076
1078
|
rf = sub.add_parser("refresh", help="new scan into the latest report's pages, no model (the Refresh button)")
|
|
1077
1079
|
rf.add_argument("--days", type=int, default=7)
|
|
1078
1080
|
sub.add_parser("serve", help="serve the report pages on 127.0.0.1 (`open` starts it)")
|
|
1079
|
-
of = sub.add_parser("
|
|
1081
|
+
of = sub.add_parser("fleet", help="the agent fleet: what every live agent does now (open | run)")
|
|
1080
1082
|
of.add_argument("action", choices=["open", "run"], nargs="?", default="open")
|
|
1081
1083
|
of.add_argument("--no-llm", action="store_true", help="run: summaries from the session recap, no model")
|
|
1082
1084
|
of.add_argument("--model", default="haiku")
|
|
@@ -1114,7 +1116,7 @@ def main() -> int:
|
|
|
1114
1116
|
return 0
|
|
1115
1117
|
if a.cmd == "open":
|
|
1116
1118
|
import report
|
|
1117
|
-
return report.open_latest(a.model)
|
|
1119
|
+
return report.open_latest(a.model, not a.no_open)
|
|
1118
1120
|
if a.cmd == "schedule":
|
|
1119
1121
|
import report
|
|
1120
1122
|
if a.action == "token":
|
|
@@ -1134,9 +1136,9 @@ def main() -> int:
|
|
|
1134
1136
|
if a.cmd == "serve":
|
|
1135
1137
|
import serve
|
|
1136
1138
|
return serve.serve()
|
|
1137
|
-
if a.cmd == "
|
|
1138
|
-
import
|
|
1139
|
-
return
|
|
1139
|
+
if a.cmd == "fleet":
|
|
1140
|
+
import fleet
|
|
1141
|
+
return fleet.open_page(a.model) if a.action == "open" else fleet.run(a.model, not a.no_llm)
|
|
1140
1142
|
if a.cmd == "context":
|
|
1141
1143
|
return context_cmd(a.agents, a.set)
|
|
1142
1144
|
if a.cmd == "link":
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""hivey's layer on top of the archify pages, added after they are finalized:
|
|
2
2
|
|
|
3
|
-
- a navbar (Stats · Map · Logs) on every page, so each page reaches the others;
|
|
3
|
+
- a navbar (🚀 Fleet · Stats · Map · Logs) on every page, so each page reaches the others;
|
|
4
4
|
- on the map: each job/agent box coloured by its spend in the window (green: none, red: the most),
|
|
5
5
|
with a legend; a hover explanation on each column header; and, in the box's info card, what the
|
|
6
6
|
job or agent does, its tokens, cost, calls, models and last run.
|
|
@@ -39,6 +39,7 @@ NAV_CSS = """
|
|
|
39
39
|
border-bottom:1px solid rgba(127,127,127,.25);background:rgba(127,127,127,.06)}
|
|
40
40
|
.hv-nav a{color:inherit;opacity:.65;text-decoration:none;padding:4px 12px;border-radius:999px}
|
|
41
41
|
.hv-nav a:hover{opacity:1;background:rgba(127,127,127,.14)}
|
|
42
|
+
.hv-nav a.hv-fleet{opacity:1;font-weight:600;margin-right:8px;border:1px solid rgba(127,127,127,.3)}
|
|
42
43
|
.hv-nav a.on{opacity:1;background:rgba(47,111,236,.16);color:#2f6fec}
|
|
43
44
|
.hv-nav .hv-span{display:inline-flex;margin-left:12px;border:1px solid rgba(127,127,127,.3);border-radius:999px;padding:2px}
|
|
44
45
|
.hv-nav .hv-span a{padding:2px 10px;font-weight:600;font-size:12px}
|
|
@@ -49,6 +50,7 @@ NAV_CSS = """
|
|
|
49
50
|
"""
|
|
50
51
|
|
|
51
52
|
MAP_CSS = """
|
|
53
|
+
.hv-off{margin-top:6px;padding-top:6px;border-top:1px solid rgba(127,127,127,.25);max-width:340px;line-height:1.35}
|
|
52
54
|
.hv-legend{position:fixed;left:14px;bottom:14px;z-index:40;padding:8px 10px;border-radius:10px;
|
|
53
55
|
font:12px/1.3 -apple-system,BlinkMacSystemFont,sans-serif;background:rgba(255,255,255,.92);color:#1d2330;
|
|
54
56
|
border:1px solid rgba(127,127,127,.3);box-shadow:0 2px 10px rgba(0,0,0,.08)}
|
|
@@ -85,7 +87,10 @@ def nav(active: str, generated: str, days: int = 7) -> str:
|
|
|
85
87
|
day = days == 1 # the toggle opens the same page in the other window
|
|
86
88
|
toggle = (f'<span class="hv-span"><a href="{active if day else DAY_DIR + "/" + active}"{" class=on" if day else ""}>24 h</a>'
|
|
87
89
|
f'<a href="{"../" + active if day else active}"{"" if day else " class=on"}>7 days</a></span>')
|
|
88
|
-
|
|
90
|
+
# back to the fleet page (it shows these pages in its Jobs tab, where the link hides itself)
|
|
91
|
+
fleet = ('<a class="hv-fleet" href="/fleet/?view=fleet" target="_top" title="The hivey fleet: every live agent now">'
|
|
92
|
+
'🚀 Fleet</a><script>if(window.top!==window)document.currentScript.previousElementSibling.remove()</script>')
|
|
93
|
+
return (f'<nav class="hv-nav">{fleet}{items}{toggle}<span class="hv-when">scan {when}</span>'
|
|
89
94
|
'<button class="hv-refresh" type="button" title="Scan again now and reload (free: no model run)" '
|
|
90
95
|
'onclick="hvRefresh(this)">↻ Refresh</button></nav>' + REFRESH_JS)
|
|
91
96
|
|
|
@@ -260,6 +265,16 @@ new MutationObserver(refill).observe(document.body,{childList:true,subtree:true,
|
|
|
260
265
|
"""
|
|
261
266
|
|
|
262
267
|
|
|
268
|
+
def jobs_off_map(spec: dict, meta: dict, snap: dict) -> list[dict]:
|
|
269
|
+
"""The scanned jobs no map box stands for: a job is on the map when a box's map-meta refs list it,
|
|
270
|
+
or list the agent it belongs to (links_candidates.belongs_to). The nightly model gets this list
|
|
271
|
+
so new jobs reach the map, and the map page names any still missing."""
|
|
272
|
+
boxes = {str(n.get("id")) for n in spec.get("nodes") or []}
|
|
273
|
+
refs = {r for k, v in (meta.get("nodes") or {}).items() if k in boxes for r in (v or {}).get("refs") or []}
|
|
274
|
+
owner = {b.get("job"): b.get("agent") for b in (snap.get("links_candidates") or {}).get("belongs_to") or []}
|
|
275
|
+
return [j for j in snap.get("jobs") or [] if j.get("id") and j["id"] not in refs and owner.get(j["id"]) not in refs]
|
|
276
|
+
|
|
277
|
+
|
|
263
278
|
def enhance_folder(folder: Path, snap: dict, job_state) -> None:
|
|
264
279
|
generated, days = snap.get("generated", ""), snap.get("window_days", 7)
|
|
265
280
|
stats = folder / "agent-stats.html"
|
|
@@ -273,6 +288,11 @@ def enhance_folder(folder: Path, snap: dict, job_state) -> None:
|
|
|
273
288
|
except (OSError, ValueError):
|
|
274
289
|
meta = {}
|
|
275
290
|
data, top = node_data(snap, spec, meta, job_state)
|
|
291
|
+
off = jobs_off_map(spec, meta, snap)
|
|
292
|
+
off_note = (f'<div class="hv-off" title="{html.escape(", ".join(j["id"] for j in off))}">'
|
|
293
|
+
f'<b>Not on the map yet ({len(off)}):</b> {html.escape(", ".join(j.get("name") or j["id"] for j in off))}'
|
|
294
|
+
'<br><span style="opacity:.65">the next nightly run adds them; the Logs page has every job</span></div>'
|
|
295
|
+
if off else "")
|
|
276
296
|
stages = dict(STAGE_HELP)
|
|
277
297
|
stages.update({k.lower(): v for k, v in (meta.get("stages") or {}).items()})
|
|
278
298
|
script = (MAP_JS.replace("__DATA__", json.dumps(data)).replace("__STAGES__", json.dumps(stages))
|
|
@@ -280,5 +300,5 @@ def enhance_folder(folder: Path, snap: dict, job_state) -> None:
|
|
|
280
300
|
legend = (f'<div class="hv-legend"><b>Spend, last {span(days)}</b><div class="bar"></div>'
|
|
281
301
|
f'<div class="ends"><span>$0</span><span>{money(top)}</span></div>'
|
|
282
302
|
f'<div style="opacity:.65;margin-top:3px">click a box for what it does, tokens and models</div>'
|
|
283
|
-
f'<div style="opacity:.65">⚠️ its last run failed, was missed or logged errors</div
|
|
303
|
+
f'<div style="opacity:.65">⚠️ its last run failed, was missed or logged errors</div>{off_note}</div>')
|
|
284
304
|
page.write_text(inject(page.read_text(), NAV_CSS + MAP_CSS, nav("agent-map.html", generated, days) + legend, script))
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="utf-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
6
|
<title>hivey fleet</title>
|
|
7
|
-
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0
|
|
7
|
+
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'><rect width='40' height='40' rx='9' fill='%239befc8'/><path d='M10 9h7v9h6V9h7v23h-7V22h-6v10h-7z' fill='%23122319'/></svg>">
|
|
8
8
|
<style>
|
|
9
9
|
:root{
|
|
10
10
|
--bg:#0d1119;--panel:#151b27;--panel2:#1b2332;--line:#273246;--text:#e8edf5;--muted:#8d9ab0;
|
|
@@ -65,10 +65,10 @@ header{position:sticky;top:0;z-index:20;display:flex;flex-wrap:wrap;align-items:
|
|
|
65
65
|
.ask .go{margin-left:auto;font-size:12px;color:var(--honey);white-space:nowrap}
|
|
66
66
|
/* ---------- views ---------- */
|
|
67
67
|
main{position:relative}
|
|
68
|
-
#
|
|
68
|
+
#fleet{position:relative;height:calc(100vh - 118px);min-height:420px;overflow:hidden;
|
|
69
69
|
background:radial-gradient(1200px 600px at 50% 20%,#18202e,#0b0e15)}
|
|
70
|
-
#
|
|
71
|
-
#
|
|
70
|
+
#fleet canvas{display:block;cursor:grab}
|
|
71
|
+
#fleet canvas.drag{cursor:grabbing}
|
|
72
72
|
#labels{position:absolute;inset:0;pointer-events:none;overflow:hidden}
|
|
73
73
|
.tag{position:absolute;transform:translate(-50%,-100%);display:flex;flex-direction:column;align-items:center;gap:4px;will-change:transform}
|
|
74
74
|
.bubble{max-width:230px;padding:7px 10px;border-radius:12px;background:#f8fafc;color:#0f172a;font-size:12px;line-height:1.3;
|
|
@@ -152,6 +152,9 @@ main{position:relative}
|
|
|
152
152
|
.actions button.primary{border-color:rgba(245,184,61,.6)}
|
|
153
153
|
.actions button:disabled{opacity:.35;cursor:not-allowed}
|
|
154
154
|
/* ---------- list ---------- */
|
|
155
|
+
#jobs{display:none;background:#fff}
|
|
156
|
+
#jobs iframe{display:block;width:100%;height:calc(100vh - 70px);border:0}
|
|
157
|
+
body.v-jobs .search{visibility:hidden}
|
|
155
158
|
#list{display:none;padding:12px 18px 40px}
|
|
156
159
|
table{width:100%;border-collapse:collapse;font-size:12.5px}
|
|
157
160
|
th{text-align:left;color:var(--muted);font-weight:600;padding:7px 8px;border-bottom:1px solid var(--line);cursor:pointer;white-space:nowrap;position:sticky;top:57px;background:var(--bg)}
|
|
@@ -188,9 +191,10 @@ td.j{max-width:420px}
|
|
|
188
191
|
<div class="spacer"></div>
|
|
189
192
|
<input class="search" id="q" placeholder="Search agents, jobs… ( / )" autocomplete="off">
|
|
190
193
|
<div class="seg" id="views">
|
|
191
|
-
<button data-v="
|
|
194
|
+
<button data-v="fleet" title="Your spaceships, one per hivey session (1)">🚀 Fleet</button>
|
|
192
195
|
<button data-v="board" title="Cards by what needs you (2)">▦ Board</button>
|
|
193
196
|
<button data-v="list" title="One row per agent, for hundreds (3)">☰ List</button>
|
|
197
|
+
<button data-v="jobs" title="Agent jobs: scheduled and background jobs, their map, spend, logs and sessions (4)">📊 Jobs</button>
|
|
194
198
|
</div>
|
|
195
199
|
<button class="iconbtn" id="music" title="Background music on/off (m)">🔇</button>
|
|
196
200
|
<button class="iconbtn" id="refresh" title="Read every terminal and session log again now (r)">⟳</button>
|
|
@@ -214,7 +218,7 @@ td.j{max-width:420px}
|
|
|
214
218
|
</select>
|
|
215
219
|
</label>
|
|
216
220
|
<label><span>⏱ Updates</span>
|
|
217
|
-
<select class="every" id="every" title="How the
|
|
221
|
+
<select class="every" id="every" title="How the fleet updates itself">
|
|
218
222
|
<option value="minute">every minute</option>
|
|
219
223
|
<option value="5min">every 5 min</option>
|
|
220
224
|
<option value="15min">every 15 min</option>
|
|
@@ -237,17 +241,18 @@ td.j{max-width:420px}
|
|
|
237
241
|
</div>
|
|
238
242
|
<div id="inbox"></div>
|
|
239
243
|
<main>
|
|
240
|
-
<section id="
|
|
244
|
+
<section id="fleet">
|
|
241
245
|
<div id="labels"></div>
|
|
242
246
|
<div id="hud"><button id="fit" title="Show everyone (f)">⤢ fit</button><button id="style" title="Comic or realistic look (t)">🎨 comic</button><span>drag to move · scroll to zoom · click an agent to open it in hivey · right-click for details</span></div>
|
|
243
247
|
</section>
|
|
244
248
|
<section id="board"></section>
|
|
245
249
|
<section id="list"></section>
|
|
250
|
+
<section id="jobs"><iframe id="jobsframe" title="Agent jobs"></iframe></section>
|
|
246
251
|
</main>
|
|
247
252
|
<aside id="drawer"></aside>
|
|
248
253
|
<div id="tip"></div>
|
|
249
254
|
<div id="toast"></div>
|
|
250
255
|
<audio id="bgm" preload="auto"></audio>
|
|
251
|
-
<script type="module" src="./
|
|
256
|
+
<script type="module" src="./fleet.js"></script>
|
|
252
257
|
</body>
|
|
253
258
|
</html>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// hivey
|
|
2
|
-
// serve.py while this page is open). Three.js draws the
|
|
1
|
+
// hivey fleet: every live agent at a desk. Data: ./fleet.json (fleet.py, refreshed every 5 min by
|
|
2
|
+
// serve.py while this page is open). Three.js draws the fleet; the board and the list are plain HTML.
|
|
3
3
|
// Click an agent: open its terminal in hivey. Right-click (or ⓘ): details. Only working agents move.
|
|
4
4
|
import * as THREE from './three.module.min.js';
|
|
5
5
|
import { RoomEnvironment } from './RoomEnvironment.js';
|
|
@@ -22,13 +22,16 @@ const st = s => STATUS[s] || { label: s || '?', emoji: '•', color: '#64748b' }
|
|
|
22
22
|
const REDUCED = matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
23
23
|
|
|
24
24
|
let data = null, agents = [], selected = null;
|
|
25
|
-
|
|
26
|
-
ui.
|
|
25
|
+
// settings saved before the rename (the page was the agent office) carry over
|
|
26
|
+
const ui = JSON.parse(localStorage.getItem('hv-fleet-ship') || localStorage.getItem('hv-' + 'off' + 'ice-ship') || '{}');
|
|
27
|
+
ui.view ||= 'fleet';
|
|
28
|
+
const VIEWS = ['fleet', 'board', 'list', 'jobs'];
|
|
29
|
+
{ const v = new URLSearchParams(location.search).get('view'); if (VIEWS.includes(v)) ui.view = v; if (v) history.replaceState(null, '', location.pathname); } // ?view=jobs from the menu or a jobs page
|
|
27
30
|
ui.filter ||= null;
|
|
28
31
|
if (ui.toon === undefined) ui.toon = false;
|
|
29
|
-
const save = () => localStorage.setItem('hv-
|
|
30
|
-
// ship positions also live on the
|
|
31
|
-
const saveShips = () => { save(); fetch('/hv-
|
|
32
|
+
const save = () => localStorage.setItem('hv-fleet-ship', JSON.stringify({ view: ui.view, filter: ui.filter, toon: ui.toon, music: ui.music, ships: ui.ships, space: ui.space, track: ui.track }));
|
|
33
|
+
// ship positions also live on the fleet server, so every browser opens the fleet where you left it
|
|
34
|
+
const saveShips = () => { save(); fetch('/hv-fleet-settings', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ ships: ui.ships || {} }) }).catch(() => {}); };
|
|
32
35
|
|
|
33
36
|
// ---------------------------------------------------------------- helpers
|
|
34
37
|
function hue(name) { let h = 0; for (const c of name || '') h = (h * 31 + c.charCodeAt(0)) >>> 0; return h % 360; }
|
|
@@ -121,35 +124,35 @@ document.addEventListener('keydown', e => { if (e.key === 'Escape') closeShipMen
|
|
|
121
124
|
async function stopSession(name) {
|
|
122
125
|
toast(`Stopping session ${name}…`);
|
|
123
126
|
try {
|
|
124
|
-
const r = await fetch('/hv-
|
|
127
|
+
const r = await fetch('/hv-fleet-action', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ action: 'stop-session', session: name }) });
|
|
125
128
|
const j = await r.json();
|
|
126
129
|
toast(j.message || (j.ok ? `Session ${name} stopped` : `Could not stop session ${name}`));
|
|
127
|
-
if (j.ok) fetch('/hv-
|
|
128
|
-
} catch (e) { toast('The
|
|
130
|
+
if (j.ok) fetch('/hv-fleet-refresh', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: '{"quick":true}' }).then(() => setTimeout(poll, 2500));
|
|
131
|
+
} catch (e) { toast('The fleet server is not answering: run `hivey agent-map fleet` again'); }
|
|
129
132
|
}
|
|
130
133
|
// click on a ship's name tag: that hivey session in a terminal (a new one if none shows it; starts a stopped one)
|
|
131
134
|
async function openSession(name, running) {
|
|
132
135
|
warpPing();
|
|
133
136
|
toast(running ? `Opening session ${name}…` : `Starting session ${name}…`);
|
|
134
137
|
try {
|
|
135
|
-
const r = await fetch('/hv-
|
|
138
|
+
const r = await fetch('/hv-fleet-action', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ action: 'session', session: name }) });
|
|
136
139
|
const j = await r.json();
|
|
137
140
|
toast(j.message || (j.ok ? `Session ${name} opened` : `Could not open session ${name}`));
|
|
138
|
-
if (j.ok && !running) setTimeout(() => fetch('/hv-
|
|
139
|
-
} catch (e) { toast('The
|
|
141
|
+
if (j.ok && !running) setTimeout(() => fetch('/hv-fleet-refresh', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: '{"quick":true}' }).then(() => setTimeout(poll, 2500)), 4000);
|
|
142
|
+
} catch (e) { toast('The fleet server is not answering: run `hivey agent-map fleet` again'); }
|
|
140
143
|
}
|
|
141
144
|
async function act(a, action) {
|
|
142
145
|
if (action === 'focus' || action === 'compact') {
|
|
143
146
|
warpPing();
|
|
144
147
|
toast(action === 'focus' ? `Opening ${a.name} in hivey…` : `Compacting ${a.name}…`);
|
|
145
|
-
|
|
148
|
+
fleet.flash(a.id);
|
|
146
149
|
document.querySelectorAll(`[data-id="${CSS.escape(a.id)}"]`).forEach(el => { el.classList.remove('flash'); void el.offsetWidth; el.classList.add('flash'); });
|
|
147
150
|
}
|
|
148
151
|
try {
|
|
149
|
-
const r = await fetch('/hv-
|
|
152
|
+
const r = await fetch('/hv-fleet-action', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ id: a.id, pane: a.pane, action }) });
|
|
150
153
|
const j = await r.json();
|
|
151
154
|
toast(j.ok && action === 'focus' && !/new terminal/.test(j.message || '') ? `${a.name} is open in hivey ↗` : `${a.name}: ${j.message}`);
|
|
152
|
-
} catch (e) { toast('The
|
|
155
|
+
} catch (e) { toast('The fleet server is not answering: run `hivey agent-map fleet` again'); }
|
|
153
156
|
}
|
|
154
157
|
// clear needs a second click within 3 s (no browser dialogs); compact goes at once
|
|
155
158
|
function armed(btn, a, action) {
|
|
@@ -197,7 +200,7 @@ function renderHeader() {
|
|
|
197
200
|
$('#pills').querySelectorAll('.pill').forEach(p => p.onclick = () => { ui.filter = ui.filter === p.dataset.f ? null : p.dataset.f; save(); renderAll(); });
|
|
198
201
|
tickSub();
|
|
199
202
|
}
|
|
200
|
-
let every = 'minute'; // the refresh setting, kept by the
|
|
203
|
+
let every = 'minute'; // the refresh setting, kept by the fleet server (shared by every open page)
|
|
201
204
|
const EVERY_S = { minute: 60, '5min': 300, '15min': 900, '1h': 3600 };
|
|
202
205
|
function tickSub() {
|
|
203
206
|
if (!data) return;
|
|
@@ -309,16 +312,16 @@ function openDrawer(a) {
|
|
|
309
312
|
const el = $('#drawer');
|
|
310
313
|
el.dataset.id = a.id;
|
|
311
314
|
wireDrawer(a);
|
|
312
|
-
|
|
315
|
+
fleet.markSelected();
|
|
313
316
|
}
|
|
314
317
|
function wireDrawer(a) {
|
|
315
318
|
$('#drawer').querySelectorAll('[data-wiki]').forEach(l => l.onclick = async e => {
|
|
316
319
|
e.preventDefault(); e.stopPropagation();
|
|
317
320
|
try {
|
|
318
|
-
const r = await fetch('/hv-
|
|
321
|
+
const r = await fetch('/hv-fleet-action', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ id: a.id, action: 'wiki', path: l.dataset.wiki }) });
|
|
319
322
|
const j = await r.json();
|
|
320
323
|
toast(j.ok ? `📚 ${j.message}` : `${a.name}: ${j.message}`);
|
|
321
|
-
} catch (err) { toast('The
|
|
324
|
+
} catch (err) { toast('The fleet server is not answering: run `hivey agent-map fleet` again'); }
|
|
322
325
|
});
|
|
323
326
|
$('#drawer').querySelectorAll('button[data-act]').forEach(b => b.onclick = e => {
|
|
324
327
|
e.stopPropagation();
|
|
@@ -329,11 +332,11 @@ function wireDrawer(a) {
|
|
|
329
332
|
armed(b, a, k);
|
|
330
333
|
});
|
|
331
334
|
}
|
|
332
|
-
function closeDrawer() { $('#drawer').classList.remove('open'); selected = null;
|
|
335
|
+
function closeDrawer() { $('#drawer').classList.remove('open'); selected = null; fleet.markSelected(); }
|
|
333
336
|
|
|
334
|
-
// ---------------------------------------------------------------- the 3D
|
|
335
|
-
const
|
|
336
|
-
const host = $('#
|
|
337
|
+
// ---------------------------------------------------------------- the 3D fleet
|
|
338
|
+
const fleet = (() => {
|
|
339
|
+
const host = $('#fleet'), labels = $('#labels');
|
|
337
340
|
let renderer;
|
|
338
341
|
try { renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true }); } catch (e) { return { ok: false, build() {}, markSelected() {}, resize() {}, fit() {}, flash() {}, setSpace() {} }; }
|
|
339
342
|
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
|
|
@@ -699,7 +702,7 @@ const office = (() => {
|
|
|
699
702
|
cam.lookAt(target);
|
|
700
703
|
dirty = true;
|
|
701
704
|
}
|
|
702
|
-
// fit = project the
|
|
705
|
+
// fit = project the fleet's corners into the camera's view and frame them with a margin
|
|
703
706
|
function fit() {
|
|
704
707
|
target.set(bounds.cx, 0, bounds.cz);
|
|
705
708
|
placeCam(); cam.updateMatrixWorld();
|
|
@@ -864,7 +867,7 @@ const office = (() => {
|
|
|
864
867
|
let last = 0, lastCode = 0;
|
|
865
868
|
function frame(t) {
|
|
866
869
|
requestAnimationFrame(frame);
|
|
867
|
-
if (document.hidden || ui.view !== '
|
|
870
|
+
if (document.hidden || ui.view !== 'fleet') return;
|
|
868
871
|
const busy = flashes.length > 0 || (!REDUCED && desks.some(d => d.a.status === 'working' || d.a.status === 'blocked' || d.team.some(m => m.status === 'working')));
|
|
869
872
|
const moving = busy || (!REDUCED && ship.thrusting());
|
|
870
873
|
const dt = Math.min(0.1, (t - (frame.prev || t)) / 1000); frame.prev = t;
|
|
@@ -929,33 +932,53 @@ function renderAll() {
|
|
|
929
932
|
renderHeader();
|
|
930
933
|
renderInbox();
|
|
931
934
|
document.querySelectorAll('#views button').forEach(b => b.classList.toggle('on', b.dataset.v === ui.view));
|
|
932
|
-
$('#
|
|
935
|
+
$('#fleet').style.display = ui.view === 'fleet' ? '' : 'none';
|
|
933
936
|
$('#board').style.display = ui.view === 'board' ? 'block' : 'none';
|
|
934
937
|
$('#list').style.display = ui.view === 'list' ? 'block' : 'none';
|
|
935
|
-
|
|
938
|
+
showJobs();
|
|
939
|
+
if (ui.view === 'fleet') { fleet.build(agents.filter(visible), data.sessions); fleet.resize(); }
|
|
936
940
|
if (ui.view === 'board') renderBoard();
|
|
937
941
|
if (ui.view === 'list') renderList();
|
|
938
942
|
if (selected) { const a = agents.find(x => x.id === selected); if (a && $('#drawer').classList.contains('open')) openDrawer(a); }
|
|
939
943
|
}
|
|
944
|
+
// the agent jobs pages (Map, Stats, Logs, Sessions) in a frame, loaded the first time the tab opens;
|
|
945
|
+
// the server redirects /hv-jobs to the latest report or builds the first one
|
|
946
|
+
function showJobs() {
|
|
947
|
+
const on = ui.view === 'jobs', frame = $('#jobsframe');
|
|
948
|
+
document.body.classList.toggle('v-jobs', on);
|
|
949
|
+
$('#jobs').style.display = on ? 'block' : 'none';
|
|
950
|
+
if (!on) return;
|
|
951
|
+
if (!frame.dataset.loaded) { // an older page server has no /hv-jobs: the latest map straight away
|
|
952
|
+
frame.dataset.loaded = '1';
|
|
953
|
+
fetch('/hv-jobs', { cache: 'no-store' }).then(r => { frame.src = r.ok ? r.url : '/latest/agent-map.html'; })
|
|
954
|
+
.catch(() => { frame.src = '/latest/agent-map.html'; });
|
|
955
|
+
}
|
|
956
|
+
fitJobs();
|
|
957
|
+
}
|
|
958
|
+
function fitJobs() {
|
|
959
|
+
const frame = $('#jobsframe');
|
|
960
|
+
if (ui.view === 'jobs') frame.style.height = Math.max(420, innerHeight - frame.getBoundingClientRect().top) + 'px';
|
|
961
|
+
}
|
|
962
|
+
addEventListener('resize', fitJobs);
|
|
940
963
|
async function poll() {
|
|
941
964
|
try {
|
|
942
|
-
if (
|
|
943
|
-
const r = await fetch('./
|
|
965
|
+
if (fleet.ready) await fleet.ready.catch(() => {});
|
|
966
|
+
const r = await fetch('./fleet.json?ts=' + Date.now(), { cache: 'no-store' });
|
|
944
967
|
const j = await r.json();
|
|
945
968
|
if (j.generated !== lastGenerated) {
|
|
946
969
|
lastGenerated = j.generated; data = j;
|
|
947
|
-
if (refreshing && Date.parse(j.generated) > refreshing) { refreshing = false; $('#refresh').innerHTML = '⟳'; toast('
|
|
970
|
+
if (refreshing && Date.parse(j.generated) > refreshing) { refreshing = false; $('#refresh').innerHTML = '⟳'; toast('Fleet updated'); }
|
|
948
971
|
renderAll();
|
|
949
972
|
}
|
|
950
|
-
} catch (e) { console.error('hivey fleet:', e); $('#sub').textContent = 'cannot read
|
|
973
|
+
} catch (e) { console.error('hivey fleet:', e); $('#sub').textContent = 'cannot read fleet.json: is the fleet server running? (hivey menu → agent fleet)'; }
|
|
951
974
|
}
|
|
952
975
|
async function refreshNow() {
|
|
953
976
|
if (refreshing) return;
|
|
954
977
|
refreshing = Date.now();
|
|
955
978
|
$('#refresh').innerHTML = '<span class="spin">⟳</span>';
|
|
956
979
|
tickSub();
|
|
957
|
-
try { await fetch('/hv-
|
|
958
|
-
catch (e) { toast('The
|
|
980
|
+
try { await fetch('/hv-fleet-refresh', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: '{}' }); }
|
|
981
|
+
catch (e) { toast('The fleet server is not answering'); refreshing = false; $('#refresh').innerHTML = '⟳'; }
|
|
959
982
|
setTimeout(() => { if (refreshing) { refreshing = false; $('#refresh').innerHTML = '⟳'; } }, 180000);
|
|
960
983
|
}
|
|
961
984
|
document.querySelectorAll('#views button').forEach(b => b.onclick = () => { ui.view = b.dataset.v; save(); renderAll(); });
|
|
@@ -1016,7 +1039,7 @@ $('#track').onchange = e => {
|
|
|
1016
1039
|
loadTrack(pickTrack());
|
|
1017
1040
|
if (!ui.music) setMusic(true); else bgm.play().catch(() => startOnTouch());
|
|
1018
1041
|
toast(ui.track === 'random' ? `A new track each time (now: ${TRACKS[trackNo - 1][1]})` : `Music: ${TRACKS[trackNo - 1][1]}, always`);
|
|
1019
|
-
post('/hv-
|
|
1042
|
+
post('/hv-fleet-settings', { track: ui.track }).catch(() => {});
|
|
1020
1043
|
};
|
|
1021
1044
|
if (ui.music) { loadTrack(pickTrack()); bgm.play().catch(() => startOnTouch()); }
|
|
1022
1045
|
// only while the page is in front of you: pause when you switch to the terminal or another app or tab
|
|
@@ -1024,7 +1047,7 @@ const inFront = () => !document.hidden && document.hasFocus();
|
|
|
1024
1047
|
function followFocus() { if (!ui.music) return; if (inFront()) bgm.play().catch(() => {}); else bgm.pause(); }
|
|
1025
1048
|
addEventListener('blur', followFocus); addEventListener('focus', followFocus);
|
|
1026
1049
|
document.addEventListener('visibilitychange', followFocus);
|
|
1027
|
-
$('#fit').onclick = () =>
|
|
1050
|
+
$('#fit').onclick = () => fleet.fit();
|
|
1028
1051
|
function toggleStyle() { ui.toon = !ui.toon; save(); $('#style').textContent = ui.toon ? '🎨 comic' : '✨ HD'; renderAll(); }
|
|
1029
1052
|
$('#style').onclick = toggleStyle;
|
|
1030
1053
|
$('#style').textContent = ui.toon ? '🎨 comic' : '✨ HD';
|
|
@@ -1034,14 +1057,14 @@ addEventListener('keydown', e => {
|
|
|
1034
1057
|
if (e.target.matches('input')) { if (e.key === 'Escape') { e.target.value = ''; e.target.blur(); renderAll(); } return; }
|
|
1035
1058
|
if (e.key === '/') { e.preventDefault(); $('#q').focus(); }
|
|
1036
1059
|
else if (e.key === 'Escape') closeDrawer();
|
|
1037
|
-
else if (e.key
|
|
1060
|
+
else if (e.key >= '1' && e.key <= '4') { ui.view = VIEWS[+e.key - 1]; save(); renderAll(); }
|
|
1038
1061
|
else if (e.key === 'r') refreshNow();
|
|
1039
|
-
else if (e.key === 'f')
|
|
1062
|
+
else if (e.key === 'f') fleet.fit();
|
|
1040
1063
|
else if (e.key === 't') toggleStyle();
|
|
1041
1064
|
else if (e.key === 'm') setMusic(!ui.music);
|
|
1042
1065
|
});
|
|
1043
|
-
if (!
|
|
1044
|
-
if (!
|
|
1066
|
+
if (!fleet.ok && ui.view === 'fleet') ui.view = 'board';
|
|
1067
|
+
if (!fleet.ok) document.querySelector('#views [data-v="fleet"]').disabled = true;
|
|
1045
1068
|
setInterval(poll, 15000);
|
|
1046
1069
|
setInterval(tickSub, 1000);
|
|
1047
1070
|
poll();
|
|
@@ -1054,26 +1077,26 @@ const SPACE_NAMES = ['violet', 'emerald', 'crimson', 'deep blue', 'golden', 'sin
|
|
|
1054
1077
|
$('#space').value = /^[1-6]$/.test(String(ui.space)) ? String(ui.space) : 'random';
|
|
1055
1078
|
$('#space').onchange = e => {
|
|
1056
1079
|
ui.space = e.target.value; save();
|
|
1057
|
-
const n =
|
|
1080
|
+
const n = fleet.setSpace(ui.space);
|
|
1058
1081
|
toast(ui.space === 'random' ? `A new space scene every time you open the page (now: ${SPACE_NAMES[n - 1] || '?'})` : `Background: ${SPACE_NAMES[n - 1]}, always`);
|
|
1059
|
-
post('/hv-
|
|
1082
|
+
post('/hv-fleet-settings', { space: ui.space }).catch(() => {});
|
|
1060
1083
|
};
|
|
1061
|
-
post('/hv-
|
|
1084
|
+
post('/hv-fleet-refresh', { load: true }).then(j => {
|
|
1062
1085
|
showEvery(j.every);
|
|
1063
1086
|
if (j.space && j.space !== String(ui.space || 'random')) { // the server's choice wins (set in another browser)
|
|
1064
1087
|
ui.space = j.space; save(); $('#space').value = j.space;
|
|
1065
|
-
if (j.space !== 'random')
|
|
1066
|
-
} else if (!j.space && ui.space) post('/hv-
|
|
1088
|
+
if (j.space !== 'random') fleet.setSpace(j.space);
|
|
1089
|
+
} else if (!j.space && ui.space) post('/hv-fleet-settings', { space: String(ui.space) }).catch(() => {});
|
|
1067
1090
|
if (j.track && j.track !== String(ui.track || 'random')) { // the music choice made in another browser
|
|
1068
1091
|
ui.track = j.track; save(); $('#track').value = j.track;
|
|
1069
1092
|
if (fixedTrack() && fixedTrack() !== trackNo) { loadTrack(fixedTrack()); if (ui.music) bgm.play().catch(() => startOnTouch()); }
|
|
1070
|
-
} else if (!j.track && ui.track) post('/hv-
|
|
1093
|
+
} else if (!j.track && ui.track) post('/hv-fleet-settings', { track: String(ui.track) }).catch(() => {});
|
|
1071
1094
|
const server = j.ships || {}, local = ui.ships || {};
|
|
1072
1095
|
if (Object.keys(server).length) { // the server's positions win; rebuild if they differ from this browser's
|
|
1073
1096
|
if (JSON.stringify(server) !== JSON.stringify(local)) { ui.ships = server; save(); if (data) renderAll(); }
|
|
1074
1097
|
} else if (Object.keys(local).length) saveShips(); // first time: hand this browser's positions to the server
|
|
1075
1098
|
setTimeout(poll, 2500); setTimeout(poll, 8000);
|
|
1076
1099
|
}).catch(() => {});
|
|
1077
|
-
$('#every').onchange = e => post('/hv-
|
|
1100
|
+
$('#every').onchange = e => post('/hv-fleet-settings', { every: e.target.value })
|
|
1078
1101
|
.then(j => { showEvery(j.every); toast({ minute: 'Updates every minute (summaries only for agents that changed)', '5min': 'Updates every 5 minutes', '15min': 'Updates every 15 minutes', '1h': 'Updates every hour', reload: 'Updates only when you reload or press ⟳' }[j.every]); })
|
|
1079
|
-
.catch(() => toast('The
|
|
1102
|
+
.catch(() => toast('The fleet server is not answering'));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Background music for the hivey agent
|
|
1
|
+
Background music for the hivey agent fleet: generated locally with Meta MusicGen (large, MLX) for hivey,
|
|
2
2
|
28 s each, loudness-normalized. The page plays a new one each time (moving on when one ends) or always the
|
|
3
3
|
one picked in its 🎵 menu.
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// hivey
|
|
1
|
+
// hivey fleet, spacecraft edition: the deck of a ship, its workstations and its crew of mini robots.
|
|
2
2
|
// Everything is built from primitives and canvas textures (no image assets): physically based shells,
|
|
3
3
|
// glass visors and emissive LEDs that the bloom pass makes glow.
|
|
4
4
|
import * as THREE from './three.module.min.js';
|
|
@@ -24,7 +24,7 @@ export function createShip(opts) {
|
|
|
24
24
|
let robotScale = 1;
|
|
25
25
|
async function load() {
|
|
26
26
|
const loader = new GLTFLoader();
|
|
27
|
-
await Promise.all(Object.entries(FILES).map(([k, url]) => loader.loadAsync(url).then(g => { MODELS[k] = g; }).catch(e => console.warn('hivey
|
|
27
|
+
await Promise.all(Object.entries(FILES).map(([k, url]) => loader.loadAsync(url).then(g => { MODELS[k] = g; }).catch(e => console.warn('hivey fleet: model', k, e))));
|
|
28
28
|
const c = new THREE.Vector3();
|
|
29
29
|
for (const [k, g] of Object.entries(MODELS)) {
|
|
30
30
|
g.scene.updateMatrixWorld(true);
|