agentglow 0.4.0 → 0.4.2

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.
@@ -0,0 +1,699 @@
1
+ var Je = Object.defineProperty;
2
+ var et = (e, n, s) => n in e ? Je(e, n, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[n] = s;
3
+ var O = (e, n, s) => et(e, typeof n != "symbol" ? n + "" : n, s);
4
+ import { jsxs as J, Fragment as we, jsx as b } from "react/jsx-runtime";
5
+ import { EffectComposer as tt, Bloom as ot, Vignette as nt } from "@react-three/postprocessing";
6
+ import * as t from "three";
7
+ import { T as Ue, g as rt, h as $, b as st, K as at, A as Be, w as G, a as ie, F as it, P as ct, L as je, G as lt, C as ft, d as Ne, k as dt, Q as Xe, R as ut, u as pt, D as ht, E as mt, e as gt, s as vt, j as bt, f as Re, n as wt, o as yt, x as St } from "./KitScene-D8qiflCw.js";
8
+ import { useThree as Pe, useFrame as fe } from "@react-three/fiber";
9
+ import { useMemo as T, useRef as E, useEffect as Mt } from "react";
10
+ var $e;
11
+ const re = typeof window < "u" && !!(($e = window.matchMedia) != null && $e.call(window, "(prefers-reduced-motion: reduce)").matches), Y = (e) => e < 0 ? 0 : e > 1 ? 1 : e, be = (e) => 1 - Math.pow(1 - Y(e), 3), xe = (e) => (e = Y(e), e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2), H = new t.Color(1, 1, 1), Ae = new t.Color("#cfe0ff"), Ie = new t.Color("#fbbf24"), xt = new t.Color("#ff3b4e"), Ve = Object.fromEntries(Object.entries(Ue).map(([e, n]) => [e, new t.Color(n).lerp(Ae, 0.45)]));
12
+ Object.fromEntries(Object.entries(Ue).map(([e, n]) => [e, new t.Color(n)]));
13
+ function Ke(e, n) {
14
+ const s = document.createElement("canvas");
15
+ s.width = s.height = e, n(s.getContext("2d"), e);
16
+ const o = new t.CanvasTexture(s);
17
+ return o.colorSpace = t.SRGBColorSpace, o;
18
+ }
19
+ let At = null;
20
+ function Le() {
21
+ return At ?? (At = Ke(128, (e, n) => {
22
+ const s = e.createRadialGradient(n / 2, n / 2, 0, n / 2, n / 2, n / 2);
23
+ s.addColorStop(0, "rgba(255,255,255,1)"), s.addColorStop(0.12, "rgba(255,255,255,0.65)"), s.addColorStop(0.4, "rgba(255,255,255,0.13)"), s.addColorStop(1, "rgba(255,255,255,0)"), e.fillStyle = s, e.fillRect(0, 0, n, n);
24
+ }));
25
+ }
26
+ let Ct = null;
27
+ function Pt() {
28
+ return Ct ?? (Ct = Ke(256, (e, n) => {
29
+ const s = n / 2, o = (m, g, y, P) => {
30
+ e.save(), e.translate(s, s), e.rotate(m);
31
+ const z = e.createLinearGradient(-g, 0, g, 0);
32
+ z.addColorStop(0, "rgba(255,255,255,0)"), z.addColorStop(0.5, `rgba(255,255,255,${P})`), z.addColorStop(1, "rgba(255,255,255,0)"), e.fillStyle = z, e.beginPath(), e.moveTo(-g, 0), e.lineTo(0, -y), e.lineTo(g, 0), e.lineTo(0, y), e.closePath(), e.fill(), e.restore();
33
+ };
34
+ o(0, s, 2.4, 1), o(Math.PI / 2, s, 2.4, 1), o(Math.PI / 4, s * 0.45, 1.3, 0.35), o(-Math.PI / 4, s * 0.45, 1.3, 0.35);
35
+ const f = e.createRadialGradient(s, s, 0, s, s, s * 0.18);
36
+ f.addColorStop(0, "rgba(255,255,255,1)"), f.addColorStop(1, "rgba(255,255,255,0)"), e.fillStyle = f, e.fillRect(0, 0, n, n);
37
+ }));
38
+ }
39
+ let zt = null;
40
+ function He() {
41
+ return zt ?? (zt = Ke(256, (e, n) => {
42
+ const s = n / 2, o = e.createRadialGradient(s, s, s * 0.78, s, s, s * 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 ge(e, n = "#fff") {
47
+ return new t.SpriteMaterial({ map: e, color: n, blending: t.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1 });
48
+ }
49
+ const Qe = () => new t.LineBasicMaterial({ vertexColors: !0, transparent: !0, blending: t.AdditiveBlending, depthWrite: !1, toneMapped: !1 }), Tt = new t.SphereGeometry(1, 32, 24), Rt = new t.ConeGeometry(1, 1, 3).translate(0, 0.5, 0), De = new t.TorusGeometry(1, 0.012, 6, 96);
50
+ function ce(e, n, s, o, f) {
51
+ const m = 1 - o;
52
+ return f.set(m * m * e.x + 2 * m * o * n.x + o * o * s.x, m * m * e.y + 2 * m * o * n.y + o * o * s.y, m * m * e.z + 2 * m * o * n.z + o * o * s.z);
53
+ }
54
+ function ve(e, n, s, o, f) {
55
+ const m = n.x - e.x, g = n.y - e.y, y = Math.hypot(m, g) || 1;
56
+ return f.copy(e).add(n).multiplyScalar(0.5), f.x += -g / y * s, f.y += m / y * s, f.z += o, f;
57
+ }
58
+ const _e = class _e {
59
+ constructor(n) {
60
+ O(this, "mesh");
61
+ O(this, "colors");
62
+ O(this, "n", 0);
63
+ O(this, "o", new t.Object3D());
64
+ O(this, "a", new t.Vector3());
65
+ O(this, "b", new t.Vector3());
66
+ this.max = n, this.colors = new Float32Array(n * 3), this.mesh = new t.InstancedMesh(Rt, 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, s, o, f, m, g, y, P) {
72
+ this.n >= this.max || P < 0.01 || (ce(n, s, o, f, this.a), ce(n, s, o, Y(f + 0.02 * m), this.b), this.b.sub(this.a), !(this.b.lengthSq() < 1e-9) && (this.o.position.copy(this.a), this.o.quaternion.setFromUnitVectors(_e.UP, this.b.normalize()), this.o.scale.set(g * 0.32, g, g * 0.32), this.o.updateMatrix(), this.mesh.setMatrixAt(this.n, this.o.matrix), this.colors[this.n * 3] = y.r * P, this.colors[this.n * 3 + 1] = y.g * P, this.colors[this.n * 3 + 2] = y.b * P, this.n++));
73
+ }
74
+ end() {
75
+ this.mesh.count = this.n, this.mesh.instanceMatrix.needsUpdate = !0, this.mesh.instanceColor.needsUpdate = !0;
76
+ }
77
+ };
78
+ O(_e, "UP", new t.Vector3(0, 1, 0));
79
+ let Ce = _e;
80
+ class We {
81
+ constructor(n, s = 32) {
82
+ O(this, "geo", new t.BufferGeometry());
83
+ O(this, "obj");
84
+ O(this, "P");
85
+ O(this, "C");
86
+ O(this, "n", 0);
87
+ O(this, "p", new t.Vector3());
88
+ this.max = n, this.seg = s, this.P = new t.BufferAttribute(new Float32Array(n * s * 6), 3), this.C = new t.BufferAttribute(new Float32Array(n * s * 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, Qe()), 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, s, o, f, m, g, y, P, z, S, v, d) {
100
+ if (this.n >= this.max || y <= g) return;
101
+ const M = this.seg, i = this.P, l = this.C;
102
+ for (let a = 0; a < M; a++)
103
+ for (let C = 0; C < 2; C++) {
104
+ const u = g + (y - g) * (a + C) / M;
105
+ ce(n, s, o, u, this.p);
106
+ const r = (this.n * M + a) * 2 + C;
107
+ i.setXYZ(r, this.p.x, this.p.y, this.p.z);
108
+ let c = m;
109
+ P > 0 && (c += P * Math.pow(Math.max(0, Math.sin((u * 9 - S * 0.9 * z) * Math.PI)), 8)), c *= 0.2 + 0.8 * Y(Math.min((u - g) / 0.06, (y - u) / 0.04)), v >= 0 && (c += d * Math.exp(-(((u - v) / 0.045) ** 2))), l.setXYZ(r, f.r * c, f.g * c, f.b * c);
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 Me = 15, ze = 7.5, Bt = (
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
+ ), Vt = (
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
+ O(this, "geo", new t.BufferGeometry());
133
+ O(this, "mat", new t.ShaderMaterial({ uniforms: { uScale: { value: 400 } }, vertexShader: Bt, fragmentShader: Vt, transparent: !0, depthWrite: !1, blending: t.AdditiveBlending }));
134
+ O(this, "obj");
135
+ O(this, "P");
136
+ O(this, "S");
137
+ O(this, "C");
138
+ O(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, s, o) {
142
+ this.mat.uniforms.uScale.value = n * s / (2 * Math.tan(o * Math.PI / 360));
143
+ }
144
+ begin() {
145
+ this.n = 0;
146
+ }
147
+ add(n, s, o, f) {
148
+ this.n >= this.max || (this.P.setXYZ(this.n, n.x, n.y, n.z), this.S.setX(this.n, s), this.C.setXYZ(this.n, o.r * f, o.g * f, o.b * f), 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 _t = 260, Oe = 40, Ee = 8, Te = 4, jt = new t.Color("#9db4ff"), Ft = (
155
+ /* glsl */
156
+ "varying vec2 vUv; void main(){ vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }"
157
+ ), Ot = (
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 * (2.0 + uAct * 0.9) + vec3(0.55, 0.6, 0.95) * core * 0.5;
185
+ gl_FragColor = vec4(c, 1.0);
186
+ }`
187
+ ), Et = (
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 It({ galaxy: e }) {
201
+ const n = T(() => rt(e, _t), [e]), s = n.nodes.length, { size: o, gl: f, camera: m } = Pe(), g = E([]), y = E([]), P = E(Array(Te).fill("")), z = E([]), S = T(() => {
202
+ const r = new Float32Array(s * 3), c = -0.18, h = Math.cos(c), x = Math.sin(c);
203
+ n.nodes.forEach((A, B) => {
204
+ const F = $(A.id, 1);
205
+ let q, _;
206
+ if (F < 0.22) {
207
+ const X = 0.22 * Math.sqrt(-2 * Math.log(1 - $(A.id, 2) * 0.95)) * 0.6, D = $(A.id, 3) * Math.PI * 2;
208
+ q = Math.cos(D) * X * Me, _ = Math.sin(D) * X * ze;
209
+ } else {
210
+ const X = F < 0.61 ? 0 : Math.PI, D = 0.12 + 0.88 * Math.sqrt($(A.id, 2)), se = X + D * 3.1 + ($(A.id, 3) - 0.5) * (0.6 + D * 0.7), ee = 1 + ($(A.id, 7) - 0.5) * 0.35;
211
+ q = Math.cos(se) * D * Me * 0.95 * ee, _ = Math.sin(se) * D * ze * 0.95 * ee;
212
+ }
213
+ r.set([q * h - _ * x, q * x + _ * h, ($(A.id, 4) - 0.5) * 4], B * 3);
214
+ }), st(n, r, Me * 0.12);
215
+ const V = n.nodes.map((A) => new t.Color(at[A.kind] ?? "#94a3b8").lerp(jt, 0.45).multiplyScalar(1)), K = n.nodes.map((A) => 0.42 + Math.pow($(A.id, 5), 4) * 0.55), j = new t.BufferGeometry();
216
+ j.setAttribute("position", new t.BufferAttribute(r, 3)), j.setAttribute("aSize", new t.BufferAttribute(new Float32Array(s), 1)), j.setAttribute("aColor", new t.BufferAttribute(new Float32Array(s * 3), 3));
217
+ const L = new Map(n.nodes.map((A, B) => [A.id, B])), I = [], W = new t.Vector3(), k = new t.Vector3();
218
+ for (const A of n.links) {
219
+ const B = L.get(A.source), F = L.get(A.target);
220
+ B === void 0 || F === void 0 || B === F || (W.fromArray(r, B * 3), k.fromArray(r, F * 3), W.distanceTo(k) < 3.2 && I.push(B, F));
221
+ }
222
+ const R = new Float32Array(I.length * 3);
223
+ I.forEach((A, B) => R.set([r[A * 3], r[A * 3 + 1], r[A * 3 + 2]], B * 3));
224
+ const N = new t.BufferGeometry();
225
+ return N.setAttribute("position", new t.BufferAttribute(R, 3)), N.setAttribute("color", new t.BufferAttribute(new Float32Array(I.length * 3), 3)), { pos: r, base: V, baseSize: K, ngeo: j, lgeo: N, owner: Int32Array.from(I), fire: new Float32Array(s), white: new Float32Array(s), fireC: Array.from({ length: s }, () => new t.Color()), phase: n.nodes.map((A) => $(A.id, 6) * 6.283) };
226
+ }, [n, s]), v = T(
227
+ () => ({
228
+ gas: new t.ShaderMaterial({ uniforms: { uTime: { value: 0 }, uAct: { value: 0 } }, vertexShader: Ft, fragmentShader: Ot, transparent: !0, depthWrite: !1, blending: t.AdditiveBlending }),
229
+ nodes: new t.ShaderMaterial({ uniforms: { uScale: { value: 400 } }, vertexShader: Et, 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: Ee }, () => ge(He(), "#000"))
232
+ }),
233
+ []
234
+ ), d = T(() => new We(Oe, 24), []), M = T(() => new Ce(Oe), []), i = T(() => new Fe(Oe), []), l = T(() => /* @__PURE__ */ new Map(), [n]), a = T(() => ({ v: new t.Vector3(), w: new t.Vector3(), ctrl: new t.Vector3(), h: new t.Vector3(), c: new t.Color(), act: 0 }), []), C = (r) => {
235
+ let c = l.get(r);
236
+ return c === void 0 && l.set(r, c = ft(n, r)), c;
237
+ };
238
+ return fe(({ clock: r }) => {
239
+ const c = performance.now(), h = Math.max(1e-4, Be.graph.scale), x = re ? 0 : r.elapsedTime, V = m.fov, K = f.getPixelRatio();
240
+ v.nodes.uniforms.uScale.value = o.height * K / (2 * Math.tan(V * Math.PI / 360)) * Be.graph.scale * 2.1, i.setScale(o.height, K, V);
241
+ const { pos: j, base: L, baseSize: I, fire: W, white: k, fireC: R, phase: N } = S, { v: A, w: B, ctrl: F, h: q, c: _ } = a;
242
+ W.fill(0), k.fill(0), d.begin(), M.begin(), i.begin();
243
+ let X = 0, D = 0;
244
+ for (const p of G.flares) {
245
+ const w = C(p.node), U = (c - p.start) / 1e3, pe = G.instances.get(p.instance), le = pe ? Ve[pe.type] : Ae, te = p.op === "write", Q = U < 0.3 ? U / 0.3 : Math.exp(-(U - 0.3) * 1.1);
246
+ if (D = Math.max(D, Q), Q > W[w] && (W[w] = Q, R[w].copy(te ? H : le), k[w] = te ? 1 : 0), A.fromArray(j, w * 3), te && U < 1.6 && X < Ee) {
247
+ const ne = z.current[X];
248
+ if (ne) {
249
+ const ae = U / 1.6;
250
+ ne.visible = !0, ne.position.copy(A), ne.scale.setScalar(0.4 + ae * 3.2), v.ripples[X].color.setScalar((1 - ae) * (1 - ae) * 0.9);
251
+ }
252
+ X++;
253
+ }
254
+ const oe = ie(p.instance);
255
+ if (oe && U < 2) {
256
+ it(A, B), ve(oe, B, 1.2, 2.5, F);
257
+ const ne = Math.min(1, U / 0.25) * Math.pow(1 - U / 2, 1.5), ae = te ? Math.min(1, U * 0.9) : 1 - Math.min(1, U * 0.9);
258
+ _.copy(te ? H : le).lerp(H, 0.2), d.add(oe, F, B, _, (te ? 0.55 : 0.4) * ne, 0.04, 0.99, 0, 1, x, ae, 1.9 * ne), ae > 0.02 && ae < 0.98 && (ce(oe, F, B, ae, q), i.add(q, 0.7, _, 1.6 * ne)), te ? M.add(oe, F, B, 0.95, 1, 0.4, H, ne * 1.2) : M.add(oe, F, B, 0.07, -1, 0.4, _, ne * 1.5);
259
+ }
260
+ }
261
+ for (let p = X; p < Ee; p++) {
262
+ const w = z.current[p];
263
+ w && (w.visible = !1);
264
+ }
265
+ d.end(), M.end(), i.end(), a.act += (D - a.act) * 0.05, v.gas.uniforms.uTime.value = x, v.gas.uniforms.uAct.value = a.act;
266
+ const se = S.ngeo.getAttribute("aSize"), ee = S.ngeo.getAttribute("aColor");
267
+ for (let p = 0; p < s; p++) {
268
+ const w = W[p], U = re ? 1 : 0.85 + 0.15 * Math.sin(x * 0.9 + N[p]);
269
+ se.setX(p, I[p] + w * (0.9 + k[p] * 0.5)), _.copy(L[p]).multiplyScalar(U), w > 0.01 && (_.r += R[p].r * w * 1.5 + w * (0.25 + k[p]), _.g += R[p].g * w * 1.5 + w * (0.25 + k[p]), _.b += R[p].b * w * 1.5 + w * (0.25 + k[p])), ee.setXYZ(p, _.r, _.g, _.b);
270
+ }
271
+ se.needsUpdate = !0, ee.needsUpdate = !0;
272
+ const de = S.lgeo.getAttribute("color"), ue = S.owner;
273
+ for (let p = 0; p < ue.length; p++) {
274
+ const w = Math.max(W[ue[p]], W[ue[p ^ 1]]);
275
+ de.setXYZ(p, 0.11 + w * 0.45, 0.13 + w * 0.5, 0.3 + w * 0.6);
276
+ }
277
+ de.needsUpdate = !0;
278
+ let Z = 0;
279
+ for (let p = G.flares.length - 1; p >= 0 && Z < Te; p--) {
280
+ const w = G.flares[p];
281
+ if (c - w.start > 2200) break;
282
+ if (w.area) continue;
283
+ let U = !1;
284
+ for (let Q = 0; Q < Z; Q++) P.current[Q] === w.node && (U = !0);
285
+ if (U) continue;
286
+ const pe = C(w.node);
287
+ for (let Q = 0; Q < Z; Q++) {
288
+ const oe = y.current[Q];
289
+ oe && Math.abs(oe.position.y - j[pe * 3 + 1]) < 0.9 / h && Math.abs(oe.position.x - j[pe * 3]) < 4.5 / h && (U = !0);
290
+ }
291
+ if (U) continue;
292
+ const le = g.current[Z], te = y.current[Z];
293
+ le && te && (te.position.fromArray(j, pe * 3), P.current[Z] !== w.node && (le.setText(`${w.op === "write" ? "wrote" : "read"} · ${w.node}`), le.setColor(w.op === "write" ? "#ffffff" : "#9db4ff")), le.setOpacity(Y(1.4 - (c - w.start) / 1600))), P.current[Z] = w.node, Z++;
294
+ }
295
+ for (let p = Z; p < Te; p++) {
296
+ const w = g.current[p];
297
+ w == null || w.setOpacity(0), P.current[p] = "";
298
+ }
299
+ }), /* @__PURE__ */ J(we, { children: [
300
+ /* @__PURE__ */ b("mesh", { material: v.gas, position: [0, 0, -1], rotation: [0, 0, -0.18], renderOrder: -5, children: /* @__PURE__ */ b("planeGeometry", { args: [Me * 2.6, ze * 2.9] }) }),
301
+ /* @__PURE__ */ b("lineSegments", { geometry: S.lgeo, material: v.fil, frustumCulled: !1 }),
302
+ /* @__PURE__ */ b("points", { geometry: S.ngeo, material: v.nodes, frustumCulled: !1 }),
303
+ v.ripples.map((r, c) => /* @__PURE__ */ b("sprite", { ref: (h) => void (z.current[c] = h), material: r, visible: !1 }, c)),
304
+ /* @__PURE__ */ J(ct, { children: [
305
+ /* @__PURE__ */ b("primitive", { object: d.obj }),
306
+ /* @__PURE__ */ b("primitive", { object: M.mesh }),
307
+ /* @__PURE__ */ b("primitive", { object: i.obj })
308
+ ] }),
309
+ Array.from({ length: Te }, (r, c) => /* @__PURE__ */ b("group", { ref: (h) => void (y.current[c] = h), children: /* @__PURE__ */ b(je, { ref: (h) => void (g.current[c] = h), text: "", offset: [0, 0.4], size: 0.24, opacity: 0, fadeMs: 250, pxRange: [8, 12] }) }, c)),
310
+ /* @__PURE__ */ b(lt, { position: [0, ze * 1.15, 0], suffix: " · nebula", color: "#8b9cff", letterSpacing: 0.04, size: 0.28, opacity: 0.85, pxRange: [8, 12] })
311
+ ] });
312
+ }
313
+ new t.Color("#8792b5");
314
+ new t.Vector3();
315
+ const Ge = 48;
316
+ function Lt() {
317
+ const { size: e, gl: n, camera: s } = Pe(), o = T(() => new We(Ge, 36), []), f = T(() => new Ce(Ge), []), m = T(() => new Fe(Ge), []), g = T(() => ({ a: new t.Vector3(), b: new t.Vector3(), c: new t.Vector3(), h: new t.Vector3(), col: new t.Color() }), []);
318
+ return fe(({ clock: y }) => {
319
+ const P = performance.now(), z = re ? 0 : y.elapsedTime;
320
+ m.setScale(e.height, n.getPixelRatio(), s.fov), o.begin(), f.begin(), m.begin();
321
+ const { a: S, b: v, c: d, h: M, col: i } = g;
322
+ for (const l of G.mcpPending.values()) {
323
+ const a = ie(l.instance), C = Ne(l.server), u = G.mcpServers.get(l.server);
324
+ if (!a || !u || !C) continue;
325
+ v.copy(C), S.copy(a), ve(S, v, 1.5, 1.2, d);
326
+ const r = dt(l, P);
327
+ i.set(u.color).lerp(Ie, Y(r / 1.2)), r > 1.2 && i.lerp(xt, Y((r - 1.2) / 1));
328
+ const c = (0.2 + Math.min(0.35, r * 0.15)) * be(r / 0.3), h = 0.06 + 0.86 * be(r / 0.45);
329
+ if (o.add(S, d, v, i, c, 0.06, h, 0.9, 1, z, r < 0.45 ? h : -1, 1.2), r > 0.45 && f.add(S, d, v, 0.9, 1, 0.42, i, 0.6 + c), l.resource) {
330
+ const x = Xe(l.server, l.resource);
331
+ x && (ve(v, x, 0.3, 0.2, d), o.add(v, d, x, i, c * 0.9, 0.12, 0.88, 0.9, 1, z, -1, 0), f.add(v, d, x, 0.8, 1, 0.3, i, 0.5 + c));
332
+ }
333
+ }
334
+ for (const l of G.mcpCalls) {
335
+ if (l.phase !== "result") continue;
336
+ const a = Y((P - l.start) / l.dur);
337
+ if (a >= 1) continue;
338
+ const C = ie(l.instance), u = Ne(l.server), r = G.mcpServers.get(l.server);
339
+ if (!C || !r || !u) continue;
340
+ v.copy(u), i.set(r.color).lerp(H, 0.4);
341
+ const c = l.resource ? Xe(l.server, l.resource) : void 0, h = c ? 0.3 : 0;
342
+ if (c && a < h) {
343
+ const x = xe(a / h);
344
+ ve(v, c, 0.3, 0.2, d), o.add(v, d, c, i, 0.15, 0.12, 0.88, 0, 1, z, 1 - x, 1.4), ce(v, d, c, 1 - x, M), m.add(M, 0.6, i, 1.5);
345
+ } else {
346
+ const x = xe((a - h) / (1 - h));
347
+ S.copy(C), ve(S, v, 1.5, 1.2, d);
348
+ const V = 1 - Math.max(0, (x - 0.85) / 0.15);
349
+ o.add(S, d, v, i, 0.22 * V, 0.06, 0.94, 0, 1, z, 1 - x, 1.6 * V), ce(S, d, v, 1 - x, M), m.add(M, 0.75, i, 1.6 * V), f.add(S, d, v, 0.08, -1, 0.45, i, 1.3 * V);
350
+ }
351
+ }
352
+ o.end(), f.end(), m.end();
353
+ }), /* @__PURE__ */ J(we, { children: [
354
+ /* @__PURE__ */ b("primitive", { object: o.obj }),
355
+ /* @__PURE__ */ b("primitive", { object: f.mesh }),
356
+ /* @__PURE__ */ b("primitive", { object: m.obj })
357
+ ] });
358
+ }
359
+ function kt({ run: e }) {
360
+ const n = T(() => new t.Color(e.color), [e.color]), s = T(() => ge(Le(), "#000"), []), o = E(null), f = E(null);
361
+ return fe(({ clock: m }) => {
362
+ var M;
363
+ const g = performance.now(), y = e.run ?? G.runs.get(e.id), P = y ? be((g - y.startedAt) / 1500) : 1, z = y != null && y.endedAt ? Y(1 - (g - y.endedAt - (ut - 2500)) / 2500) : 1, S = re ? 1 : 0.9 + 0.1 * Math.sin(m.elapsedTime * 0.5 + e.index);
364
+ s.color.copy(n).multiplyScalar(0.075 * P * z * S);
365
+ const v = Math.abs(e.side.x) * e.hu + Math.abs(e.axis.x) * e.hv, d = Math.abs(e.side.y) * e.hu + Math.abs(e.axis.y) * e.hv;
366
+ o.current && (o.current.position.set(e.origin.x, e.origin.y, -3), o.current.scale.set(v * 2.8 + 6, d * 2.8 + 5, 1)), (M = f.current) == null || M.position.set(e.origin.x, e.origin.y + d + 0.7, 0);
367
+ }), /* @__PURE__ */ J(we, { children: [
368
+ /* @__PURE__ */ b("sprite", { ref: o, material: s }),
369
+ /* @__PURE__ */ b("group", { ref: f, children: e.run && /* @__PURE__ */ b(Ut, { run: e.run }) })
370
+ ] });
371
+ }
372
+ function Ut({ run: e }) {
373
+ pt();
374
+ const n = e.status !== "started" || ht(e);
375
+ return /* @__PURE__ */ b(
376
+ je,
377
+ {
378
+ text: e.topic,
379
+ secondary: mt(e, { base: "#94a3c8", current: "#fde68a", done: "#cbd5e1" }, ["running…", "run complete"]),
380
+ color: e.color,
381
+ textColor: "#e6ecff",
382
+ plate: "none",
383
+ anchorY: "bottom",
384
+ uppercase: !0,
385
+ letterSpacing: 0.12,
386
+ size: 0.34,
387
+ maxWidth: 11,
388
+ opacity: n ? 0.5 : 0.92,
389
+ fadeMs: 600,
390
+ pxRange: [10, 14],
391
+ glow: 1.1
392
+ }
393
+ );
394
+ }
395
+ const he = 6, ye = 6, me = 28, Se = 3, Kt = 2.2;
396
+ function Wt() {
397
+ const { size: e, gl: n, camera: s } = Pe(), o = E(/* @__PURE__ */ new Set()), f = E([]), m = E([]), g = E([]), y = E([]), P = T(() => {
398
+ const d = new t.BufferGeometry();
399
+ return d.setAttribute("position", new t.BufferAttribute(new Float32Array(he * Se * me * 6), 3)), d.setAttribute("color", new t.BufferAttribute(new Float32Array(he * Se * me * 6), 3)), d.boundingSphere = new t.Sphere(new t.Vector3(), 1e4), d;
400
+ }, []), z = T(() => Qe(), []), S = T(() => new Fe(he * (2 + ye)), []), v = T(() => ({ h: new t.Vector3(), p: new t.Vector3() }), []);
401
+ return fe(() => {
402
+ const d = performance.now();
403
+ for (const u of G.runs.values()) {
404
+ if (!u.final || o.current.has(u.id)) continue;
405
+ o.current.add(u.id);
406
+ const r = Be.runs.get(u.id);
407
+ if (!r) continue;
408
+ let c;
409
+ for (const I of G.instances.values()) I.run === u.id && !I.parent && (c = ie(I.id) ?? c);
410
+ const h = (c ?? r.origin).clone(), x = Be.core.r, V = Math.abs(h.x) > 0.5 ? h.x < 0 ? 1 : -1 : $(u.id, 23) < 0.5 ? 1 : -1, K = h.x + V * (0.9 + $(u.id, 21) * 0.5) * (x + 3), j = h.y - (0.25 + $(u.id, 22) * 0.2) * (x + 3), L = new t.Vector3(K - h.x, j - h.y, 1.5).normalize();
411
+ f.current.push({ run: u.id, start: d, from: h, dir: L, travel: 1.3 * (x + 4), color: new t.Color(u.color).lerp(H, 0.7), text: u.final }), f.current.length > he && f.current.shift();
412
+ }
413
+ if (o.current.size > 200)
414
+ for (const u of o.current) G.runs.has(u) || o.current.delete(u);
415
+ f.current = f.current.filter((u) => d - u.start < 5200), S.setScale(e.height, n.getPixelRatio(), s.fov), S.begin();
416
+ const M = P.getAttribute("position"), i = P.getAttribute("color");
417
+ let l = 0;
418
+ const { h: a, p: C } = v;
419
+ for (let u = 0; u < he; u++) {
420
+ const r = f.current[u], c = m.current[u], h = g.current[u];
421
+ if (!r) {
422
+ c == null || c.setOpacity(0);
423
+ continue;
424
+ }
425
+ const x = (d - r.start) / 1e3;
426
+ c && h && (h.position.copy(r.from).add(C.set(0, -2.3, 0)), y.current[u] !== r.run + r.start && (y.current[u] = r.run + r.start, c.setText(`final answer - ${r.text.length > 64 ? r.text.slice(0, 62) + "…" : r.text}`)), c.setOpacity(Y(x / 0.3) * Y((5.2 - x) / 1.2)));
427
+ const V = x / Kt;
428
+ if (V >= 1.25) continue;
429
+ const K = r.travel * (re ? 0.6 : 1), j = K * be(Math.min(1, V)), L = Math.min(7.5, K * 0.4) * Math.min(1, V * 3) * (V > 1 ? Math.max(0, 1 - (V - 1) / 0.25) : 1), I = V > 1 ? Math.max(0, 1 - (V - 1) / 0.25) : 1, W = -r.dir.y, k = r.dir.x;
430
+ for (let R = 0; R < Se; R++)
431
+ for (let N = 0; N < me; N++)
432
+ for (let A = 0; A < 2; A++) {
433
+ const B = (N + A) / me, F = (R - 1) * 0.05 * (1 - B);
434
+ C.copy(r.from).addScaledVector(r.dir, j - L * (1 - B));
435
+ const q = ((l * Se + R) * me + N) * 2 + A;
436
+ M.setXYZ(q, C.x + W * F, C.y + k * F, C.z);
437
+ const _ = Math.pow(B, 2) * (R === 1 ? 2.6 : 1.2) * I;
438
+ i.setXYZ(q, r.color.r * _, r.color.g * _, r.color.b * _);
439
+ }
440
+ l++, a.copy(r.from).addScaledVector(r.dir, j), S.add(a, 1.3, H, 1.6 * I), S.add(a, 3.2, Ae, 0.35 * I);
441
+ for (let R = 1; R <= ye; R++) {
442
+ const N = R / ye * L;
443
+ C.copy(r.from).addScaledVector(r.dir, j - N), C.y += Math.sin(R * 2.3 + r.start) * 0.08, S.add(C, 0.5 * (1 - R / (ye + 1)), r.color, 0.9 * I * (1 - R / (ye + 1)));
444
+ }
445
+ }
446
+ P.setDrawRange(0, l * Se * me * 2), M.needsUpdate = !0, i.needsUpdate = !0, S.end();
447
+ }), /* @__PURE__ */ J(we, { children: [
448
+ /* @__PURE__ */ b("lineSegments", { geometry: P, material: z, frustumCulled: !1 }),
449
+ /* @__PURE__ */ b("primitive", { object: S.obj }),
450
+ Array.from({ length: he }, (d, M) => /* @__PURE__ */ b("group", { ref: (i) => void (g.current[M] = i), children: /* @__PURE__ */ b(je, { ref: (i) => void (m.current[M] = i), text: "", color: "#e0e7ff", size: 0.26, maxWidth: 11, opacity: 0, pxRange: [8, 12], renderOrder: 24 }) }, M))
451
+ ] });
452
+ }
453
+ const Nt = (
454
+ /* glsl */
455
+ `
456
+ varying vec3 vDir;
457
+ void main(){ vDir = normalize(position); gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }`
458
+ ), Xt = (
459
+ /* glsl */
460
+ `
461
+ varying vec3 vDir;
462
+ float h(vec2 p){ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }
463
+ float n(vec2 p){ vec2 i = floor(p); vec2 f = fract(p); f = f*f*(3.0-2.0*f);
464
+ 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); }
465
+ 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; }
466
+ void main(){
467
+ vec3 d = normalize(vDir);
468
+ // zenith indigo → horizon deep navy
469
+ vec3 top = vec3(0.007, 0.009, 0.042);
470
+ vec3 mid = vec3(0.0035, 0.0045, 0.02);
471
+ vec3 low = vec3(0.0012, 0.0016, 0.007);
472
+ float y = d.y;
473
+ vec3 col = y > 0.0 ? mix(mid, top, smoothstep(0.0, 0.85, y)) : mix(mid, low, smoothstep(0.0, -0.7, y));
474
+ // Milky Way: a soft dusty band tilted across the sky
475
+ vec3 bn = normalize(vec3(0.42, 0.9, -0.12));
476
+ float band = exp(-pow(dot(d, bn) / 0.2, 2.0));
477
+ vec2 uv = vec2(atan(d.x, -d.z), dot(d, bn)) * vec2(3.0, 9.0);
478
+ float dust = fbm(uv * 1.3);
479
+ float lanes = smoothstep(0.45, 0.75, fbm(uv * 2.4 + 7.0));
480
+ 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);
481
+ gl_FragColor = vec4(col, 1.0);
482
+ }`
483
+ ), Dt = (
484
+ /* glsl */
485
+ `
486
+ attribute float aSize; attribute float aPhase; attribute vec3 aColor;
487
+ uniform float uTime; uniform float uScale; varying vec3 vC;
488
+ void main(){
489
+ vec4 mv = modelViewMatrix * vec4(position, 1.0);
490
+ float tw = 0.78 + 0.22 * sin(uTime * (0.6 + fract(aPhase * 7.3) * 1.6) + aPhase * 6.2831);
491
+ vC = aColor * tw;
492
+ gl_PointSize = max(1.0, aSize * uScale / -mv.z);
493
+ gl_Position = projectionMatrix * mv;
494
+ }`
495
+ ), qt = (
496
+ /* glsl */
497
+ `
498
+ varying vec3 vC;
499
+ void main(){ float r = length(gl_PointCoord - 0.5) * 2.0; if (r > 1.0) discard;
500
+ float core = smoothstep(0.5, 0.0, r); float halo = pow(1.0 - r, 3.0);
501
+ gl_FragColor = vec4(vC * (core + halo * 0.35), 1.0); }`
502
+ ), qe = ["#ffffff", "#dbe7ff", "#b9cdff", "#9fb8ff", "#fff3dd", "#ffe2bf"].map((e) => new t.Color(e));
503
+ function Yt() {
504
+ const { size: e, gl: n, camera: s } = Pe(), o = T(() => {
505
+ const g = re ? 1600 : 3200, y = new Float32Array(g * 3), P = new Float32Array(g), z = new Float32Array(g), S = new Float32Array(g * 3), v = new t.Vector3(0.42, 0.9, -0.12).normalize(), d = new t.Vector3();
506
+ let M = 1234567;
507
+ const i = () => (M = M * 16807 % 2147483647) / 2147483647;
508
+ for (let a = 0; a < g; a++) {
509
+ for (let h = 0; h < 8 && (d.set(i() * 2 - 1, i() * 2 - 1, i() * 2 - 1), !(!(d.lengthSq() > 1 || d.lengthSq() < 0.01) && (d.normalize(), !(a % 5 < 2 && Math.abs(d.dot(v)) > 0.22)))); h++)
510
+ ;
511
+ d.z > 0.3 && (d.z *= -1);
512
+ const C = 110 + i() * 60;
513
+ y.set([d.x * C, d.y * C, d.z * C], a * 3);
514
+ const u = Math.pow(i(), 3.2);
515
+ P[a] = 0.55 + u * 2.6, z[a] = i();
516
+ const r = qe[Math.floor(i() * qe.length)], c = 0.22 + u * 0.75;
517
+ S.set([r.r * c, r.g * c, r.b * c], a * 3);
518
+ }
519
+ const l = new t.BufferGeometry();
520
+ return l.setAttribute("position", new t.BufferAttribute(y, 3)), l.setAttribute("aSize", new t.BufferAttribute(P, 1)), l.setAttribute("aPhase", new t.BufferAttribute(z, 1)), l.setAttribute("aColor", new t.BufferAttribute(S, 3)), l;
521
+ }, []), f = T(
522
+ () => ({
523
+ dome: new t.ShaderMaterial({ vertexShader: Nt, fragmentShader: Xt, side: t.BackSide, depthWrite: !1 }),
524
+ stars: new t.ShaderMaterial({ uniforms: { uTime: { value: 0 }, uScale: { value: 400 } }, vertexShader: Dt, fragmentShader: qt, transparent: !0, depthWrite: !1, blending: t.AdditiveBlending })
525
+ }),
526
+ []
527
+ ), m = E(null);
528
+ return fe(({ clock: g }) => {
529
+ var y;
530
+ (y = m.current) == null || y.position.copy(s.position), f.stars.uniforms.uTime.value = re ? 0 : g.elapsedTime, f.stars.uniforms.uScale.value = e.height * n.getPixelRatio() / (2 * Math.tan(s.fov * Math.PI / 360)) * 0.22;
531
+ }), /* @__PURE__ */ J("group", { ref: m, children: [
532
+ /* @__PURE__ */ b("mesh", { material: f.dome, renderOrder: -10, frustumCulled: !1, children: /* @__PURE__ */ b("sphereGeometry", { args: [400, 48, 32] }) }),
533
+ /* @__PURE__ */ b("points", { geometry: o, material: f.stars, frustumCulled: !1, renderOrder: -9 })
534
+ ] });
535
+ }
536
+ const Zt = new t.Color("#6f7fb8"), $t = new t.Color("#ff6b7a"), ke = 0.95, Ht = new t.MeshBasicMaterial({ colorWrite: !1, depthWrite: !1, transparent: !0, opacity: 0 });
537
+ function Qt({ agent: e, selected: n, onSelect: s }) {
538
+ const o = e.inst, f = E(null), m = E(null), g = E(null), y = E(null), P = E(null), z = E(null), S = E(null), v = E(null), d = E(null), M = T(() => [...o.id].reduce((r, c) => (r * 31 + c.charCodeAt(0)) % 9973, 7) / 9973, [o.id]), i = Ve[o.type], l = T(
539
+ () => ({
540
+ halo: ge(Le(), i),
541
+ spikes: ge(Pt(), i),
542
+ core: ge(Le(), "#fff"),
543
+ flare: ge(He(), i),
544
+ corona: new t.MeshBasicMaterial({ color: Ie, blending: t.AdditiveBlending, transparent: !0, depthWrite: !1, toneMapped: !1 }),
545
+ sel: new t.MeshBasicMaterial({ color: "#dbe7ff", blending: t.AdditiveBlending, transparent: !0, depthWrite: !1, toneMapped: !1 })
546
+ }),
547
+ [i]
548
+ ), a = T(
549
+ () => ({ calls: o.llmCalls, flareAt: -1e9, flareK: 1, coronaK: 0, selK: 0, c: new t.Color() }),
550
+ // eslint-disable-next-line react-hooks/exhaustive-deps
551
+ []
552
+ );
553
+ Mt(() => {
554
+ l.spikes.rotation = (M - 0.5) * 0.5;
555
+ }, [l, M]), fe(({ clock: r }) => {
556
+ var ue, Z;
557
+ const c = performance.now(), h = r.elapsedTime, x = re ? 0 : 0.05 * Re.spread;
558
+ e.live.set(e.pos.x + Math.sin(h * 0.21 + M * 20) * x, e.pos.y + Math.cos(h * 0.17 + M * 13) * x, e.pos.z);
559
+ const V = e.scale;
560
+ f.current && (f.current.position.copy(e.live), f.current.scale.setScalar(Math.max(1e-4, V))), (ue = v.current) == null || ue.position.set(e.live.x, e.live.y - 0.95 * V - 0.35, e.live.z);
561
+ const K = (c - o.bornAt) / 1e3, j = o.parent && G.instances.has(o.parent) ? ke * 0.85 : 0.05, L = Y((K - j) / 0.55), I = be(L), W = L > 0 ? Math.exp(-(K - j) * 3.2) : 0, k = o.exitAt ? (c - o.exitAt) / 1e3 : -1, R = k >= 0 ? xe(k / 0.7) : 0, N = k >= 0 ? Y((k - 0.7) / 1.7) : 0, A = k < 0;
562
+ o.llmCalls !== a.calls && (a.calls = o.llmCalls, a.flareAt = c, a.flareK = o.pulse);
563
+ const B = (c - a.flareAt) / 1e3, F = gt(o, c);
564
+ let q = !1;
565
+ for (const p of G.mcpPending.values()) p.instance === o.id && (q = !0);
566
+ const _ = A && (o.status === "thinking" || o.status === "spawning"), X = re ? 0 : 1, D = 1 + (_ ? 0.16 : 0.05) * Math.sin(h * 3.3 + M * 40) * Math.sin(h * 1.9 + M * 17) * X, se = (_ ? 1 : 0.62) * D + F * 0.25 + W * 1.2;
567
+ a.c.copy(i), A || a.c.lerp(o.status === "failed" ? $t : Zt, R);
568
+ const ee = (1 - R * 0.8) * (1 - N), de = I * (1 - R * 0.62);
569
+ if (y.current && (y.current.scale.setScalar(Math.max(1e-4, de * (0.95 + F * 0.12))), l.core.color.copy(H).lerp(a.c, R).multiplyScalar(Math.min(1.6, se) * ee)), m.current && (m.current.scale.setScalar(Math.max(1e-4, de * (_ ? 3.4 : 2.7) * (1 + F * 0.18))), l.halo.color.copy(a.c).multiplyScalar(0.42 * se * ee)), g.current) {
570
+ const p = B < 1.2 ? Math.exp(-B * 2.6) * a.flareK * 0.5 : 0, w = (_ ? 1 : 0.55) * (1 - R);
571
+ g.current.scale.setScalar(Math.max(1e-4, de * (3 + F * 1.2 + p * 4 + W * 3))), l.spikes.color.copy(a.c).lerp(H, 0.3).multiplyScalar((0.55 * w * D + F * 0.25 + p * 0.6 + W) * ee);
572
+ }
573
+ if (P.current) {
574
+ const p = B < 1.1 && A;
575
+ if (P.current.visible = p, p) {
576
+ const w = be(B / 1.1);
577
+ P.current.scale.setScalar(0.8 + w * (1.6 + a.flareK * 1.4)), l.flare.color.copy(a.c).lerp(H, 0.4).multiplyScalar((1 - w) * (1 - w) * (0.35 + a.flareK * 0.3));
578
+ }
579
+ }
580
+ if (a.coronaK += ((q && A ? 1 : 0) - a.coronaK) * 0.08, z.current) {
581
+ z.current.visible = a.coronaK > 0.02;
582
+ const p = 0.75 + 0.25 * Math.sin(h * 2.4) * X;
583
+ z.current.scale.setScalar(0.95 + 0.06 * p), z.current.rotation.z = h * 0.6 * X, l.corona.color.copy(Ie).multiplyScalar(1.4 * a.coronaK * p);
584
+ }
585
+ a.selK += ((n ? 1 : 0) - a.selK) * 0.12, S.current && (S.current.visible = a.selK > 0.02, S.current.scale.setScalar(1.1 + (1 - a.selK) * 0.5), l.sel.color.setScalar(0.9 * a.selK * ee)), (Z = d.current) == null || Z.setOpacity(vt(o.id) ? I * (A ? 0.95 : 0.6 * (1 - N)) : 0);
586
+ });
587
+ const C = (r) => {
588
+ r.stopPropagation(), s(o.id);
589
+ }, u = o.id.split(":")[2];
590
+ return /* @__PURE__ */ J(we, { children: [
591
+ /* @__PURE__ */ J("group", { ref: f, scale: 1e-4, children: [
592
+ /* @__PURE__ */ b("mesh", { geometry: Tt, material: Ht, scale: 0.75, onClick: C, onPointerOver: () => document.body.style.cursor = "pointer", onPointerOut: () => document.body.style.cursor = "" }),
593
+ /* @__PURE__ */ b("sprite", { ref: m, material: l.halo, scale: 1e-4 }),
594
+ /* @__PURE__ */ b("sprite", { ref: g, material: l.spikes, scale: 1e-4 }),
595
+ /* @__PURE__ */ b("sprite", { ref: y, material: l.core, scale: 1e-4 }),
596
+ /* @__PURE__ */ b("sprite", { ref: P, material: l.flare, visible: !1 }),
597
+ /* @__PURE__ */ b("mesh", { ref: z, geometry: De, material: l.corona, visible: !1 }),
598
+ /* @__PURE__ */ b("mesh", { ref: S, geometry: De, material: l.sel, visible: !1 })
599
+ ] }),
600
+ /* @__PURE__ */ b("group", { ref: v, children: /* @__PURE__ */ b(
601
+ je,
602
+ {
603
+ ref: d,
604
+ text: `${o.name}${u !== void 0 ? ` ${Number(u) + 1}` : ""}`,
605
+ live: o.job ? () => bt(o) : null,
606
+ color: Ue[o.type],
607
+ size: o.subagent ? 0.22 : 0.28,
608
+ letterSpacing: 0.02,
609
+ opacity: 0,
610
+ fit: !0,
611
+ pxRange: o.subagent ? [8, 11.5] : [9, 13.5]
612
+ }
613
+ ) })
614
+ ] });
615
+ }
616
+ const Ye = 96, Ze = 32;
617
+ function Jt() {
618
+ const { size: e, gl: n, camera: s } = Pe(), o = T(() => new We(Ye + Ze, 28), []), f = T(() => new Ce(Ye), []), m = T(() => new Fe(Ze), []), g = T(() => /* @__PURE__ */ new Map(), []), y = T(() => ({ ctrl: new t.Vector3(), h: new t.Vector3(), col: new t.Color(), a: new t.Vector3(), b: new t.Vector3() }), []);
619
+ return fe(({ clock: P }) => {
620
+ const z = performance.now(), S = re ? 0 : P.elapsedTime;
621
+ m.setScale(e.height, n.getPixelRatio(), s.fov), o.begin(), f.begin(), m.begin();
622
+ const { ctrl: v, col: d, h: M } = y;
623
+ for (const i of g.keys()) G.instances.has(i) || g.delete(i);
624
+ for (const i of G.instances.values()) {
625
+ if (!i.parent) continue;
626
+ const l = ie(i.parent), a = ie(i.id), C = G.instances.get(i.parent);
627
+ if (!l || !a) continue;
628
+ const u = C && !C.exitAt && !i.exitAt ? 1 : 0;
629
+ let r = g.get(i.id) ?? 0;
630
+ const c = (z - i.bornAt) / 1e3;
631
+ if (u && c < ke && (r = 1), r += (u - r) * (u ? 0.08 : 0.03), g.set(i.id, r), r < 0.01) continue;
632
+ const h = l.distanceTo(a) || 1, x = Math.min(0.3, 0.55 * Re.scale * (C ? 1.35 : 1) / h), V = Math.min(0.3, 0.5 * Re.scale / h), K = xe(c / ke);
633
+ v.copy(l).add(a).multiplyScalar(0.5);
634
+ const j = x + (1 - V - x) * K;
635
+ d.copy(Ve[i.type]).lerp(Ae, 0.5);
636
+ const L = K < 1;
637
+ o.add(l, v, a, d, (L ? 0.8 : 0.62) * r, x, j, L ? 0 : 0.55 * r, 1, S, L ? j : -1, 2.2), L ? (ce(l, v, a, j, M), m.add(M, 0.55, H, 1.3)) : f.add(l, v, a, 1 - V - 0.04, 1, (i.subagent ? 0.32 : 0.4) * Math.min(1.3, Re.scale), d, 0.95 * r);
638
+ }
639
+ for (const i of G.comets) {
640
+ const l = ie(i.from), a = ie(i.to);
641
+ if (!l || !a) continue;
642
+ const C = wt(i, z);
643
+ if (!yt(i, z)) continue;
644
+ const u = G.instances.get(i.from), r = G.instances.get(i.to);
645
+ (r == null ? void 0 : r.parent) === i.from || (u == null ? void 0 : u.parent) === i.to ? v.copy(l).add(a).multiplyScalar(0.5) : ve(l, a, 1.4, 0.8, v);
646
+ const h = xe(C);
647
+ d.copy(u ? Ve[u.type] : Ae).lerp(H, 0.45);
648
+ const x = Math.min(1, C / 0.1) * Math.min(1, (1 - C) / 0.15);
649
+ o.add(l, v, a, d, 0.9 * x, Math.max(0, h - 0.2), h, 0, 1, S, h, 1.6 * x), ce(l, v, a, h, M), m.add(M, 0.8, d, 1.4 * x);
650
+ }
651
+ o.end(), f.end(), m.end();
652
+ }), /* @__PURE__ */ J(we, { children: [
653
+ /* @__PURE__ */ b("primitive", { object: o.obj }),
654
+ /* @__PURE__ */ b("primitive", { object: f.mesh }),
655
+ /* @__PURE__ */ b("primitive", { object: m.obj })
656
+ ] });
657
+ }
658
+ const eo = { tint: "#c7d2fe", tintAmt: 0.15 }, to = {
659
+ minPolarAngle: Math.PI * 0.22,
660
+ maxPolarAngle: Math.PI * 0.78,
661
+ minAzimuthAngle: -Math.PI * 0.35,
662
+ maxAzimuthAngle: Math.PI * 0.35
663
+ };
664
+ function co() {
665
+ return /* @__PURE__ */ J(
666
+ St,
667
+ {
668
+ title: "constellation · night sky",
669
+ 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",
670
+ preset: "radial",
671
+ plane: "xy",
672
+ camera: { position: [0, 0, 34], fov: 46, far: 1200 },
673
+ controls: to,
674
+ bg: "#040618",
675
+ gl: { antialias: !0 },
676
+ fit: { nRef: 4, min: 0.62, max: 1.6, minRadius: 5.5 },
677
+ agentRadius: 1.3,
678
+ graph: { natural: Me * 1.1, radius: 3.6 },
679
+ Background: /* @__PURE__ */ b(Yt, {}),
680
+ Agent: Qt,
681
+ RunMarker: kt,
682
+ mcpStyle: eo,
683
+ GraphResource: It,
684
+ cluster: { radius: 1.5, variant: "stars", glowGain: 0.9 },
685
+ PostFX: /* @__PURE__ */ J(tt, { multisampling: 0, children: [
686
+ /* @__PURE__ */ b(ot, { mipmapBlur: !0, intensity: 0.95, luminanceThreshold: 0.22, luminanceSmoothing: 0.35, radius: 0.7 }),
687
+ /* @__PURE__ */ b(nt, { eskil: !1, offset: 0.25, darkness: 0.75 })
688
+ ] }),
689
+ children: [
690
+ /* @__PURE__ */ b(Jt, {}),
691
+ /* @__PURE__ */ b(Lt, {}),
692
+ /* @__PURE__ */ b(Wt, {})
693
+ ]
694
+ }
695
+ );
696
+ }
697
+ export {
698
+ co as default
699
+ };