Document the three-layer model, add railiance-rhythm executor install, and point playbooks at rein-aharness fi-research-brief instead of local crontab.
86 lines
3.3 KiB
Bash
Executable file
86 lines
3.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Shared env for Railiance host-side Freedom Intelligence research brief.
|
|
#
|
|
# activity-core owns cadence (Temporal + fi_brief_status + activity_task_spawn).
|
|
# This host timer is the *executor* path (same pattern as binky-control):
|
|
# rein-aharness consumes the work and posts fi_daily_brief.
|
|
#
|
|
# ISSUE_SINK_TYPE=state-hub writes progress only (not claimable issues), so a
|
|
# host timer remains the interim executor until rein-aharness poll/claim of
|
|
# activity_task_spawn is fully wired. Cadence truth still lives in activity-core.
|
|
set -euo pipefail
|
|
|
|
: "${HOME:=/home/tegwick}"
|
|
|
|
# Prefer rein-aharness venv (current name); fall back to legacy agent-harness path.
|
|
if [[ -x "${HOME}/.local/rein-aharness/venv/bin/rein-aharness" ]]; then
|
|
export PATH="${HOME}/.local/rein-aharness/venv/bin:${HOME}/.local/bin:${PATH}"
|
|
# shellcheck disable=SC1091
|
|
[[ -f "${HOME}/.local/rein-aharness/env" ]] && source "${HOME}/.local/rein-aharness/env"
|
|
elif [[ -x "${HOME}/.local/agent-harness/venv/bin/rein-aharness" ]]; then
|
|
export PATH="${HOME}/.local/agent-harness/venv/bin:${HOME}/.local/bin:${PATH}"
|
|
# shellcheck disable=SC1091
|
|
[[ -f "${HOME}/.local/agent-harness/env" ]] && source "${HOME}/.local/agent-harness/env"
|
|
else
|
|
export PATH="${HOME}/.local/bin:${PATH}"
|
|
fi
|
|
|
|
export STATE_HUB_URL="${STATE_HUB_URL:-http://127.0.0.1:18000}"
|
|
export PYTHONPATH="${HOME}/rein-aharness:${HOME}/llm-connect${PYTHONPATH:+:$PYTHONPATH}"
|
|
export FI_REPO="${FI_REPO:-${HOME}/freedom-intelligence}"
|
|
export LOG_DIR="${LOG_DIR:-${HOME}/.cache/freedom-intelligence/rhythm}"
|
|
mkdir -p "${LOG_DIR}"
|
|
|
|
log() { echo "$(date -Iseconds) $*" | tee -a "${LOG_DIR}/railiance-rhythm.log"; }
|
|
|
|
require_repo() {
|
|
if [[ ! -d "${FI_REPO}/.git" ]]; then
|
|
log "ERROR: freedom-intelligence missing at ${FI_REPO}; clone with deploy key"
|
|
exit 1
|
|
fi
|
|
git -C "${FI_REPO}" fetch --quiet origin main || true
|
|
git -C "${FI_REPO}" checkout --quiet main
|
|
git -C "${FI_REPO}" pull --ff-only --quiet origin main || log "WARN: pull failed (continuing on local)"
|
|
}
|
|
|
|
require_llm_connect() {
|
|
if [[ -z "${LLM_CONNECT_URL:-}" ]]; then
|
|
local candidates=()
|
|
candidates+=("http://127.0.0.1:18080")
|
|
if command -v kubectl >/dev/null 2>&1; then
|
|
local cip
|
|
cip="$(kubectl -n activity-core get svc llm-connect \
|
|
-o jsonpath='{.spec.clusterIP}' 2>/dev/null || true)"
|
|
if [[ -n "${cip}" ]]; then
|
|
candidates+=("http://${cip}:8080")
|
|
fi
|
|
fi
|
|
candidates+=("http://llm-connect.activity-core.svc.cluster.local:8080")
|
|
local u
|
|
for u in "${candidates[@]}"; do
|
|
if curl -sf -m 2 "${u}/health" >/dev/null 2>&1; then
|
|
export LLM_CONNECT_URL="${u}"
|
|
break
|
|
fi
|
|
done
|
|
if [[ -z "${LLM_CONNECT_URL:-}" ]]; then
|
|
export LLM_CONNECT_URL="${candidates[-1]}"
|
|
log "WARN: no llm-connect health probe succeeded; using ${LLM_CONNECT_URL}"
|
|
fi
|
|
fi
|
|
log "LLM_CONNECT_URL=${LLM_CONNECT_URL}"
|
|
}
|
|
|
|
ensure_git_identity() {
|
|
git -C "${FI_REPO}" config user.email >/dev/null 2>&1 \
|
|
|| git -C "${FI_REPO}" config user.email "rein-aharness@railiance.local"
|
|
git -C "${FI_REPO}" config user.name >/dev/null 2>&1 \
|
|
|| git -C "${FI_REPO}" config user.name "rein-aharness"
|
|
}
|
|
|
|
require_harness() {
|
|
if ! command -v rein-aharness >/dev/null 2>&1; then
|
|
log "ERROR: rein-aharness not on PATH. Install rein-aharness venv on this host."
|
|
exit 2
|
|
fi
|
|
}
|