| 1 | package autoresearch |
| 2 | |
| 3 | import "time" |
| 4 | |
| 5 | const ( |
| 6 | StatusRunning = "running" |
| 7 | StatusBlocked = "blocked" |
| 8 | StatusComplete = "complete" |
| 9 | StatusStopped = "stopped" |
| 10 | StatusInvalid = "invalid" |
| 11 | ) |
| 12 | |
| 13 | // Task is a read-only view of a historical AutoResearch archive. |
| 14 | type Task struct { |
| 15 | ID string |
| 16 | Root string |
| 17 | Spec TaskSpec |
| 18 | } |
| 19 | |
| 20 | type AllowedOperations struct { |
| 21 | Write bool `json:"write"` |
| 22 | Network bool `json:"network"` |
| 23 | Publish bool `json:"publish"` |
| 24 | } |
| 25 | |
| 26 | type SuccessCriterion struct { |
| 27 | ID string `json:"id"` |
| 28 | Description string `json:"description"` |
| 29 | Required bool `json:"required"` |
| 30 | EvidenceIDs []string `json:"evidence_ids"` |
| 31 | } |
| 32 | |
| 33 | type TaskSpec struct { |
| 34 | TaskID string `json:"task_id"` |
| 35 | Goal string `json:"goal"` |
| 36 | Scope []string `json:"scope"` |
| 37 | NonGoals []string `json:"non_goals"` |
| 38 | AllowedOperations AllowedOperations `json:"allowed_operations"` |
| 39 | SuccessCriteria []SuccessCriterion `json:"success_criteria"` |
| 40 | } |
| 41 | |
| 42 | type Progress struct { |
| 43 | Status string `json:"status"` |
| 44 | Iteration int `json:"iteration"` |
| 45 | CurrentDirection string `json:"current_direction"` |
| 46 | StaleCount int `json:"stale_count"` |
| 47 | PivotCount int `json:"pivot_count"` |
| 48 | BlockedReason string `json:"blocked_reason"` |
| 49 | UpdatedAt time.Time `json:"updated_at"` |
| 50 | } |
| 51 | |
| 52 | const ( |
| 53 | FindingSourceCommand = "command" |
| 54 | FindingSourceFile = "file" |
| 55 | FindingSourceManual = "manual" |
| 56 | ) |
| 57 | |
| 58 | // Finding.Kind is an opaque string. Unknown historical values must round-trip. |
| 59 | type Finding struct { |
| 60 | ID string `json:"id"` |
| 61 | Kind string `json:"kind"` |
| 62 | Summary string `json:"summary"` |
| 63 | Source string `json:"source"` |
| 64 | Command string `json:"command,omitempty"` |
| 65 | Paths []string `json:"paths,omitempty"` |
| 66 | Accepted bool `json:"accepted"` |
| 67 | CreatedAt time.Time `json:"created_at"` |
| 68 | } |
| 69 | |
| 70 | const ( |
| 71 | HeartbeatStartingTurn = "starting_turn" |
| 72 | HeartbeatTurnDone = "turn_done" |
| 73 | HeartbeatWarning = "warning" |
| 74 | ) |
| 75 | |
| 76 | type Heartbeat struct { |
| 77 | Status string `json:"status"` |
| 78 | Iteration int `json:"iteration"` |
| 79 | Message string `json:"message,omitempty"` |
| 80 | CreatedAt time.Time `json:"created_at"` |
| 81 | } |
| 82 | |
| 83 | type DirectionTried struct { |
| 84 | Fingerprint string `json:"fingerprint"` |
| 85 | Summary string `json:"summary"` |
| 86 | FirstSeenIteration int `json:"first_seen_iteration"` |
| 87 | LastSeenIteration int `json:"last_seen_iteration"` |
| 88 | Count int `json:"count"` |
| 89 | } |
| 90 | |
| 91 | type CriterionSummary struct { |
| 92 | ID string `json:"id"` |
| 93 | Description string `json:"description"` |
| 94 | Required bool `json:"required"` |
| 95 | EvidenceCount int `json:"evidence_count"` |
| 96 | Status string `json:"status"` |
| 97 | } |
| 98 | |
| 99 | type Summary struct { |
| 100 | TaskID string `json:"task_id"` |
| 101 | Goal string `json:"goal"` |
| 102 | Status string `json:"status"` |
| 103 | Iteration int `json:"iteration"` |
| 104 | CurrentDirection string `json:"current_direction"` |
| 105 | StaleCount int `json:"stale_count"` |
| 106 | PivotCount int `json:"pivot_count"` |
| 107 | PivotRequired bool `json:"pivot_required"` |
| 108 | LastHeartbeatAt time.Time `json:"last_heartbeat_at,omitempty"` |
| 109 | FindingCount int `json:"finding_count"` |
| 110 | OpenCriteria []CriterionSummary `json:"open_criteria"` |
| 111 | Blocker string `json:"blocker"` |
| 112 | TaskPath string `json:"task_path"` |
| 113 | NextRequiredAction string `json:"next_required_action"` |
| 114 | } |
| 115 | |
| 116 | type ValidationError struct { |
| 117 | File string `json:"file"` |
| 118 | Field string `json:"field"` |
| 119 | Error string `json:"error"` |
| 120 | } |
| 121 | |
| 122 | type ValidationReport struct { |
| 123 | Valid bool `json:"valid"` |
| 124 | Errors []ValidationError `json:"errors"` |
| 125 | } |
| 126 |