14 lines
579 B
TypeScript
14 lines
579 B
TypeScript
import path from "node:path";
|
|
import { resolveStateDir } from "../config/paths.js";
|
|
import { DEFAULT_AGENT_ID } from "../routing/session-key.js";
|
|
import { resolveUserPath } from "../utils.js";
|
|
|
|
export function resolveOpenClawAgentDir(env: NodeJS.ProcessEnv = process.env): string {
|
|
const override = env.OPENCLAW_AGENT_DIR?.trim() || env.PI_CODING_AGENT_DIR?.trim();
|
|
if (override) {
|
|
return resolveUserPath(override, env);
|
|
}
|
|
const defaultAgentDir = path.join(resolveStateDir(env), "agents", DEFAULT_AGENT_ID, "agent");
|
|
return resolveUserPath(defaultAgentDir, env);
|
|
}
|