Documentation
¶
Overview ¶
Package fleetview is the DELEGATOR-side operator overview: it polls every configured node's /fleet/health and /fleet/jobs, keeps a bounded per-node history for sparklines, folds in the delegation-log corpus, and exposes a single Overview snapshot for Task 6's embedded page to serve as JSON.
This package intentionally does NOT reuse delegate.FetchNodeView — that decoder discards the graph fields (gpu_devices, host_cpu_pct, ...) this view needs, and pulling in internal/delegate would drag the whole delegator (placement gate, dispatch, ledger) into a read-only viewer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHandler ¶
NewHandler serves the read-only operator overview: the embedded page at "/", the live Overview snapshot as JSON at "/api/overview", and a plain health check at "/healthz". It never issues any outbound request itself — all polling happens in the Poller this handler only reads from.
func NewTop ¶
NewTop constructs the `top` Bubble Tea program's model. ui is the fleet-ui base URL; interval is the poll period.
func RenderTop ¶
RenderTop is the pure, tested core of the `top` terminal view: a plain-text rendering of an Overview snapshot, independent of Bubble Tea so it can be unit-tested without a TTY. It builds three sections — a header line, a per-node table, and JOBS/ERRORS feeds — mirroring fleet-ui's page but for headless boxes with no browser. width bounds the free-text columns (probe errors, error messages) so a long message can't blow a narrow terminal's line wrapping.
Types ¶
type CardHolder ¶
type CardHolder struct {
Epoch uint64 `json:"epoch"`
Class string `json:"class"`
Verdict string `json:"verdict"`
Scope string `json:"scope"`
RemainingSec int `json:"remaining_sec,omitempty"`
Overdue bool `json:"overdue,omitempty"`
}
CardHolder is the lease on a card: its epoch, class, the node's verdict word for what it is doing, where its cards came from (declared, inferred, whole-node) and how long it has left.
type CardTile ¶
type CardTile struct {
Index int `json:"index"`
UUID string `json:"uuid"`
Name string `json:"name"`
VramUsedGB float64 `json:"vram_used_gb"`
VramTotalGB float64 `json:"vram_total_gb"`
UtilPct int `json:"util_pct"`
UtilKnown bool `json:"util_known"`
// Display marks the operator's display card: never free for work.
Display bool `json:"display,omitempty"`
// Free: no lease holds the card, it is not the display card, and it is measurably idle.
// A card that is busy under no lease is busy outside the harness, and is not free.
Free bool `json:"free"`
// Holder is the lease that holds this card; nil when none does.
Holder *CardHolder `json:"holder,omitempty"`
}
CardTile is one card of a node as the operator reads it: what the card is doing and which lease, if any, holds it.
type Error ¶
type Error struct {
At int64 `json:"at"`
Severity string `json:"severity"`
Node string `json:"node"`
Source string `json:"source"`
Message string `json:"message"`
}
Error is one operator-facing event: a probe failure, a job that finished in state "error", or a deferred/failed delegation-log row.
type Node ¶
type Node struct {
Base string `json:"base"`
NodeID string `json:"node_id"`
Reachable bool `json:"reachable"`
ProbeError string `json:"probe_error,omitempty"`
Version string `json:"harness_version,omitempty"`
GpuVendor string `json:"gpu_vendor,omitempty"`
GpuArch string `json:"gpu_arch,omitempty"`
VramTotal float64 `json:"vram_total_gb"`
VramFree float64 `json:"vram_free_gb"`
Devices []map[string]any `json:"gpu_devices,omitempty"`
// Leases is the node's live leases as it published them (health leases[], GPU routing P7),
// kept raw for the page. Cards joins them to Devices: one tile per card with the lease that
// holds it. Both are absent from a node that publishes no lease or no devices.
Leases []map[string]any `json:"leases,omitempty"`
Cards []CardTile `json:"cards,omitempty"`
GpuUtil int `json:"gpu_util_pct"`
GpuUtilKnown bool `json:"gpu_util_known"`
HostCPU int `json:"host_cpu_pct"`
RamUsed float64 `json:"host_ram_used_gb"`
RamTotal float64 `json:"host_ram_total_gb"`
AgentEnabled bool `json:"agent_enabled"`
AgentResident bool `json:"agent_seat_resident"`
AgentSeat string `json:"agent_seat,omitempty"`
AgentCtx int `json:"agent_ctx_tokens"`
ServedModels []string `json:"served_models,omitempty"`
QueueDepth int `json:"queue_depth"`
JobsRunning int `json:"jobs_running"`
JobsQueued int `json:"jobs_queued"`
MaxConcurrent int `json:"max_concurrent_jobs"`
MaxQueue int `json:"max_queue_depth"`
History []Point `json:"history"`
Jobs []map[string]any `json:"jobs"`
LastSeen int64 `json:"last_seen"`
}
Node is one polled node's current state plus its bounded history and recent jobs. JSON tags are exact — the embedded overview page (Task 6) reads them verbatim.
type Overview ¶
type Overview struct {
At int64 `json:"at"`
DelegationEnabled bool `json:"delegation_enabled"`
Nodes []Node `json:"nodes"`
Errors []Error `json:"errors"`
Delegations []map[string]any `json:"delegations"`
}
Overview is the full snapshot Task 6 serves as JSON.
Delegations carries only errors.go's delegationRowFields — operational telemetry (where a contract landed, whether it passed, how long it took), never contract CONTENT. This whole endpoint is unauthenticated, so that exclusion is load-bearing: see delegationRowFields's doc comment.
type Point ¶
type Point struct {
At int64 `json:"at"`
GpuUtil int `json:"gpu_util"`
CPU int `json:"cpu"`
VramFree float64 `json:"vram_free_gb"`
RamUsed float64 `json:"ram_used_gb"`
}
Point is one bounded history sample for a node's sparklines.
type Poller ¶
type Poller struct {
// contains filtered or unexported fields
}
Poller periodically probes every configured base's /fleet/health and /fleet/jobs, folds the delegation-log corpus, and exposes the result through Snapshot(). All mutable state lives behind mu.
func NewPoller ¶
NewPoller builds a Poller for bases (already-resolved node base URLs). It does not start probing — call Run.