@ls-stack/agent-eval 0.24.0 → 0.25.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/dist/runChild.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { B as runSummarySchema, Et as evalChartsConfigSchema, Qt as columnDefSchema, T as createRunRequestSchema, b as loadConfig, bn as configureEvalRunLogs, dt as evalStatsConfigSchema, t as executeRun, v as parseEvalMetas, w as createFsCacheStore, z as runManifestSchema } from "./runOrchestration-D697g6Qe.mjs";
1
+ import { B as runSummarySchema, T as createRunRequestSchema, Tn as configureEvalRunLogs, b as loadConfig, gt as evalStatsConfigSchema, jt as evalChartsConfigSchema, ot as buildEvalKey, r as getTargetEvals$1, rn as columnDefSchema, t as executeRun, v as parseEvalDiscovery, w as createFsCacheStore, z as runManifestSchema } from "./runOrchestration-B31SV_Bq.mjs";
2
2
  import { createHash } from "node:crypto";
3
3
  import { readFile } from "node:fs/promises";
4
4
  import { relative } from "node:path";
@@ -6,6 +6,7 @@ import { z } from "zod/v4";
6
6
  import { glob } from "glob";
7
7
  //#region ../runner/src/runChild.ts
8
8
  const evalMetaSchema = z.object({
9
+ key: z.string(),
9
10
  id: z.string(),
10
11
  title: z.string().optional(),
11
12
  filePath: z.string(),
@@ -36,8 +37,10 @@ function getConfiguredConcurrency(configConcurrency) {
36
37
  return Math.max(1, Math.floor(configConcurrency));
37
38
  }
38
39
  function getTargetEvals(params) {
39
- if (params.request.target.evalIds && params.request.target.evalIds.length > 0) return params.request.target.evalIds.map((id) => params.evals.get(id)).filter((entry) => entry !== void 0);
40
- return [...params.evals.values()].toSorted((a, b) => a.filePath.localeCompare(b.filePath));
40
+ return getTargetEvals$1({
41
+ evals: params.evals.values(),
42
+ request: params.request
43
+ });
41
44
  }
42
45
  function toWorkspaceRelativePath(params) {
43
46
  return relative(params.workspaceRoot, params.filePath).replaceAll("\\", "/");
@@ -55,21 +58,29 @@ async function discoverRunEvals(params) {
55
58
  for (const filePath of discovered) {
56
59
  const source = await readFile(filePath, "utf-8");
57
60
  const sourceFingerprint = getSourceFingerprint(source);
58
- const metas = parseEvalMetas(filePath, source);
59
- for (const meta of metas) evals.set(meta.id, {
60
- id: meta.id,
61
- title: meta.title,
62
- filePath: toWorkspaceRelativePath({
61
+ const metas = parseEvalDiscovery(filePath, source).metas;
62
+ for (const meta of metas) {
63
+ const relativeFilePath = toWorkspaceRelativePath({
63
64
  filePath: meta.filePath,
64
65
  workspaceRoot: params.workspaceRoot
65
- }),
66
- sourceFilePath: meta.filePath,
67
- sourceFingerprint,
68
- columnDefs: [],
69
- caseCount: null
70
- });
66
+ });
67
+ const key = buildEvalKey({
68
+ filePath: relativeFilePath,
69
+ evalId: meta.id
70
+ });
71
+ evals.set(key, {
72
+ key,
73
+ id: meta.id,
74
+ title: meta.title,
75
+ filePath: relativeFilePath,
76
+ sourceFilePath: meta.filePath,
77
+ sourceFingerprint,
78
+ columnDefs: [],
79
+ caseCount: null
80
+ });
81
+ }
71
82
  }
72
- return [...evals.values()].toSorted((a, b) => a.filePath.localeCompare(b.filePath));
83
+ return [...evals.values()].toSorted((a, b) => a.filePath.localeCompare(b.filePath) || a.id.localeCompare(b.id));
73
84
  }
74
85
  async function readContext(contextPath) {
75
86
  if (contextPath === void 0) throw new Error("Missing run child context path");
@@ -93,7 +104,7 @@ async function main() {
93
104
  config,
94
105
  workspaceRoot: context.workspaceRoot
95
106
  });
96
- const evals = new Map(evalMetas.map((evalMeta) => [evalMeta.id, evalMeta]));
107
+ const evals = new Map(evalMetas.map((evalMeta) => [evalMeta.key, evalMeta]));
97
108
  const lastRunStatusMap = /* @__PURE__ */ new Map();
98
109
  const latestRunInfoMap = /* @__PURE__ */ new Map();
99
110
  await executeRun({
@@ -108,7 +119,6 @@ async function main() {
108
119
  request: context.request,
109
120
  runDir: context.runDir,
110
121
  config,
111
- evals,
112
122
  cacheStore,
113
123
  lastRunStatusMap,
114
124
  latestRunInfoMap,
@@ -123,7 +133,7 @@ async function main() {
123
133
  workspaceRoot: context.workspaceRoot,
124
134
  getSourceFingerprint,
125
135
  getConfiguredConcurrency: () => getConfiguredConcurrency(config.concurrency),
126
- getSortedEvalMetas: () => [...evals.values()].toSorted((a, b) => a.filePath.localeCompare(b.filePath)),
136
+ getSortedEvalMetas: () => [...evals.values()].toSorted((a, b) => a.filePath.localeCompare(b.filePath) || a.id.localeCompare(b.id)),
127
137
  getTargetEvals: (request) => getTargetEvals({
128
138
  evals,
129
139
  request