state

package
v0.175.0-rc.521 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 28 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package state is beekeeper's shared memory on the machine: the supervisor and its relay, grants, holds, registered agents, notes, timers and session records, one JSON document read and rewritten under an exclusive file lock, plus an append-only event log of every change and of every build run. It outlives any session: a restarted supervisor or its successor reads what the previous one knew instead of rebuilding it from prose.

Index

Constants

View Source
const (
	DeliveryOriginObserved = "observed"
	DeliveryOriginStarted  = "started"
	DeliveryUnknown        = "unknown"
	DeliveryImplementing   = "implementing"
	DeliveryCI             = "ci"
	DeliveryReviewQueued   = "review-queued"
	DeliveryReviewing      = "reviewing"
	DeliveryFixing         = "fixing"
	DeliveryMerging        = "merging"
	DeliveryReleasing      = "releasing"
	DeliveryDone           = "done"
	DeliveryDropped        = "dropped"
	DeliveryBlocked        = "blocked"
	DeliveryStalled        = "stalled"
	OutcomeMerged          = "merged"
	OutcomeNoChange        = "no-change"
	OutcomeBlocked         = "blocked"
	OutcomeParked          = "parked"
	OutcomeStalled         = "stalled"
	DeliveryStepVerb       = "delivery.step"
	DeliveryNoRelease      = "no_release"
	DeliveryReleaseFailed  = "ci_failed"
)

Delivery steps are observations, never start or capacity admission rules.

View Source
const (
	NoteDecision = "decision"
	NoteLogin    = "login"
)

The kinds of a note.

View Source
const (
	RepeatDaily    = "daily"
	RepeatWeekdays = "weekdays"
	RepeatWeekly   = "weekly"
)

The values of Timer.Repeat.

View Source
const (
	Waiting  = "waiting"
	Running  = "running"
	Settling = "settling"
)

The phases of a Merge.

View Source
const ModeBypass = "bypassPermissions"

ModeBypass is Claude Code's bypassPermissions mode.

View Source
const VerbStaleWriter = "state.stale-writer"

VerbStaleWriter is the event of an older release's first refused save after a newer one wrote the state.

Variables

View Source
var ErrRecoveryWriterFenced = errors.New("state writes fenced after binary recovery; use the installed restored release or a later compatible signed release")

ErrRecoveryWriterFenced identifies a refused state write after rollback.

Repeats are the values of Timer.Repeat.

Functions

func Changes

func Changes(ctx context.Context, paths ...string) (<-chan struct{}, func())

Changes subscribes before a caller reads its snapshot, avoiding a lost wake between the read and sleep. Paths name atomic files or lease directories. Events coalesce; callers must still keep a deadline for time-based work and external sources. A missing directory or exhausted OS watch limit falls back to that deadline. No state or event contents are read here.

func DeliveryOutcomes

func DeliveryOutcomes(events []Event, since, until time.Time) map[string]int

DeliveryOutcomes counts one ending per delivery attempt in the window. Parked is a worker handoff, not a released issue. Legacy unexplained ends remain visible as dropped rather than being given invented evidence.

func Due added in v0.9.0

func Due(due, fired, now time.Time) bool

Due reports whether a watch has yet to report something due by now.

func RemoveReport

func RemoveReport(store Store, m ReportMessage) error

RemoveReport is called only after a durable receipt. A replay after a crash finds that receipt and removes the file without repeating its effects.

func RunnerSessionActive

func RunnerSessionActive(stateDir, hostSession, sessionID, name string) bool

RunnerSessionActive reports whether a harness runner unit in stateDir still belongs to a live, unparked session on the roster (or the active guide). When stateDir is empty or state.json does not exist or cannot be decoded, it returns true so standalone runner invocations and unit tests without a state file keep running.

func SetCommand

func SetCommand(c string)

SetCommand names this process in the state lock's holder record, its lock trace and stale-writer reports: the resolved subcommand path and the names of the flags given, never an argument or a flag's value, which carry a note's text, a start's brief, a configuration path or a session's name. Unset or empty, the command is guessed from the process's arguments.

func Weekend added in v0.91.0

func Weekend(t time.Time) bool

Weekend reports whether t falls on a Saturday or a Sunday.

func WriterFenced

func WriterFenced(s Store) bool

WriterFenced reports whether the recovery fence currently refuses state writes from s.

Types

type Agent

type Agent struct {
	Party
	// Execution references a coordinating roster entry's remote process.
	// Its reachability and lifecycle are stored on the matching Start.
	Execution  *execution.Ref `json:"execution,omitempty"`
	Registered time.Time      `json:"registered"`
	// ActivityAt is the latest explicit roster activity (note, wake or resume).
	ActivityAt       time.Time       `json:"activityAt,omitzero"`
	Task             string          `json:"task,omitempty"`
	AssignedAt       time.Time       `json:"assignedAt,omitzero"`
	IdleSince        time.Time       `json:"idleSince,omitzero"`
	LastTask         string          `json:"lastTask,omitempty"`
	ReportedProblems *WorkerProblems `json:"reportedProblems,omitempty"`
	// Keep marks an idle entry kept on purpose (agents keep): the doctor
	// never removes it for staleness nor archives its desktop session.
	Keep *Keep `json:"keep,omitempty"`
	// Park marks an agent that keeps its task but waits on a note, a pull
	// request or a person without holding a busy slot (agents park).
	Park *Park `json:"park,omitempty"`
	// Done says the agent reported its work finished (agents idle --done):
	// the doctor takes it off the roster and archives its desktop session
	// once its CLI is idle.
	Done bool `json:"done,omitempty"`
	// DesktopTurn is when the agent asked for a desktop turn (agents
	// desktop, agents start --desktop): the import or reopen after its
	// headless turn shows it in the desktop without waiting for the
	// desktop's window to lose the focus. Zero: none asked, or the desktop
	// was given it.
	DesktopTurn time.Time `json:"desktopTurn,omitzero"`
	// Import is the wait of the reopen that shows the agent in the desktop,
	// while it waits; nil: none waits.
	Import *ImportWait `json:"import,omitempty"`
	// ResumedWait is when the reopen after a headless turn that ended on a
	// unfinished task resumed the agent headless, and ResumedOn the wait
	// it named; zero: never. Continuations are bounded per assignment.
	ContinuationCount     int       `json:"continuationCount,omitempty"`
	ContinuationTask      time.Time `json:"continuationTask,omitzero"`
	ContinuationExhausted time.Time `json:"continuationExhausted,omitzero"`
	ResumedWait           time.Time `json:"resumedWait,omitzero"`
	ResumedOn             string    `json:"resumedOn,omitempty"`
	// Undelivered is why agents start delivered no turn of the agent's
	// task, which waits until agents wake delivers one; empty: delivered.
	Undelivered string `json:"undelivered,omitempty"`
	// Conversation is klaus-gateway's conversation the agent holds with its
	// person, a Slack thread; empty: none is open.
	Conversation string `json:"conversation,omitempty"`
	// GH is the gh the agent's shell resolves outside the sandbox, read at
	// its registration and each session start; GHAt when. Empty: not read.
	GH   string    `json:"gh,omitempty"`
	GHAt time.Time `json:"ghAt,omitzero"`
	// Harness is the agent harness the session runs on ("" or "claude",
	// "omp", "agy"); Model is the model it runs on.
	Harness string `json:"harness,omitempty"`
	Model   string `json:"model,omitempty"`
	// contains filtered or unexported fields
}

Agent is an empty session registered as spare capacity.

func (Agent) MarshalJSON added in v0.73.0

func (v Agent) MarshalJSON() ([]byte, error)

func (*Agent) UnmarshalJSON added in v0.73.0

func (v *Agent) UnmarshalJSON(b []byte) error

type AlertOwner added in v0.68.0

type AlertOwner struct {
	// Cluster and Namespace are optional exact matchers used when taking ownership.
	Cluster   string `json:"cluster,omitempty"`
	Namespace string `json:"namespace,omitempty"`
	// Alert is the firing key (installation/fingerprint@start); legacy
	// records use fingerprint@start with the installation recorded in Name.
	Alert string    `json:"alert"`
	Name  string    `json:"name"`
	By    Party     `json:"by"`
	At    time.Time `json:"at"`
	// Ended is when a watch saw the owner's session gone.
	Ended time.Time `json:"ended,omitzero"`
	// contains filtered or unexported fields
}

AlertOwner is the session that owns a firing alert (alerts own), until the session ends or the alert resolves. A party without a session id is a person, who owns it until it resolves.

func (AlertOwner) MarshalJSON added in v0.73.0

func (v AlertOwner) MarshalJSON() ([]byte, error)

func (AlertOwner) Person added in v0.68.0

func (o AlertOwner) Person() bool

Person reports whether the owner is a person rather than a session.

func (*AlertOwner) UnmarshalJSON added in v0.73.0

func (v *AlertOwner) UnmarshalJSON(b []byte) error

type App added in v0.120.0

type App struct {
	// Name is the App's name as its consent page titles it ("Authorize
	// <name>" on GitHub).
	Name string `json:"name"`
	// ClientID is the OAuth client id the consent URL carries, "" for a
	// record without a consent.
	ClientID string `json:"clientID"`
	// Callbacks are the hosts the consent page's redirect may go to: the
	// callback URLs' hosts of the App's declaration; none for a record
	// without a consent.
	Callbacks []string `json:"callbacks"`
	// Org is the organisation whose settings pages the record covers: the
	// owner of the declaring repository.
	Org string `json:"org,omitempty"`
	// Permission is the one change of the App's permissions the person
	// asked for, "<scope>: <level>" ("Members: Read-only"); "" for a record
	// without one.
	Permission string `json:"permission,omitempty"`
	// CallbackURL is the one callback URL the person asked to add to the
	// App's settings, on a callback host its manifest declares; "" for a
	// record without one.
	CallbackURL string `json:"callbackURL,omitempty"`
	// Delete says the person asked for the App's deletion: the hook answers
	// its Advanced page's Delete GitHub App and the confirmation.
	Delete bool `json:"delete,omitempty"`
	// Google says the App is a Google OAuth client of the person's: the
	// hook answers its consent on Google's sign-in, by the callback hosts
	// the person named.
	Google bool `json:"google,omitempty"`
	// Account is the Google account a Google OAuth client's sign-in
	// chooses: the hook answers no other account on Google's chooser; of a
	// third party's OAuth client, the account the consent is given as.
	Account string `json:"account,omitempty"`
	// GitLab is the host of the self-hosted GitLab whose OAuth application
	// of the person's this is: the hook answers its authorize page there,
	// by the callback hosts the person named; "" for any other record.
	GitLab string `json:"gitlab,omitempty"`
	// OAuth is the sign-in host of a third party's OAuth client the
	// person consents to as their Account there: the hook answers that
	// client's consent page on that host; "" for any other record.
	OAuth string `json:"oauth,omitempty"`
	// Slack is the workspace host (<workspace>.slack.com) of a Slack app of
	// the person's whose install consent the hook answers there, SlackApp
	// its app id and WebhookChannel the channel its webhook posts to, which
	// the install keeps (lower case, without "#"; "" for an app without
	// one); Slack is "" for any other record.
	Slack          string `json:"slack,omitempty"`
	SlackApp       string `json:"slackApp,omitempty"`
	WebhookChannel string `json:"webhookChannel,omitempty"`
	// Declared is where the organisation declares the App:
	// <repo>@<commit>:<manifest path>, the local manifest of an App on the
	// person's own account or of a deletion, or the person's own
	// declaration of a GitLab application's client id.
	Declared string `json:"declared"`
	// Word is the person's words that asked for the grant.
	Word string    `json:"word"`
	By   Party     `json:"by"`
	At   time.Time `json:"at"`
	// contains filtered or unexported fields
}

App is an App the person owns and asked a consent, or one change of its permissions, for, on their word: the hook answers the consent click on its page, and the navigation to its permissions page and the clicks of that change, itself (guard.Click, guard.Navigation).

func (App) MarshalJSON added in v0.120.0

func (v App) MarshalJSON() ([]byte, error)

func (*App) UnmarshalJSON added in v0.120.0

func (v *App) UnmarshalJSON(b []byte) error

type AppCreated added in v0.133.0

type AppCreated struct {
	Name string `json:"name"`
	Slug string `json:"slug"`
	ID   int64  `json:"id"`
	// Org is the organisation the App was created for.
	Org      string `json:"org"`
	Declared string `json:"declared"`
	// Stored is where its credentials went (a vault item, a SOPS file), ""
	// for nowhere.
	Stored string    `json:"stored,omitempty"`
	By     Party     `json:"by"`
	At     time.Time `json:"at"`
	// contains filtered or unexported fields
}

AppCreated is an App `beekeeper app create` created: beekeeper's ledger of its own Apps. The hook answers its Install click, and the deletion of one whose credentials were stored nowhere.

func (AppCreated) MarshalJSON added in v0.133.0

func (v AppCreated) MarshalJSON() ([]byte, error)

func (*AppCreated) UnmarshalJSON added in v0.133.0

func (v *AppCreated) UnmarshalJSON(b []byte) error

type AppRun added in v0.133.0

type AppRun struct {
	Name string `json:"name"`
	// Org is the account the App is created for: an organisation, or a
	// personal account (app create --manifest --user).
	Org string `json:"org"`
	// Declared is where the App is declared: its manifest in the
	// organisation's repository, or the local manifest file.
	Declared string `json:"declared"`
	// Listener is the run's loopback address, host:port.
	Listener string    `json:"listener"`
	PID      int       `json:"pid"`
	By       Party     `json:"by"`
	At       time.Time `json:"at"`
	// contains filtered or unexported fields
}

