@memberjunction/testing-engine 0.0.1 → 2.119.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +403 -29
  2. package/dist/drivers/AgentEvalDriver.d.ts +197 -0
  3. package/dist/drivers/AgentEvalDriver.d.ts.map +1 -0
  4. package/dist/drivers/AgentEvalDriver.js +370 -0
  5. package/dist/drivers/AgentEvalDriver.js.map +1 -0
  6. package/dist/drivers/BaseTestDriver.d.ts +145 -0
  7. package/dist/drivers/BaseTestDriver.d.ts.map +1 -0
  8. package/dist/drivers/BaseTestDriver.js +266 -0
  9. package/dist/drivers/BaseTestDriver.js.map +1 -0
  10. package/dist/drivers/index.d.ts +6 -0
  11. package/dist/drivers/index.d.ts.map +1 -0
  12. package/dist/drivers/index.js +22 -0
  13. package/dist/drivers/index.js.map +1 -0
  14. package/dist/engine/TestEngine.d.ts +148 -0
  15. package/dist/engine/TestEngine.d.ts.map +1 -0
  16. package/dist/engine/TestEngine.js +490 -0
  17. package/dist/engine/TestEngine.js.map +1 -0
  18. package/dist/index.d.ts +20 -0
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +42 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/oracles/ExactMatchOracle.d.ts +98 -0
  23. package/dist/oracles/ExactMatchOracle.d.ts.map +1 -0
  24. package/dist/oracles/ExactMatchOracle.js +355 -0
  25. package/dist/oracles/ExactMatchOracle.js.map +1 -0
  26. package/dist/oracles/IOracle.d.ts +47 -0
  27. package/dist/oracles/IOracle.d.ts.map +1 -0
  28. package/dist/oracles/IOracle.js +7 -0
  29. package/dist/oracles/IOracle.js.map +1 -0
  30. package/dist/oracles/LLMJudgeOracle.d.ts +65 -0
  31. package/dist/oracles/LLMJudgeOracle.d.ts.map +1 -0
  32. package/dist/oracles/LLMJudgeOracle.js +214 -0
  33. package/dist/oracles/LLMJudgeOracle.js.map +1 -0
  34. package/dist/oracles/SQLValidatorOracle.d.ts +78 -0
  35. package/dist/oracles/SQLValidatorOracle.d.ts.map +1 -0
  36. package/dist/oracles/SQLValidatorOracle.js +215 -0
  37. package/dist/oracles/SQLValidatorOracle.js.map +1 -0
  38. package/dist/oracles/SchemaValidatorOracle.d.ts +61 -0
  39. package/dist/oracles/SchemaValidatorOracle.d.ts.map +1 -0
  40. package/dist/oracles/SchemaValidatorOracle.js +193 -0
  41. package/dist/oracles/SchemaValidatorOracle.js.map +1 -0
  42. package/dist/oracles/TraceValidatorOracle.d.ts +41 -0
  43. package/dist/oracles/TraceValidatorOracle.d.ts.map +1 -0
  44. package/dist/oracles/TraceValidatorOracle.js +159 -0
  45. package/dist/oracles/TraceValidatorOracle.js.map +1 -0
  46. package/dist/oracles/index.d.ts +10 -0
  47. package/dist/oracles/index.d.ts.map +1 -0
  48. package/dist/oracles/index.js +26 -0
  49. package/dist/oracles/index.js.map +1 -0
  50. package/dist/types.d.ts +428 -0
  51. package/dist/types.d.ts.map +1 -0
  52. package/dist/types.js +6 -0
  53. package/dist/types.js.map +1 -0
  54. package/dist/utils/cost-calculator.d.ts +92 -0
  55. package/dist/utils/cost-calculator.d.ts.map +1 -0
  56. package/dist/utils/cost-calculator.js +137 -0
  57. package/dist/utils/cost-calculator.js.map +1 -0
  58. package/dist/utils/result-formatter.d.ts +98 -0
  59. package/dist/utils/result-formatter.d.ts.map +1 -0
  60. package/dist/utils/result-formatter.js +252 -0
  61. package/dist/utils/result-formatter.js.map +1 -0
  62. package/dist/utils/scoring.d.ts +64 -0
  63. package/dist/utils/scoring.d.ts.map +1 -0
  64. package/dist/utils/scoring.js +140 -0
  65. package/dist/utils/scoring.js.map +1 -0
  66. package/package.json +36 -7
