@agentv/core 2.16.0 → 2.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-E6AJPAXM.js → chunk-CPPYERD2.js} +1 -1
- package/dist/chunk-CPPYERD2.js.map +1 -0
- package/dist/evaluation/validation/index.cjs +5 -5
- package/dist/evaluation/validation/index.cjs.map +1 -1
- package/dist/evaluation/validation/index.js +6 -6
- package/dist/evaluation/validation/index.js.map +1 -1
- package/dist/index.cjs +72 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -10
- package/dist/index.d.ts +4 -10
- package/dist/index.js +73 -46
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-E6AJPAXM.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -4745,30 +4745,24 @@ function parseWorkspaceHookConfig(raw, evalFileDir) {
|
|
|
4745
4745
|
const script = parseWorkspaceScriptConfig(raw, evalFileDir);
|
|
4746
4746
|
const obj = raw;
|
|
4747
4747
|
const reset = obj.reset === "none" || obj.reset === "fast" || obj.reset === "strict" ? obj.reset : void 0;
|
|
4748
|
-
|
|
4749
|
-
if (!script && !reset && !clean) return void 0;
|
|
4748
|
+
if (!script && !reset) return void 0;
|
|
4750
4749
|
return {
|
|
4751
4750
|
...script ?? {},
|
|
4752
|
-
...reset !== void 0 && { reset }
|
|
4753
|
-
...clean !== void 0 && { clean }
|
|
4751
|
+
...reset !== void 0 && { reset }
|
|
4754
4752
|
};
|
|
4755
4753
|
}
|
|
4756
4754
|
function parseWorkspaceHooksConfig(raw, evalFileDir) {
|
|
4757
4755
|
if (!isJsonObject(raw)) return void 0;
|
|
4758
4756
|
const obj = raw;
|
|
4759
|
-
const
|
|
4760
|
-
const
|
|
4761
|
-
const
|
|
4762
|
-
const
|
|
4763
|
-
const onReuse = parseWorkspaceHookConfig(obj.on_reuse, evalFileDir);
|
|
4764
|
-
const onFinish = parseWorkspaceHookConfig(obj.on_finish, evalFileDir);
|
|
4757
|
+
const beforeAll = parseWorkspaceHookConfig(obj.before_all, evalFileDir);
|
|
4758
|
+
const beforeEach = parseWorkspaceHookConfig(obj.before_each, evalFileDir);
|
|
4759
|
+
const afterEach = parseWorkspaceHookConfig(obj.after_each, evalFileDir);
|
|
4760
|
+
const afterAll = parseWorkspaceHookConfig(obj.after_all, evalFileDir);
|
|
4765
4761
|
const hooks = {
|
|
4766
|
-
...
|
|
4767
|
-
...
|
|
4768
|
-
...
|
|
4769
|
-
...
|
|
4770
|
-
...onReuse !== void 0 && { on_reuse: onReuse },
|
|
4771
|
-
...onFinish !== void 0 && { on_finish: onFinish }
|
|
4762
|
+
...beforeAll !== void 0 && { before_all: beforeAll },
|
|
4763
|
+
...beforeEach !== void 0 && { before_each: beforeEach },
|
|
4764
|
+
...afterEach !== void 0 && { after_each: afterEach },
|
|
4765
|
+
...afterAll !== void 0 && { after_all: afterAll }
|
|
4772
4766
|
};
|
|
4773
4767
|
return Object.keys(hooks).length > 0 ? hooks : void 0;
|
|
4774
4768
|
}
|
|
@@ -4829,18 +4823,10 @@ function mergeWorkspaceConfigs(suiteLevel, caseLevel) {
|
|
|
4829
4823
|
};
|
|
4830
4824
|
};
|
|
4831
4825
|
const mergedHooks = {
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
)
|
|
4836
|
-
before_each_test: mergeHook(
|
|
4837
|
-
suiteLevel.hooks?.before_each_test,
|
|
4838
|
-
caseLevel.hooks?.before_each_test
|
|
4839
|
-
),
|
|
4840
|
-
after_each_test: mergeHook(suiteLevel.hooks?.after_each_test, caseLevel.hooks?.after_each_test),
|
|
4841
|
-
after_all_tests: mergeHook(suiteLevel.hooks?.after_all_tests, caseLevel.hooks?.after_all_tests),
|
|
4842
|
-
on_reuse: mergeHook(suiteLevel.hooks?.on_reuse, caseLevel.hooks?.on_reuse),
|
|
4843
|
-
on_finish: mergeHook(suiteLevel.hooks?.on_finish, caseLevel.hooks?.on_finish)
|
|
4826
|
+
before_all: mergeHook(suiteLevel.hooks?.before_all, caseLevel.hooks?.before_all),
|
|
4827
|
+
before_each: mergeHook(suiteLevel.hooks?.before_each, caseLevel.hooks?.before_each),
|
|
4828
|
+
after_each: mergeHook(suiteLevel.hooks?.after_each, caseLevel.hooks?.after_each),
|
|
4829
|
+
after_all: mergeHook(suiteLevel.hooks?.after_all, caseLevel.hooks?.after_all)
|
|
4844
4830
|
};
|
|
4845
4831
|
const hasHooks = Object.values(mergedHooks).some((hook) => hook !== void 0);
|
|
4846
4832
|
return {
|
|
@@ -7086,6 +7072,7 @@ var CopilotCliProvider = class {
|
|
|
7086
7072
|
const agentProcess = (0, import_node_child_process2.spawn)(executable, args, {
|
|
7087
7073
|
stdio: ["pipe", "pipe", "inherit"]
|
|
7088
7074
|
});
|
|
7075
|
+
await waitForProcessSpawn(agentProcess, executable, this.targetName);
|
|
7089
7076
|
const toolCallsInProgress = /* @__PURE__ */ new Map();
|
|
7090
7077
|
const completedToolCalls = [];
|
|
7091
7078
|
let finalContent = "";
|
|
@@ -7365,6 +7352,47 @@ var CopilotCliProvider = class {
|
|
|
7365
7352
|
}
|
|
7366
7353
|
}
|
|
7367
7354
|
};
|
|
7355
|
+
async function waitForProcessSpawn(proc, executable, targetName) {
|
|
7356
|
+
if (proc.pid) {
|
|
7357
|
+
return;
|
|
7358
|
+
}
|
|
7359
|
+
await new Promise((resolve, reject) => {
|
|
7360
|
+
const onSpawn = () => {
|
|
7361
|
+
cleanup();
|
|
7362
|
+
resolve();
|
|
7363
|
+
};
|
|
7364
|
+
const onError = (error) => {
|
|
7365
|
+
cleanup();
|
|
7366
|
+
reject(new Error(formatCopilotSpawnError(error, executable, targetName)));
|
|
7367
|
+
};
|
|
7368
|
+
const cleanup = () => {
|
|
7369
|
+
proc.off("spawn", onSpawn);
|
|
7370
|
+
proc.off("error", onError);
|
|
7371
|
+
};
|
|
7372
|
+
proc.once("spawn", onSpawn);
|
|
7373
|
+
proc.once("error", onError);
|
|
7374
|
+
});
|
|
7375
|
+
}
|
|
7376
|
+
function formatCopilotSpawnError(error, executable, targetName) {
|
|
7377
|
+
const code = error.code;
|
|
7378
|
+
const base = `Failed to start Copilot CLI executable '${executable}' for target '${targetName}'. ${error.message}`;
|
|
7379
|
+
if (process.platform !== "win32") {
|
|
7380
|
+
return base;
|
|
7381
|
+
}
|
|
7382
|
+
if (code !== "ENOENT" && code !== "EINVAL") {
|
|
7383
|
+
return base;
|
|
7384
|
+
}
|
|
7385
|
+
return `${base}
|
|
7386
|
+
|
|
7387
|
+
On Windows, shell commands like 'copilot -h' can work via .ps1/.bat shims, but AgentV launches a subprocess that needs a directly spawnable executable path.
|
|
7388
|
+
|
|
7389
|
+
Fix options:
|
|
7390
|
+
1) Install native Copilot binary package:
|
|
7391
|
+
npm install -g @github/copilot-win32-x64
|
|
7392
|
+
2) Set explicit executable for Copilot targets:
|
|
7393
|
+
- In .env: COPILOT_EXE=C:\\Users\\<you>\\AppData\\Roaming\\npm\\node_modules\\@github\\copilot-win32-x64\\copilot.exe
|
|
7394
|
+
- In .agentv/targets.yaml: executable: \${{ COPILOT_EXE }}`;
|
|
7395
|
+
}
|
|
7368
7396
|
function summarizeAcpEvent(eventType, data) {
|
|
7369
7397
|
if (!data || typeof data !== "object") {
|
|
7370
7398
|
return eventType;
|
|
@@ -16424,9 +16452,8 @@ async function runEvaluation(options) {
|
|
|
16424
16452
|
const hasSharedWorkspace = !!(useStaticWorkspace || workspaceTemplate || suiteWorkspace?.hooks || suiteWorkspace?.repos?.length && !isPerTestIsolation);
|
|
16425
16453
|
const poolEnabled = configuredMode === "pooled" ? true : configuredMode === "ephemeral" || useStaticWorkspace ? false : suiteWorkspace?.pool ?? poolWorkspaces ?? true;
|
|
16426
16454
|
const usePool = poolEnabled !== false && !!suiteWorkspace?.repos?.length && !isPerTestIsolation && !useStaticWorkspace;
|
|
16427
|
-
const
|
|
16428
|
-
const
|
|
16429
|
-
const resolvedRetainOnFailure = (finishCleanPolicy === "always" || finishCleanPolicy === "on_failure" ? "cleanup" : finishCleanPolicy === "on_success" || finishCleanPolicy === "never" ? "keep" : void 0) ?? retainOnFailure ?? (cleanupWorkspaces ? "cleanup" : "keep");
|
|
16455
|
+
const resolvedRetainOnSuccess = retainOnSuccess ?? (keepWorkspaces ? "keep" : "cleanup");
|
|
16456
|
+
const resolvedRetainOnFailure = retainOnFailure ?? (cleanupWorkspaces ? "cleanup" : "keep");
|
|
16430
16457
|
const requestedWorkers = options.maxConcurrency ?? target.workers ?? 1;
|
|
16431
16458
|
const workers = hasSharedWorkspace && !usePool ? 1 : requestedWorkers;
|
|
16432
16459
|
setupLog(
|
|
@@ -16461,7 +16488,7 @@ async function runEvaluation(options) {
|
|
|
16461
16488
|
repos: suiteWorkspace.repos,
|
|
16462
16489
|
maxSlots: poolMaxSlots,
|
|
16463
16490
|
repoManager: poolRepoManager,
|
|
16464
|
-
poolReset: (workspaceClean === "full" ? "strict" : workspaceClean === "standard" ? "fast" : null) ??
|
|
16491
|
+
poolReset: (workspaceClean === "full" ? "strict" : workspaceClean === "standard" ? "fast" : null) ?? "fast"
|
|
16465
16492
|
});
|
|
16466
16493
|
poolSlots.push(slot);
|
|
16467
16494
|
setupLog(`pool slot ${i} acquired at: ${slot.path} (existing=${slot.isExisting})`);
|
|
@@ -16512,7 +16539,7 @@ async function runEvaluation(options) {
|
|
|
16512
16539
|
throw new Error(`Failed to materialize repos: ${message}`);
|
|
16513
16540
|
}
|
|
16514
16541
|
}
|
|
16515
|
-
const suiteBeforeAllHook = suiteWorkspace?.hooks?.
|
|
16542
|
+
const suiteBeforeAllHook = suiteWorkspace?.hooks?.before_all;
|
|
16516
16543
|
if (sharedWorkspacePath && hasHookCommand(suiteBeforeAllHook)) {
|
|
16517
16544
|
const beforeAllHook = suiteBeforeAllHook;
|
|
16518
16545
|
const beforeAllCommand = (beforeAllHook.command ?? beforeAllHook.script ?? []).join(" ");
|
|
@@ -16527,7 +16554,7 @@ async function runEvaluation(options) {
|
|
|
16527
16554
|
};
|
|
16528
16555
|
try {
|
|
16529
16556
|
beforeAllOutput = await executeWorkspaceScript(
|
|
16530
|
-
toScriptConfig(beforeAllHook, "
|
|
16557
|
+
toScriptConfig(beforeAllHook, "before_all", "suite workspace"),
|
|
16531
16558
|
scriptContext
|
|
16532
16559
|
);
|
|
16533
16560
|
setupLog("shared before_all completed");
|
|
@@ -16552,7 +16579,7 @@ async function runEvaluation(options) {
|
|
|
16552
16579
|
};
|
|
16553
16580
|
try {
|
|
16554
16581
|
const output = await executeWorkspaceScript(
|
|
16555
|
-
toScriptConfig(beforeAllHook, "
|
|
16582
|
+
toScriptConfig(beforeAllHook, "before_all", "suite workspace"),
|
|
16556
16583
|
scriptContext
|
|
16557
16584
|
);
|
|
16558
16585
|
if (!beforeAllOutput) beforeAllOutput = output;
|
|
@@ -16781,7 +16808,7 @@ async function runEvaluation(options) {
|
|
|
16781
16808
|
}
|
|
16782
16809
|
}
|
|
16783
16810
|
const afterAllWorkspaces = poolSlots.length > 1 ? poolSlots.map((s) => s.path) : sharedWorkspacePath ? [sharedWorkspacePath] : [];
|
|
16784
|
-
const suiteAfterAllHook = suiteWorkspace?.hooks?.
|
|
16811
|
+
const suiteAfterAllHook = suiteWorkspace?.hooks?.after_all;
|
|
16785
16812
|
if (afterAllWorkspaces.length > 0 && hasHookCommand(suiteAfterAllHook)) {
|
|
16786
16813
|
const afterAllHook = suiteAfterAllHook;
|
|
16787
16814
|
for (const wsPath of afterAllWorkspaces) {
|
|
@@ -16793,7 +16820,7 @@ async function runEvaluation(options) {
|
|
|
16793
16820
|
};
|
|
16794
16821
|
try {
|
|
16795
16822
|
const afterAllOutput = await executeWorkspaceScript(
|
|
16796
|
-
toScriptConfig(afterAllHook, "
|
|
16823
|
+
toScriptConfig(afterAllHook, "after_all", "suite workspace"),
|
|
16797
16824
|
scriptContext,
|
|
16798
16825
|
"warn"
|
|
16799
16826
|
);
|
|
@@ -17090,7 +17117,7 @@ async function runEvalCase(options) {
|
|
|
17090
17117
|
);
|
|
17091
17118
|
}
|
|
17092
17119
|
}
|
|
17093
|
-
const caseBeforeAllHook = evalCase.workspace?.hooks?.
|
|
17120
|
+
const caseBeforeAllHook = evalCase.workspace?.hooks?.before_all;
|
|
17094
17121
|
if (workspacePath && hasHookCommand(caseBeforeAllHook)) {
|
|
17095
17122
|
const beforeAllHook = caseBeforeAllHook;
|
|
17096
17123
|
const beforeAllCommand = (beforeAllHook.command ?? beforeAllHook.script ?? []).join(" ");
|
|
@@ -17109,7 +17136,7 @@ async function runEvalCase(options) {
|
|
|
17109
17136
|
};
|
|
17110
17137
|
try {
|
|
17111
17138
|
beforeAllOutput = await executeWorkspaceScript(
|
|
17112
|
-
toScriptConfig(beforeAllHook, "
|
|
17139
|
+
toScriptConfig(beforeAllHook, "before_all", `test '${evalCase.id}'`),
|
|
17113
17140
|
scriptContext
|
|
17114
17141
|
);
|
|
17115
17142
|
if (setupDebug) {
|
|
@@ -17134,7 +17161,7 @@ async function runEvalCase(options) {
|
|
|
17134
17161
|
}
|
|
17135
17162
|
}
|
|
17136
17163
|
}
|
|
17137
|
-
const caseBeforeEachHook = evalCase.workspace?.hooks?.
|
|
17164
|
+
const caseBeforeEachHook = evalCase.workspace?.hooks?.before_each;
|
|
17138
17165
|
if (workspacePath && hasHookCommand(caseBeforeEachHook)) {
|
|
17139
17166
|
const beforeEachHook = caseBeforeEachHook;
|
|
17140
17167
|
const scriptContext = {
|
|
@@ -17147,7 +17174,7 @@ async function runEvalCase(options) {
|
|
|
17147
17174
|
};
|
|
17148
17175
|
try {
|
|
17149
17176
|
beforeEachOutput = await executeWorkspaceScript(
|
|
17150
|
-
toScriptConfig(beforeEachHook, "
|
|
17177
|
+
toScriptConfig(beforeEachHook, "before_each", `test '${evalCase.id}'`),
|
|
17151
17178
|
scriptContext
|
|
17152
17179
|
);
|
|
17153
17180
|
} catch (error) {
|
|
@@ -17264,17 +17291,17 @@ async function runEvalCase(options) {
|
|
|
17264
17291
|
}
|
|
17265
17292
|
}
|
|
17266
17293
|
const providerError = extractProviderError(providerResponse);
|
|
17267
|
-
if (repoManager && workspacePath && evalCase.workspace?.hooks?.
|
|
17294
|
+
if (repoManager && workspacePath && evalCase.workspace?.hooks?.after_each?.reset && evalCase.workspace.hooks.after_each.reset !== "none" && evalCase.workspace.repos) {
|
|
17268
17295
|
try {
|
|
17269
17296
|
await repoManager.reset(
|
|
17270
17297
|
evalCase.workspace.repos,
|
|
17271
17298
|
workspacePath,
|
|
17272
|
-
evalCase.workspace.hooks.
|
|
17299
|
+
evalCase.workspace.hooks.after_each.reset
|
|
17273
17300
|
);
|
|
17274
17301
|
} catch {
|
|
17275
17302
|
}
|
|
17276
17303
|
}
|
|
17277
|
-
const caseAfterEachHook = evalCase.workspace?.hooks?.
|
|
17304
|
+
const caseAfterEachHook = evalCase.workspace?.hooks?.after_each;
|
|
17278
17305
|
if (workspacePath && hasHookCommand(caseAfterEachHook)) {
|
|
17279
17306
|
const afterEachHook = caseAfterEachHook;
|
|
17280
17307
|
const scriptContext = {
|
|
@@ -17287,7 +17314,7 @@ async function runEvalCase(options) {
|
|
|
17287
17314
|
};
|
|
17288
17315
|
try {
|
|
17289
17316
|
afterEachOutput = await executeWorkspaceScript(
|
|
17290
|
-
toScriptConfig(afterEachHook, "
|
|
17317
|
+
toScriptConfig(afterEachHook, "after_each", `test '${evalCase.id}'`),
|
|
17291
17318
|
scriptContext,
|
|
17292
17319
|
"warn"
|
|
17293
17320
|
);
|