toolchain

package
v0.1.61 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 24 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package toolchain owns harness compatibility and managed CLI installations. Clients consume its decisions; none of the installation commands or compatibility rules live in a mobile app.

Index

Constants

View Source
const CatalogURL = "https://raw.githubusercontent.com/oblien/mindwire/main/daemon/internal/toolchain/catalog.json"
View Source
const PolicyVersion = 1

Variables

This section is empty.

Functions

func CommandContext

func CommandContext(ctx context.Context, binary string, args ...string) *exec.Cmd

func Environment

func Environment() []string

func Executable

func Executable(binary string) string

Executable resolves the same selection for native exec, help/schema discovery, auth and turns. A broken selected install must fail visibly; it never falls through to another CLI.

func InspectInstallation

func InspectInstallation(ctx context.Context, spec Spec) (string, error)

InspectInstallation checks the executable selected for native execution without launching the harness, authenticating, or contacting a package/catalog server. A damaged managed selection remains visible for repair instead of falling back to a different installation. An interrupted shell lookup is not proof of absence.

func ParseVersion

func ParseVersion(output string) string

ParseVersion understands both plain versions and native banners ("codex-cli 0.155.0").

func Root

func Root() string

func Shell

func Shell(script string) string

Shell restores the launching account's PATH after login startup. Linux's /etc/profile can replace it entirely; macOS path_helper can reorder it. Keep native tool discovery consistent with CommandContext, retain additional login paths, then put explicit managed selections ahead of both.

func WithInstallProgress

func WithInstallProgress(ctx context.Context, report func(stage string)) context.Context

WithInstallProgress observes installer activity without exposing package-manager logs or credentials. The setup tracker owns this context, so all clients see the same live stage.

Types

type Archive added in v0.1.60

type Archive struct {
	URL              string            `json:"url"`
	SHA256           string            `json:"sha256,omitempty"`
	Executable       string            `json:"executable"`
	Executables      []string          `json:"executables,omitempty"`
	EnvironmentPaths map[string]string `json:"environmentPaths,omitempty"`
}

Archive describes a vendor's complete distribution, including companion executables. Paths are relative to the archive root. No install scripts run.

type Catalog

type Catalog struct {
	SchemaVersion int                `json:"schemaVersion"`
	Revision      int                `json:"revision"`
	Harnesses     map[string]Harness `json:"harnesses"`
}

func Bundled

func Bundled() Catalog

func DecodeCatalog

func DecodeCatalog(data []byte) (Catalog, error)

func (Catalog) Evaluate

func (c Catalog) Evaluate(id, daemonVersion, installed string) Software

type DaemonRange

type DaemonRange struct {
	Min          string `json:"min"`
	MaxExclusive string `json:"maxExclusive,omitempty"`
}

type Exclusion

type Exclusion struct {
	Min          string        `json:"min"`
	MaxExclusive string        `json:"maxExclusive"`
	Daemon       []DaemonRange `json:"daemon"`
	Reason       string        `json:"reason"`
}

type Harness

type Harness struct {
	Releases []Release `json:"releases"`
	// Explicit exclusions apply to installed versions too. Missing entries mean untested,
	// not incompatible, and never cause automatic replacement of a user's existing CLI.
	Excluded []Exclusion `json:"excluded,omitempty"`
}

type Manager

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

func New

func New(daemonVersion string) *Manager

func (*Manager) Catalog

func (m *Manager) Catalog() Catalog

func (*Manager) Check

func (m *Manager) Check(ctx context.Context, spec Spec) (string, error)

Check is a setup probe, not an update. An installed, untested external CLI stays installed. A known incompatible version is rejected before it can start another turn.

func (*Manager) CheckAdmission

func (m *Manager) CheckAdmission(ctx context.Context, spec Spec) error

Admission is an explicit action, unlike passive UI reads. Probe the actual binary so a user-driven external upgrade or a damaged managed install cannot reuse stale readiness. Compatibility metadata remains cached: sending a message never waits on the catalog host.

func (*Manager) Install

func (m *Manager) Install(ctx context.Context, spec Spec, update bool) (string, error)

Install is invoked inside the supervisor's idle-harness gate and shared package-manager lock. It stages an exact approved version, verifies it, then atomically selects it. Previous versions and external installations are never removed or changed.

func (*Manager) RefreshSoftware

func (m *Manager) RefreshSoftware(ctx context.Context, spec Spec, force bool) Software

func (*Manager) Software

func (m *Manager) Software(ctx context.Context, spec Spec) Software

func (*Manager) Version

func (m *Manager) Version(ctx context.Context, spec Spec) string

type Release

type Release struct {
	Version string        `json:"version"`
	Daemon  []DaemonRange `json:"daemon"`
}

type Software

type Software struct {
	PolicyVersion         int      `json:"policyVersion"`
	InstalledVersion      string   `json:"installedVersion"`
	RecommendedVersion    string   `json:"recommendedVersion,omitempty"`
	LatestVersion         string   `json:"latestVersion,omitempty"` // latest approved catalog entry, not npm latest
	Compatibility         string   `json:"compatibility"`           // supported | untested | incompatible | unavailable | not_installed
	Managed               bool     `json:"managed"`
	UpdateAvailable       bool     `json:"updateAvailable"`
	RepairAvailable       bool     `json:"repairAvailable,omitempty"`
	RequiresDaemonUpdate  bool     `json:"requiresDaemonUpdate"`
	RequiredDaemonVersion string   `json:"requiredDaemonVersion,omitempty"`
	Message               string   `json:"message,omitempty"`
	CatalogRevision       int      `json:"catalogRevision"`
	CatalogSource         string   `json:"catalogSource"` // bundled | cached | remote
	CatalogStale          bool     `json:"catalogStale"`
	MissingDependencies   []string `json:"missingDependencies,omitempty"`
}

Software is the authoritative update/readiness decision exposed through HTTP and both SDKs.

type Spec

type Spec struct {
	ID          string
	Name        string
	Binary      string
	Package     string
	VersionArgs []string
	Environment map[string]string
	// Native distributions are immutable, compiled sources; the remote catalog
	// can select only versions whose installer ships with this daemon.
	Archives       map[string]map[string]Archive
	VersionPattern string
}

Spec is compiled into an adapter. The remote catalog can approve versions, but cannot change a package, execute shell code, or redirect an install to a different registry.

Jump to

Keyboard shortcuts

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