import { M as MarchAgentApp } from '../app-BKXFecV9.js'; import 'zod'; /** * March Agent SDK - Vercel AI SDK Extension * * VercelAIMessageStore for persistent message history with Vercel AI SDK. * * @packageDocumentation */ interface CoreMessage { role: 'system' | 'user' | 'assistant' | 'tool'; content: string | Array<{ type: string; [key: string]: unknown; }>; [key: string]: unknown; } /** * Persistent message store for Vercel AI SDK. * * Stores and retrieves AI SDK message history using the agent-state API. * Messages are serialized as JSON for full fidelity. * * @example * ```typescript * import { MarchAgentApp } from 'march-ai-sdk' * import { VercelAIMessageStore } from 'march-ai-sdk/extensions/vercel-ai' * import { streamText } from 'ai' * import { openai } from '@ai-sdk/openai' * * const app = new MarchAgentApp({ * gatewayUrl: 'agent-gateway:8080', * apiKey: 'your-key', * }) * * const store = new VercelAIMessageStore(app) * const agent = app.registerMe({ ... }) * * agent.onMessage(async (message, sender) => { * // Load message history * const history = await store.load(message.conversationId) * * // Add user message * const messages: CoreMessage[] = [ * ...history, * { role: 'user', content: message.content } * ] * * // Stream response * const streamer = agent.streamer(message) * * const result = await streamText({ * model: openai('gpt-4o'), * messages, * onChunk: ({ chunk }) => { * if (chunk.type === 'text-delta') { * streamer.stream(chunk.textDelta) * } * } * }) * * await streamer.finish() * * // Save updated history * await store.save(message.conversationId, [ * ...messages, * { role: 'assistant', content: result.text } * ]) * }) * * app.run() * ``` */ declare class VercelAIMessageStore { private static readonly NAMESPACE; private readonly client; constructor(app: MarchAgentApp); /** * Load message history for a conversation. * * @param conversationId - The conversation ID to load history for * @returns Array of CoreMessage objects (empty array if no history) */ load(conversationId: string): Promise; /** * Save message history for a conversation. * * @param conversationId - The conversation ID to save history for * @param messages - Array of CoreMessage objects to save */ save(conversationId: string, messages: CoreMessage[]): Promise; /** * Clear message history for a conversation. * * @param conversationId - The conversation ID to clear history for */ clear(conversationId: string): Promise; /** * Append messages to existing history. * * @param conversationId - The conversation ID * @param newMessages - Messages to append */ append(conversationId: string, newMessages: CoreMessage[]): Promise; /** * Get the last N messages from history. * * @param conversationId - The conversation ID * @param count - Number of messages to retrieve */ getLastMessages(conversationId: string, count: number): Promise; /** * Validate that an object is a valid message. */ private isValidMessage; /** * Serialize a message for storage. */ private serializeMessage; } export { type CoreMessage, VercelAIMessageStore };