link

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 64 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 link carries a room's board to a hub over a connection the ROOM dialled.

── why this exists ─────────────────────────────────────

Atrium today is one process. It serves the board, it holds the database, and it owns a pseudo terminal per running agent. Closing it takes every agent with it, so changing one line of CSS costs you every session on the machine.

That is the whole problem this solves. Split the process in two along the line where the cost is:

HUB   serves index.html, the CSS and the JS. Holds nothing. Owns no
      process. Restart it as often as you like.
ROOM  holds the store, the supervisor and the agents. Serves JSON and
      byte streams. Stays up for days.

The board's JavaScript does not change and does not know. It asks for `/v1/tasks` the way it always did. The hub serves the files it has and hands everything else to the room.

── why the room dials out ──────────────────────────────

Two reasons, and the second is the one that matters.

The obvious one is reachability: a room behind a firewall, on a laptop, or on another account cannot be dialled and does not have to be.

The real one is that a room must not care whether the hub is up. If the hub dialled the room, a hub restart would be a connection refused on the room's side and a reconnect storm on the hub's. Inverted, a hub restart is the room noticing its socket closed and redialling on a backoff it already has. The room is the stable thing. The hub is the disposable thing. The connection points the same way.

── the trick, which is smaller than it sounds ───────────

A room does not learn a new protocol. It serves the http.Handler it already has, on a net.Listener whose Accept returns connections it DIALLED rather than accepted:

http.Serve(reverseListener{hub}, daemon.Handler())

The hub keeps those connections in a pool and speaks ordinary HTTP/1.1 down them. So websockets upgrade, server-sent events stream, and a 400MB file download is a file download, because none of it is being translated. There is no second representation of anything.

── what a transport has to provide ─────────────────────

Exactly two things, which is the point:

hub:  a net.Listener
room: something that returns a net.Conn

`direct.go` is mutual TLS over TCP and is what ships first. OpenZiti and zrok both hand back precisely those two types, so each is a file in this package rather than a change to anything above it.

Index

Constants

View Source
const (
	SettingDeployBinary = deploy.SettingDeployBinary
	SettingDeployScript = deploy.SettingDeployScript
	SettingDeployOwner  = deploy.SettingDeployOwner
)

What the deploy package declares and the rest of this package reaches by its old name.

View Source
const (
	// EffWatchDays is how long after landing a bug or a red CI still counts against the item, and so how long a clean pass
	// stays unproven.
	EffWatchDays = 7
	// EffMinItems is the fewest landed items a figure is trended on.
	EffMinItems = 5
)
View Source
const (
	VerdictClean    = "clean"
	VerdictWatching = "watching"
	VerdictNotClean = "not_clean"
	// VerdictUnproven is an item whose 7 days are over and that cannot be called clean for want of a test fact, or of a CI
	// that could be read. It is left out of the clean-pass rate, since a dash is not a zero.
	VerdictUnproven = "unproven"
)

The verdicts of a landed item.

View Source
const (
	FigCleanPass = "clean_pass"
	FigFirstPass = "first_pass"
	FigSendBacks = "send_backs"
	FigRedAfter  = "red_after"
	FigBugs      = "bugs"
	FigTimeLand  = "time_to_land"
	FigCost      = "cost"
	FigWaste     = "waste"
)

The figures, in the order the view draws them.

View Source
const (
	UnitPct     = "pct"      // a fraction 0..1 of Den
	UnitPerItem = "per_item" // a count per landed item
	UnitSeconds = "seconds"
	UnitUSD     = "usd"
	UnitCount   = "count" // Num of Den
)

The units a figure is in.

View Source
const (
	TransportBoardZiti = "board-ziti"
	TransportRoomZiti  = "room-ziti"
	TransportCIHook    = "ci-hook"
	TransportRoomZrok  = "room-zrok"
)

The names a transport goes by.

View Source
const (
	StepLanded   = "landed"
	StepDeployed = "deployed"
	StepPushed   = "pushed"
)
View Source
const (
	ForgeRoomHeader    = conn.ForgeRoomHeader
	PRClaimPrefix      = conn.PRClaimPrefix
	PRClaimRoomHeader  = conn.PRClaimRoomHeader
	RelaySay           = conn.RelaySay
	RelayPeers         = conn.RelayPeers
	RelayCard          = conn.RelayCard
	RelayExit          = conn.RelayExit
	RelayFind          = conn.RelayFind
	RelayLaunch        = conn.RelayLaunch
	RelayHub           = conn.RelayHub
	RelayHand          = conn.RelayHand
	RoomSpecRoomHeader = conn.RoomSpecRoomHeader
	StreamUpgrade      = conn.StreamUpgrade
	MaxStreams         = conn.MaxStreams
)
View Source
const (
	ReasonPermission = notify.ReasonPermission
	ReasonQuestion   = notify.ReasonQuestion
	ReasonInput      = notify.ReasonInput
	ReasonFinished   = notify.ReasonFinished
	ReasonLogin      = notify.ReasonLogin
	ReasonCI         = notify.ReasonCI
)
View Source
const (

	// RoomSpecPrefix is the path the room asks, and RoomSpecRoomHeader carries the room the hello named.
	RoomSpecPrefix = "/_room/"
	// RoomSpecHashHeader carries the sha256 of the YAML on a spec answer.
	RoomSpecHashHeader = "X-Atrium-Spec-Sha256"
)
View Source
const CIListenerKind = forgepkg.CIListenerKind
View Source
const CardRoomHeader = "X-Atrium-Card-Room"

CardRoomHeader names the room of the card a request claims to be from, with gitsync.HeaderCard for the card.

View Source
const ChatTag = "atrium:chat"

ChatTag marks a card launched with chat: true, which is shown atrium_need and no other control tool.

View Source
const DefaultDept = "general"

DefaultDept is the department a `new:` item is filed under when the launcher has none.

View Source
const DefaultLaunchCap = 10

DefaultLaunchCap is how many concurrent mid-turn workers atrium_launch allows before it refuses. It is the HARD backstop under the advisory soft nudge in the dotfiles redirect hook, so no amount of over-eager agents can flood the box. LaunchCapEnv overrides it for a machine that can take more or fewer.

View Source
const DeptTagPrefix = "dept:"

