modeldinstall

package
v0.35.4 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package modeldinstall discovers, downloads, verifies, installs, and validates a prebuilt modeld package for the current machine. It is the implementation behind the `contenox setup` check for the local llama/openvino providers: see docs/development/blueprints/modeld/version-decoupling.md.

It speaks plain HTTPS to the public release prefix — no AWS SDK, no bucket listing, no credentials. The public index is the availability source of truth; selected archives are verified against their checksum before extraction, and the extracted binary is validated with `modeld version --json` before it is moved into place.

Index

Constants

View Source
const DefaultBaseURL = "https://contenox-modeld-artifacts-573643652148.s3.amazonaws.com/modeld"

DefaultBaseURL is the public modeld release prefix compiled into the released CLI. Only the final-package prefix is public; the native dependency prefix (modeld-deps/) stays private. Tests inject an alternate via Options.BaseURL.

Variables

View Source
var (
	// ErrNoIndex: the public release index is missing, inaccessible, or not
	// readable by anonymous setup clients.
	ErrNoIndex = errors.New("modeld setup: no public release index")
	// ErrNoCompatibleArtifact: the index has no stable build for this platform,
	// provider backend, and transport protocol window.
	ErrNoCompatibleArtifact = errors.New("modeld setup: no compatible prebuilt artifact")
	// ErrArtifactUnavailable: the index selected an artifact whose archive or
	// checksum object could not be fetched.
	ErrArtifactUnavailable = errors.New("modeld setup: selected artifact is unavailable")
	// ErrChecksumMismatch: the archive did not match its published checksum.
	ErrChecksumMismatch = errors.New("modeld setup: checksum mismatch")
	// ErrUnsupportedPlatform: this GOOS has no published package format.
	ErrUnsupportedPlatform = errors.New("modeld setup: unsupported platform")
	// ErrProtocolMismatch: the installed modeld speaks a transport protocol this
	// runtime build does not support.
	ErrProtocolMismatch = errors.New("modeld setup: incompatible modeld transport protocol")
	// ErrBackendMissing: the installed modeld lacks the compiled backend the
	// selected provider needs.
	ErrBackendMissing = errors.New("modeld setup: installed modeld lacks required compiled backend")
)

Internal errors callers branch on with errors.Is. All except ErrChecksumMismatch are "soft" — setup should fall back to source-build instructions. A checksum mismatch is a hard failure: the download must not be treated as merely unavailable.

Functions

func CurrentLauncherPath added in v0.32.7

func CurrentLauncherPath(dataRoot, goos string) (string, error)

CurrentLauncherPath resolves the current pointer to a runnable launcher.

func CurrentPointerPath added in v0.32.7

func CurrentPointerPath(dataRoot string) string

CurrentPointerPath is the cross-platform pointer to the active managed install. The file contains an absolute install directory; symlinks are also accepted for operator-managed installs.

func LauncherName

func LauncherName(goos string) string

LauncherName is the entry-point script inside the package for goos. The launcher (not modeld.bin/modeld.exe) is what callers run: it sets the native library search path before exec'ing the real binary.

func ManagedInstallDir

func ManagedInstallDir(dataRoot, version, goos, goarch string) string

ManagedInstallDir is the per-user install directory for a modeld release: <dataRoot>/modeld/<version>/<platform>. It is the canonical layout shared by the installer and the binary-discovery probe.

func ManagedLauncherPath

func ManagedLauncherPath(dataRoot, version, goos, goarch string) string

ManagedLauncherPath is the runnable launcher inside ManagedInstallDir.

func Platform

func Platform(goos, goarch string) string

Platform is the release platform string, e.g. "linux-amd64".

func ProbeBinary added in v0.32.7

func ProbeBinary(ctx context.Context, launcher string) (versionInfo, error)

ProbeBinary is the package-level form used by modeldprobe for managed-install discovery.

func WriteCurrentPointer added in v0.32.7

func WriteCurrentPointer(dataRoot, installDir string) error

WriteCurrentPointer atomically points current at installDir.

Types

type InstalledBinary added in v0.32.7

type InstalledBinary struct {
	LauncherPath string
	InstallDir   string
	Version      string
	Platform     string
	Protocol     int
	Backends     []string
}

InstalledBinary describes a compatible managed modeld installation found on disk.

func FindCompatibleInstall added in v0.32.7

func FindCompatibleInstall(ctx context.Context, dataRoot, goos, goarch, provider string) (InstalledBinary, error)

FindCompatibleInstall finds a managed install compatible with this runtime's transport protocol and, when provider is non-empty, with that backend compiled in. It checks the current pointer first, then scans all version-keyed installs.

type Options

type Options struct {
	BaseURL       string       // default DefaultBaseURL
	ClientVersion string       // default runtime version.Get(); used only for User-Agent
	DataRoot      string       // install root parent; default ~/.contenox
	GOOS          string       // default runtime.GOOS
	GOARCH        string       // default runtime.GOARCH
	HTTPClient    *http.Client // default a no-overall-timeout client
	Progress      io.Writer    // download progress sink; default io.Discard
}

Options configures EnsureInstalled. The zero value is valid: every field defaults to the released behavior. Non-default fields exist for tests and dev builds; end users never set them.

type Result

type Result struct {
	LauncherPath     string   // absolute path to the runnable modeld launcher
	Version          string   // version the installed binary reports
	Protocol         int      // transport protocol the installed binary reports
	Platform         string   // e.g. "linux-amd64"
	Backends         []string // compiled backends the binary reports
	AlreadyInstalled bool     // true when a compatible binary was already present
}

Result describes a successful install (or a compatible pre-existing install).

func EnsureInstalled

func EnsureInstalled(ctx context.Context, provider string, opts Options) (Result, error)

EnsureInstalled makes a compatible modeld available for the selected provider ("llama" or "openvino"): it reuses a compatible managed install, otherwise it resolves the newest compatible stable build from the public index, downloads, verifies, safely extracts, validates with `modeld version --json`, atomically installs into ~/.contenox/modeld/<modeld-version>/<platform>/, and writes the current pointer. Errors are typed (see errors.go) so the caller can fall back to source-build for soft failures and surface a checksum mismatch as a hard failure.

Jump to

Keyboard shortcuts

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