diff --git a/.claude/hooks/fleet-user-prompt.sh b/.claude/hooks/fleet-user-prompt.sh deleted file mode 100755 index 5ad8292..0000000 --- a/.claude/hooks/fleet-user-prompt.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env bash -# Claude Code UserPromptSubmit hook for FleetCrown. -# -# Captures every prompt typed into a Claude terminal and POSTs it to the -# fleet server so the Activity page sees terminal work, not just dispatches -# routed through /api/inject. Always exits 0 — never blocks the user. -# -# Claude sends the hook event on stdin as JSON with at least: -# { "prompt": "...", "cwd": "...", "session_id": "..." } -# -# Auth: Bearer FLEETCROWN_DAEMON_TOKEN (mirrored via daemon.env). - -set +e # never fail the user's prompt because logging is broken - -# Load token from daemon env. Skip silently if not present. -for f in "${HOME}/.config/fleetcrown/daemon.env" "${HOME}/.config/cockpit/daemon.env"; do - [ -f "$f" ] || continue - set -a - # shellcheck disable=SC1090 - . "$f" - set +a -done - -TOKEN="${FLEETCROWN_DAEMON_TOKEN:-${COCKPIT_DAEMON_TOKEN:-}}" -# Prefer the local systemd server when it's up — writes land in the same -# shared DB the Vercel deployment reads, and the local one always has the -# newest endpoints. Override with FLEET_CAPTURE_URL for headless / remote use. -BASE="${FLEET_CAPTURE_URL:-http://localhost:3000}" - -if [ -z "$TOKEN" ]; then - exit 0 -fi - -# Slurp Claude's JSON payload from stdin BEFORE backgrounding (background can't -# read the parent's stdin reliably). Pass through env to the worker so the -# heredoc-vs-stdin collision doesn't happen. -PAYLOAD="$(cat)" - -# Fire-and-forget worker. Exits within 1.5s on the inner urlopen timeout, but -# we don't wait — the user's prompt must submit instantly. -FLEET_PAYLOAD="$PAYLOAD" FLEET_BASE="$BASE" FLEET_TOKEN="$TOKEN" nohup python3 -c ' -import json, os, sys, urllib.request -base = os.environ["FLEET_BASE"] -token = os.environ["FLEET_TOKEN"] -try: - payload = json.loads(os.environ["FLEET_PAYLOAD"]) -except Exception: - sys.exit(0) -prompt = (payload.get("prompt") or "").strip() -cwd = payload.get("cwd") or os.getcwd() -session_id = payload.get("session_id") or "" -if not prompt: - sys.exit(0) -body = json.dumps({"prompt": prompt, "cwd": cwd, "sessionId": session_id}).encode("utf-8") -req = urllib.request.Request( - f"{base}/api/activity/capture", - data=body, - method="POST", - headers={"Content-Type": "application/json", "Authorization": f"Bearer {token}"}, -) -try: - urllib.request.urlopen(req, timeout=1.5).read() -except Exception: - pass -' /dev/null 2>&1 & - -disown -exit 0 diff --git a/.claude/settings.json b/.claude/settings.json index c7506fc..f8824b7 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -19,7 +19,6 @@ "TodoWrite" ] }, - "model": "claude-fable-5[1m]", "hooks": { "Notification": [ { @@ -81,7 +80,7 @@ }, { "type": "command", - "command": "/home/g/.claude/hooks/fleet-user-prompt.sh" + "command": "/home/g/.claude/hooks/fleetcrown-capture.sh" } ] } @@ -91,5 +90,6 @@ "tui": "fullscreen", "editorMode": "vim", "agentPushNotifEnabled": true, - "voiceEnabled": true + "voiceEnabled": true, + "model": "claude-fable-5[1m]" } diff --git a/.gitignore b/.gitignore index 31d5b05..b636136 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ __pycache__/ *.pyc .claude/hooks/dangerous-commands.log +.claude/hooks/fleetcrown-capture.sh