agentglow 0.2.9 → 0.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/chunks/{KitScene-Bm1I35Zc.js → KitScene-DG_pcnWW.js} +1273 -1195
  2. package/dist/chunks/{index-COLbf8XM.js → index-Agh7jdYu.js} +182 -182
  3. package/dist/chunks/{index-CGTp73GN.js → index-B2EHxcBQ.js} +400 -400
  4. package/dist/chunks/{index-D-r9aJ4u.js → index-B4Cqo621.js} +33 -33
  5. package/dist/chunks/index-BfQsJ0TH.js +751 -0
  6. package/dist/chunks/index-BmBGYhJS.js +891 -0
  7. package/dist/chunks/index-Bnn-x-aE.js +767 -0
  8. package/dist/chunks/{index-BWsSd_Wm.js → index-CTQTtm9q.js} +212 -212
  9. package/dist/chunks/{index-_IwfbZy7.js → index-CTZbUTDY.js} +62 -62
  10. package/dist/chunks/{index-cRPj-lzn.js → index-CdKvybsL.js} +284 -284
  11. package/dist/chunks/index-CeiIEWek.js +818 -0
  12. package/dist/chunks/{index-D4Wlmsay.js → index-Ci8tSMhc.js} +15 -15
  13. package/dist/chunks/{index-C2vLpNCb.js → index-Cls_VZdb.js} +100 -100
  14. package/dist/chunks/index-DFFRhihO.js +892 -0
  15. package/dist/chunks/index-DMCETM4H.js +605 -0
  16. package/dist/chunks/{index-AugvjZJN.js → index-URn4zDHp.js} +223 -223
  17. package/dist/chunks/index-u4rYZ1UO.js +495 -0
  18. package/dist/index.js +1 -1
  19. package/dist/style.css +1 -1
  20. package/dist/types/world.d.ts +30 -5
  21. package/package.json +1 -1
  22. package/dist/chunks/index-BAQDf-0T.js +0 -492
  23. package/dist/chunks/index-BRnLrSfZ.js +0 -605
  24. package/dist/chunks/index-CKyn9lcT.js +0 -753
  25. package/dist/chunks/index-CnoB0ZDk.js +0 -889
  26. package/dist/chunks/index-KmczAvvY.js +0 -818
  27. package/dist/chunks/index-Z4vdWCok.js +0 -763
  28. package/dist/chunks/index-uZGu9jzU.js +0 -887
