launch

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfirmPrompt func(prompt string) (bool, error)

DefaultConfirmPrompt provides a TUI-based confirmation prompt. When set, ConfirmPrompt delegates to it instead of using raw terminal I/O.

View Source
var DefaultSignIn func(modelName, signInURL string) (string, error)

DefaultSignIn provides a TUI-based sign-in flow. When set, ensureAuth uses it instead of plain text prompts. Returns the signed-in username or an error.

View Source
var ErrCancelled = errors.New("cancelled")

ErrCancelled is returned when the user cancels a selection.

Functions

func ConfirmPrompt

func ConfirmPrompt(prompt string) (bool, error)

ConfirmPrompt is the shared confirmation gate for launch flows (integration edits, missing-model pulls, sign-in prompts, OpenClaw install/security, etc). Behavior is controlled by currentLaunchConfirmPolicy, typically scoped by withLaunchConfirmPolicy in LaunchCmd (e.g. auto-approve with --yes).

func EnsureIntegrationInstalled

func EnsureIntegrationInstalled(name string, runner Runner) error

EnsureIntegrationInstalled installs auto-installable integrations when missing.

func IsIntegrationInstalled

func IsIntegrationInstalled(name string) bool

IsIntegrationInstalled checks if an integration binary is installed.

func LaunchCmd

func LaunchCmd(checkServerHeartbeat func(cmd *cobra.Command, args []string) error, runTUI func(cmd *cobra.Command)) *cobra.Command

LaunchCmd returns the cobra command for launching integrations. The runTUI callback is called when the root launcher UI should be shown.

func LaunchIntegration

func LaunchIntegration(ctx context.Context, req IntegrationLaunchRequest) error

LaunchIntegration runs the canonical launcher flow for one integration.

func OpenBrowser

func OpenBrowser(url string)

OpenBrowser opens the URL in the user's browser.

func ResolveRunModel

func ResolveRunModel(ctx context.Context, req RunModelRequest) (string, error)

ResolveRunModel returns the model that should be used for interactive chat.

Types

type Claude

type Claude struct{}

Claude implements Runner for Claude Code integration.

func (*Claude) Run

func (c *Claude) Run(model string, args []string) error

func (*Claude) String

func (c *Claude) String() string

type Cline

type Cline struct{}

Cline implements Runner and Editor for the Cline CLI integration

func (*Cline) Edit

func (c *Cline) Edit(models []string) error

func (*Cline) Models

func (c *Cline) Models() []string

func (*Cline) Paths

func (c *Cline) Paths() []string

func (*Cline) Run

func (c *Cline) Run(model string, args []string) error

func (*Cline) String

func (c *Cline) String() string

type Codex

type Codex struct{}

Codex implements Runner for Codex integration

func (*Codex) Run

func (c *Codex) Run(model string, args []string) error

func (*Codex) String

func (c *Codex) String() string

type Droid

type Droid struct{}

Droid implements Runner and Editor for Droid integration

func (*Droid) Edit

func (d *Droid) Edit(models []string) error

func (*Droid) Models

func (d *Droid) Models() []string

func (*Droid) Paths

func (d *Droid) Paths() []string

func (*Droid) Run

func (d *Droid) Run(model string, args []string) error

func (*Droid) String

func (d *Droid) String() string

type Editor

type Editor interface {
	Paths() []string
	Edit(models []string) error
	Models() []string
}

Editor can edit config files for integrations that support model configuration.

type IntegrationInfo

type IntegrationInfo struct {
	Name        string
	DisplayName string
	Description string
}

IntegrationInfo contains display information about a registered integration.

func ListIntegrationInfos

func ListIntegrationInfos() []IntegrationInfo

ListIntegrationInfos returns the registered integrations in launcher display order.

type IntegrationInstallSpec

type IntegrationInstallSpec struct {
	CheckInstalled  func() bool
	EnsureInstalled func() error
	URL             string
	Command         []string
}

IntegrationInstallSpec describes how launcher should detect and guide installation.

type IntegrationLaunchRequest

type IntegrationLaunchRequest struct {
	Name           string
	ModelOverride  string
	ForceConfigure bool
	ConfigureOnly  bool
	ExtraArgs      []string
	Policy         *LaunchPolicy
}

IntegrationLaunchRequest controls the canonical integration launcher flow.

type IntegrationSpec

type IntegrationSpec struct {
	Name        string
	Runner      Runner
	Aliases     []string
	Hidden      bool
	Description string
	Install     IntegrationInstallSpec
}

IntegrationSpec is the canonical registry entry for one integration.

func ListVisibleIntegrationSpecs

func ListVisibleIntegrationSpecs() []IntegrationSpec

ListVisibleIntegrationSpecs returns the canonical integrations that should appear in interactive UIs.

func LookupIntegrationSpec

func LookupIntegrationSpec(name string) (*IntegrationSpec, error)

