@principles/core 1.128.0 → 1.129.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.
- package/dist/quality-scorecard/__tests__/quality-scorecard.test.d.ts +2 -0
- package/dist/quality-scorecard/__tests__/quality-scorecard.test.d.ts.map +1 -0
- package/dist/quality-scorecard/__tests__/quality-scorecard.test.js +271 -0
- package/dist/quality-scorecard/__tests__/quality-scorecard.test.js.map +1 -0
- package/dist/quality-scorecard/index.d.ts +11 -0
- package/dist/quality-scorecard/index.d.ts.map +1 -0
- package/dist/quality-scorecard/index.js +4 -0
- package/dist/quality-scorecard/index.js.map +1 -0
- package/dist/quality-scorecard/report-generator.d.ts +11 -0
- package/dist/quality-scorecard/report-generator.d.ts.map +1 -0
- package/dist/quality-scorecard/report-generator.js +204 -0
- package/dist/quality-scorecard/report-generator.js.map +1 -0
- package/dist/quality-scorecard/types.d.ts +106 -0
- package/dist/quality-scorecard/types.d.ts.map +1 -0
- package/dist/quality-scorecard/types.js +51 -0
- package/dist/quality-scorecard/types.js.map +1 -0
- package/dist/quality-scorecard/validation.d.ts +73 -0
- package/dist/quality-scorecard/validation.d.ts.map +1 -0
- package/dist/quality-scorecard/validation.js +251 -0
- package/dist/quality-scorecard/validation.js.map +1 -0
- package/package.json +5 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quality-scorecard.test.d.ts","sourceRoot":"","sources":["../../../src/quality-scorecard/__tests__/quality-scorecard.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PRI-361 Quality Scorecard — Tests
|
|
3
|
+
*
|
|
4
|
+
* Tests pure logic from @principles/core only.
|
|
5
|
+
* I/O layer tests belong in pd-cli.
|
|
6
|
+
*/
|
|
7
|
+
import { describe, it, expect } from 'vitest';
|
|
8
|
+
import { RUBRIC_DIMENSIONS, RUBRIC_LABELS, meetsMvpThreshold, escapeHtml, escapeMarkdownTable, validateLlmScoreResponse, validateAdjudicationResponse, validatePainRow, validateGateRow, validateCliOptions, needsAdjudication, determineFinalLabel, sanitize, } from '../index.js';
|
|
9
|
+
// ── Rubric Tests ───────────────────────────────────────────────────
|
|
10
|
+
describe('Rubric definitions', () => {
|
|
11
|
+
it('has exactly 7 dimensions (G1-G7)', () => {
|
|
12
|
+
expect(RUBRIC_DIMENSIONS).toHaveLength(7);
|
|
13
|
+
expect(RUBRIC_DIMENSIONS).toEqual(['G1', 'G2', 'G3', 'G4', 'G5', 'G6', 'G7']);
|
|
14
|
+
});
|
|
15
|
+
it('every dimension has a label', () => {
|
|
16
|
+
for (const dim of RUBRIC_DIMENSIONS) {
|
|
17
|
+
expect(RUBRIC_LABELS[dim]).toBeTruthy();
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
describe('meetsMvpThreshold', () => {
|
|
22
|
+
const perfectScores = {
|
|
23
|
+
G1: 2, G2: 2, G3: 2, G4: 2, G5: 2, G6: 2, G7: 2,
|
|
24
|
+
};
|
|
25
|
+
it('passes with perfect scores', () => {
|
|
26
|
+
expect(meetsMvpThreshold(perfectScores)).toBe(true);
|
|
27
|
+
});
|
|
28
|
+
it('fails when G1 < 2', () => {
|
|
29
|
+
const scores = { ...perfectScores, G1: 1 };
|
|
30
|
+
expect(meetsMvpThreshold(scores)).toBe(false);
|
|
31
|
+
});
|
|
32
|
+
it('fails when G2 < 2', () => {
|
|
33
|
+
const scores = { ...perfectScores, G2: 1 };
|
|
34
|
+
expect(meetsMvpThreshold(scores)).toBe(false);
|
|
35
|
+
});
|
|
36
|
+
it('fails when G5 < 2', () => {
|
|
37
|
+
const scores = { ...perfectScores, G5: 1 };
|
|
38
|
+
expect(meetsMvpThreshold(scores)).toBe(false);
|
|
39
|
+
});
|
|
40
|
+
it('fails when G3 = 0 (must be >= 1)', () => {
|
|
41
|
+
const scores = { ...perfectScores, G3: 0 };
|
|
42
|
+
expect(meetsMvpThreshold(scores)).toBe(false);
|
|
43
|
+
});
|
|
44
|
+
it('fails when total < 10', () => {
|
|
45
|
+
const scores = {
|
|
46
|
+
G1: 2, G2: 2, G3: 1,
|
|
47
|
+
G4: 0, G5: 2, G6: 0, G7: 0,
|
|
48
|
+
};
|
|
49
|
+
expect(meetsMvpThreshold(scores)).toBe(false);
|
|
50
|
+
});
|
|
51
|
+
it('fails with all zeros', () => {
|
|
52
|
+
const zeros = Object.fromEntries(RUBRIC_DIMENSIONS.map(d => [d, 0]));
|
|
53
|
+
expect(meetsMvpThreshold(zeros)).toBe(false);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
// ── Escaping Tests ─────────────────────────────────────────────────
|
|
57
|
+
describe('escapeHtml', () => {
|
|
58
|
+
it('escapes < > & " \'', () => {
|
|
59
|
+
expect(escapeHtml('<script>alert("xss")</script>')).toBe('<script>alert("xss")</script>');
|
|
60
|
+
});
|
|
61
|
+
it('escapes ampersands', () => {
|
|
62
|
+
expect(escapeHtml('a & b')).toBe('a & b');
|
|
63
|
+
});
|
|
64
|
+
it('leaves safe text unchanged', () => {
|
|
65
|
+
expect(escapeHtml('hello world')).toBe('hello world');
|
|
66
|
+
});
|
|
67
|
+
it('handles injection in pain summary', () => {
|
|
68
|
+
const malicious = '<img src=x onerror=alert(1)>';
|
|
69
|
+
const escaped = escapeHtml(malicious);
|
|
70
|
+
expect(escaped).not.toContain('<');
|
|
71
|
+
expect(escaped).not.toContain('>');
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
describe('escapeMarkdownTable', () => {
|
|
75
|
+
it('escapes pipe characters', () => {
|
|
76
|
+
expect(escapeMarkdownTable('a | b | c')).toBe('a \\| b \\| c');
|
|
77
|
+
});
|
|
78
|
+
it('replaces newlines with spaces', () => {
|
|
79
|
+
expect(escapeMarkdownTable('line1\nline2\rline3')).toBe('line1 line2line3');
|
|
80
|
+
});
|
|
81
|
+
it('leaves safe text unchanged', () => {
|
|
82
|
+
expect(escapeMarkdownTable('hello world')).toBe('hello world');
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
// ── Validation Tests ───────────────────────────────────────────────
|
|
86
|
+
describe('validateLlmScoreResponse', () => {
|
|
87
|
+
it('returns zeros for null input', () => {
|
|
88
|
+
const result = validateLlmScoreResponse(null);
|
|
89
|
+
expect(result.scores.G1).toBe(0);
|
|
90
|
+
expect(result.flags).toContain('invalid_llm_response');
|
|
91
|
+
});
|
|
92
|
+
it('parses valid response', () => {
|
|
93
|
+
const result = validateLlmScoreResponse({
|
|
94
|
+
scores: { G1: 2, G2: 1, G3: 0, G4: 2, G5: 2, G6: 1, G7: 0 },
|
|
95
|
+
rationales: { G1: 'Good evidence', G2: 'Partial' },
|
|
96
|
+
flags: ['over_abstraction'],
|
|
97
|
+
});
|
|
98
|
+
expect(result.scores.G1).toBe(2);
|
|
99
|
+
expect(result.scores.G2).toBe(1);
|
|
100
|
+
expect(result.flags).toEqual(['over_abstraction']);
|
|
101
|
+
expect(result.rationales.G2).toBe('Partial');
|
|
102
|
+
});
|
|
103
|
+
it('clamps invalid scores to 0', () => {
|
|
104
|
+
const result = validateLlmScoreResponse({
|
|
105
|
+
scores: { G1: 5, G2: -1, G3: 'bad' },
|
|
106
|
+
rationales: {},
|
|
107
|
+
flags: 'not-array',
|
|
108
|
+
});
|
|
109
|
+
expect(result.scores.G1).toBe(0);
|
|
110
|
+
expect(result.scores.G2).toBe(0);
|
|
111
|
+
expect(result.scores.G3).toBe(0);
|
|
112
|
+
expect(result.flags).toEqual([]);
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
describe('validateAdjudicationResponse', () => {
|
|
116
|
+
it('returns needs-review for null input', () => {
|
|
117
|
+
const result = validateAdjudicationResponse(null);
|
|
118
|
+
expect(result.verdict).toBe('needs-review');
|
|
119
|
+
});
|
|
120
|
+
it('parses valid response', () => {
|
|
121
|
+
const result = validateAdjudicationResponse({
|
|
122
|
+
scores: { G1: 2, G2: 2, G3: 2, G4: 2, G5: 2, G6: 2, G7: 2 },
|
|
123
|
+
rationale: 'All good',
|
|
124
|
+
verdict: 'pass',
|
|
125
|
+
});
|
|
126
|
+
expect(result.verdict).toBe('pass');
|
|
127
|
+
expect(result.rationale).toBe('All good');
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
describe('validatePainRow', () => {
|
|
131
|
+
it('returns null for null input', () => {
|
|
132
|
+
expect(validatePainRow(null)).toBeNull();
|
|
133
|
+
});
|
|
134
|
+
it('returns null for missing required fields', () => {
|
|
135
|
+
expect(validatePainRow({})).toBeNull();
|
|
136
|
+
});
|
|
137
|
+
it('parses valid row', () => {
|
|
138
|
+
const row = validatePainRow({ id: 1, session_id: 's1', source: 'manual', score: 80, reason: 'test', severity: 'severe', created_at: '2026-01-01' });
|
|
139
|
+
expect(row).not.toBeNull();
|
|
140
|
+
if (row) {
|
|
141
|
+
expect(row.id).toBe(1);
|
|
142
|
+
expect(row.score).toBe(80);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
describe('validateCliOptions', () => {
|
|
147
|
+
it('rejects invalid format', () => {
|
|
148
|
+
const { errors } = validateCliOptions({ format: 'xml', minPainScore: 50, limit: 0, localModelBaseUrl: 'http://x', output: 'out.md', localModelId: 'm' });
|
|
149
|
+
expect(errors.some(e => e.field === 'format')).toBe(true);
|
|
150
|
+
});
|
|
151
|
+
it('rejects invalid minPainScore', () => {
|
|
152
|
+
const { errors } = validateCliOptions({ format: 'json', minPainScore: -1, limit: 0, localModelBaseUrl: 'http://x', output: 'out.md', localModelId: 'm' });
|
|
153
|
+
expect(errors.some(e => e.field === 'minPainScore')).toBe(true);
|
|
154
|
+
});
|
|
155
|
+
it('rejects invalid URL', () => {
|
|
156
|
+
const { errors } = validateCliOptions({ format: 'json', minPainScore: 50, limit: 0, localModelBaseUrl: 'ftp://x', output: 'out.md', localModelId: 'm' });
|
|
157
|
+
expect(errors.some(e => e.field === 'localModelBaseUrl')).toBe(true);
|
|
158
|
+
});
|
|
159
|
+
it('accepts valid options', () => {
|
|
160
|
+
const { options, errors } = validateCliOptions({
|
|
161
|
+
format: 'json', minPainScore: 50, limit: 10,
|
|
162
|
+
localModelBaseUrl: 'http://localhost:12341/v1', output: 'report.json', localModelId: 'gemma',
|
|
163
|
+
});
|
|
164
|
+
expect(errors).toHaveLength(0);
|
|
165
|
+
expect(options.format).toBe('json');
|
|
166
|
+
expect(options.limit).toBe(10);
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
// ── Gate Row Validation Tests ──────────────────────────────────────
|
|
170
|
+
describe('validateGateRow', () => {
|
|
171
|
+
it('returns null for null input', () => {
|
|
172
|
+
expect(validateGateRow(null)).toBeNull();
|
|
173
|
+
});
|
|
174
|
+
it('returns null for missing session_id', () => {
|
|
175
|
+
expect(validateGateRow({ cnt: 5 })).toBeNull();
|
|
176
|
+
});
|
|
177
|
+
it('parses valid row', () => {
|
|
178
|
+
const row = validateGateRow({ session_id: 'sess-1', cnt: 3 });
|
|
179
|
+
expect(row).not.toBeNull();
|
|
180
|
+
if (row) {
|
|
181
|
+
expect(row.session_id).toBe('sess-1');
|
|
182
|
+
expect(row.cnt).toBe(3);
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
it('defaults cnt to 0 for non-number', () => {
|
|
186
|
+
const row = validateGateRow({ session_id: 'sess-1', cnt: 'bad' });
|
|
187
|
+
expect(row).not.toBeNull();
|
|
188
|
+
if (row) {
|
|
189
|
+
expect(row.cnt).toBe(0);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
// ── Path Sanitization Tests ─────────────────────────────────────────
|
|
194
|
+
describe('sanitize — path redaction', () => {
|
|
195
|
+
it('redacts Windows paths', () => {
|
|
196
|
+
const result = sanitize('file at D:\\Code\\principles\\src\\index.ts');
|
|
197
|
+
expect(result).not.toContain('D:\\');
|
|
198
|
+
expect(result).toContain('<path>');
|
|
199
|
+
});
|
|
200
|
+
it('redacts POSIX /home/ paths', () => {
|
|
201
|
+
const result = sanitize('error in /home/user/project/src/index.ts');
|
|
202
|
+
expect(result).not.toContain('/home/');
|
|
203
|
+
expect(result).toContain('<path>');
|
|
204
|
+
});
|
|
205
|
+
it('redacts WSL /mnt/ paths', () => {
|
|
206
|
+
const result = sanitize('mounted at /mnt/c/Users/test/file.txt');
|
|
207
|
+
expect(result).not.toContain('/mnt/');
|
|
208
|
+
expect(result).toContain('<path>');
|
|
209
|
+
});
|
|
210
|
+
it('redacts /tmp/ paths', () => {
|
|
211
|
+
const result = sanitize('temp file /tmp/build-12345/output.log');
|
|
212
|
+
expect(result).not.toContain('/tmp/');
|
|
213
|
+
expect(result).toContain('<path>');
|
|
214
|
+
});
|
|
215
|
+
it('redacts JWT-like tokens', () => {
|
|
216
|
+
const result = sanitize('bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.abc');
|
|
217
|
+
expect(result).not.toContain('eyJ');
|
|
218
|
+
expect(result).toContain('<token-redacted>');
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
// ── Adjudication Decision Tests ────────────────────────────────────
|
|
222
|
+
function makeLocalEval(overrides = {}) {
|
|
223
|
+
return {
|
|
224
|
+
model: 'test-model',
|
|
225
|
+
dimensionScores: Object.fromEntries(RUBRIC_DIMENSIONS.map(d => [d, 2])),
|
|
226
|
+
dimensionRationales: Object.fromEntries(RUBRIC_DIMENSIONS.map(d => [d, ''])),
|
|
227
|
+
totalScore: overrides.totalScore ?? 14,
|
|
228
|
+
maxScore: 14,
|
|
229
|
+
mvpMet: overrides.mvpMet ?? true,
|
|
230
|
+
flags: overrides.flags ?? [],
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
function makeEpisode(overrides = {}) {
|
|
234
|
+
return {
|
|
235
|
+
episodeId: 'EP-1', summary: 'Test episode', source: 'manual', score: 80,
|
|
236
|
+
severity: 'severe', createdAt: '2026-06-12T00:00:00Z',
|
|
237
|
+
evolutionTaskResolution: null, linkedPrinciples: [], gateBlockCount: 0,
|
|
238
|
+
...overrides,
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
describe('needsAdjudication', () => {
|
|
242
|
+
it('returns critical when fabricated_evidence flag present', () => {
|
|
243
|
+
const decision = needsAdjudication(makeEpisode(), makeLocalEval({ flags: ['fabricated_evidence'] }));
|
|
244
|
+
expect(decision.shouldAdjudicate).toBe(true);
|
|
245
|
+
expect(decision.priority).toBe('critical');
|
|
246
|
+
});
|
|
247
|
+
it('returns high when MVP not met', () => {
|
|
248
|
+
const local = makeLocalEval({ mvpMet: false, totalScore: 5 });
|
|
249
|
+
local.dimensionScores = { G1: 0, G2: 2, G3: 0, G4: 0, G5: 0, G6: 1, G7: 0 };
|
|
250
|
+
const decision = needsAdjudication(makeEpisode(), local);
|
|
251
|
+
expect(decision.shouldAdjudicate).toBe(true);
|
|
252
|
+
expect(decision.priority).toBe('high');
|
|
253
|
+
});
|
|
254
|
+
it('returns low (no adjudication) when score >= 12 with MVP met', () => {
|
|
255
|
+
const decision = needsAdjudication(makeEpisode(), makeLocalEval({ totalScore: 13 }));
|
|
256
|
+
expect(decision.shouldAdjudicate).toBe(false);
|
|
257
|
+
expect(decision.priority).toBe('low');
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
describe('determineFinalLabel', () => {
|
|
261
|
+
it('returns local-pass when high score and no adjudication', () => {
|
|
262
|
+
const label = determineFinalLabel(makeLocalEval({ totalScore: 13 }), null);
|
|
263
|
+
expect(label).toBe('local-pass');
|
|
264
|
+
});
|
|
265
|
+
it('returns local-fail when very low score and no adjudication', () => {
|
|
266
|
+
const local = makeLocalEval({ totalScore: 3, mvpMet: false });
|
|
267
|
+
local.dimensionScores = { G1: 0, G2: 0, G3: 0, G4: 1, G5: 0, G6: 1, G7: 1 };
|
|
268
|
+
expect(determineFinalLabel(local, null)).toBe('local-fail');
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
//# sourceMappingURL=quality-scorecard.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quality-scorecard.test.js","sourceRoot":"","sources":["../../../src/quality-scorecard/__tests__/quality-scorecard.test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,mBAAmB,EACnB,wBAAwB,EACxB,4BAA4B,EAC5B,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,QAAQ,GAGT,MAAM,aAAa,CAAC;AAErB,sEAAsE;AAEtE,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;QAC1C,MAAM,CAAC,iBAAiB,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAC1C,MAAM,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACrC,KAAK,MAAM,GAAG,IAAI,iBAAiB,EAAE,CAAC;YACpC,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;QAC1C,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,MAAM,aAAa,GAAyC;QAC1D,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EA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AC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE;QAChE,MAAM,KAAK,GAAG,mBAAmB,CAAC,aAAa,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;QAC3E,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4DAA4D,EAAE,GAAG,EAAE;QACpE,MAAM,KAAK,GAAG,aAAa,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;QAC9D,KAAK,CAAC,eAAe,GAAG,EAAE,EAAE,EAAE,CAAgB,EAAE,EAAE,EAAE,CAAgB,EAAE,EAAE,EAAE,CAAgB,EAAE,EAAE,EAAE,CAAgB,EAAE,EAAE,EAAE,CAAgB,EAAE,EAAE,EAAE,CAAgB,EAAE,EAAE,EAAE,CAAgB,EAAE,CAAC;QACrL,MAAM,CAAC,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @principles/core/quality-scorecard — Pure logic barrel export
|
|
3
|
+
*
|
|
4
|
+
* ZERO I/O. Re-exports types, validation, and report generation.
|
|
5
|
+
*/
|
|
6
|
+
export type { RubricDimension, RubricScore, RubricEntry, PainEpisode, LocalEvaluation, AdjudicationStatus, StrongModelAdjudication, EpisodeEvaluation, QualityScorecardReport, ScorecardOptions, } from './types.js';
|
|
7
|
+
export { RUBRIC_DIMENSIONS, RUBRIC_LABELS, RUBRIC_DESCRIPTIONS, RUBRIC_PROMPTS, sumScores, meetsMvpThreshold, } from './types.js';
|
|
8
|
+
export { escapeHtml, escapeMarkdownTable, isValidRubricScore, parseRubricScore, validateDimensionScores, validateLlmScoreResponse, validateAdjudicationResponse, validatePainRow, validateEvolutionRow, validatePrincipleEventRow, validateGateRow, validateCliOptions, extractJsonFromLlmResponse, sanitize, truncate, needsAdjudication, determineFinalLabel, } from './validation.js';
|
|
9
|
+
export type { ValidatedLlmScores, ValidatedPainRow, ValidatedEvolutionRow, ValidatedPrincipleEventRow, ValidatedGateRow, ValidationError, AdjudicationDecision, } from './validation.js';
|
|
10
|
+
export { generateMarkdownReport, generateHtmlReport, generateJsonReport, } from './report-generator.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/quality-scorecard/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,YAAY,EACV,eAAe,EACf,WAAW,EACX,WAAW,EACX,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,SAAS,EACT,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,4BAA4B,EAC5B,eAAe,EACf,oBAAoB,EACpB,yBAAyB,EACzB,eAAe,EACf,kBAAkB,EAClB,0BAA0B,EAC1B,QAAQ,EACR,QAAQ,EACR,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,0BAA0B,EAC1B,gBAAgB,EAChB,eAAe,EACf,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { RUBRIC_DIMENSIONS, RUBRIC_LABELS, RUBRIC_DESCRIPTIONS, RUBRIC_PROMPTS, sumScores, meetsMvpThreshold, } from './types.js';
|
|
2
|
+
export { escapeHtml, escapeMarkdownTable, isValidRubricScore, parseRubricScore, validateDimensionScores, validateLlmScoreResponse, validateAdjudicationResponse, validatePainRow, validateEvolutionRow, validatePrincipleEventRow, validateGateRow, validateCliOptions, extractJsonFromLlmResponse, sanitize, truncate, needsAdjudication, determineFinalLabel, } from './validation.js';
|
|
3
|
+
export { generateMarkdownReport, generateHtmlReport, generateJsonReport, } from './report-generator.js';
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/quality-scorecard/index.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,SAAS,EACT,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,4BAA4B,EAC5B,eAAe,EACf,oBAAoB,EACpB,yBAAyB,EACzB,eAAe,EACf,kBAAkB,EAClB,0BAA0B,EAC1B,QAAQ,EACR,QAAQ,EACR,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AAYzB,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PRI-361 Quality Scorecard — Report Generator
|
|
3
|
+
*
|
|
4
|
+
* PURE LOGIC — generates report strings. ZERO I/O.
|
|
5
|
+
* All external strings are escaped before rendering.
|
|
6
|
+
*/
|
|
7
|
+
import type { QualityScorecardReport } from './types.js';
|
|
8
|
+
export declare function generateMarkdownReport(report: QualityScorecardReport): string;
|
|
9
|
+
export declare function generateHtmlReport(report: QualityScorecardReport): string;
|
|
10
|
+
export declare function generateJsonReport(report: QualityScorecardReport): string;
|
|
11
|
+
//# sourceMappingURL=report-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-generator.d.ts","sourceRoot":"","sources":["../../src/quality-scorecard/report-generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,sBAAsB,EAEvB,MAAM,YAAY,CAAC;AAoBpB,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,CAsF7E;AAID,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,CAiGzE;AAID,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,CAEzE"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PRI-361 Quality Scorecard — Report Generator
|
|
3
|
+
*
|
|
4
|
+
* PURE LOGIC — generates report strings. ZERO I/O.
|
|
5
|
+
* All external strings are escaped before rendering.
|
|
6
|
+
*/
|
|
7
|
+
import { RUBRIC_LABELS, RUBRIC_DIMENSIONS as DIMS } from './types.js';
|
|
8
|
+
import { escapeHtml, escapeMarkdownTable } from './validation.js';
|
|
9
|
+
// ── Markdown Report ────────────────────────────────────────────────
|
|
10
|
+
function mdTable(eval_) {
|
|
11
|
+
const local = eval_.localEvaluation;
|
|
12
|
+
const strong = eval_.strongModelAdjudication;
|
|
13
|
+
const header = '| Dimension | Label | Local | Strong | Local Rationale |';
|
|
14
|
+
const sep = '|-----------|-------|-------|--------|-----------------|';
|
|
15
|
+
const rows = DIMS.map(d => {
|
|
16
|
+
const localScore = `${local.dimensionScores[d]}/2`;
|
|
17
|
+
const strongScore = strong?.confirmedScores ? `${strong.confirmedScores[d]}/2` : '-';
|
|
18
|
+
const rationale = escapeMarkdownTable(local.dimensionRationales[d]).substring(0, 60);
|
|
19
|
+
return `| ${d} | ${RUBRIC_LABELS[d]} | ${localScore} | ${strongScore} | ${rationale} |`;
|
|
20
|
+
});
|
|
21
|
+
return [header, sep, ...rows].join('\n');
|
|
22
|
+
}
|
|
23
|
+
export function generateMarkdownReport(report) {
|
|
24
|
+
const lines = [];
|
|
25
|
+
lines.push('# PD Quality Scorecard Report');
|
|
26
|
+
lines.push('');
|
|
27
|
+
lines.push(`Generated: ${report.generatedAt}`);
|
|
28
|
+
lines.push('');
|
|
29
|
+
// Data source
|
|
30
|
+
const ds = report.dataSource;
|
|
31
|
+
lines.push('## Data Source');
|
|
32
|
+
lines.push('');
|
|
33
|
+
lines.push(`- Pain Events: ${ds.painEventCount}`);
|
|
34
|
+
lines.push(`- Evolution Tasks: ${ds.evolutionTaskCount}`);
|
|
35
|
+
lines.push(`- Principle Events: ${ds.principleEventCount}`);
|
|
36
|
+
lines.push(`- Gate Blocks: ${ds.gateBlockCount}`);
|
|
37
|
+
lines.push(`- Date Range: ${ds.dateRange.from} — ${ds.dateRange.to}`);
|
|
38
|
+
lines.push('');
|
|
39
|
+
// Config
|
|
40
|
+
lines.push('## Evaluation Config');
|
|
41
|
+
lines.push('');
|
|
42
|
+
lines.push(`- Local Model: ${report.localEvaluatorConfig.model} (${report.localEvaluatorConfig.baseUrl})`);
|
|
43
|
+
lines.push(`- API Key: ${report.localEvaluatorConfig.apiKeyStatus}`);
|
|
44
|
+
lines.push(`- Strong Model: ${report.strongModelConfig.model ?? 'not configured'} (${report.strongModelConfig.status})`);
|
|
45
|
+
lines.push('');
|
|
46
|
+
// Summary
|
|
47
|
+
lines.push('## Summary');
|
|
48
|
+
lines.push('');
|
|
49
|
+
const s = report.summary;
|
|
50
|
+
lines.push(`- Total Episodes: ${s.totalEpisodes}`);
|
|
51
|
+
lines.push(`- Local Pass: ${s.localPassCount}`);
|
|
52
|
+
lines.push(`- Local Fail: ${s.localFailCount}`);
|
|
53
|
+
lines.push(`- Strong Model Reviewed: ${s.strongModelReviewedCount}`);
|
|
54
|
+
lines.push(`- Final Pass: ${s.finalPassCount}`);
|
|
55
|
+
lines.push(`- Final Fail: ${s.finalFailCount}`);
|
|
56
|
+
lines.push(`- Needs Review: ${s.needsReviewCount}`);
|
|
57
|
+
lines.push(`- Local-only evaluated (no strong model): ${s.localOnlyCount}`);
|
|
58
|
+
lines.push(`- Average Local Score: ${s.averageLocalScore.toFixed(1)}/14`);
|
|
59
|
+
lines.push(`- MVP Threshold Met: ${s.mvpThresholdMetCount}/${s.totalEpisodes}`);
|
|
60
|
+
lines.push('');
|
|
61
|
+
// Episode details
|
|
62
|
+
lines.push('## Episode Evaluations');
|
|
63
|
+
lines.push('');
|
|
64
|
+
for (const ev of report.evaluations) {
|
|
65
|
+
const summary = escapeMarkdownTable(ev.episode.summary);
|
|
66
|
+
const flags = ev.localEvaluation.flags.map(escapeMarkdownTable).join(', ');
|
|
67
|
+
const adjRationale = ev.strongModelAdjudication
|
|
68
|
+
? escapeMarkdownTable(ev.strongModelAdjudication.rationale ?? '')
|
|
69
|
+
: '';
|
|
70
|
+
lines.push(`### ${ev.episode.episodeId} — ${ev.finalLabel.toUpperCase()}`);
|
|
71
|
+
lines.push('');
|
|
72
|
+
lines.push(`- Source: ${escapeMarkdownTable(ev.episode.source)}`);
|
|
73
|
+
lines.push(`- Pain Score: ${ev.episode.score}`);
|
|
74
|
+
lines.push(`- Severity: ${escapeMarkdownTable(ev.episode.severity)}`);
|
|
75
|
+
lines.push(`- Summary: ${summary}`);
|
|
76
|
+
lines.push(`- Local Score: ${ev.localEvaluation.totalScore}/14 (MVP: ${ev.localEvaluation.mvpMet ? 'met' : 'not met'})`);
|
|
77
|
+
if (ev.localEvaluation.flags.length > 0) {
|
|
78
|
+
lines.push(`- Flags: ${flags}`);
|
|
79
|
+
}
|
|
80
|
+
if (ev.strongModelAdjudication) {
|
|
81
|
+
const adj = ev.strongModelAdjudication;
|
|
82
|
+
lines.push(`- Adjudication: ${adj.adjudicationStatus} (model: ${escapeMarkdownTable(adj.model)})`);
|
|
83
|
+
if (adjRationale)
|
|
84
|
+
lines.push(`- Adjudication Rationale: ${adjRationale}`);
|
|
85
|
+
if (adj.confirmedMvpMet !== null)
|
|
86
|
+
lines.push(`- Confirmed MVP: ${adj.confirmedMvpMet ? 'met' : 'not met'}`);
|
|
87
|
+
if (adj.nextAction)
|
|
88
|
+
lines.push(`- Next Action: ${escapeMarkdownTable(adj.nextAction)}`);
|
|
89
|
+
}
|
|
90
|
+
lines.push('');
|
|
91
|
+
lines.push(mdTable(ev));
|
|
92
|
+
lines.push('');
|
|
93
|
+
lines.push('---');
|
|
94
|
+
lines.push('');
|
|
95
|
+
}
|
|
96
|
+
// Known limitations
|
|
97
|
+
lines.push('## Known Limitations');
|
|
98
|
+
lines.push('');
|
|
99
|
+
for (const lim of report.knownLimitations) {
|
|
100
|
+
lines.push(`- ${escapeMarkdownTable(lim)}`);
|
|
101
|
+
}
|
|
102
|
+
lines.push('');
|
|
103
|
+
return lines.join('\n');
|
|
104
|
+
}
|
|
105
|
+
// ── HTML Report ────────────────────────────────────────────────────
|
|
106
|
+
export function generateHtmlReport(report) {
|
|
107
|
+
const s = report.summary;
|
|
108
|
+
const localPassPct = s.totalEpisodes > 0 ? ((s.localPassCount / s.totalEpisodes) * 100).toFixed(0) : '0';
|
|
109
|
+
const episodeCards = report.evaluations.map(ev => {
|
|
110
|
+
const statusClass = ev.finalLabel === 'pass' ? 'pass' : ev.finalLabel === 'fail' ? 'fail' : 'review';
|
|
111
|
+
const local = ev.localEvaluation;
|
|
112
|
+
const adj = ev.strongModelAdjudication;
|
|
113
|
+
const scoreBar = DIMS.map(d => {
|
|
114
|
+
const pct = (local.dimensionScores[d] / 2) * 100;
|
|
115
|
+
const color = local.dimensionScores[d] === 2 ? '#22c55e' : local.dimensionScores[d] === 1 ? '#eab308' : '#ef4444';
|
|
116
|
+
return `<div class="dim-score"><span class="dim-label">${d}</span><div class="bar-bg"><div class="bar-fill" style="width:${pct}%;background:${color}"></div></div><span class="dim-val">${local.dimensionScores[d]}/2</span></div>`;
|
|
117
|
+
}).join('');
|
|
118
|
+
const safeSummary = escapeHtml(ev.episode.summary);
|
|
119
|
+
const safeSource = escapeHtml(ev.episode.source);
|
|
120
|
+
const safeFlags = local.flags.map(escapeHtml).join(', ');
|
|
121
|
+
const safeAdjRationale = adj ? escapeHtml(adj.rationale ?? '') : '';
|
|
122
|
+
const safeNextAction = adj?.nextAction ? escapeHtml(adj.nextAction) : '';
|
|
123
|
+
return `
|
|
124
|
+
<div class="card ${statusClass}">
|
|
125
|
+
<div class="card-header">
|
|
126
|
+
<span class="ep-id">${escapeHtml(ev.episode.episodeId)}</span>
|
|
127
|
+
<span class="badge ${statusClass}">${escapeHtml(ev.finalLabel.toUpperCase())}</span>
|
|
128
|
+
</div>
|
|
129
|
+
<div class="card-body">
|
|
130
|
+
<p><strong>Source:</strong> ${safeSource} | <strong>Score:</strong> ${ev.episode.score} | <strong>Local:</strong> ${local.totalScore}/14</p>
|
|
131
|
+
<p class="summary">${safeSummary}</p>
|
|
132
|
+
${local.flags.length > 0 ? `<p class="flags">⚠️ ${safeFlags}</p>` : ''}
|
|
133
|
+
${adj ? `<p class="adj"><strong>Adjudication:</strong> ${escapeHtml(adj.adjudicationStatus)} — ${safeAdjRationale.substring(0, 100)}</p>` : '<p class="adj"><strong>Adjudication:</strong> skipped (local-only assessment)</p>'}
|
|
134
|
+
${safeNextAction ? `<p class="adj"><strong>Next Action:</strong> ${safeNextAction}</p>` : ''}
|
|
135
|
+
<div class="score-bars">${scoreBar}</div>
|
|
136
|
+
</div>
|
|
137
|
+
</div>`;
|
|
138
|
+
}).join('\n');
|
|
139
|
+
return `<!DOCTYPE html>
|
|
140
|
+
<html lang="en">
|
|
141
|
+
<head>
|
|
142
|
+
<meta charset="UTF-8">
|
|
143
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
144
|
+
<title>PD Quality Scorecard</title>
|
|
145
|
+
<style>
|
|
146
|
+
body { font-family: system-ui, -apple-system, sans-serif; max-width: 900px; margin: 2rem auto; padding: 0 1rem; background: #0f172a; color: #e2e8f0; }
|
|
147
|
+
h1 { color: #f8fafc; }
|
|
148
|
+
h2 { color: #94a3b8; border-bottom: 1px solid #334155; padding-bottom: 0.5rem; }
|
|
149
|
+
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin: 1rem 0; }
|
|
150
|
+
.stat { background: #1e293b; padding: 1rem; border-radius: 8px; text-align: center; }
|
|
151
|
+
.stat-val { font-size: 2rem; font-weight: bold; color: #38bdf8; }
|
|
152
|
+
.stat-label { font-size: 0.8rem; color: #94a3b8; }
|
|
153
|
+
.card { background: #1e293b; border-radius: 8px; margin: 1rem 0; border-left: 4px solid #64748b; overflow: hidden; }
|
|
154
|
+
.card.pass { border-left-color: #22c55e; }
|
|
155
|
+
.card.fail { border-left-color: #ef4444; }
|
|
156
|
+
.card.review { border-left-color: #eab308; }
|
|
157
|
+
.card-header { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 1rem; background: #334155; }
|
|
158
|
+
.badge { padding: 0.2rem 0.6rem; border-radius: 4px; font-size: 0.75rem; font-weight: bold; }
|
|
159
|
+
.badge.pass { background: #22c55e33; color: #22c55e; }
|
|
160
|
+
.badge.fail { background: #ef444433; color: #ef4444; }
|
|
161
|
+
.badge.review { background: #eab30833; color: #eab308; }
|
|
162
|
+
.card-body { padding: 1rem; }
|
|
163
|
+
.summary { color: #cbd5e1; font-size: 0.9rem; }
|
|
164
|
+
.flags { color: #f97316; font-size: 0.85rem; }
|
|
165
|
+
.adj { color: #94a3b8; font-size: 0.85rem; }
|
|
166
|
+
.dim-score { display: flex; align-items: center; gap: 0.5rem; margin: 0.3rem 0; }
|
|
167
|
+
.dim-label { width: 2rem; font-size: 0.8rem; color: #94a3b8; }
|
|
168
|
+
.bar-bg { flex: 1; height: 8px; background: #334155; border-radius: 4px; }
|
|
169
|
+
.bar-fill { height: 100%; border-radius: 4px; transition: width 0.3s; }
|
|
170
|
+
.dim-val { width: 2.5rem; font-size: 0.8rem; color: #e2e8f0; }
|
|
171
|
+
.limitations { background: #1e293b; padding: 1rem; border-radius: 8px; }
|
|
172
|
+
.limitations li { color: #94a3b8; margin: 0.3rem 0; }
|
|
173
|
+
</style>
|
|
174
|
+
</head>
|
|
175
|
+
<body>
|
|
176
|
+
<h1>🧬 PD Quality Scorecard</h1>
|
|
177
|
+
<p>Generated: ${escapeHtml(report.generatedAt)}</p>
|
|
178
|
+
|
|
179
|
+
<h2>Summary</h2>
|
|
180
|
+
<div class="stats">
|
|
181
|
+
<div class="stat"><div class="stat-val">${s.totalEpisodes}</div><div class="stat-label">Episodes</div></div>
|
|
182
|
+
<div class="stat"><div class="stat-val">${localPassPct}%</div><div class="stat-label">Local Pass Rate</div></div>
|
|
183
|
+
<div class="stat"><div class="stat-val">${s.strongModelReviewedCount}</div><div class="stat-label">Strong Model Reviewed</div></div>
|
|
184
|
+
<div class="stat"><div class="stat-val">${s.averageLocalScore.toFixed(1)}</div><div class="stat-label">Avg Score /14</div></div>
|
|
185
|
+
<div class="stat"><div class="stat-val">${s.mvpThresholdMetCount}</div><div class="stat-label">MVP Met</div></div>
|
|
186
|
+
</div>
|
|
187
|
+
|
|
188
|
+
<p><strong>Config:</strong> Local: ${escapeHtml(report.localEvaluatorConfig.model)} | Strong: ${escapeHtml(report.strongModelConfig.model ?? 'skipped')}</p>
|
|
189
|
+
|
|
190
|
+
<h2>Episode Evaluations</h2>
|
|
191
|
+
${episodeCards}
|
|
192
|
+
|
|
193
|
+
<h2>Known Limitations</h2>
|
|
194
|
+
<ul class="limitations">
|
|
195
|
+
${report.knownLimitations.map(l => `<li>${escapeHtml(l)}</li>`).join('\n')}
|
|
196
|
+
</ul>
|
|
197
|
+
</body>
|
|
198
|
+
</html>`;
|
|
199
|
+
}
|
|
200
|
+
// ── JSON Report (pass-through) ─────────────────────────────────────
|
|
201
|
+
export function generateJsonReport(report) {
|
|
202
|
+
return JSON.stringify(report, null, 2);
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=report-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-generator.js","sourceRoot":"","sources":["../../src/quality-scorecard/report-generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EAAE,aAAa,EAAE,iBAAiB,IAAI,IAAI,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAElE,sEAAsE;AAEtE,SAAS,OAAO,CAAC,KAAwB;IACvC,MAAM,KAAK,GAAG,KAAK,CAAC,eAAe,CAAC;IACpC,MAAM,MAAM,GAAG,KAAK,CAAC,uBAAuB,CAAC;IAC7C,MAAM,MAAM,GAAG,0DAA0D,CAAC;IAC1E,MAAM,GAAG,GAAG,0DAA0D,CAAC;IACvE,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;QACxB,MAAM,UAAU,GAAG,GAAG,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC;QACnD,MAAM,WAAW,GAAG,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;QACrF,MAAM,SAAS,GAAG,mBAAmB,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACrF,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC,CAAC,CAAC,MAAM,UAAU,MAAM,WAAW,MAAM,SAAS,IAAI,CAAC;IAC1F,CAAC,CA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AG,CAAC,kBAAkB,CAAC,MAAM,gBAAgB,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,mFAAmF;YAC7N,cAAc,CAAC,CAAC,CAAC,gDAAgD,cAAc,MAAM,CAAC,CAAC,CAAC,EAAE;oCAClE,QAAQ;;aAE/B,CAAC;IACZ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAsCO,UAAU,CAAC,MAAM,CAAC,WAAW,CAAC;;;;4CAIF,CAAC,CAAC,aAAa;4CACf,YAAY;4CACZ,CAAC,CAAC,wBAAwB;4CAC1B,CAAC,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC;4CAC9B,CAAC,CAAC,oBAAoB;;;qCAG7B,UAAU,CAAC,MAAM,CAAC,oBAAoB,CAAC,KAAK,CAAC,cAAc,UAAU,CAAC,MAAM,CAAC,iBAAiB,CAAC,KAAK,IAAI,SAAS,CAAC;;;EAGrJ,YAAY;;;;EAIZ,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;;QAGlE,CAAC;AACT,CAAC;AAED,sEAAsE;AAEtE,MAAM,UAAU,kBAAkB,CAAC,MAA8B;IAC/D,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PRI-361 Quality Scorecard — Pure Type Definitions & Rubric
|
|
3
|
+
*
|
|
4
|
+
* This module is PURE LOGIC — zero I/O dependencies.
|
|
5
|
+
* No fs, path, fetch, database, process.env, or network access.
|
|
6
|
+
*/
|
|
7
|
+
export declare const RUBRIC_DIMENSIONS: readonly ["G1", "G2", "G3", "G4", "G5", "G6", "G7"];
|
|
8
|
+
export type RubricDimension = (typeof RUBRIC_DIMENSIONS)[number];
|
|
9
|
+
/** 0 = fail, 1 = partial, 2 = pass */
|
|
10
|
+
export type RubricScore = 0 | 1 | 2;
|
|
11
|
+
export interface RubricEntry {
|
|
12
|
+
dimension: RubricDimension;
|
|
13
|
+
score: RubricScore;
|
|
14
|
+
rationale: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const RUBRIC_LABELS: Record<RubricDimension, string>;
|
|
17
|
+
export declare const RUBRIC_DESCRIPTIONS: Record<RubricDimension, string>;
|
|
18
|
+
export declare const RUBRIC_PROMPTS: Record<RubricDimension, string>;
|
|
19
|
+
/** Sum rubric scores as plain numbers */
|
|
20
|
+
export declare function sumScores(scores: Record<RubricDimension, RubricScore>): number;
|
|
21
|
+
/** MVP quality gate: G1=2 AND G2=2 AND G5=2 AND G3>=1 AND total >= 10/14 */
|
|
22
|
+
export declare function meetsMvpThreshold(scores: Record<RubricDimension, RubricScore>): boolean;
|
|
23
|
+
export interface PainEpisode {
|
|
24
|
+
episodeId: string;
|
|
25
|
+
summary: string;
|
|
26
|
+
source: string;
|
|
27
|
+
score: number;
|
|
28
|
+
severity: string;
|
|
29
|
+
createdAt: string;
|
|
30
|
+
evolutionTaskResolution: string | null;
|
|
31
|
+
linkedPrinciples: string[];
|
|
32
|
+
gateBlockCount: number;
|
|
33
|
+
}
|
|
34
|
+
export interface LocalEvaluation {
|
|
35
|
+
model: string;
|
|
36
|
+
dimensionScores: Record<RubricDimension, RubricScore>;
|
|
37
|
+
dimensionRationales: Record<RubricDimension, string>;
|
|
38
|
+
totalScore: number;
|
|
39
|
+
maxScore: number;
|
|
40
|
+
mvpMet: boolean;
|
|
41
|
+
flags: string[];
|
|
42
|
+
}
|
|
43
|
+
export type AdjudicationStatus = 'pass' | 'fail' | 'needs-review' | 'local-pass' | 'local-fail' | 'skipped';
|
|
44
|
+
export interface StrongModelAdjudication {
|
|
45
|
+
model: string;
|
|
46
|
+
adjudicationStatus: AdjudicationStatus;
|
|
47
|
+
confirmedScores: Record<RubricDimension, RubricScore> | null;
|
|
48
|
+
confirmedMvpMet: boolean | null;
|
|
49
|
+
rationale: string;
|
|
50
|
+
nextAction: string | null;
|
|
51
|
+
}
|
|
52
|
+
export interface EpisodeEvaluation {
|
|
53
|
+
episode: PainEpisode;
|
|
54
|
+
localEvaluation: LocalEvaluation;
|
|
55
|
+
strongModelAdjudication: StrongModelAdjudication | null;
|
|
56
|
+
finalLabel: AdjudicationStatus;
|
|
57
|
+
}
|
|
58
|
+
export interface QualityScorecardReport {
|
|
59
|
+
generatedAt: string;
|
|
60
|
+
dataSource: {
|
|
61
|
+
painEventCount: number;
|
|
62
|
+
evolutionTaskCount: number;
|
|
63
|
+
principleEventCount: number;
|
|
64
|
+
gateBlockCount: number;
|
|
65
|
+
dateRange: {
|
|
66
|
+
from: string;
|
|
67
|
+
to: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
localEvaluatorConfig: {
|
|
71
|
+
model: string;
|
|
72
|
+
baseUrl: string;
|
|
73
|
+
apiKeyStatus: string;
|
|
74
|
+
};
|
|
75
|
+
strongModelConfig: {
|
|
76
|
+
model: string | null;
|
|
77
|
+
status: 'configured' | 'skipped';
|
|
78
|
+
};
|
|
79
|
+
evaluations: EpisodeEvaluation[];
|
|
80
|
+
summary: {
|
|
81
|
+
totalEpisodes: number;
|
|
82
|
+
localPassCount: number;
|
|
83
|
+
localFailCount: number;
|
|
84
|
+
strongModelReviewedCount: number;
|
|
85
|
+
finalPassCount: number;
|
|
86
|
+
finalFailCount: number;
|
|
87
|
+
needsReviewCount: number;
|
|
88
|
+
localOnlyCount: number;
|
|
89
|
+
averageLocalScore: number;
|
|
90
|
+
mvpThresholdMetCount: number;
|
|
91
|
+
};
|
|
92
|
+
knownLimitations: string[];
|
|
93
|
+
}
|
|
94
|
+
export interface ScorecardOptions {
|
|
95
|
+
dbPath: string;
|
|
96
|
+
logsDir: string;
|
|
97
|
+
localModelBaseUrl: string;
|
|
98
|
+
localModelId: string;
|
|
99
|
+
strongModelId: string | null;
|
|
100
|
+
limit: number;
|
|
101
|
+
format: 'json' | 'markdown' | 'html';
|
|
102
|
+
output: string;
|
|
103
|
+
minPainScore: number;
|
|
104
|
+
skipStrongModel: boolean;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/quality-scorecard/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,eAAO,MAAM,iBAAiB,qDAEpB,CAAC;AACX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE,sCAAsC;AACtC,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEpC,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,eAAe,CAAC;IAC3B,KAAK,EAAE,WAAW,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAQzD,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAQ/D,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAQ1D,CAAC;AAEF,yCAAyC;AACzC,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,WAAW,CAAC,GAAG,MAAM,CAE9E;AAED,4EAA4E;AAC5E,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,WAAW,CAAC,GAAG,OAAO,CASvF;AAID,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MA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 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PRI-361 Quality Scorecard — Pure Type Definitions & Rubric
|
|
3
|
+
*
|
|
4
|
+
* This module is PURE LOGIC — zero I/O dependencies.
|
|
5
|
+
* No fs, path, fetch, database, process.env, or network access.
|
|
6
|
+
*/
|
|
7
|
+
// ── Rubric Dimensions ──────────────────────────────────────────────
|
|
8
|
+
export const RUBRIC_DIMENSIONS = [
|
|
9
|
+
'G1', 'G2', 'G3', 'G4', 'G5', 'G6', 'G7',
|
|
10
|
+
];
|
|
11
|
+
export const RUBRIC_LABELS = {
|
|
12
|
+
G1: 'Evidence Grounding',
|
|
13
|
+
G2: 'Behavior-Oriented',
|
|
14
|
+
G3: 'Actionable Specificity',
|
|
15
|
+
G4: 'Root Cause Depth',
|
|
16
|
+
G5: 'Classification Correctness',
|
|
17
|
+
G6: 'Confidence Calibration',
|
|
18
|
+
G7: 'Scope Clarity',
|
|
19
|
+
};
|
|
20
|
+
export const RUBRIC_DESCRIPTIONS = {
|
|
21
|
+
G1: 'Diagnosis is grounded in concrete evidence (logs, error messages, code references) — not speculation or fabricated data.',
|
|
22
|
+
G2: 'Principle/diagnosis describes observable agent behavior, not internal model states or vague abstractions.',
|
|
23
|
+
G3: 'Root cause and recommended action are specific enough to act on without further clarification.',
|
|
24
|
+
G4: 'Root cause goes beyond surface symptoms — uses 5-Whys depth or equivalent causal analysis.',
|
|
25
|
+
G5: 'Pain classification (category, severity, confidence) matches the actual evidence.',
|
|
26
|
+
G6: 'Confidence score reflects actual certainty — not overconfident on weak evidence or underconfident on strong evidence.',
|
|
27
|
+
G7: 'Principle scope is clearly bounded — specifies when it applies and when it does not.',
|
|
28
|
+
};
|
|
29
|
+
export const RUBRIC_PROMPTS = {
|
|
30
|
+
G1: 'Does the diagnosis cite concrete evidence (error messages, file paths, code snippets, event IDs) rather than vague claims? Score 2 if specific evidence is quoted, 1 if partially grounded, 0 if purely speculative.',
|
|
31
|
+
G2: 'Is the principle/diagnosis written in terms of observable agent behavior (tool calls, file edits, decision patterns)? Score 2 if fully behavior-oriented, 1 if partially, 0 if only describes internal states.',
|
|
32
|
+
G3: 'Can someone act on the recommendation without asking clarifying questions? Score 2 if immediately actionable, 1 if needs minor clarification, 0 if vague or generic.',
|
|
33
|
+
G4: 'Does the root cause analysis go beyond "the code has a bug"? Score 2 if identifies systemic pattern (5-Whys depth >=3), 1 if identifies proximate cause, 0 if only restates symptom.',
|
|
34
|
+
G5: 'Does the pain classification match the evidence? Score 2 if category/severity/confidence align perfectly, 1 if mostly correct with minor mismatch, 0 if clearly miscategorized.',
|
|
35
|
+
G6: 'Is the confidence level calibrated to evidence strength? Score 2 if confidence matches evidence quality, 1 if slightly off, 0 if grossly over/under confident.',
|
|
36
|
+
G7: 'Is the principle scope explicitly bounded? Score 2 if clear applicability and exclusion criteria, 1 if scope is implicit, 0 if scope is unlimited or undefined.',
|
|
37
|
+
};
|
|
38
|
+
/** Sum rubric scores as plain numbers */
|
|
39
|
+
export function sumScores(scores) {
|
|
40
|
+
return Object.values(scores).reduce((s, v) => s + v, 0);
|
|
41
|
+
}
|
|
42
|
+
/** MVP quality gate: G1=2 AND G2=2 AND G5=2 AND G3>=1 AND total >= 10/14 */
|
|
43
|
+
export function meetsMvpThreshold(scores) {
|
|
44
|
+
const total = sumScores(scores);
|
|
45
|
+
return (scores.G1 === 2 &&
|
|
46
|
+
scores.G2 === 2 &&
|
|
47
|
+
scores.G5 === 2 &&
|
|
48
|
+
scores.G3 >= 1 &&
|
|
49
|
+
total >= 10);
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/quality-scorecard/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,sEAAsE;AAEtE,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAA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QACd,KAAK,IAAI,EAAE,CACZ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PRI-361 Quality Scorecard — Runtime Validation
|
|
3
|
+
*
|
|
4
|
+
* Pure validation functions for untrusted data from DB rows, LLM responses, CLI opts.
|
|
5
|
+
* ZERO I/O — no fs, fetch, database, process.env.
|
|
6
|
+
*/
|
|
7
|
+
import { type RubricDimension, type RubricScore, type PainEpisode, type LocalEvaluation, type AdjudicationStatus, type ScorecardOptions } from './types.js';
|
|
8
|
+
export declare function escapeHtml(text: string): string;
|
|
9
|
+
export declare function escapeMarkdownTable(text: string): string;
|
|
10
|
+
export declare function isValidRubricScore(value: unknown): value is RubricScore;
|
|
11
|
+
export declare function parseRubricScore(value: unknown): RubricScore;
|
|
12
|
+
export declare function validateDimensionScores(raw: Record<string, unknown>): Record<RubricDimension, RubricScore>;
|
|
13
|
+
export interface ValidatedLlmScores {
|
|
14
|
+
scores: Record<RubricDimension, RubricScore>;
|
|
15
|
+
rationales: Record<RubricDimension, string>;
|
|
16
|
+
flags: string[];
|
|
17
|
+
}
|
|
18
|
+
export declare function validateLlmScoreResponse(raw: unknown): ValidatedLlmScores;
|
|
19
|
+
export declare function validateAdjudicationResponse(raw: unknown): {
|
|
20
|
+
scores: Record<RubricDimension, RubricScore>;
|
|
21
|
+
rationale: string;
|
|
22
|
+
verdict: AdjudicationStatus;
|
|
23
|
+
};
|
|
24
|
+
export interface ValidatedPainRow {
|
|
25
|
+
id: number;
|
|
26
|
+
session_id: string;
|
|
27
|
+
source: string;
|
|
28
|
+
score: number;
|
|
29
|
+
reason: string;
|
|
30
|
+
severity: string;
|
|
31
|
+
created_at: string;
|
|
32
|
+
}
|
|
33
|
+
export declare function validatePainRow(raw: unknown): ValidatedPainRow | null;
|
|
34
|
+
export interface ValidatedEvolutionRow {
|
|
35
|
+
task_id: string;
|
|
36
|
+
score: number;
|
|
37
|
+
status: string;
|
|
38
|
+
resolution: string | null;
|
|
39
|
+
created_at: string;
|
|
40
|
+
}
|
|
41
|
+
export declare function validateEvolutionRow(raw: unknown): ValidatedEvolutionRow | null;
|
|
42
|
+
export interface ValidatedPrincipleEventRow {
|
|
43
|
+
principle_id: string | null;
|
|
44
|
+
event_type: string;
|
|
45
|
+
created_at: string;
|
|
46
|
+
}
|
|
47
|
+
export declare function validatePrincipleEventRow(raw: unknown): ValidatedPrincipleEventRow | null;
|
|
48
|
+
export interface ValidatedGateRow {
|
|
49
|
+
session_id: string;
|
|
50
|
+
cnt: number;
|
|
51
|
+
}
|
|
52
|
+
export declare function validateGateRow(raw: unknown): ValidatedGateRow | null;
|
|
53
|
+
export interface ValidationError {
|
|
54
|
+
field: string;
|
|
55
|
+
message: string;
|
|
56
|
+
}
|
|
57
|
+
export declare function validateCliOptions(raw: Record<string, unknown>): {
|
|
58
|
+
options: ScorecardOptions;
|
|
59
|
+
errors: ValidationError[];
|
|
60
|
+
};
|
|
61
|
+
export declare function extractJsonFromLlmResponse(text: string): unknown | null;
|
|
62
|
+
export declare function sanitize(text: string): string;
|
|
63
|
+
export declare function truncate(text: string, maxLen?: number): string;
|
|
64
|
+
export interface AdjudicationDecision {
|
|
65
|
+
shouldAdjudicate: boolean;
|
|
66
|
+
reason: string;
|
|
67
|
+
priority: 'critical' | 'high' | 'medium' | 'low';
|
|
68
|
+
}
|
|
69
|
+
export declare function needsAdjudication(episode: PainEpisode, localEval: LocalEvaluation): AdjudicationDecision;
|
|
70
|
+
export declare function determineFinalLabel(localEval: LocalEvaluation, adjudication: {
|
|
71
|
+
adjudicationStatus: AdjudicationStatus;
|
|
72
|
+
} | null): AdjudicationStatus;
|
|
73
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/quality-scorecard/validation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAEL,KAAK,eAAe,EACpB,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CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;CAClD;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,eAAe,GACzB,oBAAoB,CAkBtB;AAED,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,eAAe,EAC1B,YAAY,EAAE;IAAE,kBAAkB,EAAE,kBAAkB,CAAA;CAAE,GAAG,IAAI,GAC9D,kBAAkB,CAOpB"}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PRI-361 Quality Scorecard — Runtime Validation
|
|
3
|
+
*
|
|
4
|
+
* Pure validation functions for untrusted data from DB rows, LLM responses, CLI opts.
|
|
5
|
+
* ZERO I/O — no fs, fetch, database, process.env.
|
|
6
|
+
*/
|
|
7
|
+
import { RUBRIC_DIMENSIONS, } from './types.js';
|
|
8
|
+
// ── HTML / Markdown Escaping ───────────────────────────────────────
|
|
9
|
+
const HTML_ESCAPES = {
|
|
10
|
+
'&': '&',
|
|
11
|
+
'<': '<',
|
|
12
|
+
'>': '>',
|
|
13
|
+
'"': '"',
|
|
14
|
+
"'": ''',
|
|
15
|
+
};
|
|
16
|
+
const HTML_RE = /[&<>"']/g;
|
|
17
|
+
export function escapeHtml(text) {
|
|
18
|
+
return text.replace(HTML_RE, (ch) => HTML_ESCAPES[ch] ?? ch);
|
|
19
|
+
}
|
|
20
|
+
const MARKDOWN_TABLE_RE = /[|\n\r]/g;
|
|
21
|
+
export function escapeMarkdownTable(text) {
|
|
22
|
+
return text.replace(MARKDOWN_TABLE_RE, (ch) => {
|
|
23
|
+
if (ch === '|')
|
|
24
|
+
return '\\|';
|
|
25
|
+
if (ch === '\n')
|
|
26
|
+
return ' ';
|
|
27
|
+
if (ch === '\r')
|
|
28
|
+
return '';
|
|
29
|
+
return ch;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
// ── Score Validation ───────────────────────────────────────────────
|
|
33
|
+
export function isValidRubricScore(value) {
|
|
34
|
+
return value === 0 || value === 1 || value === 2;
|
|
35
|
+
}
|
|
36
|
+
export function parseRubricScore(value) {
|
|
37
|
+
if (isValidRubricScore(value))
|
|
38
|
+
return value;
|
|
39
|
+
return 0;
|
|
40
|
+
}
|
|
41
|
+
export function validateDimensionScores(raw) {
|
|
42
|
+
const result = {};
|
|
43
|
+
for (const dim of RUBRIC_DIMENSIONS) {
|
|
44
|
+
result[dim] = parseRubricScore(raw[dim]);
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
export function validateLlmScoreResponse(raw) {
|
|
49
|
+
if (typeof raw !== 'object' || raw === null) {
|
|
50
|
+
return {
|
|
51
|
+
scores: validateDimensionScores({}),
|
|
52
|
+
rationales: Object.fromEntries(RUBRIC_DIMENSIONS.map(d => [d, 'Invalid LLM response'])),
|
|
53
|
+
flags: ['invalid_llm_response'],
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
const obj = raw;
|
|
57
|
+
const rawScores = (typeof obj.scores === 'object' && obj.scores !== null)
|
|
58
|
+
? obj.scores
|
|
59
|
+
: {};
|
|
60
|
+
const rawRationales = (typeof obj.rationales === 'object' && obj.rationales !== null)
|
|
61
|
+
? obj.rationales
|
|
62
|
+
: {};
|
|
63
|
+
const scores = validateDimensionScores(rawScores);
|
|
64
|
+
const rationales = {};
|
|
65
|
+
for (const dim of RUBRIC_DIMENSIONS) {
|
|
66
|
+
rationales[dim] = typeof rawRationales[dim] === 'string'
|
|
67
|
+
? rawRationales[dim]
|
|
68
|
+
: 'No rationale provided';
|
|
69
|
+
}
|
|
70
|
+
const flags = Array.isArray(obj.flags)
|
|
71
|
+
? obj.flags.filter((f) => typeof f === 'string').map(String)
|
|
72
|
+
: [];
|
|
73
|
+
return { scores, rationales, flags };
|
|
74
|
+
}
|
|
75
|
+
// ── Adjudication Response Validation ───────────────────────────────
|
|
76
|
+
const VALID_ADJUDICATION_STATUSES = ['pass', 'fail', 'needs-review'];
|
|
77
|
+
export function validateAdjudicationResponse(raw) {
|
|
78
|
+
if (typeof raw !== 'object' || raw === null) {
|
|
79
|
+
return {
|
|
80
|
+
scores: validateDimensionScores({}),
|
|
81
|
+
rationale: 'Invalid adjudication response',
|
|
82
|
+
verdict: 'needs-review',
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
const obj = raw;
|
|
86
|
+
const rawScores = (typeof obj.scores === 'object' && obj.scores !== null)
|
|
87
|
+
? obj.scores
|
|
88
|
+
: {};
|
|
89
|
+
const rawVerdict = String(obj.verdict ?? '').toLowerCase();
|
|
90
|
+
const verdict = VALID_ADJUDICATION_STATUSES.includes(rawVerdict)
|
|
91
|
+
? rawVerdict
|
|
92
|
+
: 'needs-review';
|
|
93
|
+
return {
|
|
94
|
+
scores: validateDimensionScores(rawScores),
|
|
95
|
+
rationale: typeof obj.rationale === 'string' ? obj.rationale : 'No rationale provided',
|
|
96
|
+
verdict,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
export function validatePainRow(raw) {
|
|
100
|
+
if (typeof raw !== 'object' || raw === null)
|
|
101
|
+
return null;
|
|
102
|
+
const obj = raw;
|
|
103
|
+
const id = typeof obj.id === 'number' ? obj.id : -1;
|
|
104
|
+
const session_id = typeof obj.session_id === 'string' ? obj.session_id : '';
|
|
105
|
+
const source = typeof obj.source === 'string' ? obj.source : 'unknown';
|
|
106
|
+
const score = typeof obj.score === 'number' ? obj.score : 0;
|
|
107
|
+
const reason = typeof obj.reason === 'string' ? obj.reason : '';
|
|
108
|
+
const severity = typeof obj.severity === 'string' ? obj.severity : 'unknown';
|
|
109
|
+
const created_at = typeof obj.created_at === 'string' ? obj.created_at : new Date().toISOString();
|
|
110
|
+
if (id < 0 || reason === '')
|
|
111
|
+
return null;
|
|
112
|
+
return { id, session_id, source, score, reason, severity, created_at };
|
|
113
|
+
}
|
|
114
|
+
export function validateEvolutionRow(raw) {
|
|
115
|
+
if (typeof raw !== 'object' || raw === null)
|
|
116
|
+
return null;
|
|
117
|
+
const obj = raw;
|
|
118
|
+
const task_id = typeof obj.task_id === 'string' ? obj.task_id : '';
|
|
119
|
+
if (!task_id)
|
|
120
|
+
return null;
|
|
121
|
+
return {
|
|
122
|
+
task_id,
|
|
123
|
+
score: typeof obj.score === 'number' ? obj.score : 0,
|
|
124
|
+
status: typeof obj.status === 'string' ? obj.status : 'unknown',
|
|
125
|
+
resolution: typeof obj.resolution === 'string' ? obj.resolution : null,
|
|
126
|
+
created_at: typeof obj.created_at === 'string' ? obj.created_at : new Date().toISOString(),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
export function validatePrincipleEventRow(raw) {
|
|
130
|
+
if (typeof raw !== 'object' || raw === null)
|
|
131
|
+
return null;
|
|
132
|
+
const obj = raw;
|
|
133
|
+
const event_type = typeof obj.event_type === 'string' ? obj.event_type : '';
|
|
134
|
+
if (!event_type)
|
|
135
|
+
return null;
|
|
136
|
+
return {
|
|
137
|
+
principle_id: typeof obj.principle_id === 'string' ? obj.principle_id : null,
|
|
138
|
+
event_type,
|
|
139
|
+
created_at: typeof obj.created_at === 'string' ? obj.created_at : new Date().toISOString(),
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
export function validateGateRow(raw) {
|
|
143
|
+
if (typeof raw !== 'object' || raw === null)
|
|
144
|
+
return null;
|
|
145
|
+
const obj = raw;
|
|
146
|
+
const session_id = typeof obj.session_id === 'string' ? obj.session_id : '';
|
|
147
|
+
if (!session_id)
|
|
148
|
+
return null;
|
|
149
|
+
const cnt = typeof obj.cnt === 'number' ? obj.cnt : 0;
|
|
150
|
+
return { session_id, cnt };
|
|
151
|
+
}
|
|
152
|
+
export function validateCliOptions(raw) {
|
|
153
|
+
const errors = [];
|
|
154
|
+
const format = String(raw.format ?? 'markdown');
|
|
155
|
+
if (format !== 'json' && format !== 'markdown' && format !== 'html') {
|
|
156
|
+
errors.push({ field: 'format', message: `Invalid format "${format}"; must be json, markdown, or html` });
|
|
157
|
+
}
|
|
158
|
+
const minPainScore = Number(raw.minPainScore);
|
|
159
|
+
if (!Number.isFinite(minPainScore) || minPainScore < 0 || minPainScore > 100) {
|
|
160
|
+
errors.push({ field: 'minPainScore', message: `Invalid minPainScore "${raw.minPainScore}"; must be 0-100` });
|
|
161
|
+
}
|
|
162
|
+
const limit = Number(raw.limit);
|
|
163
|
+
if (!Number.isFinite(limit) || limit < 0) {
|
|
164
|
+
errors.push({ field: 'limit', message: `Invalid limit "${raw.limit}"; must be >= 0` });
|
|
165
|
+
}
|
|
166
|
+
const localUrl = String(raw.localModelBaseUrl ?? '');
|
|
167
|
+
if (!localUrl.startsWith('http://') && !localUrl.startsWith('https://')) {
|
|
168
|
+
errors.push({ field: 'localModelBaseUrl', message: `Invalid URL "${localUrl}"; must start with http:// or https://` });
|
|
169
|
+
}
|
|
170
|
+
const output = String(raw.output ?? '');
|
|
171
|
+
if (!output) {
|
|
172
|
+
errors.push({ field: 'output', message: 'Output path is required' });
|
|
173
|
+
}
|
|
174
|
+
const localModelId = String(raw.localModelId ?? '');
|
|
175
|
+
if (!localModelId) {
|
|
176
|
+
errors.push({ field: 'localModelId', message: 'Local model ID is required' });
|
|
177
|
+
}
|
|
178
|
+
const options = {
|
|
179
|
+
dbPath: String(raw.dbPath ?? ''),
|
|
180
|
+
logsDir: String(raw.logsDir ?? ''),
|
|
181
|
+
localModelBaseUrl: localUrl,
|
|
182
|
+
localModelId,
|
|
183
|
+
strongModelId: typeof raw.strongModelId === 'string' && raw.strongModelId ? raw.strongModelId : null,
|
|
184
|
+
limit: Number.isFinite(limit) ? Math.floor(limit) : 0,
|
|
185
|
+
format: (format === 'json' || format === 'markdown' || format === 'html') ? format : 'markdown',
|
|
186
|
+
output,
|
|
187
|
+
minPainScore: Number.isFinite(minPainScore) ? minPainScore : 0,
|
|
188
|
+
skipStrongModel: Boolean(raw.skipStrongModel),
|
|
189
|
+
};
|
|
190
|
+
return { options, errors };
|
|
191
|
+
}
|
|
192
|
+
// ── JSON Extraction from LLM ───────────────────────────────────────
|
|
193
|
+
const JSON_RE = /\{[\s\S]*\}/;
|
|
194
|
+
export function extractJsonFromLlmResponse(text) {
|
|
195
|
+
const match = JSON_RE.exec(text);
|
|
196
|
+
if (!match)
|
|
197
|
+
return null;
|
|
198
|
+
try {
|
|
199
|
+
return JSON.parse(match[0]);
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
// ── Desensitization ────────────────────────────────────────────────
|
|
206
|
+
const WIN_PATH_RE = /[A-Z]:\\[^\s"']+/g;
|
|
207
|
+
const POSIX_PATH_RE = /(?:\/home|\/mnt|\/Users|\/tmp|\/var|\/opt|\/etc|\/root)\/[^\s"']+/g;
|
|
208
|
+
const TOKEN_RE = /(eyJ[A-Za-z0-9_-]{10,})/g;
|
|
209
|
+
const SESSION_ID_RE = /([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})/g;
|
|
210
|
+
export function sanitize(text) {
|
|
211
|
+
return text
|
|
212
|
+
.replace(WIN_PATH_RE, '<path>')
|
|
213
|
+
.replace(POSIX_PATH_RE, '<path>')
|
|
214
|
+
.replace(TOKEN_RE, '<token-redacted>')
|
|
215
|
+
.replace(SESSION_ID_RE, '<session-id>');
|
|
216
|
+
}
|
|
217
|
+
export function truncate(text, maxLen = 200) {
|
|
218
|
+
if (text.length <= maxLen)
|
|
219
|
+
return text;
|
|
220
|
+
return text.substring(0, maxLen) + '...';
|
|
221
|
+
}
|
|
222
|
+
export function needsAdjudication(episode, localEval) {
|
|
223
|
+
if (localEval.flags.includes('fabricated_evidence')) {
|
|
224
|
+
return { shouldAdjudicate: true, reason: 'Fabrication detected in local evaluation', priority: 'critical' };
|
|
225
|
+
}
|
|
226
|
+
if (!localEval.mvpMet) {
|
|
227
|
+
return { shouldAdjudicate: true, reason: `MVP threshold not met (score ${localEval.totalScore}/14)`, priority: 'high' };
|
|
228
|
+
}
|
|
229
|
+
if (localEval.totalScore <= 8) {
|
|
230
|
+
return { shouldAdjudicate: true, reason: `Low total score (${localEval.totalScore}/14)`, priority: 'high' };
|
|
231
|
+
}
|
|
232
|
+
const zeroDims = RUBRIC_DIMENSIONS.filter(d => localEval.dimensionScores[d] === 0);
|
|
233
|
+
if (zeroDims.length > 0) {
|
|
234
|
+
return { shouldAdjudicate: true, reason: `Zero-score dimensions: ${zeroDims.join(', ')}`, priority: 'medium' };
|
|
235
|
+
}
|
|
236
|
+
if (localEval.totalScore >= 12 && localEval.mvpMet) {
|
|
237
|
+
return { shouldAdjudicate: false, reason: 'High score with MVP met — local-pass sufficient', priority: 'low' };
|
|
238
|
+
}
|
|
239
|
+
return { shouldAdjudicate: true, reason: 'Moderate score — recommend strong-model review', priority: 'medium' };
|
|
240
|
+
}
|
|
241
|
+
export function determineFinalLabel(localEval, adjudication) {
|
|
242
|
+
if (!adjudication || adjudication.adjudicationStatus === 'skipped') {
|
|
243
|
+
if (localEval.mvpMet && localEval.totalScore >= 12)
|
|
244
|
+
return 'local-pass';
|
|
245
|
+
if (localEval.totalScore <= 6)
|
|
246
|
+
return 'local-fail';
|
|
247
|
+
return 'needs-review';
|
|
248
|
+
}
|
|
249
|
+
return adjudication.adjudicationStatus;
|
|
250
|
+
}
|
|
251
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/quality-scorecard/validation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,iBAAiB,GAOlB,MAAM,YAAY,CAAC;AAEpB,sEAAsE;AAEtE,MAAM,YAAY,GAA2B;IAC3C,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;CACd,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agnostic pain signal capture and principle injection",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -69,6 +69,10 @@
|
|
|
69
69
|
"./runtime-v2/feedback": {
|
|
70
70
|
"types": "./dist/runtime-v2/feedback/index.d.ts",
|
|
71
71
|
"default": "./dist/runtime-v2/feedback/index.js"
|
|
72
|
+
},
|
|
73
|
+
"./quality-scorecard": {
|
|
74
|
+
"types": "./dist/quality-scorecard/index.d.ts",
|
|
75
|
+
"default": "./dist/quality-scorecard/index.js"
|
|
72
76
|
}
|
|
73
77
|
},
|
|
74
78
|
"files": [
|