feat: add pluggable multi-CLI backend system

Implement BackendAdapter interface with four CLI backends:
- ClaudeCodeBackend (extracted from AgentRuntime)
- CodexBackend (OpenAI Codex CLI)
- GeminiBackend (Google Gemini CLI)
- OpenCodeBackend (OpenCode CLI)

Add BackendRegistry for resolution/creation via AGENT_BACKEND env var.
Refactor AgentRuntime to delegate to BackendAdapter instead of
hardcoding Claude CLI. Update GatewayConfig with new env vars
(AGENT_BACKEND, BACKEND_CLI_PATH, BACKEND_MODEL, BACKEND_MAX_TURNS).

Includes 10 property-based test files and unit tests for edge cases.
This commit is contained in:
2026-02-22 23:41:30 -05:00
parent f2247ea3ac
commit 453389f55c
25 changed files with 3262 additions and 195 deletions

6
src/backends/index.ts Normal file
View File

@@ -0,0 +1,6 @@
export * from "./types.js";
export { ClaudeCodeBackend } from "./claude-backend.js";
export { CodexBackend } from "./codex-backend.js";
export { GeminiBackend } from "./gemini-backend.js";
export { OpenCodeBackend } from "./opencode-backend.js";
export { resolveBackendName, createBackend } from "./registry.js";