agentglow 0.2.10 → 0.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/chunks/{KitScene-Bm1I35Zc.js → KitScene-DG_pcnWW.js} +1273 -1195
  2. package/dist/chunks/{index-COLbf8XM.js → index-Agh7jdYu.js} +182 -182
  3. package/dist/chunks/{index-CGTp73GN.js → index-B2EHxcBQ.js} +400 -400
  4. package/dist/chunks/{index-D-r9aJ4u.js → index-B4Cqo621.js} +33 -33
  5. package/dist/chunks/index-BfQsJ0TH.js +751 -0
  6. package/dist/chunks/index-BmBGYhJS.js +891 -0
  7. package/dist/chunks/index-Bnn-x-aE.js +767 -0
  8. package/dist/chunks/{index-BWsSd_Wm.js → index-CTQTtm9q.js} +212 -212
  9. package/dist/chunks/{index-_IwfbZy7.js → index-CTZbUTDY.js} +62 -62
  10. package/dist/chunks/{index-cRPj-lzn.js → index-CdKvybsL.js} +284 -284
  11. package/dist/chunks/index-CeiIEWek.js +818 -0
  12. package/dist/chunks/{index-D4Wlmsay.js → index-Ci8tSMhc.js} +15 -15
  13. package/dist/chunks/{index-C2vLpNCb.js → index-Cls_VZdb.js} +100 -100
  14. package/dist/chunks/index-DFFRhihO.js +892 -0
  15. package/dist/chunks/index-DMCETM4H.js +605 -0
  16. package/dist/chunks/{index-AugvjZJN.js → index-URn4zDHp.js} +223 -223
  17. package/dist/chunks/index-u4rYZ1UO.js +495 -0
  18. package/dist/index.js +1 -1
  19. package/dist/style.css +1 -1
  20. package/dist/types/world.d.ts +30 -5
  21. package/package.json +1 -1
  22. package/dist/chunks/index-BAQDf-0T.js +0 -492
  23. package/dist/chunks/index-BRnLrSfZ.js +0 -605
  24. package/dist/chunks/index-CKyn9lcT.js +0 -753
  25. package/dist/chunks/index-CnoB0ZDk.js +0 -889
  26. package/dist/chunks/index-KmczAvvY.js +0 -818
  27. package/dist/chunks/index-Z4vdWCok.js +0 -763
  28. package/dist/chunks/index-uZGu9jzU.js +0 -887
