/** * Context Query Builder for LLM Context Assembly * * Token-aware context assembly with priority-based truncation. */ export declare enum ContextOutputFormat { TOON = "toon", JSON = "json", MARKDOWN = "markdown" } export declare enum TruncationStrategy { TAIL_DROP = "tail_drop",// Drop from end HEAD_DROP = "head_drop",// Drop from beginning PROPORTIONAL = "proportional" } export interface ContextResult { text: string; tokenCount: number; sections: Array<{ name: string; tokenCount: number; truncated: boolean; }>; } /** * Context Query Builder for assembling LLM context */ export declare class ContextQueryBuilder { private sessionId?; private tokenBudget; private format; private truncation; private sections; private currentSection?; /** * Set session ID for context */ forSession(sessionId: string): this; /** * Set token budget */ withBudget(tokens: number): this; /** * Set output format */ setFormat(format: ContextOutputFormat): this; /** * Set truncation strategy */ setTruncation(strategy: TruncationStrategy): this; /** * Add literal text section */ literal(name: string, priority: number, text: string): this; /** * Start a new section */ section(name: string, priority: number): this; /** * Add content to current section */ get(path: string): this; /** * Add last N records query */ last(n: number, table: string): this; /** * Add where equals condition */ whereEq(field: string, value: any): this; /** * Add vector search */ search(collection: string, embedding: string, k: number): this; /** * Add SQL query */ sql(query: string): this; /** * Finish current section */ done(): this; /** * Execute and build context */ execute(): ContextResult; private estimateTokens; private truncateText; private buildToonFormat; private buildJsonFormat; private buildMarkdownFormat; } /** * Create a context query builder */ export declare function createContextBuilder(): ContextQueryBuilder; //# sourceMappingURL=context-builder.d.ts.map