import type { AgentExecutionOptions, NetworkOptions } from '@mastra/core/agent';
import type { Mastra } from '@mastra/core/mastra';
import { registerApiRoute } from '@mastra/core/server';
import type { AgentVersionOptions } from './chat-route.js';
import type { SupportedUIMessage, V5UIMessage, V5UIMessageStream, V6UIMessage, V6UIMessageStream } from './public-types.js';
export type NetworkStreamHandlerParams<UI_MESSAGE extends SupportedUIMessage = SupportedUIMessage, OUTPUT = undefined> = AgentExecutionOptions<OUTPUT> & {
    messages: UI_MESSAGE[];
};
export type NetworkStreamHandlerOptions<UI_MESSAGE extends SupportedUIMessage = SupportedUIMessage, OUTPUT = undefined> = {
    mastra: Mastra;
    agentId: string;
    agentVersion?: AgentVersionOptions;
    params: NetworkStreamHandlerParams<UI_MESSAGE, OUTPUT>;
    defaultOptions?: NetworkOptions<OUTPUT>;
    version?: 'v5' | 'v6';
};
type NetworkStreamHandlerOptionsV5<UI_MESSAGE extends V5UIMessage = V5UIMessage, OUTPUT = undefined> = Omit<NetworkStreamHandlerOptions<UI_MESSAGE, OUTPUT>, 'version'> & {
    version?: 'v5';
};
type NetworkStreamHandlerOptionsV6<UI_MESSAGE extends V6UIMessage = V6UIMessage, OUTPUT = undefined> = Omit<NetworkStreamHandlerOptions<UI_MESSAGE, OUTPUT>, 'version'> & {
    version: 'v6';
};
/**
 * Framework-agnostic handler for streaming agent network execution in AI SDK-compatible format.
 * Use this function directly when you need to handle network streaming outside of Hono or Mastra's own apiRoutes feature.
 *
 * @example
 * ```ts
 * // Next.js App Router
 * import { handleNetworkStream } from '@mastra/ai-sdk';
 * import { createUIMessageStreamResponse } from 'ai';
 * import { mastra } from '@/src/mastra';
 *
 * export async function POST(req: Request) {
 *   const params = await req.json();
 *   const stream = await handleNetworkStream({
 *     mastra,
 *     agentId: 'routingAgent',
 *     params,
 *   });
 *   return createUIMessageStreamResponse({ stream });
 * }
 * ```
 */
export declare function handleNetworkStream<UI_MESSAGE extends V5UIMessage = V5UIMessage, OUTPUT = undefined>(options: NetworkStreamHandlerOptionsV5<UI_MESSAGE, OUTPUT>): Promise<V5UIMessageStream<UI_MESSAGE>>;
export declare function handleNetworkStream<UI_MESSAGE extends V6UIMessage = V6UIMessage, OUTPUT = undefined>(options: NetworkStreamHandlerOptionsV6<UI_MESSAGE, OUTPUT>): Promise<V6UIMessageStream<UI_MESSAGE>>;
export type NetworkRouteOptions<OUTPUT = undefined> = {
    path: `${string}:agentId${string}`;
    agent?: never;
    defaultOptions?: NetworkOptions<OUTPUT>;
    version?: 'v5' | 'v6';
    agentVersion?: AgentVersionOptions;
} | {
    path: string;
    agent: string;
    defaultOptions?: NetworkOptions<OUTPUT>;
    version?: 'v5' | 'v6';
    agentVersion?: AgentVersionOptions;
};
/**
 * Creates a network route handler for streaming agent network execution using the AI SDK-compatible format.
 *
 * This function registers an HTTP POST endpoint that accepts messages, executes an agent network, and streams the response back to the client in AI SDK-compatible format. Agent networks allow a routing agent to delegate tasks to other agents.
 *
 * @param {NetworkRouteOptions} options - Configuration options for the network route
 * @param {string} [options.path='/network/:agentId'] - The route path. Include `:agentId` for dynamic routing
 * @param {string} [options.agent] - Fixed agent ID when not using dynamic routing
 * @param {AgentExecutionOptions} [options.defaultOptions] - Default options passed to agent execution
 *
 * @example
 * // Dynamic agent routing
 * networkRoute({
 *   path: '/network/:agentId',
 * });
 *
 * @example
 * // Fixed agent with custom path
 * networkRoute({
 *   path: '/api/orchestrator',
 *   agent: 'router-agent',
 *   defaultOptions: {
 *     maxSteps: 10,
 *   },
 * });
 */
export declare function networkRoute<OUTPUT = undefined>({ path, agent, defaultOptions, version, agentVersion, }: NetworkRouteOptions<OUTPUT>): ReturnType<typeof registerApiRoute>;
export {};
//# sourceMappingURL=network-route.d.ts.map