@@ -0,0 +1,818 @@
1
+ import { jsxs as J, jsx as r } from "react/jsx-runtime";
2
+ import { EffectComposer as Et, Bloom as Ot, Vignette as Vt, Noise as Wt } from "@react-three/postprocessing";
3
+ import { useThree as Lt, useFrame as le } from "@react-three/fiber";
4
+ import { useMemo as i, useRef as U, useEffect as Ct, useState as kt } from "react";
5
+ import * as t from "three";
6
+ import { F as ht, r as Bt, n as pt, w as Z, L as dt, a as ie, d as Dt, T as Ze, v as Nt, z as Ue, l as Xt, e as qt, f as ze, S as Pe, R as jt, j as Ht, A as Zt, g as Pt, b as it, K as ct, o as Kt, G as $t, q as Yt, m as Jt } from "./KitScene-DG_pcnWW.js";
7
+ import { Trail as Tt } from "@react-three/drei";
8
+ const Ee = Bt ? 0.25 : 1, Qt = {
9
+ ...ht,
10
+ name: "ocean-drift",
11
+ run(e, o, n) {
12
+ ht.run(e, o, n), n.angle = -Math.PI / 2;
13
+ }
14
+ }, Gt = (e, o) => Math.sin(e * 0.32 + o * 1.9) * 0.45 + Math.sin(e * 0.11 + o) * 0.3, Rt = (e, o) => Math.sin(e * 0.2 + o * 0.7) * 0.35;
15
+ function Ut(e) {
16
+ let o = 7;
17
+ for (let n = 0; n < e.length; n++) o = o * 31 + e.charCodeAt(n) >>> 0;
18
+ return o;
19
+ }
20
+ const $e = new t.Vector3(0.95, 0.75, 0.25), Ne = 1.15;
21
+ function Xe(e, o) {
22
+ const n = pt.mcp.get(e);
23
+ if (!n) return;
24
+ const s = n.out.x > 0 ? -1 : 1;
25
+ return o.set(n.pos.x + $e.x * s * Ne, n.pos.y + $e.y * Ne, n.pos.z + $e.z * Ne * s);
26
+ }
27
+ const ae = (e) => e < 0 ? 0 : e > 1 ? 1 : e, en = (e) => 1 - Math.pow(1 - e, 3), tn = (e) => 1 + 2.9 * Math.pow(e - 1, 3) + 1.9 * Math.pow(e - 1, 2), Te = new t.Vector3();
28
+ function qe(e, o, n, s, d) {
29
+ Te.copy(e).add(o).multiplyScalar(0.5), Te.y += s;
30
+ const y = 1 - n;
31
+ return d.set(
32
+ y * y * e.x + 2 * y * n * Te.x + n * n * o.x,
33
+ y * y * e.y + 2 * y * n * Te.y + n * n * o.y,
34
+ y * y * e.z + 2 * y * n * Te.z + n * n * o.z
35
+ );
36
+ }
37
+ let We = null;
38
+ function Fe() {
39
+ if (We) return We;
40
+ const e = document.createElement("canvas");
41
+ e.width = e.height = 64;
42
+ const o = e.getContext("2d"), n = o.createRadialGradient(32, 32, 0, 32, 32, 32);
43
+ return n.addColorStop(0, "rgba(255,255,255,1)"), n.addColorStop(0.35, "rgba(255,255,255,0.55)"), n.addColorStop(1, "rgba(255,255,255,0)"), o.fillStyle = n, o.fillRect(0, 0, 64, 64), We = new t.CanvasTexture(e), We;
44
+ }
45
+ function zt(e) {
46
+ return new t.ShaderMaterial({
47
+ uniforms: {
48
+ uColor: { value: new t.Color(e) },
49
+ uIntensity: { value: 1 },
50
+ uOpacity: { value: 1 },
51
+ uFlash: { value: 0 }
52
+ },
53
+ vertexShader: (
54
+ /* glsl */
55
+ `
56
+ varying vec3 vN; varying vec3 vV; varying vec3 vP;
57
+ void main() {
58
+ vP = position;
59
+ vec4 mv = modelViewMatrix * vec4(position, 1.0);
60
+ vN = normalize(normalMatrix * normal);
61
+ vV = normalize(-mv.xyz);
62
+ gl_Position = projectionMatrix * mv;
63
+ }`
64
+ ),
65
+ fragmentShader: (
66
+ /* glsl */
67
+ `
68
+ uniform vec3 uColor; uniform float uIntensity; uniform float uOpacity; uniform float uFlash;
69
+ varying vec3 vN; varying vec3 vV; varying vec3 vP;
70
+ void main() {
71
+ float f = pow(1.0 - abs(dot(normalize(vN), normalize(vV))), 2.2);
72
+ float margin = 1.0 - smoothstep(0.0, 0.22, vP.y);
73
+ float canals = pow(abs(sin(atan(vP.z, vP.x) * 4.0)), 18.0) * smoothstep(0.05, 0.6, vP.y);
74
+ float top = smoothstep(0.75, 1.0, vP.y);
75
+ float b = 0.10 + f * 1.5 + margin * 1.1 + canals * 0.6 + top * 0.25;
76
+ vec3 c = mix(uColor, vec3(1.0), clamp(uFlash * 0.7 + margin * 0.15, 0.0, 1.0)) * b * uIntensity;
77
+ float a = clamp((0.18 + f * 0.9 + margin * 0.7) * uOpacity, 0.0, 1.0);
78
+ gl_FragColor = vec4(c, a);
79
+ }`
80
+ ),
81
+ transparent: !0,
82
+ depthWrite: !1,
83
+ side: t.DoubleSide,
84
+ blending: t.AdditiveBlending
85
+ });
86
+ }
87
+ function gt(e) {
88
+ return new t.ShaderMaterial({
89
+ uniforms: {
90
+ uColor: { value: new t.Color(e) },
91
+ uTime: { value: 0 },
92
+ uReveal: { value: 0 },
93
+ uFade: { value: 1 },
94
+ uPulse: { value: -1 },
95
+ uPulseAmp: { value: 0 },
96
+ uWidthGlow: { value: 1 }
97
+ },
98
+ vertexShader: (
99
+ /* glsl */
100
+ `
101
+ varying vec2 vUv;
102
+ void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }`
103
+ ),
104
+ fragmentShader: (
105
+ /* glsl */
106
+ `
107
+ uniform vec3 uColor; uniform float uTime; uniform float uReveal; uniform float uFade; uniform float uPulse; uniform float uPulseAmp; uniform float uWidthGlow;
108
+ varying vec2 vUv;
109
+ void main() {
110
+ float u = vUv.x;
111
+ float flow = pow(0.5 + 0.5 * sin(u * 70.0 - uTime * 2.4), 8.0);
112
+ float pulse = exp(-pow((u - uPulse) * 22.0, 2.0)) * uPulseAmp;
113
+ float ends = smoothstep(0.0, 0.07, u) * smoothstep(1.0, 0.93, u);
114
+ float rev = smoothstep(uReveal, uReveal - 0.04, u);
115
+ float b = (0.32 + flow * 0.7) * uWidthGlow + pulse * 5.0;
116
+ vec3 c = mix(uColor, vec3(1.0), clamp(pulse * 0.6, 0.0, 1.0)) * b;
117
+ float a = ends * rev * uFade;
118
+ gl_FragColor = vec4(c, a);
119
+ }`
120
+ ),
121
+ transparent: !0,
122
+ depthWrite: !1,
123
+ blending: t.AdditiveBlending
124
+ });
125
+ }
126
+ function nn() {
127
+ return new t.ShaderMaterial({
128
+ uniforms: { uTime: { value: 0 }, uPx: { value: 1 } },
129
+ vertexShader: (
130
+ /* glsl */
131
+ `
132
+ attribute float aSeed;
133
+ uniform float uTime; uniform float uPx;
134
+ varying float vA;
135
+ void main() {
136
+ vec3 p = position;
137
+ float H = 24.0;
138
+ p.y = mod(p.y - uTime * (0.18 + aSeed * 0.25) + 12.0, H) - 10.0;
139
+ p.x += sin(uTime * 0.3 + aSeed * 40.0) * 0.4;
140
+ p.z += cos(uTime * 0.23 + aSeed * 23.0) * 0.3;
141
+ vec4 mv = modelViewMatrix * vec4(p, 1.0);
142
+ gl_PointSize = (0.5 + aSeed * 1.5) * uPx * (28.0 / -mv.z);
143
+ vA = (0.12 + aSeed * 0.4) * smoothstep(-10.0, -7.0, p.y) * smoothstep(14.0, 10.0, p.y);
144
+ gl_Position = projectionMatrix * mv;
145
+ }`
146
+ ),
147
+ fragmentShader: (
148
+ /* glsl */
149
+ `
150
+ varying float vA;
151
+ void main() {
152
+ float d = length(gl_PointCoord - 0.5);
153
+ float a = smoothstep(0.5, 0.0, d) * vA;
154
+ gl_FragColor = vec4(vec3(0.55, 0.8, 1.0), a);
155
+ }`
156
+ ),
157
+ transparent: !0,
158
+ depthWrite: !1,
159
+ blending: t.AdditiveBlending
160
+ });
161
+ }
162
+ function Ge(e) {
163
+ return new t.ShaderMaterial({
164
+ uniforms: { uTime: { value: 0 }, uStrength: { value: e }, uSeed: { value: Math.random() * 10 } },
165
+ vertexShader: (
166
+ /* glsl */
167
+ `
168
+ varying vec2 vUv;
169
+ void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }`
170
+ ),
171
+ fragmentShader: (
172
+ /* glsl */
173
+ `
174
+ uniform float uTime; uniform float uStrength; uniform float uSeed;
175
+ varying vec2 vUv;
176
+ void main() {
177
+ float across = exp(-pow((vUv.x - 0.5) * 3.2, 2.0));
178
+ float down = pow(vUv.y, 1.6);
179
+ float shimmer = 0.75 + 0.25 * sin(uTime * 0.6 + uSeed + vUv.y * 6.0);
180
+ float a = across * down * shimmer * uStrength;
181
+ gl_FragColor = vec4(vec3(0.35, 0.65, 1.0), a);
182
+ }`
183
+ ),
184
+ transparent: !0,
185
+ depthWrite: !1,
186
+ side: t.DoubleSide,
187
+ blending: t.AdditiveBlending
188
+ });
189
+ }
190
+ function on() {
191
+ return new t.ShaderMaterial({
192
+ uniforms: { uTime: { value: 0 } },
193
+ vertexShader: (
194
+ /* glsl */
195
+ `
196
+ varying vec3 vDir;
197
+ void main() { vDir = normalize(position); gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }`
198
+ ),
199
+ fragmentShader: (
200
+ /* glsl */
201
+ `
202
+ uniform float uTime;
203
+ varying vec3 vDir;
204
+ void main() {
205
+ float y = vDir.y;
206
+ vec3 deep = vec3(0.002, 0.006, 0.014);
207
+ vec3 mid = vec3(0.006, 0.026, 0.05);
208
+ vec3 top = vec3(0.02, 0.09, 0.15);
209
+ vec3 c = mix(deep, mid, smoothstep(-0.35, 0.15, y));
210
+ c = mix(c, top, smoothstep(0.2, 0.85, y));
211
+ float caust = pow(0.5 + 0.5 * sin(vDir.x * 18.0 + uTime * 0.4) * sin(vDir.z * 15.0 - uTime * 0.3), 6.0);
212
+ c += vec3(0.03, 0.08, 0.12) * caust * smoothstep(0.55, 0.95, y);
213
+ gl_FragColor = vec4(c, 1.0);
214
+ }`
215
+ ),
216
+ side: t.BackSide,
217
+ depthWrite: !1
218
+ });
219
+ }
220
+ function rn() {
221
+ return new t.ShaderMaterial({
222
+ uniforms: { uTime: { value: 0 } },
223
+ vertexShader: (
224
+ /* glsl */
225
+ `
226
+ varying vec2 vXZ;
227
+ void main() { vec4 w = modelMatrix * vec4(position, 1.0); vXZ = w.xz; gl_Position = projectionMatrix * viewMatrix * w; }`
228
+ ),
229
+ fragmentShader: (
230
+ /* glsl */
231
+ `
232
+ uniform float uTime;
233
+ varying vec2 vXZ;
234
+ void main() {
235
+ vec2 p = vXZ;
236
+ float c1 = sin(p.x * 0.9 + uTime * 0.5 + sin(p.y * 0.7 + uTime * 0.3) * 1.5);
237
+ float c2 = sin(p.y * 1.1 - uTime * 0.4 + sin(p.x * 0.6 - uTime * 0.2) * 1.7);
238
+ float caust = pow(0.5 + 0.25 * (c1 + c2), 5.0);
239
+ float d = length(vec2(p.x * 0.6, (p.y + 3.0)));
240
+ float fade = smoothstep(22.0, 4.0, d);
241
+ vec3 sand = vec3(0.012, 0.03, 0.045);
242
+ vec3 c = sand + vec3(0.05, 0.13, 0.17) * caust;
243
+ gl_FragColor = vec4(c, fade);
244
+ }`
245
+ ),
246
+ transparent: !0,
247
+ depthWrite: !1
248
+ });
249
+ }
250
+ const Ye = Bt ? 700 : 2200;
251
+ function sn() {
252
+ const e = Lt((l) => l.viewport.dpr), o = i(on, []), n = i(rn, []), s = i(nn, []), d = i(
253
+ () => [
254
+ { x: -7.5, w: 4.5, rz: 0.08, m: Ge(0.07) },
255
+ { x: 0, w: 6, rz: 0.03, m: Ge(0.09) },
256
+ { x: 7.5, w: 4.5, rz: -0.06, m: Ge(0.07) },
257
+ { x: -15, w: 8, rz: 0.15, m: Ge(0.035) },
258
+ { x: 14, w: 7, rz: -0.12, m: Ge(0.035) }
259
+ ],
260
+ []
261
+ ), y = i(() => {
262
+ const l = new t.BufferGeometry(), w = new Float32Array(Ye * 3), T = new Float32Array(Ye);
263
+ for (let G = 0; G < Ye; G++)
264
+ w[G * 3] = (Math.random() - 0.5) * 50, w[G * 3 + 1] = Math.random() * 24 - 10, w[G * 3 + 2] = Math.random() * 34 - 22, T[G] = Math.random();
265
+ return l.setAttribute("position", new t.BufferAttribute(w, 3)), l.setAttribute("aSeed", new t.BufferAttribute(T, 1)), l;
266
+ }, []), p = U(null), A = U(null), c = U(null);
267
+ return le(({ clock: l }) => {
268
+ var m, S, I;
269
+ const w = l.elapsedTime * Ee, T = pt.core;
270
+ (m = p.current) == null || m.position.set(0, -(T.hh + 4.4), -4);
271
+ const G = Math.max(1, T.hw / 9);
272
+ (S = A.current) == null || S.scale.set(G, Math.max(1, T.hh / 6), 1), (I = c.current) == null || I.scale.setScalar(Math.max(1, T.r / 11)), o.uniforms.uTime.value = w, n.uniforms.uTime.value = w, s.uniforms.uTime.value = w, s.uniforms.uPx.value = e;
273
+ for (const k of d) k.m.uniforms.uTime.value = w;
274
+ }), /* @__PURE__ */ J("group", { children: [
275
+ /* @__PURE__ */ r("mesh", { material: o, renderOrder: -10, children: /* @__PURE__ */ r("sphereGeometry", { args: [120, 32, 16] }) }),
276
+ /* @__PURE__ */ r("mesh", { ref: p, material: n, rotation: [-Math.PI / 2, 0, 0], position: [0, -7.2, -4], children: /* @__PURE__ */ r("planeGeometry", { args: [160, 90, 1, 1] }) }),
277
+ /* @__PURE__ */ r("group", { ref: A, children: d.map((l, w) => /* @__PURE__ */ r("mesh", { material: l.m, position: [l.x, 3.5, -3.5 - (w > 2 ? 4 : 0)], rotation: [0, 0, l.rz], children: /* @__PURE__ */ r("planeGeometry", { args: [l.w, 24] }) }, w)) }),
278
+ /* @__PURE__ */ r("group", { ref: c, children: /* @__PURE__ */ r("points", { geometry: y, material: s, frustumCulled: !1 }) })
279
+ ] });
280
+ }
281
+ const vt = new t.Vector3(0.95, 0.75, 0.25);
282
+ function an({ mcp: e }) {
283
+ const o = e.srv, n = U(null), s = U(null), d = U(null), y = U(null), p = U(null), A = U(null), c = i(() => new t.Color(o.color), [o.color]), l = i(() => zt(o.color), [o.color]), w = i(() => new t.MeshBasicMaterial({ toneMapped: !1 }), []), T = i(() => new t.SpriteMaterial({ color: o.color, map: Fe(), transparent: !0, toneMapped: !1, blending: t.AdditiveBlending, depthWrite: !1 }), [o.color]), G = i(() => new t.MeshBasicMaterial({ color: new t.Color(o.color).multiplyScalar(0.8), toneMapped: !1 }), [o.color]), m = i(() => new t.MeshBasicMaterial({ color: new t.Color(2.5, 2.5, 2.5), toneMapped: !1 }), []), S = i(() => new t.MeshBasicMaterial({ color: o.color, transparent: !0, toneMapped: !1, blending: t.AdditiveBlending, depthWrite: !1, side: t.DoubleSide }), [o.color]), I = i(() => {
284
+ const z = new t.QuadraticBezierCurve3(new t.Vector3(0.55, 0.35, 0), new t.Vector3(0.75, 1.25, 0), vt);
285
+ return new t.TubeGeometry(z, 16, 0.018, 4);
286
+ }, []), k = i(() => performance.now(), []);
287
+ return le(({ clock: z }) => {
288
+ var C;
289
+ const _ = performance.now(), g = z.elapsedTime * Ee, E = Z.mcpServers.get(o.name) ?? o, h = E.inflight > 0, b = Math.exp(-(_ - E.activeAt) / 500), u = Math.min(1, (_ - k) / 1200), O = n.current, v = s.current;
290
+ if (!O || !v) return;
291
+ O.position.copy(e.pos), O.position.y += Math.sin(g * 0.45 + E.slot * 2) * 0.2, v.rotation.y = (e.out.x > 0 ? Math.PI : 0) + Math.sin(g * (h ? 2.4 : 0.6)) * (h ? 0.35 : 0.12), v.rotation.z = Math.sin(g * 0.5 + E.slot) * 0.08, v.scale.setScalar(Math.max(1e-3, u * Ne * (1 + b * 0.12))), l.uniforms.uIntensity.value = 0.16 + (h ? 0.18 : 0) + b * 0.45, l.uniforms.uOpacity.value = 0.7 * u;
292
+ const x = (h ? 2.4 + Math.sin(_ / 110) * 0.9 : 1.2) + b * 4;
293
+ if (w.color.copy(c).multiplyScalar(x), d.current && d.current.scale.setScalar(1 + b * 0.5 + (h ? 0.15 * Math.sin(_ / 110) : 0)), y.current && (y.current.scale.setScalar(1.6 + b * 2 + (h ? 0.8 : 0)), T.opacity = 0.35 + b * 0.4 + (h ? 0.2 : 0)), p.current) {
294
+ const R = (_ - E.activeAt) / 1100;
295
+ p.current.visible = R < 1, p.current.scale.setScalar(0.3 + R * 2.4), S.opacity = Math.max(0, 1 - R) * 0.9;
296
+ }
297
+ (C = A.current) == null || C.setOpacity(u * (h ? 1 : 0.75));
298
+ }), /* @__PURE__ */ J("group", { ref: n, children: [
299
+ /* @__PURE__ */ J("group", { ref: s, children: [
300
+ /* @__PURE__ */ r("mesh", { material: l, scale: [0.95, 0.62, 0.55], children: /* @__PURE__ */ r("sphereGeometry", { args: [1, 28, 18] }) }),
301
+ /* @__PURE__ */ r("mesh", { material: l, position: [0.62, -0.28, 0], rotation: [0, 0, -0.5], scale: [0.5, 0.18, 0.42], children: /* @__PURE__ */ r("sphereGeometry", { args: [1, 16, 10] }) }),
302
+ /* @__PURE__ */ r("mesh", { material: l, position: [-1.15, 0.05, 0], rotation: [0, 0, Math.PI / 2], scale: [0.6, 0.45, 0.12], children: /* @__PURE__ */ r("coneGeometry", { args: [0.7, 0.9, 12] }) }),
303
+ /* @__PURE__ */ r("mesh", { material: G, geometry: I }),
304
+ /* @__PURE__ */ r("mesh", { material: m, position: [0.55, 0.12, 0.42], children: /* @__PURE__ */ r("sphereGeometry", { args: [0.05, 8, 6] }) }),
305
+ /* @__PURE__ */ J("group", { position: vt, children: [
306
+ /* @__PURE__ */ r("mesh", { ref: d, material: w, children: /* @__PURE__ */ r("sphereGeometry", { args: [0.13, 16, 12] }) }),
307
+ /* @__PURE__ */ r("sprite", { ref: y, material: T }),
308
+ /* @__PURE__ */ r("mesh", { ref: p, material: S, visible: !1, children: /* @__PURE__ */ r("ringGeometry", { args: [0.92, 1, 48] }) })
309
+ ] })
310
+ ] }),
311
+ /* @__PURE__ */ r(dt, { ref: A, position: [0, -1.15, 0], text: `mcp · ${o.name}`, color: o.color, size: 0.3, opacity: 0, pxRange: [9, 13] })
312
+ ] });
313
+ }
314
+ function cn() {
315
+ const n = i(() => {
316
+ const l = new t.BufferGeometry();
317
+ return l.setAttribute("position", new t.BufferAttribute(new Float32Array(4032), 3)), l.setAttribute("color", new t.BufferAttribute(new Float32Array(4032), 3)), l;
318
+ }, []), s = i(() => new t.Vector3(), []), d = i(() => new t.Vector3(), []), y = i(() => new t.Color("#f59e0b"), []), p = i(() => new t.Color("#ef4444"), []), A = i(() => new t.Color(1, 1, 1), []), c = i(() => new t.Color(), []);
319
+ return le(({ clock: l }) => {
320
+ var _;
321
+ const w = performance.now(), T = l.elapsedTime, G = n.getAttribute("position"), m = n.getAttribute("color"), S = G.array, I = m.array;
322
+ let k = 0;
323
+ const z = (g, E, h) => {
324
+ for (let b = 0; b < 28; b++)
325
+ for (let u = 0; u < 2; u++) {
326
+ const O = (b + u) / 28, v = ((k * 28 + b) * 2 + u) * 3;
327
+ qe(g, E, O, 1.6, s);
328
+ const x = Math.sin(O * 14 - T * 5) * 0.05 * Math.sin(O * Math.PI);
329
+ S[v] = s.x, S[v + 1] = s.y + x, S[v + 2] = s.z;
330
+ const C = h(O);
331
+ I[v] = c.r * C, I[v + 1] = c.g * C, I[v + 2] = c.b * C;
332
+ }
333
+ k++;
334
+ };
335
+ for (const g of Z.mcpPending.values()) {
336
+ if (k >= 24) break;
337
+ const E = ie(g.instance), h = Xe(g.server, d);
338
+ if (!E || !h) continue;
339
+ const b = Dt(g, w), u = Z.mcpServers.get(g.server);
340
+ c.set((u == null ? void 0 : u.color) ?? "#94a3b8"), b < 1 ? c.lerp(y, b * 0.8) : c.copy(y).lerp(p, Math.min(1, (b - 1) / 1.2));
341
+ const O = 0.35 + Math.min(b, 3) * 0.35, v = Math.min(1, b * 4);
342
+ z(E, h, (x) => {
343
+ if (x > v) return 0;
344
+ const C = x * 6 - T * 1.8;
345
+ return O * (0.45 + Math.pow(C - Math.floor(C), 8) * 3);
346
+ });
347
+ }
348
+ for (const g of Z.mcpResolved) {
349
+ if (k >= 24) break;
350
+ const E = ie(g.instance), h = Xe(g.server, d);
351
+ if (!E || !h) continue;
352
+ const b = (w - g.resolvedAt) / 700;
353
+ c.set(((_ = Z.mcpServers.get(g.server)) == null ? void 0 : _.color) ?? "#ffffff").lerp(A, 0.6);
354
+ const u = 1 - b * 1.15;
355
+ z(E, h, (O) => (1 - b) * (0.25 + Math.exp(-Math.pow((O - u) * 9, 2)) * 5));
356
+ }
357
+ n.setDrawRange(0, k * 28 * 2), G.needsUpdate = !0, m.needsUpdate = !0;
358
+ }), /* @__PURE__ */ r("lineSegments", { geometry: n, frustumCulled: !1, children: /* @__PURE__ */ r("lineBasicMaterial", { vertexColors: !0, transparent: !0, blending: t.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) });
359
+ }
360
+ const Le = 9, ge = 11, ke = 46, _t = 1500, De = new t.Vector3(), ln = new t.SphereGeometry(1, 36, 18, 0, Math.PI * 2, 0, Math.PI / 2), un = new t.SphereGeometry(1, 16, 12), Mt = new t.Color();
361
+ function pn({ agent: e, selected: o, onSelect: n }) {
362
+ const s = e.inst, d = s.id, y = e.depth > 0, p = y ? 0.42 : 0.62, A = Ut(d) % 1e3 / 1e3, c = Ze[s.type], l = U(null), w = U(null), T = U(null), G = U(null), m = U(null), S = U(null), I = U(null), k = U(A * 6), z = i(() => zt(c), [c]), _ = i(() => new t.MeshBasicMaterial({ color: c, transparent: !0, toneMapped: !1, blending: t.AdditiveBlending, depthWrite: !1 }), [c]), g = i(() => new t.SpriteMaterial({ color: c, map: Fe(), transparent: !0, opacity: 0.06, toneMapped: !1, blending: t.AdditiveBlending, depthWrite: !1 }), [c]), E = i(() => new t.Color(c), [c]), h = i(() => {
363
+ const C = new t.BufferGeometry(), R = Le * ge * 2;
364
+ C.setAttribute("position", new t.BufferAttribute(new Float32Array(R * 3), 3));
365
+ const F = new Float32Array(R * 3), V = new t.Color(c);
366
+ for (let f = 0; f < Le; f++)
367
+ for (let B = 0; B < ge; B++)
368
+ for (let W = 0; W < 2; W++) {
369
+ const N = 1 - (B + W) / ge, H = (f * ge + B) * 2 + W;
370
+ F[H * 3] = V.r * (0.4 + N * 1.8), F[H * 3 + 1] = V.g * (0.4 + N * 1.8), F[H * 3 + 2] = V.b * (0.4 + N * 1.8);
371
+ }
372
+ return C.setAttribute("color", new t.BufferAttribute(F, 3)), C;
373
+ }, [c]), b = i(() => new t.LineBasicMaterial({ vertexColors: !0, transparent: !0, opacity: 0.8, blending: t.AdditiveBlending, depthWrite: !1, toneMapped: !1 }), []), u = i(() => {
374
+ const C = new Float32Array(ke * 4);
375
+ for (let F = 0; F < ke; F++) {
376
+ const V = Math.random() * Math.PI * 2, f = Math.random() * 1.4 - 0.4, B = Math.sqrt(1 - Math.min(1, f * f));
377
+ C[F * 4] = Math.cos(V) * B, C[F * 4 + 1] = f, C[F * 4 + 2] = Math.sin(V) * B, C[F * 4 + 3] = 0.5 + Math.random();
378
+ }
379
+ const R = new t.BufferGeometry();
380
+ return R.setAttribute("position", new t.BufferAttribute(new Float32Array(ke * 3), 3)), { dirs: C, g: R };
381
+ }, []), O = i(
382
+ () => new t.PointsMaterial({ color: new t.Color(c).multiplyScalar(2.2), size: y ? 0.16 : 0.22, map: Fe(), transparent: !0, depthWrite: !1, blending: t.AdditiveBlending, toneMapped: !1 }),
383
+ [c, y]
384
+ ), v = i(() => new t.Vector3(), []), x = U(!1);
385
+ return Ct(
386
+ () => () => {
387
+ z.dispose(), _.dispose(), g.dispose(), h.dispose(), u.g.dispose(), O.dispose();
388
+ },
389
+ // eslint-disable-next-line react-hooks/exhaustive-deps
390
+ []
391
+ ), le(({ clock: C }, R) => {
392
+ var we;
393
+ const F = performance.now(), V = C.elapsedTime, f = e.inst;
394
+ if (!x.current) {
395
+ x.current = !0;
396
+ const Y = f.parent ? ie(f.parent) : void 0;
397
+ Y ? v.copy(Y) : Nt(e.run, Ue("planner"), Ft * ze.spread, v);
398
+ }
399
+ const B = 0.12 * Ee * Math.max(1, ze.spread);
400
+ De.copy(e.pos), De.x += Math.sin(V * 0.4 + A * 9) * B, De.y += Math.sin(V * 0.7 + A * 5) * B;
401
+ const W = ae((F - f.bornAt) / _t), N = en(ae(W / 0.8)), H = W < 0.32, K = H ? 0 : tn(ae((W - 0.32) / 0.68)), Q = f.exitAt ? (F - f.exitAt) / Xt(f) : 0, q = f.exitAt > 0, M = q ? Math.max(0, 1 - Q * 1.25) : 1, a = q ? Math.exp(-(F - f.exitAt) / 220) : 0, P = f.status === "failed";
402
+ let L = !1;
403
+ for (const Y of Z.mcpPending.values()) Y.instance === d && (L = !0);
404
+ const j = (f.status === "thinking" || f.status === "spawning") && !L, D = qt(f, F), ee = o, X = ze.scale, ne = q ? 0.8 : j ? 4.6 : L ? 1.8 : 1.1;
405
+ k.current += R * ne;
406
+ const me = Math.pow(0.5 + 0.5 * Math.sin(k.current), 3), oe = j ? 1 : 0.45, ve = e.live;
407
+ ve.lerpVectors(v, De, N), ve.y += me * 0.12 * oe * X + (q ? Q * 1.2 * X : 0), l.current && (l.current.position.copy(ve), l.current.rotation.z = Math.sin(V * 0.5 + A * 7) * 0.12, l.current.rotation.x = Math.sin(V * 0.37 + A * 3) * 0.08);
408
+ const $ = p * X * K * (1 + D * 0.14) * (1 + (q ? Q * 0.6 : 0)) * (ee ? 1.12 : 1), re = 1 + me * 0.14 * oe, Me = 0.8 * (1 - me * 0.24 * oe);
409
+ w.current && (w.current.visible = !(q && M <= 1e-3)), (we = T.current) == null || we.scale.set(Math.max(1e-4, $ * re), Math.max(1e-4, $ * Me), Math.max(1e-4, $ * re));
410
+ const ue = j ? 1.25 : L ? 0.7 + 0.35 * Math.sin(V * 2.2) : 0.45;
411
+ if (z.uniforms.uIntensity.value = ue + D * 1.7 + a * 5 + (ee ? 0.7 : 0), z.uniforms.uOpacity.value = M * (0.4 + 0.6 * ae(K)), z.uniforms.uFlash.value = a, P && q && z.uniforms.uColor.value.set("#ef4444"), G.current) {
412
+ const Y = X * (H ? p * (0.32 + 0.08 * Math.sin(F / 50)) : p * (0.22 + D * 0.06) * Math.min(1, K + 0.3));
413
+ G.current.scale.setScalar(Math.max(1e-4, Y * (1 - (q ? Q : 0)))), G.current.position.y = H ? 0 : $ * Me * 0.35, Mt.copy(E).multiplyScalar((H ? 5 : 1.6 + D * 3) * ue + a * 8), _.color.copy(Mt), _.opacity = M;
414
+ }
415
+ m.current && (m.current.scale.setScalar(p * X * (H ? 3 : 4.2 + D * 2 + a * 4)), g.opacity = (0.12 + D * 0.16 + (H ? 0.5 : 0) + a * 0.6 + (ee ? 0.2 : 0)) * M);
416
+ const Oe = h.getAttribute("position"), de = Oe.array, ye = $ * re * 0.88, he = p * X * (y ? 3 : 3.6) * ae(K) * (0.85 + 0.15 * (1 - me)), fe = j ? 3.2 : 1.1, Ve = p * X * (j ? 0.55 : 0.35);
417
+ for (let Y = 0; Y < Le; Y++) {
418
+ const be = Y / Le * Math.PI * 2, xe = Math.cos(be), Be = Math.sin(be), Se = Y % 3 === 0 ? 0.35 : 1;
419
+ for (let te = 0; te < ge; te++)
420
+ for (let pe = 0; pe < 2; pe++) {
421
+ const se = (te + pe) / ge, ft = V * fe * (0.85 + Y % 4 * 0.08) - se * 5 + Y * 1.7, mt = ye * Se * (1 - se * 0.4), Ke = ((Y * ge + te) * 2 + pe) * 3;
422
+ de[Ke] = xe * mt + Math.sin(ft) * Ve * se, de[Ke + 1] = -se * he * (Se < 1 ? 0.7 : 1), de[Ke + 2] = Be * mt + Math.cos(ft * 0.8) * Ve * se * 0.7;
423
+ }
424
+ }
425
+ if (Oe.needsUpdate = !0, b.opacity = M * (j ? 0.95 : 0.55) * ae(K * 1.5), I.current && (I.current.visible = q, q)) {
426
+ const Y = u.g.getAttribute("position"), be = Y.array, xe = (F - f.exitAt) / 1e3, Be = 1 - Math.exp(-xe * 3.5), Se = p * X;
427
+ for (let te = 0; te < ke; te++) {
428
+ const pe = u.dirs, se = pe[te * 4 + 3];
429
+ be[te * 3] = pe[te * 4] * Se * 2.2 * Be * se + Math.sin(xe * 2 + te) * 0.08, be[te * 3 + 1] = pe[te * 4 + 1] * Se * 1.6 * Be * se + xe * 0.9 * se, be[te * 3 + 2] = pe[te * 4 + 2] * Se * 2.2 * Be * se;
430
+ }
431
+ Y.needsUpdate = !0, O.opacity = Math.max(0, 1 - Q) * Math.min(1, xe * 6);
432
+ }
433
+ }), /* @__PURE__ */ J("group", { ref: l, children: [
434
+ /* @__PURE__ */ J("group", { ref: w, children: [
435
+ /* @__PURE__ */ r(
436
+ "mesh",
437
+ {
438
+ ref: T,
439
+ geometry: ln,
440
+ material: z,
441
+ onClick: (C) => (C.stopPropagation(), n(d)),
442
+ onPointerOver: () => document.body.style.cursor = "pointer",
443
+ onPointerOut: () => document.body.style.cursor = ""
444
+ }
445
+ ),
446
+ /* @__PURE__ */ r("mesh", { ref: G, geometry: un, material: _ }),
447
+ /* @__PURE__ */ r("sprite", { ref: m, material: g }),
448
+ /* @__PURE__ */ r("lineSegments", { ref: S, geometry: h, material: b, frustumCulled: !1 })
449
+ ] }),
450
+ /* @__PURE__ */ r("points", { ref: I, geometry: u.g, material: O, frustumCulled: !1, visible: !1 })
451
+ ] });
452
+ }
453
+ const Ft = 1.25;
454
+ function dn() {
455
+ const n = i(() => {
456
+ const d = new t.BufferGeometry();
457
+ return d.setAttribute("position", new t.BufferAttribute(new Float32Array(3840), 3)), d.setAttribute("color", new t.BufferAttribute(new Float32Array(3840), 3)), d;
458
+ }, []), s = i(() => new t.Color(), []);
459
+ return le(({ clock: d }) => {
460
+ const y = performance.now(), p = d.elapsedTime, A = n.getAttribute("position"), c = n.getAttribute("color"), l = A.array, w = c.array, T = ze.scale;
461
+ let G = 0;
462
+ for (const m of pt.agents.values()) {
463
+ if (G >= 64) break;
464
+ const S = m.inst;
465
+ if (!S.parent) continue;
466
+ const I = ie(S.parent), k = m.live, z = Z.instances.get(S.parent);
467
+ if (!I || !z) continue;
468
+ const _ = ae((y - S.bornAt) / _t), g = (S.exitAt ? Math.max(0, 1 - (y - S.exitAt) / 900) : 1) * (z.exitAt ? Math.max(0, 1 - (y - z.exitAt) / 900) : 1);
469
+ if (g <= 0) continue;
470
+ const E = (0.22 + Math.pow(1 - _, 2) * 2.2) * g;
471
+ s.set(Ze[S.type]);
472
+ for (let h = 0; h < 10; h++)
473
+ for (let b = 0; b < 2; b++) {
474
+ const u = (h + b) / 10, O = ((G * 10 + h) * 2 + b) * 3, v = Math.sin(u * Math.PI) * (0.35 + 0.1 * Math.sin(p * 1.3 + G)) * T;
475
+ l[O] = I.x + (k.x - I.x) * u, l[O + 1] = I.y - 0.25 * T + (k.y - I.y + 0.25 * T) * u - v, l[O + 2] = I.z + (k.z - I.z) * u;
476
+ const x = _ < 1 ? Math.exp(-Math.pow((u - _ * 1.1) * 7, 2)) * 3 : 0, C = E * (0.5 + u * 0.5) + x * g;
477
+ w[O] = s.r * C, w[O + 1] = s.g * C, w[O + 2] = s.b * C;
478
+ }
479
+ G++;
480
+ }
481
+ n.setDrawRange(0, G * 10 * 2), A.needsUpdate = !0, c.needsUpdate = !0;
482
+ }), /* @__PURE__ */ r("lineSegments", { geometry: n, frustumCulled: !1, children: /* @__PURE__ */ r("lineBasicMaterial", { vertexColors: !0, transparent: !0, blending: t.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) });
483
+ }
484
+ const fn = { queued: "#1e3a5f", running: "#ffffff", done: "#5eead4", failed: "#ef4444" }, Je = ["planner", "researcher", "writer"], je = 10, Ae = new t.Color(), ce = { u0: 0, u1: 1, mid: 0, half: 1, seed: 0 }, Qe = (e) => (e - ce.u0) / (ce.u1 - ce.u0), yt = (e) => Gt((e - ce.mid) / ce.half * je, ce.seed), wt = (e) => Rt((e - ce.mid) / ce.half * je, ce.seed), bt = new t.Color("#ffffff");
485
+ function mn({ run: e }) {
486
+ const o = i(() => Ut(e.id) % 997 / 97, [e.id]), n = U(null), s = U(null), d = U(null), y = U([]), p = U(null), A = U(null), { tube: c, glow: l } = i(() => {
487
+ const g = [];
488
+ for (let h = 0; h <= 48; h++) {
489
+ const b = -1 + 2 * h / 48;
490
+ g.push(new t.Vector3(b, Gt(b * je, o), Rt(b * je, o)));
491
+ }
492
+ const E = new t.CatmullRomCurve3(g);
493
+ return { tube: new t.TubeGeometry(E, 200, 0.05, 6), glow: new t.TubeGeometry(E, 120, 0.32, 8) };
494
+ }, [o]), w = i(() => gt(e.color), [e.color]), T = i(() => {
495
+ const g = gt(e.color);
496
+ return g.uniforms.uWidthGlow.value = 0.18, g;
497
+ }, [e.color]), G = i(() => [w, T], [w, T]), m = e.run ?? Z.runs.get(e.id), S = i(() => new t.Color(e.color), [e.color]), I = i(() => Pe.map(() => new t.MeshBasicMaterial({ toneMapped: !1, transparent: !0 })), []), k = i(() => Pe.map(() => new t.MeshBasicMaterial({ toneMapped: !1, transparent: !0, blending: t.AdditiveBlending, depthWrite: !1 })), []), z = i(() => Pe.map(() => new t.SpriteMaterial({ map: Fe(), toneMapped: !1, transparent: !0, blending: t.AdditiveBlending, depthWrite: !1 })), []), _ = i(() => new t.MeshBasicMaterial({ toneMapped: !1, transparent: !0 }), []);
498
+ return Ct(
499
+ () => () => {
500
+ c.dispose(), l.dispose(), w.dispose(), T.dispose(), [...I, ...k, ...z, _].forEach((g) => g.dispose());
501
+ },
502
+ [c, l, w, T, I, k, z, _]
503
+ ), le(({ clock: g }) => {
504
+ var Q, q;
505
+ const E = n.current;
506
+ if (!E) return;
507
+ const h = performance.now(), b = g.elapsedTime, u = e.run ?? Z.runs.get(e.id);
508
+ E.position.copy(e.origin).addScaledVector(e.side, -e.cu).addScaledVector(e.axis, -e.cv);
509
+ const O = ze.spread, v = 1.6 * O, x = ce;
510
+ x.u0 = e.cu - e.hu - v, x.u1 = e.cu + e.hu + v;
511
+ const C = x.mid = (x.u0 + x.u1) / 2, R = x.half = (x.u1 - x.u0) / 2;
512
+ x.seed = o;
513
+ const F = -Ft * O, V = s.current;
514
+ V && (V.position.set(C, F, 0), V.scale.set(R, 1, 1));
515
+ const f = u ? ae((h - u.startedAt) / 1600) * 1.1 : 1.1, B = u != null && u.endedAt ? Math.max(0, 1 - (h - u.endedAt) / jt) : 1;
516
+ let W = -1, N = 0;
517
+ const H = u ? (h - u.handoffAt) / 1300 : 9;
518
+ if (u && u.handoffAt && H < 1) {
519
+ const M = 1 - Math.pow(1 - H, 3), a = Ue(Je[u.handoffFrom]), P = Ue(Je[u.handoffTo]);
520
+ W = Qe(a + (P - a) * M), N = Math.sin(H * Math.PI) * 1.2 + 0.3;
521
+ } else if (u != null && u.endedAt && h - u.endedAt < 1400) {
522
+ const M = (h - u.endedAt) / 1400, a = Ue("writer");
523
+ W = Qe(a + (x.u1 - a) * M), N = (1 - M) * 0.45;
524
+ }
525
+ for (const M of G)
526
+ M.uniforms.uTime.value = b * Ee, M.uniforms.uReveal.value = f, M.uniforms.uFade.value = B, M.uniforms.uPulse.value = W, M.uniforms.uPulseAmp.value = N;
527
+ if (d.current && (d.current.visible = W >= 0, W >= 0)) {
528
+ const M = x.u0 + W * (x.u1 - x.u0);
529
+ d.current.position.set(M, F + yt(M), wt(M)), d.current.scale.setScalar(0.18 + N * 0.12), _.color.copy(bt).lerp(S, 0.3).multiplyScalar(4 * Math.max(0.3, N)), _.opacity = B;
530
+ }
531
+ const K = !!(u != null && u.hasSteps);
532
+ for (let M = 0; M < Pe.length; M++) {
533
+ const a = y.current[M];
534
+ if (!a || (a.visible = K, !u || !K)) continue;
535
+ const P = Ue(Je[M]);
536
+ a.position.set(P, F + yt(P), wt(P));
537
+ const L = Ht(u, M), j = ae((f - Qe(P)) * 6), D = L === "running", ee = D ? 0.5 + 0.5 * Math.sin(b * 5.5) : 0;
538
+ a.scale.setScalar(Math.max(1e-3, j * (D ? 1.15 + ee * 0.2 : L === "done" ? 0.9 : 0.75) * Math.max(0.9, O))), a.rotation.y += D ? 0.05 : 4e-3;
539
+ const X = I[M];
540
+ L === "queued" ? Ae.copy(S).multiplyScalar(0.35) : D ? Ae.copy(S).lerp(bt, 0.35).multiplyScalar(2.2 + ee * 2.2) : Ae.set(fn[L]).multiplyScalar(L === "done" ? 1.5 : 2.5), X.color.copy(Ae), X.opacity = B, k[M].color.copy(Ae).multiplyScalar(D ? 0.9 : 0.5), k[M].opacity = B * (L === "queued" ? 0.35 : 1), z[M].color.copy(D ? S : Ae), z[M].opacity = B * (D ? 0.45 + ee * 0.3 : L === "done" ? 0.18 : 0.05);
541
+ }
542
+ (Q = p.current) == null || Q.position.set(x.u0 + 0.3, e.hv - e.cv + 0.5, 0), (q = A.current) == null || q.setOpacity(B * ae(f * 2));
543
+ }), /* @__PURE__ */ J("group", { ref: n, children: [
544
+ /* @__PURE__ */ J("group", { ref: s, children: [
545
+ /* @__PURE__ */ r("mesh", { geometry: c, material: w }),
546
+ /* @__PURE__ */ r("mesh", { geometry: l, material: T })
547
+ ] }),
548
+ /* @__PURE__ */ r("mesh", { ref: d, material: _, visible: !1, children: /* @__PURE__ */ r("sphereGeometry", { args: [1, 16, 12] }) }),
549
+ Pe.map((g) => /* @__PURE__ */ J("group", { ref: (E) => void (y.current[g] = E), visible: !1, children: [
550
+ /* @__PURE__ */ r("mesh", { material: I[g], children: /* @__PURE__ */ r("icosahedronGeometry", { args: [0.2, 2] }) }),
551
+ Array.from({ length: 8 }, (E, h) => {
552
+ const b = h / 8 * Math.PI * 2;
553
+ return /* @__PURE__ */ r("mesh", { material: k[g], position: [Math.cos(b) * 0.36, 0.1 + h % 2 * 0.08, Math.sin(b) * 0.36], children: /* @__PURE__ */ r("sphereGeometry", { args: [0.055, 8, 6] }) }, h);
554
+ }),
555
+ /* @__PURE__ */ r("mesh", { material: k[g], rotation: [Math.PI / 2, 0, 0], children: /* @__PURE__ */ r("torusGeometry", { args: [0.36, 0.012, 6, 40] }) }),
556
+ /* @__PURE__ */ r("sprite", { material: z[g], scale: 2.4 }),
557
+ m && /* @__PURE__ */ r(Zt, { run: m, slot: g, position: [0, -0.75, 0], color: e.color, textColor: "#bae6fd", uppercase: !0, letterSpacing: 0.08, size: 0.22, opacity: 0.8, pxRange: [7.5, 10.5] })
558
+ ] }, g)),
559
+ /* @__PURE__ */ r("group", { ref: p, children: /* @__PURE__ */ r(hn, { runId: e.id, color: e.color, labelRef: A }) })
560
+ ] });
561
+ }
562
+ function hn({ runId: e, color: o, labelRef: n }) {
563
+ const s = Z.runs.get(e);
564
+ return /* @__PURE__ */ r(
565
+ dt,
566
+ {
567
+ ref: n,
568
+ anchorX: "left",
569
+ anchorY: "bottom",
570
+ textAlign: "left",
571
+ text: `${s != null && s.hasSteps ? "hatchet · " : ""}${(s == null ? void 0 : s.topic) ?? "run"}`,
572
+ color: o,
573
+ size: 0.3,
574
+ maxWidth: 10,
575
+ opacity: 0,
576
+ pxRange: [9.5, 14]
577
+ }
578
+ );
579
+ }
580
+ const gn = new t.ConeGeometry(0.07, 0.34, 8).rotateX(Math.PI / 2), xt = new t.Vector3(), vn = new t.Vector3(), It = (e) => e < 0.5 ? 2 * e * e : 1 - Math.pow(-2 * e + 2, 2) / 2;
581
+ function St(e) {
582
+ const [o, n] = kt([]), s = U([]);
583
+ return le(() => {
584
+ const d = e(), y = s.current;
585
+ let p = y.length === d.length;
586
+ if (p)
587
+ for (let A = 0; A < d.length; A++) y[A] !== d[A].id && (p = !1);
588
+ p || (s.current = d.map((A) => A.id), n(d.slice()));
589
+ }), o;
590
+ }
591
+ function Mn({ comet: e }) {
592
+ const o = U(null), n = Z.instances.get(e.from), s = n ? Ze[n.type] : "#a5f3fc", d = i(() => new t.MeshBasicMaterial({ color: new t.Color(s).multiplyScalar(4), toneMapped: !1 }), [s]), y = i(() => (ie(e.from) ?? new t.Vector3()).clone(), [e.from]);
593
+ return le(() => {
594
+ const p = o.current;
595
+ if (!p) return;
596
+ const A = Math.min(1, (performance.now() - e.start) / e.dur), c = ie(e.from), l = ie(e.to);
597
+ if (!c || !l) {
598
+ p.scale.setScalar(1e-3);
599
+ return;
600
+ }
601
+ qe(c, l, It(A), 1.1, p.position), p.scale.setScalar(A >= 1 ? 1e-3 : 1 + Math.sin(A * Math.PI) * 0.4);
602
+ }), /* @__PURE__ */ r(Tt, { width: 1.8, length: 6, color: s, attenuation: (p) => p * p, decay: 1.4, children: /* @__PURE__ */ r("mesh", { ref: o, position: y, material: d, children: /* @__PURE__ */ r("sphereGeometry", { args: [0.11, 12, 10] }) }) });
603
+ }
604
+ function yn({ call: e }) {
605
+ const o = U(null), n = Z.mcpServers.get(e.server), s = (n == null ? void 0 : n.color) ?? "#94a3b8", d = i(() => new t.MeshBasicMaterial({ color: new t.Color(s).multiplyScalar(e.phase === "result" ? 5 : 3.5), toneMapped: !1 }), [s, e.phase]), y = i(() => ((e.phase === "call" ? ie(e.instance) : Xe(e.server, new t.Vector3())) ?? new t.Vector3()).clone(), [e]);
606
+ return le(() => {
607
+ const p = o.current;
608
+ if (!p) return;
609
+ const A = Math.min(1, (performance.now() - e.start) / e.dur), c = ie(e.instance), l = Xe(e.server, vn);
610
+ if (!c || !l) {
611
+ p.scale.setScalar(1e-3);
612
+ return;
613
+ }
614
+ const w = It(A), T = e.phase === "call" ? w : 1 - w;
615
+ qe(c, l, T, 1.6, p.position), qe(c, l, e.phase === "call" ? Math.min(1, T + 0.02) : Math.max(0, T - 0.02), 1.6, xt), p.lookAt(xt), p.scale.setScalar(A >= 1 ? 1e-3 : 1);
616
+ }), /* @__PURE__ */ r(Tt, { width: 1.4, length: 5, color: s, attenuation: (p) => p * p * p, decay: 1.6, children: /* @__PURE__ */ r("mesh", { ref: o, position: y, material: d, geometry: gn }) });
617
+ }
618
+ const et = [], tt = [];
619
+ function wn() {
620
+ if (!Pt.grouped) return Z.comets;
621
+ et.length = 0;
622
+ for (const e of Z.comets) it(e.from) && it(e.to) && et.push(e);
623
+ return et;
624
+ }
625
+ function bn() {
626
+ if (!Pt.grouped) return Z.mcpCalls;
627
+ tt.length = 0;
628
+ for (const e of Z.mcpCalls) it(e.instance) && tt.push(e);
629
+ return tt;
630
+ }
631
+ function xn() {
632
+ const e = St(wn), o = St(bn);
633
+ return /* @__PURE__ */ J("group", { children: [
634
+ e.map((n) => /* @__PURE__ */ r(Mn, { comet: n }, n.id)),
635
+ o.map((n) => /* @__PURE__ */ r(yn, { call: n }, n.id))
636
+ ] });
637
+ }
638
+ const nt = 60, Sn = new t.Vector3(), ot = [0, 1], An = 9, rt = 180, st = 60, Ce = 6, Ie = 4.2, _e = -1.15, He = 0.42, lt = Math.cos(He), ut = Math.sin(He), Cn = Object.keys(ct), at = 200;
639
+ function Re(e, o) {
640
+ let n = 2166136261 ^ o;
641
+ for (let s = 0; s < e.length; s++) n = Math.imul(n ^ e.charCodeAt(s), 16777619);
642
+ return (n >>> 0) % 1e5 / 1e5;
643
+ }
644
+ function At(e, o, n, s, d) {
645
+ e[o * 3] = n, e[o * 3 + 1] = s * lt + d * ut, e[o * 3 + 2] = -s * ut + d * lt;
646
+ }
647
+ function Bn(e) {
648
+ const o = e.nodes.length, n = new Float32Array(o * 3), s = new Float32Array(o * 3), d = new Float32Array(o), y = new Int32Array(o), p = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map();
649
+ for (const c of e.nodes) A.set(c.kind, (A.get(c.kind) ?? 0) + 1);
650
+ return e.nodes.forEach((c, l) => {
651
+ let w = Cn.indexOf(c.kind);
652
+ w < 0 && (w = 8 + Math.floor(Re(c.kind, 3) * 8));
653
+ const T = (w + 0.5) / 12, G = w * 2.39996 + 0.6, m = Math.sqrt(T), S = Math.cos(G) * m * Ie * 0.82, I = Math.sin(G) * m * Ie * 0.42, k = 0.35 + Math.sqrt(A.get(c.kind) ?? 1) * 0.1;
654
+ p.has(c.kind) || p.set(c.kind, l), y[l] = p.get(c.kind);
655
+ const z = Re(c.id, 11) * Math.PI * 2, _ = Math.pow(Re(c.id, 12), 0.7) * k, g = S + Math.cos(z) * _, E = I + Math.sin(z) * _ * 0.8, h = (0.6 + Re(c.id, 13) * 1) * (1.5 - _ / k * 0.8);
656
+ At(n, l, g, _e, E), At(s, l, g + Math.cos(z) * h * 0.35, _e + h, E + Math.sin(z) * h * 0.3), d[l] = Re(c.id, 14) * 6.28;
657
+ }), { base: n, head: s, phase: d, hub: y };
658
+ }
659
+ function Pn({ galaxy: e }) {
660
+ const o = i(() => {
661
+ const v = e.nodes.slice(0, at), x = new Set(v.map((C) => C.id));
662
+ return { nodes: v, links: e.links.filter((C) => x.has(C.source) && x.has(C.target)) };
663
+ }, [e]), n = o.nodes.length, s = i(() => Bn(o), [o]), d = i(() => o.nodes.map((v) => new t.Color(ct[v.kind] ?? "#94a3b8")), [o]), y = i(() => /* @__PURE__ */ new Map(), [o]), p = (v) => {
664
+ let x = y.get(v);
665
+ return x === void 0 && y.set(v, x = Yt(o, v) % Math.max(1, n)), x;
666
+ }, A = U(null), c = U(null), l = U(null), w = U(null), T = i(() => new Float32Array(n), [n]), G = i(() => new Float32Array(n), [n]), m = i(() => new t.Object3D(), []), S = i(() => new t.Color(), []), I = i(() => new t.Color(1, 1, 1), []), k = i(() => new t.Vector3(0, 1, 0), []), z = i(() => new t.Vector3(), []), _ = i(() => new t.Vector3(), []), g = i(() => {
667
+ const v = new Map(o.nodes.map((f, B) => [f.id, B])), x = [], C = [], R = s.head, F = (f, B, W, N, H) => {
668
+ const K = d[f], Q = d[B];
669
+ for (let q = 0; q < H; q++)
670
+ for (let M = 0; M < 2; M++) {
671
+ const a = (q + M) / H;
672
+ x.push(R[f * 3] + (R[B * 3] - R[f * 3]) * a, R[f * 3 + 1] + (R[B * 3 + 1] - R[f * 3 + 1]) * a + Math.sin(a * Math.PI) * W, R[f * 3 + 2] + (R[B * 3 + 2] - R[f * 3 + 2]) * a), C.push((K.r + (Q.r - K.r) * a) * N, (K.g + (Q.g - K.g) * a) * N, (K.b + (Q.b - K.b) * a) * N);
673
+ }
674
+ };
675
+ s.hub.forEach((f, B) => f !== B && F(B, f, 0, 0.32, 1));
676
+ for (const f of o.links) {
677
+ const B = v.get(f.source), W = v.get(f.target);
678
+ if (B === void 0 || W === void 0 || B === W) continue;
679
+ const N = Math.hypot(R[B * 3] - R[W * 3], R[B * 3 + 2] - R[W * 3 + 2]);
680
+ F(B, W, Math.min(1.4, 0.15 + N * 0.09), 0.42, 10);
681
+ }
682
+ const V = new t.BufferGeometry();
683
+ return V.setAttribute("position", new t.Float32BufferAttribute(x, 3)), V.setAttribute("color", new t.Float32BufferAttribute(C, 3)), V;
684
+ }, [o, s, d]), E = U([]), h = U([]), b = U(["", ""]), u = i(() => {
685
+ const v = new t.BufferGeometry();
686
+ return v.setAttribute("position", new t.BufferAttribute(new Float32Array(st * Ce * 2 * 3), 3)), v.setAttribute("color", new t.BufferAttribute(new Float32Array(st * Ce * 2 * 3), 3)), v;
687
+ }, []);
688
+ le(({ clock: v }) => {
689
+ const x = performance.now(), C = v.elapsedTime * Ee;
690
+ T.fill(0), G.fill(0);
691
+ const R = A.current, F = c.current, V = l.current, f = w.current;
692
+ if (!R || !F || !V || !f) return;
693
+ let B = 0, W = 0, N = 0;
694
+ const H = u.getAttribute("position"), K = u.getAttribute("color"), Q = H.array, q = K.array;
695
+ for (const a of Z.flares) {
696
+ const P = p(a.node), L = (x - a.start) / 2600;
697
+ if (L < 0 || L >= 1) continue;
698
+ const j = a.op === "write", D = Math.exp(-L * 2.6) * Math.min(1, L * 20);
699
+ D > T[P] && (T[P] = D), j && (G[P] = Math.max(G[P], D));
700
+ const ee = s.base[P * 3], X = s.base[P * 3 + 1], ne = s.base[P * 3 + 2];
701
+ if (B < nt) {
702
+ m.position.set(ee, X + 0.03, ne), m.rotation.set(-Math.PI / 2 + He, 0, 0), m.scale.setScalar(0.12 + Math.sqrt(L) * (j ? 1.5 : 0.9)), m.updateMatrix(), V.setMatrixAt(B, m.matrix);
703
+ const $ = Math.pow(1 - L, 2) * (j ? 3 : 1.6);
704
+ j ? S.copy(I).multiplyScalar($) : S.copy(d[P]).multiplyScalar($), V.setColorAt(B, S), B++;
705
+ }
706
+ if (j)
707
+ for (let $ = 0; $ < An && W < rt; $++) {
708
+ const re = (a.id * 13 + $ * 7) % 97, Me = 1.4 + re % 10 * 0.18, ue = L * 2.6 - $ * 0.08;
709
+ ue < 0 || (m.position.set(
710
+ ee + Math.sin(re) * 0.35 + Math.sin(ue * 5 + $) * 0.1,
711
+ X + 0.3 + ue * Me * 0.6,
712
+ ne + Math.cos(re) * 0.35
713
+ ), m.rotation.set(0, 0, 0), m.scale.setScalar((0.05 + re % 5 * 0.015) * (1 + ue * 0.3)), m.updateMatrix(), f.setMatrixAt(W, m.matrix), S.setRGB(1, 1.5, 1.9).multiplyScalar(Math.pow(Math.max(0, 1 - L), 1.5)), f.setColorAt(W, S), W++);
714
+ }
715
+ const me = ie(a.instance), oe = me ? Kt(me, Sn) : void 0, ve = Z.instances.get(a.instance);
716
+ if (oe && ve && N < st && L < 0.75) {
717
+ const $ = L / 0.75, re = Math.pow(1 - $, 1.5) * Math.min(1, $ * 12) * (j ? 2.4 : 1.6);
718
+ j ? S.copy(I) : S.set(Ze[ve.type]);
719
+ const Me = s.head[P * 3], ue = s.head[P * 3 + 1], Oe = s.head[P * 3 + 2];
720
+ for (let de = 0; de < Ce; de++)
721
+ for (let ye = 0; ye < 2; ye++) {
722
+ const he = (de + ye) / Ce, fe = ((N * Ce + de) * 2 + ye) * 3;
723
+ Q[fe] = oe.x + (Me - oe.x) * he, Q[fe + 1] = oe.y + (ue - oe.y) * he, Q[fe + 2] = oe.z + (Oe - oe.z) * he;
724
+ const Ve = Math.exp(-Math.pow((he - Math.min(1, $ * 2.2)) * 6, 2)) * 2, we = re * (0.35 + he * 0.4 + Ve);
725
+ q[fe] = S.r * we, q[fe + 1] = S.g * we, q[fe + 2] = S.b * we;
726
+ }
727
+ N++;
728
+ }
729
+ }
730
+ for (let a = B; a < nt; a++)
731
+ m.scale.setScalar(0), m.updateMatrix(), V.setMatrixAt(a, m.matrix);
732
+ for (let a = W; a < rt; a++)
733
+ m.scale.setScalar(0), m.updateMatrix(), f.setMatrixAt(a, m.matrix);
734
+ V.instanceMatrix.needsUpdate = !0, V.instanceColor && (V.instanceColor.needsUpdate = !0), f.instanceMatrix.needsUpdate = !0, f.instanceColor && (f.instanceColor.needsUpdate = !0), u.setDrawRange(0, N * Ce * 2), H.needsUpdate = !0, K.needsUpdate = !0;
735
+ let M = 0;
736
+ for (let a = Z.flares.length - 1; a >= 0 && M < ot.length; a--) {
737
+ const P = Z.flares[a], L = (x - P.start) / 1e3;
738
+ if (L > 1.8) continue;
739
+ let j = !1;
740
+ for (let ne = 0; ne < M; ne++) b.current[ne] === P.node && (j = !0);
741
+ if (j) continue;
742
+ const D = p(P.node), ee = E.current[M], X = h.current[M];
743
+ ee && X && (ee.position.set(s.head[D * 3], s.head[D * 3 + 1] + 0.55 + L * 0.25, s.head[D * 3 + 2]), b.current[M] !== P.node && (X.setText((P.op === "write" ? "wrote · " : "") + P.node), X.setColor(P.op === "write" ? "#ffffff" : ct[o.nodes[D].kind] ?? "#94a3b8")), X.setOpacity(Math.min(1, (1.8 - L) * 2))), b.current[M] = P.node, M++;
744
+ }
745
+ for (let a = M; a < ot.length; a++) {
746
+ const P = h.current[a];
747
+ P == null || P.setOpacity(0), b.current[a] = "";
748
+ }
749
+ for (let a = 0; a < n; a++) {
750
+ const P = T[a], L = 0, j = 0, D = s.base[a * 3], ee = s.base[a * 3 + 1], X = s.base[a * 3 + 2];
751
+ _.set(s.head[a * 3] + L, s.head[a * 3 + 1], s.head[a * 3 + 2] + j), z.set(_.x - D, _.y - ee, _.z - X);
752
+ const ne = z.length();
753
+ z.multiplyScalar(1 / ne), m.position.set(D, ee, X), m.quaternion.setFromUnitVectors(k, z), m.scale.set(1 + P, ne, 1 + P), m.updateMatrix(), F.setMatrixAt(a, m.matrix), S.copy(d[a]).multiplyScalar(0.22 + P * 1.2), F.setColorAt(a, S), m.position.copy(_), m.quaternion.identity(), m.scale.setScalar(1 + P * 2.6), m.updateMatrix(), R.setMatrixAt(a, m.matrix), S.copy(d[a]).multiplyScalar(0.75 + 0.25 * Math.sin(C * 0.8 + s.phase[a] * 3) + P * 5), G[a] > 0.01 && (S.lerp(I.setScalar(6), G[a] * 0.7), I.setScalar(1)), R.setColorAt(a, S);
754
+ }
755
+ R.count = n, F.count = n, R.instanceMatrix.needsUpdate = !0, R.instanceColor && (R.instanceColor.needsUpdate = !0), F.instanceMatrix.needsUpdate = !0, F.instanceColor && (F.instanceColor.needsUpdate = !0);
756
+ });
757
+ const O = i(() => new t.CylinderGeometry(0.03, 0.065, 1, 5, 1, !0).translate(0, 0.5, 0), []);
758
+ return /* @__PURE__ */ J("group", { children: [
759
+ /* @__PURE__ */ r("instancedMesh", { ref: c, args: [O, void 0, at], frustumCulled: !1, children: /* @__PURE__ */ r("meshBasicMaterial", { toneMapped: !1 }) }),
760
+ /* @__PURE__ */ J("instancedMesh", { ref: A, args: [void 0, void 0, at], frustumCulled: !1, children: [
761
+ /* @__PURE__ */ r("icosahedronGeometry", { args: [0.12, 1] }),
762
+ /* @__PURE__ */ r("meshBasicMaterial", { toneMapped: !1 })
763
+ ] }),
764
+ /* @__PURE__ */ r("lineSegments", { geometry: g, children: /* @__PURE__ */ r("lineBasicMaterial", { vertexColors: !0, transparent: !0, opacity: 0.9, blending: t.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) }),
765
+ /* @__PURE__ */ J("instancedMesh", { ref: l, args: [void 0, void 0, nt], frustumCulled: !1, children: [
766
+ /* @__PURE__ */ r("ringGeometry", { args: [0.86, 1, 48] }),
767
+ /* @__PURE__ */ r("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: t.AdditiveBlending, depthWrite: !1, side: t.DoubleSide })
768
+ ] }),
769
+ /* @__PURE__ */ J("instancedMesh", { ref: w, args: [void 0, void 0, rt], frustumCulled: !1, children: [
770
+ /* @__PURE__ */ r("sphereGeometry", { args: [1, 10, 8] }),
771
+ /* @__PURE__ */ r("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: t.AdditiveBlending, depthWrite: !1 })
772
+ ] }),
773
+ /* @__PURE__ */ r("lineSegments", { geometry: u, frustumCulled: !1, children: /* @__PURE__ */ r("lineBasicMaterial", { vertexColors: !0, transparent: !0, blending: t.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) }),
774
+ /* @__PURE__ */ J("mesh", { position: [0, _e * lt - 0.02, -_e * ut], rotation: [-Math.PI / 2 + He, 0, 0], scale: [Ie * 1.05, Ie * 0.62, 1], renderOrder: -1, children: [
775
+ /* @__PURE__ */ r("circleGeometry", { args: [1, 48] }),
776
+ /* @__PURE__ */ r("meshBasicMaterial", { map: Fe(), color: new t.Color("#0f766e").multiplyScalar(0.55), transparent: !0, depthWrite: !1, blending: t.AdditiveBlending, toneMapped: !1 })
777
+ ] }),
778
+ /* @__PURE__ */ r($t, { position: [0, _e - 0.9, 0.6], color: "#2dd4bf", size: 0.3, pxRange: [9, 13] }),
779
+ ot.map((v) => /* @__PURE__ */ r("group", { ref: (x) => void (E.current[v] = x), children: /* @__PURE__ */ r(dt, { ref: (x) => void (h.current[v] = x), text: "", size: 0.24, opacity: 0, pxRange: [8, 12] }) }, v))
780
+ ] });
781
+ }
782
+ function Fn() {
783
+ return /* @__PURE__ */ J(
784
+ Jt,
785
+ {
786
+ title: "Deep sea · bioluminescent agents",
787
+ subtitle: "jellyfish = agents · currents = Hatchet runs · coral reef = knowledge graph · anglerfish = MCP servers",
788
+ preset: Qt,
789
+ plane: "xy",
790
+ camera: { position: [0, 2.4, 21], fov: 50, far: 300 },
791
+ controls: { minPolarAngle: Math.PI * 0.3, maxPolarAngle: Math.PI * 0.58, minAzimuthAngle: -0.8, maxAzimuthAngle: 0.8 },
792
+ bg: "#010409",
793
+ fit: { nRef: 4, min: 0.62, max: 1.6, minRadius: 5.5 },
794
+ agentRadius: 1.4,
795
+ graph: { natural: Ie, radius: 3.6 },
796
+ peripheryGap: 4,
797
+ Background: /* @__PURE__ */ r(sn, {}),
798
+ Agent: pn,
799
+ RunMarker: mn,
800
+ McpServer: an,
801
+ GraphResource: Pn,
802
+ cluster: { radius: 1.25, variant: "swarm", pointSize: 0.9, labelBelow: 1.15 },
803
+ PostFX: /* @__PURE__ */ J(Et, { multisampling: 0, children: [
804
+ /* @__PURE__ */ r(Ot, { mipmapBlur: !0, intensity: 1.25, luminanceThreshold: 0.16, luminanceSmoothing: 0.25, radius: 0.78 }),
805
+ /* @__PURE__ */ r(Vt, { eskil: !1, offset: 0.22, darkness: 0.9 }),
806
+ /* @__PURE__ */ r(Wt, { opacity: 0.03 })
807
+ ] }),
808
+ children: [
809
+ /* @__PURE__ */ r(dn, {}),
810
+ /* @__PURE__ */ r(xn, {}),
811
+ /* @__PURE__ */ r(cn, {})
812
+ ]
813
+ }
814
+ );
815
+ }
816
+ export {
817
+ Fn as default
818
+ };