mirror of
https://github.com/katanemo/plano.git
synced 2026-06-08 14:55:14 +02:00
Spawn the local `claude` binary as a subprocess and expose it as an
Anthropic Messages-compatible provider. Hosted in brightstaff
(`CLAUDE_CLI_LISTEN_ADDR`), with session reuse, idle TTL, and watchdog.
User-facing surface is `model_providers: [{ model: claude-cli/* }]` —
the Python CLI auto-fills name/provider_interface/base_url/access_key
and the launcher (native + supervisord) enables the bridge listener
only when at least one claude-cli provider is present.
66 lines
2.7 KiB
Text
66 lines
2.7 KiB
Text
[supervisord]
|
|
nodaemon=true
|
|
pidfile=/var/run/supervisord.pid
|
|
|
|
[program:config_generator]
|
|
command=/bin/sh -c "\
|
|
uv run python -m planoai.config_generator && \
|
|
envsubst < /app/plano_config_rendered.yaml > /app/plano_config_rendered.env_sub.yaml && \
|
|
envsubst < /etc/envoy/envoy.yaml > /etc/envoy.env_sub.yaml && \
|
|
touch /tmp/config_ready || \
|
|
(echo 'Config generation failed, shutting down'; kill -15 $(cat /var/run/supervisord.pid))"
|
|
priority=10
|
|
autorestart=false
|
|
startsecs=0
|
|
stdout_logfile=/dev/stdout
|
|
redirect_stderr=true
|
|
stdout_logfile_maxbytes=0
|
|
stderr_logfile_maxbytes=0
|
|
|
|
[program:brightstaff]
|
|
# CLAUDE_CLI_LISTEN_ADDR is set automatically when the rendered config has at
|
|
# least one provider with `provider_interface: claude-cli` (the Python config
|
|
# generator auto-fills that field for any `model: claude-cli/*` entry). The
|
|
# bridge listener stays off otherwise — matches native_runner.py behavior.
|
|
command=sh -c "\
|
|
while [ ! -f /tmp/config_ready ]; do echo '[brightstaff] Waiting for config generation...'; sleep 0.5; done && \
|
|
if grep -q 'provider_interface: claude-cli' /app/plano_config_rendered.env_sub.yaml 2>/dev/null; then \
|
|
export CLAUDE_CLI_LISTEN_ADDR=${CLAUDE_CLI_LISTEN_ADDR:-127.0.0.1:14001}; \
|
|
echo '[brightstaff] claude-cli bridge enabled on '$CLAUDE_CLI_LISTEN_ADDR; \
|
|
fi; \
|
|
RUST_LOG=${LOG_LEVEL:-info} \
|
|
PLANO_CONFIG_PATH_RENDERED=/app/plano_config_rendered.env_sub.yaml \
|
|
/app/brightstaff 2>&1 | \
|
|
tee /var/log/brightstaff.log | \
|
|
while IFS= read -r line; do echo '[brightstaff]' \"$line\"; done; \
|
|
echo '[brightstaff] Process exited, shutting down'; kill -15 $(cat /var/run/supervisord.pid)"
|
|
priority=20
|
|
autorestart=false
|
|
stdout_logfile=/dev/stdout
|
|
redirect_stderr=true
|
|
stdout_logfile_maxbytes=0
|
|
stderr_logfile_maxbytes=0
|
|
|
|
[program:envoy]
|
|
command=/bin/sh -c "\
|
|
while [ ! -f /tmp/config_ready ]; do echo '[plano_logs] Waiting for config generation...'; sleep 0.5; done && \
|
|
envoy -c /etc/envoy.env_sub.yaml \
|
|
--component-log-level wasm:${LOG_LEVEL:-info} \
|
|
--log-format '[%%Y-%%m-%%d %%T.%%e][%%l] %%v' 2>&1 | \
|
|
tee /var/log/envoy.log | \
|
|
while IFS= read -r line; do echo '[plano_logs]' \"$line\"; done; \
|
|
echo '[plano_logs] Process exited, shutting down'; kill -15 $(cat /var/run/supervisord.pid)"
|
|
priority=20
|
|
autorestart=false
|
|
stdout_logfile=/dev/stdout
|
|
redirect_stderr=true
|
|
stdout_logfile_maxbytes=0
|
|
stderr_logfile_maxbytes=0
|
|
|
|
[program:tail_access_logs]
|
|
command=/bin/sh -c "tail -F /var/log/access_*.log | \
|
|
while IFS= read -r line; do echo '[access_logs]' \"$line\"; done"
|
|
stdout_logfile=/dev/stdout
|
|
redirect_stderr=true
|
|
stdout_logfile_maxbytes=0
|
|
stderr_logfile_maxbytes=0
|