@iris-eval/mcp-server 0.5.1 → 0.6.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 (53) hide show
  1. package/README.md +95 -33
  2. package/dist/config/index.d.ts +10 -0
  3. package/dist/config/index.js +33 -7
  4. package/dist/dashboard/assets/index-CshLgDRB.js +10 -0
  5. package/dist/dashboard/assets/{index-UffZ-aEJ.css → index-D0cFfBqn.css} +1 -1
  6. package/dist/dashboard/index.html +4 -3
  7. package/dist/dashboard/routes/health.js +10 -3
  8. package/dist/dashboard/routes/moments.js +1 -1
  9. package/dist/dashboard/routes/preferences.d.ts +1 -0
  10. package/dist/dashboard/routes/preferences.js +31 -3
  11. package/dist/dashboard/routes/rules.d.ts +18 -0
  12. package/dist/dashboard/routes/rules.js +160 -6
  13. package/dist/dashboard/routes/traces.js +21 -3
  14. package/dist/dashboard/seed-demo-data.js +11 -0
  15. package/dist/dashboard/server.js +13 -3
  16. package/dist/dashboard/session-auth.d.ts +8 -0
  17. package/dist/dashboard/session-auth.js +237 -0
  18. package/dist/dashboard/validation.d.ts +9 -3
  19. package/dist/dashboard/validation.js +69 -11
  20. package/dist/eval/engine.d.ts +62 -0
  21. package/dist/eval/engine.js +188 -82
  22. package/dist/eval/rules/safety.d.ts +8 -0
  23. package/dist/eval/rules/safety.js +43 -11
  24. package/dist/index.js +102 -16
  25. package/dist/middleware/rate-limit.d.ts +25 -0
  26. package/dist/middleware/rate-limit.js +54 -2
  27. package/dist/self-test.d.ts +14 -0
  28. package/dist/self-test.js +97 -13
  29. package/dist/storage/demo-guard.d.ts +8 -0
  30. package/dist/storage/demo-guard.js +53 -0
  31. package/dist/storage/sqlite-adapter.d.ts +6 -0
  32. package/dist/storage/sqlite-adapter.js +72 -1
  33. package/dist/tools/delete-rule.js +49 -11
  34. package/dist/tools/deploy-rule.d.ts +33 -0
  35. package/dist/tools/deploy-rule.js +130 -27
  36. package/dist/tools/evaluate-output.js +41 -22
  37. package/dist/tools/evaluate-with-llm-judge.js +10 -3
  38. package/dist/tools/get-traces.d.ts +27 -0
  39. package/dist/tools/get-traces.js +60 -8
  40. package/dist/tools/list-rules.js +2 -2
  41. package/dist/tools/log-trace.js +4 -3
  42. package/dist/tools/strict-input.d.ts +1 -0
  43. package/dist/tools/strict-input.js +25 -0
  44. package/dist/tools/trace-link.d.ts +7 -0
  45. package/dist/tools/trace-link.js +39 -0
  46. package/dist/tools/verify-citations.d.ts +19 -0
  47. package/dist/tools/verify-citations.js +41 -4
  48. package/dist/types/eval.d.ts +45 -1
  49. package/dist/types/index.d.ts +1 -1
  50. package/dist/types/query.d.ts +25 -0
  51. package/package.json +1 -1
  52. package/server.json +2 -2
  53. 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,24 @@ 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
+ export interface EvalCategoryResult {
88
+ score: number;
89
+ passed: boolean;
90
+ rules_evaluated: number;
91
+ rules_skipped: number;
92
+ insufficient_data: boolean;
93
+ critical_failures?: string[];
94
+ critical_skipped?: string[];
95
+ }
60
96
  export interface EvalResult {
61
97
  id: string;
62
98
  trace_id?: string;
63
- eval_type: EvalType;
99
+ eval_type: EvalResultType;
64
100
  output_text: string;
65
101
  expected_text?: string;
66
102
  score: number;
@@ -93,6 +129,14 @@ export interface EvalResult {
93
129
  * non-empty `critical_skipped` as "unknown", not as "clean".
94
130
  */
95
131
  critical_skipped?: string[];
132
+ /**
133
+ * Per-bundle breakdown, present only when eval_type is 'all'. Keyed by
134
+ * bundle; a bundle with no rules at all (nothing deployed under "custom"
135
+ * and no inline custom_rules) is absent rather than reported as
136
+ * insufficient. Response-only — not persisted as a column; the stored
137
+ * rule_results carry a `category` per rule so a reader can regroup.
138
+ */
139
+ categories?: Partial<Record<EvalType, EvalCategoryResult>>;
96
140
  }
97
141
  export type CustomRuleType = 'regex_match' | 'regex_no_match' | 'min_length' | 'max_length' | 'contains_keywords' | 'excludes_keywords' | 'json_schema' | 'cost_threshold';
98
142
  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.6.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",
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.6.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.6.0",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  },