Initial commit: AetherForge Linux (forge-mesh) v0.1.0-dev
Some checks failed
Test / test (push) Has been cancelled

This commit is contained in:
drjones
2026-07-04 09:31:23 +00:00
commit 3678b199d0
154 changed files with 21714 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
package types
import "time"
// Build represents a forge-produced agent artifact.
type Build struct {
ID string `json:"id"`
OS string `json:"os"`
Arch string `json:"arch"`
Version string `json:"version"`
Checksum string `json:"checksum"`
Signature string `json:"signature,omitempty"`
Public bool `json:"public"`
Path string `json:"path,omitempty"`
CreatedAt time.Time `json:"created_at"`
}

View File

@@ -0,0 +1,13 @@
package types
import "time"
// Campaign tracks Emberwake funnel tags (?c=).
type Campaign struct {
ID string `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
Pin string `json:"pin,omitempty"`
Heat int `json:"heat"`
CreatedAt time.Time `json:"created_at"`
}

View File

@@ -0,0 +1,22 @@
package types
import "time"
// Host represents an enrolled fleet member.
type Host struct {
ID string `json:"id"`
Hostname string `json:"hostname"`
Fingerprint string `json:"fingerprint,omitempty"`
Phenotype string `json:"phenotype,omitempty"`
Status string `json:"status"`
Hashrate float64 `json:"hashrate"`
HashrateHps float64 `json:"hashrate_hps"`
CurrentTier int `json:"current_tier"`
TierType string `json:"tier_type,omitempty"`
TierState string `json:"tier_state,omitempty"`
ClearanceLevel int `json:"clearance_level"`
MiningProfileID *string `json:"mining_profile_id,omitempty"`
LastSeenAt *time.Time `json:"last_seen_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}

View File

@@ -0,0 +1,63 @@
package types
import "time"
// HeartbeatPayload is sent by agents over WS or beacon.
type HeartbeatPayload struct {
HostID string `json:"host_id,omitempty"`
Hostname string `json:"hostname"`
Arch string `json:"arch,omitempty"`
Hashrate float64 `json:"hashrate"`
HashrateHps float64 `json:"hashrate_hps"`
CurrentTier int `json:"current_tier"`
TierType string `json:"tier_type,omitempty"`
TierState string `json:"tier_state,omitempty"`
Fingerprint string `json:"fingerprint,omitempty"`
}
// SetHashrateFields keeps hashrate and hashrate_hps in sync for older clients.
func (h *HeartbeatPayload) SetHashrateFields(hps float64) {
h.HashrateHps = hps
h.Hashrate = hps
}
// EffectiveHashrate returns hashrate_hps when set, otherwise legacy hashrate.
func (h HeartbeatPayload) EffectiveHashrate() float64 {
if h.HashrateHps > 0 {
return h.HashrateHps
}
return h.Hashrate
}
// BeaconResponse is returned by HTTPS beacon fallback.
type BeaconResponse struct {
Commands []FleetCommand `json:"commands"`
OK bool `json:"ok"`
Profile *MiningProfile `json:"mining_profile,omitempty"`
}
// WsMessage is the wire format for fleet WebSocket frames.
type WsMessage struct {
Type string `json:"type"`
Host *Host `json:"host,omitempty"`
HostID string `json:"host_id,omitempty"`
Command *FleetCommand `json:"command,omitempty"`
Payload map[string]any `json:"payload,omitempty"`
Timestamp string `json:"timestamp,omitempty"`
}
// FleetCommand is dispatched from deck to agent.
type FleetCommand struct {
ID string `json:"id"`
Action string `json:"action"`
Args map[string]any `json:"args,omitempty"`
IssuedAt time.Time `json:"issued_at"`
}
// MiningProfileRequest assigns or updates a host mining profile.
type MiningProfileRequest struct {
ProfileID string `json:"profile_id,omitempty"`
Name string `json:"name,omitempty"`
WalletAddress string `json:"wallet_address"`
Tiers []MiningTierSpec `json:"tiers,omitempty"`
}

View File

@@ -0,0 +1,21 @@
package types
import "time"
// MiningTierSpec defines one step in a tiered miner chain.
type MiningTierSpec struct {
Type string `json:"type"`
Duration int `json:"duration_minutes,omitempty"`
Config map[string]string `json:"config,omitempty"`
}
// MiningProfile is an ordered list of mining tiers pushed to agents.
type MiningProfile struct {
ID string `json:"id"`
Name string `json:"name"`
WalletAddress string `json:"wallet_address"`
Tiers []MiningTierSpec `json:"tiers"`
PolicyFromServer bool `json:"policy_from_server"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}