ops(scripts): dispatch, queue gating, heartbeat, quota probe

dispatch-turn.sh (headless turn launcher with TURN_MODEL routing),
queue-after.sh (serial gate chain + quota-wall guard), pmo-heartbeat.sh
(PMO wake loop), quota-probe-then-chain.sh (post-wall relaunch).
This commit is contained in:
2026-08-29 05:22:43 -05:00
parent 458d92831e
commit 79d93b6c49
18 changed files with 825 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
#!/usr/bin/env bash
# founder-wire-tooling.sh — FOUNDER-RUN as root.
# Wire the tooling repo (agent-stack @ current HEAD) into all four TSG
# verticals: canonical pmo-loop.sh (metrics-ledgered), dispatch-turn.sh,
# semaphore.sh, agent-metrics.sh into ~/.coordinate/scripts/. RCEO already
# wired itself. Supervisor units (tsg-supervisor.*) already org-wide.
# Stamped copies per provenance rule; fix forward in the repo, reinstall.
set -uo pipefail
[ "$(id -un)" = root ] || { echo "run as: sudo bash $0" >&2; exit 1; }
TOOLING=/home/_crossfeed/tooling
SRC=$TOOLING/agent-stack
SHA=$(git -C "$SRC" rev-parse --short HEAD)
FILES="pmo-loop.sh dispatch-turn.sh semaphore.sh agent-metrics.sh"
echo "== preflight =="
for f in $FILES; do [ -f "$SRC/$f" ] || { echo "missing $SRC/$f" >&2; exit 1; }; done
echo "ok: source files present @ $SHA"
for acct in TSGBOD TSGCCO TSGCTO TSGCOO; do
home=$(getent passwd "$acct" | cut -d: -f6)
echo "== $acct =="
mkdir -p "$home/.coordinate/scripts" "$home/.coordinate/logs"
for f in $FILES; do
install -o "$acct" -g "$acct" -m755 "$SRC/$f" "$home/.coordinate/scripts/$f"
done
sed -i "1a # installed: agent-stack @ $SHA ($(date -I))" "$home/.coordinate/scripts/pmo-loop.sh"
cat > "$home/.coordinate/inbox-pmo/NOTICE-tooling-wiring.md" <<EOF
Founder directive: your ~/.coordinate/scripts now carries agent-stack @ $SHA
(repo: /home/_crossfeed/tooling/agent-stack). Dispatch work-turns with:
screen -dmS work-turn-<slug> ~/.coordinate/scripts/dispatch-turn.sh <slug> <prompt-file>
(semaphore-gated, fresh session, doorbell back to your PMO screen; see
GOVERNANCE.md in the repo: capture free, execution metered; founder gate
on every TASK still applies). Wrapper now logs launches to metrics. Fix
bugs IN THE REPO (commit as your uid via tooling/commit.sh), then rerun
this installer. Archive this notice after reading.
EOF
chown "$acct:$acct" "$home/.coordinate/inbox-pmo/NOTICE-tooling-wiring.md"
echo " wired + NOTICE"
done
echo "== verify =="
for acct in TSGBOD TSGCCO TSGCTO TSGCOO; do
home=$(getent passwd "$acct" | cut -d: -f6)
echo " $acct: $(ls "$home/.coordinate/scripts/" 2>/dev/null | tr '\n' ' ')"
done