export declare const TELEGRAM_CONTEXT_PACKET_SCHEMA_VERSION: 2; export type TelegramContextPacketStabilityV2 = "stable" | "dynamic"; export interface TelegramContextRecordV2 { /** Stable identity within the parent semantic block. */ recordId: string; /** Complete model-visible record. The compiler never slices this value. */ content: string; /** Lower values render first. Defaults to zero. */ order?: number; /** Higher values are admitted first when the segment has a finite budget. */ priority?: number; } export interface TelegramContextSemanticBlockV2 { /** Stable meaning-level identity, independent of the block's current text. */ semanticId: string; /** Monotonic revision. The highest revision for one semantic ID wins. */ revision: number; /** Stable blocks form the reusable prefix; dynamic blocks follow it. */ stability: TelegramContextPacketStabilityV2; /** Lower values render first. Defaults to zero. */ order?: number; /** Higher values are admitted first when the segment has a finite budget. */ priority?: number; records: readonly TelegramContextRecordV2[]; } export interface TelegramContextPacketBudgetsV2 { stableChars: number; dynamicChars: number; } export interface TelegramContextPacketCompileInputV2 { blocks: readonly TelegramContextSemanticBlockV2[]; budgets: TelegramContextPacketBudgetsV2; } export interface TelegramContextOmittedRecordV2 { semanticId: string; revision: number; recordId: string; } export interface TelegramContextOmissionReceiptV2 { type: "telegram_context_omission_receipt_v2"; schemaVersion: typeof TELEGRAM_CONTEXT_PACKET_SCHEMA_VERSION; segment: TelegramContextPacketStabilityV2; reason: "char_budget"; omittedBlockCount: number; omittedRecordCount: number; omittedDigest: string; omittedSemanticIds: string[]; omittedRecords: TelegramContextOmittedRecordV2[]; } export interface TelegramContextCompiledRecordV2 extends TelegramContextOmittedRecordV2 { content: string; order: number; priority: number; serializedChars: number; } export interface TelegramContextCompiledBlockV2 { semanticId: string; revision: number; stability: TelegramContextPacketStabilityV2; order: number; priority: number; records: TelegramContextCompiledRecordV2[]; } export interface TelegramContextCompiledSegmentV2 { segment: TelegramContextPacketStabilityV2; text: string; charLength: number; budgetChars: number; blocks: TelegramContextCompiledBlockV2[]; omissionReceipt?: TelegramContextOmissionReceiptV2; } export interface TelegramContextPacketCompilationV2 { schemaVersion: typeof TELEGRAM_CONTEXT_PACKET_SCHEMA_VERSION; stablePrefix: string; stablePrefixHash: string; dynamicContext: string; combinedContext: string; selectedRevisions: Record; stable: TelegramContextCompiledSegmentV2; dynamic: TelegramContextCompiledSegmentV2; } export declare class TelegramContextPacketValidationError extends Error { constructor(message: string); } export declare class TelegramContextPacketRevisionConflictError extends Error { constructor(semanticId: string, revision: number); } export declare class TelegramContextPacketBudgetError extends Error { readonly segment: TelegramContextPacketStabilityV2; readonly budgetChars: number; readonly requiredChars: number; constructor(segment: TelegramContextPacketStabilityV2, budgetChars: number, requiredChars: number); } /** * Compile canonical Telegram context into independently budgeted stable and * dynamic JSONL segments. Selection uses typed metadata only. Record content * is either serialized in full or represented by an omission receipt. */ export declare function compileTelegramContextPacketV2(input: TelegramContextPacketCompileInputV2): TelegramContextPacketCompilationV2;