cy0307 commited on
Commit
79fb87d
·
verified ·
1 Parent(s): 5a51665

Clarify resource dates and agent runtime

Browse files

Sync GitHub commit ca53f495cf1476020a67382482387ba62e2215c7.

Files changed (3) hide show
  1. README.md +0 -0
  2. docs/assets/loop-hero-scene.js +542 -489
  3. docs/index.html +50 -15
README.md CHANGED
The diff for this file is too large to render. See raw diff
 
docs/assets/loop-hero-scene.js CHANGED
@@ -5,12 +5,12 @@ const hero = container?.closest('.hero');
5
  const stageButtons = Array.from(document.querySelectorAll('[data-loop-stage]'));
6
  const stageDetail = document.getElementById('loop-stage-detail');
7
  const stages = [
8
- ['Intake:', 'capture a bounded work packet from a queue, schedule, event, or goal.'],
9
- ['Delegate:', 'route that packet to the right agent role while keeping scope explicit.'],
10
- ['Act:', 'execute inside an isolated workspace with scoped tools and permissions.'],
11
- ['Verify:', 'turn output into evidence through tests, evals, traces, or review.'],
12
- ['Persist:', 'write progress, receipts, and durable state outside the model.'],
13
- ['Decide:', 'choose one bounded outcome: retry with evidence, escalate, or exit.'],
14
  ];
15
  let activeStage = 0;
16
  let manualSelectionUntil = 0;
@@ -54,10 +54,31 @@ selectStage(activeStage);
54
  if (container && hero) {
55
  const reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)');
56
  const lowPower = Number(navigator.hardwareConcurrency || 8) <= 4;
57
- const palette = [0x1457ff, 0x009ac2, 0x07866f, 0x12a66a, 0x2868df, 0x7657e8];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  const paper = new THREE.Color(0xf7f9fc);
59
  const white = new THREE.Color(0xffffff);
60
  const yAxis = new THREE.Vector3(0, 1, 0);
 
61
  let renderer;
62
 
63
  try {
@@ -81,37 +102,38 @@ if (container && hero) {
81
  container.appendChild(renderer.domElement);
82
 
83
  const scene = new THREE.Scene();
84
- const camera = new THREE.PerspectiveCamera(29, 1, 0.1, 60);
85
- scene.add(new THREE.HemisphereLight(0xffffff, 0xb9cbe4, 2.15));
 
86
 
87
- const keyLight = new THREE.DirectionalLight(0xffffff, 2.8);
 
88
  keyLight.position.set(-4, 6, 8);
89
  scene.add(keyLight);
90
-
91
- const cyanLight = new THREE.PointLight(0x08a9c4, 13, 14, 2);
92
- cyanLight.position.set(-1.5, 1.2, 4.5);
93
  scene.add(cyanLight);
94
-
95
- const greenLight = new THREE.PointLight(0x16a36a, 8, 10, 2);
96
- greenLight.position.set(2.3, 0.8, 3.6);
97
  scene.add(greenLight);
98
 
99
  const root = new THREE.Group();
100
  scene.add(root);
101
 
102
- function standardMaterial(hex, lighten = 0.5, options = {}) {
103
  const color = new THREE.Color(hex);
104
- const blend = Math.min(lighten, 0.58);
105
- return new THREE.MeshStandardMaterial({
106
- color: color.clone().lerp(white, blend),
107
  emissive: color,
108
- emissiveIntensity: options.emissiveIntensity ?? 0.08,
109
- metalness: options.metalness ?? 0.12,
110
- roughness: options.roughness ?? 0.34,
111
  transparent: options.transparent ?? false,
112
  opacity: options.opacity ?? 1,
113
  depthWrite: options.depthWrite ?? true,
114
  });
 
 
115
  }
116
 
117
  function basicMaterial(hex, opacity = 1) {
@@ -119,7 +141,7 @@ if (container && hero) {
119
  color: hex,
120
  transparent: opacity < 1,
121
  opacity,
122
- depthWrite: opacity >= 1,
123
  });
124
  }
125
 
@@ -130,87 +152,23 @@ if (container && hero) {
130
  material,
131
  );
132
  cylinder.position.copy(start).add(end).multiplyScalar(0.5);
133
- cylinder.quaternion.setFromUnitVectors(yAxis, direction.normalize());
134
  return cylinder;
135
  }
136
 
137
- function addTube(curve, radius, hex, opacity, segments = 120) {
138
- const tube = new THREE.Mesh(
139
- new THREE.TubeGeometry(curve, lowPower ? Math.round(segments * 0.65) : segments, radius, 6, false),
140
- new THREE.MeshBasicMaterial({
141
- color: hex,
142
- transparent: true,
143
- opacity,
144
- blending: opacity < 0.16 ? THREE.AdditiveBlending : THREE.NormalBlending,
145
- depthWrite: false,
146
- }),
147
- );
148
- root.add(tube);
149
- return tube;
150
- }
151
-
152
- function addArrow(curve, time, hex, scale = 1) {
153
- const tangent = curve.getTangentAt(time).normalize();
154
- const arrow = new THREE.Mesh(
155
- new THREE.ConeGeometry(0.06 * scale, 0.2 * scale, lowPower ? 10 : 16),
156
- basicMaterial(hex, 0.78),
157
- );
158
- arrow.position.copy(curve.getPointAt(time));
159
- arrow.quaternion.setFromUnitVectors(yAxis, tangent);
160
- root.add(arrow);
161
- return arrow;
162
- }
163
-
164
- function positionArrow(arrow, curve, time) {
165
- const tangent = curve.getTangentAt(time).normalize();
166
- arrow.position.copy(curve.getPointAt(time));
167
- arrow.quaternion.setFromUnitVectors(yAxis, tangent);
168
- }
169
-
170
- function replaceTubeGeometry(mesh, curve, radius, segments) {
171
- mesh.geometry.dispose();
172
- mesh.geometry = new THREE.TubeGeometry(
173
- curve,
174
- lowPower ? Math.round(segments * 0.65) : segments,
175
- radius,
176
- 6,
177
- false,
178
- );
179
- }
180
-
181
- function roundedRect(context, x, y, width, height, radius) {
182
- context.beginPath();
183
- context.moveTo(x + radius, y);
184
- context.lineTo(x + width - radius, y);
185
- context.quadraticCurveTo(x + width, y, x + width, y + radius);
186
- context.lineTo(x + width, y + height - radius);
187
- context.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
188
- context.lineTo(x + radius, y + height);
189
- context.quadraticCurveTo(x, y + height, x, y + height - radius);
190
- context.lineTo(x, y + radius);
191
- context.quadraticCurveTo(x, y, x + radius, y);
192
- context.closePath();
193
- }
194
-
195
- function labelSprite(text, hex) {
196
  const canvas = document.createElement('canvas');
197
  canvas.width = 512;
198
- canvas.height = 104;
199
  const context = canvas.getContext('2d');
200
- const cssColor = `#${hex.toString(16).padStart(6, '0')}`;
201
  context.clearRect(0, 0, canvas.width, canvas.height);
202
- roundedRect(context, 4, 4, 504, 96, 18);
203
- context.fillStyle = 'rgba(247, 249, 252, 0.95)';
204
- context.fill();
205
- context.lineWidth = 4;
206
- context.strokeStyle = cssColor;
207
- context.stroke();
208
- context.fillStyle = '#111827';
209
- context.font = '700 32px IBM Plex Mono, ui-monospace, monospace';
210
- context.textAlign = 'center';
211
  context.textBaseline = 'middle';
212
- context.fillText(text, 256, 53);
213
-
214
  const texture = new THREE.CanvasTexture(canvas);
215
  texture.colorSpace = THREE.SRGBColorSpace;
216
  texture.minFilter = THREE.LinearFilter;
@@ -220,75 +178,156 @@ if (container && hero) {
220
  depthTest: false,
221
  depthWrite: false,
222
  }));
223
- sprite.scale.set(1.48, 0.32, 1);
224
- sprite.renderOrder = 20;
225
  return sprite;
226
  }
227
 
228
- function numberSprite(number, hex) {
229
  const canvas = document.createElement('canvas');
230
  canvas.width = 128;
231
  canvas.height = 128;
232
  const context = canvas.getContext('2d');
233
- const cssColor = `#${hex.toString(16).padStart(6, '0')}`;
234
  context.beginPath();
235
- context.arc(64, 64, 54, 0, Math.PI * 2);
236
- context.fillStyle = 'rgba(255, 255, 255, 0.98)';
237
  context.fill();
238
- context.lineWidth = 7;
239
- context.strokeStyle = cssColor;
240
  context.stroke();
241
- context.fillStyle = '#111827';
242
- context.font = '700 46px IBM Plex Mono, ui-monospace, monospace';
243
  context.textAlign = 'center';
244
  context.textBaseline = 'middle';
245
  context.fillText(String(number).padStart(2, '0'), 64, 67);
246
-
247
  const texture = new THREE.CanvasTexture(canvas);
248
  texture.colorSpace = THREE.SRGBColorSpace;
249
- texture.minFilter = THREE.LinearFilter;
250
  const sprite = new THREE.Sprite(new THREE.SpriteMaterial({
251
  map: texture,
252
  transparent: true,
253
  depthTest: false,
254
  depthWrite: false,
255
  }));
256
- sprite.scale.set(0.42, 0.42, 1);
257
- sprite.renderOrder = 21;
258
  return sprite;
259
  }
260
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
261
  const desktopStagePositions = [
262
- new THREE.Vector3(-4.35, -0.06, 0.22),
263
- new THREE.Vector3(-2.62, 0.08, 0.04),
264
- new THREE.Vector3(-0.86, -0.03, 0.18),
265
- new THREE.Vector3(0.94, 0.08, 0.02),
266
- new THREE.Vector3(2.62, -0.02, 0.16),
267
- new THREE.Vector3(4.12, 0.07, 0.02),
268
  ];
269
  const compactStagePositions = [
270
- new THREE.Vector3(-2.7, 0.78, 0.2),
271
- new THREE.Vector3(-0.92, 0.78, 0.04),
272
- new THREE.Vector3(0.88, 0.78, 0.18),
273
- new THREE.Vector3(2.65, 0.78, 0.02),
274
- new THREE.Vector3(1.52, -0.74, 0.16),
275
- new THREE.Vector3(-0.18, -0.74, 0.02),
276
  ];
277
  const stagePositions = desktopStagePositions.map((position) => position.clone());
