From e6bf2f4a5cc00d904fe5b08d2c894d09ded7e9c4 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 1 Dec 2026 18:36:22 +0100 Subject: [PATCH 1/2] fix: resolved sub flow parames if preset value is present --- crates/taurus-core/src/handler/argument.rs | 8 ++ crates/taurus-core/src/runtime/engine.rs | 15 ++- .../src/runtime/engine/compiler.rs | 7 ++ .../src/runtime/engine/executor.rs | 117 +++++++++++++++--- .../taurus-core/src/runtime/engine/model.rs | 5 + .../src/runtime/engine/sub_flow_registry.rs | 23 +++- .../src/runtime/functions/array.rs | 1 + crates/taurus-tests/src/simulated_actions.rs | 31 ++++- 8 files changed, 180 insertions(+), 27 deletions(-) diff --git a/crates/taurus-core/src/handler/argument.rs b/crates/taurus-core/src/handler/argument.rs index 6d14eae..50f61e2 100644 --- a/crates/taurus-core/src/handler/argument.rs +++ b/crates/taurus-core/src/handler/argument.rs @@ -37,6 +37,11 @@ pub struct FunctionThunk { /// caller seeds; and it is handed on to remote nodes as a callable sub /// flow (and reported) as-is instead of being run eagerly. pub sub_flow_function: Option>, + /// Overrides resolved in the parent context at mint time (parallel to + /// `settings`): `Some` wins over the caller's value for that slot (even + /// `Some(null)`), `None` keeps it. Empty on the local path and for + /// returned functions. See `resolve_function_setting`. + pub resolved_overrides: Vec>, } impl fmt::Debug for FunctionThunk { @@ -55,6 +60,9 @@ impl fmt::Debug for FunctionThunk { pub enum Thunk { Node { node_id: i64, + /// Node-range overrides (from `CompiledThunk::Node::settings`); empty + /// for a local consumer. Resolved and applied at mint time. + settings: Vec, input_schema: Option, output_schema: Option, name: Option, diff --git a/crates/taurus-core/src/runtime/engine.rs b/crates/taurus-core/src/runtime/engine.rs index 252ae54..a80fa4e 100644 --- a/crates/taurus-core/src/runtime/engine.rs +++ b/crates/taurus-core/src/runtime/engine.rs @@ -419,7 +419,20 @@ impl ExecutionEngine { }, with_trace, ); - for (input_index, value) in parameters.into_iter().enumerate() { + // Seed the positional input slots, with any override winning over the + // action-supplied value for its slot (even a null). `resolved_overrides` + // is empty for a function target, so that case is plain caller seeding + // (its overrides are applied later in `build_function_thunk_args`). + let slot_count = pending.resolved_overrides.len().max(parameters.len()); + for input_index in 0..slot_count { + let value = match pending.resolved_overrides.get(input_index) { + Some(Some(override_value)) => override_value.clone(), + // No override: use the action value, or skip if it gave none. + _ => match parameters.get(input_index) { + Some(value) => value.clone(), + None => continue, + }, + }; value_store.insert_input_type( tucana::shared::InputType { node_id: pending.caller_node_id, diff --git a/crates/taurus-core/src/runtime/engine/compiler.rs b/crates/taurus-core/src/runtime/engine/compiler.rs index 575ccbb..feb5e97 100644 --- a/crates/taurus-core/src/runtime/engine/compiler.rs +++ b/crates/taurus-core/src/runtime/engine/compiler.rs @@ -235,6 +235,13 @@ fn compile_node_value( Some(sub_flow::ExecutionReference::StartingNodeId(referenced_node_id)) => { Ok(CompiledArg::Deferred(CompiledThunk::Node { node_id: *referenced_node_id, + // Capture overrides like the function variant below, so a + // node-range tool keeps them instead of dropping them. + settings: sub_flow + .parameters + .iter() + .map(|parameter| compile_sub_flow_setting(node_id, parameter_index, parameter)) + .collect::, _>>()?, input_schema: sub_flow.input_schema.clone(), output_schema: sub_flow.output_schema.clone(), name: sub_flow.name.clone(), diff --git a/crates/taurus-core/src/runtime/engine/executor.rs b/crates/taurus-core/src/runtime/engine/executor.rs index 2d46b56..db97e42 100644 --- a/crates/taurus-core/src/runtime/engine/executor.rs +++ b/crates/taurus-core/src/runtime/engine/executor.rs @@ -903,7 +903,7 @@ impl<'a> EngineExecutor<'a> { input_index: index as i64, }; let value = self - .resolve_function_setting(function, setting, input_type, value_store) + .resolve_function_setting(function, setting, index, input_type, value_store) .await?; self.trace_record_arg( frame_id, @@ -1149,11 +1149,19 @@ impl<'a> EngineExecutor<'a> { // function a remote runtime returned as a node result. Argument::Thunk(Thunk::Node { node_id, + settings, input_schema, output_schema, name, description, }) => { + // Resolve overrides now, in the parent context (the standalone + // run's store has a null flow input). Empty for a plain consumer. + let settings = std::mem::take(settings); + let resolved_overrides = self + .resolve_overrides(&settings, index as i64, value_store) + .await + .map_err(Signal::Failure)?; // Not executed, so left exactly as `build_args` already // recorded it: `eager: false, executed: false`. match self.sub_flow_registry.mint( @@ -1164,6 +1172,7 @@ impl<'a> EngineExecutor<'a> { Arc::clone(activity), value_store.get_current_node_id(), index as i64, + resolved_overrides, ) { Some(id) => { minted_ids.push(id.clone()); @@ -1196,6 +1205,15 @@ impl<'a> EngineExecutor<'a> { // and `execute_function_standalone` -> `build_function_thunk_args` // resolves the declared `settings` from them (see `engine.rs`). Argument::Thunk(Thunk::Function(function)) => { + // Resolve overrides in this node's (parent) store; a returned + // function has no settings to resolve. See the node branch above. + if function.sub_flow_function.is_none() && function.resolved_overrides.is_empty() { + let settings = function.settings.clone(); + function.resolved_overrides = self + .resolve_overrides(&settings, function.parameter_index, value_store) + .await + .map_err(Signal::Failure)?; + } let returned = function.sub_flow_function.clone(); let input_schema = function.input_schema.clone(); let output_schema = function.output_schema.clone(); @@ -1577,6 +1595,7 @@ impl<'a> EngineExecutor<'a> { &self, function: &FunctionThunk, setting: &SubFlowSetting, + index: usize, input_type: InputType, value_store: &mut ValueStore, ) -> Result { @@ -1585,8 +1604,26 @@ impl<'a> EngineExecutor<'a> { paths: Vec::new(), }; - // Own the lookup result so the value_store borrow is released before we - // may re-borrow it to resolve the default. + // Minted/tool path: `resolved_overrides` holds overrides pre-resolved + // in the parent context. Rule: a present override wins over the caller + // value (even null); an absent one (`None`) lets the caller value stand + // -- there is no default to fall back on. + if !function.resolved_overrides.is_empty() { + if let Some(Some(value)) = function.resolved_overrides.get(index) { + return Ok(value.clone()); + } + return match value_store.get(&reference) { + ValueStoreResult::Success(value) => Ok(value), + ValueStoreResult::Error(err) => Err(err), + ValueStoreResult::NotFound | ValueStoreResult::SubFlowFunction(_) => { + Err(missing_setting_error(function, setting)) + } + }; + } + + // Local consumer path (`for_each`/`map`/`filter`): `default` is a + // fallback, used only when the caller value is absent or null + // (code0-tech/taurus#346). match value_store.get(&reference) { ValueStoreResult::Success(value) => { if is_null_value(&value) && setting.default.is_some() { @@ -1597,8 +1634,6 @@ impl<'a> EngineExecutor<'a> { } } ValueStoreResult::Error(err) => Err(err), - // Input slots only ever hold values, so a sub flow function can't - // be found here; treat it like a missing input. ValueStoreResult::NotFound | ValueStoreResult::SubFlowFunction(_) => { self.resolve_setting_default(function, setting, value_store) .await @@ -1615,27 +1650,28 @@ impl<'a> EngineExecutor<'a> { value_store: &mut ValueStore, ) -> Result { let Some(default) = setting.default.as_ref() else { - return Err(RuntimeError::new( - "T-CORE-000107", - "SubFlowSettingValueMissing", - format!( - "Required sub_flow setting {} for function {} is missing", - setting.identifier, function.identifier - ), - )); + return Err(missing_setting_error(function, setting)); }; + self.resolve_override(default, function.parameter_index, value_store) + .await + } - match self.compiled_arg_to_argument( - default, - function.parameter_index as usize, - value_store, - )? { + /// Resolves a compiled override value against the current store, like a + /// node parameter (literal/reference/template/nested sub-flow). Shared by + /// the function-default path and mint-time pre-resolution. + async fn resolve_override( + &self, + default: &CompiledArg, + parameter_index: i64, + value_store: &mut ValueStore, + ) -> Result { + match self.compiled_arg_to_argument(default, parameter_index as usize, value_store)? { Argument::Eval(value) => Ok(value), Argument::Template(template) => { self.resolve_template_value(&template, value_store, None).await } // A reference resolving to a sub flow function, or a nested sub - // flow default, runs to produce the default value. + // flow default, runs to produce the value. Argument::Thunk(thunk) => match self.execute_thunk(&thunk, value_store).await.signal { Signal::Success(value) | Signal::Return(value) => Ok(value), Signal::Failure(err) => Err(err), @@ -1645,6 +1681,29 @@ impl<'a> EngineExecutor<'a> { }, } } + + /// Resolves a sub-flow's overrides in the parent context at mint time, + /// parallel to `settings`: `Some` for a configured value (even null), `None` + /// where there was none. `parameter_index` is the sub-flow's position among + /// the remote node's parameters. + async fn resolve_overrides( + &self, + settings: &[SubFlowSetting], + parameter_index: i64, + value_store: &mut ValueStore, + ) -> Result>, RuntimeError> { + let mut resolved = Vec::with_capacity(settings.len()); + for setting in settings { + let value = match setting.default.as_ref() { + Some(default) => { + Some(self.resolve_override(default, parameter_index, value_store).await?) + } + None => None, + }; + resolved.push(value); + } + Ok(resolved) + } } fn parameter_results_from_args(args: &[Argument]) -> Vec { @@ -1743,6 +1802,7 @@ fn returned_function_thunk( name: Some(function.name.clone()), description: Some(function.description.clone()), sub_flow_function: Some(function), + resolved_overrides: Vec::new(), })) } @@ -1839,12 +1899,14 @@ fn compiled_thunk_to_argument(thunk: &CompiledThunk) -> Thunk { match thunk { CompiledThunk::Node { node_id, + settings, input_schema, output_schema, name, description, } => Thunk::Node { node_id: *node_id, + settings: settings.clone(), input_schema: input_schema.clone(), output_schema: output_schema.clone(), name: name.clone(), @@ -1869,6 +1931,10 @@ fn compiled_thunk_to_argument(thunk: &CompiledThunk) -> Thunk { name: name.clone(), description: description.clone(), sub_flow_function: None, + // Resolved later, at mint time, if this function is handed to a + // remote action as a tool (see `resolve_remote_argument`); on the + // local path the settings' own defaults are resolved at invoke. + resolved_overrides: Vec::new(), }), } } @@ -1894,6 +1960,19 @@ fn is_null_value(value: &Value) -> bool { matches!(value.kind.as_ref(), None | Some(Kind::NullValue(_))) } +/// The error for a required sub-flow setting that had neither a configured +/// value/override nor a caller-supplied input. +fn missing_setting_error(function: &FunctionThunk, setting: &SubFlowSetting) -> RuntimeError { + RuntimeError::new( + "T-CORE-000107", + "SubFlowSettingValueMissing", + format!( + "Required sub_flow setting {} for function {} is missing", + setting.identifier, function.identifier + ), + ) +} + fn null_value() -> Value { Value { kind: Some(Kind::NullValue(0)), diff --git a/crates/taurus-core/src/runtime/engine/model.rs b/crates/taurus-core/src/runtime/engine/model.rs index e0c25d4..e600033 100644 --- a/crates/taurus-core/src/runtime/engine/model.rs +++ b/crates/taurus-core/src/runtime/engine/model.rs @@ -86,6 +86,11 @@ pub struct CompiledTemplateReference { pub enum CompiledThunk { Node { node_id: i64, + /// Configured overrides (`SubFlow.parameters`), compiled like a + /// function's `settings`. Empty for a plain node-range consumer; for a + /// tool, resolved in the parent context at mint time and applied by + /// seeding the sub-flow's input slots (`execute_sub_flow`). + settings: Vec, /// Declared shape of the sub-flow's input/output, carried from /// `shared::SubFlow` so a remote action call that mints this /// reference into a wire-format `ActionNodeSubFlowValue` can attach diff --git a/crates/taurus-core/src/runtime/engine/sub_flow_registry.rs b/crates/taurus-core/src/runtime/engine/sub_flow_registry.rs index ed924f2..3d4de1b 100644 --- a/crates/taurus-core/src/runtime/engine/sub_flow_registry.rs +++ b/crates/taurus-core/src/runtime/engine/sub_flow_registry.rs @@ -22,7 +22,7 @@ use std::collections::HashMap; use std::sync::{Arc, Mutex}; use tokio::sync::Notify; -use tucana::shared::NodeExecutionResult; +use tucana::shared::{NodeExecutionResult, Value}; use crate::handler::argument::FunctionThunk; use crate::runtime::engine::model::CompiledFlow; @@ -69,6 +69,11 @@ pub struct PendingSubFlow { /// node range standalone. pub caller_node_id: i64, pub caller_parameter_index: i64, + /// Overrides resolved in the parent context at mint time: `Some` wins over + /// the caller's value per slot, `None` keeps it. Populated for a `NodeRange` + /// target (applied by seeding input slots in `execute_sub_flow`); empty for + /// a function target, which carries its own on the `FunctionThunk`. + pub resolved_overrides: Vec>, /// The flow execution's shared idle-timeout activity (see /// `SubFlowRegistry::activity_for`) -- the same `Notify` every remote call /// of this `flow_execution_id` waits on, not just the one that minted this @@ -126,6 +131,7 @@ impl SubFlowRegistry { activity: Arc, caller_node_id: i64, caller_parameter_index: i64, + resolved_overrides: Vec>, ) -> Option { let start_idx = *flow.node_idx_by_id.get(&node_id)?; Some(self.insert(PendingSubFlow { @@ -136,6 +142,7 @@ impl SubFlowRegistry { activity, caller_node_id, caller_parameter_index, + resolved_overrides, })) } @@ -160,6 +167,8 @@ impl SubFlowRegistry { activity, caller_node_id, caller_parameter_index, + // Function targets apply overrides from the `FunctionThunk` itself. + resolved_overrides: Vec::new(), }) } @@ -303,7 +312,7 @@ mod tests { // (3, 5) so a field mix-up in `mint`/`PendingSubFlow` would be // caught by the assertions below instead of accidentally matching. let id = registry - .mint(&flow, 7, "parent-1", "flow-1", activity, 3, 5) + .mint(&flow, 7, "parent-1", "flow-1", activity, 3, 5, Vec::new()) .expect("node 7 exists in flow"); let pending = registry.get(&id).expect("entry should exist after mint"); @@ -331,7 +340,7 @@ mod tests { assert!( registry - .mint(&flow, 999, "parent-1", "flow-1", activity, 1, 1) + .mint(&flow, 999, "parent-1", "flow-1", activity, 1, 1, Vec::new()) .is_none() ); assert_eq!(registry.len(), 0); @@ -349,7 +358,7 @@ mod tests { std::thread::spawn(move || { let activity = Arc::new(Notify::new()); registry - .mint(&flow, 7, &format!("parent-{i}"), "flow-1", activity, 1, 1) + .mint(&flow, 7, &format!("parent-{i}"), "flow-1", activity, 1, 1, Vec::new()) .expect("node 7 exists in flow") }) }) @@ -414,6 +423,7 @@ mod tests { name: None, description: None, sub_flow_function: None, + resolved_overrides: Vec::new(), }; let id = registry.mint_function(&flow, function, "parent-1", "flow-1", activity, 3, 5); @@ -439,7 +449,7 @@ mod tests { // Two entries under flow A (the one we sweep) and one under flow B. let a1 = registry - .mint(&flow, 7, "parent-a", "flow-a", Arc::new(Notify::new()), 1, 1) + .mint(&flow, 7, "parent-a", "flow-a", Arc::new(Notify::new()), 1, 1, Vec::new()) .expect("node 7 exists in flow"); let a2 = registry.mint_function( &flow, @@ -456,6 +466,7 @@ mod tests { name: None, description: None, sub_flow_function: None, + resolved_overrides: Vec::new(), }, "parent-a", "flow-a", @@ -464,7 +475,7 @@ mod tests { 1, ); let b1 = registry - .mint(&flow, 7, "parent-b", "flow-b", Arc::new(Notify::new()), 1, 1) + .mint(&flow, 7, "parent-b", "flow-b", Arc::new(Notify::new()), 1, 1, Vec::new()) .expect("node 7 exists in flow"); registry.remove_for_execution("flow-a"); diff --git a/crates/taurus-core/src/runtime/functions/array.rs b/crates/taurus-core/src/runtime/functions/array.rs index 4465242..caad35d 100644 --- a/crates/taurus-core/src/runtime/functions/array.rs +++ b/crates/taurus-core/src/runtime/functions/array.rs @@ -1557,6 +1557,7 @@ mod tests { fn a_thunk(id: i64) -> Argument { Argument::Thunk(crate::handler::argument::Thunk::Node { node_id: id, + settings: Vec::new(), input_schema: None, output_schema: None, name: None, diff --git a/crates/taurus-tests/src/simulated_actions.rs b/crates/taurus-tests/src/simulated_actions.rs index 22b0ed3..4df93b6 100644 --- a/crates/taurus-tests/src/simulated_actions.rs +++ b/crates/taurus-tests/src/simulated_actions.rs @@ -14,6 +14,8 @@ //! | `example` | `remote::fail()` | Always fails -- proves a function is never run. | //! | `example` | `remote::sub_flow_function(function_identifier, definition_source)` | Returns a sub flow function (`SubFlowFunctionResult`) instead of a value. | //! | `example` | `remote::apply(handler, value)` | Invokes the `handler` sub flow once with `value` and returns its result. | +//! | `example` | `remote::invoke_empty(handler)` | Invokes the `handler` sub flow with no caller inputs (every param comes from overrides). | +//! | `example` | `remote::echo(..)` | Returns all its parameters as a list, to inspect resolved sub-flow settings. | //! | `example` | `remote::keep(handler)` | Receives a `handler` sub flow but never invokes it; returns `"kept"`. | //! | `example` | `remote::compare(a, b)` | Returns `a - b` as a number -- a comparator run on an action (used by sort fixtures). | //! | `example` | `remote::stash(handler)` | Stores the `handler` sub flow's id for a later call (does not invoke it); returns `"stashed"`. | @@ -83,6 +85,14 @@ impl RemoteRuntime for SimulatedActions<'_> { let value = literal(parameters, 1)?; raw(self.invoke(&handler, value).await?) } + // Invokes a sub flow with no caller inputs (every param comes from + // overrides) -- like an action exposing no tool params to its caller. + ("example", "remote::invoke_empty") => { + let handler = sub_flow(parameters, 0)?; + raw(self.invoke_with(&handler, vec![]).await?) + } + // Echoes all parameters as a list, to inspect resolved settings. + ("example", "remote::echo") => raw(echo_all(parameters)), ("example", "remote::keep") => { sub_flow(parameters, 0)?; raw(string("kept")) @@ -152,10 +162,19 @@ impl SimulatedActions<'_> { &self, execution_identifier: &str, input: Value, + ) -> Result { + self.invoke_with(execution_identifier, vec![input]).await + } + + /// `invoke` with an arbitrary number of positional inputs (including none). + async fn invoke_with( + &self, + execution_identifier: &str, + inputs: Vec, ) -> Result { let report = self .engine - .execute_sub_flow(execution_identifier, vec![input], Some(self), false) + .execute_sub_flow(execution_identifier, inputs, Some(self), false) .await .ok_or_else(|| { RuntimeError::new( @@ -216,6 +235,16 @@ fn raw(value: Value) -> NodeValueExecutionResult { raw_value_result(value) } +/// Returns every parameter received, in order, as a list. +fn echo_all(parameters: &[ActionNodeValue]) -> Value { + let values = (0..parameters.len()) + .map(|index| literal(parameters, index).unwrap_or_else(|_| null())) + .collect(); + Value { + kind: Some(Kind::ListValue(tucana::shared::ListValue { values })), + } +} + fn literal(parameters: &[ActionNodeValue], index: usize) -> Result { match parameters .get(index) From f9d7f984a016e3b8b255497bae30ecc15027921c Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 1 Dec 2026 18:42:40 +0100 Subject: [PATCH 2/2] feat: added fixtures to check for the resolving sub flow params --- .../remote/0020_subflow_literal_override.json | 64 +++++++++++++++ flows/remote/0021_subflow_null_override.json | 62 +++++++++++++++ flows/remote/0022_subflow_no_override.json | 55 +++++++++++++ .../0023_subflow_reference_override.json | 61 +++++++++++++++ .../0024_node_range_override_applied.json | 77 +++++++++++++++++++ ...plica_literal_and_reference_overrides.json | 65 ++++++++++++++++ 6 files changed, 384 insertions(+) create mode 100644 flows/remote/0020_subflow_literal_override.json create mode 100644 flows/remote/0021_subflow_null_override.json create mode 100644 flows/remote/0022_subflow_no_override.json create mode 100644 flows/remote/0023_subflow_reference_override.json create mode 100644 flows/remote/0024_node_range_override_applied.json create mode 100644 flows/remote/0025_flow3_replica_literal_and_reference_overrides.json diff --git a/flows/remote/0020_subflow_literal_override.json b/flows/remote/0020_subflow_literal_override.json new file mode 100644 index 0000000..343705b --- /dev/null +++ b/flows/remote/0020_subflow_literal_override.json @@ -0,0 +1,64 @@ +{ + "name": "0020_subflow_literal_override", + "description": "A configured literal override on a function sub-flow tool's parameter wins over the value the action supplies: the override (7) replaces the action's 99.", + "inputs": [ + { + "input": null, + "expected_result": 7 + } + ], + "flow": { + "flowId": "20", + "projectId": "1", + "startingNodeId": "1", + "nodeFunctions": [ + { + "definitionSource": "action.example", + "databaseId": "1", + "runtimeFunctionId": "remote::apply", + "parameters": [ + { + "databaseId": "100", + "runtimeParameterId": "handler", + "value": { + "subFlow": { + "signature": "(value: NUMBER): NUMBER", + "parameters": [ + { + "identifier": "value", + "value": { + "literalValue": { + "value": { + "numberValue": { + "integer": "7" + } + } + } + } + } + ], + "function": { + "functionIdentifier": "remote::identity", + "definitionSource": "action.example" + } + } + } + }, + { + "databaseId": "101", + "runtimeParameterId": "value", + "value": { + "literalValue": { + "value": { + "numberValue": { + "integer": "99" + } + } + } + } + } + ] + } + ] + } +} diff --git a/flows/remote/0021_subflow_null_override.json b/flows/remote/0021_subflow_null_override.json new file mode 100644 index 0000000..ce24c9a --- /dev/null +++ b/flows/remote/0021_subflow_null_override.json @@ -0,0 +1,62 @@ +{ + "name": "0021_subflow_null_override", + "description": "A configured override that is explicitly null still wins over the action-supplied value: an override's presence decides, not its content, so null replaces the action's 99.", + "inputs": [ + { + "input": null, + "expected_result": null + } + ], + "flow": { + "flowId": "21", + "projectId": "1", + "startingNodeId": "1", + "nodeFunctions": [ + { + "definitionSource": "action.example", + "databaseId": "1", + "runtimeFunctionId": "remote::apply", + "parameters": [ + { + "databaseId": "100", + "runtimeParameterId": "handler", + "value": { + "subFlow": { + "signature": "(value: NUMBER): NUMBER", + "parameters": [ + { + "identifier": "value", + "value": { + "literalValue": { + "value": { + "nullValue": "NULL_VALUE" + } + } + } + } + ], + "function": { + "functionIdentifier": "remote::identity", + "definitionSource": "action.example" + } + } + } + }, + { + "databaseId": "101", + "runtimeParameterId": "value", + "value": { + "literalValue": { + "value": { + "numberValue": { + "integer": "99" + } + } + } + } + } + ] + } + ] + } +} diff --git a/flows/remote/0022_subflow_no_override.json b/flows/remote/0022_subflow_no_override.json new file mode 100644 index 0000000..71645d9 --- /dev/null +++ b/flows/remote/0022_subflow_no_override.json @@ -0,0 +1,55 @@ +{ + "name": "0022_subflow_no_override", + "description": "With no override configured for the parameter, the action-supplied value stands: the action's 99 is used unchanged.", + "inputs": [ + { + "input": null, + "expected_result": 99 + } + ], + "flow": { + "flowId": "22", + "projectId": "1", + "startingNodeId": "1", + "nodeFunctions": [ + { + "definitionSource": "action.example", + "databaseId": "1", + "runtimeFunctionId": "remote::apply", + "parameters": [ + { + "databaseId": "100", + "runtimeParameterId": "handler", + "value": { + "subFlow": { + "signature": "(value: NUMBER): NUMBER", + "parameters": [ + { + "identifier": "value" + } + ], + "function": { + "functionIdentifier": "remote::identity", + "definitionSource": "action.example" + } + } + } + }, + { + "databaseId": "101", + "runtimeParameterId": "value", + "value": { + "literalValue": { + "value": { + "numberValue": { + "integer": "99" + } + } + } + } + } + ] + } + ] + } +} diff --git a/flows/remote/0023_subflow_reference_override.json b/flows/remote/0023_subflow_reference_override.json new file mode 100644 index 0000000..980bf30 --- /dev/null +++ b/flows/remote/0023_subflow_reference_override.json @@ -0,0 +1,61 @@ +{ + "name": "0023_subflow_reference_override", + "description": "A reference override is resolved in the parent context at mint time, so a parent flowInput path (channelId=7) reaches the sub-flow even though its own standalone store has a null flow input.", + "inputs": [ + { + "input": { "channelId": 7 }, + "expected_result": 7 + } + ], + "flow": { + "flowId": "23", + "projectId": "1", + "startingNodeId": "1", + "nodeFunctions": [ + { + "definitionSource": "action.example", + "databaseId": "1", + "runtimeFunctionId": "remote::apply", + "parameters": [ + { + "databaseId": "100", + "runtimeParameterId": "handler", + "value": { + "subFlow": { + "signature": "(value: NUMBER): NUMBER", + "parameters": [ + { + "identifier": "value", + "value": { + "referenceValue": { + "paths": [ + { "path": "channelId" } + ], + "flowInput": {} + } + } + } + ], + "function": { + "functionIdentifier": "remote::identity", + "definitionSource": "action.example" + } + } + } + }, + { + "databaseId": "101", + "runtimeParameterId": "value", + "value": { + "literalValue": { + "value": { + "nullValue": "NULL_VALUE" + } + } + } + } + ] + } + ] + } +} diff --git a/flows/remote/0024_node_range_override_applied.json b/flows/remote/0024_node_range_override_applied.json new file mode 100644 index 0000000..c72808f --- /dev/null +++ b/flows/remote/0024_node_range_override_applied.json @@ -0,0 +1,77 @@ +{ + "name": "0024_node_range_override_applied", + "description": "A node-range (startingNodeId) sub-flow tool applies its configured overrides too: the override (7) is seeded into the sub-flow's input slot and wins over the value the action supplies (99), which node 2 reads back.", + "inputs": [ + { + "input": null, + "expected_result": 7 + } + ], + "flow": { + "flowId": "24", + "projectId": "1", + "startingNodeId": "1", + "nodeFunctions": [ + { + "definitionSource": "action.example", + "databaseId": "1", + "runtimeFunctionId": "remote::apply", + "parameters": [ + { + "databaseId": "100", + "runtimeParameterId": "handler", + "value": { + "subFlow": { + "signature": "(value: NUMBER): NUMBER", + "parameters": [ + { + "identifier": "value", + "value": { + "literalValue": { + "value": { + "numberValue": { "integer": "7" } + } + } + } + } + ], + "startingNodeId": "2" + } + } + }, + { + "databaseId": "101", + "runtimeParameterId": "value", + "value": { + "literalValue": { + "value": { + "numberValue": { "integer": "99" } + } + } + } + } + ] + }, + { + "definitionSource": "action.example", + "databaseId": "2", + "runtimeFunctionId": "remote::identity", + "parameters": [ + { + "databaseId": "200", + "runtimeParameterId": "value", + "value": { + "referenceValue": { + "inputType": { + "nodeId": "1", + "parameterIndex": "0", + "inputIndex": "0" + } + } + } + } + ] + } + ] + } +} diff --git a/flows/remote/0025_flow3_replica_literal_and_reference_overrides.json b/flows/remote/0025_flow3_replica_literal_and_reference_overrides.json new file mode 100644 index 0000000..da64fa3 --- /dev/null +++ b/flows/remote/0025_flow3_replica_literal_and_reference_overrides.json @@ -0,0 +1,65 @@ +{ + "name": "0025_flow3_replica_literal_and_reference_overrides", + "description": "A function sub-flow tool with a literal override (botToken) and two reference overrides (channelId, messageId pointing into the parent flow input), invoked by an action that supplies no inputs. All three overrides resolve in the parent context at mint time -> ['BOT_TOKEN','C123','M456'].", + "inputs": [ + { + "input": { "channelId": "C123", "id": "M456" }, + "expected_result": [ "BOT_TOKEN", "C123", "M456" ] + } + ], + "flow": { + "flowId": "25", + "projectId": "1", + "startingNodeId": "1", + "nodeFunctions": [ + { + "definitionSource": "action.example", + "databaseId": "1", + "runtimeFunctionId": "remote::invoke_empty", + "parameters": [ + { + "databaseId": "100", + "runtimeParameterId": "handler", + "value": { + "subFlow": { + "signature": "(botToken: string, channelId: string, messageId: string): ARRAY", + "parameters": [ + { + "identifier": "botToken", + "value": { + "literalValue": { + "value": { "stringValue": "BOT_TOKEN" } + } + } + }, + { + "identifier": "channelId", + "value": { + "referenceValue": { + "paths": [ { "path": "channelId" } ], + "flowInput": {} + } + } + }, + { + "identifier": "messageId", + "value": { + "referenceValue": { + "paths": [ { "path": "id" } ], + "flowInput": {} + } + } + } + ], + "function": { + "functionIdentifier": "remote::echo", + "definitionSource": "action.example" + } + } + } + } + ] + } + ] + } +}