AppRun is a running `beekeeper app create`: the App it creates, the loopback listener its manifest page and GitHub's redirect go to, and its process. The hook answers GitHub's Create click on the manifest page and the App's Install click while the listener answers.

func (AppRun) MarshalJSON added in v0.133.0

func (v AppRun) MarshalJSON() ([]byte, error)

func (*AppRun) UnmarshalJSON added in v0.133.0

func (v *AppRun) UnmarshalJSON(b []byte) error

type Archive added in v0.63.0

type Archive struct {
	// Party is the agent that left the roster.
	Party
	// Host is its desktop session.
	Host  string    `json:"host"`
	Since time.Time `json:"since"`
	// Why says why it stayed the last time.
	Why string `json:"why"`
	// Tries counts the stewards' turns asked for it, Tried the last.
	Tries int       `json:"tries,omitempty"`
	Tried time.Time `json:"tried,omitzero"`
	// Looked is the last doctor's run that found no steward to ask.
	Looked time.Time `json:"looked,omitzero"`
	// Warmed is when the desktop was last made to warm the session's own
	// CLI to archive itself: the watch leaves that CLI running a while.
	Warmed time.Time `json:"warmed,omitzero"`
	// contains filtered or unexported fields
}

Archive is the desktop session of an agent that left the roster while its archive could not be done (its CLI ran a turn, no steward recorded it): the doctor asks for it again until the desktop records it.

func (Archive) MarshalJSON added in v0.73.0

func (v Archive) MarshalJSON() ([]byte, error)

func (*Archive) UnmarshalJSON added in v0.73.0

func (v *Archive) UnmarshalJSON(b []byte) error

type BranchRelease

type BranchRelease struct {
	Repo      string    `json:"repo"`
	Base      string    `json:"base"`
	Auto      bool      `json:"auto,omitempty"`
	Plugins   bool      `json:"plugins,omitempty"`
	ReleasePR bool      `json:"releasePR,omitempty"`
	At        time.Time `json:"at"`
	// contains filtered or unexported fields
}

BranchRelease is how a repository's base branch releases, as the gate read it (github.ReadBranchRelease) at At: the merges queued into the branch reuse it while their repository has places in the gate.

func (BranchRelease) MarshalJSON

func (v BranchRelease) MarshalJSON() ([]byte, error)

func (*BranchRelease) UnmarshalJSON

func (v *BranchRelease) UnmarshalJSON(b []byte) error

type Budget added in v0.6.0

type Budget struct {
	Identity   string             `json:"identity,omitempty"`
	Login      string             `json:"login,omitempty"`
	ETag       string             `json:"etag,omitempty"`
	Identities map[string]Budget  `json:"identities,omitempty"`
	Windows    map[string]GraphQL `json:"windows,omitempty"`
	Remaining  int                `json:"remaining"`
	Limit      int                `json:"limit"`
	Reset      time.Time          `json:"reset"`
	At         time.Time          `json:"at"`
	// GraphQL is the last reading of the GraphQL limit; nil before the
	// first.
	GraphQL *GraphQL `json:"graphql,omitempty"`
	// contains filtered or unexported fields
}

Budget is one reading of the GitHub core budget.

func (Budget) MarshalJSON added in v0.73.0

func (v Budget) MarshalJSON() ([]byte, error)

func (*Budget) UnmarshalJSON added in v0.73.0

func (v *Budget) UnmarshalJSON(b []byte) error

type CLI added in v0.14.1

type CLI struct {
	Supervisor Party     `json:"supervisor"`
	Since      time.Time `json:"since"`
	PID        int       `json:"pid,omitempty"`
	Gone       time.Time `json:"gone,omitzero"`
	// contains filtered or unexported fields
}

CLI is what beekeeper saw of the supervisor's CLI process in the term Supervisor and Since name: the PID it ran as and since when it has been gone. A CLI back under the same session within supervisor.restartGrace of Gone is a restart; the grant rule holds whether it comes back or not.

func (CLI) MarshalJSON added in v0.73.0

func (v CLI) MarshalJSON() ([]byte, error)

func (*CLI) Of added in v0.14.1

func (c *CLI) Of(sup *Supervisor) bool

Of reports whether the record is about sup's current term.

func (*CLI) UnmarshalJSON added in v0.73.0

func (v *CLI) UnmarshalJSON(b []byte) error

type Claim added in v0.171.0

type Claim struct {
	Issue   string    `json:"issue"`
	Comment int64     `json:"comment"`
	Session Party     `json:"session"`
	At      time.Time `json:"at"`
	Seen    time.Time `json:"seen"`
	// contains filtered or unexported fields
}

Claim is a record published on its issue as a marker comment other desks read: the comment, the session it names, since when and when this desk last refreshed it.

func (Claim) MarshalJSON added in v0.171.0

func (v Claim) MarshalJSON() ([]byte, error)

func (*Claim) UnmarshalJSON added in v0.171.0

func (v *Claim) UnmarshalJSON(b []byte) error

type Decline added in v0.91.1

type Decline struct {
	Host string    `json:"host"`
	At   time.Time `json:"at"`
	Why  string    `json:"why"`
	// contains filtered or unexported fields
}

Decline is a steward's answer to an archive request that archived nothing: its desktop session, when, and the first line of its reply.

func (Decline) MarshalJSON added in v0.91.1

func (v Decline) MarshalJSON() ([]byte, error)

func (*Decline) UnmarshalJSON added in v0.91.1

func (v *Decline) UnmarshalJSON(b []byte) error

type Delivery

type Delivery struct {
	Abandoned bool      `json:"abandoned,omitempty"`
	Outcome   string    `json:"outcome,omitempty"`
	Evidence  string    `json:"evidence,omitempty"`
	OutcomeAt time.Time `json:"outcomeAt,omitzero"`
	// Origin distinguishes passive PR observations from work started by the desk
	// or advanced by a new commit after observation. Empty is legacy/issue work.
	Origin         string            `json:"origin,omitempty"`
	OutsideDesk    bool              `json:"outsideDesk,omitempty"`
	Heads          map[string]string `json:"heads,omitempty"`
	DroppedHeads   map[string]string `json:"droppedHeads,omitempty"`
	DropReason     string            `json:"dropReason,omitempty"`
	DropBy         Party             `json:"dropBy,omitempty"`
	DropAt         time.Time         `json:"dropAt,omitempty"`
	Ref            string            `json:"ref"`
	Pulls          []string          `json:"pulls"`
	Step           string            `json:"step"`
	Since          time.Time         `json:"since"`
	Started        time.Time         `json:"started"`
	Agent          string            `json:"agent,omitempty"`
	Waits          string            `json:"waits,omitempty"`
	Release        string            `json:"release,omitempty"`
	ReleaseChecked time.Time         `json:"releaseChecked,omitempty"`
	Verdict        string            `json:"verdict,omitempty"`
}

Delivery is one issue (or an issue-less desk pull request) from start to release. Ref and Pulls use the same canonical references as serve records.

func (Delivery) Active

func (d Delivery) Active() bool

Active includes unknown observations: an unreadable pull never frees its place.

type DeliveryHealth

type DeliveryHealth struct {
	StallReports  map[string]DeliveryStallReport `json:"stallReports,omitempty"`
	At            time.Time                      `json:"at,omitempty"`
	Episodes      map[string]string              `json:"episodes,omitempty"`
	FullSignature string                         `json:"fullSignature,omitempty"`
	FullSince     time.Time                      `json:"fullSince,omitempty"`
	FullRaised    bool                           `json:"fullRaised,omitempty"`
}

DeliveryHealth is committed with alert events, shared by both watches.

type DeliveryStallReport

type DeliveryStallReport struct {
	Episodes []string `json:"episodes"`
	Detail   string   `json:"detail"`
}

DeliveryStallReport retains the identity needed to recover one batched alert.

type DeskReview added in v0.171.0

type DeskReview struct {
	ID         string            `json:"id"`
	Ref        string            `json:"ref"`
	Head       string            `json:"head"`
	Round      int               `json:"round"`
	Worker     Party             `json:"worker"`
	Reviewer   Party             `json:"reviewer"`
	AssignedAt time.Time         `json:"assignedAt"`
	Result     *DeskReviewResult `json:"result,omitempty"`
	// Released is when the round gave up its head because its reviewer was
	// gone without a result (done or off the roster, no live process, no
	// running execution); zero: it holds the head. A released round stays for its
	// history and its round number but never refuses a new reviewer.
	Released time.Time `json:"released,omitzero"`
}

DeskReview binds an independent round to the concrete sessions the coordinating component started. A display name alone is never a credential.

type DeskReviewResult added in v0.171.0

type DeskReviewResult struct {
	ID           string    `json:"id"`
	URL          string    `json:"url"`
	Author       string    `json:"author"`
	Verdict      string    `json:"verdict"`
	Head         string    `json:"head,omitempty"`
	BodyDigest   string    `json:"bodyDigest"`
	ReportDigest string    `json:"reportDigest"`
	ReportedAt   time.Time `json:"reportedAt"`
	By           Party     `json:"by"`
}

DeskReviewResult authenticates a specific public review through the assigned reviewer's durable completion report, not through their shared GitHub login.

type Emergency

type Emergency struct {
	By     Party     `json:"by"`
	Reason string    `json:"reason"`
	Until  time.Time `json:"until"`
}

Emergency is a guide-role grant; By records its issuer, not its owner. Only the authenticated current guide may act; expiry is checked every time.

type Event

type Event struct {
	At     time.Time `json:"at"`
	By     Party     `json:"by"`
	Verb   string    `json:"verb"`
	Detail string    `json:"detail"`
	// Subject is the issue or pull request the event concerns, owner/repo#n,
	// on the events the sink may dispatch (config.SinkVerbs); empty on the
	// rest.
	Subject string `json:"subject,omitempty"`
	// NoteTeam identifies the note owner independently of the event actor.
	NoteTeam string `json:"noteTeam,omitempty"`
	// NoteSnapshot retains the complete note for file-backed reopen after closure.
	NoteSnapshot *Note `json:"noteSnapshot,omitempty"`
}

Event is one line of events.jsonl. At is written in UTC (RFC 3339 with a trailing Z), so a reader can compare it as a string.

func DeliveryEvents

func DeliveryEvents(prev, next []Delivery, by Party) []Event

DeliveryEvents compares against the last committed observation, not a pass's earlier snapshot. Store.Update commits these events with the new reading.

func FollowLast

func FollowLast(s Store, name string, n int, keep func(Event) bool) ([]Event, error)

FollowLast returns the last n events keep accepts, oldest first, as Events(n, keep) does. A file store remembers under name how far it read and keeps only those n, so a reader that asks again every pass, for an event that may never have been logged, reads only what was appended since instead of the whole history again.

func FollowSnapshot

func FollowSnapshot(s Store, name, revision string, keep func(Event) bool) ([]Event, error)

FollowSnapshot opts a reader into a durable projection. revision must change whenever its predicate changes (including a time window). Other stores retain the ordinary Follow contract. Checkpoints are disposable; audit segments are the source of truth and remain available to Events/log --since.

func FollowSnapshotContext

func FollowSnapshotContext(ctx context.Context, s Store, name, revision string, keep func(Event) bool) ([]Event, error)

FollowSnapshotContext is FollowSnapshot with caller cancellation during cold or incremental history scans.

type EventOutbox

type EventOutbox struct {
	Offset int64  `json:"offset"`
	Data   []byte `json:"data"`
}

EventOutbox is an append committed atomically with state.json. Offset and Data make replay idempotent even after a partial write or an unclean exit.

type EventSegmentation

type EventSegmentation struct {
	Enabled bool            `json:"enabled"`
	Readers map[string]bool `json:"readers"`
}

EventSegmentation is enabled only after the signed recovery target has demonstrated support for segmented history. Legacy rollback loops cannot read archives, so the first protected hop must keep its original log layout.

type ExecutionMessage added in v0.171.0

type ExecutionMessage struct {
	TextDigest string             `json:"textDigest,omitempty"`
	Resolution string             `json:"resolution,omitempty"`
	Envelope   execution.Envelope `json:"envelope"`
	Key        string             `json:"key"`
	Stage      string             `json:"stage"`
	Resume     *Park              `json:"resume,omitempty"`
	// contains filtered or unexported fields
}

func (ExecutionMessage) MarshalJSON added in v0.171.0

func (v ExecutionMessage) MarshalJSON() ([]byte, error)

func (*ExecutionMessage) UnmarshalJSON added in v0.171.0

func (v *ExecutionMessage) UnmarshalJSON(b []byte) error

type ExecutionPendingPublication

type ExecutionPendingPublication struct {
	At           time.Time `json:"at"`
	Head         string    `json:"head"`
	BundleDigest string    `json:"bundleDigest"`
	Title        string    `json:"title,omitempty"`
	Body         string    `json:"body,omitempty"`
	LastError    string    `json:"lastError,omitempty"`
}

ExecutionPendingPublication is an unpushed publication request whose bundle transfer is stored on the coordinator.

type ExecutionPublication added in v0.172.2

type ExecutionPublication struct {
	At     time.Time `json:"at"`
	Branch string    `json:"branch"`
	Head   string    `json:"head"`
	URL    string    `json:"url,omitempty"`
}

ExecutionPublication is one publication of an SSH execution's branch.

type ExecutionRecord added in v0.171.0

