Expand description
§ralph-adapters
Agent adapters for the Ralph Orchestrator framework.
This crate provides implementations for various AI agent backends:
- Claude (Anthropic)
- Gemini (Google)
- Codex (OpenAI)
- Pi (pi-coding-agent)
- Roo (Roo Code)
- Amp
- Custom commands
Each adapter implements the common CLI executor interface.
§Auto-Detection
When config specifies agent: auto, the auto_detect module handles
detecting which backends are available in the system PATH.
§PTY Mode
The pty_executor module provides PTY-based execution for Claude CLI,
preserving rich terminal UI features (colors, spinners, animations) while
allowing Ralph to orchestrate iterations. Supports interactive mode (user
input forwarded) and observe mode (output-only).
Re-exports§
pub use pty_handle::ControlCommand;pub use pty_handle::PtyHandle;
Modules§
- pty_
handle - PTY handle abstraction for TUI integration.
Structs§
- AcpExecutor
- Executor for ACP-based backends (kiro-acp).
- Assistant
Message - Message content from Claude’s assistant responses.
- Claude
Stream Parser - Parses NDJSON lines from Claude’s stream output.
- CliBackend
- A CLI backend configuration for executing prompts.
- CliExecutor
- Executor for running prompts through CLI backends.
- Console
Stream Handler - Writes streaming output to stdout/stderr.
- Copilot
Assistant Message - Assistant message payload emitted by Copilot.
- Copilot
Stream Parser - Parses JSONL lines from Copilot’s prompt-mode output.
- CtrlC
State - State machine for double Ctrl+C detection.
- Custom
Backend Error - Error when creating a custom backend without a command.
- Execution
Result - Result of a CLI execution.
- Json
RpcStream Handler - Stream handler that emits JSON-RPC events to a writer.
- NoBackend
Error - Error returned when no backends are available.
- PiCost
- Cost breakdown from pi.
- PiSession
State - State accumulated across events for session summary.
- PiStream
Parser - Parses NDJSON lines from pi’s stream output.
- PiTool
Result - Tool execution result.
- PiTurn
Message - Message in turn_end — contains usage data.
- PiUsage
- Token usage statistics from pi.
- Pretty
Stream Handler - Renders streaming output with colors and markdown.
- PtyConfig
- Configuration for PTY execution.
- PtyExecution
Result - Result of a PTY execution.
- PtyExecutor
- Executor for running prompts in a pseudo-terminal.
- Quiet
Stream Handler - Suppresses all streaming output (for CI/silent mode).
- Session
Result - Session completion result data.
- TuiStream
Handler - Renders streaming output as ratatui Lines for TUI display.
- Usage
- Token usage statistics.
- User
Message - Message content from tool results (user turn).
Enums§
- Claude
Stream Event - Events emitted by Claude’s
--output-format stream-json. - Content
Block - Content blocks in assistant messages.
- Copilot
Stream Event - Events emitted by Copilot’s
--output-format json. - CtrlC
Action - Action to take after handling Ctrl+C.
- Output
Format - Output format supported by a CLI backend.
- PiAssistant
Event - Assistant message event within a message_update.
- PiContent
Block - Content block within a tool result.
- PiStream
Event - Events from pi’s
--mode jsonNDJSON output. - Prompt
Mode - How to pass prompts to the CLI tool.
- Termination
Type - How the PTY process was terminated.
- User
Content Block - Content blocks in user messages (tool results).
Constants§
- DEFAULT_
PRIORITY - Default priority order for backend detection.
Traits§
- Stream
Handler - Handler for streaming output events from Claude.
Functions§
- detect_
backend - Detects the first available backend from a priority list.
- detect_
backend_ default - Detects a backend using default priority and all adapters enabled.
- dispatch_
pi_ stream_ event - Dispatch a pi stream event to the
StreamHandler. - is_
backend_ available - Checks if a backend is available by running its version command.
- stdout_
json_ rpc_ handler - Creates a JsonRpcStreamHandler writing to stdout.