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

peer

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: 18 Imported by: 0

Documentation

Overview

Package peer exchanges explicit messages with a server workspace. It has no NATS upstream, sharing, pane-control or agent-execution dependencies.

Index

Constants

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

Variables

This section is empty.

Functions

func Display

func Display(text string) string

Remote text is data. Strip terminal controls before rendering to a terminal.

func FormatMessage

func FormatMessage(m Message) string

func Save

func Save(root, session string, c Connection) error

Save is atomic and stores only a secret's name, never its value.

func ValidBoard

func ValidBoard(name string) bool

func ValidateURL

func ValidateURL(raw string) error

Types

type Args

type Args struct {
	Verb, URL, KeySecret, Workspace, Board, ID, Thread, Text string
	After                                                    *int64
	Limit                                                    int
	JSON                                                     bool
}

func Parse

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

type Client

type Client struct {
	Connection Connection
	Key        string
}

func (Client) ResolveWorkspace

func (c Client) ResolveWorkspace(ctx context.Context) (string, error)

func (Client) Send

func (c Client) Send(ctx context.Context, p Post) (Receipt, error)

func (Client) Status

func (c Client) Status(ctx context.Context) (Status, error)

func (Client) Tail

func (c Client) Tail(ctx context.Context, after *int64, limit int) (Page, error)

type Connection

type Connection struct {
	Enabled   bool   `json:"enabled"`
	URL       string `json:"url"`
	Workspace string `json:"workspace"`
	Board     string `json:"board"`
	KeySecret string `json:"key_secret"`
	SessionID string `json:"session_id"`
}

func Load

func Load(root, session string) (Connection, error)

type CoordinationClient

type CoordinationClient struct {
	Client
	PeerToken string
}

Coordination uses the existing workspace authorization plus a registration credential. Credentials stay in the local daemon, not task prompts.

func (CoordinationClient) Apply

func (c CoordinationClient) Apply(ctx context.Context, r pc.Request, token string) (pc.Response, error)

func (CoordinationClient) Events

func (c CoordinationClient) Events(ctx context.Context, after int64) (pc.Page, error)

func (CoordinationClient) State

func (c CoordinationClient) State(ctx context.Context) (pc.State, error)

type Message

type Message struct {
	WorkspaceID string    `json:"workspace_id"`
	Board       string    `json:"board"`
	Sequence    int64     `json:"sequence"`
	ID          string    `json:"id"`
	ThreadID    string    `json:"thread_id"`
	UserID      string    `json:"user_id"`
	SessionID   string    `json:"session_id"`
	SessionName string    `json:"session_name"`
	AgentID     string    `json:"agent_id"`
	AgentName   string    `json:"agent_name"`
	Text        string    `json:"text"`
	CreatedAt   time.Time `json:"created_at"`
}

type Page

type Page struct {
	Messages []Message `json:"messages"`
	Next     int64     `json:"next"`
	HasMore  bool      `json:"has_more"`
}

type Post

type Post struct {
	ID          string `json:"id"`
	ThreadID    string `json:"thread_id,omitempty"`
	SessionID   string `json:"session_id"`
	SessionName string `json:"session_name"`
	AgentID     string `json:"agent_id"`
	AgentName   string `json:"agent_name"`
	Text        string `json:"text"`
}

type Receipt

type Receipt struct {
	Message  Message `json:"message"`
	Replayed bool    `json:"replayed"`
}

type Status

type Status struct {
	Workspace string `json:"workspace_id"`
	Board     string `json:"board"`
	User      string `json:"user_id"`
	Role      string `json:"role"`
	Transport string `json:"transport"`
}

Jump to

Keyboard shortcuts

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