@cursor/july 0.1.15 → 0.1.17
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/README.md +9 -4
- package/dist/bin/agent-serve.js +60 -2
- package/dist/channels/slack/api.d.ts.map +1 -1
- package/dist/channels/slack/api.js +13 -3
- package/dist/channels/slack/auth.d.ts +7 -1
- package/dist/channels/slack/auth.d.ts.map +1 -1
- package/dist/channels/slack/auth.js +14 -0
- package/dist/channels/slack/blocks.d.ts +61 -0
- package/dist/channels/slack/blocks.d.ts.map +1 -0
- package/dist/channels/slack/blocks.js +90 -0
- package/dist/channels/slack/defaults.d.ts +2 -0
- package/dist/channels/slack/defaults.d.ts.map +1 -1
- package/dist/channels/slack/defaults.js +29 -3
- package/dist/channels/slack/dispatch.d.ts +3 -17
- package/dist/channels/slack/dispatch.d.ts.map +1 -1
- package/dist/channels/slack/index.d.ts +1 -0
- package/dist/channels/slack/index.d.ts.map +1 -1
- package/dist/channels/slack/index.js +1 -0
- package/dist/channels/slack/interactive.d.ts +39 -3
- package/dist/channels/slack/interactive.d.ts.map +1 -1
- package/dist/channels/slack/interactive.js +152 -7
- package/dist/channels/slack/manifest.d.ts +3 -0
- package/dist/channels/slack/manifest.d.ts.map +1 -1
- package/dist/channels/slack/manifest.js +3 -0
- package/dist/channels/slack/setup.d.ts +4 -1
- package/dist/channels/slack/setup.d.ts.map +1 -1
- package/dist/channels/slack/setup.js +16 -2
- package/dist/channels/slack/slack-channel.d.ts.map +1 -1
- package/dist/channels/slack/slack-channel.js +24 -3
- package/dist/channels/slack/types.d.ts +77 -0
- package/dist/channels/slack/types.d.ts.map +1 -1
- package/dist/connections.d.ts +4 -1
- package/dist/connections.d.ts.map +1 -1
- package/dist/connections.js +4 -1
- package/dist/docs/404.html +2 -2
- package/dist/docs/ab.html +3 -3
- package/dist/docs/assets/{app.DpdGZTLe.js → app.BbEXr2KO.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.DCBsrfwP.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.IB-0QqIT.js → VPLocalSearchBox.DBEi4HDp.js} +1 -1
- package/dist/docs/assets/chunks/{theme.-fYBoNtR.js → theme.DGfptcHw.js} +2 -2
- package/dist/docs/assets/{example-agents_index.md.BPXjUtRB.js → example-agents_index.md.D2PEVSXl.js} +2 -2
- package/dist/docs/assets/{example-agents_index.md.BPXjUtRB.lean.js → example-agents_index.md.D2PEVSXl.lean.js} +1 -1
- package/dist/docs/assets/example-agents_security-reviewer.md.BZSNycMf.js +19 -0
- package/dist/docs/assets/{example-agents_security-reviewer.md.CE9v-aKm.lean.js → example-agents_security-reviewer.md.BZSNycMf.lean.js} +1 -1
- package/dist/docs/assets/{guides_mcp-oauth.md.DqmEOQY1.js → guides_mcp-oauth.md.Dd8EgSem.js} +3 -2
- package/dist/docs/assets/{guides_mcp-oauth.md.DqmEOQY1.lean.js → guides_mcp-oauth.md.Dd8EgSem.lean.js} +1 -1
- package/dist/docs/assets/{guides_slack.md.FWale6Ip.js → guides_slack.md.D_xFKlnF.js} +1 -1
- package/dist/docs/assets/{reference_connections.md.CsSr3rDz.js → reference_connections.md.B9Q3TOve.js} +12 -5
- package/dist/docs/assets/{reference_connections.md.CsSr3rDz.lean.js → reference_connections.md.B9Q3TOve.lean.js} +1 -1
- package/dist/docs/building-with-agents.html +3 -3
- package/dist/docs/concepts.html +3 -3
- package/dist/docs/deployment.html +3 -3
- package/dist/docs/evals.html +3 -3
- package/dist/docs/example-agents/approval-buddy.html +3 -3
- package/dist/docs/example-agents/benny.html +3 -3
- package/dist/docs/example-agents/bugbot.html +3 -3
- package/dist/docs/example-agents/codebase-wiki.html +3 -3
- package/dist/docs/example-agents/codeowners-review.html +3 -3
- package/dist/docs/example-agents/concierge.html +3 -3
- package/dist/docs/example-agents/fsd.html +3 -3
- package/dist/docs/example-agents/index.html +5 -5
- package/dist/docs/example-agents/knowledge-base.html +3 -3
- package/dist/docs/example-agents/oncall.html +3 -3
- package/dist/docs/example-agents/security-reviewer.html +14 -14
- package/dist/docs/example-agents/slack-agent.html +3 -3
- package/dist/docs/example-agents/weather-agent.html +3 -3
- package/dist/docs/guides/agent-to-agent.html +3 -3
- package/dist/docs/guides/cloud-runtime.html +3 -3
- package/dist/docs/guides/github.html +3 -3
- package/dist/docs/guides/human-in-the-loop.html +3 -3
- package/dist/docs/guides/mcp-oauth.html +6 -5
- package/dist/docs/guides/slack.html +5 -5
- package/dist/docs/guides/webhooks.html +3 -3
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +3 -3
- package/dist/docs/index.html +3 -3
- package/dist/docs/quickstart.html +3 -3
- package/dist/docs/reference/agent-config.html +3 -3
- package/dist/docs/reference/channels.html +3 -3
- package/dist/docs/reference/cli.html +3 -3
- package/dist/docs/reference/connections.html +14 -7
- package/dist/docs/reference/hooks.html +3 -3
- package/dist/docs/reference/http-api.html +3 -3
- package/dist/docs/reference/instructions.html +3 -3
- package/dist/docs/reference/playground.html +3 -3
- package/dist/docs/reference/project-layout.html +3 -3
- package/dist/docs/reference/prompt.html +3 -3
- package/dist/docs/reference/schedules.html +3 -3
- package/dist/docs/reference/sessions.html +3 -3
- package/dist/docs/reference/skills.html +3 -3
- package/dist/docs/reference/subagents.html +3 -3
- package/dist/docs/reference/tools.html +3 -3
- package/dist/docs/scaffolding-agents.html +3 -3
- package/dist/docs/storage.html +3 -3
- package/dist/docs/troubleshooting.html +3 -3
- package/dist/evals/assertions.d.ts +190 -0
- package/dist/evals/assertions.d.ts.map +1 -0
- package/dist/evals/assertions.js +461 -0
- package/dist/evals/expect.d.ts +95 -0
- package/dist/evals/expect.d.ts.map +1 -0
- package/dist/evals/expect.js +194 -0
- package/dist/evals/judge.d.ts +133 -0
- package/dist/evals/judge.d.ts.map +1 -0
- package/dist/evals/judge.js +228 -0
- package/dist/evals/loaders.d.ts +51 -0
- package/dist/evals/loaders.d.ts.map +1 -0
- package/dist/evals/loaders.js +124 -0
- package/dist/evals/matchers.d.ts +95 -0
- package/dist/evals/matchers.d.ts.map +1 -0
- package/dist/evals/matchers.js +145 -0
- package/dist/evals/reporters.d.ts +70 -0
- package/dist/evals/reporters.d.ts.map +1 -0
- package/dist/evals/reporters.js +221 -0
- package/dist/evals/results.d.ts +103 -0
- package/dist/evals/results.d.ts.map +1 -0
- package/dist/evals/results.js +28 -0
- package/dist/evals/run-facts.d.ts +77 -0
- package/dist/evals/run-facts.d.ts.map +1 -0
- package/dist/evals/run-facts.js +187 -0
- package/dist/evals.d.ts +136 -31
- package/dist/evals.d.ts.map +1 -1
- package/dist/evals.js +76 -12
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/cli-ax.d.ts +27 -0
- package/dist/internal/cli-ax.d.ts.map +1 -1
- package/dist/internal/cli-ax.js +90 -12
- package/dist/internal/cli-mcp.d.ts +8 -0
- package/dist/internal/cli-mcp.d.ts.map +1 -1
- package/dist/internal/cli-mcp.js +98 -0
- package/dist/internal/cli-slack.d.ts +29 -1
- package/dist/internal/cli-slack.d.ts.map +1 -1
- package/dist/internal/cli-slack.js +777 -12
- package/dist/internal/deploy-client.d.ts +7 -0
- package/dist/internal/deploy-client.d.ts.map +1 -1
- package/dist/internal/deploy-client.js +9 -0
- package/dist/internal/discovery.d.ts.map +1 -1
- package/dist/internal/discovery.js +29 -9
- package/dist/internal/distribution.d.ts.map +1 -1
- package/dist/internal/distribution.js +2 -0
- package/dist/internal/eval-judge-model.d.ts +59 -0
- package/dist/internal/eval-judge-model.d.ts.map +1 -0
- package/dist/internal/eval-judge-model.js +131 -0
- package/dist/internal/eval-run-store.d.ts.map +1 -1
- package/dist/internal/eval-run-store.js +12 -20
- package/dist/internal/eval-runner.d.ts +31 -25
- package/dist/internal/eval-runner.d.ts.map +1 -1
- package/dist/internal/eval-runner.js +332 -128
- package/dist/internal/evals-client.d.ts.map +1 -1
- package/dist/internal/evals-client.js +7 -3
- package/dist/internal/local-env.d.ts +8 -0
- package/dist/internal/local-env.d.ts.map +1 -0
- package/dist/internal/local-env.js +47 -0
- package/dist/internal/playground/static.d.ts +3 -0
- package/dist/internal/playground/static.d.ts.map +1 -1
- package/dist/internal/playground/static.js +3 -0
- package/dist/internal/run-client.d.ts +15 -0
- package/dist/internal/run-client.d.ts.map +1 -1
- package/dist/internal/run-client.js +3 -2
- package/dist/internal/sdk-runner.d.ts +36 -1
- package/dist/internal/sdk-runner.d.ts.map +1 -1
- package/dist/internal/sdk-runner.js +65 -25
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +10 -1
- package/dist/internal/session-engine.d.ts +18 -5
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +72 -19
- package/dist/internal/slack-provision-client.d.ts +130 -0
- package/dist/internal/slack-provision-client.d.ts.map +1 -0
- package/dist/internal/slack-provision-client.js +284 -0
- package/dist/playground/assets/cursor-icons-16-f_W_ogc-.woff2 +0 -0
- package/dist/playground/assets/index-CidizGZv.css +1 -0
- package/dist/playground/assets/index-DNqirsrK.js +85 -0
- package/dist/playground/index.html +2 -2
- package/dist/types.d.ts +70 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +26 -0
- package/docs/example-agents/index.md +1 -1
- package/docs/example-agents/security-reviewer.md +23 -21
- package/docs/guides/mcp-oauth.md +10 -5
- package/docs/guides/slack.md +3 -2
- package/docs/reference/connections.md +28 -18
- package/package.json +20 -2
- package/skills/create-agent/SKILL.md +15 -7
- package/skills/debug/SKILL.md +3 -1
- package/skills/mcp-auth/SKILL.md +1 -1
- package/skills/setup-slack/SKILL.md +173 -11
- package/src/bin/agent-serve.ts +63 -2
- package/src/channels/slack/api.ts +16 -3
- package/src/channels/slack/auth.ts +16 -1
- package/src/channels/slack/blocks.ts +139 -0
- package/src/channels/slack/defaults.ts +32 -4
- package/src/channels/slack/dispatch.ts +3 -18
- package/src/channels/slack/index.ts +1 -0
- package/src/channels/slack/interactive.ts +183 -19
- package/src/channels/slack/manifest.ts +3 -0
- package/src/channels/slack/setup.ts +16 -2
- package/src/channels/slack/slack-channel.ts +37 -6
- package/src/channels/slack/types.ts +89 -0
- package/src/connections.ts +4 -1
- package/src/evals/assertions.ts +704 -0
- package/src/evals/expect.ts +272 -0
- package/src/evals/judge.ts +346 -0
- package/src/evals/loaders.ts +113 -0
- package/src/evals/matchers.ts +246 -0
- package/src/evals/reporters.ts +274 -0
- package/src/evals/results.ts +132 -0
- package/src/evals/run-facts.ts +274 -0
- package/src/evals.ts +249 -42
- package/src/index.ts +2 -0
- package/src/internal/cli-ax.ts +134 -15
- package/src/internal/cli-mcp.ts +118 -5
- package/src/internal/cli-slack.ts +993 -15
- package/src/internal/deploy-client.ts +10 -0
- package/src/internal/discovery.ts +31 -5
- package/src/internal/distribution.ts +2 -0
- package/src/internal/eval-judge-model.ts +148 -0
- package/src/internal/eval-run-store.ts +10 -14
- package/src/internal/eval-runner.ts +466 -215
- package/src/internal/evals-client.ts +14 -2
- package/src/internal/local-env.ts +53 -0
- package/src/internal/playground/static.ts +3 -0
- package/src/internal/run-client.ts +17 -1
- package/src/internal/sdk-runner.ts +103 -22
- package/src/internal/server.ts +10 -0
- package/src/internal/session-engine.ts +89 -21
- package/src/internal/slack-provision-client.ts +438 -0
- package/src/types.ts +92 -4
- package/dist/channels/slack/post-update-delivery.d.ts +0 -85
- package/dist/channels/slack/post-update-delivery.d.ts.map +0 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.D2d8CfFS.js +0 -1
- package/dist/docs/assets/example-agents_security-reviewer.md.CE9v-aKm.js +0 -19
- package/dist/internal/json-dir-store.d.ts +0 -32
- package/dist/internal/json-dir-store.d.ts.map +0 -1
- package/dist/internal/persistence-coordinator.d.ts +0 -127
- package/dist/internal/persistence-coordinator.d.ts.map +0 -1
- package/dist/persistence.d.ts +0 -184
- package/dist/persistence.d.ts.map +0 -1
- package/dist/playground/assets/cursor-icons-16-CQ50JpfO.woff2 +0 -0
- package/dist/playground/assets/index-BVMOoiek.js +0 -86
- package/dist/playground/assets/index-DYmP4b--.css +0 -1
- /package/dist/docs/assets/{guides_slack.md.FWale6Ip.lean.js → guides_slack.md.D_xFKlnF.lean.js} +0 -0
|
@@ -19,8 +19,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
19
19
|
import { readdir } from "node:fs/promises";
|
|
20
20
|
import { join, relative, resolve } from "node:path";
|
|
21
21
|
import { pathToFileURL } from "node:url";
|
|
22
|
-
import {
|
|
22
|
+
import { computeVerdict, createAssertions, EvalAssertionRecorder, EvalRequireFailure, EvalSkipSignal, } from "../evals/assertions.js";
|
|
23
|
+
import { evaluateExpectation } from "../evals/expect.js";
|
|
24
|
+
import { EVAL_JUDGE_GRADERS, EvalJudgeUnavailableError, renderSubmission, } from "../evals/judge.js";
|
|
25
|
+
import { EVAL_ROOT_ENV } from "../evals/loaders.js";
|
|
26
|
+
import { combineReporters } from "../evals/reporters.js";
|
|
27
|
+
import { summarizeEvalResults } from "../evals/results.js";
|
|
28
|
+
import { EVAL_MAX_CONCURRENCY_LIMIT, expandEvalDefinition, expandSummarySuiteSelection, isEvalSummaryCase, matchesEvalIdFilter, normalizeEvalMaxConcurrency, } from "../evals.js";
|
|
23
29
|
import { isDefinitionOfKind } from "./brand.js";
|
|
30
|
+
import { callJudgeModel, EVAL_JUDGE_MODEL_ENV, resolveJudgeModel, } from "./eval-judge-model.js";
|
|
24
31
|
import { mapPool } from "./map-pool.js";
|
|
25
32
|
import { RunSessionTimeoutError, runSession } from "./run-client.js";
|
|
26
33
|
import { buildTrajectory } from "./trajectory.js";
|
|
@@ -69,6 +76,10 @@ export function discoverEvals(projectRoot_1) {
|
|
|
69
76
|
const files = yield listEvalFiles(evalsDir);
|
|
70
77
|
const evals = [];
|
|
71
78
|
let config = {};
|
|
79
|
+
// Fixture loaders resolve relative paths against the app root, so a dataset
|
|
80
|
+
// path reads the same however deep the eval file sits and whatever cwd the
|
|
81
|
+
// CLI ran from.
|
|
82
|
+
process.env[EVAL_ROOT_ENV] = root;
|
|
72
83
|
for (const abs of files) {
|
|
73
84
|
const rel = relative(evalsDir, abs).replace(/\\/g, "/");
|
|
74
85
|
if (rel === "evals.config.ts" || rel === "evals.config.js") {
|
|
@@ -82,13 +93,9 @@ export function discoverEvals(projectRoot_1) {
|
|
|
82
93
|
continue;
|
|
83
94
|
}
|
|
84
95
|
const mod = yield importModule(abs);
|
|
85
|
-
const def = mod.default;
|
|
86
|
-
if (!isDefinitionOfKind(def, "eval")) {
|
|
87
|
-
throw new Error(`${rel}: default export must be defineEval({ ... })`);
|
|
88
|
-
}
|
|
89
96
|
const fileId = rel.replace(/\.eval\.(ts|js)$/, "").replace(/\/index$/, "");
|
|
90
97
|
try {
|
|
91
|
-
for (const expanded of
|
|
98
|
+
for (const expanded of expandEvalModule(fileId, mod.default)) {
|
|
92
99
|
evals.push({
|
|
93
100
|
id: expanded.id,
|
|
94
101
|
fileId,
|
|
@@ -105,6 +112,32 @@ export function discoverEvals(projectRoot_1) {
|
|
|
105
112
|
return { evals, config };
|
|
106
113
|
});
|
|
107
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* Expand one eval module's default export into runnable datapoints.
|
|
117
|
+
*
|
|
118
|
+
* A file normally exports a single `defineEval(...)`. It may instead export an
|
|
119
|
+
* **array** of them to fan out over a dataset, in which case ids come from the
|
|
120
|
+
* file name plus a zero-padded index in array order (`sql/0000`, `sql/0001`, …).
|
|
121
|
+
* Prefer `cases` when the datapoints are hand-written and deserve stable names;
|
|
122
|
+
* the array form is for generated datasets where the index *is* the name.
|
|
123
|
+
*/
|
|
124
|
+
export function expandEvalModule(fileId, defaultExport) {
|
|
125
|
+
if (Array.isArray(defaultExport)) {
|
|
126
|
+
if (defaultExport.length === 0) {
|
|
127
|
+
throw new Error("default export array is empty; export at least one defineEval({ ... })");
|
|
128
|
+
}
|
|
129
|
+
return defaultExport.flatMap((entry, index) => {
|
|
130
|
+
if (!isDefinitionOfKind(entry, "eval")) {
|
|
131
|
+
throw new Error(`default export array entry ${index} must be defineEval({ ... })`);
|
|
132
|
+
}
|
|
133
|
+
return expandEvalDefinition(`${fileId}/${String(index).padStart(4, "0")}`, entry);
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
if (!isDefinitionOfKind(defaultExport, "eval")) {
|
|
137
|
+
throw new Error("default export must be defineEval({ ... }) or an array of them");
|
|
138
|
+
}
|
|
139
|
+
return expandEvalDefinition(fileId, defaultExport);
|
|
140
|
+
}
|
|
108
141
|
/** Apply id/tag filters used by CLI, playground, and `runDiscoveredEvals`. */
|
|
109
142
|
export function filterDiscoveredEvals(evals, options = {}) {
|
|
110
143
|
let selected = evals;
|
|
@@ -114,11 +147,12 @@ export function filterDiscoveredEvals(evals, options = {}) {
|
|
|
114
147
|
if (options.tags !== undefined && options.tags.length > 0) {
|
|
115
148
|
selected = selected.filter((e) => { var _a; return ((_a = e.definition.tags) !== null && _a !== void 0 ? _a : []).some((t) => options.tags.includes(t)); });
|
|
116
149
|
}
|
|
117
|
-
|
|
150
|
+
// Suite aggregators (`summary` tag) need sibling cases from the same file.
|
|
151
|
+
return expandSummarySuiteSelection(evals, selected, (e) => isEvalSummaryCase(e.definition.tags));
|
|
118
152
|
}
|
|
119
153
|
export function runDiscoveredEvals(options) {
|
|
120
154
|
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
-
var _a, _b, _c;
|
|
155
|
+
var _a, _b, _c, _d;
|
|
122
156
|
let selected;
|
|
123
157
|
let config;
|
|
124
158
|
if (options.discovered !== undefined) {
|
|
@@ -137,14 +171,20 @@ export function runDiscoveredEvals(options) {
|
|
|
137
171
|
if (selected.length === 0) {
|
|
138
172
|
return [];
|
|
139
173
|
}
|
|
140
|
-
const maxConcurrency =
|
|
174
|
+
const maxConcurrency = options.maxConcurrency === undefined
|
|
175
|
+
? resolveEvalMaxConcurrency(config)
|
|
176
|
+
: normalizeEvalMaxConcurrency(options.maxConcurrency);
|
|
141
177
|
const defaultTimeoutMs = (_c = (_b = options.timeoutMs) !== null && _b !== void 0 ? _b : config.timeoutMs) !== null && _c !== void 0 ? _c : 180000;
|
|
178
|
+
const reporter = buildReporterHub(options, config, selected);
|
|
179
|
+
const startedAt = new Date().toISOString();
|
|
180
|
+
yield reporter === null || reporter === void 0 ? void 0 : reporter.runStart(selected, (_d = options.target) !== null && _d !== void 0 ? _d : { baseUrl: options.baseUrl, mode: "local" });
|
|
142
181
|
// Iterations of the same authored datapoint share one concurrency slot and
|
|
143
182
|
// run sequentially. maxConcurrency is therefore the max number of distinct
|
|
144
183
|
// datapoints in flight, not datapoints × iterations.
|
|
145
184
|
const groups = groupEvalsForIterationSchedule(selected);
|
|
146
185
|
const nested = yield mapPool(groups, maxConcurrency, (group) => __awaiter(this, void 0, void 0, function* () {
|
|
147
|
-
var _a, _b, _c;
|
|
186
|
+
var _a, _b, _c, _d;
|
|
187
|
+
var _e;
|
|
148
188
|
const results = [];
|
|
149
189
|
for (const discovered of group) {
|
|
150
190
|
if ((_a = options.signal) === null || _a === void 0 ? void 0 : _a.aborted) {
|
|
@@ -161,20 +201,92 @@ export function runDiscoveredEvals(options) {
|
|
|
161
201
|
headers: options.headers,
|
|
162
202
|
verbose: Boolean(options.verbose),
|
|
163
203
|
signal: options.signal,
|
|
204
|
+
judge: {
|
|
205
|
+
configModel: (_c = config.judge) === null || _c === void 0 ? void 0 : _c.model,
|
|
206
|
+
caller: (_e = options.judgeCaller) !== null && _e !== void 0 ? _e : callJudgeModel,
|
|
207
|
+
},
|
|
164
208
|
onEvent: (event) => {
|
|
165
209
|
var _a, _b;
|
|
166
210
|
(_a = options.onCaseEvent) === null || _a === void 0 ? void 0 : _a.call(options, discovered.id, event);
|
|
167
211
|
(_b = options.onEvent) === null || _b === void 0 ? void 0 : _b.call(options, event);
|
|
168
212
|
},
|
|
169
213
|
});
|
|
170
|
-
(
|
|
214
|
+
(_d = options.onCaseDone) === null || _d === void 0 ? void 0 : _d.call(options, result);
|
|
215
|
+
yield reporter === null || reporter === void 0 ? void 0 : reporter.caseComplete(discovered, result);
|
|
171
216
|
results.push(result);
|
|
172
217
|
}
|
|
173
218
|
return results;
|
|
174
219
|
}), { signal: options.signal });
|
|
175
|
-
|
|
220
|
+
const results = nested.flat();
|
|
221
|
+
yield reporter === null || reporter === void 0 ? void 0 : reporter.runComplete(summarizeEvalResults(results, {
|
|
222
|
+
strict: options.strict === true,
|
|
223
|
+
startedAt,
|
|
224
|
+
finishedAt: new Date().toISOString(),
|
|
225
|
+
}));
|
|
226
|
+
return results;
|
|
176
227
|
});
|
|
177
228
|
}
|
|
229
|
+
/**
|
|
230
|
+
* Fan results out to the reporters that observe them.
|
|
231
|
+
*
|
|
232
|
+
* Run-wide reporters (CLI flags plus `evals.config.ts`) see every case; an
|
|
233
|
+
* eval's own `reporters` only see that eval. The run lifecycle hooks fire on
|
|
234
|
+
* every reporter in the run, so a per-eval destination still gets its
|
|
235
|
+
* `onRunStart` / `onRunComplete` pair.
|
|
236
|
+
*/
|
|
237
|
+
function buildReporterHub(options, config, selected) {
|
|
238
|
+
var _a, _b;
|
|
239
|
+
const skip = options.skipReport === true;
|
|
240
|
+
const runWide = [
|
|
241
|
+
...((_a = options.reporters) !== null && _a !== void 0 ? _a : []),
|
|
242
|
+
...(skip ? [] : ((_b = config.reporters) !== null && _b !== void 0 ? _b : [])),
|
|
243
|
+
];
|
|
244
|
+
const perEval = skip
|
|
245
|
+
? []
|
|
246
|
+
: selected.flatMap((e) => { var _a; return (_a = e.definition.reporters) !== null && _a !== void 0 ? _a : []; });
|
|
247
|
+
const everyReporter = [...new Set([...runWide, ...perEval])];
|
|
248
|
+
if (everyReporter.length === 0) {
|
|
249
|
+
return undefined;
|
|
250
|
+
}
|
|
251
|
+
const onError = (error) => {
|
|
252
|
+
// A broken destination must not fail the eval run itself.
|
|
253
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
254
|
+
process.stderr.write(`eval reporter error: ${detail}\n`);
|
|
255
|
+
};
|
|
256
|
+
const all = combineReporters(everyReporter, onError);
|
|
257
|
+
return {
|
|
258
|
+
runStart(evals, target) {
|
|
259
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
260
|
+
var _a;
|
|
261
|
+
yield (_a = all.onRunStart) === null || _a === void 0 ? void 0 : _a.call(all, evals.map((e) => ({
|
|
262
|
+
id: e.id,
|
|
263
|
+
fileId: e.fileId,
|
|
264
|
+
description: e.definition.description,
|
|
265
|
+
tags: e.definition.tags,
|
|
266
|
+
})), target);
|
|
267
|
+
});
|
|
268
|
+
},
|
|
269
|
+
caseComplete(discovered, result) {
|
|
270
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
271
|
+
var _a, _b;
|
|
272
|
+
var _c;
|
|
273
|
+
const observers = [
|
|
274
|
+
...new Set([
|
|
275
|
+
...runWide,
|
|
276
|
+
...(skip ? [] : ((_c = discovered.definition.reporters) !== null && _c !== void 0 ? _c : [])),
|
|
277
|
+
]),
|
|
278
|
+
];
|
|
279
|
+
yield (_b = (_a = combineReporters(observers, onError)).onEvalComplete) === null || _b === void 0 ? void 0 : _b.call(_a, result);
|
|
280
|
+
});
|
|
281
|
+
},
|
|
282
|
+
runComplete(summary) {
|
|
283
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
284
|
+
var _a;
|
|
285
|
+
yield (_a = all.onRunComplete) === null || _a === void 0 ? void 0 : _a.call(all, summary);
|
|
286
|
+
});
|
|
287
|
+
},
|
|
288
|
+
};
|
|
289
|
+
}
|
|
178
290
|
/**
|
|
179
291
|
* Schedule key for {@link groupEvalsForIterationSchedule}: iteration siblings
|
|
180
292
|
* (`weather/nyc/1`…`/3`) share a key; single-iteration ids keep their full id.
|
|
@@ -224,34 +336,58 @@ function resolveEvalMaxConcurrency(config) {
|
|
|
224
336
|
}
|
|
225
337
|
function runOneEval(discovered, opts) {
|
|
226
338
|
return __awaiter(this, void 0, void 0, function* () {
|
|
227
|
-
var _a;
|
|
228
|
-
var
|
|
339
|
+
var _a, _b;
|
|
340
|
+
var _c;
|
|
229
341
|
const logs = [];
|
|
230
342
|
const metrics = {};
|
|
231
|
-
const
|
|
343
|
+
const recorder = new EvalAssertionRecorder();
|
|
232
344
|
const def = discovered.definition;
|
|
233
|
-
const timeoutMs = (
|
|
345
|
+
const timeoutMs = (_c = def.timeoutMs) !== null && _c !== void 0 ? _c : opts.defaultTimeoutMs;
|
|
234
346
|
const startedAt = Date.now();
|
|
235
347
|
let sessionId;
|
|
236
348
|
let continuationToken;
|
|
349
|
+
// The session stream replays from an index and the client stops at the first
|
|
350
|
+
// terminal event, so each send must resume after the previous turn's last
|
|
351
|
+
// event or it would re-read that turn instead of the new one.
|
|
352
|
+
let nextEventIndex = 0;
|
|
237
353
|
const allEvents = [];
|
|
238
354
|
const inputs = [];
|
|
355
|
+
const turns = [];
|
|
239
356
|
let reply = null;
|
|
240
|
-
if ((_a = opts.signal) === null || _a === void 0 ? void 0 : _a.aborted) {
|
|
241
|
-
return Object.assign(Object.assign({ id: discovered.id, path: discovered.path }, (def.description === undefined
|
|
242
|
-
? {}
|
|
243
|
-
: { description: def.description })), { ok: false, assertions, error: "cancelled", logs,
|
|
244
|
-
metrics,
|
|
245
|
-
inputs, toolCalls: [], tools: [], durationMs: Date.now() - startedAt });
|
|
246
|
-
}
|
|
247
|
-
const record = (name, passed, detail) => {
|
|
248
|
-
assertions.push(Object.assign({ name,
|
|
249
|
-
passed }, (detail === undefined ? {} : { detail })));
|
|
250
|
-
};
|
|
251
357
|
const toolsUsed = () => buildTrajectory(allEvents).turns.flatMap((t) => t.toolCalls.map((c) => c.toolName));
|
|
252
358
|
const toolCallIo = () => buildTrajectory(allEvents).turns.flatMap((turn) => turn.toolCalls.map((c) => (Object.assign(Object.assign(Object.assign({ toolName: c.toolName }, (c.args === undefined ? {} : { args: c.args })), (c.output === undefined ? {} : { output: c.output })), { isError: c.isError }))));
|
|
253
|
-
const
|
|
254
|
-
|
|
359
|
+
const finish = (extra) => (Object.assign(Object.assign(Object.assign(Object.assign({ id: discovered.id, path: discovered.path }, (def.description === undefined ? {} : { description: def.description })), { ok: extra.ok, verdict: extra.verdict, skipReason: extra.skipReason, assertions: recorder.results(), error: extra.error, logs,
|
|
360
|
+
metrics, metadata: def.metadata, tags: def.tags, inputs, toolCalls: toolCallIo() }), (sessionId === undefined ? {} : { sessionId })), { finalText: extra.finalText, tools: toolsUsed(), durationMs: Date.now() - startedAt }));
|
|
361
|
+
if ((_a = opts.signal) === null || _a === void 0 ? void 0 : _a.aborted) {
|
|
362
|
+
return finish({ verdict: "failed", ok: false, error: "cancelled" });
|
|
363
|
+
}
|
|
364
|
+
// A judge that cannot reach a model must not look like a quality regression:
|
|
365
|
+
// the case is skipped visibly instead.
|
|
366
|
+
let judgeUnavailable;
|
|
367
|
+
const timeout = new AbortController();
|
|
368
|
+
const timer = setTimeout(() => timeout.abort(), clampTimerDelay(timeoutMs));
|
|
369
|
+
// A pending case timer must not hold the process open on its own.
|
|
370
|
+
(_b = timer.unref) === null || _b === void 0 ? void 0 : _b.call(timer);
|
|
371
|
+
const runAssertions = createAssertions({
|
|
372
|
+
recorder,
|
|
373
|
+
events: () => allEvents,
|
|
374
|
+
});
|
|
375
|
+
const judge = createJudgeSurface({
|
|
376
|
+
recorder,
|
|
377
|
+
grader: (name) => EVAL_JUDGE_GRADERS[name],
|
|
378
|
+
resolveModel: (callModel) => { var _a; return resolveJudgeModel({
|
|
379
|
+
call: callModel,
|
|
380
|
+
evalLevel: (_a = def.judge) === null || _a === void 0 ? void 0 : _a.model,
|
|
381
|
+
config: opts.judge.configModel,
|
|
382
|
+
env: process.env[EVAL_JUDGE_MODEL_ENV],
|
|
383
|
+
}); },
|
|
384
|
+
caller: opts.judge.caller,
|
|
385
|
+
defaultValue: () => reply,
|
|
386
|
+
onUnavailable: (message) => {
|
|
387
|
+
judgeUnavailable = judgeUnavailable !== null && judgeUnavailable !== void 0 ? judgeUnavailable : message;
|
|
388
|
+
},
|
|
389
|
+
});
|
|
390
|
+
const t = Object.assign(Object.assign({}, runAssertions), { get reply() {
|
|
255
391
|
return reply;
|
|
256
392
|
},
|
|
257
393
|
get sessionId() {
|
|
@@ -260,6 +396,9 @@ function runOneEval(discovered, opts) {
|
|
|
260
396
|
get events() {
|
|
261
397
|
return allEvents;
|
|
262
398
|
},
|
|
399
|
+
get turns() {
|
|
400
|
+
return turns;
|
|
401
|
+
},
|
|
263
402
|
get iteration() {
|
|
264
403
|
var _a;
|
|
265
404
|
return (_a = def.iteration) !== null && _a !== void 0 ? _a : 1;
|
|
@@ -268,14 +407,20 @@ function runOneEval(discovered, opts) {
|
|
|
268
407
|
var _a;
|
|
269
408
|
return (_a = def.iterations) !== null && _a !== void 0 ? _a : 1;
|
|
270
409
|
},
|
|
410
|
+
get signal() {
|
|
411
|
+
return timeout.signal;
|
|
412
|
+
},
|
|
413
|
+
judge,
|
|
271
414
|
send(message_1) {
|
|
272
415
|
return __awaiter(this, arguments, void 0, function* (message, options = {}) {
|
|
416
|
+
var _a;
|
|
273
417
|
inputs.push(message);
|
|
274
418
|
const result = yield runSession({
|
|
275
419
|
baseUrl: opts.baseUrl,
|
|
276
420
|
messages: [message],
|
|
277
421
|
sessionId,
|
|
278
422
|
continuationToken,
|
|
423
|
+
startIndex: nextEventIndex,
|
|
279
424
|
// Keep defineEval traffic out of live defineAB enrollment/metrics.
|
|
280
425
|
purpose: "eval",
|
|
281
426
|
bearerToken: opts.bearerToken,
|
|
@@ -289,39 +434,50 @@ function runOneEval(discovered, opts) {
|
|
|
289
434
|
});
|
|
290
435
|
sessionId = result.sessionId;
|
|
291
436
|
continuationToken = result.continuationToken;
|
|
437
|
+
nextEventIndex = (_a = result.nextEventIndex) !== null && _a !== void 0 ? _a : nextEventIndex;
|
|
292
438
|
allEvents.push(...result.events);
|
|
293
439
|
if (result.trajectory.finalText !== "") {
|
|
294
440
|
reply = result.trajectory.finalText;
|
|
295
441
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
442
|
+
const index = turns.length + 1;
|
|
443
|
+
// The turn is immutable, so its assertions read a frozen event slice
|
|
444
|
+
// even after later turns append to the run.
|
|
445
|
+
const turnEvents = [...result.events];
|
|
446
|
+
const turn = Object.assign(Object.assign({}, createAssertions({
|
|
447
|
+
recorder,
|
|
448
|
+
events: () => turnEvents,
|
|
449
|
+
scope: `turn[${index}]`,
|
|
450
|
+
})), { message: result.trajectory.finalText, sessionId: result.sessionId, events: turnEvents, toolCalls: result.trajectory.turns.flatMap((turn) => turn.toolCalls.map((c) => c.toolName)), ok: result.ok, index,
|
|
451
|
+
expectOk() {
|
|
452
|
+
var _a;
|
|
453
|
+
var _b;
|
|
454
|
+
if (!result.ok) {
|
|
455
|
+
throw new Error(`turn[${index}] failed: ${(_b = (_a = result.trajectory.turns.find((x) => x.failed)) === null || _a === void 0 ? void 0 : _a.error) !== null && _b !== void 0 ? _b : "unknown error"}`);
|
|
456
|
+
}
|
|
457
|
+
return turn;
|
|
458
|
+
} });
|
|
459
|
+
turns.push(turn);
|
|
460
|
+
return turn;
|
|
303
461
|
});
|
|
304
462
|
},
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
record(`messageIncludes(${String(token)})`, passed, passed ? undefined : `reply=${JSON.stringify(text.slice(0, 120))}`);
|
|
463
|
+
require(value, assertion) {
|
|
464
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
465
|
+
const outcome = evaluateExpectation(value, assertion);
|
|
466
|
+
recorder.record({
|
|
467
|
+
name: `require(${assertion.kind})`,
|
|
468
|
+
passed: outcome.passed,
|
|
469
|
+
detail: outcome.detail,
|
|
470
|
+
score: outcome.score,
|
|
471
|
+
severity: "gate",
|
|
472
|
+
});
|
|
473
|
+
if (!outcome.passed) {
|
|
474
|
+
throw new EvalRequireFailure(`require(${assertion.kind})`);
|
|
475
|
+
}
|
|
476
|
+
return value;
|
|
477
|
+
});
|
|
321
478
|
},
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
record(`check(${assertion.kind})`, passed, detail);
|
|
479
|
+
skip(reason) {
|
|
480
|
+
throw new EvalSkipSignal(reason);
|
|
325
481
|
},
|
|
326
482
|
log(message) {
|
|
327
483
|
logs.push(message);
|
|
@@ -338,90 +494,138 @@ function runOneEval(discovered, opts) {
|
|
|
338
494
|
if (opts.verbose) {
|
|
339
495
|
process.stderr.write(` metric ${key}=${String(value)}\n`);
|
|
340
496
|
}
|
|
341
|
-
}
|
|
342
|
-
};
|
|
497
|
+
} });
|
|
343
498
|
try {
|
|
344
499
|
yield def.test(t);
|
|
345
500
|
}
|
|
346
501
|
catch (error) {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
502
|
+
if (error instanceof EvalSkipSignal) {
|
|
503
|
+
clearTimeout(timer);
|
|
504
|
+
return finish({
|
|
505
|
+
verdict: "skipped",
|
|
506
|
+
ok: true,
|
|
507
|
+
skipReason: error.reason,
|
|
508
|
+
finalText: reply !== null && reply !== void 0 ? reply : undefined,
|
|
509
|
+
});
|
|
350
510
|
}
|
|
351
|
-
|
|
352
|
-
?
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
511
|
+
if (!(error instanceof EvalRequireFailure)) {
|
|
512
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
513
|
+
if (error instanceof RunSessionTimeoutError && sessionId === undefined) {
|
|
514
|
+
sessionId = error.sessionId;
|
|
515
|
+
}
|
|
516
|
+
yield recorder.waitForPending().catch(() => undefined);
|
|
517
|
+
clearTimeout(timer);
|
|
518
|
+
return finish({
|
|
519
|
+
verdict: "failed",
|
|
520
|
+
ok: false,
|
|
521
|
+
error: message,
|
|
522
|
+
finalText: reply !== null && reply !== void 0 ? reply : undefined,
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
// `require` already recorded the failing gate; fall through so the verdict
|
|
526
|
+
// comes from the assertions rather than a duplicate execution error.
|
|
356
527
|
}
|
|
528
|
+
yield recorder.waitForPending();
|
|
529
|
+
clearTimeout(timer);
|
|
530
|
+
const assertions = recorder.results();
|
|
357
531
|
const traj = buildTrajectory(allEvents);
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
532
|
+
// With no assertions at all, keep the historical fallback: a case that just
|
|
533
|
+
// drives the agent passes when the run itself succeeded.
|
|
534
|
+
const verdict = assertions.length > 0
|
|
535
|
+
? computeVerdict(assertions)
|
|
536
|
+
: traj.ok && traj.turns.length > 0
|
|
537
|
+
? "passed"
|
|
538
|
+
: "failed";
|
|
539
|
+
const finalText = reply !== null && reply !== void 0 ? reply : traj.finalText;
|
|
540
|
+
// An unreachable judge means the *judged* signal is unknown, so the case is
|
|
541
|
+
// reported as skipped rather than as a quality regression. It must not also
|
|
542
|
+
// bury a deterministic gate that already failed: skipping a failed case would
|
|
543
|
+
// turn a red eval green on any machine that happens to lack credentials.
|
|
544
|
+
if (judgeUnavailable !== undefined && verdict !== "failed") {
|
|
545
|
+
logs.push(`judge skipped: ${judgeUnavailable}`);
|
|
546
|
+
return finish({
|
|
547
|
+
verdict: "skipped",
|
|
548
|
+
ok: true,
|
|
549
|
+
skipReason: judgeUnavailable,
|
|
550
|
+
finalText,
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
if (judgeUnavailable !== undefined) {
|
|
554
|
+
logs.push(`judge unavailable (${judgeUnavailable}), but a gate already failed — reporting the failure`);
|
|
555
|
+
}
|
|
556
|
+
return finish({
|
|
557
|
+
verdict,
|
|
558
|
+
ok: verdict !== "failed",
|
|
559
|
+
finalText,
|
|
560
|
+
});
|
|
366
561
|
});
|
|
367
562
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
563
|
+
/** Clamp a case timeout to a delay `setTimeout` can represent. */
|
|
564
|
+
function clampTimerDelay(timeoutMs) {
|
|
565
|
+
const MAX_TIMER = 2147483647;
|
|
566
|
+
return Math.min(Math.max(timeoutMs, 0), MAX_TIMER);
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Build `t.judge`. Each grader records its slot immediately and resolves it
|
|
570
|
+
* during finalization, so several judges overlap instead of serializing.
|
|
571
|
+
*/
|
|
572
|
+
function createJudgeSurface(args) {
|
|
573
|
+
const grade = (graderName, reference, options) => {
|
|
574
|
+
const grader = args.grader(graderName);
|
|
575
|
+
const model = args.resolveModel(options === null || options === void 0 ? void 0 : options.model);
|
|
576
|
+
const name = `judge.${graderName}(${truncateForName(reference)})`;
|
|
577
|
+
if (model === undefined) {
|
|
578
|
+
// A missing judge model is an authoring error, not a flaky provider.
|
|
579
|
+
return args.recorder.record({
|
|
580
|
+
name,
|
|
581
|
+
passed: false,
|
|
582
|
+
severity: "gate",
|
|
583
|
+
detail: "no judge model configured; set judge.model in evals.config.ts, on the eval, or on the call",
|
|
584
|
+
});
|
|
380
585
|
}
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
const
|
|
586
|
+
const submission = renderSubmission(options !== undefined && "on" in options
|
|
587
|
+
? options.on
|
|
588
|
+
: args.defaultValue());
|
|
589
|
+
const settle = (() => __awaiter(this, void 0, void 0, function* () {
|
|
590
|
+
const reply = yield args.caller({
|
|
591
|
+
prompt: grader.buildPrompt({ submission, reference }),
|
|
592
|
+
model,
|
|
593
|
+
});
|
|
594
|
+
const result = grader.parse(reply);
|
|
386
595
|
return {
|
|
387
|
-
passed,
|
|
388
|
-
|
|
596
|
+
passed: true,
|
|
597
|
+
score: result.score,
|
|
598
|
+
detail: result.rationale === undefined
|
|
599
|
+
? `${result.choice} (${result.score.toFixed(2)})`
|
|
600
|
+
: `${result.choice} (${result.score.toFixed(2)}) — ${result.rationale}`,
|
|
389
601
|
};
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
602
|
+
}))().catch((error) => {
|
|
603
|
+
if (error instanceof EvalJudgeUnavailableError) {
|
|
604
|
+
args.onUnavailable(error.message);
|
|
605
|
+
return { passed: true, detail: `skipped: ${error.message}` };
|
|
606
|
+
}
|
|
607
|
+
throw error;
|
|
608
|
+
});
|
|
609
|
+
// Soft by default: a judge is a tracked score until given a bar.
|
|
610
|
+
return args.recorder.recordAsync({ name, passed: true, severity: "soft", detail: "grading…" }, settle);
|
|
611
|
+
};
|
|
612
|
+
return {
|
|
613
|
+
model(prompt, options) {
|
|
614
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
615
|
+
const model = args.resolveModel(options === null || options === void 0 ? void 0 : options.model);
|
|
616
|
+
if (model === undefined) {
|
|
617
|
+
throw new Error("t.judge.model: no judge model configured; set judge.model in evals.config.ts, on the eval, or on the call");
|
|
618
|
+
}
|
|
619
|
+
return args.caller({ prompt, model });
|
|
620
|
+
});
|
|
621
|
+
},
|
|
622
|
+
factuality: (expected, options) => grade("factuality", expected, options),
|
|
623
|
+
summarizes: (expected, options) => grade("summarizes", expected, options),
|
|
624
|
+
closedQA: (criteria, options) => grade("closedQA", criteria, options),
|
|
625
|
+
sql: (expected, options) => grade("sql", expected, options),
|
|
626
|
+
};
|
|
396
627
|
}
|
|
397
|
-
function
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
}
|
|
401
|
-
if (typeof a !== "object" ||
|
|
402
|
-
typeof b !== "object" ||
|
|
403
|
-
a === null ||
|
|
404
|
-
b === null) {
|
|
405
|
-
return false;
|
|
406
|
-
}
|
|
407
|
-
if (Array.isArray(a) !== Array.isArray(b)) {
|
|
408
|
-
return false;
|
|
409
|
-
}
|
|
410
|
-
if (Array.isArray(a) && Array.isArray(b)) {
|
|
411
|
-
if (a.length !== b.length) {
|
|
412
|
-
return false;
|
|
413
|
-
}
|
|
414
|
-
return a.every((item, i) => deepEqual(item, b[i]));
|
|
415
|
-
}
|
|
416
|
-
const aKeys = Object.keys(a);
|
|
417
|
-
const bKeys = Object.keys(b);
|
|
418
|
-
if (aKeys.length !== bKeys.length) {
|
|
419
|
-
return false;
|
|
420
|
-
}
|
|
421
|
-
for (const key of aKeys) {
|
|
422
|
-
if (!deepEqual(a[key], b[key])) {
|
|
423
|
-
return false;
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
return true;
|
|
628
|
+
function truncateForName(text) {
|
|
629
|
+
const oneLine = text.replace(/\s+/g, " ").trim();
|
|
630
|
+
return oneLine.length > 60 ? `${oneLine.slice(0, 59)}…` : oneLine;
|
|
427
631
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evals-client.d.ts","sourceRoot":"","sources":["../../src/internal/evals-client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"evals-client.d.ts","sourceRoot":"","sources":["../../src/internal/evals-client.ts"],"names":[],"mappings":"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"}
|
|
@@ -15,7 +15,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
15
15
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
|
-
import { matchesEvalIdFilter } from "../evals.js";
|
|
18
|
+
import { expandSummarySuiteSelection, isEvalSummaryCase, matchesEvalIdFilter, } from "../evals.js";
|
|
19
19
|
import { mergeRequestHeaders } from "./request-headers.js";
|
|
20
20
|
const DEFAULT_POLL_MS = 1000;
|
|
21
21
|
export class RemoteEvalError extends Error {
|
|
@@ -106,7 +106,8 @@ export function listRemoteEvals(args) {
|
|
|
106
106
|
if (args.tags !== undefined && args.tags.length > 0) {
|
|
107
107
|
selected = selected.filter((e) => { var _a; return ((_a = e.tags) !== null && _a !== void 0 ? _a : []).some((t) => args.tags.includes(t)); });
|
|
108
108
|
}
|
|
109
|
-
|
|
109
|
+
// Match server-side filterDiscoveredEvals: summary → whole file.
|
|
110
|
+
return expandSummarySuiteSelection(listed, selected, (e) => isEvalSummaryCase(e.tags));
|
|
110
111
|
});
|
|
111
112
|
}
|
|
112
113
|
export function startRemoteEvalRun(args) {
|
|
@@ -284,7 +285,10 @@ export function pollRemoteEvalRun(args) {
|
|
|
284
285
|
});
|
|
285
286
|
}
|
|
286
287
|
export function snapshotToEvalRunResults(snapshot) {
|
|
287
|
-
return snapshot.cases.map((c) => { var _a, _b, _c, _d, _e; return (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ id: c.id, path: c.fileId }, (c.description === undefined ? {} : { description: c.description })), { ok: c.ok === true,
|
|
288
|
+
return snapshot.cases.map((c) => { var _a, _b, _c, _d, _e, _f; return (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ id: c.id, path: c.fileId }, (c.description === undefined ? {} : { description: c.description })), { ok: c.ok === true,
|
|
289
|
+
// Older serve processes send no verdict; infer it from `ok` so a remote
|
|
290
|
+
// batch still prints and reports consistently.
|
|
291
|
+
verdict: (_a = c.verdict) !== null && _a !== void 0 ? _a : (c.ok === true ? "passed" : "failed") }), (c.skipReason === undefined ? {} : { skipReason: c.skipReason })), (c.metadata === undefined ? {} : { metadata: c.metadata })), { assertions: (_b = c.assertions) !== null && _b !== void 0 ? _b : [] }), (c.sessionId === undefined ? {} : { sessionId: c.sessionId })), { inputs: (_c = c.inputs) !== null && _c !== void 0 ? _c : [] }), (c.finalText === undefined ? {} : { finalText: c.finalText })), (c.tools === undefined ? {} : { tools: c.tools })), (c.toolCalls === undefined ? {} : { toolCalls: c.toolCalls })), (c.error === undefined ? {} : { error: c.error })), { logs: (_d = c.logs) !== null && _d !== void 0 ? _d : [], metrics: (_e = c.metrics) !== null && _e !== void 0 ? _e : {}, durationMs: (_f = c.durationMs) !== null && _f !== void 0 ? _f : 0 })); });
|
|
288
292
|
}
|
|
289
293
|
function sleep(ms, signal) {
|
|
290
294
|
return new Promise((resolve, reject) => {
|