tui

package
v0.1.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 39 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 BtwTag = "btw"

BtwTag marks a btw task in the activity log's tags.

View Source
const PacketTime = 1400 * time.Millisecond

PacketTime is how long a packet takes from sender to recipient.

Variables

This section is empty.

Functions

func Accept

func Accept(value string, tok Token, c Candidate) (string, int)

Accept replaces tok with c and a trailing space; it returns the new value and the cursor (a rune offset) after the space.

func Complete

func Complete(value string, cursor int, src Sources) (Token, []Candidate)

Complete finds the token at the cursor and its candidates.

func ExpandMentions

func ExpandMentions(text string, short map[string]string) string

ExpandMentions turns short @mentions into full handles (@sonnet-1 into @halo-sonnet-1). short maps the name without '@' to the handle.

func GitFiles

func GitFiles(ctx context.Context, repo string) ([]string, error)

GitFiles lists the files git tracks in repo.

func GitShow

func GitShow(ctx context.Context, repo, sha string) (string, error)

GitShow returns a commit's message, stat and patch (against its first parent).

func MascotANSI

func MascotANSI() []string

MascotANSI is a still mascot in 24-bit color, for text printed outside the TUI (usage, goodbyes).

func MascotFrame

func MascotFrame(t time.Duration) []string

MascotFrame is the mascot at t into its loop, uncolored: five rows of five cells (halo, gap, body). Callers that print plain text use it.

func QR

func QR(text string) []string

QR draws text as a QR code, two modules a line, dark on light whatever the terminal's colors, with a quiet zone so phones read it.

func Run

func Run(ctx context.Context, o Options) error

Run starts the TUI and blocks until it quits.

func RunSetup

func RunSetup(ctx context.Context, o SetupOptions) error

RunSetup runs the setup screen until it is closed.

func RunShort

func RunShort(root string) string

RunShort is the run's id as Halo's branches spell it: halo/<short>.

Types

type Agent

type Agent struct {
	Member
	Online  bool
	State   string // idle, working, asking, waiting, failed, done
	Sub     string // the subtask it works on
	Log     []string
	Since   time.Time
	LastAct time.Time
	Usage   Usage    // tokens and cost, for agents this Halo hosts
	Feed    []*Block // the live transcript, for agents this Halo hosts
	// contains filtered or unexported fields
}

Agent is what the TUI knows about one address.

type Backend

type Backend interface {
	// Stream calls fn for each activity entry until ctx ends.
	Stream(ctx context.Context, fn func(lg.Entry), connected func(bool, error)) error
	// Send starts a run: a prompt to the lead, with images (files on this machine)
	// attached. It returns the root task ID.
	Send(ctx context.Context, text string, images []string) (string, error)
	// Waiting lists the tasks waiting on you, oldest first.
	Waiting(ctx context.Context) ([]Wait, error)
	// Answer answers a waiting task; decision is "approve", "reject" or "".
	Answer(ctx context.Context, taskID, text, decision string) error
	// Cancel cancels a task.
	Cancel(ctx context.Context, taskID string) error
	// Online lists the roster's agents with a tunnel up.
	Online(ctx context.Context, handles []string) ([]string, error)
	// Commits lists the commits of run short since it started.
	Commits(ctx context.Context, short string, since time.Time) ([]Commit, error)
	// Diff returns a commit's git show output. task, if set, is the task that
	// published the commit to Lagrange, which has its patch when git doesn't.
	Diff(ctx context.Context, sha, task string) (string, error)
	// Runs lists your runs with the lead, newest first.
	Runs(ctx context.Context) ([]RunInfo, error)
	// History returns the activity log so far, oldest first.
	History(ctx context.Context) ([]lg.Entry, error)
	// Continue makes later prompts continue run root's conversation, so the lead
	// remembers it; "" starts a fresh one.
	Continue(root string)
	// Message sends the person's message to an agent during a run: to is the lead's
	// or a worker's handle, subtask the subtask it is about ("" for the worker's
	// current one). direct sends it straight to the worker, in its session;
	// otherwise the lead relays it. It fails when there is no such run or subtask.
	Message(ctx context.Context, to, subtask, text string, direct bool) error
	// Btw asks the lead something on the side of run root, like Claude Code's
	// /btw: it starts no run and changes no plan. The lead answers when it can;
	// the answer arrives as the btw task completing.
	Btw(ctx context.Context, root, text string) error
	// StopSubtask stops the worker of a running subtask: its task is canceled and the
	// lead hears it was on purpose. It fails when the subtask isn't running.
	StopSubtask(ctx context.Context, subtask string) error
}

