63 lines
2.1 KiB
Go
63 lines
2.1 KiB
Go
package workflow
|
|
|
|
import "encoding/json"
|
|
|
|
type TaskStatus string
|
|
|
|
const (
|
|
StatusPending TaskStatus = "pending"
|
|
StatusQueued TaskStatus = "queued"
|
|
StatusRunning TaskStatus = "running"
|
|
StatusCompleted TaskStatus = "completed"
|
|
StatusFailed TaskStatus = "failed"
|
|
StatusCanceled TaskStatus = "canceled"
|
|
)
|
|
|
|
type CreateTaskInput struct {
|
|
Title string `json:"title"`
|
|
Source string `json:"source"`
|
|
Payload json.RawMessage `json:"payload"`
|
|
Metadata json.RawMessage `json:"metadata,omitempty"`
|
|
External *ExternalRefInput `json:"external,omitempty"`
|
|
}
|
|
|
|
type ExternalRefInput struct {
|
|
Provider string `json:"provider"`
|
|
ID string `json:"id"`
|
|
URL string `json:"url"`
|
|
Metadata json.RawMessage `json:"metadata"`
|
|
}
|
|
|
|
type FailureType string
|
|
|
|
const (
|
|
FailureTypeTimeout FailureType = "timeout"
|
|
FailureTypeExecution FailureType = "execution"
|
|
FailureTypeEnqueue FailureType = "enqueue"
|
|
)
|
|
|
|
const DefaultTaskMaxAttempts = 3
|
|
|
|
const (
|
|
MetadataKeyAgentRunState = "agent_run_state"
|
|
MetadataKeyAgentPhase = "agent_phase"
|
|
MetadataKeyWaitType = "wait_type"
|
|
MetadataKeyStatusReason = "status_reason"
|
|
MetadataKeyFailureType = "failure_type"
|
|
MetadataKeyFailedAt = "failed_at"
|
|
MetadataKeyLastHeartbeat = "last_heartbeat_at"
|
|
MetadataKeyPlanRef = "plan_ref"
|
|
MetadataKeyAttempt = "attempt"
|
|
MetadataKeyRetryable = "retryable"
|
|
|
|
// Authoring run state keys for Plane-origin workspace authoring tasks.
|
|
// authoring_run_state values: "in_progress", "succeeded", "failed".
|
|
// Stale detection uses authoring_run_updated_at compared against a
|
|
// configured staleness threshold — no separate timeout state is stored.
|
|
MetadataKeyAuthoringRunState = "authoring_run_state"
|
|
MetadataKeyAuthoringRunUpdatedAt = "authoring_run_updated_at"
|
|
MetadataKeyAuthoringFailureType = "authoring_failure_type"
|
|
MetadataKeyAuthoringFailureCategory = "authoring_failure_category"
|
|
MetadataKeyAuthoringProgressMode = "authoring_progress_mode"
|
|
MetadataKeyAuthoringProgressReason = "authoring_progress_reason"
|
|
)
|