Documentation
¶
Index ¶
- Variables
- func BuildEnv(spec LaunchSpec) ([]string, error)
- func RunInteractive(ctx context.Context, stdout, stderr io.Writer, spec LaunchSpec) error
- func RunTabbed(ctx context.Context, stdout, stderr io.Writer, version string, ...) error
- type LaunchSpec
- type NewTabFunc
- type PreparedCmd
- type Tab
- type TabManager
- type TabNoticeLevel
Constants ¶
This section is empty.
Variables ¶
var ErrBackToTabs = errors.New("back to tabs")
ErrBackToTabs is returned by the newTabFn when the user presses Ctrl+B to dismiss the chooser and return to tab command mode.
var ErrQuit = errors.New("user quit")
ErrQuit is returned by RunTabbed when the user quits the chooser without creating any tabs.
var ErrUpdateRequested = errors.New("update requested")
ErrUpdateRequested is returned by RunTabbed when the user presses U in tab command mode to trigger a self-update and re-exec.
Functions ¶
func BuildEnv ¶
func BuildEnv(spec LaunchSpec) ([]string, error)
BuildEnv constructs the environment variables for the harness process, including the provider endpoint, API key, and model overrides.
func RunInteractive ¶
RunInteractive launches the harness as an interactive subprocess with full TTY access. It prints a bifrost banner before launch and a summary after exit.
func RunTabbed ¶ added in v0.10.0
func RunTabbed(ctx context.Context, stdout, stderr io.Writer, version string, updateVersion string, newTabFn NewTabFunc) error
RunTabbed enters the tabbed multiplexer. It starts with a tab bar, immediately opens the chooser via newTabFn for the first tab, then enters the main event loop. Returns ErrQuit if the user quits the initial chooser without creating any tabs.
Types ¶
type LaunchSpec ¶
type LaunchSpec struct {
Harness harness.Harness
BaseURL string
VirtualKey string
Model string
Worktree string // empty = no worktree, non-empty = worktree name (or " " for unnamed)
}
LaunchSpec holds the parameters needed to launch a harness subprocess.
type NewTabFunc ¶ added in v0.10.0
type NewTabFunc func(ctx context.Context, notify func(level TabNoticeLevel, message string), tabBarLine func() string, stdinReader io.Reader, seed *LaunchSpec) (*LaunchSpec, error)
NewTabFunc is called when the user requests a new tab or reopens the chooser for the active tab. It should present any UI needed (e.g. the harness chooser) and return the launch spec. Return a nil spec to cancel. When seed is non-nil, the chooser should use it to prefill the current tab. stdinReader provides keyboard input; when nil the callback should read os.Stdin. tabBarLine returns the current tab bar content for embedding in the chooser view.
type PreparedCmd ¶ added in v0.10.0
PreparedCmd holds a command ready to execute along with any cleanup function that should be called after the process exits.
func PrepareCommand ¶ added in v0.10.0
func PrepareCommand(ctx context.Context, spec LaunchSpec) (*PreparedCmd, error)
PrepareCommand builds the exec.Cmd for a harness launch, including environment variables, pre-launch hooks, and CLI arguments.
type Tab ¶ added in v0.10.0
type Tab struct {
// contains filtered or unexported fields
}
Tab represents a single CLI session running in a PTY.
type TabManager ¶ added in v0.10.0
type TabManager struct {
// contains filtered or unexported fields
}
TabManager multiplexes multiple CLI sessions. Each session runs in its own PTY, with a virtual terminal emulator capturing output. A 30fps render loop composites the active tab's screen content with the tab bar into atomic frames.
type TabNoticeLevel ¶ added in v0.10.0
type TabNoticeLevel int
TabNoticeLevel controls how transient tab bar notices are styled.
const ( TabNoticeInfo TabNoticeLevel = iota TabNoticeError )