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