278
- let mainCurve = new THREE.CatmullRomCurve3(stagePositions, false, 'centripetal', 0.35);
279
- const mainTube = addTube(mainCurve, 0.032, 0x1457ff, 0.82, 180);
280
- const mainGlow = addTube(mainCurve, 0.095, 0x009ac2, 0.1, 150);
281
- const mainArrowTimes = [0.11, 0.29, 0.47, 0.65, 0.84];
282
- const mainArrows = mainArrowTimes.map((time, index) => (
283
- addArrow(mainCurve, time, palette[Math.min(index + 1, palette.length - 1)], 1.02)
284
- ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
 
286
  function closestCurveTime(position) {
 
287
  let closestTime = 0;
288
  let closestDistance = Infinity;
289
- for (let sample = 0; sample <= 240; sample += 1) {
290
- const time = sample / 240;
291
- const distance = mainCurve.getPointAt(time).distanceToSquared(position);
292
  if (distance < closestDistance) {
293
  closestDistance = distance;
294
  closestTime = time;
@@ -298,90 +337,60 @@ if (container && hero) {
298
  }
299
 
300
  let stageTimes = stagePositions.map(closestCurveTime);
301
- let retryCurve = new THREE.CatmullRomCurve3([
302
- stagePositions[5],
303
- new THREE.Vector3(3.7, 1.48, -0.55),
304
- new THREE.Vector3(0.1, 1.88, -0.82),
305
- new THREE.Vector3(-3.85, 1.4, -0.52),
306
- stagePositions[0],
307
- ], false, 'centripetal', 0.45);
308
- const retryLine = new THREE.Line(
309
- new THREE.BufferGeometry().setFromPoints(retryCurve.getPoints(lowPower ? 90 : 160)),
310
- new THREE.LineDashedMaterial({
311
- color: 0x7c5ce0,
312
- transparent: true,
313
- opacity: 0.6,
314
- dashSize: 0.14,
315
- gapSize: 0.1,
316
- depthWrite: false,
317
- }),
318
- );
319
- retryLine.computeLineDistances();
320
- root.add(retryLine);
321
- const retryArrowTimes = [0.24, 0.5, 0.76];
322
- const retryArrows = retryArrowTimes.map((time) => addArrow(retryCurve, time, 0x7657e8, 0.94));
323
-
324
- const exitTarget = new THREE.Vector3(5.35, 0.75, 0.08);
325
- const escalateTarget = new THREE.Vector3(5.35, -0.72, 0.12);
326
- let exitCurve = new THREE.CatmullRomCurve3([
327
- stagePositions[5],
328
- new THREE.Vector3(4.72, 0.3, 0.04),
329
- exitTarget,
330
- ], false, 'centripetal', 0.35);
331
- let escalateCurve = new THREE.CatmullRomCurve3([
332
- stagePositions[5],
333
- new THREE.Vector3(4.7, -0.28, 0.06),
334
- escalateTarget,
335
- ], false, 'centripetal', 0.35);
336
- const exitTube = addTube(exitCurve, 0.022, 0x16a36a, 0.82, 60);
337
- const escalateTube = addTube(escalateCurve, 0.022, 0xd97706, 0.76, 60);
338
- const exitArrow = addArrow(exitCurve, 0.68, 0x16a36a, 0.9);
339
- const escalateArrow = addArrow(escalateCurve, 0.68, 0xd97706, 0.9);
340
 
341
  const stationStates = [];
342
- const labels = [];
343
  const numberLabels = [];
 
344
 
345
- function createStation(index, name) {
346
- const color = palette[index];
347
  const group = new THREE.Group();
348
  group.position.copy(stagePositions[index]);
349
  root.add(group);
350
 
351
  const haloMaterial = new THREE.MeshBasicMaterial({
352
- color,
353
  transparent: true,
354
- opacity: 0.12,
355
  blending: THREE.AdditiveBlending,
356
  depthWrite: false,
357
  });
358
  const halo = new THREE.Mesh(
359
- new THREE.TorusGeometry(0.67, 0.025, 8, lowPower ? 32 : 56),
360
  haloMaterial,
361
  );
362
  halo.rotation.x = Math.PI / 2;
363
- halo.position.y = -0.42;
364
  group.add(halo);
365
 
366
- const baseMaterial = standardMaterial(color, 0.56, { emissiveIntensity: 0.05, roughness: 0.46 });
367
  const base = new THREE.Mesh(
368
- new THREE.CylinderGeometry(0.55, 0.61, 0.09, lowPower ? 20 : 36),
369
  baseMaterial,
370
  );
371
- base.position.y = -0.39;
372
  group.add(base);
373
 
374
- const label = labelSprite(`${String(index + 1).padStart(2, '0')} ${name.toUpperCase()}`, color);
375
- label.position.set(0, 1.22, 0.12);
376
- group.add(label);
377
- labels.push(label);
378
 
379
- const numberLabel = numberSprite(index + 1, color);
380
- numberLabel.position.set(0.4, 0.84, 0.38);
381
- group.add(numberLabel);
382
- numberLabels.push(numberLabel);
383
 
384
- const state = { group, haloMaterial, baseMaterial, materials: [], label, numberLabel };
 
 
 
 
 
 
385
  stationStates.push(state);
386
  return state;
387
  }
@@ -391,199 +400,283 @@ if (container && hero) {
391
  return material;
392
  }
393
 
394
- const intake = createStation(0, 'Intake');
395
- const intakeMaterial = track(intake, standardMaterial(palette[0], 0.58));
396
- const intakeTray = new THREE.Mesh(new THREE.BoxGeometry(0.82, 0.1, 0.62), intakeMaterial);
397
- intakeTray.position.y = -0.08;
398
- intake.group.add(intakeTray);
399
- [-0.38, 0.38].forEach((x) => {
400
- const wall = new THREE.Mesh(new THREE.BoxGeometry(0.08, 0.38, 0.62), intakeMaterial);
401
- wall.position.set(x, 0.08, 0);
402
- intake.group.add(wall);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
403
  });
404
- const funnelMaterial = track(intake, standardMaterial(0x08a9c4, 0.62, { transparent: true, opacity: 0.9 }));
405
- const intakeFunnel = new THREE.Mesh(
406
- new THREE.CylinderGeometry(0.34, 0.14, 0.48, lowPower ? 20 : 32, 1, true),
407
- funnelMaterial,
408
  );
409
- intakeFunnel.position.y = 0.52;
410
- intake.group.add(intakeFunnel);
411
- const incomingPacketMaterial = track(intake, standardMaterial(0x155eef, 0.35, { emissiveIntensity: 0.35 }));
412
- const incomingPacket = new THREE.Mesh(new THREE.BoxGeometry(0.18, 0.18, 0.18), incomingPacketMaterial);
413
- incomingPacket.position.y = 0.95;
414
- intake.group.add(incomingPacket);
415
-
416
- const delegate = createStation(1, 'Delegate');
417
- const delegateHubMaterial = track(delegate, standardMaterial(palette[1], 0.45, { emissiveIntensity: 0.24 }));
418
- const delegateHub = new THREE.Mesh(new THREE.SphereGeometry(0.2, 24, 16), delegateHubMaterial);
419
- delegateHub.position.y = 0.12;
420
- delegate.group.add(delegateHub);
421
- const delegateNodes = [
422
- new THREE.Vector3(-0.42, 0.58, 0.02),
423
- new THREE.Vector3(0.46, 0.5, -0.02),
424
- new THREE.Vector3(0.32, -0.16, 0.08),
425
- ].map((position, index) => {
426
- const material = track(delegate, standardMaterial([0x155eef, 0x16a36a, 0x7c5ce0][index], 0.45));
427
- const node = new THREE.Mesh(new THREE.SphereGeometry(0.13, 20, 12), material);
428
  node.position.copy(position);
429
- node.userData.basePosition = position.clone();
430
  delegate.group.add(node);
431
  delegate.group.add(cylinderBetween(
432
- new THREE.Vector3(0, 0.12, 0),
433
  position,
434
- 0.014,
435
- basicMaterial([0x155eef, 0x16a36a, 0x7c5ce0][index], 0.48),
436
  ));
437
  return node;
438
  });
 
439
 
440
- const act = createStation(2, 'Act');
441
- const sandbox = new THREE.Mesh(
442
- new THREE.BoxGeometry(0.92, 0.86, 0.78),
443
- new THREE.MeshBasicMaterial({ color: palette[2], wireframe: true, transparent: true, opacity: 0.46 }),
 
444
  );
445
- sandbox.position.y = 0.16;
446
- act.group.add(sandbox);
447
- const actCoreMaterial = track(act, standardMaterial(palette[2], 0.36, { emissiveIntensity: 0.3 }));
448
- const actCore = new THREE.Mesh(new THREE.IcosahedronGeometry(0.25, 1), actCoreMaterial);
449
- actCore.position.y = 0.16;
450
- act.group.add(actCore);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
451
  const scannerMaterial = new THREE.MeshBasicMaterial({
452
- color: 0x08a9c4,
453
  transparent: true,
454
  opacity: 0.22,
455
  blending: THREE.AdditiveBlending,
456
  depthWrite: false,
457
  });
458
- const scanner = new THREE.Mesh(new THREE.BoxGeometry(0.78, 0.022, 0.66), scannerMaterial);
459
- scanner.position.y = -0.2;
460
- act.group.add(scanner);
461
-
462
- const verify = createStation(3, 'Verify');
463
- const verifyRingMaterial = track(verify, standardMaterial(palette[3], 0.44, { emissiveIntensity: 0.22 }));
464
- const verifyRing = new THREE.Mesh(
465
- new THREE.TorusGeometry(0.48, 0.065, 12, lowPower ? 36 : 64),
466
- verifyRingMaterial,
467
- );
468
- verifyRing.position.y = 0.14;
469
- verify.group.add(verifyRing);
470
- const verifyAuraMaterial = new THREE.MeshBasicMaterial({
471
- color: palette[3],
472
- transparent: true,
473
- opacity: 0.12,
474
- blending: THREE.AdditiveBlending,
475
- depthWrite: false,
476
- });
477
- const verifyAura = new THREE.Mesh(new THREE.TorusGeometry(0.62, 0.018, 8, 64), verifyAuraMaterial);
478
- verifyAura.position.copy(verifyRing.position);
479
- verify.group.add(verifyAura);
480
- const checkMaterial = track(verify, standardMaterial(0x16a36a, 0.18, { emissiveIntensity: 0.62 }));
481
  verify.group.add(cylinderBetween(
482
- new THREE.Vector3(-0.23, 0.13, 0.12),
483
- new THREE.Vector3(-0.06, -0.04, 0.12),
484
- 0.045,
485
  checkMaterial,
486
- 16,
487
  ));
488
  verify.group.add(cylinderBetween(
489
- new THREE.Vector3(-0.06, -0.04, 0.12),
490
- new THREE.Vector3(0.28, 0.34, 0.12),
491
- 0.045,
492
  checkMaterial,
493
- 16,
494
  ));
495
- const evidenceDots = [0, 1, 2].map((index) => {
496
- const dot = new THREE.Mesh(
497
- new THREE.SphereGeometry(0.055, 12, 8),
498
- basicMaterial(index === 1 ? 0x16a36a : 0x08a9c4, 0.84),
499
  );
500
- verify.group.add(dot);
501
- return dot;
502
  });
 
503
 
504
- const persist = createStation(4, 'Persist');
505
- const persistPlates = [0, 1, 2, 3].map((index) => {
506
- const material = track(persist, standardMaterial(index % 2 ? 0x155eef : 0x08a9c4, 0.58, { emissiveIntensity: 0.1 }));
507
- const plate = new THREE.Mesh(new THREE.BoxGeometry(0.88, 0.11, 0.62), material);
508
- plate.position.set(index * 0.035 - 0.05, -0.12 + index * 0.18, -index * 0.035);
509
- plate.userData.baseY = plate.position.y;
510
- persist.group.add(plate);
511
- return plate;
 
 
 
 
 
512
  });
513
- const receiptMaterial = track(persist, standardMaterial(0x16a36a, 0.34, { emissiveIntensity: 0.34 }));
514
- [-0.26, 0, 0.26].forEach((x, index) => {
515
- const receipt = new THREE.Mesh(new THREE.BoxGeometry(0.13, 0.18, 0.13), receiptMaterial);
516
- receipt.position.set(x, 0.66 + index * 0.04, 0.02);
 
 
 
 
 
 
 
517
  persist.group.add(receipt);
 
518
  });
519
-
520
- const decide = createStation(5, 'Decide');
521
- const decisionMaterial = track(decide, standardMaterial(palette[5], 0.38, { emissiveIntensity: 0.3 }));
522
- const decisionCore = new THREE.Mesh(new THREE.OctahedronGeometry(0.48, 0), decisionMaterial);
523
- decisionCore.position.y = 0.13;
 
 
 
 
524
  decide.group.add(decisionCore);
525
- const decisionRingMaterial = new THREE.MeshBasicMaterial({
526
- color: palette[5],
527
- transparent: true,
528
- opacity: 0.42,
529
- depthWrite: false,
530
- });
531
- const decisionRing = new THREE.Mesh(new THREE.TorusGeometry(0.61, 0.02, 8, 56), decisionRingMaterial);
532
  decisionRing.position.copy(decisionCore.position);
533
  decide.group.add(decisionRing);
534
-
535
- function endpoint(position, hex, shape = 'ring') {
536
- const group = new THREE.Group();
537
- group.position.copy(position);
538
- const material = standardMaterial(hex, 0.38, { emissiveIntensity: 0.42 });
539
- const mesh = shape === 'ring'
540
- ? new THREE.Mesh(new THREE.TorusGeometry(0.2, 0.048, 10, 32), material)
541
- : new THREE.Mesh(new THREE.OctahedronGeometry(0.22, 0), material);
542
- group.add(mesh);
543
- const halo = new THREE.Mesh(
544
- new THREE.TorusGeometry(0.3, 0.012, 8, 36),
545
- new THREE.MeshBasicMaterial({ color: hex, transparent: true, opacity: 0.24, depthWrite: false }),
546
- );
547
- group.add(halo);
548
- root.add(group);
549
- return { group, mesh, halo };
550
- }
551
-
552
- const exitEndpoint = endpoint(exitTarget, 0x16a36a, 'ring');
553
- const escalateEndpoint = endpoint(escalateTarget, 0xd97706, 'diamond');
554
-
555
- const packetMaterial = standardMaterial(palette[0], 0.28, { emissiveIntensity: 0.48, roughness: 0.22 });
556
- const packet = new THREE.Mesh(new THREE.BoxGeometry(0.36, 0.27, 0.28), packetMaterial);
557
- const packetEdgesMaterial = new THREE.LineBasicMaterial({ color: palette[0], transparent: true, opacity: 0.92 });
558
- const packetEdges = new THREE.LineSegments(new THREE.EdgesGeometry(packet.geometry), packetEdgesMaterial);
 
 
 
 
 
 
559
  const packetAuraMaterial = new THREE.MeshBasicMaterial({
560
- color: palette[0],
561
  transparent: true,
562
- opacity: 0.16,
563
  blending: THREE.AdditiveBlending,
564
  depthWrite: false,
565
  });
566
- const packetAura = new THREE.Mesh(new THREE.SphereGeometry(0.38, 18, 12), packetAuraMaterial);
567
- const packetBand = new THREE.Mesh(
568
- new THREE.BoxGeometry(0.372, 0.055, 0.292),
569
- basicMaterial(0xffffff, 0.94),
570
- );
571
- packetBand.position.y = 0.055;
572
  const packetGroup = new THREE.Group();
573
- packetGroup.add(packetAura, packet, packetEdges, packetBand);
574
- packetGroup.position.copy(stagePositions[0]);
 
575
  root.add(packetGroup);
576
 
577
  const trail = [];
578
  if (!lowPower) {
579
- for (let index = 0; index < 7; index += 1) {
580
- const material = new THREE.MeshBasicMaterial({
581
- color: palette[0],
582
- transparent: true,
583
- opacity: 0.22 * (1 - index / 8),
584
- depthWrite: false,
585
- });
586
- const point = new THREE.Mesh(new THREE.SphereGeometry(0.052 - index * 0.003, 10, 7), material);
 
 
587
  point.position.copy(packetGroup.position);
588
  trail.push(point);
589
  root.add(point);
@@ -591,35 +684,29 @@ if (container && hero) {
591
  }
592
 
593
  const retryPulse = new THREE.Mesh(
594
- new THREE.SphereGeometry(0.07, 14, 9),
595
- new THREE.MeshBasicMaterial({ color: 0x7c5ce0, transparent: true, opacity: 0.9, depthWrite: false }),
596
  );
597
  root.add(retryPulse);
598
- const exitPulse = new THREE.Mesh(new THREE.SphereGeometry(0.065, 14, 9), basicMaterial(0x16a36a, 0.9));
599
- const escalatePulse = new THREE.Mesh(new THREE.SphereGeometry(0.065, 14, 9), basicMaterial(0xd97706, 0.85));
600
- root.add(exitPulse, escalatePulse);
601
 
602
  let frameCount = 0;
603
  let animationFrame = 0;
604
  let visible = true;
 
605
  let targetRotationX = 0;
606
  let targetRotationY = 0;
607
- let layoutScaleX = 1;
608
- let layoutScaleY = 1;
609
- let stationLayoutScale = 1.12;
610
- let endpointLayoutScale = 1.08;
611
  let currentPacketColor = -1;
612
- let currentFlowStage = activeStage;
613
  const startedAt = performance.now();
614
  const targetPacketPosition = new THREE.Vector3();
 
615
 
616
  function setPacketColor(hex) {
617
  if (currentPacketColor === hex) return;
618
  currentPacketColor = hex;
619
  const color = new THREE.Color(hex);
620
- packetMaterial.color.copy(color).lerp(white, 0.28);
621
  packetMaterial.emissive.copy(color);
622
- packetEdgesMaterial.color.copy(color);
623
  packetAuraMaterial.color.copy(color);
624
  trail.forEach((point) => point.material.color.copy(color));
625
  }
@@ -640,92 +727,101 @@ if (container && hero) {
640
  function render(time = 0) {
641
  const seconds = Math.max(0, time - startedAt) * 0.001;
642
  const manual = reducedMotion.matches || performance.now() < manualSelectionUntil;
643
- let flowStage = activeStage;
644
 
645
  if (manual) {
646
- targetPacketPosition.copy(stagePositions[activeStage]);
 
647
  setPacketColor(palette[activeStage]);
 
648
  } else {
649
- const phase = (seconds * 0.062) % 1;
650
- if (phase < 0.76) {
651
- const progress = phase / 0.76;
652
  targetPacketPosition.copy(mainCurve.getPointAt(progress));
 
653
  flowStage = nearestStage(progress);
 
654
  setPacketColor(palette[flowStage]);
655
  } else {
656
- const progress = (phase - 0.76) / 0.24;
657
  targetPacketPosition.copy(retryCurve.getPointAt(progress));
658
- flowStage = progress > 0.84 ? 0 : 5;
659
- setPacketColor(progress > 0.84 ? palette[0] : 0x7c5ce0);
660
- }
661
-
662
- if (flowStage !== currentFlowStage) {
663
- currentFlowStage = flowStage;
664
- selectStage(flowStage);
665
  }
666
  }
667
 
668
- packetGroup.position.lerp(targetPacketPosition, reducedMotion.matches ? 1 : 0.16);
669
- packetGroup.rotation.x = seconds * 0.72;
670
- packetGroup.rotation.y = seconds * 0.94;
671
- const packetPulse = reducedMotion.matches ? 1 : 1 + Math.sin(seconds * 3.2) * 0.06;
 
672
  packetAura.scale.setScalar(packetPulse);
673
 
674
  let previous = packetGroup.position;
675
  trail.forEach((point, index) => {
676
- point.position.lerp(previous, 0.17 - index * 0.01);
677
  previous = point.position;
678
  });
679
 
680
  stationStates.forEach((state, index) => {
681
- const selected = index === activeStage;
682
  const packetDistance = state.group.position.distanceTo(packetGroup.position);
683
- const nearby = Math.max(0, 1 - packetDistance / 1.15);
684
- const scale = 1 + (selected ? 0.09 : 0) + nearby * 0.05;
685
- state.group.scale.setScalar(scale * stationLayoutScale);
686
- state.haloMaterial.opacity = selected ? 0.38 : 0.07 + nearby * 0.18;
687
- state.baseMaterial.emissiveIntensity = selected ? 0.17 : 0.035 + nearby * 0.08;
688
  state.materials.forEach((material) => {
689
- material.emissiveIntensity = selected ? Math.max(material.emissiveIntensity, 0.28) : 0.08 + nearby * 0.14;
 
690
  });
691
- state.label.material.opacity = selected ? 1 : 0.72;
692
  });
693
 
694
- incomingPacket.position.y = 0.88 - ((seconds * 0.42) % 1) * 0.34;
695
- incomingPacket.rotation.y = seconds * 0.8;
696
- delegateNodes.forEach((node, index) => {
697
- const pulse = reducedMotion.matches ? 1 : 1 + Math.sin(seconds * 2.1 + index * 1.7) * 0.1;
 
 
 
 
698
  node.scale.setScalar(pulse);
699
  });
700
- delegateHub.rotation.y = seconds * 0.6;
701
- actCore.rotation.x = seconds * 0.54;
702
- actCore.rotation.y = seconds * 0.76;
703
- scanner.position.y = reducedMotion.matches ? 0.08 : -0.2 + ((Math.sin(seconds * 1.7) + 1) * 0.27);
704
- const gatePulse = reducedMotion.matches ? 1 : 1 + Math.sin(seconds * 2.4) * 0.035;
705
- verifyRing.scale.setScalar(gatePulse);
706
- verifyAura.rotation.z = seconds * 0.16;
707
- verifyAuraMaterial.opacity = activeStage === 3 ? 0.34 : 0.12;
708
- evidenceDots.forEach((dot, index) => {
709
- const angle = seconds * 1.05 + index * (Math.PI * 2 / evidenceDots.length);
710
- dot.position.set(Math.cos(angle) * 0.68, 0.14 + Math.sin(angle) * 0.42, 0.02);
711
  });
712
- persistPlates.forEach((plate, index) => {
713
- plate.position.y = plate.userData.baseY + (reducedMotion.matches ? 0 : Math.sin(seconds * 1.4 + index * 0.65) * 0.012);
 
714
  });
715
- decisionCore.rotation.y = seconds * 0.5;
 
 
 
 
 
 
 
 
 
 
 
 
716
  decisionCore.rotation.z = Math.PI / 4 + seconds * 0.12;
717
- decisionRing.rotation.z = -seconds * 0.18;
718
-
719
- retryPulse.position.copy(retryCurve.getPointAt((seconds * 0.13 + 0.17) % 1));
720
- exitPulse.position.copy(exitCurve.getPointAt((seconds * 0.24) % 1));
721
- escalatePulse.position.copy(escalateCurve.getPointAt((seconds * 0.19 + 0.45) % 1));
722
- const outcomePulse = reducedMotion.matches ? 1 : 1 + Math.sin(seconds * 2) * 0.08;
723
- exitEndpoint.group.scale.setScalar(outcomePulse * endpointLayoutScale);
724
- escalateEndpoint.group.scale.setScalar((2 - outcomePulse) * endpointLayoutScale);
725
-
726
- root.rotation.x += (targetRotationX - root.rotation.x) * 0.045;
727
- root.rotation.y += (targetRotationY - root.rotation.y) * 0.045;
728
- root.scale.set(layoutScaleX, layoutScaleY, layoutScaleY);
729
  renderer.render(scene, camera);
730
  frameCount += 1;
731
  container.dataset.sceneFrames = String(frameCount);
@@ -751,36 +847,20 @@ if (container && hero) {
751
  animationFrame = 0;
752
  }
753
 
754
- function buildRetryCurve(compact) {
755
- if (compact) {
756
- return new THREE.CatmullRomCurve3([
757
- stagePositions[5],
758
- new THREE.Vector3(-0.82, 0.02, -0.58),
759
- new THREE.Vector3(-2.5, 0.32, -0.76),
760
- stagePositions[0],
761
- ], false, 'centripetal', 0.42);
762
- }
763
- return new THREE.CatmullRomCurve3([
764
- stagePositions[5],
765
- new THREE.Vector3(3.7, 1.48, -0.55),
766
- new THREE.Vector3(0.1, 1.88, -0.82),
767
- new THREE.Vector3(-3.85, 1.4, -0.52),
768
- stagePositions[0],
769
- ], false, 'centripetal', 0.45);
770
- }
771
-
772
- function applySemanticLayout(compact) {
773
  const positions = compact ? compactStagePositions : desktopStagePositions;
774
  positions.forEach((position, index) => {
775
  stagePositions[index].copy(position);
776
  stationStates[index].group.position.copy(position);
777
  });
778
 
779
- mainCurve = new THREE.CatmullRomCurve3(stagePositions, false, 'centripetal', 0.35);
780
- replaceTubeGeometry(mainTube, mainCurve, 0.032, 180);
781
- replaceTubeGeometry(mainGlow, mainCurve, 0.095, 150);
782
- mainArrows.forEach((arrow, index) => positionArrow(arrow, mainCurve, mainArrowTimes[index]));
783
  stageTimes = stagePositions.map(closestCurveTime);
 
 
784
 
785
  retryCurve = buildRetryCurve(compact);
786
  retryLine.geometry.dispose();
@@ -789,75 +869,45 @@ if (container && hero) {
789
  );
790
  retryLine.computeLineDistances();
791
  retryArrows.forEach((arrow, index) => {
792
- positionArrow(arrow, retryCurve, retryArrowTimes[index]);
793
- arrow.visible = !compact || index !== 1;
794
  });
795
-
796
- if (compact) {
797
- exitTarget.set(-1.32, -1.5, 0.08);
798
- escalateTarget.set(-2.35, -1.48, 0.12);
799
- exitCurve = new THREE.CatmullRomCurve3([
800
- stagePositions[5],
801
- new THREE.Vector3(-0.62, -1.08, 0.04),
802
- exitTarget,
803
- ], false, 'centripetal', 0.35);
804
- escalateCurve = new THREE.CatmullRomCurve3([
805
- stagePositions[5],
806
- new THREE.Vector3(-1.18, -1.16, 0.06),
807
- escalateTarget,
808
- ], false, 'centripetal', 0.35);
809
- } else {
810
- exitTarget.set(5.35, 0.75, 0.08);
811
- escalateTarget.set(5.35, -0.72, 0.12);
812
- exitCurve = new THREE.CatmullRomCurve3([
813
- stagePositions[5],
814
- new THREE.Vector3(4.72, 0.3, 0.04),
815
- exitTarget,
816
- ], false, 'centripetal', 0.35);
817
- escalateCurve = new THREE.CatmullRomCurve3([
818
- stagePositions[5],
819
- new THREE.Vector3(4.7, -0.28, 0.06),
820
- escalateTarget,
821
- ], false, 'centripetal', 0.35);
822
- }
823
- replaceTubeGeometry(exitTube, exitCurve, 0.022, 60);
824
- replaceTubeGeometry(escalateTube, escalateCurve, 0.022, 60);
825
- positionArrow(exitArrow, exitCurve, 0.68);
826
- positionArrow(escalateArrow, escalateCurve, 0.68);
827
- exitEndpoint.group.position.copy(exitTarget);
828
- escalateEndpoint.group.position.copy(escalateTarget);
829
  }
830
 
831
  function resize() {
832
  const width = Math.max(container.clientWidth, 1);
833
  const height = Math.max(container.clientHeight, 1);
834
- const mobile = window.innerWidth < 640;
835
- const narrow = window.innerWidth < 360;
836
- const tablet = !mobile && window.innerWidth < 920;
837
- applySemanticLayout(mobile);
838
- renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, mobile || lowPower ? 1.25 : 1.6));
839
  renderer.setSize(width, height, false);
840
- camera.aspect = width / height;
841
- camera.fov = mobile ? 31 : 28;
842
- camera.position.set(0, narrow ? 1.55 : mobile ? 1.5 : 3.25, narrow ? 7.35 : mobile ? 6.9 : 9.15);
843
- camera.lookAt(0, mobile ? 0.05 : 0.12, 0);
 
 
 
 
 
844
  camera.updateProjectionMatrix();
845
- layoutScaleX = mobile ? 1 : tablet ? 1.08 : 1.3;
846
- layoutScaleY = mobile ? 1 : tablet ? 1 : 1.06;
847
- stationLayoutScale = narrow ? 0.84 : mobile ? 0.86 : tablet ? 1.04 : 1.12;
848
- endpointLayoutScale = mobile ? 0.9 : 1.08;
849
- root.position.y = mobile ? 0.02 : -0.06;
850
- labels.forEach((label) => { label.visible = width >= 760; });
851
  numberLabels.forEach((label) => { label.visible = width < 760; });
 
852
  render(performance.now());
853
  }
854
 
855
  function updatePointer(event) {
 
856
  const bounds = hero.getBoundingClientRect();
857
  const x = (event.clientX - bounds.left) / bounds.width * 2 - 1;
858
  const y = (event.clientY - bounds.top) / bounds.height * 2 - 1;
859
- targetRotationY = x * 0.035;
860
- targetRotationX = -y * 0.018;
861
  }
862
 
863
  function resetPointer() {
@@ -934,13 +984,16 @@ if (container && hero) {
934
  }
935
  return {
936
  activeStage,
 
 
937
  drawCalls: renderer.info.render.calls,
 
938
  frameCount,
939
  height,
940
- labelsVisible: labels.some((label) => label.visible),
941
  luminanceRange: maximumLuminance - minimumLuminance,
942
  lowPower,
943
- outcomes: 3,
944
  painted,
945
  paintedRatio: sampled ? painted / sampled : 0,
946
  reducedMotion: reducedMotion.matches,
@@ -954,7 +1007,7 @@ if (container && hero) {
954
  window.__loopScenePause = () => {
955
  stopAnimation();
956
  manualSelectionUntil = performance.now() + 60000;
957
- packetGroup.position.copy(stagePositions[activeStage]);
958
  render(performance.now());
959
  return window.__loopSceneDiagnostics();
960
  };
 
5
  const stageButtons = Array.from(document.querySelectorAll('[data-loop-stage]'));
6
  const stageDetail = document.getElementById('loop-stage-detail');
7
  const stages = [
8
+ ['Intake:', 'turn a queue signal, event, schedule, or goal into one bounded work packet.'],
9
+ ['Delegate:', 'let an orchestrator route that packet to a specialist agent with explicit scope.'],
10
+ ['Act:', 'give the agent a controlled workspace, relevant context, and scoped tools.'],
11
+ ['Verify:', 'require evidence from tests, evals, traces, or independent review before progress.'],
12
+ ['Persist:', 'write receipts, memory, and progress to durable state outside the model.'],
13
+ ['Decide:', 'route the evidence to one bounded next action: retry, human escalation, or exit.'],
14
  ];
15
  let activeStage = 0;
16
  let manualSelectionUntil = 0;
 
54
  if (container && hero) {
55
  const reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)');
56
  const lowPower = Number(navigator.hardwareConcurrency || 8) <= 4;
57
+ const colors = {
58
+ work: 0x08a9c4,
59
+ orchestrator: 0x155eef,
60
+ agent: 0x2868df,
61
+ evidence: 0x0c9b68,
62
+ state: 0x7055d9,
63
+ decision: 0x4f46b8,
64
+ retry: 0x7055d9,
65
+ human: 0xd97706,
66
+ exit: 0x0c9b68,
67
+ ink: 0x172033,
68
+ line: 0xb8c4d6,
69
+ };
70
+ const palette = [
71
+ colors.work,
72
+ colors.orchestrator,
73
+ colors.agent,
74
+ colors.evidence,
75
+ colors.state,
76
+ colors.decision,
77
+ ];
78
  const paper = new THREE.Color(0xf7f9fc);
79
  const white = new THREE.Color(0xffffff);
80
  const yAxis = new THREE.Vector3(0, 1, 0);
81
+ const lineOffset = new THREE.Vector3(0, -0.08, -0.16);
82
  let renderer;
83
 
84
  try {
 
102
  container.appendChild(renderer.domElement);
103
 
104
  const scene = new THREE.Scene();
105
+ const camera = new THREE.OrthographicCamera(-6, 6, 2, -2, 0.1, 50);
106
+ camera.position.set(0, 2.6, 10);
107
+ camera.lookAt(0, 0, 0);
108
 
109
+ scene.add(new THREE.HemisphereLight(0xffffff, 0xc5d2e5, 2.4));
110
+ const keyLight = new THREE.DirectionalLight(0xffffff, 3.1);
111
  keyLight.position.set(-4, 6, 8);
112
  scene.add(keyLight);
113
+ const cyanLight = new THREE.PointLight(colors.work, 9, 12, 2);
114
+ cyanLight.position.set(-2.3, 1.5, 4.5);
 
115
  scene.add(cyanLight);
116
+ const greenLight = new THREE.PointLight(colors.evidence, 7, 10, 2);
117
+ greenLight.position.set(2.2, 1.1, 4.2);
 
118
  scene.add(greenLight);
119
 
120
  const root = new THREE.Group();
121
  scene.add(root);
122
 
123
+ function standardMaterial(hex, lighten = 0.48, options = {}) {
124
  const color = new THREE.Color(hex);
125
+ const material = new THREE.MeshStandardMaterial({
126
+ color: color.clone().lerp(white, Math.min(lighten, 0.64)),
 
127
  emissive: color,
128
+ emissiveIntensity: options.emissiveIntensity ?? 0.06,
129
+ metalness: options.metalness ?? 0.08,
130
+ roughness: options.roughness ?? 0.38,
131
  transparent: options.transparent ?? false,
132
  opacity: options.opacity ?? 1,
133
  depthWrite: options.depthWrite ?? true,
134
  });
135
+ material.userData.baseEmissiveIntensity = material.emissiveIntensity;
136
+ return material;
137
  }
138
 
139
  function basicMaterial(hex, opacity = 1) {
 
141
  color: hex,
142
  transparent: opacity < 1,
143
  opacity,
144
+ depthWrite: opacity >= 0.94,
145
  });
146
  }
147
 
 
152
  material,
153
  );
154
  cylinder.position.copy(start).add(end).multiplyScalar(0.5);
155
+ cylinder.quaternion.setFromUnitVectors(yAxis, direction.clone().normalize());
156
  return cylinder;
157
  }
158
 
159
+ function makeTextSprite(text, hex, options = {}) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  const canvas = document.createElement('canvas');
161
  canvas.width = 512;
162
+ canvas.height = 96;
163
  const context = canvas.getContext('2d');
 
164
  context.clearRect(0, 0, canvas.width, canvas.height);
165
+ context.fillStyle = `#${new THREE.Color(hex).getHexString()}`;
166
+ context.fillRect(22, 70, options.underlineWidth ?? 58, 5);
167
+ context.fillStyle = options.textColor || '#172033';
168
+ context.font = `${options.weight || 700} ${options.fontSize || 31}px Inter, Arial, sans-serif`;
169
+ context.textAlign = 'left';
 
 
 
 
170
  context.textBaseline = 'middle';
171
+ context.fillText(text, 22, 43);
 
172
  const texture = new THREE.CanvasTexture(canvas);
173
  texture.colorSpace = THREE.SRGBColorSpace;
174
  texture.minFilter = THREE.LinearFilter;
 
178
  depthTest: false,
179
  depthWrite: false,
180
  }));
181
+ sprite.scale.set(options.width || 1.52, options.height || 0.285, 1);
182
+ sprite.renderOrder = 30;
183
  return sprite;
184
  }
185
 
186
+ function makeNumberSprite(number, hex) {
187
  const canvas = document.createElement('canvas');
188
  canvas.width = 128;
189
  canvas.height = 128;
190
  const context = canvas.getContext('2d');
 
191
  context.beginPath();
192
+ context.arc(64, 64, 48, 0, Math.PI * 2);
193
+ context.fillStyle = '#f7f9fc';
194
  context.fill();
195
+ context.lineWidth = 8;
196
+ context.strokeStyle = `#${new THREE.Color(hex).getHexString()}`;
197
  context.stroke();
198
+ context.fillStyle = '#172033';
199
+ context.font = '700 50px Inter, Arial, sans-serif';
200
  context.textAlign = 'center';
201
  context.textBaseline = 'middle';
202
  context.fillText(String(number).padStart(2, '0'), 64, 67);
 
203
  const texture = new THREE.CanvasTexture(canvas);
204
  texture.colorSpace = THREE.SRGBColorSpace;
 
205
  const sprite = new THREE.Sprite(new THREE.SpriteMaterial({
206
  map: texture,
207
  transparent: true,
208
  depthTest: false,
209
  depthWrite: false,
210
  }));
211
+ sprite.scale.set(0.39, 0.39, 1);
212
+ sprite.renderOrder = 31;
213
  return sprite;
214
  }
215
 
216
+ function addTube(curve, radius, hex, opacity, segments = 160) {
217
+ const material = new THREE.MeshBasicMaterial({
218
+ color: hex,
219
+ transparent: opacity < 1,
220
+ opacity,
221
+ depthWrite: false,
222
+ });
223
+ const mesh = new THREE.Mesh(
224
+ new THREE.TubeGeometry(curve, lowPower ? Math.round(segments * 0.65) : segments, radius, 6, false),
225
+ material,
226
+ );
227
+ root.add(mesh);
228
+ return mesh;
229
+ }
230
+
231
+ function replaceTubeGeometry(mesh, curve, radius, segments) {
232
+ mesh.geometry.dispose();
233
+ mesh.geometry = new THREE.TubeGeometry(
234
+ curve,
235
+ lowPower ? Math.round(segments * 0.65) : segments,
236
+ radius,
237
+ 6,
238
+ false,
239
+ );
240
+ }
241
+
242
+ function addArrow(curve, time, hex, scale = 1) {
243
+ const arrow = new THREE.Mesh(
244
+ new THREE.ConeGeometry(0.055 * scale, 0.18 * scale, lowPower ? 10 : 16),
245
+ basicMaterial(hex, 0.86),
246
+ );
247
+ root.add(arrow);
248
+ positionArrow(arrow, curve, time);
249
+ return arrow;
250
+ }
251
+
252
+ function positionArrow(arrow, curve, time) {
253
+ const tangent = curve.getTangentAt(Math.min(0.999, time)).normalize();
254
+ arrow.position.copy(curve.getPointAt(time));
255
+ arrow.quaternion.setFromUnitVectors(yAxis, tangent);
256
+ }
257
+
258
  const desktopStagePositions = [
259
+ new THREE.Vector3(-4.55, 0, 0.06),
260
+ new THREE.Vector3(-2.72, 0, 0),
261
+ new THREE.Vector3(-0.7, 0, 0.06),
262
+ new THREE.Vector3(1.42, 0, 0),
263
+ new THREE.Vector3(3.2, 0, 0.06),
264
+ new THREE.Vector3(4.72, 0, 0),
265
  ];
266
  const compactStagePositions = [
267
+ new THREE.Vector3(-1.86, 0.94, 0.04),
268
+ new THREE.Vector3(0, 0.94, 0),
269
+ new THREE.Vector3(1.86, 0.94, 0.04),
270
+ new THREE.Vector3(1.86, -1.02, 0),
271
+ new THREE.Vector3(0, -1.02, 0.04),
272
+ new THREE.Vector3(-1.86, -1.02, 0),
273
  ];
274
  const stagePositions = desktopStagePositions.map((position) => position.clone());
275
+
276
+ function buildMainCurve() {
277
+ return new THREE.CatmullRomCurve3(
278
+ stagePositions.map((position) => position.clone().add(lineOffset)),
279
+ false,
280
+ 'centripetal',
281
+ 0.34,
282
+ );
283
+ }
284
+
285
+ function buildRetryCurve(compact) {
286
+ const start = stagePositions[5].clone().add(lineOffset);
287
+ const end = stagePositions[0].clone().add(lineOffset);
288
+ const controls = compact
289
+ ? [
290
+ start,
291
+ new THREE.Vector3(-2.36, -1.04, -0.5),
292
+ new THREE.Vector3(-2.36, 0.94, -0.5),
293
+ end,
294
+ ]
295
+ : [
296
+ start,
297
+ new THREE.Vector3(3.55, 1.12, -0.62),
298
+ new THREE.Vector3(0, 1.3, -0.72),
299
+ new THREE.Vector3(-3.5, 1.12, -0.62),
300
+ end,
301
+ ];
302
+ return new THREE.CatmullRomCurve3(controls, false, 'centripetal', 0.42);
303
+ }
304
+
305
+ let compactLayout = false;
306
+ let mainCurve = buildMainCurve();
307
+ let retryCurve = buildRetryCurve(false);
308
+ const mainTube = addTube(mainCurve, 0.026, colors.orchestrator, 0.78, 180);
309
+ const mainGlow = addTube(mainCurve, 0.072, colors.work, 0.08, 160);
310
+ const retryLine = new THREE.Line(
311
+ new THREE.BufferGeometry().setFromPoints(retryCurve.getPoints(lowPower ? 90 : 160)),
312
+ new THREE.LineDashedMaterial({
313
+ color: colors.retry,
314
+ transparent: true,
315
+ opacity: 0.58,
316
+ dashSize: 0.12,
317
+ gapSize: 0.09,
318
+ depthWrite: false,
319
+ }),
320
+ );
321
+ retryLine.computeLineDistances();
322
+ root.add(retryLine);
323
 
324
  function closestCurveTime(position) {
325
+ const target = position.clone().add(lineOffset);
326
  let closestTime = 0;
327
  let closestDistance = Infinity;
328
+ for (let sample = 0; sample <= 200; sample += 1) {
329
+ const time = sample / 200;
330
+ const distance = mainCurve.getPointAt(time).distanceToSquared(target);
331
  if (distance < closestDistance) {
332
  closestDistance = distance;
333
  closestTime = time;
 
337
  }
338
 
339
  let stageTimes = stagePositions.map(closestCurveTime);
340
+ let arrowTimes = stageTimes.slice(0, -1).map((time, index) => (time + stageTimes[index + 1]) / 2);
341
+ const mainArrows = arrowTimes.map((time, index) => addArrow(mainCurve, time, palette[index + 1], 0.92));
342
+ const retryArrows = [0.28, 0.55, 0.8].map((time) => addArrow(retryCurve, time, colors.retry, 0.84));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
343
 
344
  const stationStates = [];
345
+ const stationLabels = [];
346
  const numberLabels = [];
347
+ const microLabels = [];
348
 
349
+ function createStation(index, label, hex) {
 
350
  const group = new THREE.Group();
351
  group.position.copy(stagePositions[index]);
352
  root.add(group);
353
 
354
  const haloMaterial = new THREE.MeshBasicMaterial({
355
+ color: hex,
356
  transparent: true,
357
+ opacity: 0.11,
358
  blending: THREE.AdditiveBlending,
359
  depthWrite: false,
360
  });
361
  const halo = new THREE.Mesh(
362
+ new THREE.TorusGeometry(0.57, 0.023, 8, lowPower ? 28 : 48),
363
  haloMaterial,
364
  );
365
  halo.rotation.x = Math.PI / 2;
366
+ halo.position.y = -0.43;
367
  group.add(halo);
368
 
369
+ const baseMaterial = standardMaterial(hex, 0.62, { roughness: 0.58, emissiveIntensity: 0.025 });
370
  const base = new THREE.Mesh(
371
+ new THREE.CylinderGeometry(0.48, 0.56, 0.07, lowPower ? 20 : 32),
372
  baseMaterial,
373
  );
374
+ base.position.y = -0.42;
375
  group.add(base);
376
 
377
+ const title = makeTextSprite(label, hex);
378
+ title.position.set(-0.03, 0.98, 0.08);
379
+ group.add(title);
380
+ stationLabels.push(title);
381
 
382
+ const number = makeNumberSprite(index + 1, hex);
383
+ number.position.set(0.43, 0.67, 0.28);
384
+ group.add(number);
385
+ numberLabels.push(number);
386
 
387
+ const state = {
388
+ baseMaterial,
389
+ group,
390
+ haloMaterial,
391
+ materials: [],
392
+ title,
393
+ };
394
  stationStates.push(state);
395
  return state;
396
  }
 
400
  return material;
401
  }
402
 
403
+ function addMicroLabel(group, text, hex, position, width = 0.72) {
404
+ const label = makeTextSprite(text, hex, {
405
+ width,
406
+ height: 0.18,
407
+ fontSize: 38,
408
+ weight: 700,
409
+ underlineWidth: 28,
410
+ });
411
+ label.position.copy(position);
412
+ group.add(label);
413
+ microLabels.push(label);
414
+ return label;
415
+ }
416
+
417
+ const intake = createStation(0, 'WORK QUEUE', colors.work);
418
+ const queueCards = [];
419
+ for (let index = 0; index < 3; index += 1) {
420
+ const card = new THREE.Group();
421
+ const bodyMaterial = track(intake, standardMaterial(colors.work, 0.8 - index * 0.08, {
422
+ emissiveIntensity: 0.04,
423
+ roughness: 0.54,
424
+ }));
425
+ const body = new THREE.Mesh(new THREE.BoxGeometry(0.58, 0.34, 0.08), bodyMaterial);
426
+ card.add(body);
427
+ const header = new THREE.Mesh(new THREE.BoxGeometry(0.52, 0.055, 0.018), basicMaterial(colors.work, 0.8));
428
+ header.position.set(0, 0.1, 0.05);
429
+ card.add(header);
430
+ [0.01, -0.065].forEach((y, lineIndex) => {
431
+ const line = new THREE.Mesh(
432
+ new THREE.BoxGeometry(lineIndex ? 0.28 : 0.4, 0.025, 0.016),
433
+ basicMaterial(0x8da0ba, 0.72),
434
+ );
435
+ line.position.set(-0.05, y, 0.052);
436
+ card.add(line);
437
+ });
438
+ card.position.set(-0.12 + index * 0.12, -0.16 + index * 0.16, -index * 0.08);
439
+ card.rotation.z = -0.06 + index * 0.03;
440
+ intake.group.add(card);
441
+ queueCards.push(card);
442
+ }
443
+ addMicroLabel(intake.group, 'GOAL / EVENT / QUEUE', colors.work, new THREE.Vector3(-0.05, -0.68, 0.18), 1.02);
444
+
445
+ const delegate = createStation(1, 'ORCHESTRATOR', colors.orchestrator);
446
+ const orchestratorCoreMaterial = track(delegate, standardMaterial(colors.orchestrator, 0.34, {
447
+ emissiveIntensity: 0.34,
448
+ roughness: 0.26,
449
+ }));
450
+ const orchestratorCore = new THREE.Mesh(
451
+ new THREE.DodecahedronGeometry(0.22, 1),
452
+ orchestratorCoreMaterial,
453
+ );
454
+ orchestratorCore.position.y = 0.08;
455
+ delegate.group.add(orchestratorCore);
456
+ const orchestratorRingMaterial = new THREE.MeshBasicMaterial({
457
+ color: colors.orchestrator,
458
+ transparent: true,
459
+ opacity: 0.48,
460
+ depthWrite: false,
461
  });
462
+ const orchestratorRing = new THREE.Mesh(
463
+ new THREE.TorusGeometry(0.42, 0.026, 10, lowPower ? 36 : 56),
464
+ orchestratorRingMaterial,
 
465
  );
466
+ orchestratorRing.position.copy(orchestratorCore.position);
467
+ delegate.group.add(orchestratorRing);
468
+ const routerNodePositions = [
469
+ new THREE.Vector3(-0.4, 0.48, 0.02),
470
+ new THREE.Vector3(0.4, 0.48, 0.02),
471
+ new THREE.Vector3(0, -0.24, 0.06),
472
+ ];
473
+ const routerNodes = routerNodePositions.map((position, index) => {
474
+ const material = track(delegate, standardMaterial([colors.work, colors.agent, colors.evidence][index], 0.42, {
475
+ emissiveIntensity: 0.18,
476
+ }));
477
+ const node = new THREE.Mesh(new THREE.SphereGeometry(0.1, 18, 12), material);
 
 
 
 
 
 
 
478
  node.position.copy(position);
 
479
  delegate.group.add(node);
480
  delegate.group.add(cylinderBetween(
481
+ orchestratorCore.position,
482
  position,
483
+ 0.012,
484
+ basicMaterial([colors.work, colors.agent, colors.evidence][index], 0.62),
485
  ));
486
  return node;
487
  });
488
+ addMicroLabel(delegate.group, 'ROUTES SCOPE + ROLE', colors.orchestrator, new THREE.Vector3(-0.03, -0.68, 0.18), 0.98);
489
 
490
+ const act = createStation(2, 'AGENT TEAM', colors.agent);
491
+ const workspaceGeometry = new THREE.BoxGeometry(1.08, 0.72, 0.54);
492
+ const workspace = new THREE.LineSegments(
493
+ new THREE.EdgesGeometry(workspaceGeometry),
494
+ new THREE.LineBasicMaterial({ color: colors.agent, transparent: true, opacity: 0.42 }),
495
  );
496
+ workspace.position.y = 0.06;
497
+ act.group.add(workspace);
498
+ const workspaceFloor = new THREE.Mesh(
499
+ new THREE.BoxGeometry(1.02, 0.035, 0.5),
500
+ track(act, standardMaterial(colors.agent, 0.78, { transparent: true, opacity: 0.72, depthWrite: false })),
501
+ );
502
+ workspaceFloor.position.y = -0.29;
503
+ act.group.add(workspaceFloor);
504
+ const roleNames = ['PLAN', 'BUILD', 'REVIEW'];
505
+ const roleColors = [colors.work, colors.agent, colors.evidence];
506
+ const agentPods = roleNames.map((role, index) => {
507
+ const pod = new THREE.Group();
508
+ pod.userData.role = role;
509
+ pod.position.set((index - 1) * 0.34, -0.04 + (index === 1 ? 0.04 : 0), 0.05);
510
+ const material = track(act, standardMaterial(roleColors[index], 0.4, { emissiveIntensity: 0.18 }));
511
+ const body = new THREE.Mesh(new THREE.CylinderGeometry(0.105, 0.13, 0.22, 16), material);
512
+ body.position.y = 0.05;
513
+ const head = new THREE.Mesh(new THREE.SphereGeometry(0.11, 18, 12), material);
514
+ head.position.y = 0.25;
515
+ const visor = new THREE.Mesh(new THREE.BoxGeometry(0.13, 0.035, 0.035), basicMaterial(0x172033, 0.86));
516
+ visor.position.set(0, 0.26, 0.1);
517
+ const base = new THREE.Mesh(new THREE.CylinderGeometry(0.16, 0.19, 0.035, 18), basicMaterial(roleColors[index], 0.42));
518
+ base.position.y = -0.09;
519
+ pod.add(body, head, visor, base);
520
+ act.group.add(pod);
521
+ return pod;
522
+ });
523
+ addMicroLabel(act.group, 'PLAN / BUILD / REVIEW', colors.agent, new THREE.Vector3(-0.04, -0.68, 0.2), 1.02);
524
+ const contextChips = roleColors.map((hex, index) => {
525
+ const chip = new THREE.Mesh(
526
+ new THREE.BoxGeometry(0.17, 0.11, 0.035),
527
+ track(act, standardMaterial(hex, 0.66, { emissiveIntensity: 0.12 })),
528
+ );
529
+ chip.position.set((index - 1) * 0.32, 0.56 + (index % 2) * 0.05, 0.02);
530
+ act.group.add(chip);
531
+ return chip;
532
+ });
533
+
534
+ const verify = createStation(3, 'EVIDENCE GATE', colors.evidence);
535
+ const gateMaterial = track(verify, standardMaterial(colors.evidence, 0.45, { emissiveIntensity: 0.18 }));
536
+ [-0.36, 0.36].forEach((x) => {
537
+ const post = new THREE.Mesh(new THREE.BoxGeometry(0.11, 0.75, 0.16), gateMaterial);
538
+ post.position.set(x, -0.02, 0);
539
+ verify.group.add(post);
540
+ });
541
+ const gateTop = new THREE.Mesh(new THREE.BoxGeometry(0.83, 0.11, 0.16), gateMaterial);
542
+ gateTop.position.set(0, 0.36, 0);
543
+ verify.group.add(gateTop);
544
  const scannerMaterial = new THREE.MeshBasicMaterial({
545
+ color: colors.evidence,
546
  transparent: true,
547
  opacity: 0.22,
548
  blending: THREE.AdditiveBlending,
549
  depthWrite: false,
550
  });
551
+ const scanner = new THREE.Mesh(new THREE.BoxGeometry(0.62, 0.025, 0.34), scannerMaterial);
552
+ scanner.position.set(0, -0.22, 0.02);
553
+ verify.group.add(scanner);
554
+ const checkMaterial = track(verify, standardMaterial(colors.evidence, 0.18, { emissiveIntensity: 0.62 }));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
555
  verify.group.add(cylinderBetween(
556
+ new THREE.Vector3(-0.19, -0.01, 0.12),
557
+ new THREE.Vector3(-0.04, -0.16, 0.12),
558
+ 0.036,
559
  checkMaterial,
560
+ 14,
561
  ));
562
  verify.group.add(cylinderBetween(
563
+ new THREE.Vector3(-0.04, -0.16, 0.12),
564
+ new THREE.Vector3(0.24, 0.16, 0.12),
565
+ 0.036,
566
  checkMaterial,
567
+ 14,
568
  ));
569
+ const evidenceTokens = [0, 1, 2].map((index) => {
570
+ const token = new THREE.Mesh(
571
+ new THREE.SphereGeometry(0.045, 12, 8),
572
+ basicMaterial(index === 1 ? colors.evidence : colors.work, 0.88),
573
  );
574
+ verify.group.add(token);
575
+ return token;
576
  });
577
+ addMicroLabel(verify.group, 'TESTS / EVALS / TRACES', colors.evidence, new THREE.Vector3(-0.05, -0.68, 0.18), 1.05);
578
 
579
+ const persist = createStation(4, 'STATE LEDGER', colors.state);
580
+ const stateLayers = [0, 1, 2].map((index) => {
581
+ const material = track(persist, standardMaterial(index === 1 ? colors.orchestrator : colors.state, 0.53, {
582
+ emissiveIntensity: 0.12,
583
+ roughness: 0.42,
584
+ }));
585
+ const layer = new THREE.Mesh(
586
+ new THREE.CylinderGeometry(0.4, 0.4, 0.115, lowPower ? 22 : 34),
587
+ material,
588
+ );
589
+ layer.position.set(0, -0.2 + index * 0.18, 0);
590
+ persist.group.add(layer);
591
+ return layer;
592
  });
593
+ const receiptCards = [-0.24, 0, 0.24].map((x, index) => {
594
+ const receipt = new THREE.Group();
595
+ const body = new THREE.Mesh(
596
+ new THREE.BoxGeometry(0.15, 0.22, 0.05),
597
+ track(persist, standardMaterial(colors.state, 0.78, { emissiveIntensity: 0.08 })),
598
+ );
599
+ const mark = new THREE.Mesh(new THREE.BoxGeometry(0.1, 0.03, 0.012), basicMaterial(colors.evidence, 0.82));
600
+ mark.position.set(0, 0.06, 0.035);
601
+ receipt.add(body, mark);
602
+ receipt.position.set(x, 0.48 + index * 0.035, 0.02);
603
+ receipt.userData.baseY = receipt.position.y;
604
  persist.group.add(receipt);
605
+ return receipt;
606
  });
607
+ addMicroLabel(persist.group, 'RECEIPTS + MEMORY', colors.state, new THREE.Vector3(-0.04, -0.68, 0.18), 0.92);
608
+
609
+ const decide = createStation(5, 'NEXT ACTION', colors.decision);
610
+ const decisionCoreMaterial = track(decide, standardMaterial(colors.decision, 0.35, {
611
+ emissiveIntensity: 0.3,
612
+ roughness: 0.28,
613
+ }));
614
+ const decisionCore = new THREE.Mesh(new THREE.OctahedronGeometry(0.22, 0), decisionCoreMaterial);
615
+ decisionCore.position.y = 0.08;
616
  decide.group.add(decisionCore);
617
+ const decisionRing = new THREE.Mesh(
618
+ new THREE.TorusGeometry(0.33, 0.022, 8, 44),
619
+ new THREE.MeshBasicMaterial({ color: colors.decision, transparent: true, opacity: 0.42, depthWrite: false }),
620
+ );
 
 
 
621
  decisionRing.position.copy(decisionCore.position);
622
  decide.group.add(decisionRing);
623
+ const outcomeSpecs = [
624
+ { label: 'RETRY', color: colors.retry, position: new THREE.Vector3(-0.43, 0.5, 0.02), shape: 'ring' },
625
+ { label: 'EXIT', color: colors.exit, position: new THREE.Vector3(0.43, 0.5, 0.02), shape: 'ring' },
626
+ { label: 'HUMAN', color: colors.human, position: new THREE.Vector3(0, -0.31, 0.04), shape: 'diamond' },
627
+ ];
628
+ const outcomeNodes = outcomeSpecs.map((spec) => {
629
+ decide.group.add(cylinderBetween(
630
+ decisionCore.position,
631
+ spec.position,
632
+ 0.012,
633
+ basicMaterial(spec.color, 0.72),
634
+ ));
635
+ const material = track(decide, standardMaterial(spec.color, 0.36, { emissiveIntensity: 0.3 }));
636
+ const mesh = spec.shape === 'ring'
637
+ ? new THREE.Mesh(new THREE.TorusGeometry(0.11, 0.03, 8, 28), material)
638
+ : new THREE.Mesh(new THREE.OctahedronGeometry(0.11, 0), material);
639
+ mesh.userData.outcome = spec.label;
640
+ mesh.position.copy(spec.position);
641
+ decide.group.add(mesh);
642
+ return mesh;
643
+ });
644
+ addMicroLabel(decide.group, 'RETRY / HUMAN / EXIT', colors.decision, new THREE.Vector3(-0.04, -0.68, 0.16), 0.98);
645
+
646
+ const packetMaterial = standardMaterial(colors.work, 0.3, { emissiveIntensity: 0.46, roughness: 0.2 });
647
+ const packetBody = new THREE.Mesh(new THREE.BoxGeometry(0.38, 0.25, 0.075), packetMaterial);
648
+ const packetHeader = new THREE.Mesh(new THREE.BoxGeometry(0.33, 0.052, 0.018), basicMaterial(0xffffff, 0.96));
649
+ packetHeader.position.set(0, 0.071, 0.047);
650
+ const packetLine = new THREE.Mesh(new THREE.BoxGeometry(0.23, 0.027, 0.016), basicMaterial(0xd8e2f1, 0.92));
651
+ packetLine.position.set(-0.03, -0.03, 0.048);
652
+ const packetMarker = new THREE.Mesh(new THREE.BoxGeometry(0.052, 0.052, 0.02), basicMaterial(colors.evidence, 0.9));
653
+ packetMarker.position.set(0.13, -0.035, 0.052);
654
  const packetAuraMaterial = new THREE.MeshBasicMaterial({
655
+ color: colors.work,
656
  transparent: true,
657
+ opacity: 0.14,
658
  blending: THREE.AdditiveBlending,
659
  depthWrite: false,
660
  });
661
+ const packetAura = new THREE.Mesh(new THREE.SphereGeometry(0.31, 16, 10), packetAuraMaterial);
 
 
 
 
 
662
  const packetGroup = new THREE.Group();
663
+ packetGroup.add(packetAura, packetBody, packetHeader, packetLine, packetMarker);
664
+ packetGroup.position.copy(mainCurve.getPointAt(0));
665
+ packetGroup.position.z = 0.42;
666
  root.add(packetGroup);
667
 
668
  const trail = [];
669
  if (!lowPower) {
670
+ for (let index = 0; index < 6; index += 1) {
671
+ const point = new THREE.Mesh(
672
+ new THREE.SphereGeometry(0.042 - index * 0.003, 9, 6),
673
+ new THREE.MeshBasicMaterial({
674
+ color: colors.work,
675
+ transparent: true,
676
+ opacity: 0.18 * (1 - index / 7),
677
+ depthWrite: false,
678
+ }),
679
+ );
680
  point.position.copy(packetGroup.position);
681
  trail.push(point);
682
  root.add(point);
 
684
  }
685
 
686
  const retryPulse = new THREE.Mesh(
687
+ new THREE.SphereGeometry(0.06, 12, 8),
688
+ basicMaterial(colors.retry, 0.9),
689
  );
690
  root.add(retryPulse);
 
 
 
691
 
692
  let frameCount = 0;
693
  let animationFrame = 0;
694
  let visible = true;
695
+ let flowStage = 0;
696
  let targetRotationX = 0;
697
  let targetRotationY = 0;
698
+ let stationScale = 1;
 
 
 
699
  let currentPacketColor = -1;
 
700
  const startedAt = performance.now();
701
  const targetPacketPosition = new THREE.Vector3();
702
+ const targetPacketTangent = new THREE.Vector3(1, 0, 0);
703
 
704
  function setPacketColor(hex) {
705
  if (currentPacketColor === hex) return;
706
  currentPacketColor = hex;
707
  const color = new THREE.Color(hex);
708
+ packetMaterial.color.copy(color).lerp(white, 0.3);
709
  packetMaterial.emissive.copy(color);
 
710
  packetAuraMaterial.color.copy(color);
711
  trail.forEach((point) => point.material.color.copy(color));
712
  }
 
727
  function render(time = 0) {
728
  const seconds = Math.max(0, time - startedAt) * 0.001;
729
  const manual = reducedMotion.matches || performance.now() < manualSelectionUntil;
730
+ let visualStage = activeStage;
731
 
732
  if (manual) {
733
+ targetPacketPosition.copy(stagePositions[activeStage]).add(lineOffset);
734
+ targetPacketTangent.set(1, 0, 0);
735
  setPacketColor(palette[activeStage]);
736
+ visualStage = activeStage;
737
  } else {
738
+ const phase = (seconds * 0.055) % 1;
739
+ if (phase < 0.8) {
740
+ const progress = phase / 0.8;
741
  targetPacketPosition.copy(mainCurve.getPointAt(progress));
742
+ targetPacketTangent.copy(mainCurve.getTangentAt(Math.min(progress, 0.999)));
743
  flowStage = nearestStage(progress);
744
+ visualStage = flowStage;
745
  setPacketColor(palette[flowStage]);
746
  } else {
747
+ const progress = (phase - 0.8) / 0.2;
748
  targetPacketPosition.copy(retryCurve.getPointAt(progress));
749
+ targetPacketTangent.copy(retryCurve.getTangentAt(Math.min(progress, 0.999)));
750
+ flowStage = progress > 0.86 ? 0 : 5;
751
+ visualStage = flowStage;
752
+ setPacketColor(progress > 0.86 ? colors.work : colors.retry);
 
 
 
753
  }
754
  }
755
 
756
+ targetPacketPosition.z = 0.42;
757
+ packetGroup.position.lerp(targetPacketPosition, reducedMotion.matches ? 1 : 0.18);
758
+ const targetAngle = Math.atan2(targetPacketTangent.y, targetPacketTangent.x);
759
+ packetGroup.rotation.z += (targetAngle - packetGroup.rotation.z) * 0.12;
760
+ const packetPulse = reducedMotion.matches ? 1 : 1 + Math.sin(seconds * 3.1) * 0.055;
761
  packetAura.scale.setScalar(packetPulse);
762
 
763
  let previous = packetGroup.position;
764
  trail.forEach((point, index) => {
765
+ point.position.lerp(previous, 0.18 - index * 0.012);
766
  previous = point.position;
767
  });
768
 
769
  stationStates.forEach((state, index) => {
770
+ const selected = index === visualStage;
771
  const packetDistance = state.group.position.distanceTo(packetGroup.position);
772
+ const nearby = Math.max(0, 1 - packetDistance / 1.2);
773
+ const scale = stationScale * (1 + (selected ? 0.075 : 0) + nearby * 0.025);
774
+ state.group.scale.setScalar(scale);
775
+ state.haloMaterial.opacity = selected ? 0.32 : 0.07 + nearby * 0.12;
776
+ state.baseMaterial.emissiveIntensity = selected ? 0.14 : 0.025 + nearby * 0.05;
777
  state.materials.forEach((material) => {
778
+ const base = material.userData.baseEmissiveIntensity || 0;
779
+ material.emissiveIntensity = base + (selected ? 0.18 : nearby * 0.08);
780
  });
781
+ state.title.material.opacity = selected ? 1 : 0.76;
782
  });
783
 
784
+ queueCards.forEach((card, index) => {
785
+ card.position.y = -0.16 + index * 0.16 + (reducedMotion.matches ? 0 : Math.sin(seconds * 1.25 + index) * 0.012);
786
+ });
787
+ orchestratorCore.rotation.x = seconds * 0.38;
788
+ orchestratorCore.rotation.y = seconds * 0.58;
789
+ orchestratorRing.rotation.z = -seconds * 0.22;
790
+ routerNodes.forEach((node, index) => {
791
+ const pulse = reducedMotion.matches ? 1 : 1 + Math.sin(seconds * 2 + index * 1.8) * 0.08;
792
  node.scale.setScalar(pulse);
793
  });
794
+ agentPods.forEach((pod, index) => {
795
+ const working = reducedMotion.matches ? 0 : Math.sin(seconds * 1.8 + index * 1.6) * 0.025;
796
+ pod.position.y = -0.04 + (index === 1 ? 0.04 : 0) + working;
 
 
 
 
 
 
 
 
797
  });
798
+ contextChips.forEach((chip, index) => {
799
+ chip.position.y = 0.56 + (index % 2) * 0.05 + (reducedMotion.matches ? 0 : Math.sin(seconds * 1.4 + index) * 0.04);
800
+ chip.rotation.y = seconds * 0.25 + index * 0.5;
801
  });
802
+ scanner.position.y = reducedMotion.matches ? 0.02 : -0.22 + ((Math.sin(seconds * 1.65) + 1) * 0.22);
803
+ scannerMaterial.opacity = visualStage === 3 ? 0.4 : 0.2;
804
+ evidenceTokens.forEach((token, index) => {
805
+ const angle = seconds * 1.1 + index * (Math.PI * 2 / evidenceTokens.length);
806
+ token.position.set(Math.cos(angle) * 0.5, 0.02 + Math.sin(angle) * 0.35, 0.08);
807
+ });
808
+ stateLayers.forEach((layer, index) => {
809
+ layer.rotation.y = seconds * (index % 2 ? -0.08 : 0.08);
810
+ });
811
+ receiptCards.forEach((receipt, index) => {
812
+ receipt.position.y = receipt.userData.baseY + (reducedMotion.matches ? 0 : Math.sin(seconds * 1.35 + index * 0.7) * 0.018);
813
+ });
814
+ decisionCore.rotation.y = seconds * 0.52;
815
  decisionCore.rotation.z = Math.PI / 4 + seconds * 0.12;
816
+ decisionRing.rotation.z = -seconds * 0.2;
817
+ outcomeNodes.forEach((node, index) => {
818
+ const pulse = reducedMotion.matches ? 1 : 1 + Math.sin(seconds * 1.8 + index * 1.9) * 0.07;
819
+ node.scale.setScalar(pulse);
820
+ });
821
+ retryPulse.position.copy(retryCurve.getPointAt((seconds * 0.12 + 0.2) % 1));
822
+
823
+ root.rotation.x += (targetRotationX - root.rotation.x) * 0.04;
824
+ root.rotation.y += (targetRotationY - root.rotation.y) * 0.04;
 
 
 
825
  renderer.render(scene, camera);
826
  frameCount += 1;
827
  container.dataset.sceneFrames = String(frameCount);
 
847
  animationFrame = 0;
848
  }
849
 
850
+ function applyLayout(compact) {
851
+ compactLayout = compact;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
852
  const positions = compact ? compactStagePositions : desktopStagePositions;
853
  positions.forEach((position, index) => {
854
  stagePositions[index].copy(position);
855
  stationStates[index].group.position.copy(position);
856
  });
857
 
858
+ mainCurve = buildMainCurve();
859
+ replaceTubeGeometry(mainTube, mainCurve, 0.026, 180);
860
+ replaceTubeGeometry(mainGlow, mainCurve, 0.072, 160);
 
861
  stageTimes = stagePositions.map(closestCurveTime);
862
+ arrowTimes = stageTimes.slice(0, -1).map((time, index) => (time + stageTimes[index + 1]) / 2);
863
+ mainArrows.forEach((arrow, index) => positionArrow(arrow, mainCurve, arrowTimes[index]));
864
 
865
  retryCurve = buildRetryCurve(compact);
866
  retryLine.geometry.dispose();
 
869
  );
870
  retryLine.computeLineDistances();
871
  retryArrows.forEach((arrow, index) => {
872
+ positionArrow(arrow, retryCurve, [0.28, 0.55, 0.8][index]);
873
+ arrow.visible = !compact || index === 1;
874
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
875
  }
876
 
877
  function resize() {
878
  const width = Math.max(container.clientWidth, 1);
879
  const height = Math.max(container.clientHeight, 1);
880
+ const compact = width < 620;
881
+ const tablet = !compact && width < 900;
882
+ applyLayout(compact);
883
+ renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, compact || lowPower ? 1.3 : 1.65));
 
884
  renderer.setSize(width, height, false);
885
+
886
+ const viewHeight = compact ? 3.9 : tablet ? 3.45 : 3.15;
887
+ const viewWidth = viewHeight * (width / height);
888
+ camera.left = -viewWidth / 2;
889
+ camera.right = viewWidth / 2;
890
+ camera.top = viewHeight / 2;
891
+ camera.bottom = -viewHeight / 2;
892
+ camera.position.set(0, compact ? 2.05 : 2.6, 10);
893
+ camera.lookAt(0, compact ? -0.05 : 0, 0);
894
  camera.updateProjectionMatrix();
895
+
896
+ stationScale = compact ? 0.93 : tablet ? 0.92 : 1.04;
897
+ packetGroup.scale.setScalar(compact ? 1.08 : 1);
898
+ stationLabels.forEach((label) => { label.visible = width >= 760; });
 
 
899
  numberLabels.forEach((label) => { label.visible = width < 760; });
900
+ microLabels.forEach((label) => { label.visible = width >= 980; });
901
  render(performance.now());
902
  }
903
 
904
  function updatePointer(event) {
905
+ if (compactLayout) return;
906
  const bounds = hero.getBoundingClientRect();
907
  const x = (event.clientX - bounds.left) / bounds.width * 2 - 1;
908
  const y = (event.clientY - bounds.top) / bounds.height * 2 - 1;
909
+ targetRotationY = x * 0.028;
910
+ targetRotationX = -y * 0.014;
911
  }
912
 
913
  function resetPointer() {
 
984
  }
985
  return {
986
  activeStage,
987
+ agentRoles: roleNames.length,
988
+ compactLayout,
989
  drawCalls: renderer.info.render.calls,
990
+ flowStage,
991
  frameCount,
992
  height,
993
+ labelsVisible: stationLabels.some((label) => label.visible),
994
  luminanceRange: maximumLuminance - minimumLuminance,
995
  lowPower,
996
+ outcomes: outcomeNodes.length,
997
  painted,
998
  paintedRatio: sampled ? painted / sampled : 0,
999
  reducedMotion: reducedMotion.matches,
 
1007
  window.__loopScenePause = () => {
1008
  stopAnimation();
1009
  manualSelectionUntil = performance.now() + 60000;
1010
+ packetGroup.position.copy(stagePositions[activeStage]).add(lineOffset);
1011
  render(performance.now());
1012
  return window.__loopSceneDiagnostics();
1013
  };
docs/index.html CHANGED
@@ -187,7 +187,7 @@
187
  z-index: 0;
188
  min-width: 0;
189
  width: 100%;
190
- height: 292px;
191
  overflow: hidden;
192
  pointer-events: none;
193
  }
@@ -195,6 +195,28 @@
195
  .scene-fallback { display: none; align-items: center; justify-content: center; height: 100%; color: var(--muted); font-size: 0.82rem; }
196
  .hero-scene[data-scene-state="fallback"] canvas { display: none; }
197
  .hero-scene[data-scene-state="fallback"] .scene-fallback { display: flex; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  .scene-outcomes {
199
  display: flex;
200
  align-items: center;
@@ -525,7 +547,7 @@
525
  .resource-meta { margin-top: 7px; color: var(--quiet); font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 0.68rem; overflow-wrap: anywhere; }
526
  .resource-cell-label { display: none; margin-bottom: 5px; color: var(--quiet); font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 0.62rem; font-weight: 650; text-transform: uppercase; }
527
  .resource-year-value { color: var(--ink); font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 0.9rem; font-weight: 700; }
528
- .resource-year-value.undated { color: var(--quiet); font-weight: 500; }
529
  .resource-venue { display: block; color: var(--ink); font-size: 0.82rem; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
530
  .resource-publisher, .resource-date, .resource-identifier { display: block; margin-top: 4px; color: var(--quiet); font-size: 0.72rem; line-height: 1.4; overflow-wrap: anywhere; }
531
  .resource-type-label { display: block; color: var(--ink); font-size: 0.78rem; font-weight: 700; }
@@ -595,7 +617,7 @@
595
  width: 100%;
596
  margin-top: 28px;
597
  }
598
- .hero-scene { height: 268px; }
599
  .hero-inspector { grid-template-columns: 1fr; gap: 12px; padding: 14px 0; }
600
  .hero-system .loop-stage-rail { grid-template-columns: repeat(6, minmax(0, 1fr)); }
601
  .hero-inspector .loop-stage-detail { min-height: 42px; }
@@ -606,7 +628,7 @@
606
  section { padding: 68px 0; }
607
  .hero { min-height: 0; padding: 40px 0 24px; }
608
  .hero-system { margin-top: 24px; }
609
- .hero-scene { width: 100%; height: 224px; }
610
  .hero-scene canvas { opacity: 1; }
611
  .hero-system .loop-stage-rail { grid-template-columns: repeat(3, minmax(0, 1fr)); }
612
  .hero-system .loop-stage:nth-child(n) { border-top: 0; border-left: 1px solid var(--line); }
@@ -659,8 +681,11 @@
659
  .hero-system { margin-top: 18px; }
660
  .scene-head { justify-content: center; min-height: 32px; padding: 6px 0; }
661
  .scene-flow { display: none; }
662
- .hero-scene { width: 100%; height: 188px; }
663
  .hero-scene canvas { opacity: 1; }
 
 
 
664
  .scene-outcomes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; min-height: 34px; padding: 4px 0; font-size: 0.6rem; line-height: 1.3; }
665
  .scene-outcome { justify-content: center; gap: 5px; }
666
  .scene-outcome::before { width: 6px; height: 6px; flex: 0 0 auto; }
@@ -699,6 +724,7 @@
699
  .resource-item { grid-template-columns: 1fr; gap: 12px; padding: 17px 0; }
700
  .resource-work, .resource-details { grid-column: auto; }
701
  .resource-year, .resource-publication, .resource-evidence { padding-top: 10px; border-top: 1px solid var(--line); }
 
702
  .resource-detail-grid { grid-template-columns: 1fr; gap: 14px; }
703
  .resource-details summary { min-height: 34px; padding-top: 5px; }
704
  .caption { text-align: left; }
@@ -726,7 +752,8 @@
726
  .hero { padding-bottom: 8px; }
727
  .hero-system { margin-top: 16px; }
728
  .scene-head { min-height: 28px; padding-block: 4px; }
729
- .hero-scene { height: 148px; }
 
730
  .scene-outcomes { min-height: 30px; padding-block: 3px; font-size: 0.56rem; }
731
  .hero-inspector .loop-stage-detail { min-height: 34px; font-size: 0.72rem; }
732
  .mental-model { padding-top: 8px; }
@@ -880,11 +907,17 @@
880
  </div>
881
  <div class="hero-system">
882
  <div class="scene-head" aria-hidden="true">
883
- <strong>One governed pass</strong>
884
- <span class="scene-flow"><span>Work</span><i>&rarr;</i><span>Agent</span><i>&rarr;</i><span>Evidence</span><i>&rarr;</i><span>State</span><i>&rarr;</i><span>Decision</span></span>
 
 
 
885
  </div>
886
- <div class="hero-scene" data-loop-scene aria-hidden="true">
887
- <div class="scene-fallback">Work enters, an agent acts, evidence gates progress, state persists, and the system decides what happens next.</div>
 
 
 
888
  </div>
889
  <div class="scene-outcomes" aria-label="Possible loop outcomes">
890
  <span class="scene-outcome retry">Retry with evidence</span>
@@ -1533,7 +1566,7 @@
1533
  var publicationId = identifier(resource);
1534
  var sourceRecord = [
1535
  fullAuthors ? 'Authors: ' + fullAuthors : '',
1536
- resource.publication_date ? 'Published: ' + resource.publication_date : 'Publication date: not stated by the source',
1537
  'Source: ' + venue + (secondaryPublisher ? ' | ' + secondaryPublisher : ''),
1538
  publicationId ? 'Identifier: ' + publicationId : '',
1539
  resource.primary_category ? 'Primary category: ' + resource.primary_category : '',
@@ -1553,9 +1586,11 @@
1553
  }
1554
  work.appendChild(createText('div', 'resource-meta', meta));
1555
 
1556
- year.className = 'resource-year';
1557
- appendCellLabel(year, 'Year');
1558
- year.appendChild(createText('span', 'resource-year-value' + (resource.publication_year ? '' : ' undated'), resource.publication_year || 'n.d.'));
 
 
1559
 
1560
  publication.className = 'resource-publication';
1561
  appendCellLabel(publication, 'Published at');
@@ -1688,6 +1723,6 @@
1688
  });
1689
  });
1690
  </script>
1691
- <script type="module" src="assets/loop-hero-scene.js?v=13"></script>
1692
  </body>
1693
  </html>
 
187
  z-index: 0;
188
  min-width: 0;
189
  width: 100%;
190
+ height: 324px;
191
  overflow: hidden;
192
  pointer-events: none;
193
  }
 
