Skip to main content

WorkflowsConfig

Struct WorkflowsConfig 

Source
pub struct WorkflowsConfig {
Show 14 fields pub name: Option<String>, pub description: Option<String>, pub source_file: Option<PathBuf>, pub settings: WorkflowSettings, pub states: HashMap<String, StateWorkflow>, pub phases: HashMap<String, PhaseWorkflow>, pub combos: HashMap<String, ComboPrompts>, pub gates: HashMap<String, Vec<GateDefinition>>, pub roles: HashMap<String, RoleDefinition>, pub role_prompts: HashMap<String, HashMap<String, String>>, pub named_workflows: HashMap<String, Arc<WorkflowsConfig>>, pub default_workflow_key: Option<String>, pub named_overlays: HashMap<String, Arc<WorkflowsConfig>>, pub active_overlays: Vec<String>,
}
Expand description

Unified workflow configuration.

Fields§

§name: Option<String>

Short identifier for the workflow (e.g., “swarm”, “relay”, “solo”).

§description: Option<String>

Human-readable description of the workflow’s coordination model. Should explain when to choose this workflow and how agents coordinate.

§source_file: Option<PathBuf>

Path to the source file this workflow was loaded from. Not deserialized from YAML - populated by the loader.

§settings: WorkflowSettings

Global workflow settings.

§states: HashMap<String, StateWorkflow>

State definitions with transitions, timing, and prompts.

§phases: HashMap<String, PhaseWorkflow>

Phase definitions with prompts.

§combos: HashMap<String, ComboPrompts>

State+phase combination prompts (key format: “state+phase”).

§gates: HashMap<String, Vec<GateDefinition>>

Gate definitions for status and phase exits. Keys are “status:” or “phase:”, values are lists of gate definitions.

§roles: HashMap<String, RoleDefinition>

Role definitions (e.g., “lead”, “worker”) with tags, permissions, and constraints.

§role_prompts: HashMap<String, HashMap<String, String>>

Role-specific prompts. Outer key is role name, inner key is prompt name (e.g., “claiming”, “completing”), value is the prompt content.

§named_workflows: HashMap<String, Arc<WorkflowsConfig>>

Cache of named workflow configs (e.g., “swarm” -> workflow-swarm.yaml). Populated at server startup, not serialized.

§default_workflow_key: Option<String>

Key to look up the default workflow in named_workflows cache. If set, workers without a workflow use this instead of the base config.

§named_overlays: HashMap<String, Arc<WorkflowsConfig>>

Cache of named overlay configs (e.g., “git” -> overlay-git.yaml). Overlays are loaded as raw deltas (NOT merged with defaults).

§active_overlays: Vec<String>

Active overlay names applied to this config (for tracking).

Implementations§

Source§

impl WorkflowsConfig

Source

pub fn get_named_workflow(&self, name: &str) -> Option<&Arc<WorkflowsConfig>>

Get a named workflow config, or None if not found.

Source

pub fn get_default_workflow(&self) -> Option<&Arc<WorkflowsConfig>>

Get the default workflow config from the cache, if one is configured.

Source

pub fn match_role(&self, worker_tags: &[String]) -> Option<String>

Match worker tags to a role defined in this workflow. Returns the role name if any role’s tags overlap with the worker’s tags. If multiple roles match, returns the first match (by sorted key order for determinism).

Source

pub fn get_role_prompts(&self, role_name: &str) -> HashMap<String, String>

Get all prompts for a matched role. Returns an empty HashMap if the role has no prompts defined.

Source

pub fn get_role_prompt(&self, role_name: &str, prompt_key: &str) -> Option<&str>

Get a specific role prompt by role name and prompt key.

Source

pub fn get_role(&self, role_name: &str) -> Option<&RoleDefinition>

Get the role definition for a matched role.

Source

pub fn all_role_tags(&self) -> Vec<String>

Collect all unique role tags across this workflow, all named workflows, and all overlays. Returns a deduplicated list of tag names used in role definitions.

Source

pub fn apply_overlay(&mut self, overlay: &WorkflowsConfig)

Apply an overlay on top of this workflow using additive merge semantics.

Unlike deep-merge (which replaces), overlay merge:

  • states: union keys; existing states get exits unioned (deduplicated), timed |= overlay.timed, prompts appended with separator
  • phases: union keys; existing phases get prompts appended
  • combos: union keys; existing combos get enter/exit appended
  • gates: union keys; existing keys extend their Vec (never replace)
  • roles: union keys; existing roles NOT overridden (first wins)
  • role_prompts: outer keys unioned; inner keys appended or added
  • settings.initial_state: overlay wins if it differs from default (“pending”)
  • settings.blocking_states: union (deduplicated)
Source

pub fn compute_overlay_diff(&self, base: &WorkflowsConfig) -> Value

Compute a diff showing what an overlay changed relative to a base workflow. Returns a JSON object with added/modified states, exits, gates, and prompts.

Source§

impl WorkflowsConfig

Source

pub fn get_state_enter_prompt(&self, state: &str) -> Option<&str>

Get the enter prompt for a state.

Source

pub fn get_state_exit_prompt(&self, state: &str) -> Option<&str>

Get the exit prompt for a state.

Source

pub fn get_phase_enter_prompt(&self, phase: &str) -> Option<&str>

Get the enter prompt for a phase.

Source

pub fn get_phase_exit_prompt(&self, phase: &str) -> Option<&str>

Get the exit prompt for a phase.

Source

pub fn get_combo_enter_prompt(&self, state: &str, phase: &str) -> Option<&str>

Get the enter prompt for a state+phase combo.

Source

pub fn get_combo_exit_prompt(&self, state: &str, phase: &str) -> Option<&str>

Get the exit prompt for a state+phase combo.

Source

pub fn get_prompt(&self, trigger: &str) -> Option<&str>

Get a prompt by trigger name.

Trigger format:

  • enter~{state} - entering a state
  • exit~{state} - exiting a state
  • enter%{phase} - entering a phase
  • exit%{phase} - exiting a phase
  • enter~{state}%{phase} - entering a state+phase combo
  • exit~{state}%{phase} - exiting a state+phase combo
Source

pub fn list_prompt_triggers(&self) -> Vec<String>

List all available prompt triggers.

Source

pub fn get_status_exit_gates(&self, status: &str) -> Vec<&GateDefinition>

Get exit gates for a status transition. Returns gates defined under “status:” key.

Source

pub fn get_phase_exit_gates(&self, phase: &str) -> Vec<&GateDefinition>

Get exit gates for a phase transition. Returns gates defined under “phase:” key.

Trait Implementations§

Source§

impl Clone for WorkflowsConfig

Source§

fn clone(&self) -> WorkflowsConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WorkflowsConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for WorkflowsConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for WorkflowsConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<&WorkflowsConfig> for PhasesConfig

Convert WorkflowsConfig to PhasesConfig for backwards compatibility.

Source§

fn from(workflows: &WorkflowsConfig) -> Self

Converts to this type from the input type.
Source§

impl From<&WorkflowsConfig> for StatesConfig

Convert WorkflowsConfig to StatesConfig for backwards compatibility.

Source§

fn from(workflows: &WorkflowsConfig) -> Self

Converts to this type from the input type.
Source§

impl Serialize for WorkflowsConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,