Documentation
¶
Overview ¶
Extension interface and loader, one registration per extension point linked into the binary
Index ¶
- func Load() error
- func Register(e Extension)
- type Call
- type Command
- type Contribution
- type Extension
- type Host
- func (h *Host) Action(a keys.Action)
- func (h *Host) Auth(kind profiles.AuthKind, build profiles.AuthBuilder)
- func (h *Host) Catalog(models ...profiles.Model)
- func (h *Host) Command(c Command)
- func (h *Host) Context(name, doc string)
- func (h *Host) Hook(build func(info harness.AgentInfo) agent.Hook)
- func (h *Host) Kind(k harness.Kind)
- func (h *Host) Panel(p Panel)
- func (h *Host) Profile(p profiles.Profile)
- func (h *Host) Prompt(fragment func(ctx context.Context, a *harness.App, ep harness.Endpoint) string)
- func (h *Host) Protocol(p protocol.Protocol)
- func (h *Host) Setting(s harness.Setting)
- func (h *Host) Theme(fn func() theme.Theme)
- func (h *Host) Tools(build func(a *harness.App) ([]tool.Tool, error))
- func (h *Host) Vendor(v profiles.Vendor)
- func (h *Host) Workflow(w harness.Workflow)
- type Loaded
- type Manifest
- type Panel
- type UI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Call ¶
type Call struct {
Ctx context.Context
App *harness.App
// Session on the stage, nil while none is
Live *harness.Live
Args string
UI UI
}
What a command runs with
type Command ¶
type Command struct {
// Keymap action id, such as review.start
ID string
// Palette title, the command staying out of the palette when empty
Title string
// Slash command name, none when empty
Slash string
// One line for the keybind editor and the slash list
Desc string
// Argument placeholder, the command asks for one when none came
Arg string
// Default chords
Keys []string
// Reports whether the command applies now, always when nil
When func(c *Call) bool
Run func(c *Call) tea.Cmd
// Extension the command came from
Source string
}
Command an extension adds to the palette, the slash line and the keymap
type Contribution ¶
type Contribution struct {
// Kind of point, such as kind, workflow, tool or panel
Point string
Name string
Detail string
}
One thing an extension provided
type Extension ¶
type Extension interface {
Manifest() Manifest
// Declares everything the extension provides, called once at start
Attach(h *Host) error
}
Package linked into the binary that adds to icebath through a host
type Host ¶
type Host struct {
// contains filtered or unexported fields
}
Host one extension declares into, recording the first failure
func (*Host) Auth ¶
func (h *Host) Auth(kind profiles.AuthKind, build profiles.AuthBuilder)
Adds an auth kind profiles may name
func (*Host) Prompt ¶
func (h *Host) Prompt(fragment func(ctx context.Context, a *harness.App, ep harness.Endpoint) string)
Adds text to the system prompt of every run
func (*Host) Setting ¶
Adds a setting read through the configuration, shown in the app tab and taken by the -k flag
type Loaded ¶
type Loaded struct {
Manifest
Contributions []Contribution
}
Extension after loading with what it provided
type Panel ¶
type Panel struct {
// Card key, slash command name and the end of the open.<key> action
Key string
Title string
Detail string
// Default chords of the open action
Keys []string
New func(env *cards.Env) wm.Card
// Edits the configuration of the extension, so the extensions tab offers it as the settings of the extension
Settings bool
// Extension the panel came from
Source string
}
Card an extension adds, shared by every workspace and opened by key, slash and palette
type UI ¶
type UI interface {
// Opens a card in the workspace on the stage, focusing it when already open
Open(card wm.Card) tea.Cmd
Toast(text string, level wm.Level) tea.Cmd
// Asks for a line of text
Prompt(placeholder, value string, submit func(text string) tea.Cmd) tea.Cmd
// Offers a choice
Pick(placeholder string, items []wm.Item) tea.Cmd
// Sends input to the session, steering a run going on it and starting one otherwise
Submit(live *harness.Live, parts []protocol.Part) tea.Cmd
// Starts a registered workflow from the session on the stage
Start(workflow, arg string) tea.Cmd
// Live state cards read
Env() *cards.Env
}
What a command may do to the interface