import { BasePlatformAdapter, MessageEvent, ProcessingOutcome, SendResult } from './platform-base.js'; import type { PlatformConfig } from './platform-base.js'; export interface ApiServerConfig extends PlatformConfig { host?: string; port?: number; apiKey?: string; corsOrigin?: string; maxRequestBytes?: number; model?: string; } export interface ChatCompletionMessage { role: 'system' | 'user' | 'assistant' | 'tool'; content: string | Array<{ type: string; text?: string; }> | null; name?: string; tool_call_id?: string; tool_calls?: Array<{ id: string; type: string; function: { name: string; arguments: string; }; }>; } export interface ChatCompletionRequest { model?: string; messages: ChatCompletionMessage[]; stream?: boolean; temperature?: number; max_tokens?: number; tools?: unknown[]; tool_choice?: unknown; } export interface ResponsesApiRequest { model?: string; input: string | Array<{ role: string; content: string; }>; previous_response_id?: string; stream?: boolean; } declare const DEFAULT_HOST = "127.0.0.1"; declare const DEFAULT_PORT = 8642; declare const MAX_REQUEST_BYTES = 1000000; declare const MAX_NORMALIZED_TEXT_LENGTH = 65536; export declare function normalizeChatContent(content: unknown, depth?: number): string; export declare class ApiServerChannel extends BasePlatformAdapter { private host; private port; private apiKey; private corsOrigin; private maxRequestBytes; private modelName; private storedResponses; private pendingRuns; private sessionMessages; constructor(config: ApiServerConfig); connect(): Promise; disconnect(): Promise; verifyApiKey(provided: string): boolean; getCorsHeaders(): Record; handleChatCompletions(req: ChatCompletionRequest, sessionId?: string): Promise>; handleResponsesCreate(req: ResponsesApiRequest): Promise>; getStoredResponse(responseId: string): Record | null; deleteStoredResponse(responseId: string): boolean; getModels(): Record; getHealth(): Record; getDetailedHealth(): Record; startRun(task: string, sessionId?: string): Promise; getRunEvents(runId: string): unknown[] | null; stopRun(runId: string): boolean; private errorResponse; send(_chatId: string, _content: string, _replyTo?: string, _metadata?: Record): Promise; editMessage(_chatId: string, messageId: string, _content: string, _finalize?: boolean): Promise; sendTyping(_chatId: string, _metadata?: Record): Promise; stopTyping(_chatId: string): Promise; sendImage(chatId: string, imageUrl: string, caption?: string, _replyTo?: string, _metadata?: Record): Promise; sendAnimation(chatId: string, animationUrl: string, caption?: string, replyTo?: string, metadata?: Record): Promise; getChatInfo(chatId: string): Promise>; get serverHost(): string; get serverPort(): number; onProcessingComplete(_event: MessageEvent, _outcome: ProcessingOutcome): void; } export { DEFAULT_HOST, DEFAULT_PORT, MAX_REQUEST_BYTES, MAX_NORMALIZED_TEXT_LENGTH }; //# sourceMappingURL=api-server.d.ts.map