Backend is where the TUI gets its events and sends what you do.

type Block

type Block struct {
	Kind    string // "user", "think", "say", "tool", "plan"
	Task    string
	Text    string
	ID      string // the tool call
	Title   string
	Tool    string // the ACP tool kind: execute, read, edit, search, fetch, …
	Status  string // pending, in_progress, completed, failed
	Input   json.RawMessage
	Output  string
	Started time.Time
	Ended   time.Time
	Entries []PlanEntry
}

Block is one entry of an agent's live transcript.

type Candidate

type Candidate struct {
	Text string
	Desc string
}

Candidate is one completion: Text replaces the token, Desc is shown beside it.

type Comm

type Comm struct {
	At             time.Time
	Kind           string // task, ask, reply, review, fail, hub
	From, To, Text string // Text is the whole message
	Sub            string // the subtask it is about
}

Comm is one line of the agent-to-agent log.

type Commit

type Commit struct {
	SHA, Author, Subject, Refs string
	At                         time.Time
	Files, Add, Del            int
	Sub                        string   // the subtask, from the subject ("halo: S2 …")
	Parents                    []string // parent SHAs, first parent first
	Task                       string   // the task that published it to Lagrange, if one did
}

Commit is a commit of the current run: a worker's subtask, a merge into the run branch, or the run landing on your branch.

func GitCommits

func GitCommits(ctx context.Context, repo, short string, since time.Time) ([]Commit, error)

GitCommits lists a run's commits in repo: everything on its branches (halo/<short> and halo/<short>-*), plus what Halo committed on the checked-out branch since the run started (the merge that lands it).

func (Commit) Short

func (c Commit) Short() string

Short is the abbreviated SHA.

type Connector

type Connector interface {
	Telegram(ctx context.Context) (*client.Telegram, error)
	ConnectTelegram(ctx context.Context, token string) (*client.Telegram, error)
	PairTelegram(ctx context.Context) (*client.Telegram, error)
	SetTelegramLevel(ctx context.Context, level string) (*client.Telegram, error)
	TestTelegram(ctx context.Context) error
	DisconnectTelegram(ctx context.Context) error
}

Connector is a Backend that can connect Telegram.

type Demo

type Demo struct {
	Human, Prefix string
	// contains filtered or unexported fields
}

Demo is a Backend that plays a scripted run, shaped exactly like Lagrange's activity log, so the TUI can be tried (and screenshotted) without a server or tokens. Answering the plan approval moves it on; it approves itself after 8 s.

func (*Demo) Answer

func (d *Demo) Answer(_ context.Context, _ string, text, decision string) error

Answer implements Backend.

func (*Demo) Btw

func (d *Demo) Btw(ctx context.Context, root, text string) error

Btw implements Backend: a fake btw task that the lead answers a few seconds later.

func (*Demo) Cancel

func (d *Demo) Cancel(context.Context, string) error

Cancel implements Backend.

func (*Demo) Commits

func (d *Demo) Commits(context.Context, string, time.Time) ([]Commit, error)

Commits implements Backend: the commits the scripted run made.

func (*Demo) ConnectTelegram

func (d *Demo) ConnectTelegram(ctx context.Context, token string) (*client.Telegram, error)

ConnectTelegram implements Connector.

func (*Demo) Continue

func (d *Demo) Continue(string)

Continue implements Backend.

func (*Demo) Diff

func (d *Demo) Diff(_ context.Context, sha, _ string) (string, error)

Diff implements Backend.

func (*Demo) DisconnectTelegram

func (d *Demo) DisconnectTelegram(context.Context) error

DisconnectTelegram implements Connector.

func (*Demo) History

func (d *Demo) History(context.Context) ([]lg.Entry, error)

History implements Backend.

func (*Demo) Message

func (d *Demo) Message(_ context.Context, to, subtask, text string, direct bool) error

Message implements Backend: the demo has no agents to reach, so it shows the message as a fake human_message task to the lead that completes at once.

func (*Demo) Online

func (d *Demo) Online(_ context.Context, handles []string) ([]string, error)

Online implements Backend.

