/************************************************************************************************** * openai‑mcp.js – OpenAI SDK wrapper with dynamic MCP tool orchestration * (2025‑04‑20 – streamlined edition) **************************************************************************************************/ import OriginalOpenAI from "openai"; export type LogLevel = "debug" | "info" | "warn" | "error"; declare const LVL: { readonly debug: 0; readonly info: 1; readonly warn: 2; readonly error: 3; }; type LogLevelValue = (typeof LVL)[LogLevel]; export declare let currentLogLevel: LogLevelValue; export declare const setMcpLogLevel: (level: LogLevel) => void; export declare const log: (level: LogLevel | number, msg: string) => void; export interface MCPConfig { serverUrl?: string; serverUrls?: string[]; headers?: Record; maxToolCalls?: number; toolTimeoutSec?: number; disconnectAfterUse?: boolean; connectionTimeoutMs?: number; maxMessageGroups?: number; finalResponseSystemPrompt?: string; secondPassSystemPrompt?: string; modelName?: string; maxOutputTokens?: number; tokenRateLimit?: number; rateLimitWindowMs?: number; noWaitOnTpm?: boolean; logLevel?: LogLevel; } export interface Plugin { name: string; handle: (params: OriginalOpenAI.Chat.ChatCompletionCreateParams, next: (p: OriginalOpenAI.Chat.ChatCompletionCreateParams) => Promise) => Promise; } export interface OpenAIOptions { apiKey?: string; organization?: string; baseURL?: string; timeout?: number; maxRetries?: number; defaultQuery?: Record; defaultHeaders?: Record; dangerouslyAllowBrowser?: boolean; plugins?: string[] | Plugin[] | string | null; pluginConfig?: Record; mcp?: MCPConfig; mcpLogLevel?: LogLevel; } /** * OpenAI client with MCP support - drop-in replacement for OpenAI */ declare class OpenAI extends OriginalOpenAI { #private; constructor(options?: OpenAIOptions); } export default OpenAI; export { OpenAI };