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 ¶
- func AssetName(version string) string
- func BackupCurrent() error
- func ClearRollbackFlag()
- func Download(release *Release, destPath string) error
- func EnsureExtensionHealthy(extDir string) error
- func IsNewer(current, latest string) bool
- func PiExtensionAssetName(version string) string
- func Rollback() error
- func VersionFromTag(tag string) string
- type Asset
- type Release
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssetName ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
VersionFromTag strips the "daemon/v" prefix from a release tag.