agentglow 0.2.10 → 0.2.11

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 (28) hide show
  1. package/dist/chunks/{KitScene-Bm1I35Zc.js → KitScene-DG_pcnWW.js} +1273 -1195
  2. package/dist/chunks/{index-COLbf8XM.js → index-Agh7jdYu.js} +182 -182
  3. package/dist/chunks/{index-CGTp73GN.js → index-B2EHxcBQ.js} +400 -400
  4. package/dist/chunks/{index-D-r9aJ4u.js → index-B4Cqo621.js} +33 -33
  5. package/dist/chunks/index-BfQsJ0TH.js +751 -0
  6. package/dist/chunks/index-BmBGYhJS.js +891 -0
  7. package/dist/chunks/index-Bnn-x-aE.js +767 -0
  8. package/dist/chunks/{index-BWsSd_Wm.js → index-CTQTtm9q.js} +212 -212
  9. package/dist/chunks/{index-_IwfbZy7.js → index-CTZbUTDY.js} +62 -62
  10. package/dist/chunks/{index-cRPj-lzn.js → index-CdKvybsL.js} +284 -284
  11. package/dist/chunks/index-CeiIEWek.js +818 -0
  12. package/dist/chunks/{index-D4Wlmsay.js → index-Ci8tSMhc.js} +15 -15
  13. package/dist/chunks/{index-C2vLpNCb.js → index-Cls_VZdb.js} +100 -100
  14. package/dist/chunks/index-DFFRhihO.js +892 -0
  15. package/dist/chunks/index-DMCETM4H.js +605 -0
  16. package/dist/chunks/{index-AugvjZJN.js → index-URn4zDHp.js} +223 -223
  17. package/dist/chunks/index-u4rYZ1UO.js +495 -0
  18. package/dist/index.js +1 -1
  19. package/dist/style.css +1 -1
  20. package/dist/types/world.d.ts +30 -5
  21. package/package.json +1 -1
  22. package/dist/chunks/index-BAQDf-0T.js +0 -492
  23. package/dist/chunks/index-BRnLrSfZ.js +0 -605
  24. package/dist/chunks/index-CKyn9lcT.js +0 -753
  25. package/dist/chunks/index-CnoB0ZDk.js +0 -889
  26. package/dist/chunks/index-KmczAvvY.js +0 -818
  27. package/dist/chunks/index-Z4vdWCok.js +0 -763
  28. package/dist/chunks/index-uZGu9jzU.js +0 -887
