@tangle-network/agent-eval 0.145.19 → 0.145.20

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.
@@ -1,102 +0,0 @@
1
- import { t as DefaultVerdict } from "./verdict-E4eRNf7-.js";
2
- //#region src/matrix/types.d.ts
3
- /** One axis = one dimension to iterate. `V` is the value type — pass any
4
- * substrate type (AgentProfile, Driver, Validator, rubric record). */
5
- interface MatrixAxis<V> {
6
- /** Axis name. Becomes the key in `MatrixResult.byAxis`. */
7
- name: string;
8
- /** Stable id per value. Used as the bucket key in aggregation. */
9
- values: Array<{
10
- id: string;
11
- value: V;
12
- }>;
13
- /** Optional bucket label override. Receives the same `(value, id)` the
14
- * runner stored on the cell; default label is `id`. */
15
- label?: (value: V, id: string) => string;
16
- }
17
- /** A cell carries one picked value from each axis, keyed by axis name. */
18
- interface MatrixCell {
19
- axes: Record<string, {
20
- id: string;
21
- value: unknown;
22
- }>;
23
- /** 0-based replicate index within the same axis combination. */
24
- rep: number;
25
- /** Stable sort key — preserves cartesian order across concurrent execution. */
26
- ordinal: number;
27
- }
28
- interface CellResult<Output> {
29
- output: Output;
30
- verdict: DefaultVerdict;
31
- costUsd: number;
32
- durationMs: number;
33
- runId?: string;
34
- /** Populated when `runCell` threw. The cell contributes 0 to passRate AND
35
- * meanScore regardless of `verdict`. */
36
- error?: {
37
- message: string;
38
- kind: string;
39
- };
40
- }
41
- interface AxisSummary {
42
- axisName: string;
43
- axisValue: string;
44
- cells: number;
45
- passRate: number;
46
- meanScore: number;
47
- p50Score: number;
48
- p90Score: number;
49
- totalCostUsd: number;
50
- meanDurationMs: number;
51
- }
52
- interface MatrixResult<Output> {
53
- cells: Array<{
54
- cell: MatrixCell;
55
- runs: CellResult<Output>[];
56
- }>;
57
- /** `byAxis[axisName][axisValueId] = summary`. Populated only for axes
58
- * named in `aggregateBy` (default = every axis in `axes`). */
59
- byAxis: Record<string, Record<string, AxisSummary>>;
60
- summary: {
61
- totalCells: number;
62
- runsExecuted: number;
63
- /** Cells removed by `filter` plus cells unscheduled after the cost
64
- * ceiling or abort signal tripped. */
65
- cellsSkipped: number;
66
- overallPassRate: number;
67
- overallMeanScore: number;
68
- totalCostUsd: number;
69
- durationMs: number;
70
- };
71
- /** Stable id-like string generated at the end of the run. */
72
- matrixId: string;
73
- }
74
- interface RunAgentMatrixOptions<Output> {
75
- axes: MatrixAxis<unknown>[];
76
- /** User-supplied cell executor. May throw; the matrix captures throws as
77
- * `CellResult.error` and continues. */
78
- runCell: (cell: MatrixCell) => Promise<CellResult<Output>>;
79
- /** Replicates per cell. Default 1. */
80
- reps?: number;
81
- /** Prune cells from the cartesian BEFORE rep expansion. */
82
- filter?: (cell: Omit<MatrixCell, 'rep' | 'ordinal'>) => boolean;
83
- /** Axes to aggregate into `byAxis`. Default: every axis in `axes`. */
84
- aggregateBy?: string[];
85
- /** Max concurrent in-flight `runCell` invocations. Default 4. */
86
- maxConcurrency?: number;
87
- /** Cumulative-cost abort threshold (USD). When the running sum of
88
- * `result.costUsd` crosses this value, no new cells are scheduled.
89
- * In-flight cells finish. Default `Infinity`. */
90
- costCeiling?: number;
91
- /** Fires once per executed cell, after its promise settles. */
92
- onCellComplete?: (cell: MatrixCell, result: CellResult<Output>) => void;
93
- /** External cancellation. Aborts in-flight cells via a forwarded signal
94
- * and suppresses scheduling of new ones. */
95
- signal?: AbortSignal;
96
- }
97
- //#endregion
98
- //#region src/matrix/runner.d.ts
99
- declare function runAgentMatrix<Output>(opts: RunAgentMatrixOptions<Output>): Promise<MatrixResult<Output>>;
100
- //#endregion
101
- export { MatrixCell as a, MatrixAxis as i, AxisSummary as n, MatrixResult as o, CellResult as r, RunAgentMatrixOptions as s, runAgentMatrix as t };
102
- //# sourceMappingURL=index-CvjYbU0D.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-CvjYbU0D.d.ts","names":[],"sources":["../src/matrix/types.ts","../src/matrix/runner.ts"],"mappings":";;;;UAgBiB,WAAW;;EAE1B;;EAEA,QAAQ;IAAQ;IAAY,OAAO;;;;EAGnC,SAAS,OAAO,GAAG;;;UAIJ;EACf,MAAM;IAAiB;IAAY;;;EAEnC;;EAEA;;UAGe,WAAW;EAC1B,QAAQ;EACR,SAAS;EACT;EACA;EACA;;;EAGA;IAAU;IAAiB;;;UAGZ;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe,aAAa;EAC5B,OAAO;IAAQ,MAAM;IAAY,MAAM,WAAW;;;;EAGlD,QAAQ,eAAe,eAAe;EACtC;IACE;IACA;;;IAGA;IACA;IACA;IACA;IACA;;;EAGF;;UAGe,sBAAsB;EACrC,MAAM;;;EAGN,UAAU,MAAM,eAAe,QAAQ,WAAW;;EAElD;;EAEA,UAAU,MAAM,KAAK;;EAErB;;EAEA;;;;EAIA;;EAEA,kBAAkB,MAAM,YAAY,QAAQ,WAAW;;;EAGvD,SAAS;;;;iBCjBW,eAAe,QACnC,MAAM,sBAAsB,UAC3B,QAAQ,aAAa"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"matrix-BzQnu2S6.js","names":[],"sources":["../src/matrix/aggregation.ts","../src/matrix/runner.ts"],"sourcesContent":["/**\n * Per-axis aggregation of cell runs into `AxisSummary` rows.\n *\n * Pure: consumes the final `cells: [{cell, runs}]` array and returns the\n * `byAxis` table. Error runs contribute 0 to passRate and meanScore. Cost\n * and duration always count — the budget was spent regardless.\n */\n\nimport type { AxisSummary, CellResult, MatrixAxis, MatrixCell, MatrixResult } from './types'\n\ninterface Row<Output> {\n cell: MatrixCell\n result: CellResult<Output>\n}\n\nfunction flattenRuns<Output>(cells: MatrixResult<Output>['cells']): Row<Output>[] {\n const rows: Row<Output>[] = []\n for (const { cell, runs } of cells) {\n for (const result of runs) rows.push({ cell, result })\n }\n return rows\n}\n\nfunction quantile(sorted: number[], q: number): number {\n if (sorted.length === 0) return 0\n if (sorted.length === 1) return sorted[0] as number\n const pos = (sorted.length - 1) * q\n const lo = Math.floor(pos)\n const hi = Math.ceil(pos)\n if (lo === hi) return sorted[lo] as number\n const frac = pos - lo\n return (sorted[lo] as number) * (1 - frac) + (sorted[hi] as number) * frac\n}\n\nexport function summariseRows<Output>(\n rows: Row<Output>[],\n axisName: string,\n axisValue: string,\n): AxisSummary {\n if (rows.length === 0) {\n return {\n axisName,\n axisValue,\n cells: 0,\n passRate: 0,\n meanScore: 0,\n p50Score: 0,\n p90Score: 0,\n totalCostUsd: 0,\n meanDurationMs: 0,\n }\n }\n let pass = 0\n let scoreSum = 0\n let costSum = 0\n let durSum = 0\n const scores: number[] = []\n for (const { result } of rows) {\n const errored = result.error !== undefined\n const score = errored ? 0 : result.verdict.score\n const valid = !errored && result.verdict.valid\n if (valid) pass++\n scoreSum += score\n scores.push(score)\n costSum += result.costUsd\n durSum += result.durationMs\n }\n scores.sort((a, b) => a - b)\n return {\n axisName,\n axisValue,\n cells: rows.length,\n passRate: pass / rows.length,\n meanScore: scoreSum / rows.length,\n p50Score: quantile(scores, 0.5),\n p90Score: quantile(scores, 0.9),\n totalCostUsd: costSum,\n meanDurationMs: durSum / rows.length,\n }\n}\n\nfunction bucketBy<Output>(\n rows: Row<Output>[],\n axisName: string,\n labelFor: (id: string) => string,\n): Record<string, AxisSummary> {\n const buckets = new Map<string, Row<Output>[]>()\n for (const row of rows) {\n const slot = row.cell.axes[axisName]\n if (!slot) continue\n const id = slot.id\n let arr = buckets.get(id)\n if (!arr) {\n arr = []\n buckets.set(id, arr)\n }\n arr.push(row)\n }\n const out: Record<string, AxisSummary> = {}\n // Sorted keys for deterministic JSON serialisation.\n for (const id of [...buckets.keys()].sort()) {\n out[id] = summariseRows(buckets.get(id) as Row<Output>[], axisName, labelFor(id))\n }\n return out\n}\n\nexport function buildByAxis<Output>(\n cells: MatrixResult<Output>['cells'],\n axes: MatrixAxis<unknown>[],\n aggregateBy: string[],\n): Record<string, Record<string, AxisSummary>> {\n const rows = flattenRuns(cells)\n const byName = new Map(axes.map((a) => [a.name, a]))\n const byAxis: Record<string, Record<string, AxisSummary>> = {}\n for (const name of aggregateBy) {\n const axis = byName.get(name)\n const labelFor = (id: string): string => {\n if (!axis?.label) return id\n const found = axis.values.find((v) => v.id === id)\n if (!found) return id\n return axis.label(found.value, id)\n }\n byAxis[name] = bucketBy(rows, name, labelFor)\n }\n return byAxis\n}\n","/**\n * N-axis cartesian runner.\n *\n * Expansion order: cartesian over `axes` in declared order, then `reps` as the\n * inner-most dim → `ordinal = (cartIdx * reps) + rep`. The returned\n * `cells[]` is sorted by `ordinal` so concurrent execution does not reorder\n * the output.\n *\n * Scheduling is a sliding window of in-flight promises capped at\n * `maxConcurrency`. The window stops admitting new cells when the cost\n * ceiling trips or the abort signal fires; in-flight cells finish.\n */\n\nimport { buildByAxis } from './aggregation'\nimport type {\n CellResult,\n MatrixAxis,\n MatrixCell,\n MatrixResult,\n RunAgentMatrixOptions,\n} from './types'\n\ninterface BaseCell {\n axes: Record<string, { id: string; value: unknown }>\n}\n\nfunction cartesian(axes: MatrixAxis<unknown>[]): BaseCell[] {\n // Empty axes (`values=[]`) collapse the whole product to zero cells. An\n // empty `axes` array yields a single empty-axes cell — degenerate but\n // valid (caller is iterating only reps).\n if (axes.length === 0) return [{ axes: {} }]\n for (const a of axes) if (a.values.length === 0) return []\n const out: BaseCell[] = []\n const idx = new Array(axes.length).fill(0)\n while (true) {\n const slot: Record<string, { id: string; value: unknown }> = {}\n for (let i = 0; i < axes.length; i++) {\n const axis = axes[i] as MatrixAxis<unknown>\n const v = axis.values[idx[i] as number] as { id: string; value: unknown }\n slot[axis.name] = { id: v.id, value: v.value }\n }\n out.push({ axes: slot })\n // Increment like an odometer, left-most axis is fastest.\n let i = 0\n while (i < axes.length) {\n const next = (idx[i] as number) + 1\n const axis = axes[i] as MatrixAxis<unknown>\n if (next < axis.values.length) {\n idx[i] = next\n break\n }\n idx[i] = 0\n i++\n }\n if (i === axes.length) break\n }\n return out\n}\n\nfunction makeMatrixId(): string {\n // Stable id-like string: time + 8 random hex chars. Avoids node:crypto\n // import to keep the matrix dep-free.\n const t = Date.now().toString(36)\n let r = ''\n for (let i = 0; i < 8; i++) r += Math.floor(Math.random() * 16).toString(16)\n return `mtx_${t}_${r}`\n}\n\nfunction makeErrorResult<Output>(err: unknown): CellResult<Output> {\n const e = err as { message?: string; name?: string }\n return {\n output: undefined as unknown as Output,\n verdict: { valid: false, score: 0 },\n costUsd: 0,\n durationMs: 0,\n error: {\n message: typeof e?.message === 'string' ? e.message : String(err),\n kind: typeof e?.name === 'string' ? e.name : 'Error',\n },\n }\n}\n\nexport async function runAgentMatrix<Output>(\n opts: RunAgentMatrixOptions<Output>,\n): Promise<MatrixResult<Output>> {\n const startedAt = Date.now()\n const reps = Math.max(1, opts.reps ?? 1)\n const maxConcurrency = Math.max(1, opts.maxConcurrency ?? 4)\n const costCeiling = opts.costCeiling ?? Number.POSITIVE_INFINITY\n const aggregateBy = opts.aggregateBy ?? opts.axes.map((a) => a.name)\n\n const base = cartesian(opts.axes)\n const filtered = opts.filter\n ? base.filter((c) => (opts.filter as (b: BaseCell) => boolean)(c))\n : base\n const filteredOut = base.length - filtered.length\n\n const planned: MatrixCell[] = []\n for (let i = 0; i < filtered.length; i++) {\n for (let r = 0; r < reps; r++) {\n planned.push({\n axes: (filtered[i] as BaseCell).axes,\n rep: r,\n ordinal: i * reps + r,\n })\n }\n }\n\n const cellRecords: Array<{ cell: MatrixCell; runs: CellResult<Output>[] }> = []\n let cumulativeCost = 0\n let costCeilingReached = false\n let runsExecuted = 0\n let cellsUnscheduled = 0\n\n const aborted = (): boolean => opts.signal?.aborted === true\n\n // Per-run abort controller forwards the external signal so cell executors\n // see cancellation. We don't expose it on `MatrixCell` — the signature on\n // `runCell` per the public API is `(cell) => Promise<...>`. Executors that\n // need cancellation use the external signal directly via closure.\n\n let inFlight = 0\n let cursor = 0\n let resolveAll: (() => void) | undefined\n const done = new Promise<void>((res) => {\n resolveAll = res\n })\n\n const pump = (): void => {\n while (inFlight < maxConcurrency && cursor < planned.length) {\n if (aborted() || costCeilingReached) {\n // Drain remaining as unscheduled.\n const left = planned.length - cursor\n cellsUnscheduled += left\n cursor = planned.length\n break\n }\n const cell = planned[cursor++] as MatrixCell\n inFlight++\n // Lazily allocate the record so cells appear in `cells[]` in any\n // arrival order; we sort by ordinal at the end.\n const record = { cell, runs: [] as CellResult<Output>[] }\n cellRecords.push(record)\n const promise: Promise<CellResult<Output>> = (async () => {\n try {\n return await opts.runCell(cell)\n } catch (err) {\n return makeErrorResult<Output>(err)\n }\n })()\n promise.then((result) => {\n record.runs.push(result)\n runsExecuted++\n cumulativeCost += result.costUsd\n if (cumulativeCost >= costCeiling && !costCeilingReached) {\n costCeilingReached = true\n // eslint-disable-next-line no-console\n console.warn('[matrix] cost ceiling reached')\n }\n try {\n opts.onCellComplete?.(cell, result)\n } catch {\n // onCellComplete is observational — swallow throws so a noisy\n // callback can't tank the run.\n }\n inFlight--\n if (cursor < planned.length) {\n pump()\n } else if (inFlight === 0) {\n resolveAll?.()\n }\n })\n }\n if (cursor >= planned.length && inFlight === 0) resolveAll?.()\n }\n\n const onAbort = (): void => {\n // External abort: stop scheduling. In-flight cells finish; their\n // executors observe `opts.signal.aborted` directly via closure.\n if (cursor < planned.length) {\n cellsUnscheduled += planned.length - cursor\n cursor = planned.length\n }\n if (inFlight === 0) resolveAll?.()\n }\n if (opts.signal) {\n if (opts.signal.aborted) {\n cellsUnscheduled = planned.length\n cursor = planned.length\n resolveAll?.()\n } else {\n opts.signal.addEventListener('abort', onAbort, { once: true })\n }\n }\n\n if (planned.length === 0) {\n resolveAll?.()\n } else {\n pump()\n }\n\n await done\n if (opts.signal) opts.signal.removeEventListener('abort', onAbort)\n\n cellRecords.sort((a, b) => a.cell.ordinal - b.cell.ordinal)\n\n let pass = 0\n let scoreSum = 0\n let totalCost = 0\n let runCount = 0\n for (const { runs } of cellRecords) {\n for (const r of runs) {\n runCount++\n const errored = r.error !== undefined\n if (!errored && r.verdict.valid) pass++\n scoreSum += errored ? 0 : r.verdict.score\n totalCost += r.costUsd\n }\n }\n\n const byAxis = buildByAxis(cellRecords, opts.axes, aggregateBy)\n\n return {\n cells: cellRecords,\n byAxis,\n summary: {\n totalCells: planned.length,\n runsExecuted,\n cellsSkipped: cellsUnscheduled + filteredOut * reps,\n overallPassRate: runCount === 0 ? 0 : pass / runCount,\n overallMeanScore: runCount === 0 ? 0 : scoreSum / runCount,\n totalCostUsd: totalCost,\n durationMs: Date.now() - startedAt,\n },\n matrixId: makeMatrixId(),\n }\n}\n"],"mappings":";AAeA,SAAS,YAAoB,OAAqD;CAChF,MAAM,OAAsB,CAAC;CAC7B,KAAK,MAAM,EAAE,MAAM,UAAU,OAC3B,KAAK,MAAM,UAAU,MAAM,KAAK,KAAK;EAAE;EAAM;CAAO,CAAC;CAEvD,OAAO;AACT;AAEA,SAAS,SAAS,QAAkB,GAAmB;CACrD,IAAI,OAAO,WAAW,GAAG,OAAO;CAChC,IAAI,OAAO,WAAW,GAAG,OAAO,OAAO;CACvC,MAAM,OAAO,OAAO,SAAS,KAAK;CAClC,MAAM,KAAK,KAAK,MAAM,GAAG;CACzB,MAAM,KAAK,KAAK,KAAK,GAAG;CACxB,IAAI,OAAO,IAAI,OAAO,OAAO;CAC7B,MAAM,OAAO,MAAM;CACnB,OAAQ,OAAO,OAAkB,IAAI,QAAS,OAAO,MAAiB;AACxE;AAEA,SAAgB,cACd,MACA,UACA,WACa;CACb,IAAI,KAAK,WAAW,GAClB,OAAO;EACL;EACA;EACA,OAAO;EACP,UAAU;EACV,WAAW;EACX,UAAU;EACV,UAAU;EACV,cAAc;EACd,gBAAgB;CAClB;CAEF,IAAI,OAAO;CACX,IAAI,WAAW;CACf,IAAI,UAAU;CACd,IAAI,SAAS;CACb,MAAM,SAAmB,CAAC;CAC1B,KAAK,MAAM,EAAE,YAAY,MAAM;EAC7B,MAAM,UAAU,OAAO,UAAU,KAAA;EACjC,MAAM,QAAQ,UAAU,IAAI,OAAO,QAAQ;EAE3C,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