modeldinstall

package
v0.32.6 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: Apache-2.0 Imports: 20 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/blueprints/modeld-setup-artifact-detection.md.

It speaks plain HTTPS to the public release prefix — no AWS SDK, no bucket listing, no credentials. The .sha256 file is the availability probe; the archive is verified against it 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 (
	// ErrNoOfficialVersion: the CLI version is not a release tag (dev build).
	ErrNoOfficialVersion = errors.New("modeld setup: CLI version is not an official release")
	// ErrNoPrebuiltArtifact: no package is published for this version/platform
	// (the .sha256 returned 404).
	ErrNoPrebuiltArtifact = errors.New("modeld setup: no prebuilt artifact for version/platform")
	// 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")
	// ErrBackendMissing: the installed modeld lacks the compiled backend the
	// selected provider needs.
	ErrBackendMissing = errors.New("modeld setup: installed modeld lacks required compiled backend")
	// ErrPublicAccess: the artifact exists but is not publicly readable (HTTP 403),
	// which is a release-side configuration problem, not a "no package" answer.
	ErrPublicAccess = errors.New("modeld setup: prebuilt artifact is not publicly accessible")
)

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 IsOfficialVersion

func IsOfficialVersion(v string) bool

IsOfficialVersion reports whether v is an official release tag the default download path may use. Dev builds ("", "dev", "main", "unknown", commit shas) are not official: setup must fall back to source-build instead of silently downloading an arbitrary package.

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".

Types

type Options

type Options struct {
	BaseURL    string       // default DefaultBaseURL
	Version    string       // default version.Get(); must be an official tag
	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
	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 existing install, otherwise it checks the public release surface, downloads, verifies, safely extracts, validates with `modeld version --json`, and atomically installs into ~/.contenox/modeld/<version>/<platform>/. 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