import { generateText, type LanguageModel, type ModelMessage, type TelemetryOptions } from "ai";
import type { RuntimeModelReference } from "#runtime/agent/bootstrap.js";
import type { CompactionConfig, ToolLoopHarnessConfig } from "#harness/types.js";
/**
 * Rough token estimate: serialized JSON length / 4. Good enough for
 * deciding whether compaction is needed; the real token count comes back
 * from the model each step via {@link CompactionConfig.lastKnownInputTokens}.
 *
 * Accepts any JSON-serializable value so callers can apply the same heuristic
 * to whole message arrays or individual content parts on one consistent ruler.
 */
export declare function estimateTokens(value: unknown): number;
/**
 * Best available input-token count: the model-reported count from the last
 * step, plus a rough character-based estimate of whatever messages have been
 * appended since.
 */
export declare function getInputTokenCount(messages: readonly ModelMessage[], config: CompactionConfig): number;
/**
 * Returns true when the message history exceeds the compaction threshold.
 */
export declare function shouldCompact(messages: readonly ModelMessage[], config: CompactionConfig): boolean;
/**
 * Resolves the model used to summarize older context during compaction.
 *
 * Reuses the active turn model when compaction should summarize with the same
 * reference, and resolves the authored compaction model only when configured.
 */
export declare function resolveCompactionModel(input: {
    readonly compactionModelReference?: RuntimeModelReference;
    readonly model: LanguageModel;
    readonly modelReference: RuntimeModelReference;
    readonly resolveModel: ToolLoopHarnessConfig["resolveModel"];
}): Promise<{
    readonly model: LanguageModel;
    readonly providerOptions: Parameters<typeof generateText>[0]["providerOptions"];
}>;
/**
 * Compacts messages by summarizing older history and keeping only the most
 * recent messages.
 */
export declare function compactMessages(messages: ModelMessage[], model: LanguageModel, config: CompactionConfig, providerOptions?: Parameters<typeof generateText>[0]["providerOptions"], telemetry?: TelemetryOptions, headers?: Record<string, string>): Promise<ModelMessage[]>;
