launch

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 40 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 DefaultSpinner func(message string) *Spinner

DefaultSpinner, when set, starts an animated spinner displaying message and returns a *Spinner. cmd/cmd.go registers a bubbletea implementation from cmd/tui; when unset (or when it returns nil, e.g. no TTY) StartSpinner falls back to a simple ANSI spinner using SpinnerFrames.

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 ErrClaudeDesktopRestartConfirmationRequired = errors.New("Claude Desktop restart confirmation is required before changing its profile")

ErrClaudeDesktopRestartConfirmationRequired reports that applying a profile change would interrupt a running Claude Desktop process.

View Source
var ErrCodexAppRestartConfirmationRequired = errors.New("ChatGPT restart confirmation is required before changing its profile")

ErrCodexAppRestartConfirmationRequired reports that changing the regular ChatGPT profile would interrupt a running task.

View Source
var (
	ErrPlanVerificationUnavailable = errors.New("Could not verify Ollama plan. Try again in a moment or use a local model.")
)
View Source
var SpinnerFrames = []string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"}

SpinnerFrames are the braille spinner frames used by the bubbletea TUIs in this codebase (sign-in, upgrade). StartSpinner uses the same frames for its fallback so the restart spinner matches the look of those flows.

Functions

func ClaudeDesktopAutoModeEnabled added in v0.33.0

func ClaudeDesktopAutoModeEnabled() (bool, error)

ClaudeDesktopAutoModeEnabled reports the user's Claude Desktop auto mode preference. It defaults to true when unset and returns configuration read failures so callers do not mistake them for an explicit disabled setting.

func ClaudeDesktopInstalled added in v0.33.0

func ClaudeDesktopInstalled() bool

ClaudeDesktopInstalled reports whether Claude Desktop is installed.

func ClaudeDesktopModelMappings added in v0.33.0

func ClaudeDesktopModelMappings() map[string]string

ClaudeDesktopModelMappings returns explicit Claude route assignments. An empty map means the legacy ordered model selection or recommendations apply.

func ClaudeDesktopModels added in v0.33.0

func ClaudeDesktopModels() []string

ClaudeDesktopModels returns the user's explicitly saved Claude Desktop model subset. A nil result means the recommendation source should decide.

func ClaudeDesktopRunning added in v0.33.0

func ClaudeDesktopRunning() bool

ClaudeDesktopRunning reports whether Claude Desktop is open.

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 LoadedContextWindow added in v0.32.12

func LoadedContextWindow(ctx context.Context, client *api.Client, model string) int

LoadedContextWindow reports the context length model is currently running with, per the server's process list — the size the scheduler actually allocated, which VRAM fit or server configuration may hold below the model's trained maximum. Returns 0 when it cannot be determined.

func OpenBrowser

func OpenBrowser(url string)

OpenBrowser opens the URL in the user's browser.

func OpenClaudeDesktop added in v0.33.0

func OpenClaudeDesktop() error

OpenClaudeDesktop brings the installed Claude Desktop app to the foreground.

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.

func RestoreClaudeDesktopModelMappings added in v0.33.0

func RestoreClaudeDesktopModelMappings(models []string, mappings map[string]string) error

RestoreClaudeDesktopModelMappings restores a previously captured explicit mapping, including the legacy no-mapping state.

func RestoreClaudeDesktopModels added in v0.33.0

func RestoreClaudeDesktopModels(models []string) error

RestoreClaudeDesktopModels restores a previously captured selection. A nil selection restores the implicit recommendation defaults.

func SameModelRef added in v0.32.12

func SameModelRef(a, b string) bool

SameModelRef reports whether two references name the same model, tolerating an explicit ":latest" tag and an unspecified source on either side.

func SaveClaudeDesktopAutoMode added in v0.33.0

func SaveClaudeDesktopAutoMode(enabled bool) error

SaveClaudeDesktopAutoMode persists the user's Claude Desktop auto mode preference in the shared launcher configuration.

func SaveClaudeDesktopModelMappings added in v0.33.0

func SaveClaudeDesktopModelMappings(mappings map[string]string) error

SaveClaudeDesktopModelMappings persists explicit route assignments. Empty routes are omitted; sparse mappings and duplicate model values are valid.

