Documentation
¶
Overview ¶
Package ovdash contains the read-only data plumbing behind cmd/overmind-dashboard: galaxy topology, live fleet snapshots, SSE deltas, and earnings accounting. Nothing in this package writes anywhere.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Fleets = []FleetDef{
{File: "fleet", Label: "haul", Color: "#d4a017", Socket: "haul.sock"},
{File: "mission-learn", Label: "mission", Color: "#22d3ee", Socket: "mission-learn.sock"},
{File: "craft", Label: "craft", Color: "#34d399", Socket: "craft.sock"},
{File: "mb", Label: "mb", Color: "#a78bfa", Socket: "mb.sock"},
{File: "assist", Label: "assist", Color: "#fb923c", Socket: "assist.sock"},
{File: "shuttle", Label: "shuttle", Color: "#f472b6", Socket: "shuttle.sock"},
}
Fleets is the fixed fleet registry. Order is display order.
Functions ¶
This section is empty.
Types ¶
type Accounting ¶
type Accounting struct {
TotalCredits float64 `json:"total_credits"`
Agents int `json:"agents"`
Healthy int `json:"healthy"`
Unseen int `json:"unseen"`
Restarts int `json:"restarts"`
Haul SourceEarnings `json:"haul"`
Freight SourceEarnings `json:"freight"`
Missions SourceEarnings `json:"missions"`
CombinedPerHour float64 `json:"combined_per_hour"`
PerAgentPerHour float64 `json:"per_agent_per_hour"`
OldestCapture string `json:"oldest_capture"`
}
Accounting is the top-strip payload.
func BuildAccounting ¶
func BuildAccounting(s *Snapshot, haul, freight, missions SourceEarnings, window time.Duration) Accounting
BuildAccounting merges live snapshot totals with the earnings streams.
type AdminResult ¶
type AdminResult struct {
Status string `json:"status"` // accepted | unknown_agent | already_pending | recorded_offline
Detail string `json:"detail,omitempty"`
}
AdminResult is the dashboard-facing outcome of a membership action.
func AdminReadd ¶
func AdminReadd(dir, fleetLabel, agentID string) (AdminResult, error)
AdminReadd clears agentID from the overrides sidecar, then asks the live overmind to relaunch it from its yaml spec.
func AdminRemove ¶
func AdminRemove(dir, fleetLabel, agentID string) (AdminResult, error)
AdminRemove records agentID in the fleet's overrides sidecar, then asks the live overmind to remove it. A dead socket is the documented degraded mode: the override alone guarantees the removal applies at the next overmind boot.
type AgentMove ¶
type AgentMove struct {
Agent AgentState `json:"agent"`
FromSystemID string `json:"from_system_id"`
}
AgentMove is a system transition; FromSystemID lets the frontend animate along the lane between the two systems.
type AgentState ¶
type AgentState struct {
Fleet string `json:"fleet"`
AgentID string `json:"agent_id"`
Role string `json:"role"`
SystemID string `json:"system_id"`
SystemName string `json:"system_name"`
POI string `json:"poi"`
Docked bool `json:"docked"`
Credits float64 `json:"credits"`
Hull float64 `json:"hull"`
MaxHull float64 `json:"max_hull"`
Fuel float64 `json:"fuel"`
MaxFuel float64 `json:"max_fuel"`
CargoUsed float64 `json:"cargo_used"`
CargoCap float64 `json:"cargo_capacity"`
Activity string `json:"activity,omitempty"`
Healthy bool `json:"healthy"`
Seen bool `json:"seen"`
Restarts int `json:"restarts"`
LastSeen string `json:"last_seen"`
Leaving bool `json:"leaving,omitempty"`
// Build identity (from the worker's Hello, via the status file). Tier is
// this build's color vs the current (newest) fleet build. Modified is the
// cosmetic raw vcs.modified flag; CodeDirty drives the tier.
Version string `json:"version,omitempty"`
Commit string `json:"commit,omitempty"`
BuiltAt string `json:"built_at,omitempty"`
CodeDirty bool `json:"code_dirty,omitempty"`
Modified bool `json:"modified,omitempty"`
Tier Tier `json:"tier,omitempty"`
}
AgentState is one worker in one snapshot, system resolved to a map id.
type Delta ¶
type Delta struct {
Moved []AgentMove `json:"moved"`
Updated []AgentState `json:"updated"`
Joined []AgentState `json:"joined"`
Left []string `json:"left"`
StaleFleets []string `json:"stale_fleets"`
}
Delta is the between-snapshots change set pushed over SSE.
type FleetDef ¶
type FleetDef struct {
File string // status file prefix: data/overmind/<File>-status.json
Label string
Color string
Socket string // basename of the fleet's control-channel unix socket
}
FleetDef names one fleet's status file and how the UI labels/colors it.
type Galaxy ¶
type Galaxy struct {
Systems []SystemNode
// contains filtered or unexported fields
}
Galaxy is the immutable topology loaded once at startup.
func LoadGalaxy ¶
LoadGalaxy reads systems and connections from the knowledge DB (read-only).
func (*Galaxy) ResolveName ¶
ResolveName maps a display name ("Nova Terra") to a system id, case-insensitively.
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub fans SSE events out to connected dashboard clients.
func (*Hub) Broadcast ¶
Broadcast sends an event to every connected client. A client whose buffer is full is dropped (its next keyframe reconnect self-heals) — a stuck browser must never block the loop.
func (*Hub) CloseAll ¶
func (h *Hub) CloseAll()
CloseAll disconnects every client (shutdown and tests).
func (*Hub) ServeHTTP ¶
func (h *Hub) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP is the SSE endpoint.
func (*Hub) SetKeyframe ¶
SetKeyframe stores the frame every new connection receives first.
type OvermindInfo ¶
type OvermindInfo struct {
Version string `json:"version,omitempty"`
Commit string `json:"commit,omitempty"`
BuiltAt string `json:"built_at,omitempty"`
CodeDirty bool `json:"code_dirty,omitempty"`
Modified bool `json:"modified,omitempty"`
Tier Tier `json:"tier,omitempty"` // the overmind's own tier
FleetTier Tier `json:"fleet_tier,omitempty"` // worst tier in the fleet
}
OvermindInfo is one fleet's overmind build identity plus the rolled-up worst tier across that overmind and all its workers.
type POI ¶
type POI struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Class string `json:"class"`
X float64 `json:"x"`
Y float64 `json:"y"`
}
POI is one point of interest inside a system, in the shape the frontend's SystemView consumes. Coordinates are the KB's system-local units.
type Snapshot ¶
type Snapshot struct {
CapturedAt map[string]string `json:"captured_at"` // fleet label -> RFC3339
Agents []AgentState `json:"agents"` // system resolved
OffMap []AgentState `json:"off_map"` // unresolvable system names
StaleFleets []string `json:"stale_fleets"` // labels; missing/old/corrupt
Removed map[string][]string `json:"removed,omitempty"` // fleet label -> override-removed agent ids
Overminds map[string]OvermindInfo `json:"overminds,omitempty"` // fleet label -> overmind build
}
Snapshot is the merged live view across every fleet.
func ReadSnapshot ¶
func ReadSnapshot(dir string, g *Galaxy, now time.Time, staleAfter time.Duration) (*Snapshot, error)
ReadSnapshot reads every fleet status file under dir and merges them. A missing, corrupt, or older-than-staleAfter file marks that fleet stale; its last-good agents (if parseable) still appear — greying out is UI policy, data completeness is ours.
type SourceEarnings ¶
type SourceEarnings struct {
Total float64 `json:"total"`
PerHour float64 `json:"per_hour"`
Count int `json:"count"`
}
SourceEarnings is one earnings stream's trailing-window aggregate.
type SystemNode ¶
type SystemNode struct {
ID string `json:"id"`
Name string `json:"name"`
X float64 `json:"-"`
Y float64 `json:"-"`
Empire string `json:"empire"`
Police int `json:"police_level"`
Stronghold bool `json:"is_stronghold"`
LastVisited int64 `json:"last_visited_tick"`
Connections []string `json:"connections"`
}
SystemNode is one galaxy system in the shape the frontend's useGalaxyMap hook already consumes (GalaxySystem in frontend/src/lib/useGalaxyMap.ts).
func (SystemNode) MarshalJSON ¶
func (n SystemNode) MarshalJSON() ([]byte, error)
MarshalJSON emits the nested {"position":{"x","y"}} object the frontend expects while keeping flat float fields internally.
type Tier ¶
type Tier string
Tier is a build-freshness color relative to the current (newest) fleet build.