@iris-eval/mcp-server 0.5.1 → 0.7.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 (56) hide show
  1. package/README.md +100 -34
  2. package/dist/config/defaults.js +3 -1
  3. package/dist/config/index.d.ts +10 -0
  4. package/dist/config/index.js +33 -7
  5. package/dist/dashboard/assets/index-CKs2Wbd_.js +10 -0
  6. package/dist/dashboard/assets/{index-UffZ-aEJ.css → index-D0cFfBqn.css} +1 -1
  7. package/dist/dashboard/index.html +4 -3
  8. package/dist/dashboard/routes/health.js +10 -3
  9. package/dist/dashboard/routes/moments.js +1 -1
  10. package/dist/dashboard/routes/preferences.d.ts +1 -0
  11. package/dist/dashboard/routes/preferences.js +31 -3
  12. package/dist/dashboard/routes/rules.d.ts +18 -0
  13. package/dist/dashboard/routes/rules.js +160 -6
  14. package/dist/dashboard/routes/traces.js +27 -3
  15. package/dist/dashboard/seed-demo-data.js +11 -0
  16. package/dist/dashboard/server.js +13 -3
  17. package/dist/dashboard/session-auth.d.ts +8 -0
  18. package/dist/dashboard/session-auth.js +237 -0
  19. package/dist/dashboard/validation.d.ts +10 -4
  20. package/dist/dashboard/validation.js +73 -11
  21. package/dist/eval/engine.d.ts +79 -1
  22. package/dist/eval/engine.js +216 -82
  23. package/dist/eval/rules/relevance.d.ts +13 -0
  24. package/dist/eval/rules/relevance.js +185 -21
  25. package/dist/eval/rules/safety.d.ts +19 -0
  26. package/dist/eval/rules/safety.js +236 -24
  27. package/dist/index.js +102 -16
  28. package/dist/middleware/rate-limit.d.ts +25 -0
  29. package/dist/middleware/rate-limit.js +54 -2
  30. package/dist/self-test.d.ts +14 -0
  31. package/dist/self-test.js +97 -13
  32. package/dist/storage/demo-guard.d.ts +8 -0
  33. package/dist/storage/demo-guard.js +53 -0
  34. package/dist/storage/sqlite-adapter.d.ts +6 -0
  35. package/dist/storage/sqlite-adapter.js +72 -1
  36. package/dist/tools/delete-rule.js +49 -11
  37. package/dist/tools/deploy-rule.d.ts +33 -0
  38. package/dist/tools/deploy-rule.js +130 -27
  39. package/dist/tools/evaluate-output.js +54 -33
  40. package/dist/tools/evaluate-with-llm-judge.js +10 -3
  41. package/dist/tools/get-traces.d.ts +27 -0
  42. package/dist/tools/get-traces.js +60 -8
  43. package/dist/tools/list-rules.js +2 -2
  44. package/dist/tools/log-trace.js +4 -3
  45. package/dist/tools/strict-input.d.ts +1 -0
  46. package/dist/tools/strict-input.js +27 -2
  47. package/dist/tools/trace-link.d.ts +7 -0
  48. package/dist/tools/trace-link.js +39 -0
  49. package/dist/tools/verify-citations.d.ts +19 -0
  50. package/dist/tools/verify-citations.js +41 -4
  51. package/dist/types/eval.d.ts +52 -1
  52. package/dist/types/index.d.ts +1 -1
  53. package/dist/types/query.d.ts +25 -0
  54. package/package.json +8 -1
  55. package/server.json +2 -2
  56. package/dist/dashboard/assets/index-VI_nbMfN.js +0 -10
@@ -1,4 +1,12 @@
1
1
  export type EvalType = 'completeness' | 'relevance' | 'safety' | 'cost' | 'custom';
