openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
41 lines (40 loc) • 2.06 kB
JavaScript
import { n as isTruthyEnvValue } from "./env-HehwidXj.mjs";
import { n as resolveCommitHash, t as gitCommitPrefixesMatch } from "./git-commit-D8Q_PzK2.mjs";
import { r as resolveOpenClawPackageRootSync } from "./openclaw-root-C-ayo09z.mjs";
import { n as readInstallOwner } from "./install-owner-DDPQXcjQ.mjs";
import { i as readBuiltRuntimeIsolation, r as readBuiltRuntimeCommit } from "./update-git-runtime-CP5qQp-3.mjs";
//#region src/commands/doctor-stale-runtime-build.ts
const STALE_RUNTIME_BUILD_CHECK_ID = "core/doctor/stale-runtime-build";
async function collectStaleRuntimeBuildFindings(e = {}) {
const t = e.env ?? process.env;
if (isTruthyEnvValue(t.OPENCLAW_UPDATE_IN_PROGRESS)) return [];
const n = e.root ?? resolveOpenClawPackageRootSync({ moduleUrl: import.meta.url });
if (!n || await readInstallOwner(n)) return [];
const [r, i] = await Promise.all([readBuiltRuntimeCommit(n), readBuiltRuntimeIsolation(n)]);
const a = i ? [{
checkId: STALE_RUNTIME_BUILD_CHECK_ID,
severity: "warning",
message: `This immutable release was built by the operator${i.account ? ` ${i.account} (uid ${i.uid}, gid ${i.gid})` : ""} without an isolated build account.`,
path: n,
details: i,
fixHint: "See https://docs.openclaw.ai/cli/update for build-account provisioning. The sealed release remains usable."
}] : [];
if (!r) return a;
const { GIT_COMMIT: o, GIT_SHA: s, ...c } = t;
const l = resolveCommitHash({
cwd: n,
env: c
});
if (!l || gitCommitPrefixesMatch(r, l)) return a;
return [...a, {
checkId: STALE_RUNTIME_BUILD_CHECK_ID,
severity: "warning",
category: "fix-now",
docsUrl: "https://docs.openclaw.ai/install/updating",
message: `Running build came from commit ${r.slice(0, 7)}, but the checkout is at ${l.slice(0, 7)}; the loaded runtime is older than its source.`,
path: n,
fixHint: "Run `openclaw update` to rebuild and restart through the update lifecycle. For a manual build, stop the Gateway before running `pnpm build`, then start it again."
}];
}
//#endregion
export { collectStaleRuntimeBuildFindings };