Sessions: fix sessions_list transcriptPath path resolution

This commit is contained in:
Vignesh Natarajan
2026-02-28 14:42:14 -08:00
parent f57b4669e1
commit c58d2aa99e
5 changed files with 59 additions and 7 deletions

View File

@@ -1,7 +1,6 @@
import path from "node:path";
import { Type } from "@sinclair/typebox";
import { loadConfig } from "../../config/config.js";
import { resolveSessionFilePath } from "../../config/sessions.js";
import { resolveSessionFilePath, resolveSessionFilePathOptions } from "../../config/sessions.js";
import { callGateway } from "../../gateway/call.js";
import { resolveAgentIdFromSessionKey } from "../../routing/session-key.js";
import type { AnyAgentTool } from "./common.js";
@@ -156,13 +155,14 @@ export function createSessionsListTool(opts?: {
let transcriptPath: string | undefined;
if (sessionId && storePath) {
try {
const sessionPathOpts = resolveSessionFilePathOptions({
agentId: resolveAgentIdFromSessionKey(key),
storePath,
});
transcriptPath = resolveSessionFilePath(
sessionId,
sessionFile ? { sessionFile } : undefined,
{
agentId: resolveAgentIdFromSessionKey(key),
sessionsDir: path.dirname(storePath),
},
sessionPathOpts,
);
} catch {
transcriptPath = undefined;