File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 * SPDX-License-Identifier: Apache-2.0
55 */
66import path from 'node:path' ;
7- import { DatabaseSync } from 'node:sqlite' ;
87import fse from 'fs-extra' ;
98import type {
109 ImportSource ,
@@ -442,7 +441,7 @@ export class CursorImporter extends BaseImporter {
442441 } ) ;
443442
444443 try {
445- const sessionData = this . readCursorSession ( dbPath ) ;
444+ const sessionData = await this . readCursorSession ( dbPath ) ;
446445
447446 if ( ! sessionData || sessionData . messages . length === 0 ) {
448447 skipped ++ ;
@@ -484,14 +483,16 @@ export class CursorImporter extends BaseImporter {
484483 * Reads a single Cursor session from its SQLite store.db.
485484 * Returns extracted metadata and converted messages, or null if unreadable.
486485 */
487- private readCursorSession ( dbPath : string ) : {
486+ private async readCursorSession ( dbPath : string ) : Promise < {
488487 agentId : string ;
489488 name : string ;
490489 model : string ;
491490 createdAt : string ;
492491 projectPath : string ;
493492 messages : SessionMessage [ ] ;
494- } | null {
493+ } | null > {
494+ // Lazy-load node:sqlite so the binary doesn't crash on runtimes that lack it (e.g. Bun)
495+ const { DatabaseSync } = await import ( 'node:sqlite' ) ;
495496 const db = new DatabaseSync ( dbPath , { readOnly : true } as Record < string , unknown > ) ;
496497
497498 try {
You can’t perform that action at this time.
0 commit comments