update

package
v0.0.0-...-1d32ed5 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package update queries GitHub Releases for daemon versions and handles downloading, checksum verification, pi extension installation, backup, and rollback of the daemon binary.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssetName

func AssetName(version string) string

AssetName returns the expected binary asset name for a given version and the current platform, e.g. "gsd-cloud-v0.2.1-darwin-arm64".

func BackupCurrent

func BackupCurrent() error

BackupCurrent copies the current binary to the prev path so it can be restored on rollback.

func ClearRollbackFlag

func ClearRollbackFlag()

ClearRollbackFlag removes the rollback-attempted flag file, allowing future rollback attempts.

func Download

func Download(release *Release, destPath string) error

Download fetches the matching asset from the release, verifies its SHA256 checksum against a signed SHA256SUMS asset, installs the bundled pi extension, and writes the binary to destPath with an atomic rename.

func EnsureExtensionHealthy

func EnsureExtensionHealthy(extDir string) error

EnsureExtensionHealthy verifies the pi extension at extDir has its dependencies installed (specifically the @anthropic-ai/claude-agent-sdk package and its platform-native binary), and runs `npm ci` to install them if missing. Idempotent and safe to call on every daemon startup.

Returns nil if the extension is already healthy or was successfully repaired. Returns an error only if repair was needed but failed — the caller should log this and continue starting (claude-p tasks still work even with a broken pi extension; only pi-routed tasks fail).

This covers users on v0.2.31 whose auto-update produced a broken extension (PR #50 fixed the updater, but daemons running v0.2.31 ran the broken updater code at update time).

func IsNewer

func IsNewer(current, latest string) bool

IsNewer returns true if latest is a higher semver than current. Both strings should be bare versions without a "v" prefix (e.g. "0.1.13").

func PiExtensionAssetName

func PiExtensionAssetName(version string) string

PiExtensionAssetName returns the platform-independent pi extension archive name bundled with daemon releases.

func Rollback

func Rollback() error

Rollback replaces the current binary with the previous version. It uses a flag file to prevent infinite rollback loops — if a rollback has already been attempted, subsequent calls return an error until ClearRollbackFlag is called.

func VersionFromTag

func VersionFromTag(tag string) string

VersionFromTag strips the "daemon/v" prefix from a release tag.

Types

type Asset

type Asset struct {
	Name               string `json:"name"`
	BrowserDownloadURL string `json:"browser_download_url"`
}

Asset represents a downloadable file attached to a release.

type Release

type Release struct {
	TagName string  `json:"tag_name"`
	Assets  []Asset `json:"assets"`
}

Release represents a GitHub release.

func FetchLatest

func FetchLatest() (*Release, error)

FetchLatest queries GitHub Releases and returns the latest daemon release.

Jump to

Keyboard shortcuts

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