client

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 29 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultAddr   = "127.0.0.1:7272"
	DefaultListen = ":7272"
)
View Source
const HubAgent = "assistant"

HubAgent is the assistant's name as an agent: its live conversation, whichever that is now.

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() string

func From

func From(pool []sessions.Session, sg Sign) string

func IsAssistant

func IsAssistant(pool []sessions.Session) bool

IsAssistant is whether this is the assistant's conversation; the hub's other one, the guests', speaks for the user's guests and never for the user.

func Ref

func Ref(s sessions.Session) string

func Resolve

func Resolve(q string, pool []sessions.Session) (sessions.Session, error)

func SaveLogin

func SaveLogin(u, token, ca string) error

func Self

func Self(pool []sessions.Session) (sessions.Session, bool)

func ServerTokenPath

func ServerTokenPath() string

func Signed

func Signed(pool []sessions.Session, sg Sign, text string) (string, error)

Types

type Agent

type Agent struct {
	Name  string `json:"name"`
	Title string `json:"title,omitempty"`
	Host  string `json:"host"`
	Share *struct {
		Page  string `json:"page"`
		About string `json:"about,omitempty"`
	} `json:"share,omitempty"`
	Badge    any    `json:"badge,omitempty"`
	Headline string `json:"headline,omitempty"`
	Talk     bool   `json:"talk,omitempty"`
}

type Client

type Client struct {
	URL   string `json:"url"`
	Token string `json:"token"`
	CA    string `json:"ca,omitempty"`
	// contains filtered or unexported fields
}

func Load

func Load() *Client

func (*Client) AddBacklog

func (c *Client) AddBacklog(host string, req map[string]any) (it backlog.Item, err error)

func (*Client) AgentLine

func (c *Client) AgentLine(agent string) (int, []byte, error)

AgentLine asks atc for an agent's conversation to put on a call, for the hub: the status and body as they came.

func (*Client) Agents

func (c *Client) Agents() (list []Agent, err error)

func (*Client) Attach

func (c *Client) Attach(id string) error

func (*Client) Backlog

func (c *Client) Backlog() (items []backlog.Item, err error)

func (*Client) Begin

func (c *Client) Begin(host string, req map[string]any) (string, error)

func (*Client) Call

func (c *Client) Call(req map[string]any) (string, error)

func (*Client) Caps

func (c *Client) Caps(out any) error

Caps asks the server for the feature list, briefly: `atc doctor` does the checks itself when no server answers.

func (*Client) Days

func (c *Client) Days(n int) ([]usage.Day, error)

func (*Client) Deliver

func (c *Client) Deliver(ctx context.Context, x sessions.Session, text string, report, wake, approved bool) (id string, resumed bool, err error)

func (*Client) Detached

func (c *Client) Detached(id, title string) string

func (*Client) Dirs

func (c *Client) Dirs(host string) (list []Dir, err error)

func (*Client) Events

func (c *Client) Events(ctx context.Context, fn func([]sessions.Session)) error

func (*Client) Feed

func (c *Client) Feed(since int64, full bool) (text string, seq int64, err error)

Feed is what changed in atc after seq since, or with full how things stand now: one short try, since the assistant's message waits on it.

func (*Client) Find

func (c *Client) Find(q string, withPast bool) (sessions.Session, error)

func (*Client) GuestEdit

func (c *Client) GuestEdit(op, name, number string) error

func (*Client) Guests

func (c *Client) Guests() (map[string]string, error)

func (*Client) HidePage

func (c *Client) HidePage(sid, name string) error

func (*Client) History

func (c *Client) History(q, dir string, limit int) (list []sessions.Session, err error)

func (*Client) Launch

func (c *Client) Launch(ctx context.Context, l Launch) (id, dir string, err error)

func (*Client) Limits

func (c *Client) Limits() (l usage.Limits, err error)

func (*Client) Live

func (c *Client) Live() (list []sessions.Session, err error)

func (*Client) Me

func (c *Client) Me() Me

func (*Client) Message

func (c *Client) Message(agent, text string) (string, error)

Message wakes an agent with text: its conversation, resumed or started as needed.

func (*Client) Notify

func (c *Client) Notify(sid string, req map[string]any) (string, error)

func (*Client) OpenPage

func (c *Client) OpenPage(sid string, req map[string]any) (r struct{ OK, Link string }, err error)

func (*Client) Outputs

func (c *Client) Outputs(sid string) (o Outputs, err error)

func (*Client) PageState

func (c *Client) PageState(sid, name string) (st json.RawMessage, err error)

