class
ACP::ProcessTransport
- ACP::ProcessTransport
- ACP::StdioTransport
- ACP::Transport
- Reference
- Object
Overview
A convenience wrapper that spawns an agent process and creates
a StdioTransport connected to its stdin/stdout. The agent's
stderr is forwarded to a configurable IO (default: STDERR).
Defined in:
acp/transport.crConstructors
-
.new(command : String, args : Array(String) = [] of String, env : Process::Env = nil, chdir : String | Nil = nil, stderr : IO = STDERR, buffer_size : Int32 = 256)
Spawns an agent process with the given command and arguments, and sets up the stdio transport.
Instance Method Summary
-
#close : Nil
Closes the transport and terminates the agent process if it's still running.
-
#process : Process
The underlying child process.
-
#terminated? : Bool
Returns true if the agent process has terminated.
-
#wait : Process::Status
Waits for the agent process to exit and returns its status.
Instance methods inherited from class ACP::StdioTransport
close : Nil
close,
closed? : Bool
closed?,
incoming : Channel(JSON::Any | Nil)
incoming,
receive(timeout : Time::Span) : JSON::Any | Nilreceive : JSON::Any | Nil receive, send(message : Hash(String, JSON::Any)) : Nil send
Constructor methods inherited from class ACP::StdioTransport
new(reader : IO, writer : IO, buffer_size : Int32 = 256)
new
Instance methods inherited from class ACP::Transport
close : Nil
close,
closed? : Bool
closed?,
receive : JSON::Any | Nil
receive,
send(message : Hash(String, JSON::Any)) : Nil
send,
send_json(obj : Hash(String, JSON::Any)) : Nil
send_json
Constructor Detail
def self.new(command : String, args : Array(String) = [] of String, env : Process::Env = nil, chdir : String | Nil = nil, stderr : IO = STDERR, buffer_size : Int32 = 256)
#
Spawns an agent process with the given command and arguments, and sets up the stdio transport.
command— the agent executable (e.g., "claude-agent").args— command-line arguments for the agent.env— optional environment variables.chdir— optional working directory for the process.stderr— where to send the agent's stderr (default: STDERR).buffer_size— channel buffer size (default: 256).