import { AgentConfig, EvaluationReport, TestCase, TrajectoryStep } from '../../types/index.js'; import { AGUIEvent } from '../../types/agui.js'; import { callBedrockJudge } from './bedrockJudge.js'; import type { MatcherResult } from '../../lib/matchers/types.js'; export { callBedrockJudge }; import type { ConnectorRegistry, AgentConnector } from '../../services/connectors/index.js'; export declare function computeSdkMatcherSessionMetrics(matcherResults: MatcherResult[], opts?: { hasEvalError?: boolean; }): Record; /** * Options for running evaluation with connector */ export interface RunEvaluationWithConnectorOptions { /** The connector registry to use (required for CLI/server execution) */ registry: ConnectorRegistry; /** Callback for raw events from the connector */ onRawEvent?: (event: any) => void; /** Optional evaluator ID for custom evaluation criteria */ evaluatorId?: string; /** * Optional judge model id, distinct from the agent's `modelId` argument. * When set, this is the judge LLM (the model the LLM judge uses to grade * the trajectory). When unset the judge falls back to the evaluator's * `inferenceConfig.modelId` (resolved server-side in `/api/judge`), * then the server-default `BEDROCK_MODEL_ID` env var โ€” NEVER to the * agent's `modelId`. Customer input via UI dropdown / CLI * `--judge-model` / API `judgeModelId` field. * * Pre-fix the agent's `modelId` was reused as the judge model id, which * meant picking a judge-only pseudo-model like `pi-judge` from the UI * dropdown ALSO got passed to the agent and broke the agent's Bedrock * call (Bedrock doesn't know what `pi-judge` is). Now the two are * fully decoupled. */ judgeModelId?: string; /** When true, skip the LLM judge (caller will handle evaluation) */ skipJudge?: boolean; } /** * Run evaluation using connector pattern (for CLI/direct execution) * This bypasses the browser proxy and calls agents directly * * @param agent - Agent configuration * @param modelId - Model ID to use * @param testCase - Test case to evaluate * @param onStep - Callback for trajectory steps * @param options - Options including the connector registry */ /** * Result of a single agent invocation โ€” the pure, report-agnostic output of * driving a connector once. This is the primitive behind both the legacy * {@link runEvaluationWithConnector} (which then runs the judge + builds a * report) and the RFC-004 `agent.run()` fixture (which hands it to the test * body as a `RunResult`). It performs NO judging and builds NO report. */ export interface InvokeAgentResult { /** Final trajectory after the afterResponse hook (if any). */ trajectory: TrajectoryStep[]; /** Agent-supplied run id for log/trace correlation, or null. */ runId: string | null; /** Protocol-specific raw events for debugging. */ rawEvents: any[]; /** Wall-clock duration of the connector.execute() call in ms. */ agentDurationMs: number; /** Connector-supplied metadata (e.g. Claude Code `sessionId`, exitCode). */ metadata?: Record; /** The connector that handled the request (for protocol metadata). */ connector: AgentConnector; } export interface InvokeAgentOptions { /** Connector registry (required for CLI/server execution). */ registry: ConnectorRegistry; /** Streaming step callback. */ onStep?: (step: TrajectoryStep) => void; /** Raw event callback (debugging). */ onRawEvent?: (event: any) => void; /** * Per-invocation environment variables forwarded to the connector. Merged * into `connectorConfig.env` so subprocess connectors inherit them on the * spawned child (the lowest common denominator every subprocess connector * already honours). Sourced from the SDK's `AgentRunOptions.env`. */ env?: Record; } /** * Drive a single agent invocation through its connector and return the raw * trajectory/runId/rawEvents โ€” no judge, no report synthesis. * * Owns the connector resolution, request building, auth, the * `beforeRequest`/`afterResponse` hooks, and execution timing. Extracted from * {@link runEvaluationWithConnector} so the RFC-004 engine can offer an * `agent.run()` fixture that captures exactly the same trajectory/trace * correlation the legacy path produces (see RFC 004 ยง4.1, #256). */ export declare function invokeAgent(agent: AgentConfig, modelId: string, testCase: TestCase, options: InvokeAgentOptions): Promise; export declare function runEvaluationWithConnector(agent: AgentConfig, modelId: string, testCase: TestCase, onStep: (step: TrajectoryStep) => void, options: RunEvaluationWithConnectorOptions): Promise; /** * Run evaluation with selected agent, model, and test case * Streams trajectory steps to UI in real-time via onStep callback * * @deprecated Use runServerEvaluation() from services/client/evaluationApi instead. * The server-side path (/api/evaluate) consolidates all evaluation logic through the * connector system, ensuring consistent behavior for hooks, storage, and all agent types. */ export declare function runEvaluation(agent: AgentConfig, modelId: string, testCase: TestCase, onStep: (step: TrajectoryStep) => void, onRawEvent?: (event: AGUIEvent) => void): Promise; //# sourceMappingURL=index.d.ts.map