Skip to main content

is_hidden_node

Function is_hidden_node 

Source
pub fn is_hidden_node(node_name: &str, tags: &[String]) -> bool
Expand description

Check if a node name indicates a hidden (internal) node.

A node is considered hidden when either:

  1. Its name both starts and ends with __ (e.g., __route__, __internal__)
  2. It has the __hidden__ tag in its tags list

This follows the convention established by LangGraph’s TAG_HIDDEN mechanism.

Hidden nodes are filtered from:

  • interrupt_before / interrupt_after checks via should_interrupt
  • StreamEvent::Interrupt emission in the Pregel loop

§Arguments

  • node_name - The name of the node to check
  • tags - The tags associated with the node

§Examples

use juncture_core::interrupt::is_hidden_node;

// Hidden by name pattern
assert!(is_hidden_node("__route__", &[]));
assert!(is_hidden_node("__internal_router__", &[]));
assert!(!is_hidden_node("my_node", &[]));
assert!(!is_hidden_node("__incomplete", &[]));
assert!(!is_hidden_node("normal__", &[]));

// Hidden by tag
assert!(is_hidden_node("my_node", &vec!["__hidden__".to_string()]));
assert!(!is_hidden_node("my_node", &vec!["other_tag".to_string()]));