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.
@@ -0,0 +1,53 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { createContext as v, useContext as L, useMemo as A, Suspense as S, lazy as C } from "react";
3
+ const d = (e) => (e ?? "").trim().replace(/\/+$/, "");
4
+ function M() {
5
+ var t, s;
6
+ const e = typeof location > "u" ? new URLSearchParams() : new URLSearchParams(location.search), n = (a) => e.has(a) && !["0", "false", "no"].includes(e.get(a).toLowerCase());
7
+ return {
8
+ source: d(e.get("source")),
9
+ sim: ((t = e.get("sim")) == null ? void 0 : t.toLowerCase()) === "hf" ? "hf" : n("sim"),
10
+ hud: e.get("hud") === null ? !0 : n("hud"),
11
+ embedded: !1,
12
+ run: ((s = e.get("run")) == null ? void 0 : s.trim()) || void 0,
13
+ clearable: !0
14
+ };
15
+ }
16
+ const f = v(null), k = f.Provider;
17
+ function T() {
18
+ return L(f) ?? M();
19
+ }
20
+ const y = ["neural", "constellation", "orbit", "atom", "flow", "bubblechamber", "fireworks"], H = {
21
+ orbit: { name: "Orbit", tagline: "Agents orbit a graph galaxy; runs are rings, MCP servers are satellites." },
22
+ neural: { name: "Neural", tagline: "A living brain: agents fire as neurons, messages pulse along synapses." },
23
+ flow: { name: "Flow", tagline: "A murmuration: agents condense as eddies out of the current." },
24
+ constellation: { name: "Constellation", tagline: "A night sky: agents are stars linked into constellations as they delegate." },
25
+ atom: { name: "Atom", tagline: "An atom: agents are electrons in shells, subagents jump orbits, LLM calls flash photons." },
26
+ bubblechamber: { name: "Bubble chamber", tagline: "A bubble chamber: agents curl as particle tracks, spawns decay into a V, LLM calls burst bubbles." },
27
+ fireworks: { name: "Fireworks", tagline: "A night show over the water: agents burst as star shells, subagents as secondary bursts, LLM calls crackle." }
28
+ }, E = {
29
+ orbit: () => import("./index-nw9i304P.js"),
30
+ neural: () => import("./index-CoeLwySn.js"),
31
+ flow: () => import("./index-DlvN9YSt.js"),
32
+ constellation: () => import("./index-B6EboYGn.js"),
33
+ atom: () => import("./index-avfwD6eP.js"),
34
+ bubblechamber: () => import("./index-s99mYaJ9.js"),
35
+ fireworks: () => import("./index-DATZHNA0.js")
36
+ }, b = /* @__PURE__ */ new Map();
37
+ function x(e) {
38
+ let n = b.get(e);
39
+ return n || b.set(e, n = C(E[e])), n;
40
+ }
41
+ function O({ theme: e = "neural", source: n = "", hud: t = !0, sim: s = !1, scope: a, run: o, token: l, clearable: i = !0, clearedAt: c, style: h, className: u }) {
42
+ const m = y.includes(e) ? e : "neural", p = x(m), g = d(n), w = A(
43
+ () => ({ source: g, sim: s, hud: t, embedded: !0, scope: a || void 0, run: o || void 0, token: l || void 0, clearable: i, clearedAt: c }),
44
+ [g, s, t, a, o, l, i, c]
45
+ );
46
+ return /* @__PURE__ */ r("div", { className: `agentglow-embed${u ? ` ${u}` : ""}`, style: h, "data-theme": m, children: /* @__PURE__ */ r(k, { value: w, children: /* @__PURE__ */ r(S, { fallback: null, children: /* @__PURE__ */ r(p, {}) }) }) });
47
+ }
48
+ export {
49
+ O as A,
50
+ y as T,
51
+ H as a,
52
+ T as u
53
+ };
@@ -0,0 +1,593 @@
1
+ var Ye = Object.defineProperty;
2
+ var $e = (e, o, n) => o in e ? Ye(e, o, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[o] = n;
3
+ var ee = (e, o, n) => $e(e, typeof o != "symbol" ? o + "" : o, n);
4
+ import { jsxs as ne, Fragment as he, jsx as p } from "react/jsx-runtime";
5
+ import { Stars as Ze } from "@react-three/drei";
6
+ import { EffectComposer as Qe, Bloom as Je, Vignette as et } from "@react-three/postprocessing";
7
+ import { useFrame as ie, useThree as tt } from "@react-three/fiber";
8
+ import { useRef as L, useMemo as B, useEffect as nt, useState as Le } from "react";
9
+ import * as t from "three";
10
+ import { T as Ne, w as H, a as de, p as ot, e as rt, s as st, y as pe, f as _e, L as Oe, j as at, n as it, o as ct, l as lt, m as ut, c as ke, g as ft, z as pt, K as dt, A as mt, B as ht, G as gt, C as vt, R as wt, u as yt, D as bt, E as Mt, d as De, k as St, x as At } from "./KitScene-DsZmpTf7.js";
11
+ const oe = (e) => e < 0 ? 0 : e > 1 ? 1 : e, Ge = (e) => 1 - Math.pow(1 - oe(e), 3), ze = (e) => (e = oe(e), e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2), Ct = (e) => {
12
+ e = oe(e);
13
+ const o = 2.2;
14
+ return 1 + (o + 1) * Math.pow(e - 1, 3) + o * Math.pow(e - 1, 2);
15
+ }, Ve = Object.fromEntries(Object.entries(Ne).map(([e, o]) => [e, new t.Color(o)])), je = (e) => e === "graph_scout" || e === "records_scout" || e === "data_scout";
16
+ let Se = null;
17
+ function xt() {
18
+ if (Se) return Se;
19
+ const e = document.createElement("canvas");
20
+ e.width = e.height = 128;
21
+ const o = e.getContext("2d"), n = o.createRadialGradient(64, 64, 0, 64, 64, 64);
22
+ return n.addColorStop(0, "rgba(255,255,255,1)"), n.addColorStop(0.15, "rgba(255,255,255,0.6)"), n.addColorStop(0.45, "rgba(255,255,255,0.14)"), n.addColorStop(1, "rgba(255,255,255,0)"), o.fillStyle = n, o.fillRect(0, 0, 128, 128), Se = new t.CanvasTexture(e), Se;
23
+ }
24
+ function me(e = "#fff") {
25
+ return new t.SpriteMaterial({ map: xt(), color: e, blending: t.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1 });
26
+ }
27
+ function ge(e = "#fff") {
28
+ return new t.MeshBasicMaterial({ color: e, blending: t.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1 });
29
+ }
30
+ function Vt(e = 64, o = 7) {
31
+ const n = [], r = [];
32
+ for (let s = 0; s <= e; s++) {
33
+ const u = s / e;
34
+ for (let l = 0; l < o; l++) {
35
+ const g = l / o * Math.PI * 2;
36
+ n.push(u, Math.cos(g), Math.sin(g));
37
+ }
38
+ }
39
+ for (let s = 0; s < e; s++)
40
+ for (let u = 0; u < o; u++) {
41
+ const l = s * o + u, g = s * o + (u + 1) % o, m = (s + 1) * o + u, x = (s + 1) * o + (u + 1) % o;
42
+ r.push(l, m, g, g, m, x);
43
+ }
44
+ const a = new t.BufferGeometry();
45
+ return a.setAttribute("position", new t.Float32BufferAttribute(n, 3)), a.setIndex(r), a.boundingSphere = new t.Sphere(new t.Vector3(), 1e4), a;
46
+ }
47
+ const Rt = Vt(), Be = new t.SphereGeometry(1, 32, 24);
48
+ new t.SphereGeometry(1, 40, 28);
49
+ new t.IcosahedronGeometry(1, 1);
50
+ const He = new t.ConeGeometry(1, 1, 14).translate(0, 0.5, 0), Tt = new t.ConeGeometry(1, 1, 6, 1, !0).translate(0, 0.5, 0), zt = (
51
+ /* glsl */
52
+ `
53
+ uniform vec3 uP0; uniform vec3 uP1; uniform vec3 uP2; uniform float uRadius; uniform float uTaper;
54
+ varying float vT; varying float vRim;
55
+ void main(){
56
+ float t = position.x; float a = 1.0 - t;
57
+ vec3 p = a*a*uP0 + 2.0*a*t*uP1 + t*t*uP2;
58
+ vec3 tg = 2.0*a*(uP1-uP0) + 2.0*t*(uP2-uP1);
59
+ tg = length(tg) > 1e-5 ? normalize(tg) : vec3(1.0,0.0,0.0);
60
+ vec3 up = abs(tg.y) > 0.92 ? vec3(1.0,0.0,0.0) : vec3(0.0,1.0,0.0);
61
+ vec3 n = normalize(cross(tg, up)); vec3 b = cross(tg, n);
62
+ vec3 off = n*position.y + b*position.z;
63
+ vec4 mv = modelViewMatrix * vec4(p + off * uRadius * mix(1.0, uTaper, t), 1.0);
64
+ vec3 vn = normalize(normalMatrix * off);
65
+ vRim = abs(dot(vn, normalize(-mv.xyz)));
66
+ vT = t;
67
+ gl_Position = projectionMatrix * mv;
68
+ }`
69
+ ), Pt = (
70
+ /* glsl */
71
+ `
72
+ uniform vec3 uColor; uniform float uOpacity; uniform float uGrow; uniform float uTime; uniform float uSpark; uniform float uFlow;
73
+ uniform float uHead; uniform float uTail; uniform vec3 uHeadColor; uniform float uFade;
74
+ varying float vT; varying float vRim;
75
+ void main(){
76
+ if (vT > uGrow) discard;
77
+ float core = 0.25 + 0.75 * vRim * vRim;
78
+ float tip = smoothstep(uGrow - 0.1, uGrow, vT) * step(uGrow, 0.995);
79
+ float spark = uSpark * pow(max(0.0, sin(vT * 16.0 - uTime * 10.0)), 14.0);
80
+ float head = 0.0;
81
+ if (uHead >= 0.0) {
82
+ float d = vT - uHead;
83
+ head = d > 0.0 ? exp(-d * d / 0.0006) : exp(d / max(uTail, 0.001));
84
+ }
85
+ // directional flow: soft dashes travelling from start (parent, vT=0) to end (child, vT=1)
86
+ float flow = uFlow * pow(max(0.0, sin((vT * 7.0 - uTime * 0.9) * 3.14159)), 6.0);
87
+ // brightness taper: full at the start (parent), uFade at the end (child); 1 = even
88
+ float fade = mix(1.0, uFade, vT);
89
+ vec3 col = uColor * uOpacity * (core + spark * 3.5 + tip * 3.0 + flow * 2.2) * fade + uHeadColor * head * (0.6 + vRim);
90
+ gl_FragColor = vec4(col, 1.0);
91
+ }`
92
+ );
93
+ function Bt(e = "#fff", o = 0.06, n = 0.4) {
94
+ return new t.ShaderMaterial({
95
+ uniforms: {
96
+ uP0: { value: new t.Vector3() },
97
+ uP1: { value: new t.Vector3() },
98
+ uP2: { value: new t.Vector3() },
99
+ uRadius: { value: o },
100
+ uTaper: { value: n },
101
+ uColor: { value: new t.Color(e) },
102
+ uOpacity: { value: 1 },
103
+ uGrow: { value: 1 },
104
+ uTime: { value: 0 },
105
+ uFlow: { value: 0 },
106
+ uSpark: { value: 0 },
107
+ uHead: { value: -1 },
108
+ uTail: { value: 0.12 },
109
+ uHeadColor: { value: new t.Color(4, 4, 4) },
110
+ uFade: { value: 1 }
111
+ },
112
+ vertexShader: zt,
113
+ fragmentShader: Pt,
114
+ transparent: !0,
115
+ depthWrite: !1,
116
+ blending: t.AdditiveBlending
117
+ });
118
+ }
119
+ function ae(e, o, n, r, a) {
120
+ const s = 1 - r;
121
+ return a.set(s * s * e.x + 2 * s * r * o.x + r * r * n.x, s * s * e.y + 2 * s * r * o.y + r * r * n.y, s * s * e.z + 2 * s * r * o.z + r * r * n.z);
122
+ }
123
+ function Fe(e, o, n, r) {
124
+ r.copy(e).add(o).multiplyScalar(0.5);
125
+ const a = Math.hypot(r.x, r.y) || 1;
126
+ return r.x += r.x / a * n, r.y += r.y / a * n, r.z += n * 0.9, r;
127
+ }
128
+ function Ie(e, o, n) {
129
+ return e.r += o.r * n, e.g += o.g * n, e.b += o.b * n, e;
130
+ }
131
+ const Te = class Te {
132
+ constructor(o) {
133
+ ee(this, "mesh");
134
+ ee(this, "colors");
135
+ ee(this, "n", 0);
136
+ ee(this, "max");
137
+ ee(this, "o", new t.Object3D());
138
+ ee(this, "a", new t.Vector3());
139
+ ee(this, "b", new t.Vector3());
140
+ ee(this, "d", new t.Vector3());
141
+ this.max = o, this.colors = new Float32Array(o * 3), this.mesh = new t.InstancedMesh(He, new t.MeshBasicMaterial({ blending: t.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1 }), o), this.mesh.instanceColor = new t.InstancedBufferAttribute(this.colors, 3), this.mesh.frustumCulled = !1, this.mesh.count = 0;
142
+ }
143
+ begin() {
144
+ this.n = 0;
145
+ }
146
+ /** Arrow at curve parameter t, pointing toward p2 (dir=+1) or toward p0 (dir=-1). */
147
+ add(o, n, r, a, s, u, l, g = 1) {
148
+ this.n >= this.max || (ae(o, n, r, a, this.a), ae(o, n, r, Math.min(1, Math.max(0, a + 0.02 * s)), this.b), this.d.subVectors(this.b, this.a), !(this.d.lengthSq() < 1e-8) && (this.o.position.copy(this.a), this.o.quaternion.setFromUnitVectors(Te.UP, this.d.normalize()), this.o.scale.set(u * 0.4, u, u * 0.4), this.o.updateMatrix(), this.mesh.setMatrixAt(this.n, this.o.matrix), this.colors[this.n * 3] = l.r * g, this.colors[this.n * 3 + 1] = l.g * g, this.colors[this.n * 3 + 2] = l.b * g, this.n++));
149
+ }
150
+ end() {
151
+ this.mesh.count = this.n, this.mesh.instanceMatrix.needsUpdate = !0, this.mesh.instanceColor && (this.mesh.instanceColor.needsUpdate = !0);
152
+ }
153
+ };
154
+ ee(Te, "UP", new t.Vector3(0, 1, 0));
155
+ let Re = Te;
156
+ new t.Vector3();
157
+ new t.Vector3();
158
+ new t.Vector3(0, 1, 0);
159
+ const Ot = new t.Color("#4b4a63"), Ke = new t.Color("#fbbf24"), ye = /* @__PURE__ */ new Map();
160
+ function Gt(e) {
161
+ const o = [], n = new t.Vector3(0, 1, 0), r = 10;
162
+ for (let a = 0; a < r; a++) {
163
+ const s = 1 - 2 * (a + 0.5) / r, u = Math.sqrt(1 - s * s), l = a * 2.39996 + e * 6.28;
164
+ o.push(new t.Quaternion().setFromUnitVectors(n, new t.Vector3(Math.cos(l) * u, s, Math.sin(l) * u)));
165
+ }
166
+ return o;
167
+ }
168
+ const Ft = new t.TorusGeometry(1.25, 0.05, 8, 64);
169
+ function Et({ agent: e, onSelect: o }) {
170
+ const n = e.inst, r = L(null), a = L(null), s = L(null), u = L(null), l = L(null), g = L(null), m = L(null), x = L(null), S = B(() => [...n.id].reduce((F, A) => (F * 31 + A.charCodeAt(0)) % 9973, 7) / 9973, [n.id]), q = B(() => Gt(S), [S]), V = Ve[n.type], w = B(
171
+ () => ({
172
+ core: ge(V),
173
+ hot: ge("#ffffff"),
174
+ spike: ge(V),
175
+ ring: ge(Ke),
176
+ halo: me(V),
177
+ syn: Bt(V, je(n.type) ? 0.1 : 0.13, 0.35),
178
+ arrow: ge(V)
179
+ }),
180
+ [V, n.type]
181
+ ), i = B(() => ({ p0: new t.Vector3(), p1: new t.Vector3(), seedP: new t.Vector3(), p0set: !1, labelK: 1, spik: 0, ringK: 0, parentK: 1, c: new t.Color() }), []);
182
+ nt(() => (ye.set(n.id, i.p1), () => {
183
+ ye.get(n.id) === i.p1 && ye.delete(n.id);
184
+ }), [n.id, i]), ie(({ clock: F }) => {
185
+ var _, Y, $;
186
+ const A = performance.now(), O = F.elapsedTime, Z = pe ? 0 : 0.08 * _e.spread;
187
+ e.live.set(e.pos.x + Math.sin(O * 0.35 + S * 20) * Z, e.pos.y + Math.cos(O * 0.3 + S * 13) * Z, e.pos.z);
188
+ const E = e.live, G = n.parent ? H.instances.get(n.parent) : void 0, j = n.parent ? de(n.parent) : void 0;
189
+ j ? (i.p0.copy(j), i.p0set = !0) : i.p0set || (i.p0.copy(E), i.p0set = !0), i.p1.addVectors(i.p0, E).multiplyScalar(0.5);
190
+ const R = (A - n.bornAt) / 1e3, T = n.parent ? Ge(R / 0.9) : 1, I = Ct((R - (n.parent ? 0.85 : 0.1)) / 0.7), N = n.exitAt ? (A - n.exitAt) / 1e3 : -1, X = lt(n) / 1e3, K = N >= 0 ? oe(N / (X * 0.92)) : 0, Q = ot(n, A);
191
+ let D = !1;
192
+ for (const k of H.mcpPending.values()) k.instance === n.id && (D = !0);
193
+ const C = N < 0 && (n.status === "thinking" || n.status === "spawning"), W = rt(n, A), d = pe ? 0 : 1, y = 0.5 + 0.5 * Math.sin(O * 2 + S * 9) * d, z = 0.5 + 0.5 * Math.sin(O * 1 + S * 5) * d;
194
+ i.spik += ((C ? 1 : 0) - i.spik) * 0.06, i.ringK += ((D && N < 0 ? 1 : 0) - i.ringK) * 0.08, r.current && (T < 1 ? r.current.position.copy(ae(i.p0, i.p1, E, T, i.seedP)) : r.current.position.copy(E));
195
+ const M = T < 1 ? 0.18 : 0, c = Math.max(M, 0.18 + 0.82 * I) * (1 - K * K * 0.95) * e.scale;
196
+ (_ = a.current) == null || _.scale.setScalar(Math.max(1e-4, c * (0.55 + W * 0.06 + (C ? y * 0.05 : z * 0.04)))), (Y = s.current) == null || Y.scale.setScalar(Math.max(1e-4, i.spik * (0.85 + y * 0.15)));
197
+ const f = C ? 0.75 + y * 0.35 : 0.3 + z * 0.15;
198
+ if (i.c.copy(V).multiplyScalar(f + W * 0.35), N >= 0 && i.c.lerp(Ot, K).multiplyScalar(1 - K * 0.75), w.core.color.copy(i.c), w.spike.color.copy(i.c).multiplyScalar(0.9), w.hot.color.setScalar((C ? 0.35 + y * 0.25 : 0.08) * (1 - K) + W * 0.2), u.current && (u.current.visible = i.ringK > 0.02, u.current.rotation.z = O * 0.9, u.current.rotation.x = 1.1 + Math.sin(O * 0.5) * 0.2, u.current.scale.setScalar(Math.max(1e-4, c * 0.55 * i.ringK)), w.ring.color.copy(Ke).multiplyScalar(0.9 * i.ringK * (0.75 + z * 0.25))), g.current && (g.current.scale.setScalar(Math.max(1e-4, c * (C ? 2.3 + y * 0.3 : 1.6) + W * 0.35)), w.halo.color.copy(V).multiplyScalar((C ? 0.22 : 0.09) * (1 - K) + W * 0.06)), ($ = x.current) == null || $.position.set(0, -0.78 * e.scale - 0.25, 0), m.current) {
199
+ const k = st(n.id);
200
+ i.labelK += ((k ? 1 : 0) - i.labelK) * 0.12, m.current.setOpacity(oe(I) * (1 - K) * 0.95 * i.labelK);
201
+ }
202
+ const v = !!G && !G.exitAt;
203
+ i.parentK += ((n.parent && !n.exitAt && v ? 1 : 0) - i.parentK) * (v ? 0.05 : 0.035);
204
+ const h = w.syn.uniforms;
205
+ h.uP0.value.copy(i.p0), h.uP1.value.copy(i.p1), h.uP2.value.copy(E);
206
+ const U = N >= 0 ? ze(N / (X * 0.64)) : 0;
207
+ if (h.uGrow.value = n.parent ? T * (1 - U) : 0, h.uSpark.value = 0, h.uHead.value = T < 1 ? T : -1, h.uTail.value = 0.1, h.uFade.value = 0.4, h.uHeadColor.value.copy(V).multiplyScalar(1.5), h.uOpacity.value = (C ? 1.1 : 0.75) * Math.max(0, Math.min(i.parentK, Q > 0 ? 1 : 0)) + (T < 1 ? 0.4 : 0), h.uTime.value = pe ? 0 : O, h.uFlow.value = T >= 1 ? i.parentK : 0, l.current) {
208
+ const k = n.parent && T >= 1 && i.parentK > 0.05 && h.uGrow.value > 0.9;
209
+ if (l.current.visible = !!k, k) {
210
+ ae(i.p0, i.p1, E, 0.8, Pe), ae(i.p0, i.p1, E, 0.86, We), l.current.position.copy(Pe), Ue.subVectors(We, Pe).normalize(), l.current.quaternion.setFromUnitVectors(_t, Ue);
211
+ const ce = (je(n.type) ? 0.75 : 1) * Math.min(1.3, _e.scale);
212
+ l.current.scale.set(0.16 * ce, 0.42 * ce, 0.16 * ce), w.arrow.color.copy(V).multiplyScalar(1.6 * i.parentK);
213
+ }
214
+ }
215
+ });
216
+ const b = (F) => {
217
+ F.stopPropagation(), o(n.id);
218
+ }, P = n.id.split(":")[2];
219
+ return /* @__PURE__ */ ne(he, { children: [
220
+ /* @__PURE__ */ p("mesh", { geometry: Rt, material: w.syn, frustumCulled: !1 }),
221
+ /* @__PURE__ */ p("mesh", { ref: l, geometry: He, material: w.arrow, visible: !1 }),
222
+ /* @__PURE__ */ ne("group", { ref: r, children: [
223
+ /* @__PURE__ */ ne("group", { ref: a, scale: 1e-4, children: [
224
+ /* @__PURE__ */ p("mesh", { geometry: Be, material: w.core, onClick: b, onPointerOver: () => document.body.style.cursor = "pointer", onPointerOut: () => document.body.style.cursor = "" }),
225
+ /* @__PURE__ */ p("mesh", { geometry: Be, material: w.hot, scale: 0.5 }),
226
+ /* @__PURE__ */ p("group", { ref: s, scale: 1e-4, children: q.map((F, A) => /* @__PURE__ */ p("mesh", { geometry: Tt, material: w.spike, quaternion: F, scale: [0.2, 1.9, 0.2] }, A)) })
227
+ ] }),
228
+ /* @__PURE__ */ p("mesh", { ref: u, geometry: Ft, material: w.ring, visible: !1 }),
229
+ /* @__PURE__ */ p("sprite", { ref: g, material: w.halo }),
230
+ /* @__PURE__ */ p("group", { ref: x, children: /* @__PURE__ */ p(
231
+ Oe,
232
+ {
233
+ ref: m,
234
+ text: `${n.name}${P !== void 0 ? ` ${Number(P) + 1}` : ""}`,
235
+ live: n.job ? () => at(n) : null,
236
+ color: Ne[n.type],
237
+ size: n.subagent ? 0.22 : 0.3,
238
+ opacity: 0,
239
+ fit: !0,
240
+ pxRange: n.subagent ? [8, 12] : [9, 14]
241
+ }
242
+ ) })
243
+ ] })
244
+ ] });
245
+ }
246
+ const Pe = new t.Vector3(), We = new t.Vector3(), Ue = new t.Vector3(), _t = new t.Vector3(0, 1, 0);
247
+ function kt({ comet: e }) {
248
+ const o = L(null), n = H.instances.get(e.from), r = n ? Ve[n.type] : Ve.planner, a = B(() => me(new t.Color(r).multiplyScalar(1.8).addScalar(0.3)), [r]), s = B(() => ({ a: new t.Vector3(), b: new t.Vector3(), c: new t.Vector3(), h: new t.Vector3() }), []);
249
+ return ie(() => {
250
+ const u = de(e.from), l = de(e.to);
251
+ if (!u || !l || !o.current) {
252
+ o.current && (o.current.visible = !1);
253
+ return;
254
+ }
255
+ const g = H.instances.get(e.to), m = (g == null ? void 0 : g.parent) === e.from ? ye.get(e.to) : (n == null ? void 0 : n.parent) === e.to ? ye.get(e.from) : void 0;
256
+ s.a.copy(u), s.b.copy(l), m ? s.c.copy(m) : Fe(s.a, s.b, 1.2, s.c);
257
+ const x = it(e);
258
+ ae(s.a, s.c, s.b, ze(x), s.h), o.current.visible = ct(e), o.current.position.copy(s.h), o.current.scale.setScalar(1.1);
259
+ }), /* @__PURE__ */ p("sprite", { ref: o, material: a, visible: !1 });
260
+ }
261
+ function jt() {
262
+ const [e, o] = Le([]), n = L({ n: -1, last: -1, first: -1 });
263
+ return ie(() => {
264
+ const r = H.comets, a = n.current, s = r.length ? r[0].id : -1, u = r.length ? r[r.length - 1].id : -1;
265
+ (r.length !== a.n || s !== a.first || u !== a.last) && (a.n = r.length, a.first = s, a.last = u, o(r.filter((l) => !(l.from.startsWith("svc:") && l.to.startsWith("svc:") && !l.failed) && (!ut.grouped || ke(l.from) && ke(l.to)))));
266
+ }), /* @__PURE__ */ p(he, { children: e.map((r) => /* @__PURE__ */ p(kt, { comet: r }, r.id)) });
267
+ }
268
+ const te = 3.3, It = 200, se = 14, Ae = 48, ue = 16, le = 8, Ce = 4, ve = new t.Color(1, 1, 1), Kt = new t.Color("#a78bfa"), Wt = (
269
+ /* glsl */
270
+ `
271
+ attribute float aSize; attribute vec3 aColor; varying vec3 vC; varying float vFacing; uniform float uScale;
272
+ void main(){
273
+ vec4 mv = modelViewMatrix * vec4(position, 1.0);
274
+ vec3 n = normalize(normalMatrix * normalize(position));
275
+ vFacing = 0.35 + 0.65 * smoothstep(-0.4, 0.5, dot(n, normalize(-mv.xyz))); // back side dimmer → depth
276
+ gl_PointSize = aSize * uScale / -mv.z; vC = aColor; gl_Position = projectionMatrix * mv; }`
277
+ ), Ut = (
278
+ /* glsl */
279
+ `
280
+ varying vec3 vC; varying float vFacing;
281
+ void main(){ float r = length(gl_PointCoord - 0.5) * 2.0; if (r > 1.0) discard;
282
+ float core = smoothstep(0.45, 0.0, r); float halo = pow(1.0 - r, 2.2);
283
+ gl_FragColor = vec4(vC * vFacing * (core * 1.2 + halo * 0.45), 1.0); }`
284
+ ), Lt = (
285
+ /* glsl */
286
+ `
287
+ varying vec3 vN; varying vec3 vV; varying vec3 vObj;
288
+ void main(){ vec4 mv = modelViewMatrix * vec4(position, 1.0); vN = normalize(normalMatrix * normal); vV = normalize(-mv.xyz); vObj = normalize(position);
289
+ gl_Position = projectionMatrix * mv; }`
290
+ ), Nt = (
291
+ /* glsl */
292
+ `
293
+ uniform vec3 uRim; uniform vec3 uInner; uniform float uTime;
294
+ uniform vec3 uRipC[${le}]; uniform float uRipA[${le}];
295
+ varying vec3 vN; varying vec3 vV; varying vec3 vObj;
296
+ void main(){
297
+ float f = 1.0 - abs(dot(normalize(vN), normalize(vV)));
298
+ float rim = pow(f, 3.0);
299
+ float body = pow(1.0 - f, 2.0) * 0.12; // faint glassy fill toward the center
300
+ float shimmer = 0.92 + 0.08 * sin(uTime * 0.25 + vObj.y * 3.0 + vObj.x * 2.0);
301
+ vec3 col = uRim * rim * 1.1 * shimmer + uInner * body;
302
+ float rip = 0.0;
303
+ for (int i = 0; i < ${le}; i++) {
304
+ float a = uRipA[i];
305
+ if (a < 0.0 || a > 1.0) continue;
306
+ float d = acos(clamp(dot(vObj, uRipC[i]), -1.0, 1.0));
307
+ float ring = a * 2.2;
308
+ rip += exp(-pow((d - ring) / 0.06, 2.0)) * (1.0 - a) * (1.0 - a);
309
+ }
310
+ col += vec3(1.0) * rip * 0.6;
311
+ gl_FragColor = vec4(col, 1.0);
312
+ }`
313
+ );
314
+ function Dt({ galaxy: e }) {
315
+ const o = B(() => ft(e, It), [e]), n = o.nodes.length, { size: r, gl: a, camera: s } = tt(), u = L([]), l = L([]), g = L(Array(Ce).fill("")), m = B(() => {
316
+ const i = new Float32Array(n * 3), b = [], P = Math.PI * (3 - Math.sqrt(5)), F = o.ns, A = [0, 0, 0];
317
+ for (let d = 0; d < n; d++) {
318
+ const y = 1 - 2 * (d + 0.5) / Math.max(1, F), z = Math.sqrt(Math.max(0, 1 - y * y)), M = d < F ? new t.Vector3(Math.cos(d * P) * z, y, Math.sin(d * P) * z) : new t.Vector3(...pt(o.nodes[d].id, A));
319
+ b.push(M), i.set([M.x * te, M.y * te, M.z * te], d * 3);
320
+ }
321
+ const O = o.nodes.map((d) => new t.Color(dt[d.kind] ?? "#94a3b8").lerp(Kt, 0.2).multiplyScalar(0.62)), Z = new Float32Array(n), E = new Float32Array(n * 3), G = new t.BufferGeometry();
322
+ G.setAttribute("position", new t.BufferAttribute(i, 3)), G.setAttribute("aSize", new t.BufferAttribute(Z, 1)), G.setAttribute("aColor", new t.BufferAttribute(E, 3));
323
+ const j = new Map(o.nodes.map((d, y) => [d.id, y])), R = [], T = [];
324
+ for (const d of o.links) {
325
+ const y = j.get(d.source), z = j.get(d.target);
326
+ y !== void 0 && z !== void 0 && y !== z && b[y].angleTo(b[z]) < 1.25 && (R.push([y, z]), T.push(1));
327
+ }
328
+ for (let d = 0; d < n; d++) {
329
+ let y = -1, z = -1, M = 9, c = 9;
330
+ for (let f = 0; f < n; f++) {
331
+ if (f === d) continue;
332
+ const v = b[d].distanceToSquared(b[f]);
333
+ v < M ? (z = y, c = M, y = f, M = v) : v < c && (z = f, c = v);
334
+ }
335
+ y > d && (R.push([d, y]), T.push(0)), z > d && (R.push([d, z]), T.push(0));
336
+ }
337
+ const I = new Float32Array(R.length * se * 2 * 3), N = new Float32Array(R.length * se * 2 * 3), X = new Int32Array(R.length * se * 2 * 2), K = new Uint8Array(R.length * se * 2), Q = new t.Quaternion(), D = new t.Vector3();
338
+ R.forEach(([d, y], z) => {
339
+ const M = b[d], c = b[y], f = M.angleTo(c), v = new t.Vector3().crossVectors(M, c);
340
+ v.lengthSq() < 1e-6 && v.set(0, 1, 0), v.normalize();
341
+ for (let h = 0; h < se; h++)
342
+ for (let U = 0; U < 2; U++) {
343
+ const _ = (h + U) / se;
344
+ Q.setFromAxisAngle(v, f * _), D.copy(M).applyQuaternion(Q).multiplyScalar(te * (1 + 0.06 * Math.sin(Math.PI * _) * Math.min(1, f)));
345
+ const Y = (z * se + h) * 2 + U;
346
+ I.set([D.x, D.y, D.z], Y * 3), X[Y * 2] = d, X[Y * 2 + 1] = y, K[Y] = T[z];
347
+ }
348
+ });
349
+ const C = new t.BufferGeometry();
350
+ C.setAttribute("position", new t.BufferAttribute(I, 3)), C.setAttribute("color", new t.BufferAttribute(N, 3));
351
+ const W = new t.BufferGeometry();
352
+ return W.setAttribute("position", new t.BufferAttribute(new Float32Array(Ae * ue * 2 * 3), 3)), W.setAttribute("color", new t.BufferAttribute(new Float32Array(Ae * ue * 2 * 3), 3)), W.boundingSphere = new t.Sphere(new t.Vector3(), 1e4), { pos: i, unit: b, base: O, ngeo: G, ageo: C, owner: X, kindOf: K, nArcV: R.length * se * 2, bgeo: W, fire: new Float32Array(n), white: new Float32Array(n), fireC: Array.from({ length: n }, () => new t.Color()) };
353
+ }, [o, n]), x = B(
354
+ () => ({
355
+ nodes: new t.ShaderMaterial({ uniforms: { uScale: { value: 400 } }, vertexShader: Wt, fragmentShader: Ut, transparent: !0, depthWrite: !1, blending: t.AdditiveBlending }),
356
+ arcs: new t.LineBasicMaterial({ vertexColors: !0, transparent: !0, blending: t.AdditiveBlending, depthWrite: !1, toneMapped: !1 }),
357
+ beam: new t.LineBasicMaterial({ vertexColors: !0, transparent: !0, blending: t.AdditiveBlending, depthWrite: !1, toneMapped: !1 }),
358
+ orb: new t.ShaderMaterial({
359
+ uniforms: {
360
+ uRim: { value: new t.Color("#8b7cff").multiplyScalar(0.7) },
361
+ uInner: { value: new t.Color("#5b8cff").multiplyScalar(0.6) },
362
+ uTime: { value: 0 },
363
+ uRipC: { value: Array.from({ length: le }, () => new t.Vector3(0, 1, 0)) },
364
+ uRipA: { value: new Array(le).fill(-1) }
365
+ },
366
+ vertexShader: Lt,
367
+ fragmentShader: Nt,
368
+ transparent: !0,
369
+ depthWrite: !1,
370
+ blending: t.AdditiveBlending
371
+ }),
372
+ core: me(new t.Color("#8b7cff").multiplyScalar(0.22)),
373
+ aura: me(new t.Color("#4c1d95").multiplyScalar(0.28))
374
+ }),
375
+ []
376
+ ), S = B(() => /* @__PURE__ */ new Map(), [o]), q = B(() => new Re(Ae), []), V = B(() => ({ v: new t.Vector3(), v2: new t.Vector3(), mid: new t.Vector3(), sp: new t.Vector3(), c: new t.Color(), c2: new t.Color() }), []), w = (i) => {
377
+ let b = S.get(i);
378
+ return b === void 0 && S.set(i, b = vt(o, i)), b;
379
+ };
380
+ return ie(({ clock: i }) => {
381
+ const b = performance.now(), { pos: P, base: F, fire: A, white: O, fireC: Z, unit: E } = m;
382
+ x.nodes.uniforms.uScale.value = r.height * a.getPixelRatio() / (2 * Math.tan(s.fov * Math.PI / 360)) * mt.graph.scale, x.orb.uniforms.uTime.value = pe ? 0 : i.elapsedTime, A.fill(0), O.fill(0);
383
+ const { v: G, v2: j, mid: R, c: T, c2: I } = V, N = m.bgeo.getAttribute("position"), X = m.bgeo.getAttribute("color"), K = x.orb.uniforms.uRipC.value, Q = x.orb.uniforms.uRipA.value;
384
+ let D = 0;
385
+ q.begin();
386
+ let C = 0;
387
+ for (const c of H.flares) {
388
+ const f = w(c.node), v = (b - c.start) / 1e3, h = H.instances.get(c.instance), U = h ? Ve[h.type] : ve, _ = c.op === "write", Y = v < 0.35 ? v / 0.35 : Math.exp(-(v - 0.35) * 1.2);
389
+ Y > A[f] && (A[f] = Y, Z[f].copy(_ ? ve : U), O[f] = _ ? 1 : 0), _ && v < 1.8 && C < le && (K[C].copy(E[f]), Q[C] = v / 1.8, C++);
390
+ const $ = de(c.instance), k = $ ? ht($, V.sp) : void 0;
391
+ if (k && v < 2.2 && D < Ae) {
392
+ G.set(P[f * 3], P[f * 3 + 1], P[f * 3 + 2]), R.copy(k).add(G).multiplyScalar(0.5), R.z += 1;
393
+ const ce = Math.min(1, v / 0.3) * (1 - v / 2.2) ** 1.5, Xe = _ ? Math.min(1, v * 0.85) : 1 - Math.min(1, v * 0.85);
394
+ for (let be = 0; be < ue; be++)
395
+ for (let Me = 0; Me < 2; Me++) {
396
+ const J = (be + Me) / ue, re = 1 - J;
397
+ j.set(re * re * k.x + 2 * re * J * R.x + J * J * G.x, re * re * k.y + 2 * re * J * R.y + J * J * G.y, re * re * k.z + 2 * re * J * R.z + J * J * G.z);
398
+ const Ee = (D * ue + be) * 2 + Me;
399
+ N.setXYZ(Ee, j.x, j.y, j.z);
400
+ const qe = Math.exp(-(((J - Xe) / 0.1) ** 2)) * 1.3;
401
+ I.copy(_ ? ve : U).multiplyScalar(ce * ((_ ? 0.5 : 0.2) + qe) * 0.75), X.setXYZ(Ee, I.r, I.g, I.b);
402
+ }
403
+ _ ? q.add(k, R, G, 0.9, 1, 0.42, ve, ce * 1.1) : q.add(k, R, G, 0.1, -1, 0.42, U, ce * 1.3), D++;
404
+ }
405
+ }
406
+ for (let c = C; c < le; c++) Q[c] = -1;
407
+ m.bgeo.setDrawRange(0, D * ue * 2), q.end(), N.needsUpdate = !0, X.needsUpdate = !0;
408
+ const W = m.ngeo.getAttribute("aSize"), d = m.ngeo.getAttribute("aColor");
409
+ for (let c = 0; c < n; c++) {
410
+ const f = A[c];
411
+ W.setX(c, 0.21 + f * (0.55 + O[c] * 0.25)), T.copy(F[c]), f > 0.01 && Ie(Ie(T, Z[c], f * 1.6), ve, f * (0.3 + O[c] * 1.2)), d.setXYZ(c, T.r, T.g, T.b);
412
+ }
413
+ W.needsUpdate = !0, d.needsUpdate = !0;
414
+ const y = m.ageo.getAttribute("color"), z = m.owner;
415
+ for (let c = 0; c < m.nArcV; c++) {
416
+ const f = z[c * 2], v = z[c * 2 + 1], h = Math.max(A[f], A[v]), U = m.kindOf[c] ? 0.16 : 0.07;
417
+ y.setXYZ(c, 0.42 * U + h * 0.3, 0.36 * U + h * 0.3, 0.85 * U + h * 0.4);
418
+ }
419
+ y.needsUpdate = !0;
420
+ let M = 0;
421
+ for (let c = H.flares.length - 1; c >= 0 && M < Ce; c--) {
422
+ const f = H.flares[c];
423
+ if (b - f.start > 2200) break;
424
+ if (f.area) continue;
425
+ let v = !1;
426
+ for (let $ = 0; $ < M; $++) g.current[$] === f.node && (v = !0);
427
+ if (v) continue;
428
+ const h = w(f.node);
429
+ let U = !1;
430
+ for (let $ = 0; $ < M; $++) {
431
+ const k = l.current[$];
432
+ k && Math.abs(k.position.y - P[h * 3 + 1]) < 0.55 && Math.abs(k.position.x - P[h * 3]) < 3.2 && (U = !0);
433
+ }
434
+ if (U) continue;
435
+ const _ = u.current[M], Y = l.current[M];
436
+ _ && Y && (Y.position.set(P[h * 3], P[h * 3 + 1], P[h * 3 + 2]), g.current[M] !== f.node && (_.setText(`${f.op === "write" ? "wrote" : "read"} · ${f.node}`), _.setColor(f.op === "write" ? "#ffffff" : "#22d3ee")), _.setOpacity(1)), g.current[M] = f.node, M++;
437
+ }
438
+ for (let c = M; c < Ce; c++) {
439
+ const f = u.current[c];
440
+ f == null || f.setOpacity(0), g.current[c] = "";
441
+ }
442
+ }), /* @__PURE__ */ ne(he, { children: [
443
+ /* @__PURE__ */ ne("group", { children: [
444
+ /* @__PURE__ */ p("sprite", { material: x.aura, scale: te * 4.2, position: [0, 0, -te] }),
445
+ /* @__PURE__ */ p("sprite", { material: x.core, scale: te * 1.5 }),
446
+ /* @__PURE__ */ p("mesh", { geometry: Be, material: x.orb, scale: te * 1.02 }),
447
+ /* @__PURE__ */ p("lineSegments", { geometry: m.ageo, material: x.arcs, frustumCulled: !1 }),
448
+ /* @__PURE__ */ p("points", { geometry: m.ngeo, material: x.nodes, frustumCulled: !1 })
449
+ ] }),
450
+ /* @__PURE__ */ p("lineSegments", { geometry: m.bgeo, material: x.beam, frustumCulled: !1 }),
451
+ /* @__PURE__ */ p("primitive", { object: q.mesh }),
452
+ Array.from({ length: Ce }, (i, b) => /* @__PURE__ */ p("group", { ref: (P) => void (l.current[b] = P), children: /* @__PURE__ */ p(Oe, { ref: (P) => void (u.current[b] = P), text: "", offset: [0, 0.42], size: 0.24, opacity: 0, fadeMs: 250, pxRange: [8, 12] }) }, b)),
453
+ /* @__PURE__ */ p(gt, { position: [0, -te - 0.9, 0], color: "#a78bfa", size: 0.28, opacity: 0.7, pxRange: [8, 12] })
454
+ ] });
455
+ }
456
+ function Ht({ run: e }) {
457
+ const o = B(() => new t.Color(e.color), [e.color]), n = B(() => me("#000"), []), r = L(null), a = L(null);
458
+ return ie(({ clock: s }) => {
459
+ var V;
460
+ const u = performance.now(), l = e.run ?? H.runs.get(e.id), g = l ? Ge((u - l.startedAt) / 1200) : 1, m = l != null && l.endedAt ? oe(1 - (u - l.endedAt - (wt - 2500)) / 2500) : 1, x = 0.9 + 0.1 * Math.sin(s.elapsedTime * 0.6 + e.index);
461
+ n.color.copy(o).multiplyScalar(0.16 * g * m * x);
462
+ const S = Math.abs(e.side.x) * e.hu + Math.abs(e.axis.x) * e.hv, q = Math.abs(e.side.y) * e.hu + Math.abs(e.axis.y) * e.hv;
463
+ r.current && (r.current.position.set(e.origin.x, e.origin.y, -1.5), r.current.scale.set(S * 2.6 + 3, q * 2.6 + 3, 1)), (V = a.current) == null || V.position.set(e.origin.x, e.origin.y + q + 0.6, 0.5);
464
+ }), /* @__PURE__ */ ne(he, { children: [
465
+ /* @__PURE__ */ p("sprite", { ref: r, material: n }),
466
+ /* @__PURE__ */ p("group", { ref: a, children: e.run && /* @__PURE__ */ p(Xt, { run: e.run }) })
467
+ ] });
468
+ }
469
+ function Xt({ run: e }) {
470
+ yt();
471
+ const o = e.status !== "started" || bt(e);
472
+ return /* @__PURE__ */ p(
473
+ Oe,
474
+ {
475
+ text: e.topic,
476
+ secondary: Mt(e, { base: "#94a3b8", current: "#fde68a", done: "#cbd5e1" }, ["running…", "run complete"]),
477
+ color: e.color,
478
+ size: 0.34,
479
+ maxWidth: 10,
480
+ opacity: o ? 0.5 : 1,
481
+ fadeMs: 400,
482
+ anchorY: "bottom",
483
+ pxRange: [10, 15]
484
+ }
485
+ );
486
+ }
487
+ const qt = new t.Color("#fbbf24"), Yt = new t.Color("#ff2d3d"), $t = new t.Color(1, 1, 1), Zt = new t.OctahedronGeometry(0.8, 0);
488
+ new t.EdgesGeometry(Zt);
489
+ function Qt({ call: e }) {
490
+ const o = H.mcpServers.get(e.server), n = B(() => new t.Color((o == null ? void 0 : o.color) ?? "#fff"), [o]), r = B(() => me(n.clone().multiplyScalar(1.8).addScalar(0.3)), [n]), a = L(null), s = B(() => ({ a: new t.Vector3(), b: new t.Vector3(), c: new t.Vector3(), h: new t.Vector3() }), []);
491
+ return ie(() => {
492
+ const u = de(e.instance), l = De(e.server);
493
+ if (!a.current) return;
494
+ if (!u || !o || !l) {
495
+ a.current.visible = !1;
496
+ return;
497
+ }
498
+ s.a.copy(u), s.b.copy(l), Fe(s.a, s.b, 1, s.c);
499
+ const g = oe((performance.now() - e.start) / (e.phase === "call" ? e.dur : e.dur * 0.75)), m = ze(g);
500
+ ae(s.a, s.c, s.b, e.phase === "call" ? m : 1 - m, s.h), a.current.visible = g < 1, a.current.position.copy(s.h), a.current.scale.setScalar(1);
501
+ }), /* @__PURE__ */ p("sprite", { ref: a, material: r, visible: !1 });
502
+ }
503
+ const xe = 24, fe = 40, we = 3;
504
+ function Jt() {
505
+ const e = B(() => {
506
+ const a = new t.BufferGeometry();
507
+ return a.setAttribute("position", new t.BufferAttribute(new Float32Array(xe * we * fe * 2 * 3), 3)), a.setAttribute("color", new t.BufferAttribute(new Float32Array(xe * we * fe * 2 * 3), 3)), a.boundingSphere = new t.Sphere(new t.Vector3(), 1e4), a;
508
+ }, []), o = B(() => new t.LineBasicMaterial({ vertexColors: !0, transparent: !0, blending: t.AdditiveBlending, depthWrite: !1, toneMapped: !1 }), []), n = B(() => new Re(xe), []), r = B(() => ({ a: new t.Vector3(), b: new t.Vector3(), c: new t.Vector3(), p: new t.Vector3(), col: new t.Color(), k: new t.Color() }), []);
509
+ return ie(({ clock: a }) => {
510
+ const s = performance.now(), u = pe ? 0 : a.elapsedTime, l = e.getAttribute("position"), g = e.getAttribute("color");
511
+ let m = 0;
512
+ n.begin();
513
+ const x = (S, q, V, w) => {
514
+ if (m >= xe) return;
515
+ const i = de(S), b = H.mcpServers.get(q), P = De(q);
516
+ if (!i || !b || !P) return;
517
+ const { a: F, b: A, c: O, p: Z, col: E, k: G } = r;
518
+ F.copy(i), A.copy(P), Fe(F, A, 1, O), E.set(b.color);
519
+ let j;
520
+ V === 0 ? (E.lerp(qt, oe(w / 1.2)), w > 1.2 && E.lerp(Yt, oe((w - 1.2) / 1)), j = (0.22 + Math.min(0.6, w * 0.25)) * Ge(w / 0.3)) : (G.copy(E).lerp($t, 0.35), j = 1.3 * (w < 0.75 ? 1 : 1 - (w - 0.75) / 0.25));
521
+ const R = 1 - ze(w / 0.75), T = V === 0 ? 0.025 : 0.07;
522
+ for (let I = 0; I < we; I++) {
523
+ const N = (I - 1) * T;
524
+ for (let X = 0; X < fe; X++)
525
+ for (let K = 0; K < 2; K++) {
526
+ const Q = (X + K) / fe;
527
+ ae(F, O, A, Q, Z);
528
+ const D = ((m * we + I) * fe + X) * 2 + K;
529
+ l.setXYZ(D, Z.x + N, Z.y - N, Z.z + N * 0.5);
530
+ let C;
531
+ if (V === 0) {
532
+ const d = Math.pow(Math.max(0, Math.sin(Q * 20 - u * 2.2)), 8);
533
+ C = j * (0.3 + d * 1.5) * (I === 1 ? 1 : 0.25);
534
+ } else
535
+ C = j * (0.3 + Math.exp(-(((Q - R) / 0.07) ** 2)) * 3.2 * (w < 0.8 ? 1 : 0)) * (I === 1 ? 1 : 0.65);
536
+ const W = V === 0 ? E : G;
537
+ g.setXYZ(D, W.r * C, W.g * C, W.b * C);
538
+ }
539
+ }
540
+ V === 0 ? n.add(F, O, A, 0.92, 1, 0.48, E, 0.4 + j * 1.4) : n.add(F, O, A, 0.08, -1, 0.66, G, j * 1.6), m++;
541
+ };
542
+ for (const S of H.mcpPending.values()) x(S.instance, S.server, 0, St(S, s));
543
+ for (const S of H.mcpCalls) S.phase === "result" && x(S.instance, S.server, 1, oe((s - S.start) / S.dur));
544
+ e.setDrawRange(0, m * we * fe * 2), l.needsUpdate = !0, g.needsUpdate = !0, n.end();
545
+ }), /* @__PURE__ */ ne(he, { children: [
546
+ /* @__PURE__ */ p("lineSegments", { geometry: e, material: o, frustumCulled: !1 }),
547
+ /* @__PURE__ */ p("primitive", { object: n.mesh })
548
+ ] });
549
+ }
550
+ function en() {
551
+ const [e, o] = Le([]), n = L({ n: -1, first: -1, last: -1 });
552
+ return ie(() => {
553
+ const r = n.current, a = H.mcpCalls, s = a.length ? a[0].id : -1, u = a.length ? a[a.length - 1].id : -1;
554
+ (a.length !== r.n || s !== r.first || u !== r.last) && (r.n = a.length, r.first = s, r.last = u, o(a.slice()));
555
+ }), /* @__PURE__ */ ne(he, { children: [
556
+ e.map((r) => /* @__PURE__ */ p(Qt, { call: r }, r.id)),
557
+ /* @__PURE__ */ p(Jt, {})
558
+ ] });
559
+ }
560
+ const tn = { tint: "#c084fc", tintAmt: 0.2, gain: 0.9 };
561
+ function un() {
562
+ return /* @__PURE__ */ ne(
563
+ At,
564
+ {
565
+ title: "neural · living brain",
566
+ subtitle: "Agents are neurons (spiky = thinking, smooth = waiting, amber ring = waiting on MCP) · ⬢ MCP servers wire to their backends · graph memory lights up on reads/writes",
567
+ preset: "radial",
568
+ plane: "xy",
569
+ camera: { position: [0, -0.2, 31], fov: 47 },
570
+ bg: "#030208",
571
+ fit: { nRef: 4, min: 0.62, max: 1.6, minRadius: 5.5 },
572
+ agentRadius: 1.25,
573
+ graph: { natural: te * 1.08, radius: 2.1 },
574
+ Background: /* @__PURE__ */ p(Ze, { radius: 80, depth: 40, count: pe ? 1200 : 3500, factor: 2.6, saturation: 0.6, fade: !0, speed: 0.4 }),
575
+ Agent: Et,
576
+ RunMarker: Ht,
577
+ mcpStyle: tn,
578
+ GraphResource: Dt,
579
+ cluster: { radius: 1.45, variant: "orb" },
580
+ PostFX: /* @__PURE__ */ ne(Qe, { multisampling: 0, children: [
581
+ /* @__PURE__ */ p(Je, { mipmapBlur: !0, intensity: 1.1, luminanceThreshold: 0.2, luminanceSmoothing: 0.3, radius: 0.75 }),
582
+ /* @__PURE__ */ p(et, { eskil: !1, offset: 0.22, darkness: 0.9 })
583
+ ] }),
584
+ children: [
585
+ /* @__PURE__ */ p(jt, {}),
586
+ /* @__PURE__ */ p(en, {})
587
+ ]
588
+ }
589
+ );
590
+ }
591
+ export {
592
+ un as default
593
+ };