type ExecutionRecord struct {
	// Endpoint pins the approved journal route at reservation time. Nil marks
	// older records whose original route cannot be reconstructed.
	Endpoint *execution.Endpoint `json:"endpoint,omitempty"`

	Lease           *execution.LeaseGrant              `json:"lease,omitempty"`
	Completed       bool                               `json:"completed,omitempty"`
	Settled         bool                               `json:"settled,omitempty"`
	Messages        []ExecutionMessage                 `json:"messages,omitempty"`
	Handle          execution.Handle                   `json:"handle"`
	Request         execution.StartRequest             `json:"request"`
	RequestDigest   string                             `json:"requestDigest"`
	Selector        string                             `json:"selector"`
	Phase           string                             `json:"phase"`
	Provider        string                             `json:"provider"`
	Bucket          string                             `json:"bucket,omitempty"`
	ReservedAt      time.Time                          `json:"reservedAt"`
	LastActive      time.Time                          `json:"lastActive,omitzero"`
	Observation     execution.Observation              `json:"observation"`
	StopRequest     *execution.StopRequest             `json:"stopRequest,omitempty"`
	ControlSequence uint64                             `json:"controlSequence,omitempty"`
	ControlResults  map[string]execution.ControlResult `json:"controlResults,omitempty"`
	// HostJournalMissing records confirmed journal absence AND an inactive
	// owned unit. It settles a lost execution without fabricating a stop ack.
	HostJournalMissing bool `json:"hostJournalMissing,omitempty"`
	// HostJournalUnconfirmed records confirmed journal absence on a pre-inventory
	// host whose unit state can be confirmed only after the host upgrades.
	HostJournalUnconfirmed bool `json:"hostJournalUnconfirmed,omitempty"`
	// Published is the execution's last publication (agents publish): its
	// owned branch, the head it pushed and its pull request. Handle.Commit
	// stays the commit the execution started from.
	Published *ExecutionPublication `json:"published,omitempty"`
	// PendingPublication is the last publication request whose bundle
	// reached the coordinator before publication failed. Cleared once
	// published.
	PendingPublication *ExecutionPendingPublication `json:"pendingPublication,omitempty"`
	// RecoveredTransfer is the last publication bundle digest the
	// coordinator attempted to recover automatically.
	RecoveredTransfer string `json:"recoveredTransfer,omitempty"`
	// StartUnsent says no start request of this reservation has left the
	// coordinator yet, so the host holds no journal of it. A reservation
	// recorded before this field existed reads false: maybe sent.
	StartUnsent bool `json:"startUnsent,omitempty"`
	// StartSentAt is when the coordinator last sent its start request.
	StartSentAt time.Time `json:"startSentAt,omitzero"`
	// TranscriptCollected says the ended execution's stream log is
	// persisted to the transcript store to EOF; until then its host
	// reconciliation keeps collecting it, also after Settled.
	TranscriptCollected bool `json:"transcriptCollected,omitempty"`
	// TranscriptError is why the last pull of the execution's transcript
	// failed, empty once one succeeded.
	TranscriptError string `json:"transcriptError,omitempty"`
	// ReleasedAt is when a reservation the host never acknowledged was
	// given up, ReleaseReason why: it holds no host or desk slot since.
	ReleasedAt    time.Time `json:"releasedAt,omitzero"`
	ReleaseReason string    `json:"releaseReason,omitempty"`
	// Retirement is the execution's one retirement, nil until a terminal path
	// (final report, stop, failed start, crash) enters it.
	Retirement *ExecutionRetirement `json:"retirement,omitempty"`
	// contains filtered or unexported fields
}

ExecutionRecord is the coordinator's durable admission/activation journal. Request includes the private component callback credential and must never be returned by an operator status or logs command.

func (ExecutionRecord) MarshalJSON added in v0.171.0

func (v ExecutionRecord) MarshalJSON() ([]byte, error)

func (*ExecutionRecord) Released

func (r *ExecutionRecord) Released() bool

Released says the reservation was given up before its host acknowledged a start: no process of it can exist.

func (*ExecutionRecord) Terminal added in v0.171.0

func (r *ExecutionRecord) Terminal() bool

func (*ExecutionRecord) UnmarshalJSON added in v0.171.0

func (v *ExecutionRecord) UnmarshalJSON(b []byte) error

type ExecutionRetirement

type ExecutionRetirement struct {
	ID          string    `json:"id"`
	Trigger     string    `json:"trigger"`
	RequestedAt time.Time `json:"requestedAt"`
	// RevokedAt is when the worker's GitHub authorization was confirmed
	// revoked, zero until then; RevokeError is why the last attempt failed.
	RevokedAt   time.Time `json:"revokedAt,omitzero"`
	RevokeError string    `json:"revokeError,omitempty"`
	// RetiredAt is when the host confirmed Stage, zero until then; HostError is
	// why the last attempt failed.
	RetiredAt   time.Time           `json:"retiredAt,omitzero"`
	Stage       string              `json:"stage,omitempty"`
	HostError   string              `json:"hostError,omitempty"`
	Recovery    *execution.Recovery `json:"recovery,omitempty"`
	RetainUntil time.Time           `json:"retainUntil,omitzero"`
	Attempts    int                 `json:"attempts,omitempty"`
	NextAttempt time.Time           `json:"nextAttempt,omitzero"`
}

ExecutionRetirement is the coordinator's resumable retirement of an execution: its GitHub authorization and its host resources end independently, each confirmed only by its own success, and a failed step keeps its error and its next attempt so that neither outage can stand in for the other.

func (*ExecutionRetirement) Finished

func (r *ExecutionRetirement) Finished() bool

Finished says both ends of the retirement are confirmed.

type Failed added in v0.123.0

type Failed struct {
	// Head identifies the tested commit; empty on records from older gates.
	Head   string    `json:"head,omitempty"`
	Repo   string    `json:"repo"`
	PR     int       `json:"pr"`
	Lane   string    `json:"lane"`
	By     Party     `json:"by"`
	At     time.Time `json:"at"`
	Exit   int       `json:"exit"`
	Reason string    `json:"reason,omitempty"`
	// contains filtered or unexported fields
}

Failed is a gated merge's run that merged nothing: when, devctl's exit code and its reason (the verdict and the failed checks), for whoever it ran for.

func (Failed) Key added in v0.123.0

func (f Failed) Key() string

Key is the failed merge's owner/repo#n, or owner/repo promote.

func (Failed) MarshalJSON added in v0.123.0

func (v Failed) MarshalJSON() ([]byte, error)

func (*Failed) UnmarshalJSON added in v0.123.0

func (v *Failed) UnmarshalJSON(b []byte) error

type FileStore added in v0.74.0

type FileStore struct {
	// contains filtered or unexported fields
}

FileStore is the Store in a directory of the machine: state.json under a flock, events.jsonl beside it.

func Open

func Open(dir string) (*FileStore, error)

Open returns the file store in dir, creating the directory, saving as this binary's version.

func OpenVersion added in v0.108.0

func OpenVersion(dir, version string) (*FileStore, error)

OpenVersion is Open saving as version: a release stamps the state and is refused by a newer one's, a build without a release version does neither.

func (*FileStore) CompleteRollback

func (s *FileStore) CompleteRollback(version, failed string) error

CompleteRollback automatically releases the broad recovery ceiling after the journal confirms restoration. The failed version stays quarantined, including in older processes that only understand Maximum and Failed. No state, writer stamp, execution generation or lease is reset.

func (*FileStore) Dir added in v0.74.0

func (s *FileStore) Dir() string

Dir is the store's directory.

func (*FileStore) Events added in v0.74.0

func (s *FileStore) Events(n int, keep func(Event) bool) ([]Event, error)

Events returns the last n events keep accepts, oldest first (all when n <= 0, every event when keep is nil).

func (*FileStore) EventsContext

func (s *FileStore) EventsContext(ctx context.Context, n int, keep func(Event) bool) ([]Event, error)

EventsContext abandons history replay when its caller stops. Partial history is never returned as a successful read.

func (*FileStore) Exclusive added in v0.145.2

func (s *FileStore) Exclusive(fn func() error) error

Exclusive runs fn under the exclusive state lock, writing nothing: what must not happen while a process holds the lock, freezing a session's processes for one.

func (*FileStore) Follow added in v0.107.0

func (s *FileStore) Follow(name string, keep func(Event) bool) ([]Event, error)

Follow returns every event keep accepts, oldest first. It remembers under name how far it read and what it kept, and reads only the lines appended since: a watch that follows the log every poll parses each line once. A log that was replaced or shrank is read again from its start.

func (*FileStore) FollowContext

func (s *FileStore) FollowContext(ctx context.Context, name string, keep func(Event) bool) ([]Event, error)

func (*FileStore) FollowSnapshot

func (s *FileStore) FollowSnapshot(name, revision string, keep func(Event) bool) ([]Event, error)

A hard-link anchor supplies a portable, restart-safe os.SameFile identity. It prevents a replaced/truncated log from being mistaken for the old cursor. No checkpoint can authorize a state write or alter recovery's writer fence.

func (*FileStore) FollowSnapshotContext

func (s *FileStore) FollowSnapshotContext(ctx context.Context, name, revision string, keep func(Event) bool) ([]Event, error)

func (*FileStore) Log added in v0.74.0

func (s *FileStore) Log(events ...Event) error

Log appends events that change no state, a build's run for one, under the state lock. It waits at most logWait for the lock, so that a caller on every build's path never queues behind a slow update.

func (*FileStore) Peek added in v0.74.0

func (s *FileStore) Peek() (*State, error)

Peek returns the current state without taking the lock, for a caller that must never wait on it (a permission hook): a write replaces the file in one rename, so the document read is always a whole one.

func (*FileStore) Quiesce

func (s *FileStore) Quiesce(wait time.Duration) (release func(), err error)

Quiesce holds this process's writes for an exit that does not wait for them: the state lock when it frees within wait, so no append or update is under way, and always the commit lock, so no commit is half written. A state lock still busy after wait is no failure: an update holding it has not begun its commit, and its commit then waits behind the commit lock. release frees both; an exit without it frees them too.

func (*FileStore) Read added in v0.74.0

func (s *FileStore) Read() (*State, error)

Read opens the current state under a shared lock, then decodes or clones the cached snapshot after releasing it. Large read-only views must not hold up writers while allocating and decoding the retained history. Pending outbox recovery still re-reads the latest state under the exclusive lock before changing anything.

func (*FileStore) ReadFile added in v0.74.0

func (s *FileStore) ReadFile(name string, v any) (found bool, err error)

ReadFile decodes a JSON side file of the store (the last snapshot); found is false when it does not exist yet.

func (*FileStore) Record added in v0.104.0

func (s *FileStore) Record(events ...Event) error

Record appends events that change no state and must not be lost, a secret call's audit entry for one, under the state lock, waiting for it as an update does: a busy lock delays the entry, and a lock busy past lockWait fails the call instead of dropping it.

func (*FileStore) RecordWithin added in v0.145.3

func (s *FileStore) RecordWithin(wait time.Duration, events ...Event) error

RecordWithin is Record waiting at most wait for the lock.

func (*FileStore) RecoverVersion

func (s *FileStore) RecoverVersion(version, failed string, restore func() error) error

RecoverVersion executes a binary recovery while holding the state lock. It validates the live state with the recovery version's fence, without lowering the writer stamp or restoring a snapshot. Future schemas need an explicit lossless migration before this method can permit an older writer. failed is the release being rolled back: the fence stops its processes, not a later release. A prerelease neither stamps the state nor is judged by the stamp, so a prerelease candidate cannot have advanced the writer past its recovery.

func (*FileStore) RenewExecutionLease

func (s *FileStore) RenewExecutionLease(ctx context.Context, ref execution.Ref, issue func(*State) (*execution.LeaseGrant, error)) (*execution.LeaseGrant, error)

RenewExecutionLease changes only the lease of an authenticated execution. The issuer sees the authoritative, locked state, including global stop and generation revocation. Ordinary writers merge concurrent renewals at commit. An interrupted event outbox is preserved verbatim, never flushed here.

func (*FileStore) ResumeRecoveredWrites

func (s *FileStore) ResumeRecoveredWrites(version string) error

ResumeRecoveredWrites removes the recovery ceiling after an operator has explicitly completed probation of a compatible installed release. It changes no work, approval, note, writer stamp, or event history.

func (*FileStore) StopRequested

func (s *FileStore) StopRequested() (bool, error)

StopRequested reads only stop intent from the atomic snapshot. Frequent cancellation probes must not allocate every retained record and note.

func (*FileStore) Update added in v0.74.0

func (s *FileStore) Update(fn func(*State) ([]Event, error)) error

Update runs fn on the state under the exclusive lock and writes the result back with the events fn returns under the same lock. When fn fails nothing is written. Newer release state refuses the callback with StaleWriterError. Event-log open failures leave state unchanged. Once state commits, its durable outbox retains the events until their append is synced. Reads and later writes recover an interrupted append before using the state.

func (*FileStore) UpdateWithin added in v0.145.2

func (s *FileStore) UpdateWithin(wait time.Duration, fn func(*State) ([]Event, error)) error

UpdateWithin is Update waiting at most wait for the lock.

func (*FileStore) WriteFile added in v0.74.0

func (s *FileStore) WriteFile(name string, v any) error

WriteFile atomically replaces a JSON side file of the store.

type Grant

type Grant struct {
	// Reserved is the start of the claim window promised by a queue wake.
	Reserved time.Time `json:"reserved,omitempty"`
	Resource string    `json:"resource"`
	To       Party     `json:"to"`
	By       Party     `json:"by"`
	At       time.Time `json:"at"`
	// UpgradeUnblock is why the supervisor granted a claim that the
	// resource's upgrade hold admits: the work that unblocks the upgrade.
	UpgradeUnblock string `json:"upgradeUnblock,omitempty"`
	// contains filtered or unexported fields
}

Grant is the supervisor's word that a session may claim a resource.

func (Grant) MarshalJSON added in v0.73.0

func (v Grant) MarshalJSON() ([]byte, error)

func (*Grant) UnmarshalJSON added in v0.73.0

func (v *Grant) UnmarshalJSON(b []byte) error

type GraphQL added in v0.97.1

