import type { EngineMessage } from "../engine/types.js"; import { type ObservationalMemoryConfig } from "./config.js"; import type { InternalAgentRunFn } from "./internal-run.js"; import { type RunObserverResult } from "./observer.js"; import { type RunReflectorResult } from "./reflector.js"; import type { ObservationalMemoryOwner } from "./types.js"; export interface MaybeCompactThreadOptions extends ObservationalMemoryOwner { threadId: string; messages?: EngineMessage[]; config?: Partial; runInternal?: InternalAgentRunFn; } export interface MaybeCompactThreadResult { observer: RunObserverResult; reflector: RunReflectorResult; } export declare function maybeCompactThread(options: MaybeCompactThreadOptions): Promise; export interface ThreadCompactionStatus { /** Tokens in messages the Observer has not compacted yet. */ unobservedTokens: number; /** The post-turn pass compacts once `unobservedTokens` reaches this. */ observationTokenThreshold: number; /** * Undefined when the observation cursor is past the stored thread, so the * next automatic pass cannot be predicted from this thread's messages. */ tokensUntilAutoCompact?: number; } export declare function getThreadCompactionStatus(options: ObservationalMemoryOwner & { threadId: string; messages?: EngineMessage[]; config?: Partial; }): Promise; /** * Compact a thread now instead of waiting for the post-turn threshold: any * unobserved message is observed, and the Reflector runs under its usual * threshold. The next model call reads the result, so a manifest computed * before then still shows the old size. */ export declare function compactThreadNow(options: Omit): Promise;