func SaveClaudeDesktopModels added in v0.33.0

func SaveClaudeDesktopModels(models []string) error

SaveClaudeDesktopModels persists the user's explicit Claude Desktop model subset in the shared launcher configuration.

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, _ []LaunchModel, 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 the Ollama app's local gateway.

func (*ClaudeDesktop) ApplyProfileChange added in v0.33.0

func (c *ClaudeDesktop) ApplyProfileChange(change func() error, restartConfirmed bool) error

ApplyProfileChange applies a profile-dependent change immediately. Claude is restarted only when it is already running; otherwise the change takes effect the next time the user opens it.

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) AutodiscoveryConfiguredWithAutoMode added in v0.33.0

func (c *ClaudeDesktop) AutodiscoveryConfiguredWithAutoMode(autoMode bool) bool

AutodiscoveryConfiguredWithAutoMode reports whether the managed profile has the effective Auto mode state selected by the Ollama app.

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

ConfigureAutodiscovery points Claude Desktop at Ollama's local gateway without pinning a model list, so Claude discovers the selected catalog and exact Ollama route names the gateway advertises.

func (*ClaudeDesktop) ConfigureAutodiscoveryWithAutoMode added in v0.33.0

func (c *ClaudeDesktop) ConfigureAutodiscoveryWithAutoMode(autoMode bool) error

ConfigureAutodiscoveryWithAutoMode writes the managed profile with the effective Auto mode state selected by the Ollama app.

func (*ClaudeDesktop) Onboard added in v0.23.0

func (c *ClaudeDesktop) Onboard() error

func (*ClaudeDesktop) Open added in v0.33.0

func (c *ClaudeDesktop) Open() error

Open launches or foregrounds Claude Desktop.

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) RestoreForShutdown added in v0.33.0

func (c *ClaudeDesktop) RestoreForShutdown(ctx context.Context) error

RestoreForShutdown restores Claude's usual profile without reopening the app.

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, _ []LaunchModel, args []string) error

func (*ClaudeDesktop) Running added in v0.33.0

func (c *ClaudeDesktop) Running() bool

Running reports whether Claude Desktop is currently open.

func (*ClaudeDesktop) SetInstalledFromDesktop added in v0.33.0

func (c *ClaudeDesktop) SetInstalledFromDesktop(installed, restart bool) error

SetInstalledFromDesktop changes the Claude profile from the native Ollama app.

func (*ClaudeDesktop) SetInstalledFromDesktopWithAutoMode added in v0.33.0

func (c *ClaudeDesktop) SetInstalledFromDesktopWithAutoMode(installed, restart, autoMode bool) error

SetInstalledFromDesktopWithAutoMode changes the Claude profile from the native Ollama app with its effective Auto mode state.

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

func (*ClaudeDesktop) UsesOllamaGateway added in v0.33.0

func (c *ClaudeDesktop) UsesOllamaGateway() bool

UsesOllamaGateway reports whether Claude Desktop is currently routed through Ollama's local gateway. It intentionally ignores auxiliary profile settings so the gateway can keep serving while those settings are repaired.

type Cline

type Cline struct{}

Cline implements Runner and Editor for the Cline CLI integration

func (*Cline) Edit

func (c *Cline) Edit(models []LaunchModel) 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, _ []LaunchModel, args []string) error

func (*Cline) String

func (c *Cline) String() string

type Codex

type Codex struct{}

Codex implements Runner for Codex integration

func (*Codex) Restore added in v0.30.1

func (c *Codex) Restore() error

func (*Codex) RestoreSuccessMessage added in v0.30.1

func (c *Codex) RestoreSuccessMessage() string

func (*Codex) Run

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

func (*Codex) SkipRestoreInstallCheck added in v0.30.1

func (c *Codex) SkipRestoreInstallCheck() bool

func (*Codex) String

func (c *Codex) String() string

type CodexApp added in v0.24.0

type CodexApp struct{}

CodexApp adds Ollama models to ChatGPT's native catalog using a loopback router.

func (*CodexApp) ConfigurationSuccessMessage added in v0.24.0

func (c *CodexApp) ConfigurationSuccessMessage() string

func (*CodexApp) Configure added in v0.24.0

func (c *CodexApp) Configure(model string) error

