agentglow 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +38 -3
  2. package/dist/chunks/KitScene-BuFtYuhc.js +2737 -0
  3. package/dist/chunks/index-BPyTLdiF.js +792 -0
  4. package/dist/chunks/index-Bo5HRf-O.js +784 -0
  5. package/dist/chunks/index-C42Ihyo1.js +605 -0
  6. package/dist/chunks/index-C5YqtHnC.js +677 -0
  7. package/dist/chunks/index-Cyv7bII1.js +818 -0
  8. package/dist/chunks/index-D0UvupqM.js +1143 -0
  9. package/dist/chunks/index-D733n3Hf.js +1086 -0
  10. package/dist/chunks/index-DCmhxN8v.js +1010 -0
  11. package/dist/chunks/index-DO9SAG-u.js +753 -0
  12. package/dist/chunks/index-Dn6oRasS.js +887 -0
  13. package/dist/chunks/index-HyfZ0ePz.js +838 -0
  14. package/dist/chunks/index-XMOz-HBf.js +492 -0
  15. package/dist/chunks/index-ZT88hgW-.js +763 -0
  16. package/dist/chunks/index-e6egU2Q6.js +889 -0
  17. package/dist/chunks/index-jLXx_Wgk.js +68 -0
  18. package/dist/chunks/index-tonipLb2.js +980 -0
  19. package/dist/index.js +1 -1
  20. package/dist/style.css +1 -1
  21. package/dist/types/AgentScene.d.ts +14 -1
  22. package/dist/types/world.d.ts +59 -0
  23. package/package.json +1 -1
  24. package/dist/chunks/ClusterBall-CPsd6JvJ.js +0 -1489
  25. package/dist/chunks/index-0Bqa57T_.js +0 -786
  26. package/dist/chunks/index-4JCQqMml.js +0 -831
  27. package/dist/chunks/index-55W5crSg.js +0 -63
  28. package/dist/chunks/index-78lWZCrQ.js +0 -984
  29. package/dist/chunks/index-Bv6_kdaq.js +0 -768
  30. package/dist/chunks/index-Cgb5ir1r.js +0 -688
  31. package/dist/chunks/index-CqVCWpP7.js +0 -796
  32. package/dist/chunks/index-D1O5v601.js +0 -1065
  33. package/dist/chunks/index-DOoA9htC.js +0 -1181
  34. package/dist/chunks/index-K__sPGRy.js +0 -1134
  35. package/dist/chunks/index-N0zWN8NS.js +0 -857
  36. package/dist/chunks/index-NiYqQci9.js +0 -936
  37. package/dist/chunks/index-PQRnbPiJ.js +0 -565
  38. package/dist/chunks/index-VOXn1m-Q.js +0 -848
  39. package/dist/chunks/index-o4vs5msj.js +0 -837
  40. package/dist/chunks/index-yos7IepY.js +0 -890
  41. package/dist/chunks/spread-CWdeDFd9.js +0 -35
