@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.
Files changed (94) hide show
  1. package/README.md +94 -44
  2. package/dist/audit-log-reader.d.ts +0 -2
  3. package/dist/audit-log-reader.js +5 -5
  4. package/dist/config/defaults.js +3 -3
  5. package/dist/config/index.d.ts +1 -0
  6. package/dist/config/index.js +32 -6
  7. package/dist/custom-rule-store.js +100 -38
  8. package/dist/dashboard/assets/index-BZZt8bVh.js +10 -0
  9. package/dist/dashboard/assets/index-UffZ-aEJ.css +1 -0
  10. package/dist/dashboard/fonts/jetbrains-mono-cyrillic-ext.woff2 +0 -0
  11. package/dist/dashboard/fonts/jetbrains-mono-cyrillic.woff2 +0 -0
  12. package/dist/dashboard/fonts/jetbrains-mono-greek.woff2 +0 -0
  13. package/dist/dashboard/fonts/jetbrains-mono-latin-ext.woff2 +0 -0
  14. package/dist/dashboard/fonts/jetbrains-mono-latin.woff2 +0 -0
  15. package/dist/dashboard/fonts/jetbrains-mono-vietnamese.woff2 +0 -0
  16. package/dist/dashboard/fonts/manrope-cyrillic-ext.woff2 +0 -0
  17. package/dist/dashboard/fonts/manrope-cyrillic.woff2 +0 -0
  18. package/dist/dashboard/fonts/manrope-greek.woff2 +0 -0
  19. package/dist/dashboard/fonts/manrope-latin-ext.woff2 +0 -0
  20. package/dist/dashboard/fonts/manrope-latin.woff2 +0 -0
  21. package/dist/dashboard/fonts/manrope-vietnamese.woff2 +0 -0
  22. package/dist/dashboard/fonts/space-grotesk-latin-ext.woff2 +0 -0
  23. package/dist/dashboard/fonts/space-grotesk-latin.woff2 +0 -0
  24. package/dist/dashboard/fonts/space-grotesk-vietnamese.woff2 +0 -0
  25. package/dist/dashboard/index.html +2 -2
  26. package/dist/dashboard/routes/failures.d.ts +3 -0
  27. package/dist/dashboard/routes/failures.js +76 -0
  28. package/dist/dashboard/routes/index.d.ts +1 -0
  29. package/dist/dashboard/routes/index.js +1 -0
  30. package/dist/dashboard/routes/preferences.js +7 -2
  31. package/dist/dashboard/routes/rules.js +32 -14
  32. package/dist/dashboard/routes/traces.d.ts +12 -1
  33. package/dist/dashboard/routes/traces.js +90 -2
  34. package/dist/dashboard/seed-demo-data.d.ts +49 -0
  35. package/dist/dashboard/seed-demo-data.js +1080 -0
  36. package/dist/dashboard/server.js +124 -16
  37. package/dist/dashboard/validation.d.ts +74 -0
  38. package/dist/dashboard/validation.js +31 -2
  39. package/dist/eval/citation-verify/resolve.js +29 -0
  40. package/dist/eval/citation-verify/verifier.d.ts +1 -0
  41. package/dist/eval/citation-verify/verifier.js +12 -4
  42. package/dist/eval/engine.d.ts +15 -1
  43. package/dist/eval/engine.js +99 -15
  44. package/dist/eval/failure-rank.d.ts +14 -0
  45. package/dist/eval/failure-rank.js +44 -0
  46. package/dist/eval/rules/custom.d.ts +29 -1
  47. package/dist/eval/rules/custom.js +155 -19
  48. package/dist/eval/rules/regex-budget.d.ts +5 -0
  49. package/dist/eval/rules/regex-budget.js +100 -0
  50. package/dist/eval/rules/regex-sandbox.d.ts +26 -0
  51. package/dist/eval/rules/regex-sandbox.js +131 -0
  52. package/dist/eval/rules/relevance.d.ts +0 -2
  53. package/dist/eval/rules/relevance.js +6 -68
  54. package/dist/eval/rules/safety.d.ts +10 -0
  55. package/dist/eval/rules/safety.js +1377 -30
  56. package/dist/index.js +206 -19
  57. package/dist/middleware/rebinding-guard.d.ts +21 -0
  58. package/dist/middleware/rebinding-guard.js +77 -0
  59. package/dist/preferences.js +5 -10
  60. package/dist/self-test.d.ts +18 -0
  61. package/dist/self-test.js +329 -0
  62. package/dist/storage/migrations/005-normalize-created-at.d.ts +3 -0
  63. package/dist/storage/migrations/005-normalize-created-at.js +34 -0
  64. package/dist/storage/migrations/index.js +8 -1
  65. package/dist/storage/sqlite-adapter.d.ts +2 -0
  66. package/dist/storage/sqlite-adapter.js +93 -13
  67. package/dist/tools/delete-rule.d.ts +2 -1
  68. package/dist/tools/delete-rule.js +13 -4
  69. package/dist/tools/delete-trace.js +2 -1
  70. package/dist/tools/deploy-rule.d.ts +2 -1
  71. package/dist/tools/deploy-rule.js +29 -7
  72. package/dist/tools/evaluate-output.js +36 -9
  73. package/dist/tools/evaluate-with-llm-judge.js +2 -1
  74. package/dist/tools/get-traces.js +6 -2
  75. package/dist/tools/index.js +2 -2
  76. package/dist/tools/list-rules.js +2 -1
  77. package/dist/tools/log-trace.d.ts +51 -0
  78. package/dist/tools/log-trace.js +14 -2
  79. package/dist/tools/strict-input.d.ts +2 -0
  80. package/dist/tools/strict-input.js +35 -0
  81. package/dist/tools/verify-citations.js +7 -5
  82. package/dist/transport/http.js +24 -2
  83. package/dist/types/config.d.ts +7 -0
  84. package/dist/types/decision-moment.d.ts +12 -0
  85. package/dist/types/eval.d.ts +32 -0
  86. package/dist/types/query.d.ts +1 -1
  87. package/dist/utils/iris-home.d.ts +1 -0
  88. package/dist/utils/iris-home.js +21 -0
  89. package/dist/utils/write-atomic.d.ts +3 -0
  90. package/dist/utils/write-atomic.js +96 -0
  91. package/package.json +3 -2
  92. package/server.json +3 -3
  93. package/dist/dashboard/assets/index-B4Aw6ozt.css +0 -1
  94. 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
- * Heuristic for fabricated-citation patterns added v0.3.1.
54
- *
55
- * Looks for the shape: numbered citation markers ([1], [2], etc.) appearing
56
- * 3+ times AND density of "Dr." / "Professor" / "according to" / "study by"
57
- * markers. Heuristic only doesn't verify citations are real (that's v0.5
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, noHallucinationMarkers, topicConsistency];
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[];