import type { OptimizerConfig, AddOptions, PackResult } from './types'; export declare class ContextOptimizer { private config; private tokenizer; private sources; constructor(config: OptimizerConfig); /** * Register a context source. * * @param source - Identifier for this source (e.g. 'system', 'tools', 'history') * @param content - The content. Strings become one item; arrays become multiple * independently-scored items. Objects are JSON-stringified. * @param options - Priority, drop/compress strategies, etc. * * Calling `add()` with the same source name replaces the previous registration. */ add(source: string, content: string | string[] | object | object[], options: AddOptions): this; /** * Remove a previously registered source. */ remove(source: string): this; /** * Remove all registered sources. */ clear(): this; /** * Pack the registered context into an optimized arrangement. * * @param query - Optional user query. Used for relevance scoring and * included as a required item at the end of the output. * @returns PackResult with ordered items, stats, warnings, and dropped items. */ pack(query?: string): PackResult; private normalizeContent; /** * Group items into conversation turns. A new turn starts at each `role: 'user'` * message. Items without role fields are left ungrouped. */ private groupIntoTurns; private deriveItemId; private collectConstraints; /** * Clone source items and apply scoring. * * Items are cloned so that pack() is pure — calling it multiple times * with different queries produces correct, independent results. */ private collectAndScore; }