import type { IsTaskCompleteConfig } from '../../../agent/agent.types.js';
import type { MessageList } from '../../../agent/message-list/index.js';
import type { IMastraLogger } from '../../../logger/index.js';
export type TaskCompletionOutcome = {
    evaluated: false;
} | {
    evaluated: true;
    complete: boolean;
};
/**
 * Shared is-task-complete behavior: decide whether this
 * iteration should be graded, run the completion scorers, invoke the
 * `onComplete` callback, append course-correction feedback to the transcript
 * when the check fails, and emit the `is-task-complete` chunk. Callers own
 * how the verdict projects back onto their state shape (flipping
 * `isContinued`, serializing the message list, main's
 * `isTaskCompleteCheckFailed` flag).
 *
 * Grading is skipped when: no scorers are configured; the LLM hasn't
 * signaled it's done (don't interrupt mid-tool loops — `llmSignaledDone` is
 * engine-computed because the engines treat a missing step result
 * differently); on the durable engine only, the iteration errored
 * (`reason === 'error'`, #21897 — see `engineMode` below); a
 * background task result was just injected (the LLM hasn't processed it
 * yet); or the iteration only updated working memory (housekeeping, not
 * task progress).
 *
 * Error policy is per-engine (`errorPolicy`, required so every call site's
 * choice is explicit):
 * - `'fatal'` (default in-process engine): scorer throws, `onComplete`
 *   throws, and chunk-emission failures propagate to the caller and fail
 *   the run — the released in-process contract. The engine has no
 *   redelivery, so a throw surfaces exactly once; swallowing it would hide
 *   real bugs in user scorer/callback code and break error handling users
 *   wrote against the shipped behavior. A failing `emitChunk` means the
 *   consumer's stream is broken — surface it rather than running against a
 *   dead stream.
 * - `'best-effort'` (durable/evented engines): failures are logged and
 *   grading is skipped. A scorer throw fails the durable *step*, and
 *   at-least-once redelivery re-runs the step — re-invoking the throwing
 *   scorer against the same state, potentially forever. Log-and-skip is
 *   the only stable policy under redelivery. Post-verdict
 *   publish failure must not fail a step whose verdict is already settled
 *   and persisted.
 *
 * The errored-iteration skip (`reason === 'error'` above) is gated on
 * `engineMode: 'durable'`: it shipped on the durable engine before the
 * extraction (#21897 — a failing scorer must not flip `isContinued` back on
 * and re-issue the failing request until maxSteps), while the released
 * default (in-process) contract still grades errored iterations. Extending
 * the fix to the default engine changes observable scorer invocation
 * counts, so it ships separately with its own product decision.
 */
export declare function evaluateTaskCompletion(deps: {
    policy: IsTaskCompleteConfig | undefined;
    /** Per-engine failure policy for scorer / onComplete / chunk-emission errors (see docblock). */
    errorPolicy: 'fatal' | 'best-effort';
    /**
     * Which engine's shipped grading contract to apply. Only the
     * errored-iteration skip consumes this (durable-only, see docblock).
     * Required (no default) so every call site's choice is explicit and a
     * missed site is a compile error — same doctrine as ContinuationPolicy.
     */
    engineMode: 'default' | 'durable';
    /** 1-based iteration number used for maxIterations bookkeeping + the chunk payload. */
    iteration: number;
    maxIterations: number | undefined;
    llmSignaledDone: boolean;
    stepReason: string | undefined;
    backgroundTaskPending: boolean | undefined;
    toolCalls: Array<{
        toolName?: string;
        args?: unknown;
    }>;
    toolResults: Array<{
        toolName?: string;
        result?: unknown;
    }>;
    currentText: string;
    /**
     * Live (main) or rehydrated-from-state (durable) transcript; feedback is
     * appended here. Lazy so the durable engine only deserializes when the
     * iteration is actually graded (all skip-guards run first).
     */
    messageList: () => MessageList;
    runId: string;
    agentId?: string;
    agentName?: string;
    threadId?: string;
    resourceId?: string;
    customContext?: Record<string, unknown>;
    generateId?: () => string | undefined;
    emitChunk: (chunk: unknown) => void | Promise<void>;
    logger?: IMastraLogger;
}): Promise<TaskCompletionOutcome>;
//# sourceMappingURL=is-task-complete-core.d.ts.map