agentglow 0.1.0 → 0.2.0

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.
Files changed (41) hide show
  1. package/README.md +38 -3
  2. package/dist/chunks/KitScene-BuFtYuhc.js +2737 -0
  3. package/dist/chunks/index-BPyTLdiF.js +792 -0
  4. package/dist/chunks/index-Bo5HRf-O.js +784 -0
  5. package/dist/chunks/index-C42Ihyo1.js +605 -0
  6. package/dist/chunks/index-C5YqtHnC.js +677 -0
  7. package/dist/chunks/index-Cyv7bII1.js +818 -0
  8. package/dist/chunks/index-D0UvupqM.js +1143 -0
  9. package/dist/chunks/index-D733n3Hf.js +1086 -0
  10. package/dist/chunks/index-DCmhxN8v.js +1010 -0
  11. package/dist/chunks/index-DO9SAG-u.js +753 -0
  12. package/dist/chunks/index-Dn6oRasS.js +887 -0
  13. package/dist/chunks/index-HyfZ0ePz.js +838 -0
  14. package/dist/chunks/index-XMOz-HBf.js +492 -0
  15. package/dist/chunks/index-ZT88hgW-.js +763 -0
  16. package/dist/chunks/index-e6egU2Q6.js +889 -0
  17. package/dist/chunks/index-jLXx_Wgk.js +68 -0
  18. package/dist/chunks/index-tonipLb2.js +980 -0
  19. package/dist/index.js +1 -1
  20. package/dist/style.css +1 -1
  21. package/dist/types/AgentScene.d.ts +14 -1
  22. package/dist/types/world.d.ts +59 -0
  23. package/package.json +1 -1
  24. package/dist/chunks/ClusterBall-CPsd6JvJ.js +0 -1489
  25. package/dist/chunks/index-0Bqa57T_.js +0 -786
  26. package/dist/chunks/index-4JCQqMml.js +0 -831
  27. package/dist/chunks/index-55W5crSg.js +0 -63
  28. package/dist/chunks/index-78lWZCrQ.js +0 -984
  29. package/dist/chunks/index-Bv6_kdaq.js +0 -768
  30. package/dist/chunks/index-Cgb5ir1r.js +0 -688
  31. package/dist/chunks/index-CqVCWpP7.js +0 -796
  32. package/dist/chunks/index-D1O5v601.js +0 -1065
  33. package/dist/chunks/index-DOoA9htC.js +0 -1181
  34. package/dist/chunks/index-K__sPGRy.js +0 -1134
  35. package/dist/chunks/index-N0zWN8NS.js +0 -857
  36. package/dist/chunks/index-NiYqQci9.js +0 -936
  37. package/dist/chunks/index-PQRnbPiJ.js +0 -565
  38. package/dist/chunks/index-VOXn1m-Q.js +0 -848
  39. package/dist/chunks/index-o4vs5msj.js +0 -837
  40. package/dist/chunks/index-yos7IepY.js +0 -890
  41. package/dist/chunks/spread-CWdeDFd9.js +0 -35
