mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 02:42:43 +00:00
refactor(session): centralize transcript path option resolution
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
loadSessionStore,
|
||||
resolveMainSessionKey,
|
||||
resolveSessionFilePath,
|
||||
resolveSessionFilePathOptions,
|
||||
resolveSessionTranscriptsDirForAgent,
|
||||
resolveStorePath,
|
||||
} from "../config/sessions.js";
|
||||
@@ -386,6 +387,7 @@ export async function noteStateIntegrity(
|
||||
}
|
||||
|
||||
const store = loadSessionStore(storePath);
|
||||
const sessionPathOpts = resolveSessionFilePathOptions({ agentId, storePath });
|
||||
const entries = Object.entries(store).filter(([, entry]) => entry && typeof entry === "object");
|
||||
if (entries.length > 0) {
|
||||
const recent = entries
|
||||
@@ -401,9 +403,7 @@ export async function noteStateIntegrity(
|
||||
if (!sessionId) {
|
||||
return false;
|
||||
}
|
||||
const transcriptPath = resolveSessionFilePath(sessionId, entry, {
|
||||
agentId,
|
||||
});
|
||||
const transcriptPath = resolveSessionFilePath(sessionId, entry, sessionPathOpts);
|
||||
return !existsFile(transcriptPath);
|
||||
});
|
||||
if (missing.length > 0) {
|
||||
@@ -415,7 +415,11 @@ export async function noteStateIntegrity(
|
||||
const mainKey = resolveMainSessionKey(cfg);
|
||||
const mainEntry = store[mainKey];
|
||||
if (mainEntry?.sessionId) {
|
||||
const transcriptPath = resolveSessionFilePath(mainEntry.sessionId, mainEntry, { agentId });
|
||||
const transcriptPath = resolveSessionFilePath(
|
||||
mainEntry.sessionId,
|
||||
mainEntry,
|
||||
sessionPathOpts,
|
||||
);
|
||||
if (!existsFile(transcriptPath)) {
|
||||
warnings.push(
|
||||
`- Main session transcript missing (${shortenHomePath(transcriptPath)}). History will appear to reset.`,
|
||||
|
||||
Reference in New Issue
Block a user