agentglow 0.3.2 → 0.4.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.
@@ -1,16 +1,16 @@
1
1
  var At = Object.defineProperty;
2
2
  var Pt = (e, r, a) => r in e ? At(e, r, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[r] = a;
3
3
  var k = (e, r, a) => Pt(e, typeof r != "symbol" ? r + "" : r, a);
4
- import { jsxs as Y, Fragment as he, jsx as d } from "react/jsx-runtime";
4
+ import { jsxs as q, Fragment as he, jsx as d } from "react/jsx-runtime";
5
5
  import { EffectComposer as Vt, Bloom as zt, Vignette as Gt } from "@react-three/postprocessing";
6
6
  import { useRef as R, useMemo as z, useEffect as Et, useState as Ft } from "react";
7
7
  import * as t from "three";
8
8
  import { useFrame as ve } from "@react-three/fiber";
9
- import { T as bt, m as Mt, w as j, L as Ie, d as Rt, a as Se, c as ut, h as Ce, l as Bt, F as It, p as Ot, e as Tt, f as Ae, s as Lt, S as $e, z as _t, R as Nt, j as Ut, o as be, u as Xt, H as Ht, x as Kt, K as jt, q as qt, G as Yt, t as Wt, n as $t } from "./KitScene-DbBTTc3H.js";
9
+ import { T as bt, m as Mt, w as K, L as Ie, d as Rt, a as Se, c as ut, h as Ce, l as Bt, N as It, p as Ot, e as Tt, f as Ae, s as Lt, j as _t, k as Nt, n as Ut, S as We, E as Xt, R as jt, o as Ht, y as be, u as Kt, O as Yt, C as qt, r as $t, t as Wt, K as Dt, z as Zt, G as kt, A as Jt, v as Qt } from "./KitScene-qkWr95H9.js";
10
10
  var wt;
11
- const q = typeof window < "u" && !!((wt = window.matchMedia) != null && wt.call(window, "(prefers-reduced-motion: reduce)").matches), ft = new t.Color("#3db8ff"), Me = new t.Color("#9fdcff"), Xe = new t.Color("#ff4fa8"), pt = new t.Color("#ff9ccf"), ne = new t.Color(1, 1, 1), Fe = new t.Color("#ffc24a"), Dt = new t.Color("#ff2d55"), Zt = new t.Color("#3a4560"), ct = Object.fromEntries(Object.entries(bt).map(([e, r]) => [e, new t.Color(r)])), W = (e) => e < 0 ? 0 : e > 1 ? 1 : e, Ke = (e) => 1 - Math.pow(1 - W(e), 3), Be = (e) => (e = W(e), e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2);
11
+ const Y = typeof window < "u" && !!((wt = window.matchMedia) != null && wt.call(window, "(prefers-reduced-motion: reduce)").matches), ft = new t.Color("#3db8ff"), Me = new t.Color("#9fdcff"), Xe = new t.Color("#ff4fa8"), pt = new t.Color("#ff9ccf"), ne = new t.Color(1, 1, 1), Fe = new t.Color("#ffc24a"), eo = new t.Color("#ff2d55"), to = new t.Color("#3a4560"), ct = Object.fromEntries(Object.entries(bt).map(([e, r]) => [e, new t.Color(r)])), W = (e) => e < 0 ? 0 : e > 1 ? 1 : e, He = (e) => 1 - Math.pow(1 - W(e), 3), Be = (e) => (e = W(e), e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2);
12
12
  let Le = null;
13
- function kt() {
13
+ function oo() {
14
14
  if (Le) return Le;
15
15
  const e = document.createElement("canvas");
16
16
  e.width = e.height = 128;
@@ -18,7 +18,7 @@ function kt() {
18
18
  return a.addColorStop(0, "rgba(255,255,255,1)"), a.addColorStop(0.12, "rgba(255,255,255,0.7)"), a.addColorStop(0.4, "rgba(255,255,255,0.15)"), a.addColorStop(1, "rgba(255,255,255,0)"), r.fillStyle = a, r.fillRect(0, 0, 128, 128), Le = new t.CanvasTexture(e), Le;
19
19
  }
20
20
  function D(e = "#fff") {
21
- return new t.SpriteMaterial({ map: kt(), color: e, blending: t.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1 });
21
+ return new t.SpriteMaterial({ map: oo(), color: e, blending: t.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1 });
22
22
  }
23
23
  function ue(e = "#fff") {
24
24
  return new t.MeshBasicMaterial({ color: e, blending: t.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1 });
@@ -27,7 +27,7 @@ function fe(e = "#fff", r = !1) {
27
27
  return new t.LineBasicMaterial({ color: e, vertexColors: r, transparent: !0, blending: t.AdditiveBlending, depthWrite: !1, toneMapped: !1 });
28
28
  }
29
29
  const De = new t.SphereGeometry(1, 24, 18), lt = new t.ConeGeometry(1, 1, 12).translate(0, 0.5, 0), mt = new t.TorusGeometry(1, 0.03, 6, 72);
30
- function Jt(e = 48, r = 6) {
30
+ function no(e = 48, r = 6) {
31
31
  const a = [], o = [];
32
32
  for (let n = 0; n <= e; n++)
33
33
  for (let i = 0; i < r; i++) {
@@ -42,7 +42,7 @@ function Jt(e = 48, r = 6) {
42
42
  const u = new t.BufferGeometry();
43
43
  return u.setAttribute("position", new t.Float32BufferAttribute(a, 3)), u.setIndex(o), u.boundingSphere = new t.Sphere(new t.Vector3(), 1e4), u;
44
44
  }
45
- const St = Jt();
45
+ const St = no();
46
46
  function xt(e, r = 0.04) {
47
47
  return new t.ShaderMaterial({
48
48
  uniforms: {
@@ -100,12 +100,12 @@ function ce(e, r, a, o, u) {
100
100
  const n = 1 - o;
101
101
  return u.set(n * n * e.x + 2 * n * o * r.x + o * o * a.x, n * n * e.y + 2 * n * o * r.y + o * o * a.y, n * n * e.z + 2 * n * o * r.z + o * o * a.z);
102
102
  }
103
- function je(e, r, a, o) {
103
+ function Ke(e, r, a, o) {
104
104
  o.copy(e).add(r).multiplyScalar(0.5);
105
105
  const u = o.length() || 1;
106
106
  return o.multiplyScalar(1 + a / u), o.z += a * 0.4, o;
107
107
  }
108
- const Ye = class Ye {
108
+ const qe = class qe {
109
109
  constructor(r) {
110
110
  k(this, "mesh");
111
111
  k(this, "colors");
@@ -119,14 +119,14 @@ const Ye = class Ye {
119
119
  this.n = 0;
120
120
  }
121
121
  add(r, a, o, u, n, i, c, p = 1) {
122
- this.n >= this.max || p <= 0.01 || (ce(r, a, o, u, this.a), ce(r, a, o, W(u + 0.02 * n), this.b), this.b.sub(this.a), !(this.b.lengthSq() < 1e-8) && (this.o.position.copy(this.a), this.o.quaternion.setFromUnitVectors(Ye.UP, this.b.normalize()), this.o.scale.set(i * 0.38, i, i * 0.38), this.o.updateMatrix(), this.mesh.setMatrixAt(this.n, this.o.matrix), this.colors[this.n * 3] = c.r * p, this.colors[this.n * 3 + 1] = c.g * p, this.colors[this.n * 3 + 2] = c.b * p, this.n++));
122
+ this.n >= this.max || p <= 0.01 || (ce(r, a, o, u, this.a), ce(r, a, o, W(u + 0.02 * n), this.b), this.b.sub(this.a), !(this.b.lengthSq() < 1e-8) && (this.o.position.copy(this.a), this.o.quaternion.setFromUnitVectors(qe.UP, this.b.normalize()), this.o.scale.set(i * 0.38, i, i * 0.38), this.o.updateMatrix(), this.mesh.setMatrixAt(this.n, this.o.matrix), this.colors[this.n * 3] = c.r * p, this.colors[this.n * 3 + 1] = c.g * p, this.colors[this.n * 3 + 2] = c.b * p, this.n++));
123
123
  }
124
124
  end() {
125
125
  this.mesh.count = this.n, this.mesh.instanceMatrix.needsUpdate = !0, this.mesh.instanceColor.needsUpdate = !0;
126
126
  }
127
127
  };
128
- k(Ye, "UP", new t.Vector3(0, 1, 0));
129
- let qe = Ye;
128
+ k(qe, "UP", new t.Vector3(0, 1, 0));
129
+ let Ye = qe;
130
130
  class Ct {
131
131
  constructor(r, a) {
132
132
  k(this, "geo", new t.BufferGeometry());
@@ -146,16 +146,16 @@ class Ct {
146
146
  this.geo.setDrawRange(0, this.n * this.seg * 2), this.P.needsUpdate = !0, this.C.needsUpdate = !0;
147
147
  }
148
148
  }
149
- const le = 2.4, Pe = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map();
150
- function Qt(e, r, a) {
149
+ const le = 2.4, Pe = /* @__PURE__ */ new Map(), je = /* @__PURE__ */ new Map();
150
+ function ro(e, r, a) {
151
151
  return e.r += r.r * a, e.g += r.g * a, e.b += r.b * a, e;
152
152
  }
153
- const eo = new t.Vector3(), to = new t.Vector3(0, 1, 0);
154
- function oo() {
153
+ const so = new t.Vector3(), ao = new t.Vector3(0, 1, 0);
154
+ function io() {
155
155
  const e = [], r = (n, i) => e.push(...n, ...i), o = (n, i, c = 48) => {
156
156
  for (let p = 0; p < c; p++) {
157
- const b = p / c * Math.PI * 2, h = (p + 1) / c * Math.PI * 2;
158
- r([Math.cos(b) * n, Math.sin(b) * n, i], [Math.cos(h) * n, Math.sin(h) * n, i]);
157
+ const M = p / c * Math.PI * 2, h = (p + 1) / c * Math.PI * 2;
158
+ r([Math.cos(M) * n, Math.sin(M) * n, i], [Math.cos(h) * n, Math.sin(h) * n, i]);
159
159
  }
160
160
  };
161
161
  for (const n of [-0.7, 0.7])
@@ -164,13 +164,13 @@ function oo() {
164
164
  for (let n = 0; n < 16; n++) {
165
165
  const i = n / 16 * Math.PI * 2, c = Math.cos(i), p = Math.sin(i);
166
166
  r([c * 1, p * 1, -0.7], [c * 1, p * 1, 0.7]);
167
- for (const b of [-0.7, 0.7]) r([c * 0.62, p * 0.62, b], [c * 1, p * 1, b]);
167
+ for (const M of [-0.7, 0.7]) r([c * 0.62, p * 0.62, M], [c * 1, p * 1, M]);
168
168
  n % 2 === 0 && r([c * 0.3, p * 0.3, -0.8], [c * 0.3, p * 0.3, 0.8]);
169
169
  }
170
170
  const u = new t.BufferGeometry();
171
171
  return u.setAttribute("position", new t.Float32BufferAttribute(e, 3)), u;
172
172
  }
173
- const no = oo(), ro = new t.CylinderGeometry(1, 1, 1.4, 32, 1, !0).rotateX(Math.PI / 2), ye = (e, r, a) => ({ geo: e, edges: new t.EdgesGeometry(e, 25), pos: r, rot: a }), _e = {
173
+ const co = io(), lo = new t.CylinderGeometry(1, 1, 1.4, 32, 1, !0).rotateX(Math.PI / 2), ye = (e, r, a) => ({ geo: e, edges: new t.EdgesGeometry(e, 25), pos: r, rot: a }), _e = {
174
174
  db: () => [ye(new t.CylinderGeometry(0.4, 0.4, 0.66, 24)), ye(new t.TorusGeometry(0.4, 0.01, 4, 40), [0, 0.11, 0], [Math.PI / 2, 0, 0])],
175
175
  warehouse: () => [-0.28, 0, 0.28].map((e) => ye(new t.BoxGeometry(0.9, 0.18, 0.55), [0, e, 0])),
176
176
  spark: () => [ye(new t.IcosahedronGeometry(0.42, 0))],
@@ -178,38 +178,38 @@ const no = oo(), ro = new t.CylinderGeometry(1, 1, 1.4, 32, 1, !0).rotateX(Math.
178
178
  storage: () => [ye(new t.BoxGeometry(0.66, 0.66, 0.66), void 0, [0.4, 0.6, 0])],
179
179
  queue: () => [ye(new t.CapsuleGeometry(0.18, 0.7, 4, 12), void 0, [0, 0, Math.PI / 2])]
180
180
  };
181
- function so({ mcp: e, backend: r }) {
181
+ function uo({ mcp: e, backend: r }) {
182
182
  const a = e.srv, o = r.res, u = R(null), n = z(() => {
183
183
  var v;
184
184
  return ((v = _e[o.kind]) == null ? void 0 : v.call(_e)) ?? _e.api();
185
- }, [o.kind]), i = z(() => new t.Color(a.color).lerp(ne, 0.3), [a.color]), c = z(() => ({ edge: xt(a.color, 0.03), fill: ue(i), line: fe(i), halo: D(i), arrow: ue(i) }), [a.color, i]), p = R(null), b = R(null), h = R(null), G = R(null), E = R("");
185
+ }, [o.kind]), i = z(() => new t.Color(a.color).lerp(ne, 0.3), [a.color]), c = z(() => ({ edge: xt(a.color, 0.03), fill: ue(i), line: fe(i), halo: D(i), arrow: ue(i) }), [a.color, i]), p = R(null), M = R(null), h = R(null), G = R(null), E = R("");
186
186
  return ve(({ clock: v }) => {
187
187
  var w, P;
188
188
  const A = performance.now(), V = v.elapsedTime;
189
189
  (w = u.current) == null || w.position.copy(r.pos);
190
190
  const l = c.edge.uniforms;
191
191
  l.uP0.value.copy(e.pos), l.uP2.value.copy(r.pos), l.uP1.value.copy(e.pos).add(r.pos).multiplyScalar(0.5);
192
- const f = o.inflight > 0, g = Mt(o.activeAt, A, 1.5), x = f && !q ? 0.5 + 0.5 * Math.sin(V * 5) : f ? 0.5 : 0, s = f ? 1.5 + x * 0.8 : 0.14 + g * 0.9;
193
- c.fill.color.copy(i).multiplyScalar(s * 0.22), c.line.color.copy(i).multiplyScalar(s * 1.3), c.halo.color.copy(i).multiplyScalar(f ? 0.4 + x * 0.2 : 0.02 + g * 0.22), (P = b.current) == null || P.scale.setScalar(f ? 3.6 + x * 0.6 : 2.2 + g), p.current && (p.current.scale.setScalar(f ? 1.18 + x * 0.06 : 1 + g * 0.08), p.current.rotation.y = q ? 0.4 : V * (f ? 0.7 : 0.12));
192
+ const f = o.inflight > 0, g = Mt(o.activeAt, A, 1.5), x = f && !Y ? 0.5 + 0.5 * Math.sin(V * 5) : f ? 0.5 : 0, s = f ? 1.5 + x * 0.8 : 0.14 + g * 0.9;
193
+ c.fill.color.copy(i).multiplyScalar(s * 0.22), c.line.color.copy(i).multiplyScalar(s * 1.3), c.halo.color.copy(i).multiplyScalar(f ? 0.4 + x * 0.2 : 0.02 + g * 0.22), (P = M.current) == null || P.scale.setScalar(f ? 3.6 + x * 0.6 : 2.2 + g), p.current && (p.current.scale.setScalar(f ? 1.18 + x * 0.06 : 1 + g * 0.08), p.current.rotation.y = Y ? 0.4 : V * (f ? 0.7 : 0.12));
194
194
  let S = null;
195
- for (const B of j.mcpCalls) B.server === a.name && B.resource === o.name && (!S || B.start > S.start) && (S = B);
195
+ for (const B of K.mcpCalls) B.server === a.name && B.resource === o.name && (!S || B.start > S.start) && (S = B);
196
196
  let T = o.name;
197
197
  if (f) {
198
198
  let B = "";
199
- for (const _ of j.mcpPending.values()) _.server === a.name && _.resource === o.name && (B = _.tool);
199
+ for (const _ of K.mcpPending.values()) _.server === a.name && _.resource === o.name && (B = _.tool);
200
200
  T = `${o.name} ▸ ${B || "query"}()`;
201
201
  } else S && S.phase === "result" && A - S.start < 1800 && (T = `${o.name} ✓ returned`);
202
202
  G.current && (T !== E.current && (G.current.setText(T), E.current = T), G.current.setOpacity(f ? 1 : 0.5 + g * 0.5));
203
203
  const y = c.edge.uniforms;
204
- y.uTime.value = q ? 0 : V;
204
+ y.uTime.value = Y ? 0 : V;
205
205
  const I = S && S.phase === "result" ? (A - S.start) / S.dur : 9, L = h.current;
206
206
  I < 1 ? (y.uRadius.value = 0.055, y.uOpacity.value = 0.8 * (1 - I * 0.6), y.uFlow.value = 0, y.uHead.value = 1 - Be(I), y.uHeadColor.value.copy(i).multiplyScalar(3), L && (L.visible = !0, dt(L, y.uP0.value, y.uP1.value, y.uP2.value, 0.14, -1, 0.5), c.arrow.color.copy(i).multiplyScalar(2 * (1 - I * 0.7)))) : f ? (y.uRadius.value = 0.03, y.uOpacity.value = 0.5, y.uFlow.value = 1, y.uHead.value = -1, L && (L.visible = !0, dt(L, y.uP0.value, y.uP1.value, y.uP2.value, 0.82, 1, 0.4), c.arrow.color.copy(i).multiplyScalar(1.2))) : (y.uRadius.value = 0.025, y.uOpacity.value = 0.14 + g * 0.4, y.uFlow.value = 0, y.uHead.value = -1, L && (L.visible = !1));
207
- }), /* @__PURE__ */ Y(he, { children: [
207
+ }), /* @__PURE__ */ q(he, { children: [
208
208
  /* @__PURE__ */ d("mesh", { geometry: St, material: c.edge, frustumCulled: !1 }),
209
209
  /* @__PURE__ */ d("mesh", { ref: h, geometry: lt, material: c.arrow, visible: !1 }),
210
- /* @__PURE__ */ Y("group", { ref: u, children: [
211
- /* @__PURE__ */ d("sprite", { ref: b, material: c.halo }),
212
- /* @__PURE__ */ d("group", { ref: p, children: n.map((v, A) => /* @__PURE__ */ Y("group", { position: v.pos, rotation: v.rot, children: [
210
+ /* @__PURE__ */ q("group", { ref: u, children: [
211
+ /* @__PURE__ */ d("sprite", { ref: M, material: c.halo }),
212
+ /* @__PURE__ */ d("group", { ref: p, children: n.map((v, A) => /* @__PURE__ */ q("group", { position: v.pos, rotation: v.rot, children: [
213
213
  /* @__PURE__ */ d("mesh", { geometry: v.geo, material: c.fill }),
214
214
  /* @__PURE__ */ d("lineSegments", { geometry: v.edges, material: c.line })
215
215
  ] }, A)) }),
@@ -219,24 +219,24 @@ function so({ mcp: e, backend: r }) {
219
219
  }
220
220
  const Ze = new t.Vector3(), Ne = new t.Vector3();
221
221
  function dt(e, r, a, o, u, n, i) {
222
- ce(r, a, o, u, Ze), ce(r, a, o, W(u + 0.02 * n), Ne), e.position.copy(Ze), Ne.sub(Ze), Ne.lengthSq() > 1e-8 && e.quaternion.setFromUnitVectors(to, Ne.normalize()), e.scale.set(i * 0.38, i, i * 0.38);
222
+ ce(r, a, o, u, Ze), ce(r, a, o, W(u + 0.02 * n), Ne), e.position.copy(Ze), Ne.sub(Ze), Ne.lengthSq() > 1e-8 && e.quaternion.setFromUnitVectors(ao, Ne.normalize()), e.scale.set(i * 0.38, i, i * 0.38);
223
223
  }
224
- function ao({ mcp: e }) {
225
- const r = e.srv, a = R(null), o = z(() => new t.Color(r.color), [r.color]), u = z(() => ({ line: fe(o), fill: ue(o), core: D("#fff"), halo: D(o), hit: D("#fff") }), [o]), n = R(null), i = R(null), c = R(null), p = R(null), b = R(r.calls), h = R(-1e9);
224
+ function fo({ mcp: e }) {
225
+ const r = e.srv, a = R(null), o = z(() => new t.Color(r.color), [r.color]), u = z(() => ({ line: fe(o), fill: ue(o), core: D("#fff"), halo: D(o), hit: D("#fff") }), [o]), n = R(null), i = R(null), c = R(null), p = R(null), M = R(r.calls), h = R(-1e9);
226
226
  return ve(({ clock: G }) => {
227
227
  var f, g, x;
228
228
  (f = a.current) == null || f.position.copy(e.pos);
229
229
  const E = performance.now();
230
- r.calls !== b.current && (b.current = r.calls, h.current = E), (g = n.current) == null || g.lookAt(eo);
230
+ r.calls !== M.current && (M.current = r.calls, h.current = E), (g = n.current) == null || g.lookAt(so);
231
231
  const v = r.inflight > 0, A = Mt(r.activeAt, E, 1.4), V = (v ? 0.8 : 0.32) + A * 0.5;
232
- u.line.color.copy(o).multiplyScalar(V * 1.4), u.fill.color.copy(o).multiplyScalar(V * 0.05), u.core.color.setScalar(v ? 0.7 : 0.18), u.halo.color.copy(o).multiplyScalar(v ? 0.24 : 0.06 + A * 0.12), (x = c.current) == null || x.scale.setScalar(5 + (v ? 0.8 : 0)), i.current && (i.current.rotation.z = q ? 0 : G.elapsedTime * (v ? 0.55 : 0.08));
232
+ u.line.color.copy(o).multiplyScalar(V * 1.4), u.fill.color.copy(o).multiplyScalar(V * 0.05), u.core.color.setScalar(v ? 0.7 : 0.18), u.halo.color.copy(o).multiplyScalar(v ? 0.24 : 0.06 + A * 0.12), (x = c.current) == null || x.scale.setScalar(5 + (v ? 0.8 : 0)), i.current && (i.current.rotation.z = Y ? 0 : G.elapsedTime * (v ? 0.55 : 0.08));
233
233
  const l = (E - h.current) / 700;
234
234
  p.current && (p.current.visible = l < 1, p.current.scale.setScalar(1 + l * 4), u.hit.color.copy(o).lerp(ne, 0.5).multiplyScalar((1 - l) * (1 - l) * 1.2));
235
- }), /* @__PURE__ */ d(he, { children: /* @__PURE__ */ Y("group", { ref: a, children: [
235
+ }), /* @__PURE__ */ d(he, { children: /* @__PURE__ */ q("group", { ref: a, children: [
236
236
  /* @__PURE__ */ d("sprite", { ref: c, material: u.halo }),
237
- /* @__PURE__ */ d("group", { ref: n, children: /* @__PURE__ */ Y("group", { ref: i, children: [
238
- /* @__PURE__ */ d("lineSegments", { geometry: no, material: u.line }),
239
- /* @__PURE__ */ d("mesh", { geometry: ro, material: u.fill })
237
+ /* @__PURE__ */ d("group", { ref: n, children: /* @__PURE__ */ q("group", { ref: i, children: [
238
+ /* @__PURE__ */ d("lineSegments", { geometry: co, material: u.line }),
239
+ /* @__PURE__ */ d("mesh", { geometry: lo, material: u.fill })
240
240
  ] }) }),
241
241
  /* @__PURE__ */ d("sprite", { material: u.core, scale: 0.9 }),
242
242
  /* @__PURE__ */ d("sprite", { ref: p, material: u.hit, visible: !1 }),
@@ -244,17 +244,17 @@ function ao({ mcp: e }) {
244
244
  ] }) });
245
245
  }
246
246
  const ht = 28, ke = 40, Je = 24;
247
- function io() {
248
- const e = z(() => new Ct(ht * 2, ke), []), r = z(() => fe("#fff", !0), []), a = z(() => new qe(ht), []), o = z(() => Array.from({ length: Je }, () => D("#fff")), []), u = R([]), n = z(() => ({ a: new t.Vector3(), b: new t.Vector3(), c: new t.Vector3(), p: new t.Vector3(), col: new t.Color(), k: new t.Color() }), []);
247
+ function po() {
248
+ const e = z(() => new Ct(ht * 2, ke), []), r = z(() => fe("#fff", !0), []), a = z(() => new Ye(ht), []), o = z(() => Array.from({ length: Je }, () => D("#fff")), []), u = R([]), n = z(() => ({ a: new t.Vector3(), b: new t.Vector3(), c: new t.Vector3(), p: new t.Vector3(), col: new t.Color(), k: new t.Color() }), []);
249
249
  return ve(({ clock: i }) => {
250
- const c = performance.now(), p = q ? 0 : i.elapsedTime;
250
+ const c = performance.now(), p = Y ? 0 : i.elapsedTime;
251
251
  e.begin(), a.begin();
252
- const { a: b, b: h, c: G, p: E, col: v, k: A } = n, V = (f, g, x, s) => {
253
- const S = Se(f), T = j.mcpServers.get(g), y = ut(g);
252
+ const { a: M, b: h, c: G, p: E, col: v, k: A } = n, V = (f, g, x, s) => {
253
+ const S = Se(f), T = K.mcpServers.get(g), y = ut(g);
254
254
  if (!S || !T || !y) return;
255
- b.copy(S), h.copy(y), je(b, h, 1.2, G), v.set(T.color);
255
+ M.copy(S), h.copy(y), Ke(M, h, 1.2, G), v.set(T.color);
256
256
  let I;
257
- x === 0 ? (v.lerp(Fe, W(s / 1.2)), s > 1.2 && v.lerp(Dt, W((s - 1.2) / 1)), I = (0.25 + Math.min(0.6, s * 0.25)) * Ke(s / 0.3)) : (v.lerp(ne, 0.35), I = 1.2 * (s < 0.75 ? 1 : 1 - (s - 0.75) / 0.25));
257
+ x === 0 ? (v.lerp(Fe, W(s / 1.2)), s > 1.2 && v.lerp(eo, W((s - 1.2) / 1)), I = (0.25 + Math.min(0.6, s * 0.25)) * He(s / 0.3)) : (v.lerp(ne, 0.35), I = 1.2 * (s < 0.75 ? 1 : 1 - (s - 0.75) / 0.25));
258
258
  const L = 1 - Be(s / 0.75);
259
259
  for (let w = 0; w < 2; w++) {
260
260
  const P = e.next();
@@ -262,31 +262,31 @@ function io() {
262
262
  const B = w ? 0.045 : 0;
263
263
  for (let _ = 0; _ < ke; _++)
264
264
  for (let U = 0; U < 2; U++) {
265
- const H = (_ + U) / ke;
266
- ce(b, G, h, H, E), e.P.setXYZ(P + _ * 2 + U, E.x + B, E.y + B, E.z);
265
+ const j = (_ + U) / ke;
266
+ ce(M, G, h, j, E), e.P.setXYZ(P + _ * 2 + U, E.x + B, E.y + B, E.z);
267
267
  let m;
268
- x === 0 ? m = I * (0.22 + Math.pow(Math.max(0, Math.sin(H * 26 - p * 3)), 10) * 1.8) * (w ? 0.3 : 1) : m = I * (0.18 + Math.exp(-(((H - L) / 0.05) ** 2)) * 3.4 * (s < 0.8 ? 1 : 0)) * (w ? 0.5 : 1), e.C.setXYZ(P + _ * 2 + U, v.r * m, v.g * m, v.b * m);
268
+ x === 0 ? m = I * (0.22 + Math.pow(Math.max(0, Math.sin(j * 26 - p * 3)), 10) * 1.8) * (w ? 0.3 : 1) : m = I * (0.18 + Math.exp(-(((j - L) / 0.05) ** 2)) * 3.4 * (s < 0.8 ? 1 : 0)) * (w ? 0.5 : 1), e.C.setXYZ(P + _ * 2 + U, v.r * m, v.g * m, v.b * m);
269
269
  }
270
270
  }
271
- A.copy(v), x === 0 ? a.add(b, G, h, 0.93, 1, 0.45, A, 0.5 + I * 1.3) : a.add(b, G, h, 0.07, -1, 0.6, A, I * 1.5);
271
+ A.copy(v), x === 0 ? a.add(M, G, h, 0.93, 1, 0.45, A, 0.5 + I * 1.3) : a.add(M, G, h, 0.07, -1, 0.6, A, I * 1.5);
272
272
  };
273
- for (const f of j.mcpPending.values()) V(f.instance, f.server, 0, Rt(f, c));
274
- for (const f of j.mcpCalls) f.phase === "result" && V(f.instance, f.server, 1, W((c - f.start) / f.dur));
273
+ for (const f of K.mcpPending.values()) V(f.instance, f.server, 0, Rt(f, c));
274
+ for (const f of K.mcpCalls) f.phase === "result" && V(f.instance, f.server, 1, W((c - f.start) / f.dur));
275
275
  e.end(), a.end();
276
276
  let l = 0;
277
- for (const f of j.mcpCalls) {
277
+ for (const f of K.mcpCalls) {
278
278
  if (f.phase !== "call" || l >= Je) continue;
279
- const g = Se(f.instance), x = j.mcpServers.get(f.server), s = ut(f.server), S = u.current[l], T = W((c - f.start) / f.dur);
280
- !g || !x || !s || !S || T >= 1 || (b.copy(g), h.copy(s), je(b, h, 1.2, G), ce(b, G, h, Be(T), E), S.visible = !0, S.position.copy(E), S.scale.setScalar(0.85), o[l].color.set(x.color).lerp(ne, 0.4).multiplyScalar(1.5), l++);
279
+ const g = Se(f.instance), x = K.mcpServers.get(f.server), s = ut(f.server), S = u.current[l], T = W((c - f.start) / f.dur);
280
+ !g || !x || !s || !S || T >= 1 || (M.copy(g), h.copy(s), Ke(M, h, 1.2, G), ce(M, G, h, Be(T), E), S.visible = !0, S.position.copy(E), S.scale.setScalar(0.85), o[l].color.set(x.color).lerp(ne, 0.4).multiplyScalar(1.5), l++);
281
281
  }
282
282
  for (let f = l; f < Je; f++) u.current[f] && (u.current[f].visible = !1);
283
- }), /* @__PURE__ */ Y(he, { children: [
283
+ }), /* @__PURE__ */ q(he, { children: [
284
284
  /* @__PURE__ */ d("lineSegments", { geometry: e.geo, material: r, frustumCulled: !1 }),
285
285
  /* @__PURE__ */ d("primitive", { object: a.mesh }),
286
286
  o.map((i, c) => /* @__PURE__ */ d("sprite", { ref: (p) => void (u.current[c] = p), material: i, visible: !1 }, c))
287
287
  ] });
288
288
  }
289
- const Ge = 40, Qe = 160, co = new t.MeshBasicMaterial({ transparent: !0, opacity: 0, depthWrite: !1, colorWrite: !1 }), lo = new t.Vector3(0, 1, 0), uo = new t.Vector3(0, 0, 1), et = new t.Vector3(), vt = new t.Vector3(), Ee = new t.Vector3(), fo = (() => {
289
+ const Ge = 40, Qe = 160, mo = new t.MeshBasicMaterial({ transparent: !0, opacity: 0, depthWrite: !1, colorWrite: !1 }), ho = new t.Vector3(0, 1, 0), vo = new t.Vector3(0, 0, 1), et = new t.Vector3(), vt = new t.Vector3(), Ee = new t.Vector3(), go = (() => {
290
290
  const e = new Float32Array((Qe + 1) * 3);
291
291
  for (let a = 0; a <= Qe; a++) {
292
292
  const o = a / Qe * Math.PI * 2;
@@ -296,12 +296,12 @@ const Ge = 40, Qe = 160, co = new t.MeshBasicMaterial({ transparent: !0, opacity
296
296
  return r.setAttribute("position", new t.BufferAttribute(e, 3)), r.boundingSphere = new t.Sphere(new t.Vector3(), 1e4), r;
297
297
  })(), Re = 40, it = Array.from({ length: Re }, () => ({ on: !1, start: 0, size: 1, o: new t.Vector3(), dir: new t.Vector3(), perp: new t.Vector3(), c: new t.Color() }));
298
298
  let tt = 0;
299
- function po(e, r, a, o, u) {
299
+ function yo(e, r, a, o, u) {
300
300
  const n = it[tt];
301
301
  tt = (tt + 1) % Re, n.on = !0, n.start = performance.now(), n.size = a, n.o.copy(e), n.dir.copy(e).sub(r), n.dir.lengthSq() < 1e-4 && n.dir.set(0, 1, 0), n.dir.normalize(), n.dir.x += Math.sin(u * 12.9) * 0.6, n.dir.y += Math.cos(u * 7.3) * 0.6, n.dir.z += 0.35, n.dir.normalize(), n.perp.set(0, 0, 1).cross(n.dir).normalize(), n.perp.lengthSq() < 0.5 && n.perp.set(1, 0, 0), n.c.copy(o).lerp(ne, 0.35);
302
302
  }
303
- function mo({ agent: e, selected: r, onSelect: a }) {
304
- const o = e.inst, u = R(null), n = R(null), i = R(null), c = R(null), p = R(null), b = R(null), h = R(null), G = R(null), E = R(null), v = R(null), A = ct[o.type], V = !!o.subagent, l = z(
303
+ function wo({ agent: e, selected: r, onSelect: a }) {
304
+ const o = e.inst, u = R(null), n = R(null), i = R(null), c = R(null), p = R(null), M = R(null), h = R(null), G = R(null), E = R(null), v = R(null), A = ct[o.type], V = !!o.subagent, l = z(
305
305
  () => ({
306
306
  core: ue("#fff"),
307
307
  shell: ue(A),
@@ -318,7 +318,7 @@ function mo({ agent: e, selected: r, onSelect: a }) {
318
318
  ), f = z(() => {
319
319
  const y = new t.BufferGeometry();
320
320
  return y.setAttribute("position", new t.BufferAttribute(new Float32Array(Ge * 3), 3)), y.setAttribute("color", new t.BufferAttribute(new Float32Array(Ge * 3), 3)), y.boundingSphere = new t.Sphere(new t.Vector3(), 1e4), y;
321
- }, []), g = z(() => Object.assign(new t.Line(f, l.trail), { frustumCulled: !1 }), [f, l.trail]), x = z(() => Object.assign(new t.Line(fo, l.orbit), { frustumCulled: !1, matrixAutoUpdate: !1, visible: !1 }), [l.orbit]), s = z(
321
+ }, []), g = z(() => Object.assign(new t.Line(f, l.trail), { frustumCulled: !1 }), [f, l.trail]), x = z(() => Object.assign(new t.Line(go, l.orbit), { frustumCulled: !1, matrixAutoUpdate: !1, visible: !1 }), [l.orbit]), s = z(
322
322
  () => ({
323
323
  p: new t.Vector3(),
324
324
  ctrl: new t.Vector3(),
@@ -351,63 +351,63 @@ function mo({ agent: e, selected: r, onSelect: a }) {
351
351
  const F = Pe.get(e.run.id) ?? e.run.origin;
352
352
  s.n.copy(F), s.a.copy(e.pos).sub(F);
353
353
  let $ = s.a.length();
354
- $ < 0.5 && (s.a.set(0, 0.5, 0), $ = 0.5), s.b.set(-s.a.y, s.a.x, 0).normalize().multiplyScalar($ * s.tilt * s.dir).addScaledVector(uo, $ * s.lean);
354
+ $ < 0.5 && (s.a.set(0, 0.5, 0), $ = 0.5), s.b.set(-s.a.y, s.a.x, 0).normalize().multiplyScalar($ * s.tilt * s.dir).addScaledVector(vo, $ * s.lean);
355
355
  }
356
- let H = V ? w * (V ? q ? 0 : 0.9 : 0) * s.dir + s.seed * 6.28 : q ? 0 : Math.sin(w * 0.6 + s.seed * 9) * 0.06;
357
- H += s.dir * _ * 0.9;
356
+ let j = V ? w * (V ? Y ? 0 : 0.9 : 0) * s.dir + s.seed * 6.28 : Y ? 0 : Math.sin(w * 0.6 + s.seed * 9) * 0.06;
357
+ j += s.dir * _ * 0.9;
358
358
  const m = 1 + _ * _ * 0.07;
359
- S(H, e.live), m !== 1 && e.live.sub(s.n).multiplyScalar(m).add(s.n);
360
- const C = Ke((L - o.bornAt) / 1100);
359
+ S(j, e.live), m !== 1 && e.live.sub(s.n).multiplyScalar(m).add(s.n);
360
+ const C = He((L - o.bornAt) / 1100);
361
361
  if (C < 1) {
362
362
  const F = o.parent ? Se(o.parent) : void 0;
363
363
  F ? (s.from.copy(F), s.fromSet = !0) : s.fromSet || (s.from.copy(s.n), s.fromSet = !0), e.live.lerpVectors(s.from, e.live, V ? C : 0.3 + 0.7 * C);
364
364
  }
365
365
  const N = e.live;
366
366
  (me = u.current) == null || me.position.copy(N);
367
- const K = Ot(o, L), J = P < 0 && (o.status === "thinking" || o.status === "spawning"), re = Tt(o, L);
367
+ const H = Ot(o, L), J = P < 0 && (o.status === "thinking" || o.status === "spawning"), re = Tt(o, L);
368
368
  let Ve = !1;
369
- for (const F of j.mcpPending.values()) F.instance === o.id && (Ve = !0);
370
- const Oe = q ? 0.5 : 0.5 + 0.5 * Math.sin(w * (J ? 6 : 1.6) + s.seed * 30);
371
- o.llmCalls !== s.llm && (s.llm = o.llmCalls, P < 0 && po(N, Pe.get(e.run.id) ?? e.run.origin, o.pulse, A, s.seed + o.llmCalls * 0.37));
372
- const se = e.scale, pe = Ke((L - o.bornAt) / 700), We = 0.3 * se * pe * (1 - B * 0.9) * (1 + re * 0.12);
373
- if ((oe = n.current) == null || oe.scale.setScalar(Math.max(1e-4, We)), s.c.copy(A).multiplyScalar((J ? 1 + Oe * 0.4 : 0.55 + Oe * 0.15) + re * 0.5), P >= 0 && s.c.lerp(Zt, B), l.shell.color.copy(s.c), l.core.color.setScalar((J ? 0.9 : 0.45) * (1 - B) + re * 0.4), i.current && (i.current.scale.setScalar(Math.max(1e-4, (J ? 2.4 : 1.7) * se * pe * (1 - B * 0.7) + re * 0.9 * Ae.scale)), l.halo.color.copy(A).multiplyScalar(((J ? 0.32 : 0.16) + re * 0.25) * K)), b.current) {
369
+ for (const F of K.mcpPending.values()) F.instance === o.id && (Ve = !0);
370
+ const Oe = Y ? 0.5 : 0.5 + 0.5 * Math.sin(w * (J ? 6 : 1.6) + s.seed * 30);
371
+ o.llmCalls !== s.llm && (s.llm = o.llmCalls, P < 0 && yo(N, Pe.get(e.run.id) ?? e.run.origin, o.pulse, A, s.seed + o.llmCalls * 0.37));
372
+ const se = e.scale, pe = He((L - o.bornAt) / 700), $e = 0.3 * se * pe * (1 - B * 0.9) * (1 + re * 0.12);
373
+ if ((oe = n.current) == null || oe.scale.setScalar(Math.max(1e-4, $e)), s.c.copy(A).multiplyScalar((J ? 1 + Oe * 0.4 : 0.55 + Oe * 0.15) + re * 0.5), P >= 0 && s.c.lerp(to, B), l.shell.color.copy(s.c), l.core.color.setScalar((J ? 0.9 : 0.45) * (1 - B) + re * 0.4), i.current && (i.current.scale.setScalar(Math.max(1e-4, (J ? 2.4 : 1.7) * se * pe * (1 - B * 0.7) + re * 0.9 * Ae.scale)), l.halo.color.copy(A).multiplyScalar(((J ? 0.32 : 0.16) + re * 0.25) * H)), M.current) {
374
374
  const F = P >= 0 && P < 0.9 ? 1 - P / 0.9 : 0;
375
- b.current.visible = F > 0, b.current.scale.setScalar(Math.max(1e-4, se * (1.2 + (1 - F) * 3.5))), l.flash.color.copy(o.status === "failed" ? Fe : ne).multiplyScalar(F * F * 0.9);
375
+ M.current.visible = F > 0, M.current.scale.setScalar(Math.max(1e-4, se * (1.2 + (1 - F) * 3.5))), l.flash.color.copy(o.status === "failed" ? Fe : ne).multiplyScalar(F * F * 0.9);
376
376
  }
377
- if (s.ringK += ((Ve && P < 0 ? 1 : 0) - s.ringK) * 0.1, c.current && (c.current.visible = s.ringK > 0.02, c.current.rotation.set(1.2 + Math.sin(w * 0.8) * 0.3, w * 1.4, 0), c.current.scale.setScalar(Math.max(1e-4, 0.62 * se * s.ringK)), l.ring.color.copy(Fe).multiplyScalar(1.1 * s.ringK * (0.7 + Oe * 0.3))), p.current && (p.current.visible = r, p.current.quaternion.copy(I.quaternion), p.current.scale.setScalar(0.8 * se + (q ? 0 : Math.sin(w * 3) * 0.04))), (ie = G.current) == null || ie.scale.setScalar(Math.max(0.55, 0.62 * se)), V ? (Te = v.current) == null || Te.position.set(0.3 * se + 0.15, 0, 0) : (de = v.current) == null || de.position.set(0, (s.a.y > 0.2 ? 1 : -1) * (0.42 * se + 0.28), 0), E.current && (s.labelK += ((Lt(o.id) ? 1 : 0) - s.labelK) * 0.12, E.current.setOpacity(W((L - o.bornAt) / 600) * (1 - W(P / 1.2)) * 0.95 * s.labelK)), !V) {
377
+ if (s.ringK += ((Ve && P < 0 ? 1 : 0) - s.ringK) * 0.1, c.current && (c.current.visible = s.ringK > 0.02, c.current.rotation.set(1.2 + Math.sin(w * 0.8) * 0.3, w * 1.4, 0), c.current.scale.setScalar(Math.max(1e-4, 0.62 * se * s.ringK)), l.ring.color.copy(Fe).multiplyScalar(1.1 * s.ringK * (0.7 + Oe * 0.3))), p.current && (p.current.visible = r, p.current.quaternion.copy(I.quaternion), p.current.scale.setScalar(0.8 * se + (Y ? 0 : Math.sin(w * 3) * 0.04))), (ie = G.current) == null || ie.scale.setScalar(Math.max(0.55, 0.62 * se)), V ? (Te = v.current) == null || Te.position.set(0.3 * se + 0.15, 0, 0) : (de = v.current) == null || de.position.set(0, (s.a.y > 0.2 ? 1 : -1) * (0.42 * se + 0.28), 0), E.current && (s.labelK += ((Lt(o.id) ? 1 : 0) - s.labelK) * 0.12, E.current.setOpacity(W((L - o.bornAt) / 600) * (1 - W(P / 1.2)) * 0.95 * s.labelK)), !V) {
378
378
  const F = s.a.length();
379
- x.visible = F > 0.6 && K > 0.02, x.visible && (Ee.crossVectors(s.a, s.b).normalize(), x.matrix.makeBasis(s.a, s.b, Ee).setPosition(s.n), x.matrixWorldNeedsUpdate = !0, l.orbit.color.copy(A).multiplyScalar((J ? 0.32 : 0.2) * pe * (1 - B) * K));
379
+ x.visible = F > 0.6 && H > 0.02, x.visible && (Ee.crossVectors(s.a, s.b).normalize(), x.matrix.makeBasis(s.a, s.b, Ee).setPosition(s.n), x.matrixWorldNeedsUpdate = !0, l.orbit.color.copy(A).multiplyScalar((J ? 0.32 : 0.2) * pe * (1 - B) * H));
380
380
  }
381
- const Z = f.getAttribute("position"), M = f.getAttribute("color"), O = V ? 2.4 : 1.5, X = (J ? 0.75 : 0.45) * pe * (P >= 0 ? (1 - W((P - 0.4) / 2)) * 1.6 : 1);
381
+ const Z = f.getAttribute("position"), b = f.getAttribute("color"), O = V ? 2.4 : 1.5, X = (J ? 0.75 : 0.45) * pe * (P >= 0 ? (1 - W((P - 0.4) / 2)) * 1.6 : 1);
382
382
  for (let F = 0; F < Ge; F++) {
383
- const $ = H - s.dir * (F / (Ge - 1)) * O;
383
+ const $ = j - s.dir * (F / (Ge - 1)) * O;
384
384
  S($, s.p), m !== 1 && s.p.sub(s.n).multiplyScalar(m).add(s.n), C < 1 && s.p.lerpVectors(s.from, s.p, V ? C : 0.3 + 0.7 * C), Z.setXYZ(F, s.p.x, s.p.y, s.p.z);
385
385
  const ze = Math.pow(1 - F / (Ge - 1), 1.8) * X;
386
- M.setXYZ(F, (P >= 0 ? Me.r : A.r) * ze, (P >= 0 ? Me.g : A.g) * ze, (P >= 0 ? Me.b : A.b) * ze);
386
+ b.setXYZ(F, (P >= 0 ? Me.r : A.r) * ze, (P >= 0 ? Me.g : A.g) * ze, (P >= 0 ? Me.b : A.b) * ze);
387
387
  }
388
- Z.needsUpdate = !0, M.needsUpdate = !0;
389
- const Q = o.parent ? Se(o.parent) : void 0, ee = o.parent ? j.instances.get(o.parent) : void 0, ae = !!Q && !!ee && !ee.exitAt && !o.exitAt;
388
+ Z.needsUpdate = !0, b.needsUpdate = !0;
389
+ const Q = o.parent ? Se(o.parent) : void 0, ee = o.parent ? K.instances.get(o.parent) : void 0, ae = !!Q && !!ee && !ee.exitAt && !o.exitAt;
390
390
  s.linkK += ((ae ? 1 : 0) - s.linkK) * (ae ? 0.06 : 0.05), Q && s.par.copy(Q);
391
391
  const te = l.field.uniforms;
392
- te.uP0.value.copy(s.par), te.uP2.value.copy(N), je(s.par, N, V ? 0.3 : 1.4, s.ctrl), te.uP1.value.copy(s.ctrl);
392
+ te.uP0.value.copy(s.par), te.uP2.value.copy(N), Ke(s.par, N, V ? 0.3 : 1.4, s.ctrl), te.uP1.value.copy(s.ctrl);
393
393
  const ge = Be((L - o.bornAt) / 900);
394
- if (te.uGrow.value = o.parent && s.linkK > 0.01 ? ge : 0, te.uOpacity.value = (J ? 0.7 : 0.45) * s.linkK, te.uFlow.value = s.linkK, te.uTime.value = q ? 0 : w, te.uHead.value = ge < 1 ? ge : -1, h.current) {
394
+ if (te.uGrow.value = o.parent && s.linkK > 0.01 ? ge : 0, te.uOpacity.value = (J ? 0.7 : 0.45) * s.linkK, te.uFlow.value = s.linkK, te.uTime.value = Y ? 0 : w, te.uHead.value = ge < 1 ? ge : -1, h.current) {
395
395
  const F = o.parent && s.linkK > 0.05 && ge >= 1;
396
396
  if (h.current.visible = !!F, F) {
397
- ce(s.par, s.ctrl, N, 0.74, et), ce(s.par, s.ctrl, N, 0.8, vt), h.current.position.copy(et), Ee.subVectors(vt, et), Ee.lengthSq() > 1e-8 && h.current.quaternion.setFromUnitVectors(lo, Ee.normalize());
397
+ ce(s.par, s.ctrl, N, 0.74, et), ce(s.par, s.ctrl, N, 0.8, vt), h.current.position.copy(et), Ee.subVectors(vt, et), Ee.lengthSq() > 1e-8 && h.current.quaternion.setFromUnitVectors(ho, Ee.normalize());
398
398
  const $ = (V ? 0.11 : 0.15) * Math.min(1.3, Ae.scale);
399
399
  h.current.scale.set($, $ * 2.6, $), l.arrow.color.copy(A).multiplyScalar(1.5 * s.linkK);
400
400
  }
401
401
  }
402
402
  });
403
403
  const T = o.id.split(":")[2];
404
- return /* @__PURE__ */ Y(he, { children: [
404
+ return /* @__PURE__ */ q(he, { children: [
405
405
  /* @__PURE__ */ d("primitive", { object: x }),
406
406
  /* @__PURE__ */ d("mesh", { geometry: St, material: l.field, frustumCulled: !1 }),
407
407
  /* @__PURE__ */ d("mesh", { ref: h, geometry: lt, material: l.arrow, visible: !1 }),
408
408
  /* @__PURE__ */ d("primitive", { object: g }),
409
- /* @__PURE__ */ Y("group", { ref: u, position: e.pos, children: [
410
- /* @__PURE__ */ Y("group", { ref: n, scale: 1e-4, children: [
409
+ /* @__PURE__ */ q("group", { ref: u, position: e.pos, children: [
410
+ /* @__PURE__ */ q("group", { ref: n, scale: 1e-4, children: [
411
411
  /* @__PURE__ */ d("mesh", { geometry: De, material: l.shell }),
412
412
  /* @__PURE__ */ d("mesh", { geometry: De, material: l.core, scale: 0.55 })
413
413
  ] }),
@@ -416,7 +416,7 @@ function mo({ agent: e, selected: r, onSelect: a }) {
416
416
  {
417
417
  ref: G,
418
418
  geometry: De,
419
- material: co,
419
+ material: mo,
420
420
  onClick: (y) => {
421
421
  y.stopPropagation(), a(o.id);
422
422
  },
@@ -425,7 +425,7 @@ function mo({ agent: e, selected: r, onSelect: a }) {
425
425
  }
426
426
  ),
427
427
  /* @__PURE__ */ d("sprite", { ref: i, material: l.halo }),
428
- /* @__PURE__ */ d("sprite", { ref: b, material: l.flash, visible: !1 }),
428
+ /* @__PURE__ */ d("sprite", { ref: M, material: l.flash, visible: !1 }),
429
429
  /* @__PURE__ */ d("mesh", { ref: c, geometry: mt, material: l.ring, visible: !1 }),
430
430
  /* @__PURE__ */ d("mesh", { ref: p, geometry: mt, material: l.sel, visible: !1 }),
431
431
  /* @__PURE__ */ d("group", { ref: v, children: /* @__PURE__ */ d(
@@ -434,6 +434,7 @@ function mo({ agent: e, selected: r, onSelect: a }) {
434
434
  ref: E,
435
435
  anchorX: V ? "left" : "center",
436
436
  text: `${o.name}${T !== void 0 ? ` ${Number(T) + 1}` : ""}`,
437
+ live: o.job ? () => _t(o) : null,
437
438
  color: bt[o.type],
438
439
  size: V ? 0.22 : 0.28,
439
440
  opacity: 0,
@@ -445,7 +446,7 @@ function mo({ agent: e, selected: r, onSelect: a }) {
445
446
  ] });
446
447
  }
447
448
  const xe = 36, gt = 1.5;
448
- function ho() {
449
+ function bo() {
449
450
  const e = z(() => {
450
451
  const n = new t.BufferGeometry();
451
452
  return n.setAttribute("position", new t.BufferAttribute(new Float32Array(Re * xe * 6), 3)), n.setAttribute("color", new t.BufferAttribute(new Float32Array(Re * xe * 6), 3)), n.boundingSphere = new t.Sphere(new t.Vector3(), 1e4), n;
@@ -453,15 +454,15 @@ function ho() {
453
454
  return ve(() => {
454
455
  const n = performance.now(), i = e.getAttribute("position"), c = e.getAttribute("color");
455
456
  let p = 0;
456
- for (let b = 0; b < Re; b++) {
457
- const h = it[b], G = o.current[b], E = (n - h.start) / 1e3;
457
+ for (let M = 0; M < Re; M++) {
458
+ const h = it[M], G = o.current[M], E = (n - h.start) / 1e3;
458
459
  if (!h.on || E > gt) {
459
460
  h.on = !1, G && (G.visible = !1);
460
461
  continue;
461
462
  }
462
463
  if (G) {
463
464
  const g = Math.max(0, 1 - E / 0.55);
464
- G.visible = g > 0, G.position.copy(h.o), G.scale.setScalar(Math.max(1e-4, (0.8 + h.size * 1.5) * (0.6 + (1 - g) * 0.8))), a[b].color.copy(h.c).multiplyScalar(g * g * 1.1);
465
+ G.visible = g > 0, G.position.copy(h.o), G.scale.setScalar(Math.max(1e-4, (0.8 + h.size * 1.5) * (0.6 + (1 - g) * 0.8))), a[M].color.copy(h.c).multiplyScalar(g * g * 1.1);
465
466
  }
466
467
  const v = 1 - E / gt, A = 0.4 + E * 7.5, V = 1.2 + h.size * 1.1, l = 0.1 + h.size * 0.07, f = p * xe * 2;
467
468
  for (let g = 0; g < xe; g++)
@@ -474,31 +475,31 @@ function ho() {
474
475
  p++;
475
476
  }
476
477
  e.setDrawRange(0, p * xe * 2), i.needsUpdate = !0, c.needsUpdate = !0;
477
- }), /* @__PURE__ */ Y(he, { children: [
478
+ }), /* @__PURE__ */ q(he, { children: [
478
479
  /* @__PURE__ */ d("lineSegments", { geometry: e, material: r, frustumCulled: !1 }),
479
480
  a.map((n, i) => /* @__PURE__ */ d("sprite", { ref: (c) => void (o.current[i] = c), material: n, visible: !1 }, i))
480
481
  ] });
481
482
  }
482
483
  const ot = 24;
483
- function vo() {
484
+ function Mo() {
484
485
  const e = z(() => Array.from({ length: ot }, () => D("#fff")), []), r = R([]), a = z(() => ({ c: new t.Vector3(), h: new t.Vector3() }), []);
485
486
  return ve(() => {
486
487
  const o = performance.now();
487
488
  let u = 0;
488
- for (const n of j.comets) {
489
+ for (const n of K.comets) {
489
490
  if (u >= ot) break;
490
491
  const i = Se(n.from), c = Se(n.to), p = r.current[u];
491
492
  if (!i || !c || !p) continue;
492
- const b = W((o - n.start) / n.dur);
493
- if (b >= 1) continue;
494
- je(i, c, 1, a.c), ce(i, a.c, c, Be(b), a.h), p.visible = !0, p.position.copy(a.h), p.scale.setScalar(0.9);
495
- const h = j.instances.get(n.from);
496
- e[u].color.copy(h ? ct[h.type] : Me).lerp(ne, 0.4).multiplyScalar(1.4 * Math.sin(Math.PI * b) + 0.2), u++;
493
+ const M = Nt(n, o);
494
+ if (!Ut(n, o)) continue;
495
+ Ke(i, c, 1, a.c), ce(i, a.c, c, Be(M), a.h), p.visible = !0, p.position.copy(a.h), p.scale.setScalar(0.9);
496
+ const h = K.instances.get(n.from);
497
+ e[u].color.copy(h ? ct[h.type] : Me).lerp(ne, 0.4).multiplyScalar(1.4 * Math.sin(Math.PI * M) + 0.2), u++;
497
498
  }
498
499
  for (let n = u; n < ot; n++) r.current[n] && (r.current[n].visible = !1);
499
500
  }), /* @__PURE__ */ d(he, { children: e.map((o, u) => /* @__PURE__ */ d("sprite", { ref: (n) => void (r.current[u] = n), material: o, visible: !1 }, u)) });
500
501
  }
501
- const we = 14, go = 0.2, yo = new t.OctahedronGeometry(0.13, 0), wo = (
502
+ const we = 14, So = 0.2, xo = new t.OctahedronGeometry(0.13, 0), Co = (
502
503
  /* glsl */
503
504
  `
504
505
  attribute vec3 aCol;
@@ -509,7 +510,7 @@ void main(){
509
510
  vV = normalize(-mv.xyz); vC = aCol;
510
511
  gl_Position = projectionMatrix * mv;
511
512
  }`
512
- ), bo = (
513
+ ), Ao = (
513
514
  /* glsl */
514
515
  `
515
516
  uniform float uGain;
@@ -524,7 +525,7 @@ void main(){
524
525
  gl_FragColor = vec4(col * uGain, 1.0);
525
526
  }`
526
527
  ), nt = new t.Vector3();
527
- function Mo(e, r) {
528
+ function Po(e, r) {
528
529
  let a = 0, o = 0, u = 0, n = 1 / 0;
529
530
  for (const p of be.agents.values())
530
531
  p.run === e && (p.depth === 0 ? (a++, o += p.eu, u += p.ev) : n = Math.min(n, p.ev));
@@ -538,15 +539,15 @@ function Mo(e, r) {
538
539
  r.v = n < 1 / 0 ? (c + n) / 2 : c - i;
539
540
  }
540
541
  const rt = { u: 0, v: 0 };
541
- function So({ run: e }) {
542
+ function Vo({ run: e }) {
542
543
  const r = z(() => new t.Vector3(), []), a = z(() => new t.Vector3(), []), o = z(() => ({ init: !1, c: new t.Color(), topY: 0, topSet: !1 }), []);
543
- Et(() => (Pe.set(e.id, r), He.set(e.id, a), () => {
544
- Pe.get(e.id) === r && Pe.delete(e.id), He.get(e.id) === a && He.delete(e.id);
544
+ Et(() => (Pe.set(e.id, r), je.set(e.id, a), () => {
545
+ Pe.get(e.id) === r && Pe.delete(e.id), je.get(e.id) === a && je.delete(e.id);
545
546
  }), [e.id, r, a]);
546
547
  const u = z(() => {
547
548
  const h = new t.SphereGeometry(1, 16, 12), G = new t.InstancedBufferAttribute(new Float32Array(we * 3), 3);
548
549
  h.setAttribute("aCol", G);
549
- const E = new t.ShaderMaterial({ uniforms: { uGain: { value: 1 } }, vertexShader: wo, fragmentShader: bo }), v = new t.InstancedMesh(h, E, we);
550
+ const E = new t.ShaderMaterial({ uniforms: { uGain: { value: 1 } }, vertexShader: Co, fragmentShader: Ao }), v = new t.InstancedMesh(h, E, we);
550
551
  v.frustumCulled = !1;
551
552
  const A = new Float32Array(we * 3), V = Math.PI * (3 - Math.sqrt(5));
552
553
  for (let l = 0; l < we; l++) {
@@ -560,52 +561,52 @@ function So({ run: e }) {
560
561
  () => ({
561
562
  core: D(new t.Color("#7a5cff").multiplyScalar(0.35)),
562
563
  cloud: D("#000"),
563
- beads: $e.map(() => ue("#fff"))
564
+ beads: We.map(() => ue("#fff"))
564
565
  }),
565
566
  []
566
- ), c = R(null), p = R([]), b = R(null);
567
+ ), c = R(null), p = R([]), M = R(null);
567
568
  return ve(({ clock: h }) => {
568
569
  var L;
569
- const G = performance.now(), E = h.elapsedTime, v = e.run ?? j.runs.get(e.id);
570
- Mo(e, rt), _t(e, rt.u, rt.v, nt), o.init ? r.lerp(nt, 0.12) : (r.copy(nt), o.init = !0);
571
- const A = Math.max(0.6, Ae.scale), V = v ? Ke((G - v.startedAt) / 1200) : 1, l = v != null && v.endedAt ? W(1 - (G - v.endedAt - (Nt - 2600)) / 2600) : 1, f = (v == null ? void 0 : v.status) === "started" ? 1 : 0.6;
570
+ const G = performance.now(), E = h.elapsedTime, v = e.run ?? K.runs.get(e.id);
571
+ Po(e, rt), Xt(e, rt.u, rt.v, nt), o.init ? r.lerp(nt, 0.12) : (r.copy(nt), o.init = !0);
572
+ const A = Math.max(0.6, Ae.scale), V = v ? He((G - v.startedAt) / 1200) : 1, l = v != null && v.endedAt ? W(1 - (G - v.endedAt - (jt - 2600)) / 2600) : 1, f = (v == null ? void 0 : v.status) === "started" ? 1 : 0.6;
572
573
  c.current && (c.current.position.copy(r), c.current.scale.setScalar(Math.max(1e-4, A * (0.4 + 0.6 * V) * (0.6 + 0.4 * l))));
573
- const { mesh: g, mat: x, pos: s, o: S } = u, T = q ? 0 : 0.02;
574
+ const { mesh: g, mat: x, pos: s, o: S } = u, T = Y ? 0 : 0.02;
574
575
  for (let w = 0; w < we; w++)
575
- S.position.set(s[w * 3] + Math.sin(E * 2.1 + w * 1.7) * T, s[w * 3 + 1] + Math.cos(E * 1.8 + w * 2.3) * T, s[w * 3 + 2] + Math.sin(E * 1.6 + w) * T), S.scale.setScalar(go), S.updateMatrix(), g.setMatrixAt(w, S.matrix);
576
+ S.position.set(s[w * 3] + Math.sin(E * 2.1 + w * 1.7) * T, s[w * 3 + 1] + Math.cos(E * 1.8 + w * 2.3) * T, s[w * 3 + 2] + Math.sin(E * 1.6 + w) * T), S.scale.setScalar(So), S.updateMatrix(), g.setMatrixAt(w, S.matrix);
576
577
  g.instanceMatrix.needsUpdate = !0;
577
- const y = q ? 1 : 0.88 + 0.12 * Math.sin(E * 0.7 + e.index);
578
+ const y = Y ? 1 : 0.88 + 0.12 * Math.sin(E * 0.7 + e.index);
578
579
  x.uniforms.uGain.value = (0.55 + 0.45 * f) * l * (0.7 + 0.3 * V), i.cloud.color.copy(n).multiplyScalar(0.22 * l * f * y * V);
579
- for (let w = 0; w < $e.length; w++) {
580
+ for (let w = 0; w < We.length; w++) {
580
581
  const P = p.current[w];
581
582
  if (!P || (P.visible = !!(v != null && v.hasSteps), !(v != null && v.hasSteps))) continue;
582
- const B = Ut(v, w), _ = w / 3 * Math.PI * 2 + (q ? 0 : E * 0.35);
583
+ const B = Ht(v, w), _ = w / 3 * Math.PI * 2 + (Y ? 0 : E * 0.35);
583
584
  P.position.set(Math.cos(_) * 0.72, Math.sin(_) * 0.72 * 0.42, Math.sin(_) * 0.3);
584
585
  const U = 0.5 + 0.5 * Math.sin(E * 4);
585
- P.scale.setScalar(B === "running" ? 1.25 + U * 0.3 : 1), P.rotation.y = q ? 0 : E * 0.8, i.beads[w].color.copy(B === "running" ? Fe : B === "done" ? Me : B === "failed" ? Xe : n).multiplyScalar((B === "queued" ? 0.35 : B === "running" ? 1.2 + U * 0.6 : 0.9) * l);
586
+ P.scale.setScalar(B === "running" ? 1.25 + U * 0.3 : 1), P.rotation.y = Y ? 0 : E * 0.8, i.beads[w].color.copy(B === "running" ? Fe : B === "done" ? Me : B === "failed" ? Xe : n).multiplyScalar((B === "queued" ? 0.35 : B === "running" ? 1.2 + U * 0.6 : 0.9) * l);
586
587
  }
587
588
  let I = r.y + 0.95 * A;
588
589
  for (const w of be.agents.values()) w.run === e && w.live.y + 0.95 * w.scale + 0.45 > I && (I = w.live.y + 0.95 * w.scale + 0.45);
589
- o.topY = o.topSet ? o.topY + (I - o.topY) * 0.12 : I, o.topSet = !0, a.set(r.x, o.topY, 0.5), (L = b.current) == null || L.position.copy(a);
590
- }), /* @__PURE__ */ Y(he, { children: [
591
- /* @__PURE__ */ Y("group", { ref: c, scale: 1e-4, children: [
590
+ o.topY = o.topSet ? o.topY + (I - o.topY) * 0.12 : I, o.topSet = !0, a.set(r.x, o.topY, 0.5), (L = M.current) == null || L.position.copy(a);
591
+ }), /* @__PURE__ */ q(he, { children: [
592
+ /* @__PURE__ */ q("group", { ref: c, scale: 1e-4, children: [
592
593
  /* @__PURE__ */ d("sprite", { material: i.cloud, scale: 4.2, position: [0, 0, -0.6] }),
593
594
  /* @__PURE__ */ d("sprite", { material: i.core, scale: 1.8 }),
594
595
  /* @__PURE__ */ d("primitive", { object: u.mesh }),
595
- $e.map((h) => /* @__PURE__ */ d("mesh", { ref: (G) => void (p.current[h] = G), geometry: yo, material: i.beads[h], visible: !1 }, h))
596
+ We.map((h) => /* @__PURE__ */ d("mesh", { ref: (G) => void (p.current[h] = G), geometry: xo, material: i.beads[h], visible: !1 }, h))
596
597
  ] }),
597
- /* @__PURE__ */ d("group", { ref: b, children: e.run && /* @__PURE__ */ d(xo, { run: e.run, color: `#${n.getHexString()}` }) })
598
+ /* @__PURE__ */ d("group", { ref: M, children: e.run && /* @__PURE__ */ d(zo, { run: e.run, color: `#${n.getHexString()}` }) })
598
599
  ] });
599
600
  }
600
- function xo({ run: e, color: r }) {
601
- Xt();
601
+ function zo({ run: e, color: r }) {
602
+ Kt();
602
603
  const a = e.status !== "started";
603
604
  let o = 0;
604
- for (const n of j.instances.values()) n.run === e.id && Ht(n) && o++;
605
- const u = e.hasSteps ? [...Kt(e, { base: "#9fb3d1", current: "#ffc24a", done: "#cfe9ff" })] : [{ text: "nucleus", color: "#9fb3d1" }];
606
- return u.push({ text: a ? " · complete" : ` · ${o} e-`, color: "#9fb3d1" }), /* @__PURE__ */ d(Ie, { text: e.topic, secondary: u, color: r, size: 0.32, secondarySize: 0.25, maxWidth: 10, opacity: a ? 0.5 : 0.95, fadeMs: 400, anchorY: "bottom", pxRange: [10, 14] });
605
+ for (const n of K.instances.values()) n.run === e.id && Yt(n) && o++;
606
+ const u = e.hasSteps ? [...qt(e, { base: "#9fb3d1", current: "#ffc24a", done: "#cfe9ff" })] : [{ text: "nucleus", color: "#9fb3d1" }];
607
+ return u.push({ text: a ? " · complete" : ` · ${o} e-`, color: "#9fb3d1" }), !e.hasSteps && $t(e) && u.push({ text: ` · ${Wt(e)}`, color: "#9fb3d1" }), /* @__PURE__ */ d(Ie, { text: e.topic, secondary: u, color: r, size: 0.32, secondarySize: 0.25, maxWidth: 10, opacity: a ? 0.5 : 0.95, fadeMs: 400, anchorY: "bottom", pxRange: [10, 14] });
607
608
  }
608
- const Co = 140, Ao = 0.17, yt = 40, st = 18, at = 5, Ue = 4, Po = (e) => Ao * t.MathUtils.clamp(Math.sqrt(48 / Math.max(1, e)), 1, 3), Vo = (
609
+ const Go = 140, Eo = 0.17, yt = 40, st = 18, at = 5, Ue = 4, Fo = (e) => Eo * t.MathUtils.clamp(Math.sqrt(48 / Math.max(1, e)), 1, 3), Ro = (
609
610
  /* glsl */
610
611
  `
611
612
  attribute vec3 aCol; attribute float aFire;
@@ -616,7 +617,7 @@ void main(){
616
617
  vV = normalize(-mv.xyz); vC = aCol; vF = aFire;
617
618
  gl_Position = projectionMatrix * mv;
618
619
  }`
619
- ), zo = (
620
+ ), Bo = (
620
621
  /* glsl */
621
622
  `
622
623
  varying vec3 vN; varying vec3 vV; varying vec3 vC; varying float vF;
@@ -630,7 +631,7 @@ void main(){
630
631
  col += vC * vF * 1.8 + vec3(1.0) * vF * vF * 0.9;
631
632
  gl_FragColor = vec4(col, 1.0);
632
633
  }`
633
- ), Go = () => new t.ShaderMaterial({
634
+ ), Io = () => new t.ShaderMaterial({
634
635
  uniforms: { uColor: { value: new t.Color() } },
635
636
  vertexShader: (
636
637
  /* glsl */
@@ -645,18 +646,18 @@ void main(){
645
646
  transparent: !0,
646
647
  depthWrite: !1,
647
648
  blending: t.AdditiveBlending
648
- }), Eo = new t.SphereGeometry(1, 48, 32);
649
- function Fo({ galaxy: e }) {
649
+ }), Oo = new t.SphereGeometry(1, 48, 32);
650
+ function To({ galaxy: e }) {
650
651
  const r = z(() => {
651
- const l = e.nodes.slice(0, Co), f = new Set(l.map((g) => g.id));
652
+ const l = e.nodes.slice(0, Go), f = new Set(l.map((g) => g.id));
652
653
  return { nodes: l, links: e.links.filter((g) => f.has(g.source) && f.has(g.target)) };
653
654
  }, [e]), a = r.nodes.length, o = z(() => {
654
- const l = new Float32Array(a * 3), f = Math.PI * (3 - Math.sqrt(5)), g = Po(a);
655
+ const l = new Float32Array(a * 3), f = Math.PI * (3 - Math.sqrt(5)), g = Fo(a);
655
656
  for (let m = 0; m < a; m++) {
656
- const C = (le - g) * (0.3 + 0.7 * Math.cbrt(1 - m / a)), N = 1 - 2 * (m + 0.5) / a, K = Math.sqrt(1 - N * N);
657
- l.set([Math.cos(m * f) * K * C, N * C, Math.sin(m * f) * K * C], m * 3);
657
+ const C = (le - g) * (0.3 + 0.7 * Math.cbrt(1 - m / a)), N = 1 - 2 * (m + 0.5) / a, H = Math.sqrt(1 - N * N);
658
+ l.set([Math.cos(m * f) * H * C, N * C, Math.sin(m * f) * H * C], m * 3);
658
659
  }
659
- const x = r.nodes.map((m, C) => new t.Color(jt[m.kind] ?? "#94a3b8").lerp(ne, 0.08 + C * 37 % 10 / 70).multiplyScalar(0.8)), s = new Map(r.nodes.map((m, C) => [m.id, C])), S = [], T = /* @__PURE__ */ new Set(), y = (m, C) => (l[m * 3] - l[C * 3]) ** 2 + (l[m * 3 + 1] - l[C * 3 + 1]) ** 2 + (l[m * 3 + 2] - l[C * 3 + 2]) ** 2, I = (m, C) => {
660
+ const x = r.nodes.map((m, C) => new t.Color(Dt[m.kind] ?? "#94a3b8").lerp(ne, 0.08 + C * 37 % 10 / 70).multiplyScalar(0.8)), s = new Map(r.nodes.map((m, C) => [m.id, C])), S = [], T = /* @__PURE__ */ new Set(), y = (m, C) => (l[m * 3] - l[C * 3]) ** 2 + (l[m * 3 + 1] - l[C * 3 + 1]) ** 2 + (l[m * 3 + 2] - l[C * 3 + 2]) ** 2, I = (m, C) => {
660
661
  const N = m < C ? m * 4096 + C : C * 4096 + m;
661
662
  m === C || T.has(N) || (T.add(N), S.push(m, C));
662
663
  };
@@ -666,7 +667,7 @@ function Fo({ galaxy: e }) {
666
667
  }
667
668
  for (let m = 0; m < a; m++) {
668
669
  let C = -1, N = 1 / 0;
669
- for (let K = 0; K < a; K++) K !== m && y(m, K) < N && (N = y(m, K), C = K);
670
+ for (let H = 0; H < a; H++) H !== m && y(m, H) < N && (N = y(m, H), C = H);
670
671
  C >= 0 && I(m, C);
671
672
  }
672
673
  const L = new Float32Array(S.length * 3);
@@ -675,34 +676,34 @@ function Fo({ galaxy: e }) {
675
676
  w.setAttribute("position", new t.BufferAttribute(L, 3)), w.setAttribute("color", new t.BufferAttribute(new Float32Array(S.length * 3), 3)), w.boundingSphere = new t.Sphere(new t.Vector3(), le * 2);
676
677
  const P = new t.SphereGeometry(1, 20, 14), B = new t.InstancedBufferAttribute(new Float32Array(a * 3), 3), _ = new t.InstancedBufferAttribute(new Float32Array(a), 1);
677
678
  P.setAttribute("aCol", B), P.setAttribute("aFire", _);
678
- const U = new t.InstancedMesh(P, new t.ShaderMaterial({ vertexShader: Vo, fragmentShader: zo }), a);
679
+ const U = new t.InstancedMesh(P, new t.ShaderMaterial({ vertexShader: Ro, fragmentShader: Bo }), a);
679
680
  U.frustumCulled = !1;
680
- const H = new t.Object3D();
681
+ const j = new t.Object3D();
681
682
  for (let m = 0; m < a; m++)
682
- H.position.set(l[m * 3], l[m * 3 + 1], l[m * 3 + 2]), H.scale.setScalar(g), H.updateMatrix(), U.setMatrixAt(m, H.matrix), B.setXYZ(m, x[m].r, x[m].g, x[m].b);
683
- return { pos: l, base: x, atomR: g, mesh: U, aCol: B, aFire: _, o: H, bgeo: w, owner: Int32Array.from(S), fire: new Float32Array(a), fireC: Array.from({ length: a }, () => new t.Color()) };
683
+ j.position.set(l[m * 3], l[m * 3 + 1], l[m * 3 + 2]), j.scale.setScalar(g), j.updateMatrix(), U.setMatrixAt(m, j.matrix), B.setXYZ(m, x[m].r, x[m].g, x[m].b);
684
+ return { pos: l, base: x, atomR: g, mesh: U, aCol: B, aFire: _, o: j, bgeo: w, owner: Int32Array.from(S), fire: new Float32Array(a), fireC: Array.from({ length: a }, () => new t.Color()) };
684
685
  }, [r, a]), u = z(
685
686
  () => ({
686
687
  beam: fe("#fff", !0),
687
688
  bond: fe("#fff", !0),
688
689
  core: D(new t.Color("#7a5cff").multiplyScalar(0.35)),
689
690
  cloud: D(new t.Color("#1d4ed8").multiplyScalar(0.22)),
690
- waves: Array.from({ length: at }, Go)
691
+ waves: Array.from({ length: at }, Io)
691
692
  }),
692
693
  []
693
- ), n = z(() => new Ct(yt, st), []), i = z(() => new qe(yt), []), c = R([]), p = R([]), b = R([]), h = R(Array(Ue).fill("")), [G, E] = Ft("left"), v = z(() => /* @__PURE__ */ new Map(), [r]), A = z(() => ({ v: new t.Vector3(), mid: new t.Vector3(), p: new t.Vector3(), c: new t.Color(), c2: new t.Color(), sp: new t.Vector3() }), []), V = (l) => {
694
+ ), n = z(() => new Ct(yt, st), []), i = z(() => new Ye(yt), []), c = R([]), p = R([]), M = R([]), h = R(Array(Ue).fill("")), [G, E] = Ft("left"), v = z(() => /* @__PURE__ */ new Map(), [r]), A = z(() => ({ v: new t.Vector3(), mid: new t.Vector3(), p: new t.Vector3(), c: new t.Color(), c2: new t.Color(), sp: new t.Vector3() }), []), V = (l) => {
694
695
  let f = v.get(l);
695
- return f === void 0 && v.set(l, f = Wt(e, l) % a), f;
696
+ return f === void 0 && v.set(l, f = Jt(e, l) % a), f;
696
697
  };
697
698
  return ve(({ clock: l, camera: f, size: g }) => {
698
699
  if (!a) return;
699
700
  const x = performance.now(), s = l.elapsedTime, { pos: S, base: T, fire: y, fireC: I, mesh: L, aCol: w, aFire: P, o: B } = o;
700
701
  y.fill(0);
701
- const { v: _, mid: U, p: H, c: m, c2: C } = A;
702
+ const { v: _, mid: U, p: j, c: m, c2: C } = A;
702
703
  n.begin(), i.begin();
703
704
  let N = 0;
704
- for (const M of j.flares) {
705
- const O = V(M.node), X = (x - M.start) / 1e3, Q = j.instances.get(M.instance), ee = M.op === "write", ae = ee ? pt : Q ? ct[Q.type] : Me, te = X < 0.3 ? X / 0.3 : Math.exp(-(X - 0.3) * 1.3);
705
+ for (const b of K.flares) {
706
+ const O = V(b.node), X = (x - b.start) / 1e3, Q = K.instances.get(b.instance), ee = b.op === "write", ae = ee ? pt : Q ? ct[Q.type] : Me, te = X < 0.3 ? X / 0.3 : Math.exp(-(X - 0.3) * 1.3);
706
707
  if (te > y[O] && (y[O] = te, I[O].copy(ee ? ne : ae)), ee && X < 1.6 && N < at) {
707
708
  const oe = c.current[N];
708
709
  if (oe) {
@@ -711,7 +712,7 @@ function Fo({ galaxy: e }) {
711
712
  }
712
713
  N++;
713
714
  }
714
- const ge = Se(M.instance), me = ge ? qt(ge, A.sp) : void 0;
715
+ const ge = Se(b.instance), me = ge ? Zt(ge, A.sp) : void 0;
715
716
  if (me && X < 2) {
716
717
  const oe = n.next();
717
718
  if (oe < 0) continue;
@@ -720,64 +721,64 @@ function Fo({ galaxy: e }) {
720
721
  for (let de = 0; de < st; de++)
721
722
  for (let F = 0; F < 2; F++) {
722
723
  const $ = (de + F) / st;
723
- ce(me, U, _, $, H), n.P.setXYZ(oe + de * 2 + F, H.x, H.y, H.z);
724
+ ce(me, U, _, $, j), n.P.setXYZ(oe + de * 2 + F, j.x, j.y, j.z);
724
725
  const ze = Math.exp(-((($ - Te) / 0.07) ** 2)) * 2.2;
725
726
  C.copy(ae).multiplyScalar(ie * (0.18 + ze) * 0.8), n.C.setXYZ(oe + de * 2 + F, C.r, C.g, C.b);
726
727
  }
727
728
  ee ? i.add(me, U, _, 0.86, 1, 0.38, pt, ie * 1.4) : i.add(me, U, _, 0.12, -1, 0.38, ae, ie * 1.4);
728
729
  }
729
730
  }
730
- for (let M = N; M < at; M++) c.current[M] && (c.current[M].visible = !1);
731
+ for (let b = N; b < at; b++) c.current[b] && (c.current[b].visible = !1);
731
732
  n.end(), i.end();
732
- const K = q ? 0 : 0.025;
733
- for (let M = 0; M < a; M++) {
734
- const O = y[M];
735
- m.copy(T[M]), O > 0.01 && Qt(m.multiplyScalar(1 - O * 0.5), I[M], O * 0.9), w.setXYZ(M, m.r, m.g, m.b), P.setX(M, O), B.position.set(S[M * 3] + Math.sin(s * 2.1 + M * 1.7) * K, S[M * 3 + 1] + Math.cos(s * 1.8 + M * 2.3) * K, S[M * 3 + 2] + Math.sin(s * 1.6 + M) * K), B.scale.setScalar(o.atomR * (1 + O * 0.35)), B.updateMatrix(), L.setMatrixAt(M, B.matrix);
733
+ const H = Y ? 0 : 0.025;
734
+ for (let b = 0; b < a; b++) {
735
+ const O = y[b];
736
+ m.copy(T[b]), O > 0.01 && ro(m.multiplyScalar(1 - O * 0.5), I[b], O * 0.9), w.setXYZ(b, m.r, m.g, m.b), P.setX(b, O), B.position.set(S[b * 3] + Math.sin(s * 2.1 + b * 1.7) * H, S[b * 3 + 1] + Math.cos(s * 1.8 + b * 2.3) * H, S[b * 3 + 2] + Math.sin(s * 1.6 + b) * H), B.scale.setScalar(o.atomR * (1 + O * 0.35)), B.updateMatrix(), L.setMatrixAt(b, B.matrix);
736
737
  }
737
738
  L.instanceMatrix.needsUpdate = !0, w.needsUpdate = !0, P.needsUpdate = !0;
738
739
  const J = o.bgeo.getAttribute("color"), re = o.owner;
739
- for (let M = 0; M < re.length; M++) {
740
- const O = Math.max(y[re[M]], y[re[M ^ 1]]), X = T[re[M]];
741
- J.setXYZ(M, X.r * 0.22 + O * 0.5, X.g * 0.22 + O * 0.5, X.b * 0.22 + O * 0.55);
740
+ for (let b = 0; b < re.length; b++) {
741
+ const O = Math.max(y[re[b]], y[re[b ^ 1]]), X = T[re[b]];
742
+ J.setXYZ(b, X.r * 0.22 + O * 0.5, X.g * 0.22 + O * 0.5, X.b * 0.22 + O * 0.55);
742
743
  }
743
744
  J.needsUpdate = !0;
744
745
  const Ve = f, se = 30 * Math.max(1, Ve.position.distanceTo(be.graph.pos)) * Math.tan(Ve.fov * Math.PI / 360) / Math.max(1, g.height) / Math.max(0.05, be.graph.scale), pe = be.graph.out.x < -0.5 ? "right" : be.graph.out.x > 0.5 ? "left" : G;
745
746
  pe !== G && E(pe);
746
- const We = (pe === "right" ? -1 : 1) * (le + 0.3);
747
+ const $e = (pe === "right" ? -1 : 1) * (le + 0.3);
747
748
  let Z = 0;
748
- for (let M = j.flares.length - 1; M >= 0 && Z < Ue; M--) {
749
- const O = j.flares[M];
749
+ for (let b = K.flares.length - 1; b >= 0 && Z < Ue; b--) {
750
+ const O = K.flares[b];
750
751
  if (x - O.start > 2200) break;
751
752
  let X = !1;
752
753
  for (let ae = 0; ae < Z; ae++) h.current[ae] === O.node && (X = !0);
753
754
  if (X) continue;
754
- const Q = p.current[Z], ee = b.current[Z];
755
- Q && ee && (ee.position.set(We, (1.5 - Z) * se, 0.5), h.current[Z] !== O.node && (Q.setText(`${O.op === "write" ? "wrote" : "read"} · ${O.node}`), Q.setColor(O.op === "write" ? "#ff9ccf" : "#7dd3fc")), Q.setOpacity(1)), h.current[Z] = O.node, Z++;
755
+ const Q = p.current[Z], ee = M.current[Z];
756
+ Q && ee && (ee.position.set($e, (1.5 - Z) * se, 0.5), h.current[Z] !== O.node && (Q.setText(`${O.op === "write" ? "wrote" : "read"} · ${O.node}`), Q.setColor(O.op === "write" ? "#ff9ccf" : "#7dd3fc")), Q.setOpacity(1)), h.current[Z] = O.node, Z++;
756
757
  }
757
- for (let M = Z; M < Ue; M++) {
758
- const O = p.current[M];
759
- O == null || O.setOpacity(0), h.current[M] = "";
758
+ for (let b = Z; b < Ue; b++) {
759
+ const O = p.current[b];
760
+ O == null || O.setOpacity(0), h.current[b] = "";
760
761
  }
761
- }), /* @__PURE__ */ Y(he, { children: [
762
+ }), /* @__PURE__ */ q(he, { children: [
762
763
  /* @__PURE__ */ d("sprite", { material: u.cloud, scale: le * 4.2, position: [0, 0, -1] }),
763
764
  /* @__PURE__ */ d("sprite", { material: u.core, scale: le * 1.6 }),
764
765
  /* @__PURE__ */ d("lineSegments", { geometry: o.bgeo, material: u.bond, frustumCulled: !1 }),
765
766
  /* @__PURE__ */ d("primitive", { object: o.mesh }),
766
- u.waves.map((l, f) => /* @__PURE__ */ d("mesh", { ref: (g) => void (c.current[f] = g), geometry: Eo, material: l, visible: !1 }, f)),
767
+ u.waves.map((l, f) => /* @__PURE__ */ d("mesh", { ref: (g) => void (c.current[f] = g), geometry: Oo, material: l, visible: !1 }, f)),
767
768
  /* @__PURE__ */ d("lineSegments", { geometry: n.geo, material: u.beam, frustumCulled: !1 }),
768
769
  /* @__PURE__ */ d("primitive", { object: i.mesh }),
769
- Array.from({ length: Ue }, (l, f) => /* @__PURE__ */ d("group", { ref: (g) => void (b.current[f] = g), children: /* @__PURE__ */ d(Ie, { ref: (g) => void (p.current[f] = g), text: "", font: "mono", anchorX: G, size: 0.24, opacity: 0, fadeMs: 250, pxRange: [8, 11.5] }) }, f)),
770
- /* @__PURE__ */ d(Yt, { position: [0, -le - 0.85, 0], prefix: "molecule · ", font: "mono", color: "#ff4fa8", letterSpacing: 0.04, size: 0.26, opacity: 0.75, pxRange: [8.5, 12] })
770
+ Array.from({ length: Ue }, (l, f) => /* @__PURE__ */ d("group", { ref: (g) => void (M.current[f] = g), children: /* @__PURE__ */ d(Ie, { ref: (g) => void (p.current[f] = g), text: "", font: "mono", anchorX: G, size: 0.24, opacity: 0, fadeMs: 250, pxRange: [8, 11.5] }) }, f)),
771
+ /* @__PURE__ */ d(kt, { position: [0, -le - 0.85, 0], prefix: "molecule · ", font: "mono", color: "#ff4fa8", letterSpacing: 0.04, size: 0.26, opacity: 0.75, pxRange: [8.5, 12] })
771
772
  ] });
772
773
  }
773
- function Ro() {
774
+ function Lo() {
774
775
  const e = z(() => {
775
776
  const a = [], o = (n, i) => a.push(...n, ...i);
776
777
  for (const n of [4, 8, 12, 16, 20, 24])
777
778
  for (let c = 0; c < 160; c++) {
778
779
  if (n > 4 && c % 4 === 3) continue;
779
- const p = c / 160 * Math.PI * 2, b = (c + 1) / 160 * Math.PI * 2;
780
- o([Math.cos(p) * n, Math.sin(p) * n, 0], [Math.cos(b) * n, Math.sin(b) * n, 0]);
780
+ const p = c / 160 * Math.PI * 2, M = (c + 1) / 160 * Math.PI * 2;
781
+ o([Math.cos(p) * n, Math.sin(p) * n, 0], [Math.cos(M) * n, Math.sin(M) * n, 0]);
781
782
  }
782
783
  for (let n = 0; n < 72; n++) {
783
784
  const i = n / 72 * Math.PI * 2, c = 24, p = n % 6 === 0 ? 25.2 : 24.5;
@@ -788,18 +789,18 @@ function Ro() {
788
789
  }, []), r = z(() => fe(new t.Color("#3db8ff").multiplyScalar(0.075)), []);
789
790
  return /* @__PURE__ */ d("lineSegments", { geometry: e, material: r, position: [0, 0, -9] });
790
791
  }
791
- const Bo = new t.Vector3();
792
- function Io(e) {
792
+ const _o = new t.Vector3();
793
+ function No(e) {
793
794
  for (const r of be.runs.values()) {
794
795
  const a = Pe.get(r.id);
795
796
  a && e(a, 0.8 * Math.max(0.6, Ae.scale));
796
- const o = He.get(r.id);
797
- o && e(Bo.set(o.x, o.y + 0.5, o.z), 1.2);
797
+ const o = je.get(r.id);
798
+ o && e(_o.set(o.x, o.y + 0.5, o.z), 1.2);
798
799
  }
799
800
  }
800
- function Xo() {
801
- return /* @__PURE__ */ Y(
802
- $t,
801
+ function qo() {
802
+ return /* @__PURE__ */ q(
803
+ Qt,
803
804
  {
804
805
  title: "atom · agent orbitals",
805
806
  subtitle: "Each run is an atom: the nucleus is the run hub, agents are electrons on its shells, subagents orbit their parent · LLM calls emit photons sized by tokens · ◎ MCP detectors with backend sensors · graph = molecule on the side · exit = decay",
@@ -813,26 +814,26 @@ function Xo() {
813
814
  agentRadius: 0.75,
814
815
  graph: { natural: le * 1.15, radius: 2.3 },
815
816
  peripheryGap: 3.8,
816
- Background: /* @__PURE__ */ d(Ro, {}),
817
- Agent: mo,
818
- RunMarker: So,
819
- McpServer: ao,
820
- Backend: so,
821
- GraphResource: Fo,
817
+ Background: /* @__PURE__ */ d(Lo, {}),
818
+ Agent: wo,
819
+ RunMarker: Vo,
820
+ McpServer: fo,
821
+ Backend: uo,
822
+ GraphResource: To,
822
823
  cluster: { radius: 1.3, variant: "orb" },
823
- extents: Io,
824
- PostFX: /* @__PURE__ */ Y(Vt, { multisampling: 0, children: [
824
+ extents: No,
825
+ PostFX: /* @__PURE__ */ q(Vt, { multisampling: 0, children: [
825
826
  /* @__PURE__ */ d(zt, { mipmapBlur: !0, intensity: 1.05, luminanceThreshold: 0.22, luminanceSmoothing: 0.25, radius: 0.7 }),
826
827
  /* @__PURE__ */ d(Gt, { eskil: !1, offset: 0.25, darkness: 0.85 })
827
828
  ] }),
828
829
  children: [
829
- /* @__PURE__ */ d(ho, {}),
830
- /* @__PURE__ */ d(vo, {}),
831
- /* @__PURE__ */ d(io, {})
830
+ /* @__PURE__ */ d(bo, {}),
831
+ /* @__PURE__ */ d(Mo, {}),
832
+ /* @__PURE__ */ d(po, {})
832
833
  ]
833
834
  }
834
835
  );
835
836
  }
836
837
  export {
837
- Xo as default
838
+ qo as default
838
839
  };