@@ -0,0 +1,605 @@
1
+ import { jsxs as b, jsx as r, Fragment as De } from "react/jsx-runtime";
2
+ import { Sparkles as pt, Stars as ut, Grid as ft } from "@react-three/drei";
3
+ import { EffectComposer as dt, Bloom as mt, Vignette as ht, Noise as Mt } from "@react-three/postprocessing";
4
+ import * as n from "three";
5
+ import { useFrame as H } from "@react-three/fiber";
6
+ import { useRef as x, useMemo as v, useEffect as gt } from "react";
7
+ import { n as ve, f as be, i as yt, v as nt, K as wt, w as O, r as K, G as bt, x as rt, T as Ue, q as xt, L as Ee, y as St, a as ge, R as vt, j as Fe, S as We, z as Be, A as At, u as Bt, k as Ct, p as Gt, e as Rt, l as Pt, M as It, c as ot, d as zt, m as _t } from "./KitScene-DG_pcnWW.js";
8
+ const N = 0.05, Ce = 0.3, Tt = yt;
9
+ function R(e, t) {
10
+ return new n.Color(e).multiplyScalar(t);
11
+ }
12
+ const ye = /* @__PURE__ */ new Map(), st = (e) => e.depth === 0 ? e.sib ? e.ev : 0 : e.ev;
13
+ function at(e, t) {
14
+ const i = e.inst.parent ? ve.agents.get(e.inst.parent) : void 0, a = i ? st(i) : 0, o = i ? i.eu : e.eu - 2.8 * be.spread, s = e.ev - a;
15
+ return t.base = a, t.off = s, t.div = 0.7 + 0.14 * Math.abs(s), t.u0 = o + 0.5, t.u1 = Math.max(t.u0 + 2 * t.div + 0.8, 2 * e.eu - t.u0), t;
16
+ }
17
+ const Xe = (e) => {
18
+ const t = Math.min(1, Math.max(0, e));
19
+ return t * t * (3 - 2 * t);
20
+ };
21
+ function Ot(e, t) {
22
+ return e <= t.u0 || e >= t.u1 ? 0 : e < t.u0 + t.div ? Xe((e - t.u0) / t.div) : e <= t.u1 - t.div ? 1 : Xe((t.u1 - e) / t.div);
23
+ }
24
+ function Ge(e, t, i, a, o, s) {
25
+ const c = i ? i.base + i.off * Ot(t, i) : a;
26
+ return nt(e, t, c, s), s.y = o, s;
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 it = { pos: [] }, se = 0.5, Ye = 2.55, xe = 3.75, Vt = xe + 0.3, Re = new n.Vector3();
32
+ function ct(e, t) {
33
+ const i = it.pos[e];
34
+ return i ? Re.set(i.x, i.y + se, i.z) : Re.set(0, se, 0), St(Re, t);
35
+ }
36
+ function Dt(e) {
37
+ const t = [];
38
+ for (let i = 0; i < e; i++) {
39
+ const a = i / e * Math.PI * 2 + (Math.random() - 0.5) * 0.1, o = Math.random() * Math.PI * 2, s = 0.25 + 0.6 * Math.sqrt(Math.random());
40
+ t.push(new n.Vector3((Ye + s * Math.cos(o)) * Math.cos(a), s * Math.sin(o) * 0.7, (Ye + s * Math.cos(o)) * Math.sin(a)));
41
+ }
42
+ return t;
43
+ }
44
+ const lt = 200, Le = (e, t) => xt(e, t) % Math.min(lt, e.nodes.length);
45
+ function Ut({ galaxy: e }) {
46
+ const t = Math.min(lt, e.nodes.length), i = x(null), a = x(null), o = v(() => Dt(t), [t]);
47
+ it.pos = o;
48
+ const s = v(() => e.nodes.slice(0, t).map((l) => new n.Color(wt[l.kind] ?? "#94a3b8")), [e]), c = v(() => new Float32Array(Math.max(1, t)), [t]), M = v(() => new Uint8Array(Math.max(1, t)), [t]), m = v(() => new n.Object3D(), []), y = v(() => new n.Color(), []), w = v(() => new n.Color(5, 5, 5.5), []), A = x(/* @__PURE__ */ new Map()), S = v(() => {
49
+ const l = [];
50
+ for (let p = 0; p < t; p++) {
51
+ const u = [];
52
+ for (let d = 0; d < t; d++) {
53
+ if (p === d) continue;
54
+ const B = o[p].distanceToSquared(o[d]);
55
+ u.push([B, d]);
56
+ }
57
+ u.sort((d, B) => d[0] - B[0]);
58
+ for (const [, d] of u.slice(0, 2)) (d > p || p % 3 === 0) && l.push(o[p].x, o[p].y, o[p].z, o[d].x, o[d].y, o[d].z);
59
+ }
60
+ const g = new Map(e.nodes.slice(0, t).map((p, u) => [p.id, u]));
61
+ for (const p of e.links) {
62
+ const u = g.get(p.source), d = g.get(p.target);
63
+ u === void 0 || d === void 0 || o[u].distanceTo(o[d]) > 3 || l.push(o[u].x, o[u].y, o[u].z, o[d].x, o[d].y, o[d].z);
64
+ }
65
+ const C = new n.BufferGeometry();
66
+ return C.setAttribute("position", new n.Float32BufferAttribute(l, 3)), C;
67
+ }, [e, o]);
68
+ return H(() => {
69
+ const l = i.current;
70
+ if (!l) return;
71
+ const g = performance.now();
72
+ c.fill(0), M.fill(0);
73
+ let C = 0;
74
+ for (const p of O.flares) {
75
+ let u = A.current.get(p.node);
76
+ u === void 0 && (u = Le(e, p.node), A.current.set(p.node, u));
77
+ const d = (g - p.start) / 1e3, B = Math.exp(-d * 1.3) * Math.min(1, d * 8);
78
+ B > c[u] && (c[u] = B), p.op === "write" && (M[u] = 1), C = Math.max(C, B);
79
+ }
80
+ for (let p = 0; p < t; p++) {
81
+ const u = c[p];
82
+ m.position.copy(o[p]), m.scale.setScalar(1 + u * (M[p] ? 4.5 : 3)), m.updateMatrix(), l.setMatrixAt(p, m.matrix), y.copy(s[p]).multiplyScalar(0.75 + u * 4), M[p] && u > 0.01 && y.lerp(w, u * 0.8), l.setColorAt(p, y);
83
+ }
84
+ l.instanceMatrix.needsUpdate = !0, l.instanceColor && (l.instanceColor.needsUpdate = !0), a.current && a.current.material.color.set("#c7d2fe").multiplyScalar(1.4 + C * 2.2 + (K ? 0 : Math.sin(g / 700) * 0.2));
85
+ }), /* @__PURE__ */ b("group", { position: [0, se, 0], children: [
86
+ /* @__PURE__ */ b("group", { children: [
87
+ /* @__PURE__ */ b("instancedMesh", { ref: i, 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__ */ b("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, -se + 0.04, 0], children: [
94
+ /* @__PURE__ */ r("ringGeometry", { args: [xe - 0.18, xe + 0.18, 128] }),
95
+ /* @__PURE__ */ r("meshBasicMaterial", { color: R("#a5b4fc", 1.3), transparent: !0, opacity: 0.55, toneMapped: !1, side: n.DoubleSide })
96
+ ] }),
97
+ /* @__PURE__ */ b("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, -se + 0.03, 0], children: [
98
+ /* @__PURE__ */ r("circleGeometry", { args: [xe - 0.2, 96] }),
99
+ /* @__PURE__ */ r("meshBasicMaterial", { color: "#0b1030", transparent: !0, opacity: 0.75 })
100
+ ] }),
101
+ /* @__PURE__ */ b("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, -se + 0.05, 0], children: [
102
+ /* @__PURE__ */ r("ringGeometry", { args: [1.35, 1.45, 96] }),
103
+ /* @__PURE__ */ r("meshBasicMaterial", { color: R("#818cf8", 1.6), transparent: !0, opacity: 0.6, toneMapped: !1 })
104
+ ] }),
105
+ /* @__PURE__ */ b("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__ */ b("mesh", { position: [0, 0.1, 0], children: [
110
+ /* @__PURE__ */ r("sphereGeometry", { args: [0.22, 20, 20] }),
111
+ /* @__PURE__ */ r("meshBasicMaterial", { color: R("#e0e7ff", 3), toneMapped: !1 })
112
+ ] }),
113
+ /* @__PURE__ */ r(pt, { count: K ? 20 : 60, scale: [7, 1.4, 7], size: 1.8, speed: 0.25, color: "#a5b4fc", opacity: 0.55 }),
114
+ /* @__PURE__ */ r(bt, { position: [0, 2.4, 0], suffix: " · Graph Central", color: "#a5b4fc", size: 0.36, pxRange: [9.5, 14] })
115
+ ] });
116
+ }
117
+ const le = 48;
118
+ function Et() {
119
+ const e = rt(), t = x(null), i = x(null), a = v(() => {
120
+ const y = new n.BufferGeometry();
121
+ return y.setAttribute("position", new n.BufferAttribute(new Float32Array(le * 6), 3)), y.setAttribute("color", new n.BufferAttribute(new Float32Array(le * 6), 3)), y;
122
+ }, []), o = v(() => new n.Object3D(), []), s = v(() => new n.Vector3(), []), c = v(() => new n.Color(), []), M = v(() => Object.fromEntries(Object.entries(Ue).map(([y, w]) => [y, new n.Color(w)])), []), m = x(/* @__PURE__ */ new Map());
123
+ return H(() => {
124
+ const y = t.current, w = i.current;
125
+ if (!y || !w) return;
126
+ if (!e.nodes.length || !ve.graphWanted) {
127
+ y.count = w.count = 0, a.setDrawRange(0, 0);
128
+ return;
129
+ }
130
+ const A = performance.now(), S = a.getAttribute("position"), l = a.getAttribute("color");
131
+ let g = 0;
132
+ const C = O.flares;
133
+ for (let p = C.length - 1; p >= 0 && g < le; p--) {
134
+ const u = C[p], d = (A - u.start) / 2600;
135
+ if (d >= 1) continue;
136
+ let B = m.current.get(u.node);
137
+ B === void 0 && (B = Le(e, u.node), m.current.set(u.node, B)), ct(B, s);
138
+ const f = u.op === "write", U = O.instances.get(u.instance), F = U ? M[U.type] : M.researcher;
139
+ o.position.copy(s), o.rotation.set(-Math.PI / 2, 0, 0), o.scale.setScalar((f ? 0.35 : 0.2) + d * (f ? 1.6 : 0.8)), o.updateMatrix(), y.setMatrixAt(g, o.matrix), f ? c.setRGB(4, 4, 4.4).multiplyScalar(1 - d) : c.copy(F).multiplyScalar(2.4 * (1 - d)), y.setColorAt(g, c);
140
+ const h = ge(u.instance), I = Math.min(1, (A - u.start) / 700);
141
+ if (h && d < 0.75) {
142
+ const V = 1 - d / 0.75;
143
+ S.setXYZ(g * 2, h.x, h.y, h.z), S.setXYZ(g * 2 + 1, s.x, s.y, s.z), f ? c.setRGB(2.6, 2.6, 3).multiplyScalar(V) : c.copy(F).multiplyScalar(1.2 * V), l.setXYZ(g * 2, c.r, c.g, c.b), l.setXYZ(g * 2 + 1, c.r * 0.7, c.g * 0.7, c.b * 0.7);
144
+ const D = f ? I : 1 - I;
145
+ o.position.set(h.x + (s.x - h.x) * D, h.y + (s.y - h.y) * D + Math.sin(D * Math.PI) * 0.6, h.z + (s.z - h.z) * D), o.rotation.set(0, 0, 0), o.scale.setScalar(I >= 1 ? 1e-4 : f ? 1.4 : 1), o.updateMatrix(), w.setMatrixAt(g, o.matrix), f ? c.setRGB(6, 6, 6.5) : c.copy(F).multiplyScalar(4), w.setColorAt(g, c);
146
+ } else
147
+ S.setXYZ(g * 2, 0, 0, 0), S.setXYZ(g * 2 + 1, 0, 0, 0), o.scale.setScalar(1e-4), o.updateMatrix(), w.setMatrixAt(g, o.matrix);
148
+ g++;
149
+ }
150
+ y.count = g, w.count = g, y.instanceMatrix.needsUpdate = !0, w.instanceMatrix.needsUpdate = !0, y.instanceColor && (y.instanceColor.needsUpdate = !0), w.instanceColor && (w.instanceColor.needsUpdate = !0), a.setDrawRange(0, g * 2), S.needsUpdate = !0, l.needsUpdate = !0;
151
+ }), /* @__PURE__ */ b("group", { children: [
152
+ /* @__PURE__ */ b("instancedMesh", { ref: t, args: [void 0, void 0, le], 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__ */ b("instancedMesh", { ref: i, args: [void 0, void 0, le], 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 je({ galaxy: e, op: t }) {
164
+ const i = x(null), a = x(null), o = x(0);
165
+ return H(() => {
166
+ const s = performance.now();
167
+ let c = null;
168
+ for (let m = O.flares.length - 1; m >= 0; m--) if (O.flares[m].op === t) {
169
+ c = O.flares[m];
170
+ break;
171
+ }
172
+ const M = c ? s - c.start : 1e9;
173
+ if (!(!i.current || !a.current)) {
174
+ if (!c || M > 1700) {
175
+ a.current.setOpacity(0);
176
+ return;
177
+ }
178
+ c.id !== o.current && (o.current = c.id, a.current.setText((t === "write" ? "wrote · " : "") + c.node), ct(Le(e, c.node), i.current.position)), a.current.setOpacity(Math.min(1, (1700 - M) / 400));
179
+ }
180
+ }), /* @__PURE__ */ r("group", { ref: i, children: /* @__PURE__ */ r(Ee, { 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 kt() {
183
+ const e = rt();
184
+ return e.nodes.length ? /* @__PURE__ */ b(De, { children: [
185
+ /* @__PURE__ */ r(je, { galaxy: e, op: "read" }),
186
+ /* @__PURE__ */ r(je, { galaxy: e, op: "write" })
187
+ ] }) : null;
188
+ }
189
+ const Pe = { queued: "#64748b", running: "#fbbf24", done: "#22c55e", failed: "#ef4444" }, Ie = ["planner", "researcher", "writer"], qe = 10, Ze = new n.CylinderGeometry(1, 1, 1, 8, 1, !0), Oe = new n.Vector3(0, 1, 0), ne = new n.Vector3(), re = new n.Vector3(), Se = new n.Vector3(), pe = new n.Object3D(), Ne = new n.Matrix4(), ze = new n.Vector3(), ue = new n.Vector3(), q = { u0: 0, u1: 0, div: 1, base: 0, off: 0 }, fe = { u0: 0, u1: 0 }, Lt = new Float64Array(4);
190
+ function we(e, t, i, a, o) {
191
+ Se.subVectors(a, i);
192
+ const s = Se.length();
193
+ pe.position.copy(i).add(a).multiplyScalar(0.5), s > 1e-5 && pe.quaternion.setFromUnitVectors(Oe, Se.divideScalar(s)), pe.scale.set(o, Math.max(1e-4, s), o), pe.updateMatrix(), e.setMatrixAt(t, pe.matrix);
194
+ }
195
+ function Ft({ run: e }) {
196
+ const t = e.color, i = x(null), a = x(null), o = x([]), s = x([]), c = x([]), M = x(null), m = x(null), y = x(null), w = x(null), A = x(null), S = v(() => new n.Color(), []), l = e.run ?? O.runs.get(e.id), g = v(
197
+ () => ({
198
+ trunk: new n.MeshBasicMaterial({ color: R(t, 1.5), toneMapped: !1, transparent: !0 }),
199
+ glow: new n.MeshBasicMaterial({ color: R(t, 0.5), toneMapped: !1, transparent: !0, opacity: 0.22, blending: n.AdditiveBlending, depthWrite: !1 }),
200
+ spur: new n.MeshBasicMaterial({ color: R(t, 1.9), toneMapped: !1, transparent: !0 }),
201
+ platform: new n.MeshBasicMaterial({ color: R(t, 0.35), toneMapped: !1, transparent: !0, opacity: 0.6 })
202
+ }),
203
+ [t]
204
+ ), C = v(() => {
205
+ const u = new n.InstancedMesh(Ze, g.spur, 1 + qe * 3);
206
+ return u.frustumCulled = !1, u.count = 0, u;
207
+ }, [g]), p = v(() => {
208
+ const u = new n.InstancedMesh(Ze, g.glow, 1 + qe * 3);
209
+ return u.frustumCulled = !1, u.count = 0, u;
210
+ }, [g]);
211
+ return H(({ clock: u }) => {
212
+ var ie, te, J;
213
+ const d = i.current;
214
+ if (!d) return;
215
+ ze.copy(e.side), ue.copy(e.axis), Se.crossVectors(ze, Oe).dot(ue) < 0 && ue.negate(), Ne.makeBasis(ze, Oe, ue), d.quaternion.setFromRotationMatrix(Ne), d.position.copy(e.origin).addScaledVector(e.side, -e.cu).addScaledVector(e.axis, -e.cv);
216
+ const B = ue.dot(e.axis) < 0 ? -1 : 1, f = e.run ?? O.runs.get(e.id), U = performance.now(), F = u.elapsedTime, h = f ? Math.min(1, (U - f.startedAt) / 1300) : 1, I = 1 - Math.pow(1 - h, 3), V = f != null && f.endedAt ? Math.max(0, 1 - (U - f.endedAt) / vt) : 1;
217
+ ke(e, fe);
218
+ const D = fe.u0, Y = D + (fe.u1 - D) * Math.max(1e-3, I);
219
+ let E = 0;
220
+ ne.set(D, N, 0), re.set(Y, N, 0), we(C, E, ne, re, 0.075), we(p, E++, ne, re, 0.26);
221
+ for (const P of ve.agents.values()) {
222
+ if (P.run !== e || P.depth === 0 || E + 3 > C.instanceMatrix.count) continue;
223
+ at(P, q);
224
+ const _ = (q.base + q.off) * B, z = q.base * B, L = Lt;
225
+ L[0] = q.u0, L[1] = q.u0 + q.div, L[2] = q.u1 - q.div, L[3] = q.u1;
226
+ for (let T = 0; T < 3; T++)
227
+ ne.set(L[T], N, T === 0 ? z : _), re.set(Math.min(Y, L[T + 1]), N, T === 2 ? z : _), we(C, E, ne, re, 0.06), we(p, E++, ne, re, 0.22);
228
+ }
229
+ C.count = p.count = E, C.instanceMatrix.needsUpdate = !0, p.instanceMatrix.needsUpdate = !0, (ie = y.current) == null || ie.position.set(fe.u0, N + 0.12, 0), (te = w.current) == null || te.position.set(Y, N + 0.12, 0), (J = A.current) == null || J.position.set(fe.u0 - 0.2, 0.2, -2.7 * B), g.trunk.opacity = V, g.glow.opacity = 0.22 * V, g.spur.opacity = V * (f && f.hasSteps && Fe(f, 1) === "queued" ? 0.25 : 1), g.platform.opacity = 0.6 * V;
230
+ const j = !!(f != null && f.hasSteps);
231
+ We.forEach((P) => {
232
+ const _ = o.current[P];
233
+ if (_ && (_.visible = j, _.position.set(Be(Ie[P]), N, 0), _.scale.setScalar(Math.max(1e-3, Math.min(1, (h - 0.3) * 1.6)))), !f || !j) return;
234
+ const z = Fe(f, P), L = s.current[P], T = z === "running", ce = T ? K ? 0.5 : 0.5 + 0.5 * Math.sin(F * 5.5) : 0;
235
+ L && (S.set(Pe[z] ?? Pe.queued).multiplyScalar((z === "queued" ? 0.6 : T ? 1.8 + ce * 2.2 : 2.4) * V), L.material.color.copy(S), L.scale.setScalar(T ? 1.05 + ce * 0.22 : 1));
236
+ const Q = c.current[P];
237
+ if (Q) {
238
+ Q.visible = T || z === "done";
239
+ const G = Q.material;
240
+ G.color.set(Pe[z]).multiplyScalar(T ? 1.2 + ce : 0.5), G.opacity = (T ? 0.5 : 0.18) * V, Q.scale.y = T ? 1 : 0.45;
241
+ }
242
+ });
243
+ const k = f != null && f.handoffAt ? (U - f.handoffAt) / 1200 : 2, W = f ? Be(Ie[f.handoffFrom]) : 0, Ae = f ? Be(Ie[f.handoffTo]) : 0, ae = k >= 1 ? 1 : 1 - Math.pow(1 - Math.max(0, k), 3), ee = W + (Ae - W) * ae;
244
+ if (M.current && (M.current.position.set(ee, 0.32, 0), M.current.scale.setScalar(k < 1 ? 1 : 1e-3)), m.current) {
245
+ const P = k < 1.6;
246
+ if (m.current.visible = P, P) {
247
+ const _ = Math.max(0.01, ee - W);
248
+ m.current.position.set(W + _ / 2, N + 0.02, 0), m.current.scale.set(_, 1, 1), m.current.material.opacity = k < 1 ? 0.9 : Math.max(0, 1 - (k - 1) / 0.6) * 0.9;
249
+ }
250
+ }
251
+ }), /* @__PURE__ */ b("group", { ref: i, children: [
252
+ /* @__PURE__ */ b("group", { ref: a, children: [
253
+ /* @__PURE__ */ r("primitive", { object: C }),
254
+ /* @__PURE__ */ r("primitive", { object: p }),
255
+ /* @__PURE__ */ r("mesh", { ref: y, material: g.trunk, children: /* @__PURE__ */ r("boxGeometry", { args: [0.12, 0.25, 0.9] }) }),
256
+ /* @__PURE__ */ r("mesh", { ref: w, material: g.trunk, children: /* @__PURE__ */ r("boxGeometry", { args: [0.12, 0.25, 0.9] }) })
257
+ ] }),
258
+ We.map((u) => /* @__PURE__ */ b("group", { ref: (d) => void (o.current[u] = d), visible: !1, children: [
259
+ /* @__PURE__ */ b("mesh", { ref: (d) => void (s.current[u] = d), 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__ */ b("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: g.platform, children: /* @__PURE__ */ r("planeGeometry", { args: [2.2, 0.32] }) }),
268
+ /* @__PURE__ */ b("mesh", { ref: (d) => void (c.current[u] = d), 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
+ l && /* @__PURE__ */ r(At, { run: l, slot: u, position: [0, 0, -1.75], color: t, textColor: "#cbd5e1", uppercase: !0, letterSpacing: 0.08, size: 0.26, opacity: 0.85, pxRange: [7.5, 11] })
273
+ ] }, u)),
274
+ /* @__PURE__ */ r("group", { ref: A, children: /* @__PURE__ */ r(Wt, { runId: e.id, color: t }) }),
275
+ /* @__PURE__ */ b("mesh", { ref: m, visible: !1, children: [
276
+ /* @__PURE__ */ r("boxGeometry", { args: [1, 0.05, 0.28] }),
277
+ /* @__PURE__ */ r("meshBasicMaterial", { color: R("#fde68a", 3), toneMapped: !1, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1 })
278
+ ] }),
279
+ /* @__PURE__ */ b("mesh", { ref: M, scale: 1e-3, children: [
280
+ /* @__PURE__ */ r("sphereGeometry", { args: [0.22, 14, 14] }),
281
+ /* @__PURE__ */ r("meshBasicMaterial", { color: R("#fff7d6", 7), toneMapped: !1 })
282
+ ] })
283
+ ] });
284
+ }
285
+ const $e = { running: "#fde68a", done: "#bbf7d0", failed: "#fecaca", queued: "#64748b" };
286
+ function Wt({ runId: e, color: t }) {
287
+ const a = Bt().runs.get(e);
288
+ if (!a) return null;
289
+ const o = [], { shown: s, more: c } = Ct(a);
290
+ return s.forEach((M, m) => o.push({ text: `${m ? " " : ""}${M.toUpperCase()}`, color: $e[a.steps[M]] ?? "#94a3b8" })), c && o.push({ text: ` +${c}`, color: $e.queued }), /* @__PURE__ */ r(
291
+ Ee,
292
+ {
293
+ anchorX: "left",
294
+ anchorY: "bottom",
295
+ textAlign: "left",
296
+ plate: "box",
297
+ text: `${a.hasSteps ? "hatchet · " : ""}${a.topic}`,
298
+ secondary: a.hasSteps ? o : 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 X = {
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
+ }, Xt = [-0.48, -0.16, 0.16, 0.48], $ = new n.Vector3(), de = new n.Vector3(), Yt = { u0: 0, u1: 0 };
322
+ function jt({ agent: e, selected: t, onSelect: i }) {
323
+ const a = e.id, o = e.inst, s = Ue[o.type], c = e.depth > 0 || Tt(o.type), M = x(null), m = x(null), y = x(null), w = x(null), A = x(null), S = x(null), l = v(
324
+ () => ({
325
+ body: new n.MeshStandardMaterial({ color: new n.Color(s).multiplyScalar(0.18), emissive: new n.Color(s), emissiveIntensity: 0.6, metalness: 0.55, roughness: 0.3, transparent: !0, toneMapped: !1 }),
326
+ win: new n.MeshBasicMaterial({ color: R(s, 2.5), toneMapped: !1, transparent: !0 }),
327
+ lampF: new n.MeshBasicMaterial({ color: R("#ffffff", 6), toneMapped: !1, transparent: !0 }),
328
+ lampR: new n.MeshBasicMaterial({ color: R("#ff3355", 3), toneMapped: !1, transparent: !0 }),
329
+ beam: new n.MeshBasicMaterial({ color: R("#fff7e0", 0.9), toneMapped: !1, transparent: !0, opacity: 0.14, blending: n.AdditiveBlending, depthWrite: !1, side: n.DoubleSide }),
330
+ halo: new n.MeshBasicMaterial({ color: R(s, 1), toneMapped: !1, transparent: !0, opacity: 0.1, blending: n.AdditiveBlending, depthWrite: !1 }),
331
+ shimmer: new n.MeshBasicMaterial({ color: R(s, 2), toneMapped: !1, transparent: !0, opacity: 0, blending: n.AdditiveBlending, depthWrite: !1, side: n.DoubleSide }),
332
+ portal: new n.MeshBasicMaterial({ color: R(s, 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: R("#ffffff", 2.5), toneMapped: !1, transparent: !0, side: n.DoubleSide })
335
+ }),
336
+ [s]
337
+ ), g = v(() => new n.Color(s), [s]), C = v(() => new n.Color("#ffffff"), []), p = x({ 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
+ gt(() => {
339
+ const d = { pos: new n.Vector3(), u: 0 };
340
+ return ye.set(a, d), () => void ye.delete(a);
341
+ }, [a]), H(({ clock: d }, B) => {
342
+ const f = e.inst, U = M.current;
343
+ if (!U) return;
344
+ const F = e.run, h = p.current, I = c ? at(e, h.spur) : null, V = st(e), D = e.eu, Y = Math.min(0.05, B), E = performance.now(), j = Gt(f, E), k = Rt(f, E);
345
+ let W = !1;
346
+ for (const G of O.mcpPending.values()) G.instance === a && (W = !0);
347
+ if (h.r === -1 / 0) {
348
+ const G = f.parent ? ye.get(f.parent) : null;
349
+ h.r = G ? G.u : ke(F, Yt).u0;
350
+ }
351
+ const Ae = h.r;
352
+ let ae = D, ee = 2.2;
353
+ if (f.exitAt)
354
+ h.exitR || (h.exitR = h.r), ae = h.exitR + 3.4, ee = 1.6;
355
+ else if (f.status === "thinking") {
356
+ h.phase += Y * (K ? 0.25 : 0.8 + k * 2.4) * (W ? 0.25 : 1);
357
+ const G = I ? Math.max(0.2, (I.u1 - I.u0) / 2 - I.div) : 1.6 * be.spread, Z = Math.min(G, c ? 1.05 : f.type === "researcher" ? 1.5 : 1.6) * Math.max(0.8, be.spread);
358
+ ae = D + Z * Math.sin(h.phase), ee = 3;
359
+ }
360
+ h.r += (ae - h.r) * (1 - Math.exp(-Y * ee));
361
+ const ie = h.r - Ae;
362
+ Math.abs(ie) > 15e-4 && (h.dir = ie > 0 ? 1 : -1), Ge(F, h.r, I, V, Ce, $), Ge(F, h.r + 0.05, I, V, Ce, de), U.position.copy($), U.rotation.y = Math.atan2(-(de.z - $.z), de.x - $.x), e.live.copy($);
363
+ const te = ye.get(a);
364
+ te && (te.pos.copy($), te.u = h.r);
365
+ const J = d.elapsedTime, P = f.status === "waiting" || W, _ = K ? 0.5 : 0.5 + 0.5 * Math.sin(J * (W ? 2.2 : 1.4) + h.phase), z = f.exitAt ? Math.min(1, (E - f.exitAt) / Pt(f)) : 0;
366
+ if (m.current) {
367
+ const G = (c ? 1.1 : 1.35) * be.scale;
368
+ f.exitAt ? m.current.scale.set(G * (1 + z * 1.8), G * Math.max(0.05, 1 - z), G * Math.max(0.05, 1 - z)) : m.current.scale.setScalar(G * Math.max(1e-3, j) * (1 + k * 0.06) * (W ? 1 + _ * 0.06 : 1)), m.current.scale.x *= h.dir;
369
+ }
370
+ const L = f.exitAt ? 0 : e.dim, T = (f.exitAt ? 3 * (1 - z) : P ? 0.25 + _ * (W ? 0.9 : 0.35) : 1.1 + k * 2.6) * (1 - 0.75 * L);
371
+ l.body.emissiveIntensity = T, l.body.opacity = Math.min(1, j * 1.2);
372
+ const ce = (f.exitAt ? 4 * (1 - z) : P ? 0.5 + _ * (W ? 1.4 : 0.5) : 2.2 + k * 3) * (1 - 0.75 * L);
373
+ l.win.color.copy(g).multiplyScalar(ce), f.exitAt && z < 0.25 && l.win.color.lerp(C, 1 - z * 4).multiplyScalar(1.5), l.win.opacity = j, l.lampF.opacity = j * (P ? 0.4 : 1), l.lampR.opacity = j, l.beam.opacity = (P ? 0.04 : 0.13 + k * 0.08) * j * (1 - L), y.current && (y.current.scale.setScalar(0.9 + k * 0.6 + (P ? _ * 0.25 : 0)), l.halo.opacity = j * (P ? 0.04 + _ * 0.04 : 0.07 + k * 0.08));
374
+ const Q = (E - f.bornAt) / 1e3;
375
+ if (w.current) {
376
+ const G = Q < 1.2;
377
+ if (w.current.visible = G, G) {
378
+ const Z = Q / 1.2;
379
+ w.current.scale.set(1 - Z * 0.5, Math.min(1, Z * 4), 1 - Z * 0.5), w.current.rotation.y = J * 3, l.shimmer.opacity = 0.75 * (1 - Z) * (0.75 + 0.25 * Math.sin(J * 40));
380
+ }
381
+ }
382
+ if (A.current) {
383
+ const G = !!f.exitAt;
384
+ if (A.current.visible = G, G) {
385
+ h.exitPos.lengthSq() || Ge(F, h.exitR + 2.7, I, V, Ce + 0.15, h.exitPos), A.current.position.copy(h.exitPos), A.current.rotation.set(0, Math.atan2(de.x - $.x, de.z - $.z), 0);
386
+ const Z = Math.sin(Math.PI * Math.min(1, z * 1.15));
387
+ A.current.scale.setScalar(Math.max(1e-3, Z) * (c ? 0.85 : 1)), l.portal.color.copy(g).multiplyScalar(2 + 3 * Z);
388
+ }
389
+ }
390
+ S.current && (S.current.visible = t, S.current.rotation.z = J);
391
+ });
392
+ const u = (d) => {
393
+ d.stopPropagation(), i(a);
394
+ };
395
+ return /* @__PURE__ */ b(De, { children: [
396
+ /* @__PURE__ */ b("group", { ref: M, children: [
397
+ /* @__PURE__ */ b("group", { ref: m, children: [
398
+ /* @__PURE__ */ r("mesh", { geometry: X.body, material: l.body, onClick: u, onPointerOver: () => document.body.style.cursor = "pointer", onPointerOut: () => document.body.style.cursor = "" }),
399
+ Xt.map((d) => /* @__PURE__ */ r("mesh", { geometry: X.window, material: l.win, position: [d, 0.06, 0] }, d)),
400
+ /* @__PURE__ */ r("mesh", { geometry: X.roof, material: l.win, position: [0, 0.27, 0] }),
401
+ /* @__PURE__ */ r("mesh", { geometry: X.lamp, material: l.lampF, position: [0.74, 0.02, 0] }),
402
+ /* @__PURE__ */ r("mesh", { geometry: X.lamp, material: l.lampR, position: [-0.74, 0.02, 0], scale: 0.7 }),
403
+ /* @__PURE__ */ r("mesh", { geometry: X.beam, material: l.beam, position: [1.55, -0.05, 0] })
404
+ ] }),
405
+ /* @__PURE__ */ r("mesh", { ref: y, geometry: X.halo, material: l.halo }),
406
+ /* @__PURE__ */ r("mesh", { ref: w, geometry: X.shimmer, material: l.shimmer, position: [0, 1.2, 0], visible: !1 }),
407
+ /* @__PURE__ */ r("mesh", { ref: S, geometry: X.sel, material: l.sel, rotation: [-Math.PI / 2, 0, 0], position: [0, -0.22, 0], visible: !1 })
408
+ ] }),
409
+ /* @__PURE__ */ b("group", { ref: A, visible: !1, children: [
410
+ /* @__PURE__ */ r("mesh", { geometry: X.portal, material: l.portal }),
411
+ /* @__PURE__ */ r("mesh", { geometry: X.portalDisc, material: l.portalDisc })
412
+ ] })
413
+ ] });
414
+ }
415
+ const me = new n.Vector3();
416
+ function Ve(e, t, i, a, o) {
417
+ me.copy(e).add(t).multiplyScalar(0.5), me.y += a;
418
+ const s = 1 - i;
419
+ return o.set(s * s * e.x + 2 * s * i * me.x + i * i * t.x, s * s * e.y + 2 * s * i * me.y + i * i * t.y, s * s * e.z + 2 * s * i * me.z + i * i * t.z);
420
+ }
421
+ const oe = 10, Ke = 48, He = new n.Vector3(), _e = new n.Vector3(), he = new n.Object3D(), Je = new n.Color(), Qe = Object.fromEntries(Object.entries(Ue).map(([e, t]) => [e, new n.Color(t)])), et = /* @__PURE__ */ new Map();
422
+ function qt() {
423
+ const e = x(null);
424
+ return H(() => {
425
+ const t = e.current;
426
+ if (!t) return;
427
+ const i = performance.now();
428
+ let a = 0;
429
+ const o = (s, c, M, m, y, w, A) => {
430
+ for (let S = 0; S < oe && a < Ke * oe; S++) {
431
+ const l = M - S / oe * A;
432
+ l < 0 || M >= 1 ? he.scale.setScalar(1e-4) : (Ve(s, c, l, m, He), he.position.copy(He), he.scale.setScalar(w * (1 - S / oe * 0.75))), he.updateMatrix(), t.setMatrixAt(a, he.matrix), Je.copy(y).multiplyScalar(S === 0 ? 5 : 3 * (1 - S / oe)), t.setColorAt(a, Je), a++;
433
+ }
434
+ };
435
+ for (const s of O.comets) {
436
+ const c = ge(s.from), M = ge(s.to);
437
+ if (!c || !M) continue;
438
+ const m = Math.min(1, (i - s.start) / s.dur), y = m < 0.5 ? 2 * m * m : 1 - Math.pow(-2 * m + 2, 2) / 2, w = O.instances.get(s.from);
439
+ o(c, M, y, 0.9, w ? Qe[w.type] : Qe.planner, 1, 0.22);
440
+ }
441
+ for (const s of O.mcpCalls) {
442
+ const c = O.mcpServers.get(s.server), M = ot(s.server), m = ge(s.instance);
443
+ if (!c || !M || !m) continue;
444
+ _e.copy(M).setY(0.9);
445
+ const y = Math.min(1, (i - s.start) / s.dur), w = 1 - Math.pow(1 - y, 2.2);
446
+ let A = et.get(c.name);
447
+ A || et.set(c.name, A = new n.Color(c.color)), s.phase === "call" ? o(m, _e, w, 3.2, A, 1.5, 0.3) : o(_e, m, w, 3.2, Zt, 1.5, 0.3);
448
+ }
449
+ t.count = a, t.instanceMatrix.needsUpdate = !0, t.instanceColor && (t.instanceColor.needsUpdate = !0);
450
+ }), /* @__PURE__ */ b("instancedMesh", { ref: e, args: [void 0, void 0, Ke * oe], 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 Zt = new n.Color("#ffffff"), Nt = (() => {
456
+ const e = [];
457
+ for (let i = 0; i < 10; i++) {
458
+ const a = -1.7 - i * 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 $t({ mcp: e }) {
465
+ const t = e.srv, i = t.name, a = t.color ?? It[i] ?? "#94a3b8", o = x(null), s = x(null), c = x(null), M = x(null), m = v(() => new n.LineBasicMaterial({ color: R(a, 0.9), transparent: !0, opacity: 0.45, toneMapped: !1 }), [a]);
466
+ return H(({ clock: y }, w) => {
467
+ o.current && (o.current.position.set(e.pos.x, 0.9, e.pos.z), o.current.rotation.y = Math.atan2(-e.out.z, e.out.x));
468
+ const A = performance.now(), S = Math.exp(-(A - t.activeAt) / 450), l = t.inflight > 0;
469
+ s.current && (s.current.rotation.y += w * (K ? 0.1 : l ? 2.4 : 0.25)), c.current && (c.current.material.color.set(a).multiplyScalar(1.5 + S * 5 + (l ? 1 + Math.sin(y.elapsedTime * 8) : 0)), c.current.scale.setScalar(1 + S * 0.8)), M.current && M.current.material.color.set(a).multiplyScalar(0.5 + S * 2 + (l ? 0.6 : 0)), m.opacity = 0.3 + S * 0.6 + (l ? 0.25 : 0);
470
+ }), /* @__PURE__ */ b("group", { ref: o, children: [
471
+ /* @__PURE__ */ r("lineSegments", { geometry: Nt, material: m, position: [0, -0.85, 0] }),
472
+ /* @__PURE__ */ b("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__ */ b("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__ */ b("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__ */ b("group", { ref: s, position: [0, 0.3, 0], children: [
485
+ /* @__PURE__ */ b("mesh", { rotation: [Math.PI / 2, 0, 0], children: [
486
+ /* @__PURE__ */ r("torusGeometry", { args: [0.85, 0.045, 8, 48] }),
487
+ /* @__PURE__ */ r("meshBasicMaterial", { color: R(a, 2), toneMapped: !1 })
488
+ ] }),
489
+ /* @__PURE__ */ b("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: R(a, 1.6), toneMapped: !1 })
492
+ ] })
493
+ ] }),
494
+ /* @__PURE__ */ b("mesh", { ref: c, 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(Ee, { position: [0, 1.55, 0], text: i, color: a, size: 0.34, pxRange: [9, 13] })
499
+ ] });
500
+ }
501
+ const Me = 36, Te = 24;
502
+ function Kt() {
503
+ const e = v(() => {
504
+ const m = new n.BufferGeometry();
505
+ return m.setAttribute("position", new n.BufferAttribute(new Float32Array(Te * Me * 6), 3)), m.setAttribute("color", new n.BufferAttribute(new Float32Array(Te * Me * 6), 3)), m;
506
+ }, []), t = v(() => new n.Vector3(), []), i = v(() => new n.Vector3(), []), a = v(() => new n.Vector3(), []), o = v(() => new n.Color(), []), s = v(() => new n.Color("#fbbf24"), []), c = v(() => new n.Color("#ef4444"), []), M = v(() => new n.Color(), []);
507
+ return H(({ clock: m }) => {
508
+ const y = e.getAttribute("position"), w = e.getAttribute("color"), A = performance.now(), S = m.elapsedTime;
509
+ let l = 0, g = 0;
510
+ const C = (p, u, d, B) => {
511
+ const f = O.mcpServers.get(u), U = ge(p), F = ot(u);
512
+ if (!(!f || !U || !F || g >= Te)) {
513
+ if (g++, t.copy(F).setY(0.9), o.set(f.color), d === "pending") {
514
+ const h = B;
515
+ h < 1 ? o.lerp(s, h) : o.copy(s).lerp(c, Math.min(1, (h - 1) / 1));
516
+ }
517
+ for (let h = 0; h < Me; h++) {
518
+ const I = h / Me, V = (h + 1) / Me;
519
+ Ve(U, t, I, 3.2, i), Ve(U, t, V, 3.2, a);
520
+ let D;
521
+ if (d === "pending") {
522
+ const Y = ((I * 7 - S * (K ? 0.4 : 1.8)) % 1 + 1) % 1;
523
+ D = (0.35 + Math.min(1.6, B * 0.8)) * (0.25 + (Y < 0.35 ? 1.6 : 0));
524
+ } else {
525
+ const Y = 1 - B, E = Math.abs(I - Y);
526
+ D = Math.exp(-E * E * 120) * 7 + 0.6 * (1 - B), o.set("#ffffff");
527
+ }
528
+ M.copy(o).multiplyScalar(D), y.setXYZ(l, i.x, i.y, i.z), w.setXYZ(l++, M.r, M.g, M.b), y.setXYZ(l, a.x, a.y, a.z), w.setXYZ(l++, M.r, M.g, M.b);
529
+ }
530
+ }
531
+ };
532
+ for (const p of O.mcpPending.values()) C(p.instance, p.server, "pending", zt(p, A));
533
+ for (const p of O.mcpResolved) C(p.instance, p.server, "resolved", Math.min(1, (A - p.resolvedAt) / 700));
534
+ e.setDrawRange(0, l), y.needsUpdate = !0, w.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 Ht = new n.Vector3(), tt = { u0: 0, u1: 0 };
538
+ function Jt(e) {
539
+ for (const t of ve.runs.values())
540
+ ke(t, tt), e(nt(t, tt.u0 + 3, -3.4, Ht), 1.5);
541
+ }
542
+ const Qt = /* @__PURE__ */ b(De, { 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(ut, { radius: 120, depth: 50, count: K ? 1200 : 3500, factor: 3, saturation: 0.3, fade: !0, speed: 0.4 }),
548
+ /* @__PURE__ */ r(
549
+ ft,
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 an() {
566
+ return /* @__PURE__ */ b(
567
+ _t,
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: Vt, radius: 2.8 },
580
+ peripheryGap: 4.5,
581
+ Background: Qt,
582
+ Agent: jt,
583
+ RunMarker: Ft,
584
+ McpServer: $t,
585
+ GraphResource: Ut,
586
+ cluster: { radius: 1.9, variant: "stars", pointSize: 1.1 },
587
+ clusterOffset: [0, 1.9, 0],
588
+ extents: Jt,
589
+ PostFX: /* @__PURE__ */ b(dt, { multisampling: 0, children: [
590
+ /* @__PURE__ */ r(mt, { mipmapBlur: !0, intensity: 1.25, luminanceThreshold: 0.22, luminanceSmoothing: 0.25, radius: 0.72 }),
591
+ /* @__PURE__ */ r(ht, { eskil: !1, offset: 0.22, darkness: 0.85 }),
592
+ /* @__PURE__ */ r(Mt, { opacity: 0.025 })
593
+ ] }),
594
+ children: [
595
+ /* @__PURE__ */ r(Et, {}),
596
+ /* @__PURE__ */ r(kt, {}),
597
+ /* @__PURE__ */ r(qt, {}),
598
+ /* @__PURE__ */ r(Kt, {})
599
+ ]
600
+ }
601
+ );
602
+ }
603
+ export {
604
+ an as default
605
+ };