@juspay/neurolink
Version:
Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio
22 lines (21 loc) • 829 B
TypeScript
/**
* Emergency Content Truncation
*
* When message-level removal (sliding window) can't fit context into budget,
* this truncates the CONTENT of the longest messages as a last resort.
*/
import type { ChatMessage } from "../types/index.js";
/**
* Emergency content truncation: truncate the content of the longest messages
* to fit within the available token budget.
*
* Strategy: Sort messages by content length (descending), truncate each
* to a proportional share of the available budget until total fits.
*/
export declare function emergencyContentTruncation(messages: ChatMessage[], availableTokensForHistory: number, breakdown: {
systemPrompt: number;
conversationHistory: number;
currentPrompt: number;
toolDefinitions: number;
fileAttachments: number;
}, provider?: string): ChatMessage[];