feat: add entrypoint for llama dev-agent container (#29)
Some checks failed
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/push/smoke-init Pipeline failed

Simple while-true loop that runs dev-poll with llama backend env vars.
No cron, no guard files, no activation state — just polls and spawns.
Repo auto-cloned on first start.

To be used with a separate agents-llama compose service that sets
ANTHROPIC_BASE_URL to the llama-server address.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
johba 2026-03-28 17:33:09 +00:00
parent e6b57dc9f1
commit 6b0e9b5f4d

View file

@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -euo pipefail
LOG_DIR="/home/agent/data/logs/dev"
mkdir -p "$LOG_DIR" /home/agent/data
log() {
printf "[%s] llama-loop: %s\n" "$(date -u +%Y-%m-%d\ %H:%M:%S\ UTC)" "$*" | tee -a "$LOG_DIR/llama-loop.log"
}
log "Starting llama dev-agent loop"
log "Backend: ${ANTHROPIC_BASE_URL:-not set}"
log "Claude CLI: $(claude --version 2>&1 || echo not found)"
# Clone repo if not present
if [ ! -d "${PROJECT_REPO_ROOT}/.git" ]; then
log "Cloning repo..."
mkdir -p "$(dirname "$PROJECT_REPO_ROOT")"
chown -R agent:agent /home/agent/repos 2>/dev/null || true
su -s /bin/bash agent -c "git clone http://dev-bot:${FORGE_TOKEN}@forgejo:3000/${FORGE_REPO:-johba/disinto}.git ${PROJECT_REPO_ROOT}"
log "Repo cloned"
fi
log "Entering poll loop (interval: ${POLL_INTERVAL:-300}s)"
# Run dev-poll in a loop as agent user
while true; do
su -s /bin/bash agent -c "
cd /home/agent/disinto && \
bash dev/dev-poll.sh ${PROJECT_TOML:-projects/disinto.toml}
" >> "$LOG_DIR/llama-loop.log" 2>&1 || true
sleep "${POLL_INTERVAL:-300}"
done