@@ -1,818 +0,0 @@
1
- import { jsxs as J, jsx as r } from "react/jsx-runtime";
2
- import { EffectComposer as Et, Bloom as Vt, Vignette as Ot, Noise as kt } from "@react-three/postprocessing";
3
- import { useThree as Wt, useFrame as le } from "@react-three/fiber";
4
- import { useMemo as i, useRef as _, useEffect as Ct, useState as Lt } from "react";
5
- import * as t from "three";
6
- import { C as ht, r as Bt, k as dt, w as Z, L as Ze, a as ie, d as Dt, T as Ke, q as Nt, x as Ue, l as Xt, e as qt, f as ze, S as Se, R as jt, g as Pt, b as ct, K as lt, m as Ht, G as Zt, n as Kt, j as $t } from "./KitScene-Bm1I35Zc.js";
7
- import { Trail as Tt } from "@react-three/drei";
8
- const Ee = Bt ? 0.25 : 1, Yt = {
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 Ye = new t.Vector3(0.95, 0.75, 0.25), Ne = 1.15;
21
- function Xe(e, o) {
22
- const n = dt.mcp.get(e);
23
- if (!n) return;
24
- const s = n.out.x > 0 ? -1 : 1;
25
- return o.set(n.pos.x + Ye.x * s * Ne, n.pos.y + Ye.y * Ne, n.pos.z + Ye.z * Ne * s);
26
- }
27
- const ae = (e) => e < 0 ? 0 : e > 1 ? 1 : e, Jt = (e) => 1 - Math.pow(1 - e, 3), Qt = (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, m) {
29
- Te.copy(e).add(o).multiplyScalar(0.5), Te.y += s;
30
- const M = 1 - n;
31
- return m.set(
32
- M * M * e.x + 2 * M * n * Te.x + n * n * o.x,
33
- M * M * e.y + 2 * M * n * Te.y + n * n * o.y,
34
- M * M * e.z + 2 * M * n * Te.z + n * n * o.z
35
- );
36
- }
37
- let ke = null;
38
- function Fe() {
39
- if (ke) return ke;
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), ke = new t.CanvasTexture(e), ke;
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 en() {
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 tn() {
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 nn() {
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 Je = Bt ? 700 : 2200;
251
- function on() {
252
- const e = Wt((p) => p.viewport.dpr), o = i(tn, []), n = i(nn, []), s = i(en, []), m = 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
- ), M = i(() => {
262
- const p = new t.BufferGeometry(), v = new Float32Array(Je * 3), B = new Float32Array(Je);
263
- for (let R = 0; R < Je; R++)
264
- v[R * 3] = (Math.random() - 0.5) * 50, v[R * 3 + 1] = Math.random() * 24 - 10, v[R * 3 + 2] = Math.random() * 34 - 22, B[R] = Math.random();
265
- return p.setAttribute("position", new t.BufferAttribute(v, 3)), p.setAttribute("aSeed", new t.BufferAttribute(B, 1)), p;
266
- }, []), d = _(null), b = _(null), l = _(null);
267
- return le(({ clock: p }) => {
268
- var h, w, z;
269
- const v = p.elapsedTime * Ee, B = dt.core;
270
- (h = d.current) == null || h.position.set(0, -(B.hh + 4.4), -4);
271
- const R = Math.max(1, B.hw / 9);
272
- (w = b.current) == null || w.scale.set(R, Math.max(1, B.hh / 6), 1), (z = l.current) == null || z.scale.setScalar(Math.max(1, B.r / 11)), o.uniforms.uTime.value = v, n.uniforms.uTime.value = v, s.uniforms.uTime.value = v, s.uniforms.uPx.value = e;
273
- for (const L of m) L.m.uniforms.uTime.value = v;
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: d, 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: b, children: m.map((p, v) => /* @__PURE__ */ r("mesh", { material: p.m, position: [p.x, 3.5, -3.5 - (v > 2 ? 4 : 0)], rotation: [0, 0, p.rz], children: /* @__PURE__ */ r("planeGeometry", { args: [p.w, 24] }) }, v)) }),
278
- /* @__PURE__ */ r("group", { ref: l, children: /* @__PURE__ */ r("points", { geometry: M, material: s, frustumCulled: !1 }) })
279
- ] });
280
- }
281
- const Mt = new t.Vector3(0.95, 0.75, 0.25);
282
- function rn({ mcp: e }) {
283
- const o = e.srv, n = _(null), s = _(null), m = _(null), M = _(null), d = _(null), b = _(null), l = i(() => new t.Color(o.color), [o.color]), p = i(() => zt(o.color), [o.color]), v = i(() => new t.MeshBasicMaterial({ toneMapped: !1 }), []), B = i(() => new t.SpriteMaterial({ color: o.color, map: Fe(), transparent: !0, toneMapped: !1, blending: t.AdditiveBlending, depthWrite: !1 }), [o.color]), R = i(() => new t.MeshBasicMaterial({ color: new t.Color(o.color).multiplyScalar(0.8), toneMapped: !1 }), [o.color]), h = i(() => new t.MeshBasicMaterial({ color: new t.Color(2.5, 2.5, 2.5), toneMapped: !1 }), []), w = i(() => new t.MeshBasicMaterial({ color: o.color, transparent: !0, toneMapped: !1, blending: t.AdditiveBlending, depthWrite: !1, side: t.DoubleSide }), [o.color]), z = i(() => {
284
- const F = new t.QuadraticBezierCurve3(new t.Vector3(0.55, 0.35, 0), new t.Vector3(0.75, 1.25, 0), Mt);
285
- return new t.TubeGeometry(F, 16, 0.018, 4);
286
- }, []), L = i(() => performance.now(), []);
287
- return le(({ clock: F }) => {
288
- var S;
289
- const x = performance.now(), A = F.elapsedTime * Ee, G = Z.mcpServers.get(o.name) ?? o, g = G.inflight > 0, c = Math.exp(-(x - G.activeAt) / 500), U = Math.min(1, (x - L) / 1200), k = n.current, u = s.current;
290
- if (!k || !u) return;
291
- k.position.copy(e.pos), k.position.y += Math.sin(A * 0.45 + G.slot * 2) * 0.2, u.rotation.y = (e.out.x > 0 ? Math.PI : 0) + Math.sin(A * (g ? 2.4 : 0.6)) * (g ? 0.35 : 0.12), u.rotation.z = Math.sin(A * 0.5 + G.slot) * 0.08, u.scale.setScalar(Math.max(1e-3, U * Ne * (1 + c * 0.12))), p.uniforms.uIntensity.value = 0.16 + (g ? 0.18 : 0) + c * 0.45, p.uniforms.uOpacity.value = 0.7 * U;
292
- const E = (g ? 2.4 + Math.sin(x / 110) * 0.9 : 1.2) + c * 4;
293
- if (v.color.copy(l).multiplyScalar(E), m.current && m.current.scale.setScalar(1 + c * 0.5 + (g ? 0.15 * Math.sin(x / 110) : 0)), M.current && (M.current.scale.setScalar(1.6 + c * 2 + (g ? 0.8 : 0)), B.opacity = 0.35 + c * 0.4 + (g ? 0.2 : 0)), d.current) {
294
- const P = (x - G.activeAt) / 1100;
295
- d.current.visible = P < 1, d.current.scale.setScalar(0.3 + P * 2.4), w.opacity = Math.max(0, 1 - P) * 0.9;
296
- }
297
- (S = b.current) == null || S.setOpacity(U * (g ? 1 : 0.75));
298
- }), /* @__PURE__ */ J("group", { ref: n, children: [
299
- /* @__PURE__ */ J("group", { ref: s, children: [
300
- /* @__PURE__ */ r("mesh", { material: p, scale: [0.95, 0.62, 0.55], children: /* @__PURE__ */ r("sphereGeometry", { args: [1, 28, 18] }) }),
301
- /* @__PURE__ */ r("mesh", { material: p, 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: p, 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: R, geometry: z }),
304
- /* @__PURE__ */ r("mesh", { material: h, position: [0.55, 0.12, 0.42], children: /* @__PURE__ */ r("sphereGeometry", { args: [0.05, 8, 6] }) }),
305
- /* @__PURE__ */ J("group", { position: Mt, children: [
306
- /* @__PURE__ */ r("mesh", { ref: m, material: v, children: /* @__PURE__ */ r("sphereGeometry", { args: [0.13, 16, 12] }) }),
307
- /* @__PURE__ */ r("sprite", { ref: M, material: B }),
308
- /* @__PURE__ */ r("mesh", { ref: d, material: w, visible: !1, children: /* @__PURE__ */ r("ringGeometry", { args: [0.92, 1, 48] }) })
309
- ] })
310
- ] }),
311
- /* @__PURE__ */ r(Ze, { ref: b, position: [0, -1.15, 0], text: `mcp · ${o.name}`, color: o.color, size: 0.3, opacity: 0, pxRange: [9, 13] })
312
- ] });
313
- }
314
- function sn() {
315
- const n = i(() => {
316
- const p = new t.BufferGeometry();
317
- return p.setAttribute("position", new t.BufferAttribute(new Float32Array(4032), 3)), p.setAttribute("color", new t.BufferAttribute(new Float32Array(4032), 3)), p;
318
- }, []), s = i(() => new t.Vector3(), []), m = i(() => new t.Vector3(), []), M = i(() => new t.Color("#f59e0b"), []), d = i(() => new t.Color("#ef4444"), []), b = i(() => new t.Color(1, 1, 1), []), l = i(() => new t.Color(), []);
319
- return le(({ clock: p }) => {
320
- var x;
321
- const v = performance.now(), B = p.elapsedTime, R = n.getAttribute("position"), h = n.getAttribute("color"), w = R.array, z = h.array;
322
- let L = 0;
323
- const F = (A, G, g) => {
324
- for (let c = 0; c < 28; c++)
325
- for (let U = 0; U < 2; U++) {
326
- const k = (c + U) / 28, u = ((L * 28 + c) * 2 + U) * 3;
327
- qe(A, G, k, 1.6, s);
328
- const E = Math.sin(k * 14 - B * 5) * 0.05 * Math.sin(k * Math.PI);
329
- w[u] = s.x, w[u + 1] = s.y + E, w[u + 2] = s.z;
330
- const S = g(k);
331
- z[u] = l.r * S, z[u + 1] = l.g * S, z[u + 2] = l.b * S;
332
- }
333
- L++;
334
- };
335
- for (const A of Z.mcpPending.values()) {
336
- if (L >= 24) break;
337
- const G = ie(A.instance), g = Xe(A.server, m);
338
- if (!G || !g) continue;
339
- const c = Dt(A, v), U = Z.mcpServers.get(A.server);
340
- l.set((U == null ? void 0 : U.color) ?? "#94a3b8"), c < 1 ? l.lerp(M, c * 0.8) : l.copy(M).lerp(d, Math.min(1, (c - 1) / 1.2));
341
- const k = 0.35 + Math.min(c, 3) * 0.35, u = Math.min(1, c * 4);
342
- F(G, g, (E) => {
343
- if (E > u) return 0;
344
- const S = E * 6 - B * 1.8;
345
- return k * (0.45 + Math.pow(S - Math.floor(S), 8) * 3);
346
- });
347
- }
348
- for (const A of Z.mcpResolved) {
349
- if (L >= 24) break;
350
- const G = ie(A.instance), g = Xe(A.server, m);
351
- if (!G || !g) continue;
352
- const c = (v - A.resolvedAt) / 700;
353
- l.set(((x = Z.mcpServers.get(A.server)) == null ? void 0 : x.color) ?? "#ffffff").lerp(b, 0.6);
354
- const U = 1 - c * 1.15;
355
- F(G, g, (k) => (1 - c) * (0.25 + Math.exp(-Math.pow((k - U) * 9, 2)) * 5));
356
- }
357
- n.setDrawRange(0, L * 28 * 2), R.needsUpdate = !0, h.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 We = 9, ge = 11, Le = 46, _t = 1500, De = new t.Vector3(), an = new t.SphereGeometry(1, 36, 18, 0, Math.PI * 2, 0, Math.PI / 2), cn = new t.SphereGeometry(1, 16, 12), vt = new t.Color();
361
- function ln({ agent: e, selected: o, onSelect: n }) {
362
- const s = e.inst, m = s.id, M = e.depth > 0, d = M ? 0.42 : 0.62, b = Ut(m) % 1e3 / 1e3, l = Ke[s.type], p = _(null), v = _(null), B = _(null), R = _(null), h = _(null), w = _(null), z = _(null), L = _(b * 6), F = i(() => zt(l), [l]), x = i(() => new t.MeshBasicMaterial({ color: l, transparent: !0, toneMapped: !1, blending: t.AdditiveBlending, depthWrite: !1 }), [l]), A = i(() => new t.SpriteMaterial({ color: l, map: Fe(), transparent: !0, opacity: 0.06, toneMapped: !1, blending: t.AdditiveBlending, depthWrite: !1 }), [l]), G = i(() => new t.Color(l), [l]), g = i(() => {
363
- const S = new t.BufferGeometry(), P = We * ge * 2;
364
- S.setAttribute("position", new t.BufferAttribute(new Float32Array(P * 3), 3));
365
- const I = new Float32Array(P * 3), V = new t.Color(l);
366
- for (let f = 0; f < We; f++)
367
- for (let C = 0; C < ge; C++)
368
- for (let W = 0; W < 2; W++) {
369
- const j = 1 - (C + W) / ge, H = (f * ge + C) * 2 + W;
370
- I[H * 3] = V.r * (0.4 + j * 1.8), I[H * 3 + 1] = V.g * (0.4 + j * 1.8), I[H * 3 + 2] = V.b * (0.4 + j * 1.8);
371
- }
372
- return S.setAttribute("color", new t.BufferAttribute(I, 3)), S;
373
- }, [l]), c = i(() => new t.LineBasicMaterial({ vertexColors: !0, transparent: !0, opacity: 0.8, blending: t.AdditiveBlending, depthWrite: !1, toneMapped: !1 }), []), U = i(() => {
374
- const S = new Float32Array(Le * 4);
375
- for (let I = 0; I < Le; I++) {
376
- const V = Math.random() * Math.PI * 2, f = Math.random() * 1.4 - 0.4, C = Math.sqrt(1 - Math.min(1, f * f));
377
- S[I * 4] = Math.cos(V) * C, S[I * 4 + 1] = f, S[I * 4 + 2] = Math.sin(V) * C, S[I * 4 + 3] = 0.5 + Math.random();
378
- }
379
- const P = new t.BufferGeometry();
380
- return P.setAttribute("position", new t.BufferAttribute(new Float32Array(Le * 3), 3)), { dirs: S, g: P };
381
- }, []), k = i(
382
- () => new t.PointsMaterial({ color: new t.Color(l).multiplyScalar(2.2), size: M ? 0.16 : 0.22, map: Fe(), transparent: !0, depthWrite: !1, blending: t.AdditiveBlending, toneMapped: !1 }),
383
- [l, M]
384
- ), u = i(() => new t.Vector3(), []), E = _(!1);
385
- return Ct(
386
- () => () => {
387
- F.dispose(), x.dispose(), A.dispose(), g.dispose(), U.g.dispose(), k.dispose();
388
- },
389
- // eslint-disable-next-line react-hooks/exhaustive-deps
390
- []
391
- ), le(({ clock: S }, P) => {
392
- var we;
393
- const I = performance.now(), V = S.elapsedTime, f = e.inst;
394
- if (!E.current) {
395
- E.current = !0;
396
- const Y = f.parent ? ie(f.parent) : void 0;
397
- Y ? u.copy(Y) : Nt(e.run, Ue("planner"), Ft * ze.spread, u);
398
- }
399
- const C = 0.12 * Ee * Math.max(1, ze.spread);
400
- De.copy(e.pos), De.x += Math.sin(V * 0.4 + b * 9) * C, De.y += Math.sin(V * 0.7 + b * 5) * C;
401
- const W = ae((I - f.bornAt) / _t), j = Jt(ae(W / 0.8)), H = W < 0.32, K = H ? 0 : Qt(ae((W - 0.32) / 0.68)), Q = f.exitAt ? (I - f.exitAt) / Xt(f) : 0, y = f.exitAt > 0, D = y ? Math.max(0, 1 - Q * 1.25) : 1, a = y ? Math.exp(-(I - f.exitAt) / 220) : 0, T = f.status === "failed";
402
- let O = !1;
403
- for (const Y of Z.mcpPending.values()) Y.instance === m && (O = !0);
404
- const q = (f.status === "thinking" || f.status === "spawning") && !O, N = qt(f, I), ee = o, X = ze.scale, ne = y ? 0.8 : q ? 4.6 : O ? 1.8 : 1.1;
405
- L.current += P * ne;
406
- const me = Math.pow(0.5 + 0.5 * Math.sin(L.current), 3), oe = q ? 1 : 0.45, Me = e.live;
407
- Me.lerpVectors(u, De, j), Me.y += me * 0.12 * oe * X + (y ? Q * 1.2 * X : 0), p.current && (p.current.position.copy(Me), p.current.rotation.z = Math.sin(V * 0.5 + b * 7) * 0.12, p.current.rotation.x = Math.sin(V * 0.37 + b * 3) * 0.08);
408
- const $ = d * X * K * (1 + N * 0.14) * (1 + (y ? Q * 0.6 : 0)) * (ee ? 1.12 : 1), re = 1 + me * 0.14 * oe, ve = 0.8 * (1 - me * 0.24 * oe);
409
- v.current && (v.current.visible = !(y && D <= 1e-3)), (we = B.current) == null || we.scale.set(Math.max(1e-4, $ * re), Math.max(1e-4, $ * ve), Math.max(1e-4, $ * re));
410
- const ue = q ? 1.25 : O ? 0.7 + 0.35 * Math.sin(V * 2.2) : 0.45;
411
- if (F.uniforms.uIntensity.value = ue + N * 1.7 + a * 5 + (ee ? 0.7 : 0), F.uniforms.uOpacity.value = D * (0.4 + 0.6 * ae(K)), F.uniforms.uFlash.value = a, T && y && F.uniforms.uColor.value.set("#ef4444"), R.current) {
412
- const Y = X * (H ? d * (0.32 + 0.08 * Math.sin(I / 50)) : d * (0.22 + N * 0.06) * Math.min(1, K + 0.3));
413
- R.current.scale.setScalar(Math.max(1e-4, Y * (1 - (y ? Q : 0)))), R.current.position.y = H ? 0 : $ * ve * 0.35, vt.copy(G).multiplyScalar((H ? 5 : 1.6 + N * 3) * ue + a * 8), x.color.copy(vt), x.opacity = D;
414
- }
415
- h.current && (h.current.scale.setScalar(d * X * (H ? 3 : 4.2 + N * 2 + a * 4)), A.opacity = (0.12 + N * 0.16 + (H ? 0.5 : 0) + a * 0.6 + (ee ? 0.2 : 0)) * D);
416
- const Ve = g.getAttribute("position"), de = Ve.array, ye = $ * re * 0.88, he = d * X * (M ? 3 : 3.6) * ae(K) * (0.85 + 0.15 * (1 - me)), fe = q ? 3.2 : 1.1, Oe = d * X * (q ? 0.55 : 0.35);
417
- for (let Y = 0; Y < We; Y++) {
418
- const be = Y / We * Math.PI * 2, xe = Math.cos(be), Pe = Math.sin(be), Ae = 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 * Ae * (1 - se * 0.4), $e = ((Y * ge + te) * 2 + pe) * 3;
422
- de[$e] = xe * mt + Math.sin(ft) * Oe * se, de[$e + 1] = -se * he * (Ae < 1 ? 0.7 : 1), de[$e + 2] = Pe * mt + Math.cos(ft * 0.8) * Oe * se * 0.7;
423
- }
424
- }
425
- if (Ve.needsUpdate = !0, c.opacity = D * (q ? 0.95 : 0.55) * ae(K * 1.5), z.current && (z.current.visible = y, y)) {
426
- const Y = U.g.getAttribute("position"), be = Y.array, xe = (I - f.exitAt) / 1e3, Pe = 1 - Math.exp(-xe * 3.5), Ae = d * X;
427
- for (let te = 0; te < Le; te++) {
428
- const pe = U.dirs, se = pe[te * 4 + 3];
429
- be[te * 3] = pe[te * 4] * Ae * 2.2 * Pe * se + Math.sin(xe * 2 + te) * 0.08, be[te * 3 + 1] = pe[te * 4 + 1] * Ae * 1.6 * Pe * se + xe * 0.9 * se, be[te * 3 + 2] = pe[te * 4 + 2] * Ae * 2.2 * Pe * se;
430
- }
431
- Y.needsUpdate = !0, k.opacity = Math.max(0, 1 - Q) * Math.min(1, xe * 6);
432
- }
433
- }), /* @__PURE__ */ J("group", { ref: p, children: [
434
- /* @__PURE__ */ J("group", { ref: v, children: [
435
- /* @__PURE__ */ r(
436
- "mesh",
437
- {
438
- ref: B,
439
- geometry: an,
440
- material: F,
441
- onClick: (S) => (S.stopPropagation(), n(m)),
442
- onPointerOver: () => document.body.style.cursor = "pointer",
443
- onPointerOut: () => document.body.style.cursor = ""
444
- }
445
- ),
446
- /* @__PURE__ */ r("mesh", { ref: R, geometry: cn, material: x }),
447
- /* @__PURE__ */ r("sprite", { ref: h, material: A }),
448
- /* @__PURE__ */ r("lineSegments", { ref: w, geometry: g, material: c, frustumCulled: !1 })
449
- ] }),
450
- /* @__PURE__ */ r("points", { ref: z, geometry: U.g, material: k, frustumCulled: !1, visible: !1 })
451
- ] });
452
- }
453
- const Ft = 1.25;
454
- function un() {
455
- const n = i(() => {
456
- const m = new t.BufferGeometry();
457
- return m.setAttribute("position", new t.BufferAttribute(new Float32Array(3840), 3)), m.setAttribute("color", new t.BufferAttribute(new Float32Array(3840), 3)), m;
458
- }, []), s = i(() => new t.Color(), []);
459
- return le(({ clock: m }) => {
460
- const M = performance.now(), d = m.elapsedTime, b = n.getAttribute("position"), l = n.getAttribute("color"), p = b.array, v = l.array, B = ze.scale;
461
- let R = 0;
462
- for (const h of dt.agents.values()) {
463
- if (R >= 64) break;
464
- const w = h.inst;
465
- if (!w.parent) continue;
466
- const z = ie(w.parent), L = h.live, F = Z.instances.get(w.parent);
467
- if (!z || !F) continue;
468
- const x = ae((M - w.bornAt) / _t), A = (w.exitAt ? Math.max(0, 1 - (M - w.exitAt) / 900) : 1) * (F.exitAt ? Math.max(0, 1 - (M - F.exitAt) / 900) : 1);
469
- if (A <= 0) continue;
470
- const G = (0.22 + Math.pow(1 - x, 2) * 2.2) * A;
471
- s.set(Ke[w.type]);
472
- for (let g = 0; g < 10; g++)
473
- for (let c = 0; c < 2; c++) {
474
- const U = (g + c) / 10, k = ((R * 10 + g) * 2 + c) * 3, u = Math.sin(U * Math.PI) * (0.35 + 0.1 * Math.sin(d * 1.3 + R)) * B;
475
- p[k] = z.x + (L.x - z.x) * U, p[k + 1] = z.y - 0.25 * B + (L.y - z.y + 0.25 * B) * U - u, p[k + 2] = z.z + (L.z - z.z) * U;
476
- const E = x < 1 ? Math.exp(-Math.pow((U - x * 1.1) * 7, 2)) * 3 : 0, S = G * (0.5 + U * 0.5) + E * A;
477
- v[k] = s.r * S, v[k + 1] = s.g * S, v[k + 2] = s.b * S;
478
- }
479
- R++;
480
- }
481
- n.setDrawRange(0, R * 10 * 2), b.needsUpdate = !0, l.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 pn = { queued: "#1e3a5f", running: "#ffffff", done: "#5eead4", failed: "#ef4444" }, Qe = { plan: "planner", research: "researcher", write: "writer" }, je = 10, Ce = new t.Color(), ce = { u0: 0, u1: 1, mid: 0, half: 1, seed: 0 }, et = (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 dn({ run: e }) {
486
- const o = i(() => Ut(e.id) % 997 / 97, [e.id]), n = _(null), s = _(null), m = _(null), M = _([]), d = _(null), b = _(null), { tube: l, glow: p } = i(() => {
487
- const x = [];
488
- for (let G = 0; G <= 48; G++) {
489
- const g = -1 + 2 * G / 48;
490
- x.push(new t.Vector3(g, Gt(g * je, o), Rt(g * je, o)));
491
- }
492
- const A = new t.CatmullRomCurve3(x);
493
- return { tube: new t.TubeGeometry(A, 200, 0.05, 6), glow: new t.TubeGeometry(A, 120, 0.32, 8) };
494
- }, [o]), v = i(() => gt(e.color), [e.color]), B = i(() => {
495
- const x = gt(e.color);
496
- return x.uniforms.uWidthGlow.value = 0.18, x;
497
- }, [e.color]), R = i(() => [v, B], [v, B]), h = i(() => new t.Color(e.color), [e.color]), w = i(() => Se.map(() => new t.MeshBasicMaterial({ toneMapped: !1, transparent: !0 })), []), z = i(() => Se.map(() => new t.MeshBasicMaterial({ toneMapped: !1, transparent: !0, blending: t.AdditiveBlending, depthWrite: !1 })), []), L = i(() => Se.map(() => new t.SpriteMaterial({ map: Fe(), toneMapped: !1, transparent: !0, blending: t.AdditiveBlending, depthWrite: !1 })), []), F = i(() => new t.MeshBasicMaterial({ toneMapped: !1, transparent: !0 }), []);
498
- return Ct(
499
- () => () => {
500
- l.dispose(), p.dispose(), v.dispose(), B.dispose(), [...w, ...z, ...L, F].forEach((x) => x.dispose());
501
- },
502
- [l, p, v, B, w, z, L, F]
503
- ), le(({ clock: x }) => {
504
- var K, Q;
505
- const A = n.current;
506
- if (!A) return;
507
- const G = performance.now(), g = x.elapsedTime, c = e.run ?? Z.runs.get(e.id);
508
- A.position.copy(e.origin).addScaledVector(e.side, -e.cu).addScaledVector(e.axis, -e.cv);
509
- const U = ze.spread, k = 1.6 * U, u = ce;
510
- u.u0 = e.cu - e.hu - k, u.u1 = e.cu + e.hu + k;
511
- const E = u.mid = (u.u0 + u.u1) / 2, S = u.half = (u.u1 - u.u0) / 2;
512
- u.seed = o;
513
- const P = -Ft * U, I = s.current;
514
- I && (I.position.set(E, P, 0), I.scale.set(S, 1, 1));
515
- const V = c ? ae((G - c.startedAt) / 1600) * 1.1 : 1.1, f = c != null && c.endedAt ? Math.max(0, 1 - (G - c.endedAt) / jt) : 1;
516
- let C = -1, W = 0;
517
- const j = c ? (G - c.handoffAt) / 1300 : 9;
518
- if (c && c.handoffAt && j < 1) {
519
- const y = 1 - Math.pow(1 - j, 3), D = Ue(Qe[c.handoffFrom]), a = Ue(Qe[c.handoffTo]);
520
- C = et(D + (a - D) * y), W = Math.sin(j * Math.PI) * 1.2 + 0.3;
521
- } else if (c != null && c.endedAt && G - c.endedAt < 1400) {
522
- const y = (G - c.endedAt) / 1400, D = Ue("writer");
523
- C = et(D + (u.u1 - D) * y), W = (1 - y) * 0.45;
524
- }
525
- for (const y of R)
526
- y.uniforms.uTime.value = g * Ee, y.uniforms.uReveal.value = V, y.uniforms.uFade.value = f, y.uniforms.uPulse.value = C, y.uniforms.uPulseAmp.value = W;
527
- if (m.current && (m.current.visible = C >= 0, C >= 0)) {
528
- const y = u.u0 + C * (u.u1 - u.u0);
529
- m.current.position.set(y, P + yt(y), wt(y)), m.current.scale.setScalar(0.18 + W * 0.12), F.color.copy(bt).lerp(h, 0.3).multiplyScalar(4 * Math.max(0.3, W)), F.opacity = f;
530
- }
531
- const H = !!(c != null && c.hasSteps);
532
- for (let y = 0; y < Se.length; y++) {
533
- const D = Se[y], a = M.current[y];
534
- if (!a || (a.visible = H, !c || !H)) continue;
535
- const T = Ue(Qe[D]);
536
- a.position.set(T, P + yt(T), wt(T));
537
- const O = c.steps[D], q = ae((V - et(T)) * 6), N = O === "running", ee = N ? 0.5 + 0.5 * Math.sin(g * 5.5) : 0;
538
- a.scale.setScalar(Math.max(1e-3, q * (N ? 1.15 + ee * 0.2 : O === "done" ? 0.9 : 0.75) * Math.max(0.9, U))), a.rotation.y += N ? 0.05 : 4e-3;
539
- const X = w[y];
540
- O === "queued" ? Ce.copy(h).multiplyScalar(0.35) : N ? Ce.copy(h).lerp(bt, 0.35).multiplyScalar(2.2 + ee * 2.2) : Ce.set(pn[O]).multiplyScalar(O === "done" ? 1.5 : 2.5), X.color.copy(Ce), X.opacity = f, z[y].color.copy(Ce).multiplyScalar(N ? 0.9 : 0.5), z[y].opacity = f * (O === "queued" ? 0.35 : 1), L[y].color.copy(N ? h : Ce), L[y].opacity = f * (N ? 0.45 + ee * 0.3 : O === "done" ? 0.18 : 0.05);
541
- }
542
- (K = d.current) == null || K.position.set(u.u0 + 0.3, e.hv - e.cv + 0.5, 0), (Q = b.current) == null || Q.setOpacity(f * ae(V * 2));
543
- }), /* @__PURE__ */ J("group", { ref: n, children: [
544
- /* @__PURE__ */ J("group", { ref: s, children: [
545
- /* @__PURE__ */ r("mesh", { geometry: l, material: v }),
546
- /* @__PURE__ */ r("mesh", { geometry: p, material: B })
547
- ] }),
548
- /* @__PURE__ */ r("mesh", { ref: m, material: F, visible: !1, children: /* @__PURE__ */ r("sphereGeometry", { args: [1, 16, 12] }) }),
549
- Se.map((x, A) => /* @__PURE__ */ J("group", { ref: (G) => void (M.current[A] = G), visible: !1, children: [
550
- /* @__PURE__ */ r("mesh", { material: w[A], children: /* @__PURE__ */ r("icosahedronGeometry", { args: [0.2, 2] }) }),
551
- Array.from({ length: 8 }, (G, g) => {
552
- const c = g / 8 * Math.PI * 2;
553
- return /* @__PURE__ */ r("mesh", { material: z[A], position: [Math.cos(c) * 0.36, 0.1 + g % 2 * 0.08, Math.sin(c) * 0.36], children: /* @__PURE__ */ r("sphereGeometry", { args: [0.055, 8, 6] }) }, g);
554
- }),
555
- /* @__PURE__ */ r("mesh", { material: z[A], rotation: [Math.PI / 2, 0, 0], children: /* @__PURE__ */ r("torusGeometry", { args: [0.36, 0.012, 6, 40] }) }),
556
- /* @__PURE__ */ r("sprite", { material: L[A], scale: 2.4 }),
557
- /* @__PURE__ */ r(Ze, { position: [0, -0.75, 0], text: x, color: e.color, textColor: "#bae6fd", uppercase: !0, letterSpacing: 0.08, size: 0.22, opacity: 0.8, pxRange: [7.5, 10.5] })
558
- ] }, x)),
559
- /* @__PURE__ */ r("group", { ref: d, children: /* @__PURE__ */ r(fn, { runId: e.id, color: e.color, labelRef: b }) })
560
- ] });
561
- }
562
- function fn({ runId: e, color: o, labelRef: n }) {
563
- const s = Z.runs.get(e);
564
- return /* @__PURE__ */ r(
565
- Ze,
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 mn = new t.ConeGeometry(0.07, 0.34, 8).rotateX(Math.PI / 2), xt = new t.Vector3(), hn = new t.Vector3(), It = (e) => e < 0.5 ? 2 * e * e : 1 - Math.pow(-2 * e + 2, 2) / 2;
581
- function At(e) {
582
- const [o, n] = Lt([]), s = _([]);
583
- return le(() => {
584
- const m = e(), M = s.current;
585
- let d = M.length === m.length;
586
- if (d)
587
- for (let b = 0; b < m.length; b++) M[b] !== m[b].id && (d = !1);
588
- d || (s.current = m.map((b) => b.id), n(m.slice()));
589
- }), o;
590
- }
591
- function gn({ comet: e }) {
592
- const o = _(null), n = Z.instances.get(e.from), s = n ? Ke[n.type] : "#a5f3fc", m = i(() => new t.MeshBasicMaterial({ color: new t.Color(s).multiplyScalar(4), toneMapped: !1 }), [s]), M = i(() => (ie(e.from) ?? new t.Vector3()).clone(), [e.from]);
593
- return le(() => {
594
- const d = o.current;
595
- if (!d) return;
596
- const b = Math.min(1, (performance.now() - e.start) / e.dur), l = ie(e.from), p = ie(e.to);
597
- if (!l || !p) {
598
- d.scale.setScalar(1e-3);
599
- return;
600
- }
601
- qe(l, p, It(b), 1.1, d.position), d.scale.setScalar(b >= 1 ? 1e-3 : 1 + Math.sin(b * Math.PI) * 0.4);
602
- }), /* @__PURE__ */ r(Tt, { width: 1.8, length: 6, color: s, attenuation: (d) => d * d, decay: 1.4, children: /* @__PURE__ */ r("mesh", { ref: o, position: M, material: m, children: /* @__PURE__ */ r("sphereGeometry", { args: [0.11, 12, 10] }) }) });
603
- }
604
- function Mn({ call: e }) {
605
- const o = _(null), n = Z.mcpServers.get(e.server), s = (n == null ? void 0 : n.color) ?? "#94a3b8", m = i(() => new t.MeshBasicMaterial({ color: new t.Color(s).multiplyScalar(e.phase === "result" ? 5 : 3.5), toneMapped: !1 }), [s, e.phase]), M = i(() => ((e.phase === "call" ? ie(e.instance) : Xe(e.server, new t.Vector3())) ?? new t.Vector3()).clone(), [e]);
606
- return le(() => {
607
- const d = o.current;
608
- if (!d) return;
609
- const b = Math.min(1, (performance.now() - e.start) / e.dur), l = ie(e.instance), p = Xe(e.server, hn);
610
- if (!l || !p) {
611
- d.scale.setScalar(1e-3);
612
- return;
613
- }
614
- const v = It(b), B = e.phase === "call" ? v : 1 - v;
615
- qe(l, p, B, 1.6, d.position), qe(l, p, e.phase === "call" ? Math.min(1, B + 0.02) : Math.max(0, B - 0.02), 1.6, xt), d.lookAt(xt), d.scale.setScalar(b >= 1 ? 1e-3 : 1);
616
- }), /* @__PURE__ */ r(Tt, { width: 1.4, length: 5, color: s, attenuation: (d) => d * d * d, decay: 1.6, children: /* @__PURE__ */ r("mesh", { ref: o, position: M, material: m, geometry: mn }) });
617
- }
618
- const tt = [], nt = [];
619
- function vn() {
620
- if (!Pt.grouped) return Z.comets;
621
- tt.length = 0;
622
- for (const e of Z.comets) ct(e.from) && ct(e.to) && tt.push(e);
623
- return tt;
624
- }
625
- function yn() {
626
- if (!Pt.grouped) return Z.mcpCalls;
627
- nt.length = 0;
628
- for (const e of Z.mcpCalls) ct(e.instance) && nt.push(e);
629
- return nt;
630
- }
631
- function wn() {
632
- const e = At(vn), o = At(yn);
633
- return /* @__PURE__ */ J("group", { children: [
634
- e.map((n) => /* @__PURE__ */ r(gn, { comet: n }, n.id)),
635
- o.map((n) => /* @__PURE__ */ r(Mn, { call: n }, n.id))
636
- ] });
637
- }
638
- const ot = 60, bn = new t.Vector3(), rt = [0, 1], xn = 9, st = 180, at = 60, Be = 6, Ie = 4.2, _e = -1.15, He = 0.42, ut = Math.cos(He), pt = Math.sin(He), An = Object.keys(lt), it = 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 St(e, o, n, s, m) {
645
- e[o * 3] = n, e[o * 3 + 1] = s * ut + m * pt, e[o * 3 + 2] = -s * pt + m * ut;
646
- }
647
- function Sn(e) {
648
- const o = e.nodes.length, n = new Float32Array(o * 3), s = new Float32Array(o * 3), m = new Float32Array(o), M = new Int32Array(o), d = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map();
649
- for (const l of e.nodes) b.set(l.kind, (b.get(l.kind) ?? 0) + 1);
650
- return e.nodes.forEach((l, p) => {
651
- let v = An.indexOf(l.kind);
652
- v < 0 && (v = 8 + Math.floor(Re(l.kind, 3) * 8));
653
- const B = (v + 0.5) / 12, R = v * 2.39996 + 0.6, h = Math.sqrt(B), w = Math.cos(R) * h * Ie * 0.82, z = Math.sin(R) * h * Ie * 0.42, L = 0.35 + Math.sqrt(b.get(l.kind) ?? 1) * 0.1;
654
- d.has(l.kind) || d.set(l.kind, p), M[p] = d.get(l.kind);
655
- const F = Re(l.id, 11) * Math.PI * 2, x = Math.pow(Re(l.id, 12), 0.7) * L, A = w + Math.cos(F) * x, G = z + Math.sin(F) * x * 0.8, g = (0.6 + Re(l.id, 13) * 1) * (1.5 - x / L * 0.8);
656
- St(n, p, A, _e, G), St(s, p, A + Math.cos(F) * g * 0.35, _e + g, G + Math.sin(F) * g * 0.3), m[p] = Re(l.id, 14) * 6.28;
657
- }), { base: n, head: s, phase: m, hub: M };
658
- }
659
- function Cn({ galaxy: e }) {
660
- const o = i(() => {
661
- const u = e.nodes.slice(0, it), E = new Set(u.map((S) => S.id));
662
- return { nodes: u, links: e.links.filter((S) => E.has(S.source) && E.has(S.target)) };
663
- }, [e]), n = o.nodes.length, s = i(() => Sn(o), [o]), m = i(() => o.nodes.map((u) => new t.Color(lt[u.kind] ?? "#94a3b8")), [o]), M = i(() => /* @__PURE__ */ new Map(), [o]), d = (u) => {
664
- let E = M.get(u);
665
- return E === void 0 && M.set(u, E = Kt(o, u) % Math.max(1, n)), E;
666
- }, b = _(null), l = _(null), p = _(null), v = _(null), B = i(() => new Float32Array(n), [n]), R = i(() => new Float32Array(n), [n]), h = i(() => new t.Object3D(), []), w = i(() => new t.Color(), []), z = i(() => new t.Color(1, 1, 1), []), L = i(() => new t.Vector3(0, 1, 0), []), F = i(() => new t.Vector3(), []), x = i(() => new t.Vector3(), []), A = i(() => {
667
- const u = new Map(o.nodes.map((f, C) => [f.id, C])), E = [], S = [], P = s.head, I = (f, C, W, j, H) => {
668
- const K = m[f], Q = m[C];
669
- for (let y = 0; y < H; y++)
670
- for (let D = 0; D < 2; D++) {
671
- const a = (y + D) / H;
672
- E.push(P[f * 3] + (P[C * 3] - P[f * 3]) * a, P[f * 3 + 1] + (P[C * 3 + 1] - P[f * 3 + 1]) * a + Math.sin(a * Math.PI) * W, P[f * 3 + 2] + (P[C * 3 + 2] - P[f * 3 + 2]) * a), S.push((K.r + (Q.r - K.r) * a) * j, (K.g + (Q.g - K.g) * a) * j, (K.b + (Q.b - K.b) * a) * j);
673
- }
674
- };
675
- s.hub.forEach((f, C) => f !== C && I(C, f, 0, 0.32, 1));
676
- for (const f of o.links) {
677
- const C = u.get(f.source), W = u.get(f.target);
678
- if (C === void 0 || W === void 0 || C === W) continue;
679
- const j = Math.hypot(P[C * 3] - P[W * 3], P[C * 3 + 2] - P[W * 3 + 2]);
680
- I(C, W, Math.min(1.4, 0.15 + j * 0.09), 0.42, 10);
681
- }
682
- const V = new t.BufferGeometry();
683
- return V.setAttribute("position", new t.Float32BufferAttribute(E, 3)), V.setAttribute("color", new t.Float32BufferAttribute(S, 3)), V;
684
- }, [o, s, m]), G = _([]), g = _([]), c = _(["", ""]), U = i(() => {
685
- const u = new t.BufferGeometry();
686
- return u.setAttribute("position", new t.BufferAttribute(new Float32Array(at * Be * 2 * 3), 3)), u.setAttribute("color", new t.BufferAttribute(new Float32Array(at * Be * 2 * 3), 3)), u;
687
- }, []);
688
- le(({ clock: u }) => {
689
- const E = performance.now(), S = u.elapsedTime * Ee;
690
- B.fill(0), R.fill(0);
691
- const P = b.current, I = l.current, V = p.current, f = v.current;
692
- if (!P || !I || !V || !f) return;
693
- let C = 0, W = 0, j = 0;
694
- const H = U.getAttribute("position"), K = U.getAttribute("color"), Q = H.array, y = K.array;
695
- for (const a of Z.flares) {
696
- const T = d(a.node), O = (E - a.start) / 2600;
697
- if (O < 0 || O >= 1) continue;
698
- const q = a.op === "write", N = Math.exp(-O * 2.6) * Math.min(1, O * 20);
699
- N > B[T] && (B[T] = N), q && (R[T] = Math.max(R[T], N));
700
- const ee = s.base[T * 3], X = s.base[T * 3 + 1], ne = s.base[T * 3 + 2];
701
- if (C < ot) {
702
- h.position.set(ee, X + 0.03, ne), h.rotation.set(-Math.PI / 2 + He, 0, 0), h.scale.setScalar(0.12 + Math.sqrt(O) * (q ? 1.5 : 0.9)), h.updateMatrix(), V.setMatrixAt(C, h.matrix);
703
- const $ = Math.pow(1 - O, 2) * (q ? 3 : 1.6);
704
- q ? w.copy(z).multiplyScalar($) : w.copy(m[T]).multiplyScalar($), V.setColorAt(C, w), C++;
705
- }
706
- if (q)
707
- for (let $ = 0; $ < xn && W < st; $++) {
708
- const re = (a.id * 13 + $ * 7) % 97, ve = 1.4 + re % 10 * 0.18, ue = O * 2.6 - $ * 0.08;
709
- ue < 0 || (h.position.set(
710
- ee + Math.sin(re) * 0.35 + Math.sin(ue * 5 + $) * 0.1,
711
- X + 0.3 + ue * ve * 0.6,
712
- ne + Math.cos(re) * 0.35
713
- ), h.rotation.set(0, 0, 0), h.scale.setScalar((0.05 + re % 5 * 0.015) * (1 + ue * 0.3)), h.updateMatrix(), f.setMatrixAt(W, h.matrix), w.setRGB(1, 1.5, 1.9).multiplyScalar(Math.pow(Math.max(0, 1 - O), 1.5)), f.setColorAt(W, w), W++);
714
- }
715
- const me = ie(a.instance), oe = me ? Ht(me, bn) : void 0, Me = Z.instances.get(a.instance);
716
- if (oe && Me && j < at && O < 0.75) {
717
- const $ = O / 0.75, re = Math.pow(1 - $, 1.5) * Math.min(1, $ * 12) * (q ? 2.4 : 1.6);
718
- q ? w.copy(z) : w.set(Ke[Me.type]);
719
- const ve = s.head[T * 3], ue = s.head[T * 3 + 1], Ve = s.head[T * 3 + 2];
720
- for (let de = 0; de < Be; de++)
721
- for (let ye = 0; ye < 2; ye++) {
722
- const he = (de + ye) / Be, fe = ((j * Be + de) * 2 + ye) * 3;
723
- Q[fe] = oe.x + (ve - oe.x) * he, Q[fe + 1] = oe.y + (ue - oe.y) * he, Q[fe + 2] = oe.z + (Ve - oe.z) * he;
724
- const Oe = Math.exp(-Math.pow((he - Math.min(1, $ * 2.2)) * 6, 2)) * 2, we = re * (0.35 + he * 0.4 + Oe);
725
- y[fe] = w.r * we, y[fe + 1] = w.g * we, y[fe + 2] = w.b * we;
726
- }
727
- j++;
728
- }
729
- }
730
- for (let a = C; a < ot; a++)
731
- h.scale.setScalar(0), h.updateMatrix(), V.setMatrixAt(a, h.matrix);
732
- for (let a = W; a < st; a++)
733
- h.scale.setScalar(0), h.updateMatrix(), f.setMatrixAt(a, h.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, j * Be * 2), H.needsUpdate = !0, K.needsUpdate = !0;
735
- let D = 0;
736
- for (let a = Z.flares.length - 1; a >= 0 && D < rt.length; a--) {
737
- const T = Z.flares[a], O = (E - T.start) / 1e3;
738
- if (O > 1.8) continue;
739
- let q = !1;
740
- for (let ne = 0; ne < D; ne++) c.current[ne] === T.node && (q = !0);
741
- if (q) continue;
742
- const N = d(T.node), ee = G.current[D], X = g.current[D];
743
- ee && X && (ee.position.set(s.head[N * 3], s.head[N * 3 + 1] + 0.55 + O * 0.25, s.head[N * 3 + 2]), c.current[D] !== T.node && (X.setText((T.op === "write" ? "wrote · " : "") + T.node), X.setColor(T.op === "write" ? "#ffffff" : lt[o.nodes[N].kind] ?? "#94a3b8")), X.setOpacity(Math.min(1, (1.8 - O) * 2))), c.current[D] = T.node, D++;
744
- }
745
- for (let a = D; a < rt.length; a++) {
746
- const T = g.current[a];
747
- T == null || T.setOpacity(0), c.current[a] = "";
748
- }
749
- for (let a = 0; a < n; a++) {
750
- const T = B[a], O = 0, q = 0, N = s.base[a * 3], ee = s.base[a * 3 + 1], X = s.base[a * 3 + 2];
751
- x.set(s.head[a * 3] + O, s.head[a * 3 + 1], s.head[a * 3 + 2] + q), F.set(x.x - N, x.y - ee, x.z - X);
752
- const ne = F.length();
753
- F.multiplyScalar(1 / ne), h.position.set(N, ee, X), h.quaternion.setFromUnitVectors(L, F), h.scale.set(1 + T, ne, 1 + T), h.updateMatrix(), I.setMatrixAt(a, h.matrix), w.copy(m[a]).multiplyScalar(0.22 + T * 1.2), I.setColorAt(a, w), h.position.copy(x), h.quaternion.identity(), h.scale.setScalar(1 + T * 2.6), h.updateMatrix(), P.setMatrixAt(a, h.matrix), w.copy(m[a]).multiplyScalar(0.75 + 0.25 * Math.sin(S * 0.8 + s.phase[a] * 3) + T * 5), R[a] > 0.01 && (w.lerp(z.setScalar(6), R[a] * 0.7), z.setScalar(1)), P.setColorAt(a, w);
754
- }
755
- P.count = n, I.count = n, P.instanceMatrix.needsUpdate = !0, P.instanceColor && (P.instanceColor.needsUpdate = !0), I.instanceMatrix.needsUpdate = !0, I.instanceColor && (I.instanceColor.needsUpdate = !0);
756
- });
757
- const k = 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: l, args: [k, void 0, it], frustumCulled: !1, children: /* @__PURE__ */ r("meshBasicMaterial", { toneMapped: !1 }) }),
760
- /* @__PURE__ */ J("instancedMesh", { ref: b, args: [void 0, void 0, it], frustumCulled: !1, children: [
761
- /* @__PURE__ */ r("icosahedronGeometry", { args: [0.12, 1] }),
762
- /* @__PURE__ */ r("meshBasicMaterial", { toneMapped: !1 })
763
- ] }),
764
- /* @__PURE__ */ r("lineSegments", { geometry: A, children: /* @__PURE__ */ r("lineBasicMaterial", { vertexColors: !0, transparent: !0, opacity: 0.9, blending: t.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) }),
765
- /* @__PURE__ */ J("instancedMesh", { ref: p, args: [void 0, void 0, ot], 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: v, args: [void 0, void 0, st], 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 * ut - 0.02, -_e * pt], 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(Zt, { position: [0, _e - 0.9, 0.6], color: "#2dd4bf", size: 0.3, pxRange: [9, 13] }),
779
- rt.map((u) => /* @__PURE__ */ r("group", { ref: (E) => void (G.current[u] = E), children: /* @__PURE__ */ r(Ze, { ref: (E) => void (g.current[u] = E), text: "", size: 0.24, opacity: 0, pxRange: [8, 12] }) }, u))
780
- ] });
781
- }
782
- function zn() {
783
- return /* @__PURE__ */ J(
784
- $t,
785
- {
786
- title: "Deep sea · bioluminescent agents",
787
- subtitle: "jellyfish = agents · currents = Hatchet runs · coral reef = knowledge graph · anglerfish = MCP servers",
788
- preset: Yt,
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(on, {}),
798
- Agent: ln,
799
- RunMarker: dn,
800
- McpServer: rn,
801
- GraphResource: Cn,
802
- cluster: { radius: 1.25, variant: "swarm", pointSize: 0.9, labelBelow: 1.15 },
803
- PostFX: /* @__PURE__ */ J(Et, { multisampling: 0, children: [
804
- /* @__PURE__ */ r(Vt, { mipmapBlur: !0, intensity: 1.25, luminanceThreshold: 0.16, luminanceSmoothing: 0.25, radius: 0.78 }),
805
- /* @__PURE__ */ r(Ot, { eskil: !1, offset: 0.22, darkness: 0.9 }),
806
- /* @__PURE__ */ r(kt, { opacity: 0.03 })
807
- ] }),
808
- children: [
809
- /* @__PURE__ */ r(un, {}),
810
- /* @__PURE__ */ r(wn, {}),
811
- /* @__PURE__ */ r(sn, {})
812
- ]
813
- }
814
- );
815
- }
816
- export {
817
- zn as default
818
- };