/**
 * Typed query helpers over TraceStore.
 *
 * Not a full SQL engine — a minimal, composable set of operators that
 * cover the canned-pipeline use cases. For ad-hoc analytics, persist to
 * NDJSON and point DuckDB at it; the schema is stable so external SQL
 * tooling works out of the box.
 */
import type { FailureClass, JudgeSpan, LlmSpan, Run, ToolSpan } from './schema';
import type { TraceStore } from './store';
export declare function runsForScenario(store: TraceStore, scenarioId: string): Promise<Run[]>;
export declare function llmSpans(store: TraceStore, runId?: string): Promise<LlmSpan[]>;
export declare function toolSpans(store: TraceStore, runId?: string, toolName?: string): Promise<ToolSpan[]>;
export declare function judgeSpans(store: TraceStore, runId?: string): Promise<JudgeSpan[]>;
/** Group spans by any key selector. */
export declare function groupBy<T, K extends string | number>(items: T[], key: (t: T) => K): Map<K, T[]>;
/** Hash tool arguments to an orderless-key-stable string for de-duplication. */
export declare function argHash(args: unknown): string;
/** Sum an LLM-span array into aggregate token + cost. */
export declare function aggregateLlm(spans: LlmSpan[]): {
    inputTokens: number;
    outputTokens: number;
    cachedTokens: number;
    reasoningTokens: number;
    costUsd: number;
};
/** Pick the outcome's failure class when present, else derive 'success' from run status. */
export declare function runFailureClass(run: Run): FailureClass;
//# sourceMappingURL=query.d.ts.map