m64_c144bf2eaa03 / start.sh
39 lines, 1.8 KBraw
1#!/usr/bin/env bash2# pi-qwen38max-openrouter-gb10 entrypoint. Runs inside the container; takes no arguments.3# Three processes, all in this container:4# 127.0.0.1:9000 llm_relay.py OpenAI-compatible; forces the model, goes out via the gate5# 127.0.0.1:4096 cli_shim.py runs `pi -p --mode json` once per prompt6# 0.0.0.0:$M64_PORT agent_gateway.py the agent.session API m64's front proxies to7set -eu89echo '{"phase":"loading","detail":"starting pi"}' >> "$M64_STATUS"1011export HOME=/scratch/home12export WORK_DIR=/scratch/work13export SHIM_HOMES=/scratch/homes14mkdir -p "$HOME" "$WORK_DIR/sessions" "$SHIM_HOMES"1516export AGENT_HARNESS=pi17export AGENT_HARNESS_TITLE="pi coding agent 0.73.1 (badlogic/pi-mono)"18export AGENT_MODEL=qwen3.8-max # the name the harness uses19export UPSTREAM_MODEL=qwen/qwen3.8-max-0902 # what the relay sends to OpenRouter20export AGENT_CONTEXT=1000000 # Qwen3.8 Max (0902): 1M context21export AGENT_VISION=122export LLM_BASE_URL=http://127.0.0.1:9000/v123# Node (the harness) sends its own web requests through HTTP(S)_PROXY, the m64 gate (as gx10 does).24export NODE_USE_ENV_PROXY=125export RELAY_TITLE="m64 pi-qwen38max-openrouter-gb10"2627python3 -u /capsule/llm_relay.py &28RELAY_PID=$!29python3 -u /capsule/cli_shim.py &30SHIM_PID=$!3132# If the relay or the shim dies, take the container down so m64 reports the error ($$ is33# the gateway after the exec below). A dead child lingers as a zombie: test its state.34alive() { [ -r "/proc/$1/stat" ] && [ "$(cut -d')' -f2 "/proc/$1/stat" | cut -d' ' -f2)" != Z ]; }35( while alive "$RELAY_PID" && alive "$SHIM_PID"; do sleep 5; done36 echo '{"phase":"error","detail":"the LLM relay or the pi shim exited"}' >> "$M64_STATUS"37 kill -TERM $$ ) &3839exec /opt/gateway/bin/python /capsule/agent_gateway.py