func (*Demo) Output

func (d *Demo) Output(_ context.Context, path string) (string, error)

Output implements Procs.

func (*Demo) PairTelegram

func (d *Demo) PairTelegram(context.Context) (*client.Telegram, error)

PairTelegram implements Connector.

func (*Demo) Runs

func (d *Demo) Runs(context.Context) ([]RunInfo, error)

Runs implements Backend: the demo keeps no history.

func (*Demo) Send

func (d *Demo) Send(context.Context, string, []string) (string, error)

Send implements Backend: the demo ignores the prompt and plays its run.

func (*Demo) SetTelegramLevel

func (d *Demo) SetTelegramLevel(_ context.Context, level string) (*client.Telegram, error)

SetTelegramLevel implements Connector.

func (*Demo) Shells

func (d *Demo) Shells(context.Context) ([]Shell, error)

Shells implements Procs.

func (*Demo) Stop

func (d *Demo) Stop(_ context.Context, pid int) error

Stop implements Procs.

func (*Demo) StopSubtask

func (d *Demo) StopSubtask(_ context.Context, subtask string) error

StopSubtask implements Backend: the scripted run goes on, but the request shows.

func (*Demo) Stream

func (d *Demo) Stream(ctx context.Context, fn func(lg.Entry), connected func(bool, error)) error

Stream implements Backend.

func (*Demo) Telegram

func (d *Demo) Telegram(context.Context) (*client.Telegram, error)

Telegram implements Connector.

func (*Demo) TestTelegram

func (d *Demo) TestTelegram(context.Context) error

TestTelegram implements Connector.

func (*Demo) Updates

func (d *Demo) Updates() <-chan Update

Updates is the demo's raw agent output, for Options.Feed.

func (*Demo) Waiting

func (d *Demo) Waiting(context.Context) ([]Wait, error)

Waiting implements Backend.

type Dot

type Dot struct {
	From  string
	Start time.Time
}

Dot is a streamed chunk travelling from an agent to the hub.

type Live

type Live struct {
	Server, Key, Human, Lead string
	Repo                     string // the git repository the team works on
	Since                    int64  // where the stream starts: 0 replays everything, -1 starts now
	// Token returns an address token (the lead's) for Message: A2A calls with
	// Halo's metadata need one, since the API key only works on /api. It is a func
	// because the hosted team may provision its tokens after the TUI starts. nil or
	// "" uses Key.
	Token func() string
	// contains filtered or unexported fields
}

Live is the Backend of a Lagrange server.

func (*Live) Answer

func (l *Live) Answer(ctx context.Context, taskID, text, decision string) error

Answer implements Backend.

func (*Live) Btw

func (l *Live) Btw(ctx context.Context, root, text string) error

Btw implements Backend. The task nests under the run (Lagrange-Task) and is tagged btw, so every client shows it in the run instead of as a new one.

func (*Live) Cancel

func (l *Live) Cancel(ctx context.Context, taskID string) error

Cancel implements Backend.

func (*Live) Commits

func (l *Live) Commits(ctx context.Context, short string, since time.Time) ([]Commit, error)

Commits implements Backend from the local git repository.

func (*Live) ConnectTelegram

func (l *Live) ConnectTelegram(ctx context.Context, token string) (*client.Telegram, error)

ConnectTelegram implements Connector.

func (*Live) Continue

func (l *Live) Continue(root string)

Continue implements Backend.

func (*Live) Diff

func (l *Live) Diff(ctx context.Context, sha, task string) (string, error)

Diff implements Backend.

func (*Live) DisconnectTelegram

func (l *Live) DisconnectTelegram(ctx context.Context) error

DisconnectTelegram implements Connector.

func (*Live) Files

func (l *Live) Files(ctx context.Context) ([]string, error)

Files implements filer.

func (*Live) History

func (l *Live) History(ctx context.Context) ([]lg.Entry, error)

History implements Backend: it pages through GET /api/activity.

func (*Live) Message

func (l *Live) Message(ctx context.Context, to, subtask, text string, direct bool) error

Message implements Backend: it sends the lead a message with Halo's human_message metadata, which the hosting Halo routes without a Claude turn of the lead, and returns the lead's refusal as an error.

func (*Live) Online

func (l *Live) Online(ctx context.Context, handles []string) ([]string, error)

Online implements Backend.