@@ -0,0 +1,98 @@
1
+ /**
2
+ * @fileoverview Result formatting utilities for test output
3
+ * @module @memberjunction/testing-engine
4
+ */
5
+ import { TestRunResult, TestSuiteRunResult, OracleResult } from '../types';
6
+ /**
7
+ * Format test run result as human-readable text.
8
+ *
9
+ * @param result - Test run result
10
+ * @returns Formatted text output
11
+ */
12
+ export declare function formatTestRunResult(result: TestRunResult): string;
13
+ /**
14
+ * Format test suite run result as human-readable text.
15
+ *
16
+ * @param result - Test suite run result
17
+ * @returns Formatted text output
18
+ */
19
+ export declare function formatSuiteRunResult(result: TestSuiteRunResult): string;
20
+ /**
21
+ * Format oracle result as human-readable text.
22
+ *
23
+ * @param result - Oracle result
24
+ * @param indent - Indentation prefix
25
+ * @returns Formatted text output
26
+ */
27
+ export declare function formatOracleResult(result: OracleResult, indent?: string): string;
28
+ /**
29
+ * Format test summary (for suite results).
30
+ *
31
+ * @param result - Test run result
32
+ * @param indent - Indentation prefix
33
+ * @returns Formatted text output
34
+ */
35
+ export declare function formatTestSummary(result: TestRunResult, indent?: string): string;
36
+ /**
37
+ * Format test run result as JSON.
38
+ *
39
+ * @param result - Test run result
40
+ * @param pretty - Whether to pretty-print (default: true)
41
+ * @returns JSON string
42
+ */
43
+ export declare function formatTestRunResultAsJSON(result: TestRunResult, pretty?: boolean): string;
44
+ /**
45
+ * Format test suite run result as JSON.
46
+ *
47
+ * @param result - Test suite run result
48
+ * @param pretty - Whether to pretty-print (default: true)
49
+ * @returns JSON string
50
+ */
51
+ export declare function formatSuiteRunResultAsJSON(result: TestSuiteRunResult, pretty?: boolean): string;
52
+ /**
53
+ * Format test run result as markdown.
54
+ *
55
+ * @param result - Test run result
56
+ * @returns Markdown output
57
+ */
58
+ export declare function formatTestRunResultAsMarkdown(result: TestRunResult): string;
59
+ /**
60
+ * Format test suite run result as markdown.
61
+ *
62
+ * @param result - Test suite run result
63
+ * @returns Markdown output
64
+ */
65
+ export declare function formatSuiteRunResultAsMarkdown(result: TestSuiteRunResult): string;
66
+ /**
67
+ * Format test run result as CSV.
68
+ *
69
+ * @param results - Array of test run results
70
+ * @param includeHeaders - Whether to include CSV headers (default: true)
71
+ * @returns CSV output
72
+ */
73
+ export declare function formatTestRunResultsAsCSV(results: TestRunResult[], includeHeaders?: boolean): string;
74
+ /**
75
+ * Format duration in milliseconds as human-readable string.
76
+ *
77
+ * @param ms - Duration in milliseconds
78
+ * @returns Formatted duration string
79
+ */
80
+ export declare function formatDuration(ms: number): string;
81
+ /**
82
+ * Generate summary statistics from multiple test results.
83
+ *
84
+ * @param results - Array of test run results
85
+ * @returns Summary statistics
86
+ */
87
+ export declare function generateSummaryStatistics(results: TestRunResult[]): {
88
+ totalTests: number;
89
+ passedTests: number;
90
+ failedTests: number;
91
+ passRate: number;
92
+ averageScore: number;
93
+ totalDuration: number;
94
+ totalCost: number;
95
+ avgDuration: number;
96
+ avgCost: number;
97
+ };
98
+ //# sourceMappingURL=result-formatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result-formatter.d.ts","sourceRoot":"","sources":["../../src/utils/result-formatter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAG3E;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAoBjE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAoBvE;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,GAAE,MAAW,GAAG,MAAM,CAYpF;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,GAAE,MAAW,GAAG,MAAM,CAGpF;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACrC,MAAM,EAAE,aAAa,EACrB,MAAM,GAAE,OAAc,GACvB,MAAM,CAER;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACtC,MAAM,EAAE,kBAAkB,EAC1B,MAAM,GAAE,OAAc,GACvB,MAAM,CAER;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAuB3E;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAwBjF;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACrC,OAAO,EAAE,aAAa,EAAE,EACxB,cAAc,GAAE,OAAc,GAC/B,MAAM,CAoBR;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAYjD;AAeD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG;IACjE,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACnB,CA0BA"}
@@ -0,0 +1,252 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Result formatting utilities for test output
4
+ * @module @memberjunction/testing-engine
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.generateSummaryStatistics = exports.formatDuration = exports.formatTestRunResultsAsCSV = exports.formatSuiteRunResultAsMarkdown = exports.formatTestRunResultAsMarkdown = exports.formatSuiteRunResultAsJSON = exports.formatTestRunResultAsJSON = exports.formatTestSummary = exports.formatOracleResult = exports.formatSuiteRunResult = exports.formatTestRunResult = void 0;
8
+ const cost_calculator_1 = require("./cost-calculator");
9
+ /**
10
+ * Format test run result as human-readable text.
11
+ *
12
+ * @param result - Test run result
13
+ * @returns Formatted text output
14
+ */
15
+ function formatTestRunResult(result) {
16
+ const lines = [];
17
+ lines.push('='.repeat(80));
18
+ lines.push(`Test: ${result.testName}`);
19
+ lines.push(`Status: ${result.status}`);
20
+ lines.push(`Score: ${(result.score * 100).toFixed(1)}%`);
21
+ lines.push(`Checks: ${result.passedChecks}/${result.totalChecks} passed`);
22
+ lines.push(`Duration: ${formatDuration(result.durationMs)}`);
23
+ lines.push(`Cost: ${(0, cost_calculator_1.formatCost)(result.totalCost)}`);
24
+ lines.push('='.repeat(80));
25
+ if (result.oracleResults.length > 0) {
26
+ lines.push('\nOracle Results:');
27
+ for (const oracle of result.oracleResults) {
28
+ lines.push(formatOracleResult(oracle, ' '));
29
+ }
30
+ }
31
+ return lines.join('\n');
32
+ }
33
+ exports.formatTestRunResult = formatTestRunResult;
34
+ /**
35
+ * Format test suite run result as human-readable text.
36
+ *
37
+ * @param result - Test suite run result
38
+ * @returns Formatted text output
39
+ */
40
+ function formatSuiteRunResult(result) {
41
+ const lines = [];
42
+ lines.push('='.repeat(80));
43
+ lines.push(`Test Suite: ${result.suiteName}`);
44
+ lines.push(`Status: ${result.status}`);
45
+ lines.push(`Tests: ${result.passedTests}/${result.totalTests} passed`);
46
+ lines.push(`Average Score: ${(result.averageScore * 100).toFixed(1)}%`);
47
+ lines.push(`Duration: ${formatDuration(result.durationMs)}`);
48
+ lines.push(`Cost: ${(0, cost_calculator_1.formatCost)(result.totalCost)}`);
49
+ lines.push('='.repeat(80));
50
+ if (result.testResults.length > 0) {
51
+ lines.push('\nTest Results:');
52
+ for (const test of result.testResults) {
53
+ lines.push(formatTestSummary(test, ' '));
54
+ }
55
+ }
56
+ return lines.join('\n');
57
+ }
58
+ exports.formatSuiteRunResult = formatSuiteRunResult;
59
+ /**
60
+ * Format oracle result as human-readable text.
61
+ *
62
+ * @param result - Oracle result
63
+ * @param indent - Indentation prefix
64
+ * @returns Formatted text output
65
+ */
66
+ function formatOracleResult(result, indent = '') {
67
+ const status = result.passed ? '✓' : '✗';
68
+ const lines = [];
69
+ lines.push(`${indent}${status} ${result.oracleType}: ${result.message}`);
70
+ lines.push(`${indent} Score: ${(result.score * 100).toFixed(1)}%`);
71
+ if (result.details) {
72
+ lines.push(`${indent} Details: ${JSON.stringify(result.details, null, 2)}`);
73
+ }
74
+ return lines.join('\n');
75
+ }
76
+ exports.formatOracleResult = formatOracleResult;
77
+ /**
78
+ * Format test summary (for suite results).
79
+ *
80
+ * @param result - Test run result
81
+ * @param indent - Indentation prefix
82
+ * @returns Formatted text output
83
+ */
84
+ function formatTestSummary(result, indent = '') {
85
+ const status = result.status === 'Passed' ? '✓' : '✗';
86
+ return `${indent}${status} ${result.testName}: ${(result.score * 100).toFixed(1)}% (${result.passedChecks}/${result.totalChecks})`;
87
+ }
88
+ exports.formatTestSummary = formatTestSummary;
89
+ /**
90
+ * Format test run result as JSON.
91
+ *
92
+ * @param result - Test run result
93
+ * @param pretty - Whether to pretty-print (default: true)
94
+ * @returns JSON string
95
+ */
96
+ function formatTestRunResultAsJSON(result, pretty = true) {
97
+ return JSON.stringify(result, null, pretty ? 2 : 0);
98
+ }
99
+ exports.formatTestRunResultAsJSON = formatTestRunResultAsJSON;
100
+ /**
101
+ * Format test suite run result as JSON.
102
+ *
103
+ * @param result - Test suite run result
104
+ * @param pretty - Whether to pretty-print (default: true)
105
+ * @returns JSON string
106
+ */
107
+ function formatSuiteRunResultAsJSON(result, pretty = true) {
108
+ return JSON.stringify(result, null, pretty ? 2 : 0);
109
+ }
110
+ exports.formatSuiteRunResultAsJSON = formatSuiteRunResultAsJSON;
111
+ /**
112
+ * Format test run result as markdown.
113
+ *
114
+ * @param result - Test run result
115
+ * @returns Markdown output
116
+ */
117
+ function formatTestRunResultAsMarkdown(result) {
118
+ const lines = [];
119
+ lines.push(`# Test: ${result.testName}\n`);
120
+ lines.push(`**Status:** ${result.status === 'Passed' ? '✅ Passed' : '❌ Failed'}`);
121
+ lines.push(`**Score:** ${(result.score * 100).toFixed(1)}%`);
122
+ lines.push(`**Checks:** ${result.passedChecks}/${result.totalChecks} passed`);
123
+ lines.push(`**Duration:** ${formatDuration(result.durationMs)}`);
124
+ lines.push(`**Cost:** ${(0, cost_calculator_1.formatCost)(result.totalCost)}\n`);
125
+ if (result.oracleResults.length > 0) {
126
+ lines.push('## Oracle Results\n');
127
+ lines.push('| Oracle | Status | Score | Message |');
128
+ lines.push('|--------|--------|-------|---------|');
129
+ for (const oracle of result.oracleResults) {
130
+ const status = oracle.passed ? '✅' : '❌';
131
+ const score = `${(oracle.score * 100).toFixed(1)}%`;
132
+ lines.push(`| ${oracle.oracleType} | ${status} | ${score} | ${oracle.message} |`);
133
+ }
134
+ }
135
+ return lines.join('\n');
136
+ }
137
+ exports.formatTestRunResultAsMarkdown = formatTestRunResultAsMarkdown;
138
+ /**
139
+ * Format test suite run result as markdown.
140
+ *
141
+ * @param result - Test suite run result
142
+ * @returns Markdown output
143
+ */
144
+ function formatSuiteRunResultAsMarkdown(result) {
145
+ const lines = [];
146
+ lines.push(`# Test Suite: ${result.suiteName}\n`);
147
+ lines.push(`**Status:** ${result.status === 'Completed' ? '✅ Completed' : `❌ ${result.status}`}`);
148
+ lines.push(`**Tests:** ${result.passedTests}/${result.totalTests} passed`);
149
+ lines.push(`**Average Score:** ${(result.averageScore * 100).toFixed(1)}%`);
150
+ lines.push(`**Duration:** ${formatDuration(result.durationMs)}`);
151
+ lines.push(`**Cost:** ${(0, cost_calculator_1.formatCost)(result.totalCost)}\n`);
152
+ if (result.testResults.length > 0) {
153
+ lines.push('## Test Results\n');
154
+ lines.push('| Test | Status | Score | Checks |');
155
+ lines.push('|------|--------|-------|--------|');
156
+ for (const test of result.testResults) {
157
+ const status = test.status === 'Passed' ? '✅' : '❌';
158
+ const score = `${(test.score * 100).toFixed(1)}%`;
159
+ const checks = `${test.passedChecks}/${test.totalChecks}`;
160
+ lines.push(`| ${test.testName} | ${status} | ${score} | ${checks} |`);
161
+ }
162
+ }
163
+ return lines.join('\n');
164
+ }
165
+ exports.formatSuiteRunResultAsMarkdown = formatSuiteRunResultAsMarkdown;
166
+ /**
167
+ * Format test run result as CSV.
168
+ *
169
+ * @param results - Array of test run results
170
+ * @param includeHeaders - Whether to include CSV headers (default: true)
171
+ * @returns CSV output
172
+ */
173
+ function formatTestRunResultsAsCSV(results, includeHeaders = true) {
174
+ const lines = [];
175
+ if (includeHeaders) {
176
+ lines.push('TestName,Status,Score,PassedChecks,TotalChecks,DurationMs,TotalCost');
177
+ }
178
+ for (const result of results) {
179
+ lines.push([
180
+ escapeCSV(result.testName),
181
+ result.status,
182
+ result.score.toFixed(4),
183
+ result.passedChecks,
184
+ result.totalChecks,
185
+ result.durationMs,
186
+ result.totalCost.toFixed(6)
187
+ ].join(','));
188
+ }
189
+ return lines.join('\n');
190
+ }
191
+ exports.formatTestRunResultsAsCSV = formatTestRunResultsAsCSV;
192
+ /**
193
+ * Format duration in milliseconds as human-readable string.
194
+ *
195
+ * @param ms - Duration in milliseconds
196
+ * @returns Formatted duration string
197
+ */
198
+ function formatDuration(ms) {
199
+ if (ms < 1000) {
200
+ return `${ms}ms`;
201
+ }
202
+ if (ms < 60000) {
203
+ return `${(ms / 1000).toFixed(2)}s`;
204
+ }
205
+ const minutes = Math.floor(ms / 60000);
206
+ const seconds = ((ms % 60000) / 1000).toFixed(0);
207
+ return `${minutes}m ${seconds}s`;
208
+ }
209
+ exports.formatDuration = formatDuration;
210
+ /**
211
+ * Escape CSV field value.
212
+ *
213
+ * @param value - Field value
214
+ * @returns Escaped value
215
+ */
216
+ function escapeCSV(value) {
217
+ if (value.includes(',') || value.includes('"') || value.includes('\n')) {
218
+ return `"${value.replace(/"/g, '""')}"`;
219
+ }
220
+ return value;
221
+ }
222
+ /**
223
+ * Generate summary statistics from multiple test results.
224
+ *
225
+ * @param results - Array of test run results
226
+ * @returns Summary statistics
227
+ */
228
+ function generateSummaryStatistics(results) {
229
+ const totalTests = results.length;
230
+ const passedTests = results.filter(r => r.status === 'Passed').length;
231
+ const failedTests = totalTests - passedTests;
232
+ const passRate = totalTests > 0 ? passedTests / totalTests : 0;
233
+ const totalScore = results.reduce((sum, r) => sum + r.score, 0);
234
+ const averageScore = totalTests > 0 ? totalScore / totalTests : 0;
235
+ const totalDuration = results.reduce((sum, r) => sum + r.durationMs, 0);
236
+ const totalCost = results.reduce((sum, r) => sum + r.totalCost, 0);
237
+ const avgDuration = totalTests > 0 ? totalDuration / totalTests : 0;
238
+ const avgCost = totalTests > 0 ? totalCost / totalTests : 0;
239
+ return {
240
+ totalTests,
241
+ passedTests,
242
+ failedTests,
243
+ passRate,
244
+ averageScore,
245
+ totalDuration,
246
+ totalCost,
247
+ avgDuration,
248
+ avgCost
249
+ };
250
+ }
251
+ exports.generateSummaryStatistics = generateSummaryStatistics;
252
+ //# sourceMappingURL=result-formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result-formatter.js","sourceRoot":"","sources":["../../src/utils/result-formatter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,uDAA+C;AAE/C;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,MAAqB;IACrD,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3B,KAAK,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;IACvC,KAAK,CAAC,IAAI,CAAC,WAAW,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IACvC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACzD,KAAK,CAAC,IAAI,CAAC,WAAW,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,WAAW,SAAS,CAAC,CAAC;IAC1E,KAAK,CAAC,IAAI,CAAC,aAAa,cAAc,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IAC7D,KAAK,CAAC,IAAI,CAAC,SAAS,IAAA,4BAAU,EAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAA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AAC;IAEnE,MAAM,WAAW,GAAG,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IACpE,MAAM,OAAO,GAAG,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IAE5D,OAAO;QACH,UAAU;QACV,WAAW;QACX,WAAW;QACX,QAAQ;QACR,YAAY;QACZ,aAAa;QACb,SAAS;QACT,WAAW;QACX,OAAO;KACV,CAAC;AACN,CAAC;AApCD,8DAoCC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * @fileoverview Scoring utilities for test evaluation
3
+ * @module @memberjunction/testing-engine
4
+ */
5
+ import { OracleResult, ScoringWeights } from '../types';
6
+ /**
7
+ * Calculate weighted score from oracle results.
8
+ *
9
+ * @param oracleResults - Results from oracle evaluations
10
+ * @param weights - Scoring weights by oracle type
11
+ * @returns Weighted score from 0.0 to 1.0
12
+ */
13
+ export declare function calculateWeightedScore(oracleResults: OracleResult[], weights?: ScoringWeights): number;
14
+ /**
15
+ * Calculate simple average score from oracle results.
16
+ *
17
+ * @param oracleResults - Results from oracle evaluations
18
+ * @returns Average score from 0.0 to 1.0
19
+ */
20
+ export declare function calculateAverageScore(oracleResults: OracleResult[]): number;
21
+ /**
22
+ * Calculate pass rate from oracle results.
23
+ *
24
+ * @param oracleResults - Results from oracle evaluations
25
+ * @returns Pass rate from 0.0 to 1.0
26
+ */
27
+ export declare function calculatePassRate(oracleResults: OracleResult[]): number;
28
+ /**
29
+ * Determine overall test status from oracle results.
30
+ *
31
+ * Test passes only if ALL oracles pass.
32
+ *
33
+ * @param oracleResults - Results from oracle evaluations
34
+ * @returns 'Passed' if all oracles passed, 'Failed' otherwise
35
+ */
36
+ export declare function determineTestStatus(oracleResults: OracleResult[]): 'Passed' | 'Failed';
37
+ /**
38
+ * Group oracle results by type.
39
+ *
40
+ * @param oracleResults - Results from oracle evaluations
41
+ * @returns Map of oracle type to results
42
+ */
43
+ export declare function groupResultsByType(oracleResults: OracleResult[]): Map<string, OracleResult[]>;
44
+ /**
45
+ * Calculate score distribution statistics.
46
+ *
47
+ * @param oracleResults - Results from oracle evaluations
48
+ * @returns Score statistics
49
+ */
50
+ export declare function calculateScoreStatistics(oracleResults: OracleResult[]): {
51
+ min: number;
52
+ max: number;
53
+ mean: number;
54
+ median: number;
55
+ stdDev: number;
56
+ };
57
+ /**
58
+ * Normalize scores to 0-1 range.
59
+ *
60
+ * @param oracleResults - Results from oracle evaluations
61
+ * @returns Normalized results
62
+ */
63
+ export declare function normalizeScores(oracleResults: OracleResult[]): OracleResult[];
64
+ //# sourceMappingURL=scoring.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scoring.d.ts","sourceRoot":"","sources":["../../src/utils/scoring.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAExD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAClC,aAAa,EAAE,YAAY,EAAE,EAC7B,OAAO,CAAC,EAAE,cAAc,GACzB,MAAM,CAsBR;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,YAAY,EAAE,GAAG,MAAM,CAO3E;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,YAAY,EAAE,GAAG,MAAM,CAOvE;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,YAAY,EAAE,GAAG,QAAQ,GAAG,QAAQ,CAMtF;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAC9B,aAAa,EAAE,YAAY,EAAE,GAC9B,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,CAU7B;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,YAAY,EAAE,GAAG;IACrE,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAClB,CAmBA;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,aAAa,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CAmB7E"}
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Scoring utilities for test evaluation
4
+ * @module @memberjunction/testing-engine
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.normalizeScores = exports.calculateScoreStatistics = exports.groupResultsByType = exports.determineTestStatus = exports.calculatePassRate = exports.calculateAverageScore = exports.calculateWeightedScore = void 0;
8
+ /**
9
+ * Calculate weighted score from oracle results.
10
+ *
11
+ * @param oracleResults - Results from oracle evaluations
12
+ * @param weights - Scoring weights by oracle type
13
+ * @returns Weighted score from 0.0 to 1.0
14
+ */
15
+ function calculateWeightedScore(oracleResults, weights) {
16
+ if (oracleResults.length === 0) {
17
+ return 0;
18
+ }
19
+ if (!weights) {
20
+ // Simple average if no weights provided
21
+ const sum = oracleResults.reduce((acc, r) => acc + r.score, 0);
22
+ return sum / oracleResults.length;
23
+ }
24
+ // Weighted average
25
+ let weightedSum = 0;
26
+ let totalWeight = 0;
27
+ for (const result of oracleResults) {
28
+ const weight = weights[result.oracleType] || 0;
29
+ weightedSum += result.score * weight;
30
+ totalWeight += weight;
31
+ }
32
+ return totalWeight > 0 ? weightedSum / totalWeight : 0;
33
+ }
34
+ exports.calculateWeightedScore = calculateWeightedScore;
35
+ /**
36
+ * Calculate simple average score from oracle results.
37
+ *
38
+ * @param oracleResults - Results from oracle evaluations
39
+ * @returns Average score from 0.0 to 1.0
40
+ */
41
+ function calculateAverageScore(oracleResults) {
42
+ if (oracleResults.length === 0) {
43
+ return 0;
44
+ }
45
+ const sum = oracleResults.reduce((acc, r) => acc + r.score, 0);
46
+ return sum / oracleResults.length;
47
+ }
48
+ exports.calculateAverageScore = calculateAverageScore;
49
+ /**
50
+ * Calculate pass rate from oracle results.
51
+ *
52
+ * @param oracleResults - Results from oracle evaluations
53
+ * @returns Pass rate from 0.0 to 1.0
54
+ */
55
+ function calculatePassRate(oracleResults) {
56
+ if (oracleResults.length === 0) {
57
+ return 0;
58
+ }
59
+ const passedCount = oracleResults.filter(r => r.passed).length;
60
+ return passedCount / oracleResults.length;
61
+ }
62
+ exports.calculatePassRate = calculatePassRate;
63
+ /**
64
+ * Determine overall test status from oracle results.
65
+ *
66
+ * Test passes only if ALL oracles pass.
67
+ *
68
+ * @param oracleResults - Results from oracle evaluations
69
+ * @returns 'Passed' if all oracles passed, 'Failed' otherwise
70
+ */
71
+ function determineTestStatus(oracleResults) {
72
+ if (oracleResults.length === 0) {
73
+ return 'Failed';
74
+ }
75
+ return oracleResults.every(r => r.passed) ? 'Passed' : 'Failed';
76
+ }
77
+ exports.determineTestStatus = determineTestStatus;
78
+ /**
79
+ * Group oracle results by type.
80
+ *
81
+ * @param oracleResults - Results from oracle evaluations
82
+ * @returns Map of oracle type to results
83
+ */
84
+ function groupResultsByType(oracleResults) {
85
+ const grouped = new Map();
86
+ for (const result of oracleResults) {
87
+ const existing = grouped.get(result.oracleType) || [];
88
+ existing.push(result);
89
+ grouped.set(result.oracleType, existing);
90
+ }
91
+ return grouped;
92
+ }
93
+ exports.groupResultsByType = groupResultsByType;
94
+ /**
95
+ * Calculate score distribution statistics.
96
+ *
97
+ * @param oracleResults - Results from oracle evaluations
98
+ * @returns Score statistics
99
+ */
100
+ function calculateScoreStatistics(oracleResults) {
101
+ if (oracleResults.length === 0) {
102
+ return { min: 0, max: 0, mean: 0, median: 0, stdDev: 0 };
103
+ }
104
+ const scores = oracleResults.map(r => r.score).sort((a, b) => a - b);
105
+ const min = scores[0];
106
+ const max = scores[scores.length - 1];
107
+ const mean = scores.reduce((sum, s) => sum + s, 0) / scores.length;
108
+ const median = scores.length % 2 === 0
109
+ ? (scores[scores.length / 2 - 1] + scores[scores.length / 2]) / 2
110
+ : scores[Math.floor(scores.length / 2)];
111
+ const variance = scores.reduce((sum, s) => sum + Math.pow(s - mean, 2), 0) / scores.length;
112
+ const stdDev = Math.sqrt(variance);
113
+ return { min, max, mean, median, stdDev };
114
+ }
115
+ exports.calculateScoreStatistics = calculateScoreStatistics;
116
+ /**
117
+ * Normalize scores to 0-1 range.
118
+ *
119
+ * @param oracleResults - Results from oracle evaluations
120
+ * @returns Normalized results
121
+ */
122
+ function normalizeScores(oracleResults) {
123
+ if (oracleResults.length === 0) {
124
+ return [];
125
+ }
126
+ const scores = oracleResults.map(r => r.score);
127
+ const min = Math.min(...scores);
128
+ const max = Math.max(...scores);
129
+ const range = max - min;
130
+ if (range === 0) {
131
+ // All scores are the same
132
+ return oracleResults.map(r => ({ ...r, score: 1.0 }));
133
+ }
134
+ return oracleResults.map(r => ({
135
+ ...r,
136
+ score: (r.score - min) / range
137
+ }));
138
+ }
139
+ exports.normalizeScores = normalizeScores;
140
+ //# sourceMappingURL=scoring.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scoring.js","sourceRoot":"","sources":["../../src/utils/scoring.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;;;;;GAMG;AACH,SAAgB,sBAAsB,CAClC,aAA6B,EAC7B,OAAwB;IAExB,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,CAAC,CAAC;IACb,CAAC;IAED,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,wCAAwC;QACxC,MAAM,GAAG,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC/D,OAAO,GAAG,GAAG,aAAa,CAAC,MAAM,CAAC;IACtC,CAAC;IAED,mBAAmB;IACnB,IAAI,WAAW,GAAG,CAAC,CAAC;I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C;IAExB,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;QACd,0BAA0B;QAC1B,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC3B,GAAG,CAAC;QACJ,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,KAAK;KACjC,CAAC,CAAC,CAAC;AACR,CAAC;AAnBD,0CAmBC"}
package/package.json CHANGED
@@ -1,10 +1,39 @@
1
1
  {
2
2
  "name": "@memberjunction/testing-engine",
3
- "version": "0.0.1",
4
- "description": "OIDC trusted publishing setup package for @memberjunction/testing-engine",
5
- "keywords": [
6
- "oidc",
7
- "trusted-publishing",
8
- "setup"
9
- ]
3
+ "version": "2.119.0",
4
+ "description": "MemberJunction Testing Framework Engine - Core test execution and evaluation engine supporting multiple test types",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "/dist"
9
+ ],
10
+ "scripts": {
11
+ "start": "ts-node-dev src/index.ts",
12
+ "build": "tsc",
13
+ "test": "echo \"Error: no test specified\" && exit 1"
14
+ },
15
+ "author": "MemberJunction.com",
16
+ "license": "ISC",
17
+ "devDependencies": {
18
+ "ts-node-dev": "^2.0.0",
19
+ "typescript": "^5.4.5",
20
+ "@types/debug": "^4.1.12"
21
+ },
22
+ "dependencies": {
23
+ "@memberjunction/testing-engine-base": "2.119.0",
24
+ "@memberjunction/global": "2.119.0",
25
+ "@memberjunction/core": "2.119.0",
26
+ "@memberjunction/core-entities": "2.119.0",
27
+ "@memberjunction/ai-agents": "2.119.0",
28
+ "@memberjunction/ai-core-plus": "2.119.0",
29
+ "@memberjunction/ai-prompts": "2.119.0",
30
+ "@memberjunction/aiengine": "2.119.0",
31
+ "rxjs": "^7.8.1",
32
+ "zod": "^3.23.8",
33
+ "debug": "^4.4.0"
34
+ },
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "https://github.com/MemberJunction/MJ"
38
+ }
10
39
  }