Documentation
¶
Overview ¶
Package fleetreg pushes this host's fleet inventory — the tools, agents, and skills it has installed — up to cloudbox.
It is the counterpart of internal/agent/ollama's model-registry watcher, and deliberately the same shape: the host is the source of truth about itself, cloudbox caches that truth behind a freshness clock, and a content hash lets an unchanged snapshot cost one UPDATE instead of a rewrite.
The inventory is read straight out of coreutils/pkg/fleet rather than by shelling out to `bashy`. Outpost already depends on coreutils, so the registry is a library call — and a host that has no bashy binary installed still has a fleet, because the compiled-in baseline is part of the library.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContentHash ¶
ContentHash is a deterministic sha256 over the reported inventory.
The push order cannot change it (assets are sorted), and no timestamp enters it — the whole point is that an unchanged host hashes the same across polls, so cloudbox can skip the rewrite and just move the freshness clock.
Types ¶
type Asset ¶
type Asset struct {
Kind string `json:"kind"`
Name string `json:"name"`
Display string `json:"display,omitempty"`
Detail string `json:"detail,omitempty"`
}
Asset is one reported tool / agent / skill.
type Config ¶
type Config struct {
// CloudboxURL is the base URL (e.g. https://ai.dhnt.io).
CloudboxURL string
// AccessToken is the per-outpost bearer JWT. It must carry
// fleet:registry — the scope minted for a HOST reporting a fact about
// itself, not for a user authoring a definition.
AccessToken string
// AgentName is the host name cloudbox knows this outpost by.
AgentName string
PollInterval time.Duration
HeartbeatInterval time.Duration
HTTP *http.Client
// Catalog is indirected for tests. Nil uses the host's real registry.
Catalog func() *fleet.Catalog
// Skills lists the skills installed in the host's local store. Nil uses
// the default reader.
//
// It reads directory names rather than importing coreutils/pkg/skills:
// that package pulls the dhnt skill-CNL runtime, and outpost is the lean
// mesh supervisor. A name is all the inventory needs — a peer asking
// "does host-a have the conductor skill" wants a yes, not the procedure.
Skills func() []string
}
Config configures the watcher.
type PushError ¶
PushError carries the HTTP status so the caller can honor the endpoint's contract: 401 means stop (revoked or unknown token), 403 means the token lacks fleet:registry, 404 means this host is not paired under that owner. Only 5xx is worth retrying.
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher polls the local fleet registry and pushes changes.
func (*Watcher) Push ¶
Push sends one snapshot. It returns the server's `applied` verdict ("replaced" or "touched") so a caller can log what actually happened.
func (*Watcher) Run ¶
Run polls until ctx is cancelled, pushing when the inventory changes and on a heartbeat so the freshness clock keeps ticking.
A failed push is logged and retried on the next tick; it never takes the daemon down. The inventory is a convenience for peers, not a dependency of anything running on this host.