func (*Live) PairTelegram

func (l *Live) PairTelegram(ctx context.Context) (*client.Telegram, error)

PairTelegram implements Connector.

func (*Live) Runs

func (l *Live) Runs(ctx context.Context) ([]RunInfo, error)

Runs implements Backend.

func (*Live) Send

func (l *Live) Send(ctx context.Context, text string, images []string) (string, error)

Send implements Backend.

func (*Live) SetTelegramLevel

func (l *Live) SetTelegramLevel(ctx context.Context, level string) (*client.Telegram, error)

SetTelegramLevel implements Connector.

func (*Live) StopSubtask

func (l *Live) StopSubtask(ctx context.Context, subtask string) error

StopSubtask implements Backend, with Halo's stop_subtask metadata, which the hosting Halo handles like a human_message.

func (*Live) Stream

func (l *Live) Stream(ctx context.Context, fn func(lg.Entry), connected func(bool, error)) error

Stream implements Backend.

func (*Live) Telegram

func (l *Live) Telegram(ctx context.Context) (*client.Telegram, error)

Telegram implements Connector.

func (*Live) TestTelegram

func (l *Live) TestTelegram(ctx context.Context) error

TestTelegram implements Connector.

func (*Live) Waiting

func (l *Live) Waiting(ctx context.Context) ([]Wait, error)

Waiting implements Backend.

type Member

type Member struct {
	Handle, Name, Model, Role string
}

Member is a roster entry as the TUI sees it.

type Options

type Options struct {
	Backend Backend
	State   *State
	Server  string
	Handles []string // the roster's agent handles, for the online count
	// Team is the roster this Halo hosts; nil when it only watches, for the reason
	// in Watching.
	Team     Team
	Watching string
	// Notes are messages from the agents' host (errors, restarts) for the header.
	Notes <-chan string
	// Feed is the raw output of the hosted agents; Procs their shells. Both are
	// nil when this Halo only watches.
	Feed  <-chan Update
	Procs Procs
	// Preview finds the live preview of the run with this short id: the run
	// worktree and the command that serves it, or ok=false for a non-web project.
	Preview func(short string) (dir, cmd string, ok bool)
	// ImageDir is where images pasted into a prompt are kept for the agents to
	// read; "" uses a folder in the system's temp directory.
	ImageDir string
	// Quiet turns off the ping (a desktop notification and a bell) when
	// something new waits on you.
	Quiet bool
}

Options configure the TUI.

type Packet

type Packet struct {
	From, To, Kind, Label string
	Start                 time.Time
}

Packet is a message travelling from one address to another through the hub.

type PlanEntry

type PlanEntry struct {
	Content string `json:"content"`
	Status  string `json:"status"`
}

PlanEntry is an item of the agent's own todo list.

type Preview

type Preview struct {
	Dir string // the run branch's worktree
	Cmd string // the command that serves it
}

Preview is the live preview of a web run: where the run branch's code is and the command that serves it. The zero value means the project isn't a web one.

func (Preview) Web

func (p Preview) Web() bool

Web reports whether there is a preview to show.

type Procs

type Procs interface {
	Shells(ctx context.Context) ([]Shell, error)
	// Output is the end of a shell's output file.
	Output(ctx context.Context, path string) (string, error)
	// Stop ends a shell and everything it started.
	Stop(ctx context.Context, pid int) error
}

Procs reads the hosted agents' processes. Only the Halo that hosts the team has them.

type Raw

type Raw struct {
	Seq                    int64
	Kind, Who, State, Text string
	E                      lg.Entry
}

Raw is one line of the raw event tail.

type RunInfo

type RunInfo struct {
	ID, ContextID    string
	Title, State     string
	Cost             float64 // what the run's agents reported spending
	Tasks            int
	Started, Updated time.Time
}

RunInfo is a past run, for /resume.

type Screen

type Screen struct {
	W, H      int
	Frame     int
	Now       time.Time
	Server    string
	Connected bool
	Online    int
	Waiting   int
	Footer    string   // the prompt line(s), already rendered
	Popup     []string // the completion list, drawn above the input
	Bottom    string   // replaces the bottom of the screen when set (answering)
	BottomTag string
	Flash     string
	UI        *UI
	Team      string    // "team here" or "watch-only"
	Procs     bool      // this Halo can see the agents' shells
	Overlay   []string  // a box drawn in the middle (the /resume list)
	Runs      []RunInfo // your runs with the lead, for the full-screen comms
	RunSel    int       // the run selected in that list
}

