Skip to main content

Crate ainl_compression

Crate ainl_compression 

Source
Expand description

Heuristic compression primitives for AINL hosts.

This crate currently exposes the ArmaraOS “Ultra Cost-Efficient Mode” input compressor. It is intentionally embedding-free and dependency-light so it can be reused across hosts without shipping local ML models.

Companion modules (no I/O; host wiring stays out-of-crate):

  • profiles — built-in compression profiles and project→profile hints
  • adaptivecontent-shaped EfficientMode recommendations
  • cacheTTL hysteresis for cache-aware coordination

Set RUST_LOG=ainl_compression=debug to enable full before/after text logging per call (useful for tuning preserve lists and retention ratios).

Re-exports§

pub use adaptive::recommend_mode_for_content;
pub use adaptive::AdaptiveRecommendation;
pub use cache::cache_policy_summary;
pub use cache::effective_ttl_with_hysteresis;
pub use cache::CacheTtlResult;
pub use profiles::list_builtin_profiles;
pub use profiles::resolve_builtin_profile;
pub use profiles::suggest_profile_id_for_project;
pub use profiles::CompressionProfile;
pub use profiles::BUILTIN_PROFILES;

Modules§

adaptive
Embedding-free content classifier for adaptive eco mode selection.
cache
Cache-aware TTL coordination hints for compression-related caches.
profiles
Built-in compression profiles (policy vocabulary for hosts).

Structs§

Compressed
Result of a compression pass.
CompressionMetrics
Structured telemetry emitted for each compression operation.
PromptCompressor
Standalone input prompt compressor.

Enums§

EfficientMode
Input compression aggressiveness.

Traits§

CompressionTelemetrySink
Optional telemetry sink for compression metrics.

Functions§

compress
Compress text toward mode.retain() of its original token budget.
compress_with_metrics
Compress and return structured telemetry metrics in one call.
estimate_semantic_preservation_score
Lightweight lexical semantic-preservation heuristic in range 0.0..1.0.
tokenize_estimate
Heuristic token estimate (~4 chars per token, +1 minimum).