/** * Derive Strategy C correlation hints (`agents` array) for the agent (trace) * judge from a persisted run report. * * Background (#264): the agent (trace) judge's `query_spans` tool reads * `/api/traces` to find the spans it should reason over. Without these hints * the route only matches spans whose `gen_ai.request.id` equals * agent-health's runId (Strategy B) — i.e. agent-health's OWN eval-emitter * spans. Subprocess agents like claude-code emit instrumentation under their * own session ids, so they're invisible to Strategy B alone. * * Forwarding `agents: [{serviceName, startedAt, endedAt}]` lets `/api/traces` * union Strategy B with Strategy C (service.name + time-window). This is the * same correlation the run-detail Traces tab uses (see * components/RunDetailsContent.tsx), extracted here so the trace judge tool * and the UI converge on one read-side query. * * The full unification (one shared `buildSpanQuery(report)` for every * caller) is tracked in #264 — this helper is the minimum surgery to make * the agent (trace) judge functional in the meantime. */ import type { TestCaseRun, ConnectorProtocol } from '../../types/index.js'; export interface JudgeAgentsHint { serviceName: string; startedAt: number; endedAt: number; /** * Agent-emitted session id (Strategy D). When present, trace queries * correlate precisely on `attributes.session.id` (unioned with the * service.name + window fallback). Sourced from `report.sessionId`. */ sessionId?: string; } /** * Resolve the `service.name` an agent emits OTel spans under. Priority: * 1. Explicit `agentConfig.traceServiceName` (the per-agent override). * 2. Protocol-default from the table above. * 3. `-agent` heuristic (last-resort fallback). * 4. `-agent` as a final guess when protocol is unknown. * * Returns `undefined` when none of the above is derivable; the caller * should then skip Strategy C and fall back to Strategy B alone. */ export declare function resolveAgentServiceName(args: { agentTraceServiceName?: string; connectorProtocol?: ConnectorProtocol; agentKey?: string; }): string | undefined; /** * Build the `agents: [{...}]` array to forward as `JudgeRequest.agents`. * * `endedAt` defaults to the report's persisted timestamp; `startedAt` * defaults to that minus `performanceMetrics.durationMs` (with slack), or * a 30-minute lookback when duration is missing. The trace tool sends * these through to `/api/traces` which intersects them with * `service.name = serviceName`. * * Returns an empty array when we can't derive a meaningful service name — * the caller can still pass that and the route just falls back to * Strategy B (runIds-only) without breaking. */ export declare function buildJudgeAgentsHints(report: Pick, agentTraceServiceName?: string): JudgeAgentsHint[]; //# sourceMappingURL=judgeAgentsHints.d.ts.map