openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
33 lines (32 loc) • 1.6 kB
JavaScript
import { a as resolveGlobalSingleton } from "./global-singleton-D7yf05nR.mjs";
import { r as resolveStateDir } from "./state-dir-DiG0gXzD.mjs";
import { m as resolveConfigPath } from "./paths-DAcAg5aV.mjs";
import { t as resolveDefaultAgentWorkspaceDir } from "./workspace-default-path-CWX4WiCH.mjs";
import "./workspace-default-DvctYF3A.mjs";
import { AsyncLocalStorage } from "node:async_hooks";
//#region src/infra/installation-target-context.ts
const installationTargetContext = resolveGlobalSingleton(Symbol.for("openclaw.installationTargetContext"), () => new AsyncLocalStorage());
const LOCAL_INSTALLATION_TARGET_UNSUPPORTED = "This runtime cannot target the diagnosed local installation. Use the saved prompt with a suggested external or manual handoff on this machine.";
function resolveInstallationTarget(e = process.env) {
const t = resolveStateDir(e);
return Object.freeze({
stateDir: t,
configPath: resolveConfigPath(e, t),
defaultWorkspaceDir: resolveDefaultAgentWorkspaceDir(e)
});
}
function getInstallationTarget() {
return installationTargetContext.getStore();
}
function installationTargetEnv(e) {
return e ? Object.freeze({
OPENCLAW_STATE_DIR: e.stateDir,
OPENCLAW_CONFIG_PATH: e.configPath,
OPENCLAW_WORKSPACE_DIR: e.defaultWorkspaceDir
}) : void 0;
}
function withInstallationTarget(e, t) {
return installationTargetContext.run(e ? Object.freeze({ ...e }) : void 0, t);
}
//#endregion
export { withInstallationTarget as a, resolveInstallationTarget as i, getInstallationTarget as n, installationTargetEnv as r, LOCAL_INSTALLATION_TARGET_UNSUPPORTED as t };