Files
clawmates/handoff/install.sh
T
Omar SobhandClaude Opus 4.8 39bacbd1d2 World page: live WebGL Gource-style visualization (Phases A+B)
Replaces the static React-Flow world forest with a real-time WebGL view of the
swarm working, plus the live event contract that feeds it.

Phase A — the live contract + feed:
- frontend/src/lib/live/taxonomy.ts — the 13-event Clawmates Event Taxonomy as
  typed TS (the shared World/Observe contract).
- frontend/src/lib/live/useClawmatesLive.ts — native shared-singleton live client
  (EventSource to /api/world/live, typed fan-out, replay-of-last-state to late
  subscribers, refcounted, synthetic fallback so views are always alive).
- crates/cm-api/src/routes/world.rs — GET /api/world/live, authed + workspace-
  scoped SSE emitting the taxonomy (real agent.status from live-container state,
  a topology.update of the workspace's agents, telemetry with real doorsPending),
  mirroring run_events_sse. normalize() seam documented for run_events->world.touch.

Phase B — the WebGL engine:
- frontend/src/components/world/engine.ts — Gource-inspired force-directed model:
  org/company/team tree (sibling repulsion + parent spring + friction), agent
  pawns that converge on the touched node and beam it, world nodes that glow with
  heat and fade when idle. Framework-agnostic (renderer-independent) state+math.
- frontend/src/components/world/WorldCanvas.tsx — three.js scene (ortho cam,
  UnrealBloom), render loop syncing engine state, camera auto-fit, HTML labels,
  raycast click->select, Hierarchy/Flat/Live formation switch.
- Dashboard.tsx: swap <WorldFlow/> -> <WorldCanvas/> at the world-tier seam
  (shared claw-tier pieces untouched; WorldFlow.tsx kept for now).
- Adds three (+ @types/three).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-23 21:23:34 -07:00

64 lines
2.4 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# Clawmates Visualization Layer — installer (idempotent, safe to re-run)
set -euo pipefail
cd "$(dirname "$0")"
say() { printf '\033[1;38;5;209m\033[0m %s\n' "$*"; }
ok() { printf '\033[1;32m✓\033[0m %s\n' "$*"; }
warn() { printf '\033[1;33m!\033[0m %s\n' "$*"; }
echo
say "Clawmates visualization layer — install"
echo
# 1) Node >= 20 -------------------------------------------------------------
if command -v node >/dev/null 2>&1; then
NODE_MAJOR="$(node -p 'process.versions.node.split(".")[0]')"
if [ "$NODE_MAJOR" -ge 20 ]; then ok "Node $(node -v)"; else
warn "Node $(node -v) found but >= 20 is required."
echo " Install Node 20 LTS: https://nodejs.org or 'sudo apt install nodejs' from NodeSource."
exit 1
fi
else
warn "Node not found. Install Node 20 LTS, then re-run:"
echo " curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - && sudo apt-get install -y nodejs"
exit 1
fi
# 2) Bridge deps (intentionally none beyond Node built-ins) -----------------
if [ -f realtime/package.json ]; then
( cd realtime && npm ci --omit=dev 2>/dev/null || npm install --omit=dev 2>/dev/null || true )
ok "Bridge ready (dependency-free)"
fi
# 3) Static file server ------------------------------------------------------
if command -v caddy >/dev/null 2>&1; then
ok "Caddy present — will serve visualizations/"
elif command -v npx >/dev/null 2>&1; then
warn "Caddy not found; will fall back to 'npx serve'."
else
warn "No static server found. Install Caddy: https://caddyserver.com/docs/install"
fi
# 4) .env --------------------------------------------------------------------
if [ ! -f .env ]; then
cp .env.example .env
ok "Wrote .env from .env.example — edit it before running live mode."
else
ok ".env already exists (left untouched)"
fi
echo
ok "Install complete."
echo
say "Next — DEMO mode (no backend):"
echo " (cd realtime && CLAWMATES_MODE=demo node server.mjs)"
echo " caddy file-server --root ./visualizations --listen :8080 # or: npx serve ./visualizations -l 8080"
echo " open http://localhost:8080/Clawmates%20World.dc.html?live=http://localhost:8420/live"
echo
say "Next — LIVE mode (wire to cm-api): edit .env, then"
echo " (cd realtime && CLAWMATES_MODE=live node server.mjs)"
echo
say "See AGENT_HANDOFF.md for the full architecture, event taxonomy, and systemd unit."
echo