hm_plugin_protocol/
events.rs1use chrono::{DateTime, Utc};
6use schemars::JsonSchema as DeriveJsonSchema;
7use serde::{Deserialize, Serialize};
8use uuid::Uuid;
9
10use crate::executor::SnapshotRef;
11
12#[derive(
13 Debug,
14 Clone,
15 Copy,
16 PartialEq,
17 Eq,
18 Serialize,
19 Deserialize,
20 DeriveJsonSchema,
21 derive_more::IsVariant,
22)]
23#[serde(rename_all = "snake_case")]
24pub enum StdStream {
25 Stdout,
26 Stderr,
27}
28
29#[derive(
30 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, DeriveJsonSchema, derive_more::IsVariant,
31)]
32#[serde(tag = "kind", rename_all = "snake_case")]
33pub enum BuildEvent {
34 BuildStart {
35 run_id: Uuid,
36 plan: PlanSummary,
37 started_at: DateTime<Utc>,
38 },
39 StepQueued {
40 step_id: Uuid,
41 key: String,
42 chain_idx: usize,
43 parent_key: Option<String>,
46 display_name: String,
49 },
50 StepStart {
51 step_id: Uuid,
52 runner: String,
53 image: Option<String>,
54 },
55 StepLog {
56 step_id: Uuid,
57 stream: StdStream,
58 line: String,
59 ts: DateTime<Utc>,
60 },
61 StepCacheHit {
62 step_id: Uuid,
63 key: String,
64 tag: String,
65 },
66 StepEnd {
67 step_id: Uuid,
68 exit_code: i32,
69 duration_ms: u64,
70 snapshot: Option<SnapshotRef>,
71 },
72 ChainFailed {
77 chain_idx: usize,
78 failed_step_id: Uuid,
79 failed_step_key: String,
80 exit_code: i32,
81 message: String,
82 ts: DateTime<Utc>,
83 },
84 BuildEnd {
85 exit_code: i32,
86 duration_ms: u64,
87 },
88}
89
90#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, DeriveJsonSchema)]
93pub struct PlanSummary {
94 pub step_count: usize,
95 pub chain_count: usize,
96 pub default_runner: String,
97}