Help us shape the future of Go! Take the 2026 Go Developer Survey

install

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package install checks whether an ACP agent's executables are available to the backend process.

Index

Constants

View Source
const (
	AntigravityACPRegistryID = executil.AntigravityACPRegistryID
	AntigravityACPProgram    = executil.AntigravityACPProgram
)
View Source
const (
	InternalProgramRemovePaths           = "quartet-internal:remove-user-paths"
	InternalProgramBuildEinoCLI          = "quartet-internal:build-eino-cli"
	InternalProgramInstallAntigravityACP = "quartet-internal:install-antigravity-acp"
)

Variables

View Source
var ErrInstallInFlight = errors.New("another agent install is already in progress")

ErrInstallInFlight is returned when another install flow is already running.

Functions

func AntigravityUninstallPaths

func AntigravityUninstallPaths(platform Platform) []string

AntigravityUninstallPaths are the home-relative files and directories the agy uninstall flow removes on platform. Credentials stay in place.

func OfficialAntigravityACPVersions

func OfficialAntigravityACPVersions(ctx context.Context) (current, latest string, err error)

OfficialAntigravityACPVersions reads the installed registry marker and the current ACP Registry release. A missing marker still returns the registry version when that fetch succeeds. Unlike the install flow this probe runs on ordinary page loads, so it stays on the backend process environment.

Types

type Checker

type Checker struct{}

Checker performs installation checks against the backend process environment.

func (Checker) Check

func (c Checker) Check(def Definition) Status

type Definition

type Definition struct {
	Bin        string
	ACPProgram string
}

Definition contains the executable parts of one ACP runtime definition. ACPProgram is the program only; its ordered arguments do not affect whether the runtime is installed.

type ExecutableStatus

type ExecutableStatus struct {
	Executable   string
	ResolvedPath string
	PathBased    bool
	Installed    bool
	Missing      bool
	Error        string
}

ExecutableStatus describes how one executable was resolved.

type InstallMethod

type InstallMethod string

InstallMethod classifies how a built-in agent's CLI is installed.

const (
	// InstallMethodNPM installs via one or more npm install -g steps.
	InstallMethodNPM InstallMethod = "npm"
	// InstallMethodScript installs via the publisher's platform installer.
	InstallMethodScript InstallMethod = "script"
	// InstallMethodProject installs from this repository's own build tooling.
	InstallMethodProject InstallMethod = "project"
	// InstallMethodManual has no automatic flow on the current platform.
	InstallMethodManual InstallMethod = "manual"
)

type InstallSpec

type InstallSpec struct {
	Method         InstallMethod
	InstallSteps   PlatformSteps
	UpgradeSteps   PlatformSteps
	UninstallSteps PlatformSteps
	// NativeUpgradeSteps is the upgrade flow of the native installer. It is
	// used instead of UpgradeSteps when the resolved executable lives under
	// NativeInstallDirs, so the upgrade command follows the same channel as
	// the version comparison.
	NativeUpgradeSteps PlatformSteps
	// VersionPackage is the npm package whose published version is the latest
	// release for an npm installation of this agent.
	VersionPackage string
	// VersionURL returns the latest executable version as a plain semver string.
	VersionURL string
	// NativeVersionURL is the plain-semver latest endpoint of the native
	// installer. When the resolved executable lives under NativeInstallDirs,
	// version checks use this endpoint instead of VersionPackage, so the
	// compared release matches the channel the upgrade command actually follows.
	NativeVersionURL string
	// NativeInstallDirs are home-relative directories or files that identify a
	// native installer layout, such as ".local/share/codebuddy".
	NativeInstallDirs []string
	// ACPRegistryID is the ACP Registry agent installed by an internal step.
	// Version checks compare its local marker with the registry release.
	ACPRegistryID string
	Instructions  string
}

