UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

44 lines (43 loc) • 3.44 kB
import { a as crabboxCaptureUnsupportedSentence, d as listCrabboxWarmImages, m as recoverCrabboxWarmImageCapture, s as crabboxWarmImageRecoveryHint, t as CRABBOX_WARM_IMAGE_WAIT_HINT, u as listCrabboxLegacyWarmLeases } from "./crabbox-worker-warm-image-store-CTZ77FWn.mjs"; //#region extensions/crabbox/src/crabbox-worker-warm-image-cli.ts function registerCrabboxWarmImageCommands(program, state) { program.command("crabbox").description("Manage Crabbox warm images").command("warm-images").description("Inspect local warm-image ownership or acknowledge manual provider cleanup").option("--json", "Print local warm-image records as JSON").option("--recover <selector>", "Clear the exact capture or legacy allocation shown by inspection after manual cleanup").option("--acknowledge-provider-cleanup", "Confirm owning processes and recovered workers are stopped and provider artifacts are reconciled").action(async (options) => { if (options.acknowledgeProviderCleanup && !options.recover) throw new Error("--acknowledge-provider-cleanup requires --recover <selector> from warm-images inspection."); if (options.recover) await recoverCrabboxWarmImageCapture(state, options.recover, options.acknowledgeProviderCleanup === true); const images = await listCrabboxWarmImages(state); const legacyLeases = await listCrabboxLegacyWarmLeases(state); const nextSteps = "Restart the Gateway after manual reconciliation; the next eligible worker can capture again."; if (options.json) { process.stdout.write(`${JSON.stringify({ images, legacyLeases, ...options.recover ? { recoveredCapture: options.recover, nextSteps } : {} }, null, 2)}\n`); return; } const lines = options.recover ? ["Selected recovery record cleared; retained images and other allocation choices are preserved. No provider commands were run.", nextSteps] : []; if (images.length === 0 && legacyLeases.length === 0) lines.push("No Crabbox warm images are recorded locally."); for (const lease of legacyLeases) { lines.push(`Legacy worker allocation ${lease.leaseId}: original image choice is unknown.`); lines.push(` ${crabboxWarmImageRecoveryHint(lease.selector)}`); } for (const image of images) { lines.push(`${image.profileKey}: ${image.checkpointId ?? "no checkpoint"} (${image.state})`); if (image.captureUnsupported) lines.push(` Capture unsupported: ${crabboxCaptureUnsupportedSentence(image.captureUnsupported.message)} Workers use an existing compatible snapshot when one is available and otherwise provision cold; each eligible worker retries capture, so Crabbox configuration changes apply to the next dispatch. Set settings.warmImage: false on the profile to stop capture attempts.`); if (image.capture) { const uncertain = image.capture.phase === "uncertain"; const label = uncertain ? "paused" : image.capture.stale ? "still pending" : "in progress"; lines.push(` Capture ${label}: ${image.capture.selector}`); if (uncertain) lines.push(` ${crabboxWarmImageRecoveryHint(image.capture.selector)}`); else if (image.capture.stale) lines.push(` ${CRABBOX_WARM_IMAGE_WAIT_HINT}`); } if (image.retirement) lines.push(` Checkpoint deletion pending: ${image.retirement.checkpointId}; retried during the next warm-image capture or worker teardown.`); } process.stdout.write(`${lines.join("\n")}\n`); }); } //#endregion export { registerCrabboxWarmImageCommands };