faf-rust-sdk 2.0.0

Rust SDK for FAF (Foundational AI-context Format) - IANA-registered application/vnd.faf+yaml
Documentation
//! FAFB Binary Format — Unified Specification
//!
//! Compiles human-readable .faf (YAML) to AI-optimized binary.
//! String table for unlimited section names, classification bits for DNA/Context/Pointer.
//!
//! ## Features
//!
//! - **O(1) section lookup** - Section table at end for instant access
//! - **Priority truncation** - Smart context window management
//! - **Pre-computed tokens** - No runtime estimation
//! - **String table** - Unlimited section names (up to 256)
//! - **Classification** - DNA / Context / Pointer chunk types
//!
//! ## Usage
//!
//! ```ignore
//! use faf_rust_sdk::binary::{compile, decompile, CompileOptions};
//!
//! let yaml = "faf_version: 2.5.0\nproject:\n  name: my-project\n";
//! let opts = CompileOptions { use_timestamp: false };
//! let bytes = compile(yaml, &opts).unwrap();
//! let result = decompile(&bytes).unwrap();
//! let name = result.get_section_string_by_name("project").unwrap();
//! ```
//!
//! See FAFB-SPEC-UNIFIED.md for full specification.

pub mod chunk_registry;
pub mod compile;
pub mod error;
pub mod flags;
pub mod header;
pub mod priority;
pub mod section;
pub mod section_type;
pub mod string_table;

// Re-exports for convenience
pub use chunk_registry::{
    classify_key, ChunkClassification, CLASSIFICATION_MASK, DNA_KEYS, POINTER_KEY,
};
pub use compile::{compile, decompile, CompileOptions, DecompiledFafb};
pub use error::{FafbError, FafbResult};
pub use flags::{
    Flags, FLAG_COMPRESSED, FLAG_EMBEDDINGS, FLAG_MODEL_HINTS, FLAG_RESOLVED, FLAG_SIGNED,
    FLAG_STRING_TABLE, FLAG_TOKENIZED, FLAG_WEIGHTED,
};
pub use header::{
    FafbHeader, HEADER_SIZE, MAGIC, MAGIC_U32, MAX_FILE_SIZE, MAX_SECTIONS, VERSION_MAJOR,
    VERSION_MINOR,
};
pub use priority::{
    Priority, PRIORITY_CRITICAL, PRIORITY_HIGH, PRIORITY_LOW, PRIORITY_MEDIUM, PRIORITY_OPTIONAL,
};
pub use section::{SectionEntry, SectionTable, SECTION_ENTRY_SIZE};
pub use section_type::{
    SectionType, SECTION_ARCHITECTURE, SECTION_BISYNC, SECTION_COMMANDS, SECTION_CONTEXT,
    SECTION_CUSTOM, SECTION_EMBEDDINGS, SECTION_KEY_FILES, SECTION_META, SECTION_MODEL_HINTS,
    SECTION_TECH_STACK, SECTION_TOKEN_MAP,
};
pub use string_table::StringTable;