@dawn-ai/evals 0.8.2 → 0.8.3

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/index.d.ts CHANGED
@@ -4,6 +4,6 @@ export { type LlmJudgeOptions, llmJudge } from "./llm-judge.js";
4
4
  export { resolveDataset } from "./resolve-dataset.js";
5
5
  export { type RunEvalOptions, runEval } from "./run-eval.js";
6
6
  export { type NormalizedScore, normalizeScore } from "./score.js";
7
- export { contains, custom, exactMatch, jsonEquals, regex, tokensUnder, toolCalled, } from "./scorers.js";
7
+ export { contains, custom, exactMatch, jsonEquals, memoryFresh, memoryIsolated, memoryRecalled, regex, tokensUnder, toolCalled, } from "./scorers.js";
8
8
  export type { CaseResult, CaseScore, Dataset, EvalCase, EvalDefinition, EvalReport, GatePolicy, GateResult, Score, ScoredReport, Scorer, ScorerAggregate, } from "./types.js";
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,KAAK,eAAe,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,KAAK,cAAc,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,EAAE,KAAK,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AACjE,OAAO,EACL,QAAQ,EACR,MAAM,EACN,UAAU,EACV,UAAU,EACV,KAAK,EACL,WAAW,EACX,UAAU,GACX,MAAM,cAAc,CAAA;AACrB,YAAY,EACV,UAAU,EACV,SAAS,EACT,OAAO,EACP,QAAQ,EACR,cAAc,EACd,UAAU,EACV,UAAU,EACV,UAAU,EACV,KAAK,EACL,YAAY,EACZ,MAAM,EACN,eAAe,GAChB,MAAM,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,KAAK,eAAe,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,KAAK,cAAc,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,EAAE,KAAK,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AACjE,OAAO,EACL,QAAQ,EACR,MAAM,EACN,UAAU,EACV,UAAU,EACV,WAAW,EACX,cAAc,EACd,cAAc,EACd,KAAK,EACL,WAAW,EACX,UAAU,GACX,MAAM,cAAc,CAAA;AACrB,YAAY,EACV,UAAU,EACV,SAAS,EACT,OAAO,EACP,QAAQ,EACR,cAAc,EACd,UAAU,EACV,UAAU,EACV,UAAU,EACV,KAAK,EACL,YAAY,EACZ,MAAM,EACN,eAAe,GAChB,MAAM,YAAY,CAAA"}
package/dist/index.js CHANGED
@@ -4,4 +4,4 @@ export { llmJudge } from "./llm-judge.js";
4
4
  export { resolveDataset } from "./resolve-dataset.js";
5
5
  export { runEval } from "./run-eval.js";
6
6
  export { normalizeScore } from "./score.js";
7
- export { contains, custom, exactMatch, jsonEquals, regex, tokensUnder, toolCalled, } from "./scorers.js";
7
+ export { contains, custom, exactMatch, jsonEquals, memoryFresh, memoryIsolated, memoryRecalled, regex, tokensUnder, toolCalled, } from "./scorers.js";
package/dist/scorers.d.ts CHANGED
@@ -26,4 +26,25 @@ export declare function custom(fn: (run: AgentRunResult, testCase: EvalCase) =>
26
26
  name?: string;
27
27
  threshold?: number;
28
28
  }): Scorer;
29
+ /**
30
+ * Score 1 if every id in `expectedIds` appears in at least one `recall` tool
31
+ * result string; score 0 with a reason listing missing ids.
32
+ */
33
+ export declare function memoryRecalled(expectedIds: string[], opts?: {
34
+ threshold?: number;
35
+ }): Scorer;
36
+ /**
37
+ * Score 1 if `run.finalMessage` contains `expectedValue` (freshness check —
38
+ * the newer value surfaced in the response); else 0.
39
+ */
40
+ export declare function memoryFresh(expectedValue: string, opts?: {
41
+ threshold?: number;
42
+ }): Scorer;
43
+ /**
44
+ * Score 1 if `forbidden` does NOT appear in any recall tool output or
45
+ * finalMessage (no cross-namespace leak); score 0 if it leaks.
46
+ */
47
+ export declare function memoryIsolated(forbidden: string, opts?: {
48
+ threshold?: number;
49
+ }): Scorer;
29
50
  //# sourceMappingURL=scorers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scorers.d.ts","sourceRoot":"","sources":["../src/scorers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAMzD,uDAAuD;AACvD,wBAAgB,UAAU,CAAC,IAAI,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAMhE;AAED,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAMjF;AAED,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAMvE;AAED,qFAAqF;AACrF,wBAAgB,UAAU,CAAC,IAAI,CAAC,EAAE;IAChC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,E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+78,62 @@ export function custom(fn, opts) {
