/**
 * The one model call behind the session summarizer (PHNX-3939).
 *
 * A pure boundary: given the session's first user turn (the goal source) and its
 * live progress (todos / plan / phase off the state engine), it asks a local
 * Anthropic-wire endpoint (Ollama / vLLM / LiteLLM — the same configurable base
 * URL `computer/model.ts` speaks) for a strict JSON `{goal, checkpoints, checklist}`
 * and validates the shape. On ANY failure — network, non-2xx, non-JSON, wrong
 * shape — it returns `undefined`, and the caller records `summaryState: 'skipped'`.
 *
 * NEVER called on the request path: only the background SessionSummarizerService
 * invokes it, debounced and reader-gated.
 */
import type { TodoProgress } from '../session/types.js';
/** Live progress fed to the model alongside the goal-bearing prompt. */
export interface SummarizeProgress {
    /** Latest checklist write (TodoWrite / update_plan), when the session has one. */
    todos?: TodoProgress;
    /** Plan markdown from the last ExitPlanMode, when present. */
    plan?: string;
    /** Coarse lifecycle phase (running / waiting / idle / …), when known. */
    phase?: string;
}
/** The validated model output. `at` timestamps are stamped by the caller. */
export interface SummarizeResult {
    goal: string;
    /** Progress checkpoints, newest last (short lines). */
    checkpoints: string[];
    /** Detailed checklist. */
    checklist: {
        text: string;
        done: boolean;
    }[];
}
export interface SummarizeOptions {
    baseUrl: string;
    model: string;
    maxTokens?: number;
    /**
     * API key for the endpoint. Deliberately NOT resolved from `ANTHROPIC_API_KEY`:
     * the summarizer targets an operator-configured local/remote endpoint
     * (Ollama/vLLM/LiteLLM) that typically ignores the key, so forwarding the real
     * Anthropic credential there would leak it. Only an explicit
     * `AGENTS_SUMMARIZER_API_KEY` (or this option) is ever sent; otherwise the
     * header is empty.
     */
    apiKey?: string;
    /** Injectable for tests; defaults to the global fetch. */
    fetchImpl?: typeof fetch;
    /** Abort the request when the daemon tick's deadline elapses. */
    signal?: AbortSignal;
}
/** Compose the user message from the goal-bearing prompt and the live progress. */
export declare function buildSummarizeUserMessage(prompt: string, progress: SummarizeProgress): string;
/**
 * Coerce an untrusted parsed object into a {@link SummarizeResult}, or undefined
 * when the shape is wrong. Extra/missing optional arrays degrade to `[]` rather
 * than failing, but a non-string goal is a hard reject — a summary with no goal
 * is not a summary.
 */
export declare function validateSummarizeResult(parsed: unknown): SummarizeResult | undefined;
/** Strip ``` fences and pull the first {...} block so a chatty model still parses. */
export declare function extractJsonObject(text: string): string | undefined;
/**
 * Run one summarization. Returns the validated result, or `undefined` on any
 * failure (the caller then marks the session `summaryState: 'skipped'`).
 */
export declare function summarize(prompt: string, progress: SummarizeProgress, opts: SummarizeOptions): Promise<SummarizeResult | undefined>;
