Crate cellstate_pipeline

Crate cellstate_pipeline 

Source
Expand description

CELLSTATE Pipeline - Configuration Compiler (TOML + Markdown -> CompiledConfig)

This crate is a configuration compiler, not a runtime or interpreter. It reads a TOML manifest (cstate.toml) and Markdown prompt files containing YAML fence blocks, then compiles them into a single CompiledConfig struct that the runtime consumes.

§Module Layout

  • pack – Canonical entry point. Call compose_pack() to compile a pack. Orchestrates manifest parsing, Markdown extraction, IR construction, AST building, and final compilation.
  • ast – Shared AST type definitions (CellstateAst, Definition, etc.). These types are the common language between pack, config, and compiler.
  • config – YAML fence-block parsers (parse_adapter_block, etc.) and the canonical Markdown printer (ast_to_markdown) for round-trip testing.
  • compiler – Transforms a CellstateAst into a validated CompiledConfig.
  • pretty_print – Convenience crate-level alias of ast_to_markdown.

§Compilation Pipeline

cstate.toml + *.md files
        |
        v
  pack::compose_pack()
        |
  +-----+------+
  |            |
  v            v
TOML       Markdown
Manifest   Fence Blocks
  |            |
  +-----+------+
        |
        v
    PackIr (intermediate representation)
        |
        v
    CellstateAst (ast types)
        |
        v
    PipelineCompiler::compile()
        |
        v
    CompiledConfig (runtime-ready)

Re-exports§

pub use config::ast_to_markdown as pretty_print;
pub use config::ast_to_markdown;
pub use config::parse_adapter_block;
pub use config::parse_agent_block;
pub use config::parse_cache_block;
pub use config::parse_injection_block;
pub use config::parse_intent_block;
pub use config::parse_memory_block;
pub use config::parse_policy_block;
pub use config::parse_provider_block;
pub use config::parse_trajectory_block;
pub use config::ConfigError;
pub use pack::compose_pack;
pub use pack::PackError;
pub use pack::PackInput;
pub use pack::PackMarkdownFile;
pub use pack::PackOutput;
pub use ast::*;
pub use compiler::*;

Modules§

ast
Abstract Syntax Tree types
compiler
Pack Config Compiler - Transform AST to Runtime Configuration
config
Config parsing and Markdown generation for CELLSTATE configurations
pack
Pack compiler – the canonical entry point for compiling a CELLSTATE pack.