agentglow 0.4.1 → 0.4.3

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.
@@ -1,793 +0,0 @@
1
- var st = Object.defineProperty;
2
- var at = (e, n, r) => n in e ? st(e, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[n] = r;
3
- var L = (e, n, r) => at(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 it, Bloom as ct, Vignette as lt } from "@react-three/postprocessing";
6
- import * as t from "three";
7
- import { T as We, h as X, K as ft, y as je, w as N, a as ce, D as ut, J as dt, L as ye, G as pt, A as ht, m as tt, c as qe, d as mt, M as Ye, R as vt, u as gt, B as bt, C as wt, e as yt, s as St, j as Mt, f as Ve, k as At, n as xt, v as Ct } from "./KitScene-qkWr95H9.js";
8
- import { useThree as Re, useFrame as se } from "@react-three/fiber";
9
- import { useMemo as P, useRef as T, useEffect as Pt } from "react";
10
- var et;
11
- const Q = typeof window < "u" && !!((et = window.matchMedia) != null && et.call(window, "(prefers-reduced-motion: reduce)").matches), H = (e) => e < 0 ? 0 : e > 1 ? 1 : e, we = (e) => 1 - Math.pow(1 - H(e), 3), xe = (e) => (e = H(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"), zt = 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 Rt = null;
20
- function Pe() {
21
- return Rt ?? (Rt = 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 Bt = null;
27
- function Tt() {
28
- return Bt ?? (Bt = Ke(256, (e, n) => {
29
- const r = n / 2, o = (h, p, y, x) => {
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,${x})`), 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 Vt = null;
40
- function ot() {
41
- return Vt ?? (Vt = 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 nt = () => new t.LineBasicMaterial({ vertexColors: !0, transparent: !0, blending: t.AdditiveBlending, depthWrite: !1, toneMapped: !1 }), Xe = new t.SphereGeometry(1, 32, 24), _t = 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(_t, 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, x) {
72
- this.n >= this.max || x < 0.01 || (fe(n, r, o, c, this.a), fe(n, r, o, H(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 * x, this.colors[this.n * 3 + 1] = y.g * x, this.colors[this.n * 3 + 2] = y.b * x, 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, nt()), 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, x, z, M, b, u) {
100
- if (this.n >= this.max || y <= p) return;
101
- const S = this.seg, a = this.P, l = this.C;
102
- for (let i = 0; i < S; i++)
103
- for (let A = 0; A < 2; A++) {
104
- const d = p + (y - p) * (i + A) / S;
105
- fe(n, r, o, d, this.p);
106
- const s = (this.n * S + i) * 2 + A;
107
- a.setXYZ(s, this.p.x, this.p.y, this.p.z);
108
- let f = h;
109
- x > 0 && (f += x * Math.pow(Math.max(0, Math.sin((d * 9 - M * 0.9 * z) * Math.PI)), 8)), f *= 0.2 + 0.8 * H(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, jt = (
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
- ), Ot = (
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: jt, fragmentShader: Ot, 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 Gt = 260, Ee = 40, Ie = 8, Te = 4, Ft = new t.Color("#9db4ff"), Et = (
155
- /* glsl */
156
- "varying vec2 vUv; void main(){ vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }"
157
- ), It = (
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
- ), Lt = (
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
- ), Nt = (
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 kt({ galaxy: e }) {
201
- const n = P(() => ({ nodes: e.nodes.slice(0, Gt), links: e.links }), [e]), r = n.nodes.length, { size: o, gl: c, camera: h } = Re(), p = T([]), y = T([]), x = T(Array(Te).fill("")), z = T([]), M = 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 Z, 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
- Z = 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
- Z = Math.cos(ae) * $ * _e * 0.95 * te, O = Math.sin(ae) * $ * Be * 0.95 * te;
212
- }
213
- s.set([Z * m - O * w, Z * w + O * m, (X(R.id, 4) - 0.5) * 4], j * 3);
214
- });
215
- const B = n.nodes.map((R) => new t.Color(ft[R.kind] ?? "#94a3b8").lerp(Ft, 0.45).multiplyScalar(1)), U = n.nodes.map((R) => 0.42 + Math.pow(X(R.id, 5), 4) * 0.55), 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: Et, fragmentShader: It, transparent: !0, depthWrite: !1, blending: t.AdditiveBlending }),
229
- nodes: new t.ShaderMaterial({ uniforms: { uScale: { value: 400 } }, vertexShader: Lt, fragmentShader: Nt, 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(ot(), "#000"))
232
- }),
233
- []
234
- ), u = P(() => new De(Ee, 24), []), S = 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 }), []), A = (s) => {
235
- let f = l.get(s);
236
- return f === void 0 && l.set(s, f = ht(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 * 2.1, a.setScale(o.height, U, B);
241
- const { pos: V, base: k, baseSize: E, fire: F, white: G, fireC: _, phase: D } = M, { v: R, w: j, ctrl: I, h: Z, c: O } = i;
242
- F.fill(0), G.fill(0), u.begin(), S.begin(), a.begin();
243
- let Y = 0, $ = 0;
244
- for (const v of N.flares) {
245
- const C = A(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
- ut(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.55 : 0.4) * re, 0.04, 0.99, 0, 1, w, ie, 1.9 * re), ie > 0.02 && ie < 0.98 && (fe(ne, I, j, ie, Z), a.add(Z, 0.7, O, 1.6 * re)), oe ? S.add(ne, I, j, 0.95, 1, 0.4, K, re * 1.2) : S.add(ne, I, j, 0.07, -1, 0.4, O, re * 1.5);
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(), S.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 = M.ngeo.getAttribute("aSize"), te = M.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 = M.lgeo.getAttribute("color"), he = M.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.11 + C * 0.45, 0.13 + C * 0.5, 0.3 + C * 0.6);
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++) x.current[ee] === C.node && (W = !0);
284
- if (W) continue;
285
- const me = A(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), x.current[J] !== C.node && (ue.setText(`${C.op === "write" ? "wrote" : "read"} · ${C.node}`), ue.setColor(C.op === "write" ? "#ffffff" : "#9db4ff")), ue.setOpacity(H(1.4 - (f - C.start) / 1600))), x.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), x.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: M.lgeo, material: b.fil, frustumCulled: !1 }),
301
- /* @__PURE__ */ g("points", { geometry: M.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(dt, { children: [
304
- /* @__PURE__ */ g("primitive", { object: u.obj }),
305
- /* @__PURE__ */ g("primitive", { object: S.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(pt, { position: [0, Be * 1.15, 0], suffix: " · nebula", color: "#8b9cff", letterSpacing: 0.04, size: 0.28, opacity: 0.85, pxRange: [8, 12] })
310
- ] });
311
- }
312
- const Ut = (
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
- ), Wt = (
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 rt(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: Ut,
346
- fragmentShader: Wt
347
- });
348
- }
349
- const Ze = new t.Color("#8792b5"), Le = 32, Kt = 0.42, Se = new t.Vector3();
350
- function Xt({ mcp: e, backend: n }) {
351
- const r = e.srv, o = n.res, c = P(() => new t.Color(r.color), [r.color]), h = P(() => rt(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 }), []), x = P(() => {
352
- const A = new t.BufferGeometry().setAttribute("position", new t.BufferAttribute(new Float32Array((Le + 1) * 3), 3));
353
- return A.boundingSphere = new t.Sphere(new t.Vector3(), 1e4), A;
354
- }, []), z = P(() => Object.assign(new t.Line(x, y), { frustumCulled: !1 }), [x, y]), M = P(() => X(o.name, 5) < 0.5 ? 1 : -1, [o.name]), b = T(null), u = T(null), S = T(null), a = T(null), l = T("");
355
- se(({ clock: A }) => {
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 = A.elapsedTime * 0.3 * M), Se.subVectors(n.pos, e.pos);
359
- const s = Math.hypot(Se.x, Se.y), f = Math.atan2(Se.y, Se.x), m = x.getAttribute("position");
360
- for (let F = 0; F <= Le; F++) {
361
- const G = f + (F / Le - 0.5) * 2 * Kt;
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 = tt(o.activeAt, d, 1.4), U = w ? 0.5 + 0.5 * Math.sin(A.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 = S.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: S, 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 Dt({ 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: rt(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]), x = T(null), z = T(null), M = T(null);
394
- return se(({ clock: b }) => {
395
- var l, i;
396
- (l = x.current) == null || l.position.copy(e.pos);
397
- const u = performance.now(), S = n.inflight > 0, a = tt(n.activeAt, u, 1.4);
398
- p.body.uniforms.uAct.value = S ? 1 : a, p.halo.color.copy(r).multiplyScalar(S ? 0.28 : 0.07 + a * 0.18), (i = M.current) == null || i.scale.setScalar(c * (5 + (S ? 0.6 : 0))), z.current && !Q && (z.current.rotation.y = b.elapsedTime * 0.05);
399
- }), /* @__PURE__ */ q("group", { ref: x, children: [
400
- /* @__PURE__ */ g("sprite", { ref: M, 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 qt() {
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 x = 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: M, b, c: u, h: S, col: a } = p;
415
- for (const l of N.mcpPending.values()) {
416
- const i = ce(l.instance), A = qe(l.server), d = N.mcpServers.get(l.server);
417
- if (!i || !d || !A) continue;
418
- b.copy(A), M.copy(i), be(M, b, 1.5, 1.2, u);
419
- const s = mt(l, x);
420
- a.set(d.color).lerp(ke, H(s / 1.2)), s > 1.2 && a.lerp(zt, H((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(M, u, b, a, f, 0.06, m, 0.9, 1, z, s < 0.45 ? m : -1, 1.2), s > 0.45 && c.add(M, 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 = H((x - l.start) / l.dur);
430
- if (i >= 1) continue;
431
- const A = ce(l.instance), d = qe(l.server), s = N.mcpServers.get(l.server);
432
- if (!A || !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 = xe(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, S), h.add(S, 0.6, a, 1.5);
438
- } else {
439
- const w = xe((i - m) / (1 - m));
440
- M.copy(A), be(M, b, 1.5, 1.2, u);
441
- const B = 1 - Math.max(0, (w - 0.85) / 0.15);
442
- o.add(M, u, b, a, 0.22 * B, 0.06, 0.94, 0, 1, z, 1 - w, 1.6 * B), fe(M, u, b, 1 - w, S), h.add(S, 0.75, a, 1.6 * B), c.add(M, 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 Yt({ 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 S;
456
- const p = performance.now(), y = e.run ?? N.runs.get(e.id), x = y ? we((p - y.startedAt) / 1500) : 1, z = y != null && y.endedAt ? H(1 - (p - y.endedAt - (vt - 2500)) / 2500) : 1, M = Q ? 1 : 0.9 + 0.1 * Math.sin(h.elapsedTime * 0.5 + e.index);
457
- r.color.copy(n).multiplyScalar(0.075 * x * z * M);
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)), (S = c.current) == null || S.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($t, { run: e.run }) })
463
- ] });
464
- }
465
- function $t({ run: e }) {
466
- gt();
467
- const n = e.status !== "started" || bt(e);
468
- return /* @__PURE__ */ g(
469
- ye,
470
- {
471
- text: e.topic,
472
- secondary: wt(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, Me = 6, ge = 28, Ae = 3, Zt = 2.2;
489
- function Ht() {
490
- const { size: e, gl: n, camera: r } = Re(), o = T(/* @__PURE__ */ new Set()), c = T([]), h = T([]), p = T([]), y = T([]), x = P(() => {
491
- const u = new t.BufferGeometry();
492
- return u.setAttribute("position", new t.BufferAttribute(new Float32Array(ve * Ae * ge * 6), 3)), u.setAttribute("color", new t.BufferAttribute(new Float32Array(ve * Ae * ge * 6), 3)), u.boundingSphere = new t.Sphere(new t.Vector3(), 1e4), u;
493
- }, []), z = P(() => nt(), []), M = P(() => new Fe(ve * (2 + Me)), []), 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), M.setScale(e.height, n.getPixelRatio(), r.fov), M.begin();
509
- const S = x.getAttribute("position"), a = x.getAttribute("color");
510
- let l = 0;
511
- const { h: i, p: A } = 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(A.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(H(w / 0.3) * H((5.2 - w) / 1.2)));
520
- const B = w / Zt;
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; _ < Ae; _++)
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
- A.copy(s.from).addScaledVector(s.dir, V - k * (1 - j));
528
- const Z = ((l * Ae + _) * ge + D) * 2 + R;
529
- S.setXYZ(Z, A.x + F * I, A.y + G * I, A.z);
530
- const O = Math.pow(j, 2) * (_ === 1 ? 2.6 : 1.2) * E;
531
- a.setXYZ(Z, s.color.r * O, s.color.g * O, s.color.b * O);
532
- }
533
- l++, i.copy(s.from).addScaledVector(s.dir, V), M.add(i, 1.3, K, 1.6 * E), M.add(i, 3.2, Ce, 0.35 * E);
534
- for (let _ = 1; _ <= Me; _++) {
535
- const D = _ / Me * k;
536
- A.copy(s.from).addScaledVector(s.dir, V - D), A.y += Math.sin(_ * 2.3 + s.start) * 0.08, M.add(A, 0.5 * (1 - _ / (Me + 1)), s.color, 0.9 * E * (1 - _ / (Me + 1)));
537
- }
538
- }
539
- x.setDrawRange(0, l * Ae * ge * 2), S.needsUpdate = !0, a.needsUpdate = !0, M.end();
540
- }), /* @__PURE__ */ q(de, { children: [
541
- /* @__PURE__ */ g("lineSegments", { geometry: x, material: z, frustumCulled: !1 }),
542
- /* @__PURE__ */ g("primitive", { object: M.obj }),
543
- Array.from({ length: ve }, (u, S) => /* @__PURE__ */ g("group", { ref: (a) => void (p.current[S] = a), children: /* @__PURE__ */ g(ye, { ref: (a) => void (h.current[S] = a), text: "", color: "#e0e7ff", size: 0.26, maxWidth: 11, opacity: 0, pxRange: [8, 12], renderOrder: 24 }) }, S))
544
- ] });
545
- }
546
- const Jt = (
547
- /* glsl */
548
- `
549
- varying vec3 vDir;
550
- void main(){ vDir = normalize(position); gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }`
551
- ), Qt = (
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
- ), eo = (
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
- ), to = (
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 oo() {
597
- const { size: e, gl: n, camera: r } = Re(), o = P(() => {
598
- const p = Q ? 1600 : 3200, y = new Float32Array(p * 3), x = new Float32Array(p), z = new Float32Array(p), M = new Float32Array(p * 3), b = new t.Vector3(0.42, 0.9, -0.12).normalize(), u = new t.Vector3();
599
- let S = 1234567;
600
- const a = () => (S = S * 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 A = 110 + a() * 60;
606
- y.set([u.x * A, u.y * A, u.z * A], i * 3);
607
- const d = Math.pow(a(), 3.2);
608
- x[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
- M.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(x, 1)), l.setAttribute("aPhase", new t.BufferAttribute(z, 1)), l.setAttribute("aColor", new t.BufferAttribute(M, 3)), l;
614
- }, []), c = P(
615
- () => ({
616
- dome: new t.ShaderMaterial({ vertexShader: Jt, fragmentShader: Qt, side: t.BackSide, depthWrite: !1 }),
617
- stars: new t.ShaderMaterial({ uniforms: { uTime: { value: 0 }, uScale: { value: 400 } }, vertexShader: eo, fragmentShader: to, 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 no = new t.Color("#6f7fb8"), ro = new t.Color("#ff6b7a"), Ue = 0.95, so = new t.MeshBasicMaterial({ colorWrite: !1, depthWrite: !1, transparent: !0, opacity: 0 });
630
- function ao({ agent: e, selected: n, onSelect: r }) {
631
- const o = e.inst, c = T(null), h = T(null), p = T(null), y = T(null), x = T(null), z = T(null), M = T(null), b = T(null), u = T(null), S = 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(Tt(), a),
635
- core: le(Pe(), "#fff"),
636
- flare: le(ot(), 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
- Pt(() => {
647
- l.spikes.rotation = (S - 0.5) * 0.5;
648
- }, [l, S]), 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 + S * 20) * w, e.pos.y + Math.cos(m * 0.17 + S * 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 = H((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 ? xe(G / 0.7) : 0, D = G >= 0 ? H((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 = yt(o, f);
657
- let Z = !1;
658
- for (const v of N.mcpPending.values()) v.instance === o.id && (Z = !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 + S * 40) * Math.sin(m * 1.9 + S * 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" ? ro : no, _);
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 (x.current) {
667
- const v = j < 1.1 && R;
668
- if (x.current.visible = v, v) {
669
- const C = we(j / 1.1);
670
- x.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 += ((Z && 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, M.current && (M.current.visible = i.selK > 0.02, M.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(St(o.id) ? E * (R ? 0.95 : 0.6 * (1 - D)) : 0);
679
- });
680
- const A = (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: so, scale: 0.75, onClick: A, 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: x, material: l.flare, visible: !1 }),
690
- /* @__PURE__ */ g("mesh", { ref: z, geometry: $e, material: l.corona, visible: !1 }),
691
- /* @__PURE__ */ g("mesh", { ref: M, 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
- live: o.job ? () => Mt(o) : null,
699
- color: We[o.type],
700
- size: o.subagent ? 0.22 : 0.28,
701
- letterSpacing: 0.02,
702
- opacity: 0,
703
- fit: !0,
704
- pxRange: o.subagent ? [8, 11.5] : [9, 13.5]
705
- }
706
- ) })
707
- ] });
708
- }
709
- const Je = 96, Qe = 32;
710
- function io() {
711
- 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() }), []);
712
- return se(({ clock: x }) => {
713
- const z = performance.now(), M = Q ? 0 : x.elapsedTime;
714
- h.setScale(e.height, n.getPixelRatio(), r.fov), o.begin(), c.begin(), h.begin();
715
- const { ctrl: b, col: u, h: S } = y;
716
- for (const a of p.keys()) N.instances.has(a) || p.delete(a);
717
- for (const a of N.instances.values()) {
718
- if (!a.parent) continue;
719
- const l = ce(a.parent), i = ce(a.id), A = N.instances.get(a.parent);
720
- if (!l || !i) continue;
721
- const d = A && !A.exitAt && !a.exitAt ? 1 : 0;
722
- let s = p.get(a.id) ?? 0;
723
- const f = (z - a.bornAt) / 1e3;
724
- if (d && f < Ue && (s = 1), s += (d - s) * (d ? 0.08 : 0.03), p.set(a.id, s), s < 0.01) continue;
725
- const m = l.distanceTo(i) || 1, w = Math.min(0.3, 0.55 * Ve.scale * (A ? 1.35 : 1) / m), B = Math.min(0.3, 0.5 * Ve.scale / m), U = xe(f / Ue);
726
- b.copy(l).add(i).multiplyScalar(0.5);
727
- const V = w + (1 - B - w) * U;
728
- u.copy(Oe[a.type]).lerp(Ce, 0.5);
729
- const k = U < 1;
730
- o.add(l, b, i, u, (k ? 0.8 : 0.62) * s, w, V, k ? 0 : 0.55 * s, 1, M, k ? V : -1, 2.2), k ? (fe(l, b, i, V, S), h.add(S, 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);
731
- }
732
- for (const a of N.comets) {
733
- const l = ce(a.from), i = ce(a.to);
734
- if (!l || !i) continue;
735
- const A = At(a, z);
736
- if (!xt(a, z)) continue;
737
- const d = N.instances.get(a.from), s = N.instances.get(a.to);
738
- (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);
739
- const m = xe(A);
740
- u.copy(d ? Oe[d.type] : Ce).lerp(K, 0.45);
741
- const w = Math.min(1, A / 0.1) * Math.min(1, (1 - A) / 0.15);
742
- o.add(l, b, i, u, 0.9 * w, Math.max(0, m - 0.2), m, 0, 1, M, m, 1.6 * w), fe(l, b, i, m, S), h.add(S, 0.8, u, 1.4 * w);
743
- }
744
- o.end(), c.end(), h.end();
745
- }), /* @__PURE__ */ q(de, { children: [
746
- /* @__PURE__ */ g("primitive", { object: o.obj }),
747
- /* @__PURE__ */ g("primitive", { object: c.mesh }),
748
- /* @__PURE__ */ g("primitive", { object: h.obj })
749
- ] });
750
- }
751
- const co = {
752
- minPolarAngle: Math.PI * 0.22,
753
- maxPolarAngle: Math.PI * 0.78,
754
- minAzimuthAngle: -Math.PI * 0.35,
755
- maxAzimuthAngle: Math.PI * 0.35
756
- };
757
- function vo() {
758
- return /* @__PURE__ */ q(
759
- Ct,
760
- {
761
- title: "constellation · night sky",
762
- 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",
763
- preset: "radial",
764
- plane: "xy",
765
- camera: { position: [0, 0, 34], fov: 46, far: 1200 },
766
- controls: co,
767
- bg: "#040618",
768
- gl: { antialias: !0 },
769
- fit: { nRef: 4, min: 0.62, max: 1.6, minRadius: 5.5 },
770
- agentRadius: 1.3,
771
- graph: { natural: _e * 1.1, radius: 3.6 },
772
- Background: /* @__PURE__ */ g(oo, {}),
773
- Agent: ao,
774
- RunMarker: Yt,
775
- McpServer: Dt,
776
- Backend: Xt,
777
- GraphResource: kt,
778
- cluster: { radius: 1.5, variant: "stars", glowGain: 0.9 },
779
- PostFX: /* @__PURE__ */ q(it, { multisampling: 0, children: [
780
- /* @__PURE__ */ g(ct, { mipmapBlur: !0, intensity: 0.95, luminanceThreshold: 0.22, luminanceSmoothing: 0.35, radius: 0.7 }),
781
- /* @__PURE__ */ g(lt, { eskil: !1, offset: 0.25, darkness: 0.75 })
782
- ] }),
783
- children: [
784
- /* @__PURE__ */ g(io, {}),
785
- /* @__PURE__ */ g(qt, {}),
786
- /* @__PURE__ */ g(Ht, {})
787
- ]
788
- }
789
- );
790
- }
791
- export {
792
- vo as default
793
- };