openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
27 lines (26 loc) • 1.19 kB
JavaScript
import { E as parseStrictNonNegativeInteger } from "./number-coercion-D6u-4YD8.mjs";
import { o as writeRuntimeJson } from "./runtime-B-SLYP-m.mjs";
import { r as terminalText } from "./safe-text-C80HAQ2e.mjs";
import { a as recordBackupOutcomeBestEffort } from "./backup-shared-BmR-itzA.mjs";
//#region src/commands/backup-record.ts
/** Host-owned jobs can contribute outcomes without changing their execution owner. */
async function backupRecordCommand(e, t) {
if (t.status !== "ok" && t.status !== "failed") throw new Error("--status must be ok or failed.");
const n = t.target?.trim();
if (!n) throw new Error("Missing required --target label.");
const r = t.bytes === void 0 ? void 0 : parseStrictNonNegativeInteger(t.bytes);
if (r === void 0 && t.bytes !== void 0) throw new Error("--bytes must be a nonnegative integer.");
const i = {
kind: "external",
archivePath: n,
target: n,
status: t.status,
...r !== void 0 ? { bytes: r } : {},
...t.error ? { error: t.error } : {}
};
await recordBackupOutcomeBestEffort(e, i);
if (t.json) writeRuntimeJson(e, i);
else e.log(terminalText`External backup: ${n} (${t.status})`);
}
//#endregion
export { backupRecordCommand };