@nhtio/adk/batteries/llm/claude_code_cli/adapter
Cross-environment executor adapter that wraps the Claude Code CLI as a DispatchExecutorFn destination.
Remarks
The first battery in the "CLI harness" family: rather than a direct wire-format provider, this adapter drives an external coding-agent CLI binary that is itself a complete agent loop. Since a subprocess must be spawned anyway, ALL Claude-Code-specific complexity — spawning the real claude binary, hosting an MCP bridge server, translating its stream-json — lives in a dedicated wrapper process (wrapper.ts, shipped as a sibling dist asset); this adapter only ever spawns and drives that wrapper over the small, harness-agnostic protocol in ./wire.
Every dispatch iteration is stateless and self-contained: the full accumulated history renders into one -p prompt string (buildClaudeCodeCliPrompt), a fresh wrapper is spawned, and real ADK tools are bridged into the CLI's own tool loop via MCP — but actual execution always happens on the ADK side, through tool.executor(ctx)(args), exactly like every other LLM battery.
Classes
| Class | Description |
|---|---|
| ClaudeCodeCliAdapter | Opinionated CLI-harness LLM adapter that drives the Claude Code CLI as a DispatchExecutorFn destination. |
Functions
| Function | Description |
|---|---|
| resolveDefaultWrapperPath | Resolve the built wrapper asset's on-disk path relative to this module's own compiled location. adapter.ts carries its own @module tag (per the per-file tagging convention every other multi-file battery uses), so it compiles to dist/batteries/llm/claude_code_cli/adapter.mjs — three directories below the package root, where the wrapper (an explicit, un-tagged vite.config.mts entry key) compiles to dist/claude-code-cli-wrapper.mjs. |