pub struct SRBNOrchestrator {
pub graph: DiGraph<SRBNNode, Dependency>,
pub context: AgentContext,
pub auto_approve: bool,
pub ledger: MerkleLedger,
pub last_tool_failure: Option<String>,
pub planning_policy: PlanningPolicy,
pub stability_epsilon: f32,
pub energy_alpha: f32,
pub energy_beta: f32,
pub energy_gamma: f32,
/* private fields */
}Expand description
The SRBN Orchestrator - manages the agent workflow
Fields§
§graph: DiGraph<SRBNNode, Dependency>Task DAG managed by petgraph
context: AgentContextAgent context
auto_approve: boolAuto-approve mode
ledger: MerkleLedgerPersistence ledger
last_tool_failure: Option<String>Last tool failure message (for energy calculation)
planning_policy: PlanningPolicyAdaptive planning policy for agent phase selection.
stability_epsilon: f32Session-level stability threshold (ε for V(x) < ε convergence)
energy_alpha: f32Energy weight α (syntax/build errors)
energy_beta: f32Energy weight β (structural concerns)
energy_gamma: f32Energy weight γ (test/lint failures)
Implementations§
Source§impl SRBNOrchestrator
impl SRBNOrchestrator
Sourcepub fn parse_artifact_bundle_typed(
&self,
content: &str,
node_id: &str,
attempt: u32,
) -> (Option<ArtifactBundle>, ParseResultState, Option<CorrectionAttemptRecord>)
pub fn parse_artifact_bundle_typed( &self, content: &str, node_id: &str, attempt: u32, ) -> (Option<ArtifactBundle>, ParseResultState, Option<CorrectionAttemptRecord>)
PSP-7: Typed parse pipeline returning structured state for every LLM response.
Replaces the Option-based parse_artifact_bundle with a pipeline that
classifies every response through Layers A→E and returns a typed result.
- Layer A: Raw capture — fingerprints the response (hash + length).
- Layer B: Path normalization via the hardened
normalize_artifact_path. - Layer C: Strict JSON parse via
extract_and_deserialize. - Layer D: Tolerant file-marker recovery via
extract_file_markers. - Layer E: Semantic validation — declared paths, plugin support files, command policy.
Returns (Option<ArtifactBundle>, ParseResultState, Option<CorrectionAttemptRecord>).
Sourcepub async fn apply_bundle_transactionally(
&mut self,
bundle: &ArtifactBundle,
node_id: &str,
node_class: NodeClass,
) -> Result<()>
pub async fn apply_bundle_transactionally( &mut self, bundle: &ArtifactBundle, node_id: &str, node_class: NodeClass, ) -> Result<()>
PSP-5: Apply an artifact bundle transactionally
All file operations are validated first, then applied. PSP-5 Phase 2: Validates ownership boundaries before applying. If any operation fails, the method returns an error describing which operation failed, and previous successful operations are logged for manual review.
Source§impl SRBNOrchestrator
impl SRBNOrchestrator
Sourcepub async fn run_plugin_verification(
&mut self,
plugin_name: &str,
allowed_stages: &[VerifierStage],
working_dir: PathBuf,
) -> VerificationResult
pub async fn run_plugin_verification( &mut self, plugin_name: &str, allowed_stages: &[VerifierStage], working_dir: PathBuf, ) -> VerificationResult
PSP-5: Run plugin-driven verification for a node
Uses the active language plugin’s verifier profile to select commands
for syntax check, build, test, and lint stages. Delegates execution
to TestRunnerTrait implementations from test_runner.
Each stage records a StageOutcome with SensorStatus, enabling
callers to detect fallback / unavailable sensors and block false
stability claims.
Source§impl SRBNOrchestrator
impl SRBNOrchestrator
Sourcepub fn new(working_dir: PathBuf, auto_approve: bool) -> Self
pub fn new(working_dir: PathBuf, auto_approve: bool) -> Self
Create a new orchestrator with default models
Sourcepub fn new_with_models(
working_dir: PathBuf,
auto_approve: bool,
architect_model: Option<String>,
actuator_model: Option<String>,
verifier_model: Option<String>,
speculator_model: Option<String>,
architect_fallback_model: Option<String>,
actuator_fallback_model: Option<String>,
verifier_fallback_model: Option<String>,
speculator_fallback_model: Option<String>,
) -> Self
pub fn new_with_models( working_dir: PathBuf, auto_approve: bool, architect_model: Option<String>, actuator_model: Option<String>, verifier_model: Option<String>, speculator_model: Option<String>, architect_fallback_model: Option<String>, actuator_fallback_model: Option<String>, verifier_fallback_model: Option<String>, speculator_fallback_model: Option<String>, ) -> Self
Create a new orchestrator with custom model configuration
Sourcepub fn connect_tui(
&mut self,
event_sender: EventSender,
action_receiver: ActionReceiver,
)
pub fn connect_tui( &mut self, event_sender: EventSender, action_receiver: ActionReceiver, )
Connect TUI channels for interactive control
Sourcepub fn abort_flag(&self) -> Arc<AtomicBool>
pub fn abort_flag(&self) -> Arc<AtomicBool>
Get a handle to the abort flag for external signal handlers.
Sourcepub fn set_budget(
&mut self,
max_steps: Option<u32>,
max_revisions: Option<u32>,
max_cost_usd: Option<f64>,
)
pub fn set_budget( &mut self, max_steps: Option<u32>, max_revisions: Option<u32>, max_cost_usd: Option<f64>, )
Configure the session-level budget envelope.
Call this before run() to set step, cost, or revision caps from CLI
flags. Uncapped limits remain None.
Sourcepub fn rehydrate_session(&mut self, session_id: &str) -> Result<SessionSnapshot>
pub fn rehydrate_session(&mut self, session_id: &str) -> Result<SessionSnapshot>
Rehydrate the orchestrator from a persisted session, rebuilding the DAG from stored node snapshots and graph edges.
Terminal nodes (Completed, Failed, Aborted) will be skipped during
the subsequent run_resumed() execution. Non-terminal nodes are
placed back in their persisted state so the executor can continue
from the last durable boundary.
Returns Ok(snapshot) with the loaded session snapshot on success,
or an error when the session cannot be reconstructed.
Sourcepub async fn run_resumed(&mut self) -> Result<()>
pub async fn run_resumed(&mut self) -> Result<()>
Resume execution from a rehydrated session.
Walks the DAG in topological order, skipping terminal nodes and executing any node whose state is not completed/failed/aborted. Emits a differential resume summary so users can see what will be replayed vs. skipped.
Sourcepub fn add_dependency(
&mut self,
from_id: &str,
to_id: &str,
kind: &str,
) -> Result<()>
pub fn add_dependency( &mut self, from_id: &str, to_id: &str, kind: &str, ) -> Result<()>
Add a dependency edge between nodes
Sourcepub fn session_id(&self) -> &str
pub fn session_id(&self) -> &str
Get the current session ID
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Get node count
Sourcepub async fn start_lsp_for_plugins(
&mut self,
plugin_names: &[&str],
) -> Result<()>
pub async fn start_lsp_for_plugins( &mut self, plugin_names: &[&str], ) -> Result<()>
Start LSP clients for the given plugin names.
For each name, looks up the plugin’s LspConfig (with fallback)
and starts a client keyed by the plugin name.
Auto Trait Implementations§
impl !Freeze for SRBNOrchestrator
impl !RefUnwindSafe for SRBNOrchestrator
impl Send for SRBNOrchestrator
impl Sync for SRBNOrchestrator
impl Unpin for SRBNOrchestrator
impl UnsafeUnpin for SRBNOrchestrator
impl !UnwindSafe for SRBNOrchestrator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more