Screen is everything the view needs besides the state.

type SetupOptions

type SetupOptions struct {
	State      *config.State
	Roster     *config.Config
	RosterPath string
	// First is a first run: the screen opens on the server, which must work.
	First bool
	// Check checks a server and API key and returns the person's handle.
	Check func(ctx context.Context, server, key string) (string, error)
	// Login is the server and key `lagrange login` saved, if any.
	Login func() (server, key string)
	// Provision creates the team's addresses on the server.
	Provision func(ctx context.Context, cfg *config.Config, st *config.State) error
	// Connector talks to a server's Telegram settings.
	Connector func(server, key string) Connector
	// LookPath finds a command on PATH (default exec.LookPath).
	LookPath func(string) (string, error)
}

SetupOptions is what setup works on.

type Shell

type Shell = shells.Shell

Shell is a command an agent runs, or a server it left listening.

type Size

type Size int

Size is how much of the screen a panel takes. Growing takes space from the neighbours step by step: first the panel's column, then the orbit's width, then the whole screen. Shrinking below normal collapses a panel to a one-line bar.

func (Size) String

func (z Size) String() string

type Sources

type Sources struct {
	Agents   []Candidate // Text is the short name (@sonnet-1), Desc the role
	Subtasks []Candidate // Text is #S3, Desc the title
	Files    []string
}

Sources is what completion draws on.

type State

type State struct {
	Human, Lead, Reviewer string
	Prefix                string
	Order                 []string
	Agents                map[string]*Agent

	Root      string
	RootAt    time.Time
	RootEnd   time.Time
	RootState string
	Prompt    string
	Tasks     map[string]*Task
	Plan      *plan.Plan
	// Report is the run's latest situation report (lagrange/report); ReportNew is
	// set when a final one arrives live, so the TUI opens the summary card.
	Report    *report.Report
	ReportNew bool

	Follow bool

	// Hosted is set when this Halo hosts the team: the agents' raw output comes
	// through Feed, so the activity log's copy of it is skipped.
	Hosted bool

	Comms   []Comm
	Commits []Commit
	Raw     []Raw
	Packets []Packet
	Dots    []Dot
	HubAt   time.Time

	Events int

	Questions int
	Reviews   int
	Seq       int64

	// Pin, when set, is the only root task that starts a run (a resumed run).
	Pin string
	// Hint is shown while there is no run, e.g. how to resume the last one.
	Hint string
	// Shells are the processes the hosted agents run.
	Shells []Shell
	// Preview is the live preview of the run, when it is a web project.
	Preview Preview

	Focus string
	// contains filtered or unexported fields
}

State folds the activity log into what the panes show.

func NewState

func NewState(prefix string, members []Member) *State

NewState returns an empty state for a roster. members must include the lead, the reviewer and the human.

func (*State) Apply

func (s *State) Apply(e lg.Entry, now time.Time)

Apply folds one activity entry in.

func (*State) Count

func (s *State) Count(id int, u *UI) int

Count is how many items panel id lists, for moving its selection.

func (*State) CycleFocus

func (s *State) CycleFocus(now time.Time, dir ...int)

CycleFocus moves the focus to the next agent and holds it there for a while.

func (*State) Feed

func (s *State) Feed(u Update)

Feed folds a raw update into the agent's transcript: chunks join the block before them, tool call updates change the call they belong to.

func (*State) NowLine

func (s *State) NowLine(handle string) string

NowLine is what an agent is doing right now, in one line: its newest tool call, thought or message from the live transcript, or else the newest tool call Lagrange saw.

func (*State) Prune

func (s *State) Prune(now time.Time)

Prune drops packets and dots that arrived.

func (*State) Rate

func (s *State) Rate(now time.Time, n int) (float64, []int)

Rate returns events per second over the last 3 s, and per-second counts for the last n seconds.

func (*State) Render

func (s *State) Render(sc Screen) string

Render draws the whole screen.

func (*State) SetCommits

func (s *State) SetCommits(cs []Commit)

SetCommits merges commits into the run's list, oldest first. Commits seen once stay, so the list survives the run's branches being deleted after it lands.

func (*State) SetMembers

func (s *State) SetMembers(ms []Member)

