mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 21:53:43 +00:00
fix(sessions): set transcriptPath to agent sessions directory (openclaw#24775) thanks @martinfrancois
Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: martinfrancois <14319020+martinfrancois@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
import path from "node:path";
|
||||
import { Type } from "@sinclair/typebox";
|
||||
import { loadConfig } from "../../config/config.js";
|
||||
import { resolveSessionFilePath, resolveSessionFilePathOptions } from "../../config/sessions.js";
|
||||
import {
|
||||
resolveSessionFilePath,
|
||||
resolveSessionFilePathOptions,
|
||||
resolveStorePath,
|
||||
} from "../../config/sessions.js";
|
||||
import { callGateway } from "../../gateway/call.js";
|
||||
import { resolveAgentIdFromSessionKey } from "../../routing/session-key.js";
|
||||
import type { AnyAgentTool } from "./common.js";
|
||||
@@ -153,16 +158,26 @@ export function createSessionsListTool(opts?: {
|
||||
const sessionFileRaw = (entry as { sessionFile?: unknown }).sessionFile;
|
||||
const sessionFile = typeof sessionFileRaw === "string" ? sessionFileRaw : undefined;
|
||||
let transcriptPath: string | undefined;
|
||||
if (sessionId && storePath) {
|
||||
if (sessionId) {
|
||||
try {
|
||||
const sessionPathOpts = resolveSessionFilePathOptions({
|
||||
agentId: resolveAgentIdFromSessionKey(key),
|
||||
storePath,
|
||||
const agentId = resolveAgentIdFromSessionKey(key);
|
||||
const trimmedStorePath = storePath?.trim();
|
||||
let effectiveStorePath: string | undefined;
|
||||
if (trimmedStorePath && trimmedStorePath !== "(multiple)") {
|
||||
if (trimmedStorePath.includes("{agentId}") || trimmedStorePath.startsWith("~")) {
|
||||
effectiveStorePath = resolveStorePath(trimmedStorePath, { agentId });
|
||||
} else if (path.isAbsolute(trimmedStorePath)) {
|
||||
effectiveStorePath = trimmedStorePath;
|
||||
}
|
||||
}
|
||||
const filePathOpts = resolveSessionFilePathOptions({
|
||||
agentId,
|
||||
storePath: effectiveStorePath,
|
||||
});
|
||||
transcriptPath = resolveSessionFilePath(
|
||||
sessionId,
|
||||
sessionFile ? { sessionFile } : undefined,
|
||||
sessionPathOpts,
|
||||
filePathOpts,
|
||||
);
|
||||
} catch {
|
||||
transcriptPath = undefined;
|
||||
|
||||
Reference in New Issue
Block a user