INNER CODE UNIT · TypeScript

exportSessionToHtml

Dicklesworthstone/pi_agent_rust · legacy_pi_mono_code/pi-mono/packages/coding-agent/src/core/export-html/index.ts:224

export async function exportSessionToHtml(
	sm: SessionManager,
	state?: AgentState,
	options?: ExportOptions | string,
): Promise<string> {
	const opts: ExportOptions = typeof options === "string" ? { outputPath: options } : options || {};

	const sessionFile = sm.getSessionFile();
	if (!sessionFile) {
		throw new Error("Cannot export in-memory session to HTML");
	}
	if (!existsSync(sessionFile)) {
		throw new Error("Nothing to export yet - start a conversation first");
	}

	const entries = sm.getEntries();

	// Pre-render custom tools if a tool renderer is provided

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…