func (*CodexApp) ConfigureWithModels added in v0.24.0

func (c *CodexApp) ConfigureWithModels(primary string, models []LaunchModel) error

func (*CodexApp) CurrentModel added in v0.24.0

func (c *CodexApp) CurrentModel() string

func (*CodexApp) Installed added in v0.34.0

func (c *CodexApp) Installed() bool

Installed reports whether ChatGPT can be opened on this host.

func (*CodexApp) OllamaConfigured added in v0.34.0

func (c *CodexApp) OllamaConfigured() bool

OllamaConfigured reports whether the regular ChatGPT profile has the additive Ollama catalog and loopback router enabled.

func (*CodexApp) OllamaRequestCount added in v0.34.0

func (c *CodexApp) OllamaRequestCount() uint64

func (*CodexApp) Onboard added in v0.24.0

func (c *CodexApp) Onboard() error

func (*CodexApp) Paths added in v0.24.0

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

func (*CodexApp) RequiresInteractiveOnboarding added in v0.24.0

func (c *CodexApp) RequiresInteractiveOnboarding() bool

func (*CodexApp) RestartFromDesktop added in v0.34.0

func (c *CodexApp) RestartFromDesktop(restartConfirmed bool) error

RestartFromDesktop repairs and restarts the saved profile without requiring live inventory.

func (*CodexApp) Restore added in v0.24.0

func (c *CodexApp) Restore() error

func (*CodexApp) RestoreFromDesktop added in v0.34.0

func (c *CodexApp) RestoreFromDesktop(restartConfirmed bool) error

RestoreFromDesktop removes the additive Ollama catalog and restores the prior base URL and model settings. A stopped ChatGPT app remains stopped.

func (*CodexApp) RestoreHint added in v0.24.0

func (c *CodexApp) RestoreHint() string

func (*CodexApp) RestoreSuccessMessage added in v0.24.0

func (c *CodexApp) RestoreSuccessMessage() string

func (*CodexApp) Run added in v0.24.0

func (c *CodexApp) Run(_ string, _ []LaunchModel, args []string) error

func (*CodexApp) Running added in v0.34.0

func (c *CodexApp) Running() bool

Running reports whether the user's regular ChatGPT app is open.

func (*CodexApp) String added in v0.24.0

func (c *CodexApp) String() string

func (*CodexApp) Supported added in v0.24.0

func (c *CodexApp) Supported() error

func (*CodexApp) UpdateOllamaModelsFromDesktop added in v0.34.0

func (c *CodexApp) UpdateOllamaModelsFromDesktop(primary string, models []LaunchModel, restartConfirmed bool) error

UpdateOllamaModelsFromDesktop changes the Ollama catalog without opening a stopped ChatGPT app. A running app still restarts after confirmation.

func (*CodexApp) UseOllamaFromDesktop added in v0.34.0

func (c *CodexApp) UseOllamaFromDesktop(primary string, models []LaunchModel, restartConfirmed bool) error

UseOllamaFromDesktop adds Ollama models to the regular ChatGPT profile. Its startup-only catalog requires a confirmed restart when running.

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 ConfirmDefault added in v0.32.0

type ConfirmDefault int
const (
	ConfirmDefaultYes ConfirmDefault = iota
	ConfirmDefaultNo
)

type ConfirmOptions added in v0.20.5

type ConfirmOptions struct {
	YesLabel string
	NoLabel  string
	Default  ConfirmDefault
}

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, _ []LaunchModel, args []string) error

func (*Copilot) String added in v0.21.0

func (c *Copilot) String() string

type DeepSeekHarness added in v0.32.12

type DeepSeekHarness struct{}

DeepSeekHarness is the Ollama-managed DeepSeek Harness integration. It redirects only the settings provider for this invocation to an Ollama-owned document. The user's normal DSH_HOME, profiles, sessions, credentials, and patch layers remain available and untouched.

func (*DeepSeekHarness) Configure added in v0.32.12

func (d *DeepSeekHarness) Configure(modelName string) error

func (*DeepSeekHarness) ConfigureWithModels added in v0.32.12

func (d *DeepSeekHarness) ConfigureWithModels(primary string, models []LaunchModel) error

func (*DeepSeekHarness) CurrentModel added in v0.32.12