@@ -0,0 +1,792 @@
1
+ var rt = Object.defineProperty;
2
+ var st = (e, n, r) => n in e ? rt(e, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[n] = r;
3
+ var L = (e, n, r) => st(e, typeof n != "symbol" ? n + "" : n, r);
4
+ import { jsxs as q, Fragment as de, jsx as g } from "react/jsx-runtime";
5
+ import { EffectComposer as at, Bloom as it, Vignette as ct } from "@react-three/postprocessing";
6
+ import * as t from "three";
7
+ import { T as We, h as X, K as lt, k as je, w as N, a as ce, v as ft, D as ut, L as ye, G as dt, n as pt, c as qe, d as ht, E as Ye, R as mt, u as vt, o as gt, e as bt, s as wt, f as Ve, j as yt } from "./KitScene-BuFtYuhc.js";
8
+ import { useThree as Re, useFrame as se } from "@react-three/fiber";
9
+ import { useMemo as P, useRef as T, useEffect as Mt } from "react";
10
+ var et;
11
+ const Q = typeof window < "u" && !!((et = window.matchMedia) != null && et.call(window, "(prefers-reduced-motion: reduce)").matches), Z = (e) => e < 0 ? 0 : e > 1 ? 1 : e, we = (e) => 1 - Math.pow(1 - Z(e), 3), Ae = (e) => (e = Z(e), e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2), K = new t.Color(1, 1, 1), Ce = new t.Color("#cfe0ff"), ke = new t.Color("#fbbf24"), St = new t.Color("#ff3b4e"), Oe = Object.fromEntries(Object.entries(We).map(([e, n]) => [e, new t.Color(n).lerp(Ce, 0.45)]));
12
+ Object.fromEntries(Object.entries(We).map(([e, n]) => [e, new t.Color(n)]));
13
+ function Ke(e, n) {
14
+ const r = document.createElement("canvas");
15
+ r.width = r.height = e, n(r.getContext("2d"), e);
16
+ const o = new t.CanvasTexture(r);
17
+ return o.colorSpace = t.SRGBColorSpace, o;
18
+ }
19
+ let xt = null;
20
+ function Pe() {
21
+ return xt ?? (xt = Ke(128, (e, n) => {
22
+ const r = e.createRadialGradient(n / 2, n / 2, 0, n / 2, n / 2, n / 2);
23
+ r.addColorStop(0, "rgba(255,255,255,1)"), r.addColorStop(0.12, "rgba(255,255,255,0.65)"), r.addColorStop(0.4, "rgba(255,255,255,0.13)"), r.addColorStop(1, "rgba(255,255,255,0)"), e.fillStyle = r, e.fillRect(0, 0, n, n);
24
+ }));
25
+ }
26
+ let At = null;
27
+ function Ct() {
28
+ return At ?? (At = Ke(256, (e, n) => {
29
+ const r = n / 2, o = (h, p, y, A) => {
30
+ e.save(), e.translate(r, r), e.rotate(h);
31
+ const z = e.createLinearGradient(-p, 0, p, 0);
32
+ z.addColorStop(0, "rgba(255,255,255,0)"), z.addColorStop(0.5, `rgba(255,255,255,${A})`), z.addColorStop(1, "rgba(255,255,255,0)"), e.fillStyle = z, e.beginPath(), e.moveTo(-p, 0), e.lineTo(0, -y), e.lineTo(p, 0), e.lineTo(0, y), e.closePath(), e.fill(), e.restore();
33
+ };
34
+ o(0, r, 2.4, 1), o(Math.PI / 2, r, 2.4, 1), o(Math.PI / 4, r * 0.45, 1.3, 0.35), o(-Math.PI / 4, r * 0.45, 1.3, 0.35);
35
+ const c = e.createRadialGradient(r, r, 0, r, r, r * 0.18);
36
+ c.addColorStop(0, "rgba(255,255,255,1)"), c.addColorStop(1, "rgba(255,255,255,0)"), e.fillStyle = c, e.fillRect(0, 0, n, n);
37
+ }));
38
+ }
39
+ let Pt = null;
40
+ function tt() {
41
+ return Pt ?? (Pt = Ke(256, (e, n) => {
42
+ const r = n / 2, o = e.createRadialGradient(r, r, r * 0.78, r, r, r * 0.98);
43
+ o.addColorStop(0, "rgba(255,255,255,0)"), o.addColorStop(0.55, "rgba(255,255,255,0.9)"), o.addColorStop(1, "rgba(255,255,255,0)"), e.fillStyle = o, e.fillRect(0, 0, n, n);
44
+ }));
45
+ }
46
+ function le(e, n = "#fff") {
47
+ return new t.SpriteMaterial({ map: e, color: n, blending: t.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1 });
48
+ }
49
+ const ot = () => new t.LineBasicMaterial({ vertexColors: !0, transparent: !0, blending: t.AdditiveBlending, depthWrite: !1, toneMapped: !1 }), Xe = new t.SphereGeometry(1, 32, 24), zt = new t.ConeGeometry(1, 1, 3).translate(0, 0.5, 0), $e = new t.TorusGeometry(1, 0.012, 6, 96);
50
+ function fe(e, n, r, o, c) {
51
+ const h = 1 - o;
52
+ return c.set(h * h * e.x + 2 * h * o * n.x + o * o * r.x, h * h * e.y + 2 * h * o * n.y + o * o * r.y, h * h * e.z + 2 * h * o * n.z + o * o * r.z);
53
+ }
54
+ function be(e, n, r, o, c) {
55
+ const h = n.x - e.x, p = n.y - e.y, y = Math.hypot(h, p) || 1;
56
+ return c.copy(e).add(n).multiplyScalar(0.5), c.x += -p / y * r, c.y += h / y * r, c.z += o, c;
57
+ }
58
+ const Ge = class Ge {
59
+ constructor(n) {
60
+ L(this, "mesh");
61
+ L(this, "colors");
62
+ L(this, "n", 0);
63
+ L(this, "o", new t.Object3D());
64
+ L(this, "a", new t.Vector3());
65
+ L(this, "b", new t.Vector3());
66
+ this.max = n, this.colors = new Float32Array(n * 3), this.mesh = new t.InstancedMesh(zt, new t.MeshBasicMaterial({ blending: t.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1 }), n), this.mesh.instanceColor = new t.InstancedBufferAttribute(this.colors, 3), this.mesh.frustumCulled = !1, this.mesh.count = 0;
67
+ }
68
+ begin() {
69
+ this.n = 0;
70
+ }
71
+ add(n, r, o, c, h, p, y, A) {
72
+ this.n >= this.max || A < 0.01 || (fe(n, r, o, c, this.a), fe(n, r, o, Z(c + 0.02 * h), this.b), this.b.sub(this.a), !(this.b.lengthSq() < 1e-9) && (this.o.position.copy(this.a), this.o.quaternion.setFromUnitVectors(Ge.UP, this.b.normalize()), this.o.scale.set(p * 0.32, p, p * 0.32), this.o.updateMatrix(), this.mesh.setMatrixAt(this.n, this.o.matrix), this.colors[this.n * 3] = y.r * A, this.colors[this.n * 3 + 1] = y.g * A, this.colors[this.n * 3 + 2] = y.b * A, this.n++));
73
+ }
74
+ end() {
75
+ this.mesh.count = this.n, this.mesh.instanceMatrix.needsUpdate = !0, this.mesh.instanceColor.needsUpdate = !0;
76
+ }
77
+ };
78
+ L(Ge, "UP", new t.Vector3(0, 1, 0));
79
+ let ze = Ge;
80
+ class De {
81
+ constructor(n, r = 32) {
82
+ L(this, "geo", new t.BufferGeometry());
83
+ L(this, "obj");
84
+ L(this, "P");
85
+ L(this, "C");
86
+ L(this, "n", 0);
87
+ L(this, "p", new t.Vector3());
88
+ this.max = n, this.seg = r, this.P = new t.BufferAttribute(new Float32Array(n * r * 6), 3), this.C = new t.BufferAttribute(new Float32Array(n * r * 6), 3), this.geo.setAttribute("position", this.P), this.geo.setAttribute("color", this.C), this.geo.boundingSphere = new t.Sphere(new t.Vector3(), 1e4), this.obj = new t.LineSegments(this.geo, ot()), this.obj.frustumCulled = !1;
89
+ }
90
+ begin() {
91
+ this.n = 0;
92
+ }
93
+ /**
94
+ * @param base steady brightness
95
+ * @param t0,t1 visible span of the curve (trim near stars, progressive drawing)
96
+ * @param dash flowing dash strength; dashDir +1 flows toward b
97
+ * @param head travelling bright head position (-1 = none); headK its strength
98
+ */
99
+ add(n, r, o, c, h, p, y, A, z, S, b, u) {
100
+ if (this.n >= this.max || y <= p) return;
101
+ const M = this.seg, a = this.P, l = this.C;
102
+ for (let i = 0; i < M; i++)
103
+ for (let x = 0; x < 2; x++) {
104
+ const d = p + (y - p) * (i + x) / M;
105
+ fe(n, r, o, d, this.p);
106
+ const s = (this.n * M + i) * 2 + x;
107
+ a.setXYZ(s, this.p.x, this.p.y, this.p.z);
108
+ let f = h;
109
+ A > 0 && (f += A * Math.pow(Math.max(0, Math.sin((d * 9 - S * 0.9 * z) * Math.PI)), 8)), f *= 0.2 + 0.8 * Z(Math.min((d - p) / 0.06, (y - d) / 0.04)), b >= 0 && (f += u * Math.exp(-(((d - b) / 0.045) ** 2))), l.setXYZ(s, c.r * f, c.g * f, c.b * f);
110
+ }
111
+ this.n++;
112
+ }
113
+ end() {
114
+ this.geo.setDrawRange(0, this.n * this.seg * 2), this.P.needsUpdate = !0, this.C.needsUpdate = !0;
115
+ }
116
+ }
117
+ const _e = 15, Be = 7.5, Rt = (
118
+ /* glsl */
119
+ `
120
+ attribute float aSize; attribute vec3 aColor; uniform float uScale; varying vec3 vC;
121
+ void main(){ vec4 mv = modelViewMatrix * vec4(position, 1.0); vC = aColor; gl_PointSize = aSize * uScale / -mv.z; gl_Position = projectionMatrix * mv; }`
122
+ ), Bt = (
123
+ /* glsl */
124
+ `
125
+ varying vec3 vC;
126
+ void main(){ float r = length(gl_PointCoord - 0.5) * 2.0; if (r > 1.0) discard;
127
+ float core = smoothstep(0.35, 0.0, r); float halo = pow(1.0 - r, 2.6);
128
+ gl_FragColor = vec4(vC * (core * 1.4 + halo * 0.5), 1.0); }`
129
+ );
130
+ class Fe {
131
+ constructor(n) {
132
+ L(this, "geo", new t.BufferGeometry());
133
+ L(this, "mat", new t.ShaderMaterial({ uniforms: { uScale: { value: 400 } }, vertexShader: Rt, fragmentShader: Bt, transparent: !0, depthWrite: !1, blending: t.AdditiveBlending }));
134
+ L(this, "obj");
135
+ L(this, "P");
136
+ L(this, "S");
137
+ L(this, "C");
138
+ L(this, "n", 0);
139
+ this.max = n, this.P = new t.BufferAttribute(new Float32Array(n * 3), 3), this.S = new t.BufferAttribute(new Float32Array(n), 1), this.C = new t.BufferAttribute(new Float32Array(n * 3), 3), this.geo.setAttribute("position", this.P), this.geo.setAttribute("aSize", this.S), this.geo.setAttribute("aColor", this.C), this.geo.boundingSphere = new t.Sphere(new t.Vector3(), 1e4), this.obj = new t.Points(this.geo, this.mat), this.obj.frustumCulled = !1;
140
+ }
141
+ setScale(n, r, o) {
142
+ this.mat.uniforms.uScale.value = n * r / (2 * Math.tan(o * Math.PI / 360));
143
+ }
144
+ begin() {
145
+ this.n = 0;
146
+ }
147
+ add(n, r, o, c) {
148
+ this.n >= this.max || (this.P.setXYZ(this.n, n.x, n.y, n.z), this.S.setX(this.n, r), this.C.setXYZ(this.n, o.r * c, o.g * c, o.b * c), this.n++);
149
+ }
150
+ end() {
151
+ this.geo.setDrawRange(0, this.n), this.P.needsUpdate = !0, this.S.needsUpdate = !0, this.C.needsUpdate = !0;
152
+ }
153
+ }
154
+ const Tt = 260, Ee = 40, Ie = 8, Te = 4, Vt = new t.Color("#9db4ff"), _t = (
155
+ /* glsl */
156
+ "varying vec2 vUv; void main(){ vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }"
157
+ ), jt = (
158
+ /* glsl */
159
+ `
160
+ uniform float uTime; uniform float uAct; varying vec2 vUv;
161
+ float h(vec2 p){ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }
162
+ float n(vec2 p){ vec2 i = floor(p); vec2 f = fract(p); f = f*f*(3.0-2.0*f);
163
+ return mix(mix(h(i), h(i+vec2(1,0)), f.x), mix(h(i+vec2(0,1)), h(i+vec2(1,1)), f.x), f.y); }
164
+ float fbm(vec2 p){ float s = 0.0, a = 0.5; for (int i = 0; i < 6; i++){ s += a*n(p); p = p*2.02 + 3.1; a *= 0.5; } return s; }
165
+ void main(){
166
+ vec2 p = (vUv - 0.5) * 2.0;
167
+ float r = length(p);
168
+ float ang = atan(p.y, p.x);
169
+ // spiral-swirl the noise domain
170
+ float sw = ang + r * 2.6 - uTime * 0.012;
171
+ vec2 q = vec2(cos(sw), sin(sw)) * r * 2.4;
172
+ float f = fbm(q + fbm(q * 1.3 + 4.0) * 1.2);
173
+ float arms = 0.55 + 0.45 * cos(2.0 * (ang - r * 3.2 + uTime * 0.006));
174
+ float mask = smoothstep(1.0, 0.15, r);
175
+ float core = exp(-r * r * 9.0);
176
+ vec3 deep = vec3(0.10, 0.06, 0.32);
177
+ vec3 blue = vec3(0.07, 0.18, 0.45);
178
+ vec3 teal = vec3(0.05, 0.30, 0.42);
179
+ vec3 rose = vec3(0.35, 0.10, 0.36);
180
+ vec3 col = mix(deep, blue, smoothstep(0.35, 0.75, f));
181
+ col = mix(col, teal, smoothstep(0.62, 0.9, fbm(q * 0.7 + 9.0)) * 0.6);
182
+ col = mix(col, rose, smoothstep(0.55, 0.85, fbm(q * 0.9 - 5.0)) * 0.35);
183
+ float dens = pow(f, 1.6) * arms * mask;
184
+ vec3 c = col * dens * (1.05 + uAct * 0.45) + vec3(0.55, 0.6, 0.95) * core * 0.24;
185
+ gl_FragColor = vec4(c, 1.0);
186
+ }`
187
+ ), Ot = (
188
+ /* glsl */
189
+ `
190
+ attribute float aSize; attribute vec3 aColor; uniform float uScale; varying vec3 vC;
191
+ void main(){ vec4 mv = modelViewMatrix * vec4(position, 1.0); vC = aColor; gl_PointSize = aSize * uScale / -mv.z; gl_Position = projectionMatrix * mv; }`
192
+ ), Gt = (
193
+ /* glsl */
194
+ `
195
+ varying vec3 vC;
196
+ void main(){ float r = length(gl_PointCoord - 0.5) * 2.0; if (r > 1.0) discard;
197
+ float core = smoothstep(0.4, 0.0, r); float halo = pow(1.0 - r, 2.4);
198
+ gl_FragColor = vec4(vC * (core * 1.25 + halo * 0.4), 1.0); }`
199
+ );
200
+ function Ft({ galaxy: e }) {
201
+ const n = P(() => ({ nodes: e.nodes.slice(0, Tt), links: e.links }), [e]), r = n.nodes.length, { size: o, gl: c, camera: h } = Re(), p = T([]), y = T([]), A = T(Array(Te).fill("")), z = T([]), S = P(() => {
202
+ const s = new Float32Array(r * 3), f = -0.18, m = Math.cos(f), w = Math.sin(f);
203
+ n.nodes.forEach((R, j) => {
204
+ const I = X(R.id, 1);
205
+ let H, O;
206
+ if (I < 0.22) {
207
+ const Y = 0.22 * Math.sqrt(-2 * Math.log(1 - X(R.id, 2) * 0.95)) * 0.6, $ = X(R.id, 3) * Math.PI * 2;
208
+ H = Math.cos($) * Y * _e, O = Math.sin($) * Y * Be;
209
+ } else {
210
+ const Y = I < 0.61 ? 0 : Math.PI, $ = 0.12 + 0.88 * Math.sqrt(X(R.id, 2)), ae = Y + $ * 3.1 + (X(R.id, 3) - 0.5) * (0.6 + $ * 0.7), te = 1 + (X(R.id, 7) - 0.5) * 0.35;
211
+ H = Math.cos(ae) * $ * _e * 0.95 * te, O = Math.sin(ae) * $ * Be * 0.95 * te;
212
+ }
213
+ s.set([H * m - O * w, H * w + O * m, (X(R.id, 4) - 0.5) * 4], j * 3);
214
+ });
215
+ const B = n.nodes.map((R) => new t.Color(lt[R.kind] ?? "#94a3b8").lerp(Vt, 0.55).multiplyScalar(0.5)), U = n.nodes.map((R) => 0.32 + Math.pow(X(R.id, 5), 4) * 0.5), V = new t.BufferGeometry();
216
+ V.setAttribute("position", new t.BufferAttribute(s, 3)), V.setAttribute("aSize", new t.BufferAttribute(new Float32Array(r), 1)), V.setAttribute("aColor", new t.BufferAttribute(new Float32Array(r * 3), 3));
217
+ const k = new Map(n.nodes.map((R, j) => [R.id, j])), E = [], F = new t.Vector3(), G = new t.Vector3();
218
+ for (const R of n.links) {
219
+ const j = k.get(R.source), I = k.get(R.target);
220
+ j === void 0 || I === void 0 || j === I || (F.fromArray(s, j * 3), G.fromArray(s, I * 3), F.distanceTo(G) < 3.2 && E.push(j, I));
221
+ }
222
+ const _ = new Float32Array(E.length * 3);
223
+ E.forEach((R, j) => _.set([s[R * 3], s[R * 3 + 1], s[R * 3 + 2]], j * 3));
224
+ const D = new t.BufferGeometry();
225
+ return D.setAttribute("position", new t.BufferAttribute(_, 3)), D.setAttribute("color", new t.BufferAttribute(new Float32Array(E.length * 3), 3)), { pos: s, base: B, baseSize: U, ngeo: V, lgeo: D, owner: Int32Array.from(E), fire: new Float32Array(r), white: new Float32Array(r), fireC: Array.from({ length: r }, () => new t.Color()), phase: n.nodes.map((R) => X(R.id, 6) * 6.283) };
226
+ }, [n, r]), b = P(
227
+ () => ({
228
+ gas: new t.ShaderMaterial({ uniforms: { uTime: { value: 0 }, uAct: { value: 0 } }, vertexShader: _t, fragmentShader: jt, transparent: !0, depthWrite: !1, blending: t.AdditiveBlending }),
229
+ nodes: new t.ShaderMaterial({ uniforms: { uScale: { value: 400 } }, vertexShader: Ot, fragmentShader: Gt, transparent: !0, depthWrite: !1, blending: t.AdditiveBlending }),
230
+ fil: new t.LineBasicMaterial({ vertexColors: !0, transparent: !0, blending: t.AdditiveBlending, depthWrite: !1, toneMapped: !1 }),
231
+ ripples: Array.from({ length: Ie }, () => le(tt(), "#000"))
232
+ }),
233
+ []
234
+ ), u = P(() => new De(Ee, 24), []), M = P(() => new ze(Ee), []), a = P(() => new Fe(Ee), []), l = P(() => /* @__PURE__ */ new Map(), [n]), i = P(() => ({ v: new t.Vector3(), w: new t.Vector3(), ctrl: new t.Vector3(), h: new t.Vector3(), c: new t.Color(), act: 0 }), []), x = (s) => {
235
+ let f = l.get(s);
236
+ return f === void 0 && l.set(s, f = pt(n, s)), f;
237
+ };
238
+ return se(({ clock: s }) => {
239
+ const f = performance.now(), m = Math.max(1e-4, je.graph.scale), w = Q ? 0 : s.elapsedTime, B = h.fov, U = c.getPixelRatio();
240
+ b.nodes.uniforms.uScale.value = o.height * U / (2 * Math.tan(B * Math.PI / 360)) * je.graph.scale * 1.7, a.setScale(o.height, U, B);
241
+ const { pos: V, base: k, baseSize: E, fire: F, white: G, fireC: _, phase: D } = S, { v: R, w: j, ctrl: I, h: H, c: O } = i;
242
+ F.fill(0), G.fill(0), u.begin(), M.begin(), a.begin();
243
+ let Y = 0, $ = 0;
244
+ for (const v of N.flares) {
245
+ const C = x(v.node), W = (f - v.start) / 1e3, me = N.instances.get(v.instance), ue = me ? Oe[me.type] : Ce, oe = v.op === "write", ee = W < 0.3 ? W / 0.3 : Math.exp(-(W - 0.3) * 1.1);
246
+ if ($ = Math.max($, ee), ee > F[C] && (F[C] = ee, _[C].copy(oe ? K : ue), G[C] = oe ? 1 : 0), R.fromArray(V, C * 3), oe && W < 1.6 && Y < Ie) {
247
+ const re = z.current[Y];
248
+ if (re) {
249
+ const ie = W / 1.6;
250
+ re.visible = !0, re.position.copy(R), re.scale.setScalar(0.4 + ie * 3.2), b.ripples[Y].color.setScalar((1 - ie) * (1 - ie) * 0.9);
251
+ }
252
+ Y++;
253
+ }
254
+ const ne = ce(v.instance);
255
+ if (ne && W < 2) {
256
+ ft(R, j), be(ne, j, 1.2, 2.5, I);
257
+ const re = Math.min(1, W / 0.25) * Math.pow(1 - W / 2, 1.5), ie = oe ? Math.min(1, W * 0.9) : 1 - Math.min(1, W * 0.9);
258
+ O.copy(oe ? K : ue).lerp(K, 0.2), u.add(ne, I, j, O, (oe ? 0.26 : 0.1) * re, 0.04, 0.99, 0, 1, w, ie, 1.1 * re), ie > 0.02 && ie < 0.98 && (fe(ne, I, j, ie, H), a.add(H, 0.5, O, 1.1 * re)), oe ? M.add(ne, I, j, 0.95, 1, 0.34, K, re * 0.9) : M.add(ne, I, j, 0.07, -1, 0.34, O, re * 1.1);
259
+ }
260
+ }
261
+ for (let v = Y; v < Ie; v++) {
262
+ const C = z.current[v];
263
+ C && (C.visible = !1);
264
+ }
265
+ u.end(), M.end(), a.end(), i.act += ($ - i.act) * 0.05, b.gas.uniforms.uTime.value = w, b.gas.uniforms.uAct.value = i.act;
266
+ const ae = S.ngeo.getAttribute("aSize"), te = S.ngeo.getAttribute("aColor");
267
+ for (let v = 0; v < r; v++) {
268
+ const C = F[v], W = Q ? 1 : 0.85 + 0.15 * Math.sin(w * 0.9 + D[v]);
269
+ ae.setX(v, E[v] + C * (0.9 + G[v] * 0.5)), O.copy(k[v]).multiplyScalar(W), C > 0.01 && (O.r += _[v].r * C * 1.5 + C * (0.25 + G[v]), O.g += _[v].g * C * 1.5 + C * (0.25 + G[v]), O.b += _[v].b * C * 1.5 + C * (0.25 + G[v])), te.setXYZ(v, O.r, O.g, O.b);
270
+ }
271
+ ae.needsUpdate = !0, te.needsUpdate = !0;
272
+ const pe = S.lgeo.getAttribute("color"), he = S.owner;
273
+ for (let v = 0; v < he.length; v++) {
274
+ const C = Math.max(F[he[v]], F[he[v ^ 1]]);
275
+ pe.setXYZ(v, 0.05 + C * 0.35, 0.06 + C * 0.38, 0.13 + C * 0.5);
276
+ }
277
+ pe.needsUpdate = !0;
278
+ let J = 0;
279
+ for (let v = N.flares.length - 1; v >= 0 && J < Te; v--) {
280
+ const C = N.flares[v];
281
+ if (f - C.start > 2200) break;
282
+ let W = !1;
283
+ for (let ee = 0; ee < J; ee++) A.current[ee] === C.node && (W = !0);
284
+ if (W) continue;
285
+ const me = x(C.node);
286
+ for (let ee = 0; ee < J; ee++) {
287
+ const ne = y.current[ee];
288
+ ne && Math.abs(ne.position.y - V[me * 3 + 1]) < 0.9 / m && Math.abs(ne.position.x - V[me * 3]) < 4.5 / m && (W = !0);
289
+ }
290
+ if (W) continue;
291
+ const ue = p.current[J], oe = y.current[J];
292
+ ue && oe && (oe.position.fromArray(V, me * 3), A.current[J] !== C.node && (ue.setText(`${C.op === "write" ? "wrote" : "read"} · ${C.node}`), ue.setColor(C.op === "write" ? "#ffffff" : "#9db4ff")), ue.setOpacity(Z(1.4 - (f - C.start) / 1600))), A.current[J] = C.node, J++;
293
+ }
294
+ for (let v = J; v < Te; v++) {
295
+ const C = p.current[v];
296
+ C == null || C.setOpacity(0), A.current[v] = "";
297
+ }
298
+ }), /* @__PURE__ */ q(de, { children: [
299
+ /* @__PURE__ */ g("mesh", { material: b.gas, position: [0, 0, -1], rotation: [0, 0, -0.18], renderOrder: -5, children: /* @__PURE__ */ g("planeGeometry", { args: [_e * 2.6, Be * 2.9] }) }),
300
+ /* @__PURE__ */ g("lineSegments", { geometry: S.lgeo, material: b.fil, frustumCulled: !1 }),
301
+ /* @__PURE__ */ g("points", { geometry: S.ngeo, material: b.nodes, frustumCulled: !1 }),
302
+ b.ripples.map((s, f) => /* @__PURE__ */ g("sprite", { ref: (m) => void (z.current[f] = m), material: s, visible: !1 }, f)),
303
+ /* @__PURE__ */ q(ut, { children: [
304
+ /* @__PURE__ */ g("primitive", { object: u.obj }),
305
+ /* @__PURE__ */ g("primitive", { object: M.mesh }),
306
+ /* @__PURE__ */ g("primitive", { object: a.obj })
307
+ ] }),
308
+ Array.from({ length: Te }, (s, f) => /* @__PURE__ */ g("group", { ref: (m) => void (y.current[f] = m), children: /* @__PURE__ */ g(ye, { ref: (m) => void (p.current[f] = m), text: "", offset: [0, 0.4], size: 0.24, opacity: 0, fadeMs: 250, pxRange: [8, 12] }) }, f)),
309
+ /* @__PURE__ */ g(dt, { position: [0, Be * 1.15, 0], suffix: " · nebula", color: "#8b9cff", letterSpacing: 0.04, size: 0.28, opacity: 0.6, pxRange: [8, 12] })
310
+ ] });
311
+ }
312
+ const Et = (
313
+ /* glsl */
314
+ `
315
+ varying vec3 vN; varying vec3 vV; varying vec3 vObj;
316
+ void main(){
317
+ vec4 wp = modelMatrix * vec4(position, 1.0);
318
+ vN = normalize(mat3(modelMatrix) * normal); vV = normalize(cameraPosition - wp.xyz); vObj = position;
319
+ gl_Position = projectionMatrix * viewMatrix * wp; }`
320
+ ), It = (
321
+ /* glsl */
322
+ `
323
+ uniform vec3 uCol; uniform vec3 uAtmo; uniform float uAct; uniform float uBands; uniform float uSeed; uniform float uGlow;
324
+ varying vec3 vN; varying vec3 vV; varying vec3 vObj;
325
+ void main(){
326
+ vec3 N = normalize(vN); vec3 V = normalize(vV);
327
+ vec3 L = normalize(vec3(-0.55, 0.45, 0.7));
328
+ float lam = dot(N, L);
329
+ float day = smoothstep(-0.15, 0.6, lam);
330
+ float y = vObj.y;
331
+ float b = sin(y * 13.0 + sin(vObj.x * 3.0 + uSeed * 6.0) * 0.8 + uSeed * 20.0) * 0.5 + 0.5;
332
+ float b2 = sin(y * 31.0 + uSeed * 9.0) * 0.5 + 0.5;
333
+ vec3 surf = uCol * mix(1.0, 0.7 + 0.35 * b + 0.12 * b2, uBands);
334
+ vec3 col = surf * (0.05 + 0.85 * day);
335
+ float f = 1.0 - max(dot(N, V), 0.0);
336
+ float rim = pow(f, 3.0);
337
+ col += uAtmo * rim * (0.35 + 0.9 * day + uAct * 0.9);
338
+ col += uAtmo * uGlow * (0.25 + 0.75 * (1.0 - f));
339
+ gl_FragColor = vec4(col, 1.0);
340
+ }`
341
+ );
342
+ function nt(e, n, r, o) {
343
+ return new t.ShaderMaterial({
344
+ uniforms: { uCol: { value: e.clone() }, uAtmo: { value: n.clone() }, uAct: { value: 0 }, uBands: { value: r }, uSeed: { value: o }, uGlow: { value: 0 } },
345
+ vertexShader: Et,
346
+ fragmentShader: It
347
+ });
348
+ }
349
+ const Ze = new t.Color("#8792b5"), Le = 32, Lt = 0.42, Me = new t.Vector3();
350
+ function Nt({ mcp: e, backend: n }) {
351
+ const r = e.srv, o = n.res, c = P(() => new t.Color(r.color), [r.color]), h = P(() => nt(Ze, new t.Color(r.color).lerp(K, 0.3), 0, X(o.name, 6)), [r.color, o.name]), p = P(() => le(Pe(), "#000"), []), y = P(() => new t.LineBasicMaterial({ color: "#000", transparent: !0, blending: t.AdditiveBlending, depthWrite: !1, toneMapped: !1 }), []), A = P(() => {
352
+ const x = new t.BufferGeometry().setAttribute("position", new t.BufferAttribute(new Float32Array((Le + 1) * 3), 3));
353
+ return x.boundingSphere = new t.Sphere(new t.Vector3(), 1e4), x;
354
+ }, []), z = P(() => Object.assign(new t.Line(A, y), { frustumCulled: !1 }), [A, y]), S = P(() => X(o.name, 5) < 0.5 ? 1 : -1, [o.name]), b = T(null), u = T(null), M = T(null), a = T(null), l = T("");
355
+ se(({ clock: x }) => {
356
+ var k, E;
357
+ const d = performance.now();
358
+ (k = b.current) == null || k.position.copy(n.pos), u.current && !Q && (u.current.rotation.y = x.elapsedTime * 0.3 * S), Me.subVectors(n.pos, e.pos);
359
+ const s = Math.hypot(Me.x, Me.y), f = Math.atan2(Me.y, Me.x), m = A.getAttribute("position");
360
+ for (let F = 0; F <= Le; F++) {
361
+ const G = f + (F / Le - 0.5) * 2 * Lt;
362
+ m.setXYZ(F, e.pos.x + Math.cos(G) * s, e.pos.y + Math.sin(G) * s, n.pos.z);
363
+ }
364
+ m.needsUpdate = !0;
365
+ const w = o.inflight > 0, B = Math.exp(-((d - o.activeAt) / 1e3) * 1.4), U = w ? 0.5 + 0.5 * Math.sin(x.elapsedTime * 5) : 0;
366
+ h.uniforms.uAct.value = w ? 1 : B, h.uniforms.uGlow.value = w ? 0.8 + U * 0.5 : B * 0.6, h.uniforms.uCol.value.copy(Ze).lerp(c, w ? 0.6 : B * 0.5), p.color.copy(c).lerp(K, 0.3).multiplyScalar(w ? 0.55 + U * 0.25 : B * 0.35), (E = M.current) == null || E.scale.setScalar(w ? 2.6 + U * 0.4 : 1.6 + B), y.color.copy(c).lerp(K, 0.3).multiplyScalar(0.16 + (w ? 0.2 : B * 0.12));
367
+ let V = o.name;
368
+ if (w) {
369
+ let F = "";
370
+ for (const G of N.mcpPending.values()) G.server === r.name && G.resource === o.name && (F = G.tool);
371
+ V = `${o.name} ▶ ${F || "query"}()`;
372
+ } else B > 0.25 && o.calls > 0 && (V = `${o.name} ✓`);
373
+ a.current && (V !== l.current && a.current.setText(l.current = V), a.current.setOpacity(w ? 1 : 0.5 + B * 0.5), a.current.setEmphasis(w));
374
+ });
375
+ const i = o.kind === "warehouse" || o.kind === "spark" ? 0.36 : 0.3;
376
+ return /* @__PURE__ */ q(de, { children: [
377
+ /* @__PURE__ */ g("primitive", { object: z }),
378
+ /* @__PURE__ */ q("group", { ref: b, children: [
379
+ /* @__PURE__ */ g("sprite", { ref: M, material: p }),
380
+ /* @__PURE__ */ g("mesh", { ref: u, geometry: Xe, material: h, scale: i }),
381
+ /* @__PURE__ */ g(ye, { ref: a, position: [0, -0.62, 0], text: o.name, color: r.color, size: 0.2, opacity: 0.5, pxRange: [7.5, 11.5] })
382
+ ] })
383
+ ] });
384
+ }
385
+ function kt({ mcp: e }) {
386
+ const n = e.srv, r = P(() => new t.Color(n.color), [n.color]), o = P(() => X(n.name, 7), [n.name]), c = 0.72 + o * 0.28, h = X(n.name, 8) > 0.45, p = P(
387
+ () => ({
388
+ body: nt(r.clone().lerp(new t.Color("#8090c0"), 0.35).multiplyScalar(0.45), r.clone().lerp(K, 0.25).multiplyScalar(0.7), 1, o),
389
+ halo: le(Pe(), "#000"),
390
+ ring: new t.MeshBasicMaterial({ color: r.clone().lerp(K, 0.4).multiplyScalar(0.22), side: t.DoubleSide, transparent: !0, blending: t.AdditiveBlending, depthWrite: !1, toneMapped: !1 })
391
+ }),
392
+ [r, o]
393
+ ), y = P(() => new t.RingGeometry(c * 1.4, c * 1.9, 96, 1), [c]), A = T(null), z = T(null), S = T(null);
394
+ return se(({ clock: b }) => {
395
+ var l, i;
396
+ (l = A.current) == null || l.position.copy(e.pos);
397
+ const u = performance.now(), M = n.inflight > 0, a = Math.exp(-((u - n.activeAt) / 1e3) * 1.4);
398
+ p.body.uniforms.uAct.value = M ? 1 : a, p.halo.color.copy(r).multiplyScalar(M ? 0.28 : 0.07 + a * 0.18), (i = S.current) == null || i.scale.setScalar(c * (5 + (M ? 0.6 : 0))), z.current && !Q && (z.current.rotation.y = b.elapsedTime * 0.05);
399
+ }), /* @__PURE__ */ q("group", { ref: A, children: [
400
+ /* @__PURE__ */ g("sprite", { ref: S, material: p.halo }),
401
+ /* @__PURE__ */ q("group", { rotation: [0.25, 0, -0.32 + o * 0.3], children: [
402
+ /* @__PURE__ */ g("mesh", { ref: z, geometry: Xe, material: p.body, scale: c }),
403
+ h && /* @__PURE__ */ g("mesh", { geometry: y, material: p.ring, rotation: [Math.PI / 2 - 0.25, 0, 0] })
404
+ ] }),
405
+ /* @__PURE__ */ g(ye, { position: [0, c + 0.75, 0], text: `MCP · ${n.name}`, color: n.color, size: 0.28, pxRange: [9, 13] })
406
+ ] });
407
+ }
408
+ const Ne = 48;
409
+ function Ut() {
410
+ const { size: e, gl: n, camera: r } = Re(), o = P(() => new De(Ne, 36), []), c = P(() => new ze(Ne), []), h = P(() => new Fe(Ne), []), p = P(() => ({ a: new t.Vector3(), b: new t.Vector3(), c: new t.Vector3(), h: new t.Vector3(), col: new t.Color() }), []);
411
+ return se(({ clock: y }) => {
412
+ const A = performance.now(), z = Q ? 0 : y.elapsedTime;
413
+ h.setScale(e.height, n.getPixelRatio(), r.fov), o.begin(), c.begin(), h.begin();
414
+ const { a: S, b, c: u, h: M, col: a } = p;
415
+ for (const l of N.mcpPending.values()) {
416
+ const i = ce(l.instance), x = qe(l.server), d = N.mcpServers.get(l.server);
417
+ if (!i || !d || !x) continue;
418
+ b.copy(x), S.copy(i), be(S, b, 1.5, 1.2, u);
419
+ const s = ht(l, A);
420
+ a.set(d.color).lerp(ke, Z(s / 1.2)), s > 1.2 && a.lerp(St, Z((s - 1.2) / 1));
421
+ const f = (0.2 + Math.min(0.35, s * 0.15)) * we(s / 0.3), m = 0.06 + 0.86 * we(s / 0.45);
422
+ if (o.add(S, u, b, a, f, 0.06, m, 0.9, 1, z, s < 0.45 ? m : -1, 1.2), s > 0.45 && c.add(S, u, b, 0.9, 1, 0.42, a, 0.6 + f), l.resource) {
423
+ const w = Ye(l.server, l.resource);
424
+ w && (be(b, w, 0.3, 0.2, u), o.add(b, u, w, a, f * 0.9, 0.12, 0.88, 0.9, 1, z, -1, 0), c.add(b, u, w, 0.8, 1, 0.3, a, 0.5 + f));
425
+ }
426
+ }
427
+ for (const l of N.mcpCalls) {
428
+ if (l.phase !== "result") continue;
429
+ const i = Z((A - l.start) / l.dur);
430
+ if (i >= 1) continue;
431
+ const x = ce(l.instance), d = qe(l.server), s = N.mcpServers.get(l.server);
432
+ if (!x || !s || !d) continue;
433
+ b.copy(d), a.set(s.color).lerp(K, 0.4);
434
+ const f = l.resource ? Ye(l.server, l.resource) : void 0, m = f ? 0.3 : 0;
435
+ if (f && i < m) {
436
+ const w = Ae(i / m);
437
+ be(b, f, 0.3, 0.2, u), o.add(b, u, f, a, 0.15, 0.12, 0.88, 0, 1, z, 1 - w, 1.4), fe(b, u, f, 1 - w, M), h.add(M, 0.6, a, 1.5);
438
+ } else {
439
+ const w = Ae((i - m) / (1 - m));
440
+ S.copy(x), be(S, b, 1.5, 1.2, u);
441
+ const B = 1 - Math.max(0, (w - 0.85) / 0.15);
442
+ o.add(S, u, b, a, 0.22 * B, 0.06, 0.94, 0, 1, z, 1 - w, 1.6 * B), fe(S, u, b, 1 - w, M), h.add(M, 0.75, a, 1.6 * B), c.add(S, u, b, 0.08, -1, 0.45, a, 1.3 * B);
443
+ }
444
+ }
445
+ o.end(), c.end(), h.end();
446
+ }), /* @__PURE__ */ q(de, { children: [
447
+ /* @__PURE__ */ g("primitive", { object: o.obj }),
448
+ /* @__PURE__ */ g("primitive", { object: c.mesh }),
449
+ /* @__PURE__ */ g("primitive", { object: h.obj })
450
+ ] });
451
+ }
452
+ function Wt({ run: e }) {
453
+ const n = P(() => new t.Color(e.color), [e.color]), r = P(() => le(Pe(), "#000"), []), o = T(null), c = T(null);
454
+ return se(({ clock: h }) => {
455
+ var M;
456
+ const p = performance.now(), y = e.run ?? N.runs.get(e.id), A = y ? we((p - y.startedAt) / 1500) : 1, z = y != null && y.endedAt ? Z(1 - (p - y.endedAt - (mt - 2500)) / 2500) : 1, S = Q ? 1 : 0.9 + 0.1 * Math.sin(h.elapsedTime * 0.5 + e.index);
457
+ r.color.copy(n).multiplyScalar(0.075 * A * z * S);
458
+ const b = Math.abs(e.side.x) * e.hu + Math.abs(e.axis.x) * e.hv, u = Math.abs(e.side.y) * e.hu + Math.abs(e.axis.y) * e.hv;
459
+ o.current && (o.current.position.set(e.origin.x, e.origin.y, -3), o.current.scale.set(b * 2.8 + 6, u * 2.8 + 5, 1)), (M = c.current) == null || M.position.set(e.origin.x, e.origin.y + u + 0.7, 0);
460
+ }), /* @__PURE__ */ q(de, { children: [
461
+ /* @__PURE__ */ g("sprite", { ref: o, material: r }),
462
+ /* @__PURE__ */ g("group", { ref: c, children: e.run && /* @__PURE__ */ g(Kt, { run: e.run }) })
463
+ ] });
464
+ }
465
+ function Kt({ run: e }) {
466
+ vt();
467
+ const n = e.status !== "started";
468
+ return /* @__PURE__ */ g(
469
+ ye,
470
+ {
471
+ text: e.topic,
472
+ secondary: gt(e, { base: "#94a3c8", current: "#fde68a", done: "#cbd5e1" }, ["running…", "run complete"]),
473
+ color: e.color,
474
+ textColor: "#e6ecff",
475
+ plate: "none",
476
+ anchorY: "bottom",
477
+ uppercase: !0,
478
+ letterSpacing: 0.12,
479
+ size: 0.34,
480
+ maxWidth: 11,
481
+ opacity: n ? 0.5 : 0.92,
482
+ fadeMs: 600,
483
+ pxRange: [10, 14],
484
+ glow: 1.1
485
+ }
486
+ );
487
+ }
488
+ const ve = 6, Se = 6, ge = 28, xe = 3, Xt = 2.2;
489
+ function Dt() {
490
+ const { size: e, gl: n, camera: r } = Re(), o = T(/* @__PURE__ */ new Set()), c = T([]), h = T([]), p = T([]), y = T([]), A = P(() => {
491
+ const u = new t.BufferGeometry();
492
+ return u.setAttribute("position", new t.BufferAttribute(new Float32Array(ve * xe * ge * 6), 3)), u.setAttribute("color", new t.BufferAttribute(new Float32Array(ve * xe * ge * 6), 3)), u.boundingSphere = new t.Sphere(new t.Vector3(), 1e4), u;
493
+ }, []), z = P(() => ot(), []), S = P(() => new Fe(ve * (2 + Se)), []), b = P(() => ({ h: new t.Vector3(), p: new t.Vector3() }), []);
494
+ return se(() => {
495
+ const u = performance.now();
496
+ for (const d of N.runs.values()) {
497
+ if (!d.final || o.current.has(d.id)) continue;
498
+ o.current.add(d.id);
499
+ const s = je.runs.get(d.id);
500
+ if (!s) continue;
501
+ let f;
502
+ for (const E of N.instances.values()) E.run === d.id && !E.parent && (f = ce(E.id) ?? f);
503
+ const m = (f ?? s.origin).clone(), w = je.core.r, B = Math.abs(m.x) > 0.5 ? m.x < 0 ? 1 : -1 : X(d.id, 23) < 0.5 ? 1 : -1, U = m.x + B * (0.9 + X(d.id, 21) * 0.5) * (w + 3), V = m.y - (0.25 + X(d.id, 22) * 0.2) * (w + 3), k = new t.Vector3(U - m.x, V - m.y, 1.5).normalize();
504
+ c.current.push({ run: d.id, start: u, from: m, dir: k, travel: 1.3 * (w + 4), color: new t.Color(d.color).lerp(K, 0.7), text: d.final }), c.current.length > ve && c.current.shift();
505
+ }
506
+ if (o.current.size > 200)
507
+ for (const d of o.current) N.runs.has(d) || o.current.delete(d);
508
+ c.current = c.current.filter((d) => u - d.start < 5200), S.setScale(e.height, n.getPixelRatio(), r.fov), S.begin();
509
+ const M = A.getAttribute("position"), a = A.getAttribute("color");
510
+ let l = 0;
511
+ const { h: i, p: x } = b;
512
+ for (let d = 0; d < ve; d++) {
513
+ const s = c.current[d], f = h.current[d], m = p.current[d];
514
+ if (!s) {
515
+ f == null || f.setOpacity(0);
516
+ continue;
517
+ }
518
+ const w = (u - s.start) / 1e3;
519
+ f && m && (m.position.copy(s.from).add(x.set(0, -2.3, 0)), y.current[d] !== s.run + s.start && (y.current[d] = s.run + s.start, f.setText(`final answer - ${s.text.length > 64 ? s.text.slice(0, 62) + "…" : s.text}`)), f.setOpacity(Z(w / 0.3) * Z((5.2 - w) / 1.2)));
520
+ const B = w / Xt;
521
+ if (B >= 1.25) continue;
522
+ const U = s.travel * (Q ? 0.6 : 1), V = U * we(Math.min(1, B)), k = Math.min(7.5, U * 0.4) * Math.min(1, B * 3) * (B > 1 ? Math.max(0, 1 - (B - 1) / 0.25) : 1), E = B > 1 ? Math.max(0, 1 - (B - 1) / 0.25) : 1, F = -s.dir.y, G = s.dir.x;
523
+ for (let _ = 0; _ < xe; _++)
524
+ for (let D = 0; D < ge; D++)
525
+ for (let R = 0; R < 2; R++) {
526
+ const j = (D + R) / ge, I = (_ - 1) * 0.05 * (1 - j);
527
+ x.copy(s.from).addScaledVector(s.dir, V - k * (1 - j));
528
+ const H = ((l * xe + _) * ge + D) * 2 + R;
529
+ M.setXYZ(H, x.x + F * I, x.y + G * I, x.z);
530
+ const O = Math.pow(j, 2) * (_ === 1 ? 2.6 : 1.2) * E;
531
+ a.setXYZ(H, s.color.r * O, s.color.g * O, s.color.b * O);
532
+ }
533
+ l++, i.copy(s.from).addScaledVector(s.dir, V), S.add(i, 1.3, K, 1.6 * E), S.add(i, 3.2, Ce, 0.35 * E);
534
+ for (let _ = 1; _ <= Se; _++) {
535
+ const D = _ / Se * k;
536
+ x.copy(s.from).addScaledVector(s.dir, V - D), x.y += Math.sin(_ * 2.3 + s.start) * 0.08, S.add(x, 0.5 * (1 - _ / (Se + 1)), s.color, 0.9 * E * (1 - _ / (Se + 1)));
537
+ }
538
+ }
539
+ A.setDrawRange(0, l * xe * ge * 2), M.needsUpdate = !0, a.needsUpdate = !0, S.end();
540
+ }), /* @__PURE__ */ q(de, { children: [
541
+ /* @__PURE__ */ g("lineSegments", { geometry: A, material: z, frustumCulled: !1 }),
542
+ /* @__PURE__ */ g("primitive", { object: S.obj }),
543
+ Array.from({ length: ve }, (u, M) => /* @__PURE__ */ g("group", { ref: (a) => void (p.current[M] = a), children: /* @__PURE__ */ g(ye, { ref: (a) => void (h.current[M] = a), text: "", color: "#e0e7ff", size: 0.26, maxWidth: 11, opacity: 0, pxRange: [8, 12], renderOrder: 24 }) }, M))
544
+ ] });
545
+ }
546
+ const qt = (
547
+ /* glsl */
548
+ `
549
+ varying vec3 vDir;
550
+ void main(){ vDir = normalize(position); gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }`
551
+ ), Yt = (
552
+ /* glsl */
553
+ `
554
+ varying vec3 vDir;
555
+ float h(vec2 p){ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }
556
+ float n(vec2 p){ vec2 i = floor(p); vec2 f = fract(p); f = f*f*(3.0-2.0*f);
557
+ return mix(mix(h(i), h(i+vec2(1,0)), f.x), mix(h(i+vec2(0,1)), h(i+vec2(1,1)), f.x), f.y); }
558
+ float fbm(vec2 p){ float s = 0.0, a = 0.5; for (int i = 0; i < 5; i++){ s += a*n(p); p *= 2.03; a *= 0.5; } return s; }
559
+ void main(){
560
+ vec3 d = normalize(vDir);
561
+ // zenith indigo → horizon deep navy
562
+ vec3 top = vec3(0.007, 0.009, 0.042);
563
+ vec3 mid = vec3(0.0035, 0.0045, 0.02);
564
+ vec3 low = vec3(0.0012, 0.0016, 0.007);
565
+ float y = d.y;
566
+ vec3 col = y > 0.0 ? mix(mid, top, smoothstep(0.0, 0.85, y)) : mix(mid, low, smoothstep(0.0, -0.7, y));
567
+ // Milky Way: a soft dusty band tilted across the sky
568
+ vec3 bn = normalize(vec3(0.42, 0.9, -0.12));
569
+ float band = exp(-pow(dot(d, bn) / 0.2, 2.0));
570
+ vec2 uv = vec2(atan(d.x, -d.z), dot(d, bn)) * vec2(3.0, 9.0);
571
+ float dust = fbm(uv * 1.3);
572
+ float lanes = smoothstep(0.45, 0.75, fbm(uv * 2.4 + 7.0));
573
+ col += band * max(vec3(0.0), vec3(0.010, 0.012, 0.03) * (0.3 + dust * dust * 1.4) - vec3(0.006, 0.007, 0.014) * lanes);
574
+ gl_FragColor = vec4(col, 1.0);
575
+ }`
576
+ ), $t = (
577
+ /* glsl */
578
+ `
579
+ attribute float aSize; attribute float aPhase; attribute vec3 aColor;
580
+ uniform float uTime; uniform float uScale; varying vec3 vC;
581
+ void main(){
582
+ vec4 mv = modelViewMatrix * vec4(position, 1.0);
583
+ float tw = 0.78 + 0.22 * sin(uTime * (0.6 + fract(aPhase * 7.3) * 1.6) + aPhase * 6.2831);
584
+ vC = aColor * tw;
585
+ gl_PointSize = max(1.0, aSize * uScale / -mv.z);
586
+ gl_Position = projectionMatrix * mv;
587
+ }`
588
+ ), Zt = (
589
+ /* glsl */
590
+ `
591
+ varying vec3 vC;
592
+ void main(){ float r = length(gl_PointCoord - 0.5) * 2.0; if (r > 1.0) discard;
593
+ float core = smoothstep(0.5, 0.0, r); float halo = pow(1.0 - r, 3.0);
594
+ gl_FragColor = vec4(vC * (core + halo * 0.35), 1.0); }`
595
+ ), He = ["#ffffff", "#dbe7ff", "#b9cdff", "#9fb8ff", "#fff3dd", "#ffe2bf"].map((e) => new t.Color(e));
596
+ function Ht() {
597
+ const { size: e, gl: n, camera: r } = Re(), o = P(() => {
598
+ const p = Q ? 1600 : 3200, y = new Float32Array(p * 3), A = new Float32Array(p), z = new Float32Array(p), S = new Float32Array(p * 3), b = new t.Vector3(0.42, 0.9, -0.12).normalize(), u = new t.Vector3();
599
+ let M = 1234567;
600
+ const a = () => (M = M * 16807 % 2147483647) / 2147483647;
601
+ for (let i = 0; i < p; i++) {
602
+ for (let m = 0; m < 8 && (u.set(a() * 2 - 1, a() * 2 - 1, a() * 2 - 1), !(!(u.lengthSq() > 1 || u.lengthSq() < 0.01) && (u.normalize(), !(i % 5 < 2 && Math.abs(u.dot(b)) > 0.22)))); m++)
603
+ ;
604
+ u.z > 0.3 && (u.z *= -1);
605
+ const x = 110 + a() * 60;
606
+ y.set([u.x * x, u.y * x, u.z * x], i * 3);
607
+ const d = Math.pow(a(), 3.2);
608
+ A[i] = 0.55 + d * 2.6, z[i] = a();
609
+ const s = He[Math.floor(a() * He.length)], f = 0.22 + d * 0.75;
610
+ S.set([s.r * f, s.g * f, s.b * f], i * 3);
611
+ }
612
+ const l = new t.BufferGeometry();
613
+ return l.setAttribute("position", new t.BufferAttribute(y, 3)), l.setAttribute("aSize", new t.BufferAttribute(A, 1)), l.setAttribute("aPhase", new t.BufferAttribute(z, 1)), l.setAttribute("aColor", new t.BufferAttribute(S, 3)), l;
614
+ }, []), c = P(
615
+ () => ({
616
+ dome: new t.ShaderMaterial({ vertexShader: qt, fragmentShader: Yt, side: t.BackSide, depthWrite: !1 }),
617
+ stars: new t.ShaderMaterial({ uniforms: { uTime: { value: 0 }, uScale: { value: 400 } }, vertexShader: $t, fragmentShader: Zt, transparent: !0, depthWrite: !1, blending: t.AdditiveBlending })
618
+ }),
619
+ []
620
+ ), h = T(null);
621
+ return se(({ clock: p }) => {
622
+ var y;
623
+ (y = h.current) == null || y.position.copy(r.position), c.stars.uniforms.uTime.value = Q ? 0 : p.elapsedTime, c.stars.uniforms.uScale.value = e.height * n.getPixelRatio() / (2 * Math.tan(r.fov * Math.PI / 360)) * 0.22;
624
+ }), /* @__PURE__ */ q("group", { ref: h, children: [
625
+ /* @__PURE__ */ g("mesh", { material: c.dome, renderOrder: -10, frustumCulled: !1, children: /* @__PURE__ */ g("sphereGeometry", { args: [400, 48, 32] }) }),
626
+ /* @__PURE__ */ g("points", { geometry: o, material: c.stars, frustumCulled: !1, renderOrder: -9 })
627
+ ] });
628
+ }
629
+ const Jt = new t.Color("#6f7fb8"), Qt = new t.Color("#ff6b7a"), Ue = 0.95, eo = new t.MeshBasicMaterial({ colorWrite: !1, depthWrite: !1, transparent: !0, opacity: 0 });
630
+ function to({ agent: e, selected: n, onSelect: r }) {
631
+ const o = e.inst, c = T(null), h = T(null), p = T(null), y = T(null), A = T(null), z = T(null), S = T(null), b = T(null), u = T(null), M = P(() => [...o.id].reduce((s, f) => (s * 31 + f.charCodeAt(0)) % 9973, 7) / 9973, [o.id]), a = Oe[o.type], l = P(
632
+ () => ({
633
+ halo: le(Pe(), a),
634
+ spikes: le(Ct(), a),
635
+ core: le(Pe(), "#fff"),
636
+ flare: le(tt(), a),
637
+ corona: new t.MeshBasicMaterial({ color: ke, blending: t.AdditiveBlending, transparent: !0, depthWrite: !1, toneMapped: !1 }),
638
+ sel: new t.MeshBasicMaterial({ color: "#dbe7ff", blending: t.AdditiveBlending, transparent: !0, depthWrite: !1, toneMapped: !1 })
639
+ }),
640
+ [a]
641
+ ), i = P(
642
+ () => ({ calls: o.llmCalls, flareAt: -1e9, flareK: 1, coronaK: 0, selK: 0, c: new t.Color() }),
643
+ // eslint-disable-next-line react-hooks/exhaustive-deps
644
+ []
645
+ );
646
+ Mt(() => {
647
+ l.spikes.rotation = (M - 0.5) * 0.5;
648
+ }, [l, M]), se(({ clock: s }) => {
649
+ var he, J;
650
+ const f = performance.now(), m = s.elapsedTime, w = Q ? 0 : 0.05 * Ve.spread;
651
+ e.live.set(e.pos.x + Math.sin(m * 0.21 + M * 20) * w, e.pos.y + Math.cos(m * 0.17 + M * 13) * w, e.pos.z);
652
+ const B = e.scale;
653
+ c.current && (c.current.position.copy(e.live), c.current.scale.setScalar(Math.max(1e-4, B))), (he = b.current) == null || he.position.set(e.live.x, e.live.y - 0.95 * B - 0.35, e.live.z);
654
+ const U = (f - o.bornAt) / 1e3, V = o.parent && N.instances.has(o.parent) ? Ue * 0.85 : 0.05, k = Z((U - V) / 0.55), E = we(k), F = k > 0 ? Math.exp(-(U - V) * 3.2) : 0, G = o.exitAt ? (f - o.exitAt) / 1e3 : -1, _ = G >= 0 ? Ae(G / 0.7) : 0, D = G >= 0 ? Z((G - 0.7) / 1.7) : 0, R = G < 0;
655
+ o.llmCalls !== i.calls && (i.calls = o.llmCalls, i.flareAt = f, i.flareK = o.pulse);
656
+ const j = (f - i.flareAt) / 1e3, I = bt(o, f);
657
+ let H = !1;
658
+ for (const v of N.mcpPending.values()) v.instance === o.id && (H = !0);
659
+ const O = R && (o.status === "thinking" || o.status === "spawning"), Y = Q ? 0 : 1, $ = 1 + (O ? 0.16 : 0.05) * Math.sin(m * 3.3 + M * 40) * Math.sin(m * 1.9 + M * 17) * Y, ae = (O ? 1 : 0.62) * $ + I * 0.25 + F * 1.2;
660
+ i.c.copy(a), R || i.c.lerp(o.status === "failed" ? Qt : Jt, _);
661
+ const te = (1 - _ * 0.8) * (1 - D), pe = E * (1 - _ * 0.62);
662
+ if (y.current && (y.current.scale.setScalar(Math.max(1e-4, pe * (0.95 + I * 0.12))), l.core.color.copy(K).lerp(i.c, _).multiplyScalar(Math.min(1.6, ae) * te)), h.current && (h.current.scale.setScalar(Math.max(1e-4, pe * (O ? 3.4 : 2.7) * (1 + I * 0.18))), l.halo.color.copy(i.c).multiplyScalar(0.42 * ae * te)), p.current) {
663
+ const v = j < 1.2 ? Math.exp(-j * 2.6) * i.flareK * 0.5 : 0, C = (O ? 1 : 0.55) * (1 - _);
664
+ p.current.scale.setScalar(Math.max(1e-4, pe * (3 + I * 1.2 + v * 4 + F * 3))), l.spikes.color.copy(i.c).lerp(K, 0.3).multiplyScalar((0.55 * C * $ + I * 0.25 + v * 0.6 + F) * te);
665
+ }
666
+ if (A.current) {
667
+ const v = j < 1.1 && R;
668
+ if (A.current.visible = v, v) {
669
+ const C = we(j / 1.1);
670
+ A.current.scale.setScalar(0.8 + C * (1.6 + i.flareK * 1.4)), l.flare.color.copy(i.c).lerp(K, 0.4).multiplyScalar((1 - C) * (1 - C) * (0.35 + i.flareK * 0.3));
671
+ }
672
+ }
673
+ if (i.coronaK += ((H && R ? 1 : 0) - i.coronaK) * 0.08, z.current) {
674
+ z.current.visible = i.coronaK > 0.02;
675
+ const v = 0.75 + 0.25 * Math.sin(m * 2.4) * Y;
676
+ z.current.scale.setScalar(0.95 + 0.06 * v), z.current.rotation.z = m * 0.6 * Y, l.corona.color.copy(ke).multiplyScalar(1.4 * i.coronaK * v);
677
+ }
678
+ i.selK += ((n ? 1 : 0) - i.selK) * 0.12, S.current && (S.current.visible = i.selK > 0.02, S.current.scale.setScalar(1.1 + (1 - i.selK) * 0.5), l.sel.color.setScalar(0.9 * i.selK * te)), (J = u.current) == null || J.setOpacity(wt(o.id) ? E * (R ? 0.95 : 0.6 * (1 - D)) : 0);
679
+ });
680
+ const x = (s) => {
681
+ s.stopPropagation(), r(o.id);
682
+ }, d = o.id.split(":")[2];
683
+ return /* @__PURE__ */ q(de, { children: [
684
+ /* @__PURE__ */ q("group", { ref: c, scale: 1e-4, children: [
685
+ /* @__PURE__ */ g("mesh", { geometry: Xe, material: eo, scale: 0.75, onClick: x, onPointerOver: () => document.body.style.cursor = "pointer", onPointerOut: () => document.body.style.cursor = "" }),
686
+ /* @__PURE__ */ g("sprite", { ref: h, material: l.halo, scale: 1e-4 }),
687
+ /* @__PURE__ */ g("sprite", { ref: p, material: l.spikes, scale: 1e-4 }),
688
+ /* @__PURE__ */ g("sprite", { ref: y, material: l.core, scale: 1e-4 }),
689
+ /* @__PURE__ */ g("sprite", { ref: A, material: l.flare, visible: !1 }),
690
+ /* @__PURE__ */ g("mesh", { ref: z, geometry: $e, material: l.corona, visible: !1 }),
691
+ /* @__PURE__ */ g("mesh", { ref: S, geometry: $e, material: l.sel, visible: !1 })
692
+ ] }),
693
+ /* @__PURE__ */ g("group", { ref: b, children: /* @__PURE__ */ g(
694
+ ye,
695
+ {
696
+ ref: u,
697
+ text: `${o.name}${d !== void 0 ? ` ${Number(d) + 1}` : ""}`,
698
+ color: We[o.type],
699
+ size: o.subagent ? 0.22 : 0.28,
700
+ letterSpacing: 0.02,
701
+ opacity: 0,
702
+ fit: !0,
703
+ pxRange: o.subagent ? [8, 11.5] : [9, 13.5]
704
+ }
705
+ ) })
706
+ ] });
707
+ }
708
+ const Je = 96, Qe = 32;
709
+ function oo() {
710
+ const { size: e, gl: n, camera: r } = Re(), o = P(() => new De(Je + Qe, 28), []), c = P(() => new ze(Je), []), h = P(() => new Fe(Qe), []), p = P(() => /* @__PURE__ */ new Map(), []), y = P(() => ({ ctrl: new t.Vector3(), h: new t.Vector3(), col: new t.Color(), a: new t.Vector3(), b: new t.Vector3() }), []);
711
+ return se(({ clock: A }) => {
712
+ const z = performance.now(), S = Q ? 0 : A.elapsedTime;
713
+ h.setScale(e.height, n.getPixelRatio(), r.fov), o.begin(), c.begin(), h.begin();
714
+ const { ctrl: b, col: u, h: M } = y;
715
+ for (const a of p.keys()) N.instances.has(a) || p.delete(a);
716
+ for (const a of N.instances.values()) {
717
+ if (!a.parent) continue;
718
+ const l = ce(a.parent), i = ce(a.id), x = N.instances.get(a.parent);
719
+ if (!l || !i) continue;
720
+ const d = x && !x.exitAt && !a.exitAt ? 1 : 0;
721
+ let s = p.get(a.id) ?? 0;
722
+ const f = (z - a.bornAt) / 1e3;
723
+ if (d && f < Ue && (s = 1), s += (d - s) * (d ? 0.08 : 0.03), p.set(a.id, s), s < 0.01) continue;
724
+ const m = l.distanceTo(i) || 1, w = Math.min(0.3, 0.55 * Ve.scale * (x ? 1.35 : 1) / m), B = Math.min(0.3, 0.5 * Ve.scale / m), U = Ae(f / Ue);
725
+ b.copy(l).add(i).multiplyScalar(0.5);
726
+ const V = w + (1 - B - w) * U;
727
+ u.copy(Oe[a.type]).lerp(Ce, 0.5);
728
+ const k = U < 1;
729
+ o.add(l, b, i, u, (k ? 0.8 : 0.62) * s, w, V, k ? 0 : 0.55 * s, 1, S, k ? V : -1, 2.2), k ? (fe(l, b, i, V, M), h.add(M, 0.55, K, 1.3)) : c.add(l, b, i, 1 - B - 0.04, 1, (a.subagent ? 0.32 : 0.4) * Math.min(1.3, Ve.scale), u, 0.95 * s);
730
+ }
731
+ for (const a of N.comets) {
732
+ const l = ce(a.from), i = ce(a.to);
733
+ if (!l || !i) continue;
734
+ const x = Z((z - a.start) / a.dur);
735
+ if (x >= 1) continue;
736
+ const d = N.instances.get(a.from), s = N.instances.get(a.to);
737
+ (s == null ? void 0 : s.parent) === a.from || (d == null ? void 0 : d.parent) === a.to ? b.copy(l).add(i).multiplyScalar(0.5) : be(l, i, 1.4, 0.8, b);
738
+ const m = Ae(x);
739
+ u.copy(d ? Oe[d.type] : Ce).lerp(K, 0.45);
740
+ const w = Math.min(1, x / 0.1) * Math.min(1, (1 - x) / 0.15);
741
+ o.add(l, b, i, u, 0.9 * w, Math.max(0, m - 0.2), m, 0, 1, S, m, 1.6 * w), fe(l, b, i, m, M), h.add(M, 0.8, u, 1.4 * w);
742
+ }
743
+ o.end(), c.end(), h.end();
744
+ }), /* @__PURE__ */ q(de, { children: [
745
+ /* @__PURE__ */ g("primitive", { object: o.obj }),
746
+ /* @__PURE__ */ g("primitive", { object: c.mesh }),
747
+ /* @__PURE__ */ g("primitive", { object: h.obj })
748
+ ] });
749
+ }
750
+ const no = {
751
+ minPolarAngle: Math.PI * 0.22,
752
+ maxPolarAngle: Math.PI * 0.78,
753
+ minAzimuthAngle: -Math.PI * 0.35,
754
+ maxAzimuthAngle: Math.PI * 0.35
755
+ };
756
+ function fo() {
757
+ return /* @__PURE__ */ q(
758
+ yt,
759
+ {
760
+ title: "constellation · night sky",
761
+ subtitle: "Agents are stars (brighter = parent) · delegation draws constellation lines · stars flare on LLM calls · ◉ MCP planets with backend moons · the graph nebula lights on reads/writes · ✦ final answer = shooting star",
762
+ preset: "radial",
763
+ plane: "xy",
764
+ camera: { position: [0, 0, 34], fov: 46, far: 1200 },
765
+ controls: no,
766
+ bg: "#040618",
767
+ gl: { antialias: !0 },
768
+ fit: { nRef: 4, min: 0.62, max: 1.6, minRadius: 5.5 },
769
+ agentRadius: 1.3,
770
+ graph: { natural: _e * 1.1, radius: 3 },
771
+ Background: /* @__PURE__ */ g(Ht, {}),
772
+ Agent: to,
773
+ RunMarker: Wt,
774
+ McpServer: kt,
775
+ Backend: Nt,
776
+ GraphResource: Ft,
777
+ cluster: { radius: 1.5, variant: "stars", glowGain: 0.9 },
778
+ PostFX: /* @__PURE__ */ q(at, { multisampling: 0, children: [
779
+ /* @__PURE__ */ g(it, { mipmapBlur: !0, intensity: 0.95, luminanceThreshold: 0.22, luminanceSmoothing: 0.35, radius: 0.7 }),
780
+ /* @__PURE__ */ g(ct, { eskil: !1, offset: 0.25, darkness: 0.75 })
781
+ ] }),
782
+ children: [
783
+ /* @__PURE__ */ g(oo, {}),
784
+ /* @__PURE__ */ g(Ut, {}),
785
+ /* @__PURE__ */ g(Dt, {})
786
+ ]
787
+ }
788
+ );
789
+ }
790
+ export {
791
+ fo as default
792
+ };