agentglow 0.1.0 → 0.2.0

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-BuFtYuhc.js +2737 -0
  3. package/dist/chunks/index-BPyTLdiF.js +792 -0
  4. package/dist/chunks/index-Bo5HRf-O.js +784 -0
  5. package/dist/chunks/index-C42Ihyo1.js +605 -0
  6. package/dist/chunks/index-C5YqtHnC.js +677 -0
  7. package/dist/chunks/index-Cyv7bII1.js +818 -0
  8. package/dist/chunks/index-D0UvupqM.js +1143 -0
  9. package/dist/chunks/index-D733n3Hf.js +1086 -0
  10. package/dist/chunks/index-DCmhxN8v.js +1010 -0
  11. package/dist/chunks/index-DO9SAG-u.js +753 -0
  12. package/dist/chunks/index-Dn6oRasS.js +887 -0
  13. package/dist/chunks/index-HyfZ0ePz.js +838 -0
  14. package/dist/chunks/index-XMOz-HBf.js +492 -0
  15. package/dist/chunks/index-ZT88hgW-.js +763 -0
  16. package/dist/chunks/index-e6egU2Q6.js +889 -0
  17. package/dist/chunks/index-jLXx_Wgk.js +68 -0
  18. package/dist/chunks/index-tonipLb2.js +980 -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 +59 -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,831 +0,0 @@