195
  .scene-fallback { display: none; align-items: center; justify-content: center; height: 100%; color: var(--muted); font-size: 0.82rem; }
196
  .hero-scene[data-scene-state="fallback"] canvas { display: none; }
197
  .hero-scene[data-scene-state="fallback"] .scene-fallback { display: flex; }
198
+ .scene-key {
199
+ display: flex;
200
+ align-items: center;
201
+ justify-content: center;
202
+ gap: 26px;
203
+ min-height: 38px;
204
+ border-top: 1px solid var(--line);
205
+ color: var(--muted);
206
+ font-size: 0.68rem;
207
+ }
208
+ .scene-key-item { display: inline-flex; align-items: center; gap: 7px; }
209
+ .scene-key-item::before {
210
+ width: 16px;
211
+ height: 5px;
212
+ border-radius: 2px;
213
+ background: var(--blue);
214
+ content: "";
215
+ }
216
+ .scene-key-item.packet::before { background: var(--cyan); }
217
+ .scene-key-item.agents::before { background: var(--blue); }
218
+ .scene-key-item.evidence::before { background: var(--green); }
219
+ .scene-key-item.state::before { background: var(--violet); }
220
  .scene-outcomes {
221
  display: flex;
222
  align-items: center;
 
547
  .resource-meta { margin-top: 7px; color: var(--quiet); font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 0.68rem; overflow-wrap: anywhere; }
548
  .resource-cell-label { display: none; margin-bottom: 5px; color: var(--quiet); font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 0.62rem; font-weight: 650; text-transform: uppercase; }
549
  .resource-year-value { color: var(--ink); font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 0.9rem; font-weight: 700; }
550
+ .resource-year.is-empty { min-height: 1px; }
551
  .resource-venue { display: block; color: var(--ink); font-size: 0.82rem; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
552
  .resource-publisher, .resource-date, .resource-identifier { display: block; margin-top: 4px; color: var(--quiet); font-size: 0.72rem; line-height: 1.4; overflow-wrap: anywhere; }
553
  .resource-type-label { display: block; color: var(--ink); font-size: 0.78rem; font-weight: 700; }
 
617
  width: 100%;
618
  margin-top: 28px;
619
  }
620
+ .hero-scene { height: 300px; }
621
  .hero-inspector { grid-template-columns: 1fr; gap: 12px; padding: 14px 0; }
622
  .hero-system .loop-stage-rail { grid-template-columns: repeat(6, minmax(0, 1fr)); }
623
  .hero-inspector .loop-stage-detail { min-height: 42px; }
 
628
  section { padding: 68px 0; }
629
  .hero { min-height: 0; padding: 40px 0 24px; }
630
  .hero-system { margin-top: 24px; }
631
+ .hero-scene { width: 100%; height: 270px; }
632
  .hero-scene canvas { opacity: 1; }
633
  .hero-system .loop-stage-rail { grid-template-columns: repeat(3, minmax(0, 1fr)); }
634
  .hero-system .loop-stage:nth-child(n) { border-top: 0; border-left: 1px solid var(--line); }
 
681
  .hero-system { margin-top: 18px; }
682
  .scene-head { justify-content: center; min-height: 32px; padding: 6px 0; }
683
  .scene-flow { display: none; }
684
+ .hero-scene { width: 100%; height: 244px; }
685
  .hero-scene canvas { opacity: 1; }
686
+ .scene-key { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; min-height: 58px; padding: 5px 0; font-size: 0.62rem; }
687
+ .scene-key-item { justify-content: center; min-width: 0; padding: 3px 4px; }
688
+ .scene-key-item::before { width: 13px; flex: 0 0 auto; }
689
  .scene-outcomes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; min-height: 34px; padding: 4px 0; font-size: 0.6rem; line-height: 1.3; }
