launch

package
v0.23.2 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultUpgradeURL is the fixed destination for subscription upgrades.
	DefaultUpgradeURL = "https://ollama.com/upgrade"
)

Variables

View Source
var DefaultConfirmPrompt func(prompt string, options ConfirmOptions) (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 DefaultUpgrade func(modelName, requiredPlan string) (string, error)

DefaultUpgrade provides a TUI-based upgrade flow. Returns the updated plan or an error.

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

ErrCancelled is returned when the user cancels a selection.

View Source
var (
	ErrPlanVerificationUnavailable = errors.New("Could not verify your plan. Try again in a moment.")
)

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 ConfirmPromptWithOptions added in v0.20.5

func ConfirmPromptWithOptions(prompt string, options ConfirmOptions) (bool, error)

ConfirmPromptWithOptions is the shared confirmation gate for launch flows that need custom yes/no labels in interactive UIs.

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 PlanSatisfies added in v0.23.2

func PlanSatisfies(currentPlan, requiredPlan string) bool

PlanSatisfies reports whether currentPlan can use a model that has a requiredPlan.

func ResolveRunModel

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

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

Types

type AccountState added in v0.23.2

type AccountState struct {
	Status accountStateStatus
	Plan   string
}

type AccountStatePrefetch added in v0.23.2

type AccountStatePrefetch struct {
	// contains filtered or unexported fields
}

func StartAccountStatePrefetch added in v0.23.2

func StartAccountStatePrefetch(ctx context.Context) *AccountStatePrefetch

func (*AccountStatePrefetch) StateIfReady added in v0.23.2

func (p *AccountStatePrefetch) StateIfReady() *AccountState

func (*AccountStatePrefetch) StateUpdates added in v0.23.2

func (p *AccountStatePrefetch) StateUpdates(ctx context.Context) <-chan *AccountState

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 ClaudeDesktop added in v0.23.0

type ClaudeDesktop struct{}

ClaudeDesktop configures and launches Claude Desktop in third-party inference mode using Ollama Cloud as the gateway.

func (*ClaudeDesktop) AutodiscoveredModel added in v0.23.0

func (c *ClaudeDesktop) AutodiscoveredModel() string

func (*ClaudeDesktop) AutodiscoveryConfigured added in v0.23.0

func (c *ClaudeDesktop) AutodiscoveryConfigured() bool

func (*ClaudeDesktop) ConfigurationSuccessMessage added in v0.23.0

func (c *ClaudeDesktop) ConfigurationSuccessMessage() string

func (*ClaudeDesktop) ConfigureAutodiscovery added in v0.23.0

func (c *ClaudeDesktop) ConfigureAutodiscovery() error

func (*ClaudeDesktop) Onboard added in v0.23.0

func (c *ClaudeDesktop) Onboard() error

func (*ClaudeDesktop) Paths added in v0.23.0

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

func (*ClaudeDesktop) RequiresInteractiveOnboarding added in v0.23.0

func (c *ClaudeDesktop) RequiresInteractiveOnboarding() bool

func (*ClaudeDesktop) Restore added in v0.23.0

func (c *ClaudeDesktop) Restore() error

func (*ClaudeDesktop) RestoreHint added in v0.23.0

func (c *ClaudeDesktop) RestoreHint() string

func (*ClaudeDesktop) RestoreSuccessMessage added in v0.23.0

func (c *ClaudeDesktop) RestoreSuccessMessage() string

func (*ClaudeDesktop) Run added in v0.23.0

func (c *ClaudeDesktop) Run(_ string, _ []string) error

func (*ClaudeDesktop) SkipModelReadiness added in v0.23.0

func (c *ClaudeDesktop) SkipModelReadiness() bool

func (*ClaudeDesktop) String added in v0.23.0

func (c *ClaudeDesktop) String() string

func (*ClaudeDesktop) Supported added in v0.23.0

func (c *ClaudeDesktop) Supported() error

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 ConfigurationSuccessIntegration added in v0.23.0

type ConfigurationSuccessIntegration interface {
	ConfigurationSuccessMessage() string
}

ConfigurationSuccessIntegration can print a short message after launcher successfully switches an app into a launch-managed mode.

type ConfirmOptions added in v0.20.5

type ConfirmOptions struct {
	YesLabel string
	NoLabel  string
}

ConfirmOptions customizes labels for confirmation prompts.

type Copilot added in v0.21.0

type Copilot struct{}

Copilot implements Runner for GitHub Copilot CLI integration.

func (*Copilot) Run added in v0.21.0

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

func (*Copilot) String added in v0.21.0

func (c *Copilot) 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 Hermes added in v0.21.0

type Hermes struct{}

Hermes is intentionally not an Editor integration: launch owns one primary model and the local Ollama endpoint, while Hermes keeps its own discovery and switching UX after startup.

func (*Hermes) Configure added in v0.21.0

func (h *Hermes) Configure(model string) error

func (*Hermes) CurrentModel added in v0.21.0

func (h *Hermes) CurrentModel() string

func (*Hermes) Onboard added in v0.21.0

func (h *Hermes) Onboard() error

func (*Hermes) Paths added in v0.21.0

func (h *Hermes) Paths() []string

func (*Hermes) RefreshRuntimeAfterConfigure added in v0.21.0

func (h *Hermes) RefreshRuntimeAfterConfigure() error

func (*Hermes) RequiresInteractiveOnboarding added in v0.21.0

func (h *Hermes) RequiresInteractiveOnboarding() bool

func (*Hermes) Run added in v0.21.0

func (h *Hermes) Run(_ string, args []string) error

func (*Hermes) String added in v0.21.0

func (h *Hermes) String() string

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
	Restore              bool
	ExtraArgs            []string
	Policy               *LaunchPolicy
	AccountState         *AccountState
	AccountStateProvider func() *AccountState
	AccountStateUpdates  func(context.Context) <-chan *AccountState
}

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 Kimi added in v0.21.1

