mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 21:14:31 +00:00
refactor(session): centralize transcript path option resolution
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import path from "node:path";
|
||||
import {
|
||||
listAgentIds,
|
||||
resolveAgentDir,
|
||||
@@ -45,6 +44,7 @@ import {
|
||||
resolveAndPersistSessionFile,
|
||||
resolveAgentIdFromSessionKey,
|
||||
resolveSessionFilePath,
|
||||
resolveSessionFilePathOptions,
|
||||
resolveSessionTranscriptPath,
|
||||
type SessionEntry,
|
||||
updateSessionStore,
|
||||
@@ -510,10 +510,11 @@ export async function agentCommand(
|
||||
});
|
||||
}
|
||||
}
|
||||
let sessionFile = resolveSessionFilePath(sessionId, sessionEntry, {
|
||||
const sessionPathOpts = resolveSessionFilePathOptions({
|
||||
agentId: sessionAgentId,
|
||||
sessionsDir: path.dirname(storePath),
|
||||
storePath,
|
||||
});
|
||||
let sessionFile = resolveSessionFilePath(sessionId, sessionEntry, sessionPathOpts);
|
||||
if (sessionStore && sessionKey) {
|
||||
const threadIdFromSessionKey = parseSessionThreadInfo(sessionKey).threadId;
|
||||
const fallbackSessionFile = !sessionEntry?.sessionFile
|
||||
@@ -529,8 +530,8 @@ export async function agentCommand(
|
||||
sessionStore,
|
||||
storePath,
|
||||
sessionEntry,
|
||||
agentId: sessionAgentId,
|
||||
sessionsDir: path.dirname(storePath),
|
||||
agentId: sessionPathOpts?.agentId,
|
||||
sessionsDir: sessionPathOpts?.sessionsDir,
|
||||
fallbackSessionFile,
|
||||
});
|
||||
sessionFile = resolvedSessionFile.sessionFile;
|
||||
|
||||
Reference in New Issue
Block a user