SetMembers replaces the roster, keeping what the TUI knows about agents that stay.

func (*State) SetOnline

func (s *State) SetOnline(handles []string)

SetOnline marks who of the roster has a tunnel up.

func (*State) Short

func (s *State) Short(handle string) string

Short is "@name" for a handle: the halo prefix dropped.

func (*State) SubProgress

func (s *State) SubProgress(st *plan.Subtask, now time.Time) float64

SubProgress estimates how far a running subtask is, from its worker's tool calls.

func (*State) TeamCost

func (s *State) TeamCost() float64

TeamCost is the whole team's cost so far.

type Task

type Task struct {
	ID, Parent, Sender, Recipient, State, Summary, Sub, Kind string
	Tools                                                    int
	Started, Ended                                           time.Time
	// contains filtered or unexported fields
}

Task is a task of the current run.

func (*Task) Answer

func (t *Task) Answer() string

Answer returns the task's streamed answer so far.

type Team

type Team interface {
	// Members is the roster, without you.
	Members() []Member
	// SetMembers saves the roster and restarts the agents with it.
	SetMembers(ctx context.Context, ms []Member) error
	// Land merges run short into the checked-out branch and removes its
	// branches and worktrees.
	Land(ctx context.Context, short string) (string, error)
}

Team is the roster this Halo hosts. It is nil when Halo only watches: another Halo hosts the team, or this directory isn't a git repository.

type Token

type Token struct {
	Start, End int
	Kind       byte
	Text       string
}

Token is the word being typed: runes [Start,End) of the input, led by '@' (an agent), '#' (a subtask) or 'p' (a path).

func FindToken

func FindToken(value string, cursor int) (Token, bool)

FindToken returns the word under the cursor (a rune offset) when it is one that completes: an @mention, a #subtask or a path.

type UI

type UI struct {
	Focus  int
	Size   [nPanes + 1]Size
	Cur    [nPanes + 1]*pcursor
	Help   bool
	Query  string
	Filter string            // comms: only messages from or to this handle
	Diffs  map[string]string // commit SHA → git show output
	Calls  bool              // agent: the tool calls Lagrange saw, not the live transcript
	Out    map[int]string    // shell pid → the end of its output
	// BoardOff is the stacked plan board's scroll offset.
	BoardOff int
}

UI is the view state that isn't part of the run: focus, sizes, selections and overlays.

func NewUI

func NewUI() *UI

NewUI focuses the comms panel.

func (*UI) Bottom

func (u *UI) Bottom(n int)

func (*UI) FocusNext

func (u *UI) FocusNext(d int)

FocusNext moves the focus by d panels, wrapping around.

func (*UI) Grow

func (u *UI) Grow()

Grow and Shrink step the focused panel along its ladder.

func (*UI) Move

func (u *UI) Move(d, n int)

Move moves the focused panel's selection (or the open item's scroll) by d, for a list of n items.

func (*UI) SetFocus

func (u *UI) SetFocus(id int)

SetFocus focuses panel id. Grown panels go back to normal so cycling through the panels shows the usual layout; minimized ones stay minimized.

func (*UI) Shrink

func (u *UI) Shrink()

func (*UI) Top

func (u *UI) Top()

Top and Bottom jump to the first item, or to the newest and follow it.

type Update

type Update struct {
	Agent, Task, Type string
	Context           string // the A2A context: one ACP session per context
	Raw               json.RawMessage
	At                time.Time
}

Update is one raw ACP session update from an agent this Halo hosts: what Claude Code streams while it works, before Lagrange sees any of it.

type Usage

type Usage struct {
	Used, Size int64              // tokens in the newest session's context, of its window
	Sessions   map[string]float64 // A2A context → that session's cost so far, USD
	Currency   string
}

Usage is what an agent's Claude Code sessions report through ACP usage updates: the newest context window fill, and the cost of every session.

func (Usage) Cost

func (u Usage) Cost() float64

Cost is the agent's total over its sessions.

func (Usage) Fill

func (u Usage) Fill() float64

Fill is how full the context window is, 0-1, or -1 when unknown.

type Wait

type Wait struct {
	TaskID    string
	Asker     string
	Question  string
	Since     time.Time
	Questions []ask.Question // a multiple-choice form, when the asker sent one
}

Wait is a task waiting on you.

Jump to

Keyboard shortcuts

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