import type { TrajectoryStep } from '../../../types/index.js'; import type { AgentConnector, ConnectorAuth, ConnectorProtocol, ConnectorRequest, ConnectorResponse, ConnectorProgressCallback, ConnectorRawEventCallback, TraceContextStrategy } from '../../../services/connectors/types.js'; /** * Abstract base class for connectors * Provides common functionality like auth header building and error handling */ export declare abstract class BaseConnector implements AgentConnector { abstract readonly type: ConnectorProtocol; abstract readonly name: string; abstract readonly supportsStreaming: boolean; /** * Trace-context propagation strategy. Subclasses set defaults; users can * override per-agent via `connectorConfig.traceContext` (merged in execute()). */ traceContext?: TraceContextStrategy; /** * Build payload for the agent request * Subclasses must implement this to transform standard format to agent-specific format */ abstract buildPayload(request: ConnectorRequest): any; /** * Execute the request * Subclasses must implement the actual execution logic */ abstract execute(endpoint: string, request: ConnectorRequest, auth: ConnectorAuth, onProgress?: ConnectorProgressCallback, onRawEvent?: ConnectorRawEventCallback): Promise; /** * Parse raw response into TrajectoryStep array * Subclasses must implement protocol-specific parsing */ abstract parseResponse(rawResponse: any): TrajectoryStep[]; /** * Build HTTP headers from auth configuration * @param auth Authentication configuration * @returns Headers object ready for fetch/axios */ protected buildAuthHeaders(auth: ConnectorAuth): Record; /** * Build environment variables from auth configuration * Used by subprocess connectors */ protected buildAuthEnv(auth: ConnectorAuth): Record; /** * Generate a unique ID for trajectory steps */ protected generateId(): string; /** * Create a trajectory step with common fields */ protected createStep(type: TrajectoryStep['type'], content: string, extra?: Partial): TrajectoryStep; /** * Default health check implementation * Subclasses can override for protocol-specific checks */ healthCheck(endpoint: string, auth: ConnectorAuth): Promise; /** * Log debug message with connector type prefix */ protected debug(message: string, ...args: any[]): void; /** * Log error message with connector type prefix */ protected error(message: string, ...args: any[]): void; /** * Build a W3C `TRACEPARENT` env var string from the active OTel span, * if any. Returns an env-fragment object (empty if no active span or * propagation is disabled for this connector). * * Used by subprocess connectors to make the child's OTel SDK adopt the * eval `test_case` span as parent context (Strategy A). */ protected buildTraceparentEnv(): Record; /** * Inject W3C `traceparent` (and `tracestate`) headers into an outgoing * HTTP request, if a span is active and propagation is enabled. * * Used by REST/SSE connectors so the remote agent's OTel SDK adopts the * eval `test_case` span as parent context (Strategy A). */ protected injectTraceparentHeaders(headers: Record): void; } //# sourceMappingURL=BaseConnector.d.ts.map