agentglow 0.3.2 → 0.4.1
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.
- package/README.md +89 -11
- package/cli/agentglow.mjs +7 -6
- package/dist/chunks/KitScene-qkWr95H9.js +5933 -0
- package/dist/chunks/ResourceWire-BWQJV3bx.js +36 -0
- package/dist/chunks/index-2zvNrAfW.js +921 -0
- package/dist/chunks/{index-D-egBmZU.js → index-BP5CK-0G.js} +194 -194
- package/dist/chunks/{index-CHJsMIrM.js → index-B__6Mr7M.js} +195 -194
- package/dist/chunks/{index-CpXj5lT0.js → index-Bfpwwg62.js} +151 -150
- package/dist/chunks/index-BkOdY6y8.js +678 -0
- package/dist/chunks/index-Bxr6tpps.js +1015 -0
- package/dist/chunks/index-DjDzoHSk.js +52 -0
- package/dist/chunks/index-vbo-4RNb.js +990 -0
- package/dist/index.js +1 -1
- package/dist/node.js +193 -0
- package/dist/pulse.js +20 -0
- package/dist/style.css +1 -1
- package/dist/types/node.d.ts +45 -0
- package/dist/types/pulse.d.ts +37 -0
- package/dist/types/themes.d.ts +1 -1
- package/dist/types/world.d.ts +192 -8
- package/package.json +55 -6
- package/dist/chunks/KitScene-DbBTTc3H.js +0 -4605
- package/dist/chunks/index-B2VQ34Za.js +0 -948
- package/dist/chunks/index-DZvO9oiI.js +0 -677
- package/dist/chunks/index-OgLlwjoE.js +0 -48
|
@@ -0,0 +1,678 @@
|
|
|
1
|
+
var nt = Object.defineProperty;
|
|
2
|
+
var rt = (t, r, e) => r in t ? nt(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e;
|
|
3
|
+
var ee = (t, r, e) => rt(t, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
+
import { jsxs as Y, Fragment as de, jsx as p } from "react/jsx-runtime";
|
|
5
|
+
import { Stars as at } from "@react-three/drei";
|
|
6
|
+
import { EffectComposer as st, Bloom as it, Vignette as ct } from "@react-three/postprocessing";
|
|
7
|
+
import { useFrame as re, useThree as lt } from "@react-three/fiber";
|
|
8
|
+
import { useRef as z, useMemo as V, useEffect as ut, useState as $e } from "react";
|
|
9
|
+
import * as o from "three";
|
|
10
|
+
import { T as Xe, w as L, a as ge, p as pt, e as ft, s as dt, x as fe, f as We, L as be, j as mt, k as ht, n as gt, l as vt, g as yt, b as Ke, K as wt, y as bt, z as Mt, G as St, A as Ct, R as At, u as xt, B as Rt, C as Tt, m as De, c as Ye, d as Pt, v as Vt } from "./KitScene-qkWr95H9.js";
|
|
11
|
+
const oe = (t) => t < 0 ? 0 : t > 1 ? 1 : t, ke = (t) => 1 - Math.pow(1 - oe(t), 3), Me = (t) => (t = oe(t), t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2), Gt = (t) => {
|
|
12
|
+
t = oe(t);
|
|
13
|
+
const r = 2.2;
|
|
14
|
+
return 1 + (r + 1) * Math.pow(t - 1, 3) + r * Math.pow(t - 1, 2);
|
|
15
|
+
}, Ve = Object.fromEntries(Object.entries(Xe).map(([t, r]) => [t, new o.Color(r)])), Ee = (t) => t === "graph_scout" || t === "records_scout" || t === "data_scout";
|
|
16
|
+
let Ae = null;
|
|
17
|
+
function zt() {
|
|
18
|
+
if (Ae) return Ae;
|
|
19
|
+
const t = document.createElement("canvas");
|
|
20
|
+
t.width = t.height = 128;
|
|
21
|
+
const r = t.getContext("2d"), e = r.createRadialGradient(64, 64, 0, 64, 64, 64);
|
|
22
|
+
return e.addColorStop(0, "rgba(255,255,255,1)"), e.addColorStop(0.15, "rgba(255,255,255,0.6)"), e.addColorStop(0.45, "rgba(255,255,255,0.14)"), e.addColorStop(1, "rgba(255,255,255,0)"), r.fillStyle = e, r.fillRect(0, 0, 128, 128), Ae = new o.CanvasTexture(t), Ae;
|
|
23
|
+
}
|
|
24
|
+
function le(t = "#fff") {
|
|
25
|
+
return new o.SpriteMaterial({ map: zt(), color: t, blending: o.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1 });
|
|
26
|
+
}
|
|
27
|
+
function se(t = "#fff") {
|
|
28
|
+
return new o.MeshBasicMaterial({ color: t, blending: o.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1 });
|
|
29
|
+
}
|
|
30
|
+
function Bt(t = 64, r = 7) {
|
|
31
|
+
const e = [], n = [];
|
|
32
|
+
for (let a = 0; a <= t; a++) {
|
|
33
|
+
const i = a / t;
|
|
34
|
+
for (let l = 0; l < r; l++) {
|
|
35
|
+
const h = l / r * Math.PI * 2;
|
|
36
|
+
e.push(i, Math.cos(h), Math.sin(h));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
for (let a = 0; a < t; a++)
|
|
40
|
+
for (let i = 0; i < r; i++) {
|
|
41
|
+
const l = a * r + i, h = a * r + (i + 1) % r, m = (a + 1) * r + i, M = (a + 1) * r + (i + 1) % r;
|
|
42
|
+
n.push(l, m, h, h, m, M);
|
|
43
|
+
}
|
|
44
|
+
const s = new o.BufferGeometry();
|
|
45
|
+
return s.setAttribute("position", new o.Float32BufferAttribute(e, 3)), s.setIndex(n), s.boundingSphere = new o.Sphere(new o.Vector3(), 1e4), s;
|
|
46
|
+
}
|
|
47
|
+
const Ze = Bt(), Ge = new o.SphereGeometry(1, 32, 24);
|
|
48
|
+
new o.SphereGeometry(1, 40, 28);
|
|
49
|
+
new o.IcosahedronGeometry(1, 1);
|
|
50
|
+
const Ie = new o.ConeGeometry(1, 1, 14).translate(0, 0.5, 0), Ot = new o.ConeGeometry(1, 1, 6, 1, !0).translate(0, 0.5, 0), Et = (
|
|
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
|
+
), Ft = (
|
|
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;
|
|
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
|
+
vec3 col = uColor * uOpacity * (core + spark * 3.5 + tip * 3.0 + flow * 2.2) + uHeadColor * head * (0.6 + vRim);
|
|
88
|
+
gl_FragColor = vec4(col, 1.0);
|
|
89
|
+
}`
|
|
90
|
+
);
|
|
91
|
+
function Qe(t = "#fff", r = 0.06, e = 0.4) {
|
|
92
|
+
return new o.ShaderMaterial({
|
|
93
|
+
uniforms: {
|
|
94
|
+
uP0: { value: new o.Vector3() },
|
|
95
|
+
uP1: { value: new o.Vector3() },
|
|
96
|
+
uP2: { value: new o.Vector3() },
|
|
97
|
+
uRadius: { value: r },
|
|
98
|
+
uTaper: { value: e },
|
|
99
|
+
uColor: { value: new o.Color(t) },
|
|
100
|
+
uOpacity: { value: 1 },
|
|
101
|
+
uGrow: { value: 1 },
|
|
102
|
+
uTime: { value: 0 },
|
|
103
|
+
uFlow: { value: 0 },
|
|
104
|
+
uSpark: { value: 0 },
|
|
105
|
+
uHead: { value: -1 },
|
|
106
|
+
uTail: { value: 0.12 },
|
|
107
|
+
uHeadColor: { value: new o.Color(4, 4, 4) }
|
|
108
|
+
},
|
|
109
|
+
vertexShader: Et,
|
|
110
|
+
fragmentShader: Ft,
|
|
111
|
+
transparent: !0,
|
|
112
|
+
depthWrite: !1,
|
|
113
|
+
blending: o.AdditiveBlending
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function ne(t, r, e, n, s) {
|
|
117
|
+
const a = 1 - n;
|
|
118
|
+
return s.set(a * a * t.x + 2 * a * n * r.x + n * n * e.x, a * a * t.y + 2 * a * n * r.y + n * n * e.y, a * a * t.z + 2 * a * n * r.z + n * n * e.z);
|
|
119
|
+
}
|
|
120
|
+
function Oe(t, r, e, n) {
|
|
121
|
+
n.copy(t).add(r).multiplyScalar(0.5);
|
|
122
|
+
const s = Math.hypot(n.x, n.y) || 1;
|
|
123
|
+
return n.x += n.x / s * e, n.y += n.y / s * e, n.z += e * 0.9, n;
|
|
124
|
+
}
|
|
125
|
+
function Ue(t, r, e) {
|
|
126
|
+
return t.r += r.r * e, t.g += r.g * e, t.b += r.b * e, t;
|
|
127
|
+
}
|
|
128
|
+
const Be = class Be {
|
|
129
|
+
constructor(r) {
|
|
130
|
+
ee(this, "mesh");
|
|
131
|
+
ee(this, "colors");
|
|
132
|
+
ee(this, "n", 0);
|
|
133
|
+
ee(this, "max");
|
|
134
|
+
ee(this, "o", new o.Object3D());
|
|
135
|
+
ee(this, "a", new o.Vector3());
|
|
136
|
+
ee(this, "b", new o.Vector3());
|
|
137
|
+
ee(this, "d", new o.Vector3());
|
|
138
|
+
this.max = r, this.colors = new Float32Array(r * 3), this.mesh = new o.InstancedMesh(Ie, new o.MeshBasicMaterial({ blending: o.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1 }), r), this.mesh.instanceColor = new o.InstancedBufferAttribute(this.colors, 3), this.mesh.frustumCulled = !1, this.mesh.count = 0;
|
|
139
|
+
}
|
|
140
|
+
begin() {
|
|
141
|
+
this.n = 0;
|
|
142
|
+
}
|
|
143
|
+
/** Arrow at curve parameter t, pointing toward p2 (dir=+1) or toward p0 (dir=-1). */
|
|
144
|
+
add(r, e, n, s, a, i, l, h = 1) {
|
|
145
|
+
this.n >= this.max || (ne(r, e, n, s, this.a), ne(r, e, n, Math.min(1, Math.max(0, s + 0.02 * a)), this.b), this.d.subVectors(this.b, this.a), !(this.d.lengthSq() < 1e-8) && (this.o.position.copy(this.a), this.o.quaternion.setFromUnitVectors(Be.UP, this.d.normalize()), this.o.scale.set(i * 0.4, i, i * 0.4), this.o.updateMatrix(), this.mesh.setMatrixAt(this.n, this.o.matrix), this.colors[this.n * 3] = l.r * h, this.colors[this.n * 3 + 1] = l.g * h, this.colors[this.n * 3 + 2] = l.b * h, this.n++));
|
|
146
|
+
}
|
|
147
|
+
end() {
|
|
148
|
+
this.mesh.count = this.n, this.mesh.instanceMatrix.needsUpdate = !0, this.mesh.instanceColor && (this.mesh.instanceColor.needsUpdate = !0);
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
ee(Be, "UP", new o.Vector3(0, 1, 0));
|
|
152
|
+
let ze = Be;
|
|
153
|
+
const Fe = new o.Vector3(), xe = new o.Vector3(), _t = new o.Vector3(0, 1, 0);
|
|
154
|
+
function He(t, r, e, n, s, a, i) {
|
|
155
|
+
ne(r, e, n, s, Fe), ne(r, e, n, Math.min(1, Math.max(0, s + 0.02 * a)), xe), t.position.copy(Fe), xe.sub(Fe), xe.lengthSq() > 1e-8 && t.quaternion.setFromUnitVectors(_t, xe.normalize()), t.scale.set(i * 0.4, i, i * 0.4);
|
|
156
|
+
}
|
|
157
|
+
const kt = new o.Color("#4b4a63"), Le = new o.Color("#fbbf24"), we = /* @__PURE__ */ new Map();
|
|
158
|
+
function It(t) {
|
|
159
|
+
const r = [], e = new o.Vector3(0, 1, 0), n = 10;
|
|
160
|
+
for (let s = 0; s < n; s++) {
|
|
161
|
+
const a = 1 - 2 * (s + 0.5) / n, i = Math.sqrt(1 - a * a), l = s * 2.39996 + t * 6.28;
|
|
162
|
+
r.push(new o.Quaternion().setFromUnitVectors(e, new o.Vector3(Math.cos(l) * i, a, Math.sin(l) * i)));
|
|
163
|
+
}
|
|
164
|
+
return r;
|
|
165
|
+
}
|
|
166
|
+
const jt = new o.TorusGeometry(1.25, 0.05, 8, 64);
|
|
167
|
+
function Wt({ agent: t, onSelect: r }) {
|
|
168
|
+
const e = t.inst, n = z(null), s = z(null), a = z(null), i = z(null), l = z(null), h = z(null), m = z(null), M = z(null), S = V(() => [...e.id].reduce((B, x) => (B * 31 + x.charCodeAt(0)) % 9973, 7) / 9973, [e.id]), F = V(() => It(S), [S]), C = Ve[e.type], g = V(
|
|
169
|
+
() => ({
|
|
170
|
+
core: se(C),
|
|
171
|
+
hot: se("#ffffff"),
|
|
172
|
+
spike: se(C),
|
|
173
|
+
ring: se(Le),
|
|
174
|
+
halo: le(C),
|
|
175
|
+
syn: Qe(C, Ee(e.type) ? 0.08 : 0.11, 0.8),
|
|
176
|
+
arrow: se(C)
|
|
177
|
+
}),
|
|
178
|
+
[C, e.type]
|
|
179
|
+
), c = V(() => ({ p0: new o.Vector3(), p1: new o.Vector3(), seedP: new o.Vector3(), p0set: !1, labelK: 1, spik: 0, ringK: 0, parentK: 1, c: new o.Color() }), []);
|
|
180
|
+
ut(() => (we.set(e.id, c.p1), () => {
|
|
181
|
+
we.get(e.id) === c.p1 && we.delete(e.id);
|
|
182
|
+
}), [e.id, c]), re(({ clock: B }) => {
|
|
183
|
+
var D, ie, Q;
|
|
184
|
+
const x = performance.now(), _ = B.elapsedTime, k = fe ? 0 : 0.08 * We.spread;
|
|
185
|
+
t.live.set(t.pos.x + Math.sin(_ * 0.35 + S * 20) * k, t.pos.y + Math.cos(_ * 0.3 + S * 13) * k, t.pos.z);
|
|
186
|
+
const G = t.live, f = e.parent ? L.instances.get(e.parent) : void 0, T = e.parent ? ge(e.parent) : void 0;
|
|
187
|
+
T ? (c.p0.copy(T), c.p0set = !0) : c.p0set || (c.p0.copy(G), c.p0set = !0), Oe(c.p0, G, Ee(e.type) || e.subagent ? 0.25 : 0.6, c.p1);
|
|
188
|
+
const K = (x - e.bornAt) / 1e3, I = e.parent ? ke(K / 0.9) : 1, P = Gt((K - (e.parent ? 0.85 : 0.1)) / 0.7), U = e.exitAt ? (x - e.exitAt) / 1e3 : -1, N = vt(e) / 1e3, y = U >= 0 ? oe(U / (N * 0.92)) : 0, $ = pt(e, x);
|
|
189
|
+
let X = !1;
|
|
190
|
+
for (const H of L.mcpPending.values()) H.instance === e.id && (X = !0);
|
|
191
|
+
const d = U < 0 && (e.status === "thinking" || e.status === "spawning"), b = ft(e, x), O = fe ? 0 : 1, j = 0.5 + 0.5 * Math.sin(_ * 2 + S * 9) * O, Z = 0.5 + 0.5 * Math.sin(_ * 1 + S * 5) * O;
|
|
192
|
+
c.spik += ((d ? 1 : 0) - c.spik) * 0.06, c.ringK += ((X && U < 0 ? 1 : 0) - c.ringK) * 0.08, n.current && (I < 1 ? n.current.position.copy(ne(c.p0, c.p1, G, I, c.seedP)) : n.current.position.copy(G));
|
|
193
|
+
const W = I < 1 ? 0.18 : 0, u = Math.max(W, 0.18 + 0.82 * P) * (1 - y * y * 0.95) * t.scale;
|
|
194
|
+
(D = s.current) == null || D.scale.setScalar(Math.max(1e-4, u * (0.55 + b * 0.06 + (d ? j * 0.05 : Z * 0.04)))), (ie = a.current) == null || ie.scale.setScalar(Math.max(1e-4, c.spik * (0.85 + j * 0.15)));
|
|
195
|
+
const v = d ? 0.75 + j * 0.35 : 0.3 + Z * 0.15;
|
|
196
|
+
if (c.c.copy(C).multiplyScalar(v + b * 0.35), U >= 0 && c.c.lerp(kt, y).multiplyScalar(1 - y * 0.75), g.core.color.copy(c.c), g.spike.color.copy(c.c).multiplyScalar(0.9), g.hot.color.setScalar((d ? 0.35 + j * 0.25 : 0.08) * (1 - y) + b * 0.2), i.current && (i.current.visible = c.ringK > 0.02, i.current.rotation.z = _ * 0.9, i.current.rotation.x = 1.1 + Math.sin(_ * 0.5) * 0.2, i.current.scale.setScalar(Math.max(1e-4, u * 0.55 * c.ringK)), g.ring.color.copy(Le).multiplyScalar(0.9 * c.ringK * (0.75 + Z * 0.25))), h.current && (h.current.scale.setScalar(Math.max(1e-4, u * (d ? 2.3 + j * 0.3 : 1.6) + b * 0.35)), g.halo.color.copy(C).multiplyScalar((d ? 0.22 : 0.09) * (1 - y) + b * 0.06)), (Q = M.current) == null || Q.position.set(0, -0.78 * t.scale - 0.25, 0), m.current) {
|
|
197
|
+
const H = dt(e.id);
|
|
198
|
+
c.labelK += ((H ? 1 : 0) - c.labelK) * 0.12, m.current.setOpacity(oe(P) * (1 - y) * 0.95 * c.labelK);
|
|
199
|
+
}
|
|
200
|
+
const E = !!f && !f.exitAt;
|
|
201
|
+
c.parentK += ((e.parent && !e.exitAt && E ? 1 : 0) - c.parentK) * (E ? 0.05 : 0.035);
|
|
202
|
+
const R = g.syn.uniforms;
|
|
203
|
+
R.uP0.value.copy(c.p0), R.uP1.value.copy(c.p1), R.uP2.value.copy(G);
|
|
204
|
+
const q = U >= 0 ? Me(U / (N * 0.64)) : 0;
|
|
205
|
+
if (R.uGrow.value = e.parent ? I * (1 - q) : 0, R.uSpark.value = 0, R.uHead.value = I < 1 ? I : -1, R.uTail.value = 0.1, R.uHeadColor.value.copy(C).multiplyScalar(1.5), R.uOpacity.value = (d ? 1.1 : 0.75) * Math.max(0, Math.min(c.parentK, $ > 0 ? 1 : 0)) + (I < 1 ? 0.4 : 0), R.uTime.value = fe ? 0 : _, R.uFlow.value = I >= 1 ? c.parentK : 0, l.current) {
|
|
206
|
+
const H = e.parent && I >= 1 && c.parentK > 0.05 && R.uGrow.value > 0.9;
|
|
207
|
+
if (l.current.visible = !!H, H) {
|
|
208
|
+
ne(c.p0, c.p1, G, 0.8, _e), ne(c.p0, c.p1, G, 0.86, qe), l.current.position.copy(_e), Ne.subVectors(qe, _e).normalize(), l.current.quaternion.setFromUnitVectors(Kt, Ne);
|
|
209
|
+
const ue = (Ee(e.type) ? 0.75 : 1) * Math.min(1.3, We.scale);
|
|
210
|
+
l.current.scale.set(0.16 * ue, 0.42 * ue, 0.16 * ue), g.arrow.color.copy(C).multiplyScalar(1.6 * c.parentK);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
const A = (B) => {
|
|
215
|
+
B.stopPropagation(), r(e.id);
|
|
216
|
+
}, w = e.id.split(":")[2];
|
|
217
|
+
return /* @__PURE__ */ Y(de, { children: [
|
|
218
|
+
/* @__PURE__ */ p("mesh", { geometry: Ze, material: g.syn, frustumCulled: !1 }),
|
|
219
|
+
/* @__PURE__ */ p("mesh", { ref: l, geometry: Ie, material: g.arrow, visible: !1 }),
|
|
220
|
+
/* @__PURE__ */ Y("group", { ref: n, children: [
|
|
221
|
+
/* @__PURE__ */ Y("group", { ref: s, scale: 1e-4, children: [
|
|
222
|
+
/* @__PURE__ */ p("mesh", { geometry: Ge, material: g.core, onClick: A, onPointerOver: () => document.body.style.cursor = "pointer", onPointerOut: () => document.body.style.cursor = "" }),
|
|
223
|
+
/* @__PURE__ */ p("mesh", { geometry: Ge, material: g.hot, scale: 0.5 }),
|
|
224
|
+
/* @__PURE__ */ p("group", { ref: a, scale: 1e-4, children: F.map((B, x) => /* @__PURE__ */ p("mesh", { geometry: Ot, material: g.spike, quaternion: B, scale: [0.2, 1.9, 0.2] }, x)) })
|
|
225
|
+
] }),
|
|
226
|
+
/* @__PURE__ */ p("mesh", { ref: i, geometry: jt, material: g.ring, visible: !1 }),
|
|
227
|
+
/* @__PURE__ */ p("sprite", { ref: h, material: g.halo }),
|
|
228
|
+
/* @__PURE__ */ p("group", { ref: M, children: /* @__PURE__ */ p(
|
|
229
|
+
be,
|
|
230
|
+
{
|
|
231
|
+
ref: m,
|
|
232
|
+
text: `${e.name}${w !== void 0 ? ` ${Number(w) + 1}` : ""}`,
|
|
233
|
+
live: e.job ? () => mt(e) : null,
|
|
234
|
+
color: Xe[e.type],
|
|
235
|
+
size: e.subagent ? 0.22 : 0.3,
|
|
236
|
+
opacity: 0,
|
|
237
|
+
fit: !0,
|
|
238
|
+
pxRange: e.subagent ? [8, 12] : [9, 14]
|
|
239
|
+
}
|
|
240
|
+
) })
|
|
241
|
+
] })
|
|
242
|
+
] });
|
|
243
|
+
}
|
|
244
|
+
const _e = new o.Vector3(), qe = new o.Vector3(), Ne = new o.Vector3(), Kt = new o.Vector3(0, 1, 0);
|
|
245
|
+
function Ut({ comet: t }) {
|
|
246
|
+
const r = z(null), e = L.instances.get(t.from), n = e ? Ve[e.type] : Ve.planner, s = V(() => le(new o.Color(n).multiplyScalar(1.8).addScalar(0.3)), [n]), a = V(() => ({ a: new o.Vector3(), b: new o.Vector3(), c: new o.Vector3(), h: new o.Vector3() }), []);
|
|
247
|
+
return re(() => {
|
|
248
|
+
const i = ge(t.from), l = ge(t.to);
|
|
249
|
+
if (!i || !l || !r.current) {
|
|
250
|
+
r.current && (r.current.visible = !1);
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
const h = L.instances.get(t.to), m = (h == null ? void 0 : h.parent) === t.from ? we.get(t.to) : (e == null ? void 0 : e.parent) === t.to ? we.get(t.from) : void 0;
|
|
254
|
+
a.a.copy(i), a.b.copy(l), m ? a.c.copy(m) : Oe(a.a, a.b, 1.2, a.c);
|
|
255
|
+
const M = ht(t);
|
|
256
|
+
ne(a.a, a.c, a.b, Me(M), a.h), r.current.visible = gt(t), r.current.position.copy(a.h), r.current.scale.setScalar(1.1);
|
|
257
|
+
}), /* @__PURE__ */ p("sprite", { ref: r, material: s, visible: !1 });
|
|
258
|
+
}
|
|
259
|
+
function Ht() {
|
|
260
|
+
const [t, r] = $e([]), e = z({ n: -1, last: -1, first: -1 });
|
|
261
|
+
return re(() => {
|
|
262
|
+
const n = L.comets, s = e.current, a = n.length ? n[0].id : -1, i = n.length ? n[n.length - 1].id : -1;
|
|
263
|
+
(n.length !== s.n || a !== s.first || i !== s.last) && (s.n = n.length, s.first = a, s.last = i, r(n.filter((l) => !(l.from.startsWith("svc:") && l.to.startsWith("svc:") && !l.failed) && (!yt.grouped || Ke(l.from) && Ke(l.to)))));
|
|
264
|
+
}), /* @__PURE__ */ p(de, { children: t.map((n) => /* @__PURE__ */ p(Ut, { comet: n }, n.id)) });
|
|
265
|
+
}
|
|
266
|
+
const te = 3.3, Lt = 200, ce = 14, Re = 48, me = 16, pe = 8, Te = 4, ve = new o.Color(1, 1, 1), qt = new o.Color("#a78bfa");
|
|
267
|
+
function Nt(t, r = Lt) {
|
|
268
|
+
const e = t.nodes.slice(0, r), n = new Set(e.map((s) => s.id));
|
|
269
|
+
return { nodes: e, links: t.links.filter((s) => n.has(s.source) && n.has(s.target)) };
|
|
270
|
+
}
|
|
271
|
+
const $t = (
|
|
272
|
+
/* glsl */
|
|
273
|
+
`
|
|
274
|
+
attribute float aSize; attribute vec3 aColor; varying vec3 vC; varying float vFacing; uniform float uScale;
|
|
275
|
+
void main(){
|
|
276
|
+
vec4 mv = modelViewMatrix * vec4(position, 1.0);
|
|
277
|
+
vec3 n = normalize(normalMatrix * normalize(position));
|
|
278
|
+
vFacing = 0.35 + 0.65 * smoothstep(-0.4, 0.5, dot(n, normalize(-mv.xyz))); // back side dimmer → depth
|
|
279
|
+
gl_PointSize = aSize * uScale / -mv.z; vC = aColor; gl_Position = projectionMatrix * mv; }`
|
|
280
|
+
), Xt = (
|
|
281
|
+
/* glsl */
|
|
282
|
+
`
|
|
283
|
+
varying vec3 vC; varying float vFacing;
|
|
284
|
+
void main(){ float r = length(gl_PointCoord - 0.5) * 2.0; if (r > 1.0) discard;
|
|
285
|
+
float core = smoothstep(0.45, 0.0, r); float halo = pow(1.0 - r, 2.2);
|
|
286
|
+
gl_FragColor = vec4(vC * vFacing * (core * 1.2 + halo * 0.45), 1.0); }`
|
|
287
|
+
), Dt = (
|
|
288
|
+
/* glsl */
|
|
289
|
+
`
|
|
290
|
+
varying vec3 vN; varying vec3 vV; varying vec3 vObj;
|
|
291
|
+
void main(){ vec4 mv = modelViewMatrix * vec4(position, 1.0); vN = normalize(normalMatrix * normal); vV = normalize(-mv.xyz); vObj = normalize(position);
|
|
292
|
+
gl_Position = projectionMatrix * mv; }`
|
|
293
|
+
), Yt = (
|
|
294
|
+
/* glsl */
|
|
295
|
+
`
|
|
296
|
+
uniform vec3 uRim; uniform vec3 uInner; uniform float uTime;
|
|
297
|
+
uniform vec3 uRipC[${pe}]; uniform float uRipA[${pe}];
|
|
298
|
+
varying vec3 vN; varying vec3 vV; varying vec3 vObj;
|
|
299
|
+
void main(){
|
|
300
|
+
float f = 1.0 - abs(dot(normalize(vN), normalize(vV)));
|
|
301
|
+
float rim = pow(f, 3.0);
|
|
302
|
+
float body = pow(1.0 - f, 2.0) * 0.12; // faint glassy fill toward the center
|
|
303
|
+
float shimmer = 0.92 + 0.08 * sin(uTime * 0.25 + vObj.y * 3.0 + vObj.x * 2.0);
|
|
304
|
+
vec3 col = uRim * rim * 1.1 * shimmer + uInner * body;
|
|
305
|
+
float rip = 0.0;
|
|
306
|
+
for (int i = 0; i < ${pe}; i++) {
|
|
307
|
+
float a = uRipA[i];
|
|
308
|
+
if (a < 0.0 || a > 1.0) continue;
|
|
309
|
+
float d = acos(clamp(dot(vObj, uRipC[i]), -1.0, 1.0));
|
|
310
|
+
float ring = a * 2.2;
|
|
311
|
+
rip += exp(-pow((d - ring) / 0.06, 2.0)) * (1.0 - a) * (1.0 - a);
|
|
312
|
+
}
|
|
313
|
+
col += vec3(1.0) * rip * 0.6;
|
|
314
|
+
gl_FragColor = vec4(col, 1.0);
|
|
315
|
+
}`
|
|
316
|
+
);
|
|
317
|
+
function Zt({ galaxy: t }) {
|
|
318
|
+
const r = V(() => Nt(t), [t]), e = r.nodes.length, { size: n, gl: s, camera: a } = lt(), i = z([]), l = z([]), h = z(Array(Te).fill("")), m = V(() => {
|
|
319
|
+
const c = new Float32Array(e * 3), A = [], w = Math.PI * (3 - Math.sqrt(5));
|
|
320
|
+
for (let d = 0; d < e; d++) {
|
|
321
|
+
const b = 1 - 2 * (d + 0.5) / e, O = Math.sqrt(1 - b * b), j = new o.Vector3(Math.cos(d * w) * O, b, Math.sin(d * w) * O);
|
|
322
|
+
A.push(j), c.set([j.x * te, j.y * te, j.z * te], d * 3);
|
|
323
|
+
}
|
|
324
|
+
const B = r.nodes.map((d) => new o.Color(wt[d.kind] ?? "#94a3b8").lerp(qt, 0.2).multiplyScalar(0.62)), x = new Float32Array(e), _ = new Float32Array(e * 3), k = new o.BufferGeometry();
|
|
325
|
+
k.setAttribute("position", new o.BufferAttribute(c, 3)), k.setAttribute("aSize", new o.BufferAttribute(x, 1)), k.setAttribute("aColor", new o.BufferAttribute(_, 3));
|
|
326
|
+
const G = new Map(r.nodes.map((d, b) => [d.id, b])), f = [], T = [];
|
|
327
|
+
for (const d of r.links) {
|
|
328
|
+
const b = G.get(d.source), O = G.get(d.target);
|
|
329
|
+
b !== void 0 && O !== void 0 && b !== O && A[b].angleTo(A[O]) < 1.25 && (f.push([b, O]), T.push(1));
|
|
330
|
+
}
|
|
331
|
+
for (let d = 0; d < e; d++) {
|
|
332
|
+
let b = -1, O = -1, j = 9, Z = 9;
|
|
333
|
+
for (let W = 0; W < e; W++) {
|
|
334
|
+
if (W === d) continue;
|
|
335
|
+
const u = A[d].distanceToSquared(A[W]);
|
|
336
|
+
u < j ? (O = b, Z = j, b = W, j = u) : u < Z && (O = W, Z = u);
|
|
337
|
+
}
|
|
338
|
+
b > d && (f.push([d, b]), T.push(0)), O > d && (f.push([d, O]), T.push(0));
|
|
339
|
+
}
|
|
340
|
+
const K = new Float32Array(f.length * ce * 2 * 3), I = new Float32Array(f.length * ce * 2 * 3), P = new Int32Array(f.length * ce * 2 * 2), U = new Uint8Array(f.length * ce * 2), N = new o.Quaternion(), y = new o.Vector3();
|
|
341
|
+
f.forEach(([d, b], O) => {
|
|
342
|
+
const j = A[d], Z = A[b], W = j.angleTo(Z), u = new o.Vector3().crossVectors(j, Z);
|
|
343
|
+
u.lengthSq() < 1e-6 && u.set(0, 1, 0), u.normalize();
|
|
344
|
+
for (let v = 0; v < ce; v++)
|
|
345
|
+
for (let E = 0; E < 2; E++) {
|
|
346
|
+
const R = (v + E) / ce;
|
|
347
|
+
N.setFromAxisAngle(u, W * R), y.copy(j).applyQuaternion(N).multiplyScalar(te * (1 + 0.06 * Math.sin(Math.PI * R) * Math.min(1, W)));
|
|
348
|
+
const q = (O * ce + v) * 2 + E;
|
|
349
|
+
K.set([y.x, y.y, y.z], q * 3), P[q * 2] = d, P[q * 2 + 1] = b, U[q] = T[O];
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
const $ = new o.BufferGeometry();
|
|
353
|
+
$.setAttribute("position", new o.BufferAttribute(K, 3)), $.setAttribute("color", new o.BufferAttribute(I, 3));
|
|
354
|
+
const X = new o.BufferGeometry();
|
|
355
|
+
return X.setAttribute("position", new o.BufferAttribute(new Float32Array(Re * me * 2 * 3), 3)), X.setAttribute("color", new o.BufferAttribute(new Float32Array(Re * me * 2 * 3), 3)), X.boundingSphere = new o.Sphere(new o.Vector3(), 1e4), { pos: c, unit: A, base: B, ngeo: k, ageo: $, owner: P, kindOf: U, nArcV: f.length * ce * 2, bgeo: X, fire: new Float32Array(e), white: new Float32Array(e), fireC: Array.from({ length: e }, () => new o.Color()) };
|
|
356
|
+
}, [r, e]), M = V(
|
|
357
|
+
() => ({
|
|
358
|
+
nodes: new o.ShaderMaterial({ uniforms: { uScale: { value: 400 } }, vertexShader: $t, fragmentShader: Xt, transparent: !0, depthWrite: !1, blending: o.AdditiveBlending }),
|
|
359
|
+
arcs: new o.LineBasicMaterial({ vertexColors: !0, transparent: !0, blending: o.AdditiveBlending, depthWrite: !1, toneMapped: !1 }),
|
|
360
|
+
beam: new o.LineBasicMaterial({ vertexColors: !0, transparent: !0, blending: o.AdditiveBlending, depthWrite: !1, toneMapped: !1 }),
|
|
361
|
+
orb: new o.ShaderMaterial({
|
|
362
|
+
uniforms: {
|
|
363
|
+
uRim: { value: new o.Color("#8b7cff").multiplyScalar(0.7) },
|
|
364
|
+
uInner: { value: new o.Color("#5b8cff").multiplyScalar(0.6) },
|
|
365
|
+
uTime: { value: 0 },
|
|
366
|
+
uRipC: { value: Array.from({ length: pe }, () => new o.Vector3(0, 1, 0)) },
|
|
367
|
+
uRipA: { value: new Array(pe).fill(-1) }
|
|
368
|
+
},
|
|
369
|
+
vertexShader: Dt,
|
|
370
|
+
fragmentShader: Yt,
|
|
371
|
+
transparent: !0,
|
|
372
|
+
depthWrite: !1,
|
|
373
|
+
blending: o.AdditiveBlending
|
|
374
|
+
}),
|
|
375
|
+
core: le(new o.Color("#8b7cff").multiplyScalar(0.22)),
|
|
376
|
+
aura: le(new o.Color("#4c1d95").multiplyScalar(0.28))
|
|
377
|
+
}),
|
|
378
|
+
[]
|
|
379
|
+
), S = V(() => /* @__PURE__ */ new Map(), []), F = V(() => new ze(Re), []), C = V(() => ({ v: new o.Vector3(), v2: new o.Vector3(), mid: new o.Vector3(), sp: new o.Vector3(), c: new o.Color(), c2: new o.Color() }), []), g = (c) => {
|
|
380
|
+
let A = S.get(c);
|
|
381
|
+
return A === void 0 && S.set(c, A = Ct(r, c)), A;
|
|
382
|
+
};
|
|
383
|
+
return re(({ clock: c }) => {
|
|
384
|
+
const A = performance.now(), { pos: w, base: B, fire: x, white: _, fireC: k, unit: G } = m;
|
|
385
|
+
M.nodes.uniforms.uScale.value = n.height * s.getPixelRatio() / (2 * Math.tan(a.fov * Math.PI / 360)) * bt.graph.scale, M.orb.uniforms.uTime.value = fe ? 0 : c.elapsedTime, x.fill(0), _.fill(0);
|
|
386
|
+
const { v: f, v2: T, mid: K, c: I, c2: P } = C, U = m.bgeo.getAttribute("position"), N = m.bgeo.getAttribute("color"), y = M.orb.uniforms.uRipC.value, $ = M.orb.uniforms.uRipA.value;
|
|
387
|
+
let X = 0;
|
|
388
|
+
F.begin();
|
|
389
|
+
let d = 0;
|
|
390
|
+
for (const u of L.flares) {
|
|
391
|
+
const v = g(u.node), E = (A - u.start) / 1e3, R = L.instances.get(u.instance), q = R ? Ve[R.type] : ve, D = u.op === "write", ie = E < 0.35 ? E / 0.35 : Math.exp(-(E - 0.35) * 1.2);
|
|
392
|
+
ie > x[v] && (x[v] = ie, k[v].copy(D ? ve : q), _[v] = D ? 1 : 0), D && E < 1.8 && d < pe && (y[d].copy(G[v]), $[d] = E / 1.8, d++);
|
|
393
|
+
const Q = ge(u.instance), H = Q ? Mt(Q, C.sp) : void 0;
|
|
394
|
+
if (H && E < 2.2 && X < Re) {
|
|
395
|
+
f.set(w[v * 3], w[v * 3 + 1], w[v * 3 + 2]), K.copy(H).add(f).multiplyScalar(0.5), K.z += 1;
|
|
396
|
+
const ue = Math.min(1, E / 0.3) * (1 - E / 2.2) ** 1.5, tt = D ? Math.min(1, E * 0.85) : 1 - Math.min(1, E * 0.85);
|
|
397
|
+
for (let Se = 0; Se < me; Se++)
|
|
398
|
+
for (let Ce = 0; Ce < 2; Ce++) {
|
|
399
|
+
const J = (Se + Ce) / me, ae = 1 - J;
|
|
400
|
+
T.set(ae * ae * H.x + 2 * ae * J * K.x + J * J * f.x, ae * ae * H.y + 2 * ae * J * K.y + J * J * f.y, ae * ae * H.z + 2 * ae * J * K.z + J * J * f.z);
|
|
401
|
+
const je = (X * me + Se) * 2 + Ce;
|
|
402
|
+
U.setXYZ(je, T.x, T.y, T.z);
|
|
403
|
+
const ot = Math.exp(-(((J - tt) / 0.1) ** 2)) * 1.3;
|
|
404
|
+
P.copy(D ? ve : q).multiplyScalar(ue * ((D ? 0.5 : 0.2) + ot) * 0.75), N.setXYZ(je, P.r, P.g, P.b);
|
|
405
|
+
}
|
|
406
|
+
D ? F.add(H, K, f, 0.9, 1, 0.42, ve, ue * 1.1) : F.add(H, K, f, 0.1, -1, 0.42, q, ue * 1.3), X++;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
for (let u = d; u < pe; u++) $[u] = -1;
|
|
410
|
+
m.bgeo.setDrawRange(0, X * me * 2), F.end(), U.needsUpdate = !0, N.needsUpdate = !0;
|
|
411
|
+
const b = m.ngeo.getAttribute("aSize"), O = m.ngeo.getAttribute("aColor");
|
|
412
|
+
for (let u = 0; u < e; u++) {
|
|
413
|
+
const v = x[u];
|
|
414
|
+
b.setX(u, 0.21 + v * (0.55 + _[u] * 0.25)), I.copy(B[u]), v > 0.01 && Ue(Ue(I, k[u], v * 1.6), ve, v * (0.3 + _[u] * 1.2)), O.setXYZ(u, I.r, I.g, I.b);
|
|
415
|
+
}
|
|
416
|
+
b.needsUpdate = !0, O.needsUpdate = !0;
|
|
417
|
+
const j = m.ageo.getAttribute("color"), Z = m.owner;
|
|
418
|
+
for (let u = 0; u < m.nArcV; u++) {
|
|
419
|
+
const v = Z[u * 2], E = Z[u * 2 + 1], R = Math.max(x[v], x[E]), q = m.kindOf[u] ? 0.16 : 0.07;
|
|
420
|
+
j.setXYZ(u, 0.42 * q + R * 0.3, 0.36 * q + R * 0.3, 0.85 * q + R * 0.4);
|
|
421
|
+
}
|
|
422
|
+
j.needsUpdate = !0;
|
|
423
|
+
let W = 0;
|
|
424
|
+
for (let u = L.flares.length - 1; u >= 0 && W < Te; u--) {
|
|
425
|
+
const v = L.flares[u];
|
|
426
|
+
if (A - v.start > 2200) break;
|
|
427
|
+
let E = !1;
|
|
428
|
+
for (let Q = 0; Q < W; Q++) h.current[Q] === v.node && (E = !0);
|
|
429
|
+
if (E) continue;
|
|
430
|
+
const R = g(v.node);
|
|
431
|
+
let q = !1;
|
|
432
|
+
for (let Q = 0; Q < W; Q++) {
|
|
433
|
+
const H = l.current[Q];
|
|
434
|
+
H && Math.abs(H.position.y - w[R * 3 + 1]) < 0.55 && Math.abs(H.position.x - w[R * 3]) < 3.2 && (q = !0);
|
|
435
|
+
}
|
|
436
|
+
if (q) continue;
|
|
437
|
+
const D = i.current[W], ie = l.current[W];
|
|
438
|
+
D && ie && (ie.position.set(w[R * 3], w[R * 3 + 1], w[R * 3 + 2]), h.current[W] !== v.node && (D.setText(`${v.op === "write" ? "wrote" : "read"} · ${v.node}`), D.setColor(v.op === "write" ? "#ffffff" : "#22d3ee")), D.setOpacity(1)), h.current[W] = v.node, W++;
|
|
439
|
+
}
|
|
440
|
+
for (let u = W; u < Te; u++) {
|
|
441
|
+
const v = i.current[u];
|
|
442
|
+
v == null || v.setOpacity(0), h.current[u] = "";
|
|
443
|
+
}
|
|
444
|
+
}), /* @__PURE__ */ Y(de, { children: [
|
|
445
|
+
/* @__PURE__ */ Y("group", { children: [
|
|
446
|
+
/* @__PURE__ */ p("sprite", { material: M.aura, scale: te * 4.2, position: [0, 0, -te] }),
|
|
447
|
+
/* @__PURE__ */ p("sprite", { material: M.core, scale: te * 1.5 }),
|
|
448
|
+
/* @__PURE__ */ p("mesh", { geometry: Ge, material: M.orb, scale: te * 1.02 }),
|
|
449
|
+
/* @__PURE__ */ p("lineSegments", { geometry: m.ageo, material: M.arcs, frustumCulled: !1 }),
|
|
450
|
+
/* @__PURE__ */ p("points", { geometry: m.ngeo, material: M.nodes, frustumCulled: !1 })
|
|
451
|
+
] }),
|
|
452
|
+
/* @__PURE__ */ p("lineSegments", { geometry: m.bgeo, material: M.beam, frustumCulled: !1 }),
|
|
453
|
+
/* @__PURE__ */ p("primitive", { object: F.mesh }),
|
|
454
|
+
Array.from({ length: Te }, (c, A) => /* @__PURE__ */ p("group", { ref: (w) => void (l.current[A] = w), children: /* @__PURE__ */ p(be, { ref: (w) => void (i.current[A] = w), text: "", offset: [0, 0.42], size: 0.24, opacity: 0, fadeMs: 250, pxRange: [8, 12] }) }, A)),
|
|
455
|
+
/* @__PURE__ */ p(St, { position: [0, -te - 0.9, 0], color: "#a78bfa", size: 0.28, opacity: 0.7, pxRange: [8, 12] })
|
|
456
|
+
] });
|
|
457
|
+
}
|
|
458
|
+
function Qt({ run: t }) {
|
|
459
|
+
const r = V(() => new o.Color(t.color), [t.color]), e = V(() => le("#000"), []), n = z(null), s = z(null);
|
|
460
|
+
return re(({ clock: a }) => {
|
|
461
|
+
var C;
|
|
462
|
+
const i = performance.now(), l = t.run ?? L.runs.get(t.id), h = l ? ke((i - l.startedAt) / 1200) : 1, m = l != null && l.endedAt ? oe(1 - (i - l.endedAt - (At - 2500)) / 2500) : 1, M = 0.9 + 0.1 * Math.sin(a.elapsedTime * 0.6 + t.index);
|
|
463
|
+
e.color.copy(r).multiplyScalar(0.16 * h * m * M);
|
|
464
|
+
const S = Math.abs(t.side.x) * t.hu + Math.abs(t.axis.x) * t.hv, F = Math.abs(t.side.y) * t.hu + Math.abs(t.axis.y) * t.hv;
|
|
465
|
+
n.current && (n.current.position.set(t.origin.x, t.origin.y, -1.5), n.current.scale.set(S * 2.6 + 3, F * 2.6 + 3, 1)), (C = s.current) == null || C.position.set(t.origin.x, t.origin.y + F + 0.6, 0.5);
|
|
466
|
+
}), /* @__PURE__ */ Y(de, { children: [
|
|
467
|
+
/* @__PURE__ */ p("sprite", { ref: n, material: e }),
|
|
468
|
+
/* @__PURE__ */ p("group", { ref: s, children: t.run && /* @__PURE__ */ p(Jt, { run: t.run }) })
|
|
469
|
+
] });
|
|
470
|
+
}
|
|
471
|
+
function Jt({ run: t }) {
|
|
472
|
+
xt();
|
|
473
|
+
const r = t.status !== "started" || Rt(t);
|
|
474
|
+
return /* @__PURE__ */ p(
|
|
475
|
+
be,
|
|
476
|
+
{
|
|
477
|
+
text: t.topic,
|
|
478
|
+
secondary: Tt(t, { base: "#94a3b8", current: "#fde68a", done: "#cbd5e1" }, ["running…", "run complete"]),
|
|
479
|
+
color: t.color,
|
|
480
|
+
size: 0.34,
|
|
481
|
+
maxWidth: 10,
|
|
482
|
+
opacity: r ? 0.5 : 1,
|
|
483
|
+
fadeMs: 400,
|
|
484
|
+
anchorY: "bottom",
|
|
485
|
+
pxRange: [10, 15]
|
|
486
|
+
}
|
|
487
|
+
);
|
|
488
|
+
}
|
|
489
|
+
const eo = new o.Color("#fbbf24"), to = new o.Color("#ff2d3d"), Je = new o.Color(1, 1, 1), et = new o.OctahedronGeometry(0.8, 0), oo = new o.EdgesGeometry(et);
|
|
490
|
+
function no(t) {
|
|
491
|
+
const r = (e, n, s) => ({ geo: e, edges: new o.EdgesGeometry(e, 25), pos: n, rot: s });
|
|
492
|
+
switch (t) {
|
|
493
|
+
case "db":
|
|
494
|
+
return [r(new o.CylinderGeometry(0.42, 0.42, 0.7, 28)), r(new o.TorusGeometry(0.42, 0.015, 6, 40), [0, 0.12, 0], [Math.PI / 2, 0, 0])];
|
|
495
|
+
case "warehouse":
|
|
496
|
+
return [-0.3, 0, 0.3].map((e) => r(new o.BoxGeometry(0.95, 0.2, 0.6), [0, e, 0]));
|
|
497
|
+
case "spark": {
|
|
498
|
+
const e = [{ geo: new o.SphereGeometry(0.17, 16, 12) }];
|
|
499
|
+
for (let n = 0; n < 6; n++) {
|
|
500
|
+
const s = n / 6 * Math.PI * 2;
|
|
501
|
+
e.push({ geo: new o.SphereGeometry(0.1, 12, 10), pos: [Math.cos(s) * 0.45, Math.sin(s) * 0.45, (n % 2 ? 1 : -1) * 0.12] });
|
|
502
|
+
}
|
|
503
|
+
return e;
|
|
504
|
+
}
|
|
505
|
+
case "api":
|
|
506
|
+
return [r(new o.TorusGeometry(0.4, 0.1, 10, 36))];
|
|
507
|
+
case "storage":
|
|
508
|
+
return [r(new o.BoxGeometry(0.7, 0.7, 0.7), void 0, [0.4, 0.6, 0])];
|
|
509
|
+
case "queue":
|
|
510
|
+
return [r(new o.CapsuleGeometry(0.2, 0.75, 6, 16), void 0, [0, 0, Math.PI / 2])];
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
function ro({ mcp: t, backend: r }) {
|
|
514
|
+
const e = t.srv, n = r.res, s = V(() => no(n.kind), [n.kind]), a = V(() => new o.Color(e.color).lerp(Je, 0.35), [e.color]), i = V(
|
|
515
|
+
() => ({ edge: Qe(e.color, 0.035, 1), arrow: se(a), fill: se(a), line: new o.LineBasicMaterial({ color: a, transparent: !0, blending: o.AdditiveBlending, depthWrite: !1, toneMapped: !1 }), halo: le(a) }),
|
|
516
|
+
[e.color, a]
|
|
517
|
+
), l = z(null), h = z(null), m = z(null), M = z(null), S = V(() => new o.Color(e.color), [e.color]), F = z(null), C = z("");
|
|
518
|
+
return re(({ clock: g }) => {
|
|
519
|
+
var U, N;
|
|
520
|
+
const c = i.edge.uniforms;
|
|
521
|
+
c.uP0.value.copy(t.pos), c.uP2.value.copy(r.pos), c.uP1.value.copy(t.pos).add(r.pos).multiplyScalar(0.5), (U = l.current) == null || U.position.copy(r.pos);
|
|
522
|
+
const A = performance.now(), w = n.inflight > 0, B = De(n.activeAt, A, 1.5), x = w ? 0.5 + 0.5 * Math.sin(g.elapsedTime * 5) : 0, _ = w ? 1.6 + x * 0.9 : 0.12 + B * 0.9;
|
|
523
|
+
i.fill.color.copy(a).multiplyScalar(_ * 0.55), i.line.color.copy(a).multiplyScalar(_ * 1.6), i.halo.color.copy(a).multiplyScalar(w ? 0.45 + x * 0.25 : 0.02 + B * 0.25), (N = m.current) == null || N.scale.setScalar(w ? 4.2 + x * 0.8 : 2.4 + B * 1.2), h.current && h.current.scale.setScalar(w ? 1.2 + x * 0.08 : 1 + B * 0.1);
|
|
524
|
+
let k = n.name, G = null;
|
|
525
|
+
for (const y of L.mcpCalls) y.server === e.name && y.resource === n.name && (!G || y.start > G.start) && (G = y);
|
|
526
|
+
if (w) {
|
|
527
|
+
let y = "";
|
|
528
|
+
for (const $ of L.mcpPending.values()) $.server === e.name && $.resource === n.name && (y = $.tool);
|
|
529
|
+
k = `${n.name} ▶ ${y || "query"}()`;
|
|
530
|
+
} else G && G.phase === "result" && A - G.start < 1800 && (k = `${n.name} ✓ returned`);
|
|
531
|
+
F.current && (k !== C.current && (F.current.setText(k), C.current = k), F.current.setOpacity(w ? 1 : 0.55 + B * 0.45), F.current.setEmphasis(w)), h.current && (h.current.rotation.y = n.kind === "spark" || n.kind === "api" ? g.elapsedTime * (w ? 0.6 : 0.15) : Math.sin(g.elapsedTime * 0.2) * 0.25);
|
|
532
|
+
const f = i.edge.uniforms;
|
|
533
|
+
f.uTime.value = fe ? 0 : g.elapsedTime;
|
|
534
|
+
let T = null;
|
|
535
|
+
for (const y of L.mcpCalls) y.server === e.name && y.resource === n.name && (!T || y.start > T.start) && (T = y);
|
|
536
|
+
const K = T && T.phase === "result" ? (A - T.start) / T.dur : 9, I = K < 1, P = M.current;
|
|
537
|
+
if (I) {
|
|
538
|
+
const y = Me(K);
|
|
539
|
+
f.uRadius.value = 0.06, f.uOpacity.value = 0.9 * (1 - K * 0.6), f.uFlow.value = 0, f.uHead.value = 1 - y, f.uTail.value = 0.2, f.uHeadColor.value.copy(a).multiplyScalar(3), P && (P.visible = !0, He(P, f.uP0.value, f.uP1.value, f.uP2.value, 0.12, -1, 0.55), i.arrow.color.copy(a).multiplyScalar(2 * (1 - K * 0.7)));
|
|
540
|
+
} else w ? (f.uRadius.value = 0.03, f.uOpacity.value = 0.45, f.uFlow.value = 1, f.uHead.value = -1, P && (P.visible = !0, He(P, f.uP0.value, f.uP1.value, f.uP2.value, 0.84, 1, 0.42), i.arrow.color.copy(S).multiplyScalar(1.1))) : (f.uRadius.value = 0.03, f.uOpacity.value = 0.15 + B * 0.4, f.uFlow.value = 0, f.uHead.value = -1, P && (P.visible = !1));
|
|
541
|
+
}), /* @__PURE__ */ Y(de, { children: [
|
|
542
|
+
/* @__PURE__ */ p("mesh", { geometry: Ze, material: i.edge, frustumCulled: !1 }),
|
|
543
|
+
/* @__PURE__ */ p("mesh", { ref: M, geometry: Ie, material: i.arrow, visible: !1 }),
|
|
544
|
+
/* @__PURE__ */ Y("group", { ref: l, children: [
|
|
545
|
+
/* @__PURE__ */ p("sprite", { ref: m, material: i.halo }),
|
|
546
|
+
/* @__PURE__ */ p("group", { ref: h, children: s.map((g, c) => /* @__PURE__ */ Y("group", { position: g.pos, rotation: g.rot, children: [
|
|
547
|
+
/* @__PURE__ */ p("mesh", { geometry: g.geo, material: i.fill }),
|
|
548
|
+
g.edges && /* @__PURE__ */ p("lineSegments", { geometry: g.edges, material: i.line })
|
|
549
|
+
] }, c)) }),
|
|
550
|
+
/* @__PURE__ */ p(be, { ref: F, position: [0, -0.95, 0], text: n.name, color: e.color, size: 0.2, opacity: 0.55, pxRange: [7.5, 11.5] })
|
|
551
|
+
] })
|
|
552
|
+
] });
|
|
553
|
+
}
|
|
554
|
+
function ao({ mcp: t }) {
|
|
555
|
+
const r = t.srv, e = V(() => new o.Color(r.color), [r.color]), n = V(
|
|
556
|
+
() => ({ fill: se(e), line: new o.LineBasicMaterial({ color: e, transparent: !0, blending: o.AdditiveBlending, depthWrite: !1, toneMapped: !1 }), halo: le(e), core: se("#fff") }),
|
|
557
|
+
[e]
|
|
558
|
+
), s = z(null), a = z(null), i = z(null);
|
|
559
|
+
return re(({ clock: l }) => {
|
|
560
|
+
var F, C;
|
|
561
|
+
(F = s.current) == null || F.position.copy(t.pos);
|
|
562
|
+
const h = performance.now(), m = r.inflight > 0, M = De(r.activeAt, h, 1.5), S = (m ? 0.75 : 0.3) + M * 0.45;
|
|
563
|
+
n.fill.color.copy(e).multiplyScalar(S * 0.45), n.line.color.copy(e).multiplyScalar(S * 2.2), n.core.color.setScalar(m ? 0.6 : 0.15), n.halo.color.copy(e).multiplyScalar(m ? 0.28 : 0.08 + M * 0.15), (C = i.current) == null || C.scale.setScalar(4 + (m ? 0.6 : 0)), a.current && (a.current.rotation.y = l.elapsedTime * (m ? 0.7 : 0.12));
|
|
564
|
+
}), /* @__PURE__ */ Y("group", { ref: s, children: [
|
|
565
|
+
/* @__PURE__ */ p("sprite", { ref: i, material: n.halo }),
|
|
566
|
+
/* @__PURE__ */ Y("group", { ref: a, children: [
|
|
567
|
+
/* @__PURE__ */ p("mesh", { geometry: et, material: n.fill }),
|
|
568
|
+
/* @__PURE__ */ p("lineSegments", { geometry: oo, material: n.line }),
|
|
569
|
+
/* @__PURE__ */ p("mesh", { geometry: Ge, material: n.core, scale: 0.18 })
|
|
570
|
+
] }),
|
|
571
|
+
/* @__PURE__ */ p(be, { position: [0, 1.35, 0], text: `MCP · ${r.name}`, color: r.color, size: 0.28, pxRange: [9, 13] })
|
|
572
|
+
] });
|
|
573
|
+
}
|
|
574
|
+
function so({ call: t }) {
|
|
575
|
+
const r = L.mcpServers.get(t.server), e = V(() => new o.Color((r == null ? void 0 : r.color) ?? "#fff"), [r]), n = V(() => le(e.clone().multiplyScalar(1.8).addScalar(0.3)), [e]), s = z(null), a = V(() => ({ a: new o.Vector3(), b: new o.Vector3(), c: new o.Vector3(), h: new o.Vector3() }), []);
|
|
576
|
+
return re(() => {
|
|
577
|
+
const i = ge(t.instance), l = Ye(t.server);
|
|
578
|
+
if (!s.current) return;
|
|
579
|
+
if (!i || !r || !l) {
|
|
580
|
+
s.current.visible = !1;
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
a.a.copy(i), a.b.copy(l), Oe(a.a, a.b, 1, a.c);
|
|
584
|
+
const h = oe((performance.now() - t.start) / (t.phase === "call" ? t.dur : t.dur * 0.75)), m = Me(h);
|
|
585
|
+
ne(a.a, a.c, a.b, t.phase === "call" ? m : 1 - m, a.h), s.current.visible = h < 1, s.current.position.copy(a.h), s.current.scale.setScalar(1);
|
|
586
|
+
}), /* @__PURE__ */ p("sprite", { ref: s, material: n, visible: !1 });
|
|
587
|
+
}
|
|
588
|
+
const Pe = 24, he = 40, ye = 3;
|
|
589
|
+
function io() {
|
|
590
|
+
const t = V(() => {
|
|
591
|
+
const s = new o.BufferGeometry();
|
|
592
|
+
return s.setAttribute("position", new o.BufferAttribute(new Float32Array(Pe * ye * he * 2 * 3), 3)), s.setAttribute("color", new o.BufferAttribute(new Float32Array(Pe * ye * he * 2 * 3), 3)), s.boundingSphere = new o.Sphere(new o.Vector3(), 1e4), s;
|
|
593
|
+
}, []), r = V(() => new o.LineBasicMaterial({ vertexColors: !0, transparent: !0, blending: o.AdditiveBlending, depthWrite: !1, toneMapped: !1 }), []), e = V(() => new ze(Pe), []), n = V(() => ({ a: new o.Vector3(), b: new o.Vector3(), c: new o.Vector3(), p: new o.Vector3(), col: new o.Color(), k: new o.Color() }), []);
|
|
594
|
+
return re(({ clock: s }) => {
|
|
595
|
+
const a = performance.now(), i = fe ? 0 : s.elapsedTime, l = t.getAttribute("position"), h = t.getAttribute("color");
|
|
596
|
+
let m = 0;
|
|
597
|
+
e.begin();
|
|
598
|
+
const M = (S, F, C, g) => {
|
|
599
|
+
if (m >= Pe) return;
|
|
600
|
+
const c = ge(S), A = L.mcpServers.get(F), w = Ye(F);
|
|
601
|
+
if (!c || !A || !w) return;
|
|
602
|
+
const { a: B, b: x, c: _, p: k, col: G, k: f } = n;
|
|
603
|
+
B.copy(c), x.copy(w), Oe(B, x, 1, _), G.set(A.color);
|
|
604
|
+
let T;
|
|
605
|
+
C === 0 ? (G.lerp(eo, oe(g / 1.2)), g > 1.2 && G.lerp(to, oe((g - 1.2) / 1)), T = (0.22 + Math.min(0.6, g * 0.25)) * ke(g / 0.3)) : (f.copy(G).lerp(Je, 0.35), T = 1.3 * (g < 0.75 ? 1 : 1 - (g - 0.75) / 0.25));
|
|
606
|
+
const K = 1 - Me(g / 0.75), I = C === 0 ? 0.025 : 0.07;
|
|
607
|
+
for (let P = 0; P < ye; P++) {
|
|
608
|
+
const U = (P - 1) * I;
|
|
609
|
+
for (let N = 0; N < he; N++)
|
|
610
|
+
for (let y = 0; y < 2; y++) {
|
|
611
|
+
const $ = (N + y) / he;
|
|
612
|
+
ne(B, _, x, $, k);
|
|
613
|
+
const X = ((m * ye + P) * he + N) * 2 + y;
|
|
614
|
+
l.setXYZ(X, k.x + U, k.y - U, k.z + U * 0.5);
|
|
615
|
+
let d;
|
|
616
|
+
if (C === 0) {
|
|
617
|
+
const O = Math.pow(Math.max(0, Math.sin($ * 20 - i * 2.2)), 8);
|
|
618
|
+
d = T * (0.3 + O * 1.5) * (P === 1 ? 1 : 0.25);
|
|
619
|
+
} else
|
|
620
|
+
d = T * (0.3 + Math.exp(-((($ - K) / 0.07) ** 2)) * 3.2 * (g < 0.8 ? 1 : 0)) * (P === 1 ? 1 : 0.65);
|
|
621
|
+
const b = C === 0 ? G : f;
|
|
622
|
+
h.setXYZ(X, b.r * d, b.g * d, b.b * d);
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
C === 0 ? e.add(B, _, x, 0.92, 1, 0.48, G, 0.4 + T * 1.4) : e.add(B, _, x, 0.08, -1, 0.66, f, T * 1.6), m++;
|
|
626
|
+
};
|
|
627
|
+
for (const S of L.mcpPending.values()) M(S.instance, S.server, 0, Pt(S, a));
|
|
628
|
+
for (const S of L.mcpCalls) S.phase === "result" && M(S.instance, S.server, 1, oe((a - S.start) / S.dur));
|
|
629
|
+
t.setDrawRange(0, m * ye * he * 2), l.needsUpdate = !0, h.needsUpdate = !0, e.end();
|
|
630
|
+
}), /* @__PURE__ */ Y(de, { children: [
|
|
631
|
+
/* @__PURE__ */ p("lineSegments", { geometry: t, material: r, frustumCulled: !1 }),
|
|
632
|
+
/* @__PURE__ */ p("primitive", { object: e.mesh })
|
|
633
|
+
] });
|
|
634
|
+
}
|
|
635
|
+
function co() {
|
|
636
|
+
const [t, r] = $e([]), e = z({ n: -1, first: -1, last: -1 });
|
|
637
|
+
return re(() => {
|
|
638
|
+
const n = e.current, s = L.mcpCalls, a = s.length ? s[0].id : -1, i = s.length ? s[s.length - 1].id : -1;
|
|
639
|
+
(s.length !== n.n || a !== n.first || i !== n.last) && (n.n = s.length, n.first = a, n.last = i, r(s.slice()));
|
|
640
|
+
}), /* @__PURE__ */ Y(de, { children: [
|
|
641
|
+
t.map((n) => /* @__PURE__ */ p(so, { call: n }, n.id)),
|
|
642
|
+
/* @__PURE__ */ p(io, {})
|
|
643
|
+
] });
|
|
644
|
+
}
|
|
645
|
+
function vo() {
|
|
646
|
+
return /* @__PURE__ */ Y(
|
|
647
|
+
Vt,
|
|
648
|
+
{
|
|
649
|
+
title: "neural · living brain",
|
|
650
|
+
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",
|
|
651
|
+
preset: "radial",
|
|
652
|
+
plane: "xy",
|
|
653
|
+
camera: { position: [0, -0.2, 31], fov: 47 },
|
|
654
|
+
bg: "#030208",
|
|
655
|
+
fit: { nRef: 4, min: 0.62, max: 1.6, minRadius: 5.5 },
|
|
656
|
+
agentRadius: 1.25,
|
|
657
|
+
graph: { natural: te * 1.08, radius: 2.1 },
|
|
658
|
+
Background: /* @__PURE__ */ p(at, { radius: 80, depth: 40, count: fe ? 1200 : 3500, factor: 2.6, saturation: 0.6, fade: !0, speed: 0.4 }),
|
|
659
|
+
Agent: Wt,
|
|
660
|
+
RunMarker: Qt,
|
|
661
|
+
McpServer: ao,
|
|
662
|
+
Backend: ro,
|
|
663
|
+
GraphResource: Zt,
|
|
664
|
+
cluster: { radius: 1.45, variant: "orb" },
|
|
665
|
+
PostFX: /* @__PURE__ */ Y(st, { multisampling: 0, children: [
|
|
666
|
+
/* @__PURE__ */ p(it, { mipmapBlur: !0, intensity: 1.1, luminanceThreshold: 0.2, luminanceSmoothing: 0.3, radius: 0.75 }),
|
|
667
|
+
/* @__PURE__ */ p(ct, { eskil: !1, offset: 0.22, darkness: 0.9 })
|
|
668
|
+
] }),
|
|
669
|
+
children: [
|
|
670
|
+
/* @__PURE__ */ p(Ht, {}),
|
|
671
|
+
/* @__PURE__ */ p(co, {})
|
|
672
|
+
]
|
|
673
|
+
}
|
|
674
|
+
);
|
|
675
|
+
}
|
|
676
|
+
export {
|
|
677
|
+
vo as default
|
|
678
|
+
};
|