52 lines
1.7 KiB
Go
52 lines
1.7 KiB
Go
package work
|
|
|
|
type LongRunningWorkID string
|
|
type LongRunningState string
|
|
|
|
const (
|
|
LongRunningProposed LongRunningState = "PROPOSED"
|
|
LongRunningRunning LongRunningState = "RUNNING"
|
|
LongRunningPaused LongRunningState = "PAUSED"
|
|
LongRunningBlocked LongRunningState = "BLOCKED"
|
|
LongRunningCompleted LongRunningState = "COMPLETED"
|
|
LongRunningExhausted LongRunningState = "EXHAUSTED"
|
|
LongRunningCancelled LongRunningState = "CANCELLED"
|
|
)
|
|
|
|
type Investigation struct {
|
|
ID LongRunningWorkID
|
|
Objective string
|
|
HypothesisRefs []EvidenceRef
|
|
AttemptRefs []AgentRunID
|
|
FindingRefs []EvidenceRef
|
|
Blockers []string
|
|
CheckpointRefs []AgentCheckpointID
|
|
NextStep string
|
|
State LongRunningState
|
|
Revision int64
|
|
TimeBudgetMillis int64
|
|
CostBudgetMicros int64
|
|
MaxAttempts int
|
|
RecordedAtUnixMillis int64
|
|
}
|
|
|
|
// InvestigationCheckpoint is the durable boundary between attempts. A
|
|
// checkpoint is written only after an attempt has been verified, so a worker
|
|
// restart can resume at NextStep without replaying that attempt.
|
|
type InvestigationCheckpoint struct {
|
|
ID AgentCheckpointID
|
|
InvestigationID LongRunningWorkID
|
|
CompletedAttemptRefs []AgentRunID
|
|
CompletedFindingRefs []EvidenceRef
|
|
NextStep string
|
|
RecordedAtUnixMillis int64
|
|
}
|
|
|
|
func (c InvestigationCheckpoint) Valid() bool {
|
|
return c.ID != "" && c.InvestigationID != "" && c.NextStep != "" && c.RecordedAtUnixMillis > 0
|
|
}
|
|
|
|
func (w Investigation) Valid() bool {
|
|
return w.ID != "" && w.Objective != "" && w.State != "" && w.Revision > 0 && w.TimeBudgetMillis >= 0 && w.CostBudgetMicros >= 0 && w.MaxAttempts >= 0 && w.RecordedAtUnixMillis > 0
|
|
}
|