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,1010 +0,0 @@
1
- var Xt = Object.defineProperty;
2
- var Yt = (e, t, o) => t in e ? Xt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
3
- var O = (e, t, o) => Yt(e, typeof t != "symbol" ? t + "" : t, o);
4
- import { jsxs as R, Fragment as ve, jsx as s } from "react/jsx-runtime";
5
- import { useFrame as N, useThree as Zt } from "@react-three/fiber";
6
- import { EffectComposer as $t, Bloom as Jt, Vignette as Qt } from "@react-three/postprocessing";
7
- import { useRef as P, useMemo as A, useEffect as pe } from "react";
8
- import * as n from "three";
9
- import { a as je, h as eo, n as ie, z as Xe, c as to, f as Ke, r as K, T as Te, w as V, L as we, d as oo, N as no, v as Ye, S as Ze, R as so, j as Ae, u as _t, H as ao, t as ro, s as io, K as lo, o as co, G as po, q as uo, m as mo, E as ho } from "./KitScene-DG_pcnWW.js";
10
- const Rt = 1.6, zt = 1.1;
11
- function It(e, t) {
12
- const o = Ke.spread;
13
- return t.u0 = e.cu - e.hu - Rt * o, t.u1 = e.cu + e.hu + Rt * o, t.v0 = e.cv - e.hv - zt * o, t.v1 = e.cv + e.hv + zt * o, t;
14
- }
15
- const $e = { plan: "planner", research: "researcher", write: "writer" };
16
- function fo(e) {
17
- const t = Xe($e.plan), o = Xe($e.research), r = Xe($e.write);
18
- return e.b1 = (t + o) / 2, e.b2 = o + (r - o) * 0.8, e;
19
- }
20
- function Pt(e, t, o) {
21
- return e === 0 ? (t.u0 + o.b1) / 2 : e === 1 ? (o.b1 + o.b2) / 2 : (o.b2 + t.u1) / 2;
22
- }
23
- const go = 1.55, lt = /* @__PURE__ */ new Map();
24
- function fe(e, t) {
25
- const o = je(e);
26
- if (o)
27
- return t.set(o.x, lt.get(e) ?? 0.5, o.z);
28
- }
29
- function Je(e, t) {
30
- const o = ie.mcp.get(e);
31
- if (o)
32
- return t.set(o.pos.x - o.out.x * 1.9, 1.3, o.pos.z);
33
- }
34
- function yo(e, t) {
35
- const o = to(e);
36
- if (o)
37
- return t.set(o.x, 0.75, o.z);
38
- }
39
- const oe = 16, Ve = 12, X = 1, ze = 0.92, Pe = 0.42, Ce = -15 / 2, re = 0, H = oe * Ve, vo = Pe + Ve * ze + 0.1, Ft = oe * X / 2 + 0.6;
40
- function Ue(e, t) {
41
- const o = e % oe, r = Math.floor(e / oe) % Ve;
42
- return t.set(Ce + o * X, Pe + r * ze + 0.26, re + 0.05);
43
- }
44
- const U = (e) => e < 0 ? 0 : e > 1 ? 1 : e, ke = (e) => 1 - Math.pow(1 - U(e), 3), wo = (e) => Math.pow(U(e), 2.2), ge = (e) => {
45
- const t = U(e);
46
- return t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2;
47
- };
48
- function de(e, t, o, r, a) {
49
- const l = 1 - r;
50
- return a.set(l * l * e.x + 2 * l * r * t.x + r * r * o.x, l * l * e.y + 2 * l * r * t.y + r * r * o.y, l * l * e.z + 2 * l * r * t.z + r * r * o.z);
51
- }
52
- function Le(e, t, o, r) {
53
- return r.addVectors(e, t).multiplyScalar(0.5), r.y = Math.max(e.y, t.y) + o + e.distanceTo(t) * 0.18, r;
54
- }
55
- const Lt = /* @__PURE__ */ new Map();
56
- function Y(e) {
57
- let t = Lt.get(e);
58
- return t || Lt.set(e, t = new n.Color(e)), t;
59
- }
60
- const E = new n.Color("#ffab1a");
61
- new n.Color("#ff6a13");
62
- const te = new n.Color("#ffd23f"), Re = new n.Color("#ff2d2d"), Ee = new n.Color("#ffffff");
63
- new n.Color("#3b3440");
64
- const bo = (e) => eo(e, 99);
65
- function ct(e, t, o, r = !1) {
66
- const a = document.createElement("canvas");
67
- a.width = e, a.height = t, o(a.getContext("2d"));
68
- const l = new n.CanvasTexture(a);
69
- return l.colorSpace = n.SRGBColorSpace, l.anisotropy = 4, r && (l.wrapS = l.wrapT = n.RepeatWrapping), l;
70
- }
71
- let xe = null;
72
- function Mo() {
73
- return xe || (xe = ct(128, 128, (e) => {
74
- const t = e.createRadialGradient(64, 64, 0, 64, 64, 64);
75
- t.addColorStop(0, "rgba(255,255,255,1)"), t.addColorStop(0.18, "rgba(255,255,255,0.55)"), t.addColorStop(0.5, "rgba(255,255,255,0.12)"), t.addColorStop(1, "rgba(255,255,255,0)"), e.fillStyle = t, e.fillRect(0, 0, 128, 128);
76
- }), xe.colorSpace = n.NoColorSpace, xe);
77
- }
78
- let Ge = null;
79
- function Wt() {
80
- return Ge || (Ge = ct(
81
- 128,
82
- 32,
83
- (e) => {
84
- e.fillStyle = "#120d06", e.fillRect(0, 0, 128, 32), e.fillStyle = "#ffb81c";
85
- for (let t = -32; t < 160; t += 32)
86
- e.beginPath(), e.moveTo(t, 32), e.lineTo(t + 16, 32), e.lineTo(t + 32, 0), e.lineTo(t + 16, 0), e.closePath(), e.fill();
87
- },
88
- !0
89
- ), Ge);
90
- }
91
- let _e = null;
92
- function Dt() {
93
- return _e || (_e = ct(64, 64, (e) => {
94
- e.fillStyle = "#5a5a5a", e.fillRect(0, 0, 64, 64), e.strokeStyle = "#ffffff", e.lineWidth = 7, e.strokeRect(3.5, 3.5, 57, 57), e.lineWidth = 4, e.beginPath(), e.moveTo(6, 6), e.lineTo(58, 58), e.stroke(), e.fillStyle = "#8a8a8a", e.fillRect(6, 30, 52, 4);
95
- }), _e);
96
- }
97
- function ce(e = "#fff") {
98
- return new n.SpriteMaterial({ map: Mo(), color: e, transparent: !0, depthWrite: !1, blending: n.AdditiveBlending, toneMapped: !1 });
99
- }
100
- function We(e = "#fff", t = n.FrontSide) {
101
- return new n.MeshBasicMaterial({ color: e, transparent: !0, depthWrite: !1, blending: n.AdditiveBlending, toneMapped: !1, side: t });
102
- }
103
- function le(e = "#fff") {
104
- return new n.MeshBasicMaterial({ color: e, toneMapped: !1 });
105
- }
106
- const S = new n.BoxGeometry(1, 1, 1), T = new n.CylinderGeometry(1, 1, 1, 24);
107
- new n.CylinderGeometry(1, 1, 1, 12);
108
- const Bt = new n.RingGeometry(0.86, 1, 64).rotateX(-Math.PI / 2);
109
- new n.PlaneGeometry(1, 1).rotateX(-Math.PI / 2);
110
- const jt = new n.ConeGeometry(1, 1, 12).translate(0, 0.5, 0), xo = new n.EdgesGeometry(S), j = K ? 220 : 900, d = {
111
- n: j,
112
- head: 0,
113
- px: new Float32Array(j),
114
- py: new Float32Array(j),
115
- pz: new Float32Array(j),
116
- vx: new Float32Array(j),
117
- vy: new Float32Array(j),
118
- vz: new Float32Array(j),
119
- life: new Float32Array(j),
120
- // seconds left (<=0 = dead)
121
- max: new Float32Array(j),
122
- r: new Float32Array(j),
123
- g: new Float32Array(j),
124
- b: new Float32Array(j)
125
- };
126
- function Qe(e, t, o, r = 4, a = 1.6, l = 1) {
127
- const u = K ? Math.ceil(t / 4) : t;
128
- for (let i = 0; i < u; i++) {
129
- const c = d.head;
130
- d.head = (d.head + 1) % d.n;
131
- const p = Math.random() * Math.PI * 2, y = a * (0.3 + Math.random() * 0.7);
132
- d.px[c] = e.x, d.py[c] = e.y, d.pz[c] = e.z, d.vx[c] = Math.cos(p) * y, d.vz[c] = Math.sin(p) * y, d.vy[c] = l * r * (0.55 + Math.random() * 0.6);
133
- const h = 0.45 + Math.random() * 0.75;
134
- d.life[c] = h, d.max[c] = h;
135
- const v = Math.random() * 0.5;
136
- d.r[c] = o.r + (1 - o.r) * v, d.g[c] = o.g + (1 - o.g) * v, d.b[c] = o.b + (1 - o.b) * v;
137
- }
138
- }
139
- class So {
140
- constructor() {
141
- O(this, "mesh");
142
- O(this, "o", new n.Object3D());
143
- O(this, "v", new n.Vector3());
144
- O(this, "c", new n.Color());
145
- const t = new n.BoxGeometry(0.035, 0.035, 1).translate(0, 0, -0.5), o = new n.MeshBasicMaterial({ transparent: !0, depthWrite: !1, blending: n.AdditiveBlending, toneMapped: !1 });
146
- this.mesh = new n.InstancedMesh(t, o, d.n), this.mesh.frustumCulled = !1, this.mesh.count = 0, this.mesh.instanceMatrix.setUsage(n.DynamicDrawUsage), this.mesh.setColorAt(0, new n.Color());
147
- }
148
- update(t) {
149
- const o = Math.min(t, 0.05);
150
- let r = 0;
151
- const a = this.o;
152
- for (let l = 0; l < d.n; l++) {
153
- if (d.life[l] <= 0 || (d.life[l] -= o, d.vy[l] -= 9.5 * o, d.px[l] += d.vx[l] * o, d.py[l] += d.vy[l] * o, d.pz[l] += d.vz[l] * o, d.py[l] < 0.02 && (d.py[l] = 0.02, d.vy[l] *= -0.32, d.vx[l] *= 0.6, d.vz[l] *= 0.6), d.life[l] <= 0)) continue;
154
- const u = d.life[l] / d.max[l];
155
- a.position.set(d.px[l], d.py[l], d.pz[l]), this.v.set(d.px[l] + d.vx[l], d.py[l] + d.vy[l], d.pz[l] + d.vz[l]), a.lookAt(this.v);
156
- const i = Math.hypot(d.vx[l], d.vy[l], d.vz[l]);
157
- a.scale.set(1, 1, Math.min(0.5, 0.03 + i * 0.045)), a.updateMatrix(), this.mesh.setMatrixAt(r, a.matrix);
158
- const c = u * u * 2.2;
159
- this.c.setRGB(d.r[l] * c, d.g[l] * c, d.b[l] * c), this.mesh.setColorAt(r, this.c), r++;
160
- }
161
- this.mesh.count = r, this.mesh.instanceMatrix.needsUpdate = !0, this.mesh.instanceColor && (this.mesh.instanceColor.needsUpdate = !0);
162
- }
163
- }
164
- class qe {
165
- constructor(t, o = 24) {
166
- O(this, "seg");
167
- O(this, "max");
168
- O(this, "geo", new n.BufferGeometry());
169
- O(this, "lines");
170
- O(this, "n", 0);
171
- O(this, "p", new n.Vector3());
172
- O(this, "c", new n.Color());
173
- this.max = t, this.seg = o, this.geo.setAttribute("position", new n.BufferAttribute(new Float32Array(t * o * 2 * 3), 3).setUsage(n.DynamicDrawUsage)), this.geo.setAttribute("color", new n.BufferAttribute(new Float32Array(t * o * 2 * 3), 3).setUsage(n.DynamicDrawUsage)), this.geo.boundingSphere = new n.Sphere(new n.Vector3(), 1e4), this.lines = new n.LineSegments(this.geo, new n.LineBasicMaterial({ vertexColors: !0, transparent: !0, depthWrite: !1, blending: n.AdditiveBlending, toneMapped: !1 })), this.lines.frustumCulled = !1;
174
- }
175
- begin() {
176
- this.n = 0;
177
- }
178
- /** head in 0..1 = bright travelling pulse position (−1 = none); dash > 0 = marching dashes in the travel direction. */
179
- add(t, o, r, a, l, u = -1, i = 0, c = 0) {
180
- if (this.n >= this.max || l <= 2e-3) return;
181
- const p = this.geo.getAttribute("position"), y = this.geo.getAttribute("color"), h = this.n * this.seg * 2;
182
- for (let v = 0; v < this.seg; v++)
183
- for (let z = 0; z < 2; z++) {
184
- const w = (v + z) / this.seg, f = 1 - w;
185
- this.p.set(f * f * t.x + 2 * f * w * o.x + w * w * r.x, f * f * t.y + 2 * f * w * o.y + w * w * r.y, f * f * t.z + 2 * f * w * o.z + w * w * r.z);
186
- const b = h + v * 2 + z;
187
- p.setXYZ(b, this.p.x, this.p.y, this.p.z);
188
- let C = 0.35;
189
- i > 0 && (C += 0.55 * Math.max(0, Math.sin((w * i - c) * Math.PI * 2)) ** 3), u >= 0 && (C += 1.6 * Math.exp(-(((w - u) / 0.07) ** 2))), this.c.copy(a).multiplyScalar(l * C), y.setXYZ(b, this.c.r, this.c.g, this.c.b);
190
- }
191
- this.n++;
192
- }
193
- end() {
194
- this.geo.setDrawRange(0, this.n * this.seg * 2), this.geo.getAttribute("position").needsUpdate = !0, this.geo.getAttribute("color").needsUpdate = !0;
195
- }
196
- }
197
- const Be = class Be {
198
- constructor(t, o, r) {
199
- O(this, "mesh");
200
- O(this, "n", 0);
201
- O(this, "o", new n.Object3D());
202
- O(this, "c", new n.Color());
203
- O(this, "d", new n.Vector3());
204
- this.mesh = new n.InstancedMesh(t, o, r), this.mesh.frustumCulled = !1, this.mesh.count = 0, this.mesh.instanceMatrix.setUsage(n.DynamicDrawUsage), this.mesh.setColorAt(0, new n.Color());
205
- }
206
- begin() {
207
- this.n = 0;
208
- }
209
- /** Place at p, oriented so local +y points along dir (or yaw-only when dir is null), scaled (sx, sy, sz). */
210
- add(t, o, r, a, l, u, i, c = 0) {
211
- if (this.n >= this.mesh.instanceMatrix.count || i <= 2e-3) return;
212
- const p = this.o;
213
- p.position.copy(t), o ? p.quaternion.setFromUnitVectors(Be.UP, this.d.copy(o).normalize()) : p.quaternion.setFromAxisAngle(Be.UP, c), p.scale.set(r, a, l), p.updateMatrix(), this.mesh.setMatrixAt(this.n, p.matrix), this.mesh.setColorAt(this.n, this.c.copy(u).multiplyScalar(i)), this.n++;
214
- }
215
- end() {
216
- this.mesh.count = this.n, this.mesh.instanceMatrix.needsUpdate = !0, this.mesh.instanceColor && (this.mesh.instanceColor.needsUpdate = !0);
217
- }
218
- };
219
- O(Be, "UP", new n.Vector3(0, 1, 0));
220
- let ye = Be;
221
- const De = 0.3, Ao = (
222
- /* glsl */
223
- `
224
- varying vec2 vUv;
225
- void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }`
226
- ), Co = (
227
- /* glsl */
228
- `
229
- varying vec2 vUv;
230
- uniform float uLen, uTime, uGrow, uOp, uFlow;
231
- uniform vec3 uCol, uHot;
232
- void main() {
233
- float u = vUv.x * uLen; // metres along the belt (0 = parent)
234
- if (vUv.x > uGrow) discard;
235
- float v = vUv.y - 0.5; // -0.5..0.5 across
236
- float rail = smoothstep(0.36, 0.42, abs(v));
237
- // chevrons pointing toward the child, scrolling with the flow
238
- float ch = fract((u - uTime * 1.4 * uFlow) / 0.62 - abs(v) * 1.1);
239
- float chev = smoothstep(0.0, 0.08, ch) * (1.0 - smoothstep(0.16, 0.26, ch)) * (1.0 - rail);
240
- float roll = 0.5 + 0.5 * sin(u * 18.0);
241
- vec3 c = vec3(0.035, 0.028, 0.025) * (0.7 + 0.3 * roll);
242
- c += uCol * chev * 0.55;
243
- c += uHot * rail * 0.75;
244
- // growing tip glows while the belt is being laid
245
- c += uHot * exp(-pow((vUv.x - uGrow) * uLen / 0.35, 2.0)) * step(uGrow, 0.999) * 1.5;
246
- gl_FragColor = vec4(c * uOp, 1.0);
247
- #include <colorspace_fragment>
248
- }`
249
- ), Ro = new n.PlaneGeometry(1, 1).rotateX(-Math.PI / 2);
250
- function zo({ child: e }) {
251
- const t = e.inst, o = P(null), r = P(null), a = A(
252
- () => new n.ShaderMaterial({
253
- vertexShader: Ao,
254
- fragmentShader: Co,
255
- uniforms: {
256
- uLen: { value: 1 },
257
- uTime: { value: 0 },
258
- uGrow: { value: 0 },
259
- uOp: { value: 1 },
260
- uFlow: { value: 1 },
261
- uCol: { value: Y(Te[t.type]).clone().lerp(E, 0.45) },
262
- uHot: { value: E.clone() }
263
- },
264
- polygonOffset: !0,
265
- polygonOffsetFactor: -1
266
- }),
267
- [t.type]
268
- ), l = A(() => new n.MeshStandardMaterial({ color: "#15110f", metalness: 0.5, roughness: 0.5, transparent: !0 }), []);
269
- pe(
270
- () => () => {
271
- a.dispose(), l.dispose();
272
- },
273
- [a, l]
274
- );
275
- const u = A(() => ({ k: 0, a: new n.Vector3(), b: new n.Vector3() }), []);
276
- return N((i, c) => {
277
- const p = t.parent ? V.instances.get(t.parent) ?? V.archive.get(t.parent) : void 0, y = t.parent ? je(t.parent) : void 0;
278
- if (!o.current || !r.current) return;
279
- if (!p || !y) {
280
- o.current.visible = r.current.visible = !1;
281
- return;
282
- }
283
- const h = performance.now();
284
- u.a.copy(y), u.b.copy(e.live);
285
- const v = u.b.x - u.a.x, z = u.b.z - u.a.z, w = Math.hypot(v, z), f = Math.atan2(-z, v), b = ke((h - t.bornAt) / 650), C = t.exitAt ? (h - t.exitAt) / 1e3 : -1, k = C >= 0 ? ge((C - 0.6) / 1.4) : 0, L = !p.exitAt;
286
- u.k += ((L && C < 0 ? 1 : 0) - u.k) * 0.04;
287
- const x = Math.max(C >= 0 ? 1 - k : 0, u.k), M = C < 0 && (t.status === "thinking" || t.status === "spawning");
288
- o.current.position.set((u.a.x + u.b.x) / 2, 0, (u.a.z + u.b.z) / 2), o.current.rotation.y = f, r.current.rotation.y = f, o.current.position.y = De;
289
- const g = Math.max(0.5, Ke.scale * 0.62);
290
- o.current.scale.set(w, 1, g);
291
- const m = a.uniforms;
292
- m.uLen.value = w, m.uGrow.value = b * (1 - k), m.uOp.value = x, m.uFlow.value = K ? 0 : 1, m.uTime.value += (M ? 1 : 0.25) * Math.min(c, 0.05), m.uHot.value.copy(E).multiplyScalar(0.6 + (M ? 0.4 : 0));
293
- const I = Math.max(1e-3, b * (1 - k));
294
- r.current.scale.set(w * I, De - 0.02, g * 1.13), r.current.position.x = u.a.x + v * I / 2, r.current.position.z = u.a.z + z * I / 2, r.current.position.y = (De - 0.02) / 2, l.opacity = x, o.current.visible = r.current.visible = x > 0.01 && I > 2e-3;
295
- }), /* @__PURE__ */ R(ve, { children: [
296
- /* @__PURE__ */ s("mesh", { ref: r, geometry: S, material: l }),
297
- /* @__PURE__ */ s("mesh", { ref: o, geometry: Ro, material: a })
298
- ] });
299
- }
300
- function Po() {
301
- const e = A(() => {
302
- const r = new n.MeshBasicMaterial({ map: Dt(), toneMapped: !1 });
303
- return new ye(S, r, 64);
304
- }, []), t = A(() => new qe(32, 28), []), o = A(() => ({ a: new n.Vector3(), b: new n.Vector3(), c: new n.Vector3(), p: new n.Vector3(), d: new n.Vector3(), col: new n.Color() }), []);
305
- return N(() => {
306
- const r = performance.now();
307
- e.begin(), t.begin();
308
- for (const a of V.comets) {
309
- const l = V.instances.get(a.from) ?? V.archive.get(a.from), u = V.instances.get(a.to) ?? V.archive.get(a.to);
310
- if (!l || !u) continue;
311
- const i = je(a.from), c = je(a.to);
312
- if (!i || !c) continue;
313
- const p = U((r - a.start) / a.dur);
314
- if (p >= 1) continue;
315
- if (o.col.copy(Y(Te[l.type])), u.parent === l.id) {
316
- o.a.copy(i), o.b.copy(c), o.p.lerpVectors(o.a, o.b, 0.12 + 0.76 * ge(p)), o.p.y = De + 0.21;
317
- const h = Math.atan2(-(o.b.z - o.a.z), o.b.x - o.a.x);
318
- e.add(o.p, null, 0.42, 0.42, 0.42, o.col, 1.5, h);
319
- } else {
320
- if (!fe(a.from, o.a) || !fe(a.to, o.b)) continue;
321
- Le(o.a, o.b, 2.2, o.c);
322
- const h = ge(p);
323
- de(o.a, o.c, o.b, h, o.p), o.p.y -= 0.35, e.add(o.p, null, 0.4, 0.4, 0.4, o.col, 1.5, h * 2), t.add(o.a, o.c, o.b, o.col, Math.sin(Math.PI * p) * 0.9, h, 7, r / 400);
324
- }
325
- }
326
- e.end(), t.end();
327
- }), /* @__PURE__ */ R(ve, { children: [
328
- /* @__PURE__ */ s("primitive", { object: e.mesh }),
329
- /* @__PURE__ */ s("primitive", { object: t.lines })
330
- ] });
331
- }
332
- const he = new n.MeshStandardMaterial({ color: "#26201d", metalness: 0.65, roughness: 0.4 }), qt = new n.MeshStandardMaterial({ color: "#16120f", metalness: 0.2, roughness: 0.85 }), Tt = new n.MeshStandardMaterial({ color: "#0a0909", roughness: 0.9 }), ne = new n.MeshStandardMaterial({ color: "#5a5048", metalness: 0.35, roughness: 0.5, emissive: new n.Color("#2a1608"), emissiveIntensity: 0.6 }), et = new n.SphereGeometry(1, 24, 12, 0, Math.PI * 2, 0, Math.PI / 2);
333
- let tt = null;
334
- const Vt = () => {
335
- if (tt) return tt;
336
- const e = Wt().clone();
337
- return e.repeat.set(3, 1), e.needsUpdate = !0, tt = new n.MeshBasicMaterial({ map: e, color: new n.Color(0.55, 0.55, 0.55), toneMapped: !1 });
338
- }, kt = new n.MeshBasicMaterial({ color: new n.Color("#ffb020").multiplyScalar(0.32), toneMapped: !1 }), pt = (e, t, o) => t > 0 ? 1 : U(1 - (o - e) / 1400);
339
- function Lo({ mcp: e, backend: t }) {
340
- const o = e.srv, r = t.res, a = t.k, l = P(null), u = A(() => Y(o.color), [o.color]), i = A(() => ({ band: le(u), glow: ce(u), flame: ce("#ff7a1a"), lamp: ce("#ffe2a8") }), [u]);
341
- pe(() => () => Object.values(i).forEach((h) => h.dispose()), [i]);
342
- const c = P(null);
343
- N(({ clock: h }) => {
344
- var w;
345
- l.current && (l.current.position.copy(t.pos), l.current.rotation.y = e.out.x < 0 ? 0 : Math.PI);
346
- const v = pt(r.activeAt, r.inflight, performance.now()), z = K ? 0 : h.elapsedTime;
347
- i.band.color.copy(u).multiplyScalar(0.22 + v * (1.3 + 0.3 * Math.sin(z * 8))), i.glow.color.copy(u).multiplyScalar(0.05 + v * 0.3), i.flame.color.setRGB(1, 0.45, 0.1).multiplyScalar(0.2 + v * (0.9 + 0.3 * Math.sin(z * 13 + a))), i.lamp.color.setRGB(1, 0.85, 0.6).multiplyScalar(0.15 + v * 0.6), (w = c.current) == null || w.setOpacity(0.55 + v * 0.45);
348
- });
349
- const p = r.kind, y = p === "api" || p === "queue";
350
- return /* @__PURE__ */ R("group", { ref: l, children: [
351
- y ? (
352
- // trailer backed up toward the dock (+x), cab on the far side
353
- /* @__PURE__ */ R("group", { children: [
354
- /* @__PURE__ */ s("mesh", { geometry: S, material: ne, scale: [p === "queue" ? 3 : 2.5, 1.15, 1.05], position: [0.25, 0.95, 0] }),
355
- /* @__PURE__ */ s("mesh", { geometry: S, material: i.band, scale: [p === "queue" ? 2.9 : 2.4, 0.07, 1.07], position: [0.25, 0.72, 0] }),
356
- p === "queue" ? /* @__PURE__ */ s("mesh", { geometry: S, material: i.band, scale: [2.9, 0.07, 1.07], position: [0.25, 1.18, 0] }) : null,
357
- /* @__PURE__ */ s("mesh", { geometry: S, material: he, scale: [0.85, 0.95, 1], position: [p === "queue" ? -1.7 : -1.45, 0.78, 0] }),
358
- /* @__PURE__ */ s("mesh", { geometry: S, material: i.band, scale: [0.04, 0.3, 0.8], position: [p === "queue" ? -2.13 : -1.88, 0.95, 0] }),
359
- [-1.3, 0.2, 1.1].map((h) => /* @__PURE__ */ R("group", { children: [
360
- /* @__PURE__ */ s("mesh", { geometry: T, material: Tt, scale: [0.24, 0.16, 0.24], "rotation-x": Math.PI / 2, position: [h, 0.24, 0.5] }),
361
- /* @__PURE__ */ s("mesh", { geometry: T, material: Tt, scale: [0.24, 0.16, 0.24], "rotation-x": Math.PI / 2, position: [h, 0.24, -0.5] })
362
- ] }, h)),
363
- /* @__PURE__ */ s("sprite", { material: i.lamp, scale: 0.9, position: [p === "queue" ? -2.2 : -1.95, 0.6, 0.35] }),
364
- /* @__PURE__ */ s("sprite", { material: i.lamp, scale: 0.9, position: [p === "queue" ? -2.2 : -1.95, 0.6, -0.35] })
365
- ] })
366
- ) : /* @__PURE__ */ R("group", { children: [
367
- p === "warehouse" ? [-0.55, 0.55].map((h) => /* @__PURE__ */ R("group", { "position-z": h, children: [
368
- /* @__PURE__ */ s("mesh", { geometry: T, material: ne, scale: [0.55, 2.4, 0.55], "position-y": 1.2 }),
369
- /* @__PURE__ */ s("mesh", { geometry: et, material: ne, scale: [0.55, 0.3, 0.55], "position-y": 2.4 }),
370
- /* @__PURE__ */ s("mesh", { geometry: T, material: i.band, scale: [0.565, 0.07, 0.565], "position-y": 0.7 }),
371
- /* @__PURE__ */ s("mesh", { geometry: T, material: i.band, scale: [0.565, 0.07, 0.565], "position-y": 1.6 })
372
- ] }, h)) : p === "storage" ? /* @__PURE__ */ R("group", { children: [
373
- /* @__PURE__ */ s("mesh", { geometry: T, material: ne, scale: [0.95, 1.3, 0.95], "position-y": 0.65 }),
374
- /* @__PURE__ */ s("mesh", { geometry: et, material: ne, scale: [0.95, 0.35, 0.95], "position-y": 1.3 }),
375
- /* @__PURE__ */ s("mesh", { geometry: T, material: i.band, scale: [0.965, 0.07, 0.965], "position-y": 0.55 }),
376
- /* @__PURE__ */ s("mesh", { geometry: T, material: i.band, scale: [0.965, 0.07, 0.965], "position-y": 1.05 })
377
- ] }) : /* @__PURE__ */ R("group", { children: [
378
- /* @__PURE__ */ s("mesh", { geometry: T, material: ne, scale: [0.7, p === "spark" ? 2.4 : 2.9, 0.7], "position-y": p === "spark" ? 1.2 : 1.45 }),
379
- /* @__PURE__ */ s("mesh", { geometry: et, material: ne, scale: [0.7, 0.35, 0.7], "position-y": p === "spark" ? 2.4 : 2.9 }),
380
- [0.6, 1.3, 2].map((h) => /* @__PURE__ */ s("mesh", { geometry: T, material: i.band, scale: [0.715, 0.07, 0.715], "position-y": h }, h)),
381
- p === "spark" ? /* @__PURE__ */ R(ve, { children: [
382
- /* @__PURE__ */ s("mesh", { geometry: T, material: he, scale: [0.14, 0.7, 0.14], position: [0.3, 2.9, 0] }),
383
- /* @__PURE__ */ s("sprite", { material: i.flame, scale: 1.4, position: [0.3, 3.35, 0] })
384
- ] }) : null
385
- ] }),
386
- /* @__PURE__ */ s("mesh", { geometry: T, material: qt, scale: [1.15, 0.08, 1.15], "position-y": 0.04 })
387
- ] }),
388
- /* @__PURE__ */ s("sprite", { material: i.glow, scale: 4, "position-y": 1.2 }),
389
- /* @__PURE__ */ s(we, { ref: c, position: [0, y ? 2 : p === "storage" ? 2.25 : 3.5, 0], text: r.name, color: o.color, size: 0.22, opacity: 0.6, pxRange: [7.5, 11.5] })
390
- ] });
391
- }
392
- function Bo({ mcp: e }) {
393
- const t = e.srv, o = P(null), r = A(() => Y(t.color), [t.color]), a = P(null), l = P(null), u = A(() => ({ strip: le(r), inner: ce(r), spill: We(r) }), [r]);
394
- pe(() => () => Object.values(u).forEach((c) => c.dispose()), [u]);
395
- const i = A(() => ({ open: 0 }), []);
396
- return N(({ clock: c }) => {
397
- var v;
398
- o.current && (o.current.position.copy(e.pos), o.current.rotation.y = e.out.x < 0 ? 0 : Math.PI);
399
- const p = performance.now(), y = pt(t.activeAt, t.inflight, p);
400
- i.open += ((t.inflight > 0 || y > 0.3 ? 1 : 0) - i.open) * 0.07;
401
- const h = K ? 0 : c.elapsedTime;
402
- if (a.current) {
403
- const z = 2 * (1 - 0.82 * i.open);
404
- a.current.scale.y = z, a.current.position.y = 0.7 + 2 - z / 2;
405
- }
406
- u.strip.color.copy(r).multiplyScalar(0.35 + y * (1.4 + 0.25 * Math.sin(h * 6))), u.inner.color.copy(r).multiplyScalar(0.06 + i.open * 0.45), u.spill.color.copy(r).multiplyScalar(i.open * 0.22), (v = l.current) == null || v.setOpacity(0.7 + y * 0.3);
407
- }), /* @__PURE__ */ s("group", { children: /* @__PURE__ */ R("group", { ref: o, children: [
408
- /* @__PURE__ */ s("mesh", { geometry: S, material: qt, scale: [3.4, 0.7, 4.6], "position-y": 0.35 }),
409
- /* @__PURE__ */ s("mesh", { geometry: S, material: Vt(), scale: [0.04, 0.22, 4.6], position: [1.72, 0.55, 0] }),
410
- /* @__PURE__ */ s("mesh", { geometry: S, material: he, scale: [0.22, 2.3, 0.22], position: [1.55, 1.85, 1.45] }),
411
- /* @__PURE__ */ s("mesh", { geometry: S, material: he, scale: [0.22, 2.3, 0.22], position: [1.55, 1.85, -1.45] }),
412
- /* @__PURE__ */ s("mesh", { geometry: S, material: he, scale: [0.35, 0.32, 3.2], position: [1.55, 3.1, 0] }),
413
- /* @__PURE__ */ s("mesh", { geometry: S, material: u.strip, scale: [0.04, 0.08, 2.9], position: [1.74, 3, 0] }),
414
- /* @__PURE__ */ s("mesh", { ref: a, geometry: S, material: Vt(), scale: [0.06, 2, 2.68], position: [1.55, 1.7, 0] }),
415
- /* @__PURE__ */ s("sprite", { material: u.inner, scale: [4.5, 3, 1], position: [1, 1.6, 0] }),
416
- /* @__PURE__ */ s("mesh", { "rotation-x": -Math.PI / 2, position: [3.4, 0.015, 0], material: u.spill, children: /* @__PURE__ */ s("planeGeometry", { args: [3, 2.8] }) }),
417
- /* @__PURE__ */ s("mesh", { geometry: S, material: he, scale: [0.2, 3.3, 4.6], position: [-1.6, 1.65, 0] }),
418
- /* @__PURE__ */ s("mesh", { "rotation-x": -Math.PI / 2, position: [2.6, 6e-3, 0], material: kt, children: /* @__PURE__ */ s("planeGeometry", { args: [0.09, 5.2] }) }),
419
- /* @__PURE__ */ s("mesh", { "rotation-x": -Math.PI / 2, position: [3.05, 6e-3, 0], material: kt, children: /* @__PURE__ */ s("planeGeometry", { args: [0.09, 5.2] }) }),
420
- /* @__PURE__ */ s(we, { ref: l, position: [0.4, 3.85, 0], text: t.name, color: t.color, plate: "box", size: 0.26, pxRange: [8, 12.5] })
421
- ] }) });
422
- }
423
- function To() {
424
- const e = A(() => new qe(48, 32), []), t = A(() => new qe(40, 16), []), o = A(() => new ye(S, new n.MeshBasicMaterial({ toneMapped: !1 }), 64), []), r = A(() => new ye(jt, new n.MeshBasicMaterial({ toneMapped: !1, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1 }), 64), []), a = A(
425
- () => ({ a: new n.Vector3(), b: new n.Vector3(), c: new n.Vector3(), d: new n.Vector3(), e: new n.Vector3(), f: new n.Vector3(), p: new n.Vector3(), q: new n.Vector3(), col: new n.Color(), tmp: new n.Color() }),
426
- []
427
- ), l = (u, i) => {
428
- const c = no(u.name, i);
429
- return !c || !yo(u.name, a.d) ? !1 : (a.e.copy(c), a.e.y = 0.9, a.f.addVectors(a.d, a.e).multiplyScalar(0.5), a.f.y = 1.9, !0);
430
- };
431
- return N(({ clock: u }) => {
432
- const i = performance.now(), c = K ? 0 : u.elapsedTime;
433
- e.begin(), t.begin(), o.begin(), r.begin();
434
- for (const p of V.mcpServers.values())
435
- for (const y of p.resources.values()) {
436
- if (!l(p, y.name)) continue;
437
- const h = pt(y.activeAt, y.inflight, i);
438
- a.col.copy(Y(p.color)), t.add(a.d, a.f, a.e, a.col, 0.3 + h * 0.9, -1, h > 0.05 ? 5 : 0, c * 1.5);
439
- }
440
- for (const p of V.mcpPending.values()) {
441
- const y = V.mcpServers.get(p.server);
442
- if (!y || !fe(p.instance, a.a) || !Je(y.name, a.b)) continue;
443
- Le(a.a, a.b, 2.6, a.c);
444
- const h = oo(p, i);
445
- a.col.copy(E).lerp(Re, U((h - 1) / 2));
446
- const v = U(h / 0.35);
447
- e.add(a.a, a.c, a.b, a.col, v * (1.5 + 0.35 * Math.sin(c * 6)), -1, 9, c * 1.6), de(a.a, a.c, a.b, 0.94, a.p), a.q.subVectors(a.b, a.p), r.add(a.p, a.q, 0.17, 0.42, 0.17, a.col, 1.6 * v);
448
- }
449
- for (const p of V.mcpResolved) {
450
- const y = V.mcpServers.get(p.server);
451
- if (!y || !fe(p.instance, a.a) || !Je(y.name, a.b)) continue;
452
- Le(a.a, a.b, 2.6, a.c);
453
- const h = U((i - p.resolvedAt) / 700);
454
- e.add(a.a, a.c, a.b, Ee, (1 - h) * 0.9, 1 - h, 0, 0);
455
- }
456
- for (const p of V.mcpCalls) {
457
- const y = V.mcpServers.get(p.server);
458
- if (!y || !fe(p.instance, a.q)) continue;
459
- const h = U((i - p.start) / p.dur);
460
- if (h >= 1) continue;
461
- const v = p.phase === "call" ? h : 1 - h, w = !!p.resource && l(y, p.resource) ? 0.62 : 1;
462
- a.col.copy(Y(y.color)), v <= w ? (a.a.copy(a.q), Je(y.name, a.b), Le(a.a, a.b, 2.6, a.c), de(a.a, a.c, a.b, ge(v / w), a.p), a.p.y -= 0.2) : de(a.d, a.f, a.e, ge((v - w) / (1 - w)), a.p);
463
- const f = Math.min(1, h * 8, (1 - h) * 8);
464
- o.add(a.p, null, 0.5, 0.14, 0.5, a.col, 2.2 * f, h * 3), a.p.y += 0.17, o.add(a.p, null, 0.3, 0.22, 0.3, a.tmp.copy(a.col).lerp(Ee, 0.4), 1.8 * f, h * 3);
465
- }
466
- e.end(), t.end(), o.end(), r.end();
467
- }), /* @__PURE__ */ R(ve, { children: [
468
- /* @__PURE__ */ s("primitive", { object: e.lines }),
469
- /* @__PURE__ */ s("primitive", { object: t.lines }),
470
- /* @__PURE__ */ s("primitive", { object: o.mesh }),
471
- /* @__PURE__ */ s("primitive", { object: r.mesh })
472
- ] });
473
- }
474
- const Vo = (
475
- /* glsl */
476
- `
477
- varying vec3 vW;
478
- void main() {
479
- vec4 w = modelMatrix * vec4(position, 1.0);
480
- vW = w.xyz;
481
- gl_Position = projectionMatrix * viewMatrix * w;
482
- }`
483
- ), ko = (
484
- /* glsl */
485
- `
486
- varying vec3 vW;
487
- uniform vec3 uBase;
488
- uniform vec3 uGrid;
489
- uniform vec3 uMajor;
490
- uniform float uR;
491
- float line(float x, float w) {
492
- float d = abs(fract(x - 0.5) - 0.5) / fwidth(x);
493
- return 1.0 - min(d / w, 1.0);
494
- }
495
- void main() {
496
- vec2 p = vW.xz;
497
- float minor = max(line(p.x, 0.8), line(p.y, 0.8));
498
- float major = max(line(p.x / 4.0, 1.1), line(p.y / 4.0, 1.1));
499
- // spotlight pools: brighter in the middle of the hall, falling off to the walls
500
- float r = length(p * vec2(0.85, 1.1)) * (30.0 / uR);
501
- float pool = exp(-r * r / 900.0);
502
- float edge = smoothstep(46.0, 30.0, r);
503
- vec3 c = uBase * (0.55 + 0.9 * pool);
504
- c += uGrid * minor * 0.07 * edge;
505
- c += uMajor * major * 0.16 * edge;
506
- gl_FragColor = vec4(c, 1.0);
507
- #include <colorspace_fragment>
508
- }`
509
- );
510
- function Eo() {
511
- const e = A(
512
- () => new n.ShaderMaterial({
513
- vertexShader: Vo,
514
- fragmentShader: ko,
515
- uniforms: {
516
- uBase: { value: new n.Color("#0b0809") },
517
- uGrid: { value: new n.Color("#ff8a1f") },
518
- uMajor: { value: new n.Color("#ffb347") },
519
- uR: { value: 30 }
520
- }
521
- }),
522
- []
523
- );
524
- return N(() => {
525
- const t = Math.max(30, (ie.core.r + 10) * 1.3);
526
- e.uniforms.uR.value += (t - e.uniforms.uR.value) * 0.05;
527
- }), /* @__PURE__ */ s("mesh", { "rotation-x": -Math.PI / 2, position: [0, 0, 0], material: e, children: /* @__PURE__ */ s("planeGeometry", { args: [260, 220] }) });
528
- }
529
- function Oo() {
530
- return /* @__PURE__ */ R(ve, { children: [
531
- /* @__PURE__ */ s("hemisphereLight", { args: ["#ffd9b0", "#2a1a10", 0.9] }),
532
- /* @__PURE__ */ s("directionalLight", { position: [14, 26, 18], intensity: 1.5, color: "#ffd7a8" }),
533
- /* @__PURE__ */ s("directionalLight", { position: [-20, 12, -8], intensity: 0.9, color: "#ff7a2e" })
534
- ] });
535
- }
536
- const Uo = (
537
- /* glsl */
538
- `
539
- varying vec2 vUv;
540
- void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }`
541
- ), Go = (
542
- /* glsl */
543
- `
544
- varying vec2 vUv;
545
- uniform float uLen, uW, uTime, uOp, uSteps, uSweep, uSweepK;
546
- uniform vec3 uRun, uEdge, uStage; // uStage = state per zone: 0 queued, 1 running, 2 done, 3 failed
547
- uniform vec2 uZ1; // zone boundaries (0..1 along the lane)
548
- void main() {
549
- float x = vUv.x * uLen;
550
- float y = (vUv.y - 0.5) * uW;
551
- float edge = smoothstep(uW * 0.5 - 0.16, uW * 0.5 - 0.1, abs(y)) * (1.0 - smoothstep(uW * 0.5 - 0.04, uW * 0.5, abs(y)));
552
- float dash = step(0.5, fract(x / 0.9));
553
- vec3 c = uEdge * edge * (0.25 + 0.55 * dash);
554
- c += uRun * 0.006;
555
- if (uSteps > 0.5) {
556
- float zone = vUv.x < uZ1.x ? 0.0 : (vUv.x < uZ1.y ? 1.0 : 2.0);
557
- float st = zone < 0.5 ? uStage.x : (zone < 1.5 ? uStage.y : uStage.z);
558
- // stage dividers
559
- float div = (1.0 - smoothstep(0.0, 0.05, abs(vUv.x - uZ1.x) * uLen)) + (1.0 - smoothstep(0.0, 0.05, abs(vUv.x - uZ1.y) * uLen));
560
- c += uEdge * div * 0.35 * step(abs(y), uW * 0.5 - 0.1);
561
- if (st > 0.5 && st < 1.5) {
562
- float ch = fract((x - uTime * 1.2) / 1.6 - abs(y) * 0.25);
563
- float chev = smoothstep(0.0, 0.05, ch) * (1.0 - smoothstep(0.1, 0.2, ch));
564
- c += vec3(1.0, 0.7, 0.2) * (0.006 + chev * 0.035);
565
- } else if (st > 1.5 && st < 2.5) {
566
- c += vec3(0.9, 0.85, 0.8) * 0.004;
567
- } else if (st > 2.5) {
568
- c += vec3(1.0, 0.12, 0.1) * 0.02;
569
- }
570
- }
571
- // handoff sweep: a band of light travelling into the next stage
572
- c += vec3(1.0, 0.8, 0.35) * uSweepK * exp(-pow((vUv.x - uSweep) * uLen / 0.8, 2.0)) * 0.6;
573
- gl_FragColor = vec4(c * uOp, 1.0);
574
- #include <colorspace_fragment>
575
- }`
576
- ), _o = new n.PlaneGeometry(1, 1).rotateX(-Math.PI / 2), Et = new n.MeshStandardMaterial({ color: "#2a2320", metalness: 0.6, roughness: 0.4 }), ot = { queued: 0, running: 1, done: 2, failed: 3 }, Ot = new n.Vector3(0, 1, 0), nt = new n.Vector3(), Se = new n.Vector3(), Io = new n.Vector3(), Ut = new n.Matrix4(), se = { b1: 0, b2: 0 };
577
- function Fo({ run: e }) {
578
- const t = e.run ?? V.runs.get(e.id);
579
- return t ? /* @__PURE__ */ s(Wo, { kr: e, run: t }) : null;
580
- }
581
- function Wo({ kr: e, run: t }) {
582
- const o = A(
583
- () => new n.ShaderMaterial({
584
- vertexShader: Uo,
585
- fragmentShader: Go,
586
- uniforms: {
587
- uLen: { value: 1 },
588
- uW: { value: 1 },
589
- uTime: { value: 0 },
590
- uOp: { value: 0 },
591
- uSteps: { value: 0 },
592
- uSweep: { value: -1 },
593
- uSweepK: { value: 0 },
594
- uRun: { value: Y(t.color).clone() },
595
- uEdge: { value: E.clone() },
596
- uStage: { value: new n.Vector3() },
597
- uZ1: { value: new n.Vector2(0.33, 0.66) }
598
- },
599
- transparent: !0,
600
- depthWrite: !1,
601
- blending: n.AdditiveBlending
602
- }),
603
- [t.color]
604
- );
605
- pe(() => () => o.dispose(), [o]);
606
- const r = A(() => Ze.map(() => ({ lamp: le(E), glow: ce(E) })), []), a = P(null), l = P(null), u = P([]), i = P(null), c = A(() => ({ u0: 0, u1: 0, v0: 0, v1: 0, init: !1 }), []), p = A(() => ({ u0: 0, u1: 0, v0: 0, v1: 0 }), []);
607
- return N(({ clock: y }, h) => {
608
- var F, G, _;
609
- const v = a.current;
610
- if (!v) return;
611
- nt.copy(e.side), Se.copy(e.axis), Io.crossVectors(nt, Ot).dot(Se) < 0 && Se.negate(), Ut.makeBasis(nt, Ot, Se), v.quaternion.setFromRotationMatrix(Ut), v.position.copy(e.origin).addScaledVector(e.side, -e.cu).addScaledVector(e.axis, -e.cv);
612
- const z = Se.dot(e.axis) < 0 ? -1 : 1;
613
- It(e, p);
614
- const w = c.init ? 1 - Math.exp(-Math.min(0.1, h) / 0.2) : 1;
615
- c.init = !0, c.u0 += (p.u0 - c.u0) * w, c.u1 += (p.u1 - c.u1) * w, c.v0 += (p.v0 - c.v0) * w, c.v1 += (p.v1 - c.v1) * w;
616
- const f = c.u1 - c.u0, b = c.v1 - c.v0, C = (z > 0 ? c.v1 : -c.v0) + 0.15;
617
- fo(se), (F = l.current) == null || F.position.set(c.u0 + f / 2, 4e-3, (c.v0 + c.v1) / 2 * z), (G = l.current) == null || G.scale.set(f, 1, b), (_ = i.current) == null || _.position.set(c.u0 + 0.2, 0.2, (z > 0 ? c.v0 : -c.v1) - 0.25);
618
- const k = performance.now(), L = ke((k - t.startedAt) / 900), x = t.endedAt ? U(1 - (k - t.endedAt - (so - 2500)) / 2500) : 1, M = o.uniforms;
619
- M.uLen.value = f, M.uW.value = b, M.uZ1.value.set((se.b1 - c.u0) / f, (se.b2 - c.u0) / f), M.uOp.value = L * x, M.uTime.value += K ? 0 : h, M.uSteps.value = t.hasSteps ? 1 : 0, M.uStage.value.set(ot[Ae(t, 0)], ot[Ae(t, 1)], ot[Ae(t, 2)]);
620
- const g = (k - t.handoffAt) / 1e3;
621
- if (t.handoffAt && g < 1.4) {
622
- const B = (Pt(t.handoffFrom, c, se) - c.u0) / f, W = (Pt(t.handoffTo, c, se) - c.u0) / f;
623
- M.uSweep.value = B + (W - B) * ke(g / 1.1), M.uSweepK.value = 1 - U((g - 0.9) / 0.5);
624
- } else M.uSweepK.value = 0;
625
- const m = K ? 0 : y.elapsedTime, I = Math.max(0.75, Ke.spread * 0.9);
626
- for (let B = 0; B < Ze.length; B++) {
627
- const W = Ae(t, B), q = r[B], Z = W === "running" ? te : W === "done" ? Ee : W === "failed" ? Y("#ff2d2d") : E, be = W === "running" ? 1.2 + 0.4 * Math.sin(m * 5) : W === "done" ? 0.55 : W === "failed" ? 1 : 0.12;
628
- q.lamp.color.copy(Z).multiplyScalar(be * L * x), q.glow.color.copy(Z).multiplyScalar(be * 0.35 * L * x);
629
- const ue = u.current[B];
630
- if (ue) {
631
- ue.visible = t.hasSteps && L * x > 0.02;
632
- const $ = B === 0 ? c.u0 + 1.2 : B === 1 ? se.b1 + 0.6 : se.b2 + 0.6;
633
- ue.position.set($, 0, C), ue.scale.setScalar(I);
634
- }
635
- }
636
- }), /* @__PURE__ */ R("group", { ref: a, children: [
637
- /* @__PURE__ */ s("mesh", { ref: l, geometry: _o, material: o }),
638
- Ze.map((y) => /* @__PURE__ */ R("group", { ref: (h) => void (u.current[y] = h), visible: !1, children: [
639
- /* @__PURE__ */ s("mesh", { geometry: T, material: Et, scale: [0.06, 1.6, 0.06], "position-y": 0.8 }),
640
- /* @__PURE__ */ s("mesh", { geometry: S, material: Et, scale: [0.5, 0.18, 0.08], "position-y": 1.55 }),
641
- /* @__PURE__ */ s("mesh", { geometry: T, material: r[y].lamp, scale: [0.1, 0.14, 0.1], "position-y": 1.72 }),
642
- /* @__PURE__ */ s("sprite", { material: r[y].glow, scale: 1.2, "position-y": 1.72 }),
643
- t.hasSteps ? /* @__PURE__ */ s(Do, { run: t, k: y }) : null
644
- ] }, y)),
645
- /* @__PURE__ */ s("group", { ref: i, children: /* @__PURE__ */ s(jo, { run: t }) })
646
- ] });
647
- }
648
- function Do({ run: e, k: t }) {
649
- _t();
650
- const o = ao(e, t), r = Ae(e, t);
651
- return o ? /* @__PURE__ */ s(
652
- we,
653
- {
654
- position: [0, 2.25, 0],
655
- text: r === "done" ? `${o} · done` : o,
656
- color: r === "running" ? "#ffd23f" : r === "done" ? "#e7e5e4" : r === "failed" ? "#ff2d2d" : "#7c5a2a",
657
- uppercase: !0,
658
- letterSpacing: 0.12,
659
- size: 0.2,
660
- opacity: r === "queued" ? 0.55 : 1,
661
- fadeMs: 300,
662
- pxRange: [7, 10.5]
663
- }
664
- ) : null;
665
- }
666
- function jo({ run: e }) {
667
- _t();
668
- const t = e.status !== "started";
669
- return /* @__PURE__ */ s(
670
- we,
671
- {
672
- anchorX: "left",
673
- anchorY: "bottom",
674
- textAlign: "left",
675
- plate: "box",
676
- text: e.topic,
677
- secondary: ro(e, { base: "#a8a29e", current: "#ffd23f", done: "#e7e5e4" }, ["line running…", "line complete", "line halted"]),
678
- color: e.color,
679
- size: 0.34,
680
- maxWidth: 10,
681
- opacity: t ? 0.55 : 1,
682
- fadeMs: 400,
683
- fit: !0,
684
- pxRange: [8, 14]
685
- }
686
- );
687
- }
688
- const st = new n.Vector3(), ae = { u0: 0, u1: 0, v0: 0, v1: 0 };
689
- function qo(e) {
690
- for (const t of ie.runs.values())
691
- It(t, ae), e(Ye(t, ae.u0 + 3, ae.v0 - 1.4, st), 1.6), e(Ye(t, ae.u1, ae.v1, st), 0.6), e(Ye(t, ae.u0, ae.v1, st), 0.6);
692
- }
693
- const Ko = new n.MeshStandardMaterial({ color: "#1c1714", metalness: 0.55, roughness: 0.42 }), No = new n.MeshStandardMaterial({ color: "#0f0c0b", metalness: 0.4, roughness: 0.6 }), ee = new n.MeshStandardMaterial({ color: "#2a2320", metalness: 0.7, roughness: 0.35 }), at = new n.MeshStandardMaterial({ color: "#e88a1a", metalness: 0.5, roughness: 0.35, emissive: new n.Color("#ff7a00"), emissiveIntensity: 0.18 });
694
- let Ie = null;
695
- const Ho = () => {
696
- if (Ie) return Ie;
697
- const e = Wt().clone();
698
- return e.repeat.set(6, 1), e.needsUpdate = !0, Ie = new n.MeshBasicMaterial({ map: e, color: new n.Color(0.75, 0.75, 0.75), toneMapped: !1 }), Ie;
699
- }, Xo = new n.EdgesGeometry(new n.PlaneGeometry(1, 1).rotateX(-Math.PI / 2)), Yo = new n.Color("#2a2627");
700
- function Zo({ agent: e, selected: t, onSelect: o }) {
701
- const r = e.inst, a = !r.subagent, l = A(() => Y(Te[r.type]), [r.type]), u = A(() => bo(r.id), [r.id]), i = P(null), c = P(null), p = P(null), y = A(() => (u - 0.5) * 0.35, [u]), h = P(null), v = P(null), z = P(null), w = P(null), f = P(null), b = P(null), C = P(null), k = P(null), L = P(null), x = P(null), M = P(null), g = A(
702
- () => ({
703
- screen: le(l),
704
- vent: le(l),
705
- trim: new n.LineBasicMaterial({ color: E, transparent: !0, toneMapped: !1 }),
706
- beacon: le(E),
707
- beam: We(E, n.DoubleSide),
708
- halo: ce(l),
709
- rim: le(te),
710
- shock: We(l, n.DoubleSide),
711
- sel: We(te, n.DoubleSide),
712
- hatch: new n.LineBasicMaterial({ color: E, transparent: !0, toneMapped: !1, blending: n.AdditiveBlending, depthWrite: !1 }),
713
- tip: ce(te)
714
- }),
715
- [l]
716
- );
717
- pe(() => () => Object.values(g).forEach((B) => B.dispose()), [g]);
718
- const m = A(
719
- () => ({
720
- top: new n.Vector3(),
721
- tmp: new n.Vector3(),
722
- c: new n.Color(),
723
- llm: r.llmCalls,
724
- llmAt: -1e9,
725
- llmK: 0,
726
- tools: r.toolCalls + r.mcpCalls,
727
- armAt: -1e9,
728
- armMcp: !1,
729
- lastWeld: 0,
730
- failedBurst: !1,
731
- spin: u * 6.28,
732
- think: 0
733
- }),
734
- // eslint-disable-next-line react-hooks/exhaustive-deps
735
- []
736
- );
737
- pe(() => () => void lt.delete(r.id), [r.id]), N(({ clock: B }, W) => {
738
- var Mt, xt, St, At, Ct;
739
- const q = performance.now(), Z = K ? 0 : B.elapsedTime, be = (q - r.bornAt) / 1e3, ue = r.parent ? 0.55 : 0.1, $ = ke((be - ue) / 0.9), J = r.exitAt ? (q - r.exitAt) / 1e3 : -1, ut = J >= 0 ? 1 - U(J / 0.5) : 1, mt = J >= 0 ? wo((J - 0.45) / 1.9) : 0, Ne = J < 0;
740
- let me = !1;
741
- for (const Q of V.mcpPending.values()) Q.instance === r.id && (me = !0);
742
- const ht = Ne && (r.status === "thinking" || r.status === "spawning");
743
- m.think += ((ht ? 1 : 0) - m.think) * 0.08, r.llmCalls !== m.llm && (m.llm = r.llmCalls, m.llmAt = q, m.llmK = r.pulse, x.current && (x.current.getWorldPosition(m.tmp), Qe(m.tmp, Math.round(10 + m.llmK * 26), te, 3.2 + m.llmK * 1.4, 0.9 + m.llmK * 0.5)));
744
- const ft = r.toolCalls + r.mcpCalls;
745
- ft !== m.tools && (m.armMcp = r.mcpCalls > 0 && ((Mt = r.recent[0]) == null ? void 0 : Mt.type) === "mcp", m.tools = ft, m.armAt = q), r.status === "failed" && J >= 0 && !m.failedBurst && (m.failedBurst = !0, m.tmp.copy(m.top), Qe(m.tmp, 40, Re, 4, 2.2));
746
- const dt = -2.3 * (1 - $) - 2.4 * mt;
747
- h.current && (h.current.position.y = dt);
748
- const He = e.scale;
749
- (xt = i.current) == null || xt.position.copy(e.live), (St = c.current) == null || St.scale.setScalar(He), (At = p.current) == null || At.position.set(0, 2.95 * He + (a ? 0.15 : 0.05), 0);
750
- const gt = Math.max(0.2, (dt + go) * He);
751
- lt.set(r.id, gt), m.top.set(e.live.x, gt, e.live.z);
752
- const yt = (q - m.llmAt) / 1e3, Oe = Math.exp(-yt * 3.2) * m.llmK, Nt = ht ? 0.85 + 0.15 * Math.sin(Z * 9 + u * 7) : 0.32 + 0.06 * Math.sin(Z * 1.3 + u * 5), D = ut * $;
753
- m.c.copy(l).multiplyScalar((Nt + Oe * 0.7) * 1.25), r.status === "failed" && m.c.lerp(Re, 0.7), g.screen.color.copy(m.c).multiplyScalar(D).lerp(Yo, 1 - ut), g.vent.color.copy(l).multiplyScalar((0.35 + m.think * 0.5 + Oe * 0.4) * D), g.trim.color.copy(E).multiplyScalar((0.55 + m.think * 0.45 + (t ? 0.8 : 0)) * D), g.halo.color.copy(l).multiplyScalar((0.1 + m.think * 0.12 + Oe * 0.25) * D), g.rim.color.copy(te).multiplyScalar((0.25 + Oe * 2.4) * D);
754
- const vt = me && Ne ? Math.sin(Z * 7) > 0 || K ? 1 : 0.15 : 0;
755
- if (me && Ne ? g.beacon.color.copy(Re).lerp(E, 0.25).multiplyScalar(0.4 + vt * 1.4) : g.beacon.color.copy(E).multiplyScalar((0.25 + m.think * 1.2) * D), v.current && (m.spin += W * (K ? 0 : 5.5), v.current.rotation.y = m.spin, v.current.visible = D > 0.05 && (m.think > 0.05 || me), g.beam.color.copy(me ? Re : E).multiplyScalar((me ? 0.5 * vt : 0.42 * m.think) * D)), z.current) {
756
- const Q = U(yt / 1);
757
- z.current.visible = Q < 1 && D > 0.05, z.current.scale.setScalar(1.15 + ke(Q) * (0.35 + m.llmK * 0.55)), g.shock.color.copy(l).multiplyScalar((1 - Q) * (1 - Q) * 0.9 * D);
758
- }
759
- if (f.current) {
760
- const Q = ($ > 0 && $ < 1 ? 1 : 0) * (1 - $) + (J >= 0 ? U(J / 0.3) * (1 - mt) : 0) + ($ <= 0 && be > 0 ? 0.6 : 0);
761
- f.current.visible = Q > 0.02, g.hatch.color.copy(E).multiplyScalar(Q * 1.6);
762
- }
763
- w.current && (w.current.visible = t && D > 0.05, w.current.rotation.y = Z * 0.6, g.sel.color.copy(te).multiplyScalar(0.8 + 0.25 * Math.sin(Z * 3)));
764
- const wt = U((q - m.armAt) / 1500), Me = wt < 1 ? Math.sin(Math.PI * ge(wt)) : 0, bt = 0.9, Ht = m.armMcp ? Math.PI - y : -Math.PI / 2 + 0.25;
765
- b.current && (b.current.rotation.y = bt + (Ht - bt) * Me + Math.sin(Z * 0.7 + u * 9) * 0.04), C.current && (C.current.rotation.z = -0.15 - Me * 0.85), k.current && (k.current.rotation.z = -2.1 + Me * 1.05), g.tip.color.copy(te).multiplyScalar(Me * 1.2 * D), Me > 0.65 && L.current && q - m.lastWeld > 45 && (m.lastWeld = q, L.current.getWorldPosition(m.tmp), Qe(m.tmp, 3, E, 1.6, 1.4, 0.6)), (Ct = M.current) == null || Ct.setOpacity(io(r.id) ? U($ * 1.4 - 0.2) * (1 - U(J / 1.2)) : 0);
766
- });
767
- const I = (B) => {
768
- B.stopPropagation(), o(r.id);
769
- }, F = () => document.body.style.cursor = "pointer", G = () => document.body.style.cursor = "", _ = r.id.split(":")[2];
770
- return /* @__PURE__ */ R("group", { ref: i, children: [
771
- /* @__PURE__ */ R("group", { ref: c, "rotation-y": y, children: [
772
- /* @__PURE__ */ s("lineSegments", { ref: f, geometry: Xo, material: g.hatch, scale: [2.5, 1, 2.3], "position-y": 0.012 }),
773
- /* @__PURE__ */ s("mesh", { ref: w, geometry: Bt, material: g.sel, scale: 1.85, "position-y": 0.02, visible: !1 }),
774
- /* @__PURE__ */ s("mesh", { ref: z, geometry: Bt, material: g.shock, "position-y": 0.03, visible: !1 }),
775
- /* @__PURE__ */ R("group", { ref: h, "position-y": -2.3, children: [
776
- /* @__PURE__ */ s("mesh", { geometry: S, material: No, scale: [2.2, 0.22, 2], "position-y": 0.11, onClick: I, onPointerOver: F, onPointerOut: G }),
777
- /* @__PURE__ */ s("mesh", { geometry: S, material: Ho(), scale: [2.24, 0.07, 2.04], "position-y": 0.19 }),
778
- /* @__PURE__ */ s("mesh", { geometry: S, material: Ko, scale: [1.7, 1.25, 1.5], "position-y": 0.845, onClick: I, onPointerOver: F, onPointerOut: G }),
779
- /* @__PURE__ */ s("lineSegments", { geometry: xo, material: g.trim, scale: [1.71, 1.26, 1.51], "position-y": 0.845 }),
780
- /* @__PURE__ */ s("mesh", { geometry: S, material: ee, scale: [1.82, 0.09, 1.62], "position-y": 1.51 }),
781
- /* @__PURE__ */ s("mesh", { geometry: S, material: g.screen, scale: [1.18, 0.4, 0.02], position: [0, 0.98, 0.755] }),
782
- /* @__PURE__ */ s("mesh", { geometry: S, material: g.vent, scale: [0.62, 0.05, 0.02], position: [-0.22, 0.6, 0.755] }),
783
- /* @__PURE__ */ s("mesh", { geometry: S, material: g.vent, scale: [0.22, 0.05, 0.02], position: [0.42, 0.6, 0.755] }),
784
- [0.55, 0.75, 0.95, 1.15].map((B) => /* @__PURE__ */ s("mesh", { geometry: S, material: g.vent, scale: [0.02, 0.06, 0.9], position: [0.855, B, 0] }, B)),
785
- /* @__PURE__ */ s("sprite", { material: g.halo, position: [0, 0.98, 0.95], scale: [2.6, 1.4, 1] }),
786
- /* @__PURE__ */ s("mesh", { geometry: T, material: ee, scale: [0.17, 0.9, 0.17], position: [0.48, 1.98, -0.35] }),
787
- /* @__PURE__ */ s("mesh", { geometry: T, material: g.rim, scale: [0.2, 0.06, 0.2], position: [0.48, 2.44, -0.35] }),
788
- /* @__PURE__ */ s("group", { ref: x, position: [0.48, 2.5, -0.35] }),
789
- a ? /* @__PURE__ */ s("mesh", { geometry: T, material: ee, scale: [0.11, 0.6, 0.11], position: [0.12, 1.84, -0.45] }) : null,
790
- /* @__PURE__ */ s("mesh", { geometry: T, material: ee, scale: [0.15, 0.06, 0.15], position: [-0.58, 1.58, 0.42] }),
791
- /* @__PURE__ */ s("mesh", { geometry: T, material: g.beacon, scale: [0.11, 0.2, 0.11], position: [-0.58, 1.71, 0.42] }),
792
- /* @__PURE__ */ R("mesh", { ref: v, position: [-0.58, 1.71, 0.42], visible: !1, children: [
793
- /* @__PURE__ */ s("coneGeometry", { args: [0.32, 1.3, 16, 1, !0] }),
794
- /* @__PURE__ */ s("primitive", { object: g.beam, attach: "material" })
795
- ] }),
796
- /* @__PURE__ */ R("group", { position: [0.98, 0.22, 0.86], children: [
797
- /* @__PURE__ */ s("mesh", { geometry: T, material: ee, scale: [0.17, 0.14, 0.17], "position-y": 0.07 }),
798
- /* @__PURE__ */ R("group", { ref: b, "position-y": 0.14, children: [
799
- /* @__PURE__ */ s("mesh", { geometry: T, material: at, scale: [0.12, 0.12, 0.12], "position-y": 0.06 }),
800
- /* @__PURE__ */ R("group", { ref: C, "position-y": 0.12, children: [
801
- /* @__PURE__ */ s("mesh", { geometry: S, material: at, scale: [0.1, 0.78, 0.1], "position-y": 0.39 }),
802
- /* @__PURE__ */ R("group", { ref: k, "position-y": 0.78, children: [
803
- /* @__PURE__ */ s("mesh", { geometry: T, material: ee, scale: [0.08, 0.13, 0.08], "rotation-x": Math.PI / 2 }),
804
- /* @__PURE__ */ s("mesh", { geometry: S, material: at, scale: [0.075, 0.62, 0.075], "position-y": 0.31 }),
805
- /* @__PURE__ */ R("group", { ref: L, "position-y": 0.66, children: [
806
- /* @__PURE__ */ s("mesh", { geometry: S, material: ee, scale: [0.16, 0.05, 0.08] }),
807
- /* @__PURE__ */ s("mesh", { geometry: S, material: ee, scale: [0.03, 0.14, 0.06], position: [-0.06, 0.08, 0] }),
808
- /* @__PURE__ */ s("mesh", { geometry: S, material: ee, scale: [0.03, 0.14, 0.06], position: [0.06, 0.08, 0] }),
809
- /* @__PURE__ */ s("sprite", { material: g.tip, scale: 0.7, "position-y": 0.12 })
810
- ] })
811
- ] })
812
- ] })
813
- ] })
814
- ] })
815
- ] })
816
- ] }),
817
- /* @__PURE__ */ s("group", { ref: p, children: /* @__PURE__ */ s(
818
- we,
819
- {
820
- ref: M,
821
- fit: !0,
822
- text: `${r.name}${_ !== void 0 ? ` ${Number(_) + 1}` : ""}`,
823
- color: Te[r.type],
824
- size: a ? 0.3 : 0.22,
825
- opacity: 0,
826
- pxRange: a ? [9, 13.5] : [8, 11.5]
827
- }
828
- ) })
829
- ] });
830
- }
831
- const Fe = 4, rt = new n.MeshStandardMaterial({ color: "#c2560f", metalness: 0.6, roughness: 0.4, emissive: new n.Color("#ff6a00"), emissiveIntensity: 0.35 }), Gt = new n.MeshStandardMaterial({ color: "#2b2420", metalness: 0.6, roughness: 0.5 }), $o = 64;
832
- function Jo({ galaxy: e }) {
833
- const t = A(() => {
834
- const f = new n.MeshBasicMaterial({ map: Dt(), toneMapped: !1 }), b = new n.InstancedMesh(S, f, H), C = new n.Object3D(), k = new n.Vector3();
835
- for (let L = 0; L < H; L++) {
836
- Ue(L, k), C.position.copy(k);
837
- const x = 0.55 + L * 37 % 7 * 0.035;
838
- C.scale.set(0.78, x * 0.82, 0.62), C.updateMatrix(), b.setMatrixAt(L, C.matrix), b.setColorAt(L, new n.Color());
839
- }
840
- return b.instanceMatrix.setUsage(n.DynamicDrawUsage), b;
841
- }, []), o = A(() => {
842
- const f = [];
843
- for (let b = 0; b < H; b++) {
844
- const C = e.nodes[b % Math.max(1, e.nodes.length)], k = new n.Color(C ? lo[C.kind] ?? "#94a3b8" : "#333");
845
- f.push(k.multiplyScalar(b < e.nodes.length ? 0.16 : 0.05));
846
- }
847
- return f;
848
- }, [e]), r = A(() => /* @__PURE__ */ new Map(), [e]), a = (f) => {
849
- let b = r.get(f);
850
- return b === void 0 && r.set(f, b = uo(e, f) % H), b;
851
- }, l = A(() => new qe(40, 24), []), u = A(() => new ye(jt, new n.MeshBasicMaterial({ toneMapped: !1, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1 }), 40), []), i = A(
852
- () => ({
853
- fire: new Float32Array(H),
854
- white: new Float32Array(H),
855
- fireC: Array.from({ length: H }, () => new n.Color()),
856
- push: new Float32Array(H),
857
- dirty: new Uint8Array(H),
858
- o: new n.Object3D(),
859
- a: new n.Vector3(),
860
- b: new n.Vector3(),
861
- c: new n.Vector3(),
862
- p: new n.Vector3(),
863
- q: new n.Vector3(),
864
- w: new n.Vector3(),
865
- col: new n.Color()
866
- }),
867
- []
868
- );
869
- pe(() => void i.dirty.fill(1), [o, i]);
870
- const c = P([]), p = P([]), y = P(Array(Fe).fill(""));
871
- N(() => {
872
- const f = performance.now();
873
- i.fire.fill(0), i.white.fill(0), i.push.fill(0), l.begin(), u.begin();
874
- const b = V.flares;
875
- for (let x = Math.max(0, b.length - $o); x < b.length; x++) {
876
- const M = b[x], g = a(M.node), m = (f - M.start) / 1e3, I = V.instances.get(M.instance) ?? V.archive.get(M.instance), F = I ? Y(Te[I.type]) : E, G = M.op === "write", _ = m < 0.3 ? m / 0.3 : Math.exp(-(m - 0.3) * 1.3);
877
- if (_ > i.fire[g] && (i.fire[g] = _, i.fireC[g].copy(G ? Ee : F), i.white[g] = G ? 1 : 0), G && (i.push[g] = Math.max(i.push[g], Math.sin(Math.PI * U(m / 0.9)))), i.dirty[g] = 1, m < 2.2 && fe(M.instance, i.w)) {
878
- Ue(g, i.b), i.b.z += 0.4, co(i.w, i.a), Le(i.a, i.b, 4, i.c);
879
- const B = Math.min(1, m / 0.25) * Math.pow(1 - m / 2.2, 1.4), W = G ? Math.min(1, m * 0.9) : 1 - Math.min(1, m * 0.9);
880
- i.col.copy(G ? te : F).lerp(Ee, G ? 0.5 : 0), l.add(i.a, i.c, i.b, i.col, B * 0.8, W, 0, 0), G ? (de(i.a, i.c, i.b, 0.9, i.p), i.q.subVectors(i.b, i.p), u.add(i.p, i.q, 0.14, 0.36, 0.14, i.col, B * 1.4)) : (de(i.a, i.c, i.b, 0.1, i.p), i.q.subVectors(i.a, i.p), u.add(i.p, i.q, 0.14, 0.36, 0.14, i.col, B * 1.4));
881
- }
882
- }
883
- l.end(), u.end();
884
- const C = i.o;
885
- let k = !1;
886
- for (let x = 0; x < H; x++) {
887
- const M = i.fire[x];
888
- if (M > 5e-3 || i.dirty[x]) {
889
- i.col.copy(o[x]), M > 5e-3 && i.col.lerp(i.fireC[x], Math.min(1, M)).multiplyScalar(1 + M * (1.4 + i.white[x] * 1.6)), t.setColorAt(x, i.col), Ue(x, C.position), C.position.z += i.push[x] * 0.45;
890
- const g = 0.55 + x * 37 % 7 * 0.035;
891
- C.scale.set(0.78, g * 0.82, 0.62), C.updateMatrix(), t.setMatrixAt(x, C.matrix), k = !0, M <= 5e-3 && (i.dirty[x] = 0);
892
- }
893
- }
894
- k && (t.instanceMatrix.needsUpdate = !0, t.instanceColor && (t.instanceColor.needsUpdate = !0));
895
- let L = 0;
896
- for (let x = V.flares.length - 1; x >= 0 && L < Fe; x--) {
897
- const M = V.flares[x];
898
- if (f - M.start > 2200) break;
899
- let g = !1;
900
- for (let _ = 0; _ < L; _++) y.current[_] === M.node && (g = !0);
901
- if (g) continue;
902
- const m = a(M.node);
903
- Ue(m, i.p);
904
- let I = !1;
905
- for (let _ = 0; _ < L; _++) {
906
- const B = p.current[_];
907
- B && Math.abs(B.position.y - (i.p.y + 0.55)) < 0.6 && Math.abs(B.position.x - i.p.x) < 3.4 && (I = !0);
908
- }
909
- if (I) continue;
910
- const F = c.current[L], G = p.current[L];
911
- F && G && (G.position.set(i.p.x, i.p.y + 0.55, i.p.z + 0.5), y.current[L] !== M.node && (F.setText(`${M.op === "write" ? "wrote" : "read"} · ${M.node}`), F.setColor(M.op === "write" ? "#ffd23f" : "#ffab1a")), F.setOpacity(1)), y.current[L] = M.node, L++;
912
- }
913
- for (let x = L; x < Fe; x++) {
914
- const M = c.current[x];
915
- M == null || M.setOpacity(0), y.current[x] = "";
916
- }
917
- });
918
- const h = A(() => {
919
- const f = [];
920
- for (let b = 0; b <= oe; b += 5) f.push(Ce - X / 2 + Math.min(b, oe) * X);
921
- return f[f.length - 1] < Ce - X / 2 + oe * X - 0.01 && f.push(Ce - X / 2 + oe * X), f;
922
- }, []), v = oe * X, z = Ce - X / 2 + v / 2, w = Pe + Ve * ze + 0.1;
923
- return /* @__PURE__ */ R("group", { children: [
924
- /* @__PURE__ */ s("primitive", { object: t }),
925
- h.map((f) => /* @__PURE__ */ R("group", { children: [
926
- /* @__PURE__ */ s("mesh", { geometry: S, material: rt, scale: [0.09, w, 0.09], position: [f, w / 2, re + 0.42] }),
927
- /* @__PURE__ */ s("mesh", { geometry: S, material: rt, scale: [0.09, w, 0.09], position: [f, w / 2, re - 0.42] })
928
- ] }, f)),
929
- Array.from({ length: Ve + 1 }, (f, b) => /* @__PURE__ */ R("group", { children: [
930
- /* @__PURE__ */ s("mesh", { geometry: S, material: Gt, scale: [v, 0.05, 0.9], position: [z, Pe + b * ze - 0.03, re] }),
931
- /* @__PURE__ */ s("mesh", { geometry: S, material: rt, scale: [v, 0.07, 0.06], position: [z, Pe + b * ze, re + 0.44] })
932
- ] }, b)),
933
- /* @__PURE__ */ s("mesh", { geometry: S, material: Gt, scale: [v + 2, w + 1.4, 0.15], position: [z, (w + 1.4) / 2, re - 0.7] }),
934
- /* @__PURE__ */ s("primitive", { object: l.lines }),
935
- /* @__PURE__ */ s("primitive", { object: u.mesh }),
936
- Array.from({ length: Fe }, (f, b) => /* @__PURE__ */ s("group", { ref: (C) => void (p.current[b] = C), children: /* @__PURE__ */ s(we, { ref: (C) => void (c.current[b] = C), text: "", plate: "box", size: 0.22, opacity: 0, fadeMs: 250, pxRange: [7.5, 11.5] }) }, b)),
937
- /* @__PURE__ */ s(po, { position: [z, w + 1.6, re], suffix: " · rack", color: "#ffab1a", plate: "box", letterSpacing: 0.04, size: 0.7, opacity: 0.85, pxRange: [9, 13] })
938
- ] });
939
- }
940
- function Qo() {
941
- const e = A(() => new So(), []);
942
- return N((t, o) => e.update(o)), /* @__PURE__ */ s("primitive", { object: e.mesh });
943
- }
944
- const it = new n.Vector3(), Kt = 3.6;
945
- function en(e) {
946
- qo(e);
947
- for (const t of ie.mcp.values()) e(it.set(t.target.x, 3.4, t.target.z), 2.4);
948
- for (const t of ho()) e(it.copy(ie.clusterTarget[t]).setY(1.4), 3.6);
949
- if (ie.graphWanted) {
950
- const t = ie.graph;
951
- e(it.set(t.target.x, (vo + 2) * (Kt / Ft), t.target.z), 1.6);
952
- }
953
- }
954
- function tn() {
955
- const e = Zt((t) => t.scene);
956
- return N(() => {
957
- const t = e.fog;
958
- if (!t) return;
959
- const o = Ke.cam.dist || 40;
960
- t.near = o * 1.1, t.far = o * 2.9;
961
- }), null;
962
- }
963
- const on = /* @__PURE__ */ R(ve, { children: [
964
- /* @__PURE__ */ s(tn, {}),
965
- /* @__PURE__ */ s("fog", { attach: "fog", args: ["#07050a", 70, 160] }),
966
- /* @__PURE__ */ s(Oo, {}),
967
- /* @__PURE__ */ s(Eo, {})
968
- ] });
969
- function pn() {
970
- return /* @__PURE__ */ R(
971
- mo,
972
- {
973
- title: "factory · neon floor",
974
- subtitle: "Agents are machines (big = parent, compact = subagent) · belts carry crates parent → child · sparks = LLM calls · robot arms = tool calls · ⬢ docks = MCP servers with their trucks & silos · the rack is graph memory",
975
- preset: "lanes",
976
- plane: "xz",
977
- camera: { position: [6, 29, 34], fov: 38, near: 0.5, far: 300 },
978
- controls: { maxPolarAngle: 1.32 },
979
- bg: "#07050a",
980
- gl: { antialias: !0 },
981
- fit: { nRef: 4, min: 0.62, max: 1.45, minRadius: 6.5 },
982
- agentRadius: 1.6,
983
- agentHeight: 3.1,
984
- graph: { natural: Ft, radius: Kt },
985
- peripheryGap: 5,
986
- Background: on,
987
- Agent: Zo,
988
- Edge: zo,
989
- RunMarker: Fo,
990
- McpServer: Bo,
991
- Backend: Lo,
992
- GraphResource: Jo,
993
- cluster: { radius: 1.35, variant: "orb", color: "#ff8a1f" },
994
- clusterOffset: [0, 2.4, 0],
995
- extents: en,
996
- PostFX: /* @__PURE__ */ R($t, { multisampling: 0, children: [
997
- /* @__PURE__ */ s(Jt, { mipmapBlur: !0, intensity: 0.95, luminanceThreshold: 0.32, luminanceSmoothing: 0.25, radius: 0.7 }),
998
- /* @__PURE__ */ s(Qt, { eskil: !1, offset: 0.24, darkness: 0.85 })
999
- ] }),
1000
- children: [
1001
- /* @__PURE__ */ s(Po, {}),
1002
- /* @__PURE__ */ s(To, {}),
1003
- /* @__PURE__ */ s(Qo, {})
1004
- ]
1005
- }
1006
- );
1007
- }
1008
- export {
1009
- pn as default
1010
- };