mirror of
https://github.com/j3ssie/osmedeus.git
synced 2026-09-07 18:27:47 +02:00
- Add worker eval command for distributed function execution with Redis hooks registration - Add worker set command to update worker fields (alias, public-ip, ssh-enabled, ssh-keys-path) - Enhance worker status with JSON output, search filtering, and column selection (--columns, --exclude-columns, --search) - Add --keep-setting flag to install base/validate commands to preserve osm-settings.yaml after base installation - Fix binary installation in Nix: replace CopyInstalledBinaryToFolder with SymlinkInstalledBinaryToFolder - Add --clean-ws flag to db clean command for removing workspace data - Add HooksEnabled field to Run records when creating runs from CLI and API - Add comprehensive test coverage for hook execution (pre/post hooks, execution order, failure handling) - Add test coverage for worker commands (eval, set, status with JSON) and db clean operations - Improve usage documentation for worker subcommands and db operations
72 lines
2.6 KiB
Go
72 lines
2.6 KiB
Go
package state
|
|
|
|
import "time"
|
|
|
|
// StateExport represents the run state exported to JSON
|
|
type StateExport struct {
|
|
Run *RunInfo `json:"run,omitempty"`
|
|
Workspace *WorkspaceInfo `json:"workspace,omitempty"`
|
|
Artifacts []string `json:"artifacts,omitempty"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
// RunInfo contains run information for export (mirrors database.Run fields)
|
|
type RunInfo struct {
|
|
RunUUID string `json:"run_uuid"`
|
|
WorkflowName string `json:"workflow_name"`
|
|
WorkflowKind string `json:"workflow_kind"`
|
|
Target string `json:"target"`
|
|
Params map[string]any `json:"params,omitempty"`
|
|
Status string `json:"status"`
|
|
Workspace string `json:"workspace"`
|
|
StartedAt *time.Time `json:"started_at,omitempty"`
|
|
CompletedAt *time.Time `json:"completed_at,omitempty"`
|
|
ErrorMessage string `json:"error_message,omitempty"`
|
|
TotalSteps int `json:"total_steps"`
|
|
CompletedSteps int `json:"completed_steps"`
|
|
HooksEnabled bool `json:"hooks_enabled"`
|
|
RunMode string `json:"run_mode,omitempty"`
|
|
RunPriority string `json:"run_priority,omitempty"`
|
|
}
|
|
|
|
// WorkspaceInfo contains workspace information for export
|
|
type WorkspaceInfo struct {
|
|
Name string `json:"name"`
|
|
LocalPath string `json:"local_path,omitempty"`
|
|
TotalAssets int `json:"total_assets"`
|
|
TotalSubdomains int `json:"total_subdomains"`
|
|
TotalURLs int `json:"total_urls"`
|
|
TotalVulns int `json:"total_vulns"`
|
|
VulnCritical int `json:"vuln_critical"`
|
|
VulnHigh int `json:"vuln_high"`
|
|
VulnMedium int `json:"vuln_medium"`
|
|
VulnLow int `json:"vuln_low"`
|
|
VulnPotential int `json:"vuln_potential"`
|
|
RiskScore float64 `json:"risk_score"`
|
|
Tags []string `json:"tags,omitempty"`
|
|
LastRun *time.Time `json:"last_run,omitempty"`
|
|
RunWorkflow string `json:"run_workflow,omitempty"`
|
|
}
|
|
|
|
// ExportContext provides the context needed for state export
|
|
// This allows callers to provide whatever information they have available
|
|
type ExportContext struct {
|
|
RunUUID string
|
|
WorkflowName string
|
|
WorkflowKind string
|
|
Target string
|
|
WorkspacePath string
|
|
WorkspaceName string
|
|
Params map[string]any
|
|
Status string
|
|
StartedAt *time.Time
|
|
CompletedAt *time.Time
|
|
ErrorMessage string
|
|
TotalSteps int
|
|
CompletedSteps int
|
|
HooksEnabled bool
|
|
RunMode string
|
|
RunPriority string
|
|
Artifacts []string
|
|
}
|