NAME

Langertha::Raider::ACP::Client - Minimal synchronous ACP client over TCP

VERSION

version 0.503

SYNOPSIS

use Langertha::Raider::ACP::Client;
my $c = Langertha::Raider::ACP::Client->new(host => '127.0.0.1', port => 38421);
my $init = $c->initialize;
my $s    = $c->new_session;
$c->prompt_stream($s->{sessionId}, "summarise Changes", sub {
    my ($update) = @_;
    # $update is the params of a session/update JSON-RPC notification
    print $update->{update}{content}{text} // '';
});

DESCRIPTION

Line-framed JSON-RPC 2.0 over a blocking TCP socket. Matched against Langertha::Raider::Hall::ACP on the server side, but protocol-clean so it speaks to any conforming ACP agent.

Sync by design: this is a CLI client, not a daemon. The one non-trivial piece is prompt_stream, which multiplexes inbound session/update notifications with the pending session/prompt response on the same socket.

new

my $c = Langertha::Raider::ACP::Client->new(host => '127.0.0.1', port => 38421, timeout => 10);

Opens the connection; port is required, host defaults to 127.0.0.1 and timeout (seconds) to 10. Dies on failure.

initialize

Handshake. Returns the server's result hash (protocolVersion, agentCapabilities).

new_session

my $s = $c->new_session({ raiderName => 'bjorn' });

Create a session. Adds the current cwd automatically if the caller didn't set one. Returns the result hash (sessionId, ...).

prompt_stream

my $result = $c->prompt_stream($session_id, $text, $on_update);

Send a prompt, invoke $on_update->($params) for each session/update notification that arrives, and return the final result hash (typically { stopReason => ... }).

cancel

$c->cancel($session_id);

Send session/cancel. Returns the server's result.

SEE ALSO

Langertha::Raider::Hall::ACP, Langertha::Raider::ACP::CLI.

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/langertha-raider/issues.

IRC

Join #langertha on irc.perl.org or message Getty directly.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.