Document the three-layer model, add railiance-rhythm executor install, and point playbooks at rein-aharness fi-research-brief instead of local crontab.
73 lines
2.4 KiB
Bash
Executable file
73 lines
2.4 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# BREAK-GLASS only — not the primary recurrence path.
|
|
#
|
|
# Primary design:
|
|
# activity-core (schedule + fi_brief_status + spawn)
|
|
# → rein-aharness fi-research-brief on railiance01
|
|
# See docs/recurrence-ops.md and activity-core/docs/recurring-automations-playbook.md
|
|
#
|
|
# This script only prints due status for operators debugging from a workstation.
|
|
# Do NOT install it as the main crontab for FI briefs.
|
|
#
|
|
# Env:
|
|
# STATE_HUB_URL default http://127.0.0.1:8000
|
|
# FI_REPO default /home/worsch/freedom-intelligence
|
|
|
|
set -euo pipefail
|
|
|
|
STATE_HUB_URL="${STATE_HUB_URL:-http://127.0.0.1:8000}"
|
|
FI_REPO="${FI_REPO:-/home/worsch/freedom-intelligence}"
|
|
LOG_DIR="${FI_REPO}/.local/consumer-logs"
|
|
mkdir -p "$LOG_DIR"
|
|
log="$LOG_DIR/$(date +%Y-%m-%d).log"
|
|
|
|
{
|
|
echo "=== $(date -Is) consume-fi-brief-spawn ==="
|
|
# Prefer activity-core resolver if available; else raw progress heuristic
|
|
due_json=""
|
|
if command -v uv >/dev/null 2>&1 && [[ -d /home/worsch/activity-core ]]; then
|
|
due_json="$(
|
|
cd /home/worsch/activity-core &&
|
|
STATE_HUB_URL="$STATE_HUB_URL" uv run python -c "
|
|
from activity_core.context_resolvers.state_hub import _fi_brief_status
|
|
import json
|
|
print(json.dumps(_fi_brief_status({'repo': 'freedom-intelligence'}), default=str))
|
|
" 2>/dev/null || true
|
|
)"
|
|
fi
|
|
|
|
if [[ -z "$due_json" ]]; then
|
|
echo "WARN: could not query fi_brief_status; check STATE_HUB_URL=$STATE_HUB_URL"
|
|
exit 0
|
|
fi
|
|
|
|
echo "status: $due_json"
|
|
due="$(python3 -c "import json,sys; d=json.loads(sys.argv[1]); print(d['items'][0]['due'])" "$due_json")"
|
|
date_s="$(python3 -c "import json,sys; d=json.loads(sys.argv[1]); print(d['items'][0]['date'])" "$due_json")"
|
|
|
|
if [[ "$due" != "True" && "$due" != "true" ]]; then
|
|
echo "not due for $date_s — exit"
|
|
exit 0
|
|
fi
|
|
|
|
y="${date_s:0:4}"
|
|
m="${date_s:5:2}"
|
|
brief_path="$FI_REPO/briefs/$y/$m/$date_s.md"
|
|
echo "DUE: produce brief at $brief_path"
|
|
echo "Playbook: $FI_REPO/docs/daily-brief-playbook.md"
|
|
echo "On completion POST event_type=fi_daily_brief detail.repo=freedom-intelligence detail.date=$date_s"
|
|
|
|
# Non-interactive marker for operators / agents
|
|
notice="$LOG_DIR/DUE-$date_s.txt"
|
|
cat >"$notice" <<EOF
|
|
FI daily research brief is DUE for $date_s.
|
|
|
|
1. cd $FI_REPO
|
|
2. Follow docs/daily-brief-playbook.md
|
|
3. Write $brief_path
|
|
4. Post State Hub progress event fi_daily_brief
|
|
|
|
Spawn consumer ran at $(date -Is).
|
|
EOF
|
|
echo "wrote $notice"
|
|
} | tee -a "$log"
|