Skip to main content

Module binding

Module binding 

Source
Expand description

Binding Module - Data binding between tasks.

Handles with: block data binding:

  • entry: YAML types (BindingSpec/BindingEntry + WithSpec/WithEntry)
  • resolve: Runtime resolution (ResolvedBindings) with lazy support
  • template: Template substitution ({{with.alias}})
  • jsonpath: RFC 9535 JSONPath via serde_json_path
  • types: Core types (BindingPath, BindingSource, PathSegment, BindingType)
  • transform: 27 built-in transforms with pipe chains

Unified with: syntax (eager resolution):

with:
  forecast: weather.summary           # Simple path
  temp: weather.data.temp ?? 20       # With numeric default
  name: user.name ?? "Anonymous"      # With string default (quoted)
  cfg: settings ?? {"debug": false}   # With object default

Extended syntax for lazy bindings:

with:
  lazy_val:
    path: future.result
    lazy: true                        # Deferred resolution
  lazy_with_default:
    path: optional.value
    lazy: true
    default: "fallback"

Data flow:

YAML `with:` block → BindingSpec (entry)
                         ↓
                 ┌───────┴───────┐
                 ▼               ▼
          Eager (lazy=false)  Lazy (lazy=true)
          resolve now         store Pending
                 │               │
                 ▼               ▼
          ResolvedBindings (Resolved | Pending)
                         ↓
                 Template substitution
                 (resolves Pending on access)
                         ↓
                   Resolved prompt

Re-exports§

pub use mention::has_parallel_marker;
pub use mention::mentions_to_bindings;
pub use mention::parse_mentions;
pub use mention::resolve_mention;
pub use mention::strip_parallel_marker;
pub use mention::text_to_bindings;
pub use mention::Mention;
pub use mention::MentionResolutionError;
pub use mention::ResolvedMention;

Modules§

jsonpath
JSONPath evaluation — RFC 9535 via serde_json_path
mention
Mention Module - @reference parsing for Chat-as-DAG
transform
Transform Engine
types
Core Binding Types

Structs§

BindingEntry
Unified with entry - supports both string and extended object syntax
BindingPath
Source path for a binding – parsed from “$task_id.field.path”
BindingPathError
Error type for binding path parsing (NIKA-150)
ResolvedBindings
Resolved bindings from with: block (alias -> value or pending)
TransformExpr
A chain of transform operations: sort | unique | first(3)
TransformParseError
Error parsing a transform expression (NIKA-151)
WithEntry
A single binding entry in the with: block
WithEntryParseError
Error parsing a WithEntry string (NIKA-155)

Enums§

BindingSource
Where data originates
BindingType
Type constraint on a binding value (optional, defaults to Any)
LazyBinding
Lazy binding state - either resolved or pending
PathSegment
Single segment in a property path
TemplateExpr
Parsed template expression from inside {{ ... }}
TransformError
Error applying a transform (NIKA-152 type mismatch, NIKA-153 null input)
TransformOp
A single transform operation

Functions§

escape_for_shell
Escape a string for safe shell usage
extract_refs
Extract all alias references from a template (for static validation)
extract_with_refs
Extract all alias references from a template
parse_binding_entry
Parse a binding entry string into BindingEntry (eager resolution)
parse_template_expr
Parse the content inside {{ ... }} into a TemplateExpr.
parse_with_entry
Parse a with-entry from its string form
template_resolve
Resolve all {{with.alias}}, {{context.}}, and {{inputs.}} templates
template_resolve_for_shell
Resolve templates for shell context
template_resolve_with
Resolve all template references in a string
validate_refs
Validate that all template references exist in declared aliases (static validation)
validate_task_id
Validate a task ID without regex overhead
validate_with_refs
Validate that all template alias references exist in declared aliases

Type Aliases§

BindingSpec
Binding spec - map of alias to entry (YAML with: block)
WithSpec
Map of alias -> WithEntry (YAML with: block)