Documentation
¶
Overview ¶
Package peer sends a message to a running Claude session from the command line. Claude Code has no send command, so the message goes through one headless `claude -p` turn whose only tool is SendMessage: the same messaging a session uses to reach another session on this machine. It reaches a session only while that session's CLI runs, and only by the name ListAgents shows (a desktop session's title), never by its local_ id.
This rests on Claude Code's own peer messaging, which is not a documented interface: the tool's result text is what says whether the message was delivered. Everything that depends on it is in this package, and its live test (BEEKEEPER_PEER_TEST) runs it against a real session.
Index ¶
Constants ¶
const DefaultTimeout = 90 * time.Second
DefaultTimeout bounds a send: the turn takes about 5 to 15 s.
Variables ¶
var ErrUnreachable = errors.New("not reachable from the command line")
ErrUnreachable is a target whose CLI does not run or whose name no running session has.
Functions ¶
This section is empty.
Types ¶
type Result ¶
type Result struct {
// Reply is the SendMessage tool's result.
Reply string
CostUSD float64
Elapsed time.Duration
}
Result is what a send cost and what the tool said.
type Sender ¶
type Sender struct {
// Claude is the claude binary; empty: claude on PATH.
Claude string
// Model runs the sender's turn; empty: haiku.
Model string
// Dir is the sender's working directory; empty: the current one. The
// turn loads no settings, plugins, MCP servers or project instructions.
Dir string
// Timeout bounds the turn; zero: DefaultTimeout.
Timeout time.Duration
}
Sender runs the headless turn that sends a message.