DeptTagPrefix is the tag that files a card under a department (daemon's deptTagPrefix).

View Source
const DirectorTag = "atrium:director"

DirectorTag is what a launch asks for to be left alone by the merged-cull and not to count against the launch cap: an orchestrator, not a worker.

View Source
const ElevatedTag = "atrium:elevated"

ElevatedTag gives a worker card the launch tools. atrium_need with tool:atrium_launch puts it on.

View Source
const EndLineMax = 20

EndLineMax is the longest line atrium_done takes after the sha, in words.

View Source
const EndReasonMax = 50

EndReasonMax is the longest reason atrium_blocked takes, in words.

View Source
const EverywhereTag = "atrium:everywhere"

EverywhereTag is the mark. Set the way any tag is set.

View Source
const GitWait = gitTimeout

GitWait is gitTimeout for the stdio server's push, which waits on the same git.

View Source
const HeldNote = "held on your launcher's card, not delivered. it reads its notices when it asks, " +
	"so do not say it has been told."

HeldNote is what a worker is told when its report was kept on its launcher's card and not delivered.

View Source
const HumanLinkRule = "a link for the human is ALWAYS a board link, never 127.0.0.1, localhost, a port or file://, " +
	"because those open on your machine and not on theirs. call atrium_link with the path of the file in your card " +
	"and send the url it answers. a mock is static files in your card, not a server"

HumanLinkRule is what a worker is told when its text holds a link the human cannot open.

View Source
const InterviewTag = "atrium:interview"

InterviewTag is the card tag an interview launch carries (daemon.InterviewTag, which a test keeps equal). It is what the room reads to give the card the interviewer's system prompt and to leave it alone when its turn ends on a question.

View Source
const ItemOwnerTag = "atrium:item-owner:"

ItemOwnerTag carries the owner an item launch asked for. See daemon.ItemOwnerTag.

View Source
const ItemReportLine = itemReportLine

ItemReportLine is itemReportLine for the stdio control server and the tests.

View Source
const ItemTag = "atrium:item"

ItemTag marks a card launched with `item`. See daemon.ItemTag.

View Source
const ItemTagPrefix = "item:"

ItemTagPrefix is what a launch tag starts with to name the backlog item the card works on: `item:f-new-thing`.

View Source
const KindInterview = "interview"

KindInterview is the `kind` of an atrium_launch that starts an interviewer.

View Source
const KindReview = "review"

KindReview is the `kind` of an atrium_launch that starts a slop review of the branch in its directory.

View Source
const LaunchCapEnv = "ATRIUM_LAUNCH_CAP"

LaunchCapEnv overrides DefaultLaunchCap when set to a non-negative integer.

View Source
const LaunchRecoveredNote = "NOTE: the room's answer was slow, so the card was found by looking. it is running: do NOT launch it again. " +
	LaunchStartedNote

LaunchRecoveredNote is what a launch says when its answer was lost but the card was found on the room.

View Source
const LaunchStartedNote = "started. its permission requests go to the human on their board, so it will " +
	"stop at the first gated command unless somebody is watching."

LaunchStartedNote is what a launch that took says, after any warning.

View Source
const LearnedMax = 1500

LearnedMax is the longest `learned` atrium_done takes, in bytes: one paragraph. The room's is the same, and cuts.

View Source
const LifetimeWork = "work"

LifetimeWork is the lifetime atrium_launch_worker stamps. It is store.LifetimeWork, which this package does not import.

View Source
const NeedToolDesc = "Say what you lack and why: `mcp:<name>`, `agent:<name>`, `skill:<name>`, `tool:Skill`, " +
	"`tool:Agent`, `tool:atrium_launch` or, on a chat card, `tool:Read`, `tool:Edit`, `tool:Write`, `tool:Grep`, `tool:Glob`, " +
	"`tool:Bash`, `tool:PowerShell` or `tool:WebFetch`. `why` is one line, shown to the human with what you were given.\n\n" +
	"Atrium adds it to your card, restarts you on this conversation and types `continue` once you are back. " +
	"End your turn after calling this. Anything else, such as another tool or a program on PATH, is logged and " +
	"refused: ask your launcher with `atrium_say`. Every call is logged on your card."

NeedToolDesc is atrium_need's description, shared with a room's stdio server.

View Source
const NewItemPrefix = "new:"

NewItemPrefix is how a launch files the backlog item it runs on: `new:a title`.

View Source
const NoItemNote = "no backlog item was attached. "

NoItemNote is what a launch reply says when no item was attached.

View Source
const OriginTag = ctl.OriginTag

OriginTag marks a card that atrium_launch created, as opposed to a session a human started at a terminal or through the board's launch dialog. It is the doer signal the board hides agent-launched cards by. The launch cap does NOT count it: every atrium_launch stamps it, orchestrators and the resident merger included, so counting it charged them all against one cap. See SubagentTag.

HUB-SIDE, SO IT STAYS HUB-ONLY. launchHandler adds it to the tags it forwards on /v1/launch, and the room persists it as an ordinary tag (see store.SetTags), so nothing in internal/daemon has to learn the marker. A tag rather than a new field because tags already flow end to end, and one already lowercase and free of commas and spaces survives NormalizeTags unchanged.

View Source
const (
	PlacedRoomHeader = forgepkg.PlacedRoomHeader
)
View Source
const QueuedNote = "queued for your launcher. it reads it at its next tool call or when its turn ends. stop now."

QueuedNote is what a worker is told when its ending is in its launcher's queue and not yet typed.

View Source
const RecordCmdMax = 300

RecordCmdMax is the longest command a record keeps, in bytes.

View Source
const RecordLogMax = 512 << 10

RecordLogMax is the most log text one call takes, in bytes. The room keeps the tail of a bigger one.

View Source
const ReportLine = reportLine

ReportLine is how a launch prompt ends, for a test outside the package.

View Source
const RerunPrefix = "rerun:"

RerunPrefix is how a launch says it runs an item again that already has a result: `rerun:r-037`.

View Source
const RerunTag = "atrium:rerun"

RerunTag rides a rerun's tags, so the hub that re-reads a relayed launch's item from its tags knows it was said.

View Source
const ResidentReportLine = residentReportLine

ResidentReportLine is how a resident launch prompt ends, for a test outside the package.

View Source
const ResidentTag = "atrium:resident"

ResidentTag marks a long-lived card: atrium_done and atrium_blocked report a task and leave it open.

View Source
const ReviewTag = "atrium:review"

ReviewTag is the card tag a review launch carries (daemon.ReviewTag, which a test keeps equal). The room reads it so the card is not nudged when its turn ends, and the hub reads it to serve atrium_review to this card alone.

View Source
const SettingCapabilityList = "capability_list"

SettingCapabilityList holds the YAML a person edited.

View Source
const SettingExtraHosts = "extra_hosts"

SettingExtraHosts is the hub setting holding the list, as a JSON array.

View Source
const SettingLaunchCaps = "launch_caps"

SettingLaunchCaps names the per-room caps in the hub's setting table.

View Source
const SkippedMax, UnverifiedMax = 1000, 1000

SkippedMax and UnverifiedMax are the longest `skipped` and `unverified` atrium_done takes, in bytes, as WhyMax is.

View Source
const StepTagPrefix = "atrium:step:"

StepTagPrefix starts the tag that says which step of its item a card is for, `atrium:step:<step>`. The same prefix as daemon.StepTagPrefix. The room carries it on the card's first push and the hub files it on the attachment.

View Source
const SubagentTag = "atrium:subagent"

SubagentTag marks a worker an orchestrator launched to do one piece of work. The launch cap counts only mid-turn cards carrying it. The launcher puts it on through `tags`; the hub does not stamp it, so an orchestrator, the resident merger or any other long-lived agent launched without it does not consume the cap its workers share.

View Source
const Version = wire.Version
View Source
const WhyMax = 1000

WhyMax is the longest `why` atrium_done takes, in bytes.

View Source
const WorkTagPrefix = "atrium:item:"

WorkTagPrefix starts the tag that attaches a card to an item, `atrium:item:<backlog id>`. NOT ItemTag, which is whole-string and means isolated. The same prefix as daemon.WorkTagPrefix.

Variables

View Source
var (
	NewCIHook     = forgepkg.NewCIHook
	ParseCIRoutes = forgepkg.ParseCIRoutes
	MergerBranch  = forgepkg.MergerBranch
)
View Source
var (
	Hosts         = transport.Hosts
	MixedListener = transport.MixedListener
	NewCSR        = transport.NewCSR
	ParseToken    = transport.ParseToken
	EnrolOver     = transport.EnrolOver
	MaskShare     = wire.MaskShare

	MintOverlayToken     = transport.MintOverlayToken
	DirectAuthenticated  = transport.DirectAuthenticated
	OverlayAuthenticated = transport.OverlayAuthenticated
)
View Source
var (
	ErrNoGit     = conn.ErrNoGit
	ErrNoRoom    = conn.ErrNoRoom
	ErrRelayDown = conn.ErrRelayDown
	CleanClaim   = conn.CleanClaim
)
View Source
var (
	ErrGrowlNotFound = notify.ErrGrowlNotFound
	ErrGrowlStale    = notify.ErrGrowlStale
	ErrNoSub         = notify.ErrNoSub
)
View Source
var (
	NewNotifier    = notify.NewNotifier
	NewPush        = notify.NewPush
	NewGrowler     = notify.NewGrowler
	NotifyIdentity = notify.NotifyIdentity
)

EffFigureKeys is every figure, in order.

View Source
var ErrAccessNotFound = errors.New("not found")

ErrAccessNotFound is what a HubAccess wraps when the entry or room named does not exist.

View Source
var ErrNoRoomSpec = errors.New("the hub has no spec for this room")

ErrNoRoomSpec is what a room is told when the hub holds no spec for it.

View Source
var ErrNoSSHKeys = errors.New("this hub does not keep ssh keys. update the hub")

ErrNoSSHKeys is what a room is told by a hub that does not keep ssh keys yet.

View Source
var ErrUnknownTransport = errors.New("no such transport")

ErrUnknownTransport is Set's answer for a name the hub has no such item for.

Functions

func AbandonedEvent

func AbandonedEvent(o hubstore.WorkOutcome, reason string) (hubstore.WorkEvent, bool)

AbandonedEvent is the abandoned event an outcome's derivation implies, for the history.

func AddCITool

func AddCITool(s *mcp.Server, d CIDoor)

AddCITool puts the tool on a server that has no class of its own (the stdio one).

func AddEndTools

func AddEndTools(s *mcp.Server, d EndDoor)

AddEndTools puts both tools on a server that has no class of its own (the stdio one).

func AddGitTools

func AddGitTools(s *mcp.Server, d GitDoor)

AddGitTools puts both tools on a server, for a server that has no class or audit of its own (the stdio one). The hub's adds them through registerGit, with its audit line on the push.

func AddRoomBacklogTools

func AddRoomBacklogTools(s *mcp.Server, call func(ctx context.Context, method, path string, body, out any) error,
	by, room string)

AddRoomBacklogTools puts atrium_backlog and atrium_reports on a room's stdio control server. call reaches the hub's /_hub/backlog and /_hub/reports through the room, and by and room are the session's own handle and room name, which the stdio server has no request headers to read. The hub stamps both again from the link, so they are only a label.

func AddRoomCapabilityTool added in v0.0.5

func AddRoomCapabilityTool(s *mcp.Server, call func(ctx context.Context, method, path string, out any) error)

AddRoomCapabilityTool is atrium_capabilities on the stdio server, which has no class of its own.

func AddRoomDropTools added in v0.0.6

func AddRoomDropTools(s *mcp.Server, call func(ctx context.Context, method, path string, body, out any) error)

AddRoomDropTools is atrium_files and atrium_get on a room's stdio server.

func AddRoomGateTool added in v0.1.0

func AddRoomGateTool(s *mcp.Server, set func(ctx context.Context, body map[string]string) (string, bool, error))

AddRoomGateTool puts atrium_gate on a room's stdio control server. Set posts the gate for the caller's card and returns the card's id.

func AddRoomItemTools

func AddRoomItemTools(s *mcp.Server, call func(ctx context.Context, method, path string, body, out any) error, by, room string)

AddRoomItemTools puts atrium_item on a room's stdio control server. call reaches the hub through the room, and by is the session's handle and room, which the hub stamps again from the link.

func AddRoomMergeTool

func AddRoomMergeTool(s *mcp.Server, d MergeDoor)

AddRoomMergeTool puts atrium_merge on a room's stdio control server.

func AddRoomPublishTool

func AddRoomPublishTool(s *mcp.Server, call func(ctx context.Context, method, path string, body, out any) error, by string)

AddRoomPublishTool is atrium_publish on a room's stdio server.

func AddRoomWorktreesTool added in v0.0.6

func AddRoomWorktreesTool(s *mcp.Server, me, room string,
	ask func(ctx context.Context, wait time.Duration, method, path string, body, out any) error)

AddRoomWorktreesTool is atrium_worktrees on a room's stdio server, asked of its own room, which is the only one it reaches without the hub.

func Adhoc

func Adhoc(w hubstore.Work) bool

Adhoc is whether an item is one no backlog item named, which has no design to approve.

func AgentLaunchTags

func AgentLaunchTags(callerTags []string) []string

AgentLaunchTags is what an agent launch's tags become: the caller's own, the origin marker, and a WORKER marker unless the caller says it is a director or already a subagent. The merged-cull only ever touches workers, so the default has to be the one that can be culled and the exception has to be asked for. Shared by the hub's atrium_launch and a room's stdio one (internal/cli), so the two cannot drift.

func BugsNaming

func BugsNaming(backlog []hubstore.BacklogItem, known map[string]bool) []hubstore.WorkEvent

BugsNaming are the bug_filed events for every item the backlog's bugs name. A bug that names an item with the tag `atrium:item:<id>` is observed, since filing through `--item` writes it. One that says `fixes <id>` is reported: somebody linked it by hand.

func CIEvents

func CIEvents(id, sha string, landed time.Time, points []CIPoint, contains func(build, sha string) bool) []hubstore.WorkEvent

CIEvents are the ci_red and ci_green events one item's landing earned. A red commit names the item when the item's sha is in its failing range: the red commit holds it and the last green one before it did not. Only the first red of a run counts, since the rest are the same breakage, and the first green after it ends it.

func CheckBlockedReason

func CheckBlockedReason(reason string) string

CheckBlockedReason is why a reason is refused, or "": 1 to 50 words, split on whitespace. Newlines are fine.

func CheckDoneSHA

func CheckDoneSHA(sha string) string

CheckDoneSHA is why a commit id is refused, or "".

func CheckHumanLinks(texts ...string) string

CheckHumanLinks is why text is refused, or "": it holds an address only the worker's own machine can open.

func DeptOfTags

func DeptOfTags(tags []string) string

DeptOfTags is the department a card's tags file it under, or "".

func DeriveOutcome

func DeriveOutcome(in EffIn) hubstore.WorkOutcome

DeriveOutcome is the whole outcome of one item.

func EffVerdict

func EffVerdict(now, watchEnd time.Time, sendBacks int, firstPass string, red bool, bugs, reverts int, ciKnown bool) (verdict, reason string)

EffVerdict says whether a landed item earned the clean pass: no send-back at any step, a first-pass test pass, and no CI red, bug or revert, for the 7 days. Anything already wrong is `not_clean` at once, since time cannot undo it. A clean item is `watching` until the 7 days end, and `unproven` when they end with no test fact or no readable CI.

func FactEvents

func FactEvents(id string, facts []hubstore.WorkFact) []hubstore.WorkEvent

FactEvents are the events the item's facts say, which are the same every time they are read, so writing them twice writes them once. The fact kinds `test`, `review` and `not_accepted` are L4's and the accept verb's: until they are written here there are none, and the figures say dash.

func FetchRoomSpec

func FetchRoomSpec(ctx context.Context, d Dialer, room string) (yaml []byte, sha256 string, err error)

FetchRoomSpec asks the hub for this room's own spec over the room link. d is the room's dialer and room its name. It answers the YAML bytes and their sha256, or ErrNoRoomSpec when the hub has none.

func Figures

func Figures(items []*effView, a, b time.Time) (landed int, figs map[string]EffFigure)

Figures computes every roll-up for the items that landed in [a, b), and the waste of those given up on in it.

func IDSet

func IDSet(rows []LaunchRow) map[string]bool

IDSet is the ids of rows, for PickLaunched's snapshot.

func IsBug

func IsBug(b hubstore.BacklogItem) bool

IsBug says whether a backlog row is a bug: its id starts `b-`, or its department is `bugs`, or its body says `kind: bug`.

func ItemBrief

func ItemBrief(ctx context.Context, call HubCall, id string) string

ItemBrief is the text to put above a brief for a card attached to id, or "" when the hub cannot say. It never fails a launch: a launch is not refused for a hub being slow.

func ItemFolder

func ItemFolder(id string) string

ItemFolder is where an item's logs live on a machine, `~/.atrium/items/<backlog id>/`.

func LandedAt

func LandedAt(steps []hubstore.WorkStepRow) string

LandedAt is when an item landed, from its `landed` step: the end of the step, which is when the hub first read the branch on claude/main. Empty when it has not.

func LaunchDroppedWarning

func LaunchDroppedWarning(missed []string) string

LaunchDroppedWarning is the sentence put ahead of the note when a room dropped launch options, empty when it dropped none. The session is running, and exiting it is the caller's call.

func LaunchOptionsDropped

func LaunchOptionsDropped(model, effort string, args []string, env map[string]string,
	gotModel, gotEffort string, gotArgs, gotEnvKeys []string) []string

LaunchOptionsDropped names the launch options that were asked for and that the card the room handed back does not carry, which is how an older room that ignored them shows. See docs/runtime/launch-options-design.md "Version skew". Shared with the stdio control MCP in internal/cli, so the two cannot drift.

func LeanAgentsDropped

func LeanAgentsDropped(agents, skills, gotTags []string) []string

LeanAgentsDropped names "lean_agents" and "lean_skills" when they were asked for and the card the room handed back carries no `atrium:agent:` or `atrium:skill:` tag, which is how a room that ignored the fields shows. Shared with the stdio control MCP.

func LoadExtraHosts

func LoadExtraHosts(st HubSettings)

LoadExtraHosts applies the stored list to every listener. Called once as the hub starts. A store that fails or a value that will not parse applies nothing, which is the names the listeners already had.

func NotAcceptedNote

func NotAcceptedNote(msg, id string) (reason string, ok bool)

NotAcceptedNote says whether an orchestrator's message to a card is a "not accepted" for an item, and the reason after it. This is the reported way to arrive at measure 3, until the accept verb records it: the message names the item and starts with the words.

func NoteSHA

func NoteSHA(note string) string

NoteSHA is the commit an assignment's finishing note names, or "". The room puts the sha of an atrium_done in the note.

func ParseDecision

func ParseDecision(text string) string

ParseDecision is the note's first line when it is a Decision line, else "".

func ParseDocPath

func ParseDocPath(p string) (slug string, n int, ok bool)

ParseDocPath reads /d/<slug> and /d/<slug>@<n>.

func PickLaunched

func PickLaunched(known map[string]bool, cwd string, rows []LaunchRow) string

PickLaunched is the card a launch made in `cwd`, or "" when there is none. A card is the launch's when its id was NOT in `known`, the ids listed just before the post, and its worktree is `cwd`.

NO CLOCK IS COMPARED. The hub proxies to rooms on other machines, and created_at is the room's clock. Of several new cards the latest created wins, which compares two stamps from the same room.

func PostRoomLock

func PostRoomLock(ctx context.Context, d Dialer, room string, lock []byte) error

PostRoomLock sends this room's lock, a JSON object holding version 1, to the hub over the room link, where it replaces the last. d is the room's dialer and room its name. The hub never changes the spec because of it.

func PublishSSH

func PublishSSH(ctx context.Context, d Dialer, room string, in SSHPublish) error

PublishSSH sends this room's login user and public key to the hub over the room link. d is the room's dialer.

func RenderItemBrief

func RenderItemBrief(d WorkDetail) string

RenderItemBrief is the header: the item, one line per step, and the folder.

func ResolveItem

func ResolveItem(ctx context.Context, call HubCall, spec, dept, by, room string) (id string, filed bool, err error)

ResolveItem turns an item argument into the backlog id a card is attached to.

  • An id must be a backlog item the hub holds. A hub that answers "no such item" refuses the launch. A hub that does not answer does NOT: a launch is not refused for a hub being down, and the attach waits in the room's outbox.
  • An id whose item already has a result is refused unless it is said as `rerun:<id>`.
  • An empty spec is no item: it returns "" and no error.
  • `new:<title>` files the backlog item first, under dept (the launcher's, else DefaultDept), and attaches to it. Filing needs the hub, so a hub that is not answering refuses it.

func ReviewBrief

func ReviewBrief(base, callerBrief string) string

ReviewBrief is reviewBrief for a caller outside this package, the launch command.

func RoomForNeeds added in v0.0.5

func RoomForNeeds(v CapabilityView, needs []string, room string, named bool, now time.Time) (string, error)

RoomForNeeds is roomForNeeds for the stdio server, which places an unnamed launch before it asks the hub.

func Scope

func Scope(kind string, paths []string) (hub, rooms bool, skip string)

Scope is where an item's files deploy: whether the hub must run them, whether the rooms must, and the words when neither does.

func SplitRow

func SplitRow(started, ended time.Time, wins []stepWindow, home string) (steps []string, weights []int64)

SplitRow says which steps a row of one card belongs to and in what ratio, the weights in milliseconds of the row's own time spent in each step (6.4). A row inside one step is that step alone. A row that crosses a boundary is divided in the time ratio. A row inside no window goes to the nearest step the card has, the first before them all and the last after. A card with no window at all is on its home step.

func StepLines

func StepLines(d WorkDetail) []string

StepLines is one line per step, in order, from the stored step rows: `tested: done at 1a2b3c4 (observed). ...`. A step the hub has no row for reads as pending.

func StepOfCard

func StepOfCard(c hubstore.WorkCard) string

StepOfCard is the step a card is for. A card attached with no step is a builder: that is what every launch was before the step was named.

func SuperleanDropped

func SuperleanDropped(asked bool, gotTags []string) bool

SuperleanDropped is true when superlean was asked for and the card the room handed back carries no `atrium:superlean` tag, which is how a room older than the field shows: it ignored it and started the worker lean. Shared with the stdio control MCP.

func ViewOf

func ViewOf(w hubstore.Work, o hubstore.WorkOutcome, observedOnly bool, now time.Time) *effView

ViewOf is one outcome as a query sees it.

func WithItemBrief

func WithItemBrief(brief, header string) string

WithItemBrief puts the item's header ahead of a brief, once. A brief that has one already is returned as it is.

func WithItemReportLine

func WithItemReportLine(prompt string) string

WithItemReportLine is WithReportLine for an item.

func WithItemTags

func WithItemTags(ctx context.Context, call HubCall, tags []string, id string) []string

WithItemTags is WithWorkTag after taking out each tag that is the bare id of a backlog item the hub holds, so an item is named by its work tag alone. A bare id the hub does not answer for stays as given.

func WithLauncherDept

func WithLauncherDept(tags, launcherTags []string) []string

WithLauncherDept passes the launching card's department on: the first `dept:*` tag of the launcher is added to the launch's tags unless the caller's own already carry one. A launcher with no dept tag, or none known, stamps nothing. Shared by the hub's atrium_launch and a room's stdio one, like AgentLaunchTags, so a director's workers file under its department.

func WithReportLine

func WithReportLine(prompt string, resident bool) string

WithReportLine ends a launch prompt with the one line of the worker contract a prompt most often leaves out. An empty prompt stays empty: there is nothing to scope.

func WithStepTag

func WithStepTag(tags []string, step string) ([]string, error)

WithStepTag puts the step tag on a launch's tags, replacing one that is there. A step that is not one of the eight is refused, naming them, before a card exists.

func WithWorkTag

func WithWorkTag(tags []string, id string) []string

WithWorkTag puts the attachment tag on a launch's tags, unless one is there.

func WorkOfTags

func WorkOfTags(tags []string) string

WorkOfTags is the backlog id a launch's tags attach it to, or "".

Types

type AuditEntry

type AuditEntry struct {
	ID     string    `json:"id"`
	At     time.Time `json:"at"`
	Room   string    `json:"room,omitempty"`
	Kind   string    `json:"kind"`
	Detail string    `json:"detail,omitempty"`
}

AuditEntry is one operational event, shaped for the board.

Room is a name, empty for a hub-level line. It is the room's own field rather than tagged, because the audit pane is a hub view and the board reads the name straight.

type AuditLog

type AuditLog interface {
	// Record writes one line. room is a name, empty for a hub-level event. Best
	// effort: it must never block or fail the thing being recorded.
	Record(room, kind, detail string)
	// Recent reads the log newest first, optionally filtered by room name and
	// kind. Empty filters match everything.
	Recent(limit int, room, kind string) ([]AuditEntry, error)
}

AuditLog is what the proxy needs to record and read operational events.

type BuildSeen

type BuildSeen struct {
	// Name is the room's name, or "hub".
	Name string `json:"name"`
	// Commit is what it reported, empty from a build that does not say.
	Commit string `json:"commit,omitempty"`
	// Contains is that the commit holds the landed sha. Known is false when the mirror does not have the commit, which
	// is a build older than anything the hub holds.
	Contains bool `json:"contains"`
	Known    bool `json:"known"`
}

BuildSeen is one process's running commit as the hub compared it with the landed sha.

type CIAnswer

type CIAnswer = forge.CIAnswer

type CIBinder

type CIBinder = forgepkg.CIBinder

What the forge package declares and the rest of this package reaches by its old name.

type CIDoor

type CIDoor struct {
	// Ask puts a CI question to the hub and answers what its forge said.
	Ask func(ctx context.Context, req *mcp.CallToolRequest, in forge.HubCIAsk) (forge.HubCI, error)
}

CIDoor is atrium_ci, ONE CODE for the two servers that offer it, as GitDoor is for the git tools: the hub's control over HTTP (registerGit) and a room's stdio `atrium control` (internal/cli/control_ci.go). What differs is how each reaches the hub's forge, which the door is given. The tool is read only and runs no forge CLI where it is called.

func (CIDoor) AskRepo

func (d CIDoor) AskRepo(ctx context.Context, req *mcp.CallToolRequest, repo string, a forge.HubCIAsk) (forge.HubCI, error)

AskRepo is one CI question about `repo`, said as atrium_ci takes it. `atrium ci` asks through it too.

func (CIDoor) Call

func (d CIDoor) Call(ctx context.Context, req *mcp.CallToolRequest, in ciInput) (*mcp.CallToolResult, forge.HubCI, error)

Call is atrium_ci.

type CIHook

type CIHook = forgepkg.CIHook

What the forge package declares and the rest of this package reaches by its old name.

type CIPoint

type CIPoint struct {
	SHA    string
	At     time.Time
	Result string // red or green
}

CIPoint is the CI result of one commit on main: green when every finished run of it passed, red when one failed.

func PointsOf

func PointsOf(runs []forge.CIRunInfo) []CIPoint

PointsOf turns CI runs into one point per commit, oldest first. A commit with any failed run is red. Runs still going and runs cancelled or skipped say nothing.

type CIRoute

type CIRoute = forgepkg.CIRoute

What the forge package declares and the rest of this package reaches by its old name.

type CITarget

type CITarget = forge.CITarget

type CapResults added in v0.0.5

type CapResults interface {
	CapabilityPut(rows []hubstore.CapabilityRow) error
	CapabilityLatest() ([]hubstore.CapabilityRow, error)
}

CapResults is the hub's store of results.

type CapabilityList added in v0.0.5

type CapabilityList struct {
	YAML    string `json:"yaml"`
	Version int    `json:"version"`
	Hash    string `json:"hash,omitempty"`
}

CapabilityList is the hub's declared list, and Version is the one its YAML names.

type CapabilityMatch added in v0.0.5

type CapabilityMatch struct {
	Room    string            `json:"room"`
	Online  bool              `json:"online"`
	OK      bool              `json:"ok"`
	Stale   bool              `json:"stale,omitempty"`
	Results map[string]string `json:"results"`
}

CapabilityMatch is one room and how it measures against a need.

func CapabilityWhich added in v0.0.5

func CapabilityWhich(v CapabilityView, need []string, fresh time.Duration, now time.Time) []CapabilityMatch

CapabilityWhich is the rooms that can do everything in need. A room is OK only when it is online and each need passed no longer ago than fresh. A room whose passes are all there but older is a candidate with Stale set, and an offline room is never OK. Optional changes how a failure is shown, never whether a need was met.

type CapabilityRoom added in v0.0.5

type CapabilityRoom struct {
	Name    string   `json:"name"`
	Online  bool     `json:"online"`
	Checked string   `json:"checked,omitempty"`
	Running []string `json:"running,omitempty"`
}

CapabilityRoom is one room's column.

type CapabilityView added in v0.0.5

type CapabilityView struct {
	Caps    []json.RawMessage        `json:"caps"`
	Rooms   []CapabilityRoom         `json:"rooms"`
	Results []hubstore.CapabilityRow `json:"results"`
}

CapabilityView is what the board draws, and what `atrium_capabilities` answers from.

type CardState

type CardState = conn.CardState

type CommandSink

type CommandSink = notify.CommandSink

What the notify package declares and the rest of this package reaches by its old name.

type CostLine

type CostLine struct {
	Tokens tokenprice.Tokens `json:"tokens"`
	// TotalTokens is every token of every type, so a bar is drawn without adding.
	TotalTokens int64 `json:"total_tokens"`
	// Usd is the dollars of what was priced, a number to compute with. Display is what to show: `-`, `?` or `$1.23`.
	Usd   float64 `json:"usd"`
	Cents int64   `json:"cents"`
	// Units is the amount exactly, in 1e-10 dollar, which is what adds: steps plus coordination are the total in Units
	// to the last digit, where each rounded to the cent may differ from the rounded total by one.
	Units   int64  `json:"units"`
	Display string `json:"display"`
	// Known is false when some of the tokens are of a model with no price, which Display says as `?`.
	Known          bool     `json:"known"`
	UnpricedTokens int64    `json:"unpriced_tokens,omitempty"`
	UnpricedModels []string `json:"unpriced_models,omitempty"`
}

CostLine is one sum, as the board reads it.

type CostView

type CostView struct {
	// Estimated is always true: list price for the tokens, not a bill.
	Estimated bool `json:"estimated"`
	// Prices is the version of the table the dollars were worked out on.
	Prices string `json:"prices"`
	// Steps is all eight, in order, `-` where nothing was spent.
	Steps []StepCost `json:"steps"`
	// Headline is the steps alone, to be shown with HeadlineSuffix.
	Headline       CostLine `json:"headline"`
	HeadlineSuffix string   `json:"headline_suffix"`
	// Coordination is the relay and the orchestrator's spend because the item exists, never in a step.
	Coordination CostLine `json:"coordination"`
	// Total is the steps plus coordination, for the detail.
	Total CostLine `json:"total"`
	// Summary is the sentence the page may print as it stands.
	Summary string `json:"summary"`
	Rows    int    `json:"rows"`
}

CostView is what an item cost.

func ItemCost

func ItemCost(tb tokenprice.Table, cards []hubstore.WorkCard, steps []hubstore.WorkStepRow, rows []hubstore.WorkUsageRow, now time.Time) CostView

ItemCost prices an item's rows and divides them across its steps.

type CoverView

type CoverView struct {
	Total, Covered, Held int
	TipCovered           bool
}

CoverView is deployready's coverage, in the words the engine needs.

type Deliverer

type Deliverer = forge.Deliverer

type DepsStore

type DepsStore interface {
	AddGates(repo, item string, waits []itemgate.Target, why, addedBy string) ([]itemgate.Gate, error)
	Gates(repo, item string, openOnly bool) ([]itemgate.Gate, error)
	Gate(id string) (itemgate.Gate, error)
	HasOpenGates() (bool, error)
	GateMet(id, by, why string) (bool, error)
	GateTold(ids []string) error
	PendingTells() ([]itemgate.Gate, error)
	RenameItem(repo, from, to, by string) (int, error)
	ItemNames(repo, id string) ([]string, error)
}

DepsStore is what the gates need of the hub's database. hubstore.Store has every method.

type DeriveIn

type DeriveIn struct {
	Work        hubstore.Work
	Cards       []hubstore.WorkCard
	Assignments []hubstore.Item
	Facts       []hubstore.WorkFact
	Doc         DocView
	// Stored are the rows L3 wrote for landed, deployed and pushed, which are read from git and not derived here. They are
	// taken as they stand, so the item's current step goes on past building.
	Stored []hubstore.WorkStepRow
	// Evidence is what git says of the branch for tested and reviewed. The zero value is "git could not be read".
	Evidence Evidence
}

DeriveIn is everything Derive reads.

type Dialer

type Dialer = wire.Dialer

type Direct

type Direct = transport.Direct

type DocView

type DocView struct {
	// Known is whether git could be read at all. False leaves a done step done: an unreadable hub is no evidence the doc moved.
	Known bool
	// Latest is the newest commit that changed the design doc, at or after the designer's. It is what an approval pins.
	Latest string
	// Since is how many commits changed the doc after the approved one, 0 with no approval.
	Since int
}

DocView is what git says of the design doc, read by the engine before it calls Derive.

type DocsFileGit

type DocsFileGit interface {
	FileAt(ctx context.Context, sha, path string) (text string, found bool, err error)
}

DocsFileGit is what the check asks of the hub's repository: a file as a commit held it. The repository the LandGit reads answers it when it can, and without it the note is left out.

type DocsOffer

type DocsOffer struct {
	ID    string `json:"id"`
	Title string `json:"title,omitempty"`
}

DocsOffer is "close d-7?": a doc worker's item has landed and its doc item is still open.

type DocsView

type DocsView struct {
	// NotSaid is a landed feature whose change file says nothing of its docs.
	NotSaid bool `json:"not_said,omitempty"`
	// Offer is a landed doc worker's item, offered once for closing.
	Offer *DocsOffer `json:"offer,omitempty"`
}

DocsView is the `docs` of GET /_hub/work/<id>. Both fields empty is nothing to say and the answer leaves it out.

type EffAbandoned

type EffAbandoned struct {
	ID     string   `json:"id"`
	Title  string   `json:"title"`
	Reason string   `json:"reason,omitempty"`
	Usd    *float64 `json:"usd"`
}

EffAbandoned is one item given up on.

type EffBug

type EffBug struct {
	ID     string `json:"id"`
	At     string `json:"at"`
	Source string `json:"source"`
}

EffBug is a bug filed against an item.

type EffDetail

type EffDetail struct {
	FiledAt string `json:"filed_at,omitempty"`
	// SendBacks and SendBacksReported are counts by kind: design, review, not_accepted.
	SendBacks         map[string]int `json:"send_backs"`
	SendBacksReported map[string]int `json:"send_backs_reported"`
	// ByStep and ByStepReported are the same counts by the step they were sent back from.
	ByStep         map[string]int `json:"by_step"`
	ByStepReported map[string]int `json:"by_step_reported"`
	// FirstPassAt is when the first test result was seen. FirstPassReported says the result is somebody's say-so.
	FirstPassAt       string `json:"first_pass_at,omitempty"`
	FirstPassReported bool   `json:"first_pass_reported,omitempty"`
	// RedEpisodes counts the reds that name the item, RedOpen says the last has not gone green.
	RedEpisodes int  `json:"red_episodes"`
	RedOpen     bool `json:"red_open,omitempty"`
	// CIKnown is whether CI could be read since the item landed. A clean pass is not given without it.
	CIKnown bool     `json:"ci_known"`
	Bugs    []EffBug `json:"bugs,omitempty"`
	Reverts []string `json:"reverts,omitempty"`
	// RevertAt is the time of each revert, parallel to Reverts.
	RevertAt []string `json:"revert_at,omitempty"`
	// StepSeconds is each step's window, TestSeconds the tested window alone, TotalSeconds filed (or launched) to landed.
	StepSeconds  map[string]int64 `json:"step_seconds,omitempty"`
	TestSeconds  int64            `json:"test_seconds,omitempty"`
	TotalSeconds int64            `json:"total_seconds,omitempty"`
	// LongestWait is the longest single wait on the human, and the step it was on.
	LongestWaitStep    string `json:"longest_wait_step,omitempty"`
	LongestWaitSeconds int64  `json:"longest_wait_seconds,omitempty"`
	CostRows           int    `json:"cost_rows"`
	Reason             string `json:"reason,omitempty"`
}

EffDetail is the JSON an outcome keeps beside its columns: what the roll-ups and the item's strip need that a column cannot say.

func ParseEffDetail

func ParseEffDetail(o hubstore.WorkOutcome) EffDetail

ParseEffDetail reads an outcome's detail, empty when it is not there.

type EffFigure

type EffFigure struct {
	Key  string `json:"key"`
	Unit string `json:"unit"`
	// Value is nil for a dash: nothing reached the step, so there is nothing to say, which is not zero.
	Value *float64 `json:"value"`
	Num   int      `json:"num"`
	Den   int      `json:"den"`
	// Greyed is a denominator under EffMinItems. The figure is still shown, with its count, and is not trended.
	Greyed bool `json:"greyed"`
	// Source is observed, or reported when ReportedN of the items counted leaned on a reported input.
	Source    string             `json:"source"`
	ReportedN int                `json:"reported_n"`
	Parts     map[string]float64 `json:"parts,omitempty"`
}

EffFigure is one roll-up for one period.

type EffGit

type EffGit interface {
	RepoName() string
	RevertScan(ctx context.Context) ([]gitsync.Revert, error)
}

EffGit is what the lifecycle's git reach adds for efficacy: the repository's name, and the reverts on it.

type EffIn

type EffIn struct {
	Work        hubstore.Work
	Steps       []hubstore.WorkStepRow
	Assignments []hubstore.Item
	Events      []hubstore.WorkEvent
	Cost        CostView
	// Backlog is the item's backlog row, nil when the hub holds none.
	Backlog *hubstore.BacklogItem
	// CIKnown is whether CI could be read on this pass.
	CIKnown bool
	Now     time.Time
}

EffIn is everything DeriveOutcome reads.

type EffItem

type EffItem struct {
	Outcome hubstore.WorkOutcome `json:"outcome"`
	Detail  EffDetail            `json:"detail"`
	Events  []hubstore.WorkEvent `json:"events"`
	Mark    *EffMark             `json:"mark,omitempty"`
	// Sources says which of its figures lean on a reported input.
	Reported bool `json:"reported"`
}

EffItem is the `efficacy` object of an item's detail.

type EffItemRow

type EffItemRow struct {
	ID       string  `json:"id"`
	Title    string  `json:"title"`
	Dept     string  `json:"dept,omitempty"`
	LandedAt string  `json:"landed_at"`
	Mark     EffMark `json:"mark"`
	// SendBacks is the words for it ("2 send-backs", "first test failed", "0 send-backs").
	SendBacks    string   `json:"send_backs"`
	TotalSeconds int64    `json:"total_seconds"`
	Usd          *float64 `json:"usd"`
	// Reported is that a reported input went into the mark or the count.
	Reported bool `json:"reported"`
}

EffItemRow is one landed item in the list under the roll-ups.

type EffMark

type EffMark struct {
	Kind string `json:"kind"`
	Text string `json:"text"`
	// Tone is good, watch or bad, which the board draws in teal, the neutral chip and orange.
	Tone string `json:"tone"`
	// Rank orders worst first.
	Rank int `json:"rank"`
}

EffMark is the one word an item carries: the worst thing that happened to it, or that it was clean.

func MarkOf

func MarkOf(o hubstore.WorkOutcome, now time.Time) (EffMark, bool)

MarkOf is an item's mark, from its outcome. An item that has not landed has none.

type EffPeriod

type EffPeriod struct {
	Key   string `json:"key"`
	Start string `json:"start"`
	End   string `json:"end"`
	// Partial is the current period, drawn open.
	Partial bool `json:"partial"`
	Landed  int  `json:"landed"`
	// TooFew is a period with fewer than EffMinItems landed items: "too few to trend".
	TooFew  bool                 `json:"too_few"`
	Figures map[string]EffFigure `json:"figures"`
}

EffPeriod is one day or week.

type EffReport

type EffReport struct {
	By           string `json:"by"`
	ObservedOnly bool   `json:"observed_only"`
	Now          string `json:"now"`
	Zone         string `json:"zone"`
	// Periods is oldest to newest, the last being This.
	Periods []EffPeriod `json:"periods"`
	// Compare is the period before This, cut to the same days when This is partial.
	Compare EffPeriod           `json:"compare"`
	Trends  map[string]EffTrend `json:"trends"`
	Wrong   EffWrong            `json:"wrong"`
	// SendBacksByStep is this period's send-backs by the step they were sent back from.
	SendBacksByStep map[string]int `json:"send_backs_by_step"`
	Time            struct {
		Median       int64  `json:"median"`
		Work         int64  `json:"work"`
		Wait         int64  `json:"wait"`
		CI           int64  `json:"ci"`
		P90Step      string `json:"p90_step"`
		P90          int64  `json:"p90"`
		LongWaitStep string `json:"long_wait_step"`
		LongWait     int64  `json:"long_wait"`
		LongWaitItem string `json:"long_wait_item"`
	} `json:"time"`
	Abandoned      []EffAbandoned `json:"abandoned"`
	AbandonedTotal *float64       `json:"abandoned_total"`
	Landed         []EffItemRow   `json:"landed"`
	// Prices says what the dollars were worked out on: estimated, at list price.
	Estimated bool     `json:"estimated"`
	Notes     []string `json:"notes"`
}

EffReport is the whole answer of GET /_hub/work/efficacy.

func BuildEfficacy

func BuildEfficacy(in EffReportIn) EffReport

BuildEfficacy answers the roll-ups for the query.

type EffReportIn

type EffReportIn struct {
	Works        []hubstore.Work
	Outcomes     map[string]hubstore.WorkOutcome
	Events       map[string][]hubstore.WorkEvent
	By           string // day or week
	From, To     time.Time
	ObservedOnly bool
	// Now carries the zone: days and weeks are cut in it.
	Now time.Time
}

EffReportIn is what a report is built from.

type EffTrend

type EffTrend struct {
	// Verdict is better, worse, same, too_few or none (nothing to compare).
	Verdict string `json:"verdict"`
	// Dir is the way the number went: up, down or flat.
	Dir   string   `json:"dir"`
	Delta *float64 `json:"delta,omitempty"`
	Text  string   `json:"text"`
	// Was is the figure the comparison was made with, so the view can say "was 0 of 6".
	Was *EffFigure `json:"was,omitempty"`
}

EffTrend is one figure this period against the last, to the same days.

func TrendOf

func TrendOf(this, last EffFigure, thisLanded, lastLanded int) EffTrend

TrendOf compares a figure with the one before it, to the same days.

type EffWrong

type EffWrong struct {
	Red      int    `json:"red"`
	Bugs     int    `json:"bugs"`
	Reverts  int    `json:"reverts"`
	Total    int    `json:"total"`
	Was      int    `json:"was"`
	Reported int    `json:"reported"`
	Source   string `json:"source"`
}

EffWrong is the tile of what went wrong after landing, by the day it happened.

type EndDoor

type EndDoor struct {
	// Report files the body as the caller's report and answers what the room recorded.
	Report func(ctx context.Context, req *mcp.CallToolRequest, body map[string]any) (EndOutput, error)
}

EndDoor is the two tools for a server, given how each reaches the room's report endpoint.

func (EndDoor) Blocked

func (d EndDoor) Blocked(ctx context.Context, req *mcp.CallToolRequest, in blockedInput) (
	*mcp.CallToolResult, EndOutput, error)

Blocked is atrium_blocked.

func (EndDoor) Done

func (d EndDoor) Done(ctx context.Context, req *mcp.CallToolRequest, in doneInput) (
	*mcp.CallToolResult, EndOutput, error)

Done is atrium_done.

type EndOutput

type EndOutput struct {
	Recorded     bool   `json:"recorded"`
	Status       string `json:"status"`
	LauncherTold any    `json:"launcher_told"`
	Note         string `json:"note,omitempty"`
	RunnerExits  bool   `json:"runner_exits,omitempty"`
}

EndOutput is what either tool answers.

type EventHook

type EventHook = forgepkg.EventHook

What the forge package declares and the rest of this package reaches by its old name.

type Evidence

type Evidence struct {
	// Known is that the branch was read, so Tip is the tip. False leaves a done step done: an unreadable hub is no evidence
	// the branch moved.
	Known bool
	Tip   string
	// Since is, per commit a test was recorded at, how many commits of work the branch has gained after it. -1 is "no longer
	// on the branch".
	Since map[string]int
	// Cover is what the verdict trailers say of the item's own commits, and CoverKnown that it could be read.
	Cover      CoverView
	CoverKnown bool
}

Evidence is what the hub read of the item's branch for the tested and reviewed steps (item lifecycle L4).

type EvidenceGit

type EvidenceGit interface {
	ItemEvidence(ctx context.Context, branch string, shas []string) (gitsync.Evidence, error)
}

EvidenceGit is what the tested and reviewed steps read of the hub's repository. The same value that is a LandGit may also be this one. Nil, or a branch the hub does not hold, is "git could not be read" and the steps are derived from the facts alone.

type FirstRun added in v0.0.6

type FirstRun interface {
	Facts() FirstRunFacts
	LocalRoom(name string) error
	JoinString(name string) (string, error)
}

FirstRun is what the board's first-run panel asks of the hub: who this machine is, a room for this machine, and a join string for another one. The cli supplies it, since it owns the room's launch and the keys.

type FirstRunFacts added in v0.0.6

type FirstRunFacts struct {
	Machine string `json:"machine"`
	User    string `json:"user"`
	Room    string `json:"room"`
	OS      string `json:"os"`
}

FirstRunFacts is what the connect panel prefills. User is who the room runs as.

type FlowGit

type FlowGit interface {
	ItemFacts(ctx context.Context, branch, sha string) (gitsync.ItemFacts, error)
	CoveredBy(ctx context.Context, base, sha string) (bool, error)
	// EpochPlan is what a reset of claude/main onto main has to carry over. EpochMove does the reset, as epoch n, onto
	// the tip of branch ("" for main), when claude/main is still expectOld. See flow_epoch.go.
	EpochPlan(ctx context.Context) (gitsync.EpochPlan, error)
	EpochMove(ctx context.Context, n int64, branch, expectOld string) (oldTip, newTip string, err error)
}

FlowGit is the hub's repository as the flow reads it. Nil is no git: the stage is what was reported.

type FlowView

type FlowView struct {
	hubstore.FlowItem
	Git *gitsync.ItemFacts `json:"git,omitempty"`
	// TestedOn is the check shas that cover the item, DeployedOn the rooms that run it, BehindRooms the rooms that
	// have reported a deploy and do not run it yet.
	TestedOn    []string `json:"tested_on,omitempty"`
	DeployedOn  []string `json:"deployed_on,omitempty"`
	BehindRooms []string `json:"behind_rooms,omitempty"`
	Note        string   `json:"git_note,omitempty"`
}

FlowView is an item as the flow reads it: the stored record with the stage git and the records give it.

type ForgeSettings

type ForgeSettings = forgepkg.ForgeSettings

What the forge package declares and the rest of this package reaches by its old name.

type GitDoor

type GitDoor struct {
	// Card is the calling card's id, or the sentence saying there is none.
	Card func(ctx context.Context, req *mcp.CallToolRequest) (string, error)
	// IsCard says whether the caller is a card, whose URLs go on its room's forwarder.
	IsCard func(req *mcp.CallToolRequest) bool
	// Room asks the caller's room's board. long is a git push's bound rather than a quick call's.
	Room func(ctx context.Context, req *mcp.CallToolRequest, long bool, method, path string, body, out any) error
	// Lookup is the hub's answer to the query of GET /_hub/git/url.
	Lookup func(ctx context.Context, req *mcp.CallToolRequest, q url.Values) (gitsync.URLAnswer, error)
	// Older says whether an error is a bare 404, which is a room older than the endpoint.
	Older func(err error) bool
}

GitDoor is atrium_git_push and atrium_git_url, ONE CODE for the two servers that offer them: the hub's control over HTTP (controlMCP.gitDoor) and a room's stdio `atrium control` (internal/cli/control_git.go). What differs is only how each reaches the caller's room and the hub's lookup, which the door is given.

func (GitDoor) Push

func (d GitDoor) Push(ctx context.Context, req *mcp.CallToolRequest, in gitPushInput) (
	*mcp.CallToolResult, gitPushOutput, error)

Push is atrium_git_push: the room pushes one plain branch from the caller's own card's directory, with its token.

func (GitDoor) URL

func (d GitDoor) URL(ctx context.Context, req *mcp.CallToolRequest, in gitURLInput) (
	*mcp.CallToolResult, gitURLOutput, error)

URL is atrium_git_url.

A CARD FETCHES THROUGH ITS OWN ROOM'S FORWARDER. The URLs the lookup gives are on the address it reached the hub by, which is no address at all to a card on another room. So for a card the hub's URLs are rewritten onto its room's forwarder base (the path after /git/ is the same), the room being the one that knows its agent port. A room that does not say, or says something that is not a forwarder on its own loopback, leaves the card with no URL and the sentence why, not a wrong one. A room's work in progress has no forwarder route yet, so a card is given no URL for it (gitsync.ForCard).

type GitInput

type GitInput struct {
	Kind  string
	Facts gitsync.LandFacts
	// HaveBranch is that the item has a build branch the hub holds, so `landed` is being waited on rather than unstarted.
	HaveBranch bool
	Hub        BuildSeen
	Rooms      []BuildSeen
}

GitInput is everything DeriveGit reads.

type GitSettings

type GitSettings = forgepkg.GitSettings

What the forge package declares and the rest of this package reaches by its old name.

type GitStep

type GitStep struct {
	Step   string
	State  string
	SHA    string
	Reason string
	// Waiting are the processes whose build lacks the landed sha, for `deployed`, in name order.
	Waiting []string
}

GitStep is one derived step.

func DeriveGit

func DeriveGit(in GitInput) []GitStep

DeriveGit answers landed, deployed and pushed, in that order.

type GrowlRow

type GrowlRow = notify.GrowlRow

What the notify package declares and the rest of this package reaches by its old name.

type GrowlStore

type GrowlStore = notify.GrowlStore

What the notify package declares and the rest of this package reaches by its old name.

type Growler

type Growler = notify.Growler

What the notify package declares and the rest of this package reaches by its old name.

type Hub

type Hub = conn.Hub

func NewHub

func NewHub(t Timings) *Hub

NewHub makes an empty hub with an everywhere index.

type HubAccess added in v0.0.4

type HubAccess interface {
	View() any
	SaveAuth(body []byte) error
	Add(ctx context.Context, body []byte) error
	Revoke(id string) error
	OpenUp(id, account string) error
	Approve(room string) error
}

HubAccess is the hub's list of ways in, as the Accessing Atrium screen reads and writes it. The cli package implements it over the hub's store, so this package never learns the hub has a database. Bodies are the screen's JSON.

type HubCall

type HubCall func(ctx context.Context, method, path string, body, out any) error

HubCall is one call to the hub's own endpoints, however the caller reaches them.

type HubDictation added in v0.1.0

type HubDictation interface {
	On() bool
	Transcribe(ctx context.Context, wav []byte, words []string) (string, error)
}

HubDictation turns a clip into text on the hub's own whisper-server. On is false until the operator sets one.

func NewHubDictation added in v0.1.0

func NewHubDictation(conf func() (string, string), url ...func() string) HubDictation

NewHubDictation is speech to text on the hub, with conf answering the whisper-server and model paths. A url func, when given, names a shared whisper-server and wins over the paths.

type HubRecognisers

type HubRecognisers = forgepkg.HubRecognisers

What the forge package declares and the rest of this package reaches by its old name.

type HubSettings

type HubSettings interface {
	HubSetting(name string) (string, error)
	SetHubSetting(name, value string) error
}

HubSettings is what the caps need from the hub's database. hubstore.Store has both methods.

type HubTransports

type HubTransports struct {
	Store HubSettings
	// Hub receives each item's listener row. May be nil.
	Hub   *Hub
	Audit func(kind, detail string)
	// IdentityFallback is the identity an item with none of its own uses: the hub's --atrium-identity.
	IdentityFallback string
	// CheckIdentity is asked before an item is turned on or given an identity. Nil accepts anything.
	CheckIdentity func(path string) error
	// CloseIdentity ends an identity's ziti context. Nil is zitictx.Close.
	CloseIdentity func(identity string)
	// Wait, First and Cap are the bind loop's, see CIBinder.
	Wait  func(ctx context.Context, d time.Duration) bool
	First time.Duration
	Cap   time.Duration
	// contains filtered or unexported fields
}

HubTransports keeps the hub's transports bound, or not, as the settings say.

func (*HubTransports) Add

func (t *HubTransports) Add(it TransportItem, seed TransportSeed)

Add registers an item with what the command line said, which wins over what is stored.

func (*HubTransports) Effective

func (t *HubTransports) Effective(name string) (bool, string)

Effective is whether an item is on and the service it binds. An item never added is off.

func (*HubTransports) Set

func (t *HubTransports) Set(name string, on *bool, service, identity *string) (TransportView, error)

Set turns an item on or off and changes its service or identity, each only when given. Changing the service or the identity of one that is on binds it again. The values in force are stored, so a flag that seeded them stops winning. A refusal reads "refused: ...".

func (*HubTransports) Start

func (t *HubTransports) Start(ctx context.Context)

Start binds every item that is on, and keeps them bound until ctx ends.

func (*HubTransports) View

func (t *HubTransports) View() []TransportView

View is every item, in the order they were added.

type Inventory

type Inventory interface {
	Known() ([]Known, error)
	// MarkRoom puts a room on its way out, or takes the mark back off.
	MarkRoom(name string, marked bool) error
	// ForgetRoom drops a room's durable record, so it disappears from the
	// picker and the rooms tab.
	//
	// FORGET, NOT BAN. It removes what the hub wrote down and nothing else: the
	// machine is untouched, and a room that dials in again is written down afresh
	// and reappears. The caller refuses an attached room before calling this, the
	// same division startsNothing and changeInventory follow, because attachment
	// is a live socket this package cannot see from a durable record.
	ForgetRoom(name string) error
	// Remembered is what a room last said it was holding.
	//
	// ONLY EVER CALLED FOR A ROOM THAT IS NOT ANSWERING. A connected room is
	// asked, every time, and its answer is the answer. This is what the board
	// draws instead of nothing for a machine somebody shut.
	Remembered(name string) ([]CardState, error)
	// Holding names every room that has connected before and has cards
	// remembered for it, whether or not it is here now.
	//
	// ASKED ON EVERY LIST THE BOARD DRAWS, so it has to be one cheap question.
	// It decides whether there is anything to merge at all, which is why it
	// cannot be worked out by reading every room and counting its cards.
	Holding() ([]string, error)
	// HubSkin is the skin the ALL view wears, which is the hub's own and not a
	// room's. Empty means unset, read by the serving side as the default. See
	// `hubSettings` in fanout.go.
	HubSkin() (string, error)
	// SetHubSkin records the skin the ALL view wears, which is how a skin saved
	// while looking at all rooms lands somewhere instead of being refused for
	// want of a room.
	SetHubSkin(name string) error
	// HubCardColors and SetHubCardColors are the board's card colours, the hub's own like the skin.
	HubCardColors() (cardcolors.Colors, error)
	SetHubCardColors(c cardcolors.Colors) error
	// BoardAuto reports the hub-wide auto-approve flag: whether it is on, and
	// when it stops (nil for no deadline). Board policy, held by the hub and
	// enforced hub-side on the permission relay, so it reaches every session the
	// instant a request appears, whatever room registered it. See
	// `autoapprove.go` and `docs/runtime/auto-mode.md`.
	BoardAuto() (on bool, until *time.Time, err error)
	// SetBoardAuto turns the hub-wide flag on (optionally with a deadline) or
	// off, which is how the board's ALL view lands the toggle somewhere instead
	// of being refused for want of a room.
	SetBoardAuto(on bool, until *time.Time) error
}

Inventory is a hub that knows which rooms exist, not only which are here.

AN INTERFACE FOR THE SAME REASON `OwnRoom` IS ONE. Knowing which rooms exist means a database, and this package holds none and must not learn to. Whoever builds the hub implements it, and a hub without one answers the inventory with what is attached, which is what a hub with no store can honestly say. ── WHAT THE BOARD MAY DO TO A ROOM, AND WHAT IT MAY NOT ─

It may read the list, and it may mark a room for deletion or take that mark back off. Marking destroys nothing and is one click to undo, which is the whole reason decision 9 made it the reversible step.

IT MAY NOT MINT A JOIN STRING, and that is not an oversight. Atrium has no login: it is loopback, and reaching it from elsewhere is an overlay's job. A board that could mint one would mean anybody who can open that page can enrol a machine that runs agents, and a board served over an overlay is exactly the case that matters. So adding a room, replacing its join string and forgetting it are things somebody does at a terminal ON the hub, where being there is the credential.

That line is where it already was: the join dialog has always said what to run rather than minting anything.

type ItemSpec

type ItemSpec struct {
	ID    string
	Title string
	// Rerun is `rerun:<id>`: a launch on an item that already has a result, said on purpose.
	Rerun bool
}

ItemSpec is what an item argument says: an id of a backlog item, or a title to file one under.

func ParseItemSpec

func ParseItemSpec(spec string) (ItemSpec, error)

ParseItemSpec reads an item argument. Empty is no item, and an id that is not one is refused with what an id looks like.

type Keys

type Keys = transport.Keys

type Known

type Known struct {
	Name string `json:"name"`
	// SelfName is what the machine calls itself. Observed, shown beside the
	// name, never instead of it.
	SelfName string `json:"self_name,omitempty"`
	// Transport earns a badge and never a column. See docs/hub-room-requirements.
	Transport string `json:"transport"`
	// Via and Fallback are the live half of the transport: what the room is
	// attached over right now, and whether that is its first choice. Empty while
	// it is not attached.
	Via      string `json:"via,omitempty"`
	Fallback bool   `json:"fallback,omitempty"`
	// Starved is attached in name only: no data connection is arriving, so the
	// board cannot reach it. See Attached.Starved.
	Starved bool   `json:"starved,omitempty"`
	State   string `json:"state"`
	// Attached is the live half, from this hub's own connection list rather
	// than from anything written down.
	Attached bool `json:"attached"`
	// Since is when the current connection was made, and is nothing when there
	// is no current connection.
	Since *time.Time `json:"since,omitempty"`
	// FirstSeen being absent is what "never connected" means, and it is the one
	// state that draws nowhere but this tab.
	FirstSeen *time.Time `json:"first_seen,omitempty"`
	LastSeen  *time.Time `json:"last_seen,omitempty"`
	// ClearedAt is when this room last said, while connected, that it holds
	// nothing. It is what a removal rests on, and the board draws it as the
	// difference between a room waiting to be tidied and one that is ready.
	ClearedAt *time.Time `json:"cleared_at,omitempty"`
	Host      string     `json:"host,omitempty"`
	Version   string     `json:"version,omitempty"`
	// Cards is how many this room was last holding, from the cache. Only worth
	// showing when the room is not attached, and worth saying is a memory.
	Cards int `json:"cards"`
	// Waiting is a join string minted and not yet used.
	Waiting bool `json:"waiting"`
	// RemoteAccess is what an attached room said about its ssh switch. Observed, and the hub cannot change it.
	RemoteAccess *RemoteAccess `json:"remote_access,omitempty"`
	// LoginNeeded is why an attached room says its claude login needs doing. See Attached.LoginNeeded.
	LoginNeeded string `json:"login_needed,omitempty"`
	// DiskLow is the room's disk notice. See Attached.DiskLow.
	DiskLow string `json:"disk_low,omitempty"`
	// HostRunaway is the room's host watch lines. See Attached.HostRunaway.
	HostRunaway string `json:"host_runaway,omitempty"`
	// Paths is each rung as the room last reported it, with the hub's own listeners laid over. See MergePaths.
	Paths []PathState `json:"paths,omitempty"`
}

Known is one room as the rooms tab sees it: what the hub has written down about it, and whether it is answering right now.

THE TWO HALVES COME FROM DIFFERENT PLACES AND MUST NOT BE CONFUSED. The record is durable and is the hub's own truth. `Attached` is a socket in this process. A room can be one without the other in both directions: added this morning and never dialled in, or dialled in and holding cards while somebody marks it for deletion.

type LandGit

type LandGit interface {
	LandFacts(ctx context.Context, branch, sha, workID string, forge func() gitsync.ForgeMain) (gitsync.LandFacts, error)
	// ForgeMain asks the forge for its main, or answers the last answer unless force.
	ForgeMain(ctx context.Context, force bool) gitsync.ForgeMain
	Contains(ctx context.Context, build, sha string) (contains, known bool, err error)
}

LandGit is the hub's repository as the lifecycle reads landing, pushing and builds. Nil is no git: the steps stay pending.

type LaunchCaps

type LaunchCaps struct {
	// Default is the cap for a room not in Rooms. Nil means launchCap().
	Default *int `json:"default,omitempty"`
	// Rooms is keyed by room name, matched the way every room name is.
	Rooms map[string]int `json:"rooms,omitempty"`
}

LaunchCaps is how many live workers each room may run.

func (LaunchCaps) For

func (lc LaunchCaps) For(room string) int

For is the cap for one room.

type LaunchRow

type LaunchRow struct {
	ID, Worktree, Created string
}

LaunchRow is the part of a card the launch recovery reads, so the hub's launch and the stdio control server's launch share one rule without sharing a card type.

type Lifecycle

type Lifecycle struct {
	Steps []hubstore.WorkStepRow `json:"steps"`
	// State is the item's own: blocked, running, queued or finished. Derived, never stored on its own.
	State string `json:"state"`
	// Current is the first step that is not done or skipped, empty when there is none.
	Current string `json:"current"`
	// Waiting is who the item waits on right now: `human` for an approval (or a question), else empty.
	Waiting string `json:"waiting,omitempty"`
	// Ready is tested and reviewed at the tip with the test SEEN by atrium. A reported test never makes it true, and NotReady
	// says what is missing.
	Ready    bool   `json:"ready"`
	NotReady string `json:"not_ready,omitempty"`
}

Lifecycle is what Derive answers.

func Derive

func Derive(in DeriveIn) Lifecycle

Derive is the engine. The facts are in the order they were written.

type MergeDoor

type MergeDoor struct {
	Call func(ctx context.Context, method, path string, body, out any) error
	By   func(req *mcp.CallToolRequest) string
	Here MergeHere
}

MergeDoor is atrium_merge for one server. Call reaches /_hub/merge, By is the caller as <card>@<room>, Here the caller's worktree, nil where the server has none.

func (MergeDoor) Handle

func (d MergeDoor) Handle(ctx context.Context, req *mcp.CallToolRequest, in mergeInput) (*mcp.CallToolResult, mergeOutput, error)

Handle answers one call.

type MergeHere

type MergeHere func(ctx context.Context) (repo, branch, sha string, err error)

MergeHere is the repository, branch and sha of the caller's worktree, for a request that leaves them out.

type Notice

type Notice = notify.Notice

What the notify package declares and the rest of this package reaches by its old name.

type Notifier

type Notifier = notify.Notifier

What the notify package declares and the rest of this package reaches by its old name.

type NotifyStatus

type NotifyStatus = notify.NotifyStatus

What the notify package declares and the rest of this package reaches by its old name.

type NotifyStore

type NotifyStore = notify.NotifyStore

What the notify package declares and the rest of this package reaches by its old name.

type PRClaimAnswer

type PRClaimAnswer = conn.PRClaimAnswer

type PRClaimMove

type PRClaimMove = forgepkg.PRClaimMove

What the forge package declares and the rest of this package reaches by its old name.

type PageChangeGit

type PageChangeGit interface {
	PageChangedSince(ctx context.Context, since, path string) (gitsync.PageChange, bool, error)
}

PageChangeGit is what the page-changed hint asks of the hub's repository: the newest commit on the mirror's main after `since` that changed `path`, false when none did. The repository the LandGit reads answers it when it can. Without it, or on any error, the hint is left out.

type PathState

type PathState = wire.PathState

type Proven

type Proven = transport.Proven

type Proxy

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

Proxy serves the board from a hub.

func NewProxy

func NewProxy(hub *Hub, board fs.FS, boardID string, room func() string) *Proxy

NewProxy wires a hub, its board and a room chooser into one handler.

`boardID` is the hash of the board being served. Empty turns the rewrite off, which is right for a test and wrong for a running hub.

func (*Proxy) ApplyInputLag

func (p *Proxy) ApplyInputLag()

func (*Proxy) CollectEfficacy

func (p *Proxy) CollectEfficacy(ctx context.Context, now time.Time) error

CollectEfficacy writes the events and derives every outcome. now is the clock, a parameter so a test sets it.

func (*Proxy) Deliverer

func (p *Proxy) Deliverer() Deliverer

Deliverer is the hub's own say path, through the control server's resolution and post.

func (*Proxy) ForgeHelper

func (p *Proxy) ForgeHelper(host string) string

func (*Proxy) GitCards

func (p *Proxy) GitCards(ctx context.Context, room, card string) (gitsync.CardState, error)

func (*Proxy) MergePruneRoom

func (p *Proxy) MergePruneRoom(room string)

func (*Proxy) MovePRClaim

func (p *Proxy) MovePRClaim(key, to string) (hubstore.PRClaim, error)

func (*Proxy) MovePRClaimWith

func (p *Proxy) MovePRClaimWith(ctx context.Context, key, to, walker string) (PRClaimMove, error)

func (*Proxy) NewEventHook

func (p *Proxy) NewEventHook(st *hubstore.Store, from string, audit func(kind, detail string)) *EventHook

func (*Proxy) NewReminders added in v0.0.4

func (p *Proxy) NewReminders(st *hubstore.Store) *Reminders

NewReminders is the hub's reminders with its growler, its say path and its audit wired.

func (*Proxy) PullRoomUsage

func (p *Proxy) PullRoomUsage(ctx context.Context, room string, now time.Time) (PullStats, error)

PullRoomUsage reads one room's rows and keeps the ones that belong to an item. It leaves the cursor where it was on any failure, so the next tick reads the same span again.

func (*Proxy) PullWorkUsage

func (p *Proxy) PullWorkUsage(ctx context.Context) []PullStats

PullWorkUsage reads every attached room that holds a card of an item.

func (*Proxy) PushContextLimits

func (p *Proxy) PushContextLimits(room string)

func (*Proxy) PushInputLag

func (p *Proxy) PushInputLag(room string)

func (*Proxy) PushWorkerPolicy

func (p *Proxy) PushWorkerPolicy(room string)

func (*Proxy) RecordAudit

func (p *Proxy) RecordAudit(room, kind, detail string)

RecordAudit persists one operational event and nudges any watching board.

TWO THINGS, AND THE SECOND IS A DELTA, NOT STATE. The line is written to the log, and an `audit` event is emitted on the hub stream carrying only that something happened. The pane re-fetches on that delta, and again on reconnect, which is the same self-healing the rest of this stream rests on. See events.go. A board with the pane closed pays nothing.

Best effort throughout: a hub with no audit wiring records nothing and the nudge is dropped by `emit` like any other event nobody is watching.

func (*Proxy) RefreshAllGitSteps

func (p *Proxy) RefreshAllGitSteps(ctx context.Context, force bool)

RefreshAllGitSteps derives every item that still has something to learn. force says to ask the forge again whatever it last said, which a mirror pass and a collect do and a timer or a room attaching does not: the forge is asked ONCE per pass, for every item together, and at most every five minutes otherwise. It is what a collect, a mirror pass and a room dialing in call, and it never fails the caller: a read that cannot be made leaves the stored steps as they were.

func (*Proxy) RefreshGitSteps

func (p *Proxy) RefreshGitSteps(ctx context.Context, id string, forge func() gitsync.ForgeMain) ([]hubstore.WorkStepRow, error)

RefreshGitSteps derives the git steps of one item and stores them. An item with no branch has none to derive and is left alone. It answers the rows it stored.

func (*Proxy) RoomsChanged

func (p *Proxy) RoomsChanged()

RoomsChanged tells the hub something a board draws about a room has changed.

For the places outside this package that know first: a join string spent, a room's `cleared_at` written by an announcement. It says nothing about what changed. The hub reads its own store and decides whether there is news.

func (*Proxy) RunCapabilityWatch added in v0.0.5

func (p *Proxy) RunCapabilityWatch(ctx context.Context)

RunCapabilityWatch reads attached rooms' capabilities until ctx ends.

func (*Proxy) RunDeps

func (p *Proxy) RunDeps(ctx context.Context)

RunDeps re-checks open gates every minute and tells each waiter once when its item is clear, until ctx ends. An idle hub, with no open gate and nobody owed a word, pays one read a minute.

func (*Proxy) RunEfficacy

func (p *Proxy) RunEfficacy(ctx context.Context)

RunEfficacy collects every effTick until ctx ends, the first a moment after the hub is up.

func (*Proxy) RunGitSteps

func (p *Proxy) RunGitSteps(ctx context.Context)

RunGitSteps derives the git steps every gitStepsTick until ctx ends. A collect, a mirror pass and a room attaching derive sooner, through RefreshAllGitSteps.

func (*Proxy) RunMerges

func (p *Proxy) RunMerges(ctx context.Context)

func (*Proxy) RunSetupWatch

func (p *Proxy) RunSetupWatch(ctx context.Context)

RunSetupWatch reads attached rooms' setup until ctx ends.

func (*Proxy) RunTasks

func (p *Proxy) RunTasks(ctx context.Context)

RunTasks is the 30 second tick: a task whose room was away, or whose item was busy, gets its turn without a change.

func (*Proxy) RunWorkUsage

func (p *Proxy) RunWorkUsage(ctx context.Context)

RunWorkUsage pulls the rooms' usage every usagePullTick until ctx ends.

func (*Proxy) ServeHTTP

func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP is the rule.

func (*Proxy) SetAuditLog

func (p *Proxy) SetAuditLog(a AuditLog)

SetAuditLog wires the operational audit log up. Optional.

func (*Proxy) SetBacklog

func (p *Proxy) SetBacklog(st *hubstore.Store)

SetBacklog wires the backlog and the reports. Without it /_hub/backlog and /_hub/reports answer 404.

func (*Proxy) SetBoardViews

func (p *Proxy) SetBoardViews(roots []string, hash func(fs.FS) string) (bad []string)

SetBoardViews turns the board views on, for worktrees under these roots, with hash as the build id of a tree (`api.BoardID`). No roots, the default, leaves them off and every `*.localhost` name a 404. It returns the roots it could not use, which do not exist or are not directories.

func (*Proxy) SetCIDir

func (p *Proxy) SetCIDir(dir string)

func (*Proxy) SetCIHook

func (p *Proxy) SetCIHook(h *CIHook)

func (*Proxy) SetCIRuns

func (p *Proxy) SetCIRuns(f func(context.Context) ([]CIPoint, error))

SetCIRuns says how CI on main is read, one answer per commit. Unset, the hub's own forge door is used.

func (*Proxy) SetCapabilities added in v0.0.5

func (p *Proxy) SetCapabilities(st CapResults)

SetCapabilities hands the proxy the store results are kept in.

func (*Proxy) SetChangeRequests

func (p *Proxy) SetChangeRequests(st *hubstore.Store)

SetChangeRequests wires the change requests. Without it /_hub/change-requests answers 404.

func (*Proxy) SetControl

func (p *Proxy) SetControl(boardAddr string)

func (*Proxy) SetDeployReady

func (p *Proxy) SetDeployReady()

SetDeployReady turns the state on. A hub that never calls it answers /_hub/deploy-ready with 404.

func (*Proxy) SetDeps

func (p *Proxy) SetDeps(st DepsStore, build string)

SetDeps wires item gates. `build` is the hub's own build commit. Optional: without it /_hub/deps answers 404 and launches are never checked.

func (*Proxy) SetDictateInstall added in v0.1.0

func (p *Proxy) SetDictateInstall(dir string)

SetDictateInstall gives the proxy the enable switch: downloads into dir, then fills in the two paths and warms the server. The hub owns the whisper-server it starts, in a job that dies with it (internal/daemon/dictate).

func (*Proxy) SetDictation added in v0.1.0

func (p *Proxy) SetDictation(d HubDictation)

SetDictation gives the proxy the hub's speech to text.

func (*Proxy) SetDocs

func (p *Proxy) SetDocs(st *hubstore.Store)

SetDocs wires the document store. Optional: a hub without one answers /_hub/docs 404.

func (*Proxy) SetEvents

func (p *Proxy) SetEvents(h *EventHook)

func (*Proxy) SetFirstRun added in v0.0.6

func (p *Proxy) SetFirstRun(f FirstRun)

SetFirstRun wires the first-run answers. A hub run with `--no-room` and no way to start one never calls it.

func (*Proxy) SetFlowGit

func (p *Proxy) SetFlowGit(g FlowGit)

SetFlowGit wires the repository the merge flow reads.

func (*Proxy) SetForge

func (p *Proxy) SetForge(st ForgeSettings, run forge.Runner)

func (*Proxy) SetGit

func (p *Proxy) SetGit(g *gitsync.Hub)

func (*Proxy) SetGitSettings

func (p *Proxy) SetGitSettings(s GitSettings, hubDir string)

func (*Proxy) SetGrowler

func (p *Proxy) SetGrowler(g *Growler)

func (*Proxy) SetHubAccess added in v0.0.4

func (p *Proxy) SetHubAccess(a HubAccess)

SetHubAccess makes the hub answer `/v1/access` in the ALL view.

func (*Proxy) SetHubAuth added in v0.0.4

func (p *Proxy) SetHubAuth(view func() any, save func([]byte) error)

SetHubAuth makes the hub answer `/v1/auth` in the ALL view with the sign-in in front of its own published board, rather than borrowing a room's. view never carries the secret.

func (*Proxy) SetHubBuild

func (p *Proxy) SetHubBuild(commit string)

SetHubBuild says which commit this hub's own binary was built from, for `deployed`. Empty says nothing, and the hub is then counted as not holding the sha.

func (*Proxy) SetInventory

func (p *Proxy) SetInventory(s Inventory)

SetInventory wires the durable room list up. Optional.

STARTS THE AUTO-APPROVER, because the hub-wide flag it enforces lives in this store. A hub with no inventory has no flag to hold and so no approver: the permission chain is then whatever each room's own gate does, exactly as before. See autoapprove.go.

func (*Proxy) SetItems

func (p *Proxy) SetItems(st *hubstore.Store)

SetItems wires the store the items live in. Without it /_hub/items answers 404.

func (*Proxy) SetLandGit

func (p *Proxy) SetLandGit(g LandGit)

SetLandGit wires the repository the git steps read.

func (*Proxy) SetLaunchCaps

func (p *Proxy) SetLaunchCaps(st HubSettings)

SetLaunchCaps wires the store the caps are kept in. Optional: without it every room gets launchCap().

func (*Proxy) SetLiveBoard added in v0.2.0

func (p *Proxy) SetLiveBoard(hash func(fs.FS) string, parts func(fs.FS) (css, rest string))

SetLiveBoard makes the root board's version follow the files on disk.

func (*Proxy) SetNotify

func (p *Proxy) SetNotify(n *Notifier)

func (*Proxy) SetPRClaims

func (p *Proxy) SetPRClaims(st *hubstore.Store)

func (*Proxy) SetPush

func (p *Proxy) SetPush(x *Push)

func (*Proxy) SetReminders added in v0.0.4

func (p *Proxy) SetReminders(h *Reminders)

SetReminders turns reminders on for this hub. A hub that never calls it answers /_hub/remind 404.

func (*Proxy) SetResourcesDir

func (p *Proxy) SetResourcesDir(dir string)

SetResourcesDir names the state dir resources.md is read from. Without it the tool says there is no file.

func (*Proxy) SetRoomSpecs

func (p *Proxy) SetRoomSpecs(st *hubstore.Store)

SetRoomSpecs wires the store the room link serves a room's spec and lock from. Without it the room link answers 404 and /_hub/rooms/<name>/spec 404.

func (*Proxy) SetRunningCommit

func (p *Proxy) SetRunningCommit(commit string)

SetRunningCommit says which commit this hub's own binary was built from.

func (*Proxy) SetStop added in v0.0.6

func (p *Proxy) SetStop(stop func())

SetControl mounts the hub-side control MCP server at /_hub/mcp.

`boardAddr` is this hub's own board listen address, e.g. `:7778`. The control tools reach the hub's API over loopback derived from it, so they inherit the proxy's scoping and offline-room behaviour rather than reimplementing it. Optional: a hub that never calls this answers /_hub/mcp with 404. SetStop lets a loopback `POST /v1/shutdown` end this hub. The rooms behind it are never stopped through it.

func (*Proxy) SetTransports

func (p *Proxy) SetTransports(t *HubTransports)

SetTransports gives the proxy the hub's transports, answered at /_hub/transports.

func (*Proxy) WaitWork

func (p *Proxy) WaitWork(limit time.Duration) bool

WaitWork waits up to limit for the goroutines goWork started, and says whether they all finished. The hub's store closes after it, and a call still running then would hold the database file.

type PullStats

type PullStats struct {
	Room  string `json:"room"`
	Read  int    `json:"read"`
	Kept  int    `json:"kept"`
	Added int    `json:"added"`
	Since string `json:"since"`
}

PullStats is what one room's pull did.

type Push

type Push = notify.Push

What the notify package declares and the rest of this package reaches by its old name.

type PushStore

type PushStore = notify.PushStore

What the notify package declares and the rest of this package reaches by its old name.

type RecordOut

type RecordOut struct {
	Recorded bool   `json:"recorded"`
	Item     string `json:"item"`
	AtSHA    string `json:"at_sha"`
	Dirty    bool   `json:"dirty,omitempty"`
	Branch   string `json:"branch"`
	Tag      string `json:"tag"`
	// Tested is how the tested step reads after this: its state and the words.
	Tested string `json:"tested"`
	Ready  bool   `json:"ready"`
	Note   string `json:"note,omitempty"`
}

RecordOut is what a record answers.

type RelayAnswer

type RelayAnswer = conn.RelayAnswer

type RelayEvent

type RelayEvent = conn.RelayEvent

type RelayPeer

type RelayPeer = conn.RelayPeer

type RelayTask

type RelayTask = conn.RelayTask

type Reminders added in v0.0.4

type Reminders struct {
	Store   *hubstore.Store
	Growler func() *Growler
	Deliver Deliverer
	// Audit writes one hub-level line. Nil records nothing.
	Audit func(kind, detail string)
	// Now is the clock, injected by tests.
	Now func() time.Time
}

Reminders is the endpoint and the loop that brings each due reminder.

func (*Reminders) Pass added in v0.0.4

func (h *Reminders) Pass(ctx context.Context)

Pass brings every reminder that is due. A growler already raised for one is not raised again, so a pass that stopped half way, or a restart, is safe to run over.

func (*Reminders) Run added in v0.0.4

func (h *Reminders) Run(ctx context.Context)

Run passes on a ticker until ctx ends.

func (*Reminders) Serve added in v0.0.4

func (h *Reminders) Serve(w http.ResponseWriter, r *http.Request)

Serve is /_hub/remind. Loopback only, like the events routes.

type RemoteAccess

type RemoteAccess = wire.RemoteAccess

type RestartAsk

type RestartAsk = wire.RestartAsk

type Result

type Result = notify.Result

What the notify package declares and the rest of this package reaches by its old name.

type Room

type Room = conn.Room

type SSHEntry

type SSHEntry struct {
	hubstore.RoomSSH
	// Online says the room is attached to this hub right now.
	Online bool `json:"online"`
}

SSHEntry is one room in the set.

func FetchSSHSet

func FetchSSHSet(ctx context.Context, d Dialer, room string) ([]SSHEntry, error)

FetchSSHSet asks the hub for every room's published key and login user.

type SSHPublish

type SSHPublish struct {
	User string `json:"user"`
	Key  string `json:"key"`
	Port int    `json:"port"`
	On   bool   `json:"on"`
}

SSHPublish is what a room says about its own ssh.

type Sink

type Sink = notify.Sink

What the notify package declares and the rest of this package reaches by its old name.

type StashRetentionSettings

type StashRetentionSettings = forgepkg.StashRetentionSettings

What the forge package declares and the rest of this package reaches by its old name.

type StepCost

type StepCost struct {
	// Name, not `step`: an item's detail holds this beside its own steps, and a reader looking for one must not find the other.
	Step string `json:"name"`
	CostLine
}

StepCost is one step's spend.

type StreamError

type StreamError = conn.StreamError

type Timings

type Timings = wire.Timings

type Told

type Told string

Told is the room's launcher_told: "queued" when the report is in the launcher's queue and will be typed at its turn end, "relayed" when it went to another room's launcher, "held" when it was kept on the launcher's card for it to read, true as an older room answered for a queued one, and false when nobody was told. A worker that read `true` for a held report said "the orchestrator has been told", and nobody had. See daemon/finish.go.

const (
	ToldNobody Told = ""
	ToldYes    Told = "true"
	ToldHeld   Told = "held"
	// ToldQueued and ToldRelayed are what finish answers now: true is never answered for a queue row.
	ToldQueued  Told = "queued"
	ToldRelayed Told = "relayed"
)

func (Told) Any

func (t Told) Any() bool

Any is whether anybody was told, held or not.

func (*Told) UnmarshalJSON

func (t *Told) UnmarshalJSON(b []byte) error

UnmarshalJSON takes the bool older rooms answer as well as "held".

func (Told) Value

func (t Told) Value() any

Value is what a tool answers: "queued", "relayed", "held", true or false.

type TransportAsk

type TransportAsk = conn.TransportAsk

type TransportItem

type TransportItem struct {
	Name  string
	Label string
	// Kind is the hub's listener row this item reports into (Hub.SetListener).
	Kind           string
	DefaultService string
	// Listen binds the service with the identity.
	Listen func(service, identity string) (net.Listener, error)
	// Handler is served over the listener, unless Serve is set.
	Handler http.Handler
	Serve   func(ctx context.Context, ln net.Listener) error
	// Refuse says why this may not be turned off now, empty when it may. Said as a refusal.
	Refuse func() string
	// Locked says why this cannot be switched at all, empty when it can.
	Locked string
	// NoIdentity marks an item that binds no ziti service and uses no identity file: a zrok share.
	NoIdentity bool
	// Detail is a line about what the item is bound to, like a zrok share's masked token and env. May be nil.
	Detail func() string
}

TransportItem is one thing the hub binds.

type TransportSeed

type TransportSeed struct {
	On       *bool
	Service  string
	Identity string
}

TransportSeed is what the command line said for one item.

type TransportState

type TransportState = conn.TransportState

type TransportView

type TransportView struct {
	Name           string    `json:"name"`
	Label          string    `json:"label"`
	Kind           string    `json:"kind"`
	On             bool      `json:"on"`
	State          string    `json:"state"`
	LastError      string    `json:"last_error,omitempty"`
	Since          time.Time `json:"since,omitempty"`
	Service        string    `json:"service"`
	DefaultService string    `json:"default_service"`
	Identity       string    `json:"identity"`
	IdentityUsed   string    `json:"identity_used"`
	Seeded         []string  `json:"seeded,omitempty"`
	Locked         string    `json:"locked,omitempty"`
	Switchable     bool      `json:"switchable"`
	NoService      bool      `json:"no_service,omitempty"`
	Detail         string    `json:"detail,omitempty"`
}

TransportView is one item as the gear shows it.

type WorkDetail

type WorkDetail struct {
	Work  hubstore.Work          `json:"work"`
	Facts []hubstore.WorkFact    `json:"facts"`
	Steps []hubstore.WorkStepRow `json:"steps"`
	Life  struct {
		State   string `json:"state"`
		Current string `json:"current"`
		Waiting string `json:"waiting,omitempty"`
	} `json:"lifecycle"`
}

WorkDetail is the part of `GET /_hub/work/<id>` the brief reads.

func FetchWorkDetail

func FetchWorkDetail(ctx context.Context, call HubCall, id string) (WorkDetail, error)

FetchWorkDetail reads one item from the hub.

Directories

Path Synopsis
Package ctl holds the vocabulary the control tools share, below the feature packages that use it.
Package ctl holds the vocabulary the control tools share, below the feature packages that use it.
Package jsonio is the hub's JSON request and answer helpers, shared by the features that serve routes.
Package jsonio is the hub's JSON request and answer helpers, shared by the features that serve routes.
Package wire is the vocabulary of the room link: the frames, the timings and the types both halves speak.
Package wire is the vocabulary of the room link: the frames, the timings and the types both halves speak.

Jump to

Keyboard shortcuts

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