/** * Context Management Data Models for PraisonAI TypeScript SDK. * * Python parity with praisonaiagents/context/models.py: * - ContextSegment enum * - ContextLedger class * - BudgetAllocation class * - ContextSnapshot class * - OptimizerStrategy enum * - OptimizationResult class * - MonitorConfig class * - ContextConfig class */ /** * Segments that contribute to context. * Python parity with ContextSegment enum. */ export declare const ContextSegment: { readonly SYSTEM_PROMPT: "system_prompt"; readonly RULES: "rules"; readonly SKILLS: "skills"; readonly MEMORY: "memory"; readonly TOOLS_SCHEMA: "tools_schema"; readonly HISTORY: "history"; readonly TOOL_OUTPUTS: "tool_outputs"; readonly BUFFER: "buffer"; }; export type ContextSegmentType = typeof ContextSegment[keyof typeof ContextSegment]; /** * Context optimization strategies. * Python parity with OptimizerStrategy enum. */ export declare const OptimizerStrategy: { readonly TRUNCATE: "truncate"; readonly SLIDING_WINDOW: "sliding_window"; readonly SUMMARIZE: "summarize"; readonly PRUNE_TOOLS: "prune_tools"; readonly NON_DESTRUCTIVE: "non_destructive"; readonly SMART: "smart"; }; export type OptimizerStrategyType = typeof OptimizerStrategy[keyof typeof OptimizerStrategy]; /** * Tracks token usage across context segments. * Python parity with ContextLedger dataclass. */ export interface ContextLedger { systemPrompt: number; rules: number; skills: number; memory: number; toolsSchema: number; history: number; toolOutputs: number; buffer: number; turnCount: number; messageCount: number; toolCallCount: number; } /** * Create a new ContextLedger with defaults. */ export declare function createContextLedger(partial?: Partial): ContextLedger; /** * Get total tokens from ledger. */ export declare function getLedgerTotal(ledger: ContextLedger): number; /** * Token budget allocation across segments. * Python parity with BudgetAllocation dataclass. */ export interface BudgetAllocation { modelLimit: number; outputReserve: number; systemPrompt: number; rules: number; skills: number; memory: number; toolsSchema: number; history: number; toolOutputs: number; buffer: number; } /** * Create a new BudgetAllocation with defaults. */ export declare function createBudgetAllocation(partial?: Partial): BudgetAllocation; /** * Get usable tokens after output reserve. */ export declare function getUsableBudget(budget: BudgetAllocation): number; /** * Get computed history budget. */ export declare function getHistoryBudget(budget: BudgetAllocation): number; /** * Configuration for context monitoring. * Python parity with MonitorConfig dataclass. */ export interface MonitorConfig { enabled: boolean; path: string; format: 'human' | 'json'; frequency: 'turn' | 'tool_call' | 'manual' | 'overflow'; redactSensitive: boolean; multiAgentFiles: boolean; } /** * Create a new MonitorConfig with defaults. */ export declare function createMonitorConfig(partial?: Partial): MonitorConfig; /** * Complete context management configuration. * Python parity with ContextConfig dataclass. */ export interface ContextConfig { autoCompact: boolean; compactThreshold: number; strategy: OptimizerStrategyType; outputReserve: number; historyRatio: number; toolOutputMax: number; defaultToolOutputMax: number; pruneAfterTokens: number; protectedTools: string[]; toolLimits: Record; monitor: MonitorConfig; keepRecentTurns: number; llmSummarize: boolean; smartToolSummarize: boolean; sessionTracking: boolean; trackSummary: boolean; trackGoal: boolean; trackPlan: boolean; trackProgress: boolean; aggregateMemory: boolean; aggregateSources: string[]; aggregateMaxTokens: number; compressionMinGainPct: number; compressionMaxAttempts: number; toolBudgets: Record; toolSummarizeLimits: Record; estimationMode: string; logEstimationMismatch: boolean; mismatchThresholdPct: number; monitorEnabled: boolean; monitorPath: string; monitorFormat: string; monitorFrequency: string; monitorWriteMode: string; redactSensitive: boolean; snapshotTiming: string; allowAbsolutePaths: boolean; source: string; } /** * Create a new ContextConfig with defaults. */ export declare function createContextConfig(partial?: Partial): ContextConfig; /** * Create a recipe-optimized ContextConfig. * Python parity with ContextConfig.for_recipe(). */ export declare function createRecipeContextConfig(): ContextConfig; /** * Result of context optimization. * Python parity with OptimizationResult dataclass. */ export interface OptimizationResult { originalTokens: number; optimizedTokens: number; tokensSaved: number; strategyUsed: OptimizerStrategyType; messagesRemoved: number; messagesTagged: number; toolOutputsPruned: number; toolOutputsSummarized: number; tokensSavedBySummarization: number; tokensSavedByTruncation: number; summaryAdded: boolean; } /** * Create a new OptimizationResult with defaults. */ export declare function createOptimizationResult(partial?: Partial): OptimizationResult; /** * Get reduction percentage from optimization result. */ export declare function getReductionPercent(result: OptimizationResult): number; /** * A snapshot of the current context state. * Python parity with ContextSnapshot dataclass. */ export interface ContextSnapshot { timestamp: string; sessionId: string; agentName: string; modelName: string; budget: BudgetAllocation | null; ledger: ContextLedger | null; utilization: number; systemPromptContent: string; rulesContent: string; skillsContent: string; memoryContent: string; toolsSchemaContent: string; historyContent: Array>; warnings: string[]; } /** * Create a new ContextSnapshot with defaults. */ export declare function createContextSnapshot(partial?: Partial): ContextSnapshot; /** * Configuration for ContextManager. * Python parity with ManagerConfig dataclass. */ export interface ManagerConfig { modelLimit: number; outputReserve: number; defaultToolOutputMax: number; compactThreshold: number; strategy: OptimizerStrategyType; compressionMinGainPct: number; compressionMaxAttempts: number; toolBudgets: Record; toolSummarizeLimits: Record; estimationMode: string; logEstimationMismatch: boolean; mismatchThresholdPct: number; monitorEnabled: boolean; monitorPath: string; monitorFormat: string; monitorFrequency: string; monitorWriteMode: string; redactSensitive: boolean; snapshotTiming: string; allowAbsolutePaths: boolean; } /** * Create a new ManagerConfig with defaults. */ export declare function createManagerConfig(partial?: Partial): ManagerConfig;