@evomap/evolver-runtime-adapters 2.0.0-beta.0 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cursorState.js +14 -5
- package/package.json +1 -1
package/dist/cursorState.js
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
2
|
import { correlateToolNames, isMetaText } from './types.js';
|
|
3
|
-
// node:sqlite is a recent Node built-in exposed only as `node:sqlite` (no bare `sqlite` alias). Load it through
|
|
4
|
-
// createRequire so bundlers (vitest/vite) don't statically strip the prefix and fail resolution — mirrors the
|
|
5
|
-
// pattern already used by evolver-core/src/mailbox/store.ts.
|
|
6
3
|
const nodeRequire = createRequire(import.meta.url);
|
|
4
|
+
function isBunRuntime() {
|
|
5
|
+
return typeof process.versions === 'object' && typeof process.versions.bun === 'string';
|
|
6
|
+
}
|
|
7
|
+
function openReadOnlySqliteDatabase(path) {
|
|
8
|
+
if (isBunRuntime()) {
|
|
9
|
+
const { Database } = nodeRequire('bun:sqlite');
|
|
10
|
+
return new Database(path, { readonly: true });
|
|
11
|
+
}
|
|
12
|
+
// node:sqlite is exposed only as `node:sqlite` (no bare `sqlite` alias). Load it through createRequire so
|
|
13
|
+
// bundlers do not statically strip the prefix and break Vitest/Vite or Bun standalone builds.
|
|
14
|
+
const { DatabaseSync } = nodeRequire('node:sqlite');
|
|
15
|
+
return new DatabaseSync(path, { readOnly: true });
|
|
16
|
+
}
|
|
7
17
|
// ── Cursor state.vscdb conversation extraction ───────────────────────────────
|
|
8
18
|
//
|
|
9
19
|
// VERIFICATION STATUS / COVERAGE (honest scope — read before extending):
|
|
@@ -151,8 +161,7 @@ function composerToSession(composer, composerId, readBubble) {
|
|
|
151
161
|
export function parseCursorStateVscdb(dbPath) {
|
|
152
162
|
let db;
|
|
153
163
|
try {
|
|
154
|
-
|
|
155
|
-
db = new DatabaseSync(dbPath, { readOnly: true });
|
|
164
|
+
db = openReadOnlySqliteDatabase(dbPath);
|
|
156
165
|
const composerRows = db
|
|
157
166
|
.prepare("SELECT key, value FROM cursorDiskKV WHERE key LIKE 'composerData:%'")
|
|
158
167
|
.all();
|