agentv 5.1.0-next.1 → 5.3.0-next.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/README.md +16 -12
- package/dist/{artifact-writer-IORG7CW5.js → artifact-writer-JFNIPMKW.js} +5 -5
- package/dist/{chunk-ZGPCX334.js → chunk-6ZZCDZPD.js} +4101 -1204
- package/dist/chunk-6ZZCDZPD.js.map +1 -0
- package/dist/{chunk-CBBBRTQ3.js → chunk-BHKQHG26.js} +64 -3
- package/dist/chunk-BHKQHG26.js.map +1 -0
- package/dist/{chunk-AM2IPHKS.js → chunk-FVR4RQFK.js} +302 -162
- package/dist/chunk-FVR4RQFK.js.map +1 -0
- package/dist/{chunk-GIRUNQGP.js → chunk-T32NL3E6.js} +262 -154
- package/dist/chunk-T32NL3E6.js.map +1 -0
- package/dist/{chunk-GJWPQXHN.js → chunk-V52ATPTT.js} +104 -188
- package/dist/chunk-V52ATPTT.js.map +1 -0
- package/dist/cli.js +6 -6
- package/dist/dashboard/assets/{index-BSHoWrdr.js → index-DNgf3qJ2.js} +1 -1
- package/dist/dashboard/assets/{index-zvUKAkKn.css → index-D_bokML8.css} +1 -1
- package/dist/dashboard/assets/index-r_jSJmlw.js +121 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/{dist-2D2GBHZV.js → dist-6Z7U473R.js} +14 -8
- package/dist/index.js +6 -6
- package/dist/{interactive-V4SEHLNY.js → interactive-RUY3OCBI.js} +6 -6
- package/dist/skills/agentv-bench/SKILL.md +17 -13
- package/dist/skills/agentv-bench/agents/analyzer.md +1 -1
- package/dist/skills/agentv-bench/agents/comparator.md +3 -3
- package/dist/skills/agentv-bench/agents/grader.md +4 -2
- package/dist/skills/agentv-bench/references/description-optimization.md +5 -6
- package/dist/skills/agentv-bench/references/environment-adaptation.md +2 -2
- package/dist/skills/agentv-bench/references/eval-yaml-spec.md +35 -19
- package/dist/skills/agentv-bench/references/migrating-from-skill-creator.md +1 -1
- package/dist/skills/agentv-eval-migrations/references/breaking-changes.md +125 -28
- package/dist/skills/agentv-eval-writer/SKILL.md +113 -87
- package/dist/skills/agentv-eval-writer/references/eval.schema.json +772 -1367
- package/dist/{ts-eval-loader-SSPJVEHD-AL2A3V5Z.js → ts-eval-loader-DQDYRULE-V3377FOL.js} +3 -2
- package/package.json +8 -2
- package/dist/chunk-AM2IPHKS.js.map +0 -1
- package/dist/chunk-CBBBRTQ3.js.map +0 -1
- package/dist/chunk-GIRUNQGP.js.map +0 -1
- package/dist/chunk-GJWPQXHN.js.map +0 -1
- package/dist/chunk-ZGPCX334.js.map +0 -1
- package/dist/dashboard/assets/index-BaLLxmVO.js +0 -121
- /package/dist/{artifact-writer-IORG7CW5.js.map → artifact-writer-JFNIPMKW.js.map} +0 -0
- /package/dist/{dist-2D2GBHZV.js.map → dist-6Z7U473R.js.map} +0 -0
- /package/dist/{interactive-V4SEHLNY.js.map → interactive-RUY3OCBI.js.map} +0 -0
- /package/dist/{ts-eval-loader-SSPJVEHD-AL2A3V5Z.js.map → ts-eval-loader-DQDYRULE-V3377FOL.js.map} +0 -0
|
@@ -8,20 +8,15 @@ import {
|
|
|
8
8
|
external_exports,
|
|
9
9
|
extractLastAssistantContent,
|
|
10
10
|
getAgentvDataDir,
|
|
11
|
-
getRepoCheckoutRef,
|
|
12
11
|
groupTranscriptJsonLines,
|
|
13
|
-
interpolateEnv,
|
|
14
12
|
loadTests,
|
|
15
|
-
normalizeRepoIdentity,
|
|
16
13
|
normalizeToolCall,
|
|
17
|
-
parseRepoConfig,
|
|
18
14
|
parseYamlValue,
|
|
19
15
|
prepareEvalCaseWorkspace,
|
|
20
16
|
prepareSharedWorkspaceSetup,
|
|
21
17
|
readTranscriptJsonl,
|
|
22
|
-
releaseSharedWorkspaceSetup
|
|
23
|
-
|
|
24
|
-
} from "./chunk-ZGPCX334.js";
|
|
18
|
+
releaseSharedWorkspaceSetup
|
|
19
|
+
} from "./chunk-6ZZCDZPD.js";
|
|
25
20
|
|
|
26
21
|
// ../../packages/core/dist/index.js
|
|
27
22
|
import { readFileSync } from "node:fs";
|
|
@@ -29,8 +24,6 @@ import path from "node:path";
|
|
|
29
24
|
import { randomUUID } from "node:crypto";
|
|
30
25
|
import path2 from "node:path";
|
|
31
26
|
import micromatch from "micromatch";
|
|
32
|
-
import { readFile } from "node:fs/promises";
|
|
33
|
-
import path3 from "node:path";
|
|
34
27
|
import { execFile, spawn } from "node:child_process";
|
|
35
28
|
import { createHash, randomBytes } from "node:crypto";
|
|
36
29
|
import {
|
|
@@ -43,19 +36,19 @@ import {
|
|
|
43
36
|
rmSync,
|
|
44
37
|
writeFileSync
|
|
45
38
|
} from "node:fs";
|
|
46
|
-
import { cp, lstat, mkdtemp, readFile
|
|
39
|
+
import { cp, lstat, mkdtemp, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
|
|
47
40
|
import os from "node:os";
|
|
48
|
-
import
|
|
41
|
+
import path3 from "node:path";
|
|
49
42
|
import { promisify } from "node:util";
|
|
50
43
|
import * as childProcess from "node:child_process";
|
|
51
44
|
import { existsSync as existsSync2 } from "node:fs";
|
|
52
45
|
import { spawnSync } from "node:child_process";
|
|
53
46
|
import { readdir as readdir2, stat as stat2 } from "node:fs/promises";
|
|
54
47
|
import { homedir } from "node:os";
|
|
55
|
-
import
|
|
48
|
+
import path4 from "node:path";
|
|
56
49
|
import { readdir as readdir3, stat as stat3 } from "node:fs/promises";
|
|
57
50
|
import { homedir as homedir2 } from "node:os";
|
|
58
|
-
import
|
|
51
|
+
import path5 from "node:path";
|
|
59
52
|
var TRACE_SESSION_SCHEMA_VERSION = "agentv.dashboard.trace_session.v1";
|
|
60
53
|
function isRecord(value) {
|
|
61
54
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -1789,7 +1782,7 @@ async function prepareEvalWorkspace(options) {
|
|
|
1789
1782
|
});
|
|
1790
1783
|
if (!caseSetup.workspacePath) {
|
|
1791
1784
|
throw new Error(
|
|
1792
|
-
`No workspace was materialized for test "${evalCase.id}". Add
|
|
1785
|
+
`No workspace was materialized for test "${evalCase.id}". Add environment.workdir before preparing an external attempt, or use an internal workspace override for private runtime plumbing.`
|
|
1793
1786
|
);
|
|
1794
1787
|
}
|
|
1795
1788
|
return {
|
|
@@ -2018,82 +2011,6 @@ function buildPrompt(criteria, question, referenceAnswer) {
|
|
|
2018
2011
|
}
|
|
2019
2012
|
return parts.join("\n");
|
|
2020
2013
|
}
|
|
2021
|
-
async function scanRepoDeps(evalFilePaths) {
|
|
2022
|
-
const seen = /* @__PURE__ */ new Map();
|
|
2023
|
-
const errors = [];
|
|
2024
|
-
for (const filePath of evalFilePaths) {
|
|
2025
|
-
try {
|
|
2026
|
-
const repos = await extractReposFromEvalFile(filePath);
|
|
2027
|
-
for (const repo of repos) {
|
|
2028
|
-
if (!repo.repo) continue;
|
|
2029
|
-
const checkoutRef = getRepoCheckoutRef(repo);
|
|
2030
|
-
const ref = checkoutRef === "HEAD" ? void 0 : checkoutRef;
|
|
2031
|
-
const key = `${normalizeRepoIdentity(repo.repo)}\0${ref ?? ""}`;
|
|
2032
|
-
const existing = seen.get(key);
|
|
2033
|
-
if (existing) {
|
|
2034
|
-
existing.usedBy.push(filePath);
|
|
2035
|
-
} else {
|
|
2036
|
-
seen.set(key, {
|
|
2037
|
-
url: resolveRepoCloneUrl(repo.repo),
|
|
2038
|
-
ref,
|
|
2039
|
-
sparse: repo.sparse,
|
|
2040
|
-
ancestor: repo.ancestor,
|
|
2041
|
-
usedBy: [filePath]
|
|
2042
|
-
});
|
|
2043
|
-
}
|
|
2044
|
-
}
|
|
2045
|
-
} catch (err) {
|
|
2046
|
-
errors.push({
|
|
2047
|
-
file: filePath,
|
|
2048
|
-
message: err instanceof Error ? err.message : String(err)
|
|
2049
|
-
});
|
|
2050
|
-
}
|
|
2051
|
-
}
|
|
2052
|
-
return { repos: [...seen.values()], errors };
|
|
2053
|
-
}
|
|
2054
|
-
async function extractReposFromEvalFile(filePath) {
|
|
2055
|
-
const content = await readFile(filePath, "utf8");
|
|
2056
|
-
const parsed = interpolateEnv(parseYamlValue(content), process.env);
|
|
2057
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return [];
|
|
2058
|
-
const obj = parsed;
|
|
2059
|
-
const evalFileDir = path3.dirname(path3.resolve(filePath));
|
|
2060
|
-
const repos = [];
|
|
2061
|
-
const suiteRepos = await extractReposFromWorkspaceRaw(obj.workspace, evalFileDir);
|
|
2062
|
-
repos.push(...suiteRepos);
|
|
2063
|
-
const tests = Array.isArray(obj.tests) ? obj.tests : [];
|
|
2064
|
-
for (const test of tests) {
|
|
2065
|
-
if (test && typeof test === "object" && !Array.isArray(test)) {
|
|
2066
|
-
const testObj = test;
|
|
2067
|
-
const testRepos = await extractReposFromWorkspaceRaw(testObj.workspace, evalFileDir);
|
|
2068
|
-
repos.push(...testRepos);
|
|
2069
|
-
}
|
|
2070
|
-
}
|
|
2071
|
-
return repos;
|
|
2072
|
-
}
|
|
2073
|
-
async function extractReposFromWorkspaceRaw(raw, evalFileDir) {
|
|
2074
|
-
if (typeof raw === "string") {
|
|
2075
|
-
const workspaceFilePath = path3.resolve(evalFileDir, raw);
|
|
2076
|
-
const content = await readFile(workspaceFilePath, "utf8");
|
|
2077
|
-
const parsed = interpolateEnv(parseYamlValue(content), process.env);
|
|
2078
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return [];
|
|
2079
|
-
return extractReposFromObject(parsed);
|
|
2080
|
-
}
|
|
2081
|
-
if (raw && typeof raw === "object" && !Array.isArray(raw)) {
|
|
2082
|
-
return extractReposFromObject(raw);
|
|
2083
|
-
}
|
|
2084
|
-
return [];
|
|
2085
|
-
}
|
|
2086
|
-
function extractReposFromObject(obj) {
|
|
2087
|
-
const rawRepos = Array.isArray(obj.repos) ? obj.repos : [];
|
|
2088
|
-
const result = [];
|
|
2089
|
-
for (const r of rawRepos) {
|
|
2090
|
-
const parsed = parseRepoConfig(r);
|
|
2091
|
-
if (parsed?.repo) {
|
|
2092
|
-
result.push(parsed);
|
|
2093
|
-
}
|
|
2094
|
-
}
|
|
2095
|
-
return result;
|
|
2096
|
-
}
|
|
2097
2014
|
var execFileAsync = promisify(execFile);
|
|
2098
2015
|
var RESULTS_REPO_RESULTS_DIR = ".agentv/results";
|
|
2099
2016
|
var RESULTS_REPO_RUNS_DIR = ".";
|
|
@@ -2142,13 +2059,13 @@ function withFriendlyGitHubAuthError(error) {
|
|
|
2142
2059
|
}
|
|
2143
2060
|
function expandHome(p) {
|
|
2144
2061
|
if (p === "~" || p.startsWith("~/") || p.startsWith("~\\")) {
|
|
2145
|
-
return
|
|
2062
|
+
return path3.join(os.homedir(), p.slice(1));
|
|
2146
2063
|
}
|
|
2147
2064
|
return p;
|
|
2148
2065
|
}
|
|
2149
2066
|
function resolveLocalPath(p, baseDir) {
|
|
2150
2067
|
const expanded = expandHome(p);
|
|
2151
|
-
return
|
|
2068
|
+
return path3.isAbsolute(expanded) ? expanded : path3.resolve(baseDir, expanded);
|
|
2152
2069
|
}
|
|
2153
2070
|
function isNormalizedResultsConfig(config) {
|
|
2154
2071
|
return typeof config.storageBranchWorktree === "boolean";
|
|
@@ -2169,7 +2086,7 @@ function normalizeResultsConfig(config, options) {
|
|
|
2169
2086
|
const autoPush = config.auto_push === true;
|
|
2170
2087
|
const requirePush = config.require_push === true;
|
|
2171
2088
|
const resolvedRepoPath = repoPath ? resolveLocalPath(repoPath, baseDir) : void 0;
|
|
2172
|
-
const resolvedPath = explicitClonePath ? resolveLocalPath(explicitClonePath, baseDir) : repoUrl ?
|
|
2089
|
+
const resolvedPath = explicitClonePath ? resolveLocalPath(explicitClonePath, baseDir) : repoUrl ? path3.join(getAgentvDataDir(), "results", sanitizeRepoSlug(repoUrl)) : resolvedRepoPath ?? path3.join(getAgentvDataDir(), "results", sanitizeRepoSlug(repo));
|
|
2173
2090
|
return {
|
|
2174
2091
|
mode: "github",
|
|
2175
2092
|
repo,
|
|
@@ -2199,11 +2116,11 @@ function resolveResultsRepoUrl(repo) {
|
|
|
2199
2116
|
return trimmed;
|
|
2200
2117
|
}
|
|
2201
2118
|
function getResultsRepoLocalPaths(repo) {
|
|
2202
|
-
const rootDir =
|
|
2119
|
+
const rootDir = path3.join(getAgentvDataDir(), "cache", "results-repo", sanitizeRepoSlug(repo));
|
|
2203
2120
|
return {
|
|
2204
2121
|
rootDir,
|
|
2205
|
-
repoDir:
|
|
2206
|
-
statusFile:
|
|
2122
|
+
repoDir: path3.join(rootDir, "repo"),
|
|
2123
|
+
statusFile: path3.join(rootDir, "status.json")
|
|
2207
2124
|
};
|
|
2208
2125
|
}
|
|
2209
2126
|
function usesStorageBranchWorktree(config) {
|
|
@@ -2220,7 +2137,7 @@ function readPersistedStatus(statusFile) {
|
|
|
2220
2137
|
}
|
|
2221
2138
|
}
|
|
2222
2139
|
function writePersistedStatus(statusFile, status) {
|
|
2223
|
-
mkdirSync(
|
|
2140
|
+
mkdirSync(path3.dirname(statusFile), { recursive: true });
|
|
2224
2141
|
writeFileSync(statusFile, `${JSON.stringify(status, null, 2)}
|
|
2225
2142
|
`, "utf8");
|
|
2226
2143
|
}
|
|
@@ -2463,7 +2380,7 @@ async function ensureResultsMergeConfig(repoDir) {
|
|
|
2463
2380
|
try {
|
|
2464
2381
|
const { stdout } = await runGit(["rev-parse", "--git-common-dir"], { cwd: repoDir });
|
|
2465
2382
|
const resolved = stdout.trim();
|
|
2466
|
-
gitDir = resolved ?
|
|
2383
|
+
gitDir = resolved ? path3.isAbsolute(resolved) ? resolved : path3.join(repoDir, resolved) : path3.join(repoDir, ".git");
|
|
2467
2384
|
} catch {
|
|
2468
2385
|
return;
|
|
2469
2386
|
}
|
|
@@ -2472,8 +2389,8 @@ async function ensureResultsMergeConfig(repoDir) {
|
|
|
2472
2389
|
var RESULTS_INFO_ATTRIBUTES_BEGIN = "# >>> agentv results merge attributes >>>";
|
|
2473
2390
|
var RESULTS_INFO_ATTRIBUTES_END = "# <<< agentv results merge attributes <<<";
|
|
2474
2391
|
function writeResultsInfoAttributes(gitDir) {
|
|
2475
|
-
const infoDir =
|
|
2476
|
-
const attributesPath =
|
|
2392
|
+
const infoDir = path3.join(gitDir, "info");
|
|
2393
|
+
const attributesPath = path3.join(infoDir, "attributes");
|
|
2477
2394
|
const managedBlock = `${RESULTS_INFO_ATTRIBUTES_BEGIN}
|
|
2478
2395
|
${RESULTS_REPO_GITATTRIBUTES_CONTENT.trimEnd()}
|
|
2479
2396
|
${RESULTS_INFO_ATTRIBUTES_END}
|
|
@@ -2509,9 +2426,9 @@ async function addResultsGitattributesToIndex(repoDir, indexEnv) {
|
|
|
2509
2426
|
if (existing === RESULTS_REPO_GITATTRIBUTES_CONTENT) {
|
|
2510
2427
|
return;
|
|
2511
2428
|
}
|
|
2512
|
-
const scratchDir = mkdtempSync(
|
|
2429
|
+
const scratchDir = mkdtempSync(path3.join(os.tmpdir(), "agentv-results-attrs-"));
|
|
2513
2430
|
try {
|
|
2514
|
-
const scratchFile =
|
|
2431
|
+
const scratchFile = path3.join(scratchDir, RESULTS_REPO_GITATTRIBUTES_FILE);
|
|
2515
2432
|
writeFileSync(scratchFile, RESULTS_REPO_GITATTRIBUTES_CONTENT);
|
|
2516
2433
|
const { stdout: blob } = await runGit(["hash-object", "-w", "--no-filters", scratchFile], {
|
|
2517
2434
|
cwd: repoDir
|
|
@@ -2551,9 +2468,9 @@ async function ensureResultsRepoClone(config) {
|
|
|
2551
2468
|
const cachePaths = getResultsRepoLocalPaths(normalized.repo);
|
|
2552
2469
|
const cloneDir = normalized.path;
|
|
2553
2470
|
mkdirSync(cachePaths.rootDir, { recursive: true });
|
|
2554
|
-
mkdirSync(
|
|
2471
|
+
mkdirSync(path3.dirname(cloneDir), { recursive: true });
|
|
2555
2472
|
const cloneMissing = !existsSync(cloneDir);
|
|
2556
|
-
const gitDir =
|
|
2473
|
+
const gitDir = path3.join(cloneDir, ".git");
|
|
2557
2474
|
const cloneEmpty = !cloneMissing && !existsSync(gitDir) && (await readdir(cloneDir)).length === 0;
|
|
2558
2475
|
if (cloneMissing || cloneEmpty) {
|
|
2559
2476
|
try {
|
|
@@ -2719,7 +2636,7 @@ async function getStorageBranchWorktreeDirtyPaths(repoDir, config) {
|
|
|
2719
2636
|
const comparisonRef = await gitRefExists(repoDir, localRef) ? localRef : await gitRefExists(repoDir, remoteRef) ? remoteRef : void 0;
|
|
2720
2637
|
const dirtyPaths = [];
|
|
2721
2638
|
for (const gitPath of safeDirtyPaths) {
|
|
2722
|
-
const absolutePath =
|
|
2639
|
+
const absolutePath = path3.join(repoDir, ...gitPath.split("/"));
|
|
2723
2640
|
if (!existsSync(absolutePath)) {
|
|
2724
2641
|
if (await readGitText(repoDir, comparisonRef, gitPath) !== void 0) {
|
|
2725
2642
|
dirtyPaths.push(gitPath);
|
|
@@ -2825,7 +2742,7 @@ async function hasInProgressGitConflict(repoDir) {
|
|
|
2825
2742
|
check: false
|
|
2826
2743
|
});
|
|
2827
2744
|
const markerPath = stdout.trim();
|
|
2828
|
-
const resolvedMarkerPath =
|
|
2745
|
+
const resolvedMarkerPath = path3.isAbsolute(markerPath) ? markerPath : path3.join(repoDir, markerPath);
|
|
2829
2746
|
if (markerPath && existsSync(resolvedMarkerPath)) {
|
|
2830
2747
|
return true;
|
|
2831
2748
|
}
|
|
@@ -2997,7 +2914,7 @@ function withActionFlags(status, flags) {
|
|
|
2997
2914
|
};
|
|
2998
2915
|
}
|
|
2999
2916
|
function isSafeResultsRepoPath(p) {
|
|
3000
|
-
const normalized = p.split(
|
|
2917
|
+
const normalized = p.split(path3.sep).join("/");
|
|
3001
2918
|
const segments = normalized.split("/").filter(Boolean);
|
|
3002
2919
|
const isRunBundlePath = segments.length >= 2 && !segments[0]?.startsWith(".") && segments[0] !== RESULTS_REPO_GITATTRIBUTES_FILE;
|
|
3003
2920
|
return normalized === RESULTS_REPO_GITATTRIBUTES_FILE || RESULTS_REPO_TRACKED_DOT_DIRS.some(
|
|
@@ -3006,11 +2923,11 @@ function isSafeResultsRepoPath(p) {
|
|
|
3006
2923
|
}
|
|
3007
2924
|
async function existingTrackedResultsPathspecs(repoDir) {
|
|
3008
2925
|
const targets = /* @__PURE__ */ new Set();
|
|
3009
|
-
if (existsSync(
|
|
2926
|
+
if (existsSync(path3.join(repoDir, RESULTS_REPO_GITATTRIBUTES_FILE))) {
|
|
3010
2927
|
targets.add(RESULTS_REPO_GITATTRIBUTES_FILE);
|
|
3011
2928
|
}
|
|
3012
2929
|
for (const dir of RESULTS_REPO_TRACKED_DOT_DIRS) {
|
|
3013
|
-
if (existsSync(
|
|
2930
|
+
if (existsSync(path3.join(repoDir, dir))) {
|
|
3014
2931
|
targets.add(dir);
|
|
3015
2932
|
continue;
|
|
3016
2933
|
}
|
|
@@ -3023,7 +2940,7 @@ async function existingTrackedResultsPathspecs(repoDir) {
|
|
|
3023
2940
|
if (entry.name.startsWith(".") || !entry.isDirectory()) {
|
|
3024
2941
|
continue;
|
|
3025
2942
|
}
|
|
3026
|
-
if (existsSync(
|
|
2943
|
+
if (existsSync(path3.join(repoDir, entry.name, "summary.json"))) {
|
|
3027
2944
|
targets.add(entry.name);
|
|
3028
2945
|
}
|
|
3029
2946
|
}
|
|
@@ -4000,8 +3917,8 @@ async function prepareResultsRepoBranch(config, branchName) {
|
|
|
4000
3917
|
const cloneDir = await ensureResultsRepoClone(normalized);
|
|
4001
3918
|
const baseBranch = await resolveDefaultBranch(cloneDir);
|
|
4002
3919
|
await fetchResultsRepo(cloneDir, normalized.remote);
|
|
4003
|
-
const worktreeRoot = await mkdtemp(
|
|
4004
|
-
const worktreeDir =
|
|
3920
|
+
const worktreeRoot = await mkdtemp(path3.join(os.tmpdir(), "agentv-results-repo-"));
|
|
3921
|
+
const worktreeDir = path3.join(worktreeRoot, "repo");
|
|
4005
3922
|
await runGit(
|
|
4006
3923
|
["worktree", "add", "-B", branchName, worktreeDir, `${normalized.remote}/${baseBranch}`],
|
|
4007
3924
|
{
|
|
@@ -4023,12 +3940,12 @@ async function prepareResultsRepoBranch(config, branchName) {
|
|
|
4023
3940
|
}
|
|
4024
3941
|
async function stageResultsArtifacts(params) {
|
|
4025
3942
|
rmSync(params.destinationDir, { recursive: true, force: true });
|
|
4026
|
-
mkdirSync(
|
|
3943
|
+
mkdirSync(path3.dirname(params.destinationDir), { recursive: true });
|
|
4027
3944
|
await cp(params.sourceDir, params.destinationDir, { recursive: true });
|
|
4028
3945
|
}
|
|
4029
3946
|
function resolveResultsRepoRunsDir(config) {
|
|
4030
3947
|
const normalized = normalizeResultsConfig(config);
|
|
4031
|
-
return
|
|
3948
|
+
return path3.join(normalized.path, RESULTS_REPO_RESULTS_DIR);
|
|
4032
3949
|
}
|
|
4033
3950
|
async function directorySizeBytes(targetPath) {
|
|
4034
3951
|
const entry = await stat(targetPath);
|
|
@@ -4037,7 +3954,7 @@ async function directorySizeBytes(targetPath) {
|
|
|
4037
3954
|
}
|
|
4038
3955
|
let total = 0;
|
|
4039
3956
|
for (const child of await readdir(targetPath, { withFileTypes: true })) {
|
|
4040
|
-
total += await directorySizeBytes(
|
|
3957
|
+
total += await directorySizeBytes(path3.join(targetPath, child.name));
|
|
4041
3958
|
}
|
|
4042
3959
|
return total;
|
|
4043
3960
|
}
|
|
@@ -4104,7 +4021,7 @@ async function assertValidResultsBranchName(repoDir, branch) {
|
|
|
4104
4021
|
await runGit(["check-ref-format", "--branch", branch], { cwd: repoDir });
|
|
4105
4022
|
}
|
|
4106
4023
|
function normalizeDestinationPath(destinationPath) {
|
|
4107
|
-
const normalized = destinationPath.split(
|
|
4024
|
+
const normalized = destinationPath.split(path3.sep).join("/");
|
|
4108
4025
|
const segments = normalized.split("/").filter(Boolean);
|
|
4109
4026
|
if (segments.length === 0 || normalized.startsWith("/") || segments.some((segment) => segment === "..") || normalized.split("").some((char) => {
|
|
4110
4027
|
const code = char.charCodeAt(0);
|
|
@@ -4118,7 +4035,7 @@ async function listSourceFiles(sourceDir) {
|
|
|
4118
4035
|
const entries = [];
|
|
4119
4036
|
async function visit(dir) {
|
|
4120
4037
|
for (const entry of await readdir(dir, { withFileTypes: true })) {
|
|
4121
|
-
const absolutePath =
|
|
4038
|
+
const absolutePath = path3.join(dir, entry.name);
|
|
4122
4039
|
if (entry.isDirectory()) {
|
|
4123
4040
|
await visit(absolutePath);
|
|
4124
4041
|
} else if (entry.isFile() || entry.isSymbolicLink()) {
|
|
@@ -4152,7 +4069,7 @@ function artifactSidecarPointers(record) {
|
|
|
4152
4069
|
return pointers;
|
|
4153
4070
|
}
|
|
4154
4071
|
function artifactSidecarKey(destinationPath, pointerPath) {
|
|
4155
|
-
return
|
|
4072
|
+
return path3.posix.join(
|
|
4156
4073
|
RESULTS_REPO_RUNS_DIR,
|
|
4157
4074
|
normalizeDestinationPath(destinationPath),
|
|
4158
4075
|
normalizeDestinationPath(pointerPath)
|
|
@@ -4168,18 +4085,18 @@ function safeLocalSummaryManifestPath(sourceDir, manifestPath) {
|
|
|
4168
4085
|
if (typeof manifestPath !== "string" || manifestPath.trim().length === 0) {
|
|
4169
4086
|
return void 0;
|
|
4170
4087
|
}
|
|
4171
|
-
if (
|
|
4088
|
+
if (path3.isAbsolute(manifestPath)) {
|
|
4172
4089
|
return void 0;
|
|
4173
4090
|
}
|
|
4174
|
-
const normalized =
|
|
4175
|
-
if (normalized.startsWith("..") ||
|
|
4091
|
+
const normalized = path3.normalize(manifestPath);
|
|
4092
|
+
if (normalized.startsWith("..") || path3.isAbsolute(normalized)) {
|
|
4176
4093
|
return void 0;
|
|
4177
4094
|
}
|
|
4178
|
-
return
|
|
4095
|
+
return path3.join(sourceDir, normalized);
|
|
4179
4096
|
}
|
|
4180
4097
|
function resolveLocalResultManifestPath(sourceDir) {
|
|
4181
4098
|
try {
|
|
4182
|
-
const summary = JSON.parse(readFileSync2(
|
|
4099
|
+
const summary = JSON.parse(readFileSync2(path3.join(sourceDir, "summary.json"), "utf8"));
|
|
4183
4100
|
const manifestPath2 = safeLocalSummaryManifestPath(
|
|
4184
4101
|
sourceDir,
|
|
4185
4102
|
summary.index_path ?? summary.manifest_path
|
|
@@ -4189,11 +4106,11 @@ function resolveLocalResultManifestPath(sourceDir) {
|
|
|
4189
4106
|
}
|
|
4190
4107
|
} catch {
|
|
4191
4108
|
}
|
|
4192
|
-
const manifestPath =
|
|
4109
|
+
const manifestPath = path3.join(sourceDir, RUN_INTERNAL_DIRNAME, RESULT_INDEX_FILENAME2);
|
|
4193
4110
|
if (existsSync(manifestPath)) {
|
|
4194
4111
|
return manifestPath;
|
|
4195
4112
|
}
|
|
4196
|
-
const legacyManifestPath =
|
|
4113
|
+
const legacyManifestPath = path3.join(sourceDir, RESULT_INDEX_FILENAME2);
|
|
4197
4114
|
if (existsSync(legacyManifestPath)) {
|
|
4198
4115
|
return legacyManifestPath;
|
|
4199
4116
|
}
|
|
@@ -4219,10 +4136,10 @@ function collectArtifactSidecarPointers(sourceDir) {
|
|
|
4219
4136
|
}
|
|
4220
4137
|
function resolveArtifactPointerSourcePath(sourceDir, pointerPath) {
|
|
4221
4138
|
const normalizedPointerPath = normalizeDestinationPath(pointerPath);
|
|
4222
|
-
const sourceRoot =
|
|
4223
|
-
const sourcePath =
|
|
4224
|
-
const relative =
|
|
4225
|
-
if (relative.startsWith("..") ||
|
|
4139
|
+
const sourceRoot = path3.resolve(sourceDir);
|
|
4140
|
+
const sourcePath = path3.resolve(sourceRoot, ...normalizedPointerPath.split("/"));
|
|
4141
|
+
const relative = path3.relative(sourceRoot, sourcePath);
|
|
4142
|
+
if (relative.startsWith("..") || path3.isAbsolute(relative)) {
|
|
4226
4143
|
throw new Error(`Artifact pointer path escapes run directory: ${pointerPath}`);
|
|
4227
4144
|
}
|
|
4228
4145
|
return sourcePath;
|
|
@@ -4240,7 +4157,7 @@ async function prepareArtifactSidecar(params) {
|
|
|
4240
4157
|
if (params.pointers.length === 0) {
|
|
4241
4158
|
return void 0;
|
|
4242
4159
|
}
|
|
4243
|
-
const sidecarRoot = await mkdtemp(
|
|
4160
|
+
const sidecarRoot = await mkdtemp(path3.join(os.tmpdir(), "agentv-artifact-sidecar-"));
|
|
4244
4161
|
const copied = /* @__PURE__ */ new Set();
|
|
4245
4162
|
const contentByPath = /* @__PURE__ */ new Map();
|
|
4246
4163
|
try {
|
|
@@ -4256,8 +4173,8 @@ async function prepareArtifactSidecar(params) {
|
|
|
4256
4173
|
if (copied.has(relativePointerPath)) {
|
|
4257
4174
|
continue;
|
|
4258
4175
|
}
|
|
4259
|
-
const destinationPath =
|
|
4260
|
-
mkdirSync(
|
|
4176
|
+
const destinationPath = path3.join(sidecarRoot, ...relativePointerPath.split("/"));
|
|
4177
|
+
mkdirSync(path3.dirname(destinationPath), { recursive: true });
|
|
4261
4178
|
writeFileSync(destinationPath, content);
|
|
4262
4179
|
copied.add(relativePointerPath);
|
|
4263
4180
|
}
|
|
@@ -4309,19 +4226,19 @@ async function preparePublishedResultsSource(params) {
|
|
|
4309
4226
|
if (params.pointers.length === 0) {
|
|
4310
4227
|
return void 0;
|
|
4311
4228
|
}
|
|
4312
|
-
const publishedRoot = await mkdtemp(
|
|
4229
|
+
const publishedRoot = await mkdtemp(path3.join(os.tmpdir(), "agentv-results-published-"));
|
|
4313
4230
|
const omittedPaths = new Set(
|
|
4314
4231
|
params.pointers.map((pointer) => normalizeDestinationPath(pointer.path))
|
|
4315
4232
|
);
|
|
4316
4233
|
try {
|
|
4317
4234
|
const sourceFiles = await listSourceFiles(params.sourceDir);
|
|
4318
4235
|
for (const sourceFile of sourceFiles) {
|
|
4319
|
-
const relativeFile =
|
|
4320
|
-
const destinationFile =
|
|
4321
|
-
if (isResultManifestFilename(
|
|
4236
|
+
const relativeFile = path3.relative(params.sourceDir, sourceFile).split(path3.sep).join("/");
|
|
4237
|
+
const destinationFile = path3.join(publishedRoot, ...relativeFile.split("/"));
|
|
4238
|
+
if (isResultManifestFilename(path3.posix.basename(relativeFile))) {
|
|
4322
4239
|
const original = readFileSync2(sourceFile, "utf8");
|
|
4323
4240
|
const rewritten = original.split(/\r?\n/).map((line) => rewritePublishedIndexLine(line, params.destinationPath)).join("\n");
|
|
4324
|
-
mkdirSync(
|
|
4241
|
+
mkdirSync(path3.dirname(destinationFile), { recursive: true });
|
|
4325
4242
|
writeFileSync(destinationFile, rewritten);
|
|
4326
4243
|
continue;
|
|
4327
4244
|
}
|
|
@@ -4331,7 +4248,7 @@ async function preparePublishedResultsSource(params) {
|
|
|
4331
4248
|
if (omittedPaths.has(relativeFile)) {
|
|
4332
4249
|
continue;
|
|
4333
4250
|
}
|
|
4334
|
-
mkdirSync(
|
|
4251
|
+
mkdirSync(path3.dirname(destinationFile), { recursive: true });
|
|
4335
4252
|
await cp(sourceFile, destinationFile, { dereference: false });
|
|
4336
4253
|
}
|
|
4337
4254
|
} catch (error) {
|
|
@@ -4398,8 +4315,8 @@ async function commitStorageBranchWorktreePaths(params) {
|
|
|
4398
4315
|
normalized
|
|
4399
4316
|
});
|
|
4400
4317
|
}
|
|
4401
|
-
const indexRoot = await mkdtemp(
|
|
4402
|
-
const indexFile =
|
|
4318
|
+
const indexRoot = await mkdtemp(path3.join(os.tmpdir(), "agentv-results-index-"));
|
|
4319
|
+
const indexFile = path3.join(indexRoot, "index");
|
|
4403
4320
|
const indexEnv = { GIT_INDEX_FILE: indexFile };
|
|
4404
4321
|
try {
|
|
4405
4322
|
if (base.baseRef) {
|
|
@@ -4409,7 +4326,7 @@ async function commitStorageBranchWorktreePaths(params) {
|
|
|
4409
4326
|
}
|
|
4410
4327
|
await addResultsGitattributesToIndex(params.repoDir, indexEnv);
|
|
4411
4328
|
for (const gitPath of paths) {
|
|
4412
|
-
const sourcePath =
|
|
4329
|
+
const sourcePath = path3.join(params.repoDir, ...gitPath.split("/"));
|
|
4413
4330
|
if (!existsSync(sourcePath)) {
|
|
4414
4331
|
await runGit(["update-index", "--force-remove", "--", gitPath], {
|
|
4415
4332
|
cwd: params.repoDir,
|
|
@@ -4475,7 +4392,7 @@ async function commitResultsRunWithTemporaryIndex(params) {
|
|
|
4475
4392
|
await assertValidResultsBranchName(params.repoDir, normalized.branch);
|
|
4476
4393
|
await ensureResultsBranchNotCheckedOut(params.repoDir, normalized);
|
|
4477
4394
|
const destinationRunPath = normalizeDestinationPath(params.destinationPath);
|
|
4478
|
-
const destinationTreePath =
|
|
4395
|
+
const destinationTreePath = path3.posix.join(RESULTS_REPO_RUNS_DIR, destinationRunPath);
|
|
4479
4396
|
let base = await resolveStorageBranchBase({
|
|
4480
4397
|
repoDir: params.repoDir,
|
|
4481
4398
|
normalized,
|
|
@@ -4489,8 +4406,8 @@ async function commitResultsRunWithTemporaryIndex(params) {
|
|
|
4489
4406
|
preferRemote: params.preferRemoteBase
|
|
4490
4407
|
});
|
|
4491
4408
|
}
|
|
4492
|
-
const indexRoot = await mkdtemp(
|
|
4493
|
-
const indexFile =
|
|
4409
|
+
const indexRoot = await mkdtemp(path3.join(os.tmpdir(), "agentv-results-index-"));
|
|
4410
|
+
const indexFile = path3.join(indexRoot, "index");
|
|
4494
4411
|
const indexEnv = { GIT_INDEX_FILE: indexFile };
|
|
4495
4412
|
try {
|
|
4496
4413
|
if (base.baseRef) {
|
|
@@ -4513,8 +4430,8 @@ async function commitResultsRunWithTemporaryIndex(params) {
|
|
|
4513
4430
|
}
|
|
4514
4431
|
const sourceFiles = await listSourceFiles(params.sourceDir);
|
|
4515
4432
|
for (const sourceFile of sourceFiles) {
|
|
4516
|
-
const relativeFile =
|
|
4517
|
-
const destinationFile =
|
|
4433
|
+
const relativeFile = path3.relative(params.sourceDir, sourceFile).split(path3.sep).join("/");
|
|
4434
|
+
const destinationFile = path3.posix.join(destinationTreePath, relativeFile);
|
|
4518
4435
|
const fileStat = await lstat(sourceFile);
|
|
4519
4436
|
let mode = fileStat.mode & 73 ? "100755" : "100644";
|
|
4520
4437
|
let hashInputPath = sourceFile;
|
|
@@ -4794,18 +4711,18 @@ function safeGitSummaryManifestPath(runDir, manifestPath) {
|
|
|
4794
4711
|
if (manifestPath.startsWith("/")) {
|
|
4795
4712
|
return void 0;
|
|
4796
4713
|
}
|
|
4797
|
-
const normalized =
|
|
4714
|
+
const normalized = path3.posix.normalize(manifestPath);
|
|
4798
4715
|
if (normalized === ".." || normalized.startsWith("../")) {
|
|
4799
4716
|
return void 0;
|
|
4800
4717
|
}
|
|
4801
|
-
return
|
|
4718
|
+
return path3.posix.join(runDir, normalized);
|
|
4802
4719
|
}
|
|
4803
4720
|
function buildGitManifestPaths(treePaths, summaryByPath) {
|
|
4804
4721
|
const treePathSet = new Set(treePaths);
|
|
4805
4722
|
const manifestByRunDir = /* @__PURE__ */ new Map();
|
|
4806
4723
|
for (const [summaryPath, summary] of summaryByPath) {
|
|
4807
|
-
const runDir =
|
|
4808
|
-
const relativeRunPath =
|
|
4724
|
+
const runDir = path3.posix.dirname(summaryPath);
|
|
4725
|
+
const relativeRunPath = path3.posix.relative(RESULTS_REPO_RUNS_DIR, runDir);
|
|
4809
4726
|
if (!isV2ResultsRepoRunPath(relativeRunPath)) {
|
|
4810
4727
|
continue;
|
|
4811
4728
|
}
|
|
@@ -4819,7 +4736,7 @@ function buildGitManifestPaths(treePaths, summaryByPath) {
|
|
|
4819
4736
|
continue;
|
|
4820
4737
|
}
|
|
4821
4738
|
const runDir = gitRunDirForManifestPath(treePath);
|
|
4822
|
-
const relativeRunPath =
|
|
4739
|
+
const relativeRunPath = path3.posix.relative(RESULTS_REPO_RUNS_DIR, runDir);
|
|
4823
4740
|
if (!isV2ResultsRepoRunPath(relativeRunPath)) {
|
|
4824
4741
|
continue;
|
|
4825
4742
|
}
|
|
@@ -4831,8 +4748,8 @@ function buildGitManifestPaths(treePaths, summaryByPath) {
|
|
|
4831
4748
|
}
|
|
4832
4749
|
function fallbackGitManifestPath(runDir, treePathSet) {
|
|
4833
4750
|
for (const candidate of [
|
|
4834
|
-
|
|
4835
|
-
|
|
4751
|
+
path3.posix.join(runDir, ".internal", RESULT_INDEX_FILENAME2),
|
|
4752
|
+
path3.posix.join(runDir, RESULT_INDEX_FILENAME2)
|
|
4836
4753
|
]) {
|
|
4837
4754
|
if (treePathSet.has(candidate)) {
|
|
4838
4755
|
return candidate;
|
|
@@ -4841,15 +4758,15 @@ function fallbackGitManifestPath(runDir, treePathSet) {
|
|
|
4841
4758
|
return void 0;
|
|
4842
4759
|
}
|
|
4843
4760
|
function gitRunDirForManifestPath(manifestPath) {
|
|
4844
|
-
const manifestDir =
|
|
4845
|
-
return
|
|
4761
|
+
const manifestDir = path3.posix.dirname(manifestPath);
|
|
4762
|
+
return path3.posix.basename(manifestDir) === ".internal" ? path3.posix.dirname(manifestDir) : manifestDir;
|
|
4846
4763
|
}
|
|
4847
4764
|
function isV2ResultsRepoRunPath(relativeRunPath) {
|
|
4848
4765
|
const segments = relativeRunPath.split("/").filter(Boolean);
|
|
4849
4766
|
return segments.length === 1 && !segments[0].startsWith(".");
|
|
4850
4767
|
}
|
|
4851
4768
|
function buildGitRunId(relativeRunPath) {
|
|
4852
|
-
const normalized = relativeRunPath.split(
|
|
4769
|
+
const normalized = relativeRunPath.split(path3.sep).join("/");
|
|
4853
4770
|
const segments = normalized.split("/").filter(Boolean);
|
|
4854
4771
|
return segments[0] ?? relativeRunPath;
|
|
4855
4772
|
}
|
|
@@ -4978,7 +4895,7 @@ async function readGitResultArtifact(params) {
|
|
|
4978
4895
|
}
|
|
4979
4896
|
function buildWipBranchName(runDir) {
|
|
4980
4897
|
const hostname = os.hostname().replace(/[^A-Za-z0-9._-]+/g, "-").slice(0, 40);
|
|
4981
|
-
const runBasename =
|
|
4898
|
+
const runBasename = path3.basename(runDir).replace(/[^A-Za-z0-9._-]+/g, "-").slice(0, 60);
|
|
4982
4899
|
return `agentv/wip/${hostname}/${runBasename}`;
|
|
4983
4900
|
}
|
|
4984
4901
|
async function setupWipWorktree(params) {
|
|
@@ -4997,8 +4914,8 @@ async function setupWipWorktree(params) {
|
|
|
4997
4914
|
if (!baseRef) {
|
|
4998
4915
|
throw new Error("Could not resolve a base ref for the WIP results branch");
|
|
4999
4916
|
}
|
|
5000
|
-
const worktreeRoot = await mkdtemp(
|
|
5001
|
-
const worktreeDir =
|
|
4917
|
+
const worktreeRoot = await mkdtemp(path3.join(os.tmpdir(), "agentv-wip-"));
|
|
4918
|
+
const worktreeDir = path3.join(worktreeRoot, "repo");
|
|
5002
4919
|
await runGit(["worktree", "add", "-B", params.wipBranch, worktreeDir, baseRef], {
|
|
5003
4920
|
cwd: cloneDir
|
|
5004
4921
|
});
|
|
@@ -5017,7 +4934,7 @@ async function setupWipWorktree(params) {
|
|
|
5017
4934
|
};
|
|
5018
4935
|
}
|
|
5019
4936
|
async function pushWipCheckpoint(params) {
|
|
5020
|
-
const destinationDir =
|
|
4937
|
+
const destinationDir = path3.join(
|
|
5021
4938
|
params.handle.worktreeDir,
|
|
5022
4939
|
RESULTS_REPO_RUNS_DIR,
|
|
5023
4940
|
params.destinationPath
|
|
@@ -5028,7 +4945,7 @@ async function pushWipCheckpoint(params) {
|
|
|
5028
4945
|
destinationDir
|
|
5029
4946
|
});
|
|
5030
4947
|
writeFileSync(
|
|
5031
|
-
|
|
4948
|
+
path3.join(params.handle.worktreeDir, RESULTS_REPO_GITATTRIBUTES_FILE),
|
|
5032
4949
|
RESULTS_REPO_GITATTRIBUTES_CONTENT
|
|
5033
4950
|
);
|
|
5034
4951
|
await runGit(["add", "--all", "--", RESULTS_REPO_GITATTRIBUTES_FILE, params.destinationPath], {
|
|
@@ -5084,7 +5001,7 @@ function gitResultsIndexHash(value) {
|
|
|
5084
5001
|
return createHash("sha256").update(value).digest("hex");
|
|
5085
5002
|
}
|
|
5086
5003
|
function resolveGitResultsIndexRepoDir(repoDir) {
|
|
5087
|
-
const resolved =
|
|
5004
|
+
const resolved = path3.resolve(repoDir);
|
|
5088
5005
|
try {
|
|
5089
5006
|
return realpathSync(resolved);
|
|
5090
5007
|
} catch {
|
|
@@ -5100,7 +5017,7 @@ function gitResultsIndexRefKey(ref) {
|
|
|
5100
5017
|
}
|
|
5101
5018
|
function resolveGitResultsIndexCacheFile(params) {
|
|
5102
5019
|
const ref = params.ref ?? "origin/main";
|
|
5103
|
-
return
|
|
5020
|
+
return path3.join(
|
|
5104
5021
|
getAgentvDataDir(),
|
|
5105
5022
|
"cache",
|
|
5106
5023
|
"results-index",
|
|
@@ -5127,7 +5044,7 @@ function validateGitResultsIndexCacheFile(value, params) {
|
|
|
5127
5044
|
async function readGitResultsIndexCache(params) {
|
|
5128
5045
|
const cacheFile = resolveGitResultsIndexCacheFile(params);
|
|
5129
5046
|
try {
|
|
5130
|
-
const parsed = JSON.parse(await
|
|
5047
|
+
const parsed = JSON.parse(await readFile(cacheFile, "utf8"));
|
|
5131
5048
|
return validateGitResultsIndexCacheFile(parsed, params)?.runs;
|
|
5132
5049
|
} catch {
|
|
5133
5050
|
return void 0;
|
|
@@ -5146,7 +5063,7 @@ async function writeGitResultsIndexCache(params) {
|
|
|
5146
5063
|
runs: params.runs
|
|
5147
5064
|
};
|
|
5148
5065
|
try {
|
|
5149
|
-
mkdirSync(
|
|
5066
|
+
mkdirSync(path3.dirname(cacheFile), { recursive: true });
|
|
5150
5067
|
const tempFile = `${cacheFile}.${process.pid}.${Date.now()}.tmp`;
|
|
5151
5068
|
await writeFile(tempFile, `${JSON.stringify(envelope, null, 2)}
|
|
5152
5069
|
`, "utf8");
|
|
@@ -5224,9 +5141,9 @@ async function listGitRuns(repoDir, ref = "origin/main") {
|
|
|
5224
5141
|
const runs = blobs.flatMap((blob, index) => {
|
|
5225
5142
|
const manifestPath = indexPaths[index];
|
|
5226
5143
|
const runDir = gitRunDirForManifestPath(manifestPath);
|
|
5227
|
-
const summaryPath =
|
|
5144
|
+
const summaryPath = path3.posix.join(runDir, "summary.json");
|
|
5228
5145
|
const summary = summaryByPath.get(summaryPath);
|
|
5229
|
-
const relativeRunPath =
|
|
5146
|
+
const relativeRunPath = path3.posix.relative(RESULTS_REPO_RUNS_DIR, runDir);
|
|
5230
5147
|
const runId = buildGitRunId(relativeRunPath);
|
|
5231
5148
|
const rows = blob.content.toString("utf8").split(/\r?\n/).map((line) => line.trim()).filter(Boolean).flatMap(
|
|
5232
5149
|
(line) => {
|
|
@@ -5247,8 +5164,8 @@ async function listGitRuns(repoDir, ref = "origin/main") {
|
|
|
5247
5164
|
];
|
|
5248
5165
|
const rowScores = rows.map((row) => row.score).filter((score) => typeof score === "number" && Number.isFinite(score));
|
|
5249
5166
|
const avgScore = rowScores.length > 0 ? rowScores.reduce((sum, score) => sum + score, 0) / rowScores.length : 0;
|
|
5250
|
-
const timestamp = summary?.metadata?.timestamp?.trim() || rows[0]?.timestamp ||
|
|
5251
|
-
const displayName = summary?.metadata?.display_name?.trim() ||
|
|
5167
|
+
const timestamp = summary?.metadata?.timestamp?.trim() || rows[0]?.timestamp || path3.posix.basename(runDir);
|
|
5168
|
+
const displayName = summary?.metadata?.display_name?.trim() || path3.posix.basename(runDir);
|
|
5252
5169
|
const targets = summary?.metadata?.targets ?? rowTargets;
|
|
5253
5170
|
const passRate = computeAveragePassRate(summary?.run_summary) ?? avgScore;
|
|
5254
5171
|
const executionErrorCount = rows.filter(
|
|
@@ -5275,9 +5192,9 @@ async function listGitRuns(repoDir, ref = "origin/main") {
|
|
|
5275
5192
|
return runs;
|
|
5276
5193
|
}
|
|
5277
5194
|
async function materializeGitRun(repoDir, relativeRunPath, ref = "origin/main") {
|
|
5278
|
-
const normalizedRunPath = relativeRunPath.split(
|
|
5279
|
-
const runTreePath =
|
|
5280
|
-
const targetRunDir =
|
|
5195
|
+
const normalizedRunPath = relativeRunPath.split(path3.sep).join("/");
|
|
5196
|
+
const runTreePath = path3.posix.join(RESULTS_REPO_RUNS_DIR, normalizedRunPath);
|
|
5197
|
+
const targetRunDir = path3.join(repoDir, ...runTreePath.split("/"));
|
|
5281
5198
|
const { stdout: treeOut } = await runGit(["ls-tree", "-r", "--name-only", ref, runTreePath], {
|
|
5282
5199
|
cwd: repoDir
|
|
5283
5200
|
});
|
|
@@ -5293,16 +5210,16 @@ async function materializeGitRun(repoDir, relativeRunPath, ref = "origin/main")
|
|
|
5293
5210
|
`Expected ${filePaths.length} git blobs but received ${blobs.length} while materializing results run`
|
|
5294
5211
|
);
|
|
5295
5212
|
}
|
|
5296
|
-
const tempRoot = mkdtempSync(
|
|
5297
|
-
const tempRunDir =
|
|
5213
|
+
const tempRoot = mkdtempSync(path3.join(repoDir, ".agentv-run-"));
|
|
5214
|
+
const tempRunDir = path3.join(tempRoot, "run");
|
|
5298
5215
|
try {
|
|
5299
5216
|
for (const [index, filePath] of filePaths.entries()) {
|
|
5300
|
-
const relativeFilePath =
|
|
5301
|
-
const absolutePath =
|
|
5302
|
-
mkdirSync(
|
|
5217
|
+
const relativeFilePath = path3.posix.relative(runTreePath, filePath);
|
|
5218
|
+
const absolutePath = path3.join(tempRunDir, ...relativeFilePath.split("/"));
|
|
5219
|
+
mkdirSync(path3.dirname(absolutePath), { recursive: true });
|
|
5303
5220
|
writeFileSync(absolutePath, blobs[index].content);
|
|
5304
5221
|
}
|
|
5305
|
-
mkdirSync(
|
|
5222
|
+
mkdirSync(path3.dirname(targetRunDir), { recursive: true });
|
|
5306
5223
|
try {
|
|
5307
5224
|
renameSync(tempRunDir, targetRunDir);
|
|
5308
5225
|
} catch (error) {
|
|
@@ -5810,7 +5727,7 @@ function extractResponseItemContent(content) {
|
|
|
5810
5727
|
}
|
|
5811
5728
|
return parts.length > 0 ? parts.join("") : void 0;
|
|
5812
5729
|
}
|
|
5813
|
-
var DEFAULT_SESSIONS_DIR = () =>
|
|
5730
|
+
var DEFAULT_SESSIONS_DIR = () => path4.join(homedir(), ".codex", "sessions");
|
|
5814
5731
|
async function discoverCodexSessions(opts) {
|
|
5815
5732
|
const sessionsDir = opts?.sessionsDir ?? DEFAULT_SESSIONS_DIR();
|
|
5816
5733
|
const limit = opts?.latest ? 1 : opts?.limit ?? 10;
|
|
@@ -5822,7 +5739,7 @@ async function discoverCodexSessions(opts) {
|
|
|
5822
5739
|
return [];
|
|
5823
5740
|
}
|
|
5824
5741
|
for (const year of yearDirs) {
|
|
5825
|
-
const yearPath =
|
|
5742
|
+
const yearPath = path4.join(sessionsDir, year);
|
|
5826
5743
|
let monthDirs;
|
|
5827
5744
|
try {
|
|
5828
5745
|
monthDirs = await readdir2(yearPath);
|
|
@@ -5830,7 +5747,7 @@ async function discoverCodexSessions(opts) {
|
|
|
5830
5747
|
continue;
|
|
5831
5748
|
}
|
|
5832
5749
|
for (const month of monthDirs) {
|
|
5833
|
-
const monthPath =
|
|
5750
|
+
const monthPath = path4.join(yearPath, month);
|
|
5834
5751
|
let dayDirs;
|
|
5835
5752
|
try {
|
|
5836
5753
|
dayDirs = await readdir2(monthPath);
|
|
@@ -5842,7 +5759,7 @@ async function discoverCodexSessions(opts) {
|
|
|
5842
5759
|
const dirDate = `${year}-${month}-${day}`;
|
|
5843
5760
|
if (dirDate !== opts.date) continue;
|
|
5844
5761
|
}
|
|
5845
|
-
const dayPath =
|
|
5762
|
+
const dayPath = path4.join(monthPath, day);
|
|
5846
5763
|
let files;
|
|
5847
5764
|
try {
|
|
5848
5765
|
files = await readdir2(dayPath);
|
|
@@ -5851,7 +5768,7 @@ async function discoverCodexSessions(opts) {
|
|
|
5851
5768
|
}
|
|
5852
5769
|
for (const file of files) {
|
|
5853
5770
|
if (!file.startsWith("rollout-") || !file.endsWith(".jsonl")) continue;
|
|
5854
|
-
const filePath =
|
|
5771
|
+
const filePath = path4.join(dayPath, file);
|
|
5855
5772
|
const nameWithoutExt = file.replace(/\.jsonl$/, "");
|
|
5856
5773
|
const parts = nameWithoutExt.split("-");
|
|
5857
5774
|
const sessionId = parts.length >= 6 ? parts.slice(-5).join("-") : nameWithoutExt;
|
|
@@ -5870,7 +5787,7 @@ async function discoverCodexSessions(opts) {
|
|
|
5870
5787
|
sessions.sort((a, b) => b.updatedAt.getTime() - a.updatedAt.getTime());
|
|
5871
5788
|
return sessions.slice(0, limit);
|
|
5872
5789
|
}
|
|
5873
|
-
var DEFAULT_PROJECTS_DIR = () =>
|
|
5790
|
+
var DEFAULT_PROJECTS_DIR = () => path5.join(homedir2(), ".claude", "projects");
|
|
5874
5791
|
function encodeProjectPath(projectPath) {
|
|
5875
5792
|
return projectPath.replace(/\//g, "-");
|
|
5876
5793
|
}
|
|
@@ -5889,7 +5806,7 @@ async function discoverClaudeSessions(opts) {
|
|
|
5889
5806
|
}
|
|
5890
5807
|
const sessions = [];
|
|
5891
5808
|
for (const projectDir of projectDirs) {
|
|
5892
|
-
const dirPath =
|
|
5809
|
+
const dirPath = path5.join(projectsDir, projectDir);
|
|
5893
5810
|
let entries;
|
|
5894
5811
|
try {
|
|
5895
5812
|
entries = await readdir3(dirPath);
|
|
@@ -5900,7 +5817,7 @@ async function discoverClaudeSessions(opts) {
|
|
|
5900
5817
|
if (!entry.endsWith(".jsonl")) continue;
|
|
5901
5818
|
const sessionId = entry.replace(/\.jsonl$/, "");
|
|
5902
5819
|
if (opts?.sessionId && sessionId !== opts.sessionId) continue;
|
|
5903
|
-
const filePath =
|
|
5820
|
+
const filePath = path5.join(dirPath, entry);
|
|
5904
5821
|
let updatedAt;
|
|
5905
5822
|
try {
|
|
5906
5823
|
const fileStat = await stat3(filePath);
|
|
@@ -6128,7 +6045,6 @@ export {
|
|
|
6128
6045
|
defineConfig,
|
|
6129
6046
|
loadTsConfig,
|
|
6130
6047
|
generateRubrics,
|
|
6131
|
-
scanRepoDeps,
|
|
6132
6048
|
normalizeResultsConfig,
|
|
6133
6049
|
resolveResultsRepoUrl,
|
|
6134
6050
|
getResultsRepoLocalPaths,
|
|
@@ -6173,4 +6089,4 @@ export {
|
|
|
6173
6089
|
parseCopilotEvents,
|
|
6174
6090
|
createAgentKernel
|
|
6175
6091
|
};
|
|
6176
|
-
//# sourceMappingURL=chunk-
|
|
6092
|
+
//# sourceMappingURL=chunk-V52ATPTT.js.map
|