import type { Context } from '../core/context.js'; import type { CompactReport, Compactor } from '../types/compactor.js'; import type { Logger } from '../types/logger.js'; export interface CompactorOptions { preserveK?: number | undefined; eliseThreshold?: number | undefined; /** * Enable content-aware digest mode. When true, `collapseAncientTurns` uses * `buildSmartDigest` which scores messages by importance: critical content * (errors, corrections, decisions) is kept verbatim; normal exchanges get * first-sentence summaries; large tool outputs and repeated failures are * aggressively compressed. Defaults to false (lossless digest). */ smart?: boolean | undefined; /** * @deprecated Ignored. Token estimation is centralized in * `compaction-core`/`token-estimate` so all compactors and the context-pressure * monitor agree on one number. Kept only for backward-compatible call sites. */ estimator?: (((text: string) => number)) | undefined; /** Structured logger. Defaults to noOpLogger (silent). */ logger?: Logger | undefined; } /** * Default tools config values shared across CLI and WebUI. * Import this instead of hardcoding to avoid cross-surface inconsistencies. * These mirror the values in CONFIG_BEHAVIOR_DEFAULTS (config-loader.ts). * * @deprecated Import from '../types/default-config.js' instead. * This re-export exists for backward compatibility. */ export { DEFAULT_TOOLS_CONFIG, DEFAULT_CONTEXT_CONFIG, DEFAULT_AUTONOMY_CONFIG } from '../types/default-config.js'; export declare class HybridCompactor implements Compactor { private readonly preserveK; private readonly eliseThreshold; private readonly smart; private readonly logger; constructor(opts?: CompactorOptions); compact(ctx: Context, opts?: { aggressive?: boolean | undefined; }): Promise; /** * Estimate the full API request token count: messages + systemPrompt + toolDefs. * This is the accurate figure for context-window pressure monitoring. */ private estimateFullRequest; /** * Lossless rule-based collapse of ancient turns into a single digest message. * * Preserves ALL textual content of the collapsed range — user instructions, * assistant decisions/conclusions, and any prior digests (chained forward so * the digest stays lossless across repeated compactions). Only `tool_use` / * `tool_result` protocol blocks are dropped and replaced with a count marker; * their full payload already lives in the session log. No sub-LLM call. * * Returns the token savings and the digest text (for audit logging). */ private collapseAncientTurns; } //# sourceMappingURL=compactor.d.ts.map