/** * Accept-by-default gate for plan-implement research compaction. * * Prefer keeping a good free-form model summary. Reject only clear structural * failures (empty summary, orphan tool pairs, catastrophic stub) — never on * missing headings, missing hostnames, or token-% taste checks. */ import type { ChatMessage } from "../types.js"; /** Summary body shorter than this after a large history is treated as a stub. */ export declare const CATASTROPHIC_SUMMARY_MIN_CHARS = 120; /** * Only apply catastrophic-stub check when pre-compact history was at least * this many estimated tokens (small sessions may legitimately shrink a lot). */ export declare const CATASTROPHIC_BEFORE_TOKENS_MIN = 8000; /** After-tokens ratio below this vs large before + tiny body → reject. */ export declare const CATASTROPHIC_AFTER_RATIO = 0.05; export interface AcceptPlanImplementCompactionInput { readonly summarized: boolean; /** Memory body without the COMPACTION_MEMORY_PREFIX header (or full text). */ readonly summaryBody: string; readonly beforeTokens: number; readonly afterTokens: number; readonly afterMessages: readonly ChatMessage[]; } export type AcceptPlanImplementCompactionResult = { readonly accept: true; } | { readonly accept: false; readonly reason: string; }; /** * Accept unless a clear structural failure is proven. * Does not inspect plan.goal keywords or markdown section headings. */ export declare function acceptPlanImplementCompaction(input: AcceptPlanImplementCompactionInput): AcceptPlanImplementCompactionResult; /** Extract summary body from compacted messages for the accept gate. */ export declare function extractCompactionSummaryBody(messages: readonly ChatMessage[]): string; /** Skip compact when history is already small (no toast). */ export declare const PLAN_IMPLEMENT_COMPACT_MIN_TOKENS = 6000;