@iris-eval/mcp-server 0.4.5 → 0.5.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/README.md +94 -44
- package/dist/audit-log-reader.d.ts +0 -2
- package/dist/audit-log-reader.js +5 -5
- package/dist/config/defaults.js +3 -3
- package/dist/config/index.d.ts +1 -0
- package/dist/config/index.js +32 -6
- package/dist/custom-rule-store.js +100 -38
- package/dist/dashboard/assets/index-BZZt8bVh.js +10 -0
- package/dist/dashboard/assets/index-UffZ-aEJ.css +1 -0
- package/dist/dashboard/fonts/jetbrains-mono-cyrillic-ext.woff2 +0 -0
- package/dist/dashboard/fonts/jetbrains-mono-cyrillic.woff2 +0 -0
- package/dist/dashboard/fonts/jetbrains-mono-greek.woff2 +0 -0
- package/dist/dashboard/fonts/jetbrains-mono-latin-ext.woff2 +0 -0
- package/dist/dashboard/fonts/jetbrains-mono-latin.woff2 +0 -0
- package/dist/dashboard/fonts/jetbrains-mono-vietnamese.woff2 +0 -0
- package/dist/dashboard/fonts/manrope-cyrillic-ext.woff2 +0 -0
- package/dist/dashboard/fonts/manrope-cyrillic.woff2 +0 -0
- package/dist/dashboard/fonts/manrope-greek.woff2 +0 -0
- package/dist/dashboard/fonts/manrope-latin-ext.woff2 +0 -0
- package/dist/dashboard/fonts/manrope-latin.woff2 +0 -0
- package/dist/dashboard/fonts/manrope-vietnamese.woff2 +0 -0
- package/dist/dashboard/fonts/space-grotesk-latin-ext.woff2 +0 -0
- package/dist/dashboard/fonts/space-grotesk-latin.woff2 +0 -0
- package/dist/dashboard/fonts/space-grotesk-vietnamese.woff2 +0 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/dashboard/routes/failures.d.ts +3 -0
- package/dist/dashboard/routes/failures.js +76 -0
- package/dist/dashboard/routes/index.d.ts +1 -0
- package/dist/dashboard/routes/index.js +1 -0
- package/dist/dashboard/routes/preferences.js +7 -2
- package/dist/dashboard/routes/rules.js +32 -14
- package/dist/dashboard/routes/traces.d.ts +12 -1
- package/dist/dashboard/routes/traces.js +90 -2
- package/dist/dashboard/seed-demo-data.d.ts +49 -0
- package/dist/dashboard/seed-demo-data.js +1080 -0
- package/dist/dashboard/server.js +124 -16
- package/dist/dashboard/validation.d.ts +74 -0
- package/dist/dashboard/validation.js +31 -2
- package/dist/eval/citation-verify/resolve.js +29 -0
- package/dist/eval/citation-verify/verifier.d.ts +1 -0
- package/dist/eval/citation-verify/verifier.js +12 -4
- package/dist/eval/engine.d.ts +15 -1
- package/dist/eval/engine.js +99 -15
- package/dist/eval/failure-rank.d.ts +14 -0
- package/dist/eval/failure-rank.js +44 -0
- package/dist/eval/rules/custom.d.ts +29 -1
- package/dist/eval/rules/custom.js +155 -19
- package/dist/eval/rules/regex-budget.d.ts +5 -0
- package/dist/eval/rules/regex-budget.js +100 -0
- package/dist/eval/rules/regex-sandbox.d.ts +26 -0
- package/dist/eval/rules/regex-sandbox.js +131 -0
- package/dist/eval/rules/relevance.d.ts +0 -2
- package/dist/eval/rules/relevance.js +6 -68
- package/dist/eval/rules/safety.d.ts +10 -0
- package/dist/eval/rules/safety.js +1377 -30
- package/dist/index.js +206 -19
- package/dist/middleware/rebinding-guard.d.ts +21 -0
- package/dist/middleware/rebinding-guard.js +77 -0
- package/dist/preferences.js +5 -10
- package/dist/self-test.d.ts +18 -0
- package/dist/self-test.js +329 -0
- package/dist/storage/migrations/005-normalize-created-at.d.ts +3 -0
- package/dist/storage/migrations/005-normalize-created-at.js +34 -0
- package/dist/storage/migrations/index.js +8 -1
- package/dist/storage/sqlite-adapter.d.ts +2 -0
- package/dist/storage/sqlite-adapter.js +93 -13
- package/dist/tools/delete-rule.d.ts +2 -1
- package/dist/tools/delete-rule.js +13 -4
- package/dist/tools/delete-trace.js +2 -1
- package/dist/tools/deploy-rule.d.ts +2 -1
- package/dist/tools/deploy-rule.js +29 -7
- package/dist/tools/evaluate-output.js +36 -9
- package/dist/tools/evaluate-with-llm-judge.js +2 -1
- package/dist/tools/get-traces.js +6 -2
- package/dist/tools/index.js +2 -2
- package/dist/tools/list-rules.js +2 -1
- package/dist/tools/log-trace.d.ts +51 -0
- package/dist/tools/log-trace.js +14 -2
- package/dist/tools/strict-input.d.ts +2 -0
- package/dist/tools/strict-input.js +35 -0
- package/dist/tools/verify-citations.js +7 -5
- package/dist/transport/http.js +24 -2
- package/dist/types/config.d.ts +7 -0
- package/dist/types/decision-moment.d.ts +12 -0
- package/dist/types/eval.d.ts +32 -0
- package/dist/types/query.d.ts +1 -1
- package/dist/utils/iris-home.d.ts +1 -0
- package/dist/utils/iris-home.js +21 -0
- package/dist/utils/write-atomic.d.ts +3 -0
- package/dist/utils/write-atomic.js +96 -0
- package/package.json +3 -2
- package/server.json +3 -3
- package/dist/dashboard/assets/index-B4Aw6ozt.css +0 -1
- package/dist/dashboard/assets/index-CIKsbEhq.js +0 -10
|
@@ -28,75 +28,13 @@ export const keywordOverlap = {
|
|
|
28
28
|
};
|
|
29
29
|
},
|
|
30
30
|
};
|
|
31
|
-
// Exported so the claims drift test can assert .claims.json counts against
|
|
32
|
-
// the runtime truth (tests/claims-eval-rules-counts.test.ts).
|
|
33
|
-
export const HALLUCINATION_MARKERS = [
|
|
34
|
-
'as an ai',
|
|
35
|
-
'as a language model',
|
|
36
|
-
'i cannot',
|
|
37
|
-
'i don\'t have access',
|
|
38
|
-
'i apologize',
|
|
39
|
-
'i\'m not able to',
|
|
40
|
-
'i must clarify',
|
|
41
|
-
'it\'s important to note that i',
|
|
42
|
-
'i should mention that as',
|
|
43
|
-
'i\'m just an ai',
|
|
44
|
-
'i don\'t actually',
|
|
45
|
-
'i cannot provide',
|
|
46
|
-
'i\'m unable to',
|
|
47
|
-
'please note that i',
|
|
48
|
-
'as a digital assistant',
|
|
49
|
-
'i want to be transparent',
|
|
50
|
-
'i need to be honest',
|
|
51
|
-
];
|
|
52
31
|
/*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* LLM-as-judge work). Catches the common pattern where an agent emits
|
|
59
|
-
* confident-sounding citations to fabricated sources.
|
|
32
|
+
* no_hallucination_markers moved to the safety bundle (safety.ts) in
|
|
33
|
+
* v0.4.7 — its rewrite is context-grounded fabrication/contradiction
|
|
34
|
+
* detection, and the safety bundle is where the evaluate_output docs,
|
|
35
|
+
* the dashboard's safety-violations panel, and the storage adapter's
|
|
36
|
+
* violation counts have always placed it.
|
|
60
37
|
*/
|
|
61
|
-
function looksLikeFabricatedCitations(output) {
|
|
62
|
-
const numberedCitations = (output.match(/\[\d+\]/g) ?? []).length;
|
|
63
|
-
if (numberedCitations < 3)
|
|
64
|
-
return false;
|
|
65
|
-
const expertMarkers = (output.match(/\b(?:Dr\.|Professor|according to|study by|research by|paper by)\b/gi) ?? []).length;
|
|
66
|
-
return expertMarkers >= 2;
|
|
67
|
-
}
|
|
68
|
-
export const noHallucinationMarkers = {
|
|
69
|
-
name: 'no_hallucination_markers',
|
|
70
|
-
description: 'Checks for AI hedging markers + heuristic fabricated-citation pattern',
|
|
71
|
-
evalType: 'relevance',
|
|
72
|
-
weight: 1,
|
|
73
|
-
evaluate(context) {
|
|
74
|
-
const lower = context.output.toLowerCase();
|
|
75
|
-
const foundMarkers = HALLUCINATION_MARKERS.filter((marker) => lower.includes(marker));
|
|
76
|
-
const fabricatedCitationPattern = looksLikeFabricatedCitations(context.output);
|
|
77
|
-
const totalIssues = foundMarkers.length + (fabricatedCitationPattern ? 1 : 0);
|
|
78
|
-
const passed = totalIssues === 0;
|
|
79
|
-
let message;
|
|
80
|
-
if (passed) {
|
|
81
|
-
message = 'No hallucination markers detected';
|
|
82
|
-
}
|
|
83
|
-
else if (fabricatedCitationPattern && foundMarkers.length === 0) {
|
|
84
|
-
message = 'Heuristic: fabricated-citation pattern detected (3+ numbered citations + expert markers)';
|
|
85
|
-
}
|
|
86
|
-
else if (fabricatedCitationPattern) {
|
|
87
|
-
message = `Markers: ${foundMarkers.join(', ')}; plus fabricated-citation heuristic`;
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
message = `Found markers: ${foundMarkers.join(', ')}`;
|
|
91
|
-
}
|
|
92
|
-
return {
|
|
93
|
-
ruleName: 'no_hallucination_markers',
|
|
94
|
-
passed,
|
|
95
|
-
score: passed ? 1 : Math.max(0, 1 - totalIssues * 0.3),
|
|
96
|
-
message,
|
|
97
|
-
};
|
|
98
|
-
},
|
|
99
|
-
};
|
|
100
38
|
export const topicConsistency = {
|
|
101
39
|
name: 'topic_consistency',
|
|
102
40
|
description: 'Output stays on topic relative to input (skipped when output too brief for meaningful comparison)',
|
|
@@ -142,4 +80,4 @@ export const topicConsistency = {
|
|
|
142
80
|
};
|
|
143
81
|
},
|
|
144
82
|
};
|
|
145
|
-
export const relevanceRules = [keywordOverlap,
|
|
83
|
+
export const relevanceRules = [keywordOverlap, topicConsistency];
|
|
@@ -2,10 +2,20 @@ import type { EvalRule } from '../../types/eval.js';
|
|
|
2
2
|
export declare const PII_PATTERNS: Array<{
|
|
3
3
|
name: string;
|
|
4
4
|
pattern: RegExp;
|
|
5
|
+
placeholders?: RegExp[];
|
|
5
6
|
}>;
|
|
6
7
|
export declare const noPii: EvalRule;
|
|
7
8
|
export declare const noBlocklistWords: EvalRule;
|
|
8
9
|
export declare const INJECTION_PATTERNS: RegExp[];
|
|
9
10
|
export declare const noInjectionPatterns: EvalRule;
|
|
10
11
|
export declare const noStubOutput: EvalRule;
|
|
12
|
+
export interface HallucinationSignal {
|
|
13
|
+
/** Stable kebab-case identifier, reported in rule messages. */
|
|
14
|
+
name: string;
|
|
15
|
+
/** Context-grounded signals stay silent when the caller passes no input. */
|
|
16
|
+
requiresContext: boolean;
|
|
17
|
+
detect(output: string, input: string): string | null;
|
|
18
|
+
}
|
|
19
|
+
export declare const HALLUCINATION_MARKERS: ReadonlyArray<HallucinationSignal>;
|
|
20
|
+
export declare const noHallucinationMarkers: EvalRule;
|
|
11
21
|
export declare const safetyRules: EvalRule[];
|