Versions in this module Expand all Collapse all v0 v0.3.0 Nov 11, 2026 Changes in this version + const DefaultBreakerCooldown + const DefaultMaxArchiveBytes + const DefaultMinFreeBytes + const DefaultPollInterval + const DefaultZeroWorkThreshold + const DefaultZeroWorkWindow + const SchemaVersion + const SourceGitHubDownloads + const SourceManifest + var ErrBadSignature = errors.New("runner manifest signature invalid") + var ErrBelowFloor = errors.New("selected runner is below the manifest floor") + var ErrBreakGlassCooldown = errors.New("runner break-glass fetch already attempted within the breaker cooldown") + var ErrChecksumMismatch = errors.New("runner archive checksum mismatch") + var ErrDisabled = errors.New("runner auto-upgrade disabled (runner.self_heal.auto_upgrade = false)") + var ErrDowngradeRefused = errors.New("runner manifest would downgrade without rollback=true") + var ErrEncryptedSecretKey = errors.New(...) + var ErrFetch = errors.New("runner archive fetch failed") + var ErrInsufficientDisk = errors.New("insufficient free disk for runner archive") + var ErrKeyMismatch = errors.New("runner manifest signed by a different key") + var ErrManifestFetch = errors.New("runner manifest fetch failed") + var ErrManifestInvalid = errors.New("runner manifest invalid") + var ErrManifestReplayed = errors.New("runner manifest not newer than last applied") + var ErrNoCandidate = errors.New("no runner candidate for platform") + var ErrNoPublicKey = errors.New("no runner-manifest public key embedded") + var ErrNoRunnerTree = errors.New("not a runner tree") + var ErrNotInStore = errors.New("runner archive not in store") + var ErrSourcesDisagree = errors.New("runner sources disagree") + var ErrTooLarge = errors.New("runner archive exceeds size cap") + var ErrWrongChannel = errors.New("runner manifest is for a different channel") + var ListenerDepsFile = filepath.Join("bin", "Runner.Listener.deps.json") + func ArchiveExt(platform string) string + func ArchiveFilename(platform, version string) string + func GenerateKeypair(rnd io.Reader) (*PublicKey, *SecretKey, error) + func HashReader(r io.Reader) (string, error) + func MatchesDeprecation(line string) bool + func ParseListenerDepsVersion(data []byte) (string, error) + func PlatformKey(goos, goarch string) string + func PrepareOverrideTree(dir string, image TreeInfo) error + func Sign(priv ed25519.PrivateKey, keyID [8]byte, data []byte, trustedComment string, ...) string + type BootReport struct + BelowFloor bool + Cache []VerifyResult + EmbeddedMatchesManifest bool + EmbeddedSHA256 string + EmbeddedTampered bool + Image *ImageDecision + ImageErr error + ImageInfo TreeInfo + Selected Selection + type BreakerState int + const BreakerClosed + const BreakerHalfOpen + const BreakerOpen + func (b BreakerState) String() string + type Candidate struct + Filename string + Platform string + SHA256 string + Source string + URL string + Version string + type Channel string + const ChannelCanary + const ChannelStable + type Controller struct + func NewController(cfg ControllerConfig) (*Controller, error) + func (c *Controller) Kick(reason string) + func (c *Controller) OnDegraded(platform string, streak int, reason string) + func (c *Controller) Reconcile(ctx context.Context, trigger string) + func (c *Controller) Report() (BootReport, *Manifest, error) + func (c *Controller) Run(ctx context.Context) + type ControllerConfig struct + AutoUpgrade bool + BreakGlassCooldown time.Duration + Channel Channel + Detector *Detector + Fetcher *Fetcher + GitHub Source + Image string + ImageOverride bool + Log *slog.Logger + Manifest ManifestLoader + Now func() time.Time + Override *ImageOverride + Platform string + PollInterval time.Duration + ProbeImage func(ctx context.Context, image string) (TreeInfo, error) + Selector *Selector + Store *Store + SweepProbes func(ctx context.Context) int + type Detector struct + Cooldown time.Duration + Log *slog.Logger + Now func() time.Time + OnDegraded func(platform string, streak int, reason string) + Threshold int + Window time.Duration + func (d *Detector) Allow(platform string) bool + func (d *Detector) Exited(runnerName string, killedByUs bool) Verdict + func (d *Detector) JobStarted(runnerName string) + func (d *Detector) Registered(runnerName, platform string) + func (d *Detector) Reset(platform string) + func (d *Detector) State(platform string) (BreakerState, int) + func (d *Detector) Tracked() int + type DiagHit struct + File string + Line string + func ScanDiag(runnerDir string) (DiagHit, bool, error) + type Fetcher struct + Client *http.Client + DiskCheck func(path string) (diskspace.Usage, error) + Log *slog.Logger + MaxBytes int64 + MinFreeBytes uint64 + Store *Store + func (f *Fetcher) Fetch(ctx context.Context, url string, meta Sidecar) (string, error) + type GitHubSource struct + Client *gh.Client + Owner string + Repo string + func (g *GitHubSource) Resolve(ctx context.Context, platform string) (Candidate, error) + type HTTPManifestLoader struct + Client *http.Client + Key *PublicKey + URL string + func (l *HTTPManifestLoader) Load(ctx context.Context) (*Manifest, error) + type ImageDecision struct + AvailableVersion string + ImageBelowFloor bool + ImageVersion string + NeedFetch bool + Override bool + Reason string + func DecideImageOverride(image TreeInfo, available Selection, m *Manifest, breakerOpen bool) ImageDecision + type ImageOverride struct + func NewImageOverride(log *slog.Logger) *ImageOverride + func (o *ImageOverride) Clear(reason string) + func (o *ImageOverride) Engage(dir, version, image, reason string) + func (o *ImageOverride) OfficialRunnerOverride(image string) (string, bool) + func (o *ImageOverride) Status() (active bool, dir, version, image, reason string, since time.Time) + type Manifest struct + Channel Channel + Floor string + Platforms map[string]PlatformArtifact + PublishedAt time.Time + Rollback bool + SchemaVersion int + Version string + func ParseManifest(data []byte) (*Manifest, error) + func (m *Manifest) Artifact(platform string) (PlatformArtifact, error) + func (m *Manifest) BelowFloor(v []int) bool + func (m *Manifest) FloorParts() []int + func (m *Manifest) Validate() error + func (m *Manifest) VersionParts() []int + type ManifestLoader interface + Load func(ctx context.Context) (*Manifest, error) + type ManifestSource struct + Manifest *Manifest + func (m ManifestSource) Resolve(_ context.Context, platform string) (Candidate, error) + type PlatformArtifact struct + SHA256 string + URL string + type Pointer struct + AppliedAt time.Time + Dir string + Ext string + SHA256 string + Version string + type PublicKey struct + Key ed25519.PublicKey + KeyID [8]byte + func EmbeddedPublicKey() (*PublicKey, error) + func ParsePublicKey(text string) (*PublicKey, error) + func (pk *PublicKey) EncodeFile(untrustedComment string) string + func (pk *PublicKey) String() string + func (pk *PublicKey) Verify(data []byte, sigText string) error + func (pk *PublicKey) VerifyAndParse(data []byte, sigText string) (*Manifest, error) + type Result struct + BreakGlass bool + Dir string + Reason string + SHA256 string + Swapped bool + Version string + type SecretKey struct + Key ed25519.PrivateKey + KeyID [8]byte + func ParseSecretKey(text string) (*SecretKey, error) + func (sk *SecretKey) Encode(untrustedComment string) string + func (sk *SecretKey) Public() *PublicKey + func (sk *SecretKey) Sign(data []byte, trustedComment string) string + type Selection struct + BreakGlass bool + Dir string + Parts []int + Source string + Version string + type Selector struct + BreakerOpen func() bool + Embedded *runner.Manager + HashEmbedded func() (string, error) + Log *slog.Logger + ProbeImage func() (TreeInfo, error) + Store *Store + func (s *Selector) BootVerify(m *Manifest, platform string) (BootReport, error) + func (s *Selector) Dir() string + func (s *Selector) MountedRunnerDir() (string, bool) + func (s *Selector) Select() Selection + type Sidecar struct + FetchedAt time.Time + Platform string + SHA256 string + Size int64 + Sources []string + URL string + Version string + func (sc Sidecar) HasSource(source string) bool + func (sc Sidecar) IsBreakGlass() bool + type Signature struct + GlobalSig []byte + KeyID [8]byte + Prehashed bool + Sig []byte + TrustedComment string + func ParseSignature(text string) (*Signature, error) + type Source interface + Resolve func(ctx context.Context, platform string) (Candidate, error) + type StaticManifestLoader struct + Manifest *Manifest + func (s StaticManifestLoader) Load(context.Context) (*Manifest, error) + type Store struct + func NewStore(dataDir string, log *slog.Logger) *Store + func (s *Store) AddSidecarSource(sha, source string) error + func (s *Store) Current() (Pointer, bool, error) + func (s *Store) Extract(sha, version string) (string, error) + func (s *Store) Has(sha, ext string) bool + func (s *Store) Init() error + func (s *Store) LastApplied() (time.Time, error) + func (s *Store) Previous() (Pointer, bool, error) + func (s *Store) Prune() error + func (s *Store) Put(r io.Reader, meta Sidecar, maxBytes int64) (string, error) + func (s *Store) Rollback() error + func (s *Store) Root() string + func (s *Store) SetLastApplied(t time.Time) error + func (s *Store) Sidecar(sha string) (Sidecar, error) + func (s *Store) Swap(sha, version string) error + func (s *Store) Verify() []VerifyResult + type TreeInfo struct + Dir string + GID int + Parts []int + UID int + Version string + func ProbeRunnerTree(dir string) (TreeInfo, error) + type Upgrader struct + AutoUpgrade bool + BreakGlassCooldown time.Duration + BreakGlassOpen func() bool + Channel Channel + Fetcher *Fetcher + GitHub Source + Log *slog.Logger + Manifest ManifestLoader + Now func() time.Time + Platform string + Store *Store + func (u *Upgrader) Run(ctx context.Context) (Result, error) + type Verdict struct + Lifetime time.Duration + Opened bool + Platform string + Reason string + Runner string + Streak int + ZeroWork bool + type VerifyResult struct + Err error + OK bool + Pointer Pointer