LookupIntegrationSpec resolves either a canonical integration name or alias to its spec.

type LaunchConfirmMode

type LaunchConfirmMode int

LaunchConfirmMode controls confirmation behavior across launch flows.

const (
	// LaunchConfirmPrompt prompts the user for confirmation.
	LaunchConfirmPrompt LaunchConfirmMode = iota
	// LaunchConfirmAutoApprove skips prompts and treats confirmation as accepted.
	LaunchConfirmAutoApprove
	// LaunchConfirmRequireYes rejects confirmation requests with a --yes hint.
	LaunchConfirmRequireYes
)

type LaunchMissingModelMode

type LaunchMissingModelMode int

LaunchMissingModelMode controls local missing-model handling in launch flows.

const (
	// LaunchMissingModelPromptToPull prompts to pull a missing local model.
	LaunchMissingModelPromptToPull LaunchMissingModelMode = iota
	// LaunchMissingModelAutoPull pulls a missing local model without prompting.
	LaunchMissingModelAutoPull
	// LaunchMissingModelFail fails immediately when a local model is missing.
	LaunchMissingModelFail
)

type LaunchPolicy

type LaunchPolicy struct {
	Confirm      LaunchConfirmMode
	MissingModel LaunchMissingModelMode
}

LaunchPolicy controls launch behavior that may vary by caller context.

type LauncherIntegrationState

type LauncherIntegrationState struct {
	Name            string
	DisplayName     string
	Description     string
	Installed       bool
	AutoInstallable bool
	Selectable      bool
	Changeable      bool
	CurrentModel    string
	ModelUsable     bool
	InstallHint     string
	Editor          bool
}

LauncherIntegrationState is the launch-owned status for one launcher integration.

type LauncherState

type LauncherState struct {
	LastSelection  string
	RunModel       string
	RunModelUsable bool
	Integrations   map[string]LauncherIntegrationState
}

LauncherState is the launch-owned snapshot used to render the root launcher menu.

func BuildLauncherState

func BuildLauncherState(ctx context.Context) (*LauncherState, error)

BuildLauncherState returns the launch-owned root launcher menu snapshot.

type ModelInfo

type ModelInfo = modelInfo

ModelInfo re-exports launcher model inventory details for callers.

type ModelItem

type ModelItem struct {
	Name        string
	Description string
	Recommended bool
}

ModelItem represents a model for selection UIs.

func IntegrationSelectionItems

func IntegrationSelectionItems() ([]ModelItem, error)

IntegrationSelectionItems returns the sorted integration items shown by launcher selection UIs.

type MultiSelector

type MultiSelector func(title string, items []ModelItem, preChecked []string) ([]string, error)

MultiSelector is a function type for multi item selection.

var DefaultMultiSelector MultiSelector

DefaultMultiSelector is the default multi-select implementation.

type OpenCode

type OpenCode struct{}

OpenCode implements Runner and Editor for OpenCode integration

func (*OpenCode) Edit

func (o *OpenCode) Edit(modelList []string) error

func (*OpenCode) Models

func (o *OpenCode) Models() []string

func (*OpenCode) Paths

func (o *OpenCode) Paths() []string

func (*OpenCode) Run

func (o *OpenCode) Run(model string, args []string) error

func (*OpenCode) String

func (o *OpenCode) String() string

type Openclaw

type Openclaw struct{}

func (*Openclaw) Edit

func (c *Openclaw) Edit(models []string) error

func (*Openclaw) Models

func (c *Openclaw) Models() []string

func (*Openclaw) Paths

func (c *Openclaw) Paths() []string

func (*Openclaw) Run

func (c *Openclaw) Run(model string, args []string) error

func (*Openclaw) String

func (c *Openclaw) String() string

type Pi

type Pi struct{}

Pi implements Runner and Editor for Pi (Pi Coding Agent) integration

func (*Pi) Edit

func (p *Pi) Edit(models []string) error

func (*Pi) Models

func (p *Pi) Models() []string

func (*Pi) Paths

func (p *Pi) Paths() []string

func (*Pi) Run

func (p *Pi) Run(model string, args []string) error

func (*Pi) String

func (p *Pi) String() string

type RunModelRequest

type RunModelRequest struct {
	ForcePicker bool
	Policy      *LaunchPolicy
}

RunModelRequest controls how the root launcher resolves the chat model.

type Runner

type Runner interface {
	Run(model string, args []string) error
	String() string
}

Runner executes a model with an integration.

func LookupIntegration

func LookupIntegration(name string) (string, Runner, error)

LookupIntegration resolves a registry name to the canonical key and runner.

type SingleSelector

type SingleSelector func(title string, items []ModelItem, current string) (string, error)

SingleSelector is a function type for single item selection. current is the name of the previously selected item to highlight; empty means no pre-selection.

var DefaultSingleSelector SingleSelector

DefaultSingleSelector is the default single-select implementation.

Jump to

Keyboard shortcuts

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