type GraphQL struct {
	BlockedBy []string `json:"blockedBy,omitempty"`
	Identity  string   `json:"identity,omitempty"`
	Login     string   `json:"login,omitempty"`
	Err       string   `json:"error,omitempty"`
	Remaining int      `json:"remaining"`
	Limit     int      `json:"limit"`
	// Reset is when the window the reading counts resets and a refusal
	// ends; zero when GitHub named no time.
	Reset time.Time `json:"reset,omitzero"`
	// Refused is GitHub's words while it refused GraphQL calls.
	Refused   string    `json:"refused,omitempty"`
	Secondary bool      `json:"secondary,omitempty"`
	At        time.Time `json:"at"`
	// contains filtered or unexported fields
}

GraphQL is one reading of the GitHub GraphQL limit.

func (*GraphQL) Blocks added in v0.97.1

func (g *GraphQL) Blocks(now time.Time) bool

Blocks says the reading's refusal still holds at now: one without a reset holds until a reading says otherwise.

func (GraphQL) MarshalJSON added in v0.97.1

func (v GraphQL) MarshalJSON() ([]byte, error)

func (*GraphQL) UnmarshalJSON added in v0.97.1

func (v *GraphQL) UnmarshalJSON(b []byte) error

type GuideFinding

type GuideFinding struct {
	Issue string `json:"issue,omitempty"`
	Count int    `json:"count"`
}

GuideFinding retains a report fingerprint and its disposition across guide relays.

type GuideWork

type GuideWork struct {
	ID     int       `json:"id"`
	Kind   string    `json:"kind"`
	Text   string    `json:"text"`
	By     Party     `json:"by"`
	Due    time.Time `json:"due"`
	Source string    `json:"source,omitempty"`
	// contains filtered or unexported fields
}

GuideWork is work owned by the guide role across session relays. Kind distinguishes tasks, standing goals, and temporary changes to restore.

func (GuideWork) MarshalJSON

func (v GuideWork) MarshalJSON() ([]byte, error)

func (*GuideWork) UnmarshalJSON

func (v *GuideWork) UnmarshalJSON(b []byte) error

type Handover

type Handover struct {
	Party
	PID int `json:"pid"`
}

Handover protects the outgoing session while the owning CLI moves its work. PID lets readers ignore a mark left by a crashed handover.

type Hold

type Hold struct {
	// Incident pauses supervisor starts in Target except the named repair.
	// It stays set through the repair release and proof, until lifted.
	Incident bool      `json:"incident,omitempty"`
	Target   string    `json:"target"`
	Reason   string    `json:"reason"`
	By       Party     `json:"by"`
	At       time.Time `json:"at"`
	Until    time.Time `json:"until,omitzero"`
	// Except is what a merge hold lets through: a repository (the tool's own
	// during a tool-release window) or one pull request, owner/repo#n.
	Except string `json:"except,omitempty"`
	// ExceptSession is the session (by name) a merge hold lets through: its
	// merges and promotes run, a line's promoter promoting while the hold
	// keeps every other session's merges off the line.
	ExceptSession string `json:"exceptSession,omitempty"`
	// Tool is the binary whose release window this hold is, ToolFrom the
	// version it reported when the window opened, ToolPR the pull request
	// that opened it (0 for a promotion), ToolMerged whether it merged and
	// ToolRelease the release it produced. The window closes once its pull
	// request merged (or its promotion runs) and the tool reports another
	// version than ToolFrom (ToolRelease once known), also while the merge's
	// devctl still waits for the release workflow, or once its merge ended
	// with nothing merged, no release warranted or only a release candidate.
	// ToolUpdated is when beekeeper last ran the tool's update for the
	// window, ToolFailed that update's failure ("" when it ran clean: the
	// release's binary did not verify, or no newer one is published yet),
	// ToolChecked when a gate or the watch last claimed the read of the
	// window's state (the tool's version, its pull request), which they share.
	Tool        string    `json:"tool,omitempty"`
	ToolFrom    string    `json:"toolFrom,omitempty"`
	ToolPR      int       `json:"toolPR,omitempty"`
	ToolMerged  bool      `json:"toolMerged,omitempty"`
	ToolRelease string    `json:"toolRelease,omitempty"`
	ToolUpdated time.Time `json:"toolUpdated,omitzero"`
	ToolFailed  string    `json:"toolFailed,omitempty"`
	ToolChecked time.Time `json:"toolChecked,omitzero"`
	// LiftWhen is a shell command on this machine; the watch lifts the hold
	// once it exits 0.
	LiftWhen string `json:"liftWhen,omitempty"`
	// UpgradeTo is the target release of the upgrade an automatic upgrade
	// hold stands for.
	UpgradeTo string `json:"upgradeTo,omitempty"`
	// LiftedBy and LiftedAt record the lift of an upgrade hold: the watch
	// keeps a lifted hold, inactive, for as long as its upgrade runs.
	LiftedBy *Party    `json:"liftedBy,omitempty"`
	LiftedAt time.Time `json:"liftedAt,omitzero"`
	// contains filtered or unexported fields
}