func (*Client) Pages

func (c *Client) Pages(sid string) (list []pages.Page, err error)

func (*Client) Pairing

func (c *Client) Pairing(url string) (text string, err error)

Pairing is a one-time code to let a new device in, as text. url overrides the address it carries.

func (*Client) Patch

func (c *Client) Patch(sid string, fields map[string]any) error

func (*Client) PatchBacklog

func (c *Client) PatchBacklog(host, id string, fields map[string]any) (it backlog.Item, err error)

func (*Client) Presets

func (c *Client) Presets() (ps []Preset, err error)

func (*Client) Recent

func (c *Client) Recent() (list []sessions.Session, err error)

Recent is Live as of the server's last poll when that is a few seconds old at most: for looking, not acting.

func (*Client) Remove

func (c *Client) Remove(id string) error

func (*Client) Resources

func (c *Client) Resources(host string) (r resources.Report, err error)

func (*Client) Resume

func (c *Client) Resume(sid string) (string, error)

func (*Client) Send

func (c *Client) Send(id, text string) error

Send types text into a session. From inside a Claude session it says which one sent it, so the hub hears it as another session rather than the user typing.

func (*Client) ServerHome

func (c *Client) ServerHome() string

func (*Client) SessionUsage

func (c *Client) SessionUsage(sid string) (st usage.Stats, err error)

func (*Client) SetPageState

func (c *Client) SetPageState(sid, name string, st json.RawMessage) error

func (*Client) Shelve

func (c *Client) Shelve(sid, title string) (it backlog.Item, err error)

Shelve sends a session to the backlog: stopped and off the list, its item resuming it.

func (*Client) Show

func (c *Client) Show(sid string, req map[string]any) (r struct {
	Page    pages.Page `json:"page"`
	Created bool       `json:"created"`
	Link    string     `json:"link"`
}, err error)

func (*Client) Start

func (c *Client) Start(dir, name, prompt string) (string, error)

func (*Client) StartOn

func (c *Client) StartOn(host, dir, name, prompt string, worktree bool) (string, error)

func (*Client) StartPreset

func (c *Client) StartPreset(name, prompt string) (string, string, error)

func (*Client) Stop

func (c *Client) Stop(id string) error

func (*Client) Summary

func (c *Client) Summary(sid string, wait int, again bool) (s Summary, err error)

func (*Client) Transcript

func (c *Client) Transcript(sid string) (p history.Page, err error)

func (*Client) Trust

func (c *Client) Trust(u *Untrusted) error

Trust puts Claude Code's own trust prompt for the folder in this terminal, and returns once it is answered.

func (*Client) Turns

func (c *Client) Turns(sid string) (turns []history.Turn, waiting []history.Waiting, err error)

func (*Client) Until

func (c *Client) Until(ctx context.Context, key string, limit time.Duration, ok func(sessions.Session) bool) error

func (*Client) WhatsApp

func (c *Client) WhatsApp(req map[string]any) ([]string, error)

type Dir

type Dir struct {
	Path   string `json:"path"`
	Recent bool   `json:"recent"`
}

type File

type File struct {
	outputs.File
	URL string `json:"url"`
}

type Launch

type Launch struct {
	Host, Dir, Name, Preset, Prompt string
	Worktree, Report, Approved      bool
}

type Me

type Me struct {
	Host  string   `json:"host"`
	Home  string   `json:"home"`
	Hosts []string `json:"hosts"`
	Peers []struct {
		Name  string `json:"name"`
		Error string `json:"error"`
	} `json:"peers"`
}

type Outputs

type Outputs struct {
	Pages   []pages.Page   `json:"pages"`
	Servers []Server       `json:"servers"`
	Links   []outputs.Link `json:"links"`
	Files   []File         `json:"files"`
}

type Preset

type Preset struct {
	Name  string `json:"name"`
	Dir   string `json:"dir"`
	Brief string `json:"brief,omitempty"`
	Host  string `json:"host,omitempty"`
}

type Server

type Server struct {
	URL       string `json:"url"`
	Port      int    `json:"port"`
	LocalOnly bool   `json:"localOnly,omitempty"`
	Running   bool   `json:"running"`
}

type Sign

type Sign struct{ Started, Report, Approved bool }

type Summary

type Summary struct {
	Summary     *summary.Summary `json:"summary"`
	Summarizing bool             `json:"summarizing"`
}

type Untrusted

type Untrusted struct{ Host, Dir, Parent, Msg string }

func (*Untrusted) Error

func (u *Untrusted) Error() string

Jump to

Keyboard shortcuts

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