Help us shape the future of Go! Take the 2026 Go Developer Survey

peer

package
v0.116.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

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

View Source
const DefaultTimeout = 90 * time.Second

DefaultTimeout bounds a send: the turn takes about 5 to 15 s.

Variables

View Source
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.

func (Sender) Send

func (s Sender) Send(ctx context.Context, to, message string) (Result, error)

Send delivers message to the running session named to.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL