mirror of
https://github.com/morluto/rea.git
synced 2026-11-15 19:23:24 +00:00
26 lines
708 B
JavaScript
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 }),
|
|
]);
|
|
}
|