package types import "time" // SystemMetrics represents comprehensive system performance metrics type SystemMetrics struct { // System Information Hostname string `json:"hostname"` Platform string `json:"platform"` PlatformFamily string `json:"platform_family"` PlatformVersion string `json:"platform_version"` KernelVersion string `json:"kernel_version"` KernelArch string `json:"kernel_arch"` // CPU Metrics CPUUsage float64 `json:"cpu_usage"` CPUCores int `json:"cpu_cores"` CPUModel string `json:"cpu_model"` // Memory Metrics MemoryUsage float64 `json:"memory_usage"` MemoryTotal uint64 `json:"memory_total"` MemoryUsed uint64 `json:"memory_used"` MemoryFree uint64 `json:"memory_free"` MemoryAvailable uint64 `json:"memory_available"` SwapTotal uint64 `json:"swap_total"` SwapUsed uint64 `json:"swap_used"` SwapFree uint64 `json:"swap_free"` // Disk Metrics DiskUsage float64 `json:"disk_usage"` DiskTotal uint64 `json:"disk_total"` DiskUsed uint64 `json:"disk_used"` DiskFree uint64 `json:"disk_free"` // Network Metrics NetworkInKbps float64 `json:"network_in_kbps"` NetworkOutKbps float64 `json:"network_out_kbps"` NetworkInBytes uint64 `json:"network_in_bytes"` NetworkOutBytes uint64 `json:"network_out_bytes"` // System Load LoadAvg1 float64 `json:"load_avg_1"` LoadAvg5 float64 `json:"load_avg_5"` LoadAvg15 float64 `json:"load_avg_15"` // Process Information ProcessCount int `json:"process_count"` // Network Information IPAddress string `json:"ip_address"` Location string `json:"location"` // Filesystem Information FilesystemInfo []FilesystemInfo `json:"filesystem_info"` BlockDevices []BlockDevice `json:"block_devices"` // Timestamp Timestamp time.Time `json:"timestamp"` } // FilesystemInfo represents individual filesystem statistics type FilesystemInfo struct { Mountpoint string `json:"mountpoint"` Fstype string `json:"fstype"` Total uint64 `json:"total"` Used uint64 `json:"used"` Free uint64 `json:"free"` UsagePercent float64 `json:"usage_percent"` } // BlockDevice represents block device information type BlockDevice struct { Name string `json:"name"` Size uint64 `json:"size"` Model string `json:"model"` SerialNumber string `json:"serial_number"` } // NetworkStats represents detailed network interface statistics type NetworkStats struct { InterfaceName string `json:"interface_name"` BytesSent uint64 `json:"bytes_sent"` BytesRecv uint64 `json:"bytes_recv"` PacketsSent uint64 `json:"packets_sent"` PacketsRecv uint64 `json:"packets_recv"` ErrorsIn uint64 `json:"errors_in"` ErrorsOut uint64 `json:"errors_out"` DropsIn uint64 `json:"drops_in"` DropsOut uint64 `json:"drops_out"` } // AuthToken represents the authentication token structure type AuthToken struct { AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` ExpiresAt time.Time `json:"expires_at"` TokenType string `json:"token_type"` AgentID string `json:"agent_id"` } // DeviceAuthRequest represents the device authorization request type DeviceAuthRequest struct { ClientID string `json:"client_id"` Scope string `json:"scope,omitempty"` } // DeviceAuthResponse represents the device authorization response type DeviceAuthResponse struct { DeviceCode string `json:"device_code"` UserCode string `json:"user_code"` VerificationURI string `json:"verification_uri"` ExpiresIn int `json:"expires_in"` Interval int `json:"interval"` } // TokenRequest represents the token request for device flow type TokenRequest struct { GrantType string `json:"grant_type"` DeviceCode string `json:"device_code,omitempty"` RefreshToken string `json:"refresh_token,omitempty"` ClientID string `json:"client_id,omitempty"` } // TokenResponse represents the token response type TokenResponse struct { AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` TokenType string `json:"token_type"` ExpiresIn int `json:"expires_in"` AgentID string `json:"agent_id,omitempty"` Error string `json:"error,omitempty"` ErrorDescription string `json:"error_description,omitempty"` } // HeartbeatRequest represents the agent heartbeat request type HeartbeatRequest struct { AgentID string `json:"agent_id"` Status string `json:"status"` Metrics SystemMetrics `json:"metrics"` } // MetricsRequest represents the flattened metrics payload expected by agent-auth-api type MetricsRequest struct { // Agent identification AgentID string `json:"agent_id"` // Basic metrics CPUUsage float64 `json:"cpu_usage"` MemoryUsage float64 `json:"memory_usage"` DiskUsage float64 `json:"disk_usage"` // Network metrics NetworkInKbps float64 `json:"network_in_kbps"` NetworkOutKbps float64 `json:"network_out_kbps"` // System information IPAddress string `json:"ip_address"` Location string `json:"location"` AgentVersion string `json:"agent_version"` KernelVersion string `json:"kernel_version"` DeviceFingerprint string `json:"device_fingerprint"` // Structured data (JSON fields in database) LoadAverages map[string]float64 `json:"load_averages"` OSInfo map[string]string `json:"os_info"` FilesystemInfo []FilesystemInfo `json:"filesystem_info"` BlockDevices []BlockDevice `json:"block_devices"` NetworkStats map[string]uint64 `json:"network_stats"` } // eBPF related types type EBPFEvent struct { Timestamp int64 `json:"timestamp"` EventType string `json:"event_type"` ProcessID int `json:"process_id"` ProcessName string `json:"process_name"` UserID int `json:"user_id"` Data map[string]interface{} `json:"data"` } type EBPFTrace struct { TraceID string `json:"trace_id"` StartTime time.Time `json:"start_time"` EndTime time.Time `json:"end_time"` Capability string `json:"capability"` Events []EBPFEvent `json:"events"` Summary string `json:"summary"` EventCount int `json:"event_count"` ProcessList []string `json:"process_list"` } type EBPFRequest struct { Name string `json:"name"` Type string `json:"type"` // "tracepoint", "kprobe", "kretprobe" Target string `json:"target"` // tracepoint path or function name Duration int `json:"duration"` // seconds Filters map[string]string `json:"filters,omitempty"` Description string `json:"description"` } type NetworkEvent struct { Timestamp uint64 `json:"timestamp"` PID uint32 `json:"pid"` TID uint32 `json:"tid"` UID uint32 `json:"uid"` EventType string `json:"event_type"` Comm [16]byte `json:"-"` CommStr string `json:"comm"` } // Agent types type DiagnosticResponse struct { ResponseType string `json:"response_type"` Reasoning string `json:"reasoning"` Commands []Command `json:"commands"` } type ResolutionResponse struct { ResponseType string `json:"response_type"` RootCause string `json:"root_cause"` ResolutionPlan string `json:"resolution_plan"` Confidence string `json:"confidence"` } type Command struct { ID string `json:"id"` Command string `json:"command"` Description string `json:"description"` } type CommandResult struct { ID string `json:"id"` Command string `json:"command"` Description string `json:"description"` Output string `json:"output"` ExitCode int `json:"exit_code"` Error string `json:"error,omitempty"` } type EBPFEnhancedDiagnosticResponse struct { ResponseType string `json:"response_type"` Reasoning string `json:"reasoning"` Commands []Command `json:"commands"` EBPFPrograms []EBPFRequest `json:"ebpf_programs"` NextActions []string `json:"next_actions,omitempty"` } type TensorZeroRequest struct { Model string `json:"model"` Messages []map[string]interface{} `json:"messages"` EpisodeID string `json:"tensorzero::episode_id,omitempty"` } type TensorZeroResponse struct { Choices []map[string]interface{} `json:"choices"` EpisodeID string `json:"episode_id"` } // WebSocket types type WebSocketMessage struct { Type string `json:"type"` Data interface{} `json:"data"` } type InvestigationTask struct { TaskID string `json:"task_id"` InvestigationID string `json:"investigation_id"` AgentID string `json:"agent_id"` DiagnosticPayload map[string]interface{} `json:"diagnostic_payload"` EpisodeID string `json:"episode_id,omitempty"` } type TaskResult struct { TaskID string `json:"task_id"` Success bool `json:"success"` CommandResults map[string]interface{} `json:"command_results,omitempty"` Error string `json:"error,omitempty"` } type HeartbeatData struct { AgentID string `json:"agent_id"` Timestamp time.Time `json:"timestamp"` Version string `json:"version"` } // Investigation server types type InvestigationRequest struct { Issue string `json:"issue"` AgentID string `json:"agent_id"` EpisodeID string `json:"episode_id,omitempty"` Timestamp string `json:"timestamp,omitempty"` Priority string `json:"priority,omitempty"` Description string `json:"description,omitempty"` } type InvestigationResponse struct { Status string `json:"status"` Message string `json:"message"` Results map[string]interface{} `json:"results,omitempty"` AgentID string `json:"agent_id"` Timestamp string `json:"timestamp"` EpisodeID string `json:"episode_id,omitempty"` Investigation *PendingInvestigation `json:"investigation,omitempty"` } type PendingInvestigation struct { ID string `json:"id"` Issue string `json:"issue"` AgentID string `json:"agent_id"` Status string `json:"status"` DiagnosticPayload map[string]interface{} `json:"diagnostic_payload"` CommandResults map[string]interface{} `json:"command_results,omitempty"` EpisodeID *string `json:"episode_id,omitempty"` CreatedAt string `json:"created_at"` StartedAt *string `json:"started_at,omitempty"` CompletedAt *string `json:"completed_at,omitempty"` ErrorMessage *string `json:"error_message,omitempty"` } // System types type SystemInfo struct { Hostname string `json:"hostname"` Platform string `json:"platform"` PlatformInfo map[string]string `json:"platform_info"` KernelVersion string `json:"kernel_version"` Uptime string `json:"uptime"` LoadAverage []float64 `json:"load_average"` CPUInfo map[string]string `json:"cpu_info"` MemoryInfo map[string]string `json:"memory_info"` DiskInfo []map[string]string `json:"disk_info"` } // Executor types type CommandExecutor struct { timeout time.Duration }