agentglow 0.2.9 → 0.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/chunks/{KitScene-Bm1I35Zc.js → KitScene-DG_pcnWW.js} +1273 -1195
  2. package/dist/chunks/{index-COLbf8XM.js → index-Agh7jdYu.js} +182 -182
  3. package/dist/chunks/{index-CGTp73GN.js → index-B2EHxcBQ.js} +400 -400
  4. package/dist/chunks/{index-D-r9aJ4u.js → index-B4Cqo621.js} +33 -33
  5. package/dist/chunks/index-BfQsJ0TH.js +751 -0
  6. package/dist/chunks/index-BmBGYhJS.js +891 -0
  7. package/dist/chunks/index-Bnn-x-aE.js +767 -0
  8. package/dist/chunks/{index-BWsSd_Wm.js → index-CTQTtm9q.js} +212 -212
  9. package/dist/chunks/{index-_IwfbZy7.js → index-CTZbUTDY.js} +62 -62
  10. package/dist/chunks/{index-cRPj-lzn.js → index-CdKvybsL.js} +284 -284
  11. package/dist/chunks/index-CeiIEWek.js +818 -0
  12. package/dist/chunks/{index-D4Wlmsay.js → index-Ci8tSMhc.js} +15 -15
  13. package/dist/chunks/{index-C2vLpNCb.js → index-Cls_VZdb.js} +100 -100
  14. package/dist/chunks/index-DFFRhihO.js +892 -0
  15. package/dist/chunks/index-DMCETM4H.js +605 -0
  16. package/dist/chunks/{index-AugvjZJN.js → index-URn4zDHp.js} +223 -223
  17. package/dist/chunks/index-u4rYZ1UO.js +495 -0
  18. package/dist/index.js +1 -1
  19. package/dist/style.css +1 -1
  20. package/dist/types/world.d.ts +30 -5
  21. package/package.json +1 -1
  22. package/dist/chunks/index-BAQDf-0T.js +0 -492
  23. package/dist/chunks/index-BRnLrSfZ.js +0 -605
  24. package/dist/chunks/index-CKyn9lcT.js +0 -753
  25. package/dist/chunks/index-CnoB0ZDk.js +0 -889
  26. package/dist/chunks/index-KmczAvvY.js +0 -818
  27. package/dist/chunks/index-Z4vdWCok.js +0 -763
  28. package/dist/chunks/index-uZGu9jzU.js +0 -887
