flow-extension/install.sh
type-two 501431bf59 Flow rinse: browser downloads, fast-fail, autoStart, launcher + self-healing launchd
- background.js: chrome.downloads via page session (no CSP/base64)
- content.js: fast-fail on Flow error banner, image vs video timeouts, autoStart
- local_server_example.py: /enqueue + /save, downloads/ output, resume-skip
- launch.sh: idempotent server-up + caffeinate + single-tab focus
- install.sh + plist: self-healing agent every 10 min (TCC-safe App Support copy)
- flowclient.py: enqueue/wait_for helper for game projects
- README: full setup + macOS TCC gotcha

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 01:20:32 +10:00

41 lines
1.7 KiB
Bash

#!/bin/sh
# Install (or resync) the self-healing launchd agent for the Flow rinse.
# Run ON the rig Mac, from this directory: ./install.sh
#
# Mirrors the vault-backup pattern (mrpgi-vault/backup.sh): launchd can't
# execute scripts inside ~/Documents (macOS TCC blocks it), so the agent runs
# a COPY of the runtime at "~/Library/Application Support/flowrinse/".
# Once the agent owns the server, queue.jsonl / results.jsonl / downloads
# live THERE — enqueue via http://localhost:8017/enqueue as usual.
#
# Re-run after editing launch.sh / local_server_example.py to resync the copy.
#
# One-time macOS prompts on first run (click Allow on the rig's screen):
# * Automation: "sh"/"osascript" wants to control "Brave Browser"
#
# Manage the job:
# launchctl kickstart -k gui/$(id -u)/games.monsterrobot.flowrinse # run now
# launchctl bootout gui/$(id -u)/games.monsterrobot.flowrinse # stop it
set -e
DIR="$(cd "$(dirname "$0")" && pwd)"
APP="$HOME/Library/Application Support/flowrinse"
LABEL=games.monsterrobot.flowrinse
PLIST="$HOME/Library/LaunchAgents/$LABEL.plist"
# runtime copy (code always refreshed; live state never overwritten)
mkdir -p "$APP"
cp "$DIR/launch.sh" "$DIR/local_server_example.py" "$DIR/flowclient.py" "$APP/"
chmod +x "$APP/launch.sh"
for f in queue.jsonl results.jsonl; do
[ -f "$APP/$f" ] || { [ -f "$DIR/$f" ] && cp "$DIR/$f" "$APP/$f" || true; }
done
mkdir -p "$HOME/Library/LaunchAgents"
cp "$DIR/$LABEL.plist" "$PLIST"
launchctl bootout gui/$(id -u)/$LABEL 2>/dev/null || true
launchctl bootstrap gui/$(id -u) "$PLIST"
echo "installed $LABEL — fires at load + every 10 min"
echo "run now: launchctl kickstart -k gui/$(id -u)/$LABEL"