type Kimi struct{}

Kimi implements Runner for Kimi Code CLI integration.

func (*Kimi) Run added in v0.21.1

func (k *Kimi) Run(model string, args []string) error

func (*Kimi) String added in v0.21.1

func (k *Kimi) String() string

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
	AccountState   *AccountState
}

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 ManagedAutodiscoveryCloudIntegration added in v0.23.0

type ManagedAutodiscoveryCloudIntegration interface {
	UsesOllamaCloud() bool
}

ManagedAutodiscoveryCloudIntegration marks an autodiscovery integration whose discovered model catalog depends on the user's local Ollama Cloud auth state.

type ManagedAutodiscoveryIntegration added in v0.23.0

type ManagedAutodiscoveryIntegration interface {
	Paths() []string
	AutodiscoveredModel() string
	AutodiscoveryConfigured() bool
	ConfigureAutodiscovery() error
	Onboard() error
}

ManagedAutodiscoveryIntegration is for managed integrations that do not need a launcher-selected model because the app discovers available models itself.

type ManagedInteractiveOnboarding added in v0.21.0

type ManagedInteractiveOnboarding interface {
	RequiresInteractiveOnboarding() bool
}

ManagedInteractiveOnboarding lets a managed integration declare whether its onboarding step really requires an interactive terminal. Hermes does not.

type ManagedModelListConfigurer added in v0.23.0

type ManagedModelListConfigurer interface {
	ConfigureWithModels(primary string, models []string) error
}

ManagedModelListConfigurer lets managed single-model integrations receive the launcher's model list while still preserving one primary selected model.

type ManagedModelReadinessSkipper added in v0.23.0

type ManagedModelReadinessSkipper interface {
	SkipModelReadiness() bool
}

ManagedModelReadinessSkipper lets managed integrations opt out of local Ollama model readiness checks when the configured runtime is not the local daemon.

type ManagedOnboardingValidator added in v0.21.0

type ManagedOnboardingValidator interface {
	OnboardingComplete() bool
}

ManagedOnboardingValidator lets managed integrations re-check saved onboarding state when launcher needs a stronger live readiness signal.

type ManagedRuntimeRefresher added in v0.21.0

type ManagedRuntimeRefresher interface {
	RefreshRuntimeAfterConfigure() error
}

ManagedRuntimeRefresher lets managed integrations refresh any long-lived background runtime after launch rewrites their config.

type ManagedSingleModel added in v0.21.0

type ManagedSingleModel interface {
	Paths() []string
	Configure(model string) error
	CurrentModel() string
	Onboard() error
}

ManagedSingleModel is the narrow launch-owned config path for integrations like Hermes that have one primary model selected by launcher, need launcher to persist minimal config, and still keep their own model discovery and onboarding UX. This stays separate from Runner-only integrations and the multi-model Editor flow so Hermes-specific behavior stays scoped to one path.

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
	VRAMBytes       int64
	ContextLength   int
	MaxOutputTokens int
	RequiredPlan    string
}

ModelItem represents model metadata before selector-only UI state is derived.

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 []SelectionItem, preChecked []string) ([]string, error)

MultiSelector is a function type for multi item selection.

var DefaultMultiSelector MultiSelector

DefaultMultiSelector is the default multi-select implementation.

