huddash

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 10 Imported by: ? 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 huddash renders a self-contained hauler dashboard HTML page (inline SVG, no JavaScript) from the durable haul_results + fleet_timeseries history in market.db plus the live fleet-status.json. It is the Phase-2 generator for docs/superpowers/specs/2026-06-26-hauler-dashboard-design.md.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(in Input) string

Render produces the complete dashboard HTML document.

Types

type AgentData

type AgentData struct {
	AgentID string
	Status  balances.LiveRecord    // current credits/location/fuel/cargo (may be zero if absent)
	HasStat bool                   // whether Status was found in fleet-status.json
	Hauls   []market.HaulResult    // within window
	Series  []market.FleetSnapshot // within window
}

AgentData is one hauler's window-filtered history plus its current status.

type Input

type Input struct {
	GeneratedAt time.Time
	Period      Period
	Window      time.Duration
	Agents      []AgentData // sorted by agent id
}

Input is the fully-assembled render model.

func LoadInput

func LoadInput(ctx context.Context, ld Loader, statusPath string, p Period, window time.Duration, now time.Time) (Input, error)

LoadInput assembles the render model: haul_results + fleet_timeseries from the market DB (window-filtered) joined with the live fleet-status.json. Agents are the haulers in the status file plus any agent that has hauls in the window.

type Loader

type Loader interface {
	GetHaulResults(ctx context.Context, agentID string, limit int) ([]market.HaulResult, error)
	GetFleetSnapshots(ctx context.Context, agentID string, limit int) ([]market.FleetSnapshot, error)
}

Loader is the subset of *market.Collector this package needs (eases testing).

type Period

type Period struct {
	Name string
	Dur  time.Duration
}

Period is a time-bucketing granularity for the per-period charts.

func ParsePeriod

func ParsePeriod(s string) (Period, error)

ParsePeriod maps hour|half_day|day to a Period.

Jump to

Keyboard shortcuts

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