import type { OpenClawConfig } from "../../config/types.openclaw.js"; import type { CompactResult, ContextEngine } from "../../context-engine/types.js"; export declare const EMBEDDED_COMPACTION_TIMEOUT_MS = 900000; export declare function resolveCompactionTimeoutMs(cfg?: OpenClawConfig): number; export declare function compactWithSafetyTimeout(compact: (abortSignal?: AbortSignal) => Promise, timeoutMs?: number, opts?: { abortSignal?: AbortSignal; onCancel?: () => void; }): Promise; /** Parameters for a single {@link ContextEngine.compact} invocation. */ export type ContextEngineCompactParams = Parameters[0]; /** * Invoke a plugin-owned {@link ContextEngine.compact} bounded by the same * finite safety timeout that protects native runtime compaction. * * Plugin context engines that advertise `ownsCompaction` previously had their * `compact()` awaited with no timeout, no watchdog, and no abort signal — a * slow or hung plugin compaction would hang the agent turn indefinitely. This * wrapper closes that gap: * - the call is bounded by `timeoutMs` (host-resolved, default * {@link EMBEDDED_COMPACTION_TIMEOUT_MS}); on timeout it rejects with a * "Compaction timed out" error so the caller's existing failure handling * runs instead of hanging; * - the timeout signal and caller `abortSignal` are both raced against the * call (so a non-cooperating engine is still bounded) and threaded into the * `compact()` params (so cooperating engines can cancel their own in-flight * work). * * Callers keep their existing try/catch — a timeout or abort surfaces as a * thrown error, never a silent hang. */ export declare function compactContextEngineWithSafetyTimeout(contextEngine: Pick, params: ContextEngineCompactParams, timeoutMs?: number, abortSignal?: AbortSignal): Promise;