@juspay/neurolink
Version:
The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002
16 lines (15 loc) • 750 B
TypeScript
/**
* Stage 4: Sliding Window Truncation
*
* Non-destructive fallback: tags oldest messages as truncated
* instead of deleting them. Always preserves first message pair.
* Removes messages in pairs to maintain role alternation.
*
* Features:
* - Adaptive truncation (PERF-001): calculates fraction from actual overage
* instead of fixed 50%, with iterative refinement up to 6 passes.
* - Small conversation handling (BUG-005): for <= 4 messages, truncates
* message content proportionally instead of returning no-op.
*/
import type { ChatMessage, TruncationConfig, TruncationResult } from "../../types/index.js";
export declare function truncateWithSlidingWindow(messages: ChatMessage[], config?: TruncationConfig): TruncationResult;