@vercel/agent-eval 2.1.0 → 2.2.1
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 +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/agents/eval-helper.mjs +32 -15
- package/dist/lib/agents/fx/agent.d.ts +15 -0
- package/dist/lib/agents/fx/agent.d.ts.map +1 -0
- package/dist/lib/agents/fx/agent.js +137 -0
- package/dist/lib/agents/fx/agent.js.map +1 -0
- package/dist/lib/agents/fx/run.mjs +150 -0
- package/dist/lib/agents/index.d.ts +5 -2
- package/dist/lib/agents/index.d.ts.map +1 -1
- package/dist/lib/agents/index.js +12 -6
- package/dist/lib/agents/index.js.map +1 -1
- package/dist/lib/agents/plugin/contract.d.ts +8 -0
- package/dist/lib/agents/plugin/contract.d.ts.map +1 -1
- package/dist/lib/agents/plugin/contract.js +12 -0
- package/dist/lib/agents/plugin/contract.js.map +1 -1
- package/dist/lib/agents/plugin/orchestrator.d.ts.map +1 -1
- package/dist/lib/agents/plugin/orchestrator.js +5 -1
- package/dist/lib/agents/plugin/orchestrator.js.map +1 -1
- package/dist/lib/agents/shared.d.ts +28 -0
- package/dist/lib/agents/shared.d.ts.map +1 -1
- package/dist/lib/agents/shared.js +43 -0
- package/dist/lib/agents/shared.js.map +1 -1
- package/dist/lib/agents/types.d.ts +1 -0
- package/dist/lib/agents/types.d.ts.map +1 -1
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +6 -2
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/o11y/index.d.ts +1 -0
- package/dist/lib/o11y/index.d.ts.map +1 -1
- package/dist/lib/o11y/index.js +1 -0
- package/dist/lib/o11y/index.js.map +1 -1
- package/dist/lib/o11y/parsers/fx.d.ts +8 -0
- package/dist/lib/o11y/parsers/fx.d.ts.map +1 -0
- package/dist/lib/o11y/parsers/fx.js +270 -0
- package/dist/lib/o11y/parsers/fx.js.map +1 -0
- package/dist/lib/o11y/parsers/index.d.ts +3 -1
- package/dist/lib/o11y/parsers/index.d.ts.map +1 -1
- package/dist/lib/o11y/parsers/index.js +7 -0
- package/dist/lib/o11y/parsers/index.js.map +1 -1
- package/dist/lib/runner.d.ts.map +1 -1
- package/dist/lib/runner.js +9 -3
- package/dist/lib/runner.js.map +1 -1
- package/dist/lib/types.d.ts +1 -1
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/types.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -26,5 +26,5 @@ export { Dashboard, createConsoleProgressHandler } from './lib/dashboard.js';
|
|
|
26
26
|
export type { InitOptions } from './lib/init.js';
|
|
27
27
|
export { initProject, getPostInitInstructions } from './lib/init.js';
|
|
28
28
|
export type { ToolName, TranscriptEvent, WebFetchInfo, FileOperationInfo, ShellCommandInfo, TranscriptSummary, Transcript, ParseableAgent, } from './lib/o11y/index.js';
|
|
29
|
-
export { parseTranscript, parseTranscriptSummary, loadTranscript, SUPPORTED_AGENTS, parseClaudeCodeTranscript, parseCodexTranscript, parseOpenCodeTranscript, } from './lib/o11y/index.js';
|
|
29
|
+
export { parseTranscript, parseTranscriptSummary, loadTranscript, SUPPORTED_AGENTS, parseClaudeCodeTranscript, parseCodexTranscript, parseOpenCodeTranscript, parseFxTranscript, } from './lib/o11y/index.js';
|
|
30
30
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,YAAY,EACV,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,WAAW,EACX,UAAU,EACV,cAAc,EACd,WAAW,EACX,OAAO,EACP,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,WAAW,EACX,aAAa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sBAAsB,CAAC;AAGhG,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD,YAAY,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGjF,OAAO,EAAE,SAAS,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAG7E,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAGrE,YAAY,EACV,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -25,5 +25,5 @@ export { runExperiment, runSingleEval, StartRateLimiter } from './lib/runner.js'
|
|
|
25
25
|
// Re-export dashboard utilities
|
|
26
26
|
export { Dashboard, createConsoleProgressHandler } from './lib/dashboard.js';
|
|
27
27
|
export { initProject, getPostInitInstructions } from './lib/init.js';
|
|
28
|
-
export { parseTranscript, parseTranscriptSummary, loadTranscript, SUPPORTED_AGENTS, parseClaudeCodeTranscript, parseCodexTranscript, parseOpenCodeTranscript, } from './lib/o11y/index.js';
|
|
28
|
+
export { parseTranscript, parseTranscriptSummary, loadTranscript, SUPPORTED_AGENTS, parseClaudeCodeTranscript, parseCodexTranscript, parseOpenCodeTranscript, parseFxTranscript, } from './lib/o11y/index.js';
|
|
29
29
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA2BH,sBAAsB;AACtB,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3F,6BAA6B;AAC7B,OAAO,EACL,eAAe,EACf,cAAc,EACd,aAAa,EACb,UAAU,EACV,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAEzB,8BAA8B;AAC9B,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAU1B,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAK/D,yCAAyC;AACzC,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAIzF,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAI5E,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,uBAAuB,EACvB,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAE1B,2BAA2B;AAC3B,OAAO,EAAE,kBAAkB,EAAE,oCAAoC,EAAE,MAAM,sBAAsB,CAAC;AAEhG,uBAAuB;AACvB,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,iBAAiB,GAClB,MAAM,q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E,MAAM,uBAAuB,CAAC;AAI5E,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,uBAAuB,EACvB,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAE1B,2BAA2B;AAC3B,OAAO,EAAE,kBAAkB,EAAE,oCAAoC,EAAE,MAAM,sBAAsB,CAAC;AAEhG,uBAAuB;AACvB,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAE7B,yBAAyB;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIlD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEjF,gCAAgC;AAChC,OAAO,EAAE,SAAS,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAI7E,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAarE,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,qBAAqB,CAAC"}
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* these files before validation).
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
-
import {
|
|
30
|
+
import { spawn } from 'node:child_process';
|
|
31
31
|
import { readFileSync, existsSync, mkdirSync } from 'node:fs';
|
|
32
32
|
import { expect } from 'vitest';
|
|
33
33
|
|
|
@@ -129,12 +129,31 @@ function readJudgeConfig() {
|
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
+
/** spawn + collect, resolving on exit. Never rejects: judge failures become verdicts. */
|
|
133
|
+
function spawnCollect(cmd, args) {
|
|
134
|
+
return new Promise((resolve) => {
|
|
135
|
+
const child = spawn(cmd, args, { cwd: process.cwd(), env: process.env });
|
|
136
|
+
let stdout = '';
|
|
137
|
+
let stderr = '';
|
|
138
|
+
child.stdout.on('data', (chunk) => (stdout += chunk));
|
|
139
|
+
child.stderr.on('data', (chunk) => (stderr += chunk));
|
|
140
|
+
child.on('error', (err) => resolve({ stdout, stderr: `${stderr}\n${err.message}`, status: -1 }));
|
|
141
|
+
child.on('close', (status) => resolve({ stdout, stderr, status }));
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
132
145
|
/**
|
|
133
146
|
* Run one agentic judgment IN this sandbox by re-invoking the codegen agent's
|
|
134
|
-
* runner.
|
|
135
|
-
*
|
|
147
|
+
* runner. Async ON PURPOSE, not as style: the vitest worker answers the main
|
|
148
|
+
* process over an RPC channel whose per-call timeout is hardcoded to 60s (birpc's
|
|
149
|
+
* DEFAULT_TIMEOUT — no vitest config or env var reaches it). A judge run takes
|
|
150
|
+
* however long the model takes, routinely past a minute, and the old spawnSync
|
|
151
|
+
* blocked the worker's event loop for all of it, so in-flight calls like
|
|
152
|
+
* onTaskUpdate timed out and vitest failed the file EVEN WHEN EVERY TEST PASSED.
|
|
153
|
+
* Keeping the loop alive while the judge works is the entire fix; the sandbox
|
|
154
|
+
* timeout still bounds the run. Returns {pass, score?, reason}.
|
|
136
155
|
*/
|
|
137
|
-
function runJudge(subject, criterion, opts = {}) {
|
|
156
|
+
async function runJudge(subject, criterion, opts = {}) {
|
|
138
157
|
const id = nextId();
|
|
139
158
|
mkdirSync(JUDGE_IO_DIR, { recursive: true });
|
|
140
159
|
const verdictPath = `${JUDGE_IO_DIR}/${id}-verdict.json`;
|
|
@@ -156,12 +175,7 @@ function runJudge(subject, criterion, opts = {}) {
|
|
|
156
175
|
extra: cfg.extra ?? undefined,
|
|
157
176
|
};
|
|
158
177
|
|
|
159
|
-
const res =
|
|
160
|
-
cwd: process.cwd(),
|
|
161
|
-
env: process.env,
|
|
162
|
-
encoding: 'utf8',
|
|
163
|
-
maxBuffer: 64 * 1024 * 1024,
|
|
164
|
-
});
|
|
178
|
+
const res = await spawnCollect('node', [runnerPath, JSON.stringify(input)]);
|
|
165
179
|
|
|
166
180
|
// Prefer the verdict file the judge agent wrote; then the runner result's output
|
|
167
181
|
// (the agent's final message); then raw stdout.
|
|
@@ -189,9 +203,12 @@ function subjectOf(received) {
|
|
|
189
203
|
return received && typeof received === 'object' ? received.__judgeSubject : undefined;
|
|
190
204
|
}
|
|
191
205
|
|
|
192
|
-
//
|
|
206
|
+
// Async matchers — `await expect(...)`, as every example here shows. The await is
|
|
207
|
+
// load-bearing: vitest does not track a custom matcher's promise, so an un-awaited
|
|
208
|
+
// judge call floats free of its test — a failing verdict surfaces as an unhandled
|
|
209
|
+
// rejection instead of failing the test, and a passing one is never even read.
|
|
193
210
|
expect.extend({
|
|
194
|
-
toSatisfyCriterion(received, criterion) {
|
|
211
|
+
async toSatisfyCriterion(received, criterion) {
|
|
195
212
|
const subject = subjectOf(received);
|
|
196
213
|
if (!subject) {
|
|
197
214
|
return {
|
|
@@ -200,7 +217,7 @@ expect.extend({
|
|
|
200
217
|
'toSatisfyCriterion expects `environment` or `transcript` from @vercel/agent-eval/eval',
|
|
201
218
|
};
|
|
202
219
|
}
|
|
203
|
-
const v = runJudge(subject, criterion);
|
|
220
|
+
const v = await runJudge(subject, criterion);
|
|
204
221
|
return {
|
|
205
222
|
pass: v.pass,
|
|
206
223
|
message: () =>
|
|
@@ -210,7 +227,7 @@ expect.extend({
|
|
|
210
227
|
};
|
|
211
228
|
},
|
|
212
229
|
|
|
213
|
-
toScoreAtLeast(received, criterion, threshold) {
|
|
230
|
+
async toScoreAtLeast(received, criterion, threshold) {
|
|
214
231
|
const subject = subjectOf(received);
|
|
215
232
|
if (!subject) {
|
|
216
233
|
return {
|
|
@@ -219,7 +236,7 @@ expect.extend({
|
|
|
219
236
|
'toScoreAtLeast expects `environment` or `transcript` from @vercel/agent-eval/eval',
|
|
220
237
|
};
|
|
221
238
|
}
|
|
222
|
-
const v = runJudge(subject, criterion, { numeric: true });
|
|
239
|
+
const v = await runJudge(subject, criterion, { numeric: true });
|
|
223
240
|
const score = typeof v.score === 'number' ? v.score : v.pass ? 1 : 0;
|
|
224
241
|
const pass = score >= threshold;
|
|
225
242
|
return {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fx agent definition for research-enabled runs through Vercel AI Gateway.
|
|
3
|
+
*/
|
|
4
|
+
import type { Agent } from '../types.js';
|
|
5
|
+
import type { AgentDefinition } from '../plugin/contract.js';
|
|
6
|
+
export declare const FX_VERSION = "0.0.5";
|
|
7
|
+
export declare const FX_RELEASE_SHA256: {
|
|
8
|
+
readonly x64: "d5639d173267774aa8228a474baf619a7076ac41a91023915007c865143429b1";
|
|
9
|
+
readonly arm64: "8bbcde6a41256c4fac4e0a022291cf02740419e27afabde3b8f45e7a4e393edb";
|
|
10
|
+
};
|
|
11
|
+
/** Build the zero-dependency installer executed inside the Linux sandbox. */
|
|
12
|
+
export declare function buildFxInstallScript(): string;
|
|
13
|
+
export declare function createFxDefinition(): AgentDefinition;
|
|
14
|
+
export declare function createFxAgent(): Agent;
|
|
15
|
+
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../../src/lib/agents/fx/agent.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,KAAK,EAAmB,MAAM,aAAa,CAAC;AAG1D,OAAO,KAAK,EAAE,eAAe,EAAe,MAAM,uBAAuB,CAAC;AAG1E,eAAO,MAAM,UAAU,UAAU,CAAC;AAElC,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AAIX,6EAA6E;AAC7E,wBAAgB,oBAAoB,IAAI,MAAM,CAiE7C;AAED,wBAAgB,kBAAkB,IAAI,eAAe,CAgDpD;AAED,wBAAgB,aAAa,IAAI,KAAK,CAYrC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fx agent definition for research-enabled runs through Vercel AI Gateway.
|
|
3
|
+
*/
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { AI_GATEWAY } from '../shared.js';
|
|
6
|
+
import { runWithDefinition } from '../plugin/orchestrator.js';
|
|
7
|
+
export const FX_VERSION = '0.0.5';
|
|
8
|
+
export const FX_RELEASE_SHA256 = {
|
|
9
|
+
x64: 'd5639d173267774aa8228a474baf619a7076ac41a91023915007c865143429b1',
|
|
10
|
+
arm64: '8bbcde6a41256c4fac4e0a022291cf02740419e27afabde3b8f45e7a4e393edb',
|
|
11
|
+
};
|
|
12
|
+
const FX_RUNTIME_PROTOCOL = 'ask-json-session-v1';
|
|
13
|
+
/** Build the zero-dependency installer executed inside the Linux sandbox. */
|
|
14
|
+
export function buildFxInstallScript() {
|
|
15
|
+
return `
|
|
16
|
+
import { createHash } from 'node:crypto';
|
|
17
|
+
import { chmodSync, mkdirSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
18
|
+
import { join, resolve } from 'node:path';
|
|
19
|
+
import { spawnSync } from 'node:child_process';
|
|
20
|
+
|
|
21
|
+
const version = ${JSON.stringify(FX_VERSION)};
|
|
22
|
+
const checksums = ${JSON.stringify(FX_RELEASE_SHA256)};
|
|
23
|
+
if (process.platform !== 'linux' || !(process.arch in checksums)) {
|
|
24
|
+
throw new Error(\`Unsupported fx sandbox platform: \${process.platform}/\${process.arch}\`);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const releaseArch = process.arch === 'x64' ? 'x86_64' : 'aarch64';
|
|
28
|
+
const asset = \`fx-linux-\${releaseArch}.tar.gz\`;
|
|
29
|
+
const url = \`https://github.com/vercel-labs/fx/releases/download/v\${version}/\${asset}\`;
|
|
30
|
+
const installDir = resolve('__agent_eval__/bin');
|
|
31
|
+
const archivePath = join(installDir, asset);
|
|
32
|
+
const binaryPath = join(installDir, 'fx');
|
|
33
|
+
|
|
34
|
+
mkdirSync(installDir, { recursive: true });
|
|
35
|
+
const maxArchiveBytes = 32 * 1024 * 1024;
|
|
36
|
+
const controller = new AbortController();
|
|
37
|
+
const timeout = setTimeout(() => controller.abort(), 60_000);
|
|
38
|
+
let archive;
|
|
39
|
+
try {
|
|
40
|
+
const response = await fetch(url, { signal: controller.signal });
|
|
41
|
+
if (!response.ok) throw new Error(\`fx download failed: HTTP \${response.status}\`);
|
|
42
|
+
const contentLength = Number(response.headers.get('content-length'));
|
|
43
|
+
if (Number.isFinite(contentLength) && contentLength > maxArchiveBytes) {
|
|
44
|
+
throw new Error('fx archive exceeds 32 MB');
|
|
45
|
+
}
|
|
46
|
+
if (!response.body) throw new Error('fx download returned no body');
|
|
47
|
+
|
|
48
|
+
const chunks = [];
|
|
49
|
+
let size = 0;
|
|
50
|
+
for await (const chunk of response.body) {
|
|
51
|
+
const bytes = Buffer.from(chunk);
|
|
52
|
+
size += bytes.length;
|
|
53
|
+
if (size > maxArchiveBytes) {
|
|
54
|
+
controller.abort();
|
|
55
|
+
throw new Error('fx archive exceeds 32 MB');
|
|
56
|
+
}
|
|
57
|
+
chunks.push(bytes);
|
|
58
|
+
}
|
|
59
|
+
archive = Buffer.concat(chunks, size);
|
|
60
|
+
} finally {
|
|
61
|
+
clearTimeout(timeout);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const actual = createHash('sha256').update(archive).digest('hex');
|
|
65
|
+
const expected = checksums[process.arch];
|
|
66
|
+
if (actual !== expected) throw new Error(\`fx checksum mismatch: expected \${expected}, got \${actual}\`);
|
|
67
|
+
|
|
68
|
+
writeFileSync(archivePath, archive);
|
|
69
|
+
const extracted = spawnSync('tar', ['-xzf', archivePath, '-C', installDir, 'fx'], { encoding: 'utf8' });
|
|
70
|
+
unlinkSync(archivePath);
|
|
71
|
+
if (extracted.status !== 0) throw new Error(\`fx extraction failed: \${extracted.stderr || extracted.error?.message || 'unknown error'}\`);
|
|
72
|
+
chmodSync(binaryPath, 0o755);
|
|
73
|
+
|
|
74
|
+
const installed = spawnSync(binaryPath, ['--version'], { encoding: 'utf8' });
|
|
75
|
+
if (installed.status !== 0 || installed.stdout.trim() !== version) {
|
|
76
|
+
throw new Error(\`fx version check failed: \${installed.stdout || installed.stderr || installed.error?.message || 'unknown error'}\`);
|
|
77
|
+
}
|
|
78
|
+
`;
|
|
79
|
+
}
|
|
80
|
+
export function createFxDefinition() {
|
|
81
|
+
return {
|
|
82
|
+
name: 'vercel-ai-gateway/fx',
|
|
83
|
+
displayName: 'fx (Vercel AI Gateway)',
|
|
84
|
+
defaultModel: 'zai/glm-5.2',
|
|
85
|
+
o11yAgentName: 'vercel-ai-gateway/fx',
|
|
86
|
+
bundledSkillsControl: 'not-applicable',
|
|
87
|
+
requiresWebResearch: true,
|
|
88
|
+
supportsCrossAgentJudge: false,
|
|
89
|
+
runnerPath: fileURLToPath(new URL('./run.mjs', import.meta.url)),
|
|
90
|
+
getApiKeyEnvVar() {
|
|
91
|
+
return AI_GATEWAY.apiKeyEnvVar;
|
|
92
|
+
},
|
|
93
|
+
install(_options) {
|
|
94
|
+
return [
|
|
95
|
+
{
|
|
96
|
+
kind: 'command',
|
|
97
|
+
cmd: 'npm',
|
|
98
|
+
args: ['install'],
|
|
99
|
+
retryOnce: true,
|
|
100
|
+
errorPrefix: 'npm install failed',
|
|
101
|
+
errorBody: 'last10',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
kind: 'command',
|
|
105
|
+
cmd: 'node',
|
|
106
|
+
args: ['--input-type=module', '--eval', buildFxInstallScript()],
|
|
107
|
+
errorPrefix: 'fx install failed',
|
|
108
|
+
errorBody: 'stderr',
|
|
109
|
+
},
|
|
110
|
+
];
|
|
111
|
+
},
|
|
112
|
+
configFiles: () => [],
|
|
113
|
+
authEnv(options) {
|
|
114
|
+
return { [AI_GATEWAY.apiKeyEnvVar]: options.apiKey };
|
|
115
|
+
},
|
|
116
|
+
fingerprintExtra() {
|
|
117
|
+
return {
|
|
118
|
+
fxVersion: FX_VERSION,
|
|
119
|
+
fxRuntimeProtocol: FX_RUNTIME_PROTOCOL,
|
|
120
|
+
};
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
export function createFxAgent() {
|
|
125
|
+
const definition = createFxDefinition();
|
|
126
|
+
return {
|
|
127
|
+
name: definition.name,
|
|
128
|
+
displayName: definition.displayName,
|
|
129
|
+
getApiKeyEnvVar: definition.getApiKeyEnvVar,
|
|
130
|
+
getDefaultModel() {
|
|
131
|
+
return definition.defaultModel;
|
|
132
|
+
},
|
|
133
|
+
run: (fixturePath, options) => runWithDefinition(definition, fixturePath, options),
|
|
134
|
+
definition,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../../../src/lib/agents/fx/agent.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAIzC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC;AAElC,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,GAAG,EAAE,kEAAkE;IACvE,KAAK,EAAE,kEAAkE;CACjE,CAAC;AAEX,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAElD,6EAA6E;AAC7E,MAAM,UAAU,oBAAoB;IAClC,OAAO;;;;;;kBAMS,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC;oBACxB,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwDpD,CAAC;AACF,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,OAAO;QACL,IAAI,EAAE,sBAA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C3C,eAAe;YACb,OAAO,UAAU,CAAC,YAAY,CAAC;QACjC,CAAC;QACD,GAAG,EAAE,CAAC,WAAW,EAAE,OAAO,EAAE,EAAE,CAAC,iBAAiB,CAAC,UAAU,EAAE,WAAW,EAAE,OAAO,CAAC;QAClF,UAAU;KACX,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fx in-sandbox runner. This file must remain zero-dependency.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { spawnSync } from 'node:child_process';
|
|
6
|
+
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
7
|
+
import { dirname, join } from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
|
|
10
|
+
/** @param {{prompt:string}} input */
|
|
11
|
+
export function buildFxCliArgs(input) {
|
|
12
|
+
return ['ask', '--yolo', '--json', '--no-color', '--', input.prompt];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** @param {string} raw */
|
|
16
|
+
export function parseFxAskResult(raw) {
|
|
17
|
+
if (!raw || !raw.trim()) return null;
|
|
18
|
+
try {
|
|
19
|
+
const value = JSON.parse(raw.trim());
|
|
20
|
+
if (
|
|
21
|
+
value &&
|
|
22
|
+
typeof value === 'object' &&
|
|
23
|
+
typeof value.output === 'string' &&
|
|
24
|
+
typeof value.exit_code === 'number' &&
|
|
25
|
+
Array.isArray(value.tool_calls)
|
|
26
|
+
) {
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
} catch {
|
|
30
|
+
// The caller reports malformed stdout as an agent failure.
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** @param {string} raw */
|
|
36
|
+
export function isFxSessionDetail(raw) {
|
|
37
|
+
if (!raw || !raw.trim()) return false;
|
|
38
|
+
try {
|
|
39
|
+
const value = JSON.parse(raw.trim());
|
|
40
|
+
return value?.kind === 'session_detail' && Array.isArray(value.history);
|
|
41
|
+
} catch {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** @param {{model?:string}} input */
|
|
47
|
+
export function buildFxEnvironment(input) {
|
|
48
|
+
const env = { ...process.env, FX_AUTO_UPGRADE: '0' };
|
|
49
|
+
if (input.model) env.FX_MODEL = input.model;
|
|
50
|
+
else delete env.FX_MODEL;
|
|
51
|
+
return env;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @param {import('../plugin/contract.js').AgentRunInput} input
|
|
56
|
+
* @returns {Promise<import('../plugin/contract.js').RunnerResult>}
|
|
57
|
+
*/
|
|
58
|
+
export async function runAgent(input) {
|
|
59
|
+
const binary = join(input.cwd, '__agent_eval__', 'bin', 'fx');
|
|
60
|
+
const env = buildFxEnvironment(input);
|
|
61
|
+
const res = spawnSync(binary, buildFxCliArgs(input), {
|
|
62
|
+
cwd: input.cwd,
|
|
63
|
+
env,
|
|
64
|
+
encoding: 'utf8',
|
|
65
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const stdout = res.stdout || '';
|
|
69
|
+
const stderr = res.stderr || '';
|
|
70
|
+
const output = stdout + stderr;
|
|
71
|
+
const askResult = parseFxAskResult(stdout);
|
|
72
|
+
const processExitCode = res.status == null ? -1 : res.status;
|
|
73
|
+
const agentExitCode = askResult?.exit_code ?? processExitCode;
|
|
74
|
+
|
|
75
|
+
// The supported session projection is richer than fx ask's final summary.
|
|
76
|
+
// Fall back to the ask JSON when a session cannot be read.
|
|
77
|
+
let transcript = askResult ? stdout.trim() : null;
|
|
78
|
+
if (askResult?.session_id) {
|
|
79
|
+
const session = spawnSync(binary, ['session', '--id', askResult.session_id, '--json'], {
|
|
80
|
+
cwd: input.cwd,
|
|
81
|
+
env,
|
|
82
|
+
encoding: 'utf8',
|
|
83
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
84
|
+
});
|
|
85
|
+
if (session.status === 0 && isFxSessionDetail(session.stdout || '')) {
|
|
86
|
+
transcript = session.stdout.trim();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const ok = !res.error && processExitCode === 0 && askResult?.exit_code === 0;
|
|
91
|
+
if (!ok) {
|
|
92
|
+
const errorLines = output.trim().split('\n').slice(-5).join('\n');
|
|
93
|
+
const error = askResult?.error || (res.error ? `Failed to run fx: ${res.error.message}` : null);
|
|
94
|
+
return {
|
|
95
|
+
ok: false,
|
|
96
|
+
output,
|
|
97
|
+
transcript,
|
|
98
|
+
observedModel: askResult?.model || null,
|
|
99
|
+
error: error || errorLines || `fx exited with code ${agentExitCode}`,
|
|
100
|
+
agentExitCode,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
ok: true,
|
|
106
|
+
output,
|
|
107
|
+
transcript,
|
|
108
|
+
observedModel: askResult.model || null,
|
|
109
|
+
error: null,
|
|
110
|
+
agentExitCode,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const isMain = process.argv[1] && fileURLToPath(import.meta.url) === process.argv[1];
|
|
115
|
+
|
|
116
|
+
if (isMain) {
|
|
117
|
+
const input = JSON.parse(process.argv[2]);
|
|
118
|
+
let result;
|
|
119
|
+
try {
|
|
120
|
+
result = await runAgent(input);
|
|
121
|
+
} catch (error) {
|
|
122
|
+
result = {
|
|
123
|
+
ok: false,
|
|
124
|
+
output: '',
|
|
125
|
+
transcript: null,
|
|
126
|
+
observedModel: null,
|
|
127
|
+
error: error && error.message ? error.message : String(error),
|
|
128
|
+
agentExitCode: -1,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
try {
|
|
133
|
+
mkdirSync(dirname(input.resultPath), { recursive: true });
|
|
134
|
+
writeFileSync(input.resultPath, JSON.stringify(result));
|
|
135
|
+
} catch {
|
|
136
|
+
// The marker below remains available when the result file cannot be written.
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
process.stdout.write(
|
|
140
|
+
'__AGENT_RESULT__ ' +
|
|
141
|
+
JSON.stringify({
|
|
142
|
+
ok: result.ok,
|
|
143
|
+
observedModel: result.observedModel,
|
|
144
|
+
error: result.error,
|
|
145
|
+
agentExitCode: result.agentExitCode,
|
|
146
|
+
}) +
|
|
147
|
+
'\n'
|
|
148
|
+
);
|
|
149
|
+
process.exit(0);
|
|
150
|
+
}
|
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { registerAgent, getAgent, listAgents, hasAgent } from './registry.js';
|
|
5
5
|
import type { AgentType } from '../types.js';
|
|
6
|
-
/** Validate
|
|
7
|
-
export declare function
|
|
6
|
+
/** Validate opt-in runtime controls for every agent used by a run. */
|
|
7
|
+
export declare function assertRunRuntimeControls(agentName: AgentType, controls: {
|
|
8
|
+
disableBundledSkills?: boolean;
|
|
9
|
+
webResearch?: boolean;
|
|
10
|
+
}, judgeAgentName?: AgentType): void;
|
|
8
11
|
export { registerAgent, getAgent, listAgents, hasAgent };
|
|
9
12
|
export type { Agent, AgentRunOptions, AgentRunResult } from './types.js';
|
|
10
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/agents/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/agents/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAY9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAY7C,sEAAsE;AACtE,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE;IAAE,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,EACnE,cAAc,CAAC,EAAE,SAAS,GACzB,IAAI,CAUN;AAGD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;AAGzD,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/lib/agents/index.js
CHANGED
|
@@ -5,22 +5,28 @@ import { registerAgent, getAgent, listAgents, hasAgent } from './registry.js';
|
|
|
5
5
|
import { createClaudeCodeAgent } from './claude-code/agent.js';
|
|
6
6
|
import { createCodexAgent } from './codex/agent.js';
|
|
7
7
|
import { createOpenCodeAgent } from './opencode/agent.js';
|
|
8
|
+
import { createFxAgent } from './fx/agent.js';
|
|
8
9
|
import { createGeminiAgent } from './gemini/agent.js';
|
|
9
10
|
import { createCursorAgent } from './cursor/agent.js';
|
|
10
|
-
import { assertBundledSkillsControl } from './plugin/contract.js';
|
|
11
|
+
import { assertBundledSkillsControl, assertCrossAgentJudgeSupport, assertWebResearchControl, } from './plugin/contract.js';
|
|
11
12
|
// Register all agent variants (Vercel AI Gateway + Direct API)
|
|
12
13
|
registerAgent(createClaudeCodeAgent({ useVercelAiGateway: true })); // vercel-ai-gateway/claude-code
|
|
13
14
|
registerAgent(createClaudeCodeAgent({ useVercelAiGateway: false })); // claude-code
|
|
14
15
|
registerAgent(createCodexAgent({ useVercelAiGateway: true })); // vercel-ai-gateway/codex
|
|
15
16
|
registerAgent(createCodexAgent({ useVercelAiGateway: false })); // codex
|
|
16
17
|
registerAgent(createOpenCodeAgent()); // vercel-ai-gateway/opencode
|
|
18
|
+
registerAgent(createFxAgent()); // vercel-ai-gateway/fx
|
|
17
19
|
registerAgent(createGeminiAgent()); // gemini
|
|
18
20
|
registerAgent(createCursorAgent()); // cursor
|
|
19
|
-
/** Validate
|
|
20
|
-
export function
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
/** Validate opt-in runtime controls for every agent used by a run. */
|
|
22
|
+
export function assertRunRuntimeControls(agentName, controls, judgeAgentName) {
|
|
23
|
+
const definition = getAgent(agentName).definition;
|
|
24
|
+
assertBundledSkillsControl(definition, controls.disableBundledSkills);
|
|
25
|
+
assertWebResearchControl(definition, controls.webResearch);
|
|
26
|
+
if (judgeAgentName && judgeAgentName !== agentName) {
|
|
27
|
+
const judgeDefinition = getAgent(judgeAgentName).definition;
|
|
28
|
+
assertBundledSkillsControl(judgeDefinition, controls.disableBundledSkills);
|
|
29
|
+
assertCrossAgentJudgeSupport(judgeDefinition);
|
|
24
30
|
}
|
|
25
31
|
}
|
|
26
32
|
// Re-export registry functions
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/agents/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/agents/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,wB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AAC,UAAU,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC;IAE3D,IAAI,cAAc,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;QACnD,MAAM,eAAe,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC,UAAU,CAAC;QAC5D,0BAA0B,CAAC,eAAe,EAAE,QAAQ,CAAC,oBAAoB,CAAC,CAAC;QAC3E,4BAA4B,CAAC,eAAe,CAAC,CAAC;IAChD,CAAC;AACH,CAAC;AAED,+BAA+B;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -78,6 +78,10 @@ export interface AgentDefinition {
|
|
|
78
78
|
/** Whether the CLI can disable vendor-bundled skills, or has none to disable.
|
|
79
79
|
* Omitted means the opt-in control is unsupported. */
|
|
80
80
|
bundledSkillsControl?: 'configurable' | 'not-applicable';
|
|
81
|
+
/** Whether this adapter currently supports only research-enabled runs. */
|
|
82
|
+
requiresWebResearch?: boolean;
|
|
83
|
+
/** Whether another agent may select this adapter as its pinned judge. */
|
|
84
|
+
supportsCrossAgentJudge?: boolean;
|
|
81
85
|
/**
|
|
82
86
|
* Which host env var the apiKey is read from. Mirrors the old getApiKeyEnvVar()
|
|
83
87
|
* EXACTLY, including claude-code's 3-way runtime branch (gateway →
|
|
@@ -115,6 +119,10 @@ export interface AgentDefinition {
|
|
|
115
119
|
}
|
|
116
120
|
/** Reject an opt-in capability when an agent cannot honor it. */
|
|
117
121
|
export declare function assertBundledSkillsControl(definition: AgentDefinition, requested?: boolean): void;
|
|
122
|
+
/** Reject a run when an adapter requires the research tool surface. */
|
|
123
|
+
export declare function assertWebResearchControl(definition: AgentDefinition, requested?: boolean): void;
|
|
124
|
+
/** Reject an adapter that cannot serve as another agent's pinned judge. */
|
|
125
|
+
export declare function assertCrossAgentJudgeSupport(definition: AgentDefinition): void;
|
|
118
126
|
/**
|
|
119
127
|
* What the host passes INTO run.mjs (serialized as argv[2] JSON).
|
|
120
128
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../src/lib/agents/plugin/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC1B,qFAAqF;IACrF,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;IAC1B,0BAA0B;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,wBAAwB;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gFAAgF;IAChF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,sFAAsF;IACtF,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,SAAS,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAChC;AAED;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,kFAAkF;IAClF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+FAA+F;IAC/F,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,sFAAsF;IACtF,IAAI,EAAE,MAAM,CAAC;IACb,qEAAqE;IACrE,WAAW,EAAE,MAAM,CAAC;IACpB,wEAAwE;IACxE,YAAY,EAAE,SAAS,CAAC;IACxB,uFAAuF;IACvF,aAAa,EAAE,MAAM,CAAC;IACtB,8FAA8F;IAC9F,UAAU,EAAE,MAAM,CAAC;IACnB;0DACsD;IACtD,oBAAoB,CAAC,EAAE,cAAc,GAAG,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"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C,yFAAyF;IACzF,GAAG,EAAE,MAAM,CAAC;IACZ,uEAAuE;IACvE,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,uCAAuC;IACvC,EAAE,EAAE,OAAO,CAAC;IACZ,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,+EAA+E;IAC/E,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,kFAAkF;IAClF,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,8EAA8E;IAC9E,aAAa,EAAE,MAAM,CAAC;IACtB;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -24,4 +24,16 @@ export function assertBundledSkillsControl(definition, requested) {
|
|
|
24
24
|
throw new Error(`Agent ${definition.name} does not support disableBundledSkills`);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
+
/** Reject a run when an adapter requires the research tool surface. */
|
|
28
|
+
export function assertWebResearchControl(definition, requested) {
|
|
29
|
+
if (definition.requiresWebResearch && !requested) {
|
|
30
|
+
throw new Error(`Agent ${definition.name} requires webResearch: true`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/** Reject an adapter that cannot serve as another agent's pinned judge. */
|
|
34
|
+
export function assertCrossAgentJudgeSupport(definition) {
|
|
35
|
+
if (definition.supportsCrossAgentJudge === false) {
|
|
36
|
+
throw new Error(`Agent ${definition.name} does not support cross-agent judging`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
27
39
|
//# sourceMappingURL=contract.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../../../src/lib/agents/plugin/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../../../src/lib/agents/plugin/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AA+GH,iEAAiE;AACjE,MAAM,UAAU,0BAA0B,CACxC,UAA2B,EAC3B,SAAmB;IAEnB,IAAI,SAAS,IAAI,CAAC,UAAU,CAAC,oBAAoB,EAAE,CAAC;QAClD,MAAM,IAAI,KAAK,CAAC,SAAS,UAAU,CAAC,IAAI,wCAAwC,CAAC,CAAC;IACpF,CAAC;AACH,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,wBAAwB,CACtC,UAA2B,EAC3B,SAAmB;IAEnB,IAAI,UAAU,CAAC,mBAAmB,IAAI,CAAC,SAAS,EAAE,CAAC;QACjD,MAAM,IAAI,KAAK,CAAC,SAAS,UAAU,CAAC,IAAI,6BAA6B,CAAC,CAAC;IACzE,CAAC;AACH,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,4BAA4B,CAAC,UAA2B;IACtE,IAAI,UAAU,CAAC,uBAAuB,KAAK,KAAK,EAAE,CAAC;QACjD,MAAM,IAAI,KAAK,CAAC,SAAS,UAAU,CAAC,IAAI,uCAAuC,CAAC,CAAC;IACnF,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../../../../src/lib/agents/plugin/orchestrator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAwBnE,OAAO,
|
|
1
|
+
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../../../../src/lib/agents/plugin/orchestrator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAwBnE,OAAO,EAIL,KAAK,eAAe,EAGrB,MAAM,eAAe,CAAC;AAoBvB,+EAA+E;AAC/E,UAAU,kBAAkB;IAC1B,oFAAoF;IACpF,UAAU,EAAE,MAAM,CAAC;IACnB,sEAAsE;IACtE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,2EAA2E;IAC3E,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,uEAAuE;IACvE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CACvC;AAED,UAAU,YAAY;IACpB,iFAAiF;IACjF,QAAQ,EAAE,eAAe,CAAC;IAC1B,sFAAsF;IACtF,YAAY,EAAE,eAAe,CAAC;IAC9B,qFAAqF;IACrF,MAAM,EAAE,OAAO,CAAC;IAChB,uFAAuF;IACvF,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,gFAAgF;IAChF,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,2DAA2D;IAC3D,MAAM,EAAE,kBAAkB,CAAC;CAC5B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,eAAe,EAAE,OAAO,EAAE,eAAe,GAAG,YAAY,CA2ChG;AA0FD;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,eAAe,EACpB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,cAAc,CAAC,CAkBzB"}
|
|
@@ -18,7 +18,7 @@ import { createSandbox, collectLocalFiles, splitTestFiles, verifyNoTestFiles, }
|
|
|
18
18
|
import { runValidation, captureGeneratedFiles, createVitestConfig, initGitAndCommit, injectTranscriptContext, prepareNeutralWorkspace, resolveAgentApiKey, EVAL_HELPER_PATH, JUDGE_TRANSCRIPT_FILE, JUDGE_CONFIG_PATH, JUDGE_RUNNER_PATH, } from '../shared.js';
|
|
19
19
|
import { redactRunResult } from '../redact.js';
|
|
20
20
|
import { getAgent } from '../registry.js';
|
|
21
|
-
import { assertBundledSkillsControl, } from './contract.js';
|
|
21
|
+
import { assertBundledSkillsControl, assertCrossAgentJudgeSupport, assertWebResearchControl, } from './contract.js';
|
|
22
22
|
/** Well-known paths inside the sandbox for the runner + its result file. */
|
|
23
23
|
const RUNNER_PATH = '__agent_eval__/run.mjs';
|
|
24
24
|
const RESULT_PATH = '__agent_eval__/agent-result.json';
|
|
@@ -44,6 +44,7 @@ const EVAL_HELPER_DISK_PATH = fileURLToPath(new URL('../eval-helper.mjs', import
|
|
|
44
44
|
export function resolveJudgeRuntime(def, options) {
|
|
45
45
|
const spec = options.judge;
|
|
46
46
|
assertBundledSkillsControl(def, options.disableBundledSkills);
|
|
47
|
+
assertWebResearchControl(def, options.webResearch);
|
|
47
48
|
// Same harness as codegen (default, or judge.agent omitted/equal): reuse run.mjs,
|
|
48
49
|
// just pin the model when asked. Identical to pre-feature behavior when unset.
|
|
49
50
|
if (!spec || (spec.agent ?? def.name) === def.name) {
|
|
@@ -65,6 +66,7 @@ export function resolveJudgeRuntime(def, options) {
|
|
|
65
66
|
// Pinned to a DIFFERENT agent — resolve its definition + key + runner.
|
|
66
67
|
const judgeDef = getAgent(spec.agent).definition;
|
|
67
68
|
assertBundledSkillsControl(judgeDef, options.disableBundledSkills);
|
|
69
|
+
assertCrossAgentJudgeSupport(judgeDef);
|
|
68
70
|
const judgeApiKey = resolveAgentApiKey(judgeDef.getApiKeyEnvVar) ?? '';
|
|
69
71
|
const judgeOptions = { ...options, model: spec.model, apiKey: judgeApiKey };
|
|
70
72
|
return {
|
|
@@ -172,6 +174,8 @@ async function readRunnerResult(sandbox, resultPath, nodeResult) {
|
|
|
172
174
|
* transcript.
|
|
173
175
|
*/
|
|
174
176
|
export async function runWithDefinition(def, fixturePath, options) {
|
|
177
|
+
assertBundledSkillsControl(def, options.disableBundledSkills);
|
|
178
|
+
assertWebResearchControl(def, options.webResearch);
|
|
175
179
|
const result = await runOnce(def, fixturePath, options);
|
|
176
180
|
// A judge pinned to a different agent authenticates with its own key, and it can
|
|
177
181
|
// reach the transcript too, so redact both. Resolving the judge can throw (an
|