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
@@ -1,796 +0,0 @@
1
- var lt = Object.defineProperty;
2
- var ut = (e, t, n) => t in e ? lt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var te = (e, t, n) => ut(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { jsx as u, Fragment as ie, jsxs as D } from "react/jsx-runtime";
5
- import { Stars as pt, OrbitControls as ft } from "@react-three/drei";
6
- import { useFrame as Z, useThree as dt, Canvas as mt } from "@react-three/fiber";
7
- import { EffectComposer as ht, Bloom as gt, Vignette as wt } from "@react-three/postprocessing";
8
- import { useState as de, useRef as V, useMemo as M, useEffect as vt } from "react";
9
- import { T as tt, j as yt, w as T, h as ye, C as bt, l as we, i as He, p as St, e as Mt, r as $e, b as Ct, s as At, L as Ae, a as xt, K as Vt, G as Pt, n as Tt, d as Rt, R as zt, u as kt, k as Ot, c as Bt, f as Gt, H as Et, t as Ft, g as _t } from "./ClusterBall-CPsd6JvJ.js";
10
- import * as o from "three";
11
- import { a as It } from "./spread-CWdeDFd9.js";
12
- var et;
13
- const fe = typeof window < "u" && !!((et = window.matchMedia) != null && et.call(window, "(prefers-reduced-motion: reduce)").matches), ee = (e) => e < 0 ? 0 : e > 1 ? 1 : e, De = (e) => 1 - Math.pow(1 - ee(e), 3), xe = (e) => (e = ee(e), e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2), Lt = (e) => {
14
- e = ee(e);
15
- const t = 2.2;
16
- return 1 + (t + 1) * Math.pow(e - 1, 3) + t * Math.pow(e - 1, 2);
17
- }, Fe = Object.fromEntries(Object.entries(tt).map(([e, t]) => [e, new o.Color(t)])), Me = (e) => e === "graph_scout" || e === "records_scout" || e === "data_scout";
18
- let ze = null;
19
- function jt() {
20
- if (ze) return ze;
21
- const e = document.createElement("canvas");
22
- e.width = e.height = 128;
23
- const t = e.getContext("2d"), n = t.createRadialGradient(64, 64, 0, 64, 64, 64);
24
- return n.addColorStop(0, "rgba(255,255,255,1)"), n.addColorStop(0.15, "rgba(255,255,255,0.6)"), n.addColorStop(0.45, "rgba(255,255,255,0.14)"), n.addColorStop(1, "rgba(255,255,255,0)"), t.fillStyle = n, t.fillRect(0, 0, 128, 128), ze = new o.CanvasTexture(e), ze;
25
- }
26
- function le(e = "#fff") {
27
- return new o.SpriteMaterial({ map: jt(), color: e, blending: o.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1 });
28
- }
29
- function ae(e = "#fff") {
30
- return new o.MeshBasicMaterial({ color: e, blending: o.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1 });
31
- }
32
- function Kt(e = 64, t = 7) {
33
- const n = [], r = [];
34
- for (let a = 0; a <= e; a++) {
35
- const c = a / e;
36
- for (let l = 0; l < t; l++) {
37
- const m = l / t * Math.PI * 2;
38
- n.push(c, Math.cos(m), Math.sin(m));
39
- }
40
- }
41
- for (let a = 0; a < e; a++)
42
- for (let c = 0; c < t; c++) {
43
- const l = a * t + c, m = a * t + (c + 1) % t, d = (a + 1) * t + c, y = (a + 1) * t + (c + 1) % t;
44
- r.push(l, d, m, m, d, y);
45
- }
46
- const s = new o.BufferGeometry();
47
- return s.setAttribute("position", new o.Float32BufferAttribute(n, 3)), s.setIndex(r), s.boundingSphere = new o.Sphere(new o.Vector3(), 1e4), s;
48
- }
49
- const ot = Kt(), _e = new o.SphereGeometry(1, 32, 24);
50
- new o.SphereGeometry(1, 40, 28);
51
- new o.IcosahedronGeometry(1, 1);
52
- const Ne = new o.ConeGeometry(1, 1, 14).translate(0, 0.5, 0), Ut = new o.ConeGeometry(1, 1, 6, 1, !0).translate(0, 0.5, 0), Wt = (
53
- /* glsl */
54
- `
55
- uniform vec3 uP0; uniform vec3 uP1; uniform vec3 uP2; uniform float uRadius; uniform float uTaper;
56
- varying float vT; varying float vRim;
57
- void main(){
58
- float t = position.x; float a = 1.0 - t;
59
- vec3 p = a*a*uP0 + 2.0*a*t*uP1 + t*t*uP2;
60
- vec3 tg = 2.0*a*(uP1-uP0) + 2.0*t*(uP2-uP1);
61
- tg = length(tg) > 1e-5 ? normalize(tg) : vec3(1.0,0.0,0.0);
62
- vec3 up = abs(tg.y) > 0.92 ? vec3(1.0,0.0,0.0) : vec3(0.0,1.0,0.0);
63
- vec3 n = normalize(cross(tg, up)); vec3 b = cross(tg, n);
64
- vec3 off = n*position.y + b*position.z;
65
- vec4 mv = modelViewMatrix * vec4(p + off * uRadius * mix(1.0, uTaper, t), 1.0);
66
- vec3 vn = normalize(normalMatrix * off);
67
- vRim = abs(dot(vn, normalize(-mv.xyz)));
68
- vT = t;
69
- gl_Position = projectionMatrix * mv;
70
- }`
71
- ), Ht = (
72
- /* glsl */
73
- `
74
- uniform vec3 uColor; uniform float uOpacity; uniform float uGrow; uniform float uTime; uniform float uSpark; uniform float uFlow;
75
- uniform float uHead; uniform float uTail; uniform vec3 uHeadColor;
76
- varying float vT; varying float vRim;
77
- void main(){
78
- if (vT > uGrow) discard;
79
- float core = 0.25 + 0.75 * vRim * vRim;
80
- float tip = smoothstep(uGrow - 0.1, uGrow, vT) * step(uGrow, 0.995);
81
- float spark = uSpark * pow(max(0.0, sin(vT * 16.0 - uTime * 10.0)), 14.0);
82
- float head = 0.0;
83
- if (uHead >= 0.0) {
84
- float d = vT - uHead;
85
- head = d > 0.0 ? exp(-d * d / 0.0006) : exp(d / max(uTail, 0.001));
86
- }
87
- // directional flow: soft dashes travelling from start (parent, vT=0) to end (child, vT=1)
88
- float flow = uFlow * pow(max(0.0, sin((vT * 7.0 - uTime * 0.9) * 3.14159)), 6.0);
89
- vec3 col = uColor * uOpacity * (core + spark * 3.5 + tip * 3.0 + flow * 2.2) + uHeadColor * head * (0.6 + vRim);
90
- gl_FragColor = vec4(col, 1.0);
91
- }`
92
- );
93
- function nt(e = "#fff", t = 0.06, n = 0.4) {
94
- return new o.ShaderMaterial({
95
- uniforms: {
96
- uP0: { value: new o.Vector3() },
97
- uP1: { value: new o.Vector3() },
98
- uP2: { value: new o.Vector3() },
99
- uRadius: { value: t },
100
- uTaper: { value: n },
101
- uColor: { value: new o.Color(e) },
102
- uOpacity: { value: 1 },
103
- uGrow: { value: 1 },
104
- uTime: { value: 0 },
105
- uFlow: { value: 0 },
106
- uSpark: { value: 0 },
107
- uHead: { value: -1 },
108
- uTail: { value: 0.12 },
109
- uHeadColor: { value: new o.Color(4, 4, 4) }
110
- },
111
- vertexShader: Wt,
112
- fragmentShader: Ht,
113
- transparent: !0,
114
- depthWrite: !1,
115
- blending: o.AdditiveBlending
116
- });
117
- }
118
- function oe(e, t, n, r, s) {
119
- const a = 1 - r;
120
- return s.set(a * a * e.x + 2 * a * r * t.x + r * r * n.x, a * a * e.y + 2 * a * r * t.y + r * r * n.y, a * a * e.z + 2 * a * r * t.z + r * r * n.z);
121
- }
122
- function je(e, t, n, r) {
123
- r.copy(e).add(t).multiplyScalar(0.5);
124
- const s = Math.hypot(r.x, r.y) || 1;
125
- return r.x += r.x / s * n, r.y += r.y / s * n, r.z += n * 0.9, r;
126
- }
127
- function me(e, t, n, r, s, a, c, l) {
128
- const m = new o.Vector3(e, t, 0).normalize(), d = new o.Vector3(n, r, 0).normalize(), y = d.clone().multiplyScalar(0.62).add(new o.Vector3(0, 0, 0.78)).normalize();
129
- return { dir: m, tan: d, fan: y, gangR: s, somaR: a, spread: c, fanLen: l };
130
- }
131
- const ke = [
132
- me(-1, 0, 0, -1, 13.2, 8, 2.9, 3),
133
- me(1, 0, 0, -1, 13.2, 8, 2.9, 3),
134
- me(0, 1, 1, 0, 8.5, 5.5, 3.9, 1.9),
135
- me(0, -1, 1, 0, 9.3, 5.7, 3.9, 2.2),
136
- me(-0.82, 0.57, 0.57, 0.82, 11.5, 7.2, 2.6, 2.5),
137
- me(0.82, -0.57, 0.57, 0.82, 11.5, 7.2, 2.6, 2.5)
138
- ], Ve = (e) => ke[(e % ke.length + ke.length) % ke.length];
139
- function Dt(e, t, n) {
140
- const r = Ve(e);
141
- return n.copy(r.dir).multiplyScalar(r.somaR), t === "planner" ? (n.addScaledVector(r.tan, -r.spread * 0.9).addScaledVector(r.dir, 0.4), n.z = 0.5) : t === "writer" && (n.addScaledVector(r.tan, r.spread * 0.9).addScaledVector(r.dir, 0.4), n.z = 0.5), n;
142
- }
143
- const Nt = new o.Vector3(), qt = 3.8;
144
- function rt(e) {
145
- return It(yt(e)) * qt;
146
- }
147
- function $t(e, t) {
148
- const n = T.runs.get(e.run), r = n ? n.slot : 0, s = Ve(r);
149
- Dt(r, e.type, t);
150
- const a = rt(e.run);
151
- if (a && t.addScaledVector(s.tan, a), Me(e.type)) {
152
- let c = 0, l = 0;
153
- for (const w of T.instances.values())
154
- w.run !== e.run || !Me(w.type) || (c++, w.index < e.index && l++);
155
- const m = (ye(e.run, 1) - 0.5) * 0.9, d = (c <= 1 ? 0 : (-1 + 2 * l / (c - 1)) * 1.1) + m, y = s.fanLen * (0.85 + 0.35 * ye(e.id, 2));
156
- t.addScaledVector(s.dir, Math.cos(d) * y + 0.4).addScaledVector(s.fan, Math.sin(d) * y);
157
- } else {
158
- let c = 0;
159
- for (const l of T.instances.values()) l.run === e.run && l.type === e.type && l.index < e.index && c++;
160
- c && t.addScaledVector(s.fan, (c % 2 ? 1 : -1) * Math.ceil(c / 2) * 1.6);
161
- }
162
- return t.add(Nt.set(ye(e.id, 3) - 0.5, ye(e.id, 4) - 0.5, ye(e.id, 5) - 0.5).multiplyScalar(0.9));
163
- }
164
- const se = /* @__PURE__ */ new Map(), Ke = [
165
- [-11.8, 7, -2],
166
- [11.8, 7, -2],
167
- [-11.8, -5.8, -2],
168
- [11.8, -5.8, -2],
169
- [0, -9, -2.5],
170
- [0, 9.6, -3],
171
- [-14, 6.5, -4],
172
- [14, -6.5, -4]
173
- ];
174
- function Pe(e, t) {
175
- const n = Ke[e % Ke.length], r = Math.floor(e / Ke.length);
176
- return t.set(n[0] * (1 + r * 0.15), n[1] * (1 + r * 0.15), n[2] - r * 3);
177
- }
178
- function Xt(e, t, n, r) {
179
- return Pe(e, r), Math.abs(r.x) < 1 ? (r.x += (t - (n - 1) / 2) * 3.4, r.y += Math.sign(r.y || 1) * 1) : (r.x += Math.sign(r.x) * 3.3, r.y += (t - (n - 1) / 2) * 2.1), r.z -= 0.4, r;
180
- }
181
- function Xe(e, t, n) {
182
- return e.r += t.r * n, e.g += t.g * n, e.b += t.b * n, e;
183
- }
184
- const Le = class Le {
185
- constructor(t) {
186
- te(this, "mesh");
187
- te(this, "colors");
188
- te(this, "n", 0);
189
- te(this, "max");
190
- te(this, "o", new o.Object3D());
191
- te(this, "a", new o.Vector3());
192
- te(this, "b", new o.Vector3());
193
- te(this, "d", new o.Vector3());
194
- this.max = t, this.colors = new Float32Array(t * 3), this.mesh = new o.InstancedMesh(Ne, new o.MeshBasicMaterial({ blending: o.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1 }), t), this.mesh.instanceColor = new o.InstancedBufferAttribute(this.colors, 3), this.mesh.frustumCulled = !1, this.mesh.count = 0;
195
- }
196
- begin() {
197
- this.n = 0;
198
- }
199
- /** Arrow at curve parameter t, pointing toward p2 (dir=+1) or toward p0 (dir=-1). */
200
- add(t, n, r, s, a, c, l, m = 1) {
201
- this.n >= this.max || (oe(t, n, r, s, this.a), oe(t, n, r, Math.min(1, Math.max(0, s + 0.02 * a)), this.b), this.d.subVectors(this.b, this.a), !(this.d.lengthSq() < 1e-8) && (this.o.position.copy(this.a), this.o.quaternion.setFromUnitVectors(Le.UP, this.d.normalize()), this.o.scale.set(c * 0.4, c, c * 0.4), this.o.updateMatrix(), this.mesh.setMatrixAt(this.n, this.o.matrix), this.colors[this.n * 3] = l.r * m, this.colors[this.n * 3 + 1] = l.g * m, this.colors[this.n * 3 + 2] = l.b * m, this.n++));
202
- }
203
- end() {
204
- this.mesh.count = this.n, this.mesh.instanceMatrix.needsUpdate = !0, this.mesh.instanceColor && (this.mesh.instanceColor.needsUpdate = !0);
205
- }
206
- };
207
- te(Le, "UP", new o.Vector3(0, 1, 0));
208
- let Ie = Le;
209
- const Ue = new o.Vector3(), Oe = new o.Vector3(), Yt = new o.Vector3(0, 1, 0);
210
- function Ye(e, t, n, r, s, a, c) {
211
- oe(t, n, r, s, Ue), oe(t, n, r, Math.min(1, Math.max(0, s + 0.02 * a)), Oe), e.position.copy(Ue), Oe.sub(Ue), Oe.lengthSq() > 1e-8 && e.quaternion.setFromUnitVectors(Yt, Oe.normalize()), e.scale.set(c * 0.4, c, c * 0.4);
212
- }
213
- const Zt = [
214
- [-12.5, -3.8, -1],
215
- [11.3, -3.4, -1.5],
216
- [10, 10.2, -3],
217
- [4.5, -10, -1],
218
- [-10.5, 7.3, -1],
219
- [10.5, -7.5, -1]
220
- ];
221
- function Qt(e, t) {
222
- if (we.laneExpanded[e]) return t.fromArray(Zt[e]);
223
- const n = Ve(e);
224
- return t.copy(n.dir).multiplyScalar(n.somaR + n.fanLen * 0.35 + (e === 2 ? 1.3 : 0)).setZ(-0.4);
225
- }
226
- function Jt() {
227
- return /* @__PURE__ */ u(bt, { place: Qt, radius: 1.45, variant: "orb" });
228
- }
229
- const eo = new o.Color("#4b4a63"), Ze = new o.Color("#fbbf24"), Ce = /* @__PURE__ */ new Map();
230
- function to(e) {
231
- const t = [], n = new o.Vector3(0, 1, 0), r = 10;
232
- for (let s = 0; s < r; s++) {
233
- const a = 1 - 2 * (s + 0.5) / r, c = Math.sqrt(1 - a * a), l = s * 2.39996 + e * 6.28;
234
- t.push(new o.Quaternion().setFromUnitVectors(n, new o.Vector3(Math.cos(l) * c, a, Math.sin(l) * c)));
235
- }
236
- return t;
237
- }
238
- const oo = new o.TorusGeometry(1.25, 0.05, 8, 64);
239
- function no({ inst: e, onSelect: t }) {
240
- const n = V(null), r = V(null), s = V(null), a = V(null), c = V(null), l = V(null), m = V(null), d = M(() => [...e.id].reduce((v, h) => (v * 31 + h.charCodeAt(0)) % 9973, 7) / 9973, [e.id]), y = M(() => to(d), [d]), w = Fe[e.type], C = M(
241
- () => ({
242
- core: ae(w),
243
- hot: ae("#ffffff"),
244
- spike: ae(w),
245
- ring: ae(Ze),
246
- halo: le(w),
247
- syn: nt(w, Me(e.type) ? 0.08 : 0.11, 0.8),
248
- arrow: ae(w)
249
- }),
250
- [w, e.type]
251
- ), i = M(
252
- () => ({ pos: new o.Vector3(), target: new o.Vector3(), live: new o.Vector3(), p0: new o.Vector3(), p1: new o.Vector3(), seedP: new o.Vector3(), init: !1, p0set: !1, labelK: 1, spik: 0, ringK: 0, parentK: 1, c: new o.Color() }),
253
- []
254
- );
255
- vt(() => (se.set(e.id, i.live), Ce.set(e.id, i.p1), () => {
256
- se.get(e.id) === i.live && se.delete(e.id), Ce.get(e.id) === i.p1 && Ce.delete(e.id);
257
- }), [e.id, i]), Z(({ clock: v }) => {
258
- var G, H;
259
- const h = performance.now(), k = v.elapsedTime;
260
- $t(e, i.target), i.init ? i.pos.lerp(i.target, 0.04) : (i.pos.copy(i.target), i.init = !0);
261
- const I = fe ? 0 : 0.08;
262
- i.live.set(i.pos.x + Math.sin(k * 0.35 + d * 20) * I, i.pos.y + Math.cos(k * 0.3 + d * 13) * I, i.pos.z);
263
- const N = e.parent ? T.instances.get(e.parent) : void 0, B = e.parent ? se.get(e.parent) : void 0;
264
- if (B ? (i.p0.copy(B), i.p0set = !0) : i.p0set || (i.p0.copy(i.live), i.p0set = !0), Me(e.type)) {
265
- const z = T.runs.get(e.run);
266
- i.p1.copy(i.p0).addScaledVector(Ve(z ? z.slot : 0).dir, 1.7);
267
- } else je(i.p0, i.live, 0.6, i.p1);
268
- const U = (h - e.bornAt) / 1e3, f = e.parent ? De(U / 0.9) : 1, E = Lt((U - (e.parent ? 0.85 : 0.1)) / 0.7), R = e.exitAt ? (h - e.exitAt) / 1e3 : -1, j = xt(e) / 1e3, A = R >= 0 ? ee(R / (j * 0.92)) : 0, $ = St(e, h);
269
- let x = !1;
270
- for (const z of T.mcpPending.values()) z.instance === e.id && (x = !0);
271
- const F = R < 0 && (e.status === "thinking" || e.status === "spawning"), X = Mt(e, h), W = fe ? 0 : 1, g = 0.5 + 0.5 * Math.sin(k * 2 + d * 9) * W, P = 0.5 + 0.5 * Math.sin(k * 1 + d * 5) * W;
272
- i.spik += ((F ? 1 : 0) - i.spik) * 0.06, i.ringK += ((x && R < 0 ? 1 : 0) - i.ringK) * 0.08, n.current && (f < 1 ? n.current.position.copy(oe(i.p0, i.p1, i.live, f, i.seedP)) : n.current.position.copy(i.live));
273
- const L = f < 1 ? 0.18 : 0, K = Math.max(L, 0.18 + 0.82 * E) * (1 - A * A * 0.95) * $e(e) * Ct();
274
- (G = r.current) == null || G.scale.setScalar(Math.max(1e-4, K * (0.55 + X * 0.06 + (F ? g * 0.05 : P * 0.04)))), (H = s.current) == null || H.scale.setScalar(Math.max(1e-4, i.spik * (0.85 + g * 0.15)));
275
- const Q = F ? 0.75 + g * 0.35 : 0.3 + P * 0.15;
276
- if (i.c.copy(w).multiplyScalar(Q + X * 0.35), R >= 0 && i.c.lerp(eo, A).multiplyScalar(1 - A * 0.75), C.core.color.copy(i.c), C.spike.color.copy(i.c).multiplyScalar(0.9), C.hot.color.setScalar((F ? 0.35 + g * 0.25 : 0.08) * (1 - A) + X * 0.2), a.current && (a.current.visible = i.ringK > 0.02, a.current.rotation.z = k * 0.9, a.current.rotation.x = 1.1 + Math.sin(k * 0.5) * 0.2, a.current.scale.setScalar(Math.max(1e-4, K * 0.55 * i.ringK)), C.ring.color.copy(Ze).multiplyScalar(0.9 * i.ringK * (0.75 + P * 0.25))), l.current && (l.current.scale.setScalar(Math.max(1e-4, K * (F ? 2.3 + g * 0.3 : 1.6) + X * 0.35)), C.halo.color.copy(w).multiplyScalar((F ? 0.22 : 0.09) * (1 - A) + X * 0.06)), m.current) {
277
- const z = At(e.id);
278
- i.labelK += ((z ? 1 : 0) - i.labelK) * 0.12, m.current.setOpacity(ee(E) * (1 - A) * 0.95 * i.labelK);
279
- }
280
- const _ = !!N && !N.exitAt;
281
- i.parentK += ((e.parent && !e.exitAt && _ ? 1 : 0) - i.parentK) * (_ ? 0.05 : 0.035);
282
- const p = C.syn.uniforms;
283
- p.uP0.value.copy(i.p0), p.uP1.value.copy(i.p1), p.uP2.value.copy(i.live);
284
- const b = R >= 0 ? xe(R / (j * 0.64)) : 0;
285
- if (p.uGrow.value = e.parent ? f * (1 - b) : 0, p.uSpark.value = 0, p.uHead.value = f < 1 ? f : -1, p.uTail.value = 0.1, p.uHeadColor.value.copy(w).multiplyScalar(1.5), p.uOpacity.value = (F ? 1.1 : 0.75) * Math.max(0, Math.min(i.parentK, $ > 0 ? 1 : 0)) + (f < 1 ? 0.4 : 0), p.uTime.value = fe ? 0 : k, p.uFlow.value = f >= 1 ? i.parentK : 0, c.current) {
286
- const z = e.parent && f >= 1 && i.parentK > 0.05 && p.uGrow.value > 0.9;
287
- if (c.current.visible = !!z, z) {
288
- oe(i.p0, i.p1, i.live, 0.8, We), oe(i.p0, i.p1, i.live, 0.86, Qe), c.current.position.copy(We), Je.subVectors(Qe, We).normalize(), c.current.quaternion.setFromUnitVectors(ro, Je);
289
- const q = Me(e.type) ? 0.75 : 1;
290
- c.current.scale.set(0.16 * q, 0.42 * q, 0.16 * q), C.arrow.color.copy(w).multiplyScalar(1.6 * i.parentK);
291
- }
292
- }
293
- });
294
- const O = (v) => {
295
- v.stopPropagation(), t(e.id);
296
- }, S = e.id.split(":")[2];
297
- return /* @__PURE__ */ D(ie, { children: [
298
- /* @__PURE__ */ u("mesh", { geometry: ot, material: C.syn, frustumCulled: !1 }),
299
- /* @__PURE__ */ u("mesh", { ref: c, geometry: Ne, material: C.arrow, visible: !1 }),
300
- /* @__PURE__ */ D("group", { ref: n, children: [
301
- /* @__PURE__ */ D("group", { ref: r, scale: 1e-4, children: [
302
- /* @__PURE__ */ u("mesh", { geometry: _e, material: C.core, onClick: O, onPointerOver: () => document.body.style.cursor = "pointer", onPointerOut: () => document.body.style.cursor = "" }),
303
- /* @__PURE__ */ u("mesh", { geometry: _e, material: C.hot, scale: 0.5 }),
304
- /* @__PURE__ */ u("group", { ref: s, scale: 1e-4, children: y.map((v, h) => /* @__PURE__ */ u("mesh", { geometry: Ut, material: C.spike, quaternion: v, scale: [0.2, 1.9, 0.2] }, h)) })
305
- ] }),
306
- /* @__PURE__ */ u("mesh", { ref: a, geometry: oo, material: C.ring, visible: !1 }),
307
- /* @__PURE__ */ u("sprite", { ref: l, material: C.halo }),
308
- /* @__PURE__ */ u(
309
- Ae,
310
- {
311
- ref: m,
312
- position: [0, -1.05 * $e(e), 0],
313
- text: `${e.name}${S !== void 0 ? ` ${Number(S) + 1}` : ""}`,
314
- color: tt[e.type],
315
- size: e.subagent ? 0.22 : 0.3,
316
- opacity: 0,
317
- pxRange: e.subagent ? [8, 11.5] : [9, 13.5]
318
- }
319
- )
320
- ] })
321
- ] });
322
- }
323
- const We = new o.Vector3(), Qe = new o.Vector3(), Je = new o.Vector3(), ro = new o.Vector3(0, 1, 0);
324
- function ao({ onSelect: e }) {
325
- const [t, n] = de([]), r = V(/* @__PURE__ */ new Set()), s = V(-1);
326
- return Z(() => {
327
- const a = T.instances;
328
- let c = a.size !== r.current.size || s.current !== we.version;
329
- if (!c)
330
- for (const l of a.keys()) r.current.has(l) || (c = !0);
331
- c && (r.current = new Set(a.keys()), s.current = we.version, n([...a.values()].filter(He)));
332
- }), /* @__PURE__ */ u(ie, { children: t.map((a) => /* @__PURE__ */ u(no, { inst: a, onSelect: e }, a.id)) });
333
- }
334
- function so({ comet: e }) {
335
- const t = V(null), n = T.instances.get(e.from), r = n ? Fe[n.type] : Fe.planner, s = M(() => le(new o.Color(r).multiplyScalar(1.8).addScalar(0.3)), [r]), a = M(() => ({ a: new o.Vector3(), b: new o.Vector3(), c: new o.Vector3(), h: new o.Vector3() }), []);
336
- return Z(() => {
337
- const c = se.get(e.from), l = se.get(e.to);
338
- if (!c || !l || !t.current) {
339
- t.current && (t.current.visible = !1);
340
- return;
341
- }
342
- const m = T.instances.get(e.to), d = (m == null ? void 0 : m.parent) === e.from ? Ce.get(e.to) : (n == null ? void 0 : n.parent) === e.to ? Ce.get(e.from) : void 0;
343
- a.a.copy(c), a.b.copy(l), d ? a.c.copy(d) : je(a.a, a.b, 1.2, a.c);
344
- const y = ee((performance.now() - e.start) / e.dur);
345
- oe(a.a, a.c, a.b, xe(y), a.h), t.current.visible = y < 1, t.current.position.copy(a.h), t.current.scale.setScalar(1.1);
346
- }), /* @__PURE__ */ u("sprite", { ref: t, material: s, visible: !1 });
347
- }
348
- function io() {
349
- const [e, t] = de([]), n = V({ n: -1, last: -1, first: -1 });
350
- return Z(() => {
351
- const r = T.comets, s = n.current, a = r.length ? r[0].id : -1, c = r.length ? r[r.length - 1].id : -1;
352
- (r.length !== s.n || a !== s.first || c !== s.last) && (s.n = r.length, s.first = a, s.last = c, t(we.grouped ? r.filter((l) => He(l.from) && He(l.to)) : r.slice()));
353
- }), /* @__PURE__ */ u(ie, { children: e.map((r) => /* @__PURE__ */ u(so, { comet: r }, r.id)) });
354
- }
355
- const re = 3.3, co = 200, ce = 14, Be = 48, he = 16, pe = 8, Ge = 4, be = new o.Color(1, 1, 1), lo = new o.Color("#a78bfa");
356
- function uo(e, t = co) {
357
- const n = e.nodes.slice(0, t), r = new Set(n.map((s) => s.id));
358
- return { nodes: n, links: e.links.filter((s) => r.has(s.source) && r.has(s.target)) };
359
- }
360
- const po = (
361
- /* glsl */
362
- `
363
- attribute float aSize; attribute vec3 aColor; varying vec3 vC; varying float vFacing; uniform float uScale;
364
- void main(){
365
- vec4 mv = modelViewMatrix * vec4(position, 1.0);
366
- vec3 n = normalize(normalMatrix * normalize(position));
367
- vFacing = 0.35 + 0.65 * smoothstep(-0.4, 0.5, dot(n, normalize(-mv.xyz))); // back side dimmer → depth
368
- gl_PointSize = aSize * uScale / -mv.z; vC = aColor; gl_Position = projectionMatrix * mv; }`
369
- ), fo = (
370
- /* glsl */
371
- `
372
- varying vec3 vC; varying float vFacing;
373
- void main(){ float r = length(gl_PointCoord - 0.5) * 2.0; if (r > 1.0) discard;
374
- float core = smoothstep(0.45, 0.0, r); float halo = pow(1.0 - r, 2.2);
375
- gl_FragColor = vec4(vC * vFacing * (core * 1.2 + halo * 0.45), 1.0); }`
376
- ), mo = (
377
- /* glsl */
378
- `
379
- varying vec3 vN; varying vec3 vV; varying vec3 vObj;
380
- void main(){ vec4 mv = modelViewMatrix * vec4(position, 1.0); vN = normalize(normalMatrix * normal); vV = normalize(-mv.xyz); vObj = normalize(position);
381
- gl_Position = projectionMatrix * mv; }`
382
- ), ho = (
383
- /* glsl */
384
- `
385
- uniform vec3 uRim; uniform vec3 uInner; uniform float uTime;
386
- uniform vec3 uRipC[${pe}]; uniform float uRipA[${pe}];
387
- varying vec3 vN; varying vec3 vV; varying vec3 vObj;
388
- void main(){
389
- float f = 1.0 - abs(dot(normalize(vN), normalize(vV)));
390
- float rim = pow(f, 3.0);
391
- float body = pow(1.0 - f, 2.0) * 0.12; // faint glassy fill toward the center
392
- float shimmer = 0.92 + 0.08 * sin(uTime * 0.25 + vObj.y * 3.0 + vObj.x * 2.0);
393
- vec3 col = uRim * rim * 1.1 * shimmer + uInner * body;
394
- float rip = 0.0;
395
- for (int i = 0; i < ${pe}; i++) {
396
- float a = uRipA[i];
397
- if (a < 0.0 || a > 1.0) continue;
398
- float d = acos(clamp(dot(vObj, uRipC[i]), -1.0, 1.0));
399
- float ring = a * 2.2;
400
- rip += exp(-pow((d - ring) / 0.06, 2.0)) * (1.0 - a) * (1.0 - a);
401
- }
402
- col += vec3(1.0) * rip * 0.6;
403
- gl_FragColor = vec4(col, 1.0);
404
- }`
405
- );
406
- function go({ galaxy: e }) {
407
- const t = M(() => uo(e), [e]), n = t.nodes.length, { size: r, gl: s, camera: a } = dt(), c = V([]), l = V([]), m = V(Array(Ge).fill("")), d = M(() => {
408
- const S = new Float32Array(n * 3), v = [], h = Math.PI * (3 - Math.sqrt(5));
409
- for (let g = 0; g < n; g++) {
410
- const P = 1 - 2 * (g + 0.5) / n, L = Math.sqrt(1 - P * P), K = new o.Vector3(Math.cos(g * h) * L, P, Math.sin(g * h) * L);
411
- v.push(K), S.set([K.x * re, K.y * re, K.z * re], g * 3);
412
- }
413
- const k = t.nodes.map((g) => new o.Color(Vt[g.kind] ?? "#94a3b8").lerp(lo, 0.2).multiplyScalar(0.62)), I = new Float32Array(n), N = new Float32Array(n * 3), B = new o.BufferGeometry();
414
- B.setAttribute("position", new o.BufferAttribute(S, 3)), B.setAttribute("aSize", new o.BufferAttribute(I, 1)), B.setAttribute("aColor", new o.BufferAttribute(N, 3));
415
- const U = new Map(t.nodes.map((g, P) => [g.id, P])), f = [], E = [];
416
- for (const g of t.links) {
417
- const P = U.get(g.source), L = U.get(g.target);
418
- P !== void 0 && L !== void 0 && P !== L && v[P].angleTo(v[L]) < 1.25 && (f.push([P, L]), E.push(1));
419
- }
420
- for (let g = 0; g < n; g++) {
421
- let P = -1, L = -1, K = 9, Q = 9;
422
- for (let _ = 0; _ < n; _++) {
423
- if (_ === g) continue;
424
- const p = v[g].distanceToSquared(v[_]);
425
- p < K ? (L = P, Q = K, P = _, K = p) : p < Q && (L = _, Q = p);
426
- }
427
- P > g && (f.push([g, P]), E.push(0)), L > g && (f.push([g, L]), E.push(0));
428
- }
429
- const R = new Float32Array(f.length * ce * 2 * 3), j = new Float32Array(f.length * ce * 2 * 3), A = new Int32Array(f.length * ce * 2 * 2), $ = new Uint8Array(f.length * ce * 2), x = new o.Quaternion(), F = new o.Vector3();
430
- f.forEach(([g, P], L) => {
431
- const K = v[g], Q = v[P], _ = K.angleTo(Q), p = new o.Vector3().crossVectors(K, Q);
432
- p.lengthSq() < 1e-6 && p.set(0, 1, 0), p.normalize();
433
- for (let b = 0; b < ce; b++)
434
- for (let G = 0; G < 2; G++) {
435
- const H = (b + G) / ce;
436
- x.setFromAxisAngle(p, _ * H), F.copy(K).applyQuaternion(x).multiplyScalar(re * (1 + 0.06 * Math.sin(Math.PI * H) * Math.min(1, _)));
437
- const z = (L * ce + b) * 2 + G;
438
- R.set([F.x, F.y, F.z], z * 3), A[z * 2] = g, A[z * 2 + 1] = P, $[z] = E[L];
439
- }
440
- });
441
- const X = new o.BufferGeometry();
442
- X.setAttribute("position", new o.BufferAttribute(R, 3)), X.setAttribute("color", new o.BufferAttribute(j, 3));
443
- const W = new o.BufferGeometry();
444
- return W.setAttribute("position", new o.BufferAttribute(new Float32Array(Be * he * 2 * 3), 3)), W.setAttribute("color", new o.BufferAttribute(new Float32Array(Be * he * 2 * 3), 3)), W.boundingSphere = new o.Sphere(new o.Vector3(), 1e4), { pos: S, unit: v, base: k, ngeo: B, ageo: X, owner: A, kindOf: $, nArcV: f.length * ce * 2, bgeo: W, fire: new Float32Array(n), white: new Float32Array(n), fireC: Array.from({ length: n }, () => new o.Color()) };
445
- }, [t, n]), y = M(
446
- () => ({
447
- nodes: new o.ShaderMaterial({ uniforms: { uScale: { value: 400 } }, vertexShader: po, fragmentShader: fo, transparent: !0, depthWrite: !1, blending: o.AdditiveBlending }),
448
- arcs: new o.LineBasicMaterial({ vertexColors: !0, transparent: !0, blending: o.AdditiveBlending, depthWrite: !1, toneMapped: !1 }),
449
- beam: new o.LineBasicMaterial({ vertexColors: !0, transparent: !0, blending: o.AdditiveBlending, depthWrite: !1, toneMapped: !1 }),
450
- orb: new o.ShaderMaterial({
451
- uniforms: {
452
- uRim: { value: new o.Color("#8b7cff").multiplyScalar(0.7) },
453
- uInner: { value: new o.Color("#5b8cff").multiplyScalar(0.6) },
454
- uTime: { value: 0 },
455
- uRipC: { value: Array.from({ length: pe }, () => new o.Vector3(0, 1, 0)) },
456
- uRipA: { value: new Array(pe).fill(-1) }
457
- },
458
- vertexShader: mo,
459
- fragmentShader: ho,
460
- transparent: !0,
461
- depthWrite: !1,
462
- blending: o.AdditiveBlending
463
- }),
464
- core: le(new o.Color("#8b7cff").multiplyScalar(0.22)),
465
- aura: le(new o.Color("#4c1d95").multiplyScalar(0.28))
466
- }),
467
- []
468
- ), w = M(() => /* @__PURE__ */ new Map(), []), C = M(() => new Ie(Be), []), i = M(() => ({ v: new o.Vector3(), v2: new o.Vector3(), mid: new o.Vector3(), c: new o.Color(), c2: new o.Color() }), []), O = (S) => {
469
- let v = w.get(S);
470
- return v === void 0 && w.set(S, v = Tt(t, S)), v;
471
- };
472
- return Z(({ clock: S }) => {
473
- const v = performance.now(), { pos: h, base: k, fire: I, white: N, fireC: B, unit: U } = d;
474
- y.nodes.uniforms.uScale.value = r.height * s.getPixelRatio() / (2 * Math.tan(a.fov * Math.PI / 360)), y.orb.uniforms.uTime.value = fe ? 0 : S.elapsedTime, I.fill(0), N.fill(0);
475
- const { v: f, v2: E, mid: R, c: j, c2: A } = i, $ = d.bgeo.getAttribute("position"), x = d.bgeo.getAttribute("color"), F = y.orb.uniforms.uRipC.value, X = y.orb.uniforms.uRipA.value;
476
- let W = 0;
477
- C.begin();
478
- let g = 0;
479
- for (const p of T.flares) {
480
- const b = O(p.node), G = (v - p.start) / 1e3, H = T.instances.get(p.instance), z = H ? Fe[H.type] : be, q = p.op === "write", ve = G < 0.35 ? G / 0.35 : Math.exp(-(G - 0.35) * 1.2);
481
- ve > I[b] && (I[b] = ve, B[b].copy(q ? be : z), N[b] = q ? 1 : 0), q && G < 1.8 && g < pe && (F[g].copy(U[b]), X[g] = G / 1.8, g++);
482
- const Y = se.get(p.instance);
483
- if (Y && G < 2.2 && W < Be) {
484
- f.set(h[b * 3], h[b * 3 + 1], h[b * 3 + 2]), R.copy(Y).add(f).multiplyScalar(0.5), R.z += 1;
485
- const ue = Math.min(1, G / 0.3) * (1 - G / 2.2) ** 1.5, it = q ? Math.min(1, G * 0.85) : 1 - Math.min(1, G * 0.85);
486
- for (let Te = 0; Te < he; Te++)
487
- for (let Re = 0; Re < 2; Re++) {
488
- const J = (Te + Re) / he, ne = 1 - J;
489
- E.set(ne * ne * Y.x + 2 * ne * J * R.x + J * J * f.x, ne * ne * Y.y + 2 * ne * J * R.y + J * J * f.y, ne * ne * Y.z + 2 * ne * J * R.z + J * J * f.z);
490
- const qe = (W * he + Te) * 2 + Re;
491
- $.setXYZ(qe, E.x, E.y, E.z);
492
- const ct = Math.exp(-(((J - it) / 0.1) ** 2)) * 1.3;
493
- A.copy(q ? be : z).multiplyScalar(ue * ((q ? 0.5 : 0.2) + ct) * 0.75), x.setXYZ(qe, A.r, A.g, A.b);
494
- }
495
- q ? C.add(Y, R, f, 0.9, 1, 0.42, be, ue * 1.1) : C.add(Y, R, f, 0.1, -1, 0.42, z, ue * 1.3), W++;
496
- }
497
- }
498
- for (let p = g; p < pe; p++) X[p] = -1;
499
- d.bgeo.setDrawRange(0, W * he * 2), C.end(), $.needsUpdate = !0, x.needsUpdate = !0;
500
- const P = d.ngeo.getAttribute("aSize"), L = d.ngeo.getAttribute("aColor");
501
- for (let p = 0; p < n; p++) {
502
- const b = I[p];
503
- P.setX(p, 0.21 + b * (0.55 + N[p] * 0.25)), j.copy(k[p]), b > 0.01 && Xe(Xe(j, B[p], b * 1.6), be, b * (0.3 + N[p] * 1.2)), L.setXYZ(p, j.r, j.g, j.b);
504
- }
505
- P.needsUpdate = !0, L.needsUpdate = !0;
506
- const K = d.ageo.getAttribute("color"), Q = d.owner;
507
- for (let p = 0; p < d.nArcV; p++) {
508
- const b = Q[p * 2], G = Q[p * 2 + 1], H = Math.max(I[b], I[G]), z = d.kindOf[p] ? 0.16 : 0.07;
509
- K.setXYZ(p, 0.42 * z + H * 0.3, 0.36 * z + H * 0.3, 0.85 * z + H * 0.4);
510
- }
511
- K.needsUpdate = !0;
512
- let _ = 0;
513
- for (let p = T.flares.length - 1; p >= 0 && _ < Ge; p--) {
514
- const b = T.flares[p];
515
- if (v - b.start > 2200) break;
516
- let G = !1;
517
- for (let Y = 0; Y < _; Y++) m.current[Y] === b.node && (G = !0);
518
- if (G) continue;
519
- const H = O(b.node);
520
- let z = !1;
521
- for (let Y = 0; Y < _; Y++) {
522
- const ue = l.current[Y];
523
- ue && Math.abs(ue.position.y - h[H * 3 + 1]) < 0.55 && Math.abs(ue.position.x - h[H * 3]) < 3.2 && (z = !0);
524
- }
525
- if (z) continue;
526
- const q = c.current[_], ve = l.current[_];
527
- q && ve && (ve.position.set(h[H * 3], h[H * 3 + 1], h[H * 3 + 2]), m.current[_] !== b.node && (q.setText(`${b.op === "write" ? "wrote" : "read"} · ${b.node}`), q.setColor(b.op === "write" ? "#ffffff" : "#22d3ee")), q.setOpacity(1)), m.current[_] = b.node, _++;
528
- }
529
- for (let p = _; p < Ge; p++) {
530
- const b = c.current[p];
531
- b == null || b.setOpacity(0), m.current[p] = "";
532
- }
533
- }), /* @__PURE__ */ D(ie, { children: [
534
- /* @__PURE__ */ D("group", { children: [
535
- /* @__PURE__ */ u("sprite", { material: y.aura, scale: re * 4.2, position: [0, 0, -re] }),
536
- /* @__PURE__ */ u("sprite", { material: y.core, scale: re * 1.5 }),
537
- /* @__PURE__ */ u("mesh", { geometry: _e, material: y.orb, scale: re * 1.02 }),
538
- /* @__PURE__ */ u("lineSegments", { geometry: d.ageo, material: y.arcs, frustumCulled: !1 }),
539
- /* @__PURE__ */ u("points", { geometry: d.ngeo, material: y.nodes, frustumCulled: !1 })
540
- ] }),
541
- /* @__PURE__ */ u("lineSegments", { geometry: d.bgeo, material: y.beam, frustumCulled: !1 }),
542
- /* @__PURE__ */ u("primitive", { object: C.mesh }),
543
- Array.from({ length: Ge }, (S, v) => /* @__PURE__ */ u("group", { ref: (h) => void (l.current[v] = h), children: /* @__PURE__ */ u(Ae, { ref: (h) => void (c.current[v] = h), text: "", offset: [0, 0.42], size: 0.24, opacity: 0, fadeMs: 250, pxRange: [8, 12] }) }, v)),
544
- /* @__PURE__ */ u(Pt, { position: [0, -re - 0.9, 0], color: "#a78bfa", size: 0.28, opacity: 0.7, pxRange: [8, 12] })
545
- ] });
546
- }
547
- const wo = new o.Vector3();
548
- function vo({ run: e }) {
549
- const t = Ve(e.slot), n = M(() => new o.Color(e.color), [e.color]), r = M(() => le("#000"), []), s = M(() => t.dir.clone().multiplyScalar(t.somaR + t.fanLen * 0.35).setZ(-1.5), [t]), a = Math.abs(t.dir.x) > 0.5, c = V(null), l = V(null);
550
- Z(({ clock: d }) => {
551
- var O;
552
- const y = performance.now();
553
- l.current && l.current.position.lerp(wo.copy(t.tan).multiplyScalar(rt(e.id)), 0.05);
554
- const w = De((y - e.startedAt) / 1200), C = e.endedAt ? ee(1 - (y - e.endedAt - (zt - 2500)) / 2500) : 1, i = 0.9 + 0.1 * Math.sin(d.elapsedTime * 0.6 + e.slot);
555
- r.color.copy(n).multiplyScalar(0.16 * w * C * i), (O = c.current) == null || O.scale.set(a ? 9.5 : 13, a ? 11 : 7.5, 1);
556
- });
557
- const m = M(() => {
558
- const d = t.dir.clone().multiplyScalar(t.somaR);
559
- return a ? d.y += t.spread + 1.9 : d.addScaledVector(t.dir, t.fanLen + 1.8), d;
560
- }, [t, a]);
561
- return /* @__PURE__ */ D("group", { ref: l, children: [
562
- /* @__PURE__ */ u("sprite", { ref: c, material: r, position: s }),
563
- /* @__PURE__ */ u(yo, { run: e, pos: m })
564
- ] });
565
- }
566
- function yo({ run: e, pos: t }) {
567
- kt();
568
- const n = e.status !== "started";
569
- return /* @__PURE__ */ u(
570
- Ae,
571
- {
572
- position: t,
573
- text: e.topic,
574
- secondary: Ot(e, { base: "#94a3b8", current: "#fde68a", done: "#cbd5e1" }, ["running…", "run complete"]),
575
- color: e.color,
576
- size: 0.34,
577
- maxWidth: 10,
578
- opacity: n ? 0.5 : 1,
579
- fadeMs: 400,
580
- pxRange: [10, 15]
581
- }
582
- );
583
- }
584
- function bo() {
585
- const [e, t] = de([]), n = V(/* @__PURE__ */ new Set()), r = V(-1);
586
- return Z(() => {
587
- const s = T.runs;
588
- let a = s.size !== n.current.size || r.current !== we.version;
589
- if (!a)
590
- for (const c of s.keys()) n.current.has(c) || (a = !0);
591
- a && (n.current = new Set(s.keys()), r.current = we.version, t([...s.values()].filter((c) => Rt(c.id))));
592
- }), /* @__PURE__ */ u(ie, { children: e.map((s) => /* @__PURE__ */ u(vo, { run: s }, s.id)) });
593
- }
594
- const So = new o.Color("#fbbf24"), Mo = new o.Color("#ff2d3d"), at = new o.Color(1, 1, 1), st = new o.OctahedronGeometry(0.8, 0), Co = new o.EdgesGeometry(st);
595
- function Ao(e) {
596
- const t = (n, r, s) => ({ geo: n, edges: new o.EdgesGeometry(n, 25), pos: r, rot: s });
597
- switch (e) {
598
- case "db":
599
- return [t(new o.CylinderGeometry(0.42, 0.42, 0.7, 28)), t(new o.TorusGeometry(0.42, 0.015, 6, 40), [0, 0.12, 0], [Math.PI / 2, 0, 0])];
600
- case "warehouse":
601
- return [-0.3, 0, 0.3].map((n) => t(new o.BoxGeometry(0.95, 0.2, 0.6), [0, n, 0]));
602
- case "spark": {
603
- const n = [{ geo: new o.SphereGeometry(0.17, 16, 12) }];
604
- for (let r = 0; r < 6; r++) {
605
- const s = r / 6 * Math.PI * 2;
606
- n.push({ geo: new o.SphereGeometry(0.1, 12, 10), pos: [Math.cos(s) * 0.45, Math.sin(s) * 0.45, (r % 2 ? 1 : -1) * 0.12] });
607
- }
608
- return n;
609
- }
610
- case "api":
611
- return [t(new o.TorusGeometry(0.4, 0.1, 10, 36))];
612
- case "storage":
613
- return [t(new o.BoxGeometry(0.7, 0.7, 0.7), void 0, [0.4, 0.6, 0])];
614
- case "queue":
615
- return [t(new o.CapsuleGeometry(0.2, 0.75, 6, 16), void 0, [0, 0, Math.PI / 2])];
616
- }
617
- }
618
- function xo({ srv: e, res: t, k: n, n: r }) {
619
- const s = M(() => Xt(e.slot, n, r, new o.Vector3()), [e.slot, n, r]), a = M(() => Pe(e.slot, new o.Vector3()), [e.slot]), c = M(() => Ao(t.kind), [t.kind]), l = M(() => new o.Color(e.color).lerp(at, 0.35), [e.color]), m = M(() => {
620
- const S = nt(e.color, 0.035, 1);
621
- return S.uniforms.uP0.value.copy(a), S.uniforms.uP2.value.copy(s), S.uniforms.uP1.value.copy(a).add(s).multiplyScalar(0.5), { edge: S, arrow: ae(l), fill: ae(l), line: new o.LineBasicMaterial({ color: l, transparent: !0, blending: o.AdditiveBlending, depthWrite: !1, toneMapped: !1 }), halo: le(l) };
622
- }, [e.color, a, s, l]), d = V(null), y = V(null), w = V(null), C = M(() => new o.Color(e.color), [e.color]), i = V(null), O = V("");
623
- return Z(({ clock: S }) => {
624
- var $;
625
- const v = performance.now(), h = t.inflight > 0, k = Math.exp(-((v - t.activeAt) / 1e3) * 1.5), I = h ? 0.5 + 0.5 * Math.sin(S.elapsedTime * 5) : 0, N = h ? 1.6 + I * 0.9 : 0.12 + k * 0.9;
626
- m.fill.color.copy(l).multiplyScalar(N * 0.55), m.line.color.copy(l).multiplyScalar(N * 1.6), m.halo.color.copy(l).multiplyScalar(h ? 0.45 + I * 0.25 : 0.02 + k * 0.25), ($ = y.current) == null || $.scale.setScalar(h ? 4.2 + I * 0.8 : 2.4 + k * 1.2), d.current && d.current.scale.setScalar(h ? 1.2 + I * 0.08 : 1 + k * 0.1);
627
- let B = t.name, U = null;
628
- for (const x of T.mcpCalls) x.server === e.name && x.resource === t.name && (!U || x.start > U.start) && (U = x);
629
- if (h) {
630
- let x = "";
631
- for (const F of T.mcpPending.values()) F.server === e.name && F.resource === t.name && (x = F.tool);
632
- B = `${t.name} ▶ ${x || "query"}()`;
633
- } else U && U.phase === "result" && v - U.start < 1800 && (B = `${t.name} ✓ returned`);
634
- i.current && (B !== O.current && (i.current.setText(B), O.current = B), i.current.setOpacity(h ? 1 : 0.55 + k * 0.45), i.current.setEmphasis(h)), d.current && (d.current.rotation.y = t.kind === "spark" || t.kind === "api" ? S.elapsedTime * (h ? 0.6 : 0.15) : Math.sin(S.elapsedTime * 0.2) * 0.25);
635
- const f = m.edge.uniforms;
636
- f.uTime.value = fe ? 0 : S.elapsedTime;
637
- let E = null;
638
- for (const x of T.mcpCalls) x.server === e.name && x.resource === t.name && (!E || x.start > E.start) && (E = x);
639
- const R = E && E.phase === "result" ? (v - E.start) / E.dur : 9, j = R < 1, A = w.current;
640
- if (j) {
641
- const x = xe(R);
642
- f.uRadius.value = 0.06, f.uOpacity.value = 0.9 * (1 - R * 0.6), f.uFlow.value = 0, f.uHead.value = 1 - x, f.uTail.value = 0.2, f.uHeadColor.value.copy(l).multiplyScalar(3), A && (A.visible = !0, Ye(A, f.uP0.value, f.uP1.value, f.uP2.value, 0.12, -1, 0.55), m.arrow.color.copy(l).multiplyScalar(2 * (1 - R * 0.7)));
643
- } else h ? (f.uRadius.value = 0.03, f.uOpacity.value = 0.45, f.uFlow.value = 1, f.uHead.value = -1, A && (A.visible = !0, Ye(A, f.uP0.value, f.uP1.value, f.uP2.value, 0.84, 1, 0.42), m.arrow.color.copy(C).multiplyScalar(1.1))) : (f.uRadius.value = 0.03, f.uOpacity.value = 0.15 + k * 0.4, f.uFlow.value = 0, f.uHead.value = -1, A && (A.visible = !1));
644
- }), /* @__PURE__ */ D(ie, { children: [
645
- /* @__PURE__ */ u("mesh", { geometry: ot, material: m.edge, frustumCulled: !1 }),
646
- /* @__PURE__ */ u("mesh", { ref: w, geometry: Ne, material: m.arrow, visible: !1 }),
647
- /* @__PURE__ */ D("group", { position: s, children: [
648
- /* @__PURE__ */ u("sprite", { ref: y, material: m.halo }),
649
- /* @__PURE__ */ u("group", { ref: d, children: c.map((S, v) => /* @__PURE__ */ D("group", { position: S.pos, rotation: S.rot, children: [
650
- /* @__PURE__ */ u("mesh", { geometry: S.geo, material: m.fill }),
651
- S.edges && /* @__PURE__ */ u("lineSegments", { geometry: S.edges, material: m.line })
652
- ] }, v)) }),
653
- /* @__PURE__ */ u(Ae, { ref: i, position: [0, -0.95, 0], text: t.name, color: e.color, size: 0.2, opacity: 0.55, pxRange: [7.5, 11.5] })
654
- ] })
655
- ] });
656
- }
657
- function Vo({ srv: e }) {
658
- const t = M(() => Pe(e.slot, new o.Vector3()), [e.slot]), n = M(() => new o.Color(e.color), [e.color]), r = M(
659
- () => ({ fill: ae(n), line: new o.LineBasicMaterial({ color: n, transparent: !0, blending: o.AdditiveBlending, depthWrite: !1, toneMapped: !1 }), halo: le(n), core: ae("#fff") }),
660
- [n]
661
- ), s = V(null), a = V(null), [c, l] = de([]), m = V(0);
662
- return Z(({ clock: d }) => {
663
- var O;
664
- e.resources.size !== m.current && (m.current = e.resources.size, l([...e.resources.values()]));
665
- const y = performance.now(), w = e.inflight > 0, C = Math.exp(-((y - e.activeAt) / 1e3) * 1.5), i = (w ? 0.75 : 0.3) + C * 0.45;
666
- r.fill.color.copy(n).multiplyScalar(i * 0.45), r.line.color.copy(n).multiplyScalar(i * 2.2), r.core.color.setScalar(w ? 0.6 : 0.15), r.halo.color.copy(n).multiplyScalar(w ? 0.28 : 0.08 + C * 0.15), (O = a.current) == null || O.scale.setScalar(4 + (w ? 0.6 : 0)), s.current && (s.current.rotation.y = d.elapsedTime * (w ? 0.7 : 0.12));
667
- }), /* @__PURE__ */ D(ie, { children: [
668
- /* @__PURE__ */ D("group", { position: t, children: [
669
- /* @__PURE__ */ u("sprite", { ref: a, material: r.halo }),
670
- /* @__PURE__ */ D("group", { ref: s, children: [
671
- /* @__PURE__ */ u("mesh", { geometry: st, material: r.fill }),
672
- /* @__PURE__ */ u("lineSegments", { geometry: Co, material: r.line }),
673
- /* @__PURE__ */ u("mesh", { geometry: _e, material: r.core, scale: 0.18 })
674
- ] }),
675
- /* @__PURE__ */ u(Ae, { position: [0, 1.35, 0], text: `MCP · ${e.name}`, color: e.color, size: 0.28, pxRange: [9, 13] })
676
- ] }),
677
- c.map((d, y) => /* @__PURE__ */ u(xo, { srv: e, res: d, k: y, n: c.length }, d.name))
678
- ] });
679
- }
680
- function Po({ call: e }) {
681
- const t = T.mcpServers.get(e.server), n = M(() => new o.Color((t == null ? void 0 : t.color) ?? "#fff"), [t]), r = M(() => le(n.clone().multiplyScalar(1.8).addScalar(0.3)), [n]), s = V(null), a = M(() => ({ a: new o.Vector3(), b: new o.Vector3(), c: new o.Vector3(), h: new o.Vector3() }), []);
682
- return Z(() => {
683
- const c = se.get(e.instance);
684
- if (!s.current) return;
685
- if (!c || !t) {
686
- s.current.visible = !1;
687
- return;
688
- }
689
- a.a.copy(c), Pe(t.slot, a.b), je(a.a, a.b, 1, a.c);
690
- const l = ee((performance.now() - e.start) / (e.phase === "call" ? e.dur : e.dur * 0.75)), m = xe(l);
691
- oe(a.a, a.c, a.b, e.phase === "call" ? m : 1 - m, a.h), s.current.visible = l < 1, s.current.position.copy(a.h), s.current.scale.setScalar(1);
692
- }), /* @__PURE__ */ u("sprite", { ref: s, material: r, visible: !1 });
693
- }
694
- const Ee = 24, ge = 40, Se = 3;
695
- function To() {
696
- const e = M(() => {
697
- const s = new o.BufferGeometry();
698
- return s.setAttribute("position", new o.BufferAttribute(new Float32Array(Ee * Se * ge * 2 * 3), 3)), s.setAttribute("color", new o.BufferAttribute(new Float32Array(Ee * Se * ge * 2 * 3), 3)), s.boundingSphere = new o.Sphere(new o.Vector3(), 1e4), s;
699
- }, []), t = M(() => new o.LineBasicMaterial({ vertexColors: !0, transparent: !0, blending: o.AdditiveBlending, depthWrite: !1, toneMapped: !1 }), []), n = M(() => new Ie(Ee), []), r = M(() => ({ a: new o.Vector3(), b: new o.Vector3(), c: new o.Vector3(), p: new o.Vector3(), col: new o.Color(), k: new o.Color() }), []);
700
- return Z(({ clock: s }) => {
701
- const a = performance.now(), c = fe ? 0 : s.elapsedTime, l = e.getAttribute("position"), m = e.getAttribute("color");
702
- let d = 0;
703
- n.begin();
704
- const y = (w, C, i, O) => {
705
- if (d >= Ee) return;
706
- const S = se.get(w), v = T.mcpServers.get(C);
707
- if (!S || !v) return;
708
- const { a: h, b: k, c: I, p: N, col: B, k: U } = r;
709
- h.copy(S), Pe(v.slot, k), je(h, k, 1, I), B.set(v.color);
710
- let f;
711
- i === 0 ? (B.lerp(So, ee(O / 1.2)), O > 1.2 && B.lerp(Mo, ee((O - 1.2) / 1)), f = (0.22 + Math.min(0.6, O * 0.25)) * De(O / 0.3)) : (U.copy(B).lerp(at, 0.35), f = 1.3 * (O < 0.75 ? 1 : 1 - (O - 0.75) / 0.25));
712
- const E = 1 - xe(O / 0.75), R = i === 0 ? 0.025 : 0.07;
713
- for (let j = 0; j < Se; j++) {
714
- const A = (j - 1) * R;
715
- for (let $ = 0; $ < ge; $++)
716
- for (let x = 0; x < 2; x++) {
717
- const F = ($ + x) / ge;
718
- oe(h, I, k, F, N);
719
- const X = ((d * Se + j) * ge + $) * 2 + x;
720
- l.setXYZ(X, N.x + A, N.y - A, N.z + A * 0.5);
721
- let W;
722
- if (i === 0) {
723
- const P = Math.pow(Math.max(0, Math.sin(F * 20 - c * 2.2)), 8);
724
- W = f * (0.3 + P * 1.5) * (j === 1 ? 1 : 0.25);
725
- } else
726
- W = f * (0.3 + Math.exp(-(((F - E) / 0.07) ** 2)) * 3.2 * (O < 0.8 ? 1 : 0)) * (j === 1 ? 1 : 0.65);
727
- const g = i === 0 ? B : U;
728
- m.setXYZ(X, g.r * W, g.g * W, g.b * W);
729
- }
730
- }
731
- i === 0 ? n.add(h, I, k, 0.92, 1, 0.48, B, 0.4 + f * 1.4) : n.add(h, I, k, 0.08, -1, 0.66, U, f * 1.6), d++;
732
- };
733
- for (const w of T.mcpPending.values()) y(w.instance, w.server, 0, Bt(w, a));
734
- for (const w of T.mcpCalls) w.phase === "result" && y(w.instance, w.server, 1, ee((a - w.start) / w.dur));
735
- e.setDrawRange(0, d * Se * ge * 2), l.needsUpdate = !0, m.needsUpdate = !0, n.end();
736
- }), /* @__PURE__ */ D(ie, { children: [
737
- /* @__PURE__ */ u("lineSegments", { geometry: e, material: t, frustumCulled: !1 }),
738
- /* @__PURE__ */ u("primitive", { object: n.mesh })
739
- ] });
740
- }
741
- function Ro() {
742
- const [e, t] = de([]), [n, r] = de([]), s = V({ s: -1, n: -1, first: -1, last: -1 });
743
- return Z(() => {
744
- const a = s.current;
745
- T.mcpServers.size !== a.s && (a.s = T.mcpServers.size, t([...T.mcpServers.values()]));
746
- const c = T.mcpCalls, l = c.length ? c[0].id : -1, m = c.length ? c[c.length - 1].id : -1;
747
- (c.length !== a.n || l !== a.first || m !== a.last) && (a.n = c.length, a.first = l, a.last = m, r(c.slice()));
748
- }), /* @__PURE__ */ D(ie, { children: [
749
- e.map((a) => /* @__PURE__ */ u(Vo, { srv: a }, a.name)),
750
- n.map((a) => /* @__PURE__ */ u(Po, { call: a }, a.id)),
751
- /* @__PURE__ */ u(To, {})
752
- ] });
753
- }
754
- function zo() {
755
- return Z(() => {
756
- Ft(), _t();
757
- }), null;
758
- }
759
- function ko({ children: e }) {
760
- return /* @__PURE__ */ u("group", { position: [-2.2, 0, 0], children: e });
761
- }
762
- function jo() {
763
- const e = Gt(), [t, n] = de(null);
764
- return /* @__PURE__ */ D("div", { className: "scene-root", children: [
765
- /* @__PURE__ */ D(mt, { camera: { position: [0, -0.2, 31], fov: 47 }, dpr: [1, 2], gl: { antialias: !1, powerPreference: "high-performance" }, onPointerMissed: () => n(null), children: [
766
- /* @__PURE__ */ u("color", { attach: "background", args: ["#030208"] }),
767
- /* @__PURE__ */ u(zo, {}),
768
- /* @__PURE__ */ u(pt, { radius: 80, depth: 40, count: fe ? 1200 : 3500, factor: 2.6, saturation: 0.6, fade: !0, speed: 0.4 }),
769
- /* @__PURE__ */ D(ko, { children: [
770
- /* @__PURE__ */ u(go, { galaxy: e }),
771
- /* @__PURE__ */ u(bo, {}),
772
- /* @__PURE__ */ u(ao, { onSelect: n }),
773
- /* @__PURE__ */ u(io, {}),
774
- /* @__PURE__ */ u(Jt, {}),
775
- /* @__PURE__ */ u(Ro, {})
776
- ] }),
777
- /* @__PURE__ */ u(ft, { makeDefault: !0, enablePan: !1, enableDamping: !0, dampingFactor: 0.06, minDistance: 10, maxDistance: 48 }),
778
- /* @__PURE__ */ D(ht, { multisampling: 0, children: [
779
- /* @__PURE__ */ u(gt, { mipmapBlur: !0, intensity: 1.1, luminanceThreshold: 0.2, luminanceSmoothing: 0.3, radius: 0.75 }),
780
- /* @__PURE__ */ u(wt, { eskil: !1, offset: 0.22, darkness: 0.9 })
781
- ] })
782
- ] }),
783
- /* @__PURE__ */ u(
784
- Et,
785
- {
786
- title: "neural · living brain",
787
- subtitle: "Agents are neurons (spiky = thinking, smooth = waiting, amber ring = waiting on MCP) · ⬢ MCP servers wire to their backends · graph memory lights up on reads/writes",
788
- selected: t,
789
- onClose: () => n(null)
790
- }
791
- )
792
- ] });
793
- }
794
- export {
795
- jo as default
796
- };