open-standards/jouleclaw/jouleclaw-rs/crates/jouleclaw-decode/src/error.rs
Transaction Science c73fe87ed9 jouleclaw: full L0–L10 cascade tier surface — 20 pure-Rust crates
Port the complete verity-cascade layer taxonomy into the public
JouleClaw open standard as 20 standalone crates, each implementing the
jouleclaw-cascade Tier (or meta-control) trait. All deterministic-first,
pure Rust, no C++/Python deps, no OpenIE IP. +541 lib tests (1141→1682),
0 failures.

Execution tiers (L0.25–L4.5):
- jouleclaw-formula        L0.25  structural-contrast relationship resolver
- jouleclaw-tool-tier      L0.5   484-tool deterministic dispatch adapter
- jouleclaw-ssm-router     L0.75  local intent classifier (keyword default)
- jouleclaw-local-index    L1     BM25 in-process retrieval
- jouleclaw-graph-rag      L1.25  entity extraction + KG enrichment
- jouleclaw-struct-contrast L1.375 graph-enriched second formula pass
- jouleclaw-ssm-reader     L1.5   extractive reading-comprehension QA
- jouleclaw-federation     L2     multi-provider parallel search + fusion
- jouleclaw-rerank         L2.5   reranker (BM25 default; ColBERT/SPLADE plug-in)
- jouleclaw-llm-cheap      L3     cheap-LLM backend trait surface
- jouleclaw-verification-tier L4  cross-model agreement verification
- jouleclaw-proof-tier     L4.5   deterministic CSP (DPLL SAT + sudoku)

Meta-cognitive control plane (L5–L10):
- jouleclaw-routing        L5     episode-memory learned dispatch ordering
- jouleclaw-agent          L6     multi-step recursive cascade
- jouleclaw-reflection     L7     offline promote/demote lessons
- jouleclaw-tuner          L8     five damped control loops
- jouleclaw-supervisor     L9     pathology detection
- jouleclaw-governor       L10    rolling joule budget + tenant quotas + kill switch

Standalone capability crates:
- jouleclaw-decode         grammar-constrained decoding (regex/CFG/JSON-schema → token mask)
- jouleclaw-program        DSPy-style typed-signature modules + compiler

Co-Authored-By: Claude Opus 4.7 <[email protected]>
2026-05-27 09:21:25 -04:00

32 lines
1 KiB
Rust

//! Error type for grammar compilation and decoding.
use thiserror::Error;
/// Errors raised by grammar compilation, mask projection, and decoding.
#[derive(Debug, Error)]
pub enum DecodeError {
/// Regex syntax could not be parsed.
#[error("regex parse error at byte {pos}: {msg}")]
RegexParse { pos: usize, msg: String },
/// JSON-schema is malformed or uses an unsupported construct.
#[error("json-schema error: {0}")]
JsonSchema(String),
/// Context-free grammar references a non-terminal that was never defined,
/// or has no productions for the start symbol.
#[error("cfg error: {0}")]
Cfg(String),
/// Caller stepped a token id that is not currently permitted by the mask.
#[error("token id {0} is not allowed in current state")]
TokenNotAllowed(u32),
/// Caller stepped a token id outside the vocabulary range.
#[error("token id {0} is out of vocabulary range (size {1})")]
TokenOutOfRange(u32, usize),
/// Vocabulary is empty.
#[error("vocabulary is empty")]
EmptyVocabulary,
}