InstallSpec is the preset lifecycle flow declared by a built-in agent catalog entry. Clients only select an AgentID; commands never come from the request. UninstallSteps intentionally remove executables and managed install artifacts only, leaving credentials, sessions and configuration untouched.

func (InstallSpec) AutoInstallable

func (s InstallSpec) AutoInstallable(platform Platform) bool

func (InstallSpec) AutoUninstallable

func (s InstallSpec) AutoUninstallable(platform Platform) bool

func (InstallSpec) AutoUpgradeable

func (s InstallSpec) AutoUpgradeable(platform Platform) bool

func (InstallSpec) Clone

func (s InstallSpec) Clone() InstallSpec

Clone returns a deep copy suitable for exposing catalog snapshots.

func (InstallSpec) HasNonNPMSteps

func (s InstallSpec) HasNonNPMSteps(platform Platform) bool

HasNonNPMSteps reports whether the current install flow manages anything outside npm. Such agents also get a local binary version probe.

func (InstallSpec) NPMPackages

func (s InstallSpec) NPMPackages(platform Platform) []string

NPMPackages returns package names managed by the current platform's install flow. Version suffixes such as pkg@1.2.3 and @scope/pkg@latest are stripped.

func (InstallSpec) StepDisplays

func (s InstallSpec) StepDisplays(platform Platform) []string

StepDisplays returns the current platform's install commands for the UI.

func (InstallSpec) StepsForInstall

func (s InstallSpec) StepsForInstall(platform Platform) []InstallStep

func (InstallSpec) StepsForUninstall

func (s InstallSpec) StepsForUninstall(platform Platform) []InstallStep

func (InstallSpec) StepsForUpgrade

func (s InstallSpec) StepsForUpgrade(platform Platform) []InstallStep

StepsForUpgrade returns the dedicated upgrade flow when one is declared for the platform, or the install flow for package managers/installers whose install command also upgrades.

func (InstallSpec) StepsForUpgradePath

func (s InstallSpec) StepsForUpgradePath(platform Platform, resolvedPath string) []InstallStep

StepsForUpgradePath returns the upgrade flow of the channel the resolved executable belongs to: the native updater when resolvedPath is a native install, otherwise the regular upgrade or install flow. A CLI that picks its update channel on its own may not agree with the version comparison, so callers that know the installed executable must use this variant.

func (InstallSpec) UninstallStepDisplays

func (s InstallSpec) UninstallStepDisplays(platform Platform) []string

UninstallStepDisplays returns the current platform's uninstall commands so the destructive confirmation can show exactly what Quartet will execute.

func (InstallSpec) UsesNativeRelease

func (s InstallSpec) UsesNativeRelease(resolvedPath string) bool

UsesNativeRelease reports whether resolvedPath is the native installer layout declared by NativeInstallDirs. Symlinks are resolved first, and an executable that lands inside a package-manager tree stays on the npm version channel.

func (InstallSpec) Validate

func (s InstallSpec) Validate(agentID string) error

type InstallStep

type InstallStep struct {
	Program             string
	Args                []string
	Dir                 string
	Display             string
	SkipIfMissing       bool
	IfMissingExecutable string
}

InstallStep is one preset command of an automatic lifecycle flow. Program and Args are executed verbatim (no shell word-splitting); Display is the human-readable rendering shown in the UI and results.

func CommandStep

func CommandStep(program string, args ...string) InstallStep

CommandStep builds a shell-free command step used by CLIs with native lifecycle commands.

func GoBuildInstallStep

func GoBuildInstallStep() InstallStep

GoBuildInstallStep builds the project-owned eino-cli directly. It works on Windows, macOS and Linux without depending on make or cp.

func NPMStep

func NPMStep(pkg string) InstallStep

NPMStep builds the single npm install -g step for a package.

func NPMUninstallStep

func NPMUninstallStep(pkg string) InstallStep

NPMUninstallStep builds the matching npm uninstall -g step.

func OfficialAntigravityACPStep