Hold stops work on a target (a repository's merges, "github" for every GitHub call) until it is lifted or Until passes.

func (Hold) Active

func (h Hold) Active(now time.Time) bool

Active reports whether the hold still applies at now.

func (Hold) Admits added in v0.157.0

func (h Hold) Admits(session string) bool

Admits reports whether the hold lets the session named session through.

func (Hold) AwaitsOwnRelease added in v0.148.0

func (h Hold) AwaitsOwnRelease() bool

AwaitsOwnRelease reports whether the hold is a repository's whose lift probe waits on that repository's release or tag: only the repository's own promote cuts it, so the hold lets that promote through.

func (Hold) Excepts added in v0.8.0

func (h Hold) Excepts(repo string, pr int) bool

Excepts reports whether the hold lets a merge of repo#pr through.

func (Hold) Expired added in v0.25.10

func (h Hold) Expired(now time.Time) bool

Expired reports whether the hold's time has passed at now.

func (Hold) MarshalJSON added in v0.73.0

func (v Hold) MarshalJSON() ([]byte, error)

func (*Hold) UnmarshalJSON added in v0.73.0

func (v *Hold) UnmarshalJSON(b []byte) error

type HostPin

type HostPin struct {
	Selector     string            `json:"selector"`
	Identity     execution.HostID  `json:"identity"`
	Version      string            `json:"version,omitempty"`
	PolicyDigest string            `json:"policyDigest,omitempty"`
	Tools        map[string]string `json:"tools,omitempty"`
	PinnedAt     time.Time         `json:"pinnedAt,omitzero"`
	// Configured is the digest the agents.hosts entry named when the host
	// was last pinned, empty for none. An entry that names another digest
	// than this and PolicyDigest is a changed host policy: the host is due
	// for an update, as for a new release.
	Configured string `json:"configured,omitempty"`
	// Tried is the last update attempt, which paces the retries.
	Tried time.Time `json:"tried,omitzero"`
	// UpdateError is a release lookup failure before contacting the host.
	// It delays update retries but does not block starts on a compatible host.
	UpdateError   string `json:"updateError,omitempty"`
	UpdateVersion string `json:"updateVersion,omitempty"`
	// Held is why the host takes no start: its update to HeldVersion
	// failed, since HeldAt. The next successful update lifts it.
	Held        string    `json:"held,omitempty"`
	HeldAt      time.Time `json:"heldAt,omitzero"`
	HeldVersion string    `json:"heldVersion,omitempty"`
	// Reported says the supervisor loop handed the hold on as its finding.
	Reported bool `json:"reported,omitempty"`
	// Behind is the first coordinator release the host did not follow
	// while it drained or waited, since BehindSince; BehindReported says
	// the supervisor loop handed on, once, that it stayed behind for more
	// than that release or past its bound. The next successful update
	// clears them.
	Behind         string    `json:"behind,omitempty"`
	BehindSince    time.Time `json:"behindSince,omitzero"`
	BehindReported bool      `json:"behindReported,omitempty"`
	// contains filtered or unexported fields
}

HostPin is an execution host's release and the policy digest beekeeper recorded when it last updated the host, in place of a hand-kept agents.hosts digest, and the hold of a host whose update failed.

func (HostPin) MarshalJSON

func (v HostPin) MarshalJSON() ([]byte, error)

func (*HostPin) UnmarshalJSON

func (v *HostPin) UnmarshalJSON(b []byte) error

type HostPlacement

type HostPlacement struct {
	At         time.Time `json:"at"`
	Repository string    `json:"repository"`
	Reason     string    `json:"reason"`
	// contains filtered or unexported fields
}

HostPlacement is the last dated placement decision for a configured host.

func (HostPlacement) MarshalJSON

func (v HostPlacement) MarshalJSON() ([]byte, error)

func (*HostPlacement) UnmarshalJSON

func (v *HostPlacement) UnmarshalJSON(b []byte) error

type ImportWait added in v0.71.0

type ImportWait struct {
	On    string    `json:"on"`
	Since time.Time `json:"since"`
	Until time.Time `json:"until"`
	// contains filtered or unexported fields
}

ImportWait is a reopen waiting to show a session in the desktop: what holds it, since when, and its bound.

func (ImportWait) MarshalJSON added in v0.73.0

func (v ImportWait) MarshalJSON() ([]byte, error)

func (*ImportWait) Pending added in v0.71.0

func (w *ImportWait) Pending(now time.Time) bool

Pending reports whether the wait still runs at now: a reopen that died leaves its record behind, past its bound.

func (*ImportWait) UnmarshalJSON added in v0.73.0

func (v *ImportWait) UnmarshalJSON(b []byte) error

type ItemHold added in v0.150.0

type ItemHold struct {
	Ref    string `json:"ref"`
	Status string `json:"status"`
	Was    string `json:"was"`
}

ItemHold is a board item a decision holds on its person: the issue, the Status the hold set and the Status it had before, which its release sets back.

type Keep added in v0.71.0

type Keep struct {
	By     Party     `json:"by"`
	At     time.Time `json:"at"`
	Until  time.Time `json:"until,omitzero"`
	Reason string    `json:"reason,omitempty"`
	// contains filtered or unexported fields
}

Keep is a roster entry's keep marker: who set it, when, why, and until when (zero: until lifted).

func (*Keep) Holds added in v0.71.0

func (k *Keep) Holds(now time.Time) bool

Holds reports whether the marker still keeps its entry at now.

func (Keep) MarshalJSON added in v0.73.0

func (v Keep) MarshalJSON() ([]byte, error)

func (*Keep) UnmarshalJSON added in v0.73.0

func (v *Keep) UnmarshalJSON(b []byte) error

type LocalTask

type LocalTask struct {
	// Ref is the task's issue or pull request, owner/repo#n.
	Ref string    `json:"ref"`
	Why string    `json:"why"`
	By  Party     `json:"by"`
	At  time.Time `json:"at"`
	// contains filtered or unexported fields
}

LocalTask is a task whose remaining work needs what only the coordinator has (data, devices, commands): every start of it, the loop's and a hand start without --host, runs on the coordinator. A worker on an execution host asks for it with agents move, the desk marks one with agents move --ref.

func (LocalTask) MarshalJSON

func (v LocalTask) MarshalJSON() ([]byte, error)

func (*LocalTask) UnmarshalJSON

func (v *LocalTask) UnmarshalJSON(b []byte) error

type LockBusyError added in v0.145.2

type LockBusyError struct {
	PID     int
	Command string
	Since   time.Time
	Waited  time.Duration
}

LockBusyError is a wait for the state lock that ended before its holder released it: who holds it, since when, as the holder recorded it; PID 0 is a holder without a record (a reader, or an older beekeeper).

func (*LockBusyError) Error added in v0.145.2

func (e *LockBusyError) Error() string

type Merge added in v0.6.0

type Merge struct {
	// Head is the commit pinned by the gate, retained for detached outcomes.
	Head string `json:"head,omitempty"`
	Repo string `json:"repo"`
	PR   int    `json:"pr"`
	Lane string `json:"lane"`
	By   Party  `json:"by"`
	PID  int    `json:"pid"`
	// Version is the binary that owns this place. Older releases may not record it.
	Version string `json:"version,omitempty"`
	// Child is a running merge's devctl, in a session of its own: it merges
	// on when the gate's caller, or the gate, is gone.
	Child int `json:"child,omitempty"`
	// Run is the files' base of a queued merge's own run (the gate under
	// --queued and its merge-child), whose merge-child owes the outcome to
	// the owner: a run cut before that merge-child wrote its exit code
	// leaves the outcome to the watch. Cleared once the cut is owed.
	Run string `json:"run,omitempty"`
	// Output is the file the gate's stdout writes to, a background task's
	// output file: a TaskStop naming that task stops the merge.
	Output string `json:"output,omitempty"`
	Phase  string `json:"phase"`
	// Joined orders the queue; a rerun within the queue TTL keeps it.
	Joined  time.Time `json:"joined"`
	Seen    time.Time `json:"seen"`
	Started time.Time `json:"started,omitzero"`
	// Finished and Exit are when and how the merge's run ended.
	Finished time.Time `json:"finished,omitzero"`
	Exit     int       `json:"exit,omitempty"`
	// Seeded marks a place queued on a session's behalf (lanes queue): it
	// survives refusals and keeps the seed TTL until the merge runs.
	Seeded bool `json:"seeded,omitempty"`
	// Outside marks a merge run outside the gate (lanes settle): waiting, it
	// heads its lane until its own devctl pr merge runs or GitHub reports it
	// merged; merged, it settles its lane like a gated merge.
	Outside bool `json:"outside,omitempty"`
	// Checked is when GitHub last reported an outside merge not merged yet.
	Checked time.Time `json:"checked,omitzero"`
	// Candidate is the release candidate a promotion (PR 0) was queued for,
	// the newest one at queue time, empty when there was none: its turn
	// refuses when the newest candidate is another by then.
	Candidate string `json:"candidate,omitempty"`
	// Release is the tag the merge released, empty when unknown.
	Release string `json:"release,omitempty"`
	// ReleaseFailed marks a merge whose release failed (devctl exit 6): its
	// auto-release run or tag pipeline failed, nothing rolls, and the lane
	// settles at once.
	ReleaseFailed bool `json:"releaseFailed,omitempty"`
	// Releasing marks a merge of a lane without an installation whose gate
	// confirms its release after devctl ended at the merge: the lane's next
	// merge starts its update and CI meanwhile and merges once the release
	// is confirmed or failed. A releasing merge whose gate is gone settles
	// by the settle rule, its release unknown.
	Releasing bool `json:"releasing,omitempty"`
	// HandCut is the merge's base branch when no Auto-release run tags a
	// merge into it (its tags are cut by hand): devctl awaits no release and
	// the merge leaves its lane once merged.
	HandCut string `json:"handCut,omitempty"`
	// Roll names the HelmReleases (namespace/name) that must reach Release
	// before the lane frees.
	Roll []string `json:"roll,omitempty"`
	// Reset is the GitHub budget reset a merge queued under the floor waits
	// for: for merge.resetFirst from then it goes before the waits, and the
	// older such merges before it. Its start clears it.
	Reset time.Time `json:"reset,omitzero"`
	// contains filtered or unexported fields
}

Merge is one devctl pr merge the gate holds in its lane's queue.

func (Merge) Key added in v0.6.0

func (m Merge) Key() string

Key is the merge's repository and number, owner/repo#n, or owner/repo promote for a promotion (PR 0).

func (Merge) MarshalJSON added in v0.73.0

func (v Merge) MarshalJSON() ([]byte, error)

func (*Merge) UnmarshalJSON added in v0.73.0

func (v *Merge) UnmarshalJSON(b []byte) error

type Note

type Note struct {
	ID   int       `json:"id"`
	For  string    `json:"for,omitempty"`
	Text string    `json:"text"`
	Due  time.Time `json:"due,omitzero"`
	// Default is what happens when nobody answers by Due.
	Default string    `json:"default,omitempty"`
	By      Party     `json:"by"`
	At      time.Time `json:"at"`
	// Fired is when a watch reported the note due; it reports it once.
	Fired time.Time `json:"fired,omitzero"`
	// Kind is NoteDecision for a question that waits on a person or
	// NoteLogin for a sign-in the watch closes once Until, a shell command,
	// exits 0.
	Kind  string `json:"kind,omitempty"`
	Until string `json:"until,omitempty"`
	// Refs are the issues and pull requests (owner/repo#n) the note asks
	// about: once every one is closed or merged, the watch closes the note
	// as overtaken, unless a closing keyword closed one and the note's
	// worker has not ended its task (Kept). A to-do's refs and a reopened
	// note's never close it. Without refs the note is linked to its filing
	// session, and closes once that session is archived.
	Refs []string `json:"refs,omitempty"`
	// Reopened is when note reopen put the note back in the queue after it
	// closed: from then on its refs no longer overtake it, and only its
	// answer, its default or a close by hand ends it.
	Reopened time.Time `json:"reopened,omitzero"`
	// TaskEnded is when the worker that filed the note reported its task
	// over (agents idle): from then on its settled refs overtake the note,
	// a closing keyword's close included. Zero for a note no worker filed
	// or whose worker still runs.
	TaskEnded time.Time `json:"taskEnded,omitzero"`
	// Kept is why the watch keeps the note open although every ref is
	// closed or merged, said once per reason (NOTE KEPT).
	Kept string `json:"kept,omitempty"`
	// Question, StatusQuo, Options ("<label>: <consequence>" each) and
	// Recommend (the recommended option, 1-based) are a decision's parts as
	// its message renders them; Text joins them for the terminal.
	Question  string   `json:"question,omitempty"`
	StatusQuo string   `json:"statusQuo,omitempty"`
	Options   []string `json:"options,omitempty"`
	Recommend int      `json:"recommend,omitempty"`
	// Posted is the gateway's handle on the decision's message, once posted.
	Posted string `json:"posted,omitempty"`
	// Held is the board item the decision holds (note add --holds), its
	// first --ref, and AlsoHeld those of its further --ref: each one's
	// Status set to Blocked / Waiting until the decision closes, then set
	// back. nil and empty for a note that holds nothing.
	Held     *ItemHold  `json:"held,omitempty"`
	AlsoHeld []ItemHold `json:"alsoHeld,omitempty"`
	// Central is the muster context of the central instance that holds
	// the note, as a machine lists it beside its own; empty for the
	// machine's own note, and never stored.
	Central string `json:"central,omitempty"`
	// contains filtered or unexported fields
}

Note is an open item: a question for a person, a deadline.

func (*Note) HoldOf added in v0.155.6

func (n *Note) HoldOf(ref string) *ItemHold

HoldOf is n's hold of the board item ref; nil when n holds no such item.

func (*Note) Holds added in v0.155.6

func (n *Note) Holds() []ItemHold

Holds are the board items n holds: Held, then AlsoHeld.

func (Note) MarshalJSON added in v0.73.0

func (v Note) MarshalJSON() ([]byte, error)

func (*Note) Option added in v0.77.0

func (n *Note) Option(i int) (label, consequence string, ok bool)

Option is a decision's option i (1-based) split into its label and its consequence; ok is false for none.

func (*Note) UnmarshalJSON added in v0.73.0

func (v *Note) UnmarshalJSON(b []byte) error

type NoteHistory added in v0.172.3

type NoteHistory interface {
	NoteClosure(int) (*Event, error)
}

NoteHistory is the optional history of a store that retains central note closures beyond the late-answer window. File-backed stores need not implement it.

type NoteLookup added in v0.174.0

type NoteLookup interface {
	LookupNote(int) (*Note, *Event, error)
}

NoteLookup is the optional complete history of a store that retains closed notes.

type Override

type Override struct {
	ID int `json:"id"`
	// Path is the configuration file the override changed.
	Path   string        `json:"path"`
	Keys   []OverrideKey `json:"keys"`
	Reason string        `json:"reason"`
	// Until is the time the override ends; Ref (owner/repo#n) the issue or
	// pull request whose closing ends it. One of the two is set.
	Until time.Time `json:"until,omitzero"`
	Ref   string    `json:"ref,omitempty"`
	By    Party     `json:"by"`
	At    time.Time `json:"at"`
	// Checked is when Ref was last found open or unreadable, Found what
	// that check found.
	Checked time.Time `json:"checked,omitzero"`
	Found   string    `json:"found,omitempty"`
	// Ended is when its end arrived and a restore took it, Ending why (the
	// time came, Ref closed): another tick leaves it to that restore.
	Ended  time.Time `json:"ended,omitzero"`
	Ending string    `json:"ending,omitempty"`
	// Decision is why the restore waits on the person (a key changed since
	// the override), Note the decision note asking them.
	Decision string `json:"decision,omitempty"`
	Note     int    `json:"note,omitempty"`
	// contains filtered or unexported fields
}

Override is a temporary change of the configuration file (config set --until): the keys it set, each one's value before, why and its end, a time or an issue or pull request whose closing ends it. The watch and the supervisor loop restore the values before once its end arrives, or ask the person when a restore needs a decision.

func (Override) MarshalJSON

func (v Override) MarshalJSON() ([]byte, error)

func (*Override) UnmarshalJSON

func (v *Override) UnmarshalJSON(b []byte) error

type OverrideKey

type OverrideKey struct {
	Key      string `json:"key"`
	Value    string `json:"value"`
	Previous string `json:"previous,omitempty"`
	Absent   bool   `json:"absent,omitempty"`
	// contains filtered or unexported fields
}

OverrideKey is one key an override set: the value it set and the value before, YAML, or Absent when the file had no such key.

func (OverrideKey) MarshalJSON

func (v OverrideKey) MarshalJSON() ([]byte, error)

func (*OverrideKey) UnmarshalJSON

func (v *OverrideKey) UnmarshalJSON(b []byte) error

type Owed added in v0.140.1

type Owed struct {
	Cancelled bool      `json:"cancelled,omitempty"`
	Owner     Party     `json:"owner"`
	Line      string    `json:"line"`
	Ask       bool      `json:"ask,omitempty"`
	Repo      string    `json:"repo,omitempty"`
	PR        int       `json:"pr,omitempty"`
	Command   string    `json:"command,omitempty"`
	Stop      string    `json:"stop,omitempty"`
	Gate      int       `json:"gate,omitempty"`
	Child     int       `json:"child"`
	Heard     string    `json:"heard,omitempty"`
	Since     time.Time `json:"since"`
	Tried     time.Time `json:"tried,omitzero"`
	Why       string    `json:"why,omitempty"`
	// contains filtered or unexported fields
}

Owed is a detached run's outcome its owner has not heard: recorded by the run's merge-child before it hands the outcome over, so a merge-child stopped or killed on the way (a desktop restart, its user manager stopping) leaves it to the watch. Gate and Child are the pids of the run's gate and merge-child, which hand it over while either runs; Heard is the gate's heard marker, which says its caller heard it. Line is the outcome; Ask marks a merge stopped before devctl reported its end, whose outcome is its pull request's state on GitHub (Repo, PR), Command and Stop naming the command and its stop. Tried is when a hand-over was last claimed, Why why the last one failed. Cancelled distinguishes a requested stop from a crash, so recovery never asks the owner to rerun a cancelled command.

func (Owed) Key added in v0.140.1

func (o Owed) Key() string

Key tells owed outcomes apart: the merge-child that owes it and when.

func (Owed) MarshalJSON added in v0.140.1

func (v Owed) MarshalJSON() ([]byte, error)

func (*Owed) UnmarshalJSON added in v0.140.1

func (v *Owed) UnmarshalJSON(b []byte) error

type PaceOff

type PaceOff struct {
	Provider string    `json:"provider"`
	Until    time.Time `json:"until"`
	Reason   string    `json:"reason"`
	By       Party     `json:"by"`
	At       time.Time `json:"at"`
	// contains filtered or unexported fields
}

PaceOff is the person's word that worker starts on a subscription provider may run ahead of its 7-day pace (capacity pace off), such as a usage reset in hand: until Until, and only within the 7-day window current at At. The window's caps and the 5-hour window still bound the starts.

func (PaceOff) MarshalJSON

func (v PaceOff) MarshalJSON() ([]byte, error)

func (*PaceOff) UnmarshalJSON

func (v *PaceOff) UnmarshalJSON(b []byte) error

type Pair added in v0.156.0

type Pair struct {
	// Keys are the two merges, owner/repo#n each.
	Keys []string  `json:"keys"`
	By   Party     `json:"by"`
	At   time.Time `json:"at"`
	// Ready is when each merge's gate last found only the pair holding it
	// back, by key.
	Ready map[string]time.Time `json:"ready,omitempty"`
	// Started is the merge that started first; its sibling then starts
	// outside merge.cap and merge.sessionCap, the slot taken for both.
	Started string `json:"started,omitempty"`
	// Refused is why one of the two was refused, RefusedKey which: the
	// other's gate refuses it with the same reason.
	Refused    string `json:"refused,omitempty"`
	RefusedKey string `json:"refusedKey,omitempty"`
	// contains filtered or unexported fields
}

Pair is two merges that must land together, a change split over two repositories: the gate holds the first at its turn until the other is next in its lane too, then starts both, and a refusal of either refuses both with one reason.

func (Pair) MarshalJSON added in v0.156.0

func (v Pair) MarshalJSON() ([]byte, error)

func (Pair) Sibling added in v0.156.0

func (p Pair) Sibling(key string) string

Sibling is the pair's other merge than key, "" when key is not in it.

func (*Pair) UnmarshalJSON added in v0.156.0

func (v *Pair) UnmarshalJSON(b []byte) error

type Park added in v0.82.0

type Park struct {
	// Continuation holds events for a fresh worker, never a transcript resume.
	Continuation []string `json:"continuation,omitempty"`
	Continuing   bool     `json:"continuing,omitempty"`

	// External marks a wait no current decision can resolve; it resumes by an explicit wake.
	External bool `json:"external,omitempty"`
	// Checks parks on coordinator-owned CI settlement, never PR comments or review.
	Checks bool `json:"checks,omitempty"`
	// RefKind caches GitHub's Issue or PullRequest type for this park.
	RefKind string `json:"refKind,omitempty"`
	// RefChecked is the last lookup attempt; issues and unresolved references retry every five minutes.
	RefChecked time.Time `json:"refChecked,omitzero"`
	// ReviewHead proves the caller parked from the PR branch at its published HEAD.
	// Empty (including parks written by older versions) is a plain wait.
	ReviewHead string `json:"reviewHead,omitempty"`
	// PostMerge is work remaining after merge; nil preserves older parks.
	// An explicit empty string lets the loop close the task without a wake.
	PostMerge *string `json:"postMerge,omitempty"`
	// Worktree is the local git worktree root the caller parked from.
	Worktree string    `json:"worktree,omitempty"`
	By       Party     `json:"by"`
	At       time.Time `json:"at"`
	On       string    `json:"on,omitempty"`
	Waits    string    `json:"waits"`
	// Resumable is when the watch saw On settle; Answer is what settled it,
	// a person's answer word for word or the pull request's state.
	Resumable time.Time `json:"resumable,omitzero"`
	Answer    string    `json:"answer,omitempty"`
	// Told is when the supervisor's watch said the park waits on a person;
	// zero: not yet, or it waits on no person.
	Told time.Time `json:"told,omitzero"`
	// contains filtered or unexported fields
}

Park is an agent's park: what it waits for, on which note (#<id>) or issue or pull request (owner/repo#n), and once that settled, since when it is resumable and the words its resume carries.

func (Park) MarshalJSON added in v0.82.0

func (v Park) MarshalJSON() ([]byte, error)

func (*Park) UnmarshalJSON added in v0.82.0

func (v *Park) UnmarshalJSON(b []byte) error

type Party

type Party struct {
	// Session is the Claude Code session id (CLAUDE_CODE_SESSION_ID).
	Session string `json:"session,omitempty"`
	// HostSession is the desktop app's id for it (local_…); it survives a
	// CLI restart that changes Session.
	HostSession string `json:"hostSession,omitempty"`
	Name        string `json:"name"`
	// Person is whose agent the party is: a verified email, stable across
	// identity providers.
	Person string `json:"person,omitempty"`
	// Team is the person's team.
	Team string `json:"team,omitempty"`
	// Host is the machine or installation the party runs on.
	Host string `json:"host,omitempty"`
}

Party names a session (or a person) in the state.

func (Party) Is

func (p Party) Is(o Party) bool

Is reports whether p and o name the same session or person. Parties of two people, or on two hosts, are never the same, whatever their names.

func (Party) Owner added in v0.74.0

func (p Party) Owner() string

Owner names whose agent the party is, of which team, on which host ("alex@example.com, team bumblebee, on lab"); empty when none is known.

type Record added in v0.9.0

type Record struct {
	Session Party     `json:"session"`
	Issue   string    `json:"issue"`
	Waits   string    `json:"waits,omitempty"`
	By      Party     `json:"by"`
	At      time.Time `json:"at"`
	// Ended is when a watch saw the session's CLI gone; it reports it once.
	Ended time.Time `json:"ended,omitzero"`
	// contains filtered or unexported fields
}

Record is what a session serves: the issue or epic (owner/repo#n) and what it waits on. Any session can have one, registered agent or not.

func (Record) MarshalJSON added in v0.73.0

func (v Record) MarshalJSON() ([]byte, error)

func (*Record) UnmarshalJSON added in v0.73.0

func (v *Record) UnmarshalJSON(b []byte) error

type Relay added in v0.10.0

type Relay struct {
	From    Party     `json:"from"`
	To      Party     `json:"to"`
	At      time.Time `json:"at"`
	Expires time.Time `json:"expires"`
	// Taken is when the successor took the role; the record stays so the
	// outgoing supervisor learns it has been relieved.
	Taken time.Time `json:"taken,omitzero"`
	// Reported is when a watch said the relay was taken or expired; it says
	// it once.
	Reported time.Time `json:"reported,omitzero"`
	// contains filtered or unexported fields
}

Relay is a role's holder (the guide) naming its successor: the successor's start takes the role until Expires; the outgoing holder keeps it meanwhile.

func (Relay) MarshalJSON added in v0.73.0

func (v Relay) MarshalJSON() ([]byte, error)

func (*Relay) Open added in v0.10.0

func (r *Relay) Open(now time.Time) bool

Open reports whether the relay can still be taken at now.

func (*Relay) UnmarshalJSON added in v0.73.0

func (v *Relay) UnmarshalJSON(b []byte) error

type RelayDue added in v0.16.0

type RelayDue struct {
	Supervisor Party     `json:"supervisor"`
	Since      time.Time `json:"since"`
	Reported   time.Time `json:"reported"`
	// Context is the supervisor's context in tokens when it was reported.
	Context int64 `json:"contextTokens"`
	// RelayAt is the relayAt in tokens it was reported at.
	RelayAt int64 `json:"relayAt,omitempty"`
	// contains filtered or unexported fields
}

RelayDue is the watch's memory that it reported the relay due to the supervisor's term Supervisor and Since at RelayAt: a relay cancelled or expired removes it, so the next quiet moment reports it again, and a changed relayAt reports it anew.

func (*RelayDue) At added in v0.91.1

func (r *RelayDue) At(sup *Supervisor, relayAt int64) bool

At reports whether the record is about sup's current term at relayAt.

func (RelayDue) MarshalJSON added in v0.73.0

func (v RelayDue) MarshalJSON() ([]byte, error)

func (*RelayDue) Of added in v0.16.0

func (r *RelayDue) Of(sup *Supervisor) bool

Of reports whether the record is about sup's current term.

func (*RelayDue) UnmarshalJSON added in v0.73.0

func (v *RelayDue) UnmarshalJSON(b []byte) error

type Relief added in v0.14.1

type Relief struct {
	Party Party `json:"party"`
	// By is the successor whose start took the relay, At when the relay
	// was opened and Taken when it was taken.
	By    Party     `json:"by"`
	At    time.Time `json:"at"`
	Taken time.Time `json:"taken"`
	// contains filtered or unexported fields
}

Relief records a supervisor a relay relieved, so that its `supervisor status` keeps saying so after the successor relays onward, cancels a relay or is relieved in turn.

func (Relief) MarshalJSON added in v0.73.0

func (v Relief) MarshalJSON() ([]byte, error)

func (*Relief) UnmarshalJSON added in v0.73.0

func (v *Relief) UnmarshalJSON(b []byte) error

type Report added in v0.26.0

type Report struct {
	Party
	// Unit is the transient user unit its turn runs in.
	Unit string `json:"unit"`
	// Slot is the start of the interval it reports on.
	Slot    time.Time `json:"slot"`
	Started time.Time `json:"started"`
	// Ended is when beekeeper took it off the roster; zero while it runs.
	Ended time.Time `json:"ended,omitzero"`
	// Outcome is posted, timeout or failed: <why>; empty while it runs.
	Outcome string `json:"outcome,omitempty"`
	// Skipped is the latest slot skipped while it ran.
	Skipped time.Time `json:"skipped,omitzero"`
	// contains filtered or unexported fields
}

Report is one run of the scheduled status reporter: the session the standby watch started for an interval's slot, until it posted, timed out or failed to start.

func (Report) MarshalJSON added in v0.73.0

func (v Report) MarshalJSON() ([]byte, error)

func (*Report) Running added in v0.26.0

func (r *Report) Running() bool

Running reports whether the reporter has yet to end.

func (*Report) UnmarshalJSON added in v0.73.0

func (v *Report) UnmarshalJSON(b []byte) error

type ReportMessage

type ReportMessage struct {
	ID      string          `json:"id"`
	By      Party           `json:"by"`
	At      time.Time       `json:"at"`
	Kind    string          `json:"kind"`
	Payload json.RawMessage `json:"payload"`
}

ReportMessage is a durable command from a session to the supervisor. The filename orders completed submissions; the receipt commits with the effects.

func PendingReports

func PendingReports(store Store) ([]ReportMessage, error)

PendingReports returns completed publications in filename order. Partial temporary files are invisible. A corrupt publication is an error, not a skip.

func QueueReport

func QueueReport(store Store, by Party, kind string, payload any) (ReportMessage, error)

QueueReport publishes a synced message without opening state.lock. The final rename and directory sync precede acknowledgement to the session.

type ReportPause added in v0.28.0

type ReportPause struct {
	Final time.Time `json:"final,omitzero"`
	Since time.Time `json:"since,omitzero"`
	By    Party     `json:"by"`
	// contains filtered or unexported fields
}

ReportPause pauses the scheduled reporter until it is resumed: from Since, or, while Final is set, from the start of one final report due then.

func (*ReportPause) FinalDue added in v0.28.0

func (p *ReportPause) FinalDue(now time.Time) bool

FinalDue reports whether the final report is due at now.

func (ReportPause) MarshalJSON added in v0.73.0

func (v ReportPause) MarshalJSON() ([]byte, error)

func (*ReportPause) Paused added in v0.28.0

func (p *ReportPause) Paused() bool

Paused reports whether no scheduled report starts.

func (*ReportPause) UnmarshalJSON added in v0.73.0

func (v *ReportPause) UnmarshalJSON(b []byte) error

type ReportReceipt

type ReportReceipt struct {
	At       time.Time `json:"at"`
	Note     int       `json:"note,omitempty"`
	Error    string    `json:"error,omitempty"`
	Notified bool      `json:"notified,omitempty"`
	By       Party     `json:"by"`
}

ReportReceipt survives a crash between committing effects and removing the inbox file. Note is also the stable resolution of a pending note reference.

type ReportThread added in v0.82.0

type ReportThread struct {
	// Report is the reporter's name.
	Report  string    `json:"report"`
	Channel string    `json:"channel"`
	TS      string    `json:"ts"`
	Posted  time.Time `json:"posted"`
	// Seen is the ts of the last reply delivered.
	Seen string `json:"seen,omitempty"`
	// contains filtered or unexported fields
}

ReportThread is the Slack thread of a posted status report, whose replies by the report's author the feedback watch delivers.

func (ReportThread) MarshalJSON added in v0.82.0

func (v ReportThread) MarshalJSON() ([]byte, error)

func (*ReportThread) UnmarshalJSON added in v0.82.0

func (v *ReportThread) UnmarshalJSON(b []byte) error

type ReviewNitCheck

type ReviewNitCheck struct {
	Ref          string    `json:"ref"`
	Head         string    `json:"head"`
	ApprovedHead string    `json:"approvedHead"`
	By           Party     `json:"by"`
	At           time.Time `json:"at"`
}

ReviewNitCheck is a supervisor's explicit attestation that a new head only fixes nits in an approval. It never substitutes for that original review.

type ReviewPark

type ReviewPark struct {
	On         string         `json:"on"`
	At         time.Time      `json:"at"`
	ReviewHead string         `json:"reviewHead"`
	Agent      string         `json:"agent"`
	Party      Party          `json:"party"`
	Execution  *execution.Ref `json:"execution,omitempty"`
	Selector   string         `json:"selector,omitempty"`
	Model      string         `json:"model,omitempty"`
	Serves     string         `json:"serves,omitempty"`
	PostMerge  *string        `json:"postMerge,omitempty"`
	Worktree   string         `json:"worktree,omitempty"`
	// Continuing names the fresh session the loop is starting for this
	// park's task once its pull request ended: that start continues the
	// task's delivery (ContinueDelivery) with On among its pulls.
	Continuing string `json:"continuing,omitempty"`
}

ReviewPark retains each proven pull-request review request independently of the worker's current park and roster lifetime.

type ReviewRequest

type ReviewRequest struct {
	// PID owns the reservation only while the start command is in progress.
	PID   int    `json:"pid,omitempty"`
	Ref   string `json:"ref"`
	Head  string `json:"head"`
	Round int    `json:"round"`
	// By is the session that asked for the review by hand (agents review);
	// the loop's own reviews name none. It gets the verdict.
	By Party `json:"by,omitzero"`
}

ReviewRequest reserves a review before its session starts. Live sessions and assignments keep it active after the starting process exits.

type Role added in v0.20.0

type Role struct {
	// WorkChecked records the current guide turn's explicit work review.
	WorkChecked *Party `json:"workChecked,omitempty"`
	// WatchSeen is the last successful guide-feed heartbeat.
	WatchSeen time.Time `json:"watchSeen,omitzero"`
	// Delivered are independently delivered notices, scoped to their holder.
	Delivered []string    `json:"delivered,omitempty"`
	Holder    *Supervisor `json:"holder,omitempty"`
	Relay     *Relay      `json:"relay,omitempty"`
	Relieved  []Relief    `json:"relieved,omitempty"`
	CLI       *CLI        `json:"cli,omitempty"`
	RelayDue  *RelayDue   `json:"relayDue,omitempty"`
	// Fed are the keys of what the guide's feed reported: the open notes
	// for a person and the sessions waiting on one, each said once.
	Fed []string `json:"fed,omitempty"`
	// Run is the highest run of the role numbered: "<Role> run <Run>".
	Run int `json:"run,omitempty"`
	// Asking is the note the guide asks its person now (beekeeper guide
	// next): served again until it is answered or done. AskingFrom is the
	// muster context of the central instance that holds it, empty for the
	// machine's own.
	Asking     int    `json:"asking,omitempty"`
	AskingFrom string `json:"askingFrom,omitempty"`
	// contains filtered or unexported fields
}

Role is a relayed role's record: its holder and term, its last relay, the holders relays relieved, what beekeeper saw of its CLI and the relay due the watch reported: the guide's, in Guide.

func (Role) LocalAsking added in v0.165.0

func (r Role) LocalAsking() int

LocalAsking is the machine's own note the guide asks now, 0 when it asks none or a central instance's.

func (Role) MarshalJSON added in v0.73.0

func (v Role) MarshalJSON() ([]byte, error)

func (*Role) UnmarshalJSON added in v0.73.0

func (v *Role) UnmarshalJSON(b []byte) error

type RoleLine added in v0.139.2

type RoleLine struct {
	Role string    `json:"role"`
	Line string    `json:"line"`
	At   time.Time `json:"at"`
	// contains filtered or unexported fields
}

RoleLine is a line for the holder of a role (supervisor, guide) that no session held, or whose holder could not be told, when it was said: the answer to a note a run of the role filed.

func (RoleLine) MarshalJSON added in v0.139.2

func (v RoleLine) MarshalJSON() ([]byte, error)

func (*RoleLine) UnmarshalJSON added in v0.139.2

func (v *RoleLine) UnmarshalJSON(b []byte) error

type StaleWriterError added in v0.108.0

type StaleWriterError struct {
	PID     int
	Command string
	// Version is this binary's, Newer the one that wrote the state.
	Version, Newer string
	// Load is why the state does not decode, nil for a refused save.
	Load error
}

StaleWriterError is a save refused because a newer release wrote the state, or a state a newer release wrote that this binary does not load (Load): this binary would save it by rules that release changed (a watch, a start's reopen or a gate call left running by an install). The state stays as it is; the process ends or is restarted, and the installed beekeeper runs its command.

func (*StaleWriterError) Error added in v0.108.0

func (e *StaleWriterError) Error() string

func (*StaleWriterError) Unwrap added in v0.151.0

func (e *StaleWriterError) Unwrap() error

type Start added in v0.22.0

type Start struct {
	// Kind is the immutable task kind selected when the session starts.
	Kind string `json:"kind,omitempty"`
	// Successor redirects late messages after a fresh continuation took the task.
	Successor *Party `json:"successor,omitempty"`
	Effort    string `json:"effort,omitempty"`
	Party
	Execution *ExecutionRecord `json:"execution,omitempty"`
	Mode      string           `json:"mode"`
	Dir       string           `json:"dir"`
	By        Party            `json:"by"`
	At        time.Time        `json:"at"`
	// Harness is the agent harness started: "" for Claude Code, "omp".
	Harness string `json:"harness,omitempty"`
	// Model is the model the session was started on (--model, as its first
	// reply names it), which its turns keep; empty: none was chosen.
	Model string `json:"model,omitempty"`
	// Background says the session runs as a Claude Code background session
	// (agents.mode background): it has no desktop session, and its wakes go
	// by its messaging, a stopped one's by claude --bg --resume.
	Background bool `json:"background,omitempty"`
	// Role is the relayed role the session was started to take (a guide
	// run); empty: none. Only such a start may take the role.
	// Once relieved or taken over, its session stays the person's to close: nothing stops or
	// archives it.
	Role string `json:"role,omitempty"`
	// Conversation is the harness's own id of the conversation where it
	// differs from the start's (agy): its transcript's id, which outlives the
	// link files removed with the session's inbox.
	Conversation string `json:"conversation,omitempty"`
	// Task is the task an ended worker held last (EndedWorkers).
	Task string `json:"task,omitempty"`
	// contains filtered or unexported fields
}

Start is a session `beekeeper agents start` started: the id beekeeper chose and the permission mode it passed, recorded before the session existed. A session cannot add itself: its id is only ever written here by the start that created it.

func (Start) MarshalJSON added in v0.73.0

func (v Start) MarshalJSON() ([]byte, error)

func (*Start) UnmarshalJSON added in v0.73.0

func (v *Start) UnmarshalJSON(b []byte) error

type State

type State struct {
	ReportReceipts    map[string]ReportReceipt `json:"reportReceipts,omitempty"`
	DeliveryHealth    DeliveryHealth           `json:"deliveryHealth,omitempty"`
	DeliveryHolds     map[string]ItemHold      `json:"deliveryHolds,omitempty"`
	Deliveries        []Delivery               `json:"deliveries,omitempty"`
	DeliveriesAt      time.Time                `json:"deliveriesAt,omitempty"`
	GuideReportsSince time.Time                `json:"guideReportsSince,omitempty"`
	GuideFindings     map[string]GuideFinding  `json:"guideFindings,omitempty"`
	GuideReports      []string                 `json:"guideReports,omitempty"`
	GuideWork         []GuideWork              `json:"guideWork,omitempty"`
	NextGuideWork     int                      `json:"nextGuideWork,omitempty"`
	// EventOutbox retains the exact log append with the state it commits.
	EventOutbox *EventOutbox `json:"eventOutbox,omitempty"`
	// ProductionNotes are consumed authorities, retained across hook processes.
	ProductionNotes   map[int]time.Time `json:"productionNotes,omitempty"`
	Handovers         []Handover        `json:"handovers,omitempty"`
	Emergency         *Emergency        `json:"emergency,omitempty"`
	AutoInstallPaused bool              `json:"autoInstallPaused,omitempty"`
	// LabIdle records when a configured kind lab was first seen unleased.
	LabIdle map[string]time.Time `json:"labIdle,omitempty"`
	// Guide is the guide's role: the person's decisions. The supervisor is
	// the supervisor loop, which holds no role record.
	Guide *Role `json:"guide,omitempty"`
	// Grants are queued per resource in the order given.
	Grants []Grant `json:"grants,omitempty"`
	// Released is when each resource was last released; a grant's TTL runs
	// from the later of it and the grant.
	Released map[string]time.Time `json:"released,omitempty"`
	Holds    []Hold               `json:"holds,omitempty"`
	Agents   []Agent              `json:"agents,omitempty"`
	// EndedWorkers retain local removed identities for orphan-process cleanup
	// and for a wake or resume by name (endedWorker).
	// They grant no start permissions; Starts remains the authorization ledger.
	EndedWorkers []Start `json:"endedWorkers,omitempty"`
	// Parks are the parks of sessions off the roster (agents park by a
	// session no roster entry names), one per session, its By: the watch
	// settles and resumes them as it does a roster agent's.
	Parks []Park `json:"parks,omitempty"`
	Notes []Note `json:"notes,omitempty"`
	// Defaulted are the decisions closed by their default within the last
	// day: an answer that arrives meanwhile replaces the default.
	Defaulted []Note  `json:"defaulted,omitempty"`
	NextNote  int     `json:"nextNote,omitempty"`
	Timers    []Timer `json:"timers,omitempty"`
	NextTimer int     `json:"nextTimer,omitempty"`
	// Overrides are the temporary configuration changes in effect (config
	// set --until).
	Overrides    []Override `json:"overrides,omitempty"`
	NextOverride int        `json:"nextOverride,omitempty"`
	// PaceOffs are the providers whose worker starts may run ahead of their
	// 7-day pace for a while (capacity pace off).
	PaceOffs []PaceOff `json:"paceOffs,omitempty"`
	// Records say which session serves which issue.
	Records []Record `json:"records,omitempty"`
	// Claims are the records this desk published on GitHub as claims
	// other desks read (board.claims).
	Claims []Claim `json:"claims,omitempty"`
	// Starts are the sessions beekeeper started, what the permission hook
	// answers for.
	Starts []Start `json:"starts,omitempty"`
	// Apps are the Apps the person owns and asked a consent for, what the
	// hook answers a consent click for.
	Apps []App `json:"apps,omitempty"`
	// AppRuns are the running `beekeeper app create` commands.
	AppRuns []AppRun `json:"appRuns,omitempty"`
	// AppsCreated are the Apps `beekeeper app create` created.
	AppsCreated []AppCreated `json:"appsCreated,omitempty"`
	// Archives are the desktop sessions of agents off the roster the
	// doctor still owes an archive.
	Archives []Archive `json:"archives,omitempty"`
	// ArchivesSeeded says the doctor owed the archives of the finished
	// workers whose desktop CLI ran on before it kept Archives.
	ArchivesSeeded bool `json:"archivesSeeded,omitempty"`
	// FinishedSeeded says the doctor owed the archives of all finished
	// workers whose desktop record stayed unarchived, a CLI running or not.
	FinishedSeeded bool `json:"finishedSeeded,omitempty"`
	// DoneSeeded says the doctor owed those archives again, of the agents
	// that reported done and the relieved role runs no person typed in, once
	// a finished session's own warmed CLI archived it.
	DoneSeeded bool `json:"doneSeeded,omitempty"`
	// Declines are the stewards that declined an archive request, which
	// the doctor asks for none for a while.
	Declines []Decline `json:"declines,omitempty"`
	// BudgetETag makes the budget probe a conditional request (a 304
	// costs no budget).
	BudgetETag string `json:"budgetETag,omitempty"`
	// Budget is the last reading of the GitHub core budget.
	Budget *Budget `json:"budget,omitempty"`
	// BranchReleases are how the base branches of the queued merges release,
	// one read per repository and branch for the lane's pass.
	BranchReleases []BranchRelease `json:"branchReleases,omitempty"`
	// Merges are the wrapped devctl pr merge runs, per lane: waiting in join
	// order, running, and settling until the lane's installation rolled them.
	Merges []Merge `json:"merges,omitempty"`
	// Failed are the gated merges whose last run merged nothing, one per
	// pull request, shown on their lane until its next attempt joins it.
	Failed []Failed `json:"failed,omitempty"`
	// Owed are the outcomes of detached runs their owners have not heard
	// yet, until the watch hands each over.
	Owed []Owed `json:"owed,omitempty"`
	// Report is the scheduled status reporter's current or last run.
	Report *Report `json:"report,omitempty"`
	// ReportThreads are the posted reports' Slack threads the feedback
	// watch reads, while feedback.window lasts.
	ReportThreads []ReportThread `json:"reportThreads,omitempty"`
	// AlertOwners are the owners of the firing alerts, one per alert.
	AlertOwners []AlertOwner `json:"alertOwners,omitempty"`
	// ReportPause pauses the scheduled reporter, after one final report.
	ReportPause *ReportPause `json:"reportPause,omitempty"`
	// Writer is the newest beekeeper that saved the state.
	Writer *Writer `json:"writer,omitempty"`
	// WorkerReports are mid-task findings and idle reports that the
	// supervisor's watch has not printed yet.
	WorkerReports   []WorkerReport   `json:"workerReports,omitempty"`
	ReviewNitChecks []ReviewNitCheck `json:"reviewNitChecks,omitempty"`
	ReviewRequests  []ReviewRequest  `json:"reviewRequests,omitempty"`
	DeskReviews     []DeskReview     `json:"deskReviews,omitempty"`
	ReviewParks     []ReviewPark     `json:"reviewParks,omitempty"`
	// Urgent are the merges marked urgent (lanes urgent): waiting for their
	// gate, or run under the GitHub budget floor in a reset window that has
	// not ended.
	Urgent []Urgent `json:"urgent,omitempty"`
	// Pairs are the merges declared to land together (the gate's --pair):
	// neither starts unless the other is next in its lane.
	Pairs []Pair `json:"pairs,omitempty"`
	// RoleLines are lines for a role's holder that found none to tell: the
	// role's next start says them.
	RoleLines []RoleLine `json:"roleLines,omitempty"`
	// Stop is the stop of every start, wake, revive, import and merge
	// (beekeeper stop) while it stands; beekeeper resume lifts it.
	Stop *Stop `json:"stop,omitempty"`
	// HostPins are the execution hosts beekeeper updated (agents hosts
	// update): the release each runs and the policy digest its starts are
	// pinned to, or why it is held.
	HostPins []HostPin `json:"hostPins,omitempty"`
	// HostPlacements retain the last placement verdict, not an admission grant.
	HostPlacements      map[string]HostPlacement `json:"hostPlacements,omitempty"`
	HostIdleSince       time.Time                `json:"hostIdleSince,omitzero"`
	HostLastRemoteStart time.Time                `json:"hostLastRemoteStart,omitzero"`
	HostIdleReported    bool                     `json:"hostIdleReported,omitempty"`
	// LocalTasks are the tasks whose starts stay on the coordinator (agents
	// move): no supervisor.hosts placement takes them to an execution host.
	LocalTasks []LocalTask `json:"localTasks,omitempty"`
	// TranscriptGrants are the guide's expiring grants of wider transcript
	// access to workers.
	TranscriptGrants []TranscriptGrant `json:"transcriptGrants,omitempty"`
	// TranscriptRequests are open worker requests for wider transcript
	// access awaiting the guide's grant.
	TranscriptRequests  []TranscriptRequest `json:"transcriptRequests,omitempty"`
	NextTranscriptGrant int                 `json:"nextTranscriptGrant,omitempty"`
	// contains filtered or unexported fields
}

State is the whole document.

func (*State) BypassStart added in v0.22.0

func (st *State) BypassStart(session string) (Start, bool)

BypassStart returns the start of session when beekeeper started it in bypassPermissions.

func (*State) BypassStartOf added in v0.150.0

func (st *State) BypassStartOf(p Party) (Start, bool)

BypassStartOf returns the start of p when beekeeper started it in bypassPermissions, matched by its CLI session id or its desktop host id: the desktop gives a session's restarted CLI a new session id and keeps its host id.

func (*State) ContinueDelivery

func (s *State) ContinueDelivery(ref, agent, pull string, at time.Time)

ContinueDelivery hands ref's delivery to agent, the fresh session that continues a parked worker's task. It is the same task: a delivery still active or ended merged keeps its pulls, step and outcome, so the merged pull request its post-merge work follows still proves the outcome. Any other delivery starts again as StartDelivery starts one. pull, the pull request the worker parked on (owner/repo#n, "" for none), joins the delivery's pulls: a pull request that only says "Part of" the issue reaches it through that park alone, which the fresh session does not repeat.

func (*State) GuideRole added in v0.20.0

func (st *State) GuideRole() Role

GuideRole is the guide's record.

func (*State) HostPin

func (st *State) HostPin(selector string) *HostPin

HostPin is the pin of the execution host selector, nil for none.

func (*State) Knows added in v0.70.1

func (st *State) Knows(p Party) bool

Knows reports whether p is a session beekeeper started (any mode), holds the guide's role, or is an agent on the roster: the sessions the hooks act in wherever they run.

func (*State) LocalTaskFor

func (st *State) LocalTaskFor(refs ...string) (LocalTask, bool)

LocalTaskFor is the mark of the first of refs (owner/repo#n, any case) that stays on the coordinator.

func (*State) MarkLocal

func (st *State) MarkLocal(t LocalTask) bool

MarkLocal records that ref stays on the coordinator, replacing an older mark of it, and reports whether the mark is new.

func (State) MarshalJSON added in v0.9.0

func (v State) MarshalJSON() ([]byte, error)

func (*State) PaceOff

func (st *State) PaceOff(provider string, now time.Time) *PaceOff

PaceOff is the pace override of provider in effect at now, nil for none.

func (*State) PairOf added in v0.156.0

func (s *State) PairOf(key string) int

PairOf is the index of the pair key is in, -1 when none.

func (*State) PullDelivery

func (s *State) PullDelivery(ref string)

PullDelivery records that ref, whose delivery a start just started or continued, is a pull request: that delivery holds ref among its pulls, as the loop's observation of an issue-less pull request has it. The pull request's merge then proves the delivery's outcome although no sweep of the desk's open pull requests ever read it (one another author opened, or one that merged first). A pull request an active delivery of its issue holds has no delivery of its own: StartDelivery started none.

func (*State) ReviewNitsChecked

func (st *State) ReviewNitsChecked(ref, head, approved string) bool

func (*State) ReviewParkFor

func (st *State) ReviewParkFor(on string) (ReviewPark, bool)

ReviewParkFor returns the recorded desk-review park for on (owner/repo#n).

func (*State) SetGuideRole added in v0.20.0

func (st *State) SetGuideRole(r Role)

SetGuideRole stores the guide's record, none when it is empty.

func (*State) StartDelivery

func (s *State) StartDelivery(ref, agent, waits string, at time.Time)

StartDelivery runs under the caller's serve-record lock. A fixer or a second worker serving the same active issue does not reset its delivery clock.

func (*State) StartIndex added in v0.150.0

func (st *State) StartIndex(p Party) int

StartIndex is the index in Starts of p's start in any mode, matched as BypassStartOf matches; -1 when beekeeper did not start it.

func (*State) UnmarkLocal

func (st *State) UnmarkLocal(ref string) bool

UnmarkLocal lifts ref's mark and reports whether it had one.

func (*State) UnmarshalJSON added in v0.9.0

func (v *State) UnmarshalJSON(b []byte) error

func (*State) UpsertReviewPark

func (st *State) UpsertReviewPark(rp ReviewPark)

UpsertReviewPark records or updates the desk-review park for rp.On.

type Stop added in v0.171.0

type Stop struct {
	Reason string    `json:"reason"`
	By     Party     `json:"by"`
	At     time.Time `json:"at"`
	// Holds are the targets of the holds the stop set (merges, github); a
	// full hold that stood before the stop is not among them and stays.
	Holds []string `json:"holds,omitempty"`
	// Replaced are the holds on those targets the stop's replaced: one that
	// let a merge through, or that would have ended by itself while the
	// stop stands (a time, a probe). Resume puts each back as it was.
	Replaced []Hold `json:"replaced,omitempty"`
	// Units are the installed units the stop stopped (the standby service,
	// stop.units), which resume starts again.
	Units []string `json:"units,omitempty"`
	// Sessions are the names of the sessions the stop ended.
	Sessions []string `json:"sessions,omitempty"`
	// contains filtered or unexported fields
}

Stop is a standing beekeeper stop: who stopped the machine's sessions, when and why, and what the stop changed, which beekeeper resume puts back.

func (Stop) MarshalJSON added in v0.171.0

func (v Stop) MarshalJSON() ([]byte, error)

func (*Stop) UnmarshalJSON added in v0.171.0

func (v *Stop) UnmarshalJSON(b []byte) error

type Store

type Store interface {
	// Dir is the machine-local directory beside the state: the merge
	// gate's and the timers' side files.
	Dir() string
	// Read returns the current state.
	Read() (*State, error)
	// Peek returns the current state without waiting on a writer.
	Peek() (*State, error)
	// Update runs fn on the state and saves the result together with the
	// events fn returns; when fn fails nothing is saved.
	Update(fn func(*State) ([]Event, error)) error
	// UpdateWithin is Update for a caller that must not wait long, a
	// session's start for one: a lock busy past wait fails it.
	UpdateWithin(wait time.Duration, fn func(*State) ([]Event, error)) error
	// Exclusive runs fn while no other process holds the state, writing
	// nothing.
	Exclusive(fn func() error) error
	// Log appends events that change no state, giving up on a busy lock.
	Log(events ...Event) error
	// Record appends events that change no state and must not be lost,
	// waiting for the lock as an update does.
	Record(events ...Event) error
	// RecordWithin is Record for a caller that must not wait long, an
	// agent's hand-over note for one: a lock busy past wait fails it with
	// a LockBusyError, the events not appended.
	RecordWithin(wait time.Duration, events ...Event) error
	// Events returns the last n events keep accepts, oldest first.
	Events(n int, keep func(Event) bool) ([]Event, error)
	// Follow returns every event keep accepts, oldest first, as Events(0,
	// keep); a reader that calls it again under the same name, with the
	// same keep, may be handed what it read before and only what was logged
	// since read.
	Follow(name string, keep func(Event) bool) ([]Event, error)
	// ReadFile decodes a JSON side file; found is false when it is missing.
	ReadFile(name string, v any) (found bool, err error)
	// WriteFile replaces a JSON side file.
	WriteFile(name string, v any) error
}

Store is the seam every command reads and changes the state through.

type Supervisor

type Supervisor struct {
	Party
	Since time.Time `json:"since"`
	// contains filtered or unexported fields
}

Supervisor is the session holding a relayed role (the guide's).

func (Supervisor) MarshalJSON added in v0.73.0

func (v Supervisor) MarshalJSON() ([]byte, error)

func (*Supervisor) UnmarshalJSON added in v0.73.0

func (v *Supervisor) UnmarshalJSON(b []byte) error

type Timer added in v0.9.0

type Timer struct {
	ID   int       `json:"id"`
	Due  time.Time `json:"due"`
	What string    `json:"what"`
	By   Party     `json:"by"`
	At   time.Time `json:"at"`
	// WakeParkAt binds an execution CI wake to the exact park that created it.
	WakeParkAt time.Time `json:"wakeParkAt,omitzero"`
	// Fired is when a watch reported the timer; it reports it once.
	Fired time.Time `json:"fired,omitzero"`
	// When is a typed condition (pr-merged owner/repo#n, …) and Probe a
	// shell command that exits 0 once its condition holds: from Due, the
	// watch checks it every Every and fires the timer once it holds.
	When  string        `json:"when,omitempty"`
	Probe string        `json:"probe,omitempty"`
	Every time.Duration `json:"every,omitempty"`
	// Checked is when a watch last found the condition not holding, Reason
	// why: what the reference says, or why it could not be read
	// (Unreadable).
	Checked    time.Time `json:"checked,omitzero"`
	Reason     string    `json:"reason,omitempty"`
	Unreadable bool      `json:"unreadable,omitempty"`
	// Failing is the first of the checks in a row whose probe could not
	// run: the guide was told of them once, and is told when it runs again.
	Failing time.Time `json:"failing,omitzero"`
	// Since is the first check that found the condition not holding; Stuck
	// is set once the watch said it has not held for a day.
	Since time.Time `json:"since,omitzero"`
	Stuck bool      `json:"stuck,omitempty"`
	// Until is the end of the wait: past it the timer fires as timed out,
	// or closes unfired when Expire is set.
	Until  time.Time `json:"until,omitzero"`
	Expire bool      `json:"expire,omitempty"`
	// PendingWakeReason retains an already fired occurrence until delivery.
	PendingWakeReason   string `json:"pendingWakeReason,omitempty"`
	PendingWakeTimedOut bool   `json:"pendingWakeTimedOut,omitempty"`
	// Wake is the agent the firing wakes with What; Run a shell command it
	// runs, its exit code logged. Without either the watch's line says it.
	Wake string `json:"wake,omitempty"`
	Run  string `json:"run,omitempty"`
	// Repeat re-arms a timer that wakes or runs at the same local time:
	// daily, weekdays (Monday to Friday) or weekly. Such a timer stays open
	// until marked done.
	Repeat string `json:"repeat,omitempty"`
	// Held is what kept a due timer from firing at its time (a beekeeper
	// stop), said when it fires late; a re-armed timer starts without it.
	Held string `json:"held,omitempty"`
	// contains filtered or unexported fields
}

Timer is a point in time the supervisor has to look at something ("check the rollout after 22:55").

func (Timer) Auto added in v0.56.0

func (t Timer) Auto() bool

Auto reports whether the watch acts on the timer itself and closes it when it fires: a condition to wait on, an agent to wake or a command to run. A plain timer stays open until marked done.

func (Timer) Conditional added in v0.56.0

func (t Timer) Conditional() bool

Conditional reports whether the timer waits on a condition.

func (Timer) Looked added in v0.56.0

func (t Timer) Looked(now time.Time) bool

Looked reports whether someone has to look at the timer by now: a plain timer whose time has come. An auto timer is the watch's to act on.

func (Timer) MarshalJSON added in v0.73.0

func (v Timer) MarshalJSON() ([]byte, error)

func (Timer) Next added in v0.91.0

func (t Timer) Next(now time.Time) time.Time

Next is the first time after now the repeating timer is due again, at its local time of day: a day or a week on, a weekday timer skipping the weekend.

func (*Timer) UnmarshalJSON added in v0.73.0

func (v *Timer) UnmarshalJSON(b []byte) error

type TranscriptGrant

type TranscriptGrant struct {
	ID      int       `json:"id"`
	To      Party     `json:"to"`
	Repo    string    `json:"repo,omitempty"`
	Session string    `json:"session,omitempty"`
	All     bool      `json:"all,omitempty"`
	Reason  string    `json:"reason,omitempty"`
	By      Party     `json:"by"`
	At      time.Time `json:"at"`
	Expires time.Time `json:"expires"`
	// contains filtered or unexported fields
}

TranscriptGrant is the guide's expiring authorization for a worker to read and search transcripts beyond its own repository.

func (TranscriptGrant) Active

func (g TranscriptGrant) Active(now time.Time) bool

Active reports whether the grant holds at now.

func (TranscriptGrant) MarshalJSON

func (v TranscriptGrant) MarshalJSON() ([]byte, error)

func (*TranscriptGrant) UnmarshalJSON

func (v *TranscriptGrant) UnmarshalJSON(b []byte) error

type TranscriptRequest

type TranscriptRequest struct {
	ID      int       `json:"id"`
	By      Party     `json:"by"`
	Repo    string    `json:"repo,omitempty"`
	Session string    `json:"session,omitempty"`
	All     bool      `json:"all,omitempty"`
	Reason  string    `json:"reason"`
	At      time.Time `json:"at"`
	// contains filtered or unexported fields
}

TranscriptRequest is a worker's request to the guide for wider transcript access (another session, another repository, or all transcripts).

func (TranscriptRequest) MarshalJSON

func (v TranscriptRequest) MarshalJSON() ([]byte, error)

func (*TranscriptRequest) UnmarshalJSON

func (v *TranscriptRequest) UnmarshalJSON(b []byte) error

type Urgent added in v0.110.0

type Urgent struct {
	Repo string `json:"repo"`
	PR   int    `json:"pr"`
	// By is who asked for it, Reason why.
	By     Party     `json:"by"`
	Reason string    `json:"reason"`
	At     time.Time `json:"at"`
	// Window is the reset of the budget window the merge ran under the
	// floor in; zero while it waits for its gate.
	Window time.Time `json:"window,omitzero"`
	// Remaining is the budget when it ran, Spent what its run drew from
	// it: nil while it runs, -1 unread.
	Remaining int  `json:"remaining,omitempty"`
	Spent     *int `json:"spent,omitempty"`
	// contains filtered or unexported fields
}

Urgent is a merge marked urgent, a privacy or security fix's: under the GitHub budget floor it runs, once per reset window, while the budget keeps github.urgentBound for it.

func (Urgent) Key added in v0.110.0

func (u Urgent) Key() string

Key is the urgent merge's owner/repo#n.

func (Urgent) MarshalJSON added in v0.110.0

func (v Urgent) MarshalJSON() ([]byte, error)

func (Urgent) Ran added in v0.110.0

func (u Urgent) Ran() bool

Ran says whether the merge ran under the floor in the window that resets at Window.

func (*Urgent) UnmarshalJSON added in v0.110.0

func (v *Urgent) UnmarshalJSON(b []byte) error

type WorkerProblems

type WorkerProblems struct {
	Task       string    `json:"task"`
	AssignedAt time.Time `json:"assignedAt,omitzero"`
	Findings   []string  `json:"findings"`
}

WorkerProblems keeps finding receipts after the watch drains its reports.

type WorkerReport added in v0.93.0

type WorkerReport struct {
	Finished bool      `json:"finished,omitempty"`
	By       Party     `json:"by"`
	At       time.Time `json:"at"`
	Task     string    `json:"task,omitempty"`
	Text     string    `json:"text"`
	Problems []string  `json:"problems,omitempty"`
	// TellTo is who started the desk review this report gives the verdict
	// of: the watch wakes it with the report. GitHub may record the verdict
	// as a plain comment, which nothing reading the review state sees.
	TellTo Party `json:"tellTo,omitzero"`
	// contains filtered or unexported fields
}

WorkerReport is the report a worker finished its task with: what it delivered and the problems it found (broken functions, ways around them, follow-ups). The supervisor's watch prints it once and drops it; the event log keeps it (agents.report, agents.problem).

func (WorkerReport) MarshalJSON added in v0.93.0

func (v WorkerReport) MarshalJSON() ([]byte, error)

func (*WorkerReport) UnmarshalJSON added in v0.93.0

func (v *WorkerReport) UnmarshalJSON(b []byte) error

type Writer added in v0.73.0

type Writer struct {
	Version string `json:"version"`
	// contains filtered or unexported fields
}

Writer is the version of the newest beekeeper that saved the state.

func (Writer) MarshalJSON added in v0.73.0

func (v Writer) MarshalJSON() ([]byte, error)

func (*Writer) UnmarshalJSON added in v0.73.0

func (v *Writer) UnmarshalJSON(b []byte) error

Directories

Path Synopsis
Package kube is the Kubernetes store of `beekeeper serve`: the shared state of the Giant Swarm installations as custom resources of beekeeper.giantswarm.io instead of one document under a file lock.
Package kube is the Kubernetes store of `beekeeper serve`: the shared state of the Giant Swarm installations as custom resources of beekeeper.giantswarm.io instead of one document under a file lock.

Jump to

Keyboard shortcuts

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