Documentation
¶
Index ¶
- Constants
- Variables
- func After(ctx context.Context, wait time.Duration, next func() tea.Cmd) tea.Cmd
- func Async(work func() func() tea.Cmd) tea.Cmd
- func AsyncTo(card wm.Card, work func() func() tea.Cmd) tea.Cmd
- func Behind(work func() func() tea.Cmd) tea.Cmd
- func Call[R any](hub *cards.Hub, call func() (R, error), then func(result R) tea.Cmd) tea.Cmd
- func EditFile(ctx context.Context, path string, done func(err error) tea.Cmd) tea.Cmd
- func EditText(ctx context.Context, name, text string, ...) tea.Cmd
- func Followed(screens []Screen) []string
- func Held(value string) (string, bool)
- func Language(l *base.Language) tea.Cmd
- func PickOf(picks string) (kind, of string)
- func Reason(err error) string
- func Reread(card wm.Card, work func() func() bool) tea.Cmd
- func Run(ctx context.Context, screens []Screen, options Options) error
- func Theme(name string) tea.Cmd
- func Waiting(loaded bool, err error, none string) string
- type Activity
- type Area
- type Ask
- type Attention
- type Choice
- type Doing
- type Flow
- func (f *Flow) Ask(intro string, fields []cards.Field, verb string, ...) tea.Cmd
- func (f *Flow) End() tea.Cmd
- func (f *Flow) Pick(intro string, choices []Choice, current string, ...) tea.Cmd
- func (f *Flow) PickVerb(intro string, choices []Choice, current, verb string, ...) tea.Cmd
- func (f *Flow) Show(view wm.Card) tea.Cmd
- type Heed
- type Kit
- func (k *Kit) Add(screens ...Screen) (tea.Cmd, error)
- func (k *Kit) Apply(apply func() tea.Cmd)
- func (k *Kit) ApplyTo(card wm.Card, apply func() tea.Cmd)
- func (k *Kit) Areas(areas []Area)
- func (k *Kit) Ask(hub *cards.Hub, title string, field cards.Field, submit string, ...) tea.Cmd
- func (k *Kit) AskAny(hub *cards.Hub, title string, field cards.Field, submit string, ...) tea.Cmd
- func (k *Kit) AskOr(hub *cards.Hub, title string, field cards.Field, submit string, ...) tea.Cmd
- func (k *Kit) Attend(a Attention) tea.Cmd
- func (k *Kit) Changed(key, value string) tea.Cmd
- func (k *Kit) Changes() uint64
- func (k *Kit) Choose(hub *cards.Hub, picks string, ask Ask) (tea.Cmd, bool)
- func (k *Kit) Dark() (dark, told bool)
- func (k *Kit) Drop(prefix string)
- func (k *Kit) EditBeside(name, text string, done func(edited string, err error) tea.Cmd) tea.Cmd
- func (k *Kit) Flow(hub *cards.Hub, title string) *Flow
- func (k *Kit) Focused() wm.Card
- func (k *Kit) Hub(key string, root wm.Card) *cards.Hub
- func (k *Kit) Indicate(indicator string) tea.Cmd
- func (k *Kit) Indicator() string
- func (k *Kit) Job(hub *cards.Hub, title string, run func(out Output) Outcome, ...) tea.Cmd
- func (k *Kit) Look(change func(looks *Looks)) tea.Cmd
- func (k *Kit) Mark(marked, on bool) string
- func (k *Kit) Mount(area, argument string) (*cards.Hub, tea.Cmd, bool)
- func (k *Kit) Move(folder string) error
- func (k *Kit) Notifier() tty.Notifier
- func (k *Kit) Notifying(mode string)
- func (k *Kit) Open(id, argument string) tea.Cmd
- func (k *Kit) Pages(profile string) map[string][]Page
- func (k *Kit) Pick(hub *cards.Hub, title, verb string, choices []Choice, current string, ...) tea.Cmd
- func (k *Kit) PickFrom(hub *cards.Hub, title string, intro []string, verb string, choices []Choice, ...) tea.Cmd
- func (k *Kit) Picker(picks string) (Picker, bool)
- func (k *Kit) Report(report func(status *wm.Status))
- func (k *Kit) Screens() []Screen
- func (k *Kit) Sessions() []string
- func (k *Kit) Set(name, value string) tea.Cmd
- func (k *Kit) Show(key string, root wm.Card) (*cards.Hub, tea.Cmd)
- func (k *Kit) Slash(line string) (tea.Cmd, bool)
- func (k *Kit) Still() *Kit
- func (k *Kit) Terminal() *cards.Terminal
- func (k *Kit) TerminalCommand(line string) *cards.Terminal
- func (k *Kit) TerminalProgram(argv []string, done func(cards.TerminalEnd) tea.Cmd) *cards.Terminal
- func (k *Kit) Wear(saved string) tea.Cmd
- func (k *Kit) While(hub *cards.Hub) func() context.Context
- func (k *Kit) Worn() string
- type LanguageMsg
- type Looks
- type Next
- type Options
- type Outcome
- type Output
- type Page
- type Picker
- type Screen
- type Sessioned
- type ThemeMsg
- type Tone
- type Window
Constants ¶
const ( ReplyDone = "done" ReplyFailed = "failed" WaitsOnYou = "waiting" )
What happened in a window that may deserve the person's attention: a reply ended, a reply failed, or the agent waits on the person for an approval or an answer
const ( NotifyOff = "off" NotifyWaiting = "waiting" NotifyAll = "all" )
Values of Notifications: none, only as the agent waits on the person, or as a reply ends too
const ( LookLight = "light" LookDark = "dark" )
Modes of Looks that take one of the styles whatever the terminal
const ( GroupSessions = "Sessions" GroupModels = "Models" GroupAbilities = "What the agent can do" GroupSafety = "Safety" GroupMedia = "Images and video" GroupVoice = "Voice" GroupSecrets = "Keys and passwords" GroupApp = "This app" GroupMore = "More" )
Headings the command palette lists screens under, in the order they show: what a person reaches for first comes first
const JobContext = "job"
Keys of the page of a job
const LanguageSetting = "language"
Name the cards are told a change of the window's language by, as a setting of the kit
Variables ¶
var ErrNoEditor = lang.Errorf("No editor was found. Set EDITOR to the editor you use.")
Why nothing was opened in an editor: none is set and none of the usual ones is on this machine
Functions ¶
func After ¶
Runs what to do next once the time passed, on the UI loop and with nothing drawn again for it, or never when the context ends first: the wait between two readings of something read again every little while
func Async ¶
Runs work off the UI loop, then what it hands back on the UI loop, after which every card draws again as what it shows may have changed. Work that found nothing to apply hands back nil: then nothing reaches the UI loop and no card is drawn again, so reading something again every little while costs the app nothing while what is read stays the same
func AsyncTo ¶
Async for work whose outcome one card alone shows, such as what a view reads again every little while: what the work hands back runs on the UI loop, after which the card, or the hub or menu holding it, reads what it shows anew and draws again while every other card stays as it is drawn, however many windows are open. Work that found nothing to apply hands back nil, and then nothing reaches the UI loop. Work whose outcome other cards show too, such as a setting kept, goes through Async
func Behind ¶
Async for work that changes nothing a card shows by itself, such as the wait between two readings: what the work hands back runs on the UI loop and nothing is drawn again for it, so it only looks at what the app holds and hands back what to do next. Whatever that does next that a card shows reaches the card as work of its own, through Async or AsyncTo
func EditFile ¶
Opens the file in the person's editor with the terminal handed over to it, the editor found off the UI loop. done runs on the UI loop once the editor is back, with ErrNoEditor when there is none and why it did not start when it could not. An editor that ends with a status of its own still ran
func EditText ¶
func EditText(ctx context.Context, name, text string, done func(edited string, err error) tea.Cmd) tea.Cmd
Opens the text in the person's editor, in a file of the name made off the UI loop in a folder of its own that only its owner can read. done runs on the UI loop once the editor is back, with what the file holds then, the folder gone, or why the text could not be edited
func Held ¶
Text a value held as YAML names, as a picker reads the value it words, empty with false for a value that is not text. What a value names is kept, as a row words the value it holds each time it is drawn and reads it once
func PickOf ¶
Kind of thing a setting's Picks names and what of that kind the picker lists, written kind:argument, such as model:openrouter for the models of OpenRouter alone. The argument is the picker's own to read; empty for every thing of the kind
func Reread ¶
AsyncTo for a reading that mostly finds what its card shows already, such as what a card reads as it opens or reads again when something it follows changed: what the work hands back runs on the UI loop, where what the card holds now is known, and answers whether it changed anything the card shows. The card is drawn again only when it did; a reading that found what the card holds already, or that a later one overtook, draws nothing at all and wakes no frames. Looking on the UI loop rather than where the work ran means the answer is held against what the card holds as it arrives, not against what the card held as the reading began
Types ¶
type Activity ¶
type Activity struct {
// A reply is under way, it waits on the person for an approval or an answer, a tool it called is at work, it thinks before it writes
Busy, Waiting, Tool, Thinking bool
// When its last reply ended well and whether it left every task of its list done, when one failed, when the person last sent it a
// message from this window and what that said, and when anything last happened in it; zero for never
Ended time.Time
Finished bool
Failed time.Time
Said time.Time
Message string
Last time.Time
// Cell of the screen where what it does shows now, which what keeps the person company may look at: the approval or the question
// that waits, else the composer while the person types, else the newest line while a reply is written; Spotted false for none
Spot image.Point
Spotted bool
}
What a session does and what last happened in it
type Area ¶
type Area struct {
ID, Title, Group, About string
}
One area of the settings menu as the palette lists it: the key of its section, its name, the heading of its group and what is set there
type Ask ¶
type Ask struct {
Title string
Intro []string
// Key of the setting asked about, empty when a screen asks for itself
Key string
// Values held now, as YAML, by key: the setting's own and those of the settings beside it
Values map[string]string
// Choices listed before the things, such as what is in effect when nothing is picked
First []Choice
// Profile whose things are listed, the one in use when empty
Profile string
// What of the kind to list, as the setting's Picks says after the kind, such as the provider whose models alone are listed: the
// picker's own to read; empty for every thing of the kind
Of string
// The setting at Key is a list and one item of it is asked for: Values holds that item alone under Key, nothing for a new one, and Done
// is handed the one item picked under Key, the asker keeping the list
Item bool
// Word on the button that picks, the job's verb when the pick ends a job, such as Add; choose when empty
Verb string
// Handed the values to keep, as YAML, by key; a value of null puts a default back. The asker ends the job once they are kept
Done func(values map[string]string) tea.Cmd
}
What a picker is asked
type Attention ¶
type Attention struct {
Kind string
Bell bool
Stopped bool
Title string
Body string
Session string
Folder string
Project string
// How long the reply that ended ran, and the shortest whose end rings the bell, 0 for every one; a wait on the person rings whatever
// they are
Took, After time.Duration
// The person is typing in the window it happened in: it is in front, the terminal has the focus, and its prompt changed a moment ago
Typing bool
}
Something that happened, as the one rule of what deserves the person's attention weighs it: its kind, whether the bell of its kind is on, whether the person stopped the reply themselves, and what a notification of the desktop says of it: the title of the session with what looks like a secret masked, one line, and for Warp the session and the folder and project it works in
type Choice ¶
type Choice struct {
ID string
Title string
Detail string
// Heading the choice is listed under, the choices of one heading together in the order given; none for a list with no headings
Group string
// Word on the button while the choice is in hand, such as Add for a choice that ends a job where the others lead on; the list's own
// verb when empty
Verb string
}
type Doing ¶
type Doing interface {
// What the session shown does now and what last happened in it, read on the UI loop
Doing() Activity
}
Card that shows a session at work, which says what the session is doing, so what keeps the person company in the app, such as a pet, reacts to it
type Flow ¶
type Flow struct {
// contains filtered or unexported fields
}
Steps of one job, each one question: a form of typed fields or a list to pick from, with one line above it saying what is asked. One view on the hub titled as the job through every step; esc goes back a step with the answers kept, and from the first leaves the job
func (*Flow) Ask ¶
func (f *Flow) Ask(intro string, fields []cards.Field, verb string, next func(values map[string]string) tea.Cmd) tea.Cmd
Asks the next question in a form of typed fields under the intro, the verb on what enter does from the last field, Next when empty. Every step says what is asked: above its fields, or for a step of one field under that field, before the field's own help and never above it too. Fields asked at this place before come back as they were left
func (*Flow) End ¶
Ends the job: the flow closes, and so does a menu the person came straight into for this job
func (*Flow) Pick ¶
func (f *Flow) Pick(intro string, choices []Choice, current string, next func(choice Choice) tea.Cmd) tea.Cmd
Asks the next question as a list to pick from under the intro, the choice in use marked. A choice made at this place before is in hand again
type Heed ¶
type Heed struct {
Bell, Notify bool
}
What the one rule says of something that happened: whether the terminal's bell rings, and whether a notification of the desktop goes
func Weigh ¶
The one rule of what deserves the person's attention: nothing for a reply the person stopped, nor while they type in the window it happened in; the bell where its setting for the kind says so, for a reply that ended or failed only once it ran at least as long as the bell asks; a notification where Notifications covers the kind, the terminal shows them, and the person is not looking at the terminal, as far as it reports its focus, a terminal that reports none told every time since it can't be known
type Kit ¶
type Kit struct {
Env *cards.Env
WM *wm.Model
History cards.History
// contains filtered or unexported fields
}
func (*Kit) Add ¶
Adds screens while the app runs, such as the widgets of plugins, after those the app started with so a slash command of theirs wins; one with the ID of an added screen takes its place. Each is readied as a screen the app starts with is: its keys, the keys saved for them, its keymap contexts and actions, the settings it follows and what it learns before anyone opens it
func (*Kit) ApplyTo ¶
Apply for a change one card alone shows, which draws again while every other card stays as it is drawn
func (*Kit) Areas ¶
Tells the kit the areas of the settings menu, which the palette then lists in place of the screens that are their pages
func (*Kit) Ask ¶
func (k *Kit) Ask(hub *cards.Hub, title string, field cards.Field, submit string, done func(text string) tea.Cmd) tea.Cmd
Asks one question over the hub in a form of the one field: typed into, its help under it, enter handing the trimmed answer to done and the button labeled submit. An empty answer is refused
func (*Kit) AskAny ¶
func (k *Kit) AskAny(hub *cards.Hub, title string, field cards.Field, submit string, done func(text string) tea.Cmd) tea.Cmd
Ask that takes an empty answer too, for a value a person takes away by leaving its field empty
func (*Kit) AskOr ¶
func (k *Kit) AskOr(hub *cards.Hub, title string, field cards.Field, submit string, done func(text string) tea.Cmd, left func() tea.Cmd) tea.Cmd
Ask whose form runs left when it closes with no answer given, by the way back or with its hub, for an asker that waits for the answer
func (*Kit) Attend ¶
Tells the person of what happened as Weigh says, through the kit's writer to the terminal: the bell, then the notification in the form the terminal takes it, wrapped for tmux or screen where one stands between
func (*Kit) Changed ¶
Tells every screen that follows the setting its new value, as YAML, and every card that it changed. A value as the settings service shows it that is not the value in use, such as text that names a variable as ${NAME}, is read again for use first, off the UI loop, so what follows the setting acts on what it comes to and never on the reference; one that could not be read is said in the log and told to none
func (*Kit) Changes ¶
Count of the changes to the screens and the areas so far, so what is worked out of the screens, such as which areas have a page or which settings a picker keeps together, is worked out again only once it moved
func (*Kit) Choose ¶
Opens the picker of a kind of thing over the hub, handed what of the kind to list when picks names it after the kind and the ask does not; false when no screen offers one
func (*Kit) Drop ¶
Drops the screens added under IDs that start with the prefix, with the keys that open them and the actions no other screen adds
func (*Kit) EditBeside ¶
Opens the text in the person's editor in a terminal window beside what they work in, which stays on the screen and goes on while they edit, such as the list of the actions while the keys of the keymap are edited: in a file of the name made off the UI loop in a folder of its own that only its owner can read. done runs on the UI loop once the editor ended or its window was closed, with what the file holds then, the folder gone, or why the text could not be edited
func (*Kit) Flow ¶
Starts a job in steps over the hub, titled as the job; its first question shows it
func (*Kit) Indicate ¶
Has every spinner of the app, those of the windows and of the bar alike, turn through the frames of the busy indicator, the wheel of the style worn for the unicode one; the style is worn again with them
func (*Kit) Job ¶
func (k *Kit) Job(hub *cards.Hub, title string, run func(out Output) Outcome, ended func() tea.Cmd) tea.Cmd
Runs a job on a page pushed over the hub that shows what it says as it comes, carried on to its end when the page is closed. How it ended is the last line while the page shows, and the note of the hub once the page closed. ended runs on the UI loop once the job is over, such as to read a list again
func (*Kit) Mark ¶
Mark before a choice of a list where one choice is in use: filled on that one, hollow on the rest, nothing where no choice is marked
func (*Kit) Mount ¶
Opens the screen that names the area as the page of that area, handing it the argument: the hub its first view went into, with what its Open returned. False when no screen names the area; a nil hub when the screen showed nothing
func (*Kit) Move ¶
Moves the window into the folder: the folder of this process, then the folder its views and the sessions its chats make work in. An error says why it could not, the window staying where it was. It runs on the UI loop, which keeps one move after another and the folder of the process the one the window says it is in, so whoever asks looks at the folder off the UI loop first: entering a folder just looked at reads nothing from the disk again
func (*Kit) Notifier ¶
The terminal this window runs in as its notifications go, read off the environment of the process once
func (*Kit) Notifying ¶
Sets what sends a notification of the desktop, as Notifications says: off, waiting or all
func (*Kit) Pages ¶
Pages of the areas the screens are the pages of, by the key of each area, read from every screen that has some: off the UI thread, on a kit Still made on it
func (*Kit) Pick ¶
func (k *Kit) Pick(hub *cards.Hub, title, verb string, choices []Choice, current string, pick func(choice Choice) tea.Cmd) tea.Cmd
Opens a list of choices over the hub, or in a hub of its own when hub is nil, the one in use marked on a list that has one. Each choice shows what it means beside it, or under the list where the width cannot hold every meaning whole. Enter or the button labeled verb runs pick with the highlighted choice and closes the list
func (*Kit) PickFrom ¶
func (k *Kit) PickFrom(hub *cards.Hub, title string, intro []string, verb string, choices []Choice, current string, pick func(choice Choice) tea.Cmd) tea.Cmd
Pick with lines above the choices that say what is being chosen, for a title that does not
func (*Kit) Picker ¶
Picker of the kind a setting's Picks names, the argument after the kind left to the picker; false when no screen offers one. Every row of a setting that names a kind asks, so the pickers are gathered by kind once and again only when the screens changed, the first screen that offers a kind winning as the screens are ordered
func (*Kit) Set ¶
Sets a setting of the kit by the name its cards read it by, telling every card it changed
func (*Kit) Show ¶
Shows the first view of a screen: as the page of its area when the settings menu is opening it, else in a dialog of its own. Called by Open before it returns
func (*Kit) Still ¶
The kit as it stands on the UI loop now, for work off it such as reading Pages: the folder of the session in view, the settings and the screens as they are now, so what the UI loop changes meanwhile, such as a session moving into a worktree, is never read from another thread
func (*Kit) TerminalCommand ¶
Terminal window that runs one command line through the shell in the folder the window works in, closing once it ends
func (*Kit) TerminalProgram ¶
Terminal window that runs a program with its arguments in the folder the window works in, with no shell between, such as the person's editor on a file: it closes once the program ends well and stays open with what the program printed when it fails. done is told once how the program ended and what it left on the screen, or that it did not start or its window was closed while it ran
func (*Kit) Wear ¶
Wears the saved style again once a source handed the app's styles anew, as one of a source has it now; while they lack it the one worn stays as long as they still have that, else the default one is worn. A style of the kit is left to whatever follows the saved one. The light style stands in for the saved one where the look says the window wears it
func (*Kit) While ¶
Context for what a view reads to show itself, by the hub it shows on: it ends once the hub leaves the screen, so a reading still under way for a page a person left stops rather than running on behind, and it is made anew the next time it is asked for after that. Asked for on the UI loop as a reading starts. Whoever takes the reading in drops what it found once the context ended and reads again when the page is back, as what a stopped reading answers is no answer
type LanguageMsg ¶
The window speaks another language
type Looks ¶
type Looks struct {
Style, Light string
// LookLight or LookDark to take one of the two always, anything else to go by the background of the terminal
Mode string
}
Which style the window wears: the style it is set to, the one for a light background, and which of the two it takes
type Next ¶
What the page of a job offers once the job ended, such as installing what it read: the word on its key, a question asked along the bottom of the page first when there is one, and what it runs on the UI loop, once
type Options ¶
type Options struct {
Style string
Keys map[string][]string
// Frame rate readout in the corner, and the log of the frames slower than the floor to the file
FrameRate, FrameLog bool
FrameLogFloor time.Duration
FrameLogFile string
// Mouse tracking asked of the terminal, as the setting of the mouse names it: wm.MouseAll, wm.MouseClicks or wm.MouseOff, every move
// when empty
Mouse string
// Value as YAML of every setting a screen follows, by key, as it is read for use
Settings map[string]string
// Reads the value as YAML of a setting as it is read for use: of one that a screen added while the app runs follows, when the app did
// not read it as it started, and of one whose change was told as Shown says the settings service shows it
Read func(key string) (string, error)
// Whether a value as YAML that the settings service shows of a setting is not the value in use, such as text that names a variable as
// ${NAME} or a secret masked: a change told with such a value is read again with Read before the screens that follow the setting hear
// it
Shown func(value string) bool
// Variables the shells of terminal windows run with over this process's own, as KEY=value, read as each shell starts
ShellEnv func() []string
// Styles beside those of the kit by where they come from, such as the styles folder of the profile
Styles map[string][]theme.Theme
// What the terminal's background was the run before, LookLight, LookDark or empty, which the first frame is worn for until the terminal
// answers; and how what the window learns of it is kept for the next run, called off the UI loop, nil for not at all
Background string
Remember func(dark bool)
// Told what the terminal was found to draw and the way pictures are drawn in it each time that changed, off the UI loop, so the doctor
// and the report of the installation can say it; nil for no one
Graphics func(report gfx.Report)
// The server the window runs on is this process's own, so the replies it runs wait while the window is suspended to the shell
Own bool
// Windows the last run kept, opened again as the window starts, nil for none; and what keeps the windows as the window quits for the
// next run, called once the program ended, nil for nothing
Layout *wm.Layout
Keep func(layout wm.Layout)
}
type Outcome ¶
type Outcome struct {
// A failure the job did not say as a line
Err error
// Ended with problems it said as lines
Problems bool
// Something the job made that the person may copy, such as a path, said on the last line
Made, MadeWhat string
// What the job says of how it ended, in place of the usual words: the last line, and the note of the hub once the page closed
Note string
// The note tells how to go on rather than that the job went well, such as what to do by hand that the job could not
Info bool
// Builds, on the UI loop, what takes the place of the page once the job ended while the page shows, such as a list of what the job
// came to; nil keeps the page
Result func() wm.Card
// What the page offers once the job ended, nil for nothing
Next *Next
}
How a job ended
type Output ¶
type Output interface {
// A line of what happened, in its tone
Line(text string, tone Tone)
// What goes on now, shown under the lines with a spinner until the next
Status(text string)
// Rows under the titles of their columns, drawn as a table at the width of the page
Table(columns []render.Column, rows [][]string)
// Text written in markdown, such as a file the job read, drawn formatted at the width of the page
Markdown(text string)
}
Where a job tells the person what it does
type Page ¶
type Page struct {
// What the page is called, and the titles of the pages above it inside the area, outermost first
Title string
Trail []string
// One line saying what is there
About string
// More words a search reads, such as the names of what the page shows
Words string
// Argument the screen opens the area with to show the page, as its Open takes it after the profile; empty for the area's own page
Argument string
// Keys of the settings the page shows rows or controls of, so a setting found by a search opens the page with its control over it; a
// key ending in a dot stands for every key under it
Keys []string
}
A page inside an area that a search of Settings finds and opens: the area on that page, the keys on it
func Remembered ¶
Pages as last read under the key, read again behind so the next answer is fresh: how Pages answers at once for a screen whose things take time to find, such as places found by probing this computer. The first call for a key waits for its reading; a reading that fails, nil, keeps what was read before
type Picker ¶
type Picker struct {
// Opens the list to pick from over the hub
Open func(kit *Kit, hub *cards.Hub, ask Ask) tea.Cmd
// Keys of the settings kept as one choice with the setting at key: one row shows them all and their own rows are left out. Nil for
// a kind whose choice is one value
Beside func(key string) []string
// What the row shows for the values held; the value in the settings service's own words when nil or when it answers nothing
Shown func(ask Ask) string
}
What a screen offers for every setting whose value names its kind of thing, registered under the name those settings give in Picks
type Screen ¶
type Screen struct {
ID string
Title string
Short string
// Heading the command palette lists the screen under, one of the Group names, and its place among the screens of that heading,
// lower first. A screen that names no heading is listed under More
Group string
Order int
Slash []string
// More names the screen answers as a slash command, which the slash list, /help and the palette leave out
Aliases []string
Usage string
Keys []string
Actions []keys.Action
Where map[string]string
// Opened once when the app starts
Startup bool
// Listed with its key on an empty screen
Suggest bool
Ready func(kit *Kit) bool
Open func(kit *Kit, argument string) tea.Cmd
// Settings the screen follows by key, each run with the value as YAML once the app starts and again whenever it changes
Follows map[string]func(kit *Kit, value string) tea.Cmd
// Key of the settings section the screen is the page of. The screen is then one area of the settings menu: the palette, its slash
// commands, Kit.Open and the menu itself all show it there
Area string
// Opens the settings menu on the area with the section key and hands the argument to the page of that area. Only the screen of the
// menu itself has one
Menu func(kit *Kit, area, argument string) tea.Cmd
// Pickers the screen offers every other screen, by the kind of thing each picks
Pickers map[string]Picker
// Pages inside the area the screen is the page of, as a search of Settings finds them: read each time a search starts, off the UI
// thread on a kit Still made as it started, so it may ask a service; the profile is the one whose settings are shown
Pages func(kit *Kit, profile string) []Page
// Runs once as the app starts, for what a screen learns before anyone opens it
Start func(kit *Kit) tea.Cmd
// Values a hole of its usage takes as a person completes its slash line, such as the styles for [name]: called off the UI loop on a kit
// Still made on it, with the hole as the usage names it and the words typed before it; nil for a screen whose holes take anything
Values func(kit *Kit, hole string, words []string) []cards.Offer
// Card of the screen made again for one it made the run before under the key, as the window opens the windows the last run kept: a new
// card, which is handed the state the old one kept (wm.Stateful) before it starts, so the key it has now may differ; nil for a key that
// is not the screen's or a card it makes no more of, such as a chat that showed no session. The state is what the old card kept, nil
// for none
Reopen func(kit *Kit, key string, state json.RawMessage) wm.Card
}
type Sessioned ¶
type Sessioned interface {
// Id of the session shown, empty before it has one
Session() string
// Profile the session shown runs on, which requests about it name
Profile() string
}
Card that shows one session of the agent, such as a chat
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
The window of the screens, made and not yet run on a terminal
func New ¶
Makes the window of the screens: its keymap with the action that opens each screen, the places a screen names and the actions it adds, the saved keys over them, and what each screen makes of the first values of the settings it follows. What the keymap refuses of a screen is the error, and no window is made