func OfficialAntigravityACPStep() InstallStep

OfficialAntigravityACPStep downloads the Google ACP server published in the ACP Registry and installs a launcher named agy_acp_server.

func OptionalNPMUninstallStep

func OptionalNPMUninstallStep(pkg string) InstallStep

OptionalNPMUninstallStep is used when an Agent may have been installed by either npm or a native installer. A missing npm executable means there is no npm installation to remove; other npm errors still fail with full output.

func PowerShellScriptStep

func PowerShellScriptStep(url string) InstallStep

PowerShellScriptStep downloads and executes an official Windows installer.

func PowerShellStep

func PowerShellStep(command string) InstallStep

PowerShellStep builds a controlled PowerShell command for Windows-only lifecycle operations.

func RemovePathsStep

func RemovePathsStep(paths ...string) InstallStep

RemovePathsStep builds a cross-platform executable-removal step. Every path is resolved relative to the running backend user's home directory, and the helper refuses paths outside that home directory. Directories are removed recursively only when explicitly listed by the trusted catalog.

func UnixScriptStep

func UnixScriptStep(url, shell string) InstallStep

UnixScriptStep downloads an official script completely before executing it. This preserves curl failures: a pipeline could otherwise return the shell's success status after receiving an empty script.

func (InstallStep) WhenMissing

func (s InstallStep) WhenMissing(executable string) InstallStep

WhenMissing associates an install step with the executable it provides. Ordinary installs preserve existing components; upgrades deliberately ignore this condition and re-run the publisher's upgrade commands.

type Platform

type Platform string

Platform selects the commands that are valid on the backend host.

const (
	PlatformDarwin  Platform = "darwin"
	PlatformLinux   Platform = "linux"
	PlatformWindows Platform = "windows"
)

func CurrentPlatform

func CurrentPlatform() Platform

CurrentPlatform returns the catalog platform matching runtime.GOOS.

type PlatformSteps

type PlatformSteps struct {
	Shared  []InstallStep
	Darwin  []InstallStep
	Linux   []InstallStep
	Windows []InstallStep
}

PlatformSteps declares host-specific lifecycle commands. Shared applies to every platform; a non-empty platform slice replaces Shared on that host.

func NPMInstallFlow

func NPMInstallFlow(packages ...string) PlatformSteps

func NPMOrNativeUninstallFlow

func NPMOrNativeUninstallFlow(packages []string, paths ...string) PlatformSteps

NPMOrNativeUninstallFlow removes both supported installation sources. npm reports success when a package is absent, so the native-path cleanup remains safe for script installs and npm installs alike.

func NPMUninstallFlow

func NPMUninstallFlow(packages ...string) PlatformSteps

func (PlatformSteps) For

func (s PlatformSteps) For(platform Platform) []InstallStep

type Status

type Status struct {
	Installed          bool
	MissingExecutables bool
	Bin                ExecutableStatus
	ACPProgram         ExecutableStatus
	Error              string
}

Status is the complete installation result for one ACP runtime definition.

type StepResult

type StepResult struct {
	Display    string
	Stdout     string
	Stderr     string
	ExitCode   int
	TimedOut   bool
	Error      string
	DurationMs int64
}

StepResult captures the complete outcome of one executed install step. Stdout/Stderr are kept verbatim — errors must reach the user in full.

func RunSteps

func RunSteps(ctx context.Context, steps []InstallStep, perStepTimeout time.Duration, env map[string]string) ([]StepResult, error)

RunSteps executes the given preset steps sequentially with a per-step timeout, stopping at the first failed step. It returns the results of every step that was started. ErrInstallInFlight is returned (without results) when another install is already running.

env carries the agent's own runtime environment (its configured ACP env vars): preset commands run with it appended to the backend process environment, and internal steps use it for their own outbound requests, so an agent that needs a proxy to reach its vendor can also be installed and upgraded through that proxy.

Jump to

Keyboard shortcuts

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