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,767 +0,0 @@
1
- var Ce = Object.defineProperty;
2
- var Be = (t, e, l) => e in t ? Ce(t, e, { enumerable: !0, configurable: !0, writable: !0, value: l }) : t[e] = l;
3
- var gt = (t, e, l) => Be(t, typeof e != "symbol" ? e + "" : e, l);
4
- import { jsxs as U, jsx as o, Fragment as Qt } from "react/jsx-runtime";
5
- import { useFrame as ft, useThree as Ge } from "@react-three/fiber";
6
- import { EffectComposer as Pe, Bloom as Re, Vignette as _e, Noise as Ee } from "@react-three/postprocessing";
7
- import * as s from "three";
8
- import { useRef as z, useMemo as D, useLayoutEffect as he } from "react";
9
- import { f as it, v as Rt, i as Te, y as Ie, K as Jt, w as H, L as Et, G as Le, q as Oe, T as yt, a as ut, r as Q, p as Ft, e as Ve, l as We, n as st, S as te, z as Bt, j as Ne, A as Ue, R as De, k as $e, x as Fe, d as je, m as Ke, E as Xe } from "./KitScene-DG_pcnWW.js";
10
- import { RoundedBoxGeometry as qe } from "three/examples/jsm/geometries/RoundedBoxGeometry.js";
11
- const ke = -1.9, vt = () => ke * it.spread;
12
- function Yt(t, e) {
13
- return e.u0 = t.cu - t.hu - 1.2 * it.spread, e.u1 = t.cu + t.hu + 1 * it.spread, e;
14
- }
15
- function Mt(t, e, l) {
16
- return Rt(t, e, vt(), l), l.y = 0, l;
17
- }
18
- const me = 200, ot = 16, jt = 1, _t = 1.3, He = Math.ceil(me / ot), Zt = -15 / 2, Kt = -((He - 1) * _t) / 2, ge = -Zt + 1.3, Qe = 10.5, Me = (t, e) => (e.x = Zt + t % ot * jt, e.z = Kt + Math.floor(t / ot) * _t, e), Ye = new s.Vector3(), Tt = new s.Vector3();
19
- function ee(t, e, l) {
20
- return Ie(Ye.set(t, 0, e), Tt), l.x = Tt.x, l.z = Tt.z, l;
21
- }
22
- const xe = (t) => Te(t.type) || t.subagent, Ze = (t) => it.scale * (xe(t) ? 1 : 1.45), ne = /* @__PURE__ */ new Map();
23
- function Z(t) {
24
- let e = ne.get(t);
25
- return e || ne.set(t, e = new s.Color(t)), e;
26
- }
27
- class Je {
28
- constructor() {
29
- gt(this, "x", new Float32Array(8));
30
- gt(this, "z", new Float32Array(8));
31
- gt(this, "l", new Float32Array(8));
32
- gt(this, "n", 0);
33
- }
34
- begin() {
35
- return this.n = 0, this;
36
- }
37
- pt(e, l) {
38
- const i = this.n;
39
- return this.x[i] = e, this.z[i] = l, this.l[i] = i ? this.l[i - 1] + Math.hypot(e - this.x[i - 1], l - this.z[i - 1]) : 0, this.n++, this;
40
- }
41
- get len() {
42
- return this.n ? this.l[this.n - 1] : 0;
43
- }
44
- /** point at fraction s (0..1); writes out.x/out.z and returns segment direction angle */
45
- at(e, l) {
46
- const i = Math.max(0, Math.min(1, e)) * this.len;
47
- for (let d = 0; d < this.n - 1; d++)
48
- if (i <= this.l[d + 1] || d === this.n - 2) {
49
- const h = this.l[d + 1] - this.l[d] || 1, x = Math.min(1, (i - this.l[d]) / h);
50
- return l.x = this.x[d] + (this.x[d + 1] - this.x[d]) * x, l.z = this.z[d] + (this.z[d + 1] - this.z[d]) * x, Math.atan2(this.z[d + 1] - this.z[d], this.x[d + 1] - this.x[d]);
51
- }
52
- return l.x = this.x[0], l.z = this.z[0], 0;
53
- }
54
- }
55
- const dt = (t) => t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2, ye = (t) => 1 - Math.pow(1 - t, 3), X = (t) => t < 0 ? 0 : t > 1 ? 1 : t;
56
- let At = null;
57
- function Xt() {
58
- if (At) return At;
59
- const t = document.createElement("canvas");
60
- t.width = t.height = 128;
61
- const e = t.getContext("2d"), l = e.createRadialGradient(64, 64, 0, 64, 64, 64);
62
- return l.addColorStop(0, "rgba(255,255,255,1)"), l.addColorStop(0.25, "rgba(255,255,255,0.45)"), l.addColorStop(0.6, "rgba(255,255,255,0.08)"), l.addColorStop(1, "rgba(255,255,255,0)"), e.fillStyle = l, e.fillRect(0, 0, 128, 128), At = new s.CanvasTexture(t), At;
63
- }
64
- let zt = null;
65
- function tn() {
66
- if (zt) return zt;
67
- const t = document.createElement("canvas");
68
- t.width = t.height = 128;
69
- const e = t.getContext("2d");
70
- e.strokeStyle = "#fff", e.lineWidth = 5, e.strokeRect(8, 8, 112, 112), e.lineWidth = 3, e.strokeRect(40, 40, 48, 48), e.fillStyle = "rgba(255,255,255,0.55)", e.fillRect(52, 52, 24, 24), e.lineWidth = 2, e.globalAlpha = 0.7;
71
- for (let l = 0; l < 4; l++) {
72
- const i = 48 + l * 10;
73
- e.beginPath(), e.moveTo(i, 40), e.lineTo(i, 18), e.moveTo(i, 88), e.lineTo(i, 110), e.moveTo(40, i), e.lineTo(18, i), e.moveTo(88, i), e.lineTo(110, i), e.stroke();
74
- }
75
- return zt = new s.CanvasTexture(t), zt;
76
- }
77
- const bt = 650, be = (t) => Math.min(me, t.nodes.length), oe = /* @__PURE__ */ new Map();
78
- function qt(t, e) {
79
- let l = oe.get(e);
80
- return l === void 0 && oe.set(e, l = Oe(t, e) % be(t)), l;
81
- }
82
- const se = 24, en = 120, lt = 10, Ct = 2;
83
- function nn({ galaxy: t }) {
84
- const e = z(null), l = z(null), i = z(null), d = z([]), h = z([]), x = z(Array(Ct).fill(-1)), M = be(t), O = Math.ceil(M / ot), R = D(() => t.nodes.slice(0, M).map((p) => new s.Color(Jt[p.kind] ?? "#94a3b8")), [t, M]), S = D(() => Array.from({ length: M }, (p, u) => Me(u, { x: 0, z: 0 })), [M]), m = D(() => new Float32Array(M), [M]), b = D(() => new Float32Array(M), [M]), y = D(() => new s.Object3D(), []), L = D(() => new s.Color(), []), G = D(() => new s.Color(1, 1, 1), []), g = D(() => {
85
- const p = new Map(t.nodes.map((C, v) => [C.id, v % M])), u = /* @__PURE__ */ new Set(), f = [];
86
- for (const C of t.links) {
87
- const v = p.get(C.source), B = p.get(C.target);
88
- if (v === void 0 || B === void 0 || v === B || Math.hypot(v % ot - B % ot, Math.floor(v / ot) - Math.floor(B / ot)) > 5) continue;
89
- const A = v < B ? `${v}-${B}` : `${B}-${v}`;
90
- if (!u.has(A) && (u.add(A), f.push([v, B]), f.length >= en))
91
- break;
92
- }
93
- return f;
94
- }, [t, M]), V = D(() => {
95
- const p = new s.BufferGeometry(), u = new Float32Array(g.length * lt * 6);
96
- let f = 0;
97
- for (const [C, v] of g) {
98
- const B = S[C], A = S[v], w = 0.3 + Math.hypot(A.x - B.x, A.z - B.z) * 0.1;
99
- for (let P = 0; P < lt; P++)
100
- for (const _ of [P / lt, (P + 1) / lt])
101
- u[f++] = B.x + (A.x - B.x) * _, u[f++] = 0.25 + 4 * w * _ * (1 - _), u[f++] = B.z + (A.z - B.z) * _;
102
- }
103
- return p.setAttribute("position", new s.BufferAttribute(u, 3)), p.setAttribute("color", new s.BufferAttribute(new Float32Array(u.length), 3)), p;
104
- }, [g, S]);
105
- ft(() => {
106
- const p = e.current, u = l.current, f = i.current;
107
- if (!p || !u || !f) return;
108
- const C = performance.now();
109
- m.fill(0), b.fill(0);
110
- let v = 0;
111
- for (const w of H.flares) {
112
- const P = C - w.start - bt;
113
- if (P < 0) continue;
114
- const _ = qt(t, w.node), W = P / 1e3, K = Math.exp(-W * 1.5);
115
- if (w.op === "read") m[_] = Math.max(m[_], K);
116
- else if (b[_] = Math.max(b[_], K * 1.4), m[_] = Math.max(m[_], K), W < 1.3) {
117
- const T = W * 10, I = 1 - W / 1.3, N = S[_];
118
- for (let F = 0; F < M; F++) {
119
- const J = Math.hypot(S[F].x - N.x, (S[F].z - N.z) * 0.8), et = Math.exp(-(J - T) * (J - T) * 1.2) * I * 0.38;
120
- et > b[F] && (b[F] = et);
121
- }
122
- v < se && (y.position.set(N.x, 0.06, N.z), y.rotation.set(-Math.PI / 2, 0, 0), y.scale.setScalar(0.4 + T), y.updateMatrix(), f.setMatrixAt(v, y.matrix), L.set(1, 1, 1).multiplyScalar(0.9 * I * I), f.setColorAt(v++, L));
123
- }
124
- }
125
- for (let w = 0; w < M; w++) {
126
- const P = m[w], _ = b[w];
127
- y.position.set(S[w].x, 0.1 + P * 0.35 + _ * 0.2, S[w].z), y.rotation.set(0, 0, 0), y.scale.set(0.74, 0.2 + P * 0.7 + _ * 0.3, 1.25), y.updateMatrix(), p.setMatrixAt(w, y.matrix), L.copy(R[w]).multiplyScalar(0.06 + P * 4.5), _ > 0.01 && L.lerp(G, Math.min(1, _ * 0.7)).multiplyScalar(1 + _ * 2.5), p.setColorAt(w, L), y.position.set(S[w].x - 0.22, 0.22 + P * 0.7 + _ * 0.35, S[w].z + 0.45), y.scale.setScalar(1), y.updateMatrix(), u.setMatrixAt(w, y.matrix), L.copy(R[w]).multiplyScalar(0.45 + P * 5), u.setColorAt(w, L);
128
- }
129
- const B = V.getAttribute("color"), A = B.array;
130
- for (let w = 0; w < g.length; w++) {
131
- const [P, _] = g[w], W = Math.max(m[P], m[_]), K = Math.max(b[P], b[_]);
132
- L.setRGB(0.05, 0.2, 0.28), W > 0.02 && L.lerp(R[m[P] > m[_] ? P : _], Math.min(1, W)).multiplyScalar(1 + W * 4), K > 0.05 && L.lerp(G, Math.min(1, K)).multiplyScalar(1 + K * 2);
133
- const T = w * lt * 6;
134
- for (let I = 0; I < lt * 2; I++)
135
- A[T + I * 3] = L.r, A[T + I * 3 + 1] = L.g, A[T + I * 3 + 2] = L.b;
136
- }
137
- B.needsUpdate = !0;
138
- let E = 0;
139
- for (let w = H.flares.length - 1; w >= 0 && E < Ct; w--) {
140
- const P = H.flares[w], _ = C - P.start - bt;
141
- if (_ < 0 || _ > 1700) continue;
142
- const W = qt(t, P.node);
143
- let K = !1;
144
- for (let N = 0; N < E; N++) x.current[N] === W && (K = !0);
145
- if (K) continue;
146
- const T = d.current[E], I = h.current[E];
147
- T && I && (T.visible = !0, T.position.set(S[W].x, 2.4, S[W].z), x.current[E] !== W && (I.setText(`${P.op === "write" ? "WRITE" : "read"} · ${P.node}`), I.setColor(P.op === "write" ? "#ffffff" : Jt[t.nodes[W].kind] ?? "#22d3ee")), I.setOpacity(Math.min(1, (1700 - _) / 400))), x.current[E++] = W;
148
- }
149
- for (; E < Ct; E++) {
150
- x.current[E] = -1;
151
- const w = d.current[E];
152
- w && (w.visible = !1);
153
- const P = h.current[E];
154
- P == null || P.setOpacity(0);
155
- }
156
- p.instanceMatrix.needsUpdate = !0, u.instanceMatrix.needsUpdate = !0, p.instanceColor && (p.instanceColor.needsUpdate = !0), u.instanceColor && (u.instanceColor.needsUpdate = !0), f.count = v, f.instanceMatrix.needsUpdate = !0, f.instanceColor && (f.instanceColor.needsUpdate = !0);
157
- });
158
- const j = ot * jt, n = O * _t, a = Zt + j / 2 - jt / 2, r = Kt + n / 2 - _t / 2, c = D(() => new s.EdgesGeometry(new s.BoxGeometry(j + 1.2, 0.12, n + 1.2)), [j, n]);
159
- return /* @__PURE__ */ U("group", { children: [
160
- /* @__PURE__ */ U("mesh", { position: [a, 0.03, r], children: [
161
- /* @__PURE__ */ o("boxGeometry", { args: [j + 1.2, 0.06, n + 1.2] }),
162
- /* @__PURE__ */ o("meshStandardMaterial", { color: "#060a16", metalness: 0.6, roughness: 0.5 })
163
- ] }),
164
- /* @__PURE__ */ o("lineSegments", { geometry: c, position: [a, 0.06, r], children: /* @__PURE__ */ o("lineBasicMaterial", { color: Z("#a5f3fc").clone().multiplyScalar(1.3), toneMapped: !1, transparent: !0, opacity: 0.8 }) }),
165
- /* @__PURE__ */ U("mesh", { position: [ge, 0.02, r], children: [
166
- /* @__PURE__ */ o("boxGeometry", { args: [0.12, 0.03, n + 1.2] }),
167
- /* @__PURE__ */ o("meshBasicMaterial", { color: Z("#22d3ee").clone().multiplyScalar(1.1), toneMapped: !1 })
168
- ] }),
169
- /* @__PURE__ */ o("lineSegments", { geometry: V, frustumCulled: !1, children: /* @__PURE__ */ o("lineBasicMaterial", { vertexColors: !0, toneMapped: !1, transparent: !0, blending: s.AdditiveBlending, depthWrite: !1 }) }),
170
- /* @__PURE__ */ U("instancedMesh", { ref: e, args: [void 0, void 0, M], frustumCulled: !1, children: [
171
- /* @__PURE__ */ o("boxGeometry", {}),
172
- /* @__PURE__ */ o("meshBasicMaterial", { toneMapped: !1 })
173
- ] }),
174
- /* @__PURE__ */ U("instancedMesh", { ref: l, args: [void 0, void 0, M], frustumCulled: !1, children: [
175
- /* @__PURE__ */ o("boxGeometry", { args: [0.1, 0.05, 0.1] }),
176
- /* @__PURE__ */ o("meshBasicMaterial", { toneMapped: !1 })
177
- ] }),
178
- /* @__PURE__ */ U("instancedMesh", { ref: i, args: [void 0, void 0, se], frustumCulled: !1, children: [
179
- /* @__PURE__ */ o("ringGeometry", { args: [0.92, 1, 64] }),
180
- /* @__PURE__ */ o("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: s.AdditiveBlending, depthWrite: !1, side: s.DoubleSide })
181
- ] }),
182
- Array.from({ length: Ct }, (p, u) => /* @__PURE__ */ o("group", { ref: (f) => void (d.current[u] = f), visible: !1, children: /* @__PURE__ */ o(Et, { ref: (f) => void (h.current[u] = f), text: "", size: 0.24, opacity: 0, fadeMs: 120, pxRange: [8, 12] }) }, u)),
183
- /* @__PURE__ */ o(Le, { position: [a, 0.4, Kt - 1.6], suffix: " · memory bank", color: "#22d3ee", letterSpacing: 0.06, size: 1, pxRange: [10, 15] })
184
- ] });
185
- }
186
- const on = (
187
- /* glsl */
188
- `
189
- varying vec2 vP;
190
- void main() {
191
- vec4 w = modelMatrix * vec4(position, 1.0);
192
- vP = w.xz;
193
- gl_Position = projectionMatrix * viewMatrix * w;
194
- }`
195
- ), sn = (
196
- /* glsl */
197
- `
198
- varying vec2 vP;
199
- uniform vec2 uCenter;
200
- float gridLine(vec2 p, float s, float w) {
201
- vec2 q = p / s;
202
- vec2 g = abs(fract(q - 0.5) - 0.5) / (fwidth(q) * w);
203
- return 1.0 - min(min(g.x, g.y), 1.0);
204
- }
205
- void main() {
206
- float minor = gridLine(vP, 1.0, 1.0);
207
- float major = gridLine(vP, 5.0, 1.4);
208
- float d = length(vP - uCenter);
209
- float fade = exp(-d * 0.028);
210
- vec3 base = vec3(0.004, 0.008, 0.02);
211
- vec3 cy = vec3(0.05, 0.55, 0.75);
212
- vec3 mg = vec3(0.55, 0.12, 0.65);
213
- float side = smoothstep(-30.0, 40.0, vP.x);
214
- vec3 lineC = mix(cy, mg, side * 0.6);
215
- vec3 col = base + lineC * (minor * 0.07 + major * 0.32) * fade;
216
- gl_FragColor = vec4(col, 1.0);
217
- }`
218
- );
219
- function rn(t) {
220
- return () => {
221
- t |= 0, t = t + 1831565813 | 0;
222
- let e = Math.imul(t ^ t >>> 15, 1 | t);
223
- return e = e + Math.imul(e ^ e >>> 7, 61 | e) ^ e, ((e ^ e >>> 14) >>> 0) / 4294967296;
224
- };
225
- }
226
- const re = [
227
- [1, 0],
228
- [0, 1],
229
- [-1, 0],
230
- [0, -1],
231
- [Math.SQRT1_2, Math.SQRT1_2],
232
- [-Math.SQRT1_2, Math.SQRT1_2]
233
- ], wt = (() => {
234
- const t = rn(42), e = [];
235
- for (let l = 0; l < 170; l++) {
236
- let i = Math.round((-46 + t() * 96) * 2) / 2, d = Math.round((-40 + t() * 76) * 2) / 2;
237
- const h = [i, d];
238
- let x = Math.floor(t() * 4);
239
- const M = 2 + Math.floor(t() * 3);
240
- for (let O = 0; O < M; O++) {
241
- const R = 1.5 + t() * 6;
242
- i += re[x][0] * R, d += re[x][1] * R, h.push(i, d), x = t() < 0.5 ? (x + 1) % 4 : t() < 0.5 ? 4 + Math.floor(t() * 2) : x;
243
- }
244
- e.push({ pts: h, magenta: t() < 0.35 });
245
- }
246
- return e;
247
- })();
248
- function an() {
249
- const t = z(null), e = z(null), l = D(() => wt.reduce((i, d) => i + d.pts.length / 2 - 1, 0), []);
250
- return he(() => {
251
- const i = t.current, d = e.current, h = new s.Object3D(), x = new s.Color();
252
- let M = 0, O = 0;
253
- for (const R of wt) {
254
- x.set(R.magenta ? "#d946ef" : "#22d3ee").multiplyScalar(R.magenta ? 0.16 : 0.2);
255
- for (let S = 0; S + 3 < R.pts.length; S += 2) {
256
- const [m, b, y, L] = [R.pts[S], R.pts[S + 1], R.pts[S + 2], R.pts[S + 3]];
257
- h.position.set((m + y) / 2, 5e-3, (b + L) / 2), h.rotation.set(0, -Math.atan2(L - b, y - m), 0), h.scale.set(Math.hypot(y - m, L - b) + 0.06, 0.01, 0.07), h.updateMatrix(), i.setMatrixAt(M, h.matrix), i.setColorAt(M++, x);
258
- }
259
- for (const S of [0, R.pts.length - 2])
260
- h.position.set(R.pts[S], 0.01, R.pts[S + 1]), h.rotation.set(-Math.PI / 2, 0, 0), h.scale.set(1, 1, 1), h.updateMatrix(), d.setMatrixAt(O, h.matrix), d.setColorAt(O++, x.clone().multiplyScalar(2.2));
261
- }
262
- i.instanceMatrix.needsUpdate = !0, d.instanceMatrix.needsUpdate = !0, i.instanceColor && (i.instanceColor.needsUpdate = !0), d.instanceColor && (d.instanceColor.needsUpdate = !0);
263
- }, []), /* @__PURE__ */ U(Qt, { children: [
264
- /* @__PURE__ */ U("instancedMesh", { ref: t, args: [void 0, void 0, l], frustumCulled: !1, children: [
265
- /* @__PURE__ */ o("boxGeometry", {}),
266
- /* @__PURE__ */ o("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: s.AdditiveBlending, depthWrite: !1 })
267
- ] }),
268
- /* @__PURE__ */ U("instancedMesh", { ref: e, args: [void 0, void 0, wt.length * 2], frustumCulled: !1, children: [
269
- /* @__PURE__ */ o("ringGeometry", { args: [0.08, 0.17, 12] }),
270
- /* @__PURE__ */ o("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: s.AdditiveBlending, depthWrite: !1, side: s.DoubleSide })
271
- ] })
272
- ] });
273
- }
274
- function cn() {
275
- const t = D(() => ({ uCenter: { value: new s.Vector2(0, -2) } }), []);
276
- return /* @__PURE__ */ U("group", { children: [
277
- /* @__PURE__ */ U("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, 0, -4], children: [
278
- /* @__PURE__ */ o("planeGeometry", { args: [220, 220] }),
279
- /* @__PURE__ */ o("shaderMaterial", { vertexShader: on, fragmentShader: sn, uniforms: t, toneMapped: !1 })
280
- ] }),
281
- /* @__PURE__ */ o(an, {})
282
- ] });
283
- }
284
- const ln = new qe(1.5, 0.34, 1.5, 3, 0.07), pn = new s.BoxGeometry(0.24, 0.05, 0.09), un = new s.BoxGeometry(1, 1, 1), ae = 16, ie = 36, dn = new s.Color("#fbbf24"), ce = new s.Color(1, 1, 1), It = new s.Color("#ef4444"), we = [];
285
- for (let t = 0; t < 4; t++)
286
- for (let e = 0; e < 4; e++) {
287
- const l = -0.48 + e * 0.32, i = 0.86, d = t === 0 ? [l, 0, i] : t === 1 ? [i, 0, -l] : t === 2 ? [-l, 0, -i] : [-i, 0, l];
288
- we.push(d);
289
- }
290
- const Gt = [], Pt = [];
291
- for (let t = 0; t < 3; t++)
292
- for (let e = 0; e < 2; e++)
293
- for (let l = 0; l < 3; l++)
294
- for (let i = 0; i < 2; i++) {
295
- const d = -0.5 + t * 0.5 + (i ? 0.18 : -0.05), h = -0.5 + l * 0.5 + (i ? -0.12 : 0.08);
296
- Gt.push(d, 0.08 + e * 0.18 + i * 0.1, h), Pt.push(d * (1.2 + (t * 7 + l * 3 + i) % 5 * 0.35), 1.8 + (t + e * 3 + l * 5 + i * 2) % 6 * 0.55, h * (1.2 + (l * 5 + t + i) % 4 * 0.4));
297
- }
298
- function fn(t) {
299
- for (const e of H.mcpPending.values()) if (e.instance === t) return !0;
300
- return !1;
301
- }
302
- function hn({ agent: t, selected: e, onSelect: l }) {
303
- const i = t.inst, d = z(null), h = z(null), x = z(null), M = z(null), O = z(null), R = z(null), S = z(null), m = z(null), b = z(null), y = z(null), L = D(() => Z(yt[i.type]), [i.type]), G = D(
304
- () => ({
305
- body: new s.MeshStandardMaterial({ color: "#0a0f1d", metalness: 0.75, roughness: 0.3, emissive: L, emissiveIntensity: 0.05 }),
306
- die: new s.MeshBasicMaterial({ map: tn(), transparent: !0, blending: s.AdditiveBlending, depthWrite: !1, toneMapped: !1 }),
307
- coreOuter: new s.MeshBasicMaterial({ wireframe: !0, transparent: !0, blending: s.AdditiveBlending, depthWrite: !1, toneMapped: !1 }),
308
- coreInner: new s.MeshBasicMaterial({ toneMapped: !1 }),
309
- column: new s.MeshBasicMaterial({ transparent: !0, blending: s.AdditiveBlending, depthWrite: !1, toneMapped: !1 }),
310
- glow: new s.MeshBasicMaterial({ map: Xt(), transparent: !0, blending: s.AdditiveBlending, depthWrite: !1, toneMapped: !1 }),
311
- flash: new s.MeshBasicMaterial({ map: Xt(), transparent: !0, blending: s.AdditiveBlending, depthWrite: !1, toneMapped: !1 }),
312
- ring: new s.MeshBasicMaterial({ transparent: !0, blending: s.AdditiveBlending, depthWrite: !1, toneMapped: !1, side: s.DoubleSide }),
313
- vox: new s.MeshBasicMaterial({ toneMapped: !1 }),
314
- pins: new s.MeshBasicMaterial({ toneMapped: !1 })
315
- }),
316
- [L]
317
- ), g = D(() => ({ pos: new s.Vector3(), start: new s.Vector3(), home: new s.Vector3(), init: !1, emerge: !1, spin: 0, spin2: 0 }), []), V = D(() => new s.Object3D(), []), j = D(() => new s.Color(), []);
318
- return he(() => {
319
- const n = M.current;
320
- n && (we.forEach((a, r) => {
321
- V.position.set(a[0], a[1], a[2]), V.rotation.set(0, r < 4 || r >= 8 && r < 12 ? Math.PI / 2 : 0, 0), V.scale.setScalar(1), V.updateMatrix(), n.setMatrixAt(r, V.matrix), n.setColorAt(r, j.setScalar(0));
322
- }), n.instanceMatrix.needsUpdate = !0);
323
- }, [V, j]), ft(({ clock: n }, a) => {
324
- var St;
325
- const r = performance.now(), c = i, p = n.elapsedTime;
326
- g.home.copy(t.pos);
327
- const u = Ze(c);
328
- if (!g.init) {
329
- g.init = !0;
330
- const $ = c.parent ? ut(c.parent) : void 0;
331
- g.emerge = !!$, g.start.copy($ ?? g.home), g.pos.copy(g.start);
332
- }
333
- const f = r - c.bornAt, C = g.emerge ? 620 : 480;
334
- let v = 0, B = 1;
335
- if (f < C && !Q) {
336
- const $ = X(f / C);
337
- if (g.emerge) {
338
- const q = dt($);
339
- g.pos.lerpVectors(g.start, g.home, q), v = 2.4 * Math.sin(Math.PI * $), B = 0.2 + 0.8 * q;
340
- } else
341
- g.pos.copy(g.home), v = 9 * (1 - $ * $);
342
- } else
343
- g.pos.lerp(g.home, 1 - Math.exp(-a * 5));
344
- t.live.set(g.pos.x, 0, g.pos.z);
345
- const A = f - C, E = c.exitAt > 0, w = E ? r - c.exitAt : -1, P = c.status === "failed", _ = 2500 / We(c), W = w * _, K = W > 600 ? Math.pow(X((W - 600) / 1900), 2) * 3.8 : 0, T = W > 950 ? X((W - 950) / 1300) : 0, I = Ft(c, r), N = Math.min(1.3, Ve(c, r)), F = c.status === "thinking" || c.status === "spawning", J = !E && fn(c.id), et = X(E ? 1 - W / 700 : A / 300);
346
- d.current && (d.current.position.set(g.pos.x, v + K, g.pos.z), d.current.scale.setScalar(u * B), !Q && E && (d.current.rotation.y += a * T * 4)), h.current && h.current.scale.setScalar(T > 0 ? Math.max(1e-3, 1 - T * 4) : 1);
347
- const rt = 0.5 + 0.5 * Math.sin(p * (J ? 2.4 : 1.3));
348
- let k = F ? 1.1 + N * 1.6 + 0.25 * Math.sin(p * 9) : 0.28 + rt * 0.22 + N;
349
- J && (k = 0.5 + rt * 0.9), k *= et, G.body.emissiveIntensity = 0.04 + k * 0.12;
350
- const tt = J ? j.copy(L).lerp(dn, 0.55 * rt) : j.copy(L);
351
- if (G.die.color.copy(tt).multiplyScalar(0.25 + k * 1.4), M.current) {
352
- for (let $ = 0; $ < ae; $++) {
353
- const q = (Q || A > $ * 40) && !(E && W > $ * 38), mt = F && !Q ? Math.max(0, Math.sin(p * 9 - $ * 0.7)) * (0.6 + N) : 0, ze = q ? 0.55 + k * 0.9 + mt * 1.4 + N * 1.2 : 0.03;
354
- M.current.setColorAt($, j.copy(L).multiplyScalar(ze));
355
- }
356
- M.current.instanceColor && (M.current.instanceColor.needsUpdate = !0);
357
- }
358
- const ht = Q ? 0.4 : F ? 3.6 + N * 5 : J ? 0.9 : 0.45;
359
- if (g.spin += a * ht * (E ? et : 1), x.current) {
360
- const $ = X(A / 280) * (T > 0 ? 1 - T : 1);
361
- x.current.visible = $ > 0.01, x.current.position.y = 1.15 + (Q ? 0 : Math.sin(p * 2 + c.index) * 0.08), x.current.rotation.set(g.spin * 0.6, g.spin, 0), x.current.children[1].rotation.set(-g.spin * 1.3, 0, g.spin * 0.9), x.current.scale.setScalar($ * (F ? 1 + N * 0.35 : 0.82 + rt * 0.08)), G.coreOuter.color.copy(tt).multiplyScalar(0.5 + k * 1.1), G.coreInner.color.copy(tt).multiplyScalar(0.8 + k * 1.1 + N * 1.2);
362
- }
363
- if (b.current && (b.current.visible = !!((St = x.current) != null && St.visible), G.column.color.copy(tt).multiplyScalar(0.08 + k * 0.22)), R.current) {
364
- R.current.position.y = (-v - K) / (u * B) + 0.03;
365
- const $ = F && !Q ? 1 + 0.08 * Math.sin(p * 17) + 0.05 * Math.sin(p * 29) : 1;
366
- R.current.scale.setScalar((2.3 + N * 0.5) * $), G.glow.color.copy(tt).multiplyScalar((0.05 + Math.min(k, 2.4) * 0.12) * I);
367
- }
368
- let Y = 0, ct = ce;
369
- if (A >= 0 && A < 520 && (Y = 1 - A / 520), E && W < 400 && (Y = Math.max(Y, (1 - W / 400) * 0.6), ct = P ? It : ce), T > 0 && T < 0.4 && (Y = Math.max(Y, 1 - T / 0.4), ct = P ? It : L), S.current && m.current && (S.current.visible = m.current.visible = Y > 0.01, Y > 0.01)) {
370
- const $ = 1 - Y;
371
- G.flash.color.copy(ct).multiplyScalar(1.1 * Y * Y), S.current.scale.setScalar(1.2 + $ * 2.2), m.current.scale.setScalar(0.9 + $ * 2), G.ring.color.copy(ct).multiplyScalar(1.5 * Y);
372
- }
373
- if (O.current && (O.current.visible = T > 0, T > 0)) {
374
- const $ = 0.16 * (1 - T * 0.85);
375
- for (let q = 0; q < ie; q++) {
376
- const mt = Q ? 0.2 : 1;
377
- V.position.set(
378
- Gt[q * 3] + Pt[q * 3] * T * 1.6 * mt,
379
- Gt[q * 3 + 1] + Pt[q * 3 + 1] * T * 1.4 * mt,
380
- Gt[q * 3 + 2] + Pt[q * 3 + 2] * T * 1.6 * mt
381
- ), V.rotation.set(T * q, T * 3, 0), V.scale.setScalar($ * (q % 3 === 0 ? 1.3 : 1)), V.updateMatrix(), O.current.setMatrixAt(q, V.matrix);
382
- }
383
- O.current.instanceMatrix.needsUpdate = !0, G.vox.color.copy(P ? It : L).multiplyScalar(3.2 * (1 - T));
384
- }
385
- y.current && (y.current.visible = e, e && (y.current.rotation.z = p * 0.8, y.current.material.color.setScalar(1.6 + 0.6 * Math.sin(p * 5))));
386
- }), /* @__PURE__ */ U("group", { ref: d, children: [
387
- /* @__PURE__ */ o("mesh", { ref: R, rotation: [-Math.PI / 2, 0, 0], material: G.glow, children: /* @__PURE__ */ o("planeGeometry", { args: [1, 1] }) }),
388
- /* @__PURE__ */ U("group", { ref: h, children: [
389
- /* @__PURE__ */ o(
390
- "mesh",
391
- {
392
- geometry: ln,
393
- material: G.body,
394
- position: [0, 0.2, 0],
395
- onClick: (n) => (n.stopPropagation(), l(i.id)),
396
- onPointerOver: () => document.body.style.cursor = "pointer",
397
- onPointerOut: () => document.body.style.cursor = ""
398
- }
399
- ),
400
- /* @__PURE__ */ o("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, 0.375, 0], material: G.die, children: /* @__PURE__ */ o("planeGeometry", { args: [1.25, 1.25] }) }),
401
- /* @__PURE__ */ o("instancedMesh", { ref: M, args: [pn, G.pins, ae], position: [0, 0.06, 0] })
402
- ] }),
403
- /* @__PURE__ */ o("mesh", { ref: b, position: [0, 0.78, 0], material: G.column, children: /* @__PURE__ */ o("cylinderGeometry", { args: [0.05, 0.22, 0.75, 12, 1, !0] }) }),
404
- /* @__PURE__ */ U("group", { ref: x, position: [0, 1.15, 0], children: [
405
- /* @__PURE__ */ o("mesh", { material: G.coreOuter, children: /* @__PURE__ */ o("octahedronGeometry", { args: [0.42, 0] }) }),
406
- /* @__PURE__ */ o("mesh", { material: G.coreInner, children: /* @__PURE__ */ o("icosahedronGeometry", { args: [0.15, 0] }) })
407
- ] }),
408
- /* @__PURE__ */ o("mesh", { ref: S, rotation: [-Math.PI / 2, 0, 0], position: [0, 0.06, 0], material: G.flash, visible: !1, children: /* @__PURE__ */ o("planeGeometry", { args: [1, 1] }) }),
409
- /* @__PURE__ */ o("mesh", { ref: m, rotation: [-Math.PI / 2, 0, 0], position: [0, 0.07, 0], material: G.ring, visible: !1, children: /* @__PURE__ */ o("ringGeometry", { args: [0.9, 1, 48] }) }),
410
- /* @__PURE__ */ o("instancedMesh", { ref: O, args: [un, G.vox, ie], visible: !1, frustumCulled: !1 }),
411
- /* @__PURE__ */ U("mesh", { ref: y, rotation: [-Math.PI / 2, 0, 0], position: [0, 0.05, 0], visible: !1, children: [
412
- /* @__PURE__ */ o("ringGeometry", { args: [1.25, 1.35, 4, 1, Math.PI / 4] }),
413
- /* @__PURE__ */ o("meshBasicMaterial", { toneMapped: !1, side: s.DoubleSide })
414
- ] }),
415
- e && /* @__PURE__ */ o(Et, { position: [0, 2, 0], text: i.name, color: yt[i.type], size: 0.32, pxRange: [9.5, 13.5] })
416
- ] });
417
- }
418
- const le = { queued: "#64748b", running: "#fde68a", done: "#5eead4", failed: "#f87171" }, mn = new s.Color("#334155"), gn = new s.Color("#5eead4"), Mn = new s.Color("#ef4444"), kt = ["planner", "researcher", "writer"], ve = new s.BoxGeometry(1.5, 0.55, 1.25), xn = new s.EdgesGeometry(ve), Lt = new s.BoxGeometry(1, 1, 1), pe = new s.Vector3(0, 1, 0), Ot = new s.Vector3(), xt = new s.Vector3(), yn = new s.Vector3(), ue = new s.Matrix4();
419
- function bn(t) {
420
- const { shown: e, more: l } = $e(t), i = e.map((d, h) => ({ text: `${h ? " " : ""}${d}${t.steps[d] === "done" ? " ·" : t.steps[d] === "failed" ? " ×" : ""}`, color: le[t.steps[d]] }));
421
- return l && i.push({ text: ` +${l}`, color: le.queued }), i;
422
- }
423
- function Se(t, e) {
424
- return t.endedAt ? X(1 - (e - t.endedAt - 1200) / (De - 1200)) : 1;
425
- }
426
- function wn({ run: t }) {
427
- const e = t.run ?? H.runs.get(t.id);
428
- return e ? /* @__PURE__ */ o(vn, { kr: t, run: e }) : null;
429
- }
430
- function vn({ kr: t, run: e }) {
431
- const l = z(null), i = z(null), d = D(() => new s.MeshBasicMaterial({ toneMapped: !1, transparent: !0, blending: s.AdditiveBlending, depthWrite: !1 }), []), h = D(() => new s.MeshBasicMaterial({ toneMapped: !1 }), []), x = D(() => Z(e.color), [e.color]), M = D(() => new s.MeshBasicMaterial({ color: x.clone().multiplyScalar(1.6), toneMapped: !1 }), [x]), O = z(null), R = z([]), S = z(null), m = z([]), b = z([]), y = z([]), L = z([]), G = z([]), g = z(null), V = z(null), j = z(""), n = D(() => ({ u0: 0, u1: 0, init: !1 }), []), a = D(() => ({ u0: 0, u1: 0 }), []);
432
- return ft(({ clock: r }, c) => {
433
- var _, W, K, T;
434
- const p = l.current;
435
- if (!p) return;
436
- Ot.copy(t.side), xt.copy(t.axis), yn.crossVectors(Ot, pe).dot(xt) < 0 && xt.negate(), ue.makeBasis(Ot, pe, xt), p.quaternion.setFromRotationMatrix(ue), p.position.copy(t.origin).addScaledVector(t.side, -t.cu).addScaledVector(t.axis, -t.cv);
437
- const u = xt.dot(t.axis) < 0 ? -1 : 1;
438
- Yt(t, a);
439
- const f = n.init ? 1 - Math.exp(-Math.min(0.1, c) / 0.2) : 1;
440
- n.init = !0, n.u0 += (a.u0 - n.u0) * f, n.u1 += (a.u1 - n.u1) * f;
441
- const C = Math.max(0.01, n.u1 - n.u0), v = vt() * u, B = Math.max(0.7, it.spread * 0.95), A = performance.now(), E = Se(e, A), w = r.elapsedTime;
442
- i.current && (i.current.position.set(n.u0, 0, v), i.current.scale.x = Math.max(1e-3, ye(X((A - e.startedAt) / 900)))), (_ = O.current) == null || _.position.set(C / 2, 0.015, 0), (W = O.current) == null || W.scale.set(C, 0.02, B), R.current.forEach((I, N) => {
443
- I && (I.position.set(C / 2, 0.03, (N ? 0.5 : -0.5) * B), I.scale.set(C, 0.04, 0.07));
444
- }), (K = S.current) == null || K.scale.set(0.5, 0.08, B * 1.45), d.color.copy(x).multiplyScalar(0.32 * E), h.color.copy(x).multiplyScalar(2.4 * E), (T = g.current) == null || T.position.set(n.u0 + 0.2, 0.3, v - 1.5 * B * u);
445
- const P = Math.max(0.7, it.spread * 0.9);
446
- if (te.forEach((I) => {
447
- const N = m.current[I];
448
- N && (N.position.set(Bt(kt[I]), 0, v), N.scale.setScalar(P), N.visible = e.hasSteps);
449
- const F = Ne(e, I), J = b.current[I], et = y.current[I], rt = L.current[I], k = G.current[I];
450
- if (!J || !et || !rt || !k) return;
451
- const tt = F === "running", ht = tt ? Q ? 1 : 0.75 + 0.35 * Math.sin(w * 6) : 1, Y = F === "queued" ? mn : F === "done" ? gn : F === "failed" ? Mn : x, ct = F === "queued" ? 0.9 : F === "done" ? 1.1 : F === "failed" ? 2 : 3.2 * ht;
452
- rt.color.copy(Y).multiplyScalar(ct * E), et.emissive.copy(Y), et.emissiveIntensity = (tt ? 0.9 * ht : F === "done" ? 0.12 : 0.04) * E;
453
- const St = tt ? 2.2 : F === "done" ? 1 : 0.7;
454
- J.scale.y += (St - J.scale.y) * 0.12, J.position.y = 0.55 * J.scale.y / 2, k.visible = tt && E > 0.05, k.visible && (k.material.color.copy(x).multiplyScalar(0.55 * ht * E), k.scale.y = 1 + 0.1 * Math.sin(w * 3));
455
- }), V.current) {
456
- const I = e.stepOrder.map((N) => `${N}:${e.steps[N]}`).join(" ") + e.hasSteps;
457
- I !== j.current && (j.current = I, V.current.setText(
458
- `${e.hasSteps ? "hatchet · " : ""}${e.topic}`,
459
- e.hasSteps ? bn(e) : [{ text: e.status === "started" ? "bus active" : "bus idle", color: "#64748b" }]
460
- )), V.current.setOpacity(0.35 + 0.65 * E);
461
- }
462
- }), /* @__PURE__ */ U("group", { ref: l, children: [
463
- /* @__PURE__ */ U("group", { ref: i, children: [
464
- /* @__PURE__ */ o("mesh", { ref: O, geometry: Lt, material: d }),
465
- [0, 1].map((r) => /* @__PURE__ */ o("mesh", { ref: (c) => void (R.current[r] = c), geometry: Lt, material: h }, r)),
466
- /* @__PURE__ */ o("mesh", { ref: S, geometry: Lt, material: M, position: [0, 0.04, 0] })
467
- ] }),
468
- te.map((r) => /* @__PURE__ */ U("group", { ref: (c) => void (m.current[r] = c), visible: !1, children: [
469
- /* @__PURE__ */ U("group", { ref: (c) => void (b.current[r] = c), children: [
470
- /* @__PURE__ */ o("mesh", { geometry: ve, children: /* @__PURE__ */ o("meshStandardMaterial", { ref: (c) => void (y.current[r] = c), color: "#070b16", metalness: 0.75, roughness: 0.3, toneMapped: !1 }) }),
471
- /* @__PURE__ */ o("lineSegments", { geometry: xn, children: /* @__PURE__ */ o("lineBasicMaterial", { ref: (c) => void (L.current[r] = c), toneMapped: !1 }) })
472
- ] }),
473
- /* @__PURE__ */ U("mesh", { ref: (c) => void (G.current[r] = c), position: [0, 3.2, 0], visible: !1, children: [
474
- /* @__PURE__ */ o("boxGeometry", { args: [0.12, 5, 0.12] }),
475
- /* @__PURE__ */ o("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: s.AdditiveBlending, depthWrite: !1 })
476
- ] }),
477
- /* @__PURE__ */ o(Ue, { run: e, slot: r, prefix: "gate · ", position: [0, 0.05, -1.05], color: "#5eead4", uppercase: !0, letterSpacing: 0.12, size: 0.18, opacity: 0.6, pxRange: [6.5, 9] })
478
- ] }, r)),
479
- /* @__PURE__ */ o("group", { ref: g, children: /* @__PURE__ */ o(
480
- Et,
481
- {
482
- ref: V,
483
- anchorX: "left",
484
- anchorY: "bottom",
485
- textAlign: "left",
486
- plate: "box",
487
- text: `${e.hasSteps ? "hatchet · " : ""}${e.topic}`,
488
- secondary: "",
489
- color: e.color,
490
- size: 0.36,
491
- maxWidth: 11,
492
- fit: !0,
493
- pxRange: [8, 14]
494
- }
495
- ) })
496
- ] });
497
- }
498
- const de = new s.Vector3(), Vt = { u0: 0, u1: 0 };
499
- function Sn(t) {
500
- for (const e of st.runs.values())
501
- Yt(e, Vt), t(Rt(e, Vt.u0 + 3, vt() - 2.4, de), 1.6), t(Rt(e, Vt.u1, vt(), de), 0.6);
502
- }
503
- const Ht = 2.1, Ae = new s.BoxGeometry(1.5, 0.7, 3.2), An = new s.EdgesGeometry(Ae);
504
- function zn({ mcp: t }) {
505
- const e = t.srv, l = z(null), i = D(() => t.target.x <= 0, [t]), d = z(null), h = z(null), x = z(null), M = D(() => new s.MeshBasicMaterial({ toneMapped: !1, wireframe: !0, transparent: !0, blending: s.AdditiveBlending, depthWrite: !1 }), []), O = D(() => new s.MeshBasicMaterial({ toneMapped: !1 }), []), R = z(null), S = D(() => Z(e.color), [e.color]), m = z(0);
506
- return ft(({ clock: b }, y) => {
507
- l.current && (l.current.position.set(t.pos.x, 0, t.pos.z), l.current.rotation.y = t.out.x < 0 ? 0 : Math.PI);
508
- const L = performance.now(), G = H.mcpServers.get(e.name) ?? e, g = G.inflight > 0, V = Math.exp(-((L - G.activeAt) / 1e3) * 2.5), j = b.elapsedTime, a = (g ? 0.75 + 0.25 * Math.sin(j * 7) : 0.5 + 0.1 * Math.sin(j * 1.3)) + V * 2.5 + (g ? 1 : 0);
509
- m.current += y * (Q ? 0.3 : g ? 4.5 : 0.6), d.current && (d.current.rotation.y = m.current, d.current.children[0].rotation.x = m.current * 0.7, d.current.scale.setScalar(1 + V * 0.35), d.current.position.y = 1.7 + (Q ? 0 : Math.sin(j * 1.6 + G.slot) * 0.08)), M.color.copy(S).multiplyScalar(0.9 + a * 0.9), O.color.copy(S).multiplyScalar(1.2 + a * 1.4), h.current && h.current.color.copy(S).multiplyScalar(0.5 + a * 1.3), x.current && x.current.color.copy(S).multiplyScalar(0.6 + a * 0.8), R.current && R.current.color.copy(S).multiplyScalar(0.15 + a * 0.35);
510
- }), /* @__PURE__ */ U("group", { ref: l, children: [
511
- /* @__PURE__ */ o("mesh", { geometry: Ae, position: [0, 0.35, 0], children: /* @__PURE__ */ o("meshStandardMaterial", { color: "#070b16", metalness: 0.8, roughness: 0.28 }) }),
512
- /* @__PURE__ */ o("lineSegments", { geometry: An, position: [0, 0.35, 0], children: /* @__PURE__ */ o("lineBasicMaterial", { ref: x, toneMapped: !1 }) }),
513
- /* @__PURE__ */ U("mesh", { position: [0, 0.71, 0], children: [
514
- /* @__PURE__ */ o("boxGeometry", { args: [0.3, 0.02, 2.8] }),
515
- /* @__PURE__ */ o("meshBasicMaterial", { ref: h, toneMapped: !1 })
516
- ] }),
517
- Array.from({ length: 7 }, (b, y) => /* @__PURE__ */ U("mesh", { position: [0.95 + (Ht - 1) / 2, 0.02, -1.2 + y * 0.4], children: [
518
- /* @__PURE__ */ o("boxGeometry", { args: [Ht - 1, 0.02, 0.06] }),
519
- /* @__PURE__ */ o("meshBasicMaterial", { color: S.clone().multiplyScalar(0.55), toneMapped: !1 })
520
- ] }, y)),
521
- /* @__PURE__ */ U("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, 0.02, 0], children: [
522
- /* @__PURE__ */ o("planeGeometry", { args: [5, 6] }),
523
- /* @__PURE__ */ o("meshBasicMaterial", { ref: R, map: Xt(), toneMapped: !1, transparent: !0, blending: s.AdditiveBlending, depthWrite: !1 })
524
- ] }),
525
- /* @__PURE__ */ U("group", { ref: d, position: [0, 1.7, 0], children: [
526
- /* @__PURE__ */ o("mesh", { material: M, children: /* @__PURE__ */ o("torusGeometry", { args: [0.55, 0.05, 6, 24] }) }),
527
- /* @__PURE__ */ o("mesh", { material: M, rotation: [Math.PI / 2, 0, 0], children: /* @__PURE__ */ o("torusGeometry", { args: [0.42, 0.03, 6, 20] }) }),
528
- /* @__PURE__ */ o("mesh", { material: O, children: /* @__PURE__ */ o("octahedronGeometry", { args: [0.2, 0] }) })
529
- ] }),
530
- /* @__PURE__ */ o(Et, { position: [-1.1, 0.6, 0], anchorX: i ? "right" : "left", text: `mcp · ${e.name}`, color: e.color, size: 0.3, pxRange: [9, 13] })
531
- ] });
532
- }
533
- const Wt = 1800, Nt = 360, fe = new s.Color("#fbbf24"), Cn = new s.Color("#ef4444"), pt = new s.Color(1, 1, 1), Ut = { u0: 0, u1: 0 }, at = new s.Vector3(), nt = new s.Vector3(), Dt = new s.Vector3();
534
- function Bn() {
535
- const t = Fe(), e = z(null), l = z(null), i = D(
536
- () => ({
537
- o: new s.Object3D(),
538
- c: new s.Color(),
539
- c2: new s.Color(),
540
- path: new Je(),
541
- pt: { x: 0, z: 0 },
542
- pt2: { x: 0, z: 0 },
543
- nw: 0,
544
- nh: 0
545
- }),
546
- []
547
- );
548
- ft(() => {
549
- const h = e.current, x = l.current;
550
- if (!h || !x) return;
551
- const M = performance.now(), { o: O, c: R, c2: S, path: m, pt: b, pt2: y } = i;
552
- i.nw = 0, i.nh = 0;
553
- const L = (n, a, r, c, p, u, f, C, v) => {
554
- if (i.nw >= Wt || v < 3e-3) return;
555
- const B = Math.hypot(r - n, c - a);
556
- B < 0.01 || (O.position.set((n + r) / 2, p + f / 2, (a + c) / 2), O.rotation.set(0, -Math.atan2(c - a, r - n), 0), O.scale.set(B + u * 0.5, f, u), O.updateMatrix(), h.setMatrixAt(i.nw, O.matrix), h.setColorAt(i.nw++, S.copy(C).multiplyScalar(v)));
557
- }, G = (n, a, r, c, p, u, f, C) => {
558
- i.nh >= Nt || C < 3e-3 || (O.position.set(n, a, r), O.rotation.set(0, -c, 0), O.scale.set(p, u, u), O.updateMatrix(), x.setMatrixAt(i.nh, O.matrix), x.setColorAt(i.nh++, S.copy(f).multiplyScalar(C)));
559
- }, g = (n, a, r, c, p, u, f) => {
560
- const C = m.len, v = X(Math.min(n, a)) * C, B = X(Math.max(n, a)) * C;
561
- if (!(B - v < 0.01))
562
- for (let A = 0; A < m.n - 1; A++) {
563
- const E = m.l[A], w = m.l[A + 1], P = Math.max(v, E), _ = Math.min(B, w);
564
- if (_ <= P) continue;
565
- const W = w - E || 1, K = (P - E) / W, T = (_ - E) / W, I = m.x[A + 1] - m.x[A], N = m.z[A + 1] - m.z[A];
566
- L(m.x[A] + I * K, m.z[A] + N * K, m.x[A] + I * T, m.z[A] + N * T, r, c, p, u, f);
567
- }
568
- }, V = (n, a, r, c, p = 0.4, u = !1) => {
569
- const f = m.at(n, b) + (u ? Math.PI : 0);
570
- u ? (g(1, n + p, a, 0.05, 0.05, r, c * 0.35), g(n + p, n, a, 0.07, 0.2, r, c * 1.2)) : (g(0, n - p, a, 0.05, 0.05, r, c * 0.35), g(n - p, n, a, 0.07, 0.2, r, c * 1.2)), G(b.x, a + 0.12, b.z, f, 0.42, 0.17, pt, c * 2.2), G(b.x, a + 0.12, b.z, f, 0.7, 0.3, r, c * 1.2);
571
- };
572
- for (const n of st.runs.values()) {
573
- const a = n.run;
574
- if (!a) continue;
575
- const r = Se(a, M), c = Z(a.color);
576
- Yt(n, Ut), Mt(n, Ut.u0, at);
577
- const p = M - a.startedAt;
578
- if (p < 1300) {
579
- const f = dt(X(p / 1300));
580
- Mt(n, a.hasSteps ? Bt("planner") : n.cu, nt), m.begin().pt(at.x, at.z).pt(nt.x, nt.z), V(f, 0.06, c, 2.2 * (p > 1100 ? (1300 - p) / 200 : 1), 0.6);
581
- }
582
- const u = M - a.handoffAt;
583
- if (a.handoffAt && u < 1300) {
584
- const f = dt(X(u / 1e3)), C = u > 1e3 ? 1 - (u - 1e3) / 300 : 1;
585
- Mt(n, Bt(kt[a.handoffFrom]), nt), Mt(n, Bt(kt[a.handoffTo]), Dt), m.begin().pt(nt.x, nt.z).pt(Dt.x, Dt.z), V(f, 0.06, pt, 1.4 * C, 0.5), V(f, 0.06, c, 2.4 * C, 0.5);
586
- }
587
- if (a.status === "started" && !Q) {
588
- Mt(n, Ut.u1, nt), m.begin().pt(at.x, at.z).pt(nt.x, nt.z);
589
- for (let f = 0; f < 3; f++) {
590
- const C = ((M / 5200 + f / 3) % 1 + 1) % 1;
591
- m.at(C, b), G(b.x, 0.08, b.z + (f - 1) * 0.28, 0, 0.5, 0.06, c, 1.3 * r);
592
- }
593
- }
594
- }
595
- for (const n of st.agents.values()) {
596
- const a = n.inst, r = n.live, c = Ft(a, M), p = Z(yt[a.type]);
597
- if (xe(a) || (Rt(n.run, 0, vt(), at), L(r.x, r.z - 0.75, r.x, at.z + 0.45, 0.02, 0.09, 0.03, Z(n.run.color), 1.4 * c)), !a.parent) continue;
598
- const u = ut(a.parent);
599
- if (!u) continue;
600
- const f = H.instances.get(a.parent), C = c * (f ? Math.max(0.35, Ft(f, M)) : 1), v = X((M - a.bornAt) / 520), B = u.x + 0.95;
601
- if (m.begin().pt(u.x + 0.6, u.z).pt(B, u.z).pt(r.x - 0.55, r.z), g(0, v, 0.03, 0.12, 0.05, p, 2.4 * C), g(0, v, 0.03, 0.4, 0.01, p, 0.35 * C), v < 1) {
602
- const A = m.at(v, b);
603
- G(b.x, 0.15, b.z, A, 0.4, 0.16, pt, 3);
604
- }
605
- }
606
- for (const n of H.comets) {
607
- const a = ut(n.from), r = ut(n.to);
608
- if (!a || !r) continue;
609
- const c = (M - n.start) / n.dur, p = H.instances.get(n.from), u = Z(p ? yt[p.type] : "#ffffff");
610
- m.begin().pt(a.x, a.z).pt(r.x, a.z).pt(r.x, r.z), c < 1 ? V(dt(X(c)), 0.3, u, 2, 0.45) : g(0, 1, 0.3, 0.05, 0.05, u, 0.8 * (1 - (c - 1) * 4));
611
- }
612
- if (st.graphWanted && t.nodes.length && st.graph.mix > 0.05)
613
- for (const n of H.flares) {
614
- const a = M - n.start, r = ut(n.instance);
615
- if (!r) continue;
616
- const c = qt(t, n.node);
617
- Me(c, y);
618
- const p = y.z, u = y.x;
619
- ee(u - 0.4, p, y);
620
- const f = y.x, C = y.z;
621
- ee(ge, p, y);
622
- const v = n.op === "write", B = H.instances.get(n.instance), A = v ? pt : Z(B ? yt[B.type] : "#22d3ee"), E = y.x < r.x ? -0.6 : 0.6;
623
- if (m.begin().pt(r.x + E, r.z).pt(y.x, r.z).pt(y.x, y.z).pt(f, C), a < bt) V(dt(a / bt), 0.04, A, v ? 2.4 : 1.6, 0.35);
624
- else {
625
- const w = Math.exp(-((a - bt) / 1e3) * 2.4);
626
- g(0, 1, 0.04, 0.05, 0.04, A, (v ? 1 : 0.7) * w);
627
- }
628
- }
629
- const j = (n, a) => {
630
- const r = ut(n), c = H.mcpServers.get(a), p = st.mcp.get(a);
631
- if (!r || !c || !p) return null;
632
- const u = p.out.x < 0 ? -1 : 1, f = p.pos.x - u * Ht;
633
- return m.begin().pt(r.x + u * 0.6, r.z).pt(f, r.z).pt(f, p.pos.z).pt(p.pos.x - u * 0.8, p.pos.z), c;
634
- };
635
- for (const n of H.mcpPending.values()) {
636
- const a = j(n.instance, n.server);
637
- if (!a) continue;
638
- const r = je(n, M);
639
- R.copy(Z(a.color)), r < 1.2 ? R.lerp(fe, r / 1.2) : R.copy(fe).lerp(Cn, X((r - 1.2) / 1));
640
- const c = 0.55 + Math.min(r, 3) * 0.45, p = r > 2.2 && !Q ? 0.75 + 0.25 * Math.sin(M / 45) : 1;
641
- g(0, 1, 0.16, 0.11, 0.11, R, 0.75 * c * p), g(0, 1, 0.12, 0.5, 0.02, R, 0.22 * c);
642
- for (let u = 0; u < 6; u++) {
643
- const f = Q ? u / 6 : (M / 900 * (1 + r * 0.4) + u / 6) % 1, C = m.at(f, b);
644
- G(b.x, 0.28, b.z, C, 0.42, 0.16, R, 2 * c);
645
- }
646
- }
647
- for (const n of H.mcpResolved) {
648
- const a = j(n.instance, n.server);
649
- if (!a) continue;
650
- const r = X((M - n.resolvedAt) / 700), c = 1 - ye(r), p = Z(a.color);
651
- g(0, 1, 0.16, 0.06, 0.06, p, 0.6 * (1 - r) * (1 - r)), g(c, c + 0.22, 0.16, 0.1, 0.22, pt, 2.2 * (1 - r * 0.5));
652
- const u = m.at(c, b) + Math.PI;
653
- G(b.x, 0.3, b.z, u, 0.6, 0.26, pt, 3.2);
654
- }
655
- for (const n of H.mcpCalls) {
656
- const a = j(n.instance, n.server);
657
- if (!a) continue;
658
- const r = (M - n.start) / n.dur;
659
- if (r >= 1) continue;
660
- const c = Z(a.color), p = dt(X(r));
661
- n.phase === "call" ? V(p, 0.36, c, 1.8, 0.35) : V(1 - p, 0.36, c, 1.8, 0.35, !0);
662
- }
663
- if (!Q)
664
- for (let n = 0; n < wt.length; n += 7) {
665
- const a = wt[n];
666
- m.begin();
667
- for (let u = 0; u < a.pts.length; u += 2) m.pt(a.pts[u], a.pts[u + 1]);
668
- const r = (M / 1e3 * (0.12 + n % 5 * 0.03) + n * 0.137) % 1, c = m.at(r, b), p = Z(a.magenta ? "#e879f9" : "#22d3ee");
669
- g(r - 0.12, r, 0.01, 0.06, 0.02, p, 0.6), G(b.x, 0.05, b.z, c, 0.3, 0.07, p, 1.6);
670
- }
671
- h.count = i.nw, x.count = i.nh, h.instanceMatrix.needsUpdate = !0, x.instanceMatrix.needsUpdate = !0, h.instanceColor && (h.instanceColor.needsUpdate = !0), x.instanceColor && (x.instanceColor.needsUpdate = !0);
672
- });
673
- const d = (h, x) => {
674
- h && !h.instanceColor && (h.instanceColor = new s.InstancedBufferAttribute(new Float32Array(x * 3), 3), h.count = 0);
675
- };
676
- return /* @__PURE__ */ U(Qt, { children: [
677
- /* @__PURE__ */ U(
678
- "instancedMesh",
679
- {
680
- ref: (h) => {
681
- e.current = h, d(h, Wt);
682
- },
683
- args: [void 0, void 0, Wt],
684
- frustumCulled: !1,
685
- children: [
686
- /* @__PURE__ */ o("boxGeometry", {}),
687
- /* @__PURE__ */ o("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: s.AdditiveBlending, depthWrite: !1 })
688
- ]
689
- }
690
- ),
691
- /* @__PURE__ */ U(
692
- "instancedMesh",
693
- {
694
- ref: (h) => {
695
- l.current = h, d(h, Nt);
696
- },
697
- args: [void 0, void 0, Nt],
698
- frustumCulled: !1,
699
- children: [
700
- /* @__PURE__ */ o("boxGeometry", {}),
701
- /* @__PURE__ */ o("meshBasicMaterial", { toneMapped: !1 })
702
- ]
703
- }
704
- )
705
- ] });
706
- }
707
- const $t = new s.Vector3();
708
- function Gn(t) {
709
- Sn(t);
710
- for (const e of st.agents.values()) t($t.set(e.target.x, 1.6 * e.scale, e.target.z), 0.6);
711
- for (const e of st.mcp.values()) t($t.set(e.target.x, 1.7, e.target.z), 1.8);
712
- for (const e of Xe()) t($t.copy(st.clusterTarget[e]).setY(1), 3.6);
713
- }
714
- function Pn() {
715
- const t = Ge((e) => e.scene);
716
- return ft(() => {
717
- const e = t.fog;
718
- if (!e) return;
719
- const l = it.cam.dist || 40;
720
- e.near = l * 0.85, e.far = l * 2.6;
721
- }), null;
722
- }
723
- const Rn = /* @__PURE__ */ U(Qt, { children: [
724
- /* @__PURE__ */ o(Pn, {}),
725
- /* @__PURE__ */ o("fog", { attach: "fog", args: ["#010309", 45, 120] }),
726
- /* @__PURE__ */ o("ambientLight", { intensity: 0.35 }),
727
- /* @__PURE__ */ o("hemisphereLight", { args: ["#67e8f9", "#1e0b2e", 0.6] }),
728
- /* @__PURE__ */ o("directionalLight", { position: [-8, 14, 10], intensity: 1.4, color: "#c4b5fd" }),
729
- /* @__PURE__ */ o("pointLight", { position: [18, 6, -8], intensity: 60, distance: 40, color: "#22d3ee" }),
730
- /* @__PURE__ */ o("pointLight", { position: [-14, 5, 2], intensity: 50, distance: 36, color: "#e879f9" }),
731
- /* @__PURE__ */ o(cn, {})
732
- ] });
733
- function Wn() {
734
- return /* @__PURE__ */ o(
735
- Ke,
736
- {
737
- title: "circuit",
738
- subtitle: "Hatchet buses · agent chips · graph memory bank · MCP I/O ports",
739
- preset: "lanes",
740
- plane: "xz",
741
- camera: { position: [1.6, 21, 30], fov: 50, near: 0.1, far: 300 },
742
- controls: { minPolarAngle: 0.6, maxPolarAngle: 1.42 },
743
- bg: "#010309",
744
- fit: { nRef: 4, min: 0.62, max: 1.3, minRadius: 5.5 },
745
- agentRadius: 1.2,
746
- graph: { natural: Qe, radius: 3.4 },
747
- peripheryGap: 4.4,
748
- Background: Rn,
749
- Agent: hn,
750
- RunMarker: wn,
751
- McpServer: zn,
752
- GraphResource: nn,
753
- cluster: { radius: 1.1, variant: "orb", glowGain: 0.85 },
754
- clusterOffset: [0, 2.2, 0],
755
- extents: Gn,
756
- PostFX: /* @__PURE__ */ U(Pe, { multisampling: 0, children: [
757
- /* @__PURE__ */ o(Re, { mipmapBlur: !0, intensity: 1.25, luminanceThreshold: 0.22, luminanceSmoothing: 0.25, radius: 0.72 }),
758
- /* @__PURE__ */ o(_e, { eskil: !1, offset: 0.22, darkness: 0.9 }),
759
- /* @__PURE__ */ o(Ee, { opacity: 0.03 })
760
- ] }),
761
- children: /* @__PURE__ */ o(Bn, {})
762
- }
763
- );
764
- }
765
- export {
766
- Wn as default
767
- };