fix: add missing collectDirectorySeedFiles definition

This commit is contained in:
Codex Agent
2026-06-07 14:51:35 +08:00
parent 94571fb50c
commit bfedec8f30
+20
View File
@@ -942,6 +942,26 @@ function agentTraceIdentityArtifact(run: PreparedCaseRun, agent: AgentRunStage)
});
}
async function collectDirectorySeedFiles(sourceRel: string, targetRel: string, files: AgentWorkspaceFile[]): Promise<void> {
const sourceDir = path.join(SOURCE_ROOT, sourceRel);
const stack: string[] = [""];
while (stack.length > 0) {
const sub = stack.pop()!;
const dirPath = path.join(sourceDir, sub);
const entries = await readdir(dirPath, { withFileTypes: true });
for (const dirent of entries) {
const relPath = sub ? path.join(sub, dirent.name) : dirent.name;
if (dirent.isDirectory()) {
stack.push(relPath);
} else if (dirent.isFile()) {
const filePath = path.join(dirPath, dirent.name);
const targetPath = path.join(targetRel, relPath).replace(/\\/g, "/");
files.push({ path: targetPath, content: await readFile(filePath, "utf8"), encoding: "utf8" });
}
}
}
}
async function agentWorkspaceFilesForRun(run: PreparedCaseRun): Promise<AgentWorkspaceFile[]> {
const content = await readFile(run.specPath, "utf8");
const files: AgentWorkspaceFile[] = [{ path: ".hwlab/hwpod-spec.yaml", content, encoding: "utf8" }];