feat: show all variables in start node outputs

Signed-off-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
-LAN-
2026-03-17 05:19:30 +08:00
parent 3be2315cd1
commit e44f024d66
5 changed files with 180 additions and 10 deletions

View File

@@ -206,6 +206,23 @@ class VariablePool(BaseModel):
return result
def flatten(self, *, unprefixed_node_id: str | None = None) -> Mapping[str, object]:
"""Return a selector-style snapshot of the entire variable pool.
Variables belonging to ``unprefixed_node_id`` keep their original names so callers
can expose the current node's values without duplicating its namespace. All other
entries are emitted as ``"<node_id>.<name>"`` to preserve their source prefix in a
single flat mapping.
"""
result: dict[str, object] = {}
for node_id, variables in self.variable_dictionary.items():
for name, variable in variables.items():
output_name = name if node_id == unprefixed_node_id else f"{node_id}.{name}"
result[output_name] = deepcopy(variable.value)
return result
@classmethod
def empty(cls) -> VariablePool:
"""Create an empty variable pool."""