Documentation
¶
Overview ¶
Package httpapi exposes the gofer control plane over HTTP using github.com/gookit/rux/v2. Handlers only parse params, enforce the auth context and encode responses; all business logic lives in the job service and the project/agent registries (plan §7).
Error responses use a small uniform shape (NOT the company {status,code, message} envelope), because this is a local developer tool, not an internal business service (plan §7):
{"error":"unknown project","detail":"project_key other not found"}
Index ¶
- Constants
- Variables
- type AgentBrief
- type AttachTicketBinding
- type AttachTicketStore
- type ConfigReloadReporter
- type ConfigWriter
- type DirEntry
- type DirsView
- type PolicyDegrade
- type PolicyRejection
- type ProjectDirEntry
- type PtySessionStore
- type RootEntry
- type Server
- func (s *Server) Handler() http.Handler
- func (s *Server) HostedForwarders() *tunnel.HostedForwarderManager
- func (s *Server) LinkIssueFinished(snap job.JobResult)
- func (s *Server) LinkIssueStarted(snap job.JobResult)
- func (s *Server) Live() *pushhub.Hub
- func (s *Server) OnSessionStart(jobID string, sess *ptyrunner.PtySession)
- func (s *Server) Run(addr string) error
- func (s *Server) RunCtx(ctx context.Context, addr string) error
- func (s *Server) RunCtxTLS(ctx context.Context, addr string, tlsCfg *config.TLSConfig) error
- func (s *Server) SetBuildInfo(info buildinfo.Info)
- func (s *Server) SetCastRecorder(rec *castrec.Recorder)
- func (s *Server) SetConfigWriter(cw ConfigWriter)
- func (s *Server) SetHostedForwarderDial(dial tunnel.HostedDial)
- func (s *Server) SetMetrics(m *metrics.Metrics, enabled bool, token string)
- func (s *Server) SetPresence(p *presence.Service)
- func (s *Server) SetPtyRelay(nonces *ptyrelay.NonceStore, relays *ptyrelay.Registry)
- func (s *Server) SetPtySessionStore(store PtySessionStore)
- func (s *Server) SetPtyTranscriptMaxBytes(n int64)
- func (s *Server) SetRules(st *rule.Store)
- func (s *Server) SetRunners(runners map[string]config.RunnerConfig)
- func (s *Server) SetServerConfig(cfg *config.ServerConfig)
- func (s *Server) SetSessionInjectCommands(commands []string)
- func (s *Server) SetSessionRelayPolicy(idleSec, turnSec int, skipWhenSupervising bool, supervisingWindowSec int)
- func (s *Server) SetSessionTakeoverAliveSec(sec int)
- func (s *Server) SetSessionWaitBudgets(onSec, autoSec int)
- func (s *Server) SetSkills(st *skill.Store)
- func (s *Server) SetTrackerStore(store *jobstore.Store)
- func (s *Server) SetTunnelPresets(st TunnelPresetStore)
- func (s *Server) SetWebPush(service WebPushService)
- func (s *Server) SetWorkerReloader(r workerReloader)
- func (s *Server) SetWorkerUpgrader(u workerUpgrader)
- func (s *Server) SetWorkerUpgrades(m *workerupgrade.Manager)
- func (s *Server) SetXfer(m *xfer.Manager)
- func (s *Server) StartHostedAutostart()
- func (s *Server) StartNudgeSweeper(stop <-chan struct{})
- func (s *Server) Steward() *steward.Service
- func (s *Server) StopHostedForwarders()
- func (s *Server) UserCallerIDs() []string
- func (s *Server) Work() *work.Service
- type TunnelPresetStore
- type WebPushService
- type WorkerCaps
- type WorkerReloadOutcome
- type WorkerReloadStatus
- type WorkerStatus
Constants ¶
const ( // DefaultProbeTimeoutSec is a probe's deadline (and the sync wait around it) when // the caller asks for none: long enough for a cold CLI start, short enough that a // hung one is reported as a failure rather than as silence. DefaultProbeTimeoutSec = 120 )
Variables ¶
var ( ErrUpgradeWorkerOffline = errors.New("worker offline") ErrUpgradeTooOld = errors.New("worker too old for remote upgrade") ErrUpgradeTimeout = errors.New("worker did not answer the upgrade request in time") )
Upgrade failure classes the hub adapter (serve) maps its own errors onto, so this layer can pick a status without importing wshub (D2/G022).
Functions ¶
This section is empty.
Types ¶
type AgentBrief ¶
type AgentBrief struct {
Key string `json:"key"`
Type string `json:"type,omitempty"`
Interactive bool `json:"interactive,omitempty"`
Batch bool `json:"batch"`
// Available/Version are DISPLAY-ONLY, and Available is a *bool for a reason —
// see wsproto.AgentBrief for the full rule. Short version: nil = the worker never
// reported it (pre-P2 build), false = a probe did not find the CLI. NEITHER means
// "cannot run": an operator-declared agent stays runnable whatever the probe says.
// Nothing in this package (or the web console) may filter or grey out an agent on
// this field; the agent list is the authority on what exists.
Available *bool `json:"available,omitempty"`
Version string `json:"version,omitempty"`
}
AgentBrief is httpapi's local typed agent capability (key + type + interactive), the detail the web capability cascade needs beyond a bare agent key. It mirrors wsproto.AgentBrief but is redeclared here so httpapi never imports wshub/wsproto (the D2 boundary): the serve-side adapter converts the wshub snapshot into this type. It is exported because that adapter (package serve) constructs it. The JSON tags match wsproto/the web MetaAgent shape (type/interactive omitempty).
type AttachTicketBinding ¶
type AttachTicketBinding struct {
Caller string
JobID string
PtySessionID string
Mode string
Origin string
Expiry int64
}
AttachTicketBinding is the in-memory binding carried by a browser attach ticket. The ticket token itself is opaque and consumed once by the T7 WS path.
type AttachTicketStore ¶
type AttachTicketStore struct {
// contains filtered or unexported fields
}
AttachTicketStore holds short-lived one-time browser attach tickets.
func NewAttachTicketStore ¶
func NewAttachTicketStore() *AttachTicketStore
func (*AttachTicketStore) Consume ¶
func (s *AttachTicketStore) Consume(token string, nowUnix int64) (AttachTicketBinding, bool)
func (*AttachTicketStore) Issue ¶
func (s *AttachTicketStore) Issue(b AttachTicketBinding) string
type ConfigReloadReporter ¶
type ConfigReloadReporter interface {
ReloadConfigReport() (config.ReloadResult, error)
}
ConfigReloadReporter is an optional extension implemented by the server core. Keeping it separate preserves the narrow writer seam used by lightweight tests and MCP callers while allowing the HTTP response to expose generation details.
type ConfigWriter ¶
ConfigWriter is the narrow write-transaction seam (D2/G022) for the WEB-04③ V1.1 config write endpoints: the only two things this entry layer asks of the config owner are "run this mutation as one transaction" (clone → apply → validate → save → reload) and "re-read the file by hand". *core.Core satisfies it; serve injects the singleton via SetConfigWriter.
A nil seam (mcp, most tests) leaves the routes mounted but answering 503 — the same degradation /v1/xfer uses — so the router never has to be rebuilt for it.
type DirsView ¶
type DirsView struct {
Workspace *DirEntry `json:"workspace,omitempty"`
Roots []RootEntry `json:"roots,omitempty"`
Projects []ProjectDirEntry `json:"projects,omitempty"`
// OtherProjects counts configured projects that are not listed because this
// runner may not run them (allowed_runners excludes it). Their host_path belongs
// to another worker's machine, so "directory missing here" would be a false alarm.
OtherProjects int `json:"other_projects,omitempty"`
}
DirsView is where a runner runs things: the machine's default workspace (GOFER_WORKSPACE or ~/.gofer/workspace), the roots mapping of a policy-mode worker and the directory every served project resolves to. Exists is judged on the runner's own machine at report time. A project that could not be resolved at all is not here — its reason is the worker's policy_rejected entry.
type PolicyDegrade ¶
type PolicyRejection ¶
type ProjectDirEntry ¶
type ProjectDirEntry struct {
Key string `json:"key"`
Path string `json:"path"`
Exists bool `json:"exists"`
}
ProjectDirEntry is the directory a project resolves to on the runner.
type PtySessionStore ¶
type PtySessionStore interface {
UpsertPtySession(rec jobstore.PtySessionRecord) error
GetPtySessionByJob(jobID string) (jobstore.PtySessionRecord, bool, error)
ListPtySessionsByJob(jobID string) ([]jobstore.PtySessionRecord, error)
ListRecentPtySessions(limit int) ([]jobstore.PtySessionRecord, error)
}
PtySessionStore is the narrow persistence seam the WEB-03 P3 pty handlers use to record/read pty relay session metadata (design review 高1). It is defined here — rather than the Server holding a raw *jobstore.Store — so the entry layer keeps a minimal, intention-revealing surface; *jobstore.Store satisfies it. A nil PtySessionStore means "no persistence" (mcp / most tests) and handlers (T5/T6) must guard against it.
type RootEntry ¶
type RootEntry struct {
From string `json:"from"`
To string `json:"to"`
Exists bool `json:"exists"`
}
RootEntry is one roots mapping (server-side prefix -> the worker's local path).
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server holds the wired dependencies and the rux router. It is constructed once (New) and either started with Run or exposed as an http.Handler (Handler) for httptest.
func New ¶
func New(serverCfg *config.ServerConfig, token string, allowEmptyToken bool, jobs *job.Service, wf *workflow.Engine, projects *project.Registry, agents *agent.Registry, hub workerHub, runners map[string]config.RunnerConfig, prober runnerProber, workers workerRegistry) *Server
New builds a Server: it resolves the effective token, wires the rux router (routes + auth middleware) and returns it ready to Run or hand to httptest.
token is the already-resolved effective token (serve resolves config.token / token_env / --token before calling New). allowEmptyToken mirrors the config/flag of the same name.
runners is the configured runner set for the C6/P4 GET /v1/runners endpoint (nil/empty => only the implicit local row). prober and workers are the C6/P4 observability sources (both nil-safe: a nil renders the corresponding runner rows `unknown`). serve injects them (config.Runners + the peer-http probe cache + a hub adapter); other callers pass nil.
NOTE (D3, deferred): New is now a wide positional constructor. The plan flags a future functional-option / Deps-struct refactor as optional cleanup; it is intentionally NOT done here to keep the change backward-compatible and focused.
func (*Server) Handler ¶
Handler exposes the rux router as an http.Handler (rux.Router implements ServeHTTP), used by httptest and by Run.
func (*Server) HostedForwarders ¶
func (s *Server) HostedForwarders() *tunnel.HostedForwarderManager
func (*Server) LinkIssueFinished ¶
func (*Server) LinkIssueStarted ¶
func (*Server) Live ¶
Live returns the browser push hub so assembly can wire its sources (job store hook, event tap, worker presence, ...). It is never nil on a Server built by New.
func (*Server) OnSessionStart ¶
func (s *Server) OnSessionStart(jobID string, sess *ptyrunner.PtySession)
OnSessionStart implements ptyrunner.SessionObserver for serve-local pty jobs. It must stay non-blocking because PtyRunner calls it synchronously before the child run loop starts; all relay/session persistence work happens in a goroutine.
func (*Server) Run ¶
Run starts the HTTP server on addr and blocks until the listener fails, with no graceful-shutdown signal. Retained for callers that do not manage a context.
func (*Server) RunCtx ¶
RunCtx starts the HTTP server on addr and blocks until ctx is cancelled — then it gracefully shuts down (stop accepting new conns, drain in-flight up to shutdownGrace) and returns nil — or until the listener fails. http.ErrServerClosed from a graceful Shutdown is expected and mapped to nil. The address is logged; the token is never logged (plan §11).
func (*Server) RunCtxTLS ¶
RunCtxTLS serves the same router on the historical HTTP listener and, when configured, an additional HTTPS listener. The HTTP endpoint remains available for workers and CLI clients.
func (*Server) SetBuildInfo ¶
SetBuildInfo injects linker build metadata for runtime status endpoints.
func (*Server) SetCastRecorder ¶
SetCastRecorder injects the WEB-03 P3 cast recording factory (nil = recording off, the zero-regression default). Like SetPtyRelay it is a post-construction setter so the wide positional New stays untouched; serve calls it at startup after resolving storage.cast and its encryption key. It mounts no routes, so — unlike SetMetrics/SetPresence/SetPtyRelay — it does NOT rebuild the router.
func (*Server) SetConfigWriter ¶
func (s *Server) SetConfigWriter(cw ConfigWriter)
SetConfigWriter injects the config write transaction (WEB-04③ V1.1) behind the /v1/config write routes. serve passes the *core.Core singleton (which satisfies the narrow interface); a nil writer leaves the routes mounted and answering 503, so — like SetXfer — it mounts nothing and needs no router rebuild.
func (*Server) SetHostedForwarderDial ¶
func (s *Server) SetHostedForwarderDial(dial tunnel.HostedDial)
SetHostedForwarderDial enables server-local preset forwarding. The callback is deliberately supplied by serve because it knows the effective listen address and bearer token; tests may inject an in-process fake.
func (*Server) SetMetrics ¶
SetMetrics injects the E16 Prometheus instrumentation and mounts the /metrics endpoint + the /v1 HTTP middleware (design §6.2). It MUST be called before the server starts serving (serve calls it right after New, before Run). enabled and token come from serverCfg.Metrics. Passing a nil m leaves metrics off.
The router is rebuilt so the /metrics route + the metricsMiddleware on /v1 are registered (rux requires routes/middleware at build time). This is safe because SetMetrics runs single-threaded at assemble time, before any request is served.
func (*Server) SetPresence ¶
SetPresence injects the E36 presence/mailbox service and rebuilds the router so the /v1/agents/* + /v1/messages routes are mounted (they are registered only when s.presence is non-nil). Mirrors SetMetrics: called post-construction by serve (after SetMetrics) so the wide positional New and its many call sites stay untouched. Must run single-threaded at assemble time, before serving.
func (*Server) SetPtyRelay ¶
func (s *Server) SetPtyRelay(nonces *ptyrelay.NonceStore, relays *ptyrelay.Registry)
SetPtyRelay injects the shared live-only PTY relay state for worker pty-connect and browser attach routes. It is a post-construction setter to avoid widening New's already-large positional constructor.
func (*Server) SetPtySessionStore ¶
func (s *Server) SetPtySessionStore(store PtySessionStore)
SetPtySessionStore injects the pty-session persistence seam (WEB-03 P3). serve passes the *jobstore.Store (which satisfies PtySessionStore); a nil store leaves pty session persistence off (mcp/tests). It mounts no routes → no router rebuild.
func (*Server) SetPtyTranscriptMaxBytes ¶
SetPtyTranscriptMaxBytes sets the pty text transcript's tail cap (PTY-01 §四, config key pty.transcript_max_bytes). serve injects ptyrelay.DefaultTranscript… resolved value at startup; hub-less callers (mcp/tests) leave it unset and get the default. <= 0 restores the default.
func (*Server) SetRules ¶
SetRules injects the JOB-06① rule library (serve passes core's store for <config-dir>/rules). Same contract as SetSkills: the /v1/rules routes are always mounted and answer 503 while it is nil.
func (*Server) SetRunners ¶
func (s *Server) SetRunners(runners map[string]config.RunnerConfig)
SetRunners refreshes the runner definitions rendered by GET /v1/runners. The serve hook calls this after Core has rebuilt dynamic worker runners; startup-only runner types remain in the concrete Core registry and are reported as restart-required by the reload result.
func (*Server) SetServerConfig ¶
func (s *Server) SetServerConfig(cfg *config.ServerConfig)
SetServerConfig swaps the live server policy used by auth and worker metadata handlers after a successful core reload. The router itself is unchanged; only the immutable startup projection (caller tokens and server policy) is replaced.
func (*Server) SetSessionInjectCommands ¶
SetSessionInjectCommands injects the tmux-injection whitelist (SESS-01 §9.1 A, session.inject_commands): the CLI commands a reply may be typed into. Empty keeps the relay's built-in list. Like SetSessionRelayPolicy it is a no-op without a relay service.
func (*Server) SetSessionRelayPolicy ¶
func (s *Server) SetSessionRelayPolicy(idleSec, turnSec int, skipWhenSupervising bool, supervisingWindowSec int)
SetSessionRelayPolicy injects the effective session-relay auto-arm policy (SESS-01 R2 + SUP-01 D): the keyboard idle threshold and the last-human-input fallback threshold, the supervision gate and its look-back window, all in seconds (see config.SessionConfig; 0 disables that criterion). serve calls it with the whole config's effective values — the `session:` block — while a Server built from a bare ServerConfig keeps New's shipped default. No-op without a relay service (a server with no job store).
func (*Server) SetSessionTakeoverAliveSec ¶
SetSessionTakeoverAliveSec injects session.takeover_alive_sec (the heartbeat window inside which a web takeover is refused as `session_alive`; <= 0 = guard off).
func (*Server) SetSessionWaitBudgets ¶
SetSessionWaitBudgets injects the Stop-wait budgets (N1 §C): seconds a hook may block for a reply under an explicit `on` switch and under an auto-armed wait (0 = no server cap). Hot-reloaded with the rest of the `session:` block.
func (*Server) SetSkills ¶
SetSkills injects the JOB-10 skill library (serve passes core's store for <config-dir>/skills). Like SetXfer it needs no router rebuild: the /v1/skills routes are always mounted and answer 503 while no library is wired, so a server without one (mcp, most tests) keeps the identical router.
func (*Server) SetTrackerStore ¶
SetTrackerStore injects the server mirror store used by tracker sync routes.
func (*Server) SetTunnelPresets ¶
func (s *Server) SetTunnelPresets(st TunnelPresetStore)
SetTunnelPresets injects the preset store (serve wires the metadata store). It mounts no routes, so it does not rebuild the router.
func (*Server) SetWebPush ¶
func (s *Server) SetWebPush(service WebPushService)
SetWebPush injects W2b after server construction. All routes are registered unconditionally, so no router rebuild is necessary.
func (*Server) SetWorkerReloader ¶
func (s *Server) SetWorkerReloader(r workerReloader)
SetWorkerReloader injects the worker-reload seam (serve). Mounting no route, it does not rebuild the router: the endpoint is always registered and answers 503 while no reloader is wired.
func (*Server) SetWorkerUpgrader ¶
func (s *Server) SetWorkerUpgrader(u workerUpgrader)
func (*Server) SetWorkerUpgrades ¶
func (s *Server) SetWorkerUpgrades(m *workerupgrade.Manager)
SetWorkerUpgrades injects the staging + upgrade-record store (nil = remote upgrade unavailable, the routes answer 503).
func (*Server) SetXfer ¶
SetXfer injects the XFER-01 transfer manager (serve passes core's). Unlike SetPresence it needs no router rebuild: the /v1/xfer routes are always mounted and answer 503 while no manager is wired, so a server without transfers (mcp, most tests) keeps the identical router.
func (*Server) StartHostedAutostart ¶
func (s *Server) StartHostedAutostart()
StartHostedAutostart restores only stored presets explicitly marked autostart. Forwarder listeners bind immediately; worker dialing remains lazy inside the Forwarder, so a worker reconnect race cannot prevent server startup.
func (*Server) StartNudgeSweeper ¶
func (s *Server) StartNudgeSweeper(stop <-chan struct{})
StartNudgeSweeper runs the session-nudge sweeper (N2 §E) until stop closes: one pass at startup, then every nudgeSweepInterval. It is the server's own goroutine because the relay service lives here; serve only starts it.
func (*Server) Steward ¶
Steward returns the steward service (nil without a job store); serve feeds it config and runs its loop.
func (*Server) StopHostedForwarders ¶
func (s *Server) StopHostedForwarders()
func (*Server) UserCallerIDs ¶
UserCallerIDs exposes the already-resolved auth identities to assembly without making webpush parse config tokens a second time.
type TunnelPresetStore ¶
type TunnelPresetStore interface {
UpsertTunnelPreset(rec jobstore.TunnelPresetRecord) error
GetTunnelPreset(name string) (jobstore.TunnelPresetRecord, bool, error)
ListTunnelPresets() ([]jobstore.TunnelPresetRecord, error)
DeleteTunnelPreset(name string) error
}
TunnelPresetStore is the narrow persistence seam for those presets, the same shape PtySessionStore uses: the entry layer asks for four operations and *jobstore.Store satisfies it. A nil store leaves the routes mounted but answering 503 (mcp / most tests), which is the degradation /v1/xfer and the config writes already use.
type WebPushService ¶
type WebPushService interface {
PublicKey() (string, error)
Subscribe(callerID string, input webpush.SubscriptionInput, userAgent string) (jobstore.PushSubscription, error)
ListSubscriptions(callerID string) ([]jobstore.PushSubscription, error)
DeleteSubscription(callerID, endpoint string) (bool, error)
QueueTest(callerID string) (int, error)
Act(token, option string) (job.Interaction, error)
}
type WorkerCaps ¶
type WorkerCaps struct {
Labels []string `json:"labels"`
Projects []string `json:"projects"`
Agents []string `json:"agents"`
AgentCaps []AgentBrief `json:"agent_caps,omitempty"`
MaxConcurrent int `json:"max_concurrent"`
}
WorkerCaps is the worker's capability snapshot after a successful reload — the proof that the new config took effect. It mirrors the hub's caps frame but is redeclared here (like AgentBrief) so httpapi never imports wshub/wsproto; the serve-side adapter constructs it, hence the exported fields.
type WorkerReloadOutcome ¶
type WorkerReloadOutcome struct {
Status WorkerReloadStatus
Detail string
Caps WorkerCaps
}
WorkerReloadOutcome is the adapter's structured answer to one reload request. It is deliberately (status, detail) rather than a Go error: classifying an error means matching on the types that define it, and those live in wshub — so the matching happens ONCE, in the serve-side adapter, and this package maps a status onto a status code. Detail is the human-readable reason (for WorkerReloadRejected: the worker's verbatim message).
type WorkerReloadStatus ¶
type WorkerReloadStatus string
WorkerReloadStatus classifies the outcome of one worker config reload. It is the transport-agnostic vocabulary the serve-side adapter translates the hub's error taxonomy into, so this package can pick a status code without importing wshub (the D2/G022 boundary — see workerReloader).
const ( // WorkerReloadApplied: the worker re-read its config and is now running it. WorkerReloadApplied WorkerReloadStatus = "applied" // WorkerReloadRejected: the worker answered but REFUSED the new config (bad // yaml, unknown agent, …) and still runs the previous one. Detail carries its // own words and must reach the user unchanged. WorkerReloadRejected WorkerReloadStatus = "rejected" // WorkerReloadOffline: the worker has no live connection (never connected, or // dropped while we waited for the receipt). WorkerReloadOffline WorkerReloadStatus = "offline" // WorkerReloadTooOld: the worker is connected and healthy but speaks a protocol // with no reload frame. It keeps working; it just has to be restarted to pick up // a new config. WorkerReloadTooOld WorkerReloadStatus = "too_old" // WorkerReloadTimedOut: no receipt within the deadline. The reload is NOT known // to have failed — the worker may still apply it — so it is reported as "no // receipt in time", never as "reload failed". WorkerReloadTimedOut WorkerReloadStatus = "timeout" // WorkerReloadFailed: anything else (write error, hub not wired, cancelled). WorkerReloadFailed WorkerReloadStatus = "failed" )
type WorkerStatus ¶
type WorkerStatus struct {
Connected bool `json:"connected"`
LastHeartbeat int64 `json:"last_heartbeat"` // unix millis of the most recent inbound frame
InFlight int `json:"in_flight"`
Labels []string `json:"labels,omitempty"`
Projects []string `json:"projects,omitempty"`
// Agents stays the bare agent-key list (validation / selector, back-compat);
// AgentCaps carries the typed detail (type/interactive) the UI cascade needs.
Agents []string `json:"agents,omitempty"`
AgentCaps []AgentBrief `json:"agent_caps,omitempty"`
// Tools are the worker's declared external tools (CFG-16), display only.
Tools []config.Tool `json:"tools,omitempty"`
// Node info reported by the worker on register (P1), surfaced for the P4
// runners observability panel.
OS string `json:"os,omitempty"`
Arch string `json:"arch,omitempty"`
// Hostname is the worker's self-reported machine hostname; RemoteAddr is the
// conn's remote address as the hub saw it (may be a NAT/bridge address —
// hostname is the machine-identifying field).
Hostname string `json:"hostname,omitempty"`
RemoteAddr string `json:"remote_addr,omitempty"`
GoferVersion string `json:"gofer_version,omitempty"`
StartedAt int64 `json:"started_at,omitempty"` // worker process start, unix seconds
// ProtocolVersion is the wire version this worker registered with. Surfaced so
// an operator can spot a too-old worker (reload/policy gated by
// wsproto.SupportsReload/SupportsPolicy) before a reload/policy push 409s.
ProtocolVersion int `json:"protocol_version,omitempty"`
MessengerStatus string `json:"messenger_status,omitempty"`
// MessengerDetail and Dirs come from the worker's heartbeat (protocol v16). nil =
// the worker never reported them (an older build, or no heartbeat yet): the console
// shows "unknown", not "stopped".
MessengerDetail *messenger.Snapshot `json:"messenger_detail,omitempty"`
Dirs *DirsView `json:"dirs,omitempty"`
// Draining is true while the worker is upgrading itself and takes no new jobs.
Draining bool `json:"draining,omitempty"`
PolicyPending bool `json:"policy_pending,omitempty"`
PolicyRev int64 `json:"policy_rev,omitempty"`
AppliedRev int64 `json:"applied_rev,omitempty"`
PolicyRejected []PolicyRejection `json:"policy_rejected,omitempty"`
PolicyDegraded []PolicyDegrade `json:"policy_degraded,omitempty"`
}
WorkerStatus is the read-only worker view the handler renders (C6/P4). It is produced by the serve-side adapter from the wshub registry snapshot, so httpapi never imports wshub's internal types. Connected=false means offline / never connected (rendered as `disconnected`). The /v1/workers/{id} views serialize it directly, so it carries the API's snake_case field names.
Source Files
¶
- acp_stream_handler.go
- agent_handler.go
- agent_probe_handler.go
- artifact_handler.go
- attach_handler.go
- attach_ticket_handler.go
- attach_ticket_store.go
- auth.go
- comment_handler.go
- config_handler.go
- config_write_handler.go
- decision_handler.go
- delivery_handler.go
- diff_handler.go
- event_handler.go
- finding_issue_handler.go
- http_error.go
- interaction_handler.go
- issue_read_handler.go
- job_delete_handler.go
- job_handler.go
- job_include.go
- job_redact_handler.go
- job_title_handler.go
- jobcredential.go
- local_pty_observer.go
- mcp_handler.go
- mdreq.go
- memory_candidate_handler.go
- meta_handler.go
- metrics_handler.go
- plan_handler.go
- plan_handoff.go
- presence_handler.go
- project_browse_handler.go
- project_handler.go
- pty_connect_handler.go
- pty_recording_handler.go
- pty_session_capture.go
- pty_sessions_handler.go
- pty_source.go
- push_handler.go
- ratelimit.go
- respond.go
- retry_handler.go
- rules_handler.go
- runner_handler.go
- runner_messenger_handler.go
- schedule_handler.go
- scoped_memory_handler.go
- secret_scan_handler.go
- server.go
- session_ask_handler.go
- session_handler.go
- session_inject.go
- session_job_handler.go
- session_nudge_handler.go
- session_permission_handler.go
- session_resume_handler.go
- skills_handler.go
- stats_handler.go
- stats_overview_handler.go
- steward_handler.go
- steward_wiring.go
- stream_handler.go
- template_handler.go
- today_advice_handler.go
- today_handler.go
- today_lanes_handler.go
- today_memory_handler.go
- today_snooze_handler.go
- tracker_handler.go
- tracker_repo_sync_handler.go
- tunnel_forwarder_handler.go
- tunnel_handler.go
- tunnel_hosted_handler.go
- tunnel_preset_handler.go
- wakeup_handler.go
- work_handler.go
- work_outcomes.go
- work_summarize_handler.go
- work_wiring.go
- workbench_handler.go
- workbench_review_handler.go
- worker_assignable_handler.go
- worker_registration.go
- worker_reload_handler.go
- worker_upgrade_handler.go
- worker_view_handler.go
- workflow_handler.go
- worktree_handler.go
- ws_handler.go
- xfer_handler.go