import { existsSync, readFileSync } from "node:fs";
//#region src/session/parity/load-jsonl-entries.ts
/** Same semantics as pi-coding-agent `loadEntriesFromFile` (package does not export it from the root). */
function loadEntriesFromFile(filePath) {
	if (!existsSync(filePath)) return [];
	const content = readFileSync(filePath, "utf8");
	const entries = [];
	for (const line of content.trim().split("\n")) {
		if (!line.trim()) continue;
		try {
			entries.push(JSON.parse(line));
		} catch {}
	}
	if (entries.length === 0) return entries;
	const header = entries[0];
	if (header.type !== "session" || typeof header.id !== "string") return [];
	return entries;
}
//#endregion
export { loadEntriesFromFile };

//# sourceMappingURL=load-jsonl-entries.js.map