fix sessions dir from state env

what: use CLAWDBOT_STATE_DIR/CLAWDIS_STATE_DIR for session transcripts

why: isolate multi-instance gateways

tests: not run
This commit is contained in:
Josh Palmer
2026-01-05 00:51:01 +01:00
parent 59dfe0337d
commit aa45f512f4
3 changed files with 26 additions and 4 deletions

View File

@@ -7,6 +7,7 @@ import type { Skill } from "@mariozechner/pi-coding-agent";
import JSON5 from "json5";
import type { MsgContext } from "../auto-reply/templating.js";
import { normalizeE164 } from "../utils.js";
import { resolveStateDir } from "./paths.js";
export type SessionScope = "per-sender" | "global";
@@ -84,8 +85,11 @@ export type SessionSkillSnapshot = {
resolvedSkills?: Skill[];
};
export function resolveSessionTranscriptsDir(): string {
return path.join(os.homedir(), ".clawdbot", "sessions");
export function resolveSessionTranscriptsDir(
env: NodeJS.ProcessEnv = process.env,
homedir: () => string = os.homedir,
): string {
return path.join(resolveStateDir(env, homedir), "sessions");
}
export function resolveDefaultSessionStorePath(): string {