/** * Augments `this.sample()` calls with three composable behaviors: * * 1. Memory include convention — keys prefixed `include_system_` auto-inject * into systemPrompt; `include_transient_` inject as a trailing context * message appended to the messages array. * * Note: the FileMemoryBackend sanitizes key names (replaces [^a-zA-Z0-9_.-] * with '_'), so colons are not safe in key names. Underscore separators * are used throughout to guarantee the stored filenames and prefix filters * always agree. * * 2. Transient context registry (ContextRegistry) — in-memory named sections * with high/medium/low priority. Assembled into the trailing message * alongside memory transient includes. Low-priority sections are dropped * first under budget pressure. * * 3. Repeat-loop detection (RepeatDetector) — tracks the last 8 responses. * On consecutive duplicates, injects a graded signal into the next call's * systemPrompt so the model sees loop pressure as inline feedback. * * All three compose inside assembleSampleParams(), which is called by * the augmented this.sample() in loader.ts before forwarding to samplingProvider. */ export type ContextPriority = 'high' | 'medium' | 'low'; export declare class ContextRegistry { private _sections; add(name: string, content: string, priority?: ContextPriority): void; clear(name: string): void; clearAll(): void; /** * Assemble all sections into a single text block within `budget` chars. * Sections are sorted by priority descending (high kept longest). * Whole sections are dropped — never truncated mid-content. * Returns '' when empty or when all sections exceed the budget. */ assemble(budget?: number): string; } export declare class RepeatDetector { private _history; private _streak; private _pendingSignal; /** * Record a response after samplingProvider returns. * Updates the pending signal for injection on the next call. */ record(response: string): void; /** Read the pending signal to inject at the start of the next sample() call. */ consumeSignal(): string | null; } export interface SampleParams { prompt?: string; messages?: Array<{ role: 'user' | 'assistant'; content: any; }>; systemPrompt?: string; maxTokens?: number; temperature?: number; modelPreferences?: unknown; stopSequences?: string[]; includeContext?: 'none' | 'thisServer' | 'allServers'; } export interface AugmentedSampleParams { messages: Array<{ role: 'user' | 'assistant'; content: any; }>; systemPrompt: string | undefined; maxTokens: number; temperature: number | undefined; modelPreferences: unknown; stopSequences: string[] | undefined; includeContext: string | undefined; } /** * Assemble the final messages + systemPrompt to pass to samplingProvider. * * Reads memory includes and the context registry, then composes them with * the caller-supplied params. Fail-soft: errors in memory reads or registry * assembly are swallowed so a broken memory backend never kills a sample() call. */ export declare function assembleSampleParams(params: SampleParams, memory: any, context: ContextRegistry, repeatSignal: string | null): Promise; //# sourceMappingURL=sample-augmenter.d.ts.map