export interface StorageTestCase { id: string; name: string; description?: string; version: number; initialPrompt: string; tools?: unknown[]; messages?: unknown[]; context?: unknown[]; forwardedProps?: Record; expectedPPL?: string; expectedOutcomes?: string[]; expectedTrajectory?: unknown[]; labels?: string[]; category?: string; subcategory?: string; difficulty?: 'Easy' | 'Medium' | 'Hard'; tags?: string[]; author?: string; createdAt: string; updatedAt: string; lastRunAt?: string; /** Source provenance for SDK / code-imported test cases. Used by the * CollapsibleTestCaseDefinition UI to distinguish SDK tests (path is * the source of truth) from JSON tests (the row itself is the source * of truth). Already round-trips through OpenSearch — the storage * layer was just dropping it on read. */ sourceFile?: string; sourceHash?: string; } export interface StorageBenchmarkRunConfig { id: string; name: string; description?: string; agentKey: string; agentId?: string; modelId: string; headers?: Record; iterationCount?: number; createdAt: string; results?: Record; status?: string; error?: string; stats?: { passed: number; failed: number; pending: number; total: number; errored?: number; }; } export interface StorageBenchmark { id: string; name: string; description?: string; author?: string; createdAt: string; llmJudgePrompt?: string; testCaseIds: string[]; runs: StorageBenchmarkRunConfig[]; } /** @deprecated Use StorageBenchmarkRunConfig instead */ export type StorageExperimentRunConfig = StorageBenchmarkRunConfig; /** @deprecated Use StorageBenchmark instead */ export type StorageExperiment = StorageBenchmark; export interface StorageRunAnnotation { id: string; text: string; tags?: string[]; author?: string; createdAt: string; updatedAt: string; } export interface StorageRun { id: string; name?: string; description?: string; experimentId: string; experimentRunId: string; testCaseId: string; testCaseVersionId: string; agentId: string; modelId: string; iteration: number; author?: string; createdAt: string; status: 'running' | 'completed' | 'failed'; passFailStatus?: 'passed' | 'failed'; traceId?: string; tags?: string[]; actualOutcomes?: unknown[]; llmJudgeReasoning?: string; metrics?: { accuracy?: number; faithfulness?: number; latency_score?: number; trajectory_alignment_score?: number; }; annotations?: StorageRunAnnotation[]; trajectory?: unknown[]; rawEvents?: unknown[]; logs?: unknown[]; improvementStrategies?: { category: string; issue: string; recommendation: string; priority: 'high' | 'medium' | 'low'; }[]; connectorProtocol?: string; } export interface StorageAnalyticsRecord { analyticsId: string; runId: string; experimentId: string; experimentRunId: string; testCaseId: string; testCaseVersionId?: string; traceId?: string; experimentName?: string; testCaseName?: string; testCaseCategory?: string; testCaseDifficulty?: string; agentId: string; modelId: string; iteration: number; tags?: string[]; passFailStatus?: string; status?: string; createdAt: string; author?: string; [key: string]: unknown; } export declare const storageAdmin: { /** * Check storage health/connectivity */ health(): Promise<{ status: string; cluster?: unknown; error?: string; /** Active storage backend. 'file' means OpenSearch is unavailable / not configured; 'error' means configured-but-unreachable. */ backend?: "file" | "opensearch" | "error"; /** * Real OpenSearch connectivity, present when OpenSearch is configured but * the active backend fell back to file storage. Top-level `status` reflects * the active (possibly file) backend, NOT OpenSearch — use this to report * true OpenSearch connectivity. Shape mirrors testStorageConnection(). */ opensearch?: { status: string; message?: string; latencyMs?: number; clusterName?: string; clusterStatus?: string; }; }>; /** * Initialize all indexes with mappings */ initIndexes(): Promise<{ success: boolean; results: Record; }>; /** * Get storage statistics */ stats(): Promise<{ stats: Record; }>; }; export declare const testCaseStorage: { /** * Get all test cases (latest versions only) * @param options.fields - 'summary' for lightweight list-view payload * @param options.size - page size for pagination * @param options.after - cursor token for next page * @param options.includeSample - whether to include sample/demo data */ getAll(options?: { fields?: "summary"; size?: number; after?: string; includeSample?: boolean; }): Promise<{ testCases: StorageTestCase[]; total: number; after?: string | null; hasMore?: boolean; }>; /** * Get test cases by specific IDs (latest versions only) * Used for efficient filtered fetching (e.g., only test cases in a benchmark) */ getByIds(ids: string[]): Promise; /** * Get test case by ID (latest version) */ getById(id: string): Promise; /** * Get all versions of a test case */ getVersions(id: string): Promise; /** * Get specific version of a test case */ getVersion(id: string, version: number): Promise; /** * Create new test case (starts at version 1) */ create(testCase: Omit): Promise; /** * Update test case (creates new version) */ update(id: string, testCase: Partial): Promise; /** * Delete test case (all versions) */ delete(id: string): Promise<{ deleted: number; }>; /** * Bulk create test cases */ bulkCreate(testCases: Partial[]): Promise<{ created: number; errors: boolean; }>; }; export declare const benchmarkStorage: { /** * Get all benchmarks * @param options.includeSample - whether to include sample/demo data */ getAll(options?: { includeSample?: boolean; }): Promise; /** * Get benchmark by ID * @param options.fields - 'polling' for lightweight payload (excludes versions, testCaseSnapshots, headers) * @param options.runsSize - max number of runs to return * @param options.runsOffset - offset into runs array for pagination */ getById(id: string, options?: { fields?: "polling"; runsSize?: number; runsOffset?: number; }): Promise; /** * Create benchmark */ create(benchmark: Omit): Promise; /** * Update benchmark (for run management) */ update(id: string, benchmark: Partial): Promise; /** * Delete benchmark */ delete(id: string): Promise<{ deleted: boolean; }>; /** * Bulk create benchmarks */ bulkCreate(benchmarks: Partial[]): Promise<{ created: number; errors: boolean; }>; /** * Update benchmark metadata only (name, description) */ updateMetadata(id: string, updates: { name?: string; description?: string; }): Promise; /** * Get all versions of a benchmark */ getVersions(id: string): Promise<{ versions: any[]; total: number; }>; /** * Get specific version of a benchmark */ getVersion(id: string, version: number): Promise; }; /** @deprecated Use benchmarkStorage instead */ export declare const experimentStorage: { /** * Get all benchmarks * @param options.includeSample - whether to include sample/demo data */ getAll(options?: { includeSample?: boolean; }): Promise; /** * Get benchmark by ID * @param options.fields - 'polling' for lightweight payload (excludes versions, testCaseSnapshots, headers) * @param options.runsSize - max number of runs to return * @param options.runsOffset - offset into runs array for pagination */ getById(id: string, options?: { fields?: "polling"; runsSize?: number; runsOffset?: number; }): Promise; /** * Create benchmark */ create(benchmark: Omit): Promise; /** * Update benchmark (for run management) */ update(id: string, benchmark: Partial): Promise; /** * Delete benchmark */ delete(id: string): Promise<{ deleted: boolean; }>; /** * Bulk create benchmarks */ bulkCreate(benchmarks: Partial[]): Promise<{ created: number; errors: boolean; }>; /** * Update benchmark metadata only (name, description) */ updateMetadata(id: string, updates: { name?: string; description?: string; }): Promise; /** * Get all versions of a benchmark */ getVersions(id: string): Promise<{ versions: any[]; total: number; }>; /** * Get specific version of a benchmark */ getVersion(id: string, version: number): Promise; }; export declare const runStorage: { /** * Get all runs with pagination */ getAll(options?: { size?: number; from?: number; _source?: string[]; }): Promise<{ runs: StorageRun[]; total: number; size: number; from: number; }>; /** * Batch-get runs by ID in one request (server fans out in parallel). * Used by the comparison page to load every cell's report at once. */ getByIds(ids: string[]): Promise; /** * Get run by ID */ getById(id: string): Promise; /** * Create run */ create(run: Omit, options?: { analytics?: boolean; }): Promise; /** * Delete run */ delete(id: string): Promise<{ deleted: boolean; }>; /** * Partial update of a run * Used for updating trace-mode runs after traces become available */ partialUpdate(id: string, updates: Partial): Promise; /** * Get run counts grouped by test case ID (single aggregation query) */ getCountsByTestCase(): Promise>; /** * Get runs by test case ID */ getByTestCase(testCaseId: string, size?: number, from?: number): Promise<{ runs: StorageRun[]; total: number; }>; /** * Get runs by benchmark ID */ getByBenchmark(benchmarkId: string, size?: number): Promise; /** * Get runs by benchmark run config ID */ getByBenchmarkRun(benchmarkId: string, runId: string, size?: number): Promise; /** * Get all iterations for a test case in a benchmark */ getIterations(benchmarkId: string, testCaseId: string, benchmarkRunId?: string): Promise<{ runs: StorageRun[]; total: number; maxIteration: number; }>; /** @deprecated Use getByBenchmark instead */ getByExperiment(experimentId: string, size?: number): Promise; /** @deprecated Use getByBenchmarkRun instead */ getByExperimentRun(experimentId: string, runId: string, size?: number): Promise; /** * Search runs with filters */ search(filters: { experimentId?: string; testCaseId?: string; experimentRunId?: string; agentId?: string; modelId?: string; status?: string; passFailStatus?: string; tags?: string[]; dateRange?: { start: string; end: string; }; size?: number; from?: number; }): Promise<{ runs: StorageRun[]; total: number; }>; /** * Add annotation to run */ addAnnotation(runId: string, annotation: Omit): Promise; /** * Update annotation */ updateAnnotation(runId: string, annotationId: string, updates: Partial): Promise; /** * Delete annotation */ deleteAnnotation(runId: string, annotationId: string): Promise<{ deleted: boolean; }>; /** * Bulk create runs */ bulkCreate(runs: Partial[]): Promise<{ created: number; errors: boolean; }>; }; export declare const analyticsStorage: { /** * Query analytics records */ query(filters: { experimentId?: string; testCaseId?: string; agentId?: string; modelId?: string; passFailStatus?: string; size?: number; from?: number; }): Promise<{ records: StorageAnalyticsRecord[]; total: number; }>; /** * Get aggregated metrics */ aggregations(experimentId?: string, groupBy?: string): Promise<{ aggregations: Array<{ key: string; metrics: { avgAccuracy?: number; avgFaithfulness?: number; avgLatency?: number; avgTrajectory?: number; }; passCount: number; failCount: number; totalRuns: number; }>; groupBy: string; }>; /** * Complex search with custom filters and aggregations */ search(options: { filters?: Record; aggs?: Record; size?: number; from?: number; }): Promise<{ records: StorageAnalyticsRecord[]; total: number; aggregations: Record; }>; /** * Backfill analytics from existing runs */ backfill(): Promise<{ backfilled: number; errors: number; total: number; }>; }; export declare const opensearchStorage: { admin: { /** * Check storage health/connectivity */ health(): Promise<{ status: string; cluster?: unknown; error?: string; /** Active storage backend. 'file' means OpenSearch is unavailable / not configured; 'error' means configured-but-unreachable. */ backend?: "file" | "opensearch" | "error"; /** * Real OpenSearch connectivity, present when OpenSearch is configured but * the active backend fell back to file storage. Top-level `status` reflects * the active (possibly file) backend, NOT OpenSearch — use this to report * true OpenSearch connectivity. Shape mirrors testStorageConnection(). */ opensearch?: { status: string; message?: string; latencyMs?: number; clusterName?: string; clusterStatus?: string; }; }>; /** * Initialize all indexes with mappings */ initIndexes(): Promise<{ success: boolean; results: Record; }>; /** * Get storage statistics */ stats(): Promise<{ stats: Record; }>; }; testCases: { /** * Get all test cases (latest versions only) * @param options.fields - 'summary' for lightweight list-view payload * @param options.size - page size for pagination * @param options.after - cursor token for next page * @param options.includeSample - whether to include sample/demo data */ getAll(options?: { fields?: "summary"; size?: number; after?: string; includeSample?: boolean; }): Promise<{ testCases: StorageTestCase[]; total: number; after?: string | null; hasMore?: boolean; }>; /** * Get test cases by specific IDs (latest versions only) * Used for efficient filtered fetching (e.g., only test cases in a benchmark) */ getByIds(ids: string[]): Promise; /** * Get test case by ID (latest version) */ getById(id: string): Promise; /** * Get all versions of a test case */ getVersions(id: string): Promise; /** * Get specific version of a test case */ getVersion(id: string, version: number): Promise; /** * Create new test case (starts at version 1) */ create(testCase: Omit): Promise; /** * Update test case (creates new version) */ update(id: string, testCase: Partial): Promise; /** * Delete test case (all versions) */ delete(id: string): Promise<{ deleted: number; }>; /** * Bulk create test cases */ bulkCreate(testCases: Partial[]): Promise<{ created: number; errors: boolean; }>; }; benchmarks: { /** * Get all benchmarks * @param options.includeSample - whether to include sample/demo data */ getAll(options?: { includeSample?: boolean; }): Promise; /** * Get benchmark by ID * @param options.fields - 'polling' for lightweight payload (excludes versions, testCaseSnapshots, headers) * @param options.runsSize - max number of runs to return * @param options.runsOffset - offset into runs array for pagination */ getById(id: string, options?: { fields?: "polling"; runsSize?: number; runsOffset?: number; }): Promise; /** * Create benchmark */ create(benchmark: Omit): Promise; /** * Update benchmark (for run management) */ update(id: string, benchmark: Partial): Promise; /** * Delete benchmark */ delete(id: string): Promise<{ deleted: boolean; }>; /** * Bulk create benchmarks */ bulkCreate(benchmarks: Partial[]): Promise<{ created: number; errors: boolean; }>; /** * Update benchmark metadata only (name, description) */ updateMetadata(id: string, updates: { name?: string; description?: string; }): Promise; /** * Get all versions of a benchmark */ getVersions(id: string): Promise<{ versions: any[]; total: number; }>; /** * Get specific version of a benchmark */ getVersion(id: string, version: number): Promise; }; runs: { /** * Get all runs with pagination */ getAll(options?: { size?: number; from?: number; _source?: string[]; }): Promise<{ runs: StorageRun[]; total: number; size: number; from: number; }>; /** * Batch-get runs by ID in one request (server fans out in parallel). * Used by the comparison page to load every cell's report at once. */ getByIds(ids: string[]): Promise; /** * Get run by ID */ getById(id: string): Promise; /** * Create run */ create(run: Omit, options?: { analytics?: boolean; }): Promise; /** * Delete run */ delete(id: string): Promise<{ deleted: boolean; }>; /** * Partial update of a run * Used for updating trace-mode runs after traces become available */ partialUpdate(id: string, updates: Partial): Promise; /** * Get run counts grouped by test case ID (single aggregation query) */ getCountsByTestCase(): Promise>; /** * Get runs by test case ID */ getByTestCase(testCaseId: string, size?: number, from?: number): Promise<{ runs: StorageRun[]; total: number; }>; /** * Get runs by benchmark ID */ getByBenchmark(benchmarkId: string, size?: number): Promise; /** * Get runs by benchmark run config ID */ getByBenchmarkRun(benchmarkId: string, runId: string, size?: number): Promise; /** * Get all iterations for a test case in a benchmark */ getIterations(benchmarkId: string, testCaseId: string, benchmarkRunId?: string): Promise<{ runs: StorageRun[]; total: number; maxIteration: number; }>; /** @deprecated Use getByBenchmark instead */ getByExperiment(experimentId: string, size?: number): Promise; /** @deprecated Use getByBenchmarkRun instead */ getByExperimentRun(experimentId: string, runId: string, size?: number): Promise; /** * Search runs with filters */ search(filters: { experimentId?: string; testCaseId?: string; experimentRunId?: string; agentId?: string; modelId?: string; status?: string; passFailStatus?: string; tags?: string[]; dateRange?: { start: string; end: string; }; size?: number; from?: number; }): Promise<{ runs: StorageRun[]; total: number; }>; /** * Add annotation to run */ addAnnotation(runId: string, annotation: Omit): Promise; /** * Update annotation */ updateAnnotation(runId: string, annotationId: string, updates: Partial): Promise; /** * Delete annotation */ deleteAnnotation(runId: string, annotationId: string): Promise<{ deleted: boolean; }>; /** * Bulk create runs */ bulkCreate(runs: Partial[]): Promise<{ created: number; errors: boolean; }>; }; analytics: { /** * Query analytics records */ query(filters: { experimentId?: string; testCaseId?: string; agentId?: string; modelId?: string; passFailStatus?: string; size?: number; from?: number; }): Promise<{ records: StorageAnalyticsRecord[]; total: number; }>; /** * Get aggregated metrics */ aggregations(experimentId?: string, groupBy?: string): Promise<{ aggregations: Array<{ key: string; metrics: { avgAccuracy?: number; avgFaithfulness?: number; avgLatency?: number; avgTrajectory?: number; }; passCount: number; failCount: number; totalRuns: number; }>; groupBy: string; }>; /** * Complex search with custom filters and aggregations */ search(options: { filters?: Record; aggs?: Record; size?: number; from?: number; }): Promise<{ records: StorageAnalyticsRecord[]; total: number; aggregations: Record; }>; /** * Backfill analytics from existing runs */ backfill(): Promise<{ backfilled: number; errors: number; total: number; }>; }; /** @deprecated Use benchmarks instead */ experiments: { /** * Get all benchmarks * @param options.includeSample - whether to include sample/demo data */ getAll(options?: { includeSample?: boolean; }): Promise; /** * Get benchmark by ID * @param options.fields - 'polling' for lightweight payload (excludes versions, testCaseSnapshots, headers) * @param options.runsSize - max number of runs to return * @param options.runsOffset - offset into runs array for pagination */ getById(id: string, options?: { fields?: "polling"; runsSize?: number; runsOffset?: number; }): Promise; /** * Create benchmark */ create(benchmark: Omit): Promise; /** * Update benchmark (for run management) */ update(id: string, benchmark: Partial): Promise; /** * Delete benchmark */ delete(id: string): Promise<{ deleted: boolean; }>; /** * Bulk create benchmarks */ bulkCreate(benchmarks: Partial[]): Promise<{ created: number; errors: boolean; }>; /** * Update benchmark metadata only (name, description) */ updateMetadata(id: string, updates: { name?: string; description?: string; }): Promise; /** * Get all versions of a benchmark */ getVersions(id: string): Promise<{ versions: any[]; total: number; }>; /** * Get specific version of a benchmark */ getVersion(id: string, version: number): Promise; }; }; export default opensearchStorage; //# sourceMappingURL=opensearchClient.d.ts.map