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

peercoord

package
v0.2.11 Latest Latest
Warning

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

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

Documentation

Overview

Package peercoord runs session-local peer listeners. Only typed messages and task records cross the server boundary; Host operations are strictly local.

Index

Constants

View Source
const Usage = `` /* 1423-byte string literal not displayed */

Variables

This section is empty.

Functions

func BoardKey

func BoardKey(c peer.Connection) string

func CheckRunner

func CheckRunner(ctx context.Context, runner string) error

CheckRunner uses provider-supported status commands. It never reads or copies login files and never includes authentication output in peer messages.

func Directory

func Directory(root, session string) string

func IsCommand

func IsCommand(args []string) bool

func RunAgent

func RunAgent(path string) error

RunAgent is a local, interactive supervisor. The provider CLI runs a structured turn; the pane stays open between turns and can pause/resume automatic delivery. No shared transcript, pane subscription, or remote shell channel is involved.

func RunnerArgs

func RunnerArgs(spec RunnerSpec, conversation, prompt string) ([]string, io.Reader, error)

func ShellQuote

func ShellQuote(s string) string

func WriteJSON

func WriteJSON(path string, value any) error

Types

type Arguments

type Arguments struct {
	Verb, Sub string
	Pos       []string
	Flags     map[string]string
	Text      string
}

func Parse

func Parse(args []string) (Arguments, error)

type Attention

type Attention struct {
	Kind    string `json:"kind"`
	TaskID  string `json:"task_id,omitempty"`
	Task    string `json:"task,omitempty"`
	AgentID string `json:"agent_id,omitempty"`
	Detail  string `json:"detail,omitempty"`
}

type Board

type Board struct {
	Recent          []pc.Event            `json:"recent"`
	AdmissionErrors map[string]string     `json:"admission_errors,omitempty"`
	Connection      peer.Connection       `json:"connection"`
	Workspace       string                `json:"local_workspace"`
	PeerID          string                `json:"peer_id"`
	Token           string                `json:"token"`
	Incarnation     string                `json:"incarnation"`
	Listening       bool                  `json:"listening"`
	Draining        bool                  `json:"draining"`
	Cursor          int64                 `json:"cursor"`
	Projects        map[string]Project    `json:"projects"`
	Endpoints       map[string]*Endpoint  `json:"endpoints"`
	Executions      map[string]*Execution `json:"executions"`
	Inbox           []pc.Event            `json:"inbox"`
	Outbox          []Outgoing            `json:"outbox"`
	State           pc.State              `json:"state"`
	LastContact     time.Time             `json:"last_contact"`
	LastError       string                `json:"last_error,omitempty"`
	Rejoined        bool                  `json:"-"`
}

type CommandContext

type CommandContext struct{ Socket, Execution, Token, Pane, Session string }

type Control

type Control struct {
	CostUSD      float64  `json:"cost_usd,omitempty"`
	Args         []string `json:"args,omitempty"`
	Text         string   `json:"text,omitempty"`
	Execution    string   `json:"execution"`
	Token        string   `json:"token"`
	Pane         string   `json:"pane"`
	Op           string   `json:"op"`
	DeliveryID   string   `json:"delivery_id,omitempty"`
	Conversation string   `json:"conversation,omitempty"`
	Error        string   `json:"error,omitempty"`
}

type ControlReply

type ControlReply struct {
	BudgetRemaining float64 `json:"budget_remaining,omitempty"`
	Output          string  `json:"output,omitempty"`
	Error           string  `json:"error,omitempty"`
	Prompt          string  `json:"prompt,omitempty"`
	DeliveryID      string  `json:"delivery_id,omitempty"`
	Conversation    string  `json:"conversation,omitempty"`
	Stop            bool    `json:"stop"`
	Paused          bool    `json:"paused"`
	Done            bool    `json:"done"`
}

func Call

func Call(ctx context.Context, socket string, req Control) (ControlReply, error)

type Disk

type Disk struct {
	Version int               `json:"version"`
	Boards  map[string]*Board `json:"boards"`
}

type Endpoint

