Module pack

Module pack 

Source
Expand description

Pack compiler – the canonical entry point for compiling a CELLSTATE pack.

Call compose_pack() with a PackInput (TOML manifest + Markdown files) to get a PackOutput containing both the intermediate CellstateAst and the final CompiledConfig.

This module orchestrates the full pipeline:

  1. Parse the TOML manifest (cstate.toml) via schema::parse_manifest.
  2. Parse Markdown prompt files, extracting fence blocks (markdown sub-module).
  3. Build the intermediate representation (ir::PackIr), merging TOML and Markdown-derived definitions and validating cross-references.
  4. Convert the IR into a CellstateAst (ast::build_ast).
  5. Compile the AST into a CompiledConfig via PipelineCompiler::compile.
  6. Inject pack-specific metadata (tools, toolsets, agents, injections, routing, file hashes) into the compiled config.

The ast module provides the shared types that this module produces. The config/ module provides the YAML fence-block parsers that this module calls during step 2.

Re-exportsΒ§

pub use flow::*;

ModulesΒ§

a2a
A2A (Agent-to-Agent) Agent Card generation.
a2ui_compat
Google A2UI compatibility layer.
agents_md
AGENTS.md generation from Pack configuration.
ast πŸ”’
Pack IR -> CellstateAst
flow
Flow definition and execution receipts
ir πŸ”’
Pack IR and validation
llms_txt
llms.txt generation from Pack configuration.
markdown πŸ”’
Markdown lint + extraction for pack prompts
mcp πŸ”’
MCP (Model Context Protocol) schema generation.
schema πŸ”’
Pack manifest schema (cstate.toml)
skills
Agent Skills interoperability (SKILL.md emit/parse).

StructsΒ§

AdapterDef
ComposioGatewayDef
Dynamic Composio MCP Gateway configuration. Enables runtime discovery of Composio’s 800+ tool integrations via a meta-tool.
DefaultsSection
ExtractedBlocks
Extracted metadata from markdown fenced blocks.
FencedBlock
FormatDef
InjectionDef
MarkdownDoc
MarkdownError
McpSchema
MCP schema representation for tool serving.
McpTool
Individual tool in MCP schema.
MetaSection
PackAgentBinding
Pack agent binding - wires toolsets and prompts to an agent role. Not to be confused with ast::AgentDef which defines agent capabilities.
PackInput
PackIr
PackManifest
PackMarkdownFile
PackOutput
PolicyActionDef
PolicyDef
ProfileBinding
ProfileDef
ProviderDef
RoutingSection
SettingsMatrix
SettingsSection
ToolBashDef
Bash tool definition β€” sandboxed command execution via just-bash.
ToolBrowserDef
Browser tool definition β€” accessibility-first browser automation.
ToolComposioDef
Composio tool definition β€” managed SaaS integrations via Composio REST API. Composio handles OAuth, authentication, and API mapping for 800+ tools. CELLSTATE records why the tool was called, what memory informed the decision, and what gates it passed.
ToolExecDef
ToolPromptDef
ToolsSection
ToolsetDef
UserSection

EnumsΒ§

FenceKind
Supported fence block types (single source of truth)
PackError

FunctionsΒ§

ast_from_ir
Builds a CELLSTATE AST from a pack intermediate representation.
build_ast
compile_composio_gateway πŸ”’
Compile Composio MCP Gateway configuration from manifest.
compile_flows πŸ”’
Compile flow definitions into compiled flows with content hashes.
compile_pack_agents
Compile pack agent bindings to toolsets with extracted markdown metadata.
compile_pack_injections
Compile pack injection metadata for runtime wiring.
compile_pack_routing
Compile pack provider routing hints.
compile_tools
Compile pack tool registry into runtime tool configs. contracts maps contract paths to their JSON content.
compile_toolsets
Compile pack toolsets into runtime toolset configs.
compose_pack
compute_file_hashes πŸ”’
Compute SHA-256 hashes for all pack source files. These hashes enable runtime drift detection without recompilation.
generate_mcp_schema
Generate deterministic MCP schema from compiled configuration.
inject_pack_metadata πŸ”’
Inject pack-level metadata from the manifest into CompiledConfig.
parse_manifest
parse_markdown_files
sha256_hex πŸ”’
Compute SHA-256 hash of content, returning hex-encoded string.
to_canonical_json
Serialize MCP schema to canonical JSON.

Type AliasesΒ§

ContractFiles
Contract files loaded from the pack for schema compilation.