1
- var rt = Object.defineProperty;
2
- var st = (e, t, o) => t in e ? rt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
3
- var T = (e, t, o) => st(e, typeof t != "symbol" ? t + "" : t, o);
4
- import { jsx as h, jsxs as E, Fragment as X } from "react/jsx-runtime";
5
- import { OrbitControls as at } from "@react-three/drei";
6
- import { useFrame as I, Canvas as it } from "@react-three/fiber";
7
- import { EffectComposer as ct, Bloom as lt, Vignette as pt } from "@react-three/postprocessing";
8
- import { useState as de, useRef as V, useMemo as k, useEffect as ft } from "react";
9
- import { w as A, h as _, l as oe, m as je, j as Ne, T as $e, C as ut, L as ce, c as dt, i as ht, r as ke, p as gt, b as mt, s as wt, d as qe, R as yt, S as Ie, u as bt, k as vt, n as Re, G as St, f as Mt, H as xt, t as Ct, g as At } from "./ClusterBall-CPsd6JvJ.js";
10
- import * as s from "three";
11
- import { a as Be } from "./spread-CWdeDFd9.js";
12
- var We;
13
- const L = typeof window < "u" && !!((We = window.matchMedia) != null && We.call(window, "(prefers-reduced-motion: reduce)").matches), K = new s.Color("#46ff9a"), le = new s.Color("#38e8ff"), Xe = new s.Color("#ffb547"), xe = new s.Color("#ff4a4a"), N = new s.Color(1, 1, 1), kt = Object.fromEntries(
14
- Object.entries($e).map(([e, t]) => [e, new s.Color(t).lerp(K, 0.28)])
15
- ), B = (e) => e < 0 ? 0 : e > 1 ? 1 : e, Oe = (e) => 1 - Math.pow(1 - B(e), 3), ne = (e) => (e = B(e), e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2), W = 10, Z = Math.PI * 2, Rt = L ? 0.22 : 0.85, Ge = (e) => e * Rt % Z;
16
- function Pt(e, t) {
17
- let o = (t - e) % Z;
18
- return o < 0 && (o += Z), Math.exp(-o * 1.4);
19
- }
20
- function $(e, t, o, r) {
21
- return r.set(Math.sin(e) * t, o, -Math.cos(e) * t);
22
- }
23
- const zt = (e) => Math.atan2(e.x, -e.z);
24
- function De(e) {
25
- if (oe.grouped) return je(e) * Z / 6 + Be(Ne(e)) * 0.55 + (_(e, 1) - 0.5) * 0.12;
26
- const t = A.runs.get(e);
27
- return (t ? t.slot : Math.floor(_(e, 9) * 6)) * Z / 6 + (_(e, 1) - 0.5) * 0.32;
28
- }
29
- const te = [30, 210, 330, 150, 90, 270, 0, 180].map((e) => e * Math.PI / 180), Ye = W + 1.55;
30
- function Ee(e, t) {
31
- const o = te[e % te.length] + Math.floor(e / te.length) * 0.26;
32
- return $(o, Ye + Math.floor(e / te.length) * 0.8, 0, t);
33
- }
34
- function Ke(e, t, o, r) {
35
- const i = te[e % te.length] + Math.floor(e / te.length) * 0.26;
36
- return $(i + (t - (o - 1) / 2) * 0.17, Ye + 2.35, 0, r);
37
- }
38
- const we = /* @__PURE__ */ new Map(), Tt = (e) => oe.grouped ? 1 + je(e) * 64 + Ne(e) : 0, ye = /* @__PURE__ */ new Map();
39
- function Bt(e) {
40
- const t = ye.get(e.id);
41
- if (t !== void 0) return t;
42
- const o = /* @__PURE__ */ new Set();
43
- for (const [i, a] of ye) {
44
- const c = A.instances.get(i);
45
- if (!c) {
46
- ye.delete(i);
47
- continue;
48
- }
49
- c.run === e.run && c.parent === e.parent && o.add(a);
50
- }
51
- let r = 0;
52
- for (; o.has(r); ) r++;
53
- return ye.set(e.id, r), r;
54
- }
55
- function Ce(e) {
56
- const t = we.get(e.id), o = Tt(e.run);
57
- if (t && t.key === o) return t;
58
- for (const c of we.keys()) !A.instances.has(c) && !A.archive.has(c) && we.delete(c);
59
- const r = e.parent ? A.instances.get(e.parent) ?? A.archive.get(e.parent) : void 0, i = Bt(e);
60
- let a;
61
- if (r) {
62
- const c = Ce(r), l = Math.min(W - 1.5, c.r + (e.subagent ? 2.7 : 2.3) + (i % 2 ? 0.9 : 0) + (_(e.id, 4) - 0.5) * 0.5), n = 2.3 / l, w = (_(e.run, 5) - 0.5) * 0.3;
63
- a = { bearing: c.bearing + w * (i ? 1 : 0.4) + Be(i) * n + (_(e.id, 6) - 0.5) * 0.06, r: l, depth: c.depth + 1, key: o };
64
- } else {
65
- const c = De(e.run), l = 3.3 + _(e.id, 2) * 0.8 + (i ? 1.2 : 0);
66
- a = { bearing: c + Be(i) * (2.4 / l) + (_(e.id, 3) - 0.5) * 0.12, r: l, depth: 0, key: o };
67
- }
68
- return we.set(e.id, a), a;
69
- }
70
- const Et = (e) => e.subagent ? 0.55 : 1.1;
71
- function Ze(e, t, o, r) {
72
- if ($(t.bearing, t.r, 0, r), L) return r;
73
- const i = _(e.id, 7) * Z, a = Z / 26 * (_(e.id, 8) > 0.5 ? 1 : -1), c = e.subagent ? 0.32 : 0.45, l = Math.cos(t.bearing), n = Math.sin(t.bearing), w = Math.cos(o * a + i) * c, C = Math.sin(o * a + i) * c * 0.55;
74
- return r.x += l * w - n * C, r.z += n * w + l * C, r;
75
- }
76
- const H = /* @__PURE__ */ new Map();
77
- function ae(e, t, o, r, i) {
78
- const a = 1 - r;
79
- return i.set(a * a * e.x + 2 * a * r * t.x + r * r * o.x, a * a * e.y + 2 * a * r * t.y + r * r * o.y, a * a * e.z + 2 * a * r * t.z + r * r * o.z);
80
- }
81
- function ue(e, t, o, r, i) {
82
- i.copy(e).add(t).multiplyScalar(0.5);
83
- const a = t.x - e.x, c = t.z - e.z, l = Math.hypot(a, c) || 1;
84
- return i.x += -c / l * r * l * 0.18, i.z += a / l * r * l * 0.18, i.y += o, i;
85
- }
86
- let be = null;
87
- function Vt() {
88
- if (be) return be;
89
- const e = document.createElement("canvas");
90
- e.width = e.height = 128;
91
- const t = e.getContext("2d"), o = t.createRadialGradient(64, 64, 0, 64, 64, 64);
92
- return o.addColorStop(0, "rgba(255,255,255,1)"), o.addColorStop(0.16, "rgba(255,255,255,0.55)"), o.addColorStop(0.45, "rgba(255,255,255,0.12)"), o.addColorStop(1, "rgba(255,255,255,0)"), t.fillStyle = o, t.fillRect(0, 0, 128, 128), be = new s.CanvasTexture(e), be;
93
- }
94
- const Ue = (e = "#fff") => new s.SpriteMaterial({ map: Vt(), color: e, blending: s.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1 }), fe = (e = "#fff") => new s.MeshBasicMaterial({ color: e, blending: s.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1 }), Fe = (e = "#fff") => new s.LineBasicMaterial({ color: e, blending: s.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1 }), Ot = new s.ConeGeometry(1, 1, 3).translate(0, 0.5, 0), ve = 28, q = { Solid: 0, Dash: 1, Head: 2 }, Ae = class Ae {
95
- constructor(t, o) {
96
- T(this, "lines");
97
- T(this, "arrows");
98
- T(this, "P");
99
- T(this, "C");
100
- T(this, "v", 0);
101
- T(this, "na", 0);
102
- T(this, "maxV");
103
- T(this, "maxA");
104
- T(this, "aColors");
105
- T(this, "p", new s.Vector3());
106
- T(this, "q", new s.Vector3());
107
- T(this, "o", new s.Object3D());
108
- T(this, "time", 0);
109
- this.maxV = t * ve * 2;
110
- const r = new s.BufferGeometry();
111
- this.P = new s.BufferAttribute(new Float32Array(this.maxV * 3), 3), this.C = new s.BufferAttribute(new Float32Array(this.maxV * 3), 3), this.P.setUsage(s.DynamicDrawUsage), this.C.setUsage(s.DynamicDrawUsage), r.setAttribute("position", this.P), r.setAttribute("color", this.C), r.boundingSphere = new s.Sphere(new s.Vector3(), 1e4), this.lines = new s.LineSegments(r, new s.LineBasicMaterial({ vertexColors: !0, transparent: !0, blending: s.AdditiveBlending, depthWrite: !1, toneMapped: !1 })), this.lines.frustumCulled = !1, this.maxA = o, this.aColors = new Float32Array(o * 3), this.arrows = new s.InstancedMesh(Ot, new s.MeshBasicMaterial({ blending: s.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1 }), o), this.arrows.instanceColor = new s.InstancedBufferAttribute(this.aColors, 3), this.arrows.frustumCulled = !1, this.arrows.count = 0;
112
- }
113
- begin(t) {
114
- this.v = 0, this.na = 0, this.time = t;
115
- }
116
- push(t, o, r, i, a) {
117
- const c = this.v++;
118
- this.P.setXYZ(c, t, o, r), this.C.setXYZ(c, i.r * a, i.g * a, i.b * a);
119
- }
120
- segment(t, o, r, i, a = i) {
121
- this.v + 2 > this.maxV || (this.push(t.x, t.y, t.z, r, i), this.push(o.x, o.y, o.z, r, a));
122
- }
123
- /** Quadratic curve p0→p1→p2, drawn up to `grow` (0..1). */
124
- curve(t, o, r, i, a, c, l = 0, n = 1, w = 9, C = 1.4) {
125
- if (this.v + ve * 2 > this.maxV || a <= 2e-3) return;
126
- const u = Math.max(1, Math.ceil(ve * B(n)));
127
- for (let y = 0; y < u; y++)
128
- for (let v = 0; v < 2; v++) {
129
- const d = Math.min(n, (y + v) / ve);
130
- ae(t, o, r, d, this.p);
131
- let f = 1;
132
- if (c === q.Dash) {
133
- const p = Math.sin((d * w - this.time * C) * Math.PI);
134
- f = 0.18 + (p > 0 ? Math.pow(p, 3) : 0) * 1.1;
135
- } else if (c === q.Head) {
136
- const p = d - l;
137
- f = 0.12 + (p > 0 ? Math.exp(-(p * p) / 9e-4) : Math.exp(p / 0.16)) * 2.4;
138
- }
139
- this.push(this.p.x, this.p.y, this.p.z, i, a * f);
140
- }
141
- }
142
- ring(t, o, r, i, a, c, l, n) {
143
- const w = Math.max(4, Math.ceil(Math.abs(c - a) / 0.06));
144
- for (let C = 0; C < w; C++) {
145
- if (this.v + 2 > this.maxV) return;
146
- const u = a + (c - a) * C / w, y = a + (c - a) * (C + 1) / w;
147
- this.push(t + Math.sin(u) * i, r, o - Math.cos(u) * i, l, n), this.push(t + Math.sin(y) * i, r, o - Math.cos(y) * i, l, n);
148
- }
149
- }
150
- /** Arrowhead on the curve at t, pointing toward p2 (dir=+1) or p0 (dir=-1). */
151
- arrow(t, o, r, i, a, c, l, n) {
152
- this.na >= this.maxA || n <= 0.01 || (ae(t, o, r, i, this.p), ae(t, o, r, B(i + 0.02 * a), this.q), this.q.sub(this.p), !(this.q.lengthSq() < 1e-9) && (this.o.position.copy(this.p), this.o.quaternion.setFromUnitVectors(Ae.UP, this.q.normalize()), this.o.scale.set(c * 0.42, c, c * 0.42), this.o.updateMatrix(), this.arrows.setMatrixAt(this.na, this.o.matrix), this.aColors[this.na * 3] = l.r * n, this.aColors[this.na * 3 + 1] = l.g * n, this.aColors[this.na * 3 + 2] = l.b * n, this.na++));
153
- }
154
- end() {
155
- this.lines.geometry.setDrawRange(0, this.v), this.P.needsUpdate = !0, this.C.needsUpdate = !0, this.arrows.count = this.na, this.arrows.instanceMatrix.needsUpdate = !0, this.arrows.instanceColor && (this.arrows.instanceColor.needsUpdate = !0);
156
- }
157
- };
158
- T(Ae, "UP", new s.Vector3(0, 1, 0));
159
- let ie = Ae;
160
- const Gt = (
161
- /* glsl */
162
- `
163
- attribute float aSize; attribute vec3 aColor; varying vec3 vC; uniform float uScale;
164
- void main(){ vec4 mv = modelViewMatrix * vec4(position, 1.0); gl_PointSize = aSize * uScale / -mv.z; vC = aColor; gl_Position = projectionMatrix * mv; }`
165
- ), Dt = (
166
- /* glsl */
167
- `
168
- varying vec3 vC;
169
- void main(){ float r = length(gl_PointCoord - 0.5) * 2.0; if (r > 1.0) discard;
170
- float core = smoothstep(0.35, 0.0, r); float halo = pow(1.0 - r, 2.4);
171
- gl_FragColor = vec4(vC * (core * 1.3 + halo * 0.5), 1.0); }`
172
- );
173
- class Je {
174
- constructor(t) {
175
- T(this, "points");
176
- T(this, "material");
177
- T(this, "P");
178
- T(this, "C");
179
- T(this, "S");
180
- T(this, "n", 0);
181
- T(this, "max");
182
- this.max = t;
183
- const o = new s.BufferGeometry();
184
- this.P = new s.BufferAttribute(new Float32Array(t * 3), 3), this.C = new s.BufferAttribute(new Float32Array(t * 3), 3), this.S = new s.BufferAttribute(new Float32Array(t), 1), o.setAttribute("position", this.P), o.setAttribute("aColor", this.C), o.setAttribute("aSize", this.S), o.boundingSphere = new s.Sphere(new s.Vector3(), 1e4), this.material = new s.ShaderMaterial({ uniforms: { uScale: { value: 300 } }, vertexShader: Gt, fragmentShader: Dt, transparent: !0, depthWrite: !1, blending: s.AdditiveBlending }), this.points = new s.Points(o, this.material), this.points.frustumCulled = !1;
185
- }
186
- begin() {
187
- this.n = 0;
188
- }
189
- add(t, o, r, i, a, c) {
190
- if (this.n >= this.max || c <= 3e-3) return;
191
- const l = this.n++;
192
- this.P.setXYZ(l, t, o, r), this.C.setXYZ(l, a.r * c, a.g * c, a.b * c), this.S.setX(l, i);
193
- }
194
- end() {
195
- this.points.geometry.setDrawRange(0, this.n), this.P.needsUpdate = !0, this.C.needsUpdate = !0, this.S.needsUpdate = !0;
196
- }
197
- }
198
- const Qe = 64, Me = Array.from({ length: Qe }, () => ({ x: 0, y: 0, z: 0, r: 1, color: new s.Color(), start: -1e9, dur: 1, k: 1, width: 1 }));
199
- let Pe = 0;
200
- function pe(e, t, o, r = 1200, i = 1, a = 0, c = 1) {
201
- const l = Me[Pe];
202
- Pe = (Pe + 1) % Qe, l.x = e.x, l.y = e.y, l.z = e.z, l.r = t, l.color.copy(o), l.start = performance.now() + a, l.dur = r, l.k = i, l.width = c;
203
- }
204
- function Ut(e, t) {
205
- const o = e * Z / 6;
206
- return oe.laneExpanded[e] ? $(o - 0.42, W - 2.2, 0.9, t) : $(o, W * 0.52, 0.9, t);
207
- }
208
- function Ft() {
209
- return /* @__PURE__ */ h(ut, { place: Ut, radius: 1.2, variant: "stars", color: "#46ff9a" });
210
- }
211
- const ze = { db: "◉", warehouse: "▤", spark: "✷", api: "⇄", storage: "▣", queue: "≡" }, et = (e) => new s.Color(e).lerp(K, 0.25), Ve = new s.PlaneGeometry(1.7, 0.16).rotateX(-Math.PI / 2), He = new s.EdgesGeometry(Ve), _t = new s.CylinderGeometry(0.07, 0.1, 0.7, 6).translate(0, 0.35, 0), qt = new s.CylinderGeometry(0.17, 0.12, 0.14, 8).translate(0, 0.76, 0), tt = new s.BoxGeometry(0.42, 0.18, 0.42).translate(0, 0.09, 0), It = new s.EdgesGeometry(tt);
212
- function Ht({ srv: e, res: t, k: o, n: r }) {
213
- const i = k(() => Ke(e.slot, o, r, new s.Vector3()), [e.slot, o, r]), a = k(() => et(e.color).lerp(N, 0.2), [e.color]), c = k(() => ({ fill: fe(a), line: Fe(a), halo: Ue(a) }), [a]), l = V(null), n = V(null), w = V("");
214
- return I(({ clock: C }) => {
215
- var b;
216
- const u = performance.now(), y = t.inflight > 0, v = Math.exp(-((u - t.activeAt) / 1e3) * 1.4), d = y && !L ? 0.5 + 0.5 * Math.sin(C.elapsedTime * 6) : 0.5, f = y ? 1.4 + d * 0.8 : 0.25 + v * 1;
217
- c.fill.color.copy(a).multiplyScalar(f * 0.35), c.line.color.copy(a).multiplyScalar(f * 1.2), c.halo.color.copy(a).multiplyScalar(y ? 0.35 + d * 0.2 : 0.03 + v * 0.25), (b = l.current) == null || b.scale.setScalar(y ? 2.6 + d * 0.6 : 1.6 + v);
218
- let p = `${ze[t.kind] ?? "·"} ${t.name}`;
219
- if (y) {
220
- let m = "";
221
- for (const g of A.mcpPending.values()) g.server === e.name && g.resource === t.name && (m = g.tool);
222
- p = `${ze[t.kind] ?? "·"} ${t.name} ▸ ${m || "query"}()`;
223
- } else v > 0.25 && (p = `${ze[t.kind] ?? "·"} ${t.name} ✓`);
224
- n.current && (p !== w.current && (w.current = p, n.current.setText(p)), n.current.setOpacity(y ? 1 : 0.5 + v * 0.5), n.current.setEmphasis(y));
225
- }), /* @__PURE__ */ E("group", { position: i, children: [
226
- /* @__PURE__ */ h("mesh", { geometry: tt, material: c.fill }),
227
- /* @__PURE__ */ h("lineSegments", { geometry: It, material: c.line }),
228
- /* @__PURE__ */ h("sprite", { ref: l, material: c.halo, position: [0, 0.15, 0] }),
229
- /* @__PURE__ */ h(ce, { ref: n, position: [0, -0.05, 0.62], text: t.name, font: "mono", plate: "underline", color: e.color, textColor: "#a6e9c6", letterSpacing: 0.03, size: 0.26, pxRange: [7.5, 10.5] })
230
- ] });
231
- }
232
- function Lt({ srv: e }) {
233
- const t = k(() => Ee(e.slot, new s.Vector3()), [e.slot]), o = k(() => Math.atan2(t.x, -t.z), [t]), r = k(() => et(e.color), [e.color]), i = k(() => ({ fill: fe(r), line: Fe(r), tower: fe(r), cab: fe(N), beacon: Ue(r) }), [r]), a = V(null), [c, l] = de([]), n = V(-1);
234
- return I(({ clock: w }) => {
235
- var f;
236
- e.resources.size !== n.current && (n.current = e.resources.size, l([...e.resources.values()]));
237
- const C = performance.now(), u = e.inflight > 0, y = Math.exp(-((C - e.activeAt) / 1e3) * 1.3), v = L ? 0.6 : Math.pow(0.5 + 0.5 * Math.sin(w.elapsedTime * (u ? 7 : 1.6) + e.slot), 4), d = 0.35 + y * 0.7 + (u ? 0.5 : 0);
238
- i.fill.color.copy(r).multiplyScalar(d * 0.18), i.line.color.copy(r).multiplyScalar(d * 1.3), i.tower.color.copy(r).multiplyScalar(d * 0.7), i.cab.color.copy(r).lerp(N, 0.5).multiplyScalar(0.3 + v * (u ? 1.4 : 0.7)), i.beacon.color.copy(r).multiplyScalar(0.08 + v * (u ? 0.55 : 0.22) + y * 0.15), (f = a.current) == null || f.scale.setScalar(1.4 + v * (u ? 1.6 : 0.7));
239
- }), /* @__PURE__ */ E(X, { children: [
240
- /* @__PURE__ */ E("group", { position: t, rotation: [0, -o, 0], children: [
241
- /* @__PURE__ */ E("group", { rotation: [0, 0.5, 0], children: [
242
- /* @__PURE__ */ h("mesh", { geometry: Ve, material: i.fill }),
243
- /* @__PURE__ */ h("lineSegments", { geometry: He, material: i.line })
244
- ] }),
245
- /* @__PURE__ */ E("group", { rotation: [0, -0.75, 0], position: [0.1, 5e-3, 0.15], children: [
246
- /* @__PURE__ */ h("mesh", { geometry: Ve, material: i.fill, scale: [0.75, 1, 1] }),
247
- /* @__PURE__ */ h("lineSegments", { geometry: He, material: i.line, scale: [0.75, 1, 1] })
248
- ] }),
249
- /* @__PURE__ */ E("group", { position: [0.45, 0, -0.35], children: [
250
- /* @__PURE__ */ h("mesh", { geometry: _t, material: i.tower }),
251
- /* @__PURE__ */ h("mesh", { geometry: qt, material: i.cab }),
252
- /* @__PURE__ */ h("sprite", { ref: a, material: i.beacon, position: [0, 0.8, 0] })
253
- ] })
254
- ] }),
255
- /* @__PURE__ */ h(
256
- ce,
257
- {
258
- position: [t.x, 0, t.z],
259
- offset: [Math.sin(o) * 1.15, Math.cos(o) * 1 - 0.45],
260
- text: [
261
- { text: e.name.replace(/[^a-z0-9]/gi, "").slice(0, 4).toUpperCase().padEnd(4, "X") + " ", color: e.color },
262
- { text: `MCP · ${e.name}`, color: "#c8f7de" }
263
- ],
264
- font: "mono",
265
- plate: "box",
266
- color: e.color,
267
- letterSpacing: 0.04,
268
- size: 0.3,
269
- pxRange: [8, 11.5]
270
- }
271
- ),
272
- c.map((w, C) => /* @__PURE__ */ h(Ht, { srv: e, res: w, k: C, n: c.length }, w.name))
273
- ] });
274
- }
275
- function Wt() {
276
- const e = k(() => new ie(140, 64), []), t = k(() => new Je(64), []), o = k(() => ({ ap: new s.Vector3(), gp: new s.Vector3(), c: new s.Vector3(), h: new s.Vector3(), col: new s.Color(), col2: new s.Color() }), []), r = k(() => /* @__PURE__ */ new Map(), []);
277
- return I(({ clock: i, size: a }) => {
278
- const c = performance.now();
279
- e.begin(L ? 0 : i.elapsedTime), t.begin(), t.material.uniforms.uScale.value = a.height * 0.9;
280
- const { ap: l, gp: n, c: w, h: C, col: u, col2: y } = o;
281
- r.clear();
282
- for (const d of A.mcpCalls) {
283
- if (!d.resource) continue;
284
- const f = d.server + "|" + d.resource, p = r.get(f);
285
- (!p || d.start > p.start) && r.set(f, d);
286
- }
287
- for (const d of A.mcpServers.values()) {
288
- Ee(d.slot, l), u.set(d.color).lerp(K, 0.25);
289
- const f = d.resources.size;
290
- let p = 0;
291
- for (const b of d.resources.values()) {
292
- Ke(d.slot, p++, f, n), l.y = n.y = 0.03, w.copy(l).add(n).multiplyScalar(0.5);
293
- const m = Math.exp(-((c - b.activeAt) / 1e3) * 1.4), g = r.get(d.name + "|" + b.name), S = g && g.phase === "result" ? (c - g.start) / g.dur : 9;
294
- if (S < 1) {
295
- const P = 1 - ne(S);
296
- e.curve(l, w, n, y.copy(u).lerp(N, 0.35), 0.9, q.Head, P, 1), e.arrow(l, w, n, 0.12, -1, 0.3, u, 1.6 * (1 - S * 0.6));
297
- } else b.inflight > 0 ? (e.curve(l, w, n, u, 0.7, q.Dash, 0, 1, 6, 1.8), e.arrow(l, w, n, 0.85, 1, 0.26, u, 1.2)) : e.curve(l, w, n, u, 0.16 + m * 0.4, q.Solid);
298
- }
299
- }
300
- const v = (d, f, p, b) => {
301
- const m = H.get(d), g = A.mcpServers.get(f);
302
- if (!(!m || !g))
303
- if (Ee(g.slot, l), l.y = 0.25, ue(m.pos, l, 1.2, 0.4, w), u.set(g.color).lerp(K, 0.25), p === 0) {
304
- u.lerp(Xe, B(b / 1.2)), b > 1.2 && u.lerp(xe, B((b - 1.2) / 1.2));
305
- const S = (0.45 + Math.min(0.5, b * 0.2)) * B(b / 0.25) * m.vis;
306
- e.curve(m.pos, w, l, u, S, q.Dash, 0, 1, 12, 2.2), e.arrow(m.pos, w, l, 0.93, 1, 0.34, u, 0.6 + S);
307
- } else {
308
- u.lerp(N, 0.35);
309
- const S = 1 - ne(b / 0.8), P = (b < 0.8 ? 1 : 1 - (b - 0.8) / 0.2) * m.vis;
310
- e.curve(m.pos, w, l, u, 0.9 * P, q.Head, S, 1), e.arrow(m.pos, w, l, Math.max(0.04, S), -1, 0.36, u, 1.8 * P), ae(m.pos, w, l, S, C), t.add(C.x, C.y, C.z, 0.7, u, 1.2 * P);
311
- }
312
- };
313
- for (const d of A.mcpPending.values()) v(d.instance, d.server, 0, dt(d, c));
314
- for (const d of A.mcpCalls) d.phase === "result" && v(d.instance, d.server, 1, B((c - d.start) / d.dur));
315
- e.end(), t.end();
316
- }), /* @__PURE__ */ E(X, { children: [
317
- /* @__PURE__ */ h("primitive", { object: e.lines }),
318
- /* @__PURE__ */ h("primitive", { object: e.arrows }),
319
- /* @__PURE__ */ h("primitive", { object: t.points })
320
- ] });
321
- }
322
- function jt() {
323
- const [e, t] = de([]), o = V(-1);
324
- return I(() => {
325
- A.mcpServers.size !== o.current && (o.current = A.mcpServers.size, t([...A.mcpServers.values()]));
326
- }), /* @__PURE__ */ E(X, { children: [
327
- e.map((r) => /* @__PURE__ */ h(Lt, { srv: r }, r.name)),
328
- /* @__PURE__ */ h(Wt, {})
329
- ] });
330
- }
331
- const ot = new s.OctahedronGeometry(0.42, 0), Nt = new s.EdgesGeometry(ot), $t = new s.SphereGeometry(0.7, 8, 6), Xt = new s.MeshBasicMaterial({ transparent: !0, opacity: 0, depthWrite: !1 }), Yt = 1.6, Kt = 1.7, Zt = (e) => e >= 1e3 ? `${(e / 1e3).toFixed(1)}k` : String(e);
332
- function Jt({ inst: e, onSelect: t }) {
333
- const o = V(null), r = V(null), i = V(null), a = V(null), c = kt[e.type], l = k(() => ({ fill: fe(c), edge: Fe(c), halo: Ue(c) }), [c]), n = k(
334
- () => ({
335
- id: e.id,
336
- pos: new s.Vector3(),
337
- ground: new s.Vector3(),
338
- color: new s.Color(),
339
- vis: 0,
340
- scale: 1,
341
- takeoff: 0,
342
- land: 0,
343
- origin: new s.Vector3(),
344
- ctrl: new s.Vector3(),
345
- cruise: new s.Vector3(),
346
- hold: new s.Vector3(),
347
- init: !1,
348
- llm: e.llmCalls,
349
- landed: !1,
350
- lastTag: 0,
351
- t2: "",
352
- c: new s.Color()
353
- }),
354
- [e]
355
- );
356
- ft(() => (H.set(e.id, n), () => {
357
- H.get(e.id) === n && H.delete(e.id);
358
- }), [e.id, n]), I(({ clock: d }) => {
359
- var he, U;
360
- const f = performance.now(), p = d.elapsedTime, b = Ce(e), m = Et(e);
361
- if (Ze(e, b, p, n.hold), n.hold.y = m, n.init ? n.cruise.lerp(n.hold, 0.08) : n.cruise.copy(n.hold), !n.init) {
362
- n.init = !0;
363
- const F = e.parent ? H.get(e.parent) : void 0;
364
- F && F.vis > 0.05 ? n.origin.copy(F.pos) : n.origin.set(n.cruise.x, 0, n.cruise.z), pe(n.origin, e.subagent ? 0.9 : 1.4, K, 1100, 0.7);
365
- }
366
- const g = (f - e.bornAt) / 1e3;
367
- n.takeoff = B(g / Yt), n.takeoff < 1 ? (ue(n.origin, n.cruise, e.parent ? 1.5 : 0.2, e.parent ? 0.7 : 0, n.ctrl), ae(n.origin, n.ctrl, n.cruise, ne(n.takeoff), n.pos)) : n.pos.copy(n.cruise);
368
- const S = e.exitAt ? (f - e.exitAt) / 1e3 : -1;
369
- if (n.land = S >= 0 ? B(S / Kt) : 0, S >= 0 && (n.pos.y *= 1 - ne(n.land)), n.land >= 1 && !n.landed && (n.landed = !0, n.ground.set(n.pos.x, 0.02, n.pos.z), pe(n.ground, 1.1 * ke(e), e.status === "failed" ? xe : K, 1300, 0.9)), n.ground.set(n.pos.x, 0.02, n.pos.z), n.vis = gt(e, f), n.scale = ke(e) * mt(), e.llmCalls !== n.llm) {
370
- n.llm = e.llmCalls;
371
- const F = 0.55 + e.pulse * 1.05;
372
- pe(n.pos, F * (e.subagent ? 0.8 : 1), c, 1500, 1.1), pe(n.pos, F * 0.62 * (e.subagent ? 0.8 : 1), c, 1300, 0.7, 170);
373
- }
374
- const P = Pt(zt(n.pos), Ge(p)), M = S < 0 && (e.status === "thinking" || e.status === "spawning"), z = e.status === "failed", O = L ? 0.5 : 0.5 + 0.5 * Math.sin(p * 2.4 + e.index);
375
- n.c.copy(c), z && n.c.lerp(xe, B(n.land * 2)), n.color.copy(n.c);
376
- const j = (0.55 + P * 0.9) * n.vis;
377
- l.fill.color.copy(n.c).multiplyScalar((M ? 0.85 + O * 0.25 : 0.12) * j), l.edge.color.copy(n.c).lerp(N, 0.25).multiplyScalar((M ? 1.3 : 1) * j), l.halo.color.copy(n.c).multiplyScalar((M ? 0.32 : 0.12) * j + P * 0.12 * n.vis), o.current && o.current.position.copy(n.pos);
378
- const J = 0.45 + 0.55 * Oe(n.takeoff), Q = n.scale * J * (1 - n.land * 0.45);
379
- if (r.current && (r.current.scale.set(Q, Q * 0.75, Q), r.current.rotation.y = Math.PI / 4), (he = i.current) == null || he.scale.setScalar(Q * (M ? 2.6 + O * 0.3 : 1.8) + P * 0.5), (U = a.current) == null || U.setOpacity(wt(e.id) ? B(n.takeoff * 1.6) * n.vis * (0.75 + P * 0.25) : 0), f - n.lastTag > 200 && a.current) {
380
- n.lastTag = f;
381
- let F = !1;
382
- for (const x of A.mcpPending.values()) x.instance === e.id && (F = !0);
383
- const ge = S >= 0 ? z ? "FAIL" : n.land < 1 ? "LAND" : "DONE" : n.takeoff < 1 ? "TKOF" : F ? "MCP" : M ? "THNK" : "WAIT", re = `${Zt(e.tokens)} tk ${ge}`;
384
- re !== n.t2 && (n.t2 = re, a.current.setText(y, re));
385
- }
386
- });
387
- const w = (d) => {
388
- d.stopPropagation(), t(e.id);
389
- }, C = e.id.split(":")[2], u = !e.subagent, y = `${e.name.toUpperCase()}${C !== void 0 && /^\d+$/.test(C) ? ` ${Number(C) + 1}` : ""}`, v = Math.sin(Ce(e).bearing) < -0.15;
390
- return /* @__PURE__ */ E("group", { ref: o, children: [
391
- /* @__PURE__ */ E("group", { ref: r, children: [
392
- /* @__PURE__ */ h("mesh", { geometry: ot, material: l.fill }),
393
- /* @__PURE__ */ h("lineSegments", { geometry: Nt, material: l.edge })
394
- ] }),
395
- /* @__PURE__ */ h("sprite", { ref: i, material: l.halo }),
396
- /* @__PURE__ */ h(
397
- "mesh",
398
- {
399
- geometry: $t,
400
- material: Xt,
401
- scale: ke(e),
402
- onClick: w,
403
- onPointerOver: () => document.body.style.cursor = "pointer",
404
- onPointerOut: () => document.body.style.cursor = ""
405
- }
406
- ),
407
- /* @__PURE__ */ h(
408
- ce,
409
- {
410
- ref: a,
411
- text: y,
412
- secondary: "",
413
- font: "mono",
414
- plate: "bar",
415
- leader: !0,
416
- offset: v ? [-0.75, 0.62] : [0.75, 0.62],
417
- anchorX: v ? "right" : "left",
418
- anchorY: "bottom",
419
- textAlign: v ? "right" : "left",
420
- color: $e[e.type],
421
- textColor: "#d9ffe9",
422
- secondaryColor: "#57d897",
423
- letterSpacing: 0.06,
424
- size: u ? 0.36 : 0.3,
425
- secondarySize: u ? 0.3 : 0.27,
426
- opacity: 0,
427
- pxRange: u ? [8.5, 12.5] : [7.5, 10.5],
428
- renderOrder: 26
429
- }
430
- )
431
- ] });
432
- }
433
- function Qt({ onSelect: e }) {
434
- const [t, o] = de([]), r = V(/* @__PURE__ */ new Set()), i = V(-1);
435
- return I(() => {
436
- const a = A.instances;
437
- let c = a.size !== r.current.size || i.current !== oe.version;
438
- if (!c)
439
- for (const l of a.keys()) r.current.has(l) || (c = !0);
440
- c && (r.current = new Set(a.keys()), i.current = oe.version, o([...a.values()].filter(ht)));
441
- }), /* @__PURE__ */ h(X, { children: t.map((a) => /* @__PURE__ */ h(Jt, { inst: a, onSelect: e }, a.id)) });
442
- }
443
- const Le = 6, eo = 1.15;
444
- function to() {
445
- const e = k(() => new ie(220, 64), []), t = k(() => new Je(600), []), o = k(() => ({ a: new s.Vector3(), b: new s.Vector3(), c: new s.Vector3(), h: new s.Vector3(), col: new s.Color() }), []), r = k(() => /* @__PURE__ */ new Map(), []);
446
- return I(({ clock: i, size: a }) => {
447
- const c = performance.now(), l = i.elapsedTime, n = L ? 0 : l;
448
- e.begin(n), t.begin(), t.material.uniforms.uScale.value = a.height * 0.9;
449
- const { a: w, b: C, c: u, h: y, col: v } = o;
450
- for (const f of A.instances.values()) {
451
- const p = H.get(f.id);
452
- if (!p || p.vis <= 0.01) continue;
453
- if (e.segment(p.pos, p.ground, p.color, 0.28 * p.vis, 0.05 * p.vis), t.add(p.ground.x, 0.03, p.ground.z, 0.22 * p.scale, p.color, 0.35 * p.vis), p.takeoff >= 1 && !L) {
454
- const m = Ce(f);
455
- for (let g = 1; g <= Le; g++) {
456
- Ze(f, m, l - g * eo, w);
457
- const S = 1 - g / (Le + 1);
458
- t.add(w.x, p.pos.y, w.z, (f.subagent ? 0.16 : 0.24) * (0.6 + S * 0.4), p.color, 0.55 * S * S * p.vis);
459
- }
460
- }
461
- if (f.parent) {
462
- const m = H.get(f.parent), g = A.instances.get(f.parent), S = !!m && !!g && !g.exitAt && !f.exitAt, P = r.get(f.id) ?? 0, M = P + ((S ? 1 : 0) - P) * (S ? 0.06 : 0.04);
463
- r.set(f.id, M), m && M > 0.01 && (ue(m.pos, p.pos, 0.9, 0.5, u), p.takeoff < 1 ? e.curve(m.pos, u, p.pos, p.color, 0.9, q.Head, p.takeoff, 1) : (e.curve(m.pos, u, p.pos, p.color, 0.95 * M * Math.min(m.vis, p.vis), q.Dash, 0, 1, 10, 1.2), e.arrow(m.pos, u, p.pos, 0.8, 1, f.subagent ? 0.26 : 0.34, p.color, 0.9 * M * p.vis)));
464
- }
465
- let b = -1;
466
- for (const m of A.mcpPending.values()) m.instance === f.id && (b = Math.max(b, (c - m.since) / 1e3));
467
- if (b >= 0) {
468
- v.copy(Xe).lerp(xe, B((b - 1.2) / 1.2));
469
- const m = L ? 0.6 : 0.5 + 0.5 * Math.sin(l * 6), g = 0.62 * p.scale;
470
- for (let S = 0; S < 4; S++) e.ring(p.pos.x, p.pos.z, p.pos.y, g, S * 1.5708 + 0.25, S * 1.5708 + 1.3, v, (0.6 + m * 0.6) * p.vis);
471
- }
472
- }
473
- for (const f of r.keys()) A.instances.has(f) || r.delete(f);
474
- const d = A.selected ? H.get(A.selected) : void 0;
475
- if (d && d.vis > 0.01) {
476
- const f = 0.75 * d.scale + 0.15, p = f * 0.45, b = d.pos.y;
477
- v.copy(N);
478
- for (let m = -1; m <= 1; m += 2)
479
- for (let g = -1; g <= 1; g += 2)
480
- w.set(d.pos.x + m * f, b, d.pos.z + g * f), C.set(w.x - m * p, b, w.z), e.segment(w, C, v, 0.9), C.set(w.x, b, w.z - g * p), e.segment(w, C, v, 0.9);
481
- }
482
- for (const f of A.comets) {
483
- const p = H.get(f.from), b = H.get(f.to);
484
- if (!p || !b) continue;
485
- const m = B((c - f.start) / f.dur);
486
- if (m >= 1) continue;
487
- ue(p.pos, b.pos, 1.8, -0.9, u);
488
- const g = ne(m), S = m < 0.85 ? 1 : 1 - (m - 0.85) / 0.15;
489
- e.curve(p.pos, u, b.pos, p.color, 0.18 * S, q.Solid), e.curve(p.pos, u, b.pos, p.color, 0.75 * S, q.Head, g, Math.min(1, g + 0.01)), e.arrow(p.pos, u, b.pos, Math.max(0.02, g), 1, 0.36, p.color, 1.6 * S), ae(p.pos, u, b.pos, g, y), v.copy(p.color).lerp(N, 0.4), t.add(y.x, y.y, y.z, 0.75, v, 1.3 * S);
490
- }
491
- e.end(), t.end();
492
- }), /* @__PURE__ */ E(X, { children: [
493
- /* @__PURE__ */ h("primitive", { object: e.lines }),
494
- /* @__PURE__ */ h("primitive", { object: e.arrows }),
495
- /* @__PURE__ */ h("primitive", { object: t.points })
496
- ] });
497
- }
498
- const oo = new s.RingGeometry(0.955, 1, 96).rotateX(-Math.PI / 2);
499
- function no() {
500
- const e = k(() => {
501
- const o = new s.InstancedMesh(oo, new s.MeshBasicMaterial({ blending: s.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1, side: s.DoubleSide }), Me.length);
502
- return o.instanceColor = new s.InstancedBufferAttribute(new Float32Array(Me.length * 3), 3), o.frustumCulled = !1, o.count = 0, o;
503
- }, []), t = k(() => new s.Object3D(), []);
504
- return I(() => {
505
- const o = performance.now();
506
- let r = 0;
507
- const i = e.instanceColor.array;
508
- for (const a of Me) {
509
- const c = (o - a.start) / a.dur;
510
- if (c < 0 || c >= 1) continue;
511
- const l = Math.max(0.01, a.r * Oe(c));
512
- t.position.set(a.x, a.y, a.z), t.scale.set(l, 1, l), t.updateMatrix(), e.setMatrixAt(r, t.matrix);
513
- const n = a.k * Math.pow(1 - c, 1.6) * 1.4;
514
- i[r * 3] = a.color.r * n, i[r * 3 + 1] = a.color.g * n, i[r * 3 + 2] = a.color.b * n, r++;
515
- }
516
- e.count = r, e.instanceMatrix.needsUpdate = !0, e.instanceColor.needsUpdate = !0;
517
- }), /* @__PURE__ */ h("primitive", { object: e });
518
- }
519
- const Y = 0.36;
520
- function ro({ run: e }) {
521
- bt();
522
- const t = De(e.id), o = k(() => $(t, W + 1.75, 0, new s.Vector3()), [t]), r = Math.sin(t), i = Math.cos(t), a = e.status !== "started";
523
- return /* @__PURE__ */ h(
524
- ce,
525
- {
526
- position: o,
527
- anchorX: r > 0.35 ? "left" : r < -0.35 ? "right" : "center",
528
- anchorY: i > 0.35 ? "bottom" : i < -0.35 ? "top" : "middle",
529
- textAlign: "left",
530
- plate: "bar",
531
- text: e.topic,
532
- textColor: "#e8fff1",
533
- secondary: vt(e, { base: "#5fbf8d", current: "#b8ffd6", done: "#9fcfb4" }, ["airborne…", "run complete", "run failed"]),
534
- color: e.color,
535
- size: 0.34,
536
- secondarySize: 0.27,
537
- maxWidth: 8.5,
538
- opacity: a ? 0.55 : 1,
539
- fadeMs: 400,
540
- pxRange: [9, 12.5]
541
- }
542
- );
543
- }
544
- function so() {
545
- const [e, t] = de([]), o = V(/* @__PURE__ */ new Set()), r = V(-1), i = k(() => new ie(40, 1), []), a = k(() => new s.Color(), []);
546
- return I(({ clock: c }) => {
547
- const l = A.runs;
548
- let n = l.size !== o.current.size || r.current !== oe.version;
549
- if (!n)
550
- for (const u of l.keys()) o.current.has(u) || (n = !0);
551
- n && (o.current = new Set(l.keys()), r.current = oe.version, t([...l.values()].filter((u) => qe(u.id))));
552
- const w = performance.now(), C = c.elapsedTime;
553
- i.begin(C);
554
- for (const u of l.values()) {
555
- if (!qe(u.id)) continue;
556
- const y = De(u.id), v = Oe((w - u.startedAt) / 1e3), d = u.endedAt ? B(1 - (w - u.endedAt - (yt - 2500)) / 2500) : 1, f = v * d;
557
- a.set(u.color).lerp(K, 0.15);
558
- const p = W + 0.3;
559
- if (u.hasSteps) {
560
- const b = 2 * Y * v / 3;
561
- for (let g = 0; g < Ie.length; g++) {
562
- const S = u.steps[Ie[g]], P = L ? 0.7 : 0.5 + 0.5 * Math.sin(C * 4), M = S === "running" ? 1.1 + P * 0.8 : S === "done" ? 0.75 : S === "failed" ? 0.9 : 0.18, z = y - Y * v + g * b + 0.02, O = S === "failed" ? a.set("#ff4a4a") : a.set(u.color).lerp(K, 0.15);
563
- i.ring(0, 0, 0.03, p, z, z + b - 0.04, O, M * f), i.ring(0, 0, 0.03, p + 0.06, z, z + b - 0.04, O, M * f * 0.5);
564
- }
565
- const m = u.handoffAt ? 1 - (w - u.handoffAt) / 900 : 0;
566
- m > 0 && i.ring(0, 0, 0.03, p + 0.14, y - Y, y + Y, N, m * 0.8 * f);
567
- } else
568
- i.ring(0, 0, 0.03, p, y - Y * v, y + Y * v, a, 0.85 * f), i.ring(0, 0, 0.03, p + 0.06, y - Y * v, y + Y * v, a, 0.35 * f);
569
- }
570
- i.end();
571
- }), /* @__PURE__ */ E(X, { children: [
572
- /* @__PURE__ */ h("primitive", { object: i.lines }),
573
- e.map((c) => /* @__PURE__ */ h(ro, { run: c }, c.id))
574
- ] });
575
- }
576
- const ao = W + 1, io = (
577
- /* glsl */
578
- `
579
- varying vec2 vP;
580
- void main(){ vP = position.xy; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }`
581
- ), co = (
582
- /* glsl */
583
- `
584
- uniform float uSweep; uniform float uR;
585
- uniform vec3 uBase; uniform vec3 uGrid; uniform vec3 uSweepC; uniform vec3 uCyan;
586
- varying vec2 vP;
587
- #define TAU 6.28318530718
588
- float line(float d, float w){ float f = fwidth(d); return 1.0 - smoothstep(w, w + f * 1.5, abs(d)); }
589
- void main(){
590
- // plane is rotated -90° about X: local (x, y) → world (x, 0, -y); bearing 0 = north (local +y), clockwise
591
- float r = length(vP);
592
- float b = atan(vP.x, vP.y); if (b < 0.0) b += TAU;
593
- float d = mod(uSweep - b, TAU); // radians behind the sweep
594
- float glow = exp(-d * 1.4); // phosphor persistence
595
- float inside = 1.0 - smoothstep(uR - 0.02, uR + 0.02, r);
596
-
597
- vec3 col = uBase * (0.55 + 0.45 * (1.0 - r / uR)) * inside; // CRT bloom toward the centre
598
-
599
- // range rings
600
- float rings = 0.0;
601
- for (int i = 1; i <= 4; i++) rings = max(rings, line(r - uR * float(i) / 4.0, 0.012));
602
- float fine = 0.0;
603
- for (int i = 1; i <= 8; i += 2) fine = max(fine, line(r - uR * float(i) / 8.0, 0.006));
604
- // bearing spokes every 30° (and faint 10°)
605
- float a30 = mod(b, TAU / 12.0); a30 = min(a30, TAU / 12.0 - a30) * r;
606
- float a10 = mod(b, TAU / 36.0); a10 = min(a10, TAU / 36.0 - a10) * r;
607
- float spokes = line(a30, 0.01) * step(0.35, r) * inside;
608
- float spokes10 = line(a10, 0.005) * step(uR * 0.5, r) * inside * 0.5;
609
- float lit = 0.3 + glow * 1.4;
610
- col += uGrid * (rings * 1.0 + fine * 0.35 + spokes * 0.6 + spokes10) * lit * inside;
611
- // centre cross
612
- col += uGrid * (line(vP.x, 0.008) + line(vP.y, 0.008)) * step(r, 0.45) * 1.2;
613
-
614
- // bezel: outer ring + 5°/10°/30° ticks just outside the scope
615
- float bez = line(r - uR, 0.02) * 1.4 + line(r - (uR + 0.62), 0.008) * 0.6;
616
- float t5 = mod(b, TAU / 72.0); t5 = min(t5, TAU / 72.0 - t5) * r;
617
- float t10 = mod(b, TAU / 36.0); t10 = min(t10, TAU / 36.0 - t10) * r;
618
- float ticks = line(t5, 0.008) * step(uR, r) * step(r, uR + 0.16) + line(t10, 0.012) * step(uR, r) * step(r, uR + 0.3) + line(a30, 0.016) * step(uR, r) * step(r, uR + 0.45);
619
- col += uGrid * (bez + ticks) * (0.65 + glow * 0.6);
620
-
621
- // the sweep: a crisp leading line + afterglow wedge
622
- float edge = exp(-d * 60.0) * inside * step(0.15, r);
623
- col += uSweepC * (edge * 1.8 + glow * 0.16 * inside) * (0.35 + 0.65 * smoothstep(0.0, uR * 0.25, r));
624
- // faint cyan rim halo
625
- col += uCyan * exp(-abs(r - uR) * 9.0) * 0.06;
626
-
627
- float outer = 1.0 - smoothstep(uR + 0.7, uR + 0.95, r);
628
- gl_FragColor = vec4(col * outer, 1.0);
629
- }`
630
- );
631
- function lo() {
632
- const e = k(
633
- () => Array.from({ length: 12 }, (t, o) => {
634
- const r = o * 30;
635
- return { deg: r, pos: $(r * Math.PI / 180, W + 0.85, 0, new s.Vector3()) };
636
- }),
637
- []
638
- );
639
- return /* @__PURE__ */ h(X, { children: e.map((t) => /* @__PURE__ */ h(ce, { position: t.pos, text: String(t.deg).padStart(3, "0"), font: "mono", plate: "none", textColor: "#2fae6e", letterSpacing: 0.08, size: 0.24, opacity: 0.85, pxRange: [6.5, 9.5], renderOrder: 12 }, t.deg)) });
640
- }
641
- function po() {
642
- const e = k(
643
- () => new s.ShaderMaterial({
644
- uniforms: {
645
- uSweep: { value: 0 },
646
- uR: { value: W },
647
- uBase: { value: new s.Color("#04241a") },
648
- uGrid: { value: new s.Color("#1fa865") },
649
- uSweepC: { value: new s.Color("#5dffb4") },
650
- uCyan: { value: new s.Color("#38e8ff") }
651
- },
652
- vertexShader: io,
653
- fragmentShader: co,
654
- toneMapped: !1
655
- }),
656
- []
657
- );
658
- return I(({ clock: t }) => {
659
- e.uniforms.uSweep.value = Ge(t.elapsedTime);
660
- }), /* @__PURE__ */ E(X, { children: [
661
- /* @__PURE__ */ h("mesh", { rotation: [-Math.PI / 2, 0, 0], material: e, renderOrder: -1, children: /* @__PURE__ */ h("circleGeometry", { args: [ao, 160] }) }),
662
- /* @__PURE__ */ h(lo, {})
663
- ] });
664
- }
665
- const fo = 180, Se = 4, Te = new s.Color("#ffd27a"), uo = (
666
- /* glsl */
667
- `
668
- attribute float aSize; attribute vec3 aColor; attribute float aHeat;
669
- uniform float uScale; uniform float uSweep;
670
- varying vec3 vC; varying float vHeat;
671
- void main(){
672
- float b = atan(position.x, -position.z); if (b < 0.0) b += 6.28318530718;
673
- float d = mod(uSweep - b, 6.28318530718);
674
- float glow = exp(-d * 1.4);
675
- vec4 mv = modelViewMatrix * vec4(position, 1.0);
676
- gl_PointSize = aSize * (1.0 + aHeat * 0.9) * uScale / -mv.z;
677
- vC = aColor * (0.45 + glow * 0.9); vHeat = aHeat;
678
- gl_Position = projectionMatrix * mv;
679
- }`
680
- ), ho = (
681
- /* glsl */
682
- `
683
- varying vec3 vC; varying float vHeat;
684
- void main(){
685
- vec2 p = gl_PointCoord * 2.0 - 1.0; p.y = -p.y;
686
- // equilateral triangle SDF (waypoint symbol), outline + soft glow when hot
687
- const float k = 1.7320508;
688
- vec2 q = p * 1.25; q.y += 0.18;
689
- q.x = abs(q.x) - 1.0; q.y = q.y + 1.0 / k;
690
- if (q.x + k * q.y > 0.0) q = vec2(q.x - k * q.y, -k * q.x - q.y) / 2.0;
691
- q.x -= clamp(q.x, -2.0, 0.0);
692
- float dist = -length(q) * sign(q.y) * 0.62;
693
- float edge = 1.0 - smoothstep(0.0, 0.09, abs(dist + 0.05));
694
- float fill = (1.0 - smoothstep(-0.05, 0.02, dist)) * vHeat * 0.9;
695
- float halo = exp(-dot(p, p) * 2.5) * vHeat * 0.6;
696
- float a = edge + fill + halo;
697
- if (a < 0.01) discard;
698
- gl_FragColor = vec4(vC * a, 1.0);
699
- }`
700
- );
701
- function go({ galaxy: e }) {
702
- const t = k(() => e.nodes.slice(0, fo), [e]), o = t.length, r = k(() => {
703
- const y = new Float32Array(o * 3), v = new s.Vector3(), d = Math.PI * (3 - Math.sqrt(5));
704
- for (let M = 0; M < o; M++) {
705
- const z = t[M].id, O = 1.3 + (W - 1.9) * Math.sqrt((M + 0.5) / o) + (_(z, 11) - 0.5) * 0.45;
706
- $(M * d + (_(z, 12) - 0.5) * 0.12, O, 0.04, v), y.set([v.x, v.y, v.z], M * 3);
707
- }
708
- const f = new s.BufferGeometry();
709
- f.setAttribute("position", new s.BufferAttribute(y, 3)), f.setAttribute("aSize", new s.BufferAttribute(new Float32Array(o).fill(0.32), 1));
710
- const p = new Float32Array(o * 3), b = new s.Color("#2fd6c8");
711
- for (let M = 0; M < o; M++) p.set([b.r, b.g, b.b], M * 3);
712
- f.setAttribute("aColor", new s.BufferAttribute(p, 3)), f.setAttribute("aHeat", new s.BufferAttribute(new Float32Array(o), 1)), f.boundingSphere = new s.Sphere(new s.Vector3(), 1e4);
713
- const m = new Map(t.map((M, z) => [M.id, z])), g = [];
714
- for (const M of e.links) {
715
- const z = m.get(M.source), O = m.get(M.target);
716
- if (z === void 0 || O === void 0 || z === O) continue;
717
- const j = y[z * 3] - y[O * 3], J = y[z * 3 + 2] - y[O * 3 + 2];
718
- if (j * j + J * J < 4.2 * 4.2 && g.push(z, O), g.length > 600) break;
719
- }
720
- const S = new s.BufferGeometry(), P = new Float32Array(g.length * 3);
721
- for (let M = 0; M < g.length; M++) P.set([y[g[M] * 3], 0.03, y[g[M] * 3 + 2]], M * 3);
722
- return S.setAttribute("position", new s.BufferAttribute(P, 3)), S.setAttribute("color", new s.BufferAttribute(new Float32Array(g.length * 3), 3)), S.boundingSphere = new s.Sphere(new s.Vector3(), 1e4), { pos: y, g: f, lg: S, pairs: g, read: new Float32Array(o), write: new Float32Array(o) };
723
- }, [t, e.links, o]), i = k(
724
- () => new s.ShaderMaterial({ uniforms: { uScale: { value: 300 }, uSweep: { value: 0 } }, vertexShader: uo, fragmentShader: ho, transparent: !0, depthWrite: !1, blending: s.AdditiveBlending }),
725
- []
726
- ), a = k(() => new s.LineBasicMaterial({ vertexColors: !0, transparent: !0, blending: s.AdditiveBlending, depthWrite: !1, toneMapped: !1 }), []), c = k(() => new ie(48, 32), []), l = V({ lastFlare: 0, last: 0 }), n = V([]), w = V([]), C = V(Array(Se).fill("")), u = k(() => ({ wp: new s.Vector3(), c: new s.Vector3(), col: new s.Color(), base: new s.Color("#2fd6c8"), air: new s.Color("#0f6f5a") }), []);
727
- return I(({ clock: y, size: v }) => {
728
- var re;
729
- const d = performance.now(), f = Math.min(0.1, l.current.last ? (d - l.current.last) / 1e3 : 0.016);
730
- l.current.last = d, i.uniforms.uScale.value = v.height * 0.9, i.uniforms.uSweep.value = Ge(y.elapsedTime);
731
- const { read: p, write: b, pos: m } = r, { wp: g, c: S, col: P, base: M, air: z } = u;
732
- for (const x of A.flares) {
733
- if (x.id <= l.current.lastFlare) continue;
734
- l.current.lastFlare = Math.max(l.current.lastFlare, x.id);
735
- const R = Re(e, x.node) % o;
736
- x.op === "read" ? p[R] = 1 : (b[R] = 1, g.set(m[R * 3], 0.05, m[R * 3 + 2]), pe(g, 1.6, Te, 1400, 0.9));
737
- }
738
- const O = Math.exp(-f * 0.8), j = r.g.getAttribute("aHeat"), J = r.g.getAttribute("aColor");
739
- for (let x = 0; x < o; x++) {
740
- p[x] *= O, b[x] *= O;
741
- const R = Math.max(p[x], b[x]);
742
- j.setX(x, R), P.copy(M).lerp(le, B(p[x] * 1.5)).multiplyScalar(1 + p[x] * 2.2), b[x] > 0.01 && P.lerp(Te, B(b[x] * 1.5)).multiplyScalar(1 + b[x] * 1.5), J.setXYZ(x, P.r, P.g, P.b);
743
- }
744
- j.needsUpdate = !0, J.needsUpdate = !0;
745
- const Q = r.lg.getAttribute("color");
746
- for (let x = 0; x < r.pairs.length; x++) {
747
- const R = r.pairs[x], G = Math.max(p[R], b[R]), D = 0.1 + G * 1.4;
748
- Q.setXYZ(x, z.r * D + le.r * G * 0.4, z.g * D + le.g * G * 0.4, z.b * D + le.b * G * 0.4);
749
- }
750
- Q.needsUpdate = !0, c.begin(L ? 0 : y.elapsedTime);
751
- let he = 0;
752
- for (let x = A.flares.length - 1; x >= 0; x--) {
753
- const R = A.flares[x], G = (d - R.start) / 1e3;
754
- if (G > 1.8) continue;
755
- const D = H.get(R.instance);
756
- if (!D) continue;
757
- const ee = Re(e, R.node) % o;
758
- g.set(m[ee * 3], 0.05, m[ee * 3 + 2]), ue(D.pos, g, 0.6, 0.3, S);
759
- const me = B(G / 1.1), se = G < 1.1 ? 1 : 1 - (G - 1.1) / 0.7, _e = R.op === "read" ? le : Te, nt = R.op === "read" ? 1 - ne(me) : ne(me);
760
- if (c.curve(D.pos, S, g, _e, 0.6 * se * D.vis, q.Head, nt, 1), c.arrow(D.pos, S, g, R.op === "read" ? 0.1 : 0.9, R.op === "read" ? -1 : 1, 0.26, _e, 1.2 * se * D.vis), ++he > 40) break;
761
- }
762
- c.end();
763
- let U = 0;
764
- const F = C.current, ge = [];
765
- for (let x = A.flares.length - 1; x >= 0 && U < Se; x--) {
766
- const R = A.flares[x];
767
- if (ge.includes(R.node)) continue;
768
- ge.push(R.node);
769
- const G = Re(e, R.node) % o, D = n.current[U], ee = w.current[U];
770
- D && D.position.set(m[G * 3], 0.05, m[G * 3 + 2]);
771
- const me = (d - R.start) / 1e3;
772
- if (ee) {
773
- const se = `${R.op === "read" ? "RD" : "WR"} ${((re = e.nodes[G]) == null ? void 0 : re.name) ?? R.node}`;
774
- F[U] !== se && (F[U] = se, ee.setText(se), ee.setColor(R.op === "read" ? "#38e8ff" : "#ffd27a")), ee.setOpacity(B(1.4 - me / 1.8));
775
- }
776
- U++;
777
- }
778
- for (; U < Se; U++) {
779
- const x = w.current[U];
780
- x == null || x.setOpacity(0);
781
- }
782
- }), /* @__PURE__ */ E(X, { children: [
783
- /* @__PURE__ */ h("lineSegments", { geometry: r.lg, material: a, frustumCulled: !1 }),
784
- /* @__PURE__ */ h("points", { geometry: r.g, material: i, frustumCulled: !1 }),
785
- /* @__PURE__ */ h("primitive", { object: c.lines }),
786
- /* @__PURE__ */ h("primitive", { object: c.arrows }),
787
- Array.from({ length: Se }, (y, v) => /* @__PURE__ */ h("group", { ref: (d) => void (n.current[v] = d), children: /* @__PURE__ */ h(ce, { ref: (d) => void (w.current[v] = d), position: [0, 0, 0.45], text: "", font: "mono", plate: "box", letterSpacing: 0.05, size: 0.26, opacity: 0, pxRange: [7.5, 10.5], renderOrder: 22 }) }, v)),
788
- /* @__PURE__ */ h(St, { position: $(Math.PI, W + 3.3, 0, new s.Vector3()), prefix: "WPT waypoints · ", font: "mono", plate: "box", color: "#38e8ff", textColor: "#c8f7de", letterSpacing: 0.04, size: 0.3, pxRange: [8, 11.5] })
789
- ] });
790
- }
791
- function mo() {
792
- return I(() => {
793
- Ct(), At();
794
- }), null;
795
- }
796
- function Ao() {
797
- const e = Mt(), [t, o] = de(null);
798
- return /* @__PURE__ */ E("div", { className: "scene-root ap-root", children: [
799
- /* @__PURE__ */ E(it, { camera: { position: [0, 29.5, 15.5], fov: 48 }, dpr: [1, 2], gl: { antialias: !0, powerPreference: "high-performance" }, onPointerMissed: () => o(null), children: [
800
- /* @__PURE__ */ h("color", { attach: "background", args: ["#010604"] }),
801
- /* @__PURE__ */ h(mo, {}),
802
- /* @__PURE__ */ E("group", { position: [-2.6, 0, 0.2], children: [
803
- /* @__PURE__ */ h(po, {}),
804
- /* @__PURE__ */ h(go, { galaxy: e }),
805
- /* @__PURE__ */ h(so, {}),
806
- /* @__PURE__ */ h(jt, {}),
807
- /* @__PURE__ */ h(to, {}),
808
- /* @__PURE__ */ h(no, {}),
809
- /* @__PURE__ */ h(Qt, { onSelect: o }),
810
- /* @__PURE__ */ h(Ft, {})
811
- ] }),
812
- /* @__PURE__ */ h(at, { makeDefault: !0, enablePan: !1, enableDamping: !0, dampingFactor: 0.06, minDistance: 12, maxDistance: 48, maxPolarAngle: 1.15, target: [0, 0, 1.1] }),
813
- /* @__PURE__ */ E(ct, { multisampling: 0, children: [
814
- /* @__PURE__ */ h(lt, { mipmapBlur: !0, intensity: 0.95, luminanceThreshold: 0.22, luminanceSmoothing: 0.35, radius: 0.7 }),
815
- /* @__PURE__ */ h(pt, { eskil: !1, offset: 0.25, darkness: 0.85 })
816
- ] })
817
- ] }),
818
- /* @__PURE__ */ h(
819
- xt,
820
- {
821
- title: "airport · radar scope",
822
- subtitle: "Agents are flights (solid = thinking, hollow = waiting, amber ring = waiting on MCP) · subagents take off from their parent · rings = LLM pings sized by tokens · ✈ MCP airports with backend gates · △ waypoints = graph memory",
823
- selected: t,
824
- onClose: () => o(null)
825
- }
826
- )
827
- ] });
828
- }
829
- export {
830
- Ao as default
831
- };