@hivey/cli 0.9.67 → 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.67",
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",
@@ -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
 
@@ -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
  }