func (d *DeepSeekHarness) CurrentModel() string

func (*DeepSeekHarness) Onboard added in v0.32.12

func (d *DeepSeekHarness) Onboard() error

func (*DeepSeekHarness) Paths added in v0.32.12

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

func (*DeepSeekHarness) RequiresInteractiveOnboarding added in v0.32.12

func (d *DeepSeekHarness) RequiresInteractiveOnboarding() bool

func (*DeepSeekHarness) Run added in v0.32.12

func (d *DeepSeekHarness) Run(_ string, _ []LaunchModel, args []string) error

func (*DeepSeekHarness) String added in v0.32.12

func (d *DeepSeekHarness) String() string

type Droid

type Droid struct{}

Droid implements Runner and Editor for Droid integration

func (*Droid) Edit

func (d *Droid) Edit(models []LaunchModel) 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, _ []LaunchModel, args []string) error

func (*Droid) String

func (d *Droid) String() string

type Editor

type Editor interface {
	Paths() []string
	Edit(models []LaunchModel) 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, _ []LaunchModel, args []string) error

func (*Hermes) String added in v0.21.0

func (h *Hermes) String() string

type HermesDesktop added in v0.30.5

type HermesDesktop struct {
	Hermes
}

func (*HermesDesktop) Onboard added in v0.30.5

func (h *HermesDesktop) Onboard() error

func (*HermesDesktop) Run added in v0.30.5

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

func (*HermesDesktop) String added in v0.30.5

func (h *HermesDesktop) 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, _ []LaunchModel, 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 LaunchModel added in v0.30.0

type LaunchModel struct {
	Name            string
	Remote          bool
	ToolCapable     bool
	Capabilities    []modelpkg.Capability
	Thinking        *api.ModelRecommendationThinking
	ContextLength   int
	MaxOutputTokens int
	EmbeddingLength int
	Size            int64
	Details         api.ModelDetails
}

LaunchModel is the model metadata Launch passes to integration config writers after resolving selected model names through the per-run inventory.

func (LaunchModel) HasCapability added in v0.30.0

func (m LaunchModel) HasCapability(capability modelpkg.Capability) bool

func (LaunchModel) WithCloudLimits added in v0.30.0

func (m LaunchModel) WithCloudLimits() LaunchModel

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 []LaunchModel) 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 = LaunchModel

ModelInfo re-exports launcher model inventory details for callers.

type ModelItem

type ModelItem struct {
	Name            string
	Description     string
	Recommended     bool
	VRAMBytes       int64
	MaxOutputTokens int
	RequiredPlan    string
	ToolCapable     bool
	Capabilities    []modelpkg.Capability
	Thinking        *api.ModelRecommendationThinking
	Size            int64
	Details         api.ModelDetails
}

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 Muse added in v0.32.12

type Muse struct{}

Muse implements Runner and Editor for Meta's Muse Code CLI.

Muse has no flag or environment variable that can supply a model catalog, and it will not start without one: its provider fetches <origin>/muse-code/models before the first inference call, reusing only the scheme, host and port of the configured base URL. The undocumented model_catalog key in settings.json is the one way to satisfy that without standing up the endpoint, so launch has to write a settings file.

That file is also where the base URL lives, and endpoint_transport is a single global provider switch rather than an additive model list — writing it into ~/.config/muse/settings.json would repoint the user's whole muse install. So launch keeps its own config root and passes it to muse as XDG_CONFIG_HOME, leaving a Meta-backed muse and `ollama launch muse` free to coexist.

func (*Muse) Edit added in v0.32.12

func (m *Muse) Edit(models []LaunchModel) error

func (*Muse) Models added in v0.32.12

func (m *Muse) Models() []string

func (*Muse) Paths added in v0.32.12

func (m *Muse) Paths() []string

func (*Muse) Run added in v0.32.12

func (m *Muse) Run(model string, models []LaunchModel, args []string) error

func (*Muse) String added in v0.32.12

func (m *Muse) String() string

func (*Muse) Supported added in v0.32.12

func (m *Muse) Supported() error

type OMP added in v0.30.6

type OMP struct{}

OMP implements Runner for the OMP coding-agent integration.

func (*OMP) Configure added in v0.30.6

