Download src/agents/cli-runner/cleanup.ts from SaylorTwift/openclaw: direct link, hf CLI and curl.
- Browser
- Download file 990 Bytes
-
https://huggingface.co/SaylorTwift/openclaw/resolve/main/src/agents/cli-runner/cleanup.ts
- Command line
-
hf download hf://SaylorTwift/openclaw/src/agents/cli-runner/cleanup.ts
-
curl -L -o cleanup.ts https://huggingface.co/SaylorTwift/openclaw/resolve/main/src/agents/cli-runner/cleanup.ts
990 Bytes
| import { toErrorObject } from "../../infra/errors.js"; | |
| import { recordModelFallbackStop } from "../failover-error.js"; | |
| import { runOwnedAgentCleanup } from "../run-cleanup-timeout.js"; | |
| import { cliBackendLog } from "./log.js"; | |
| import type { RunCliAgentParams } from "./types.js"; | |
| /** Join CLI cleanup; replacement requires closure before any provider can proceed. */ | |
| export async function runCliCleanup( | |
| params: Pick<RunCliAgentParams, "runId" | "sessionId" | "oneShotCliRun">, | |
| step: string, | |
| cleanup: () => Promise<void>, | |
| settlement?: "required", | |
| ): Promise<void> { | |
| try { | |
| await runOwnedAgentCleanup({ ...params, step, cleanup, settlement, log: cliBackendLog }); | |
| } catch (error) { | |
| if (settlement !== "required") { | |
| throw error; | |
| } | |
| const failure = toErrorObject(error, "CLI resource cleanup failed"); | |
| // A different provider must not replace resources whose previous owner is still unclosed. | |
| recordModelFallbackStop(failure); | |
| throw failure; | |
| } | |
| } | |