pub struct WorkflowsConfig {Show 15 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 advisories: HashMap<String, AdvisoryDefinition>,
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: WorkflowSettingsGlobal 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:
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.
advisories: HashMap<String, AdvisoryDefinition>Advisory definitions for on-demand guidance. Key is the advisory topic name (e.g., “decompose-epic”, “inject-legal”).
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
impl WorkflowsConfig
Sourcepub fn get_named_workflow(&self, name: &str) -> Option<&Arc<WorkflowsConfig>>
pub fn get_named_workflow(&self, name: &str) -> Option<&Arc<WorkflowsConfig>>
Get a named workflow config, or None if not found.
Sourcepub fn get_default_workflow(&self) -> Option<&Arc<WorkflowsConfig>>
pub fn get_default_workflow(&self) -> Option<&Arc<WorkflowsConfig>>
Get the default workflow config from the cache, if one is configured.
Sourcepub fn match_role(&self, worker_tags: &[String]) -> Option<String>
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).
Sourcepub fn get_role_prompts(&self, role_name: &str) -> HashMap<String, String>
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.
Sourcepub fn get_role_prompt(&self, role_name: &str, prompt_key: &str) -> Option<&str>
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.
Sourcepub fn get_role(&self, role_name: &str) -> Option<&RoleDefinition>
pub fn get_role(&self, role_name: &str) -> Option<&RoleDefinition>
Get the role definition for a matched role.
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.
Sourcepub fn apply_overlay(&mut self, overlay: &WorkflowsConfig)
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)
Sourcepub fn compute_overlay_diff(&self, base: &WorkflowsConfig) -> Value
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
impl WorkflowsConfig
Sourcepub fn get_state_enter_prompt(&self, state: &str) -> Option<&str>
pub fn get_state_enter_prompt(&self, state: &str) -> Option<&str>
Get the enter prompt for a state.
Sourcepub fn get_state_exit_prompt(&self, state: &str) -> Option<&str>
pub fn get_state_exit_prompt(&self, state: &str) -> Option<&str>
Get the exit prompt for a state.
Sourcepub fn get_phase_enter_prompt(&self, phase: &str) -> Option<&str>
pub fn get_phase_enter_prompt(&self, phase: &str) -> Option<&str>
Get the enter prompt for a phase.
Sourcepub fn get_phase_exit_prompt(&self, phase: &str) -> Option<&str>
pub fn get_phase_exit_prompt(&self, phase: &str) -> Option<&str>
Get the exit prompt for a phase.
Sourcepub fn get_combo_enter_prompt(&self, state: &str, phase: &str) -> Option<&str>
pub fn get_combo_enter_prompt(&self, state: &str, phase: &str) -> Option<&str>
Get the enter prompt for a state+phase combo.
Sourcepub fn get_combo_exit_prompt(&self, state: &str, phase: &str) -> Option<&str>
pub fn get_combo_exit_prompt(&self, state: &str, phase: &str) -> Option<&str>
Get the exit prompt for a state+phase combo.
Sourcepub fn get_prompt(&self, trigger: &str) -> Option<&str>
pub fn get_prompt(&self, trigger: &str) -> Option<&str>
Get a prompt by trigger name.
Trigger format:
enter~{state}- entering a stateexit~{state}- exiting a stateenter%{phase}- entering a phaseexit%{phase}- exiting a phaseenter~{state}%{phase}- entering a state+phase comboexit~{state}%{phase}- exiting a state+phase combo
Sourcepub fn list_prompt_triggers(&self) -> Vec<String>
pub fn list_prompt_triggers(&self) -> Vec<String>
List all available prompt triggers.
Sourcepub fn get_status_exit_gates(&self, status: &str) -> Vec<&GateDefinition>
pub fn get_status_exit_gates(&self, status: &str) -> Vec<&GateDefinition>
Get exit gates for a status transition.
Returns gates defined under “status:
Sourcepub fn get_phase_exit_gates(&self, phase: &str) -> Vec<&GateDefinition>
pub fn get_phase_exit_gates(&self, phase: &str) -> Vec<&GateDefinition>
Get exit gates for a phase transition.
Returns gates defined under “phase:
Sourcepub fn get_tag_exit_gates(&self, tag: &str) -> Vec<&GateDefinition>
pub fn get_tag_exit_gates(&self, tag: &str) -> Vec<&GateDefinition>
Get exit gates for a tag. Returns gates defined under “tag:<tag_name>” key.
Trait Implementations§
Source§impl Clone for WorkflowsConfig
impl Clone for WorkflowsConfig
Source§fn clone(&self) -> WorkflowsConfig
fn clone(&self) -> WorkflowsConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WorkflowsConfig
impl Debug for WorkflowsConfig
Source§impl Default for WorkflowsConfig
impl Default for WorkflowsConfig
Source§impl<'de> Deserialize<'de> for WorkflowsConfig
impl<'de> Deserialize<'de> for WorkflowsConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<&WorkflowsConfig> for PhasesConfig
Convert WorkflowsConfig to PhasesConfig for backwards compatibility.
impl From<&WorkflowsConfig> for PhasesConfig
Convert WorkflowsConfig to PhasesConfig for backwards compatibility.
Source§fn from(workflows: &WorkflowsConfig) -> Self
fn from(workflows: &WorkflowsConfig) -> Self
Source§impl From<&WorkflowsConfig> for StatesConfig
Convert WorkflowsConfig to StatesConfig for backwards compatibility.
impl From<&WorkflowsConfig> for StatesConfig
Convert WorkflowsConfig to StatesConfig for backwards compatibility.
Source§fn from(workflows: &WorkflowsConfig) -> Self
fn from(workflows: &WorkflowsConfig) -> Self
Auto Trait Implementations§
impl Freeze for WorkflowsConfig
impl RefUnwindSafe for WorkflowsConfig
impl Send for WorkflowsConfig
impl Sync for WorkflowsConfig
impl Unpin for WorkflowsConfig
impl UnsafeUnpin for WorkflowsConfig
impl UnwindSafe for WorkflowsConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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