1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
//! Task types for CODA execution.
//!
//! Defines `Task`, `TaskResult`, and `TaskStatus` which represent the
//! units of work in CODA's execution pipeline.
use PathBuf;
use Duration;
/// A unit of work in CODA's execution pipeline.
///
/// Each CLI command or execution phase maps to a `Task` variant.
/// Result of executing a task, extracted from SDK's `ResultMessage`.
///
/// Contains execution metrics (turns, cost, duration) alongside the
/// task identity and outcome status.
///
/// # Examples
///
/// ```
/// use std::time::Duration;
///
/// use coda_core::task::{Task, TaskResult, TaskStatus};
///
/// let result = TaskResult {
/// task: Task::DevPhase {
/// name: "setup-types".to_string(),
/// feature_slug: "add-auth".to_string(),
/// },
/// status: TaskStatus::Completed,
/// turns: 3,
/// cost_usd: 0.12,
/// duration: Duration::from_secs(300),
/// artifacts: vec![],
/// };
///
/// assert_eq!(result.turns, 3);
/// assert!(matches!(result.status, TaskStatus::Completed));
/// ```
/// Outcome status of a task execution.