import { join } from "node:path";
import { z } from "zod";
import { SessionStore } from "./session-store.mjs";
import { reportHTMLContent } from "./utils.mjs";
function exportSessionReport(sessionId) {
    const dump = SessionStore.buildSessionDump(sessionId);
    const reportPath = join(SessionStore.reportDir(sessionId), 'index.html');
    reportHTMLContent(JSON.stringify(dump), reportPath, false);
    SessionStore.markReportGenerated(sessionId, reportPath);
    return reportPath;
}
function createExportSessionReportTool() {
    return {
        name: 'export_session_report',
        description: 'Generate a merged HTML report from a persisted session',
        schema: {
            sessionId: z.string().describe('Persistent session ID to export')
        },
        handler: async (args)=>{
            const { sessionId } = args;
            if ('string' != typeof sessionId || !sessionId) return {
                content: [
                    {
                        type: 'text',
                        text: 'sessionId is required to export a session report'
                    }
                ],
                isError: true
            };
            const reportPath = exportSessionReport(sessionId);
            return {
                content: [
                    {
                        type: 'text',
                        text: `Session report generated: ${reportPath}`
                    }
                ]
            };
        }
    };
}
export { createExportSessionReportTool, exportSessionReport };

//# sourceMappingURL=session-report.mjs.map