Some checks failed
Work Records / validate (push) Has been cancelled
Host LLM_CONNECT_URL discovery uses ClusterIP when DNS is unreachable; mail path fails hard if triage fails. Mark T06 done and workplan finished; update residual docs (OperatingRhythm, cutover runbook, llm-rhythm).
75 lines
3 KiB
Bash
Executable file
75 lines
3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Shared env for Railiance host-side Binky rhythm (BINKY-WP-0004-T06 interim).
|
|
# activity-core schedules remain the source of cadence truth; this host timer
|
|
# is the *executor* until a continuous harness poller consumes emissions
|
|
# (ISSUE_SINK_TYPE=state-hub currently writes progress only — not claimable issues).
|
|
set -euo pipefail
|
|
|
|
: "${HOME:=/home/tegwick}"
|
|
export PATH="${HOME}/.local/agent-harness/venv/bin:${HOME}/.local/bin:${PATH}"
|
|
# shellcheck disable=SC1091
|
|
source "${HOME}/.local/agent-harness/env"
|
|
|
|
export STATE_HUB_URL="${STATE_HUB_URL:-http://127.0.0.1:18000}"
|
|
export PYTHONPATH="${HOME}/agent-harness:${HOME}/llm-connect${PYTHONPATH:+:$PYTHONPATH}"
|
|
export BINKY_REPO="${BINKY_REPO:-${HOME}/binky-control}"
|
|
export LOG_DIR="${LOG_DIR:-${HOME}/.cache/binky-control/rhythm}"
|
|
mkdir -p "${LOG_DIR}"
|
|
|
|
log() { echo "$(date -Iseconds) $*" | tee -a "${LOG_DIR}/railiance-rhythm.log"; }
|
|
|
|
require_repo() {
|
|
if [[ ! -d "${BINKY_REPO}/.git" ]]; then
|
|
log "ERROR: binky-control missing at ${BINKY_REPO}; clone via forgejo-agent-harness deploy key"
|
|
exit 1
|
|
fi
|
|
git -C "${BINKY_REPO}" fetch --quiet origin main || true
|
|
git -C "${BINKY_REPO}" checkout --quiet main
|
|
git -C "${BINKY_REPO}" pull --ff-only --quiet origin main || log "WARN: pull failed (continuing on local)"
|
|
}
|
|
|
|
require_llm_connect() {
|
|
# Server-side rhythm uses llm-connect HTTP (OpenRouter), never Claude CLI.
|
|
# Host cannot resolve in-cluster DNS; try reachable bases in order:
|
|
# 1) explicit LLM_CONNECT_URL 2) local port-forward 3) Service ClusterIP
|
|
# 4) cluster DNS (works only in-pod).
|
|
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 "${BINKY_REPO}" config user.email >/dev/null 2>&1 \
|
|
|| git -C "${BINKY_REPO}" config user.email "agent-harness@railiance.local"
|
|
git -C "${BINKY_REPO}" config user.name >/dev/null 2>&1 \
|
|
|| git -C "${BINKY_REPO}" config user.name "agent-harness"
|
|
}
|
|
|
|
require_claude() {
|
|
# Deprecated for Railiance. Kept only so old docs fail loudly with the right message.
|
|
log "ERROR: Claude CLI is not the Railiance execution path (BINKY-WP-0006)."
|
|
log "Use llm-connect/OpenRouter via agent-harness hosted adapters — see integrations/railiance-llm-rhythm.md"
|
|
exit 2
|
|
}
|