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.
Files changed (41) hide show
  1. package/README.md +38 -3
  2. package/dist/chunks/KitScene-BuFtYuhc.js +2737 -0
  3. package/dist/chunks/index-BPyTLdiF.js +792 -0
  4. package/dist/chunks/index-Bo5HRf-O.js +784 -0
  5. package/dist/chunks/index-C42Ihyo1.js +605 -0
  6. package/dist/chunks/index-C5YqtHnC.js +677 -0
  7. package/dist/chunks/index-Cyv7bII1.js +818 -0
  8. package/dist/chunks/index-D0UvupqM.js +1143 -0
  9. package/dist/chunks/index-D733n3Hf.js +1086 -0
  10. package/dist/chunks/index-DCmhxN8v.js +1010 -0
  11. package/dist/chunks/index-DO9SAG-u.js +753 -0
  12. package/dist/chunks/index-Dn6oRasS.js +887 -0
  13. package/dist/chunks/index-HyfZ0ePz.js +838 -0
  14. package/dist/chunks/index-XMOz-HBf.js +492 -0
  15. package/dist/chunks/index-ZT88hgW-.js +763 -0
  16. package/dist/chunks/index-e6egU2Q6.js +889 -0
  17. package/dist/chunks/index-jLXx_Wgk.js +68 -0
  18. package/dist/chunks/index-tonipLb2.js +980 -0
  19. package/dist/index.js +1 -1
  20. package/dist/style.css +1 -1
  21. package/dist/types/AgentScene.d.ts +14 -1
  22. package/dist/types/world.d.ts +59 -0
  23. package/package.json +1 -1
  24. package/dist/chunks/ClusterBall-CPsd6JvJ.js +0 -1489
  25. package/dist/chunks/index-0Bqa57T_.js +0 -786
  26. package/dist/chunks/index-4JCQqMml.js +0 -831
  27. package/dist/chunks/index-55W5crSg.js +0 -63
  28. package/dist/chunks/index-78lWZCrQ.js +0 -984
  29. package/dist/chunks/index-Bv6_kdaq.js +0 -768
  30. package/dist/chunks/index-Cgb5ir1r.js +0 -688
  31. package/dist/chunks/index-CqVCWpP7.js +0 -796
  32. package/dist/chunks/index-D1O5v601.js +0 -1065
  33. package/dist/chunks/index-DOoA9htC.js +0 -1181
  34. package/dist/chunks/index-K__sPGRy.js +0 -1134
  35. package/dist/chunks/index-N0zWN8NS.js +0 -857
  36. package/dist/chunks/index-NiYqQci9.js +0 -936
  37. package/dist/chunks/index-PQRnbPiJ.js +0 -565
  38. package/dist/chunks/index-VOXn1m-Q.js +0 -848
  39. package/dist/chunks/index-o4vs5msj.js +0 -837
  40. package/dist/chunks/index-yos7IepY.js +0 -890
  41. package/dist/chunks/spread-CWdeDFd9.js +0 -35
