import type { LanguageModelV2, SharedV2ProviderOptions } from '@ai-sdk/provider-v5';
import type { Span } from '@opentelemetry/api';
import type { CallSettings, IdGenerator, StopCondition, TelemetrySettings, ToolChoice, ToolSet } from 'ai-v5';
import type { MessageList } from '../agent/message-list/index.js';
import type { IMastraLogger } from '../logger/index.js';
import type { OutputProcessor } from '../processors/index.js';
import type { OutputSchema } from '../stream/base/schema.js';
import type { ChunkType } from '../stream/types.js';
import type { MastraIdGenerator } from '../types.js';
export type StreamInternal = {
    now?: () => number;
    generateId?: IdGenerator;
    currentDate?: () => Date;
};
export type LoopConfig = {
    onChunk?: (chunk: ChunkType) => Promise<void> | void;
    onError?: ({ error }: {
        error: Error | string;
    }) => Promise<void> | void;
    onFinish?: (event: any) => Promise<void> | void;
    onStepFinish?: (event: any) => Promise<void> | void;
    onAbort?: (event: any) => Promise<void> | void;
    activeTools?: Array<keyof ToolSet> | undefined;
    abortSignal?: AbortSignal;
};
export type LoopOptions<Tools extends ToolSet = ToolSet, OUTPUT extends OutputSchema | undefined = undefined> = {
    model: LanguageModelV2;
    logger?: IMastraLogger;
    mode?: 'generate' | 'stream';
    runId?: string;
    idGenerator?: MastraIdGenerator;
    toolCallStreaming?: boolean;
    telemetry_settings?: TelemetrySettings;
    messageList: MessageList;
    includeRawChunks?: boolean;
    modelSettings?: CallSettings;
    headers?: Record<string, string>;
    toolChoice?: ToolChoice<any>;
    options?: LoopConfig;
    providerOptions?: SharedV2ProviderOptions;
    tools?: Tools;
    outputProcessors?: OutputProcessor[];
    experimental_generateMessageId?: () => string;
    stopWhen?: StopCondition<NoInfer<Tools>> | Array<StopCondition<NoInfer<Tools>>>;
    maxSteps?: number;
    _internal?: StreamInternal;
    output?: OUTPUT;
};
export type LoopRun<Tools extends ToolSet = ToolSet, OUTPUT extends OutputSchema | undefined = undefined> = LoopOptions<Tools, OUTPUT> & {
    runId: string;
    startTimestamp: number;
    modelStreamSpan: Span;
    _internal: StreamInternal;
};
export type OuterLLMRun<Tools extends ToolSet = ToolSet, OUTPUT extends OutputSchema | undefined = undefined> = {
    messageId: string;
    controller: ReadableStreamDefaultController<ChunkType>;
    writer: WritableStream<ChunkType>;
} & LoopRun<Tools, OUTPUT>;
//# sourceMappingURL=types.d.ts.map