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
//! Output path.
//!
//! The worker → `SpawnerAdapter` → engine output path. All structuring is
//! completed inside the `SpawnerAdapter`; by the time an event reaches the
//! engine it is a Rust-typed `OutputEvent`. The wire form the worker uses
//! (stdout / NDJSON / file path / IPC) is opaque to the engine.
//!
//! The `WorkerResult` type was folded into `OutputEvent::Final`.
//!
//! # Canonical type locations
//!
//! `OutputEvent` and `ContentRef` are canonical in [`crate::store::output`];
//! this module is narrowed to re-exports plus the engine-specific
//! `OutputSink` / `EngineSink`.
use crateEngineError;
use async_trait;
pub use crate;
/// Sink used inside a worker function to emit events. The `InProcSpawner`
/// injects one into `WorkerInvocation`. The `ProcessSpawner` / child-process
/// pull path folds stdout / IPC into `OutputEvent` internally and calls
/// `engine.submit_output` directly, so it does not go through `OutputSink`
/// (it lands in the same engine state, but not via this trait).
/// Concrete `OutputSink` — the default implementation that closes over
/// `engine`, `token`, `task_id`, and `attempt`, and calls
/// `engine.submit_output` for every `emit`. Injected by the `InProcSpawner`
/// into `WorkerInvocation`.
///
/// `InProcSpawner::spawn` is this type's **sole constructor**, which is
/// what makes it the in-process lane's "the worker itself did this"
/// boundary: an `OutputEvent::Artifact` arriving here is a part the worker
/// staged, as opposed to one some other producer appended to the same
/// shared tail (`AfterRunAuditMiddleware` calls `submit_output` directly
/// for exactly that reason). `emit` therefore records `Artifact` names
/// into `EngineState.worker_artifact_names` — the allowlist the Final-pull
/// folds `{out, parts}` from. Adding a second constructor for a non-worker
/// producer would break that invariant; such a producer should call
/// `Engine::submit_output` directly instead.