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
//! Inverted control loop — the code-pipeline's architectural core (design.md §2
//! + §0.2, breakdown T4).
//!
//! # The inversion (design §2)
//!
//! The panel's load-bearing correction: the non-LLM **supervisor owns the event
//! loop**, and the **orchestrator is a stateless pure function** invoked *per
//! decision point*. It never runs as a long-lived LLM driver (which would
//! exhaust context and hallucinate state transitions) and never speaks natural
//! language back to the loop — it returns **discrete, typed action primitives**
//! ([`Action`]). The supervisor validates each primitive, would-execute it, and
//! records a structured [`DecisionEnvelope`] so a run is causally replayable.
//!
//! # The tiering (design §0.2)
//!
//! The orchestrator function is itself **tiered**. A fast, cheap *coordinator*
//! emits the obvious mechanical primitives (a clear `RE_CODE_CHUNK`, dispatch,
//! progress) and classifies each decision [`Routine`](DecisionClass::Routine) vs
//! [`Consequential`](DecisionClass::Consequential). Every *final/consequential*
//! primitive — `DECLARE_CONVERGED`, `TRIGGER_RE_SPEC`, `ESCALATE`, a non-trivial
//! `PROPOSE_SPINOFF` — is deferred to an expensive *decider* (Opus) whose verdict
//! is the one recorded. The classification boundary is the one genuinely new risk
//! this refinement adds (a fast model mislabelling a consequential decision as
//! routine), so [`DecisionEnvelope::decision_tier`] makes every such call
//! auditable: **a consequential action stamped `coordinator` is an invariant
//! violation** the driver flags ([`DecisionEnvelope::validate_for`]).
//!
//! # Layout
//!
//! - [`action`] — the typed [`Action`] primitives + their
//! [`routine/consequential`](DecisionClass) classification.
//! - [`envelope`] — the [`DecisionEnvelope`] audit record + the tier invariant.
//! - [`orchestrator`] — the [`Orchestrator`] trait, the [`TieredOrchestrator`]
//! wrapper, and deterministic scripted [`Coordinator`]/[`Decider`] stubs.
//! - [`driver`] — [`drive`], a pure in-memory state machine modelling the
//! supervisor side of the loop.
//!
//! **This module is behind the seam and not wired into any live path.** Nothing
//! in `run create` / the live supervisor constructs an [`Orchestrator`] or calls
//! [`drive`] yet; staged rollout (design §14) plugs it in at T5, which replaces
//! the in-memory state machine's execution stub with the real event log
//! (`LockedRun` + `append_and_apply`, state-integrity invariant 1) and the real
//! git/merge/spawn actions. It lands as unused-by-default scaffolding + tests;
//! the `mod pipeline;` declaration carries `#[allow(dead_code)]` for that reason.
/// The live end-to-end pipeline driver (T5 walking skeleton) — the FIRST
/// bold-to-live wiring of the whole system as the additive `pipeline run`
/// command. Unlike the rest of this module (a behind-the-seam scaffold), `live`
/// IS wired into a real command; it reuses the harness/floor/plan/envelope
/// pieces without creating an orchestratectl run or touching the reducer.
pub use ;
pub use ;
pub use ;
pub use ;