@@ -1,763 +0,0 @@
1
- var ze = Object.defineProperty;
2
- var Ce = (t, e, l) => e in t ? ze(t, e, { enumerable: !0, configurable: !0, writable: !0, value: l }) : t[e] = l;
3
- var gt = (t, e, l) => Ce(t, typeof e != "symbol" ? e + "" : e, l);
4
- import { jsxs as N, jsx as o, Fragment as Yt } from "react/jsx-runtime";
5
- import { useFrame as ht, useThree as Be } from "@react-three/fiber";
6
- import { EffectComposer as Ge, Bloom as Pe, Vignette as Re, Noise as _e } from "@react-three/postprocessing";
7
- import * as s from "three";
8
- import { useRef as z, useMemo as D, useLayoutEffect as fe } from "react";
9
- import { f as ct, q as Et, i as Ee, v as Te, K as te, w as Q, L as vt, G as Ie, n as Le, T as yt, a as dt, r as Y, p as jt, e as Oe, l as Ve, k as st, S as zt, x as Pt, R as We, t as Ne, d as Ue, j as De, B as $e } from "./KitScene-Bm1I35Zc.js";
10
- import { RoundedBoxGeometry as Fe } from "three/examples/jsm/geometries/RoundedBoxGeometry.js";
11
- const je = -1.9, St = () => je * ct.spread;
12
- function Zt(t, e) {
13
- return e.u0 = t.cu - t.hu - 1.2 * ct.spread, e.u1 = t.cu + t.hu + 1 * ct.spread, e;
14
- }
15
- function Mt(t, e, l) {
16
- return Et(t, e, St(), l), l.y = 0, l;
17
- }
18
- const he = 200, ot = 16, Kt = 1, Tt = 1.3, Ke = Math.ceil(he / ot), Jt = -15 / 2, Xt = -((Ke - 1) * Tt) / 2, me = -Jt + 1.3, Xe = 10.5, ge = (t, e) => (e.x = Jt + t % ot * Kt, e.z = Xt + Math.floor(t / ot) * Tt, e), ke = new s.Vector3(), It = new s.Vector3();
19
- function ee(t, e, l) {
20
- return Te(ke.set(t, 0, e), It), l.x = It.x, l.z = It.z, l;
21
- }
22
- const Me = (t) => Ee(t.type) || t.subagent, qe = (t) => ct.scale * (Me(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 He {
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 c = this.n;
39
- return this.x[c] = e, this.z[c] = l, this.l[c] = c ? this.l[c - 1] + Math.hypot(e - this.x[c - 1], l - this.z[c - 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 c = Math.max(0, Math.min(1, e)) * this.len;
47
- for (let d = 0; d < this.n - 1; d++)
48
- if (c <= this.l[d + 1] || d === this.n - 2) {
49
- const g = this.l[d + 1] - this.l[d] || 1, x = Math.min(1, (c - this.l[d]) / g);
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 ft = (t) => t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2, xe = (t) => 1 - Math.pow(1 - t, 3), k = (t) => t < 0 ? 0 : t > 1 ? 1 : t;
56
- let Ct = null;
57
- function kt() {
58
- if (Ct) return Ct;
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), Ct = new s.CanvasTexture(t), Ct;
63
- }
64
- let Bt = null;
65
- function Qe() {
66
- if (Bt) return Bt;
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 c = 48 + l * 10;
73
- e.beginPath(), e.moveTo(c, 40), e.lineTo(c, 18), e.moveTo(c, 88), e.lineTo(c, 110), e.moveTo(40, c), e.lineTo(18, c), e.moveTo(88, c), e.lineTo(110, c), e.stroke();
74
- }
75
- return Bt = new s.CanvasTexture(t), Bt;
76
- }
77
- const bt = 650, ye = (t) => Math.min(he, 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 = Le(t, e) % ye(t)), l;
81
- }
82
- const se = 24, Ye = 120, pt = 10, Gt = 2;
83
- function Ze({ galaxy: t }) {
84
- const e = z(null), l = z(null), c = z(null), d = z([]), g = z([]), x = z(Array(Gt).fill(-1)), M = ye(t), O = Math.ceil(M / ot), R = D(() => t.nodes.slice(0, M).map((a) => new s.Color(te[a.kind] ?? "#94a3b8")), [t, M]), S = D(() => Array.from({ length: M }, (a, u) => ge(u, { x: 0, z: 0 })), [M]), h = 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), []), m = D(() => {
85
- const a = 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 = a.get(C.source), B = a.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 >= Ye))
91
- break;
92
- }
93
- return f;
94
- }, [t, M]), V = D(() => {
95
- const a = new s.BufferGeometry(), u = new Float32Array(m.length * pt * 6);
96
- let f = 0;
97
- for (const [C, v] of m) {
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 < pt; P++)
100
- for (const _ of [P / pt, (P + 1) / pt])
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 a.setAttribute("position", new s.BufferAttribute(u, 3)), a.setAttribute("color", new s.BufferAttribute(new Float32Array(u.length), 3)), a;
104
- }, [m, S]);
105
- ht(() => {
106
- const a = e.current, u = l.current, f = c.current;
107
- if (!a || !u || !f) return;
108
- const C = performance.now();
109
- h.fill(0), b.fill(0);
110
- let v = 0;
111
- for (const w of Q.flares) {
112
- const P = C - w.start - bt;
113
- if (P < 0) continue;
114
- const _ = qt(t, w.node), W = P / 1e3, j = Math.exp(-W * 1.5);
115
- if (w.op === "read") h[_] = Math.max(h[_], j);
116
- else if (b[_] = Math.max(b[_], j * 1.4), h[_] = Math.max(h[_], j), W < 1.3) {
117
- const I = W * 10, U = 1 - W / 1.3, E = S[_];
118
- for (let K = 0; K < M; K++) {
119
- const X = Math.hypot(S[K].x - E.x, (S[K].z - E.z) * 0.8), tt = Math.exp(-(X - I) * (X - I) * 1.2) * U * 0.38;
120
- tt > b[K] && (b[K] = tt);
121
- }
122
- v < se && (y.position.set(E.x, 0.06, E.z), y.rotation.set(-Math.PI / 2, 0, 0), y.scale.setScalar(0.4 + I), y.updateMatrix(), f.setMatrixAt(v, y.matrix), L.set(1, 1, 1).multiplyScalar(0.9 * U * U), f.setColorAt(v++, L));
123
- }
124
- }
125
- for (let w = 0; w < M; w++) {
126
- const P = h[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(), a.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), a.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 < m.length; w++) {
131
- const [P, _] = m[w], W = Math.max(h[P], h[_]), j = Math.max(b[P], b[_]);
132
- L.setRGB(0.05, 0.2, 0.28), W > 0.02 && L.lerp(R[h[P] > h[_] ? P : _], Math.min(1, W)).multiplyScalar(1 + W * 4), j > 0.05 && L.lerp(G, Math.min(1, j)).multiplyScalar(1 + j * 2);
133
- const I = w * pt * 6;
134
- for (let U = 0; U < pt * 2; U++)
135
- A[I + U * 3] = L.r, A[I + U * 3 + 1] = L.g, A[I + U * 3 + 2] = L.b;
136
- }
137
- B.needsUpdate = !0;
138
- let T = 0;
139
- for (let w = Q.flares.length - 1; w >= 0 && T < Gt; w--) {
140
- const P = Q.flares[w], _ = C - P.start - bt;
141
- if (_ < 0 || _ > 1700) continue;
142
- const W = qt(t, P.node);
143
- let j = !1;
144
- for (let E = 0; E < T; E++) x.current[E] === W && (j = !0);
145
- if (j) continue;
146
- const I = d.current[T], U = g.current[T];
147
- I && U && (I.visible = !0, I.position.set(S[W].x, 2.4, S[W].z), x.current[T] !== W && (U.setText(`${P.op === "write" ? "WRITE" : "read"} · ${P.node}`), U.setColor(P.op === "write" ? "#ffffff" : te[t.nodes[W].kind] ?? "#22d3ee")), U.setOpacity(Math.min(1, (1700 - _) / 400))), x.current[T++] = W;
148
- }
149
- for (; T < Gt; T++) {
150
- x.current[T] = -1;
151
- const w = d.current[T];
152
- w && (w.visible = !1);
153
- const P = g.current[T];
154
- P == null || P.setOpacity(0);
155
- }
156
- a.instanceMatrix.needsUpdate = !0, u.instanceMatrix.needsUpdate = !0, a.instanceColor && (a.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 F = ot * Kt, n = O * Tt, r = Jt + F / 2 - Kt / 2, i = Xt + n / 2 - Tt / 2, p = D(() => new s.EdgesGeometry(new s.BoxGeometry(F + 1.2, 0.12, n + 1.2)), [F, n]);
159
- return /* @__PURE__ */ N("group", { children: [
160
- /* @__PURE__ */ N("mesh", { position: [r, 0.03, i], children: [
161
- /* @__PURE__ */ o("boxGeometry", { args: [F + 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: p, position: [r, 0.06, i], children: /* @__PURE__ */ o("lineBasicMaterial", { color: Z("#a5f3fc").clone().multiplyScalar(1.3), toneMapped: !1, transparent: !0, opacity: 0.8 }) }),
165
- /* @__PURE__ */ N("mesh", { position: [me, 0.02, i], 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__ */ N("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__ */ N("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__ */ N("instancedMesh", { ref: c, 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: Gt }, (a, u) => /* @__PURE__ */ o("group", { ref: (f) => void (d.current[u] = f), visible: !1, children: /* @__PURE__ */ o(vt, { ref: (f) => void (g.current[u] = f), text: "", size: 0.24, opacity: 0, fadeMs: 120, pxRange: [8, 12] }) }, u)),
183
- /* @__PURE__ */ o(Ie, { position: [r, 0.4, Xt - 1.6], suffix: " · memory bank", color: "#22d3ee", letterSpacing: 0.06, size: 1, pxRange: [10, 15] })
184
- ] });
185
- }
186
- const Je = (
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
- ), tn = (
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 en(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 = en(42), e = [];
235
- for (let l = 0; l < 170; l++) {
236
- let c = Math.round((-46 + t() * 96) * 2) / 2, d = Math.round((-40 + t() * 76) * 2) / 2;
237
- const g = [c, 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
- c += re[x][0] * R, d += re[x][1] * R, g.push(c, d), x = t() < 0.5 ? (x + 1) % 4 : t() < 0.5 ? 4 + Math.floor(t() * 2) : x;
243
- }
244
- e.push({ pts: g, magenta: t() < 0.35 });
245
- }
246
- return e;
247
- })();
248
- function nn() {
249
- const t = z(null), e = z(null), l = D(() => wt.reduce((c, d) => c + d.pts.length / 2 - 1, 0), []);
250
- return fe(() => {
251
- const c = t.current, d = e.current, g = 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 [h, b, y, L] = [R.pts[S], R.pts[S + 1], R.pts[S + 2], R.pts[S + 3]];
257
- g.position.set((h + y) / 2, 5e-3, (b + L) / 2), g.rotation.set(0, -Math.atan2(L - b, y - h), 0), g.scale.set(Math.hypot(y - h, L - b) + 0.06, 0.01, 0.07), g.updateMatrix(), c.setMatrixAt(M, g.matrix), c.setColorAt(M++, x);
258
- }
259
- for (const S of [0, R.pts.length - 2])
260
- g.position.set(R.pts[S], 0.01, R.pts[S + 1]), g.rotation.set(-Math.PI / 2, 0, 0), g.scale.set(1, 1, 1), g.updateMatrix(), d.setMatrixAt(O, g.matrix), d.setColorAt(O++, x.clone().multiplyScalar(2.2));
261
- }
262
- c.instanceMatrix.needsUpdate = !0, d.instanceMatrix.needsUpdate = !0, c.instanceColor && (c.instanceColor.needsUpdate = !0), d.instanceColor && (d.instanceColor.needsUpdate = !0);
263
- }, []), /* @__PURE__ */ N(Yt, { children: [
264
- /* @__PURE__ */ N("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__ */ N("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 on() {
275
- const t = D(() => ({ uCenter: { value: new s.Vector2(0, -2) } }), []);
276
- return /* @__PURE__ */ N("group", { children: [
277
- /* @__PURE__ */ N("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, 0, -4], children: [
278
- /* @__PURE__ */ o("planeGeometry", { args: [220, 220] }),
279
- /* @__PURE__ */ o("shaderMaterial", { vertexShader: Je, fragmentShader: tn, uniforms: t, toneMapped: !1 })
280
- ] }),
281
- /* @__PURE__ */ o(nn, {})
282
- ] });
283
- }
284
- const sn = new Fe(1.5, 0.34, 1.5, 3, 0.07), rn = new s.BoxGeometry(0.24, 0.05, 0.09), an = new s.BoxGeometry(1, 1, 1), ae = 16, ie = 36, cn = new s.Color("#fbbf24"), ce = new s.Color(1, 1, 1), Lt = new s.Color("#ef4444"), be = [];
285
- for (let t = 0; t < 4; t++)
286
- for (let e = 0; e < 4; e++) {
287
- const l = -0.48 + e * 0.32, c = 0.86, d = t === 0 ? [l, 0, c] : t === 1 ? [c, 0, -l] : t === 2 ? [-l, 0, -c] : [-c, 0, l];
288
- be.push(d);
289
- }
290
- const Rt = [], _t = [];
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 c = 0; c < 2; c++) {
295
- const d = -0.5 + t * 0.5 + (c ? 0.18 : -0.05), g = -0.5 + l * 0.5 + (c ? -0.12 : 0.08);
296
- Rt.push(d, 0.08 + e * 0.18 + c * 0.1, g), _t.push(d * (1.2 + (t * 7 + l * 3 + c) % 5 * 0.35), 1.8 + (t + e * 3 + l * 5 + c * 2) % 6 * 0.55, g * (1.2 + (l * 5 + t + c) % 4 * 0.4));
297
- }
298
- function ln(t) {
299
- for (const e of Q.mcpPending.values()) if (e.instance === t) return !0;
300
- return !1;
301
- }
302
- function pn({ agent: t, selected: e, onSelect: l }) {
303
- const c = t.inst, d = z(null), g = z(null), x = z(null), M = z(null), O = z(null), R = z(null), S = z(null), h = z(null), b = z(null), y = z(null), L = D(() => Z(yt[c.type]), [c.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: Qe(), 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: kt(), transparent: !0, blending: s.AdditiveBlending, depthWrite: !1, toneMapped: !1 }),
311
- flash: new s.MeshBasicMaterial({ map: kt(), 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
- ), m = 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(), []), F = D(() => new s.Color(), []);
318
- return fe(() => {
319
- const n = M.current;
320
- n && (be.forEach((r, i) => {
321
- V.position.set(r[0], r[1], r[2]), V.rotation.set(0, i < 4 || i >= 8 && i < 12 ? Math.PI / 2 : 0, 0), V.scale.setScalar(1), V.updateMatrix(), n.setMatrixAt(i, V.matrix), n.setColorAt(i, F.setScalar(0));
322
- }), n.instanceMatrix.needsUpdate = !0);
323
- }, [V, F]), ht(({ clock: n }, r) => {
324
- var At;
325
- const i = performance.now(), p = c, a = n.elapsedTime;
326
- m.home.copy(t.pos);
327
- const u = qe(p);
328
- if (!m.init) {
329
- m.init = !0;
330
- const $ = p.parent ? dt(p.parent) : void 0;
331
- m.emerge = !!$, m.start.copy($ ?? m.home), m.pos.copy(m.start);
332
- }
333
- const f = i - p.bornAt, C = m.emerge ? 620 : 480;
334
- let v = 0, B = 1;
335
- if (f < C && !Y) {
336
- const $ = k(f / C);
337
- if (m.emerge) {
338
- const q = ft($);
339
- m.pos.lerpVectors(m.start, m.home, q), v = 2.4 * Math.sin(Math.PI * $), B = 0.2 + 0.8 * q;
340
- } else
341
- m.pos.copy(m.home), v = 9 * (1 - $ * $);
342
- } else
343
- m.pos.lerp(m.home, 1 - Math.exp(-r * 5));
344
- t.live.set(m.pos.x, 0, m.pos.z);
345
- const A = f - C, T = p.exitAt > 0, w = T ? i - p.exitAt : -1, P = p.status === "failed", _ = 2500 / Ve(p), W = w * _, j = W > 600 ? Math.pow(k((W - 600) / 1900), 2) * 3.8 : 0, I = W > 950 ? k((W - 950) / 1300) : 0, U = jt(p, i), E = Math.min(1.3, Oe(p, i)), K = p.status === "thinking" || p.status === "spawning", X = !T && ln(p.id), tt = k(T ? 1 - W / 700 : A / 300);
346
- d.current && (d.current.position.set(m.pos.x, v + j, m.pos.z), d.current.scale.setScalar(u * B), !Y && T && (d.current.rotation.y += r * I * 4)), g.current && g.current.scale.setScalar(I > 0 ? Math.max(1e-3, 1 - I * 4) : 1);
347
- const rt = 0.5 + 0.5 * Math.sin(a * (X ? 2.4 : 1.3));
348
- let J = K ? 1.1 + E * 1.6 + 0.25 * Math.sin(a * 9) : 0.28 + rt * 0.22 + E;
349
- X && (J = 0.5 + rt * 0.9), J *= tt, G.body.emissiveIntensity = 0.04 + J * 0.12;
350
- const et = X ? F.copy(L).lerp(cn, 0.55 * rt) : F.copy(L);
351
- if (G.die.color.copy(et).multiplyScalar(0.25 + J * 1.4), M.current) {
352
- for (let $ = 0; $ < ae; $++) {
353
- const q = (Y || A > $ * 40) && !(T && W > $ * 38), mt = K && !Y ? Math.max(0, Math.sin(a * 9 - $ * 0.7)) * (0.6 + E) : 0, Ae = q ? 0.55 + J * 0.9 + mt * 1.4 + E * 1.2 : 0.03;
354
- M.current.setColorAt($, F.copy(L).multiplyScalar(Ae));
355
- }
356
- M.current.instanceColor && (M.current.instanceColor.needsUpdate = !0);
357
- }
358
- const lt = Y ? 0.4 : K ? 3.6 + E * 5 : X ? 0.9 : 0.45;
359
- if (m.spin += r * lt * (T ? tt : 1), x.current) {
360
- const $ = k(A / 280) * (I > 0 ? 1 - I : 1);
361
- x.current.visible = $ > 0.01, x.current.position.y = 1.15 + (Y ? 0 : Math.sin(a * 2 + p.index) * 0.08), x.current.rotation.set(m.spin * 0.6, m.spin, 0), x.current.children[1].rotation.set(-m.spin * 1.3, 0, m.spin * 0.9), x.current.scale.setScalar($ * (K ? 1 + E * 0.35 : 0.82 + rt * 0.08)), G.coreOuter.color.copy(et).multiplyScalar(0.5 + J * 1.1), G.coreInner.color.copy(et).multiplyScalar(0.8 + J * 1.1 + E * 1.2);
362
- }
363
- if (b.current && (b.current.visible = !!((At = x.current) != null && At.visible), G.column.color.copy(et).multiplyScalar(0.08 + J * 0.22)), R.current) {
364
- R.current.position.y = (-v - j) / (u * B) + 0.03;
365
- const $ = K && !Y ? 1 + 0.08 * Math.sin(a * 17) + 0.05 * Math.sin(a * 29) : 1;
366
- R.current.scale.setScalar((2.3 + E * 0.5) * $), G.glow.color.copy(et).multiplyScalar((0.05 + Math.min(J, 2.4) * 0.12) * U);
367
- }
368
- let H = 0, at = ce;
369
- if (A >= 0 && A < 520 && (H = 1 - A / 520), T && W < 400 && (H = Math.max(H, (1 - W / 400) * 0.6), at = P ? Lt : ce), I > 0 && I < 0.4 && (H = Math.max(H, 1 - I / 0.4), at = P ? Lt : L), S.current && h.current && (S.current.visible = h.current.visible = H > 0.01, H > 0.01)) {
370
- const $ = 1 - H;
371
- G.flash.color.copy(at).multiplyScalar(1.1 * H * H), S.current.scale.setScalar(1.2 + $ * 2.2), h.current.scale.setScalar(0.9 + $ * 2), G.ring.color.copy(at).multiplyScalar(1.5 * H);
372
- }
373
- if (O.current && (O.current.visible = I > 0, I > 0)) {
374
- const $ = 0.16 * (1 - I * 0.85);
375
- for (let q = 0; q < ie; q++) {
376
- const mt = Y ? 0.2 : 1;
377
- V.position.set(
378
- Rt[q * 3] + _t[q * 3] * I * 1.6 * mt,
379
- Rt[q * 3 + 1] + _t[q * 3 + 1] * I * 1.4 * mt,
380
- Rt[q * 3 + 2] + _t[q * 3 + 2] * I * 1.6 * mt
381
- ), V.rotation.set(I * q, I * 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 ? Lt : L).multiplyScalar(3.2 * (1 - I));
384
- }
385
- y.current && (y.current.visible = e, e && (y.current.rotation.z = a * 0.8, y.current.material.color.setScalar(1.6 + 0.6 * Math.sin(a * 5))));
386
- }), /* @__PURE__ */ N("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__ */ N("group", { ref: g, children: [
389
- /* @__PURE__ */ o(
390
- "mesh",
391
- {
392
- geometry: sn,
393
- material: G.body,
394
- position: [0, 0.2, 0],
395
- onClick: (n) => (n.stopPropagation(), l(c.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: [rn, 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__ */ N("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: h, 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: [an, G.vox, ie], visible: !1, frustumCulled: !1 }),
411
- /* @__PURE__ */ N("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(vt, { position: [0, 2, 0], text: c.name, color: yt[c.type], size: 0.32, pxRange: [9.5, 13.5] })
416
- ] });
417
- }
418
- const un = { queued: "#64748b", running: "#fde68a", done: "#5eead4", failed: "#f87171" }, dn = new s.Color("#334155"), fn = new s.Color("#5eead4"), hn = new s.Color("#ef4444"), Ht = { plan: "planner", research: "researcher", write: "writer" }, we = new s.BoxGeometry(1.5, 0.55, 1.25), mn = new s.EdgesGeometry(we), Ot = new s.BoxGeometry(1, 1, 1), le = new s.Vector3(0, 1, 0), Vt = new s.Vector3(), xt = new s.Vector3(), gn = new s.Vector3(), pe = new s.Matrix4();
419
- function ve(t, e) {
420
- return t.endedAt ? k(1 - (e - t.endedAt - 1200) / (We - 1200)) : 1;
421
- }
422
- function Mn({ run: t }) {
423
- const e = t.run ?? Q.runs.get(t.id);
424
- return e ? /* @__PURE__ */ o(xn, { kr: t, run: e }) : null;
425
- }
426
- function xn({ kr: t, run: e }) {
427
- const l = z(null), c = z(null), d = D(() => new s.MeshBasicMaterial({ toneMapped: !1, transparent: !0, blending: s.AdditiveBlending, depthWrite: !1 }), []), g = 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), h = z([]), b = z([]), y = z([]), L = z([]), G = z([]), m = z(null), V = z(null), F = z(""), n = D(() => ({ u0: 0, u1: 0, init: !1 }), []), r = D(() => ({ u0: 0, u1: 0 }), []);
428
- return ht(({ clock: i }, p) => {
429
- var _, W, j, I;
430
- const a = l.current;
431
- if (!a) return;
432
- Vt.copy(t.side), xt.copy(t.axis), gn.crossVectors(Vt, le).dot(xt) < 0 && xt.negate(), pe.makeBasis(Vt, le, xt), a.quaternion.setFromRotationMatrix(pe), a.position.copy(t.origin).addScaledVector(t.side, -t.cu).addScaledVector(t.axis, -t.cv);
433
- const u = xt.dot(t.axis) < 0 ? -1 : 1;
434
- Zt(t, r);
435
- const f = n.init ? 1 - Math.exp(-Math.min(0.1, p) / 0.2) : 1;
436
- n.init = !0, n.u0 += (r.u0 - n.u0) * f, n.u1 += (r.u1 - n.u1) * f;
437
- const C = Math.max(0.01, n.u1 - n.u0), v = St() * u, B = Math.max(0.7, ct.spread * 0.95), A = performance.now(), T = ve(e, A), w = i.elapsedTime;
438
- c.current && (c.current.position.set(n.u0, 0, v), c.current.scale.x = Math.max(1e-3, xe(k((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((U, E) => {
439
- U && (U.position.set(C / 2, 0.03, (E ? 0.5 : -0.5) * B), U.scale.set(C, 0.04, 0.07));
440
- }), (j = S.current) == null || j.scale.set(0.5, 0.08, B * 1.45), d.color.copy(x).multiplyScalar(0.32 * T), g.color.copy(x).multiplyScalar(2.4 * T), (I = m.current) == null || I.position.set(n.u0 + 0.2, 0.3, v - 1.5 * B * u);
441
- const P = Math.max(0.7, ct.spread * 0.9);
442
- if (zt.forEach((U, E) => {
443
- const K = h.current[E];
444
- K && (K.position.set(Pt(Ht[U]), 0, v), K.scale.setScalar(P), K.visible = e.hasSteps);
445
- const X = e.steps[U], tt = b.current[E], rt = y.current[E], J = L.current[E], et = G.current[E];
446
- if (!tt || !rt || !J || !et) return;
447
- const lt = X === "running", H = lt ? Y ? 1 : 0.75 + 0.35 * Math.sin(w * 6) : 1, at = X === "queued" ? dn : X === "done" ? fn : X === "failed" ? hn : x, At = X === "queued" ? 0.9 : X === "done" ? 1.1 : X === "failed" ? 2 : 3.2 * H;
448
- J.color.copy(at).multiplyScalar(At * T), rt.emissive.copy(at), rt.emissiveIntensity = (lt ? 0.9 * H : X === "done" ? 0.12 : 0.04) * T;
449
- const $ = lt ? 2.2 : X === "done" ? 1 : 0.7;
450
- tt.scale.y += ($ - tt.scale.y) * 0.12, tt.position.y = 0.55 * tt.scale.y / 2, et.visible = lt && T > 0.05, et.visible && (et.material.color.copy(x).multiplyScalar(0.55 * H * T), et.scale.y = 1 + 0.1 * Math.sin(w * 3));
451
- }), V.current) {
452
- const U = zt.map((E) => `${E}:${e.steps[E]}`).join(" ") + e.hasSteps;
453
- U !== F.current && (F.current = U, V.current.setText(
454
- `${e.hasSteps ? "hatchet · " : ""}${e.topic}`,
455
- e.hasSteps ? zt.map((E, K) => ({ text: `${K ? " " : ""}${E}${e.steps[E] === "done" ? " ·" : e.steps[E] === "failed" ? " ×" : ""}`, color: un[e.steps[E]] })) : [{ text: e.status === "started" ? "bus active" : "bus idle", color: "#64748b" }]
456
- )), V.current.setOpacity(0.35 + 0.65 * T);
457
- }
458
- }), /* @__PURE__ */ N("group", { ref: l, children: [
459
- /* @__PURE__ */ N("group", { ref: c, children: [
460
- /* @__PURE__ */ o("mesh", { ref: O, geometry: Ot, material: d }),
461
- [0, 1].map((i) => /* @__PURE__ */ o("mesh", { ref: (p) => void (R.current[i] = p), geometry: Ot, material: g }, i)),
462
- /* @__PURE__ */ o("mesh", { ref: S, geometry: Ot, material: M, position: [0, 0.04, 0] })
463
- ] }),
464
- zt.map((i, p) => /* @__PURE__ */ N("group", { ref: (a) => void (h.current[p] = a), visible: !1, children: [
465
- /* @__PURE__ */ N("group", { ref: (a) => void (b.current[p] = a), children: [
466
- /* @__PURE__ */ o("mesh", { geometry: we, children: /* @__PURE__ */ o("meshStandardMaterial", { ref: (a) => void (y.current[p] = a), color: "#070b16", metalness: 0.75, roughness: 0.3, toneMapped: !1 }) }),
467
- /* @__PURE__ */ o("lineSegments", { geometry: mn, children: /* @__PURE__ */ o("lineBasicMaterial", { ref: (a) => void (L.current[p] = a), toneMapped: !1 }) })
468
- ] }),
469
- /* @__PURE__ */ N("mesh", { ref: (a) => void (G.current[p] = a), position: [0, 3.2, 0], visible: !1, children: [
470
- /* @__PURE__ */ o("boxGeometry", { args: [0.12, 5, 0.12] }),
471
- /* @__PURE__ */ o("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: s.AdditiveBlending, depthWrite: !1 })
472
- ] }),
473
- /* @__PURE__ */ o(vt, { position: [0, 0.05, -1.05], text: `gate · ${i}`, color: "#5eead4", uppercase: !0, letterSpacing: 0.12, size: 0.18, opacity: 0.6, pxRange: [6.5, 9] })
474
- ] }, i)),
475
- /* @__PURE__ */ o("group", { ref: m, children: /* @__PURE__ */ o(
476
- vt,
477
- {
478
- ref: V,
479
- anchorX: "left",
480
- anchorY: "bottom",
481
- textAlign: "left",
482
- plate: "box",
483
- text: `${e.hasSteps ? "hatchet · " : ""}${e.topic}`,
484
- secondary: "",
485
- color: e.color,
486
- size: 0.36,
487
- maxWidth: 11,
488
- fit: !0,
489
- pxRange: [8, 14]
490
- }
491
- ) })
492
- ] });
493
- }
494
- const ue = new s.Vector3(), Wt = { u0: 0, u1: 0 };
495
- function yn(t) {
496
- for (const e of st.runs.values())
497
- Zt(e, Wt), t(Et(e, Wt.u0 + 3, St() - 2.4, ue), 1.6), t(Et(e, Wt.u1, St(), ue), 0.6);
498
- }
499
- const Qt = 2.1, Se = new s.BoxGeometry(1.5, 0.7, 3.2), bn = new s.EdgesGeometry(Se);
500
- function wn({ mcp: t }) {
501
- const e = t.srv, l = z(null), c = D(() => t.target.x <= 0, [t]), d = z(null), g = 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]), h = z(0);
502
- return ht(({ clock: b }, y) => {
503
- l.current && (l.current.position.set(t.pos.x, 0, t.pos.z), l.current.rotation.y = t.out.x < 0 ? 0 : Math.PI);
504
- const L = performance.now(), G = Q.mcpServers.get(e.name) ?? e, m = G.inflight > 0, V = Math.exp(-((L - G.activeAt) / 1e3) * 2.5), F = b.elapsedTime, r = (m ? 0.75 + 0.25 * Math.sin(F * 7) : 0.5 + 0.1 * Math.sin(F * 1.3)) + V * 2.5 + (m ? 1 : 0);
505
- h.current += y * (Y ? 0.3 : m ? 4.5 : 0.6), d.current && (d.current.rotation.y = h.current, d.current.children[0].rotation.x = h.current * 0.7, d.current.scale.setScalar(1 + V * 0.35), d.current.position.y = 1.7 + (Y ? 0 : Math.sin(F * 1.6 + G.slot) * 0.08)), M.color.copy(S).multiplyScalar(0.9 + r * 0.9), O.color.copy(S).multiplyScalar(1.2 + r * 1.4), g.current && g.current.color.copy(S).multiplyScalar(0.5 + r * 1.3), x.current && x.current.color.copy(S).multiplyScalar(0.6 + r * 0.8), R.current && R.current.color.copy(S).multiplyScalar(0.15 + r * 0.35);
506
- }), /* @__PURE__ */ N("group", { ref: l, children: [
507
- /* @__PURE__ */ o("mesh", { geometry: Se, position: [0, 0.35, 0], children: /* @__PURE__ */ o("meshStandardMaterial", { color: "#070b16", metalness: 0.8, roughness: 0.28 }) }),
508
- /* @__PURE__ */ o("lineSegments", { geometry: bn, position: [0, 0.35, 0], children: /* @__PURE__ */ o("lineBasicMaterial", { ref: x, toneMapped: !1 }) }),
509
- /* @__PURE__ */ N("mesh", { position: [0, 0.71, 0], children: [
510
- /* @__PURE__ */ o("boxGeometry", { args: [0.3, 0.02, 2.8] }),
511
- /* @__PURE__ */ o("meshBasicMaterial", { ref: g, toneMapped: !1 })
512
- ] }),
513
- Array.from({ length: 7 }, (b, y) => /* @__PURE__ */ N("mesh", { position: [0.95 + (Qt - 1) / 2, 0.02, -1.2 + y * 0.4], children: [
514
- /* @__PURE__ */ o("boxGeometry", { args: [Qt - 1, 0.02, 0.06] }),
515
- /* @__PURE__ */ o("meshBasicMaterial", { color: S.clone().multiplyScalar(0.55), toneMapped: !1 })
516
- ] }, y)),
517
- /* @__PURE__ */ N("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, 0.02, 0], children: [
518
- /* @__PURE__ */ o("planeGeometry", { args: [5, 6] }),
519
- /* @__PURE__ */ o("meshBasicMaterial", { ref: R, map: kt(), toneMapped: !1, transparent: !0, blending: s.AdditiveBlending, depthWrite: !1 })
520
- ] }),
521
- /* @__PURE__ */ N("group", { ref: d, position: [0, 1.7, 0], children: [
522
- /* @__PURE__ */ o("mesh", { material: M, children: /* @__PURE__ */ o("torusGeometry", { args: [0.55, 0.05, 6, 24] }) }),
523
- /* @__PURE__ */ o("mesh", { material: M, rotation: [Math.PI / 2, 0, 0], children: /* @__PURE__ */ o("torusGeometry", { args: [0.42, 0.03, 6, 20] }) }),
524
- /* @__PURE__ */ o("mesh", { material: O, children: /* @__PURE__ */ o("octahedronGeometry", { args: [0.2, 0] }) })
525
- ] }),
526
- /* @__PURE__ */ o(vt, { position: [-1.1, 0.6, 0], anchorX: c ? "right" : "left", text: `mcp · ${e.name}`, color: e.color, size: 0.3, pxRange: [9, 13] })
527
- ] });
528
- }
529
- const Nt = 1800, Ut = 360, de = new s.Color("#fbbf24"), vn = new s.Color("#ef4444"), ut = new s.Color(1, 1, 1), Dt = { u0: 0, u1: 0 }, it = new s.Vector3(), nt = new s.Vector3(), $t = new s.Vector3();
530
- function Sn() {
531
- const t = Ne(), e = z(null), l = z(null), c = D(
532
- () => ({
533
- o: new s.Object3D(),
534
- c: new s.Color(),
535
- c2: new s.Color(),
536
- path: new He(),
537
- pt: { x: 0, z: 0 },
538
- pt2: { x: 0, z: 0 },
539
- nw: 0,
540
- nh: 0
541
- }),
542
- []
543
- );
544
- ht(() => {
545
- const g = e.current, x = l.current;
546
- if (!g || !x) return;
547
- const M = performance.now(), { o: O, c: R, c2: S, path: h, pt: b, pt2: y } = c;
548
- c.nw = 0, c.nh = 0;
549
- const L = (n, r, i, p, a, u, f, C, v) => {
550
- if (c.nw >= Nt || v < 3e-3) return;
551
- const B = Math.hypot(i - n, p - r);
552
- B < 0.01 || (O.position.set((n + i) / 2, a + f / 2, (r + p) / 2), O.rotation.set(0, -Math.atan2(p - r, i - n), 0), O.scale.set(B + u * 0.5, f, u), O.updateMatrix(), g.setMatrixAt(c.nw, O.matrix), g.setColorAt(c.nw++, S.copy(C).multiplyScalar(v)));
553
- }, G = (n, r, i, p, a, u, f, C) => {
554
- c.nh >= Ut || C < 3e-3 || (O.position.set(n, r, i), O.rotation.set(0, -p, 0), O.scale.set(a, u, u), O.updateMatrix(), x.setMatrixAt(c.nh, O.matrix), x.setColorAt(c.nh++, S.copy(f).multiplyScalar(C)));
555
- }, m = (n, r, i, p, a, u, f) => {
556
- const C = h.len, v = k(Math.min(n, r)) * C, B = k(Math.max(n, r)) * C;
557
- if (!(B - v < 0.01))
558
- for (let A = 0; A < h.n - 1; A++) {
559
- const T = h.l[A], w = h.l[A + 1], P = Math.max(v, T), _ = Math.min(B, w);
560
- if (_ <= P) continue;
561
- const W = w - T || 1, j = (P - T) / W, I = (_ - T) / W, U = h.x[A + 1] - h.x[A], E = h.z[A + 1] - h.z[A];
562
- L(h.x[A] + U * j, h.z[A] + E * j, h.x[A] + U * I, h.z[A] + E * I, i, p, a, u, f);
563
- }
564
- }, V = (n, r, i, p, a = 0.4, u = !1) => {
565
- const f = h.at(n, b) + (u ? Math.PI : 0);
566
- u ? (m(1, n + a, r, 0.05, 0.05, i, p * 0.35), m(n + a, n, r, 0.07, 0.2, i, p * 1.2)) : (m(0, n - a, r, 0.05, 0.05, i, p * 0.35), m(n - a, n, r, 0.07, 0.2, i, p * 1.2)), G(b.x, r + 0.12, b.z, f, 0.42, 0.17, ut, p * 2.2), G(b.x, r + 0.12, b.z, f, 0.7, 0.3, i, p * 1.2);
567
- };
568
- for (const n of st.runs.values()) {
569
- const r = n.run;
570
- if (!r) continue;
571
- const i = ve(r, M), p = Z(r.color);
572
- Zt(n, Dt), Mt(n, Dt.u0, it);
573
- const a = M - r.startedAt;
574
- if (a < 1300) {
575
- const f = ft(k(a / 1300));
576
- Mt(n, r.hasSteps ? Pt("planner") : n.cu, nt), h.begin().pt(it.x, it.z).pt(nt.x, nt.z), V(f, 0.06, p, 2.2 * (a > 1100 ? (1300 - a) / 200 : 1), 0.6);
577
- }
578
- const u = M - r.handoffAt;
579
- if (r.handoffAt && u < 1300) {
580
- const f = ft(k(u / 1e3)), C = u > 1e3 ? 1 - (u - 1e3) / 300 : 1;
581
- Mt(n, Pt(Ht[r.handoffFrom]), nt), Mt(n, Pt(Ht[r.handoffTo]), $t), h.begin().pt(nt.x, nt.z).pt($t.x, $t.z), V(f, 0.06, ut, 1.4 * C, 0.5), V(f, 0.06, p, 2.4 * C, 0.5);
582
- }
583
- if (r.status === "started" && !Y) {
584
- Mt(n, Dt.u1, nt), h.begin().pt(it.x, it.z).pt(nt.x, nt.z);
585
- for (let f = 0; f < 3; f++) {
586
- const C = ((M / 5200 + f / 3) % 1 + 1) % 1;
587
- h.at(C, b), G(b.x, 0.08, b.z + (f - 1) * 0.28, 0, 0.5, 0.06, p, 1.3 * i);
588
- }
589
- }
590
- }
591
- for (const n of st.agents.values()) {
592
- const r = n.inst, i = n.live, p = jt(r, M), a = Z(yt[r.type]);
593
- if (Me(r) || (Et(n.run, 0, St(), it), L(i.x, i.z - 0.75, i.x, it.z + 0.45, 0.02, 0.09, 0.03, Z(n.run.color), 1.4 * p)), !r.parent) continue;
594
- const u = dt(r.parent);
595
- if (!u) continue;
596
- const f = Q.instances.get(r.parent), C = p * (f ? Math.max(0.35, jt(f, M)) : 1), v = k((M - r.bornAt) / 520), B = u.x + 0.95;
597
- if (h.begin().pt(u.x + 0.6, u.z).pt(B, u.z).pt(i.x - 0.55, i.z), m(0, v, 0.03, 0.12, 0.05, a, 2.4 * C), m(0, v, 0.03, 0.4, 0.01, a, 0.35 * C), v < 1) {
598
- const A = h.at(v, b);
599
- G(b.x, 0.15, b.z, A, 0.4, 0.16, ut, 3);
600
- }
601
- }
602
- for (const n of Q.comets) {
603
- const r = dt(n.from), i = dt(n.to);
604
- if (!r || !i) continue;
605
- const p = (M - n.start) / n.dur, a = Q.instances.get(n.from), u = Z(a ? yt[a.type] : "#ffffff");
606
- h.begin().pt(r.x, r.z).pt(i.x, r.z).pt(i.x, i.z), p < 1 ? V(ft(k(p)), 0.3, u, 2, 0.45) : m(0, 1, 0.3, 0.05, 0.05, u, 0.8 * (1 - (p - 1) * 4));
607
- }
608
- if (st.graphWanted && t.nodes.length && st.graph.mix > 0.05)
609
- for (const n of Q.flares) {
610
- const r = M - n.start, i = dt(n.instance);
611
- if (!i) continue;
612
- const p = qt(t, n.node);
613
- ge(p, y);
614
- const a = y.z, u = y.x;
615
- ee(u - 0.4, a, y);
616
- const f = y.x, C = y.z;
617
- ee(me, a, y);
618
- const v = n.op === "write", B = Q.instances.get(n.instance), A = v ? ut : Z(B ? yt[B.type] : "#22d3ee"), T = y.x < i.x ? -0.6 : 0.6;
619
- if (h.begin().pt(i.x + T, i.z).pt(y.x, i.z).pt(y.x, y.z).pt(f, C), r < bt) V(ft(r / bt), 0.04, A, v ? 2.4 : 1.6, 0.35);
620
- else {
621
- const w = Math.exp(-((r - bt) / 1e3) * 2.4);
622
- m(0, 1, 0.04, 0.05, 0.04, A, (v ? 1 : 0.7) * w);
623
- }
624
- }
625
- const F = (n, r) => {
626
- const i = dt(n), p = Q.mcpServers.get(r), a = st.mcp.get(r);
627
- if (!i || !p || !a) return null;
628
- const u = a.out.x < 0 ? -1 : 1, f = a.pos.x - u * Qt;
629
- return h.begin().pt(i.x + u * 0.6, i.z).pt(f, i.z).pt(f, a.pos.z).pt(a.pos.x - u * 0.8, a.pos.z), p;
630
- };
631
- for (const n of Q.mcpPending.values()) {
632
- const r = F(n.instance, n.server);
633
- if (!r) continue;
634
- const i = Ue(n, M);
635
- R.copy(Z(r.color)), i < 1.2 ? R.lerp(de, i / 1.2) : R.copy(de).lerp(vn, k((i - 1.2) / 1));
636
- const p = 0.55 + Math.min(i, 3) * 0.45, a = i > 2.2 && !Y ? 0.75 + 0.25 * Math.sin(M / 45) : 1;
637
- m(0, 1, 0.16, 0.11, 0.11, R, 0.75 * p * a), m(0, 1, 0.12, 0.5, 0.02, R, 0.22 * p);
638
- for (let u = 0; u < 6; u++) {
639
- const f = Y ? u / 6 : (M / 900 * (1 + i * 0.4) + u / 6) % 1, C = h.at(f, b);
640
- G(b.x, 0.28, b.z, C, 0.42, 0.16, R, 2 * p);
641
- }
642
- }
643
- for (const n of Q.mcpResolved) {
644
- const r = F(n.instance, n.server);
645
- if (!r) continue;
646
- const i = k((M - n.resolvedAt) / 700), p = 1 - xe(i), a = Z(r.color);
647
- m(0, 1, 0.16, 0.06, 0.06, a, 0.6 * (1 - i) * (1 - i)), m(p, p + 0.22, 0.16, 0.1, 0.22, ut, 2.2 * (1 - i * 0.5));
648
- const u = h.at(p, b) + Math.PI;
649
- G(b.x, 0.3, b.z, u, 0.6, 0.26, ut, 3.2);
650
- }
651
- for (const n of Q.mcpCalls) {
652
- const r = F(n.instance, n.server);
653
- if (!r) continue;
654
- const i = (M - n.start) / n.dur;
655
- if (i >= 1) continue;
656
- const p = Z(r.color), a = ft(k(i));
657
- n.phase === "call" ? V(a, 0.36, p, 1.8, 0.35) : V(1 - a, 0.36, p, 1.8, 0.35, !0);
658
- }
659
- if (!Y)
660
- for (let n = 0; n < wt.length; n += 7) {
661
- const r = wt[n];
662
- h.begin();
663
- for (let u = 0; u < r.pts.length; u += 2) h.pt(r.pts[u], r.pts[u + 1]);
664
- const i = (M / 1e3 * (0.12 + n % 5 * 0.03) + n * 0.137) % 1, p = h.at(i, b), a = Z(r.magenta ? "#e879f9" : "#22d3ee");
665
- m(i - 0.12, i, 0.01, 0.06, 0.02, a, 0.6), G(b.x, 0.05, b.z, p, 0.3, 0.07, a, 1.6);
666
- }
667
- g.count = c.nw, x.count = c.nh, g.instanceMatrix.needsUpdate = !0, x.instanceMatrix.needsUpdate = !0, g.instanceColor && (g.instanceColor.needsUpdate = !0), x.instanceColor && (x.instanceColor.needsUpdate = !0);
668
- });
669
- const d = (g, x) => {
670
- g && !g.instanceColor && (g.instanceColor = new s.InstancedBufferAttribute(new Float32Array(x * 3), 3), g.count = 0);
671
- };
672
- return /* @__PURE__ */ N(Yt, { children: [
673
- /* @__PURE__ */ N(
674
- "instancedMesh",
675
- {
676
- ref: (g) => {
677
- e.current = g, d(g, Nt);
678
- },
679
- args: [void 0, void 0, Nt],
680
- frustumCulled: !1,
681
- children: [
682
- /* @__PURE__ */ o("boxGeometry", {}),
683
- /* @__PURE__ */ o("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: s.AdditiveBlending, depthWrite: !1 })
684
- ]
685
- }
686
- ),
687
- /* @__PURE__ */ N(
688
- "instancedMesh",
689
- {
690
- ref: (g) => {
691
- l.current = g, d(g, Ut);
692
- },
693
- args: [void 0, void 0, Ut],
694
- frustumCulled: !1,
695
- children: [
696
- /* @__PURE__ */ o("boxGeometry", {}),
697
- /* @__PURE__ */ o("meshBasicMaterial", { toneMapped: !1 })
698
- ]
699
- }
700
- )
701
- ] });
702
- }
703
- const Ft = new s.Vector3();
704
- function An(t) {
705
- yn(t);
706
- for (const e of st.agents.values()) t(Ft.set(e.target.x, 1.6 * e.scale, e.target.z), 0.6);
707
- for (const e of st.mcp.values()) t(Ft.set(e.target.x, 1.7, e.target.z), 1.8);
708
- for (const e of $e()) t(Ft.copy(st.clusterTarget[e]).setY(1), 3.6);
709
- }
710
- function zn() {
711
- const t = Be((e) => e.scene);
712
- return ht(() => {
713
- const e = t.fog;
714
- if (!e) return;
715
- const l = ct.cam.dist || 40;
716
- e.near = l * 0.85, e.far = l * 2.6;
717
- }), null;
718
- }
719
- const Cn = /* @__PURE__ */ N(Yt, { children: [
720
- /* @__PURE__ */ o(zn, {}),
721
- /* @__PURE__ */ o("fog", { attach: "fog", args: ["#010309", 45, 120] }),
722
- /* @__PURE__ */ o("ambientLight", { intensity: 0.35 }),
723
- /* @__PURE__ */ o("hemisphereLight", { args: ["#67e8f9", "#1e0b2e", 0.6] }),
724
- /* @__PURE__ */ o("directionalLight", { position: [-8, 14, 10], intensity: 1.4, color: "#c4b5fd" }),
725
- /* @__PURE__ */ o("pointLight", { position: [18, 6, -8], intensity: 60, distance: 40, color: "#22d3ee" }),
726
- /* @__PURE__ */ o("pointLight", { position: [-14, 5, 2], intensity: 50, distance: 36, color: "#e879f9" }),
727
- /* @__PURE__ */ o(on, {})
728
- ] });
729
- function In() {
730
- return /* @__PURE__ */ o(
731
- De,
732
- {
733
- title: "circuit",
734
- subtitle: "Hatchet buses · agent chips · graph memory bank · MCP I/O ports",
735
- preset: "lanes",
736
- plane: "xz",
737
- camera: { position: [1.6, 21, 30], fov: 50, near: 0.1, far: 300 },
738
- controls: { minPolarAngle: 0.6, maxPolarAngle: 1.42 },
739
- bg: "#010309",
740
- fit: { nRef: 4, min: 0.62, max: 1.3, minRadius: 5.5 },
741
- agentRadius: 1.2,
742
- graph: { natural: Xe, radius: 3.4 },
743
- peripheryGap: 4.4,
744
- Background: Cn,
745
- Agent: pn,
746
- RunMarker: Mn,
747
- McpServer: wn,
748
- GraphResource: Ze,
749
- cluster: { radius: 1.1, variant: "orb", glowGain: 0.85 },
750
- clusterOffset: [0, 2.2, 0],
751
- extents: An,
752
- PostFX: /* @__PURE__ */ N(Ge, { multisampling: 0, children: [
753
- /* @__PURE__ */ o(Pe, { mipmapBlur: !0, intensity: 1.25, luminanceThreshold: 0.22, luminanceSmoothing: 0.25, radius: 0.72 }),
754
- /* @__PURE__ */ o(Re, { eskil: !1, offset: 0.22, darkness: 0.9 }),
755
- /* @__PURE__ */ o(_e, { opacity: 0.03 })
756
- ] }),
757
- children: /* @__PURE__ */ o(Sn, {})
758
- }
759
- );
760
- }
761
- export {
762
- In as default
763
- };