mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 15:10:43 +00:00
19 lines
717 B
TypeScript
19 lines
717 B
TypeScript
import os from "node:os";
|
|
import path from "node:path";
|
|
import { resolveRequiredHomeDir } from "../infra/home-dir.js";
|
|
import { normalizeOptionalLowercaseString } from "../shared/string-coerce.js";
|
|
|
|
export function resolveDefaultAgentWorkspaceDir(
|
|
env: NodeJS.ProcessEnv = process.env,
|
|
homedir: () => string = os.homedir,
|
|
): string {
|
|
const home = resolveRequiredHomeDir(env, homedir);
|
|
const profile = env.OPENCLAW_PROFILE?.trim();
|
|
if (profile && normalizeOptionalLowercaseString(profile) !== "default") {
|
|
return path.join(home, ".openclaw", `workspace-${profile}`);
|
|
}
|
|
return path.join(home, ".openclaw", "workspace");
|
|
}
|
|
|
|
export const DEFAULT_AGENT_WORKSPACE_DIR = resolveDefaultAgentWorkspaceDir();
|