import type { InferUIMessageChunk, ObjectStreamPart, TextStreamPart, ToolSet, UIMessage, FinishReason } from './_types/@internal_ai-sdk-v5/dist/index.d.ts'; import type { FinishReason as FinishReasonV6, InferUIMessageChunk as InferUIMessageChunkV6, ToolApprovalRequest, UIMessage as UIMessageV6 } from './_types/@internal_ai-v6/dist/index.d.ts'; import type { DataChunkType, ChunkType, MastraFinishReason } from '@mastra/core/stream'; /** * Separator used to encode both runId and toolCallId into a single approvalId string. * Chosen because neither runId nor toolCallId can contain ":" in normal usage * (UUIDs are hex + hyphens; provider tool call IDs are alphanumeric + underscores). * The server splits on this separator to recover the runId for resumeStream. */ export declare const APPROVAL_ID_SEPARATOR = "::"; /** * Maps Mastra's extended finish reasons to AI SDK-compatible values. * 'tripwire' and 'retry' are Mastra-specific reasons for processor scenarios, * which are mapped to 'other' for AI SDK compatibility. */ export declare function toAISDKFinishReason(reason: MastraFinishReason): FinishReason; export type OutputChunkType = TextStreamPart | ObjectStreamPart> | ToolApprovalRequest | DataChunkType | undefined; export type ToolAgentChunkType = { type: 'tool-agent'; toolCallId: string; payload: any; }; export type ToolWorkflowChunkType = { type: 'tool-workflow'; toolCallId: string; payload: any; }; export type ToolNetworkChunkType = { type: 'tool-network'; toolCallId: string; payload: any; }; type ConvertMastraChunkToAISDKOptions = { chunk: ChunkType; mode?: 'generate' | 'stream'; normalizeWarnings: (warnings: any[] | undefined) => any[]; normalizeUsage: (usage: any) => any; normalizeFinishReason: (reason: MastraFinishReason) => string; includeRawFinishReason?: boolean; }; export declare function convertMastraChunkToAISDKBase({ chunk, mode, normalizeWarnings, normalizeUsage, normalizeFinishReason, includeRawFinishReason, }: ConvertMastraChunkToAISDKOptions): OutputChunkType; export declare function convertMastraChunkToAISDKv5({ chunk, mode, }: { chunk: ChunkType; mode?: 'generate' | 'stream'; }): OutputChunkType; export declare function toAISDKFinishReasonV6(reason: MastraFinishReason): FinishReasonV6; export declare function convertMastraChunkToAISDKv6({ chunk, mode, }: { chunk: ChunkType; mode?: 'generate' | 'stream'; }): OutputChunkType | OutputChunkType[]; export declare function convertFullStreamChunkToUIMessageStream({ part, messageMetadataValue, sendReasoning, sendSources, onError, sendStart, sendFinish, responseMessageId, }: { part: TextStreamPart | DataChunkType | ToolApprovalRequest | { type: 'tool-output'; toolCallId: string; output: any; }; messageMetadataValue?: unknown; sendReasoning?: boolean; sendSources?: boolean; onError: (error: unknown) => string; sendStart?: boolean; sendFinish?: boolean; responseMessageId?: string; }): InferUIMessageChunk | InferUIMessageChunkV6 | ToolAgentChunkType | ToolWorkflowChunkType | ToolNetworkChunkType | undefined; export {}; //# sourceMappingURL=helpers.d.ts.map