feat(claude-cli): add local Claude Code CLI provider bridge

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.
This commit is contained in:
Spherrrical 2026-05-04 12:57:53 -07:00
parent b71a555f19
commit 9fdfeb7cbf
26 changed files with 2847 additions and 2 deletions

View file

@ -184,6 +184,7 @@ properties:
enum:
- plano
- claude
- claude-cli
- deepseek
- groq
- mistral
@ -242,6 +243,7 @@ properties:
enum:
- plano
- claude
- claude-cli
- deepseek
- groq
- mistral

View file

@ -18,8 +18,16 @@ 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 | \