/** * withAnycastOpenAI() — transparent telemetry wrapper for @openai/agents streams. * * Tested against @openai/agents 0.x * OpenAI Agents SDK is evolving rapidly. If this wrapper breaks after an SDK update, * check: https://github.com/openai/openai-agents-js * and update the event type interface below. */ import { AnycastMemory } from './with-anycast.js'; interface OpenAIAgentStreamEvent { type: 'raw_model_stream_event' | 'run_item_stream_event' | 'agent_updated_stream_event' | 'run_stream_done' | string; item?: { type: 'message_output_item' | 'tool_call_item' | 'tool_call_output_item' | string; rawItem?: { name?: string; type?: string; }; }; finalOutput?: { rawResponses?: Array<{ usage?: { input_tokens?: number; output_tokens?: number; total_tokens?: number; }; }>; }; } interface OpenAIAgentStream { [Symbol.asyncIterator](): AsyncIterator; } export interface WithAnycastOpenAIOptions { /** Agent token from the Anycast portal */ agentToken: string; /** Portal URL (default: https://agents.anycast.com) */ portalUrl?: string; /** Display name in portal */ agentName?: string; /** Log forwarded events to console */ debug?: boolean; /** Attach .memory API to the stream (default: false) */ enableMemory?: boolean; /** Auto-persist session state (default: false) */ persistSession?: boolean; } /** * Wrap an OpenAI Agents SDK stream with Anycast telemetry. * * @example * ```js * const { run } = require('@openai/agents') * const { withAnycastOpenAI } = require('@anycast/agent') * * const stream = withAnycastOpenAI( * await run(agent, prompt, { stream: true }), * { agentToken: process.env.ANYCAST_TOKEN } * ) * for await (const event of stream) { ... } * ``` */ export declare function withAnycastOpenAI(stream: T, options: WithAnycastOpenAIOptions): T & { memory: AnycastMemory; }; export {}; //# sourceMappingURL=with-anycast-openai.d.ts.map