import type { MastraDBMessage } from '@mastra/core/agent';
import type { Mastra } from '@mastra/core/mastra';
import type { ObservabilityContext } from '@mastra/core/observability';
import type { RequestContext } from '@mastra/core/request-context';
import type { ModelByInputTokens } from './model-by-input-tokens.js';
import type { TokenCounter } from './token-counter.js';
import type { ResolvedObservationConfig } from './types.js';
type ConcreteObservationModel = Exclude<ResolvedObservationConfig['model'], ModelByInputTokens>;
type ObservationModelResolver = (inputTokens: number) => {
    model: ConcreteObservationModel;
    selectedThreshold?: number;
    routingStrategy?: 'model-by-input-tokens';
    routingThresholds?: string;
};
/**
 * Runs the Observer agent for extracting observations from messages.
 * Handles single-thread and multi-thread modes, degenerate detection, and retry logic.
 */
export interface ObserverExchange {
    systemPrompt: string;
    observerMessages: Array<{
        role: string;
        content: unknown;
    }>;
    rawOutput: string;
    parsedResult: {
        observations: string;
        currentTask?: string;
        suggestedContinuation?: string;
        threadTitle?: string;
        degenerate?: boolean;
    };
    model: string;
    inputTokens: number;
    isMultiThread: boolean;
    retriedDueToDegenerate: boolean;
}
export declare class ObserverRunner {
    private readonly observationConfig;
    private readonly observedMessageIds;
    private readonly resolveModel;
    private readonly tokenCounter;
    private mastra?;
    /** Captured prompt/response from the last observer call (for repro capture). */
    lastExchange?: ObserverExchange;
    constructor(opts: {
        observationConfig: ResolvedObservationConfig;
        observedMessageIds: Set<string>;
        resolveModel: ObservationModelResolver;
        tokenCounter: TokenCounter;
        mastra?: Mastra;
    });
    __registerMastra(mastra: Mastra): void;
    private createAgent;
    private withAbortCheck;
    /**
     * Call the Observer agent for a single thread.
     */
    call(existingObservations: string | undefined, messagesToObserve: MastraDBMessage[], abortSignal?: AbortSignal, options?: {
        skipContinuationHints?: boolean;
        requestContext?: RequestContext;
        observabilityContext?: ObservabilityContext;
        priorCurrentTask?: string;
        priorSuggestedResponse?: string;
        priorThreadTitle?: string;
        wasTruncated?: boolean;
        model?: ConcreteObservationModel;
    }): Promise<{
        observations: string;
        currentTask?: string;
        suggestedContinuation?: string;
        threadTitle?: string;
        usage?: {
            inputTokens?: number;
            outputTokens?: number;
            totalTokens?: number;
        };
    }>;
    /**
     * Call the Observer agent for multiple threads in a single batched request.
     */
    callMultiThread(existingObservations: string | undefined, messagesByThread: Map<string, MastraDBMessage[]>, threadOrder: string[], abortSignal?: AbortSignal, requestContext?: RequestContext, priorMetadataByThread?: Map<string, {
        currentTask?: string;
        suggestedResponse?: string;
        threadTitle?: string;
    }>, observabilityContext?: ObservabilityContext, model?: ConcreteObservationModel): Promise<{
        results: Map<string, {
            observations: string;
            currentTask?: string;
            suggestedContinuation?: string;
            threadTitle?: string;
        }>;
        usage?: {
            inputTokens?: number;
            outputTokens?: number;
            totalTokens?: number;
        };
    }>;
}
export {};
//# sourceMappingURL=observer-runner.d.ts.map