Skip to main content

Task

interface Task {
  id: string;
  title: string;
  description: string;
  assignTo: string;
  status: TaskStatus;
  group?: string;
  missionId?: string;
  dependsOn: string[];
  expectations: TaskExpectation[];
  metrics: TaskMetric[];
  retries: number;
  maxRetries: number;
  maxDuration?: number;
  retryPolicy?: RetryPolicy;
  result?: TaskResult;
  phase?: "execution" | "review" | "fix" | "clarification";
  fixAttempts?: number;
  questionRounds?: number;
  resolutionAttempts?: number;
  originalDescription?: string;
  sessionId?: string;
  revisionCount?: number;
  deadline?: string;
  priority?: number;
  expectedOutcomes?: ExpectedOutcome[];
  outcomes?: TaskOutcome[];
  notifications?: ScopedNotificationRules;
  sideEffects?: boolean;
  createdAt: string;
  updatedAt: string;
}

TaskStatus

type TaskStatus =
  | "draft"
  | "pending"
  | "awaiting_approval"
  | "assigned"
  | "in_progress"
  | "review"
  | "done"
  | "failed"

TaskExpectation

Defines how a task is assessed:
interface TaskExpectation {
  type: "test" | "file_exists" | "script" | "llm_review";
  command?: string;
  paths?: string[];
  criteria?: string;
  dimensions?: EvalDimension[];
  threshold?: number;
  confidence?: "firm" | "estimated";
}

interface EvalDimension {
  name: string;
  description: string;
  weight: number;
  rubric?: Record<number, string>;
}

TaskOutcome

Artifacts produced by task execution:
interface TaskOutcome {
  id: string;
  type: "file" | "text" | "url" | "json" | "media";
  label: string;
  path?: string;
  mimeType?: string;
  size?: number;
  text?: string;
  url?: string;
  data?: unknown;
  producedBy?: string;
  producedAt: string;
  tags?: string[];
}

ExpectedOutcome

Define what a task should produce:
interface ExpectedOutcome {
  type: "file" | "text" | "url" | "json" | "media";
  label: string;
  description?: string;
  path?: string;
  mimeType?: string;
  required?: boolean;
  tags?: string[];
}

TaskResult

interface TaskResult {
  exitCode: number;
  stdout: string;
  stderr: string;
  duration: number;
  assessment?: AssessmentResult;
  assessmentHistory?: AssessmentResult[];
}

AssessmentResult

interface AssessmentResult {
  passed: boolean;
  checks: CheckResult[];
  metrics: MetricResult[];
  llmReview?: string;
  scores?: DimensionScore[];
  globalScore?: number;
  timestamp: string;
  trigger?: "initial" | "reassess" | "fix" | "retry" | "auto-correct" | "judge";
}

interface CheckResult {
  type: "test" | "file_exists" | "script" | "llm_review";
  passed: boolean;
  message: string;
  details?: string;
  scores?: DimensionScore[];
  globalScore?: number;
}

interface DimensionScore {
  dimension: string;
  score: number;
  reasoning: string;
  weight: number;
  evidence?: { file: string; line: number; note: string }[];
}

interface MetricResult {
  name: string;
  value: number;
  threshold: number;
  passed: boolean;
}

RetryPolicy

interface RetryPolicy {
  escalateAfter?: number;
  fallbackAgent?: string;
  escalateModel?: string;
}