@@ -0,0 +1,887 @@
1
+ import { jsxs as v, jsx as o, Fragment as ht } from "react/jsx-runtime";
2
+ import { MeshReflectorMaterial as mt, Grid as gt, Trail as rt, Stars as yt } from "@react-three/drei";
3
+ import { useFrame as ie, useThree as Mt } from "@react-three/fiber";
4
+ import { EffectComposer as vt, Bloom as wt, Vignette as xt, Noise as bt } from "@react-three/postprocessing";
5
+ import * as n from "three";
6
+ import { useRef as x, useMemo as i, useEffect as ze, useState as St } from "react";
7
+ import { k as te, y as At, f as Me, z as Gt, w as J, a as Ct, i as Bt, h as Ke, c as Et, K as Pt, m as zt, T as xe, L as Ye, G as Lt, n as Rt, q as _e, S as we, x as Ae, R as Ft, r as ue, d as Tt, b as Ue, g as kt, l as Vt, e as st, p as It, j as _t, A as Wt } from "./KitScene-BuFtYuhc.js";
8
+ const Ot = (
9
+ /* glsl */
10
+ `
11
+ varying vec3 vLocal;
12
+ varying vec3 vN;
13
+ varying float vFogDepth;
14
+ void main() {
15
+ vec4 p = vec4(position, 1.0);
16
+ vec3 n = normal;
17
+ #ifdef USE_INSTANCING
18
+ p = instanceMatrix * p;
19
+ n = mat3(instanceMatrix) * n;
20
+ #endif
21
+ vLocal = p.xyz;
22
+ vN = normalize(n);
23
+ vec4 mv = modelViewMatrix * p;
24
+ vFogDepth = -mv.z;
25
+ gl_Position = projectionMatrix * mv;
26
+ }`
27
+ ), Dt = (
28
+ /* glsl */
29
+ `
30
+ uniform vec3 uColor; // window colour (agent type)
31
+ uniform vec3 uEdge; // neon edge colour (run)
32
+ uniform float uEdgeAmt;
33
+ uniform vec2 uHalf; // half width / depth (object space)
34
+ uniform float uH; // height
35
+ uniform float uTime;
36
+ uniform float uLit; // fraction of windows lit
37
+ uniform float uWork; // 0..1 thinking: scroll band + flicker
38
+ uniform float uEnergy; // LLM pulse
39
+ uniform float uCascade; // 0..1 lights go out from the top
40
+ uniform float uScaffold; // 0..1 birth: glowing grid lines
41
+ uniform float uFiller; // 1 = background skyline (per-window palette, no edges)
42
+ uniform float uOpacity;
43
+ uniform vec3 uFogColor;
44
+ uniform float uFogNear;
45
+ uniform float uFogFar;
46
+ varying vec3 vLocal;
47
+ varying vec3 vN;
48
+ varying float vFogDepth;
49
+
50
+ float hash(vec2 p) { return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }
51
+
52
+ void main() {
53
+ vec3 body = vec3(0.012, 0.016, 0.03);
54
+ vec3 col = body;
55
+ bool roof = vN.y > 0.5;
56
+ float side = abs(vN.x) > 0.5 ? vLocal.z : vLocal.x;
57
+ float faceId = abs(vN.x) > 0.5 ? sign(vN.x) * 3.0 : sign(vN.z) * 7.0;
58
+ vec2 cell = vec2(0.34, 0.46);
59
+ vec2 g = vec2(side, vLocal.y) / cell;
60
+ vec2 id = floor(g) + vec2(faceId * 13.0, 0.0);
61
+ vec2 f = fract(g);
62
+ float win = step(0.2, f.x) * step(f.x, 0.8) * step(0.22, f.y) * step(f.y, 0.74);
63
+ float r = hash(id);
64
+ float tick = floor(uTime * 7.0);
65
+ // flicker while working: a few windows toggle each tick
66
+ float flick = step(hash(id + tick * 0.37), 0.12) * uWork;
67
+ float lit = step(r, uLit);
68
+ lit = abs(lit - flick);
69
+ // scrolling band of light moving up the facade while thinking
70
+ float band = smoothstep(0.82, 1.0, 1.0 - abs(fract(vLocal.y / max(uH, 0.001) * 1.4 - uTime * 0.55) - 0.5) * 2.0) * uWork;
71
+ // lights-out cascade from the top
72
+ float alive = step(vLocal.y, uH * (1.0 - uCascade) + 0.001);
73
+ vec3 wc = uColor;
74
+ if (uFiller > 0.5) {
75
+ wc = mix(vec3(1.0, 0.62, 0.32), vec3(0.45, 0.8, 1.0), step(0.55, hash(id * 1.7 + 3.1)));
76
+ wc = mix(wc, vec3(0.95, 0.4, 0.9), step(0.93, hash(id * 2.3)));
77
+ }
78
+ float bright = (0.55 + 0.9 * r) * (1.0 + uEnergy * 1.6);
79
+ if (!roof && vLocal.y > 0.25) {
80
+ col += win * alive * (lit * bright + band * 2.2) * wc * (uFiller > 0.5 ? 0.6 : 1.6);
81
+ // energy flash: whole facade glows briefly
82
+ col += win * alive * uEnergy * 0.35 * mix(wc, vec3(1.0), 0.4);
83
+ }
84
+ // neon corner edges + rim at the roof line
85
+ vec2 a = abs(vLocal.xz);
86
+ float corner = step(uHalf.x - 0.06, a.x) * step(uHalf.y - 0.06, a.y);
87
+ float rim = roof ? step(uHalf.x - 0.08, a.x) + step(uHalf.y - 0.08, a.y) : 0.0;
88
+ col += uEdge * uEdgeAmt * (corner * 1.6 + min(rim, 1.0) * 1.2) * (0.6 + 0.4 * alive);
89
+ // birth scaffold: glowing floor lines + vertical ribs
90
+ float lines = max(step(0.9, fract(vLocal.y / 0.46)), step(0.88, fract(side / 0.34)));
91
+ col += uScaffold * lines * uColor * 3.0;
92
+ col = mix(col, uColor * 0.25, uScaffold * 0.35);
93
+ float fogF = smoothstep(uFogNear, uFogFar, vFogDepth);
94
+ col = mix(col, uFogColor, fogF);
95
+ gl_FragColor = vec4(col, uOpacity);
96
+ }`
97
+ ), be = { color: new n.Color("#05040d"), near: 34, far: 110 }, Te = { near: { value: be.near }, far: { value: be.far } };
98
+ function at(t = {}) {
99
+ return new n.ShaderMaterial({
100
+ vertexShader: Ot,
101
+ fragmentShader: Dt,
102
+ toneMapped: !1,
103
+ transparent: !1,
104
+ uniforms: {
105
+ uColor: { value: new n.Color(t.color ?? "#ffffff") },
106
+ uEdge: { value: new n.Color(t.edge ?? "#818cf8") },
107
+ uEdgeAmt: { value: t.filler ? 0 : 1 },
108
+ uHalf: { value: new n.Vector2(1, 1) },
109
+ uH: { value: 1 },
110
+ uTime: { value: 0 },
111
+ uLit: { value: t.filler ? 0.32 : 0.5 },
112
+ uWork: { value: 0 },
113
+ uEnergy: { value: 0 },
114
+ uCascade: { value: 0 },
115
+ uScaffold: { value: 0 },
116
+ uFiller: { value: t.filler ? 1 : 0 },
117
+ uOpacity: { value: 1 },
118
+ uFogColor: { value: be.color },
119
+ uFogNear: Te.near,
120
+ uFogFar: Te.far
121
+ }
122
+ });
123
+ }
124
+ function Ut(t) {
125
+ return () => (t = t * 16807 % 2147483647, (t - 1) / 2147483646);
126
+ }
127
+ const Le = 1.1, ct = () => Math.hypot(te.core.hw, te.core.hh) + 2.4;
128
+ function $t() {
129
+ const t = x(null), e = 16;
130
+ return ie(() => {
131
+ const s = t.current;
132
+ s && s.scale.setScalar(ct() / e);
133
+ }), /* @__PURE__ */ v("group", { children: [
134
+ /* @__PURE__ */ v("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, 0, 0], children: [
135
+ /* @__PURE__ */ o("planeGeometry", { args: [320, 320] }),
136
+ /* @__PURE__ */ o(
137
+ mt,
138
+ {
139
+ resolution: 512,
140
+ blur: [400, 120],
141
+ mixBlur: 1,
142
+ mixStrength: 3.2,
143
+ mixContrast: 1.1,
144
+ roughness: 0.85,
145
+ depthScale: 0.6,
146
+ minDepthThreshold: 0.3,
147
+ maxDepthThreshold: 1.4,
148
+ color: "#05060c",
149
+ metalness: 0.7,
150
+ mirror: 0.7
151
+ }
152
+ )
153
+ ] }),
154
+ /* @__PURE__ */ o(
155
+ gt,
156
+ {
157
+ position: [0, 0.012, 0],
158
+ args: [300, 300],
159
+ cellSize: 1.5,
160
+ cellThickness: 0.5,
161
+ cellColor: "#141a36",
162
+ sectionSize: 6,
163
+ sectionThickness: 0.9,
164
+ sectionColor: "#2b2366",
165
+ fadeDistance: 120,
166
+ fadeStrength: 2,
167
+ infiniteGrid: !0
168
+ }
169
+ ),
170
+ /* @__PURE__ */ v("group", { ref: t, children: [
171
+ /* @__PURE__ */ v("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, 0.015, 0], children: [
172
+ /* @__PURE__ */ o("ringGeometry", { args: [e - Le, e + Le, 160] }),
173
+ /* @__PURE__ */ o("meshBasicMaterial", { color: "#020308", transparent: !0, opacity: 0.8, depthWrite: !1 })
174
+ ] }),
175
+ [-Le, Le].map((s) => /* @__PURE__ */ v("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, 0.02, 0], children: [
176
+ /* @__PURE__ */ o("ringGeometry", { args: [e + s - 0.03, e + s + 0.03, 160] }),
177
+ /* @__PURE__ */ o("meshBasicMaterial", { color: new n.Color("#3b2f8f").multiplyScalar(1.4), toneMapped: !1 })
178
+ ] }, s))
179
+ ] })
180
+ ] });
181
+ }
182
+ const Je = 0.33, Qe = 0.94, Ge = new n.Object3D();
183
+ function Nt() {
184
+ const t = x(null), e = i(() => {
185
+ const a = at({ filler: !0 });
186
+ return a.uniforms.uH.value = 999, a.uniforms.uLit.value = 0.2, a;
187
+ }, []), s = i(() => new n.BoxGeometry(1, 1, 1).translate(0, 0.5, 0), []), r = i(() => {
188
+ const a = Ut(42), w = [];
189
+ for (let u = -96; u <= 96; u += 4.6)
190
+ for (let g = -96; g <= 60; g += 4.6) {
191
+ const p = u + (a() - 0.5) * 1.6, S = g + (a() - 0.5) * 1.6;
192
+ a() < 0.3 || w.push({ x: p, z: S, w: 1.6 + a() * 1.8, d: 1.6 + a() * 1.8, h: 0, ry: a() * 0.6 - 0.3, tall: Math.pow(a(), 2.2), spike: a() < 0.06 ? 10 : 0 });
193
+ }
194
+ return w;
195
+ }, []), l = i(() => new Float32Array(r.length), [r]), c = i(() => new Float32Array(r.length), [r]), f = x({ hw: -1, hh: -1, sig: -1, last: -1e9, moving: !0 });
196
+ return ie((a, w) => {
197
+ const u = t.current;
198
+ if (!u) return;
199
+ const g = te.core, p = f.current, S = performance.now();
200
+ let O = te.graphWanted ? te.graph.target.x * 7 + te.graph.target.z * 3 + 1 : 0;
201
+ for (const y of te.mcp.values()) O += y.target.x * 0.37 + y.target.z * 0.11;
202
+ if ((Math.abs(g.hw - p.hw) > 0.6 || Math.abs(g.hh - p.hh) > 0.6 || Math.abs(O - p.sig) > 0.5) && S - p.last > 300) {
203
+ p.hw = g.hw, p.hh = g.hh, p.sig = O, p.last = S, p.moving = !0;
204
+ const y = g.hw + 2.5, d = g.hh + 2.5, A = ct(), G = te.graph, I = te.graphWanted ? G.radius + 2.6 : 0;
205
+ for (let D = 0; D < r.length; D++) {
206
+ const F = r[D], _ = Math.max(0, Math.abs(F.x) - y), Y = Math.max(0, Math.abs(F.z) - d), ne = Math.hypot(_, Y);
207
+ let W = 0;
208
+ const re = F.x * Je + F.z * Qe - (y * Je + d * Qe), oe = re > -1;
209
+ if (ne > 3 && Math.hypot(F.x, F.z) > A + 2.2 && !(oe && re < 24)) {
210
+ const E = Math.min(1, ne / 40);
211
+ W = 1 + F.tall * (3 + E * 18) + F.spike * E, oe && (W = Math.min(W, 1.4));
212
+ }
213
+ I && Math.hypot(F.x - G.target.x, F.z - G.target.z) < I && (W = 0);
214
+ for (const E of te.mcp.values()) Math.hypot(F.x - E.target.x, F.z - E.target.z) < 3.4 && (W = 0);
215
+ c[D] = W;
216
+ }
217
+ }
218
+ if (!p.moving) return;
219
+ const H = 1 - Math.exp(-Math.min(0.1, w) / 0.35);
220
+ let B = !1;
221
+ for (let y = 0; y < r.length; y++) {
222
+ const d = r[y], A = c[y] - l[y];
223
+ Math.abs(A) > 0.01 ? (l[y] += A * H, B = !0) : l[y] = c[y], Ge.position.set(d.x, 0, d.z), Ge.rotation.set(0, d.ry, 0), Ge.scale.set(l[y] > 0.02 ? d.w : 1e-4, Math.max(1e-4, l[y]), l[y] > 0.02 ? d.d : 1e-4), Ge.updateMatrix(), u.setMatrixAt(y, Ge.matrix);
224
+ }
225
+ u.instanceMatrix.needsUpdate = !0, p.moving = B;
226
+ }), ze(() => () => (s.dispose(), e.dispose()), [s, e]), /* @__PURE__ */ o("instancedMesh", { ref: t, args: [s, e, r.length], frustumCulled: !1 });
227
+ }
228
+ const pe = 2.5, Xt = 1.4, et = 4.2, tt = 2.4, Ht = {
229
+ name: "city-grid",
230
+ local: { topGap: 3.4, fanLen: 3, subGap: 2.4, fan: "spread", stackGap: 2, pad: 1.3 },
231
+ run(t, e, s) {
232
+ const r = et * Me.spread, l = e.n, c = 2 * e.hu + tt, f = 2 * e.hv + tt + r, a = Gt(l, c, f, e.aspect), w = Math.ceil(l / a), u = t % a, g = Math.floor(t / a), p = Math.min(a, l - g * a);
233
+ s.a = (u - (p - 1) / 2) * c, s.b = ((w - 1) / 2 - g) * f + r / 2, s.angle = -Math.PI / 2;
234
+ },
235
+ cluster(t, e, s, r, l) {
236
+ At(e, s, r, -(r.hh + et * Me.spread + 6), l);
237
+ },
238
+ periphery: "sides"
239
+ };
240
+ function qt(t, e) {
241
+ const s = t.type, r = t.id;
242
+ if (!t.subagent && !Bt(s)) {
243
+ const [l, c] = s === "planner" ? [1.7, 6] : s === "researcher" ? [2.1, 8.6] : [1.9, 7];
244
+ return { w: l, d: l, h: c * (0.9 + 0.2 * Ke(r, 33)) * (e ? 0.85 : 1) };
245
+ }
246
+ return { w: 0.95, d: 0.95, h: 2.6 + Ke(r, 37) * 1.4 };
247
+ }
248
+ const ke = /* @__PURE__ */ new Map();
249
+ function fe(t, e) {
250
+ const s = Ct(t);
251
+ if (s)
252
+ return e.set(s.x, ke.get(t) ?? 0.3, s.z);
253
+ }
254
+ const Yt = 6.2, it = 0.72;
255
+ function je(t) {
256
+ const e = J.mcpServers.get(t);
257
+ return Yt + ((e == null ? void 0 : e.slot) ?? 0) % 2 * 1.3;
258
+ }
259
+ function $e(t, e) {
260
+ const s = Et(t);
261
+ if (s)
262
+ return e.set(s.x, je(t) - 0.8, s.z);
263
+ }
264
+ const Ne = { queued: "#3b4256", running: "#fbbf24", done: "#22c55e", failed: "#ef4444" }, X = (t) => t < 0 ? 0 : t > 1 ? 1 : t, Se = (t) => 1 - Math.pow(1 - t, 3), ve = (t) => t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2, lt = pe + 1.3, ut = 200, Pe = 34, Xe = 1.2, He = 1.1, jt = 2600, me = 12, Re = 4, qe = pe + 0.06;
265
+ function Zt(t) {
266
+ const e = [];
267
+ for (let s = 0; s < t; s++) {
268
+ const r = Math.floor(s / Pe), c = (s * 7 % Pe + r % 2 * 0.5) / Pe * Math.PI * 2, f = He + r * Xe;
269
+ e.push({ p: new n.Vector3(Math.sin(c) * qe, f, Math.cos(c) * qe), th: c, y: f });
270
+ }
271
+ return { list: e, height: He + Math.ceil(t / Pe) * Xe };
272
+ }
273
+ const Kt = (t) => He + Math.ceil(Math.min(ut, t) / Pe) * Xe + 4.4;
274
+ function Jt({ galaxy: t }) {
275
+ const e = Math.min(ut, t.nodes.length), s = i(() => t.nodes.slice(0, e), [t, e]), { list: r, height: l } = i(() => Zt(e), [e]), c = i(() => s.map((m) => new n.Color(Pt[m.kind] ?? "#94a3b8")), [s]), f = i(() => {
276
+ const m = new Map(s.map((T, z) => [T.id, z])), C = [], j = /* @__PURE__ */ new Set();
277
+ for (const T of t.links) {
278
+ const z = m.get(T.source), L = m.get(T.target);
279
+ if (z === void 0 || L === void 0 || z === L) continue;
280
+ const R = z < L ? `${z}-${L}` : `${L}-${z}`;
281
+ j.has(R) || (j.add(R), C.push([z, L]));
282
+ }
283
+ return C;
284
+ }, [t, s]), a = i(() => {
285
+ const m = new Float32Array(f.length * me * 6), C = (T, z, L, R) => {
286
+ let q = z.th - T.th;
287
+ q > Math.PI && (q -= Math.PI * 2), q < -Math.PI && (q += Math.PI * 2);
288
+ const Q = T.th + q * L, ae = qe + 0.02 + Math.sin(L * Math.PI) * 0.22;
289
+ m[R] = Math.sin(Q) * ae, m[R + 1] = T.y + (z.y - T.y) * L, m[R + 2] = Math.cos(Q) * ae;
290
+ };
291
+ f.forEach(([T, z], L) => {
292
+ for (let R = 0; R < me; R++) {
293
+ const q = (L * me + R) * 6;
294
+ C(r[T], r[z], R / me, q), C(r[T], r[z], (R + 1) / me, q + 3);
295
+ }
296
+ });
297
+ const j = new n.BufferGeometry();
298
+ return j.setAttribute("position", new n.BufferAttribute(m, 3)), j.setAttribute("color", new n.BufferAttribute(new Float32Array(m.length), 3)), j;
299
+ }, [f, r]);
300
+ ze(() => () => a.dispose(), [a]);
301
+ const w = x(null), u = x(null), g = x(null), p = x(null), S = x(null), O = x([]), P = x([]), H = x(Array.from({ length: Re }, () => ({ node: "", key: "" }))), B = i(() => new Float32Array(e), [e]), y = i(() => new Float32Array(e), [e]), d = i(() => /* @__PURE__ */ new Map(), []), A = i(() => new n.Object3D(), []), G = i(() => new n.Color(), []), I = i(() => new n.Color("#5b4fd6"), []), D = i(() => new n.Color(1, 1, 1), []), F = i(() => new n.Vector3(), []), _ = i(() => new n.Vector3(), []), Y = i(() => new n.Vector3(), []), ne = i(() => new n.Vector3(0, 1, 0), []), W = i(() => new n.Vector3(), []), re = i(() => new n.Vector3(), []), oe = x(!0), E = 72, k = 40, Z = (m) => {
302
+ let C = d.get(m);
303
+ return C === void 0 && d.set(m, C = Rt(t, m) % e), C;
304
+ }, se = (m, C, j, T, z, L) => {
305
+ Y.subVectors(T, j);
306
+ const R = Y.length();
307
+ return R < 1e-3 ? !1 : (A.position.copy(j).addScaledVector(Y, 0.5), A.quaternion.setFromUnitVectors(ne, Y.multiplyScalar(1 / R)), A.scale.set(z, R, z), A.updateMatrix(), m.setMatrixAt(C, A.matrix), m.setColorAt(C, L), !0);
308
+ };
309
+ ie(({ clock: m }) => {
310
+ const C = performance.now(), j = m.elapsedTime;
311
+ B.fill(0), y.fill(0);
312
+ const T = u.current, z = g.current;
313
+ let L = 0, R = 0;
314
+ for (const h of J.flares) {
315
+ const M = Z(h.node), V = X((C - h.start) / jt), K = Math.pow(1 - V, 1.4);
316
+ h.op === "write" ? y[M] = Math.max(y[M], K) : B[M] = Math.max(B[M], K);
317
+ const ee = J.instances.get(h.instance), ce = !!fe(h.instance, W);
318
+ ce && zt(W, re);
319
+ const le = r[M].p;
320
+ if (!(!T || !z)) {
321
+ if (ce && L < E) {
322
+ const de = Se(X((C - h.start) / 250));
323
+ F.copy(re), _.copy(re).lerp(le, de), G.set(ee ? xe[ee.type] : "#c7d2fe"), h.op === "write" && G.lerp(D, 0.6), G.multiplyScalar((h.op === "write" ? 3.2 : 2.2) * K), se(T, L, F, _, h.op === "write" ? 0.06 : 0.04, G) && L++;
324
+ const he = X((C - h.start - 200) / 700);
325
+ if (he > 0 && he < 1 && R < k) {
326
+ const ye = Se(he);
327
+ h.op === "read" ? F.copy(le).lerp(re, ye) : F.copy(re).lerp(le, ye), A.position.copy(F), A.quaternion.identity(), A.scale.setScalar(1), A.updateMatrix(), z.setMatrixAt(R, A.matrix), G.set(ee ? xe[ee.type] : "#ffffff").lerp(D, 0.5).multiplyScalar(4), z.setColorAt(R, G), R++;
328
+ }
329
+ }
330
+ if (h.op === "write" && L < E) {
331
+ const de = Se(X((C - h.start) / 450));
332
+ _.copy(le), _.y += 3 + 40 * de, G.setRGB(1.6, 1.7, 2.2).multiplyScalar(K * 1.6), se(T, L, le, _, 0.13, G) && L++;
333
+ }
334
+ }
335
+ }
336
+ T && (T.count = L, T.instanceMatrix.needsUpdate = !0, T.instanceColor && (T.instanceColor.needsUpdate = !0)), z && (z.count = R, z.instanceMatrix.needsUpdate = !0, z.instanceColor && (z.instanceColor.needsUpdate = !0));
337
+ const q = w.current;
338
+ if (q) {
339
+ for (let h = 0; h < e; h++) {
340
+ const M = B[h], V = y[h];
341
+ G.copy(c[h]).multiplyScalar(0.9 + M * 5 + V * 3), V > 0 ? G.lerp(D, Math.min(1, V * 1.3)).multiplyScalar(1 + V * 4) : M > 0 && G.lerp(D, M * 0.25), q.setColorAt(h, G);
342
+ const K = 1 + M * 1.2 + V * 2;
343
+ A.position.copy(r[h].p), A.rotation.set(0, r[h].th, 0), A.scale.set(K, K, 1), A.updateMatrix(), q.setMatrixAt(h, A.matrix);
344
+ }
345
+ q.instanceMatrix.needsUpdate = !0, q.instanceColor && (q.instanceColor.needsUpdate = !0);
346
+ }
347
+ const Q = J.flares.length > 0;
348
+ if (Q || oe.current) {
349
+ const h = a.getAttribute("color"), M = h.array;
350
+ for (let V = 0; V < f.length; V++) {
351
+ const [K, ee] = f[V], ce = Math.max(B[K], y[K]), le = Math.max(B[ee], y[ee]), de = ce > 0 || le > 0;
352
+ for (let he = 0; he < me; he++)
353
+ for (let ye = 0; ye < 2; ye++) {
354
+ const Ze = (he + ye) / me, Ve = de ? ce * (1 - Ze) + le * Ze : 0, Ie = (V * me + he) * 6 + ye * 3;
355
+ M[Ie] = I.r * 0.55 + Ve * 2.2, M[Ie + 1] = I.g * 0.55 + Ve * 2, M[Ie + 2] = I.b * 0.55 + Ve * 2.6;
356
+ }
357
+ }
358
+ h.needsUpdate = !0, oe.current = Q;
359
+ }
360
+ const ae = H.current;
361
+ let b = 0;
362
+ for (let h = J.flares.length - 1; h >= 0 && b < Re; h--) {
363
+ const M = J.flares[h];
364
+ if (C - M.start > 1600) break;
365
+ let V = !1;
366
+ for (let ce = 0; ce < b; ce++) ae[ce].node === M.node && (V = !0);
367
+ if (V) continue;
368
+ const K = O.current[b], ee = P.current[b];
369
+ if (K && ee) {
370
+ const ce = r[Z(M.node)].p;
371
+ K.position.set(ce.x * 1.12, ce.y + 0.35, ce.z * 1.12);
372
+ const le = `${M.node}|${M.op}`;
373
+ if (ae[b].key !== le) {
374
+ const de = J.instances.get(M.instance);
375
+ ee.setText(M.op === "write" ? `wrote · ${M.node}` : M.node), ee.setColor(M.op === "write" ? "#ffffff" : de ? xe[de.type] : "#c7d2fe"), ae[b].key = le;
376
+ }
377
+ ee.setOpacity(1 - X((C - M.start - 1100) / 500));
378
+ }
379
+ ae[b].node = M.node, b++;
380
+ }
381
+ for (let h = b; h < Re; h++) {
382
+ const M = P.current[h];
383
+ M == null || M.setOpacity(0), ae[h].node = "", ae[h].key = "";
384
+ }
385
+ const N = J.flares.length;
386
+ p.current && p.current.material.color.setRGB(0.55, 0.45, 1.6).multiplyScalar(1.2 + Math.min(3, N * 0.35) + Math.sin(j * 2) * 0.3), S.current && S.current.material.color.setRGB(0.9, 0.85, 2.4).multiplyScalar(1.5 + Math.min(4, N * 0.4) + Math.sin(j * 3.1) * 0.4);
387
+ });
388
+ const U = l, $ = i(() => new n.MeshBasicMaterial({ color: new n.Color("#6d5cff").multiplyScalar(1.6), toneMapped: !1 }), []);
389
+ return /* @__PURE__ */ v("group", { children: [
390
+ /* @__PURE__ */ v("mesh", { position: [0, U / 2, 0], children: [
391
+ /* @__PURE__ */ o("cylinderGeometry", { args: [pe, pe, U, 40, 1] }),
392
+ /* @__PURE__ */ o("meshStandardMaterial", { color: "#05060e", roughness: 0.3, metalness: 0.85 })
393
+ ] }),
394
+ [0.03, U].map((m, C) => /* @__PURE__ */ o("mesh", { position: [0, m, 0], rotation: [Math.PI / 2, 0, 0], material: $, children: /* @__PURE__ */ o("torusGeometry", { args: [pe + 0.1, 0.06, 8, 64] }) }, C)),
395
+ /* @__PURE__ */ o("lineSegments", { geometry: a, frustumCulled: !1, children: /* @__PURE__ */ o("lineBasicMaterial", { vertexColors: !0, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) }),
396
+ /* @__PURE__ */ v("instancedMesh", { ref: w, args: [void 0, void 0, Math.max(1, e)], frustumCulled: !1, children: [
397
+ /* @__PURE__ */ o("circleGeometry", { args: [0.13, 16] }),
398
+ /* @__PURE__ */ o("meshBasicMaterial", { toneMapped: !1 })
399
+ ] }),
400
+ /* @__PURE__ */ v("mesh", { position: [0, U + 1, 0], children: [
401
+ /* @__PURE__ */ o("cylinderGeometry", { args: [0.15, pe * 0.85, 2, 24] }),
402
+ /* @__PURE__ */ o("meshStandardMaterial", { color: "#090b16", roughness: 0.3, metalness: 0.9 })
403
+ ] }),
404
+ /* @__PURE__ */ v("mesh", { ref: p, position: [0, U + 0.6, 0], rotation: [Math.PI / 2, 0, 0], children: [
405
+ /* @__PURE__ */ o("torusGeometry", { args: [pe * 0.95, 0.08, 8, 64] }),
406
+ /* @__PURE__ */ o("meshBasicMaterial", { toneMapped: !1 })
407
+ ] }),
408
+ /* @__PURE__ */ v("mesh", { position: [0, U + 2.9, 0], children: [
409
+ /* @__PURE__ */ o("cylinderGeometry", { args: [0.03, 0.06, 2, 6] }),
410
+ /* @__PURE__ */ o("meshBasicMaterial", { color: "#4c4a7a" })
411
+ ] }),
412
+ /* @__PURE__ */ v("mesh", { ref: S, position: [0, U + 4.1, 0], children: [
413
+ /* @__PURE__ */ o("sphereGeometry", { args: [0.28, 20, 20] }),
414
+ /* @__PURE__ */ o("meshBasicMaterial", { toneMapped: !1 })
415
+ ] }),
416
+ /* @__PURE__ */ v("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, 0.03, 0], children: [
417
+ /* @__PURE__ */ o("ringGeometry", { args: [pe + 1.1, pe + 1.25, 64] }),
418
+ /* @__PURE__ */ o("meshBasicMaterial", { color: new n.Color("#7c6cff").multiplyScalar(2), toneMapped: !1 })
419
+ ] }),
420
+ /* @__PURE__ */ v("instancedMesh", { ref: u, args: [void 0, void 0, E], frustumCulled: !1, children: [
421
+ /* @__PURE__ */ o("cylinderGeometry", { args: [1, 1, 1, 6, 1, !0] }),
422
+ /* @__PURE__ */ o("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1 })
423
+ ] }),
424
+ /* @__PURE__ */ v("instancedMesh", { ref: g, args: [void 0, void 0, k], frustumCulled: !1, children: [
425
+ /* @__PURE__ */ o("sphereGeometry", { args: [0.16, 10, 10] }),
426
+ /* @__PURE__ */ o("meshBasicMaterial", { toneMapped: !1 })
427
+ ] }),
428
+ Array.from({ length: Re }, (m, C) => /* @__PURE__ */ o("group", { ref: (j) => void (O.current[C] = j), children: /* @__PURE__ */ o(Ye, { ref: (j) => void (P.current[C] = j), text: "", size: 0.3, opacity: 0, pxRange: [8, 12], renderOrder: 22 }) }, C)),
429
+ /* @__PURE__ */ o(Lt, { position: [0, U + 5.2, 0], color: "#8b7dff", letterSpacing: 0.06, glow: 1.1, size: 0.6, pxRange: [11, 16] })
430
+ ] });
431
+ }
432
+ const Qt = new n.Color(1, 1, 1), ot = new n.Vector3(0, 1, 0), We = new n.Vector3(), Ce = new n.Vector3(), eo = new n.Vector3(), nt = new n.Matrix4(), Be = { plan: "planner", research: "researcher", write: "writer" }, Oe = new n.PlaneGeometry(1, 1).rotateX(-Math.PI / 2), to = new n.BufferGeometry().setFromPoints([new n.Vector3(-0.5, 0, -0.5), new n.Vector3(0.5, 0, -0.5), new n.Vector3(0.5, 0, 0.5), new n.Vector3(-0.5, 0, 0.5)]);
433
+ function ft(t, e) {
434
+ const s = Me.spread;
435
+ return e.u0 = t.cu - t.hu - 0.5 * s, e.u1 = t.cu + t.hu + 0.5 * s, e.v0 = t.cv - t.hv - 0.3 * s, e.av = t.cv + t.hv + Xt * s, e.v1 = e.av + 1.25 * s, e;
436
+ }
437
+ function oo({ run: t, step: e, gref: s }) {
438
+ const r = i(
439
+ () => ({
440
+ frame: new n.MeshBasicMaterial({ toneMapped: !1 }),
441
+ pad: new n.MeshBasicMaterial({ toneMapped: !1, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1 }),
442
+ col: new n.MeshBasicMaterial({ toneMapped: !1, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1, side: n.DoubleSide })
443
+ }),
444
+ []
445
+ ), l = x(null), c = i(() => new n.Color(), []);
446
+ return ie(({ clock: f }) => {
447
+ const a = t.steps[e], w = f.elapsedTime, u = a === "running" ? 1.6 + Math.sin(w * (ue ? 2 : 6)) * 0.7 : a === "done" ? 1.8 : a === "failed" ? 2 : 0.55;
448
+ c.set(Ne[a] ?? Ne.queued), r.frame.color.copy(c).multiplyScalar(u), r.pad.color.copy(c).multiplyScalar(a === "queued" ? 0.15 : 0.45 * u), l.current && (l.current.visible = a === "running", r.col.color.copy(c).multiplyScalar(0.09 + 0.04 * Math.sin(w * 6)), l.current.rotation.y += 0.01);
449
+ }), /* @__PURE__ */ v("group", { ref: s, children: [
450
+ /* @__PURE__ */ o("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, 0.03, 0], material: r.pad, children: /* @__PURE__ */ o("planeGeometry", { args: [1.9, 1.9] }) }),
451
+ /* @__PURE__ */ o("mesh", { position: [0, 1.1, -1], material: r.frame, children: /* @__PURE__ */ o("boxGeometry", { args: [0.12, 2.2, 0.12] }) }),
452
+ /* @__PURE__ */ o("mesh", { position: [0, 1.1, 1], material: r.frame, children: /* @__PURE__ */ o("boxGeometry", { args: [0.12, 2.2, 0.12] }) }),
453
+ /* @__PURE__ */ o("mesh", { position: [0, 2.2, 0], material: r.frame, children: /* @__PURE__ */ o("boxGeometry", { args: [0.16, 0.16, 2.2] }) }),
454
+ /* @__PURE__ */ o("mesh", { ref: l, position: [0, 4, 0], material: r.col, children: /* @__PURE__ */ o("cylinderGeometry", { args: [0.32, 0.55, 8, 16, 1, !0] }) })
455
+ ] });
456
+ }
457
+ function no({ run: t }) {
458
+ const e = t.run ?? J.runs.get(t.id);
459
+ return e ? /* @__PURE__ */ o(ro, { kr: t, run: e }) : null;
460
+ }
461
+ function ro({ kr: t, run: e }) {
462
+ const s = i(() => new n.Color(e.color), [e.color]), r = i(() => new n.MeshBasicMaterial({ color: s, transparent: !0, opacity: 0.05, depthWrite: !1, toneMapped: !1 }), [s]), l = i(() => new n.LineBasicMaterial({ color: s.clone().multiplyScalar(1.6), transparent: !0, toneMapped: !1 }), [s]), c = i(() => new n.LineLoop(to, l), [l]), f = x(null), a = x(null), w = x(null), u = x([]), g = x([]), p = i(() => [0, 1].map(() => new n.MeshBasicMaterial({ toneMapped: !1 })), []), S = x(null), O = x(null), P = x(null), H = x(null), B = x(""), y = i(() => new n.Color(), []), d = i(() => ({ u0: 0, u1: 0, v0: 0, v1: 0, av: 0, init: !1 }), []), A = i(() => ({ u0: 0, u1: 0, v0: 0, v1: 0, av: 0 }), []);
463
+ return ie((G, I) => {
464
+ var T, z, L, R, q, Q, ae;
465
+ const D = f.current;
466
+ if (!D) return;
467
+ We.copy(t.side), Ce.copy(t.axis), eo.crossVectors(We, ot).dot(Ce) < 0 && Ce.negate(), nt.makeBasis(We, ot, Ce), D.quaternion.setFromRotationMatrix(nt), D.position.copy(t.origin).addScaledVector(t.side, -t.cu).addScaledVector(t.axis, -t.cv);
468
+ const F = Ce.dot(t.axis) < 0 ? -1 : 1;
469
+ ft(t, A);
470
+ const _ = d.init ? 1 - Math.exp(-Math.min(0.1, I) / 0.2) : 1;
471
+ d.init = !0, d.u0 += (A.u0 - d.u0) * _, d.u1 += (A.u1 - d.u1) * _, d.v0 += (A.v0 - d.v0) * _, d.v1 += (A.v1 - d.v1) * _, d.av += (A.av - d.av) * _;
472
+ const Y = d.u1 - d.u0, ne = d.v1 - d.v0, W = (d.u0 + d.u1) / 2, re = (d.v0 + d.v1) / 2 * F, oe = d.av * F, E = Me.spread;
473
+ (T = a.current) == null || T.position.set(W, 0.02, re), (z = a.current) == null || z.scale.set(Y, 1, ne), c.position.set(W, 0.04, re), c.scale.set(Y, 1, ne), (L = w.current) == null || L.position.set(W, 0.025, oe), (R = w.current) == null || R.scale.set(Y - 0.4, 1, 1.7 * E), we.forEach((b, N) => {
474
+ const h = u.current[N];
475
+ h && (h.position.set(Ae(Be[b]), 0, oe), h.scale.setScalar(Math.max(0.6, E * 0.95)), h.visible = e.hasSteps);
476
+ });
477
+ for (let b = 0; b < 2; b++) {
478
+ const N = g.current[b];
479
+ if (!N) continue;
480
+ const h = Ae(Be[we[b]]), M = Ae(Be[we[b + 1]]);
481
+ N.position.set((h + M) / 2, 0.04, oe), N.scale.set(Math.max(0.01, Math.abs(M - h) - 1.9 * E), 1, 0.07), N.visible = e.hasSteps;
482
+ }
483
+ (q = P.current) == null || q.position.set(W, 0.3, (d.v1 + 0.6 * E) * F);
484
+ const k = performance.now(), Z = X((k - e.startedAt) / 900), se = e.endedAt ? 1 - X((k - e.endedAt - (Ft - 1800)) / 1800) : 1, U = Z * se;
485
+ r.opacity = 0.06 * U, l.opacity = U;
486
+ for (let b = 0; b < 2; b++) {
487
+ const N = we[b + 1], M = e.steps[N] !== "queued";
488
+ p[b].color.copy(s).multiplyScalar((M ? 1.6 : 0.25) * U);
489
+ }
490
+ const $ = e.handoffAt ? (k - e.handoffAt) / 1300 : 2;
491
+ if (S.current && (S.current.visible = $ >= 0 && $ < 1, S.current.visible)) {
492
+ const b = Ae(Be[e.handoffFrom]), N = Ae(Be[e.handoffTo]), h = ve($), M = b + (N - b) * h, V = b + (N - b) * ve(Math.max(0, $ - 0.22));
493
+ if (S.current.position.set(M, 0.18, oe + 0.3 * F), S.current.scale.setScalar(Math.max(0.6, E)), O.current) {
494
+ const K = Math.max(0.05, Math.abs(M - V));
495
+ O.current.scale.set(K / Math.max(0.6, E), 1, 1), O.current.position.x = (V - M) / 2 / Math.max(0.6, E), y.copy(s).lerp(Qt, 0.2).multiplyScalar(3.2), O.current.material.color.copy(y);
496
+ }
497
+ }
498
+ let m = 0, C = 0;
499
+ J.instances.forEach((b) => {
500
+ b.run === e.id && !b.exitAt && (m++, b.subagent && C++);
501
+ });
502
+ const j = `${e.steps.plan}${e.steps.research}${e.steps.write}${m}${C}${e.status}`;
503
+ if (j !== B.current && H.current) {
504
+ B.current = j;
505
+ const b = `${m} agents${C ? ` · fan-out ×${C}` : ""}${e.status !== "started" ? ` · ${e.status}` : ""}`;
506
+ (Q = H.current) == null || Q.setText(
507
+ [{ text: e.topic, color: "#f8fafc" }, { text: ` ${b}`, color: "#a5b4fc" }],
508
+ e.hasSteps ? we.map((N, h) => ({ text: `${h ? " · " : ""}${N.toUpperCase()}`, color: e.steps[N] === "queued" ? "#64748b" : Ne[e.steps[N]] })) : [{ text: e.status === "started" ? "district active" : "district closed", color: "#94a3b8" }]
509
+ );
510
+ }
511
+ (ae = H.current) == null || ae.setOpacity(U);
512
+ }), /* @__PURE__ */ v("group", { ref: f, children: [
513
+ /* @__PURE__ */ o("mesh", { ref: a, geometry: Oe, material: r }),
514
+ /* @__PURE__ */ o("primitive", { object: c }),
515
+ /* @__PURE__ */ o("mesh", { ref: w, geometry: Oe, children: /* @__PURE__ */ o("meshBasicMaterial", { color: "#04050a", transparent: !0, opacity: 0.75, depthWrite: !1 }) }),
516
+ [0, 1].map((G) => /* @__PURE__ */ o("mesh", { ref: (I) => void (g.current[G] = I), geometry: Oe, material: p[G] }, G)),
517
+ we.map((G, I) => /* @__PURE__ */ o(oo, { run: e, step: G, gref: (D) => void (u.current[I] = D) }, G)),
518
+ /* @__PURE__ */ v("group", { ref: S, visible: !1, children: [
519
+ /* @__PURE__ */ v("mesh", { children: [
520
+ /* @__PURE__ */ o("boxGeometry", { args: [0.42, 0.16, 0.26] }),
521
+ /* @__PURE__ */ o("meshBasicMaterial", { color: new n.Color("#fff7d6").multiplyScalar(5), toneMapped: !1 })
522
+ ] }),
523
+ /* @__PURE__ */ v("mesh", { ref: O, children: [
524
+ /* @__PURE__ */ o("boxGeometry", { args: [1, 0.06, 0.14] }),
525
+ /* @__PURE__ */ o("meshBasicMaterial", { transparent: !0, blending: n.AdditiveBlending, depthWrite: !1, toneMapped: !1 })
526
+ ] })
527
+ ] }),
528
+ /* @__PURE__ */ o("group", { ref: P, children: /* @__PURE__ */ o(
529
+ Ye,
530
+ {
531
+ ref: H,
532
+ text: e.topic,
533
+ secondary: "",
534
+ plate: "box",
535
+ textAlign: "left",
536
+ color: e.color,
537
+ letterSpacing: 0.02,
538
+ size: 0.42,
539
+ secondarySize: 0.3,
540
+ maxWidth: 16,
541
+ opacity: 0,
542
+ fadeMs: 300,
543
+ fit: !0,
544
+ pxRange: [8.5, 14]
545
+ }
546
+ ) })
547
+ ] });
548
+ }
549
+ const De = new n.Vector3(), ge = { u0: 0, u1: 0, v0: 0, v1: 0, av: 0 };
550
+ function so(t) {
551
+ for (const e of te.runs.values())
552
+ ft(e, ge), t(_e(e, (ge.u0 + ge.u1) / 2, ge.v1 + 0.9 * Me.spread, De), 1.6), t(_e(e, ge.u0, ge.av, De), 0.8), t(_e(e, ge.u1, ge.av, De), 0.8);
553
+ }
554
+ const Ee = new n.Vector3();
555
+ function pt(t, e, s, r, l) {
556
+ Ee.copy(t).add(e).multiplyScalar(0.5), Ee.y = Math.max(t.y, e.y) + r;
557
+ const c = 1 - s;
558
+ return l.set(
559
+ c * c * t.x + 2 * c * s * Ee.x + s * s * e.x,
560
+ c * c * t.y + 2 * c * s * Ee.y + s * s * e.y,
561
+ c * c * t.z + 2 * c * s * Ee.z + s * s * e.z
562
+ );
563
+ }
564
+ function dt(t, e = () => !0) {
565
+ const [s, r] = St([]), l = x("");
566
+ return ie(() => {
567
+ const c = !kt.grouped;
568
+ let f = "";
569
+ for (const a of t()) (c || e(a)) && (f += a.id + ",");
570
+ f !== l.current && (l.current = f, r(c ? t().slice() : t().filter(e)));
571
+ }), s;
572
+ }
573
+ function ao({ comet: t }) {
574
+ const e = x(null), s = i(() => fe(t.from, new n.Vector3()) ?? new n.Vector3(), [t.from]), r = i(() => fe(t.to, new n.Vector3()) ?? new n.Vector3(), [t.to]), l = J.instances.get(t.from), c = l ? xe[l.type] : "#ffffff";
575
+ return ie(() => {
576
+ const f = X((performance.now() - t.start) / t.dur);
577
+ fe(t.from, s), fe(t.to, r), e.current && (pt(s, r, ve(f), 2.5 + s.distanceTo(r) * 0.25, e.current.position), e.current.scale.setScalar(f >= 1 ? 1e-3 : 1));
578
+ }), /* @__PURE__ */ o(rt, { width: 1.6, length: 6, color: new n.Color(c).multiplyScalar(2.2), attenuation: (f) => f * f, decay: 1, children: /* @__PURE__ */ v("mesh", { ref: e, position: s, children: [
579
+ /* @__PURE__ */ o("sphereGeometry", { args: [0.14, 12, 12] }),
580
+ /* @__PURE__ */ o("meshBasicMaterial", { color: new n.Color(c).lerp(new n.Color("#fff"), 0.4).multiplyScalar(4), toneMapped: !1 })
581
+ ] }) });
582
+ }
583
+ function co() {
584
+ const t = dt(() => J.comets, (e) => Ue(e.from) && Ue(e.to));
585
+ return /* @__PURE__ */ o("group", { children: t.map((e) => /* @__PURE__ */ o(ao, { comet: e }, e.id)) });
586
+ }
587
+ function io(t, e) {
588
+ const s = document.createElement("canvas");
589
+ s.width = 512, s.height = 96;
590
+ const r = s.getContext("2d");
591
+ r.fillStyle = "#05030c", r.fillRect(0, 0, 512, 96), r.fillStyle = e, r.globalAlpha = 0.18;
592
+ for (let a = 0; a < 512; a += 6) r.fillRect(a, 0, 2, 96);
593
+ r.globalAlpha = 1, r.font = "700 46px ui-monospace, Menlo, monospace", r.textBaseline = "middle", r.shadowColor = e, r.shadowBlur = 12;
594
+ const l = `${t.toUpperCase()} ◆ MCP ◆ `, c = r.measureText(l).width;
595
+ for (let a = 8; a < 512 + c; a += c) r.fillText(l, a, 50);
596
+ const f = new n.CanvasTexture(s);
597
+ return f.wrapS = n.RepeatWrapping, f.colorSpace = n.SRGBColorSpace, f;
598
+ }
599
+ function lo({ mcp: t }) {
600
+ const e = t.srv, s = x(null), r = x(null), l = x(null), c = x(null), f = x(null), a = i(() => io(e.name, e.color), [e.name, e.color]);
601
+ ze(() => () => a.dispose(), [a]);
602
+ const w = i(() => new n.Color(e.color), [e.color]), u = i(() => performance.now(), []), g = x(0);
603
+ return ie(({ clock: p }, S) => {
604
+ const O = performance.now(), P = p.elapsedTime, H = je(e.name) + (ue ? 0 : Math.sin(P * 0.5 + e.slot) * 0.15), B = s.current;
605
+ B && (B.position.set(t.pos.x, H, t.pos.z), B.rotation.y = (t.out.x < 0 ? Math.PI : 0) + (ue ? 0 : Math.sin(P * 0.23 + e.slot) * 0.08), B.scale.setScalar(it * ve(X((O - u) / 1200))));
606
+ const y = e.inflight > 0, d = Math.exp(-((O - e.activeAt) / 1e3) * 3);
607
+ g.current += S * (y ? 6 : 0.6) * (ue ? 0.2 : 1), l.current && (l.current.rotation.y = g.current), r.current && (r.current.color.setScalar((y ? 2.6 : 1.3) + d * 2.5), ue || (a.offset.x += S * (y ? 0.25 : 0.06))), c.current && (c.current.scale.setScalar(1 + d * 0.5), c.current.material.color.copy(w).multiplyScalar(0.05 + (y ? 0.08 : 0) + d * 0.25)), f.current && f.current.material.color.copy(w).multiplyScalar((y ? 3 + Math.sin(P * 10) * 1.2 : 1.2) + d * 4);
608
+ }), /* @__PURE__ */ v("group", { ref: s, scale: 0, children: [
609
+ /* @__PURE__ */ v("mesh", { scale: [3.4, 1.05, 1.05], children: [
610
+ /* @__PURE__ */ o("sphereGeometry", { args: [1, 32, 20] }),
611
+ /* @__PURE__ */ o("meshStandardMaterial", { color: "#0d0f1c", roughness: 0.45, metalness: 0.6 })
612
+ ] }),
613
+ /* @__PURE__ */ v("mesh", { rotation: [0, 0, 0], scale: [3.42, 1.07, 1.07], children: [
614
+ /* @__PURE__ */ o("torusGeometry", { args: [1, 0.012, 6, 64] }),
615
+ /* @__PURE__ */ o("meshBasicMaterial", { color: w.clone().multiplyScalar(2), toneMapped: !1 })
616
+ ] }),
617
+ [1, -1].map((p) => /* @__PURE__ */ v("mesh", { position: [0, 0, p * 1.08], rotation: [0, p > 0 ? 0 : Math.PI, 0], children: [
618
+ /* @__PURE__ */ o("planeGeometry", { args: [4.2, 0.85] }),
619
+ /* @__PURE__ */ o("meshBasicMaterial", { ref: p > 0 ? r : void 0, map: a, toneMapped: !1 })
620
+ ] }, p)),
621
+ [0, Math.PI / 2, Math.PI, -Math.PI / 2].map((p) => /* @__PURE__ */ v("mesh", { position: [-3.1, 0, 0], rotation: [p, 0, 0], children: [
622
+ /* @__PURE__ */ o("boxGeometry", { args: [0.8, 0.04, 1.3] }),
623
+ /* @__PURE__ */ o("meshStandardMaterial", { color: "#141729", metalness: 0.6, roughness: 0.5 })
624
+ ] }, p)),
625
+ /* @__PURE__ */ v("mesh", { position: [0.3, -1.05, 0], children: [
626
+ /* @__PURE__ */ o("boxGeometry", { args: [1.2, 0.3, 0.45] }),
627
+ /* @__PURE__ */ o("meshStandardMaterial", { color: "#10121f", metalness: 0.6, roughness: 0.4 })
628
+ ] }),
629
+ /* @__PURE__ */ o("group", { ref: l, position: [0.3, -1.35, 0], children: /* @__PURE__ */ v("mesh", { rotation: [0, 0, Math.PI / 2.6], position: [0.25, -0.1, 0], children: [
630
+ /* @__PURE__ */ o("coneGeometry", { args: [0.35, 0.18, 16, 1, !0] }),
631
+ /* @__PURE__ */ o("meshBasicMaterial", { color: w.clone().multiplyScalar(1.6), wireframe: !0, toneMapped: !1 })
632
+ ] }) }),
633
+ /* @__PURE__ */ v("mesh", { ref: f, position: [0.3, -1.3, 0], children: [
634
+ /* @__PURE__ */ o("sphereGeometry", { args: [0.1, 10, 10] }),
635
+ /* @__PURE__ */ o("meshBasicMaterial", { toneMapped: !1 })
636
+ ] }),
637
+ /* @__PURE__ */ v("mesh", { ref: c, scale: [3.9, 1.6, 1.6], children: [
638
+ /* @__PURE__ */ o("sphereGeometry", { args: [1, 24, 16] }),
639
+ /* @__PURE__ */ o("meshBasicMaterial", { transparent: !0, blending: n.AdditiveBlending, depthWrite: !1, toneMapped: !1 })
640
+ ] }),
641
+ /* @__PURE__ */ o(Ye, { position: [0, 1.7, 0], text: `mcp · ${e.name}`, font: "mono", color: e.color, size: 0.34, pxRange: [9, 13] })
642
+ ] });
643
+ }
644
+ function uo({ call: t }) {
645
+ var u;
646
+ const e = x(null), s = i(() => new n.Vector3(), []), r = i(() => new n.Vector3(), []), l = ((u = J.mcpServers.get(t.server)) == null ? void 0 : u.color) ?? "#ffffff", c = i(() => {
647
+ const g = new n.Vector3(0, -50, 0);
648
+ return (t.phase === "call" ? fe(t.instance, g) : $e(t.server, g)) ?? g.set(0, -50, 0);
649
+ }, [t]), f = i(() => new n.Vector3(), []), a = i(() => new n.Vector3(), []);
650
+ ie(() => {
651
+ const g = X((performance.now() - t.start) / t.dur), p = fe(t.instance, f), S = $e(t.server, a);
652
+ !p || !S || !e.current || (t.phase === "call" ? (s.copy(p), r.copy(S)) : (s.copy(S), r.copy(p)), pt(s, r, ve(g), 3, e.current.position), e.current.rotation.y += 0.2, e.current.scale.setScalar(g >= 1 ? 1e-3 : 1));
653
+ });
654
+ const w = new n.Color(l);
655
+ return t.phase === "result" && w.lerp(new n.Color("#ffffff"), 0.45), /* @__PURE__ */ o(rt, { width: 1.3, length: 5, color: w.clone().multiplyScalar(2), attenuation: (g) => g * g, children: /* @__PURE__ */ v("mesh", { ref: e, position: c, children: [
656
+ /* @__PURE__ */ o("octahedronGeometry", { args: [0.16, 0] }),
657
+ /* @__PURE__ */ o("meshBasicMaterial", { color: w.clone().multiplyScalar(4), toneMapped: !1 })
658
+ ] }) });
659
+ }
660
+ function fo() {
661
+ const t = dt(() => J.mcpCalls, (e) => Ue(e.instance));
662
+ return /* @__PURE__ */ o("group", { children: t.map((e) => /* @__PURE__ */ o(uo, { call: e }, e.id)) });
663
+ }
664
+ const po = new n.Color("#fbbf24"), ho = new n.Color("#ff2d3d");
665
+ function mo() {
666
+ const s = i(() => {
667
+ const u = new n.BufferGeometry();
668
+ return u.setAttribute("position", new n.BufferAttribute(new Float32Array(5760), 3)), u.setAttribute("color", new n.BufferAttribute(new Float32Array(5760), 3)), u;
669
+ }, []), r = i(() => new n.Vector3(), []), l = i(() => new n.Vector3(), []), c = i(() => new n.Vector3(), []), f = i(() => new n.Color(), []), a = i(() => new n.Color(), []), w = (u, g) => (g.copy(r).lerp(l, u), g.y -= Math.sin(u * Math.PI) * 1.2, g);
670
+ return ie(({ clock: u }) => {
671
+ const g = s.getAttribute("position"), p = s.getAttribute("color"), S = performance.now(), O = ue ? 0 : u.elapsedTime;
672
+ let P = 0;
673
+ const H = (B, y, d, A, G) => {
674
+ const I = J.mcpServers.get(y);
675
+ if (!I || P >= 960 || !fe(B, r) || !$e(y, l)) return;
676
+ f.set(I.color), A > 0.8 && f.lerp(po, X((A - 0.8) / 1)), A > 1.8 && f.lerp(ho, X((A - 1.8) / 0.8));
677
+ const D = d === "pending" ? ve(X((S - G) / 350)) : 1, F = d === "resolved" ? (S - G) / 700 : 0;
678
+ for (let _ = 0; _ < 40 && P < 960; _++, P++) {
679
+ const Y = _ / 40 * D, ne = (_ + 1) / 40 * D;
680
+ w(Y, c), g.setXYZ(P * 2, c.x, c.y, c.z), w(ne, c), g.setXYZ(P * 2 + 1, c.x, c.y, c.z);
681
+ for (let W = 0; W < 2; W++) {
682
+ const re = W ? ne : Y;
683
+ let oe;
684
+ if (d === "pending") {
685
+ const E = Math.pow(0.5 + 0.5 * Math.sin(re * 46 - O * 9), 6);
686
+ oe = (0.25 + 0.2 * Math.min(3, A)) * (0.35 + 1.6 * E), a.copy(f).multiplyScalar(oe);
687
+ } else {
688
+ const E = 1 - X(F / 0.55), k = Math.exp(-Math.pow((re - E) * 9, 2)) * 5 * (1 - X((F - 0.55) / 0.3));
689
+ oe = 0.35 * (1 - X(F / 0.8)), a.copy(f).multiplyScalar(oe).addScalar(k * 0.6), a.r += f.r * k, a.g += f.g * k, a.b += f.b * k;
690
+ }
691
+ p.setXYZ(P * 2 + W, a.r, a.g, a.b);
692
+ }
693
+ }
694
+ };
695
+ J.mcpPending.forEach((B) => H(B.instance, B.server, "pending", Tt(B, S), B.since));
696
+ for (const B of J.mcpResolved) H(B.instance, B.server, "resolved", 0, B.resolvedAt);
697
+ s.setDrawRange(0, P * 2), g.needsUpdate = !0, p.needsUpdate = !0;
698
+ }), /* @__PURE__ */ o("lineSegments", { geometry: s, frustumCulled: !1, children: /* @__PURE__ */ o("lineBasicMaterial", { vertexColors: !0, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) });
699
+ }
700
+ function go({ agent: t, selected: e, onSelect: s }) {
701
+ const r = t.inst, l = t.run.color, c = i(() => qt(r, t.depth === 0 ? t.sib : 0), [r, t]), f = xe[r.type], { h: a, w, d: u } = c, g = i(() => new n.BoxGeometry(w, a, u).translate(0, a / 2, 0), [w, a, u]), p = i(() => {
702
+ const E = [], k = w / 2 + 0.04, Z = u / 2 + 0.04, se = ($) => {
703
+ const m = [[-k, -Z], [k, -Z], [k, Z], [-k, Z]];
704
+ for (let C = 0; C < 4; C++) E.push(m[C][0], $, m[C][1], m[(C + 1) % 4][0], $, m[(C + 1) % 4][1]);
705
+ };
706
+ for (let $ = 0; $ <= a + 1e-3; $ += 0.92) se($);
707
+ se(a);
708
+ for (const [$, m] of [[-k, -Z], [k, -Z], [k, Z], [-k, Z]]) E.push($, 0, m, $, a, m);
709
+ for (const [$, m] of [[-k, -Z], [k, Z]]) E.push($, 0, m, -$, a, -m);
710
+ const U = new n.BufferGeometry();
711
+ return U.setAttribute("position", new n.Float32BufferAttribute(E, 3)), U;
712
+ }, [w, a, u]), S = i(() => {
713
+ const E = at({ color: f, edge: l });
714
+ return E.uniforms.uHalf.value.set(w / 2, u / 2), E.uniforms.uH.value = a, E.uniforms.uLit.value = 0.2, E;
715
+ }, [f, l, w, u, a]);
716
+ ze(() => () => (g.dispose(), p.dispose(), S.dispose()), [g, p, S]);
717
+ const O = x(null), P = x(null), H = x(null), B = x(null), y = x(null), d = x(null), A = x(null), G = i(() => new n.Color(f), [f]), I = i(() => new n.Color("#ffffff"), []), D = i(() => new n.Color("#ff3344"), []), F = i(() => new n.Color("#fbbf24"), []), _ = i(() => new n.Color(), []), Y = x(0.2), ne = x(0);
718
+ ze(() => () => void ke.delete(r.id), [r.id]);
719
+ const W = x(null);
720
+ return ie(({ clock: E }, k) => {
721
+ const Z = performance.now(), se = E.elapsedTime, U = (Z - r.bornAt) / 1e3, $ = Me.scale;
722
+ W.current && (W.current.position.copy(t.live), W.current.scale.x !== $ && W.current.scale.setScalar($));
723
+ const m = r.exitAt ? (Z - r.exitAt) / 1e3 * (2500 / Vt(r)) : -1, C = Se(X((U - 0.25) / 1.25)), j = m >= 0 ? ve(X((m - 0.8) / 1.5)) : 0, T = -a * (1 - C) - (a + 0.4) * j;
724
+ O.current && (O.current.position.y = T);
725
+ const z = U < 0.25 ? U / 0.25 : 1 - X((U - 1.1) / 0.7);
726
+ P.current && (P.current.visible = z > 0.01, P.current.material.color.copy(G).multiplyScalar(z * (2.2 + Math.sin(se * 30) * 0.6)));
727
+ let L = !1;
728
+ for (const V of J.mcpPending.values()) V.instance === r.id && (L = !0);
729
+ const R = r.status === "thinking" && !L, q = r.status === "waiting" || L, Q = st(r, Z), ae = R ? 0.8 : L ? 0.22 + 0.12 * Math.sin(se * 2.4) : q ? 0.12 : r.exitAt ? 0.85 : 0.45;
730
+ Y.current += (ae - Y.current) * Math.min(1, k * 3);
731
+ const b = S.uniforms;
732
+ b.uTime.value = ue ? 0 : se, b.uLit.value = Y.current, b.uWork.value = R && !ue ? 1 : 0, b.uEnergy.value = Math.min(1.6, Q), b.uCascade.value = m >= 0 ? X(m / 0.9) : 0, b.uScaffold.value = U < 1.6 ? Math.max(0, z) * (1 - C * 0.6) : 0, b.uEdgeAmt.value = (0.55 + Q * 0.8) * (m >= 0 ? 1 - X(m / 1.2) * 0.8 : 1);
733
+ const N = a + T, h = R ? 0.5 + 0.5 * Math.sin(se * 7) : L ? 0.5 + 0.5 * Math.sin(se * 2.4) : q ? 0.5 + 0.5 * Math.sin(se * 1.3) : 0.6, M = m >= 0 ? Math.max(0, 1 - m / 0.5) : 0;
734
+ if (H.current) {
735
+ H.current.position.y = N + 0.75;
736
+ const V = (q ? 0.6 + h * 0.8 : 1.4 + h * 2.6) + Q * 4 + M * 8;
737
+ _.copy(G).lerp(L ? F : G, L ? 0.6 : 0).lerp(r.status === "failed" ? D : I, M * 0.8 + Math.min(0.5, Q * 0.25)).multiplyScalar(m >= 0 ? V * (1 - X((m - 0.5) / 0.5)) : V), H.current.material.color.copy(_), H.current.scale.setScalar(1 + Q * 0.6 + M * 2.5);
738
+ }
739
+ if (B.current && (B.current.position.y = N + 0.75, B.current.scale.setScalar(0.8 + h * (R ? 0.6 : 0.2) + Math.min(1.2, Q * 0.8) + M * 3), B.current.material.color.copy(G).multiplyScalar((R ? 0.22 : 0.08) + Math.min(0.3, Q * 0.15) + M * 0.5)), ne.current += ((R && m < 0 ? 1 : 0) - ne.current) * Math.min(1, k * 4), y.current && (y.current.visible = ne.current > 0.02, y.current.position.y = N + 1.6, y.current.scale.setScalar(ne.current * (1 + Q * 0.25)), y.current.rotation.y += k * (ue ? 0.3 : 1.8)), d.current) {
740
+ const V = d.current.material, K = U / 0.9, ee = m >= 0 ? m / 1.1 : -1;
741
+ ee >= 0 && ee < 1 ? (d.current.visible = !0, d.current.scale.setScalar(1 + ee * 6), V.color.copy(r.status === "failed" ? D : G).lerp(I, 0.4).multiplyScalar(2.5 * (1 - ee))) : K < 1 ? (d.current.visible = !0, d.current.scale.setScalar(0.5 + Se(K) * 3), V.color.copy(G).multiplyScalar(3 * (1 - K))) : d.current.visible = !1;
742
+ }
743
+ A.current && (A.current.visible = e, A.current.visible && (A.current.rotation.z += k * 1.2)), ke.set(r.id, Math.max(0.3, (N + 0.75) * $));
744
+ }), /* @__PURE__ */ v("group", { ref: W, children: [
745
+ /* @__PURE__ */ v("group", { ref: O, children: [
746
+ /* @__PURE__ */ o("mesh", { geometry: g, material: S, onClick: (E) => (E.stopPropagation(), s(r.id)), onPointerOver: () => document.body.style.cursor = "pointer", onPointerOut: () => document.body.style.cursor = "" }),
747
+ /* @__PURE__ */ v("mesh", { position: [0, a + 0.35, 0], children: [
748
+ /* @__PURE__ */ o("cylinderGeometry", { args: [0.03, 0.05, 0.7, 6] }),
749
+ /* @__PURE__ */ o("meshBasicMaterial", { color: "#1e2433" })
750
+ ] })
751
+ ] }),
752
+ /* @__PURE__ */ o("lineSegments", { ref: P, geometry: p, children: /* @__PURE__ */ o("lineBasicMaterial", { transparent: !0, blending: n.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) }),
753
+ /* @__PURE__ */ v("mesh", { ref: H, children: [
754
+ /* @__PURE__ */ o("sphereGeometry", { args: [0.13, 14, 14] }),
755
+ /* @__PURE__ */ o("meshBasicMaterial", { toneMapped: !1 })
756
+ ] }),
757
+ /* @__PURE__ */ v("mesh", { ref: B, children: [
758
+ /* @__PURE__ */ o("sphereGeometry", { args: [0.32, 16, 16] }),
759
+ /* @__PURE__ */ o("meshBasicMaterial", { transparent: !0, blending: n.AdditiveBlending, depthWrite: !1, toneMapped: !1 })
760
+ ] }),
761
+ /* @__PURE__ */ v("group", { ref: y, children: [
762
+ /* @__PURE__ */ v("mesh", { rotation: [Math.PI / 2, 0, 0], children: [
763
+ /* @__PURE__ */ o("torusGeometry", { args: [Math.max(0.55, w * 0.42), 0.025, 6, 48] }),
764
+ /* @__PURE__ */ o("meshBasicMaterial", { color: G.clone().multiplyScalar(2.6), toneMapped: !1 })
765
+ ] }),
766
+ /* @__PURE__ */ v("mesh", { children: [
767
+ /* @__PURE__ */ o("octahedronGeometry", { args: [0.32, 0] }),
768
+ /* @__PURE__ */ o("meshBasicMaterial", { color: G.clone().multiplyScalar(2), wireframe: !0, toneMapped: !1 })
769
+ ] }),
770
+ /* @__PURE__ */ v("mesh", { position: [0, 0, Math.max(0.55, w * 0.42)], children: [
771
+ /* @__PURE__ */ o("planeGeometry", { args: [0.7, 0.26] }),
772
+ /* @__PURE__ */ o("meshBasicMaterial", { color: G.clone().multiplyScalar(1.3), transparent: !0, opacity: 0.55, side: n.DoubleSide, blending: n.AdditiveBlending, depthWrite: !1, toneMapped: !1 })
773
+ ] })
774
+ ] }),
775
+ /* @__PURE__ */ v("mesh", { ref: d, rotation: [-Math.PI / 2, 0, 0], position: [0, 0.05, 0], children: [
776
+ /* @__PURE__ */ o("ringGeometry", { args: [Math.max(w, u) * 0.62, Math.max(w, u) * 0.72, 48] }),
777
+ /* @__PURE__ */ o("meshBasicMaterial", { transparent: !0, blending: n.AdditiveBlending, depthWrite: !1, toneMapped: !1 })
778
+ ] }),
779
+ /* @__PURE__ */ v("mesh", { ref: A, rotation: [-Math.PI / 2, 0, 0], position: [0, 0.07, 0], visible: !1, children: [
780
+ /* @__PURE__ */ o("ringGeometry", { args: [Math.max(w, u) * 0.85, Math.max(w, u) * 0.95, 6] }),
781
+ /* @__PURE__ */ o("meshBasicMaterial", { color: new n.Color("#e0f2fe").multiplyScalar(2.5), toneMapped: !1 })
782
+ ] })
783
+ ] });
784
+ }
785
+ function yo() {
786
+ const s = i(() => {
787
+ const u = new n.BufferGeometry();
788
+ return u.setAttribute("position", new n.BufferAttribute(new Float32Array(2400), 3)), u.setAttribute("color", new n.BufferAttribute(new Float32Array(2400), 3)), u;
789
+ }, []), r = i(() => new n.Vector3(), []), l = i(() => new n.Vector3(), []), c = i(() => new n.Vector3(), []), f = i(() => new n.Vector3(), []), a = i(() => new n.Color(), []), w = (u, g) => {
790
+ const p = 1 - u;
791
+ return g.set(p * p * r.x + 2 * p * u * c.x + u * u * l.x, p * p * r.y + 2 * p * u * c.y + u * u * l.y, p * p * r.z + 2 * p * u * c.z + u * u * l.z);
792
+ };
793
+ return ie(() => {
794
+ const u = s.getAttribute("position"), g = s.getAttribute("color"), p = performance.now();
795
+ let S = 0;
796
+ for (const O of te.agents.values()) {
797
+ const P = O.inst;
798
+ if (!P.parent || S >= 400 || !fe(P.parent, r) || !fe(P.id, l)) continue;
799
+ const H = It(P, p);
800
+ if (H < 0.02) continue;
801
+ const B = X((p - P.bornAt) / 650);
802
+ c.copy(r).add(l).multiplyScalar(0.5), c.y = Math.max(r.y, l.y) + 1.2 + r.distanceTo(l) * 0.12;
803
+ const y = Se(B), d = 1 - B, G = (P.type === "graph_scout" || P.type === "records_scout" ? 0.9 : 0.45) * H + d * 2.5 + st(P, p) * 0.4;
804
+ a.set(xe[P.type]);
805
+ for (let I = 0; I < 10 && S < 400; I++, S++) {
806
+ const D = I / 10 * y, F = (I + 1) / 10 * y;
807
+ w(D, f), u.setXYZ(S * 2, f.x, f.y, f.z), w(F, f), u.setXYZ(S * 2 + 1, f.x, f.y, f.z);
808
+ const _ = G * (0.35 + 0.65 * (I / 10)), Y = G * (0.35 + 0.65 * ((I + 1) / 10));
809
+ g.setXYZ(S * 2, a.r * _, a.g * _, a.b * _), g.setXYZ(S * 2 + 1, a.r * Y, a.g * Y, a.b * Y);
810
+ }
811
+ }
812
+ s.setDrawRange(0, S * 2), u.needsUpdate = !0, g.needsUpdate = !0;
813
+ }), /* @__PURE__ */ o("lineSegments", { geometry: s, frustumCulled: !1, children: /* @__PURE__ */ o("lineBasicMaterial", { vertexColors: !0, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) });
814
+ }
815
+ const Fe = new n.Vector3();
816
+ function Mo(t) {
817
+ for (const e of te.agents.values()) t(Fe.set(e.target.x, ke.get(e.id) ?? 0, e.target.z), 0.9);
818
+ so(t);
819
+ for (const e of Wt()) t(Fe.copy(te.clusterTarget[e]).setY(1), 4.4);
820
+ for (const e of te.mcp.values()) t(Fe.set(e.target.x, je(e.name), e.target.z), 3.4 * it + 0.6);
821
+ if (te.graphWanted) {
822
+ const e = te.graph;
823
+ t(Fe.set(e.target.x, Kt(200) * (e.radius / lt), e.target.z), 2.4);
824
+ }
825
+ }
826
+ function vo() {
827
+ const t = Mt((e) => e.scene);
828
+ return ie(() => {
829
+ const e = Me.cam.dist || 40, s = Math.max(30, e * 0.68), r = Math.max(100, e * 2.2);
830
+ Te.near.value = s, Te.far.value = r;
831
+ const l = t.fog;
832
+ l && (l.near = s, l.far = r);
833
+ }), null;
834
+ }
835
+ const wo = /* @__PURE__ */ v(ht, { children: [
836
+ /* @__PURE__ */ o("fog", { attach: "fog", args: [be.color, be.near, be.far] }),
837
+ /* @__PURE__ */ o(vo, {}),
838
+ /* @__PURE__ */ o("ambientLight", { intensity: 0.35, color: "#8a7dff" }),
839
+ /* @__PURE__ */ o("pointLight", { position: [0, 24, 0], intensity: 180, distance: 60, color: "#7c6cff" }),
840
+ /* @__PURE__ */ o("pointLight", { position: [30, 10, -20], intensity: 90, distance: 60, color: "#ff2d95" }),
841
+ /* @__PURE__ */ o(yt, { radius: 160, depth: 60, count: ue ? 800 : 2200, factor: 4, saturation: 0.3, fade: !0, speed: 0 }),
842
+ /* @__PURE__ */ o($t, {}),
843
+ /* @__PURE__ */ o(Nt, {})
844
+ ] });
845
+ function Bo() {
846
+ return /* @__PURE__ */ v(
847
+ _t,
848
+ {
849
+ title: "city",
850
+ subtitle: "night city · agents rise as skyscrapers · districts = Hatchet runs · spire = knowledge graph · blimps = MCP",
851
+ className: "city-root",
852
+ preset: Ht,
853
+ plane: "xz",
854
+ camera: { position: [14, 30, 40], fov: 45, near: 0.5, far: 400 },
855
+ target: [0, 1.5, 0],
856
+ controls: { minPolarAngle: 0.35, maxPolarAngle: 1.32 },
857
+ bg: "#05040d",
858
+ gl: { powerPreference: "high-performance" },
859
+ fit: { nRef: 4, min: 0.62, max: 1.3, minRadius: 7 },
860
+ agentRadius: 1.4,
861
+ graph: { natural: lt, radius: 2.8 },
862
+ peripheryGap: 6.5,
863
+ Background: wo,
864
+ Agent: go,
865
+ RunMarker: no,
866
+ McpServer: lo,
867
+ GraphResource: Jt,
868
+ cluster: { radius: 1.9, variant: "swarm", pointSize: 1.05 },
869
+ clusterOffset: [0, 1.9, 0],
870
+ extents: Mo,
871
+ PostFX: /* @__PURE__ */ v(vt, { multisampling: 0, children: [
872
+ /* @__PURE__ */ o(wt, { mipmapBlur: !0, intensity: 1.25, luminanceThreshold: 0.22, luminanceSmoothing: 0.25, radius: 0.78 }),
873
+ /* @__PURE__ */ o(xt, { eskil: !1, offset: 0.22, darkness: 0.85 }),
874
+ /* @__PURE__ */ o(bt, { opacity: 0.035 })
875
+ ] }),
876
+ children: [
877
+ /* @__PURE__ */ o(yo, {}),
878
+ /* @__PURE__ */ o(co, {}),
879
+ /* @__PURE__ */ o(fo, {}),
880
+ /* @__PURE__ */ o(mo, {})
881
+ ]
882
+ }
883
+ );
884
+ }
885
+ export {
886
+ Bo as default
887
+ };