import type { Readable } from 'node:stream'; import type { PipelineExecutionInput } from '../../handlers/types.js'; import type { ProviderRuntimeProfile } from '../../../providers/core/api/provider-types.js'; export interface ServerConfigV2 { /** * The config file path used to bootstrap this server instance. * When present, daemon-admin restart should reload from the same file. */ configPath?: string; server: { port: number; host: string; apikey?: string; timeout?: number; bodyLimit?: string; /** * Whether quota management participates in virtual-router routing decisions. * When false, quota daemon signals won't remove providers from the pool. */ quotaRoutingEnabled?: boolean; }; logging: { level: 'debug' | 'info' | 'warn' | 'error'; enableConsole?: boolean; enableFile?: boolean; filePath?: string; }; providers: Record; v2Config?: { enableHooks?: boolean; hookStages?: string[]; }; } export interface ServerStatusV2 { initialized: boolean; running: boolean; port: number; host: string; uptime: number; memory: NodeJS.MemoryUsage; version: 'v2'; } export interface RequestContextV2 { requestId: string; timestamp: number; method: string; url: string; userAgent?: string; ip?: string; endpoint: string; } export type ProviderProtocol = 'openai-chat' | 'openai-responses' | 'anthropic-messages' | 'gemini-chat' | 'gemini-cli-chat'; export interface ProviderHandle { runtimeKey: string; providerId: string; providerType: string; providerFamily: string; providerProtocol: ProviderProtocol; runtime: ProviderRuntimeProfile; instance: { initialize(): Promise; cleanup(): Promise; processIncoming(payload: Record): Promise; }; } export interface VirtualRouterArtifacts { config: unknown; targetRuntime?: Record; } export interface HubPipelineExecutionResult { requestId?: string; providerPayload?: Record; standardizedRequest?: Record; processedRequest?: Record; target?: { providerKey: string; providerType: string; outboundProfile: string; runtimeKey?: string; processMode?: string; }; routingDecision?: { routeName?: string; }; metadata: Record; } export interface HubPipeline { execute(request: PipelineExecutionInput & { payload: Record | { readable?: Readable; } | Readable; }): Promise; updateVirtualRouterConfig(config: unknown): void; } export type HubPipelineCtor = new (config: { virtualRouter: unknown; [key: string]: unknown; }) => HubPipeline;