78
78
  score: fn,
79
79
  };
80
80
  }
81
+ // ---------------------------------------------------------------------------
82
+ // Memory scorers
83
+ // ---------------------------------------------------------------------------
84
+ /** Returns the string content of all tool results whose name matches `toolName`. */
85
+ function recallOutputs(run, toolName) {
86
+ return run.toolResults
87
+ .filter((r) => r.name === toolName)
88
+ .map((r) => (typeof r.content === "string" ? r.content : JSON.stringify(r.content)));
89
+ }
90
+ /**
91
+ * Score 1 if every id in `expectedIds` appears in at least one `recall` tool
92
+ * result string; score 0 with a reason listing missing ids.
93
+ */
94
+ export function memoryRecalled(expectedIds, opts) {
95
+ return {
96
+ name: `memoryRecalled(${expectedIds.join(",")})`,
97
+ ...(opts?.threshold !== undefined ? { threshold: opts.threshold } : {}),
98
+ score: (run) => {
99
+ const outputs = recallOutputs(run, "recall");
100
+ const combined = outputs.join("\n");
101
+ const missing = expectedIds.filter((id) => !combined.includes(id));
102
+ if (missing.length === 0)
103
+ return 1;
104
+ return { score: 0, reason: `Missing memory ids: ${missing.join(", ")}` };
105
+ },
106
+ };
107
+ }
108
+ /**
109
+ * Score 1 if `run.finalMessage` contains `expectedValue` (freshness check —
110
+ * the newer value surfaced in the response); else 0.
111
+ */
112
+ export function memoryFresh(expectedValue, opts) {
113
+ return {
114
+ name: `memoryFresh(${expectedValue})`,
115
+ ...(opts?.threshold !== undefined ? { threshold: opts.threshold } : {}),
116
+ score: (run) => run.finalMessage.includes(expectedValue)
117
+ ? 1
118
+ : { score: 0, reason: `Expected "${expectedValue}" in finalMessage` },
119
+ };
120
+ }
121
+ /**
122
+ * Score 1 if `forbidden` does NOT appear in any recall tool output or
123
+ * finalMessage (no cross-namespace leak); score 0 if it leaks.
124
+ */
125
+ export function memoryIsolated(forbidden, opts) {
126
+ return {
127
+ name: `memoryIsolated(${forbidden})`,
128
+ ...(opts?.threshold !== undefined ? { threshold: opts.threshold } : {}),
129
+ score: (run) => {
130
+ const outputs = recallOutputs(run, "recall");
131
+ const leaksInRecall = outputs.some((o) => o.includes(forbidden));
132
+ const leaksInMessage = run.finalMessage.includes(forbidden);
133
+ if (leaksInRecall || leaksInMessage) {
134
+ return { score: 0, reason: `Cross-namespace leak: "${forbidden}" found in output` };
135
+ }
136
+ return 1;
137
+ },
138
+ };
139
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dawn-ai/evals",
3
- "version": "0.8.2",
3
+ "version": "0.8.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -30,12 +30,12 @@
30
30
  "access": "public"
31
31
  },
32
32
  "peerDependencies": {
33
- "@dawn-ai/testing": "0.8.2"
33
+ "@dawn-ai/testing": "0.8.3"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "25.6.0",
37
- "@dawn-ai/testing": "0.8.2",
38
- "@dawn-ai/config-typescript": "0.8.2"
37
+ "@dawn-ai/testing": "0.8.3",
38
+ "@dawn-ai/config-typescript": "0.8.3"
39
39
  },
40
40
  "scripts": {
41
41
  "build": "tsc -b tsconfig.json",