Files
loki/scripts/fleet
T
CatoandClaude Fable 5.1 6e6ca0bc7a docs(cloud-primary): nothing left that describes the old substrate — docs, marketing, comments, focus_tab (#631)
* docs(cloud-primary): nothing left that describes the old substrate — docs, marketing, comments, focus_tab

The cloud-primary series (#615 routing, #618 OrangeCat auto-kickoff, #624
Fleet Runner 0.8.19, #630 web PTY-only) changed what the product IS. This
sweep makes every surface that describes it say so, so neither an agent
reading the repo nor a person reading the site is told about zellij tabs,
presence-based routing, a cold-start restore, or a handoff that "starts
nothing".

Inventory-driven (≈105 doc lines, ≈30 user-facing strings, ≈22 code
comments, 2 repo-level items), not a grep-and-replace:

User-facing
- /download prerequisites: the "Zellij — bundled" card is gone; copy says
  each agent runs in a terminal Fleet Runner owns.
- Quickstart, license page, executor copy (cloud is the default; "This
  computer" is a per-project choice under Runs on), marketing pillars,
  whitepaper (owned-PTY design, "where a project runs is a decision, not a
  guess", ZSH typing-guard section deleted), Control terminal panel strings
  (components renamed LiveTerminalPanel / LiveTerminalRows), peek drawer
  copy, GitHub release notes for 0.8.19, repo description + topics.

Agent-facing
- README, CLAUDE.md, AGENTS-adjacent SSOTs: cloud-local-workflows.md now
  states the stored routing rule; priority plan closes B6; multitenancy plan
  routes by builder_pref; HANDOFF.md staleness table + terminals section;
  the 2026-09-10 cold-start handoff gets a dated "superseded" section; the
  two shipped proposals (fleet-runner-pty-ownership, desktop-app) carry a
  status banner; home/README describes the eight modules that exist;
  desktop/README describes 0.8.19; roadmap seed marks the migration done;
  box-runner unit and log drop FLEETCROWN_RUNNER_PTY; 22 code comments.

Code (one coherent retirement)
- focus_tab is removed from the pending-command contract, the desktop
  validator and poller, enqueueTabCommand's type, the validator test and the
  failure classifier (START_SESSION | RETRY). The runner had rejected it
  since 0.8.19; now it cannot be enqueued at all.

Verified: tsc, eslint, 148/148 unit files, 130/130 home self-tests,
check:desktop (typecheck + build).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WSNERoZZqW2TgqbAGHSQZf

* chore(desktop): 0.8.20 — the focus_tab retirement touches desktop/, so it ships as a release

The release-drift gate is right: a desktop change without a bump goes red on
main once the next tag is minted. 0.8.19's changelog date is corrected to the
release's real publishedAt.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WSNERoZZqW2TgqbAGHSQZf

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-11 02:41:20 -07:00

161 lines
5.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# fleet — Friendly local wrapper for FleetCrown development and daily use.
# Valid both in a checkout's scripts/ directory and when extracted flat into
# ~/.local/share/fleetcrown/ by the hosted installer.
#
# Recommended: symlink as "fc" (or keep "cpit" during transition):
# ln -s /home/g/dev/fleetcrown/scripts/fleet ~/bin/fc
#
# Examples:
# fc daemon start
# fc install-agent grok
# fc status
# fc pause
# fc resume
set -euo pipefail
RUNTIME_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ ! -x "$RUNTIME_DIR/fleetcrown-daemon.sh" ]; then
echo "FleetCrown helper is incomplete at $RUNTIME_DIR. Re-run the installer from Settings." >&2
exit 1
fi
DAEMON_SCRIPT="$RUNTIME_DIR/fleetcrown-daemon.sh"
INSTALL_SCRIPT="$RUNTIME_DIR/install-fleetcrown-daemon.sh"
# Load env if present (the one from the installer). Support both the new
# FLEETCROWN_ layout and legacy COCKPIT_ location during transition.
if [ -f "$HOME/.config/fleetcrown/daemon.env" ]; then
set -a
source "$HOME/.config/fleetcrown/daemon.env"
set +a
elif [ -f "$HOME/.config/fleetcrown/daemon.env" ]; then
set -a
source "$HOME/.config/fleetcrown/daemon.env"
set +a
fi
# Force remote for production Control when you also run a local dev server
export APP_DAEMON_FORCE_REMOTE=1
export FLEETCROWN_DAEMON_FORCE_REMOTE=1
export COCKPIT_DAEMON_FORCE_REMOTE=1
case "${1:-help}" in
daemon|d)
shift
case "${1:-start}" in
start)
if systemctl --user is-enabled fleetcrown-daemon >/dev/null 2>&1; then
echo "Starting via systemd (recommended)…"
bash "$INSTALL_SCRIPT" --restart 2>/dev/null || systemctl --user restart fleetcrown-daemon
else
echo "Starting daemon (no systemd service — run: fleet service enable)…"
pkill -f 'fleetcrown-daemon.sh' 2>/dev/null || true
sleep 0.5
nohup bash "$DAEMON_SCRIPT" >> "${HOME}/.local/state/fleetcrown/daemon.log" 2>&1 &
sleep 1
pgrep -f 'fleetcrown-daemon.sh' >/dev/null && echo "Daemon started." || echo "Daemon failed to start — check log."
fi
;;
stop)
if systemctl --user is-enabled fleetcrown-daemon >/dev/null 2>&1; then
systemctl --user stop fleetcrown-daemon
fi
pkill -f 'fleetcrown-daemon.sh' 2>/dev/null || true
echo "Daemon stopped."
;;
restart)
if systemctl --user is-enabled fleetcrown-daemon >/dev/null 2>&1; then
bash "$INSTALL_SCRIPT" --restart
else
$0 daemon stop
sleep 1
$0 daemon start
fi
;;
*)
echo "Usage: fleet daemon {start|stop|restart}"
;;
esac
;;
install-agent|ia)
agent="${2:-}"
if [ -z "$agent" ]; then
echo "Usage: fleet install-agent <grok|claude|cursor|gemini>"
exit 1
fi
echo "Triggering one-click install for $agent (will open a tab if daemon running)..."
# This calls the production API — requires the daemon token (prefer new FLEETCROWN_, fall back)
TOKEN="${FLEETCROWN_DAEMON_TOKEN:-${COCKPIT_DAEMON_TOKEN:-}}"
if [ -z "$TOKEN" ]; then
echo "No FLEETCROWN_DAEMON_TOKEN (or legacy COCKPIT_DAEMON_TOKEN) found. Source your daemon.env first."
exit 1
fi
auth_header="$(mktemp)"
chmod 600 "$auth_header"
printf 'Authorization: Bearer %s\n' "$TOKEN" > "$auth_header"
trap 'rm -f "$auth_header"' EXIT
curl -s -X POST "https://fleetcrown.orangecat.ch/api/agent/install-cli" \
-H "@$auth_header" \
-H "Content-Type: application/json" \
-d "{\"agent\":\"$agent\"}" | jq .
echo "The installer runs in a terminal Fleet Runner owns — watch it on Control → This computer."
;;
status|s)
echo "=== Running daemons ==="
pgrep -f 'fleetcrown-daemon.sh' -a || echo "None"
echo ""
echo "=== Systemd user service ==="
systemctl --user status fleetcrown-daemon 2>/dev/null || echo "Service not installed (run: ./scripts/install-fleetcrown-daemon.sh)"
echo ""
echo "=== Recent runtime state (if any) ==="
ls -lt /tmp/agent-current-prompt-* /tmp/agent-ready-* 2>/dev/null | head -5 || echo "No recent sentinels"
echo "=== Your projects ==="
grep -E '^(FleetCrown|revamp|OrangeCat)' "$HOME/.config/agent-projects.conf" 2>/dev/null || echo "No conf"
;;
service)
shift
case "${1:-status}" in
enable|install)
echo "Installing/enabling background service..."
bash "$INSTALL_SCRIPT"
;;
disable)
echo "Disabling service..."
systemctl --user disable --now fleetcrown-daemon 2>/dev/null || true
;;
status)
systemctl --user status fleetcrown-daemon 2>/dev/null || echo "Not installed"
;;
*)
echo "Usage: fleet service {enable|disable|status}"
;;
esac
;;
pause)
touch "/tmp/fleetcrown-pause"
echo "Fleet paused (daemon will respect this on next cycle)."
;;
resume)
rm -f "/tmp/fleetcrown-pause"
echo "Fleet resumed."
;;
help|*)
echo "fleet — your friendly local FleetCrown helper"
echo ""
echo "Recommended name: fc (or cpit during transition to avoid conflicts)"
echo ""
echo "Commands:"
echo " fc daemon start # Clean start against production"
echo " fc daemon stop"
echo " fc install-agent grok # Opens a tab and injects the installer"
echo " fc status"
echo " fc pause / resume # Low-power mode"
echo ""
echo "Setup (recommended):"
echo " ln -s /home/g/dev/fleetcrown/scripts/fleet ~/bin/fc"
echo ""
echo "Then just use: fc daemon start"
;;
esac