agentglow 0.2.9 → 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,751 @@
1
+ import { jsxs as G, jsx as r, Fragment as Ee } from "react/jsx-runtime";
2
+ import { EffectComposer as ft, Bloom as ht, ChromaticAberration as mt, Vignette as Mt, Noise as gt } from "@react-three/postprocessing";
3
+ import { useMemo as x, useRef as w, useEffect as Ye, useState as yt } from "react";
4
+ import * as e from "three";
5
+ import { useFrame as te, useThree as nt } from "@react-three/fiber";
6
+ import { n as Re, K as ot, w as Q, a as he, o as wt, G as xt, L as Qe, q as bt, c as Je, d as St, T as et, R as At, j as vt, z as De, f as We, p as Ct, e as dt, m as Bt, v as Gt } from "./KitScene-DG_pcnWW.js";
7
+ var lt;
8
+ const ke = typeof window < "u" && !!((lt = window.matchMedia) != null && lt.call(window, "(prefers-reduced-motion: reduce)").matches), H = ke ? 0.15 : 1, se = 7, Pe = 1.3, ue = { speed: 1, paused: !1 }, we = { ax: se, ay: se }, xe = /* @__PURE__ */ new Map(), Ve = (s) => 1 - Math.pow(1 - Math.min(1, Math.max(0, s)), 3);
9
+ let Oe = null;
10
+ function tt() {
11
+ if (Oe) return Oe;
12
+ const s = document.createElement("canvas");
13
+ s.width = s.height = 128;
14
+ const n = s.getContext("2d"), o = n.createRadialGradient(64, 64, 0, 64, 64, 64);
15
+ return o.addColorStop(0, "rgba(255,255,255,1)"), o.addColorStop(0.18, "rgba(255,255,255,0.55)"), o.addColorStop(0.5, "rgba(255,255,255,0.12)"), o.addColorStop(1, "rgba(255,255,255,0)"), n.fillStyle = o, n.fillRect(0, 0, 128, 128), Oe = new e.CanvasTexture(s), Oe;
16
+ }
17
+ let Ie = null;
18
+ function Tt() {
19
+ if (Ie) return Ie;
20
+ const s = document.createElement("canvas");
21
+ s.width = s.height = 128;
22
+ const n = s.getContext("2d");
23
+ n.translate(64, 64);
24
+ const o = (l, a, u) => {
25
+ n.save(), n.rotate(u);
26
+ const h = n.createLinearGradient(-l, 0, l, 0);
27
+ h.addColorStop(0, "rgba(255,255,255,0)"), h.addColorStop(0.5, "rgba(255,255,255,1)"), h.addColorStop(1, "rgba(255,255,255,0)"), n.fillStyle = h, n.beginPath(), n.moveTo(-l, 0), n.lineTo(0, -a), n.lineTo(l, 0), n.lineTo(0, a), n.closePath(), n.fill(), n.restore();
28
+ };
29
+ o(62, 3.2, 0), o(62, 3.2, Math.PI / 2), o(36, 2, Math.PI / 4), o(36, 2, -Math.PI / 4);
30
+ const i = n.createRadialGradient(0, 0, 0, 0, 0, 20);
31
+ return i.addColorStop(0, "rgba(255,255,255,1)"), i.addColorStop(1, "rgba(255,255,255,0)"), n.fillStyle = i, n.fillRect(-20, -20, 40, 40), Ie = new e.CanvasTexture(s), Ie;
32
+ }
33
+ const me = -215, ut = () => Ge.camZ + 4;
34
+ function Et({ children: s }) {
35
+ const n = w(null), o = nt((l) => l.camera), i = nt((l) => l.scene);
36
+ return te((l, a) => {
37
+ var p;
38
+ const u = Math.min(a, 0.1);
39
+ ue.speed += ((ue.paused ? 0 : 1) - ue.speed) * Math.min(1, u * 2.5);
40
+ const h = Re.core;
41
+ let c = Math.max(se * 0.85, h.hw + 2.6), y = Math.max(se * 0.85, h.hh + 2.6);
42
+ c = Math.max(c, y * 0.6), y = Math.max(y, c * 0.5), we.ax = c, we.ay = y, (p = n.current) == null || p.scale.set(c / se, y / se, 1), Ge.camZ = o.position.z;
43
+ const m = i.fog;
44
+ m && (m.near = Math.max(10, Ge.camZ + 8), m.far = Ge.camZ + 200);
45
+ }), /* @__PURE__ */ r("group", { ref: n, children: s });
46
+ }
47
+ const Ge = { camZ: 30 };
48
+ function Rt() {
49
+ const n = w(null), o = x(() => new e.Object3D(), []), i = x(() => new e.Color(), []), l = x(() => [new e.Color("#4f46e5"), new e.Color("#22d3ee"), new e.Color("#7c3aed")], []), a = w(0);
50
+ return te((u, h) => {
51
+ const c = n.current;
52
+ if (!c) return;
53
+ const y = ut() - me;
54
+ a.current = (a.current + Math.min(h, 0.1) * 3.5 * H * ue.speed) % y;
55
+ const m = y / 48;
56
+ for (let p = 0; p < 48; p++) {
57
+ const B = me + (p * m + a.current) % y;
58
+ o.position.set(0, 0, B), o.rotation.set(0, 0, 0), o.scale.setScalar(1), o.updateMatrix(), c.setMatrixAt(p, o.matrix);
59
+ const R = p % 4 === 0, C = Math.min(1, Math.max(0, (Ge.camZ + 2 - B) / 10));
60
+ i.copy(l[p % 3]).multiplyScalar((R ? 1.5 : 0.55) * C), c.setColorAt(p, i);
61
+ }
62
+ c.instanceMatrix.needsUpdate = !0, c.instanceColor && (c.instanceColor.needsUpdate = !0);
63
+ }), /* @__PURE__ */ G("instancedMesh", { ref: n, args: [void 0, void 0, 48], frustumCulled: !1, children: [
64
+ /* @__PURE__ */ r("torusGeometry", { args: [se, 0.03, 4, 120] }),
65
+ /* @__PURE__ */ r("meshBasicMaterial", { toneMapped: !1, transparent: !0, opacity: 0.85, blending: e.AdditiveBlending, depthWrite: !1 })
66
+ ] });
67
+ }
68
+ function Pt() {
69
+ const s = x(() => {
70
+ const o = new Float32Array(144);
71
+ for (let l = 0; l < 24; l++) {
72
+ const a = l / 24 * Math.PI * 2, u = Math.cos(a) * se, h = Math.sin(a) * se;
73
+ o.set([u, h, 120, u, h, me], l * 6);
74
+ }
75
+ const i = new e.BufferGeometry();
76
+ return i.setAttribute("position", new e.BufferAttribute(o, 3)), i;
77
+ }, []);
78
+ return /* @__PURE__ */ r("lineSegments", { geometry: s, children: /* @__PURE__ */ r("lineBasicMaterial", { color: new e.Color("#3730a3").multiplyScalar(1.1), transparent: !0, opacity: 0.35, toneMapped: !1, blending: e.AdditiveBlending, depthWrite: !1 }) });
79
+ }
80
+ function Ot() {
81
+ const s = ke ? 120 : 300, n = w(null), o = x(() => {
82
+ const u = new Float32Array(s * 5);
83
+ for (let h = 0; h < s; h++) {
84
+ const c = se * (0.38 + 0.6 * Math.pow(Math.random(), 0.45));
85
+ u.set([Math.random() * Math.PI * 2, c, me + Math.random() * 240, 9 + Math.random() * 12, 1 + Math.random() * 3.5], h * 5);
86
+ }
87
+ return u;
88
+ }, [s]), i = x(() => new e.Object3D(), []), l = x(() => new e.Color(), []), a = x(() => [new e.Color("#a5b4fc"), new e.Color("#67e8f9"), new e.Color("#f0abfc"), new e.Color("#ffffff")], []);
89
+ return te((u, h) => {
90
+ const c = n.current;
91
+ if (!c) return;
92
+ const y = Math.min(h, 0.1), m = ut(), p = m - me;
93
+ for (let B = 0; B < s; B++) {
94
+ const R = B * 5;
95
+ let C = o[R + 2] + y * o[R + 3] * H * ue.speed;
96
+ C > m && (C -= p), o[R + 2] = C;
97
+ const M = o[R], _ = o[R + 1];
98
+ i.position.set(Math.cos(M) * _, Math.sin(M) * _, C), i.scale.set(0.022, 0.022, o[R + 4] * (ke ? 0.4 : 1)), i.updateMatrix(), c.setMatrixAt(B, i.matrix);
99
+ const b = Math.min(1, Math.max(0, (C - me) / 60)) * Math.min(1, Math.max(0, (m - C) / 6));
100
+ l.copy(a[B % 4]).multiplyScalar((0.15 + 0.6 * b * (_ / se)) * (0.25 + 0.75 * ue.speed)), c.setColorAt(B, l);
101
+ }
102
+ c.instanceMatrix.needsUpdate = !0, c.instanceColor && (c.instanceColor.needsUpdate = !0);
103
+ }), /* @__PURE__ */ G("instancedMesh", { ref: n, args: [void 0, void 0, s], frustumCulled: !1, children: [
104
+ /* @__PURE__ */ r("boxGeometry", { args: [1, 1, 1] }),
105
+ /* @__PURE__ */ r("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: e.AdditiveBlending, depthWrite: !1, fog: !1 })
106
+ ] });
107
+ }
108
+ function It() {
109
+ const s = x(() => tt(), []), n = w(null);
110
+ return te(({ clock: o }) => {
111
+ n.current && n.current.scale.setScalar(1 + Math.sin(o.elapsedTime * 0.8) * 0.03 * H);
112
+ }), /* @__PURE__ */ G("group", { position: [0, 0, me + 5], children: [
113
+ /* @__PURE__ */ G("mesh", { ref: n, children: [
114
+ /* @__PURE__ */ r("planeGeometry", { args: [80, 80] }),
115
+ /* @__PURE__ */ r("meshBasicMaterial", { map: s, color: new e.Color("#818cf8").multiplyScalar(1.1), transparent: !0, blending: e.AdditiveBlending, depthWrite: !1, toneMapped: !1, fog: !1 })
116
+ ] }),
117
+ /* @__PURE__ */ G("mesh", { children: [
118
+ /* @__PURE__ */ r("planeGeometry", { args: [18, 18] }),
119
+ /* @__PURE__ */ r("meshBasicMaterial", { map: s, color: new e.Color("#e0e7ff").multiplyScalar(2), transparent: !0, blending: e.AdditiveBlending, depthWrite: !1, toneMapped: !1, fog: !1 })
120
+ ] })
121
+ ] });
122
+ }
123
+ const re = 2.3, ne = 5.2, pt = 3.4, oe = 2 * Math.PI * re, rt = new e.Matrix4().makeRotationFromEuler(new e.Euler(0.28, 0.8, 0)), Me = 48, st = 220, je = 3, zt = new e.Vector3(0, 1, 0), _t = new e.Vector3(0, 0, 1), Se = new e.Vector3();
124
+ function ge(s, n) {
125
+ let o = 2166136261 ^ n;
126
+ for (let i = 0; i < s.length; i++) o = Math.imul(o ^ s.charCodeAt(i), 16777619);
127
+ return (o >>> 0) % 1e5 / 1e5;
128
+ }
129
+ function Ut({ galaxy: s }) {
130
+ const n = x(() => {
131
+ const S = s.nodes.slice(0, st), A = new Set(S.map((U) => U.id));
132
+ return { nodes: S, links: s.links.filter((U) => A.has(U.source) && A.has(U.target)) };
133
+ }, [s]), o = n.nodes.length, i = w(null), l = w(null), a = w(null), u = w(null), h = w(/* @__PURE__ */ new Map()), c = x(() => {
134
+ const S = new Float32Array(o), A = new Float32Array(o), U = new Map(n.nodes.map((t, d) => [t.id, d])), V = [];
135
+ for (const t of n.links) {
136
+ const d = U.get(t.source), f = U.get(t.target);
137
+ d !== void 0 && f !== void 0 && d !== f && V.push([d, f]);
138
+ }
139
+ let O = 0;
140
+ n.nodes.forEach((t, d) => {
141
+ const f = h.current.get(t.id);
142
+ f ? (S[d] = f.u, A[d] = f.w) : (S[d] = ge(t.id, 1) * oe, A[d] = ge(t.id, 2) * ne, O++);
143
+ });
144
+ for (const [t, d] of V) {
145
+ const f = !h.current.has(n.nodes[t].id), T = !h.current.has(n.nodes[d].id);
146
+ f && !T && (S[t] = (S[d] + (ge(n.nodes[t].id, 3) - 0.5) * 0.8 + oe) % oe, A[t] = Math.min(ne, Math.max(0, A[d] + (ge(n.nodes[t].id, 4) - 0.5) * 0.8))), T && !f && (S[d] = (S[t] + (ge(n.nodes[d].id, 3) - 0.5) * 0.8 + oe) % oe, A[d] = Math.min(ne, Math.max(0, A[t] + (ge(n.nodes[d].id, 4) - 0.5) * 0.8)));
147
+ }
148
+ const K = h.current.size === 0 ? 90 : O ? 14 : 0, F = new Float32Array(o), D = new Float32Array(o), X = (t) => t > oe / 2 ? t - oe : t < -oe / 2 ? t + oe : t;
149
+ for (let t = 0; t < K; t++) {
150
+ F.fill(0), D.fill(0);
151
+ for (let f = 0; f < o; f++)
152
+ for (let T = f + 1; T < o; T++) {
153
+ const L = X(S[f] - S[T]), j = A[f] - A[T], Z = L * L + j * j + 4e-3;
154
+ if (Z > 1.4) continue;
155
+ const N = 0.05 / Z;
156
+ F[f] += L * N, D[f] += j * N, F[T] -= L * N, D[T] -= j * N;
157
+ }
158
+ for (const [f, T] of V) {
159
+ const L = X(S[T] - S[f]), j = A[T] - A[f];
160
+ F[f] += L * 0.06, D[f] += j * 0.06, F[T] -= L * 0.06, D[T] -= j * 0.06;
161
+ }
162
+ const d = 0.6 * (1 - t / Math.max(1, K)) + 0.05;
163
+ for (let f = 0; f < o; f++)
164
+ S[f] = (S[f] + Math.max(-0.3, Math.min(0.3, F[f])) * d + oe) % oe, A[f] = Math.max(0, Math.min(ne, A[f] + Math.max(-0.3, Math.min(0.3, D[f])) * d));
165
+ }
166
+ const $ = new Float32Array(o * 3), Y = /* @__PURE__ */ new Map();
167
+ for (let t = 0; t < o; t++) {
168
+ Y.set(n.nodes[t].id, { u: S[t], w: A[t] });
169
+ const d = S[t] / re, f = re + Math.sin(t * 7.3) * 0.12;
170
+ Se.set(Math.cos(d) * f, Math.sin(d) * f, ne / 2 - A[t]).applyMatrix4(rt), $.set([Se.x, Se.y, Se.z], t * 3);
171
+ }
172
+ return h.current = Y, $;
173
+ }, [o, n]), y = x(() => n.nodes.map((S) => new e.Color(ot[S.kind] ?? "#94a3b8")), [n]), m = x(() => {
174
+ const S = new Map(n.nodes.map((V, O) => [V.id, O])), A = [];
175
+ for (const V of n.links) {
176
+ const O = S.get(V.source), K = S.get(V.target);
177
+ if (O === void 0 || K === void 0 || O === K) continue;
178
+ const F = c[O * 3] - c[K * 3], D = c[O * 3 + 1] - c[K * 3 + 1], X = c[O * 3 + 2] - c[K * 3 + 2];
179
+ F * F + D * D + X * X > 2.6 * 2.6 || A.push(c[O * 3], c[O * 3 + 1], c[O * 3 + 2], c[K * 3], c[K * 3 + 1], c[K * 3 + 2]);
180
+ }
181
+ const U = new e.BufferGeometry();
182
+ return U.setAttribute("position", new e.Float32BufferAttribute(A, 3)), U;
183
+ }, [n, c]), p = x(() => /* @__PURE__ */ new Map(), [n]), B = (S) => {
184
+ let A = p.get(S);
185
+ return A === void 0 && p.set(S, A = bt(n, S)), A;
186
+ }, R = x(() => new Float32Array(o), [o]), C = x(() => new Uint8Array(o), [o]), M = x(() => new e.Object3D(), []), _ = x(() => new e.Color(), []), b = x(() => new e.Color("#ffffff"), []), I = x(() => new e.Vector3(), []), g = x(() => new e.Vector3(), []), E = x(() => Tt(), []), z = w([]), P = w([]), v = w([]), k = w([-1, -1, -1]), J = x(() => {
187
+ const S = [];
188
+ for (const V of [-ne / 2, -ne / 6, ne / 6, ne / 2])
189
+ for (let O = 0; O < 48; O++) {
190
+ const K = O / 48 * Math.PI * 2, F = (O + 1) / 48 * Math.PI * 2;
191
+ S.push(Math.cos(K) * re, Math.sin(K) * re, V, Math.cos(F) * re, Math.sin(F) * re, V);
192
+ }
193
+ for (let V = 0; V < 12; V++) {
194
+ const O = V / 12 * Math.PI * 2;
195
+ S.push(Math.cos(O) * re, Math.sin(O) * re, -ne / 2, Math.cos(O) * re, Math.sin(O) * re, ne / 2);
196
+ }
197
+ const U = new e.BufferGeometry();
198
+ return U.setAttribute("position", new e.Float32BufferAttribute(S, 3)), U.applyMatrix4(rt), U;
199
+ }, []);
200
+ return te(({ clock: S }) => {
201
+ var Y;
202
+ const A = i.current;
203
+ if (!A) return;
204
+ const U = 1, V = 0, O = performance.now(), K = S.elapsedTime;
205
+ R.fill(0), C.fill(0);
206
+ let F = 0, D = 0, X = 0;
207
+ for (const t of Q.flares) {
208
+ const d = B(t.node), f = (O - t.start) / 1e3, T = Math.exp(-f * 1.2) * Math.min(1, f * 10);
209
+ T > R[d] && (R[d] = T), t.op === "write" && (C[d] = 1);
210
+ const L = c[d * 3] * U - c[d * 3 + 1] * V, j = c[d * 3] * V + c[d * 3 + 1] * U, Z = c[d * 3 + 2], N = t.op === "write", q = Math.max(0, 1 - f / 2.6);
211
+ l.current && F < Me && (M.position.set(L, j, Z), M.quaternion.identity(), M.scale.setScalar(((N ? 0.6 : 0.35) + f * (N ? 2.6 : 1.5)) * 0.18), M.updateMatrix(), l.current.setMatrixAt(F, M.matrix), _.copy(N ? b : y[d]).multiplyScalar((N ? 4 : 2.4) * q), l.current.setColorAt(F++, _)), N && a.current && D < Me && (M.position.set(L, j, Z), M.quaternion.setFromAxisAngle(_t, f * 0.8), M.scale.setScalar((1.5 + 3 * T) * 0.45), M.updateMatrix(), a.current.setMatrixAt(D, M.matrix), _.copy(b).multiplyScalar(3.2 * q), a.current.setColorAt(D++, _));
212
+ const le = xe.get(t.instance), pe = he(t.instance);
213
+ if (le && pe && u.current && X < Me && le.presence > 0.02) {
214
+ const ae = wt(pe, Se);
215
+ I.set(L, j, Z), g.subVectors(I, ae);
216
+ const ee = g.length();
217
+ M.position.copy(ae).addScaledVector(g, 0.5), M.quaternion.setFromUnitVectors(zt, g.normalize());
218
+ const W = N ? 1.6 : 1;
219
+ M.scale.set(W * (0.5 + T), ee, W * (0.5 + T)), M.updateMatrix(), u.current.setMatrixAt(X, M.matrix), _.copy(N ? b : le.color).multiplyScalar((N ? 3.2 : 2.4) * q * q), u.current.setColorAt(X++, _);
220
+ }
221
+ }
222
+ let $ = 0;
223
+ for (let t = Q.flares.length - 1; t >= 0 && $ < je; t--) {
224
+ const d = Q.flares[t], f = (O - d.start) / 1e3;
225
+ if (f > 1.6) break;
226
+ const T = B(d.node);
227
+ let L = !1;
228
+ for (let N = 0; N < $; N++) k.current[N] === T && (L = !0);
229
+ if (L) continue;
230
+ const j = z.current[$], Z = P.current[$];
231
+ j && Z && (j.position.set(c[T * 3], c[T * 3 + 1], c[T * 3 + 2]), (k.current[$] !== T || v.current[$] !== d.op) && (Z.setText((d.op === "write" ? "wrote · " : "") + d.node), v.current[$] = d.op, Z.setColor(d.op === "write" ? "#ffffff" : ot[(Y = n.nodes[T]) == null ? void 0 : Y.kind] ?? "#a5b4fc")), Z.setOpacity(Math.min(1, (1.6 - f) * 2.5)), k.current[$] = T), $++;
232
+ }
233
+ for (let t = $; t < je; t++) {
234
+ k.current[t] = -1;
235
+ const d = P.current[t];
236
+ d == null || d.setOpacity(0);
237
+ }
238
+ for (const t of [l.current, a.current, u.current])
239
+ t && (t.count = t === l.current ? F : t === a.current ? D : X, t.instanceMatrix.needsUpdate = !0, t.instanceColor && (t.instanceColor.needsUpdate = !0));
240
+ for (let t = 0; t < o; t++) {
241
+ const d = R[t];
242
+ M.position.set(c[t * 3], c[t * 3 + 1], c[t * 3 + 2]), M.quaternion.identity(), M.scale.setScalar(1 + d * 2.4), M.updateMatrix(), A.setMatrixAt(t, M.matrix);
243
+ const f = 0.75 + 0.25 * Math.sin(K * 1.7 * H + t * 1.3);
244
+ _.copy(y[t]).multiplyScalar(1.1 * f + d * 5), C[t] && _.lerp(b, Math.min(1, d) * 0.6).multiplyScalar(1 + d), A.setColorAt(t, _);
245
+ }
246
+ A.count = o, A.instanceMatrix.needsUpdate = !0, A.instanceColor && (A.instanceColor.needsUpdate = !0);
247
+ }), /* @__PURE__ */ G(Ee, { children: [
248
+ /* @__PURE__ */ G("group", { children: [
249
+ /* @__PURE__ */ r("lineSegments", { geometry: J, children: /* @__PURE__ */ r("lineBasicMaterial", { color: new e.Color("#4f46e5").multiplyScalar(0.9), transparent: !0, opacity: 0.35, blending: e.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) }),
250
+ /* @__PURE__ */ G("instancedMesh", { ref: i, args: [void 0, void 0, st], frustumCulled: !1, children: [
251
+ /* @__PURE__ */ r("icosahedronGeometry", { args: [0.13, 1] }),
252
+ /* @__PURE__ */ r("meshBasicMaterial", { toneMapped: !1 })
253
+ ] }),
254
+ /* @__PURE__ */ r("lineSegments", { geometry: m, children: /* @__PURE__ */ r("lineBasicMaterial", { color: new e.Color("#a5b4fc").multiplyScalar(1.3), transparent: !0, opacity: 0.42, blending: e.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) })
255
+ ] }),
256
+ /* @__PURE__ */ G("instancedMesh", { ref: l, args: [void 0, void 0, Me], frustumCulled: !1, children: [
257
+ /* @__PURE__ */ r("ringGeometry", { args: [0.82, 1, 40] }),
258
+ /* @__PURE__ */ r("meshBasicMaterial", { transparent: !0, blending: e.AdditiveBlending, depthWrite: !1, toneMapped: !1, side: e.DoubleSide })
259
+ ] }),
260
+ /* @__PURE__ */ G("instancedMesh", { ref: a, args: [void 0, void 0, Me], frustumCulled: !1, children: [
261
+ /* @__PURE__ */ r("planeGeometry", { args: [1, 1] }),
262
+ /* @__PURE__ */ r("meshBasicMaterial", { map: E, transparent: !0, blending: e.AdditiveBlending, depthWrite: !1, toneMapped: !1 })
263
+ ] }),
264
+ /* @__PURE__ */ G("instancedMesh", { ref: u, args: [void 0, void 0, Me], frustumCulled: !1, children: [
265
+ /* @__PURE__ */ r("cylinderGeometry", { args: [0.035, 0.035, 1, 6, 1, !0] }),
266
+ /* @__PURE__ */ r("meshBasicMaterial", { transparent: !0, blending: e.AdditiveBlending, depthWrite: !1, toneMapped: !1 })
267
+ ] }),
268
+ /* @__PURE__ */ r("group", { position: [0, -pt - 0.5, 0], children: /* @__PURE__ */ r(xt, { color: "#a5b4fc", letterSpacing: 0.04, size: 0.32, pxRange: [9, 13] }) }),
269
+ Array.from({ length: je }, (S, A) => /* @__PURE__ */ r("group", { ref: (U) => void (z.current[A] = U), children: /* @__PURE__ */ r(Qe, { ref: (U) => void (P.current[A] = U), position: [0, 0.45, 0], text: "", size: 0.24, opacity: 0, pxRange: [8, 12] }) }, A))
270
+ ] });
271
+ }
272
+ const ze = 12, Ae = 40, kt = new e.Vector3(0, 1, 0), Te = new e.Color("#ffffff"), Vt = new e.Color("#f59e0b"), Wt = new e.Color("#ef4444"), Le = (s, n, o, i) => (1 - i) * (1 - i) * s + 2 * (1 - i) * i * n + i * i * o, Ft = (s) => s < 0.5 ? 2 * s * s : 1 - Math.pow(-2 * s + 2, 2) / 2, Dt = Object.fromEntries(Object.entries(et).map(([s, n]) => [s, new e.Color(n)]));
273
+ function jt(s, n, o, i) {
274
+ const l = s / we.ax, a = n / we.ay, u = o / we.ax, h = i / we.ay, c = u - l, y = h - a, m = c * c + y * y, p = 2 * (l * c + a * y), B = l * l + a * a - 1, R = p * p - 4 * m * B;
275
+ if (m < 1e-6 || R < 0) return -1;
276
+ const C = Math.sqrt(R), M = (-p + C) / (2 * m), _ = (-p - C) / (2 * m);
277
+ return M >= 0 && M <= 1 ? M : _ >= 0 && _ <= 1 ? _ : -1;
278
+ }
279
+ function Lt() {
280
+ const s = w(null), n = w(null), o = x(() => new e.Object3D(), []), i = x(() => new e.Color(), []), l = x(() => new e.Color(), []), a = x(() => new e.Vector3(), []), u = x(() => new e.Vector3(), []), h = x(() => new e.Vector3(), []), c = x(() => /* @__PURE__ */ new Map(), []);
281
+ return te(() => {
282
+ var _;
283
+ const y = s.current, m = n.current;
284
+ if (!y || !m) return;
285
+ const p = performance.now();
286
+ let B = 0, R = 0, C = 0;
287
+ const M = (b, I, g) => {
288
+ const E = Ft(Math.min(1, Math.max(0, b)));
289
+ for (let z = 0; z < ze; z++) {
290
+ const P = Math.max(0, E - z * 0.028);
291
+ o.position.set(Le(a.x, h.x, u.x, P), Le(a.y, h.y, u.y, P), Le(a.z, h.z, u.z, P)), o.scale.setScalar(I * (1 - z / ze) * (b >= 1 ? 0 : 1)), o.updateMatrix(), y.setMatrixAt(B, o.matrix), i.copy(z === 0 ? Te : l).lerp(l, z === 0 ? 0.35 : 0).multiplyScalar((z === 0 ? 5 : 3.2) * (1 - z / ze) * g), y.setColorAt(B++, i);
292
+ }
293
+ return E;
294
+ };
295
+ for (const b of Q.comets) {
296
+ if (C >= Ae) break;
297
+ const I = he(b.from), g = he(b.to);
298
+ if (!I || !g) continue;
299
+ const E = (p - b.start) / b.dur;
300
+ if (E > 1.05) continue;
301
+ a.copy(I), u.copy(g), h.copy(a).add(u).multiplyScalar(0.5), h.z -= 3 + a.distanceTo(u) * 0.25;
302
+ const z = Q.instances.get(b.from);
303
+ l.copy(z ? Dt[z.type] : Te), M(E, 0.2, 1), C++;
304
+ }
305
+ for (const b of Q.mcpCalls) {
306
+ if (C >= Ae) break;
307
+ const I = he(b.instance), g = Je(b.server);
308
+ if (!I || !g) continue;
309
+ const E = (p - b.start) / b.dur;
310
+ if (E > 1.05) continue;
311
+ b.phase === "call" ? (a.copy(I), u.copy(g)) : (a.copy(g), u.copy(I)), h.copy(a).add(u).multiplyScalar(0.5), h.z -= 2;
312
+ let z = c.get(b.server);
313
+ z || c.set(b.server, z = new e.Color(((_ = Q.mcpServers.get(b.server)) == null ? void 0 : _.color) ?? "#94a3b8")), l.copy(z);
314
+ const P = M(E, 0.17, 1.1);
315
+ C++;
316
+ const v = jt(a.x, a.y, u.x, u.y);
317
+ if (v >= 0 && P > v && R < Ae) {
318
+ const k = P - v;
319
+ o.position.set(a.x + (u.x - a.x) * v, a.y + (u.y - a.y) * v, a.z + (u.z - a.z) * v), o.scale.setScalar(0.25 + k * 2.4), o.updateMatrix(), m.setMatrixAt(R, o.matrix), i.copy(z).lerp(Te, 0.4).multiplyScalar(4 * Math.exp(-k * 4)), m.setColorAt(R++, i);
320
+ }
321
+ }
322
+ y.count = B, m.count = R, y.instanceMatrix.needsUpdate = !0, m.instanceMatrix.needsUpdate = !0, y.instanceColor && (y.instanceColor.needsUpdate = !0), m.instanceColor && (m.instanceColor.needsUpdate = !0);
323
+ }), /* @__PURE__ */ G(Ee, { children: [
324
+ /* @__PURE__ */ G("instancedMesh", { ref: s, args: [void 0, void 0, Ae * ze], frustumCulled: !1, children: [
325
+ /* @__PURE__ */ r("sphereGeometry", { args: [1, 12, 8] }),
326
+ /* @__PURE__ */ r("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: e.AdditiveBlending, depthWrite: !1 })
327
+ ] }),
328
+ /* @__PURE__ */ G("instancedMesh", { ref: n, args: [void 0, void 0, Ae], frustumCulled: !1, children: [
329
+ /* @__PURE__ */ r("ringGeometry", { args: [0.7, 1, 32] }),
330
+ /* @__PURE__ */ r("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: e.AdditiveBlending, depthWrite: !1, side: e.DoubleSide })
331
+ ] })
332
+ ] });
333
+ }
334
+ function Nt() {
335
+ const o = w(null), i = w(null), l = x(() => new e.Object3D(), []), a = x(() => new e.Color(), []), u = x(() => new e.Vector3(), []), h = x(() => /* @__PURE__ */ new Map(), []), c = (y) => {
336
+ var p;
337
+ let m = h.get(y);
338
+ return m || h.set(y, m = new e.Color(((p = Q.mcpServers.get(y)) == null ? void 0 : p.color) ?? "#94a3b8")), m;
339
+ };
340
+ return te(({ clock: y }) => {
341
+ var I;
342
+ const m = o.current, p = i.current;
343
+ if (!m || !p) return;
344
+ const B = performance.now(), R = y.elapsedTime * Math.max(0.25, H);
345
+ let C = 0, M = 0;
346
+ const _ = (g, E, z) => {
347
+ u.subVectors(E, g);
348
+ const P = u.length();
349
+ l.position.copy(g).addScaledVector(u, 0.5), l.quaternion.setFromUnitVectors(kt, u.normalize()), l.scale.set(z, P, z), l.updateMatrix(), m.setMatrixAt(C, l.matrix), m.setColorAt(C++, a);
350
+ }, b = (g, E, z, P) => {
351
+ l.position.lerpVectors(g, E, z), l.quaternion.identity(), l.scale.setScalar(P), l.updateMatrix(), p.setMatrixAt(M, l.matrix), p.setColorAt(M++, a);
352
+ };
353
+ for (const g of Q.mcpPending.values()) {
354
+ if (C >= 24) break;
355
+ const E = he(g.instance), z = Je(g.server);
356
+ if (!E || !z || (((I = xe.get(g.instance)) == null ? void 0 : I.presence) ?? 0) < 0.02) continue;
357
+ const P = St(g, B), v = Math.min(1, P / 0.35);
358
+ a.copy(c(g.server)), P > 0.6 && a.lerp(Vt, Math.min(1, (P - 0.6) / 0.9)), P > 1.6 && a.lerp(Wt, Math.min(1, (P - 1.6) / 0.8));
359
+ const k = (0.9 + Math.min(2.2, P * 0.7)) * v * (0.85 + 0.15 * Math.sin(R * 9));
360
+ a.multiplyScalar(k), _(E, z, 0.6 + Math.min(1.4, P * 0.4)), a.multiplyScalar(1.8);
361
+ for (let J = 0; J < 8 && M < 192; J++) {
362
+ const S = (R * (0.7 + Math.min(1.2, P * 0.35)) + J / 8) % 1;
363
+ S > v || b(E, z, S, 0.09 + Math.min(0.08, P * 0.03));
364
+ }
365
+ }
366
+ for (const g of Q.mcpResolved) {
367
+ if (C >= 24) break;
368
+ const E = he(g.instance), z = Je(g.server);
369
+ if (!E || !z) continue;
370
+ const P = Math.min(1, (B - g.resolvedAt) / 700);
371
+ a.copy(c(g.server)).lerp(Te, 0.6).multiplyScalar(2.6 * (1 - P)), _(E, z, 1.6 * (1 - P * 0.7)), a.copy(Te).multiplyScalar(6);
372
+ const v = 1 - Math.pow(1 - P, 2);
373
+ for (let k = 0; k < 5 && M < 192; k++) b(z, E, Math.max(0, v - k * 0.035), 0.26 * (1 - k / 5));
374
+ }
375
+ m.count = C, p.count = M, m.instanceMatrix.needsUpdate = !0, p.instanceMatrix.needsUpdate = !0, m.instanceColor && (m.instanceColor.needsUpdate = !0), p.instanceColor && (p.instanceColor.needsUpdate = !0);
376
+ }), /* @__PURE__ */ G(Ee, { children: [
377
+ /* @__PURE__ */ G("instancedMesh", { ref: o, args: [void 0, void 0, 24], frustumCulled: !1, children: [
378
+ /* @__PURE__ */ r("cylinderGeometry", { args: [0.03, 0.03, 1, 6, 1, !0] }),
379
+ /* @__PURE__ */ r("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: e.AdditiveBlending, depthWrite: !1 })
380
+ ] }),
381
+ /* @__PURE__ */ G("instancedMesh", { ref: i, args: [void 0, void 0, 192], frustumCulled: !1, children: [
382
+ /* @__PURE__ */ r("sphereGeometry", { args: [1, 10, 8] }),
383
+ /* @__PURE__ */ r("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: e.AdditiveBlending, depthWrite: !1 })
384
+ ] })
385
+ ] });
386
+ }
387
+ function Kt({ mcp: s }) {
388
+ const n = s.name, o = s.srv, i = x(() => new e.Color((o == null ? void 0 : o.color) ?? "#94a3b8"), [o == null ? void 0 : o.color]), l = w(null), a = x(() => tt(), []), u = w(null), h = w(null), c = w(null), y = w(null), m = w(null), p = w(null);
389
+ return te(({ clock: B }, R) => {
390
+ var E;
391
+ (E = l.current) == null || E.position.copy(s.pos);
392
+ const C = Q.mcpServers.get(n);
393
+ if (!C) return;
394
+ const M = performance.now(), _ = B.elapsedTime, b = Math.exp(-(M - C.activeAt) / 450), I = C.inflight > 0 ? 1 : 0, g = (I * 2.6 + b * 2) * Math.max(0.2, H);
395
+ u.current && (u.current.rotation.z += R * g), h.current && (h.current.rotation.x += R * g * 0.7), c.current && (c.current.material.color.copy(i).multiplyScalar(1.3 + I * 1.4 + b * 3 + (I ? Math.sin(_ * 7) * 0.5 : 0)), c.current.scale.setScalar(1 + b * 0.35)), y.current && (y.current.material.opacity = 0.22 + I * 0.25 + b * 0.45, y.current.scale.setScalar(1 + b * 0.7 + I * 0.2)), m.current && (m.current.visible = Math.sin(_ * 4 + C.slot) > 0.6 || I === 1);
396
+ }), /* @__PURE__ */ G("group", { ref: l, children: [
397
+ /* @__PURE__ */ G("group", { ref: p, children: [
398
+ /* @__PURE__ */ G("mesh", { ref: c, children: [
399
+ /* @__PURE__ */ r("octahedronGeometry", { args: [0.55, 0] }),
400
+ /* @__PURE__ */ r("meshBasicMaterial", { toneMapped: !1 })
401
+ ] }),
402
+ [-1, 1].map((B) => /* @__PURE__ */ G("mesh", { position: [B * 1.55, 0, 0], children: [
403
+ /* @__PURE__ */ r("boxGeometry", { args: [1.5, 0.6, 0.04] }),
404
+ /* @__PURE__ */ r("meshStandardMaterial", { color: "#0f172a", emissive: i, emissiveIntensity: 0.35, metalness: 0.8, roughness: 0.35, toneMapped: !1 })
405
+ ] }, B)),
406
+ /* @__PURE__ */ G("mesh", { position: [0, 0, 0], children: [
407
+ /* @__PURE__ */ r("boxGeometry", { args: [1.6, 0.06, 0.06] }),
408
+ /* @__PURE__ */ r("meshBasicMaterial", { color: i.clone().multiplyScalar(0.8), toneMapped: !1 })
409
+ ] }),
410
+ /* @__PURE__ */ G("mesh", { ref: m, position: [0, 0.85, 0], children: [
411
+ /* @__PURE__ */ r("sphereGeometry", { args: [0.09, 10, 8] }),
412
+ /* @__PURE__ */ r("meshBasicMaterial", { color: new e.Color(4, 3.2, 3.2), toneMapped: !1 })
413
+ ] })
414
+ ] }),
415
+ /* @__PURE__ */ G("mesh", { ref: u, children: [
416
+ /* @__PURE__ */ r("torusGeometry", { args: [1.05, 0.04, 6, 64, Math.PI * 1.6] }),
417
+ /* @__PURE__ */ r("meshBasicMaterial", { color: i.clone().multiplyScalar(2.2), toneMapped: !1 })
418
+ ] }),
419
+ /* @__PURE__ */ G("mesh", { ref: h, rotation: [Math.PI / 2, 0, 0], children: [
420
+ /* @__PURE__ */ r("torusGeometry", { args: [0.8, 0.03, 6, 48] }),
421
+ /* @__PURE__ */ r("meshBasicMaterial", { color: i.clone().multiplyScalar(1.6), toneMapped: !1 })
422
+ ] }),
423
+ /* @__PURE__ */ G("mesh", { ref: y, children: [
424
+ /* @__PURE__ */ r("planeGeometry", { args: [4.2, 4.2] }),
425
+ /* @__PURE__ */ r("meshBasicMaterial", { map: a, color: i, transparent: !0, blending: e.AdditiveBlending, depthWrite: !1, toneMapped: !1 })
426
+ ] }),
427
+ /* @__PURE__ */ r("group", { position: [0, -1.55, 0], children: /* @__PURE__ */ r(Qe, { text: `mcp · ${n}`, color: (o == null ? void 0 : o.color) ?? "#94a3b8", size: 0.36, pxRange: [9, 13] }) })
428
+ ] });
429
+ }
430
+ const Xt = new e.Color("#4ade80"), Ne = new e.Color("#fde68a"), $t = new e.Color("#ef4444"), Ke = ["planner", "researcher", "writer"], Xe = 16, $e = 7, qe = 5, qt = new e.BoxGeometry(1, 0.035, 0.035), Zt = new e.TorusGeometry(1, 0.03, 6, 64), ce = new e.Object3D(), ie = new e.Color(), _e = new Float64Array(3), Ze = new Int8Array(3);
431
+ function Ht({ run: s }) {
432
+ const n = x(() => new e.Color(s.color), [s.color]), o = w(null), i = w([]), l = w([]), a = w([]), u = w([]), h = w([]), c = w(null), y = w(null), m = w(null), p = w(null), B = w(""), R = w(["", "", ""]), C = w([0, 0, 0]), M = w([0, 0.33, 0.66]), _ = x(() => n.clone().lerp(new e.Color("#ffffff"), 0.55).multiplyScalar(5), [n]), b = x(() => {
433
+ const g = new e.InstancedMesh(Zt, new e.MeshBasicMaterial({ toneMapped: !1, transparent: !0, blending: e.AdditiveBlending, depthWrite: !1 }), 3 * $e);
434
+ return g.frustumCulled = !1, g.setColorAt(0, new e.Color(0, 0, 0)), g.count = 0, g;
435
+ }, []), I = x(
436
+ () => ({
437
+ rail: new e.MeshBasicMaterial({ color: n.clone().multiplyScalar(1.6), toneMapped: !1, transparent: !0, opacity: 0.75 }),
438
+ dash: new e.MeshBasicMaterial({ color: n.clone().multiplyScalar(2.4), toneMapped: !1, transparent: !0, opacity: 0.8, blending: e.AdditiveBlending, depthWrite: !1 })
439
+ }),
440
+ [n]
441
+ );
442
+ return te(({ clock: g }, E) => {
443
+ var Y;
444
+ const z = o.current;
445
+ if (!z) return;
446
+ const P = Math.min(E, 0.1), v = s.run ?? Q.runs.get(s.id), k = performance.now(), J = g.elapsedTime, S = We.spread;
447
+ z.position.copy(s.origin).addScaledVector(s.side, -s.cu).addScaledVector(s.axis, -s.cv);
448
+ const A = v ? Ve((k - v.startedAt) / 1300) : 1, U = v != null && v.endedAt ? Math.max(0, 1 - (k - v.endedAt) / At) : 1, V = s.cu - s.hu - 0.8 * S, O = V + (s.cu + s.hu + 0.8 * S - V) * Math.max(1e-3, A);
449
+ for (let t = 0; t < 2; t++) {
450
+ const d = i.current[t];
451
+ d && (d.position.set((V + O) / 2, (t ? 0.62 : -0.62) * S, -0.9), d.scale.set(Math.max(0.01, O - V), 1, 1));
452
+ }
453
+ I.rail.opacity = 0.75 * U, I.dash.opacity = 0.8 * U;
454
+ const K = y.current;
455
+ if (K) {
456
+ const t = Math.max(0.5, O - V);
457
+ for (let d = 0; d < Xe; d++) {
458
+ const f = V + (d * (t / Xe) + J * 3 * H * ue.speed) % t;
459
+ ce.position.set(f, 0, -0.9), ce.rotation.set(0, 0, 0), ce.scale.set(1, 1, 1), ce.updateMatrix(), K.setMatrixAt(d, ce.matrix);
460
+ }
461
+ K.instanceMatrix.needsUpdate = !0;
462
+ }
463
+ const F = !!(v != null && v.hasSteps);
464
+ let D = 0;
465
+ if (F && v) {
466
+ for (let t = 0; t < 3; t++) {
467
+ const d = vt(v, t);
468
+ _e[t] = De(Ke[t]), Ze[t] = d === "queued" ? 0 : d === "running" ? 1 : d === "done" ? 2 : 3;
469
+ }
470
+ D = 3;
471
+ } else
472
+ for (const t of Re.agents.values()) {
473
+ if (D >= 3) break;
474
+ t.run !== s || t.depth !== 0 || (_e[D] = t.eu, Ze[D] = t.inst.exitAt ? 2 : t.inst.status === "thinking" ? 1 : 4, D++);
475
+ }
476
+ let X = 0;
477
+ for (let t = 0; t < 3; t++) {
478
+ const d = l.current[t], f = a.current[t], T = u.current[t], L = h.current[t];
479
+ if (!d || !f || !T || !L || (d.visible = t < D, t >= D)) continue;
480
+ const j = Ze[t], Z = F ? `s${t}${j}` : "a" + j;
481
+ R.current[t] !== Z && (R.current[t] = Z, C.current[t] = k);
482
+ const N = Math.exp(-(k - C.current[t]) / 280), q = j === 1;
483
+ j === 0 ? ie.copy(n).multiplyScalar(0.32) : q ? ie.copy(n).lerp(Ne, 0.35).multiplyScalar(1.35 + Math.sin(J * 5) * 0.45 * H) : j === 2 ? ie.copy(F ? Xt : n).multiplyScalar(F ? 1.15 : 0.6) : j === 3 ? ie.copy($t).multiplyScalar(2.2) : ie.copy(n).multiplyScalar(0.7), ie.multiplyScalar((1 + N * 1.6) * U), d.position.set(_e[t], 0, -0.2), d.scale.setScalar(S * Math.max(1e-3, Math.min(1, (A - 0.2) * 1.6))), f.material.color.copy(ie), f.scale.setScalar(1 + N * 0.45 + (q ? Math.sin(J * 6) * 0.05 * H : 0)), T.visible = q, q && (T.rotation.z += P * 3.2 * Math.max(0.3, H));
484
+ const le = L.material;
485
+ le.opacity = (j === 0 ? 0.02 : q ? 0.1 + Math.sin(J * 5) * 0.04 : 0.04) * U, le.color.copy(ie), L.scale.setScalar(1 + N * 0.8), M.current[t] = (M.current[t] + P * (q ? 1.4 : 0.22) * H * ue.speed) % 1;
486
+ const pe = M.current[t], ae = j === 0 ? 0.35 : q ? 1.25 : 0.55;
487
+ for (let ee = 0; ee < $e; ee++) {
488
+ const W = (ee + 1 - pe) * qe, Fe = Math.min(1, W / qe), de = 1 - W / (($e + 1) * qe);
489
+ ce.position.set(_e[t], 0, -0.2 - W), ce.rotation.set(0, 0, 0), ce.scale.setScalar(Pe * S * (1 + W * 0.012)), ce.updateMatrix(), b.setMatrixAt(X, ce.matrix), ie.copy(n).lerp(Ne, q ? 0.25 : 0).multiplyScalar(ae * Fe * de * de * U), b.setColorAt(X, ie), X++;
490
+ }
491
+ }
492
+ b.count = X, b.instanceMatrix.needsUpdate = !0, b.instanceColor && (b.instanceColor.needsUpdate = !0);
493
+ const $ = c.current;
494
+ if ($) {
495
+ const t = v != null && v.handoffAt ? (k - v.handoffAt) / 950 : 2;
496
+ if ($.visible = F && t >= 0 && t < 1, $.visible && v) {
497
+ const d = De(Ke[v.handoffFrom]), f = De(Ke[v.handoffTo]);
498
+ $.position.set(d + (f - d) * Ve(t), 0, -0.4), $.scale.set((1 + 9 * Math.sin(Math.PI * t)) * S, S, S);
499
+ }
500
+ }
501
+ if ((Y = m.current) == null || Y.position.set(s.cu - s.hu, s.hv - s.cv + 0.45, 0), v && p.current) {
502
+ const t = v.stepOrder.filter((L) => v.steps[L] === "running"), d = v.stepOrder[v.stepOrder.length - 1], f = t.length ? `${t.join(" + ")} running` : d ? `${d} ${v.steps[d]}` : "", T = f + v.status;
503
+ T !== B.current && (B.current = T, p.current.setText(v.topic, v.status === "completed" ? "run complete" : v.hasSteps ? `hatchet · ${f}` : "running…")), p.current.setOpacity(U);
504
+ }
505
+ }), /* @__PURE__ */ G("group", { ref: o, children: [
506
+ [0, 1].map((g) => /* @__PURE__ */ r("mesh", { ref: (E) => void (i.current[g] = E), geometry: qt, material: I.rail }, g)),
507
+ /* @__PURE__ */ r("instancedMesh", { ref: y, args: [void 0, void 0, Xe], material: I.dash, frustumCulled: !1, children: /* @__PURE__ */ r("boxGeometry", { args: [0.9, 0.05, 0.05] }) }),
508
+ /* @__PURE__ */ r("primitive", { object: b }),
509
+ [0, 1, 2].map((g) => /* @__PURE__ */ G("group", { ref: (E) => void (l.current[g] = E), visible: !1, children: [
510
+ /* @__PURE__ */ G("mesh", { ref: (E) => void (a.current[g] = E), children: [
511
+ /* @__PURE__ */ r("torusGeometry", { args: [Pe, 0.075, 10, 64] }),
512
+ /* @__PURE__ */ r("meshBasicMaterial", { toneMapped: !1 })
513
+ ] }),
514
+ /* @__PURE__ */ G("mesh", { ref: (E) => void (u.current[g] = E), visible: !1, children: [
515
+ /* @__PURE__ */ r("torusGeometry", { args: [Pe * 1.23, 0.045, 6, 48, Math.PI * 0.7] }),
516
+ /* @__PURE__ */ r("meshBasicMaterial", { color: Ne.clone().multiplyScalar(1.8), toneMapped: !1 })
517
+ ] }),
518
+ /* @__PURE__ */ G("mesh", { ref: (E) => void (h.current[g] = E), children: [
519
+ /* @__PURE__ */ r("circleGeometry", { args: [Pe * 0.96, 48] }),
520
+ /* @__PURE__ */ r("meshBasicMaterial", { transparent: !0, opacity: 0.05, blending: e.AdditiveBlending, depthWrite: !1, toneMapped: !1, side: e.DoubleSide })
521
+ ] })
522
+ ] }, g)),
523
+ /* @__PURE__ */ G("mesh", { ref: c, visible: !1, children: [
524
+ /* @__PURE__ */ r("sphereGeometry", { args: [0.2, 16, 12] }),
525
+ /* @__PURE__ */ r("meshBasicMaterial", { color: _, toneMapped: !1 })
526
+ ] }),
527
+ /* @__PURE__ */ r("group", { ref: m, children: /* @__PURE__ */ r(Qe, { ref: p, text: "", secondary: "", anchorX: "left", anchorY: "bottom", textAlign: "left", color: s.color, letterSpacing: 0.02, size: 0.38, maxWidth: 14, pxRange: [10, 14] }) })
528
+ ] });
529
+ }
530
+ const Yt = new e.Color("#f59e0b"), Jt = new e.Color("#ef4444"), Ue = new e.Color("#ffffff"), Qt = (() => {
531
+ const n = new Float32Array(132);
532
+ for (let i = 0; i < 22; i++) {
533
+ const l = i / 22 * Math.PI * 2 + Math.random() * 0.2, a = (Math.random() - 0.5) * 2.4, u = Math.cos(l), h = Math.sin(l), c = 0.7 + Math.random() * 0.6;
534
+ n.set([u * 0.25, h * 0.25, a * 0.2, u * c, h * c, a * c], i * 6);
535
+ }
536
+ const o = new e.BufferGeometry();
537
+ return o.setAttribute("position", new e.BufferAttribute(n, 3)), o;
538
+ })(), at = new e.Euler(), fe = {
539
+ capsule: new e.CapsuleGeometry(0.36, 1.15, 6, 18),
540
+ fin: new e.BoxGeometry(0.05, 1.25, 0.5),
541
+ engine: new e.SphereGeometry(0.22, 16, 12),
542
+ halo: new e.PlaneGeometry(2.6, 2.6),
543
+ sel: new e.TorusGeometry(1.05, 0.035, 6, 48),
544
+ hit: new e.SphereGeometry(1.1, 10, 8),
545
+ flash: new e.SphereGeometry(0.45, 16, 12),
546
+ ring: new e.RingGeometry(0.85, 1, 48)
547
+ }, en = 0.78, tn = -0.62;
548
+ function nn({ agent: s, selected: n, onSelect: o }) {
549
+ const i = s.id, l = s.inst.type, a = x(() => new e.Color(et[l]), [l]), u = x(() => ({ color: a.clone(), energy: 0, active: 0, presence: 0, seed: Math.random() }), [a]);
550
+ Ye(() => (xe.set(i, u), () => {
551
+ xe.get(i) === u && xe.delete(i);
552
+ }), [i, u]);
553
+ const h = w(null), c = w(null), y = w(null), m = w(null), p = w(null), B = w(null), R = w(null), C = w(null), M = w(null), _ = w(null), b = w(null), I = w(null), g = x(() => new e.Color(), []), E = x(() => tt(), []), z = x(() => a.clone().lerp(Ue, 0.55), [a]);
554
+ return te(({ clock: P }, v) => {
555
+ const k = s.inst, J = h.current;
556
+ if (!J) return;
557
+ const S = Math.min(v, 0.1), A = performance.now(), U = P.elapsedTime, V = Ct(k, A), O = dt(k, A), K = (A - k.bornAt) / 1e3, F = k.status === "thinking" || k.status === "spawning";
558
+ let D = 0;
559
+ for (const W of Q.mcpPending.values()) W.instance === i && (D = Math.max(D, (A - W.since) / 1e3 + 0.01));
560
+ const X = !F && !k.exitAt, $ = We.scale;
561
+ if (!b.current) {
562
+ const W = k.parent ? he(k.parent) : void 0;
563
+ b.current = W ? W.clone() : s.pos.clone().setZ(-45);
564
+ }
565
+ const Y = b.current, t = Ve(K / 1.15), d = Math.sin(U * 1.1 + u.seed * 6) * 0.18 * H * $;
566
+ let f = Y.x + (s.pos.x - Y.x) * t, T = Y.y + (s.pos.y + d - Y.y) * t, L = Y.z + (s.pos.z - Y.z) * t, j = V, Z = V * (1 + 4 * (1 - t)), N = Math.max(0, 1 - K / 0.5) * 2.5, q = 0;
567
+ if (k.exitAt) {
568
+ if (q = (A - k.exitAt) / 1e3, I.current || (I.current = new e.Vector3(f, T, L)), f = I.current.x, T = I.current.y, L = I.current.z, k.status === "failed")
569
+ j *= Math.max(0, 1 - q * 1.3), Z = j;
570
+ else {
571
+ const W = Math.max(0, q - 0.18);
572
+ L -= (6 * W + 120 * W * W) * Math.max(0.3, H), Z = V * (1 + 34 * Math.min(1, W * 1.6)), j *= 1 - 0.55 * Math.min(1, W * 2);
573
+ }
574
+ N += Math.max(0, 1 - q / 0.5) * 4;
575
+ }
576
+ s.live.set(f, T, L);
577
+ const le = X ? (D ? 0.07 * Math.sin(U * 3.2) : 0.05 * Math.sin(U * 1.6)) * H : 0;
578
+ J.position.set(f, T, L), at.set(tn, 0, 0), J.quaternion.setFromEuler(at);
579
+ const pe = s.scale * en;
580
+ J.scale.set(j * (1 + le) * (n ? 1.15 : 1) * pe, j * (1 + le) * (n ? 1.15 : 1) * pe, Z * pe), c.current && (c.current.rotation.z += S * (F ? 5.5 : X ? 0.5 : 2) * (1 + O * 1.6) * Math.max(0.25, H));
581
+ const ae = y.current;
582
+ if (ae) {
583
+ const W = F ? 1.7 + Math.sin(U * 5) * 0.45 * H : X ? D ? 0.55 + 0.35 * Math.sin(U * 3.2) : 0.35 + 0.15 * Math.sin(U * 1.6) : 1.1;
584
+ ae.emissiveIntensity = W * 0.8 + O * 2.6 + N, D ? ae.emissive.copy(a).lerp(Yt, Math.min(0.55, D * 0.3)) : ae.emissive.copy(a), ae.opacity = Math.min(1, V * 1.4);
585
+ }
586
+ if (m.current) {
587
+ const W = (F ? 1 + Math.sin(U * 14) * 0.18 * H : X ? 0.55 : 0.85) + O * 1.3;
588
+ m.current.scale.setScalar(W), m.current.material.color.copy(z).multiplyScalar((X ? 0.8 : 1.9) + O * 2.5 + N);
589
+ }
590
+ if (p.current) {
591
+ const W = p.current.material;
592
+ W.opacity = Math.min(1, ((X ? 0.1 : 0.24) + O * 0.25 + N * 0.06) * V), p.current.scale.setScalar(1 + O * 0.8);
593
+ }
594
+ B.current && (B.current.visible = n, B.current.rotation.z -= S * 1.5), u.energy = O, u.active = F ? 1 : X ? 0.2 : 0.6, u.presence = k.exitAt ? V * Math.max(0, 1 - q * 2) : V;
595
+ const ee = R.current;
596
+ if (ee) {
597
+ const W = K / 0.9, Fe = k.exitAt ? q / 0.7 : 2, de = W < 1 ? W : Fe;
598
+ if (ee.visible = de < 1, ee.visible) {
599
+ W < 1 ? ee.position.copy(Y) : I.current && ee.position.copy(I.current);
600
+ const be = 1 - de;
601
+ ee.scale.setScalar((0.35 + de * 1.9) * $), g.copy(W < 1 ? a : k.status === "failed" ? Jt : Ue).lerp(Ue, 0.3).multiplyScalar(2.4 * be), C.current.material.color.copy(g), C.current.material.opacity = be * be, M.current.material.color.copy(g), M.current.material.opacity = be, _.current.material.color.copy(g), _.current.material.opacity = be, _.current.scale.set(1 + de * 1.5, 1 + de * 1.5, 1 + de * 4);
602
+ }
603
+ }
604
+ }), /* @__PURE__ */ G(Ee, { children: [
605
+ /* @__PURE__ */ G("group", { ref: h, position: [0, 0, -200], children: [
606
+ /* @__PURE__ */ G("group", { ref: c, children: [
607
+ /* @__PURE__ */ r("mesh", { geometry: fe.capsule, rotation: [Math.PI / 2, 0, 0], children: /* @__PURE__ */ r("meshStandardMaterial", { ref: y, color: a.clone().multiplyScalar(0.35), emissive: a, emissiveIntensity: 1, metalness: 0.5, roughness: 0.3, toneMapped: !1, transparent: !0 }) }),
608
+ [0, 1, 2].map((P) => /* @__PURE__ */ r("mesh", { geometry: fe.fin, rotation: [0, 0, P * Math.PI * 2 / 3], position: [0, 0, 0.45], children: /* @__PURE__ */ r("meshBasicMaterial", { color: a.clone().lerp(Ue, 0.3).multiplyScalar(1.6), toneMapped: !1 }) }, P))
609
+ ] }),
610
+ /* @__PURE__ */ r("mesh", { geometry: fe.engine, ref: m, position: [0, 0, 0.95], children: /* @__PURE__ */ r("meshBasicMaterial", { toneMapped: !1 }) }),
611
+ /* @__PURE__ */ r("mesh", { geometry: fe.halo, ref: p, position: [0, 0, 0.6], children: /* @__PURE__ */ r("meshBasicMaterial", { map: E, color: a.clone().multiplyScalar(1.6), transparent: !0, blending: e.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) }),
612
+ /* @__PURE__ */ r("mesh", { geometry: fe.sel, ref: B, visible: !1, children: /* @__PURE__ */ r("meshBasicMaterial", { color: new e.Color(3, 3, 3), toneMapped: !1 }) }),
613
+ /* @__PURE__ */ r(
614
+ "mesh",
615
+ {
616
+ geometry: fe.hit,
617
+ onClick: (P) => (P.stopPropagation(), o(i)),
618
+ onPointerOver: () => document.body.style.cursor = "pointer",
619
+ onPointerOut: () => document.body.style.cursor = "",
620
+ children: /* @__PURE__ */ r("meshBasicMaterial", { transparent: !0, opacity: 0, depthWrite: !1, colorWrite: !1 })
621
+ }
622
+ )
623
+ ] }),
624
+ /* @__PURE__ */ G("group", { ref: R, visible: !1, children: [
625
+ /* @__PURE__ */ r("mesh", { geometry: fe.flash, ref: C, children: /* @__PURE__ */ r("meshBasicMaterial", { transparent: !0, blending: e.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) }),
626
+ /* @__PURE__ */ r("mesh", { geometry: fe.ring, ref: M, children: /* @__PURE__ */ r("meshBasicMaterial", { transparent: !0, blending: e.AdditiveBlending, depthWrite: !1, toneMapped: !1, side: e.DoubleSide }) }),
627
+ /* @__PURE__ */ r("lineSegments", { ref: _, geometry: Qt, children: /* @__PURE__ */ r("lineBasicMaterial", { transparent: !0, blending: e.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) })
628
+ ] })
629
+ ] });
630
+ }
631
+ function on() {
632
+ const o = w(null), i = x(() => new e.Object3D(), []), l = x(() => new e.Color(), []);
633
+ return te(({ clock: a }) => {
634
+ const u = o.current;
635
+ if (!u) return;
636
+ const h = a.elapsedTime * Math.max(0.2, H), c = We.scale;
637
+ let y = 0;
638
+ for (const m of Re.agents.values()) {
639
+ if (y + 9 > 576) break;
640
+ const p = xe.get(m.id);
641
+ if (!p || p.presence <= 0.01) continue;
642
+ const B = m.live, R = m.scale * 0.75, C = 0.6 + p.active * 1.4 + p.energy * 1.5;
643
+ for (let M = 0; M < 9; M++) {
644
+ const _ = (h * C + M / 9 + p.seed * 7) % 1, b = p.seed * 40 + M * 2.39996, I = (0.25 + 0.55 * ((M * 0.618 + p.seed) % 1)) * R, g = (0.5 + p.active * 0.9 + p.energy * 2.6) * c;
645
+ i.position.set(B.x + Math.cos(b) * I, B.y + Math.sin(b) * I + 0.35 * R, B.z + (1 + _ * (2.5 + p.energy * 4)) * c), i.scale.set(0.035 * c, 0.035 * c, g), i.updateMatrix(), u.setMatrixAt(y, i.matrix), l.copy(p.color).multiplyScalar((0.25 + p.active * 0.9 + p.energy * 2.2) * (1 - _) * p.presence), u.setColorAt(y, l), y++;
646
+ }
647
+ }
648
+ u.count = y, u.instanceMatrix.needsUpdate = !0, u.instanceColor && (u.instanceColor.needsUpdate = !0);
649
+ }), /* @__PURE__ */ G("instancedMesh", { ref: o, args: [void 0, void 0, 576], frustumCulled: !1, children: [
650
+ /* @__PURE__ */ r("boxGeometry", { args: [1, 1, 1] }),
651
+ /* @__PURE__ */ r("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: e.AdditiveBlending, depthWrite: !1 })
652
+ ] });
653
+ }
654
+ const ve = 14, ct = 64, rn = new e.CylinderGeometry(1, 1, 1, 6, 1, !0), sn = new e.Vector3(0, 1, 0), Ce = new e.Vector3(), ye = new e.Vector3(), He = new e.Vector3(), Be = new e.Object3D();
655
+ function it(s, n, o, i, l, a) {
656
+ const u = 1 - l, h = u * u * u, c = 3 * u * u * l, y = 3 * u * l * l, m = l * l * l;
657
+ return a.copy(s).multiplyScalar(h + c).addScaledVector(n, y + m), a.addScaledVector(o, i * (c - 0.3 * y)), a;
658
+ }
659
+ function an() {
660
+ const s = x(() => {
661
+ const o = new e.InstancedMesh(rn, new e.MeshBasicMaterial({ toneMapped: !1, transparent: !0, blending: e.AdditiveBlending, depthWrite: !1 }), ct * ve);
662
+ return o.frustumCulled = !1, o.setColorAt(0, new e.Color(0, 0, 0)), o.count = 0, o;
663
+ }, []), n = x(() => new e.Color(), []);
664
+ return te(() => {
665
+ const o = performance.now(), i = We.scale;
666
+ let l = 0;
667
+ for (const a of Re.agents.values()) {
668
+ if (l + ve > ct * ve) break;
669
+ const u = a.inst.parent;
670
+ if (!u) continue;
671
+ const h = he(u);
672
+ if (!h) continue;
673
+ const c = a.inst, y = Ve((o - c.bornAt) / 1300), m = c.exitAt ? Math.max(0, 1 - (o - c.exitAt) / 700) : 1;
674
+ if (m <= 0) continue;
675
+ const p = dt(c, o);
676
+ n.copy(cn[c.type]).multiplyScalar((1.2 + p * 2 + (c.status === "thinking" ? 0.6 : 0)) * m * 0.8);
677
+ const B = Math.max(1.2, Math.abs(a.live.x - h.x) * 0.9), R = Math.max(1, Math.round(ve * y));
678
+ it(h, a.live, a.run.side, B, 0, Ce);
679
+ for (let C = 1; C <= R; C++) {
680
+ it(h, a.live, a.run.side, B, C / ve, ye), Ce.z -= 0.6 * i, ye.z -= 0.6 * i, He.subVectors(ye, Ce);
681
+ const M = He.length();
682
+ Be.position.copy(Ce).add(ye).multiplyScalar(0.5), M > 1e-5 && Be.quaternion.setFromUnitVectors(sn, He.divideScalar(M)), Be.scale.set(0.05 * i, Math.max(1e-4, M), 0.05 * i), Be.updateMatrix(), s.setMatrixAt(l, Be.matrix), s.setColorAt(l, n), l++, Ce.copy(ye).setZ(ye.z + 0.6 * i);
683
+ }
684
+ }
685
+ s.count = l, s.instanceMatrix.needsUpdate = !0, s.instanceColor && (s.instanceColor.needsUpdate = !0);
686
+ }), /* @__PURE__ */ r("primitive", { object: s });
687
+ }
688
+ const cn = Object.fromEntries(Object.entries(et).map(([s, n]) => [s, new e.Color(n)])), ln = new e.Vector2(9e-4, 6e-4), dn = new e.Vector2(), un = new e.Vector3();
689
+ function pn(s) {
690
+ for (const n of Re.runs.values()) s(Gt(n, n.cu - n.hu + 2.5, n.cv - n.hv - 1, un), 1.6);
691
+ }
692
+ const fn = /* @__PURE__ */ G(Ee, { children: [
693
+ /* @__PURE__ */ r("fog", { attach: "fog", args: ["#02030a", 45, 190] }),
694
+ /* @__PURE__ */ r("ambientLight", { intensity: 0.35 }),
695
+ /* @__PURE__ */ r("directionalLight", { position: [0, 4, 10], intensity: 1.2, color: "#c7d2fe" }),
696
+ /* @__PURE__ */ r(It, {}),
697
+ /* @__PURE__ */ G(Et, { children: [
698
+ /* @__PURE__ */ r(Rt, {}),
699
+ /* @__PURE__ */ r(Pt, {}),
700
+ /* @__PURE__ */ r(Ot, {})
701
+ ] })
702
+ ] });
703
+ function wn() {
704
+ const [s, n] = yt(!1);
705
+ return Ye(() => {
706
+ ue.paused = s;
707
+ }, [s]), Ye(() => {
708
+ const o = (i) => {
709
+ i.code === "Space" && !(i.target instanceof HTMLInputElement) && (i.preventDefault(), n((l) => !l));
710
+ };
711
+ return window.addEventListener("keydown", o), () => window.removeEventListener("keydown", o);
712
+ }, []), /* @__PURE__ */ G(
713
+ Bt,
714
+ {
715
+ title: "tunnel",
716
+ subtitle: "time warp · runs are lanes with hatchet gates · ships = agents · star shell = falkordb · stations = mcp",
717
+ preset: "lanes",
718
+ plane: "xy",
719
+ camera: { position: [0, 0, 24], fov: 62, far: 400 },
720
+ controls: { minPolarAngle: Math.PI * 0.36, maxPolarAngle: Math.PI * 0.64, minAzimuthAngle: -0.45, maxAzimuthAngle: 0.45 },
721
+ bg: "#02030a",
722
+ fit: { nRef: 4, min: 0.62, max: 1.5, minRadius: 5.5 },
723
+ agentRadius: 1.15,
724
+ graph: { natural: pt, radius: 3 },
725
+ peripheryGap: 4.2,
726
+ Background: fn,
727
+ Agent: nn,
728
+ RunMarker: Ht,
729
+ McpServer: Kt,
730
+ GraphResource: Ut,
731
+ cluster: { radius: 0.95, variant: "swarm", glowGain: 1.1, labelBelow: 1.1 },
732
+ extents: pn,
733
+ PostFX: /* @__PURE__ */ G(ft, { multisampling: 0, children: [
734
+ /* @__PURE__ */ r(ht, { mipmapBlur: !0, intensity: 1.25, luminanceThreshold: 0.2, luminanceSmoothing: 0.25, radius: 0.72 }),
735
+ /* @__PURE__ */ r(mt, { offset: ke ? dn : ln, radialModulation: !0, modulationOffset: 0.25 }),
736
+ /* @__PURE__ */ r(Mt, { eskil: !1, offset: 0.22, darkness: 0.9 }),
737
+ /* @__PURE__ */ r(gt, { opacity: 0.03 })
738
+ ] }),
739
+ hudInset: /* @__PURE__ */ r("button", { className: "hud tunnel-pause", onClick: () => n((o) => !o), title: "Space", children: s ? "▶ resume warp" : "❚❚ pause warp" }),
740
+ children: [
741
+ /* @__PURE__ */ r(an, {}),
742
+ /* @__PURE__ */ r(on, {}),
743
+ /* @__PURE__ */ r(Lt, {}),
744
+ /* @__PURE__ */ r(Nt, {})
745
+ ]
746
+ }
747
+ );
748
+ }
749
+ export {
750
+ wn as default
751
+ };