/**
 * High-level session export — exports the current AgentSession to HTML.
 *
 * Wires up the extension tool renderer and delegates to exportFromFile.
 */
import { theme } from '../theme/runtime.js';
import { exportFromFile } from './export-from-file.js';
import { createToolHtmlRenderer } from './tool-renderer.js';
/** Export the current agent session to a self-contained HTML file. */
export async function exportSessionToHtml(session, outputPath) {
    const sessionFile = session.sessionManager.getSessionFile();
    if (!sessionFile) {
        throw new Error('Cannot export in-memory session to HTML');
    }
    // Settings manager may be a non-shell variant (e.g. headless RPC) without `getTheme`.
    const themeName = session.settingsManager.getTheme?.();
    const extensionRunner = session.extensionRunner;
    const toolRenderer = extensionRunner
        ? createToolHtmlRenderer({
            getToolDefinition: (name) => extensionRunner.getToolDefinition(name),
            theme
        })
        : undefined;
    return await exportFromFile(sessionFile, {
        outputPath,
        themeName,
        toolRenderer
    });
}
//# sourceMappingURL=session-export.js.map