openclaw/src/agents/agent-paths.ts

21 lines
640 B
TypeScript
Raw Normal View History

2025-12-23 02:48:48 +01:00
import path from "node:path";
import { CONFIG_DIR, resolveUserPath } from "../utils.js";
const DEFAULT_AGENT_DIR = path.join(CONFIG_DIR, "agent");
2026-01-04 14:32:47 +00:00
export function resolveClawdbotAgentDir(): string {
2025-12-23 02:48:48 +01:00
const override =
2026-01-04 14:32:47 +00:00
process.env.CLAWDBOT_AGENT_DIR?.trim() ||
2025-12-23 02:48:48 +01:00
process.env.PI_CODING_AGENT_DIR?.trim() ||
DEFAULT_AGENT_DIR;
return resolveUserPath(override);
}
2026-01-04 14:32:47 +00:00
export function ensureClawdbotAgentEnv(): string {
const dir = resolveClawdbotAgentDir();
if (!process.env.CLAWDBOT_AGENT_DIR) process.env.CLAWDBOT_AGENT_DIR = dir;
2025-12-23 02:48:48 +01:00
if (!process.env.PI_CODING_AGENT_DIR) process.env.PI_CODING_AGENT_DIR = dir;
return dir;
}