2
+ /**
3
+ * What an EvalResult can be tagged as: a single bundle (EvalType), or
4
+ * 'all' — evaluate_output's eval_type="all", which runs every bundle in one
5
+ * pass and reports a per-category breakdown beside the overall verdict.
6
+ * Kept apart from EvalType on purpose: rules are deployed and registered
7
+ * under a real bundle, never under 'all'.
8
+ */
9
+ export type EvalResultType = EvalType | 'all';
2
10
  export interface EvalRule {
3
11
  name: string;
4
12
  description: string;
@@ -49,6 +57,20 @@ export interface EvalContext {
49
57
  }
50
58
  export interface EvalRuleResult {
51
59
  ruleName: string;
60
+ /**
61
+ * Deployed rule id (rule-<hex>) when the rule came from the custom-rule
62
+ * store. Absent for built-in rules and for inline custom_rules. Names are
63
+ * not unique — a same-name redeploy with replace:true mints a new id, and
64
+ * stores written before the same-name guard may hold duplicates — so this
65
+ * is the field that tells two same-named results apart (#373).
66
+ */
67
+ ruleId?: string;
68
+ /**
69
+ * The bundle this rule belongs to. Present only on eval_type="all"
70
+ * results, where rule_results spans every bundle and a reader needs to
71
+ * regroup them.
72
+ */
73
+ category?: EvalType;
52
74
  passed: boolean;
53
75
  score: number;
54
76
  message: string;
@@ -57,10 +79,31 @@ export interface EvalRuleResult {
57
79
  configInvalid?: boolean;
58
80
  budgetExceeded?: boolean;
59
81
  }
82
+ /**
83
+ * Per-bundle verdict inside an eval_type="all" result. Same semantics as a
84
+ * single-bundle EvalResult (threshold + critical veto), computed over that
85
+ * bundle's rules only.
86
+ *
87
+ * `score` and `passed` are null when the bundle evaluated no rule (every
88
+ * rule skipped for missing context — cost without cost_usd, relevance
89
+ * without input). Such a bundle was not judged: it is neither passing nor
90
+ * failing, `insufficient_data` is true, and it never counted toward the
91
+ * overall verdict (#406). The top-level EvalResult keeps a boolean
92
+ * `passed` on purpose — a gate keyed on it must fail closed.
93
+ */
94
+ export interface EvalCategoryResult {
95
+ score: number | null;
96
+ passed: boolean | null;
97
+ rules_evaluated: number;
98
+ rules_skipped: number;
99
+ insufficient_data: boolean;
100
+ critical_failures?: string[];
101
+ critical_skipped?: string[];
102
+ }
60
103
  export interface EvalResult {
61
104
  id: string;
62
105
  trace_id?: string;
63
- eval_type: EvalType;
106
+ eval_type: EvalResultType;
64
107
  output_text: string;
65
108
  expected_text?: string;
66
109
  score: number;
@@ -93,6 +136,14 @@ export interface EvalResult {
93
136
  * non-empty `critical_skipped` as "unknown", not as "clean".
94
137
  */
95
138
  critical_skipped?: string[];
139
+ /**
140
+ * Per-bundle breakdown, present only when eval_type is 'all'. Keyed by
141
+ * bundle; a bundle with no rules at all (nothing deployed under "custom"
142
+ * and no inline custom_rules) is absent rather than reported as
143
+ * insufficient. Response-only — not persisted as a column; the stored
144
+ * rule_results carry a `category` per rule so a reader can regroup.
145
+ */
146
+ categories?: Partial<Record<EvalType, EvalCategoryResult>>;
96
147
  }
97
148
  export type CustomRuleType = 'regex_match' | 'regex_no_match' | 'min_length' | 'max_length' | 'contains_keywords' | 'excludes_keywords' | 'json_schema' | 'cost_threshold';
98
149
  export interface CustomRuleDefinition {
@@ -1,5 +1,5 @@
1
1
  export type { SpanKind, SpanStatus, SpanEvent, ToolCallRecord, TokenUsage, Span, Trace, } from './trace.js';
2
- export type { EvalType, EvalRule, EvalContext, EvalRuleResult, EvalResult, CustomRuleType, CustomRuleDefinition, } from './eval.js';
2
+ export type { EvalType, EvalResultType, EvalRule, EvalContext, EvalRuleResult, EvalResult, EvalCategoryResult, CustomRuleType, CustomRuleDefinition, } from './eval.js';
3
3
  export type { TraceFilter, TraceQueryOptions, TraceQueryResult, DashboardSummary, EvalStatsPeriod, EvalStats, EvalStatsTrendBucket, EvalStatsRuleBreakdown, EvalStatsFailure, IStorageAdapter, } from './query.js';
4
4
  export type { IrisConfig } from './config.js';
5
5
  export type { TenantId } from './tenant.js';
@@ -95,6 +95,31 @@ export interface IStorageAdapter {
95
95
  }>;
96
96
  getDashboardSummary(tenantId: TenantId, sinceHours?: number): Promise<DashboardSummary>;
97
97
  deleteTracesOlderThan(tenantId: TenantId, days: number): Promise<number>;
98
+ /**
99
+ * Retention twin of deleteTracesOlderThan for eval_results (#372).
100
+ * Deleting a trace only NULLs the trace_id on its evaluations (FK ON
101
+ * DELETE SET NULL), so every eval row — output_text verbatim, including
102
+ * whatever no_pii flagged — outlived the retention window until this
103
+ * existed. Cutoff is on created_at.
104
+ */
105
+ deleteEvalResultsOlderThan(tenantId: TenantId, days: number): Promise<number>;
106
+ /**
107
+ * Delete EVERY trace, span and eval result for the tenant, then compact
108
+ * the database so the deleted text does not linger in free pages or in
109
+ * the write-ahead log. Returns what was removed. Deployed rules, the
110
+ * audit log and preferences are not storage rows and are untouched.
111
+ */
112
+ purge(tenantId: TenantId): Promise<{
113
+ traces: number;
114
+ evalResults: number;
115
+ }>;
116
+ /**
117
+ * Fold the write-ahead log into the main file and truncate it
118
+ * (wal_checkpoint TRUNCATE). Best-effort; called after a retention sweep
119
+ * so rows deleted at startup do not survive as readable text in
120
+ * iris.db-wal.
121
+ */
122
+ checkpoint(): Promise<void>;
98
123
  /**
99
124
  * Delete a single trace by id. Cascades to spans via FK ON DELETE
100
125
  * CASCADE; eval_results get their trace_id set to NULL (so score
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iris-eval/mcp-server",
3
- "version": "0.5.1",
3
+ "version": "0.7.0",
4
4
  "description": "Stop shipping agents on vibes. Score every agent output for quality, safety, and cost.",
5
5
  "mcpName": "io.github.iris-eval/mcp-server",
6
6
  "type": "module",
@@ -28,8 +28,15 @@
28
28
  "version:sync": "node scripts/sync-versions.mjs",
29
29
  "claims:capture-tests": "node scripts/claims/capture-tests.mjs",
30
30
  "claims:generate": "node scripts/claims/generate.mjs",
31
+ "claims:generate:live": "node scripts/claims/generate.mjs --live",
31
32
  "claims:check": "node scripts/claims/generate.mjs --check",
32
33
  "claims:check-hardcoded": "node scripts/claims/check-no-hardcoded.mjs",
34
+ "proof": "tsx proof/run.ts",
35
+ "proof:typecheck": "tsc -p proof/tsconfig.json",
36
+ "llms:render": "node scripts/claims/render-llms.mjs",
37
+ "llms:check": "node scripts/claims/render-llms.mjs --check",
38
+ "proof:judge": "tsx proof/judge/run.ts",
39
+ "proof:judge:typecheck": "tsc -p proof/judge/tsconfig.json",
33
40
  "clean": "rm -rf dist coverage",
34
41
  "seed:demo": "tsx scripts/seed-demo-data.ts",
35
42
  "demo": "tsx scripts/demo.ts"
package/server.json CHANGED
@@ -6,12 +6,12 @@
6
6
  "url": "https://github.com/iris-eval/mcp-server",
7
7
  "source": "github"
8
8
  },
9
- "version": "0.5.1",
9
+ "version": "0.7.0",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "@iris-eval/mcp-server",
14
- "version": "0.5.1",
14
+ "version": "0.7.0",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  },