Commit cbb49c284738
Changed files (1)
dots
pi
agent
extensions
ai-storage
dots/pi/agent/extensions/ai-storage/index.ts
@@ -668,8 +668,11 @@ export default function (pi: ExtensionAPI) {
if (currentSessionFile) {
const rawSessionPath = ctx.sessionManager?.getSessionFile?.();
if (rawSessionPath && existsSync(rawSessionPath)) {
- const htmlPath = currentSessionFile.replace(/\.md$/, ".html");
+ const summaryFilename = currentSessionFile.split("/").pop() || "";
+ const exportsDir = join(dirname(currentSessionFile), "exports");
+ const htmlPath = join(exportsDir, summaryFilename.replace(/\.md$/, ".html"));
try {
+ await mkdir(exportsDir, { recursive: true });
const { execSync } = await import("node:child_process");
execSync(`pi --export "${rawSessionPath}" "${htmlPath}"`, {
encoding: "utf-8",
@@ -1188,8 +1191,11 @@ After generating the summary, use the save_session_to_history tool to save it${c
}
// Derive HTML output path (same dir as summary, .html extension)
- const htmlPath = summaryPath.replace(/\.md$/, ".html");
+ const summaryFilename = summaryPath.split("/").pop() || "";
+ const exportsDir = join(dirname(summaryPath), "exports");
+ const htmlPath = join(exportsDir, summaryFilename.replace(/\.md$/, ".html"));
+ await mkdir(exportsDir, { recursive: true });
ctx.ui.notify(`Exporting session to HTML...`, "info");
const { execSync } = await import("node:child_process");