Files
reverse-engineering-anything/scripts/lib/agent-evaluation-cleanup.mjs
T

26 lines
708 B
JavaScript

import { rm } from "node:fs/promises";
import { closeVerifierResources } from "./verifier-cleanup.mjs";
/**
* Release the evaluation commands, then remove the run root, or keep it when
* asked; the root stays while the commands are unconfirmed. Copied
* authentication is removed independently, even when the commands or the root
* fail to release.
*/
export async function closeAgentEvaluation({
fixture,
commands,
authPath,
keepFixtures,
}) {
fixture.releaseAfter(() => commands.close());
await closeVerifierResources([
() =>
keepFixtures
? fixture.keep("REA_AGENT_EVAL_KEEP_FIXTURES=true")
: fixture.release(),
() => rm(authPath, { force: true }),
]);
}