690
  .scene-outcome { justify-content: center; gap: 5px; }
691
  .scene-outcome::before { width: 6px; height: 6px; flex: 0 0 auto; }
 
724
  .resource-item { grid-template-columns: 1fr; gap: 12px; padding: 17px 0; }
725
  .resource-work, .resource-details { grid-column: auto; }
726
  .resource-year, .resource-publication, .resource-evidence { padding-top: 10px; border-top: 1px solid var(--line); }
727
+ .resource-year.is-empty { display: none; }
728
  .resource-detail-grid { grid-template-columns: 1fr; gap: 14px; }
729
  .resource-details summary { min-height: 34px; padding-top: 5px; }
730
  .caption { text-align: left; }
 
752
  .hero { padding-bottom: 8px; }
753
  .hero-system { margin-top: 16px; }
754
  .scene-head { min-height: 28px; padding-block: 4px; }
755
+ .hero-scene { height: 218px; }
756
+ .scene-key { min-height: 52px; font-size: 0.58rem; }
757
  .scene-outcomes { min-height: 30px; padding-block: 3px; font-size: 0.56rem; }
758
  .hero-inspector .loop-stage-detail { min-height: 34px; font-size: 0.72rem; }
759
  .mental-model { padding-top: 8px; }
 
907
  </div>