type MultiSelectorWithUpdates added in v0.23.2

type MultiSelectorWithUpdates func(title string, items []SelectionItem, preChecked []string, updates <-chan []SelectionItem) ([]string, error)

MultiSelectorWithUpdates is a multi item selector that can receive refreshed item state while open.

var DefaultMultiSelectorWithUpdates MultiSelectorWithUpdates

DefaultMultiSelectorWithUpdates is the default multi-select implementation with live updates.

type OpenCode

type OpenCode struct {
	// contains filtered or unexported fields
}

OpenCode implements Runner and Editor for OpenCode integration. Config is passed via OPENCODE_CONFIG_CONTENT env var at launch time instead of writing to opencode's config files.

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 Poolside added in v0.22.0

type Poolside struct{}

Poolside implements Runner for Poolside's CLI.

func (*Poolside) Run added in v0.22.0

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

func (*Poolside) String added in v0.22.0

func (p *Poolside) String() string

type RestorableIntegration added in v0.23.0

type RestorableIntegration interface {
	Restore() error
}

RestorableIntegration lets integrations switch back from a launch-managed mode to the application's normal/default mode.

type RestoreHintIntegration added in v0.23.0

type RestoreHintIntegration interface {
	RestoreHint() string
}

RestoreHintIntegration can provide a short restore command after launch switches an app into a launch-managed mode.

type RestoreSuccessIntegration added in v0.23.0

type RestoreSuccessIntegration interface {
	RestoreSuccessMessage() string
}

RestoreSuccessIntegration can print a short message after launcher restores an app back to its default mode.

type RunModelRequest

type RunModelRequest struct {
	ForcePicker          bool
	Policy               *LaunchPolicy
	AccountState         *AccountState
	AccountStateProvider func() *AccountState
	AccountStateUpdates  func(context.Context) <-chan *AccountState
}

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 SelectionItem added in v0.23.2

type SelectionItem struct {
	Name              string
	Description       string
	Recommended       bool
	AvailabilityBadge string
}

SelectionItem represents a model row after launch has derived selector-only UI state.

func ApplyAccountStateToSelectionItems added in v0.23.2

func ApplyAccountStateToSelectionItems(items []ModelItem, state AccountState) []SelectionItem

func SelectionItemsWithAccountState added in v0.23.2

func SelectionItemsWithAccountState(items []ModelItem, state *AccountState) []SelectionItem

type SingleSelector

type SingleSelector func(title string, items []SelectionItem, 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.

type SingleSelectorWithUpdates added in v0.23.2

type SingleSelectorWithUpdates func(title string, items []SelectionItem, current string, updates <-chan []SelectionItem) (string, error)

SingleSelectorWithUpdates is a single item selector that can receive refreshed item state while open.

var DefaultSingleSelectorWithUpdates SingleSelectorWithUpdates

DefaultSingleSelectorWithUpdates is the default single-select implementation with live updates.

type SupportedIntegration added in v0.23.0

type SupportedIntegration interface {
	Supported() error
}

SupportedIntegration lets an integration report platform support separately from whether the underlying app binary is installed.

type VSCode added in v0.18.3

type VSCode struct{}

VSCode implements Runner and Editor for Visual Studio Code integration.

func (*VSCode) Edit added in v0.18.3

func (v *VSCode) Edit(models []string) error

func (*VSCode) FocusVSCode added in v0.18.3

func (v *VSCode) FocusVSCode()

FocusVSCode brings VS Code to the foreground.

func (*VSCode) IsRunning added in v0.18.3

func (v *VSCode) IsRunning() bool

IsRunning reports whether VS Code is currently running. Each platform uses a pattern specific enough to avoid matching Cursor or other VS Code forks.

func (*VSCode) Models added in v0.18.3

func (v *VSCode) Models() []string

func (*VSCode) Paths added in v0.18.3

func (v *VSCode) Paths() []string

func (*VSCode) Quit added in v0.18.3

func (v *VSCode) Quit()

Quit gracefully quits VS Code and waits for it to exit so that it flushes its in-memory state back to the database.

func (*VSCode) Run added in v0.18.3

func (v *VSCode) Run(model string, args []string) error

func (*VSCode) ShowInModelPicker added in v0.18.3

func (v *VSCode) ShowInModelPicker(models []string) error

ShowInModelPicker ensures the given models are visible in VS Code's Copilot Chat model picker. It sets the configured models to true in the picker preferences so they appear in the dropdown. Models use the VS Code identifier format "ollama/Ollama/<name>".

func (*VSCode) String added in v0.18.3

func (v *VSCode) String() string

Jump to

Keyboard shortcuts

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