UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

33 lines (32 loc) • 1.66 kB
import { a as resolveGlobalSingleton } from "./global-singleton-0m-JziJW.mjs"; import { r as resolveStateDir } from "./state-dir-CfAW6S2K.mjs"; import { m as resolveConfigPath } from "./paths-FklbMVOH.mjs"; import { t as resolveDefaultAgentWorkspaceDir } from "./workspace-default-path-BG9KN4ds.mjs"; import "./workspace-default-CQbD5G-j.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(env = process.env) { const stateDir = resolveStateDir(env); return Object.freeze({ stateDir, configPath: resolveConfigPath(env, stateDir), defaultWorkspaceDir: resolveDefaultAgentWorkspaceDir(env) }); } function getInstallationTarget() { return installationTargetContext.getStore(); } function installationTargetEnv(target) { return target ? Object.freeze({ OPENCLAW_STATE_DIR: target.stateDir, OPENCLAW_CONFIG_PATH: target.configPath, OPENCLAW_WORKSPACE_DIR: target.defaultWorkspaceDir }) : void 0; } function withInstallationTarget(target, run) { return installationTargetContext.run(target ? Object.freeze({ ...target }) : void 0, run); } //#endregion export { withInstallationTarget as a, resolveInstallationTarget as i, getInstallationTarget as n, installationTargetEnv as r, LOCAL_INSTALLATION_TARGET_UNSUPPORTED as t };