func (o *OMP) Configure(model string) error

func (*OMP) ConfigureWithModels added in v0.30.6

func (o *OMP) ConfigureWithModels(primary string, models []LaunchModel) error

func (*OMP) CurrentModel added in v0.30.6

func (o *OMP) CurrentModel() string

func (*OMP) Onboard added in v0.30.6

func (o *OMP) Onboard() error

func (*OMP) Paths added in v0.30.6

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

func (*OMP) RequiresInteractiveOnboarding added in v0.30.6

func (o *OMP) RequiresInteractiveOnboarding() bool

func (*OMP) Run added in v0.30.6

func (o *OMP) Run(model string, _ []LaunchModel, args []string) error

func (*OMP) String added in v0.30.6

func (o *OMP) String() string

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(models []LaunchModel) 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, models []LaunchModel, args []string) error

func (*OpenCode) String

func (o *OpenCode) String() string

type Openclaw

type Openclaw struct{}

func (*Openclaw) Edit

func (c *Openclaw) Edit(models []LaunchModel) 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, _ []LaunchModel, 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 []LaunchModel) error

func (*Pi) Models

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

func (*Pi) Paths

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

func (*Pi) Run

func (p *Pi) Run(_ string, _ []LaunchModel, 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, _ []LaunchModel, args []string) error

func (*Poolside) String added in v0.22.0

func (p *Poolside) String() string

type Qwen added in v0.30.1

type Qwen struct{}

func (*Qwen) Configure added in v0.30.1

func (q *Qwen) Configure(model string) error

func (*Qwen) CurrentModel added in v0.30.1

func (q *Qwen) CurrentModel() string

func (*Qwen) Onboard added in v0.30.1

func (q *Qwen) Onboard() error

func (*Qwen) Paths added in v0.30.1

func (q *Qwen) Paths() []string

func (*Qwen) RequiresInteractiveOnboarding added in v0.30.1

func (q *Qwen) RequiresInteractiveOnboarding() bool

func (*Qwen) Run added in v0.30.1

func (q *Qwen) Run(model string, _ []LaunchModel, args []string) error

func (*Qwen) String added in v0.30.1

func (q *Qwen) 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 RestoreInstallCheckSkipper added in v0.30.1

type RestoreInstallCheckSkipper interface {
	SkipRestoreInstallCheck() bool
}

RestoreInstallCheckSkipper lets cleanup-only restore flows run even when the external integration binary has already been removed.

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, models []LaunchModel, args []string) error
	String() string
}

Runner executes an integration with the selected model and its resolved launch metadata. models is ordered with the primary model first.

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 Spinner added in v0.32.0

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

Spinner is a handle on a running animated spinner. Stop halts the spinner and clears its line (it blocks until the spinner has fully stopped and is safe to call multiple times). Cancelled returns a channel that is closed if the user interrupts the spinner (e.g. with Ctrl+C); wait loops can select on it to abort early. For the non-interactive ANSI fallback the channel is never closed because Ctrl+C raises SIGINT and terminates the process directly.

func NewSpinner added in v0.32.0

func NewSpinner(stop func(), cancelled chan struct{}) *Spinner

NewSpinner builds a Spinner from a stop function and a cancellation channel. It is intended for implementations of DefaultSpinner (e.g. the bubbletea spinner in cmd/tui). stop must be safe to call multiple times; cancelled is closed by the implementation when the user interrupts the spinner, or left open when interruption is handled another way (e.g. SIGINT).

func StartSpinner added in v0.32.0

func StartSpinner(message string) *Spinner

StartSpinner begins an animated spinner displaying message and returns a *Spinner handle. It uses DefaultSpinner when available, otherwise a simple ANSI fallback that renders SpinnerFrames to stderr without requiring a TTY.

func (*Spinner) Cancelled added in v0.32.0

func (s *Spinner) Cancelled() <-chan struct{}

Cancelled returns a channel that is closed when the user interrupts the spinner. Callers may select on it to abort a blocking wait.

func (*Spinner) Stop added in v0.32.0

func (s *Spinner) Stop()

Stop halts the spinner and clears its line. It is a no-op when the spinner already stopped (for example after the user cancelled it).

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 []LaunchModel) 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, _ []LaunchModel, 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