Documentation
¶
Overview ¶
Package api exposes the HTTP and WebSocket surface of `conductor serve`.
Index ¶
- Constants
- Variables
- type Desk
- type DeskOpener
- type Identity
- type Lane
- func (l *Lane) Decide(ctx context.Context, linkID, sessionID string, m proto.Decide, ...) []byte
- func (l *Lane) DecisionLink(linkID, sessionID, runID string) bool
- func (l *Lane) Evidence(ctx context.Context, linkID, sessionID string, m proto.DecisionEvidence) []byte
- func (l *Lane) LinkEnded(linkID string) error
- func (l *Lane) List(ctx context.Context, linkID, sessionID string, m proto.DecisionsList) []byte
- func (l *Lane) Read(ctx context.Context, linkID, sessionID string, m proto.DecisionRead) []byte
- func (l *Lane) Record(ctx context.Context, linkID, sessionID string, m proto.DecisionRecord) []byte
- func (l *Lane) Track(ctx context.Context, linkID, sessionID string, m proto.DecisionTrack) []byte
- func (l *Lane) Watch(linkID, sessionID string, changed func()) (stop func())
- type Operation
- type Option
- type PasteAnswerer
- type PastePeer
- type PublishedSession
- type Publisher
- type Server
- func (s *Server) BrakemanHost() ext.Host
- func (s *Server) Catalog() catalog.Catalog
- func (s *Server) Handler() http.Handler
- func (s *Server) Instance() string
- func (s *Server) Lane() *Lane
- func (s *Server) Launch(ctx context.Context, spec crew.LaunchSpec) (*session.Local, error)
- func (s *Server) Links() *share.Store
- func (s *Server) ProviderStarted(ctx context.Context, name string) bool
- func (s *Server) PublicOriginLeftOut() bool
- func (s *Server) Registered() []ext.Registration
- func (s *Server) Registry() *session.Registry
- func (s *Server) RemoteLinkGone(linkID, sessionID, runID string, ended bool)
- func (s *Server) RemoteLinkUnnamed(linkID, sessionID, runID string)
- func (s *Server) Reserve(ctx context.Context) (*session.Reservation, error)
- func (s *Server) RunMaintenance(ctx context.Context)
- func (s *Server) SeedExampleCrews() (added, skipped []string, err error)
- func (s *Server) SetBrakemanHost(h ext.Host)
- func (s *Server) SetListen(addr string)
- func (s *Server) SetPasteAnswerer(f PasteAnswerer)
- func (s *Server) SetPublisher(p Publisher)
- func (s *Server) SetReach(r reachSource, c certSource)
- func (s *Server) SetSwitchyardDecisions(on bool)
- func (s *Server) SetTLSListen(addr string)
- func (s *Server) SetUplinkHeld(held func() []string)
- func (s *Server) SettlePublications()
- func (s *Server) Shutdown(ctx context.Context)
- func (s *Server) StartBrakeman()
- func (s *Server) StartExtensions(ctx context.Context)
- func (s *Server) WaitBackground(ctx context.Context)
- func (s *Server) WarmCatalog(ctx context.Context)
Constants ¶
const ( // MaxTicketReply bounds the replies that carry a ticket's comments: a // ticket's read (and an operation's on it, the ticket beside a receipt // of at most 4 KiB, and a session's read of its run's ticket, the // ticket beside its labels and its milestone) and a page of its // comments. The largest ticket the server can make, every field and set // at its bound and every text at its escaped worst (fifty comments at // 32 KiB, the description at 128 KiB, fifty links, each a delivery // naming its candidate with its verification receipt at 8 KiB, fifty // attachments, a hundred relations and fifty children with their // titles: about 3.2 MiB), is under it, and so is the largest page of // comments, maxCommentPage of them at their escaped worst. // dispatch_test.go builds both and measures their replies. Exported // for the CLI, whose limits are derived from it (internal/cli: // maxDispatchReply, and the session client's, each 4 MiB). MaxTicketReply = 3<<20 + 512<<10 // MaxProjectReply bounds a project's read: its fields at their bounds, // 100 labels, 100 milestones with 4 KiB descriptions and 200 views with // 8 KiB queries, every text at its escaped worst, is under it, which // dispatch_test.go measures as it measures MaxTicketReply. Exported // for the CLI, which reads a project for its labels' and milestones' // names (internal/cli: maxDispatchReply). MaxProjectReply = 3 << 20 )
const ( // TrackerReadTimeout bounds the preview, a link, an unlink, a field // given back and a link's read: the lock, the reads, one write. TrackerReadTimeout = trackerBusyWait + trackerReadsBudget + dispatchWriteTimeout // ImportTimeout bounds an import and a refresh: the lock, the reads, // the ticket's write, the images (their downloads and their commits). ImportTimeout = trackerBusyWait + trackerReadsBudget + dispatchWriteTimeout + trackerImagesBudget // MergedCloseTimeout bounds a ticket's edit to done when its project // requires merged: the links' locks and their reads, at most // maxCloseReads at once, in one phase; the reads' records, each // within a write's cap of its own; the edit. MergedCloseTimeout = trackerBusyWait + mergedReadsBudget + dispatchWriteTimeout + dispatchWriteTimeout )
The bounds of a route that reads GitHub: each route's deadline is the sum of its steps' caps (trackerCaps).
const ( // MaxLaunchReply bounds a launch's read: its summary beside its // package as the bytes it is kept as (at most dispatch.MaxPackage, 640 // KiB). The largest, a package at its bound with the summary's texts // (why, the agents, the label) at their escaped worst, is under it // (dispatch_launch_test.go). Exported for the CLI. MaxLaunchReply = 1 << 20 // LaunchTimeout bounds a launch's request on the server: its run's // start (runTimeout) and its two store writes, the pending launch and // its outcome, each within its own bound. A client that waits for the // answer waits at least this long. Exported for the CLI. LaunchTimeout = runTimeout + 2*dispatchWriteTimeout )
const ( // MaxPlanReply bounds a plan revision's read: its summary beside its // body as the bytes it is kept as (at most dispatch.MaxPlanBody, 2 // MiB). The largest, a body at exactly 2 MiB with the summary's texts // at their escaped worst, is under it (dispatch_plans_test.go). // Exported for the CLI. MaxPlanReply = dispatch.MaxPlanReply // MaxPlansReply bounds a ticket's revisions' list: at most // dispatch.MaxPlans summaries, never a body. The largest, every // summary's texts (the approval's note, the stale words, the crew's // name, the approver, the withdrawer and the author) at their escaped // worst, is under it (dispatch_plans_test.go). Exported for the CLI. MaxPlansReply = 1 << 20 )
const ( // PublishTimeout bounds a send: the lock; the target's resolve and the // account's read; the send begun; a try after an earlier one's look for // that try's comment; the post; its settle; then either a lost answer's // listing and its settle, or the close (closeSteps). PublishTimeout = trackerBusyWait + trackerReadsBudget + dispatchWriteTimeout + 2*publishPostBudget + dispatchWriteTimeout + closeSteps // PrepareTimeout bounds a prepare: the lock; a link's read; the link's // read recorded; the target's resolve; the prepare. PrepareTimeout = trackerBusyWait + 2*trackerReadsBudget + 2*dispatchWriteTimeout // CheckTimeout bounds a Check: the lock, the listing (its resolve and // at most twice ten pages), the settle. CheckTimeout = trackerBusyWait + publishPostBudget + dispatchWriteTimeout // CloseNowTimeout bounds Close now: the lock and closeSteps. CloseNowTimeout = trackerBusyWait + closeSteps )
The bounds of a publication's routes: each step has its own cap from the moment it starts (trackerCaps: reads for a look at the item, post for a post, a listing or a close, write for a step of the store's), and each deadline is the sum of its steps' caps (trackerCaps.sending and the others below).
const ( MaxTicketReviews = dispatch.ReviewsPerPage MaxTicketReviewBytes = 24 << 20 )
MaxTicketReviews is the most reviews of a ticket its source indexes, the newest: one page of RV1's (dispatch.ReviewsPerPage). At RV1's bounds (50 findings of a review, each resolved and verified) their entries are under MaxTicketReviewBytes, so a ticket's reviews never take the index's budget (TestATicketsReviewsAreBounded).
const ( OpenedBrowser = "browser" // in the browser the agent's settings name OpenedDefault = "default" // in the default browser: the agent names none OpenedMissing = "missing" // in the default browser: the one named is not installed on that computer OpenedFailed = "failed" // in the default browser: the one named did not start OpenOffered = "offered" // in the workbench: no desktop app took it, or the one that did could not open it OpenHanded = "handed" // to a desktop app, which has not said what became of it )
The outcomes of an open: what the desktop app did (the first four), or that it was offered in the workbench. The app tells OpenOffered too, for a link it claimed and could not open (its bridge refused it), which the server then offers in every workbench.
const DecisionListed = maxDecisionListed
DecisionListed bounds one record as the operator's decision lists give it (GET /api/decisions, a ticket's decisions; listedOf): a page of n of them is at most n times it and 1 KiB more (maxDecisionListPage), the bound conductor decision list reads a page under.
const ExternalJobTimeout = 2 * trackerReadsBudget
ExternalJobTimeout bounds the prepared request from an external job: the item's read and its checks, then a job's log, each a phase of the GitHub reads' own budget (trackerReadsBudget). Exported for the CLI.
const ExternalReviewTimeout = ReviewTimeout + ExternalJobTimeout
ExternalReviewTimeout bounds a review's request that names an external job: a review's own bound, and beside it one budget, ExternalJobTimeout, shared by the fresh reads of every job it names (externalBudget), so the review's own bound stays whole for its store steps however many jobs it names. Exported for the CLI.
const ( // MaxCandidatesReply bounds a page of a run's candidates: eight tasks, // six candidates each, sixteen receipts each (a task's eight checks // and its manifest's eight verify steps), every text at its bound and // escaped worst, encoded whole, is under it (dispatch_evidence_test.go). // Exported for the CLI. MaxCandidatesReply = 1 << 20 )
const ( // MaxDiffReply bounds the diff route's reply: at most gitrepo.MaxFiles // files, fewer when the next would pass it (truncated says so), as // writeJSON encodes them. Exported for the CLI. MaxDiffReply = 256 << 10 )
const MaxHistoryReply = maxHistoryReply
MaxHistoryReply is maxHistoryReply, the bound conductor history reads a search's reply under.
const (
// MaxOpenURL bounds a link opened, in bytes.
MaxOpenURL = 2048
)
An agent's links, opened in the browser its settings name (#436): the agent asks with its session's token (conductor open, the MCP tool open_url, its $BROWSER), the server tells the workbenches over their event stream, and the desktop app, which alone starts a browser, claims the open and starts the browser on the computer it runs on. A workbench in a plain browser tab starts nothing: once no desktop app has claimed the open, it offers the link in a toast. docs/protocol.md, "Opening a link".
const MaxRepairReply = 512 << 10
MaxRepairReply bounds the prepared request, whole and never cut: the sum of its parts at their escaped worst as writeJSON encodes them (six bytes for a byte it escapes). The finding is about 80 KiB (its argv at the 8 KiB a check's argv may hold, every byte a control character, 48 KiB with its 32 entries' quotes; its tail and its quote at 2 KiB each, 12 KiB each; its error at dispatch.MaxCheckError and its words at dispatch.MaxFindingMessage characters; ids, commits and the attempt before under 4 KiB), the criteria at most about 390 KiB (a package's 16 KiB of acceptance, 96 KiB escaped; or a task's eight checks with their argv at the same worst), the rest under 4 KiB (TestPrepareRepairBound). Exported for the CLI.
const ( // MaxTicketRunsReply bounds a page of a ticket's runs: ten entries, // each a launch with its summary (its why at 2,000 characters, its // agents and label at their bounds), the run's summary (twelve // members, twenty blockers with their reasons cut to 200 characters) // and what changed since, every text at its escaped worst, encoded // whole, is under it (dispatch_evidence_test.go). Exported for the CLI. MaxTicketRunsReply = 1 << 20 )
const ( // ReviewTimeout bounds a review's request on the server: its run's // continuation (runTimeout) and its store writes, the review and its // outcome, each within its own bound. Exported for the CLI. ReviewTimeout = runTimeout + 2*dispatchWriteTimeout )
const ( // TrackerSaveTimeout bounds a save: the wait for the file's lock and // the token's check with GitHub (the CLI's conductor trackers set waits // it and a request's time beside it). TrackerSaveTimeout = trackerLockWait + trackerCheckTimeout )
The token's bounds and names.
Variables ¶
var ErrNoDesks = errors.New("the switchyard keeps no desks")
ErrNoDesks says the rendezvous keeps no desks: an older switchyard, which closes a register_desk.
Functions ¶
This section is empty.
Types ¶
type Desk ¶
type Desk interface {
// CurrentID is the rendezvous's id for it, which the run's group names.
CurrentID() string
// Decisions says the rendezvous carries decisions (its registered).
Decisions() bool
RunLink(ctx context.Context, role string, ttl time.Duration, label string, run proto.RunGroup) (proto.LinkCreated, error)
RunLinkUpdate(ctx context.Context, run proto.RunGroup) error
Revoke(ctx context.Context, linkID string) error
// DisconnectLink ends the desk's viewers that came with linkID, told
// why (revoked or expired), as a session's DisconnectLink does its own.
DisconnectLink(linkID string, why error)
Done() <-chan struct{}
// Stop ends it, and waits for its end (its lanes' operations under
// way, the rendezvous told) until ctx is done: past that its end goes
// on by itself, and the error says what was left.
Stop(ctx context.Context) error
}
Desk is a run's desk at the rendezvous (hostagent.Desk).
type DeskOpener ¶
DeskOpener is a Publisher that opens runs' desks at its rendezvous.
type Identity ¶
type Identity struct {
// Ran says the probe ran and answered; Pending that it is under way
// (ask again); neither with Error when it could not run.
Ran bool `json:"ran"`
Pending bool `json:"pending,omitempty"`
// Identified says the program is the agent, Version what it said;
// Impostor that it is a known other program of the same name. Verified
// says the adapter's expectation was checked against the real CLI: a
// verified probe that identifies nothing names the program as not the
// agent, an unverified one leaves it unidentified.
Identified bool `json:"identified"`
Impostor bool `json:"impostor,omitempty"`
Verified bool `json:"verified"`
Name string `json:"name,omitempty"`
Version string `json:"version,omitempty"`
// Output is the first line the program printed, when not identified.
Output string `json:"output,omitempty"`
Error string `json:"error,omitempty"`
}
Identity is what the server knows of an agent's program from its adapter's probe (agents.Probe), as GET /api/catalog and POST /api/catalog/check report it under `identity`.
func (Identity) Misidentified ¶
Misidentified reports whether the identity says the program is not the agent: a known impostor, or a verified probe that matched nothing.
type Lane ¶
type Lane struct {
// contains filtered or unexported fields
}
Lane is the Server as a decision link's lane (hostagent.Decisions).
func (*Lane) Decide ¶
func (l *Lane) Decide(ctx context.Context, linkID, sessionID string, m proto.Decide, answer func(context.Context, proto.Answer) error, stands func() error) []byte
Decide takes one action through the item's own operation, as the link. Its opId is claimed first, for the whole request (rule 2): the same request the link took before is answered from it (replay), one under way on another connection is waited for, and another request under it is op_conflict, nothing done.
func (*Lane) DecisionLink ¶
DecisionLink says whether linkID is a decision link this server minted at its switchyard that opens a lane for the publisher's connection (hostagent.Decisions): a session's (sessionID, a link of the session or of its run) or a desk's (runID, a link of the run), as it stands.
func (*Lane) Evidence ¶
func (l *Lane) Evidence(ctx context.Context, linkID, sessionID string, m proto.DecisionEvidence) []byte
Evidence answers a bounded read of one evidence entry, named by its own ref, of the item ref: a check of a task in the scope (its log's last 4 KiB), or a session in it (its id); anything else is opened on the desktop or the LAN.
func (*Lane) LinkEnded ¶
LinkEnded is why this server's link store no longer opens linkID (hostagent.Decisions), in one read of it (share.Store.Live): revoked from its mark, or kept as ended with its forgotten run; expired once past its expiry on this server's clock. A link it does not hold is not ended.
func (*Lane) Read ¶
Read answers one item in the scope with its detail, open or as it is now; its evidence entries naming a session in the scope carry the id the holder opens it by.
func (*Lane) Record ¶
Record answers a part of a DR1 record in the scope, cut from one whole read of it at the rev the part names (lane_decisions.go).
func (*Lane) Watch ¶
Watch calls changed whenever the hash of what the link's viewer sees differs from the last it saw, read again on each of the server's events (a session's, a run's, Dispatch's) and on each action noted in the link's Recent, until stop. A link's connections share one watch, which reads the scope once per settle for all of them (laneState.links), and its first read is made before Watch returns, so a request the connection serves after it is never the baseline of a change it misses.
type Operation ¶
type Operation struct {
// Name is the operation's name, the MCP tool's when it has one.
Name string `json:"name"`
// Summary is the guide's line, at most maxOpSummary bytes as the
// guide encodes it (a character JSON escapes counts as its escape).
Summary string `json:"summary"`
// Description is the MCP tool's description, verbatim, at most
// maxOpDescription bytes as encoded, apart from Summary so neither
// bound breaks the other. The guide's operations section leaves it out: tools/list
// carries it.
Description string `json:"description,omitempty"`
// Scope is who reaches it: admin, session (any session), task (an
// attempt of a managed run) or ticket (a member of a run launched
// from or linked to a ticket) or observe (a Brakeman turn's session: its request and its
// brief; PR-4's reads join it) or act (a Brakeman turn's session
// granted the operation by the person, PR-13: the act tool and the
// operations granted, each its own route's).
Scope string `json:"scope"`
Method string `json:"method"`
// Path is the route's pattern, as the mux takes it after the method.
Path string `json:"path"`
// MCP is the tool's name, "" for an operation with no tool.
MCP string `json:"mcp,omitempty"`
// CLI is the command that does it, its words and placeholders.
CLI []string `json:"cli,omitempty"`
// Input is the JSON Schema of the body or of the tool's arguments.
Input map[string]any `json:"input"`
// Receipt names the receipt it answers with: ledger (a run command's),
// dispatch (a Dispatch operation's), or "" for none.
Receipt string `json:"receipt,omitempty"`
// Revision names the precondition the route itself enforces: "run"
// (a command's expectedRevision, above 0), "ticket" (Dispatch's
// expectedRev), "publication" (a publication's expectedRev) or
// "decision" (a decision's expectedRev); "" for a
// route that decodes no revision (a run's stop and resume), which a
// proposal never gets a button for.
Revision string `json:"revision,omitempty"`
// Bounds are the body's and the reply's limits, in bytes.
Bounds map[string]int `json:"bounds,omitempty"`
// contains filtered or unexported fields
}
Operation is one of Conductor's operations an agent or a client calls: its route, its MCP tool and CLI form when it has them, the JSON Schema of its body or the tool's arguments, and what it answers with.
func Operations ¶
func Operations() []Operation
Operations is the table: every agent route and tool, the admin's operations a proposal may name, and the guide. The caller must not change the maps it holds.
type Option ¶
type Option func(*options)
Option configures a server New makes.
func WithExtensions ¶
WithExtensions gives the server the providers p, as the composition root read them and local.Fill filled them: it asks nothing about them. Without it, the server holds local.Fill(ext.Providers{}), the free build.
func WithNotices ¶
WithNotices gives the server the third-party notices text it serves at /third-party-notices.txt in place of the embedded THIRD_PARTY_NOTICES: the text a main that links more modules than this one handed in (cli.SetNotices, which bounds it). "" keeps the embedded text, as a server made without the option holds it.
func WithPreviewBridge ¶
WithPreviewBridge gives the server the built bridge (internal/web's PreviewBridge); an empty one is none, and the route answers 404 no_bridge.
type PasteAnswerer ¶
type PasteAnswerer func(ctx context.Context, local *session.Local, offerSDP string, role session.Role, label string, ice []proto.ICEServer) (PastePeer, string, error)
PasteAnswerer answers a viewer's paste offer for a server session (hostagent.AnswerPaste, which serve wires in: api stays free of hostagent). It returns the peer kept for the viewer and the answer SDP.
type PublishedSession ¶
type PublishedSession interface {
OnChange(info session.Info)
OnActivity(id string, e session.ActivityEntry, state session.AttentionState)
OnChat(id string, m session.ChatMessage)
Stop()
Base() string
ID() string
// Link mints a share link to the session at the rendezvous.
Link(ctx context.Context, role string, ttl time.Duration, label string) (proto.LinkCreated, error)
// Revoke revokes a link minted there; one it no longer knows answers an
// error naming not_found.
Revoke(ctx context.Context, linkID string) error
// CurrentID is the rendezvous's id for the session now: ID unless the
// rendezvous restarted and the session was registered afresh under
// another id (an older rendezvous, which ignores host instances).
CurrentID() string
// HeldLinks is what the rendezvous last said it holds of the links
// minted for the session; false when it never said (an older one).
HeldLinks() ([]string, bool)
// Done is closed once the publication has ended, whatever ended it;
// StoppedThere says the rendezvous ended it with a stop of its own, the
// session going on here.
Done() <-chan struct{}
StoppedThere() bool
// RunLink mints, at the rendezvous, one link to the sessions of a run's
// members there; RunLinkUpdate tells it the members now. Either goes over
// this session's connection, which must be a member's.
RunLink(ctx context.Context, role string, ttl time.Duration, label string, run proto.RunGroup) (proto.LinkCreated, error)
RunLinkUpdate(ctx context.Context, run proto.RunGroup) error
}
PublishedSession is a session published to the rendezvous: its hooks get the local session's changes and entries, Stop ends the publication.
type Publisher ¶
type Publisher interface {
Publish(ctx context.Context, local *session.Local) (PublishedSession, error)
// Server is the rendezvous's URL, for a reply that says where a session
// was meant to be published: its scheme, host and path, never user
// information, a query or a fragment.
Server() string
}
Publisher publishes a server session to a rendezvous Conductor (hostagent.Uplink); PublishedSession is one publication.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server holds the shared state behind every route.
func New ¶
func New(cfg *config.Config, cat catalog.Catalog, log *slog.Logger, web http.Handler, st *store.Store, opts ...Option) (*Server, error)
New wires the server. cat is the configured catalog; when st holds a catalog.json overlay it is applied on top. A corrupt or invalid overlay, or crews.json that cannot be moved, is an error, so that startup fails instead of a later save overwriting the file; a crew file that cannot be used, and a crew of crews.json not moved over an existing file, are logged and left out. An override env value equal to the configured agent's is saved back as the mask first (maskConfiguredEnv), and a failure to save it stops startup too. web serves the embedded SPA and may be nil. st persists UI-managed state in the data directory and may be nil when there is none. The options are read before anything is written; without WithExtensions the server is the free build (extensions.go).
func (*Server) BrakemanHost ¶
BrakemanHost is the ext.Host the server gives Brakeman's desk: the one a provider's Start gets, but for the desk, so its LaunchTurn launches the turn of the request holding the desk's slot, and the operations it runs for a turn are the actor brakeman's. It lasts as long as the server.
func (*Server) Catalog ¶
Catalog returns a snapshot of the launchable agents: the configured catalog with the data directory overlay applied. A snapshot is never changed by later edits, so it can be read without a lock.
func (*Server) Instance ¶
Instance identifies this server process; the reach self-check matches it on /api/health.
func (*Server) Launch ¶
Launch starts the session of a crew member through createLocalSession, the path POST /api/sessions takes (crew.Launcher). An attempt's tree's own names (spec.Inject) and the env names the server approved for its project manifest (spec.Allow) go into the session's environment. An error is an *apiError.
func (*Server) ProviderStarted ¶
ProviderStarted reports whether the provider name has started: true at once for one that is no ext.Starter; otherwise once its first try of Start has returned or been given up (or ctx ends), whether a try has succeeded. The uplink's credential asks it before the provider's first UplinkToken (hostagent.UplinkCredential).
func (*Server) PublicOriginLeftOut ¶
PublicOriginLeftOut reports whether the bridge leaves publicUrl out of its origins (publicOrigin's left; conductor serve says so once).
func (*Server) Registered ¶
func (s *Server) Registered() []ext.Registration
Registered is every provider the composition root gave the server (WithExtensions), its kind and name, in the registry's order: none for the free build. It is what GET /api/capabilities lists, with each provider's state (capabilities.go).
func (*Server) RemoteLinkGone ¶
RemoteLinkGone is told a link the switchyard says no longer opens what one of the publisher's connections carries (hostagent.Uplink.LinkGone): the server's own id of a published session, or the run of a desk. A decision link of this server's there ends here too, through its barrier, where that word is the link's own end: a session link's, from its session's connection; a run link's, from the run's desk alone. A member's connection is told so when the member only left the run's group (the run's next attempt replacing it), which ends nothing of the link. Its record is not forgotten here (forgetRemote): the switchyard sends link_gone as it closes the link's viewers, before it has deleted what it keeps of the link (a revoke whose file is not deleted yet is answered store_unavailable after it), so the link is owed its revoke there (the store's hook marks it so) and keeps its record, listed and holding the run's desk, until the switchyard confirms the revoke or answers not_found (retryRevokeThere, or a revoke again from here).
A link the switchyard says it ended of itself (ended: an open admission past its bound, #820) is the link's own end on whichever connection it is told, a member's too (remoteLinkEnded).
func (*Server) RemoteLinkUnnamed ¶
RemoteLinkUnnamed is told a link one of the publisher's connections held that its registered no longer names (hostagent.Uplink.LinkUnnamed): the link's end only where it can mean nothing else, a run's link on the run's desk (as an ended word is) and a session's own link on its session's connection. It never asks which run a session is of: a member's answer also stops naming a run's link once it left the group.
func (*Server) Reserve ¶
Reserve holds a place for a managed run's attempt among the server's sessions (crew.Launcher): refused at the cap before anything is made.
func (*Server) RunMaintenance ¶
RunMaintenance garbage-collects ended sessions until ctx is cancelled.
func (*Server) SeedExampleCrews ¶
SeedExampleCrews saves the example crews (crew.Examples) whose ids have no file in the crews directory, with the server's default working directory, and returns what it added and what it skipped. conductor serve --examples and POST /api/crews/examples both come here.
func (*Server) SetBrakemanHost ¶
SetBrakemanHost gives Brakeman's desk the ext.Host it launches through: the composition root's (runServe gives it BrakemanHost), a test's own otherwise. Without one the desk launches through BrakemanHost. Nothing on a server without a desk.
func (*Server) SetListen ¶
SetListen gives the server the address its plain listener got (conductor serve, once it listens, before it serves): the bridge's origins are read from it, and when the embedded app has the bridge and the listener is on the loopback (or every address), the engine names the bridge's URL there to every tree with a preview resolved after it.
func (*Server) SetPasteAnswerer ¶
func (s *Server) SetPasteAnswerer(f PasteAnswerer)
SetPasteAnswerer makes the paste route answer; without one it says so.
func (*Server) SetPublisher ¶
SetPublisher makes every server session created from now on published to the rendezvous; nil stops that.
func (*Server) SetReach ¶
func (s *Server) SetReach(r reachSource, c certSource)
SetReach gives the server its reach status and certificate readiness; either may be nil (no mapper, no TLS).
func (*Server) SetSwitchyardDecisions ¶
SetSwitchyardDecisions says whether this server's host connections say, in their registered, that it carries a decision link's lane (signal.Hub.SetDecisions). The serve command says so: its embedded join page has the Decide tab the lane is for (docs/plans/decision-inbox.md, PR-7), so no build advertises what its page lacks.
func (*Server) SetTLSListen ¶
SetTLSListen gives the server the address its TLS listener got (conductor serve, once that listens): the bridge's https origins are at its port, the one it is bound to, never the configured text (:0 is a port drawn at listening).
func (*Server) SetUplinkHeld ¶
SetUplinkHeld gives the server what answers the tokens its uplink's credential took from the identity provider (hostagent.UplinkCredential's Held), for the detail's check; before it starts serving.
func (*Server) SettlePublications ¶
func (s *Server) SettlePublications()
SettlePublications settles, in the background, the publications the store holds being sent (a send a stop or a crash cut), as many as the store lists (dispatch.MaxSendingPublications): one at a time, each under its lock, by a listing for its comment, within settleStartTimeout in all and the server's stop. It never posts or closes, and a server's start never waits for it. It is the server's own settle, not a person's act: a deleted ticket or an archived project does not stop it, so a comment that was posted is recorded as posted.
func (*Server) Shutdown ¶
Shutdown first ends the identity probes (probeCache.stop: none starts, each under way has its process group killed), waited for within ctx with the usage reads. It arms the managed runs' teardown cut-off (crew's Draining: ctx's deadline less the reserve their rows need), stops the webhooks, then the runs, so that no crew member starts any more and the services of their trees end, then waits for the trees being ended (crew's Drain), then every session, and closes every viewer. The webhooks go first: the entries the sessions record as they stop are not sent. The runs are stopped together, so that one slow to stop costs the others none of the budget; a finished run is stopped too (its stop waits for its trees). The goroutines the server started on its own (track) are waited for last, once every viewer is closed, until they end or ctx does; the records of the runs stopped are then waited for within recordsGrace, whatever ctx says, and closed, and the ledger after them.
func (*Server) StartBrakeman ¶
func (s *Server) StartBrakeman()
StartBrakeman starts Brakeman's desk: its loop, which takes the queued requests a restart finds. conductor serve calls it once the server is made and its listener bound (cfg.PublicURL then has the listener's port, which a turn's session is given to call back on), so the first turn is launched by a desk the server holds. A server never started takes no turn; one with no desk (a switchyard, no data directory) does nothing.
func (*Server) StartExtensions ¶
StartExtensions starts every provider that is an ext.Starter, once per distinct value (the entitlement source's slot among them), all at once, each on a goroutine of the server's own (track), and returns at once: it asks no provider anything itself, so nothing a provider does holds up the listeners. runServe calls it once the server is made and before the listeners serve, with the maintenance context: ctx's end, or the server's extensions stopping (Shutdown), ends every try and every retry. A second call does nothing.
func (*Server) WaitBackground ¶
WaitBackground waits, as long as ctx allows, for the goroutines the server started on its own (track): a run's record being written, the viewers of a forgotten run's links being closed. It ends the identity probes as Shutdown does. Shutdown does the same at its end; tests call it before their directories go.
func (*Server) WarmCatalog ¶
WarmCatalog does at the server's start what the first GET /api/catalog would: it looks the agents' programs up and runs their probes, so the Launch dialog first opened after the app starts finds them known (inside WSL the first lookups and probes of a dozen agents take seconds).
Source Files
¶
- accounts.go
- attention.go
- auth.go
- binding.go
- brakeman.go
- brakeman_account_unix.go
- brakeman_act.go
- brakeman_act_decision.go
- brakeman_act_repair.go
- brakeman_changes.go
- brakeman_history.go
- brakeman_make.go
- brakeman_observe.go
- brakeman_refs.go
- brakeman_role.go
- brakeman_session.go
- candidates.go
- capabilities.go
- capacity.go
- capture_decision.go
- capture_review.go
- capture_sends.go
- captures.go
- catalog.go
- commits.go
- compare.go
- compare_doors.go
- compare_drafts.go
- compare_selection.go
- compare_supporting.go
- crews.go
- decide.go
- decision_refs.go
- decisions.go
- desk_host.go
- desk_publish.go
- dispatch.go
- dispatch_attachments.go
- dispatch_delivery.go
- dispatch_evidence.go
- dispatch_external.go
- dispatch_external_checks.go
- dispatch_launch.go
- dispatch_plans.go
- dispatch_publish.go
- dispatch_reviews.go
- dispatch_session.go
- errors.go
- events.go
- export.go
- extcontext.go
- extensions.go
- exthost.go
- extruntime.go
- files.go
- guide.go
- history_availability.go
- history_decisions.go
- history_dispatch.go
- history_hosted.go
- history_index.go
- history_index_dispatch.go
- history_journal.go
- history_resume.go
- history_reviews.go
- history_search.go
- history_sources.go
- hostedanswer.go
- identity.go
- inbox.go
- inbox_decisions.go
- inbox_track.go
- integrations.go
- invite.go
- lane.go
- lane_decisions.go
- launching.go
- ledger.go
- linkfiles.go
- links.go
- lookup.go
- manifest.go
- me.go
- media.go
- notices.go
- notify.go
- opendir_unix.go
- opens.go
- paste.go
- paths.go
- people.go
- preview_commands.go
- preview_label.go
- previewbridge.go
- probe.go
- publish.go
- publishrun.go
- ratelimit.go
- reach.go
- resume.go
- review_diff.go
- review_locate.go
- review_repair.go
- router.go
- runs.go
- selfservice.go
- server.go
- sessionclone.go
- sessions.go
- signin.go
- switchyard_page.go
- sync.go
- tasks.go
- touched.go
- trackers.go
- trackers_unix.go
- unsent.go
- unsent_linux.go
- webhooks.go
- ws_host.go
- ws_viewer.go
- wssink.go