agentglow 0.2.11 → 0.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,891 +0,0 @@
1
- import { jsxs as M, jsx as o, Fragment as mt } from "react/jsx-runtime";
2
- import { MeshReflectorMaterial as gt, Grid as yt, Trail as rt, Stars as Mt } from "@react-three/drei";
3
- import { useFrame as ie, useThree as vt } from "@react-three/fiber";
4
- import { EffectComposer as wt, Bloom as xt, Vignette as bt, Noise as St } from "@react-three/postprocessing";
5
- import * as n from "three";
6
- import { useRef as b, useMemo as l, useEffect as Le, useState as At } from "react";
7
- import { n as te, B as Ct, f as Me, C as Gt, w as J, a as Bt, i as Et, h as Ze, c as Lt, K as Pt, o as zt, T as we, L as qe, G as Rt, q as Tt, v as Ie, S as Ke, z as Se, R as Ft, j as st, D as kt, k as Vt, r as ue, d as It, b as De, g as _t, l as Ot, e as at, p as Wt, m as Dt, E as Ut } from "./KitScene-DG_pcnWW.js";
8
- const Nt = (
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
- ), $t = (
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
- ), xe = { color: new n.Color("#05040d"), near: 34, far: 110 }, Te = { near: { value: xe.near }, far: { value: xe.far } };
98
- function ct(t = {}) {
99
- return new n.ShaderMaterial({
100
- vertexShader: Nt,
101
- fragmentShader: $t,
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: xe.color },
119
- uFogNear: Te.near,
120
- uFogFar: Te.far
121
- }
122
- });
123
- }
124
- function Xt(t) {
125
- return () => (t = t * 16807 % 2147483647, (t - 1) / 2147483646);
126
- }
127
- const Pe = 1.1, it = () => Math.hypot(te.core.hw, te.core.hh) + 2.4;
128
- function Ht() {
129
- const t = b(null), e = 16;
130
- return ie(() => {
131
- const s = t.current;
132
- s && s.scale.setScalar(it() / e);
133
- }), /* @__PURE__ */ M("group", { children: [
134
- /* @__PURE__ */ M("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, 0, 0], children: [
135
- /* @__PURE__ */ o("planeGeometry", { args: [320, 320] }),
136
- /* @__PURE__ */ o(
137
- gt,
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
- yt,
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__ */ M("group", { ref: t, children: [
171
- /* @__PURE__ */ M("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, 0.015, 0], children: [
172
- /* @__PURE__ */ o("ringGeometry", { args: [e - Pe, e + Pe, 160] }),
173
- /* @__PURE__ */ o("meshBasicMaterial", { color: "#020308", transparent: !0, opacity: 0.8, depthWrite: !1 })
174
- ] }),
175
- [-Pe, Pe].map((s) => /* @__PURE__ */ M("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, Ae = new n.Object3D();
183
- function qt() {
184
- const t = b(null), e = l(() => {
185
- const a = ct({ filler: !0 });
186
- return a.uniforms.uH.value = 999, a.uniforms.uLit.value = 0.2, a;
187
- }, []), s = l(() => new n.BoxGeometry(1, 1, 1).translate(0, 0.5, 0), []), r = l(() => {
188
- const a = Xt(42), v = [];
189
- for (let u = -96; u <= 96; u += 4.6)
190
- for (let m = -96; m <= 60; m += 4.6) {
191
- const p = u + (a() - 0.5) * 1.6, A = m + (a() - 0.5) * 1.6;
192
- a() < 0.3 || v.push({ x: p, z: A, 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 v;
195
- }, []), i = l(() => new Float32Array(r.length), [r]), c = l(() => new Float32Array(r.length), [r]), f = b({ hw: -1, hh: -1, sig: -1, last: -1e9, moving: !0 });
196
- return ie((a, v) => {
197
- const u = t.current;
198
- if (!u) return;
199
- const m = te.core, p = f.current, A = performance.now();
200
- let W = te.graphWanted ? te.graph.target.x * 7 + te.graph.target.z * 3 + 1 : 0;
201
- for (const g of te.mcp.values()) W += g.target.x * 0.37 + g.target.z * 0.11;
202
- if ((Math.abs(m.hw - p.hw) > 0.6 || Math.abs(m.hh - p.hh) > 0.6 || Math.abs(W - p.sig) > 0.5) && A - p.last > 300) {
203
- p.hw = m.hw, p.hh = m.hh, p.sig = W, p.last = A, p.moving = !0;
204
- const g = m.hw + 2.5, d = m.hh + 2.5, C = it(), S = te.graph, I = te.graphWanted ? S.radius + 2.6 : 0;
205
- for (let H = 0; H < r.length; H++) {
206
- const T = r[H], _ = Math.max(0, Math.abs(T.x) - g), q = Math.max(0, Math.abs(T.z) - d), ne = Math.hypot(_, q);
207
- let O = 0;
208
- const re = T.x * Je + T.z * Qe - (g * Je + d * Qe), oe = re > -1;
209
- if (ne > 3 && Math.hypot(T.x, T.z) > C + 2.2 && !(oe && re < 24)) {
210
- const E = Math.min(1, ne / 40);
211
- O = 1 + T.tall * (3 + E * 18) + T.spike * E, oe && (O = Math.min(O, 1.4));
212
- }
213
- I && Math.hypot(T.x - S.target.x, T.z - S.target.z) < I && (O = 0);
214
- for (const E of te.mcp.values()) Math.hypot(T.x - E.target.x, T.z - E.target.z) < 3.4 && (O = 0);
215
- c[H] = O;
216
- }
217
- }
218
- if (!p.moving) return;
219
- const $ = 1 - Math.exp(-Math.min(0.1, v) / 0.35);
220
- let B = !1;
221
- for (let g = 0; g < r.length; g++) {
222
- const d = r[g], C = c[g] - i[g];
223
- Math.abs(C) > 0.01 ? (i[g] += C * $, B = !0) : i[g] = c[g], Ae.position.set(d.x, 0, d.z), Ae.rotation.set(0, d.ry, 0), Ae.scale.set(i[g] > 0.02 ? d.w : 1e-4, Math.max(1e-4, i[g]), i[g] > 0.02 ? d.d : 1e-4), Ae.updateMatrix(), u.setMatrixAt(g, Ae.matrix);
224
- }
225
- u.instanceMatrix.needsUpdate = !0, p.moving = B;
226
- }), Le(() => () => (s.dispose(), e.dispose()), [s, e]), /* @__PURE__ */ o("instancedMesh", { ref: t, args: [s, e, r.length], frustumCulled: !1 });
227
- }
228
- const pe = 2.5, Yt = 1.4, et = 4.2, tt = 2.4, jt = {
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, i = e.n, c = 2 * e.hu + tt, f = 2 * e.hv + tt + r, a = Gt(i, c, f, e.aspect), v = Math.ceil(i / a), u = t % a, m = Math.floor(t / a), p = Math.min(a, i - m * a);
233
- s.a = (u - (p - 1) / 2) * c, s.b = ((v - 1) / 2 - m) * f + r / 2, s.angle = -Math.PI / 2;
234
- },
235
- cluster(t, e, s, r, i) {
236
- Ct(e, s, r, -(r.hh + et * Me.spread + 6), i);
237
- },
238
- periphery: "sides"
239
- };
240
- function Zt(t, e) {
241
- const s = t.type, r = t.id;
242
- if (!t.subagent && !Et(s)) {
243
- const [i, c] = s === "planner" ? [1.7, 6] : s === "researcher" ? [2.1, 8.6] : [1.9, 7];
244
- return { w: i, d: i, h: c * (0.9 + 0.2 * Ze(r, 33)) * (e ? 0.85 : 1) };
245
- }
246
- return { w: 0.95, d: 0.95, h: 2.6 + Ze(r, 37) * 1.4 };
247
- }
248
- const Fe = /* @__PURE__ */ new Map();
249
- function fe(t, e) {
250
- const s = Bt(t);
251
- if (s)
252
- return e.set(s.x, Fe.get(t) ?? 0.3, s.z);
253
- }
254
- const Kt = 6.2, lt = 0.72;
255
- function Ye(t) {
256
- const e = J.mcpServers.get(t);
257
- return Kt + ((e == null ? void 0 : e.slot) ?? 0) % 2 * 1.3;
258
- }
259
- function Ue(t, e) {
260
- const s = Lt(t);
261
- if (s)
262
- return e.set(s.x, Ye(t) - 0.8, s.z);
263
- }
264
- const Ne = { queued: "#3b4256", running: "#fbbf24", done: "#22c55e", failed: "#ef4444" }, N = (t) => t < 0 ? 0 : t > 1 ? 1 : t, be = (t) => 1 - Math.pow(1 - t, 3), ve = (t) => t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2, ut = pe + 1.3, ft = 200, Ee = 34, $e = 1.2, Xe = 1.1, Jt = 2600, me = 12, ze = 4, He = pe + 0.06;
265
- function Qt(t) {
266
- const e = [];
267
- for (let s = 0; s < t; s++) {
268
- const r = Math.floor(s / Ee), c = (s * 7 % Ee + r % 2 * 0.5) / Ee * Math.PI * 2, f = Xe + r * $e;
269
- e.push({ p: new n.Vector3(Math.sin(c) * He, f, Math.cos(c) * He), th: c, y: f });
270
- }
271
- return { list: e, height: Xe + Math.ceil(t / Ee) * $e };
272
- }
273
- const eo = (t) => Xe + Math.ceil(Math.min(ft, t) / Ee) * $e + 4.4;
274
- function to({ galaxy: t }) {
275
- const e = Math.min(ft, t.nodes.length), s = l(() => t.nodes.slice(0, e), [t, e]), { list: r, height: i } = l(() => Qt(e), [e]), c = l(() => s.map((h) => new n.Color(Pt[h.kind] ?? "#94a3b8")), [s]), f = l(() => {
276
- const h = new Map(s.map((F, P) => [F.id, P])), G = [], Y = /* @__PURE__ */ new Set();
277
- for (const F of t.links) {
278
- const P = h.get(F.source), z = h.get(F.target);
279
- if (P === void 0 || z === void 0 || P === z) continue;
280
- const R = P < z ? `${P}-${z}` : `${z}-${P}`;
281
- Y.has(R) || (Y.add(R), G.push([P, z]));
282
- }
283
- return G;
284
- }, [t, s]), a = l(() => {
285
- const h = new Float32Array(f.length * me * 6), G = (F, P, z, R) => {
286
- let X = P.th - F.th;
287
- X > Math.PI && (X -= Math.PI * 2), X < -Math.PI && (X += Math.PI * 2);
288
- const Q = F.th + X * z, ae = He + 0.02 + Math.sin(z * Math.PI) * 0.22;
289
- h[R] = Math.sin(Q) * ae, h[R + 1] = F.y + (P.y - F.y) * z, h[R + 2] = Math.cos(Q) * ae;
290
- };
291
- f.forEach(([F, P], z) => {
292
- for (let R = 0; R < me; R++) {
293
- const X = (z * me + R) * 6;
294
- G(r[F], r[P], R / me, X), G(r[F], r[P], (R + 1) / me, X + 3);
295
- }
296
- });
297
- const Y = new n.BufferGeometry();
298
- return Y.setAttribute("position", new n.BufferAttribute(h, 3)), Y.setAttribute("color", new n.BufferAttribute(new Float32Array(h.length), 3)), Y;
299
- }, [f, r]);
300
- Le(() => () => a.dispose(), [a]);
301
- const v = b(null), u = b(null), m = b(null), p = b(null), A = b(null), W = b([]), L = b([]), $ = b(Array.from({ length: ze }, () => ({ node: "", key: "" }))), B = l(() => new Float32Array(e), [e]), g = l(() => new Float32Array(e), [e]), d = l(() => /* @__PURE__ */ new Map(), []), C = l(() => new n.Object3D(), []), S = l(() => new n.Color(), []), I = l(() => new n.Color("#5b4fd6"), []), H = l(() => new n.Color(1, 1, 1), []), T = l(() => new n.Vector3(), []), _ = l(() => new n.Vector3(), []), q = l(() => new n.Vector3(), []), ne = l(() => new n.Vector3(0, 1, 0), []), O = l(() => new n.Vector3(), []), re = l(() => new n.Vector3(), []), oe = b(!0), E = 72, k = 40, Z = (h) => {
302
- let G = d.get(h);
303
- return G === void 0 && d.set(h, G = Tt(t, h) % e), G;
304
- }, se = (h, G, Y, F, P, z) => {
305
- q.subVectors(F, Y);
306
- const R = q.length();
307
- return R < 1e-3 ? !1 : (C.position.copy(Y).addScaledVector(q, 0.5), C.quaternion.setFromUnitVectors(ne, q.multiplyScalar(1 / R)), C.scale.set(P, R, P), C.updateMatrix(), h.setMatrixAt(G, C.matrix), h.setColorAt(G, z), !0);
308
- };
309
- ie(({ clock: h }) => {
310
- const G = performance.now(), Y = h.elapsedTime;
311
- B.fill(0), g.fill(0);
312
- const F = u.current, P = m.current;
313
- let z = 0, R = 0;
314
- for (const y of J.flares) {
315
- const x = Z(y.node), V = N((G - y.start) / Jt), K = Math.pow(1 - V, 1.4);
316
- y.op === "write" ? g[x] = Math.max(g[x], K) : B[x] = Math.max(B[x], K);
317
- const ee = J.instances.get(y.instance), ce = !!fe(y.instance, O);
318
- ce && zt(O, re);
319
- const le = r[x].p;
320
- if (!(!F || !P)) {
321
- if (ce && z < E) {
322
- const de = be(N((G - y.start) / 250));
323
- T.copy(re), _.copy(re).lerp(le, de), S.set(ee ? we[ee.type] : "#c7d2fe"), y.op === "write" && S.lerp(H, 0.6), S.multiplyScalar((y.op === "write" ? 3.2 : 2.2) * K), se(F, z, T, _, y.op === "write" ? 0.06 : 0.04, S) && z++;
324
- const he = N((G - y.start - 200) / 700);
325
- if (he > 0 && he < 1 && R < k) {
326
- const ye = be(he);
327
- y.op === "read" ? T.copy(le).lerp(re, ye) : T.copy(re).lerp(le, ye), C.position.copy(T), C.quaternion.identity(), C.scale.setScalar(1), C.updateMatrix(), P.setMatrixAt(R, C.matrix), S.set(ee ? we[ee.type] : "#ffffff").lerp(H, 0.5).multiplyScalar(4), P.setColorAt(R, S), R++;
328
- }
329
- }
330
- if (y.op === "write" && z < E) {
331
- const de = be(N((G - y.start) / 450));
332
- _.copy(le), _.y += 3 + 40 * de, S.setRGB(1.6, 1.7, 2.2).multiplyScalar(K * 1.6), se(F, z, le, _, 0.13, S) && z++;
333
- }
334
- }
335
- }
336
- F && (F.count = z, F.instanceMatrix.needsUpdate = !0, F.instanceColor && (F.instanceColor.needsUpdate = !0)), P && (P.count = R, P.instanceMatrix.needsUpdate = !0, P.instanceColor && (P.instanceColor.needsUpdate = !0));
337
- const X = v.current;
338
- if (X) {
339
- for (let y = 0; y < e; y++) {
340
- const x = B[y], V = g[y];
341
- S.copy(c[y]).multiplyScalar(0.9 + x * 5 + V * 3), V > 0 ? S.lerp(H, Math.min(1, V * 1.3)).multiplyScalar(1 + V * 4) : x > 0 && S.lerp(H, x * 0.25), X.setColorAt(y, S);
342
- const K = 1 + x * 1.2 + V * 2;
343
- C.position.copy(r[y].p), C.rotation.set(0, r[y].th, 0), C.scale.set(K, K, 1), C.updateMatrix(), X.setMatrixAt(y, C.matrix);
344
- }
345
- X.instanceMatrix.needsUpdate = !0, X.instanceColor && (X.instanceColor.needsUpdate = !0);
346
- }
347
- const Q = J.flares.length > 0;
348
- if (Q || oe.current) {
349
- const y = a.getAttribute("color"), x = y.array;
350
- for (let V = 0; V < f.length; V++) {
351
- const [K, ee] = f[V], ce = Math.max(B[K], g[K]), le = Math.max(B[ee], g[ee]), de = ce > 0 || le > 0;
352
- for (let he = 0; he < me; he++)
353
- for (let ye = 0; ye < 2; ye++) {
354
- const je = (he + ye) / me, ke = de ? ce * (1 - je) + le * je : 0, Ve = (V * me + he) * 6 + ye * 3;
355
- x[Ve] = I.r * 0.55 + ke * 2.2, x[Ve + 1] = I.g * 0.55 + ke * 2, x[Ve + 2] = I.b * 0.55 + ke * 2.6;
356
- }
357
- }
358
- y.needsUpdate = !0, oe.current = Q;
359
- }
360
- const ae = $.current;
361
- let w = 0;
362
- for (let y = J.flares.length - 1; y >= 0 && w < ze; y--) {
363
- const x = J.flares[y];
364
- if (G - x.start > 1600) break;
365
- let V = !1;
366
- for (let ce = 0; ce < w; ce++) ae[ce].node === x.node && (V = !0);
367
- if (V) continue;
368
- const K = W.current[w], ee = L.current[w];
369
- if (K && ee) {
370
- const ce = r[Z(x.node)].p;
371
- K.position.set(ce.x * 1.12, ce.y + 0.35, ce.z * 1.12);
372
- const le = `${x.node}|${x.op}`;
373
- if (ae[w].key !== le) {
374
- const de = J.instances.get(x.instance);
375
- ee.setText(x.op === "write" ? `wrote · ${x.node}` : x.node), ee.setColor(x.op === "write" ? "#ffffff" : de ? we[de.type] : "#c7d2fe"), ae[w].key = le;
376
- }
377
- ee.setOpacity(1 - N((G - x.start - 1100) / 500));
378
- }
379
- ae[w].node = x.node, w++;
380
- }
381
- for (let y = w; y < ze; y++) {
382
- const x = L.current[y];
383
- x == null || x.setOpacity(0), ae[y].node = "", ae[y].key = "";
384
- }
385
- const j = J.flares.length;
386
- p.current && p.current.material.color.setRGB(0.55, 0.45, 1.6).multiplyScalar(1.2 + Math.min(3, j * 0.35) + Math.sin(Y * 2) * 0.3), A.current && A.current.material.color.setRGB(0.9, 0.85, 2.4).multiplyScalar(1.5 + Math.min(4, j * 0.4) + Math.sin(Y * 3.1) * 0.4);
387
- });
388
- const D = i, U = l(() => new n.MeshBasicMaterial({ color: new n.Color("#6d5cff").multiplyScalar(1.6), toneMapped: !1 }), []);
389
- return /* @__PURE__ */ M("group", { children: [
390
- /* @__PURE__ */ M("mesh", { position: [0, D / 2, 0], children: [
391
- /* @__PURE__ */ o("cylinderGeometry", { args: [pe, pe, D, 40, 1] }),
392
- /* @__PURE__ */ o("meshStandardMaterial", { color: "#05060e", roughness: 0.3, metalness: 0.85 })
393
- ] }),
394
- [0.03, D].map((h, G) => /* @__PURE__ */ o("mesh", { position: [0, h, 0], rotation: [Math.PI / 2, 0, 0], material: U, children: /* @__PURE__ */ o("torusGeometry", { args: [pe + 0.1, 0.06, 8, 64] }) }, G)),
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__ */ M("instancedMesh", { ref: v, 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__ */ M("mesh", { position: [0, D + 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__ */ M("mesh", { ref: p, position: [0, D + 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__ */ M("mesh", { position: [0, D + 2.9, 0], children: [
409
- /* @__PURE__ */ o("cylinderGeometry", { args: [0.03, 0.06, 2, 6] }),
410
- /* @__PURE__ */ o("meshBasicMaterial", { color: "#4c4a7a" })
411
- ] }),
412
- /* @__PURE__ */ M("mesh", { ref: A, position: [0, D + 4.1, 0], children: [
413
- /* @__PURE__ */ o("sphereGeometry", { args: [0.28, 20, 20] }),
414
- /* @__PURE__ */ o("meshBasicMaterial", { toneMapped: !1 })
415
- ] }),
416
- /* @__PURE__ */ M("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__ */ M("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__ */ M("instancedMesh", { ref: m, 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: ze }, (h, G) => /* @__PURE__ */ o("group", { ref: (Y) => void (W.current[G] = Y), children: /* @__PURE__ */ o(qe, { ref: (Y) => void (L.current[G] = Y), text: "", size: 0.3, opacity: 0, pxRange: [8, 12], renderOrder: 22 }) }, G)),
429
- /* @__PURE__ */ o(Rt, { position: [0, D + 5.2, 0], color: "#8b7dff", letterSpacing: 0.06, glow: 1.1, size: 0.6, pxRange: [11, 16] })
430
- ] });
431
- }
432
- const oo = new n.Color(1, 1, 1), ot = new n.Vector3(0, 1, 0), _e = new n.Vector3(), Ce = new n.Vector3(), no = new n.Vector3(), nt = new n.Matrix4(), Ge = ["planner", "researcher", "writer"], Oe = new n.PlaneGeometry(1, 1).rotateX(-Math.PI / 2), ro = 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 pt(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 + Yt * s, e.v1 = e.av + 1.25 * s, e;
436
- }
437
- function so({ run: t, slot: e, gref: s }) {
438
- const r = l(
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
- ), i = b(null), c = l(() => new n.Color(), []);
446
- return ie(({ clock: f }) => {
447
- const a = st(t, e), v = f.elapsedTime, u = a === "running" ? 1.6 + Math.sin(v * (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), i.current && (i.current.visible = a === "running", r.col.color.copy(c).multiplyScalar(0.09 + 0.04 * Math.sin(v * 6)), i.current.rotation.y += 0.01);
449
- }), /* @__PURE__ */ M("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: i, position: [0, 4, 0], material: r.col, children: /* @__PURE__ */ o("cylinderGeometry", { args: [0.32, 0.55, 8, 16, 1, !0] }) })
455
- ] });
456
- }
457
- function ao(t) {
458
- const { shown: e, more: s } = Vt(t), r = e.map((i, c) => ({ text: `${c ? " · " : ""}${i.toUpperCase()}`, color: t.steps[i] === "queued" ? "#64748b" : Ne[t.steps[i]] }));
459
- return s && r.push({ text: ` · +${s}`, color: "#64748b" }), r;
460
- }
461
- function co({ run: t }) {
462
- const e = t.run ?? J.runs.get(t.id);
463
- return e ? /* @__PURE__ */ o(io, { kr: t, run: e }) : null;
464
- }
465
- function io({ kr: t, run: e }) {
466
- const s = l(() => new n.Color(e.color), [e.color]), r = l(() => new n.MeshBasicMaterial({ color: s, transparent: !0, opacity: 0.05, depthWrite: !1, toneMapped: !1 }), [s]), i = l(() => new n.LineBasicMaterial({ color: s.clone().multiplyScalar(1.6), transparent: !0, toneMapped: !1 }), [s]), c = l(() => new n.LineLoop(ro, i), [i]), f = b(null), a = b(null), v = b(null), u = b([]), m = b([]), p = l(() => [0, 1].map(() => new n.MeshBasicMaterial({ toneMapped: !1 })), []), A = b(null), W = b(null), L = b(null), $ = b(null), B = b(""), g = l(() => new n.Color(), []), d = l(() => ({ u0: 0, u1: 0, v0: 0, v1: 0, av: 0, init: !1 }), []), C = l(() => ({ u0: 0, u1: 0, v0: 0, v1: 0, av: 0 }), []);
467
- return ie((S, I) => {
468
- var F, P, z, R, X, Q, ae;
469
- const H = f.current;
470
- if (!H) return;
471
- _e.copy(t.side), Ce.copy(t.axis), no.crossVectors(_e, ot).dot(Ce) < 0 && Ce.negate(), nt.makeBasis(_e, ot, Ce), H.quaternion.setFromRotationMatrix(nt), H.position.copy(t.origin).addScaledVector(t.side, -t.cu).addScaledVector(t.axis, -t.cv);
472
- const T = Ce.dot(t.axis) < 0 ? -1 : 1;
473
- pt(t, C);
474
- const _ = d.init ? 1 - Math.exp(-Math.min(0.1, I) / 0.2) : 1;
475
- d.init = !0, d.u0 += (C.u0 - d.u0) * _, d.u1 += (C.u1 - d.u1) * _, d.v0 += (C.v0 - d.v0) * _, d.v1 += (C.v1 - d.v1) * _, d.av += (C.av - d.av) * _;
476
- const q = d.u1 - d.u0, ne = d.v1 - d.v0, O = (d.u0 + d.u1) / 2, re = (d.v0 + d.v1) / 2 * T, oe = d.av * T, E = Me.spread;
477
- (F = a.current) == null || F.position.set(O, 0.02, re), (P = a.current) == null || P.scale.set(q, 1, ne), c.position.set(O, 0.04, re), c.scale.set(q, 1, ne), (z = v.current) == null || z.position.set(O, 0.025, oe), (R = v.current) == null || R.scale.set(q - 0.4, 1, 1.7 * E), Ke.forEach((w) => {
478
- const j = u.current[w];
479
- j && (j.position.set(Se(Ge[w]), 0, oe), j.scale.setScalar(Math.max(0.6, E * 0.95)), j.visible = e.hasSteps);
480
- });
481
- for (let w = 0; w < 2; w++) {
482
- const j = m.current[w];
483
- if (!j) continue;
484
- const y = Se(Ge[w]), x = Se(Ge[w + 1]);
485
- j.position.set((y + x) / 2, 0.04, oe), j.scale.set(Math.max(0.01, Math.abs(x - y) - 1.9 * E), 1, 0.07), j.visible = e.hasSteps;
486
- }
487
- (X = L.current) == null || X.position.set(O, 0.3, (d.v1 + 0.6 * E) * T);
488
- const k = performance.now(), Z = N((k - e.startedAt) / 900), se = e.endedAt ? 1 - N((k - e.endedAt - (Ft - 1800)) / 1800) : 1, D = Z * se;
489
- r.opacity = 0.06 * D, i.opacity = D;
490
- for (let w = 0; w < 2; w++) {
491
- const y = st(e, w + 1) !== "queued";
492
- p[w].color.copy(s).multiplyScalar((y ? 1.6 : 0.25) * D);
493
- }
494
- const U = e.handoffAt ? (k - e.handoffAt) / 1300 : 2;
495
- if (A.current && (A.current.visible = U >= 0 && U < 1, A.current.visible)) {
496
- const w = Se(Ge[e.handoffFrom]), j = Se(Ge[e.handoffTo]), y = ve(U), x = w + (j - w) * y, V = w + (j - w) * ve(Math.max(0, U - 0.22));
497
- if (A.current.position.set(x, 0.18, oe + 0.3 * T), A.current.scale.setScalar(Math.max(0.6, E)), W.current) {
498
- const K = Math.max(0.05, Math.abs(x - V));
499
- W.current.scale.set(K / Math.max(0.6, E), 1, 1), W.current.position.x = (V - x) / 2 / Math.max(0.6, E), g.copy(s).lerp(oo, 0.2).multiplyScalar(3.2), W.current.material.color.copy(g);
500
- }
501
- }
502
- let h = 0, G = 0;
503
- J.instances.forEach((w) => {
504
- w.run === e.id && kt(w) && (h++, w.subagent && G++);
505
- });
506
- const Y = `${e.stepOrder.map((w) => e.steps[w]).join()}${h}${G}${e.status}`;
507
- if (Y !== B.current && $.current) {
508
- B.current = Y;
509
- const w = `${h} agents${G ? ` · fan-out ×${G}` : ""}${e.status !== "started" ? ` · ${e.status}` : ""}`;
510
- (Q = $.current) == null || Q.setText(
511
- [{ text: e.topic, color: "#f8fafc" }, { text: ` ${w}`, color: "#a5b4fc" }],
512
- e.hasSteps ? ao(e) : [{ text: e.status === "started" ? "district active" : "district closed", color: "#94a3b8" }]
513
- );
514
- }
515
- (ae = $.current) == null || ae.setOpacity(D);
516
- }), /* @__PURE__ */ M("group", { ref: f, children: [
517
- /* @__PURE__ */ o("mesh", { ref: a, geometry: Oe, material: r }),
518
- /* @__PURE__ */ o("primitive", { object: c }),
519
- /* @__PURE__ */ o("mesh", { ref: v, geometry: Oe, children: /* @__PURE__ */ o("meshBasicMaterial", { color: "#04050a", transparent: !0, opacity: 0.75, depthWrite: !1 }) }),
520
- [0, 1].map((S) => /* @__PURE__ */ o("mesh", { ref: (I) => void (m.current[S] = I), geometry: Oe, material: p[S] }, S)),
521
- Ke.map((S) => /* @__PURE__ */ o(so, { run: e, slot: S, gref: (I) => void (u.current[S] = I) }, S)),
522
- /* @__PURE__ */ M("group", { ref: A, visible: !1, children: [
523
- /* @__PURE__ */ M("mesh", { children: [
524
- /* @__PURE__ */ o("boxGeometry", { args: [0.42, 0.16, 0.26] }),
525
- /* @__PURE__ */ o("meshBasicMaterial", { color: new n.Color("#fff7d6").multiplyScalar(5), toneMapped: !1 })
526
- ] }),
527
- /* @__PURE__ */ M("mesh", { ref: W, children: [
528
- /* @__PURE__ */ o("boxGeometry", { args: [1, 0.06, 0.14] }),
529
- /* @__PURE__ */ o("meshBasicMaterial", { transparent: !0, blending: n.AdditiveBlending, depthWrite: !1, toneMapped: !1 })
530
- ] })
531
- ] }),
532
- /* @__PURE__ */ o("group", { ref: L, children: /* @__PURE__ */ o(
533
- qe,
534
- {
535
- ref: $,
536
- text: e.topic,
537
- secondary: "",
538
- plate: "box",
539
- textAlign: "left",
540
- color: e.color,
541
- letterSpacing: 0.02,
542
- size: 0.42,
543
- secondarySize: 0.3,
544
- maxWidth: 16,
545
- opacity: 0,
546
- fadeMs: 300,
547
- fit: !0,
548
- pxRange: [8.5, 14]
549
- }
550
- ) })
551
- ] });
552
- }
553
- const We = new n.Vector3(), ge = { u0: 0, u1: 0, v0: 0, v1: 0, av: 0 };
554
- function lo(t) {
555
- for (const e of te.runs.values())
556
- pt(e, ge), t(Ie(e, (ge.u0 + ge.u1) / 2, ge.v1 + 0.9 * Me.spread, We), 1.6), t(Ie(e, ge.u0, ge.av, We), 0.8), t(Ie(e, ge.u1, ge.av, We), 0.8);
557
- }
558
- const Be = new n.Vector3();
559
- function dt(t, e, s, r, i) {
560
- Be.copy(t).add(e).multiplyScalar(0.5), Be.y = Math.max(t.y, e.y) + r;
561
- const c = 1 - s;
562
- return i.set(
563
- c * c * t.x + 2 * c * s * Be.x + s * s * e.x,
564
- c * c * t.y + 2 * c * s * Be.y + s * s * e.y,
565
- c * c * t.z + 2 * c * s * Be.z + s * s * e.z
566
- );
567
- }
568
- function ht(t, e = () => !0) {
569
- const [s, r] = At([]), i = b("");
570
- return ie(() => {
571
- const c = !_t.grouped;
572
- let f = "";
573
- for (const a of t()) (c || e(a)) && (f += a.id + ",");
574
- f !== i.current && (i.current = f, r(c ? t().slice() : t().filter(e)));
575
- }), s;
576
- }
577
- function uo({ comet: t }) {
578
- const e = b(null), s = l(() => fe(t.from, new n.Vector3()) ?? new n.Vector3(), [t.from]), r = l(() => fe(t.to, new n.Vector3()) ?? new n.Vector3(), [t.to]), i = J.instances.get(t.from), c = i ? we[i.type] : "#ffffff";
579
- return ie(() => {
580
- const f = N((performance.now() - t.start) / t.dur);
581
- fe(t.from, s), fe(t.to, r), e.current && (dt(s, r, ve(f), 2.5 + s.distanceTo(r) * 0.25, e.current.position), e.current.scale.setScalar(f >= 1 ? 1e-3 : 1));
582
- }), /* @__PURE__ */ o(rt, { width: 1.6, length: 6, color: new n.Color(c).multiplyScalar(2.2), attenuation: (f) => f * f, decay: 1, children: /* @__PURE__ */ M("mesh", { ref: e, position: s, children: [
583
- /* @__PURE__ */ o("sphereGeometry", { args: [0.14, 12, 12] }),
584
- /* @__PURE__ */ o("meshBasicMaterial", { color: new n.Color(c).lerp(new n.Color("#fff"), 0.4).multiplyScalar(4), toneMapped: !1 })
585
- ] }) });
586
- }
587
- function fo() {
588
- const t = ht(() => J.comets, (e) => De(e.from) && De(e.to));
589
- return /* @__PURE__ */ o("group", { children: t.map((e) => /* @__PURE__ */ o(uo, { comet: e }, e.id)) });
590
- }
591
- function po(t, e) {
592
- const s = document.createElement("canvas");
593
- s.width = 512, s.height = 96;
594
- const r = s.getContext("2d");
595
- r.fillStyle = "#05030c", r.fillRect(0, 0, 512, 96), r.fillStyle = e, r.globalAlpha = 0.18;
596
- for (let a = 0; a < 512; a += 6) r.fillRect(a, 0, 2, 96);
597
- r.globalAlpha = 1, r.font = "700 46px ui-monospace, Menlo, monospace", r.textBaseline = "middle", r.shadowColor = e, r.shadowBlur = 12;
598
- const i = `${t.toUpperCase()} ◆ MCP ◆ `, c = r.measureText(i).width;
599
- for (let a = 8; a < 512 + c; a += c) r.fillText(i, a, 50);
600
- const f = new n.CanvasTexture(s);
601
- return f.wrapS = n.RepeatWrapping, f.colorSpace = n.SRGBColorSpace, f;
602
- }
603
- function ho({ mcp: t }) {
604
- const e = t.srv, s = b(null), r = b(null), i = b(null), c = b(null), f = b(null), a = l(() => po(e.name, e.color), [e.name, e.color]);
605
- Le(() => () => a.dispose(), [a]);
606
- const v = l(() => new n.Color(e.color), [e.color]), u = l(() => performance.now(), []), m = b(0);
607
- return ie(({ clock: p }, A) => {
608
- const W = performance.now(), L = p.elapsedTime, $ = Ye(e.name) + (ue ? 0 : Math.sin(L * 0.5 + e.slot) * 0.15), B = s.current;
609
- B && (B.position.set(t.pos.x, $, t.pos.z), B.rotation.y = (t.out.x < 0 ? Math.PI : 0) + (ue ? 0 : Math.sin(L * 0.23 + e.slot) * 0.08), B.scale.setScalar(lt * ve(N((W - u) / 1200))));
610
- const g = e.inflight > 0, d = Math.exp(-((W - e.activeAt) / 1e3) * 3);
611
- m.current += A * (g ? 6 : 0.6) * (ue ? 0.2 : 1), i.current && (i.current.rotation.y = m.current), r.current && (r.current.color.setScalar((g ? 2.6 : 1.3) + d * 2.5), ue || (a.offset.x += A * (g ? 0.25 : 0.06))), c.current && (c.current.scale.setScalar(1 + d * 0.5), c.current.material.color.copy(v).multiplyScalar(0.05 + (g ? 0.08 : 0) + d * 0.25)), f.current && f.current.material.color.copy(v).multiplyScalar((g ? 3 + Math.sin(L * 10) * 1.2 : 1.2) + d * 4);
612
- }), /* @__PURE__ */ M("group", { ref: s, scale: 0, children: [
613
- /* @__PURE__ */ M("mesh", { scale: [3.4, 1.05, 1.05], children: [
614
- /* @__PURE__ */ o("sphereGeometry", { args: [1, 32, 20] }),
615
- /* @__PURE__ */ o("meshStandardMaterial", { color: "#0d0f1c", roughness: 0.45, metalness: 0.6 })
616
- ] }),
617
- /* @__PURE__ */ M("mesh", { rotation: [0, 0, 0], scale: [3.42, 1.07, 1.07], children: [
618
- /* @__PURE__ */ o("torusGeometry", { args: [1, 0.012, 6, 64] }),
619
- /* @__PURE__ */ o("meshBasicMaterial", { color: v.clone().multiplyScalar(2), toneMapped: !1 })
620
- ] }),
621
- [1, -1].map((p) => /* @__PURE__ */ M("mesh", { position: [0, 0, p * 1.08], rotation: [0, p > 0 ? 0 : Math.PI, 0], children: [
622
- /* @__PURE__ */ o("planeGeometry", { args: [4.2, 0.85] }),
623
- /* @__PURE__ */ o("meshBasicMaterial", { ref: p > 0 ? r : void 0, map: a, toneMapped: !1 })
624
- ] }, p)),
625
- [0, Math.PI / 2, Math.PI, -Math.PI / 2].map((p) => /* @__PURE__ */ M("mesh", { position: [-3.1, 0, 0], rotation: [p, 0, 0], children: [
626
- /* @__PURE__ */ o("boxGeometry", { args: [0.8, 0.04, 1.3] }),
627
- /* @__PURE__ */ o("meshStandardMaterial", { color: "#141729", metalness: 0.6, roughness: 0.5 })
628
- ] }, p)),
629
- /* @__PURE__ */ M("mesh", { position: [0.3, -1.05, 0], children: [
630
- /* @__PURE__ */ o("boxGeometry", { args: [1.2, 0.3, 0.45] }),
631
- /* @__PURE__ */ o("meshStandardMaterial", { color: "#10121f", metalness: 0.6, roughness: 0.4 })
632
- ] }),
633
- /* @__PURE__ */ o("group", { ref: i, position: [0.3, -1.35, 0], children: /* @__PURE__ */ M("mesh", { rotation: [0, 0, Math.PI / 2.6], position: [0.25, -0.1, 0], children: [
634
- /* @__PURE__ */ o("coneGeometry", { args: [0.35, 0.18, 16, 1, !0] }),
635
- /* @__PURE__ */ o("meshBasicMaterial", { color: v.clone().multiplyScalar(1.6), wireframe: !0, toneMapped: !1 })
636
- ] }) }),
637
- /* @__PURE__ */ M("mesh", { ref: f, position: [0.3, -1.3, 0], children: [
638
- /* @__PURE__ */ o("sphereGeometry", { args: [0.1, 10, 10] }),
639
- /* @__PURE__ */ o("meshBasicMaterial", { toneMapped: !1 })
640
- ] }),
641
- /* @__PURE__ */ M("mesh", { ref: c, scale: [3.9, 1.6, 1.6], children: [
642
- /* @__PURE__ */ o("sphereGeometry", { args: [1, 24, 16] }),
643
- /* @__PURE__ */ o("meshBasicMaterial", { transparent: !0, blending: n.AdditiveBlending, depthWrite: !1, toneMapped: !1 })
644
- ] }),
645
- /* @__PURE__ */ o(qe, { position: [0, 1.7, 0], text: `mcp · ${e.name}`, font: "mono", color: e.color, size: 0.34, pxRange: [9, 13] })
646
- ] });
647
- }
648
- function mo({ call: t }) {
649
- var u;
650
- const e = b(null), s = l(() => new n.Vector3(), []), r = l(() => new n.Vector3(), []), i = ((u = J.mcpServers.get(t.server)) == null ? void 0 : u.color) ?? "#ffffff", c = l(() => {
651
- const m = new n.Vector3(0, -50, 0);
652
- return (t.phase === "call" ? fe(t.instance, m) : Ue(t.server, m)) ?? m.set(0, -50, 0);
653
- }, [t]), f = l(() => new n.Vector3(), []), a = l(() => new n.Vector3(), []);
654
- ie(() => {
655
- const m = N((performance.now() - t.start) / t.dur), p = fe(t.instance, f), A = Ue(t.server, a);
656
- !p || !A || !e.current || (t.phase === "call" ? (s.copy(p), r.copy(A)) : (s.copy(A), r.copy(p)), dt(s, r, ve(m), 3, e.current.position), e.current.rotation.y += 0.2, e.current.scale.setScalar(m >= 1 ? 1e-3 : 1));
657
- });
658
- const v = new n.Color(i);
659
- return t.phase === "result" && v.lerp(new n.Color("#ffffff"), 0.45), /* @__PURE__ */ o(rt, { width: 1.3, length: 5, color: v.clone().multiplyScalar(2), attenuation: (m) => m * m, children: /* @__PURE__ */ M("mesh", { ref: e, position: c, children: [
660
- /* @__PURE__ */ o("octahedronGeometry", { args: [0.16, 0] }),
661
- /* @__PURE__ */ o("meshBasicMaterial", { color: v.clone().multiplyScalar(4), toneMapped: !1 })
662
- ] }) });
663
- }
664
- function go() {
665
- const t = ht(() => J.mcpCalls, (e) => De(e.instance));
666
- return /* @__PURE__ */ o("group", { children: t.map((e) => /* @__PURE__ */ o(mo, { call: e }, e.id)) });
667
- }
668
- const yo = new n.Color("#fbbf24"), Mo = new n.Color("#ff2d3d");
669
- function vo() {
670
- const s = l(() => {
671
- const u = new n.BufferGeometry();
672
- return u.setAttribute("position", new n.BufferAttribute(new Float32Array(5760), 3)), u.setAttribute("color", new n.BufferAttribute(new Float32Array(5760), 3)), u;
673
- }, []), r = l(() => new n.Vector3(), []), i = l(() => new n.Vector3(), []), c = l(() => new n.Vector3(), []), f = l(() => new n.Color(), []), a = l(() => new n.Color(), []), v = (u, m) => (m.copy(r).lerp(i, u), m.y -= Math.sin(u * Math.PI) * 1.2, m);
674
- return ie(({ clock: u }) => {
675
- const m = s.getAttribute("position"), p = s.getAttribute("color"), A = performance.now(), W = ue ? 0 : u.elapsedTime;
676
- let L = 0;
677
- const $ = (B, g, d, C, S) => {
678
- const I = J.mcpServers.get(g);
679
- if (!I || L >= 960 || !fe(B, r) || !Ue(g, i)) return;
680
- f.set(I.color), C > 0.8 && f.lerp(yo, N((C - 0.8) / 1)), C > 1.8 && f.lerp(Mo, N((C - 1.8) / 0.8));
681
- const H = d === "pending" ? ve(N((A - S) / 350)) : 1, T = d === "resolved" ? (A - S) / 700 : 0;
682
- for (let _ = 0; _ < 40 && L < 960; _++, L++) {
683
- const q = _ / 40 * H, ne = (_ + 1) / 40 * H;
684
- v(q, c), m.setXYZ(L * 2, c.x, c.y, c.z), v(ne, c), m.setXYZ(L * 2 + 1, c.x, c.y, c.z);
685
- for (let O = 0; O < 2; O++) {
686
- const re = O ? ne : q;
687
- let oe;
688
- if (d === "pending") {
689
- const E = Math.pow(0.5 + 0.5 * Math.sin(re * 46 - W * 9), 6);
690
- oe = (0.25 + 0.2 * Math.min(3, C)) * (0.35 + 1.6 * E), a.copy(f).multiplyScalar(oe);
691
- } else {
692
- const E = 1 - N(T / 0.55), k = Math.exp(-Math.pow((re - E) * 9, 2)) * 5 * (1 - N((T - 0.55) / 0.3));
693
- oe = 0.35 * (1 - N(T / 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;
694
- }
695
- p.setXYZ(L * 2 + O, a.r, a.g, a.b);
696
- }
697
- }
698
- };
699
- J.mcpPending.forEach((B) => $(B.instance, B.server, "pending", It(B, A), B.since));
700
- for (const B of J.mcpResolved) $(B.instance, B.server, "resolved", 0, B.resolvedAt);
701
- s.setDrawRange(0, L * 2), m.needsUpdate = !0, p.needsUpdate = !0;
702
- }), /* @__PURE__ */ o("lineSegments", { geometry: s, frustumCulled: !1, children: /* @__PURE__ */ o("lineBasicMaterial", { vertexColors: !0, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) });
703
- }
704
- function wo({ agent: t, selected: e, onSelect: s }) {
705
- const r = t.inst, i = t.run.color, c = l(() => Zt(r, t.depth === 0 ? t.sib : 0), [r, t]), f = we[r.type], { h: a, w: v, d: u } = c, m = l(() => new n.BoxGeometry(v, a, u).translate(0, a / 2, 0), [v, a, u]), p = l(() => {
706
- const E = [], k = v / 2 + 0.04, Z = u / 2 + 0.04, se = (U) => {
707
- const h = [[-k, -Z], [k, -Z], [k, Z], [-k, Z]];
708
- for (let G = 0; G < 4; G++) E.push(h[G][0], U, h[G][1], h[(G + 1) % 4][0], U, h[(G + 1) % 4][1]);
709
- };
710
- for (let U = 0; U <= a + 1e-3; U += 0.92) se(U);
711
- se(a);
712
- for (const [U, h] of [[-k, -Z], [k, -Z], [k, Z], [-k, Z]]) E.push(U, 0, h, U, a, h);
713
- for (const [U, h] of [[-k, -Z], [k, Z]]) E.push(U, 0, h, -U, a, -h);
714
- const D = new n.BufferGeometry();
715
- return D.setAttribute("position", new n.Float32BufferAttribute(E, 3)), D;
716
- }, [v, a, u]), A = l(() => {
717
- const E = ct({ color: f, edge: i });
718
- return E.uniforms.uHalf.value.set(v / 2, u / 2), E.uniforms.uH.value = a, E.uniforms.uLit.value = 0.2, E;
719
- }, [f, i, v, u, a]);
720
- Le(() => () => (m.dispose(), p.dispose(), A.dispose()), [m, p, A]);
721
- const W = b(null), L = b(null), $ = b(null), B = b(null), g = b(null), d = b(null), C = b(null), S = l(() => new n.Color(f), [f]), I = l(() => new n.Color("#ffffff"), []), H = l(() => new n.Color("#ff3344"), []), T = l(() => new n.Color("#fbbf24"), []), _ = l(() => new n.Color(), []), q = b(0.2), ne = b(0);
722
- Le(() => () => void Fe.delete(r.id), [r.id]);
723
- const O = b(null);
724
- return ie(({ clock: E }, k) => {
725
- const Z = performance.now(), se = E.elapsedTime, D = (Z - r.bornAt) / 1e3, U = Me.scale;
726
- O.current && (O.current.position.copy(t.live), O.current.scale.x !== U && O.current.scale.setScalar(U));
727
- const h = r.exitAt ? (Z - r.exitAt) / 1e3 * (2500 / Ot(r)) : -1, G = be(N((D - 0.25) / 1.25)), Y = h >= 0 ? ve(N((h - 0.8) / 1.5)) : 0, F = -a * (1 - G) - (a + 0.4) * Y;
728
- W.current && (W.current.position.y = F);
729
- const P = D < 0.25 ? D / 0.25 : 1 - N((D - 1.1) / 0.7);
730
- L.current && (L.current.visible = P > 0.01, L.current.material.color.copy(S).multiplyScalar(P * (2.2 + Math.sin(se * 30) * 0.6)));
731
- let z = !1;
732
- for (const V of J.mcpPending.values()) V.instance === r.id && (z = !0);
733
- const R = r.status === "thinking" && !z, X = r.status === "waiting" || z, Q = at(r, Z), ae = R ? 0.8 : z ? 0.22 + 0.12 * Math.sin(se * 2.4) : X ? 0.12 : r.exitAt ? 0.85 : 0.45;
734
- q.current += (ae - q.current) * Math.min(1, k * 3);
735
- const w = A.uniforms;
736
- w.uTime.value = ue ? 0 : se, w.uLit.value = q.current, w.uWork.value = R && !ue ? 1 : 0, w.uEnergy.value = Math.min(1.6, Q), w.uCascade.value = h >= 0 ? N(h / 0.9) : 0, w.uScaffold.value = D < 1.6 ? Math.max(0, P) * (1 - G * 0.6) : 0, w.uEdgeAmt.value = (0.55 + Q * 0.8) * (h >= 0 ? 1 - N(h / 1.2) * 0.8 : 1);
737
- const j = a + F, y = R ? 0.5 + 0.5 * Math.sin(se * 7) : z ? 0.5 + 0.5 * Math.sin(se * 2.4) : X ? 0.5 + 0.5 * Math.sin(se * 1.3) : 0.6, x = h >= 0 ? Math.max(0, 1 - h / 0.5) : 0;
738
- if ($.current) {
739
- $.current.position.y = j + 0.75;
740
- const V = (X ? 0.6 + y * 0.8 : 1.4 + y * 2.6) + Q * 4 + x * 8;
741
- _.copy(S).lerp(z ? T : S, z ? 0.6 : 0).lerp(r.status === "failed" ? H : I, x * 0.8 + Math.min(0.5, Q * 0.25)).multiplyScalar(h >= 0 ? V * (1 - N((h - 0.5) / 0.5)) : V), $.current.material.color.copy(_), $.current.scale.setScalar(1 + Q * 0.6 + x * 2.5);
742
- }
743
- if (B.current && (B.current.position.y = j + 0.75, B.current.scale.setScalar(0.8 + y * (R ? 0.6 : 0.2) + Math.min(1.2, Q * 0.8) + x * 3), B.current.material.color.copy(S).multiplyScalar((R ? 0.22 : 0.08) + Math.min(0.3, Q * 0.15) + x * 0.5)), ne.current += ((R && h < 0 ? 1 : 0) - ne.current) * Math.min(1, k * 4), g.current && (g.current.visible = ne.current > 0.02, g.current.position.y = j + 1.6, g.current.scale.setScalar(ne.current * (1 + Q * 0.25)), g.current.rotation.y += k * (ue ? 0.3 : 1.8)), d.current) {
744
- const V = d.current.material, K = D / 0.9, ee = h >= 0 ? h / 1.1 : -1;
745
- ee >= 0 && ee < 1 ? (d.current.visible = !0, d.current.scale.setScalar(1 + ee * 6), V.color.copy(r.status === "failed" ? H : S).lerp(I, 0.4).multiplyScalar(2.5 * (1 - ee))) : K < 1 ? (d.current.visible = !0, d.current.scale.setScalar(0.5 + be(K) * 3), V.color.copy(S).multiplyScalar(3 * (1 - K))) : d.current.visible = !1;
746
- }
747
- C.current && (C.current.visible = e, C.current.visible && (C.current.rotation.z += k * 1.2)), Fe.set(r.id, Math.max(0.3, (j + 0.75) * U));
748
- }), /* @__PURE__ */ M("group", { ref: O, children: [
749
- /* @__PURE__ */ M("group", { ref: W, children: [
750
- /* @__PURE__ */ o("mesh", { geometry: m, material: A, onClick: (E) => (E.stopPropagation(), s(r.id)), onPointerOver: () => document.body.style.cursor = "pointer", onPointerOut: () => document.body.style.cursor = "" }),
751
- /* @__PURE__ */ M("mesh", { position: [0, a + 0.35, 0], children: [
752
- /* @__PURE__ */ o("cylinderGeometry", { args: [0.03, 0.05, 0.7, 6] }),
753
- /* @__PURE__ */ o("meshBasicMaterial", { color: "#1e2433" })
754
- ] })
755
- ] }),
756
- /* @__PURE__ */ o("lineSegments", { ref: L, geometry: p, children: /* @__PURE__ */ o("lineBasicMaterial", { transparent: !0, blending: n.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) }),
757
- /* @__PURE__ */ M("mesh", { ref: $, children: [
758
- /* @__PURE__ */ o("sphereGeometry", { args: [0.13, 14, 14] }),
759
- /* @__PURE__ */ o("meshBasicMaterial", { toneMapped: !1 })
760
- ] }),
761
- /* @__PURE__ */ M("mesh", { ref: B, children: [
762
- /* @__PURE__ */ o("sphereGeometry", { args: [0.32, 16, 16] }),
763
- /* @__PURE__ */ o("meshBasicMaterial", { transparent: !0, blending: n.AdditiveBlending, depthWrite: !1, toneMapped: !1 })
764
- ] }),
765
- /* @__PURE__ */ M("group", { ref: g, children: [
766
- /* @__PURE__ */ M("mesh", { rotation: [Math.PI / 2, 0, 0], children: [
767
- /* @__PURE__ */ o("torusGeometry", { args: [Math.max(0.55, v * 0.42), 0.025, 6, 48] }),
768
- /* @__PURE__ */ o("meshBasicMaterial", { color: S.clone().multiplyScalar(2.6), toneMapped: !1 })
769
- ] }),
770
- /* @__PURE__ */ M("mesh", { children: [
771
- /* @__PURE__ */ o("octahedronGeometry", { args: [0.32, 0] }),
772
- /* @__PURE__ */ o("meshBasicMaterial", { color: S.clone().multiplyScalar(2), wireframe: !0, toneMapped: !1 })
773
- ] }),
774
- /* @__PURE__ */ M("mesh", { position: [0, 0, Math.max(0.55, v * 0.42)], children: [
775
- /* @__PURE__ */ o("planeGeometry", { args: [0.7, 0.26] }),
776
- /* @__PURE__ */ o("meshBasicMaterial", { color: S.clone().multiplyScalar(1.3), transparent: !0, opacity: 0.55, side: n.DoubleSide, blending: n.AdditiveBlending, depthWrite: !1, toneMapped: !1 })
777
- ] })
778
- ] }),
779
- /* @__PURE__ */ M("mesh", { ref: d, rotation: [-Math.PI / 2, 0, 0], position: [0, 0.05, 0], children: [
780
- /* @__PURE__ */ o("ringGeometry", { args: [Math.max(v, u) * 0.62, Math.max(v, u) * 0.72, 48] }),
781
- /* @__PURE__ */ o("meshBasicMaterial", { transparent: !0, blending: n.AdditiveBlending, depthWrite: !1, toneMapped: !1 })
782
- ] }),
783
- /* @__PURE__ */ M("mesh", { ref: C, rotation: [-Math.PI / 2, 0, 0], position: [0, 0.07, 0], visible: !1, children: [
784
- /* @__PURE__ */ o("ringGeometry", { args: [Math.max(v, u) * 0.85, Math.max(v, u) * 0.95, 6] }),
785
- /* @__PURE__ */ o("meshBasicMaterial", { color: new n.Color("#e0f2fe").multiplyScalar(2.5), toneMapped: !1 })
786
- ] })
787
- ] });
788
- }
789
- function xo() {
790
- const s = l(() => {
791
- const u = new n.BufferGeometry();
792
- return u.setAttribute("position", new n.BufferAttribute(new Float32Array(2400), 3)), u.setAttribute("color", new n.BufferAttribute(new Float32Array(2400), 3)), u;
793
- }, []), r = l(() => new n.Vector3(), []), i = l(() => new n.Vector3(), []), c = l(() => new n.Vector3(), []), f = l(() => new n.Vector3(), []), a = l(() => new n.Color(), []), v = (u, m) => {
794
- const p = 1 - u;
795
- return m.set(p * p * r.x + 2 * p * u * c.x + u * u * i.x, p * p * r.y + 2 * p * u * c.y + u * u * i.y, p * p * r.z + 2 * p * u * c.z + u * u * i.z);
796
- };
797
- return ie(() => {
798
- const u = s.getAttribute("position"), m = s.getAttribute("color"), p = performance.now();
799
- let A = 0;
800
- for (const W of te.agents.values()) {
801
- const L = W.inst;
802
- if (!L.parent || A >= 400 || !fe(L.parent, r) || !fe(L.id, i)) continue;
803
- const $ = Wt(L, p);
804
- if ($ < 0.02) continue;
805
- const B = N((p - L.bornAt) / 650);
806
- c.copy(r).add(i).multiplyScalar(0.5), c.y = Math.max(r.y, i.y) + 1.2 + r.distanceTo(i) * 0.12;
807
- const g = be(B), d = 1 - B, S = (L.type === "graph_scout" || L.type === "records_scout" ? 0.9 : 0.45) * $ + d * 2.5 + at(L, p) * 0.4;
808
- a.set(we[L.type]);
809
- for (let I = 0; I < 10 && A < 400; I++, A++) {
810
- const H = I / 10 * g, T = (I + 1) / 10 * g;
811
- v(H, f), u.setXYZ(A * 2, f.x, f.y, f.z), v(T, f), u.setXYZ(A * 2 + 1, f.x, f.y, f.z);
812
- const _ = S * (0.35 + 0.65 * (I / 10)), q = S * (0.35 + 0.65 * ((I + 1) / 10));
813
- m.setXYZ(A * 2, a.r * _, a.g * _, a.b * _), m.setXYZ(A * 2 + 1, a.r * q, a.g * q, a.b * q);
814
- }
815
- }
816
- s.setDrawRange(0, A * 2), u.needsUpdate = !0, m.needsUpdate = !0;
817
- }), /* @__PURE__ */ o("lineSegments", { geometry: s, frustumCulled: !1, children: /* @__PURE__ */ o("lineBasicMaterial", { vertexColors: !0, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) });
818
- }
819
- const Re = new n.Vector3();
820
- function bo(t) {
821
- for (const e of te.agents.values()) t(Re.set(e.target.x, Fe.get(e.id) ?? 0, e.target.z), 0.9);
822
- lo(t);
823
- for (const e of Ut()) t(Re.copy(te.clusterTarget[e]).setY(1), 4.4);
824
- for (const e of te.mcp.values()) t(Re.set(e.target.x, Ye(e.name), e.target.z), 3.4 * lt + 0.6);
825
- if (te.graphWanted) {
826
- const e = te.graph;
827
- t(Re.set(e.target.x, eo(200) * (e.radius / ut), e.target.z), 2.4);
828
- }
829
- }
830
- function So() {
831
- const t = vt((e) => e.scene);
832
- return ie(() => {
833
- const e = Me.cam.dist || 40, s = Math.max(30, e * 0.68), r = Math.max(100, e * 2.2);
834
- Te.near.value = s, Te.far.value = r;
835
- const i = t.fog;
836
- i && (i.near = s, i.far = r);
837
- }), null;
838
- }
839
- const Ao = /* @__PURE__ */ M(mt, { children: [
840
- /* @__PURE__ */ o("fog", { attach: "fog", args: [xe.color, xe.near, xe.far] }),
841
- /* @__PURE__ */ o(So, {}),
842
- /* @__PURE__ */ o("ambientLight", { intensity: 0.35, color: "#8a7dff" }),
843
- /* @__PURE__ */ o("pointLight", { position: [0, 24, 0], intensity: 180, distance: 60, color: "#7c6cff" }),
844
- /* @__PURE__ */ o("pointLight", { position: [30, 10, -20], intensity: 90, distance: 60, color: "#ff2d95" }),
845
- /* @__PURE__ */ o(Mt, { radius: 160, depth: 60, count: ue ? 800 : 2200, factor: 4, saturation: 0.3, fade: !0, speed: 0 }),
846
- /* @__PURE__ */ o(Ht, {}),
847
- /* @__PURE__ */ o(qt, {})
848
- ] });
849
- function zo() {
850
- return /* @__PURE__ */ M(
851
- Dt,
852
- {
853
- title: "city",
854
- subtitle: "night city · agents rise as skyscrapers · districts = Hatchet runs · spire = knowledge graph · blimps = MCP",
855
- className: "city-root",
856
- preset: jt,
857
- plane: "xz",
858
- camera: { position: [14, 30, 40], fov: 45, near: 0.5, far: 400 },
859
- target: [0, 1.5, 0],
860
- controls: { minPolarAngle: 0.35, maxPolarAngle: 1.32 },
861
- bg: "#05040d",
862
- gl: { powerPreference: "high-performance" },
863
- fit: { nRef: 4, min: 0.62, max: 1.3, minRadius: 7 },
864
- agentRadius: 1.4,
865
- graph: { natural: ut, radius: 2.8 },
866
- peripheryGap: 6.5,
867
- Background: Ao,
868
- Agent: wo,
869
- RunMarker: co,
870
- McpServer: ho,
871
- GraphResource: to,
872
- cluster: { radius: 1.9, variant: "swarm", pointSize: 1.05 },
873
- clusterOffset: [0, 1.9, 0],
874
- extents: bo,
875
- PostFX: /* @__PURE__ */ M(wt, { multisampling: 0, children: [
876
- /* @__PURE__ */ o(xt, { mipmapBlur: !0, intensity: 1.25, luminanceThreshold: 0.22, luminanceSmoothing: 0.25, radius: 0.78 }),
877
- /* @__PURE__ */ o(bt, { eskil: !1, offset: 0.22, darkness: 0.85 }),
878
- /* @__PURE__ */ o(St, { opacity: 0.035 })
879
- ] }),
880
- children: [
881
- /* @__PURE__ */ o(xo, {}),
882
- /* @__PURE__ */ o(fo, {}),
883
- /* @__PURE__ */ o(go, {}),
884
- /* @__PURE__ */ o(vo, {})
885
- ]
886
- }
887
- );
888
- }
889
- export {
890
- zo as default
891
- };