908
  <div class="hero-system">
909
  <div class="scene-head" aria-hidden="true">
910
+ <strong>Agent loop runtime</strong>
911
+ <span class="scene-flow"><span>Trigger</span><i>&rarr;</i><span>Orchestrator</span><i>&rarr;</i><span>Agent team</span><i>&rarr;</i><span>Evidence gate</span><i>&rarr;</i><span>State</span><i>&rarr;</i><span>Next action</span></span>
912
+ </div>
913
+ <div class="hero-scene" data-loop-scene role="img" aria-label="Animated agent loop runtime. A task enters an orchestrator, is delegated to specialist agents with tools and context, passes an evidence gate, writes to durable state, and reaches a bounded next-action decision.">
914
+ <div class="scene-fallback">A task enters an orchestrator, moves through a specialist agent team and evidence gate, writes to durable state, and reaches a bounded next action.</div>
915
  </div>
916
+ <div class="scene-key" aria-label="Agent runtime visual key">
917
+ <span class="scene-key-item packet">Work packet</span>
918
+ <span class="scene-key-item agents">Orchestrator + agent team</span>
919
+ <span class="scene-key-item evidence">Evidence gate</span>
920
+ <span class="scene-key-item state">Durable state</span>
921
  </div>
922
  <div class="scene-outcomes" aria-label="Possible loop outcomes">
923
  <span class="scene-outcome retry">Retry with evidence</span>
 
1566
  var publicationId = identifier(resource);
1567
  var sourceRecord = [
1568
  fullAuthors ? 'Authors: ' + fullAuthors : '',
1569
+ resource.publication_date ? 'Published: ' + resource.publication_date : '',
1570
  'Source: ' + venue + (secondaryPublisher ? ' | ' + secondaryPublisher : ''),
1571
  publicationId ? 'Identifier: ' + publicationId : '',
1572
  resource.primary_category ? 'Primary category: ' + resource.primary_category : '',
 
1586
  }
1587
  work.appendChild(createText('div', 'resource-meta', meta));
1588
 
1589
+ year.className = 'resource-year' + (resource.publication_year ? '' : ' is-empty');
1590
+ if (resource.publication_year) {
1591
+ appendCellLabel(year, 'Year');
1592
+ year.appendChild(createText('span', 'resource-year-value', resource.publication_year));
1593
+ }
1594
 
1595
  publication.className = 'resource-publication';
1596
  appendCellLabel(publication, 'Published at');
 
1723
  });
1724
  });
1725
  </script>
1726
+ <script type="module" src="assets/loop-hero-scene.js?v=19"></script>
1727
  </body>
1728
  </html>