Documentation
¶
Index ¶
- Constants
- func Arguments(raw string, width int, look theme.Theme) []string
- func Changed(text string, look theme.Theme) string
- func Clip(rows []string, keep int, look theme.Theme) []string
- func Diff(text string, look theme.Theme) []string
- func Notes(look theme.Theme, notes ...string) []string
- func Outline(value any, width int, look theme.Theme) []string
- func Register(host *app.App)
- func Room(width, rows, cols, height int) (gutter, band int)
- func Text(text string) []string
- type Ambient
- type Ambienter
- type Call
- type Dock
- type Docked
- type Docker
- type Liner
- type Lines
- type Picture
- type Ran
- type Registrant
- type Registry
- func (r *Registry) Ambients(conn *connect.Client) []Ambient
- func (r *Registry) Docks(conn *connect.Client) []Dock
- func (r *Registry) Lines(conn *connect.Client) []Liner
- func (r *Registry) Register(registrant Registrant)
- func (r *Registry) Settings() []string
- func (r *Registry) View(tool string) (View, bool)
- func (r *Registry) Views() []View
- type Run
- type Seated
- type Shown
- type Surround
- func (s *Surround) Animate(dt float64) bool
- func (s *Surround) Awake() bool
- func (s *Surround) Band(place string, width int, t theme.Theme) []string
- func (s *Surround) Beside(width, rows int, t theme.Theme) (stack []string, gutter, band int)
- func (s *Surround) Corners(body []string, width int, t theme.Theme) []string
- func (s *Surround) Empty() bool
- func (s *Surround) Seat(x, y int, shown bool)
- type View
- type Views
Constants ¶
const ( TopLeft = "top-left" TopRight = "top-right" BottomLeft = "bottom-left" BottomRight = "bottom-right" DockTop = "dock-top" DockBottom = "dock-bottom" Beside = "beside" )
Places of what a window shows around its transcript: over its four corners, in rows above it and in rows below it, and beside its bottom right in room the window makes for them
const PlaceOf = "place:"
Start of the argument of the tools screen that opens the page of a place, such as place:telegram
const Screen = "tools"
Screen of the tools
const ToolOf = "tool:"
Start of the argument of the tools screen that opens the page of a tool's group with the tool in hand, such as tool:web_search
Variables ¶
This section is empty.
Functions ¶
func Arguments ¶
Rows of the arguments a call was given as a person reads them, unfolded under its title: each argument a row of its name and value, a long text under its name as its lines. They are laid out once for each width and look, a window drawing the call again reading them from memory
func Diff ¶
Rows of a diff, at most six files and 80 lines of it, the rest counted in a last row; only the rows shown are painted
func Notes ¶
Rows of notes the tool added for the model that the person should read too, such as a warning, in the accent tone
func Outline ¶
Rows of a structured value as a person reads it, for a result whose shape icebath does not know, such as the structured content of an MCP tool: each field of an object a row of its name and value, a list of objects that share plain fields a table, a short list of plain values on one row, nested values indented under their name
func Room ¶
Room a stack of boxes cols wide and height high takes beside a transcript of the width and rows: the columns of a gutter at its right, the stack at its foot, while the transcript keeps 72 columns; else the rows of a band under it while it keeps 24 columns and 4 rows; none when it fits neither way
Types ¶
type Ambient ¶
type Ambient interface {
// Rows of the place at the width: a stack of boxes for a corner, a transcript of the rows given under it; whole rows for a dock
Rows(place string, width, rows int, t theme.Theme) []string
// Count that moves each time what it shows changed, so the rows drawn of it are drawn again only then
Version() uint64
// Moves what turns on its own, such as the spinner of a part whose first lines are on their way, by the seconds passed: whether what
// it shows changed. The window in view steps it with its frames
Animate(dt float64) bool
// Whether the frames have to keep coming for it, as while such a spinner turns
Awake() bool
}
What a window shows around its transcript besides the docks of its session, such as the ambient widgets of extensions. Only the window in view, the one focused last, shows it
type Ambienter ¶
Registrant that shows things around the windows, reading them through the connection. A registrant that does says so by having this too
type Call ¶
type Call struct {
Arguments string
// Text of the result, empty while the call runs: as the tool returned it, out of the block outside content is handed the model in, and
// with the notes the agent added after it, which Decode reads past
Result string
Failed bool
// The reply the call is part of has ended
Ended bool
// What the user is shown of the result in place of its text, such as the change a write made; empty when the text is all there is
Display string
// Values of the settings the view reads, by key, as YAML
Settings map[string]string
}
Call of a tool as a window has it
type Dock ¶
type Dock struct {
// Reads what the dock shows of the session, off the UI loop, for the profile of the window that shows it, which may be another than its
// window's; nil shows nothing
Load func(ctx context.Context, profile, session string) (Docked, error)
}
What a window docks above its prompt for the session it shows, such as the background processes its commands left running: read again every second and a half while the session works or something docked counts by the second, and otherwise only when the session tells something
type Docked ¶
type Docked interface {
// Rows at the width, at most limit of what it lists, one line when folded; none when there is nothing to show. Asked on the UI loop on
// every frame the window is drawn, so it lays out what Load read and reads nothing itself
Rows(width, limit int, now time.Time, t theme.Theme, folded bool) []string
// Whether something it shows counts by the second, such as a process still running
Live(now time.Time) bool
}
What a dock shows of a session at a moment
type Docker ¶
Registrant that docks rows in the windows, reading them through the connection. A registrant that docks says so by having this too
type Liner ¶
type Liner struct {
// Mark the line starts with
Mark string
// What the empty prompt says of the mark, such as that it runs a line in the person's shell; empty says nothing
Hint func(env *cards.Env) string
// Starts the line for a window, telling each change of what it printed and how it ended to told, off the UI loop, until it ends; stop
// ends it. A line that prints fast tells as fast, and each telling holds all it printed so far, so a window takes in the newest at most
// once a frame
Run func(ctx context.Context, run Run, told func(ran Ran)) (stop func())
// Lines run in a session before, oldest first
Kept func(ctx context.Context, session, profile string) ([]Ran, error)
// What a window shows of a line, as rows under a head that folds them, naming the key that stops a line still running
Shown func(ran Ran, width int, t theme.Theme, stop string) *Shown
}
What runs a line a person types in a window after a mark of its own: what it prints is shown in the window as it comes, and kept with the session
type Lines ¶
Registrant that runs lines a person types in a window. A registrant that does says so by having this too
type Picture ¶
type Picture struct {
// Small copy of it as PNG or JPEG bytes, and the file of it at full size, which only a window on the machine that made it can read
Data []byte
Path string
// The same as base64 text in place of Data, for a picture handed as text: its bytes are decoded off the UI loop, as a picture is laid out
Encoded string
// Row of the result's rows the picture is drawn before, past the last for after them all
At int
}
Picture of a result and the row it is drawn before
func EncodedPicture ¶
Picture of an image a result holds as base64 text, such as the content of an MCP tool, drawn as PictureOf draws one: the text is decoded off the UI loop as the picture is laid out
type Ran ¶
type Ran struct {
Time time.Time
Line string
Output string
// Only the end of the output was kept
Cut bool
Done bool
Code int
// The person stopped it
Stopped bool
// Why it could not run, empty when it ran
Error string
// Folder it ran in, once the server said it
Folder string
}
A line run, or running, and what it printed so far
type Registrant ¶
type Registrant interface {
Views() []View
}
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func (*Registry) Ambients ¶
What every registrant that has one shows around the windows, those of a registry registered into this one with them
func (*Registry) Lines ¶
Liners of every registrant that runs lines, reaching what runs them through the connection
func (*Registry) Register ¶
func (r *Registry) Register(registrant Registrant)
func (*Registry) View ¶
View of the tool, false when it is shown as its text. Its Result reads the result as the tool returned it, and is never handed a failure it does not show, which reads as Failure tells it, nor a result saved to a file for being too long, which reads as Saved tells it, unless the tool put something of its own in Display to show in its place, such as a picture or the content an MCP server handed back; where it shows nothing, the text the tool put in Display shows as Displayed lays it out. The views are made once and kept by tool, made again only after another registrant came, and what a view makes of a call is kept by what the call holds, so a window that draws a call again, as a resize or a reply going on does, draws it from memory; the pictures it shows the window draws as the kit lays them out
type Run ¶
type Run struct {
// Session of the window, empty before it has one, and its profile
Session, Profile string
// Folder of a window that has no session yet
Folder string
Line string
// The person's shell, as this app knows it
Shell string
}
A line to run, and the window it is run for
type Seated ¶
Ambient told the screen cell its boxes beside the transcript start at, their top left, each time the window in view is drawn, and when they are not drawn: for an image the terminal places over them by position
type Shown ¶
type Shown struct {
Head string
// Head while the rows are folded, Head when empty
Folded string
Rows []string
// The rows show until the user folds them
Open bool
// Pictures among the rows, each drawn before the row it names by the window through the kit's picture element, as its terminal draws
// pictures and Images asks; none for rows of text alone
Pictures []*Picture
}
Result shown as rows under a head that folds them
func Content ¶
What a result shows of its content when icebath does not know the tool's shape, such as the result of an MCP server's tool or an extension's: by the content types of MCP, a text as its lines, or as an outline when it is JSON, each image drawn where it comes, audio and resources as what they are and where they are, and the structured content as an outline, all under a head counting what came back
func Displayed ¶
What the tool showed the person in place of its result when it is text, for a view that shows nothing else of it: its first line the head and the rest under it; nil for none
func Failure ¶
A failed call as the sentence that says why, the lines after the first under it: what the tool told the person of it in Display, else the error its result names, else the message it gives, else its text when that is no JSON. A call that did not fail, whose result its view could not read, reads as where the result went when it was saved to a file for being too long, else as what the tool showed, else as its text when that is no JSON; nil when nothing of it is for a person to read
type Surround ¶
type Surround struct {
// contains filtered or unexported fields
}
What the ambients show around a window: their rows kept and drawn again only once one of them changed, or at a size or look not drawn yet
func NewSurround ¶
func (*Surround) Animate ¶
Moves what the ambients turn on their own by the seconds passed: whether any of them changed what it shows
func (*Surround) Beside ¶
Boxes of every ambient beside a transcript of the width and rows, one after the other, each row as wide as the widest, and the room they take as Room says; none when they fit neither way
type View ¶
type View struct {
// Tool shown this way, by name, or the view the tools of one kind name as theirs, such as those of MCP servers
Tool string
// Line next to the tool's title in place of its subject argument; empty keeps the subject
Line func(call Call) string
// What the result is shown as in place of its text; nil keeps the text
Result func(call Call, width int, theme theme.Theme) *Shown
// Result shows failed calls too, such as a command's output with how it exited; the failure of a call of any other view reads as the
// sentence Failure makes of it
Fails bool
// Only the newest call of the tool in a reply shows its result, the others their line alone: for a tool whose every result holds all
// it keeps, such as a task list
Latest bool
// Settings the view reads, by key, which a window hands it in Call.Settings as they change
Settings []string
// How many tasks of its list a call of a tool that keeps one leaves done, and of how many; false for a call that tells none
Tasks func(call Call) (done, total int, ok bool)
}
How a window shows the calls of one tool, for a tool whose arguments and text are not the best way to read it