diff --git a/build.sh b/build.sh index 1c87eccb..55800bfb 100755 --- a/build.sh +++ b/build.sh @@ -1606,6 +1606,16 @@ EOF mkdir -p "${MOUNT_POINT}/usr/local/share/clawdie-iso" install -m 0644 "${LIVE_SESSION_DIR}/START-HERE.txt" \ "${MOUNT_POINT}/usr/local/share/clawdie-iso/START-HERE.txt" + install -m 0755 "${LIVE_SESSION_DIR}/colibri-panel-indicator.sh" \ + "${MOUNT_POINT}/usr/local/bin/colibri-panel-indicator" + install -m 0755 "${LIVE_SESSION_DIR}/clawdie-wallpaper-gen.sh" \ + "${MOUNT_POINT}/usr/local/bin/clawdie-wallpaper-gen" + install -m 0755 "${LIVE_SESSION_DIR}/clawdie-join-hive.sh" \ + "${MOUNT_POINT}/usr/local/bin/clawdie-join-hive" + install -m 0644 "${LIVE_SESSION_DIR}/clawdie-join-hive.desktop" \ + "${MOUNT_POINT}/usr/local/share/applications/Clawdie Join Hive.desktop" + install -m 0644 "${LIVE_SESSION_DIR}/clawdie-join-hive.desktop" \ + "${MOUNT_POINT}/home/clawdie/Desktop/Join Hive.desktop" mkdir -p "${MOUNT_POINT}/usr/local/share/clawdie-iso/bootstrap" install -m 0644 "${LIVE_SESSION_DIR}/bootstrap.html" \ "${MOUNT_POINT}/usr/local/share/clawdie-iso/bootstrap/index.html" diff --git a/live/operator-session/clawdie-join-hive.desktop b/live/operator-session/clawdie-join-hive.desktop new file mode 100644 index 00000000..23c545a2 --- /dev/null +++ b/live/operator-session/clawdie-join-hive.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Type=Application +Version=1.0 +Name=Join Hive +Comment=Register this machine as a Colibri agent +Exec=xfce4-terminal --title "Join Hive" --geometry=80x24 --command "/usr/local/bin/clawdie-join-hive.sh" +Icon=network-server +Terminal=false +Categories=System;Utility; diff --git a/live/operator-session/clawdie-join-hive.sh b/live/operator-session/clawdie-join-hive.sh new file mode 100755 index 00000000..d138a022 --- /dev/null +++ b/live/operator-session/clawdie-join-hive.sh @@ -0,0 +1,70 @@ +#!/bin/sh +# One-click "Join Hive" โ€” registers this machine as a Colibri agent. +# Runs in a visible terminal so the operator sees the result. +# Idempotent: safe to re-run on an already-registered agent. +set -e + +SOCKET="${COLIBRI_SOCKET:-/var/run/colibri/colibri.sock}" +PROVIDER_ENV="/usr/local/etc/colibri/provider.env" + +echo "========================================" +echo " Clawdie โ€” Join Hive" +echo "========================================" +echo "" + +# 1. Check daemon +if [ ! -S "$SOCKET" ]; then + echo "[1/4] Starting colibri daemon..." + mdo -u root service colibri_daemon start + sleep 2 +else + echo "[1/4] Daemon already running." +fi + +# 2. Vault creds +echo "[2/4] Checking vault credentials..." +if [ -f "$PROVIDER_ENV" ] && grep -q 'BW_CLIENTID=.' "$PROVIDER_ENV" 2>/dev/null; then + echo " provider.env present with credentials." +else + echo " WARNING: provider.env missing or empty." + echo " Vault provisioning will be skipped." + echo " Edit ${PROVIDER_ENV} and re-run." +fi + +# 3. Detect capabilities +HOST=$(hostname) +OS=$(uname -s | tr '[:upper:]' '[:lower:]') +CAPS="$OS,shell" + +# Add optional capabilities +which colibri >/dev/null 2>&1 && CAPS="$CAPS,colibri" +which hermes >/dev/null 2>&1 && CAPS="$CAPS,hermes" +which pi >/dev/null 2>&1 && CAPS="$CAPS,pi" +tailscale status >/dev/null 2>&1 && CAPS="$CAPS,tailscale" +[ "$OS" = "freebsd" ] && CAPS="$CAPS,rc.d,jail,zfs" + +AGENT_NAME="${HOST}" +echo "[3/4] Registering agent: ${AGENT_NAME}" +echo " capabilities: ${CAPS}" + +RESP=$(printf '{"cmd":"register-agent","name":"%s","capabilities":%s}\n' \ + "$AGENT_NAME" "$(echo "$CAPS" | python3 -c "import sys; print(__import__('json').dumps(sys.stdin.read().strip().split(',')))")" \ + | nc -U "$SOCKET" -w 3 2>/dev/null) + +if echo "$RESP" | grep -q '"ok":true'; then + echo " registered." +elif echo "$RESP" | grep -q 'already exists'; then + echo " already registered (idempotent)." +else + echo " registration note: ${RESP}" +fi + +# 4. Start poll loop +echo "[4/4] Agent ${AGENT_NAME} is live on the Colibri board." +echo "" +echo " Check: colibri status" +echo " Tasks: colibri list-tasks --status started" +echo " Board: colibri list-agents" +echo "" +echo "Hive joined. Press Enter to close." +read -r _ diff --git a/live/operator-session/clawdie-wallpaper-gen.sh b/live/operator-session/clawdie-wallpaper-gen.sh new file mode 100755 index 00000000..bca2bdd3 --- /dev/null +++ b/live/operator-session/clawdie-wallpaper-gen.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# Generate a wallpaper with machine identity overlaid. +# Run once on first boot, caches result in /tmp/clawdie-wallpaper.png. +# Requires: ImageMagick (convert), tailscale, colibri socket. + +set -e + +OUT="${1:-/tmp/clawdie-wallpaper.png}" +BG="/usr/local/share/backgrounds/xfce/default.png" + +HOST=$(hostname) +TS_IP=$(tailscale ip -4 2>/dev/null || echo "offline") +COLIBRI_SOCK="/var/run/colibri/colibri.sock" +COLIBRI_PORT="9190" +JAIL_RELEASE=$(freebsd-version 2>/dev/null || uname -r) + +# Fall back to a solid colour if no background image exists +if [ ! -f "$BG" ]; then + convert -size 1920x1080 xc:'#1a1a2e' "$BG" 2>/dev/null || true +fi + +# One-liner draw: place identity text in the bottom-left corner +convert "$BG" \ + -font Helvetica -pointsize 18 -fill '#e0e0e0' \ + -annotate +40+900 "hostname ${HOST}" \ + -annotate +40+930 "tailscale ${TS_IP}" \ + -annotate +40+960 "colibri ${COLIBRI_PORT}" \ + -annotate +40+990 "jail ${JAIL_RELEASE}" \ + -font Helvetica-Bold -pointsize 28 -fill '#8b5cf6' \ + -annotate +40+850 "Clawdie OS" \ + "$OUT" + +echo "Wallpaper: ${OUT}" diff --git a/live/operator-session/colibri-panel-indicator.sh b/live/operator-session/colibri-panel-indicator.sh new file mode 100755 index 00000000..09213f6c --- /dev/null +++ b/live/operator-session/colibri-panel-indicator.sh @@ -0,0 +1,32 @@ +#!/bin/sh +# xfce4-genmon panel indicator โ€” polls colibri daemon health. +# Install: add a Generic Monitor panel item pointing to this script. +# Refresh interval: 30s. +# +# Output: green/red dot + agent count + task count. +# ๐ŸŸข 2 agents ยท 3 tasks +# ๐Ÿ”ด daemon down + +SOCKET="${COLIBRI_SOCKET:-/var/run/colibri/colibri.sock}" +TOOLTIP="" + +if [ -S "$SOCKET" ]; then + STATUS=$(printf '{"cmd":"status"}\n' | nc -U "$SOCKET" -w 2 2>/dev/null) + if [ -n "$STATUS" ]; then + AGENTS=$(echo "$STATUS" | python3 -c "import sys,json; d=json.load(sys.stdin)['data']; print(d['agents'])" 2>/dev/null) + TASKS=$(echo "$STATUS" | python3 -c "import sys,json; d=json.load(sys.stdin)['data']; t=d['tasks']; print(t['started'])" 2>/dev/null) + HOST=$(echo "$STATUS" | python3 -c "import sys,json; print(json.load(sys.stdin)['data']['host'])" 2>/dev/null) + + echo "๐ŸŸข ${AGENTS} agents ยท ${TASKS} tasks" + TOOLTIP="Colibri: ${HOST} | socket: ${SOCKET} | agents: ${AGENTS} | started tasks: ${TASKS}" + else + echo "๐Ÿ”ด no response" + TOOLTIP="Colibri socket exists but not responding" + fi +else + echo "๐Ÿ”ด down" + TOOLTIP="Colibri daemon not running (no socket at ${SOCKET})" +fi + +echo "${TOOLTIP}" +echo "xfce4-terminal --title 'Colibri Status' --command 'colibri status'" diff --git a/packages/pkg-list-xfce.txt b/packages/pkg-list-xfce.txt index f13da61e..ad7c4212 100644 --- a/packages/pkg-list-xfce.txt +++ b/packages/pkg-list-xfce.txt @@ -54,3 +54,4 @@ xfce4-screenshooter-plugin xfce4-taskmanager ristretto xfce4-tumbler +ImageMagick7