@@ -0,0 +1,605 @@
1
+ import { jsxs as w, jsx as r, Fragment as Ue } from "react/jsx-runtime";
2
+ import { Sparkles as it, Stars as ct, Grid as lt } from "@react-three/drei";
3
+ import { EffectComposer as pt, Bloom as ut, Vignette as ft, Noise as dt } from "@react-three/postprocessing";
4
+ import * as n from "three";
5
+ import { useFrame as J } from "@react-three/fiber";
6
+ import { useRef as v, useMemo as A, useEffect as mt } from "react";
7
+ import { k as ve, f as we, i as ht, q as Qe, K as Mt, w as T, r as H, G as gt, t as et, T as Ee, n as yt, L as Se, v as wt, a as Me, R as bt, S as Ve, x as Be, u as xt, p as vt, e as St, l as At, M as Bt, c as tt, d as Ct, j as Gt } from "./KitScene-BuFtYuhc.js";
8
+ const $ = 0.05, Ce = 0.3, Rt = ht;
9
+ function I(e, t) {
10
+ return new n.Color(e).multiplyScalar(t);
11
+ }
12
+ const ge = /* @__PURE__ */ new Map(), nt = (e) => e.depth === 0 ? e.sib ? e.ev : 0 : e.ev;
13
+ function rt(e, t) {
14
+ const c = e.inst.parent ? ve.agents.get(e.inst.parent) : void 0, a = c ? nt(c) : 0, s = c ? c.eu : e.eu - 2.8 * we.spread, o = e.ev - a;
15
+ return t.base = a, t.off = o, t.div = 0.7 + 0.14 * Math.abs(o), t.u0 = s + 0.5, t.u1 = Math.max(t.u0 + 2 * t.div + 0.8, 2 * e.eu - t.u0), t;
16
+ }
17
+ const Le = (e) => {
18
+ const t = Math.min(1, Math.max(0, e));
19
+ return t * t * (3 - 2 * t);
20
+ };
21
+ function Pt(e, t) {
22
+ return e <= t.u0 || e >= t.u1 ? 0 : e < t.u0 + t.div ? Le((e - t.u0) / t.div) : e <= t.u1 - t.div ? 1 : Le((t.u1 - e) / t.div);
23
+ }
24
+ function Ge(e, t, c, a, s, o) {
25
+ const p = c ? c.base + c.off * Pt(t, c) : a;
26
+ return Qe(e, t, p, o), o.y = s, o;
27
+ }
28
+ function ke(e, t) {
29
+ return t.u0 = e.cu - e.hu - 0.6, t.u1 = e.cu + e.hu + 0.6, t;
30
+ }
31
+ const ot = { pos: [] }, ae = 0.5, We = 2.55, be = 3.75, It = be + 0.3, Re = new n.Vector3();
32
+ function st(e, t) {
33
+ const c = ot.pos[e];
34
+ return c ? Re.set(c.x, c.y + ae, c.z) : Re.set(0, ae, 0), wt(Re, t);
35
+ }
36
+ function zt(e) {
37
+ const t = [];
38
+ for (let c = 0; c < e; c++) {
39
+ const a = c / e * Math.PI * 2 + (Math.random() - 0.5) * 0.1, s = Math.random() * Math.PI * 2, o = 0.25 + 0.6 * Math.sqrt(Math.random());
40
+ t.push(new n.Vector3((We + o * Math.cos(s)) * Math.cos(a), o * Math.sin(s) * 0.7, (We + o * Math.cos(s)) * Math.sin(a)));
41
+ }
42
+ return t;
43
+ }
44
+ const at = 200, Fe = (e, t) => yt(e, t) % Math.min(at, e.nodes.length);
45
+ function _t({ galaxy: e }) {
46
+ const t = Math.min(at, e.nodes.length), c = v(null), a = v(null), s = A(() => zt(t), [t]);
47
+ ot.pos = s;
48
+ const o = A(() => e.nodes.slice(0, t).map((i) => new n.Color(Mt[i.kind] ?? "#94a3b8")), [e]), p = A(() => new Float32Array(Math.max(1, t)), [t]), M = A(() => new Uint8Array(Math.max(1, t)), [t]), f = A(() => new n.Object3D(), []), g = A(() => new n.Color(), []), y = A(() => new n.Color(5, 5, 5.5), []), B = v(/* @__PURE__ */ new Map()), S = A(() => {
49
+ const i = [];
50
+ for (let l = 0; l < t; l++) {
51
+ const d = [];
52
+ for (let u = 0; u < t; u++) {
53
+ if (l === u) continue;
54
+ const h = s[l].distanceToSquared(s[u]);
55
+ d.push([h, u]);
56
+ }
57
+ d.sort((u, h) => u[0] - h[0]);
58
+ for (const [, u] of d.slice(0, 2)) (u > l || l % 3 === 0) && i.push(s[l].x, s[l].y, s[l].z, s[u].x, s[u].y, s[u].z);
59
+ }
60
+ const b = new Map(e.nodes.slice(0, t).map((l, d) => [l.id, d]));
61
+ for (const l of e.links) {
62
+ const d = b.get(l.source), u = b.get(l.target);
63
+ d === void 0 || u === void 0 || s[d].distanceTo(s[u]) > 3 || i.push(s[d].x, s[d].y, s[d].z, s[u].x, s[u].y, s[u].z);
64
+ }
65
+ const P = new n.BufferGeometry();
66
+ return P.setAttribute("position", new n.Float32BufferAttribute(i, 3)), P;
67
+ }, [e, s]);
68
+ return J(() => {
69
+ const i = c.current;
70
+ if (!i) return;
71
+ const b = performance.now();
72
+ p.fill(0), M.fill(0);
73
+ let P = 0;
74
+ for (const l of T.flares) {
75
+ let d = B.current.get(l.node);
76
+ d === void 0 && (d = Fe(e, l.node), B.current.set(l.node, d));
77
+ const u = (b - l.start) / 1e3, h = Math.exp(-u * 1.3) * Math.min(1, u * 8);
78
+ h > p[d] && (p[d] = h), l.op === "write" && (M[d] = 1), P = Math.max(P, h);
79
+ }
80
+ for (let l = 0; l < t; l++) {
81
+ const d = p[l];
82
+ f.position.copy(s[l]), f.scale.setScalar(1 + d * (M[l] ? 4.5 : 3)), f.updateMatrix(), i.setMatrixAt(l, f.matrix), g.copy(o[l]).multiplyScalar(0.75 + d * 4), M[l] && d > 0.01 && g.lerp(y, d * 0.8), i.setColorAt(l, g);
83
+ }
84
+ i.instanceMatrix.needsUpdate = !0, i.instanceColor && (i.instanceColor.needsUpdate = !0), a.current && a.current.material.color.set("#c7d2fe").multiplyScalar(1.4 + P * 2.2 + (H ? 0 : Math.sin(b / 700) * 0.2));
85
+ }), /* @__PURE__ */ w("group", { position: [0, ae, 0], children: [
86
+ /* @__PURE__ */ w("group", { children: [
87
+ /* @__PURE__ */ w("instancedMesh", { ref: c, args: [void 0, void 0, Math.max(1, t)], children: [
88
+ /* @__PURE__ */ r("sphereGeometry", { args: [0.095, 10, 10] }),
89
+ /* @__PURE__ */ r("meshBasicMaterial", { toneMapped: !1 })
90
+ ] }),
91
+ /* @__PURE__ */ r("lineSegments", { geometry: S, children: /* @__PURE__ */ r("lineBasicMaterial", { color: "#8b9cff", transparent: !0, opacity: 0.42, blending: n.AdditiveBlending, depthWrite: !1 }) })
92
+ ] }),
93
+ /* @__PURE__ */ w("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, -ae + 0.04, 0], children: [
94
+ /* @__PURE__ */ r("ringGeometry", { args: [be - 0.18, be + 0.18, 128] }),
95
+ /* @__PURE__ */ r("meshBasicMaterial", { color: I("#a5b4fc", 1.3), transparent: !0, opacity: 0.55, toneMapped: !1, side: n.DoubleSide })
96
+ ] }),
97
+ /* @__PURE__ */ w("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, -ae + 0.03, 0], children: [
98
+ /* @__PURE__ */ r("circleGeometry", { args: [be - 0.2, 96] }),
99
+ /* @__PURE__ */ r("meshBasicMaterial", { color: "#0b1030", transparent: !0, opacity: 0.75 })
100
+ ] }),
101
+ /* @__PURE__ */ w("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, -ae + 0.05, 0], children: [
102
+ /* @__PURE__ */ r("ringGeometry", { args: [1.35, 1.45, 96] }),
103
+ /* @__PURE__ */ r("meshBasicMaterial", { color: I("#818cf8", 1.6), transparent: !0, opacity: 0.6, toneMapped: !1 })
104
+ ] }),
105
+ /* @__PURE__ */ w("mesh", { ref: a, position: [0, 0.1, 0], children: [
106
+ /* @__PURE__ */ r("octahedronGeometry", { args: [0.55, 0] }),
107
+ /* @__PURE__ */ r("meshBasicMaterial", { color: "#c7d2fe", toneMapped: !1, wireframe: !0 })
108
+ ] }),
109
+ /* @__PURE__ */ w("mesh", { position: [0, 0.1, 0], children: [
110
+ /* @__PURE__ */ r("sphereGeometry", { args: [0.22, 20, 20] }),
111
+ /* @__PURE__ */ r("meshBasicMaterial", { color: I("#e0e7ff", 3), toneMapped: !1 })
112
+ ] }),
113
+ /* @__PURE__ */ r(it, { count: H ? 20 : 60, scale: [7, 1.4, 7], size: 1.8, speed: 0.25, color: "#a5b4fc", opacity: 0.55 }),
114
+ /* @__PURE__ */ r(gt, { position: [0, 2.4, 0], suffix: " · Graph Central", color: "#a5b4fc", size: 0.36, pxRange: [9.5, 14] })
115
+ ] });
116
+ }
117
+ const ce = 48;
118
+ function Tt() {
119
+ const e = et(), t = v(null), c = v(null), a = A(() => {
120
+ const g = new n.BufferGeometry();
121
+ return g.setAttribute("position", new n.BufferAttribute(new Float32Array(ce * 6), 3)), g.setAttribute("color", new n.BufferAttribute(new Float32Array(ce * 6), 3)), g;
122
+ }, []), s = A(() => new n.Object3D(), []), o = A(() => new n.Vector3(), []), p = A(() => new n.Color(), []), M = A(() => Object.fromEntries(Object.entries(Ee).map(([g, y]) => [g, new n.Color(y)])), []), f = v(/* @__PURE__ */ new Map());
123
+ return J(() => {
124
+ const g = t.current, y = c.current;
125
+ if (!g || !y) return;
126
+ if (!e.nodes.length || !ve.graphWanted) {
127
+ g.count = y.count = 0, a.setDrawRange(0, 0);
128
+ return;
129
+ }
130
+ const B = performance.now(), S = a.getAttribute("position"), i = a.getAttribute("color");
131
+ let b = 0;
132
+ const P = T.flares;
133
+ for (let l = P.length - 1; l >= 0 && b < ce; l--) {
134
+ const d = P[l], u = (B - d.start) / 2600;
135
+ if (u >= 1) continue;
136
+ let h = f.current.get(d.node);
137
+ h === void 0 && (h = Fe(e, d.node), f.current.set(d.node, h)), st(h, o);
138
+ const x = d.op === "write", k = T.instances.get(d.instance), V = k ? M[k.type] : M.researcher;
139
+ s.position.copy(o), s.rotation.set(-Math.PI / 2, 0, 0), s.scale.setScalar((x ? 0.35 : 0.2) + u * (x ? 1.6 : 0.8)), s.updateMatrix(), g.setMatrixAt(b, s.matrix), x ? p.setRGB(4, 4, 4.4).multiplyScalar(1 - u) : p.copy(V).multiplyScalar(2.4 * (1 - u)), g.setColorAt(b, p);
140
+ const m = Me(d.instance), C = Math.min(1, (B - d.start) / 700);
141
+ if (m && u < 0.75) {
142
+ const F = 1 - u / 0.75;
143
+ S.setXYZ(b * 2, m.x, m.y, m.z), S.setXYZ(b * 2 + 1, o.x, o.y, o.z), x ? p.setRGB(2.6, 2.6, 3).multiplyScalar(F) : p.copy(V).multiplyScalar(1.2 * F), i.setXYZ(b * 2, p.r, p.g, p.b), i.setXYZ(b * 2 + 1, p.r * 0.7, p.g * 0.7, p.b * 0.7);
144
+ const _ = x ? C : 1 - C;
145
+ s.position.set(m.x + (o.x - m.x) * _, m.y + (o.y - m.y) * _ + Math.sin(_ * Math.PI) * 0.6, m.z + (o.z - m.z) * _), s.rotation.set(0, 0, 0), s.scale.setScalar(C >= 1 ? 1e-4 : x ? 1.4 : 1), s.updateMatrix(), y.setMatrixAt(b, s.matrix), x ? p.setRGB(6, 6, 6.5) : p.copy(V).multiplyScalar(4), y.setColorAt(b, p);
146
+ } else
147
+ S.setXYZ(b * 2, 0, 0, 0), S.setXYZ(b * 2 + 1, 0, 0, 0), s.scale.setScalar(1e-4), s.updateMatrix(), y.setMatrixAt(b, s.matrix);
148
+ b++;
149
+ }
150
+ g.count = b, y.count = b, g.instanceMatrix.needsUpdate = !0, y.instanceMatrix.needsUpdate = !0, g.instanceColor && (g.instanceColor.needsUpdate = !0), y.instanceColor && (y.instanceColor.needsUpdate = !0), a.setDrawRange(0, b * 2), S.needsUpdate = !0, i.needsUpdate = !0;
151
+ }), /* @__PURE__ */ w("group", { children: [
152
+ /* @__PURE__ */ w("instancedMesh", { ref: t, args: [void 0, void 0, ce], frustumCulled: !1, children: [
153
+ /* @__PURE__ */ r("torusGeometry", { args: [1, 0.05, 6, 40] }),
154
+ /* @__PURE__ */ r("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1 })
155
+ ] }),
156
+ /* @__PURE__ */ w("instancedMesh", { ref: c, args: [void 0, void 0, ce], frustumCulled: !1, children: [
157
+ /* @__PURE__ */ r("sphereGeometry", { args: [0.1, 10, 10] }),
158
+ /* @__PURE__ */ r("meshBasicMaterial", { toneMapped: !1 })
159
+ ] }),
160
+ /* @__PURE__ */ r("lineSegments", { geometry: a, frustumCulled: !1, children: /* @__PURE__ */ r("lineBasicMaterial", { vertexColors: !0, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) })
161
+ ] });
162
+ }
163
+ function Xe({ galaxy: e, op: t }) {
164
+ const c = v(null), a = v(null), s = v(0);
165
+ return J(() => {
166
+ const o = performance.now();
167
+ let p = null;
168
+ for (let f = T.flares.length - 1; f >= 0; f--) if (T.flares[f].op === t) {
169
+ p = T.flares[f];
170
+ break;
171
+ }
172
+ const M = p ? o - p.start : 1e9;
173
+ if (!(!c.current || !a.current)) {
174
+ if (!p || M > 1700) {
175
+ a.current.setOpacity(0);
176
+ return;
177
+ }
178
+ p.id !== s.current && (s.current = p.id, a.current.setText((t === "write" ? "wrote · " : "") + p.node), st(Fe(e, p.node), c.current.position)), a.current.setOpacity(Math.min(1, (1700 - M) / 400));
179
+ }
180
+ }), /* @__PURE__ */ r("group", { ref: c, children: /* @__PURE__ */ r(Se, { ref: a, position: [0, t === "write" ? 1.1 : 0.7, 0], text: "", color: t === "write" ? "#ffffff" : "#a5b4fc", size: 0.28, opacity: 0, fadeMs: 200, pxRange: [8, 12] }) });
181
+ }
182
+ function Vt() {
183
+ const e = et();
184
+ return e.nodes.length ? /* @__PURE__ */ w(Ue, { children: [
185
+ /* @__PURE__ */ r(Xe, { galaxy: e, op: "read" }),
186
+ /* @__PURE__ */ r(Xe, { galaxy: e, op: "write" })
187
+ ] }) : null;
188
+ }
189
+ const Pe = { queued: "#64748b", running: "#fbbf24", done: "#22c55e", failed: "#ef4444" }, Ie = { plan: "planner", research: "researcher", write: "writer" }, Ye = 10, je = new n.CylinderGeometry(1, 1, 1, 8, 1, !0), Oe = new n.Vector3(0, 1, 0), re = new n.Vector3(), oe = new n.Vector3(), xe = new n.Vector3(), le = new n.Object3D(), Ze = new n.Matrix4(), ze = new n.Vector3(), pe = new n.Vector3(), Z = { u0: 0, u1: 0, div: 1, base: 0, off: 0 }, ue = { u0: 0, u1: 0 }, Ot = new Float64Array(4);
190
+ function ye(e, t, c, a, s) {
191
+ xe.subVectors(a, c);
192
+ const o = xe.length();
193
+ le.position.copy(c).add(a).multiplyScalar(0.5), o > 1e-5 && le.quaternion.setFromUnitVectors(Oe, xe.divideScalar(o)), le.scale.set(s, Math.max(1e-4, o), s), le.updateMatrix(), e.setMatrixAt(t, le.matrix);
194
+ }
195
+ function Dt({ run: e }) {
196
+ const t = e.color, c = v(null), a = v(null), s = v([]), o = v([]), p = v([]), M = v(null), f = v(null), g = v(null), y = v(null), B = v(null), S = A(() => new n.Color(), []), i = A(
197
+ () => ({
198
+ trunk: new n.MeshBasicMaterial({ color: I(t, 1.5), toneMapped: !1, transparent: !0 }),
199
+ glow: new n.MeshBasicMaterial({ color: I(t, 0.5), toneMapped: !1, transparent: !0, opacity: 0.22, blending: n.AdditiveBlending, depthWrite: !1 }),
200
+ spur: new n.MeshBasicMaterial({ color: I(t, 1.9), toneMapped: !1, transparent: !0 }),
201
+ platform: new n.MeshBasicMaterial({ color: I(t, 0.35), toneMapped: !1, transparent: !0, opacity: 0.6 })
202
+ }),
203
+ [t]
204
+ ), b = A(() => {
205
+ const l = new n.InstancedMesh(je, i.spur, 1 + Ye * 3);
206
+ return l.frustumCulled = !1, l.count = 0, l;
207
+ }, [i]), P = A(() => {
208
+ const l = new n.InstancedMesh(je, i.glow, 1 + Ye * 3);
209
+ return l.frustumCulled = !1, l.count = 0, l;
210
+ }, [i]);
211
+ return J(({ clock: l }) => {
212
+ var ee, ie, te;
213
+ const d = c.current;
214
+ if (!d) return;
215
+ ze.copy(e.side), pe.copy(e.axis), xe.crossVectors(ze, Oe).dot(pe) < 0 && pe.negate(), Ze.makeBasis(ze, Oe, pe), d.quaternion.setFromRotationMatrix(Ze), d.position.copy(e.origin).addScaledVector(e.side, -e.cu).addScaledVector(e.axis, -e.cv);
216
+ const u = pe.dot(e.axis) < 0 ? -1 : 1, h = e.run ?? T.runs.get(e.id), x = performance.now(), k = l.elapsedTime, V = h ? Math.min(1, (x - h.startedAt) / 1300) : 1, m = 1 - Math.pow(1 - V, 3), C = h != null && h.endedAt ? Math.max(0, 1 - (x - h.endedAt) / bt) : 1;
217
+ ke(e, ue);
218
+ const F = ue.u0, _ = F + (ue.u1 - F) * Math.max(1e-3, m);
219
+ let U = 0;
220
+ re.set(F, $, 0), oe.set(_, $, 0), ye(b, U, re, oe, 0.075), ye(P, U++, re, oe, 0.26);
221
+ for (const D of ve.agents.values()) {
222
+ if (D.run !== e || D.depth === 0 || U + 3 > b.instanceMatrix.count) continue;
223
+ rt(D, Z);
224
+ const z = (Z.base + Z.off) * u, E = Z.base * u, R = Ot;
225
+ R[0] = Z.u0, R[1] = Z.u0 + Z.div, R[2] = Z.u1 - Z.div, R[3] = Z.u1;
226
+ for (let W = 0; W < 3; W++)
227
+ re.set(R[W], $, W === 0 ? E : z), oe.set(Math.min(_, R[W + 1]), $, W === 2 ? E : z), ye(b, U, re, oe, 0.06), ye(P, U++, re, oe, 0.22);
228
+ }
229
+ b.count = P.count = U, b.instanceMatrix.needsUpdate = !0, P.instanceMatrix.needsUpdate = !0, (ee = g.current) == null || ee.position.set(ue.u0, $ + 0.12, 0), (ie = y.current) == null || ie.position.set(_, $ + 0.12, 0), (te = B.current) == null || te.position.set(ue.u0 - 0.2, 0.2, -2.7 * u), i.trunk.opacity = C, i.glow.opacity = 0.22 * C, i.spur.opacity = C * (h && h.hasSteps && h.steps.research === "queued" ? 0.25 : 1), i.platform.opacity = 0.6 * C;
230
+ const j = !!(h != null && h.hasSteps);
231
+ Ve.forEach((D, z) => {
232
+ const E = s.current[z];
233
+ if (E && (E.visible = j, E.position.set(Be(Ie[D]), $, 0), E.scale.setScalar(Math.max(1e-3, Math.min(1, (V - 0.3) * 1.6)))), !h || !j) return;
234
+ const R = h.steps[D], W = o.current[z], N = R === "running", ne = N ? H ? 0.5 : 0.5 + 0.5 * Math.sin(k * 5.5) : 0;
235
+ W && (S.set(Pe[R] ?? Pe.queued).multiplyScalar((R === "queued" ? 0.6 : N ? 1.8 + ne * 2.2 : 2.4) * C), W.material.color.copy(S), W.scale.setScalar(N ? 1.05 + ne * 0.22 : 1));
236
+ const G = p.current[z];
237
+ if (G) {
238
+ G.visible = N || R === "done";
239
+ const X = G.material;
240
+ X.color.set(Pe[R]).multiplyScalar(N ? 1.2 + ne : 0.5), X.opacity = (N ? 0.5 : 0.18) * C, G.scale.y = N ? 1 : 0.45;
241
+ }
242
+ });
243
+ const O = h != null && h.handoffAt ? (x - h.handoffAt) / 1200 : 2, L = h ? Be(Ie[h.handoffFrom]) : 0, q = h ? Be(Ie[h.handoffTo]) : 0, Ae = O >= 1 ? 1 : 1 - Math.pow(1 - Math.max(0, O), 3), Q = L + (q - L) * Ae;
244
+ if (M.current && (M.current.position.set(Q, 0.32, 0), M.current.scale.setScalar(O < 1 ? 1 : 1e-3)), f.current) {
245
+ const D = O < 1.6;
246
+ if (f.current.visible = D, D) {
247
+ const z = Math.max(0.01, Q - L);
248
+ f.current.position.set(L + z / 2, $ + 0.02, 0), f.current.scale.set(z, 1, 1), f.current.material.opacity = O < 1 ? 0.9 : Math.max(0, 1 - (O - 1) / 0.6) * 0.9;
249
+ }
250
+ }
251
+ }), /* @__PURE__ */ w("group", { ref: c, children: [
252
+ /* @__PURE__ */ w("group", { ref: a, children: [
253
+ /* @__PURE__ */ r("primitive", { object: b }),
254
+ /* @__PURE__ */ r("primitive", { object: P }),
255
+ /* @__PURE__ */ r("mesh", { ref: g, material: i.trunk, children: /* @__PURE__ */ r("boxGeometry", { args: [0.12, 0.25, 0.9] }) }),
256
+ /* @__PURE__ */ r("mesh", { ref: y, material: i.trunk, children: /* @__PURE__ */ r("boxGeometry", { args: [0.12, 0.25, 0.9] }) })
257
+ ] }),
258
+ Ve.map((l, d) => /* @__PURE__ */ w("group", { ref: (u) => void (s.current[d] = u), visible: !1, children: [
259
+ /* @__PURE__ */ w("mesh", { ref: (u) => void (o.current[d] = u), rotation: [-Math.PI / 2, 0, 0], position: [0, 0.03, 0], children: [
260
+ /* @__PURE__ */ r("ringGeometry", { args: [0.62, 0.86, 48] }),
261
+ /* @__PURE__ */ r("meshBasicMaterial", { color: "#64748b", toneMapped: !1, transparent: !0, side: n.DoubleSide })
262
+ ] }),
263
+ /* @__PURE__ */ w("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, 0.02, 0], children: [
264
+ /* @__PURE__ */ r("circleGeometry", { args: [0.6, 40] }),
265
+ /* @__PURE__ */ r("meshBasicMaterial", { color: "#060a18" })
266
+ ] }),
267
+ /* @__PURE__ */ r("mesh", { position: [0, 0.02, -1.15], rotation: [-Math.PI / 2, 0, 0], material: i.platform, children: /* @__PURE__ */ r("planeGeometry", { args: [2.2, 0.32] }) }),
268
+ /* @__PURE__ */ w("mesh", { ref: (u) => void (p.current[d] = u), position: [0, 1.6, 0], visible: !1, children: [
269
+ /* @__PURE__ */ r("cylinderGeometry", { args: [0.07, 0.3, 3.2, 12, 1, !0] }),
270
+ /* @__PURE__ */ r("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1, side: n.DoubleSide })
271
+ ] }),
272
+ /* @__PURE__ */ r(Se, { position: [0, 0, -1.75], text: l, color: t, textColor: "#cbd5e1", uppercase: !0, letterSpacing: 0.08, size: 0.26, opacity: 0.85, pxRange: [7.5, 11] })
273
+ ] }, l)),
274
+ /* @__PURE__ */ r("group", { ref: B, children: /* @__PURE__ */ r(Et, { runId: e.id, color: t }) }),
275
+ /* @__PURE__ */ w("mesh", { ref: f, visible: !1, children: [
276
+ /* @__PURE__ */ r("boxGeometry", { args: [1, 0.05, 0.28] }),
277
+ /* @__PURE__ */ r("meshBasicMaterial", { color: I("#fde68a", 3), toneMapped: !1, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1 })
278
+ ] }),
279
+ /* @__PURE__ */ w("mesh", { ref: M, scale: 1e-3, children: [
280
+ /* @__PURE__ */ r("sphereGeometry", { args: [0.22, 14, 14] }),
281
+ /* @__PURE__ */ r("meshBasicMaterial", { color: I("#fff7d6", 7), toneMapped: !1 })
282
+ ] })
283
+ ] });
284
+ }
285
+ const Ut = { running: "#fde68a", done: "#bbf7d0", failed: "#fecaca", queued: "#64748b" };
286
+ function Et({ runId: e, color: t }) {
287
+ const a = xt().runs.get(e);
288
+ if (!a) return null;
289
+ const s = [];
290
+ return Ve.forEach((o, p) => s.push({ text: `${p ? " " : ""}${o.toUpperCase()}`, color: Ut[a.steps[o]] ?? "#94a3b8" })), /* @__PURE__ */ r(
291
+ Se,
292
+ {
293
+ anchorX: "left",
294
+ anchorY: "bottom",
295
+ textAlign: "left",
296
+ plate: "box",
297
+ text: `${a.hasSteps ? "hatchet · " : ""}${a.topic}`,
298
+ secondary: a.hasSteps ? s : a.status === "started" ? "running…" : "run complete",
299
+ letterSpacing: 0.02,
300
+ color: t,
301
+ size: 0.34,
302
+ secondarySize: 0.24,
303
+ maxWidth: 11,
304
+ opacity: a.status === "started" ? 1 : 0.55,
305
+ fadeMs: 300,
306
+ pxRange: [9.5, 13.5]
307
+ }
308
+ );
309
+ }
310
+ const Y = {
311
+ body: new n.CapsuleGeometry(0.27, 0.95, 6, 16).rotateZ(Math.PI / 2),
312
+ window: new n.BoxGeometry(0.2, 0.1, 0.57),
313
+ roof: new n.BoxGeometry(1.1, 0.04, 0.12),
314
+ lamp: new n.SphereGeometry(0.075, 12, 12),
315
+ beam: new n.ConeGeometry(0.35, 1.6, 20, 1, !0).rotateZ(Math.PI / 2),
316
+ halo: new n.SphereGeometry(0.62, 20, 20),
317
+ shimmer: new n.CylinderGeometry(0.75, 0.75, 3.2, 28, 1, !0),
318
+ portal: new n.TorusGeometry(0.75, 0.07, 10, 48),
319
+ portalDisc: new n.CircleGeometry(0.72, 40),
320
+ sel: new n.RingGeometry(0.95, 1.08, 48)
321
+ }, kt = [-0.48, -0.16, 0.16, 0.48], K = new n.Vector3(), fe = new n.Vector3(), Ft = { u0: 0, u1: 0 };
322
+ function Lt({ agent: e, selected: t, onSelect: c }) {
323
+ const a = e.id, s = e.inst, o = Ee[s.type], p = e.depth > 0 || Rt(s.type), M = v(null), f = v(null), g = v(null), y = v(null), B = v(null), S = v(null), i = A(
324
+ () => ({
325
+ body: new n.MeshStandardMaterial({ color: new n.Color(o).multiplyScalar(0.18), emissive: new n.Color(o), emissiveIntensity: 0.6, metalness: 0.55, roughness: 0.3, transparent: !0, toneMapped: !1 }),
326
+ win: new n.MeshBasicMaterial({ color: I(o, 2.5), toneMapped: !1, transparent: !0 }),
327
+ lampF: new n.MeshBasicMaterial({ color: I("#ffffff", 6), toneMapped: !1, transparent: !0 }),
328
+ lampR: new n.MeshBasicMaterial({ color: I("#ff3355", 3), toneMapped: !1, transparent: !0 }),
329
+ beam: new n.MeshBasicMaterial({ color: I("#fff7e0", 0.9), toneMapped: !1, transparent: !0, opacity: 0.14, blending: n.AdditiveBlending, depthWrite: !1, side: n.DoubleSide }),
330
+ halo: new n.MeshBasicMaterial({ color: I(o, 1), toneMapped: !1, transparent: !0, opacity: 0.1, blending: n.AdditiveBlending, depthWrite: !1 }),
331
+ shimmer: new n.MeshBasicMaterial({ color: I(o, 2), toneMapped: !1, transparent: !0, opacity: 0, blending: n.AdditiveBlending, depthWrite: !1, side: n.DoubleSide }),
332
+ portal: new n.MeshBasicMaterial({ color: I(o, 3), toneMapped: !1, transparent: !0 }),
333
+ portalDisc: new n.MeshBasicMaterial({ color: new n.Color("#000000"), transparent: !0, opacity: 0.85, side: n.DoubleSide }),
334
+ sel: new n.MeshBasicMaterial({ color: I("#ffffff", 2.5), toneMapped: !1, transparent: !0, side: n.DoubleSide })
335
+ }),
336
+ [o]
337
+ ), b = A(() => new n.Color(o), [o]), P = A(() => new n.Color("#ffffff"), []), l = v({ r: -1 / 0, phase: Math.random() * 6, dir: 1, exitR: 0, exitPos: new n.Vector3(), spur: { u0: 0, u1: 0, div: 1, base: 0, off: 0 } });
338
+ mt(() => {
339
+ const u = { pos: new n.Vector3(), u: 0 };
340
+ return ge.set(a, u), () => void ge.delete(a);
341
+ }, [a]), J(({ clock: u }, h) => {
342
+ const x = e.inst, k = M.current;
343
+ if (!k) return;
344
+ const V = e.run, m = l.current, C = p ? rt(e, m.spur) : null, F = nt(e), _ = e.eu, U = Math.min(0.05, h), j = performance.now(), O = vt(x, j), L = St(x, j);
345
+ let q = !1;
346
+ for (const G of T.mcpPending.values()) G.instance === a && (q = !0);
347
+ if (m.r === -1 / 0) {
348
+ const G = x.parent ? ge.get(x.parent) : null;
349
+ m.r = G ? G.u : ke(V, Ft).u0;
350
+ }
351
+ const Ae = m.r;
352
+ let Q = _, ee = 2.2;
353
+ if (x.exitAt)
354
+ m.exitR || (m.exitR = m.r), Q = m.exitR + 3.4, ee = 1.6;
355
+ else if (x.status === "thinking") {
356
+ m.phase += U * (H ? 0.25 : 0.8 + L * 2.4) * (q ? 0.25 : 1);
357
+ const G = C ? Math.max(0.2, (C.u1 - C.u0) / 2 - C.div) : 1.6 * we.spread, X = Math.min(G, p ? 1.05 : x.type === "researcher" ? 1.5 : 1.6) * Math.max(0.8, we.spread);
358
+ Q = _ + X * Math.sin(m.phase), ee = 3;
359
+ }
360
+ m.r += (Q - m.r) * (1 - Math.exp(-U * ee));
361
+ const ie = m.r - Ae;
362
+ Math.abs(ie) > 15e-4 && (m.dir = ie > 0 ? 1 : -1), Ge(V, m.r, C, F, Ce, K), Ge(V, m.r + 0.05, C, F, Ce, fe), k.position.copy(K), k.rotation.y = Math.atan2(-(fe.z - K.z), fe.x - K.x), e.live.copy(K);
363
+ const te = ge.get(a);
364
+ te && (te.pos.copy(K), te.u = m.r);
365
+ const D = u.elapsedTime, z = x.status === "waiting" || q, E = H ? 0.5 : 0.5 + 0.5 * Math.sin(D * (q ? 2.2 : 1.4) + m.phase), R = x.exitAt ? Math.min(1, (j - x.exitAt) / At(x)) : 0;
366
+ if (f.current) {
367
+ const G = (p ? 1.1 : 1.35) * we.scale;
368
+ x.exitAt ? f.current.scale.set(G * (1 + R * 1.8), G * Math.max(0.05, 1 - R), G * Math.max(0.05, 1 - R)) : f.current.scale.setScalar(G * Math.max(1e-3, O) * (1 + L * 0.06) * (q ? 1 + E * 0.06 : 1)), f.current.scale.x *= m.dir;
369
+ }
370
+ const W = x.exitAt ? 3 * (1 - R) : z ? 0.25 + E * (q ? 0.9 : 0.35) : 1.1 + L * 2.6;
371
+ i.body.emissiveIntensity = W, i.body.opacity = Math.min(1, O * 1.2);
372
+ const N = x.exitAt ? 4 * (1 - R) : z ? 0.5 + E * (q ? 1.4 : 0.5) : 2.2 + L * 3;
373
+ i.win.color.copy(b).multiplyScalar(N), x.exitAt && R < 0.25 && i.win.color.lerp(P, 1 - R * 4).multiplyScalar(1.5), i.win.opacity = O, i.lampF.opacity = O * (z ? 0.4 : 1), i.lampR.opacity = O, i.beam.opacity = (z ? 0.04 : 0.13 + L * 0.08) * O, g.current && (g.current.scale.setScalar(0.9 + L * 0.6 + (z ? E * 0.25 : 0)), i.halo.opacity = O * (z ? 0.04 + E * 0.04 : 0.07 + L * 0.08));
374
+ const ne = (j - x.bornAt) / 1e3;
375
+ if (y.current) {
376
+ const G = ne < 1.2;
377
+ if (y.current.visible = G, G) {
378
+ const X = ne / 1.2;
379
+ y.current.scale.set(1 - X * 0.5, Math.min(1, X * 4), 1 - X * 0.5), y.current.rotation.y = D * 3, i.shimmer.opacity = 0.75 * (1 - X) * (0.75 + 0.25 * Math.sin(D * 40));
380
+ }
381
+ }
382
+ if (B.current) {
383
+ const G = !!x.exitAt;
384
+ if (B.current.visible = G, G) {
385
+ m.exitPos.lengthSq() || Ge(V, m.exitR + 2.7, C, F, Ce + 0.15, m.exitPos), B.current.position.copy(m.exitPos), B.current.rotation.set(0, Math.atan2(fe.x - K.x, fe.z - K.z), 0);
386
+ const X = Math.sin(Math.PI * Math.min(1, R * 1.15));
387
+ B.current.scale.setScalar(Math.max(1e-3, X) * (p ? 0.85 : 1)), i.portal.color.copy(b).multiplyScalar(2 + 3 * X);
388
+ }
389
+ }
390
+ S.current && (S.current.visible = t, S.current.rotation.z = D);
391
+ });
392
+ const d = (u) => {
393
+ u.stopPropagation(), c(a);
394
+ };
395
+ return /* @__PURE__ */ w(Ue, { children: [
396
+ /* @__PURE__ */ w("group", { ref: M, children: [
397
+ /* @__PURE__ */ w("group", { ref: f, children: [
398
+ /* @__PURE__ */ r("mesh", { geometry: Y.body, material: i.body, onClick: d, onPointerOver: () => document.body.style.cursor = "pointer", onPointerOut: () => document.body.style.cursor = "" }),
399
+ kt.map((u) => /* @__PURE__ */ r("mesh", { geometry: Y.window, material: i.win, position: [u, 0.06, 0] }, u)),
400
+ /* @__PURE__ */ r("mesh", { geometry: Y.roof, material: i.win, position: [0, 0.27, 0] }),
401
+ /* @__PURE__ */ r("mesh", { geometry: Y.lamp, material: i.lampF, position: [0.74, 0.02, 0] }),
402
+ /* @__PURE__ */ r("mesh", { geometry: Y.lamp, material: i.lampR, position: [-0.74, 0.02, 0], scale: 0.7 }),
403
+ /* @__PURE__ */ r("mesh", { geometry: Y.beam, material: i.beam, position: [1.55, -0.05, 0] })
404
+ ] }),
405
+ /* @__PURE__ */ r("mesh", { ref: g, geometry: Y.halo, material: i.halo }),
406
+ /* @__PURE__ */ r("mesh", { ref: y, geometry: Y.shimmer, material: i.shimmer, position: [0, 1.2, 0], visible: !1 }),
407
+ /* @__PURE__ */ r("mesh", { ref: S, geometry: Y.sel, material: i.sel, rotation: [-Math.PI / 2, 0, 0], position: [0, -0.22, 0], visible: !1 })
408
+ ] }),
409
+ /* @__PURE__ */ w("group", { ref: B, visible: !1, children: [
410
+ /* @__PURE__ */ r("mesh", { geometry: Y.portal, material: i.portal }),
411
+ /* @__PURE__ */ r("mesh", { geometry: Y.portalDisc, material: i.portalDisc })
412
+ ] })
413
+ ] });
414
+ }
415
+ const de = new n.Vector3();
416
+ function De(e, t, c, a, s) {
417
+ de.copy(e).add(t).multiplyScalar(0.5), de.y += a;
418
+ const o = 1 - c;
419
+ return s.set(o * o * e.x + 2 * o * c * de.x + c * c * t.x, o * o * e.y + 2 * o * c * de.y + c * c * t.y, o * o * e.z + 2 * o * c * de.z + c * c * t.z);
420
+ }
421
+ const se = 10, qe = 48, Ne = new n.Vector3(), _e = new n.Vector3(), me = new n.Object3D(), $e = new n.Color(), Ke = Object.fromEntries(Object.entries(Ee).map(([e, t]) => [e, new n.Color(t)])), He = /* @__PURE__ */ new Map();
422
+ function Wt() {
423
+ const e = v(null);
424
+ return J(() => {
425
+ const t = e.current;
426
+ if (!t) return;
427
+ const c = performance.now();
428
+ let a = 0;
429
+ const s = (o, p, M, f, g, y, B) => {
430
+ for (let S = 0; S < se && a < qe * se; S++) {
431
+ const i = M - S / se * B;
432
+ i < 0 || M >= 1 ? me.scale.setScalar(1e-4) : (De(o, p, i, f, Ne), me.position.copy(Ne), me.scale.setScalar(y * (1 - S / se * 0.75))), me.updateMatrix(), t.setMatrixAt(a, me.matrix), $e.copy(g).multiplyScalar(S === 0 ? 5 : 3 * (1 - S / se)), t.setColorAt(a, $e), a++;
433
+ }
434
+ };
435
+ for (const o of T.comets) {
436
+ const p = Me(o.from), M = Me(o.to);
437
+ if (!p || !M) continue;
438
+ const f = Math.min(1, (c - o.start) / o.dur), g = f < 0.5 ? 2 * f * f : 1 - Math.pow(-2 * f + 2, 2) / 2, y = T.instances.get(o.from);
439
+ s(p, M, g, 0.9, y ? Ke[y.type] : Ke.planner, 1, 0.22);
440
+ }
441
+ for (const o of T.mcpCalls) {
442
+ const p = T.mcpServers.get(o.server), M = tt(o.server), f = Me(o.instance);
443
+ if (!p || !M || !f) continue;
444
+ _e.copy(M).setY(0.9);
445
+ const g = Math.min(1, (c - o.start) / o.dur), y = 1 - Math.pow(1 - g, 2.2);
446
+ let B = He.get(p.name);
447
+ B || He.set(p.name, B = new n.Color(p.color)), o.phase === "call" ? s(f, _e, y, 3.2, B, 1.5, 0.3) : s(_e, f, y, 3.2, Xt, 1.5, 0.3);
448
+ }
449
+ t.count = a, t.instanceMatrix.needsUpdate = !0, t.instanceColor && (t.instanceColor.needsUpdate = !0);
450
+ }), /* @__PURE__ */ w("instancedMesh", { ref: e, args: [void 0, void 0, qe * se], frustumCulled: !1, children: [
451
+ /* @__PURE__ */ r("sphereGeometry", { args: [0.12, 10, 10] }),
452
+ /* @__PURE__ */ r("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1 })
453
+ ] });
454
+ }
455
+ const Xt = new n.Color("#ffffff"), Yt = (() => {
456
+ const e = [];
457
+ for (let c = 0; c < 10; c++) {
458
+ const a = -1.7 - c * 0.42;
459
+ e.push(a, 0.04, 0, a - 0.25, 0.04, 0);
460
+ }
461
+ const t = new n.BufferGeometry();
462
+ return t.setAttribute("position", new n.Float32BufferAttribute(e, 3)), t;
463
+ })();
464
+ function jt({ mcp: e }) {
465
+ const t = e.srv, c = t.name, a = t.color ?? Bt[c] ?? "#94a3b8", s = v(null), o = v(null), p = v(null), M = v(null), f = A(() => new n.LineBasicMaterial({ color: I(a, 0.9), transparent: !0, opacity: 0.45, toneMapped: !1 }), [a]);
466
+ return J(({ clock: g }, y) => {
467
+ s.current && (s.current.position.set(e.pos.x, 0.9, e.pos.z), s.current.rotation.y = Math.atan2(-e.out.z, e.out.x));
468
+ const B = performance.now(), S = Math.exp(-(B - t.activeAt) / 450), i = t.inflight > 0;
469
+ o.current && (o.current.rotation.y += y * (H ? 0.1 : i ? 2.4 : 0.25)), p.current && (p.current.material.color.set(a).multiplyScalar(1.5 + S * 5 + (i ? 1 + Math.sin(g.elapsedTime * 8) : 0)), p.current.scale.setScalar(1 + S * 0.8)), M.current && M.current.material.color.set(a).multiplyScalar(0.5 + S * 2 + (i ? 0.6 : 0)), f.opacity = 0.3 + S * 0.6 + (i ? 0.25 : 0);
470
+ }), /* @__PURE__ */ w("group", { ref: s, children: [
471
+ /* @__PURE__ */ r("lineSegments", { geometry: Yt, material: f, position: [0, -0.85, 0] }),
472
+ /* @__PURE__ */ w("mesh", { ref: M, rotation: [-Math.PI / 2, 0, 0], position: [0, -0.85, 0], children: [
473
+ /* @__PURE__ */ r("ringGeometry", { args: [1.25, 1.55, 6] }),
474
+ /* @__PURE__ */ r("meshBasicMaterial", { color: a, toneMapped: !1, side: n.DoubleSide })
475
+ ] }),
476
+ /* @__PURE__ */ w("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, -0.86, 0], children: [
477
+ /* @__PURE__ */ r("circleGeometry", { args: [1.25, 6] }),
478
+ /* @__PURE__ */ r("meshBasicMaterial", { color: "#070b18" })
479
+ ] }),
480
+ /* @__PURE__ */ w("mesh", { position: [0, -0.35, 0], children: [
481
+ /* @__PURE__ */ r("cylinderGeometry", { args: [0.18, 0.3, 1, 8] }),
482
+ /* @__PURE__ */ r("meshStandardMaterial", { color: "#111827", emissive: a, emissiveIntensity: 0.4, metalness: 0.6, roughness: 0.3 })
483
+ ] }),
484
+ /* @__PURE__ */ w("group", { ref: o, position: [0, 0.3, 0], children: [
485
+ /* @__PURE__ */ w("mesh", { rotation: [Math.PI / 2, 0, 0], children: [
486
+ /* @__PURE__ */ r("torusGeometry", { args: [0.85, 0.045, 8, 48] }),
487
+ /* @__PURE__ */ r("meshBasicMaterial", { color: I(a, 2), toneMapped: !1 })
488
+ ] }),
489
+ /* @__PURE__ */ w("mesh", { rotation: [Math.PI / 2.6, 0, 0], children: [
490
+ /* @__PURE__ */ r("torusGeometry", { args: [0.62, 0.03, 8, 40] }),
491
+ /* @__PURE__ */ r("meshBasicMaterial", { color: I(a, 1.6), toneMapped: !1 })
492
+ ] })
493
+ ] }),
494
+ /* @__PURE__ */ w("mesh", { ref: p, position: [0, 0.3, 0], children: [
495
+ /* @__PURE__ */ r("sphereGeometry", { args: [0.2, 16, 16] }),
496
+ /* @__PURE__ */ r("meshBasicMaterial", { color: a, toneMapped: !1 })
497
+ ] }),
498
+ /* @__PURE__ */ r(Se, { position: [0, 1.55, 0], text: c, color: a, size: 0.34, pxRange: [9, 13] })
499
+ ] });
500
+ }
501
+ const he = 36, Te = 24;
502
+ function Zt() {
503
+ const e = A(() => {
504
+ const f = new n.BufferGeometry();
505
+ return f.setAttribute("position", new n.BufferAttribute(new Float32Array(Te * he * 6), 3)), f.setAttribute("color", new n.BufferAttribute(new Float32Array(Te * he * 6), 3)), f;
506
+ }, []), t = A(() => new n.Vector3(), []), c = A(() => new n.Vector3(), []), a = A(() => new n.Vector3(), []), s = A(() => new n.Color(), []), o = A(() => new n.Color("#fbbf24"), []), p = A(() => new n.Color("#ef4444"), []), M = A(() => new n.Color(), []);
507
+ return J(({ clock: f }) => {
508
+ const g = e.getAttribute("position"), y = e.getAttribute("color"), B = performance.now(), S = f.elapsedTime;
509
+ let i = 0, b = 0;
510
+ const P = (l, d, u, h) => {
511
+ const x = T.mcpServers.get(d), k = Me(l), V = tt(d);
512
+ if (!(!x || !k || !V || b >= Te)) {
513
+ if (b++, t.copy(V).setY(0.9), s.set(x.color), u === "pending") {
514
+ const m = h;
515
+ m < 1 ? s.lerp(o, m) : s.copy(o).lerp(p, Math.min(1, (m - 1) / 1));
516
+ }
517
+ for (let m = 0; m < he; m++) {
518
+ const C = m / he, F = (m + 1) / he;
519
+ De(k, t, C, 3.2, c), De(k, t, F, 3.2, a);
520
+ let _;
521
+ if (u === "pending") {
522
+ const U = ((C * 7 - S * (H ? 0.4 : 1.8)) % 1 + 1) % 1;
523
+ _ = (0.35 + Math.min(1.6, h * 0.8)) * (0.25 + (U < 0.35 ? 1.6 : 0));
524
+ } else {
525
+ const U = 1 - h, j = Math.abs(C - U);
526
+ _ = Math.exp(-j * j * 120) * 7 + 0.6 * (1 - h), s.set("#ffffff");
527
+ }
528
+ M.copy(s).multiplyScalar(_), g.setXYZ(i, c.x, c.y, c.z), y.setXYZ(i++, M.r, M.g, M.b), g.setXYZ(i, a.x, a.y, a.z), y.setXYZ(i++, M.r, M.g, M.b);
529
+ }
530
+ }
531
+ };
532
+ for (const l of T.mcpPending.values()) P(l.instance, l.server, "pending", Ct(l, B));
533
+ for (const l of T.mcpResolved) P(l.instance, l.server, "resolved", Math.min(1, (B - l.resolvedAt) / 700));
534
+ e.setDrawRange(0, i), g.needsUpdate = !0, y.needsUpdate = !0;
535
+ }), /* @__PURE__ */ r("lineSegments", { geometry: e, frustumCulled: !1, children: /* @__PURE__ */ r("lineBasicMaterial", { vertexColors: !0, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) });
536
+ }
537
+ const qt = new n.Vector3(), Je = { u0: 0, u1: 0 };
538
+ function Nt(e) {
539
+ for (const t of ve.runs.values())
540
+ ke(t, Je), e(Qe(t, Je.u0 + 3, -3.4, qt), 1.5);
541
+ }
542
+ const $t = /* @__PURE__ */ w(Ue, { children: [
543
+ /* @__PURE__ */ r("fog", { attach: "fog", args: ["#02040a", 60, 140] }),
544
+ /* @__PURE__ */ r("ambientLight", { intensity: 0.35 }),
545
+ /* @__PURE__ */ r("pointLight", { position: [0, 8, 0], intensity: 60, distance: 40, color: "#818cf8" }),
546
+ /* @__PURE__ */ r("directionalLight", { position: [10, 20, 8], intensity: 0.6, color: "#c7d2fe" }),
547
+ /* @__PURE__ */ r(ct, { radius: 120, depth: 50, count: H ? 1200 : 3500, factor: 3, saturation: 0.3, fade: !0, speed: 0.4 }),
548
+ /* @__PURE__ */ r(
549
+ lt,
550
+ {
551
+ position: [0, -0.02, 0],
552
+ args: [120, 120],
553
+ cellSize: 1,
554
+ cellThickness: 0.5,
555
+ cellColor: "#0f1733",
556
+ sectionSize: 6,
557
+ sectionThickness: 0.9,
558
+ sectionColor: "#1e2a5a",
559
+ fadeDistance: 90,
560
+ fadeStrength: 1.6,
561
+ infiniteGrid: !0
562
+ }
563
+ )
564
+ ] });
565
+ function nn() {
566
+ return /* @__PURE__ */ w(
567
+ Gt,
568
+ {
569
+ title: "subway",
570
+ subtitle: "neon transit map · each hatchet run is a line, each agent a train, MCP servers are airports, the knowledge graph is Graph Central",
571
+ preset: "lanes",
572
+ plane: "xz",
573
+ camera: { position: [0, 29, 35], fov: 46 },
574
+ controls: { maxPolarAngle: Math.PI * 0.42, minPolarAngle: Math.PI * 0.12 },
575
+ bg: "#02040a",
576
+ gl: { preserveDrawingBuffer: !0 },
577
+ fit: { nRef: 4, min: 0.7, max: 1.3, minRadius: 7.5 },
578
+ agentRadius: 1,
579
+ graph: { natural: It, radius: 2.8 },
580
+ peripheryGap: 4.5,
581
+ Background: $t,
582
+ Agent: Lt,
583
+ RunMarker: Dt,
584
+ McpServer: jt,
585
+ GraphResource: _t,
586
+ cluster: { radius: 1.9, variant: "stars", pointSize: 1.1 },
587
+ clusterOffset: [0, 1.9, 0],
588
+ extents: Nt,
589
+ PostFX: /* @__PURE__ */ w(pt, { multisampling: 0, children: [
590
+ /* @__PURE__ */ r(ut, { mipmapBlur: !0, intensity: 1.25, luminanceThreshold: 0.22, luminanceSmoothing: 0.25, radius: 0.72 }),
591
+ /* @__PURE__ */ r(ft, { eskil: !1, offset: 0.22, darkness: 0.85 }),
592
+ /* @__PURE__ */ r(dt, { opacity: 0.025 })
593
+ ] }),
594
+ children: [
595
+ /* @__PURE__ */ r(Tt, {}),
596
+ /* @__PURE__ */ r(Vt, {}),
597
+ /* @__PURE__ */ r(Wt, {}),
598
+ /* @__PURE__ */ r(Zt, {})
599
+ ]
600
+ }
601
+ );
602
+ }
603
+ export {
604
+ nn as default
605
+ };