agentglow 0.1.0 → 0.2.1

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