@hivey/cli 0.9.66 → 0.9.68

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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hivey/cli",
3
- "version": "0.9.66",
3
+ "version": "0.9.68",
4
4
  "description": "All your AI swarms, one terminal: a workspace and lead agent for teams of Claude Code and Codex agents",
5
5
  "keywords": [
6
6
  "hivey",
@@ -108,7 +108,7 @@ hivey agent-map nightly [--model sonnet] # a full report now (also: --no-llm,
108
108
  hivey agent-map schedule install [--at 06:30] [--model sonnet] # | remove | status
109
109
  ```
110
110
 
111
- - **hivey menu → agent map** runs `hivey agent-map open`: it opens `agent-stats.html`,
111
+ - **hivey menu → agent jobs** runs `hivey agent-map open`: it opens `agent-stats.html`,
112
112
  `agent-map.html` and `agent-logs.html` from `~/.hivey/agent-map/reports/latest`.
113
113
  - **hivey's layer on the archify pages** (`enhance.py`, after finalize; `agent_map.py enhance [folder]`
114
114
  re-applies it): a Stats · Map · Logs navbar on every page; map boxes coloured by spend (green: none →
@@ -130,7 +130,7 @@ hivey agent-map schedule install [--at 06:30] [--model sonnet] # | remove | st
130
130
  People chatting with agents (Claude Code, Codex, Grok in a terminal; snapshot `interactive`, with one
131
131
  entry per session) go to **`agent-sessions.html`**: cost by agent and by day, the costliest sessions with
132
132
  their peak context (⚠️ over 300k tokens), length and first message, and tips to spend less.
133
- - **Open:** `hivey agent-map open` (hivey menu → agent map) opens `http://127.0.0.1:42817/latest/agent-map.html`
133
+ - **Open:** `hivey agent-map open` (hivey menu → agent jobs) opens `http://127.0.0.1:42817/latest/agent-map.html`
134
134
  (the map first; the stats page when there is no map yet). With no report yet it builds the pages without
135
135
  a model in seconds, opens them, then draws the map in the background (`first-run.json` stops a second
136
136
  click from starting another build). If a stats page fails, the logs and sessions pages still publish.
@@ -179,9 +179,9 @@ hivey agent-map schedule install [--at 06:30] [--model sonnet] # | remove | st
179
179
  - When you are the nightly model: follow the prompt you were given, change only `map.json`,
180
180
  `agent-map.html` and `links.json` (through `link`), and stop after the map passes.
181
181
 
182
- ## Agent office (what every agent does now)
182
+ ## Agent fleet (what every agent does now)
183
183
 
184
- `hivey agent-map office` (hivey menu → agent office) opens http://127.0.0.1:42817/office/: every live
184
+ `hivey agent-map fleet` (or `office`; hivey menu → agent fleet) opens http://127.0.0.1:42817/office/: every live
185
185
  agent in hivey at a desk in a 3D office, 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/office-settings.json` with the ⏱ setting. Open, compact and clear reach the agent through its own session's socket. 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
186
  each swarm's coordinator get a desk; a swarm's workers and critics stand beside their coordinator's desk.
187
187
 
@@ -10,10 +10,10 @@
10
10
  confirm (or remove) a link between two nodes
11
11
  agent_map.py nightly [--model sonnet] [--no-llm] [--open]
12
12
  a full report in ~/.hivey/agent-map/reports/<date>/
13
- agent_map.py open open the latest report (hivey menu → agent map)
13
+ agent_map.py open open the latest report (hivey menu → agent jobs)
14
14
  agent_map.py office [open|run] [--no-llm] the agent office: every live agent at a desk, its current
15
15
  job (terminal + session log, summed up by Sonnet), context
16
- and compact/clear advice (hivey menu → agent office)
16
+ and compact/clear advice (hivey menu → agent fleet)
17
17
  agent_map.py schedule [install|remove|status|offer] [--at 06:30] [--model sonnet]
18
18
  agent_map.py schedule token --command "envsave get es_…" long-lived Claude login for the run
19
19
  the nightly launchd run (com.hivey.agent-map)
@@ -93,7 +93,7 @@ def nav(active: str, generated: str, days: int = 7) -> str:
93
93
  # The Refresh button: the pages are served by `hivey agent-map open` (serve.py) on 127.0.0.1,
94
94
  # which reruns the scan on POST /hv-refresh. Opened as plain files, it says how to get there.
95
95
  REFRESH_JS = """<script>async function hvRefresh(b){
96
- if(location.protocol==='file:'){b.textContent='open from the hivey menu → agent map to refresh';return;}
96
+ if(location.protocol==='file:'){b.textContent='open from the hivey menu → agent jobs to refresh';return;}
97
97
  b.disabled=true;const t0=Date.now();const tick=setInterval(()=>{b.textContent='↻ Scanning… '+Math.round((Date.now()-t0)/1000)+'s';},500);
98
98
  try{const r=await fetch('/hv-refresh',{method:'POST'});const j=await r.json();clearInterval(tick);
99
99
  if(j.ok){location.reload();}else{b.disabled=false;b.textContent='refresh failed';b.title=j.error||'';}}
@@ -560,8 +560,35 @@ const office = (() => {
560
560
  return e;
561
561
  }
562
562
  // one spaceship per hivey session, flying in a column (the default session first, stopped ones dark and empty)
563
+ // free what the old scene used and the new one does not (shapes, materials, textures stay on the GPU
564
+ // otherwise: every rebuild leaked ~10 MB until the page froze)
565
+ function release(prev, next) {
566
+ const keep = new Set([scene.background, scene.environment]);
567
+ const texturesOf = m => Object.values(m).filter(v => v && v.isTexture);
568
+ next.traverse(o => {
569
+ if (o.geometry) keep.add(o.geometry);
570
+ if (o.skeleton) keep.add(o.skeleton);
571
+ [].concat(o.material || []).forEach(m => { keep.add(m); texturesOf(m).forEach(t => keep.add(t)); });
572
+ });
573
+ prev.traverse(o => {
574
+ if (o.geometry && !keep.has(o.geometry)) o.geometry.dispose();
575
+ if (o.skeleton && !keep.has(o.skeleton)) o.skeleton.dispose(); // each robot's bone texture
576
+ [].concat(o.material || []).forEach(m => {
577
+ if (keep.has(m)) return;
578
+ texturesOf(m).forEach(t => { if (!keep.has(t)) t.dispose(); });
579
+ m.dispose();
580
+ });
581
+ });
582
+ }
563
583
  function build(list, sessions) {
584
+ // rebuild only when something drawn changed (searching, polling and view switches call this often)
585
+ const sig = JSON.stringify([list.map(a => [a.id, a.status, a.name, a.space, a.context_pct, a.asleep, a.summary?.bubble,
586
+ a.summary?.needs_you, a.summary?.advice, (a.team || []).map(m => m.status)]), sessions, ui.toon, ui.ships]);
587
+ if (sig === build.sig && world.children.length) return;
588
+ build.sig = sig;
589
+ const prev = world;
564
590
  scene.remove(world); world = new THREE.Group(); scene.add(world);
591
+ ship.reset();
565
592
  desks = []; labels.innerHTML = ''; tags = new Map(); roomTags = [];
566
593
  sessions = sessions?.length ? sessions : [{ name: 'default', running: true, default: true }];
567
594
  const known = new Set(sessions.map(s => s.name));
@@ -638,6 +665,7 @@ const office = (() => {
638
665
  sun.shadow.camera.updateProjectionMatrix();
639
666
  applyStyle(world);
640
667
  markSelected();
668
+ release(prev, world);
641
669
  if (!build.done) { fit(); build.done = true; }
642
670
  dirty = true;
643
671
  }
@@ -875,6 +903,7 @@ const office = (() => {
875
903
  dirty = true;
876
904
  return ship.spaceNo();
877
905
  }
906
+ globalThis.__fleet = { memory: () => ({ ...renderer.info.memory, programs: renderer.info.programs?.length }), world: () => world }; // for debugging leaks
878
907
  return { ok: true, build, markSelected, resize, fit, flash, setSpace, ready: ship.load() };
879
908
  })();
880
909
 
@@ -904,7 +933,7 @@ async function poll() {
904
933
  if (refreshing && Date.parse(j.generated) > refreshing) { refreshing = false; $('#refresh').innerHTML = '⟳'; toast('Office updated'); }
905
934
  renderAll();
906
935
  }
907
- } catch (e) { console.error('hivey fleet:', e); $('#sub').textContent = 'cannot read office.json: is the office server running? (hivey menu → agent office)'; }
936
+ } catch (e) { console.error('hivey fleet:', e); $('#sub').textContent = 'cannot read office.json: is the office server running? (hivey menu → agent fleet)'; }
908
937
  }
909
938
  async function refreshNow() {
910
939
  if (refreshing) return;
@@ -403,7 +403,6 @@ export function createShip(opts) {
403
403
  }
404
404
  function thrust(s) {
405
405
  for (const e of engines) {
406
- if (!e.sp.parent?.parent) continue; // a ship from an older build
407
406
  const k = 1 + 0.1 * Math.sin(s * 23 + e.ph) + 0.05 * Math.sin(s * 61 + e.ph * 2);
408
407
  e.sp.scale.setScalar(e.s * k);
409
408
  e.pl.scale.y = e.s * 0.8 * (1 + 0.18 * Math.sin(s * 31 + e.ph));
@@ -416,7 +415,6 @@ export function createShip(opts) {
416
415
  SH = st.hull ? once('hull:' + st.hull, () => { const m = HULL.clone(); m.color.set(st.hull); return m; }) : HULL;
417
416
  SHD = st.dark ? once('dark:' + st.dark, () => { const m = HULL_DARK.clone(); m.color.set(st.dark); return m; }) : HULL_DARK;
418
417
  ACC = st.acc; KIND = st.kind; NAME = name ? String(name).toUpperCase() : '';
419
- for (let i = engines.length - 1; i >= 0; i--) if (!engines[i].sp.parent?.parent) engines.splice(i, 1);
420
418
  }
421
419
  // the ship's name painted on its hull, in its light colour
422
420
  function nameplate(grp, text, x, y, z, w, h) {
@@ -795,5 +793,7 @@ export function createShip(opts) {
795
793
  spaceNo = n;
796
794
  return galaxyTex(n);
797
795
  }
798
- return { load, makeRobot, makeStation, decorate, bridge, background, pod, space, scenes: SCENES.map(s => s.name), spaceNo: () => spaceNo, planets: () => planets.filter(p => p.parent && p.parent.parent), thrusting: () => engines.length > 0, thrust, accent, statusLed, NO_LINE };
796
+ return { load, makeRobot, makeStation, decorate, bridge, background, pod, space, scenes: SCENES.map(s => s.name), spaceNo: () => spaceNo, planets: () => planets, thrusting: () => engines.length > 0, thrust,
797
+ // a new scene is being built: forget the old ships' engines and planets (they kept the old scene in memory)
798
+ reset: () => { engines.length = 0; planets.length = 0; }, accent, statusLed, NO_LINE };
799
799
  }
@@ -605,7 +605,7 @@ def open_page(model: str) -> int:
605
605
  serve.request_office_refresh(port)
606
606
  url = f"http://127.0.0.1:{port}/office/"
607
607
  subprocess.run(["open", url], capture_output=True)
608
- print(f"agent office: {url}")
608
+ print(f"agent fleet: {url}")
609
609
  return 0
610
610
 
611
611
 
@@ -216,7 +216,7 @@ def write_stats(snap: dict, folder: Path) -> None:
216
216
  else:
217
217
  L.append(f"✅ All {len(jobs)} jobs ran cleanly.\n")
218
218
  L.append("Every job and agent, with its status, issues and the last lines of its log: `agent-logs.html` "
219
- "in this folder (hivey menu → agent map opens it too).\n")
219
+ "in this folder (hivey menu → agent jobs opens it too).\n")
220
220
 
221
221
  L.append("## What is not counted yet? {#gaps}\n")
222
222
  L.append('@callout level=warning title="Spend the map cannot see"')
@@ -846,7 +846,7 @@ def offer(hour: int, minute: int, model: str) -> int:
846
846
  tty.write(
847
847
  "\nhivey can watch this computer every night: scheduled jobs (cron, launchd), agents and\n"
848
848
  "swarms, token use and estimated cost per agent and provider, failing jobs, and how\n"
849
- "agents feed each other. The report opens from the hivey menu → agent map.\n"
849
+ "agents feed each other. The report opens from the hivey menu → agent jobs.\n"
850
850
  f"It runs at {hour:02}:{minute:02} with Claude {model} (well under a dollar a night).\n"
851
851
  "Set up the nightly agent monitoring? [Y/n] ")
852
852
  tty.flush()