#!/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. if [[ -z "${LLM_CONNECT_URL:-}" ]]; then # In-cluster default when running inside k8s; host timers may override. export LLM_CONNECT_URL="${LLM_CONNECT_URL:-http://llm-connect.activity-core.svc.cluster.local:8080}" fi log "LLM_CONNECT_URL=${LLM_CONNECT_URL}" } 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 }