1use schemars::JsonSchema;
5use serde::{Deserialize, Serialize};
6
7#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
9#[serde(rename_all = "lowercase")]
10pub enum SubtaskKind {
11 #[default]
13 Implementation,
14 Research,
17}
18
19#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
27#[schemars(
28 title = "SubtaskItem",
29 description = "One proposed child session in an orchestrator decomposition plan. Each subtask \
30 runs unattended in its own worktree branched from the same base branch, so it \
31 must be completable without coordinating with its siblings."
32)]
33pub struct SubtaskItem {
34 #[serde(default)]
37 #[schemars(
38 title = "acceptance_criteria",
39 description = "Concrete, testable acceptance criteria for this subtask. The approval UI \
40 shows these criteria and the controller verifies the finished child \
41 against the same list."
42 )]
43 pub acceptance_criteria: Vec<String>,
44 #[serde(default)]
47 #[schemars(
48 title = "kind",
49 description = "Execution behavior for this subtask. `implementation` (the default) may \
50 change repository files and proceeds to integration. `research` runs as a \
51 temporary read-only child, returns a report, and is never integrated."
52 )]
53 pub kind: SubtaskKind,
54 #[schemars(
56 title = "prompt",
57 description = "Complete standalone prompt for the child session. The child sees only this \
58 prompt and the repository, so restate every constraint it needs instead of \
59 referring back to the plan or to sibling subtasks."
60 )]
61 pub prompt: String,
62 #[schemars(
64 title = "task_key",
65 description = "Short stable `kebab-case` identifier for this subtask, unique within the \
66 plan. Reuse the exact same key when re-proposing a subtask so a retry \
67 replaces the previous attempt instead of creating a duplicate."
68 )]
69 pub task_key: String,
70 #[schemars(
72 title = "title",
73 description = "Short human-readable title describing what this subtask delivers."
74 )]
75 pub title: String,
76 #[serde(default)]
79 #[schemars(
80 title = "touched_areas",
81 description = "Best-effort repository-relative file or directory paths this subtask is \
82 expected to modify. Wildcard patterns are not supported. Paths may overlap \
83 between subtasks and workers may modify additional files when needed to \
84 satisfy the task. Defaults to an empty list when omitted."
85 )]
86 pub touched_areas: Vec<String>,
87}