type Endpoint struct {
	LastProbe       time.Time `json:"-"`
	SetupError      string    `json:"setup_error,omitempty"`
	Enrolled        bool      `json:"enrolled"`
	Agent           pc.Agent  `json:"agent"`
	Origin          string    `json:"origin"`
	Mode            string    `json:"mode"`
	AcceptedLeaders []string  `json:"accepted_leaders"`
	Permission      string    `json:"permission"`
	Model           string    `json:"model,omitempty"`
	MaxRuntime      int       `json:"max_runtime"`
	MaxTurns        int       `json:"max_turns"`
	MaxBudgetUSD    float64   `json:"max_budget_usd"`
	LeaderExecution string    `json:"leader_execution,omitempty"`
}

type Execution

type Execution struct {
	SpentUSD       float64    `json:"spent_usd"`
	CommandToken   string     `json:"command_token"`
	LastDeliveryID string     `json:"last_delivery_id,omitempty"`
	ID             string     `json:"id"`
	AgentID        string     `json:"agent_id"`
	TaskID         string     `json:"task_id,omitempty"`
	AttemptID      string     `json:"attempt_id,omitempty"`
	Token          string     `json:"token"`
	PaneID         string     `json:"pane_id"`
	Directory      string     `json:"directory"`
	Branch         string     `json:"branch"`
	Base           string     `json:"base"`
	Phase          string     `json:"phase"`
	CreatedAt      time.Time  `json:"created_at"`
	Deadline       time.Time  `json:"deadline"`
	LastSeen       time.Time  `json:"last_seen"`
	Incarnation    string     `json:"incarnation"`
	Conversation   string     `json:"conversation,omitempty"`
	Inbox          []pc.Event `json:"inbox"`
	Delivery       []pc.Event `json:"delivery"`
	DeliveryID     string     `json:"delivery_id,omitempty"`
	Turns          int        `json:"turns"`
	Paused         bool       `json:"paused"`
	Error          string     `json:"error,omitempty"`
	InitialPrompt  string     `json:"initial_prompt"`
}

type Host

type HostRequest

type HostRequest struct {
	Args                                                                     []string
	Workspace, Op, Origin, Pane, Execution, Directory, Command, Name, Secret string
}

type HostResponse

type HostResponse struct {
	Value  string
	Exists bool
	Err    error
}

type Outgoing

type Outgoing struct {
	Request pc.Request `json:"request"`
	Token   string     `json:"token,omitempty"`
}

type Project

type Project struct {
	Path string `json:"path"`
	Base string `json:"base"`
}

type RunnerSpec

type RunnerSpec struct {
	CommandContext                                                                                 string
	CommandToken                                                                                   string
	KeySecret                                                                                      string
	LogPath                                                                                        string
	Socket, Execution, Token, Pane, Directory, Session, RyshDir, Binary, Runner, Permission, Model string
	MaxTurns                                                                                       int
	MaxBudgetUSD                                                                                   float64
	Deadline                                                                                       time.Time
}

type Runtime

type Runtime struct {
	// contains filtered or unexported fields
}

func New

func New(root, session string, host Host) *Runtime

func (*Runtime) Close

func (r *Runtime) Close()

func (*Runtime) Command

func (r *Runtime) Command(ctx context.Context, workspace, pane string, args []string) (any, error)

func (*Runtime) SetConnected

func (r *Runtime) SetConnected(connected bool)

func (*Runtime) Start

func (r *Runtime) Start() error

type Summary

type Summary struct {
	Board              string         `json:"board"`
	AsOf               time.Time      `json:"as_of"`
	AgentLimit         int            `json:"agent_limit"`
	RegisteredAgents   int            `json:"registered_agents"`
	ReadyAgents        int            `json:"ready_agents"`
	RegisteredAccounts int            `json:"registered_accounts"`
	Runners            map[string]int `json:"runners"`
	Tasks              map[string]int `json:"tasks"`
	Leader             string         `json:"leader"`
	Term               int64          `json:"term"`
	Listening          bool           `json:"local_listening"`
	Attention          []Attention    `json:"attention"`
}

Summary deliberately excludes conversation transcripts, local credentials, task result bodies and provider configuration. Accounts are not human counts.

type TurnResult

type TurnResult struct {
	CostUSD      float64
	Conversation string
	Err          error
}

func RunTurn

func RunTurn(ctx context.Context, spec RunnerSpec, conversation, prompt string, onConversation func(string) error, out io.Writer) TurnResult

Jump to

Keyboard shortcuts

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