@cleocode/core 2026.3.62 → 2026.3.64
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/index.js +23 -0
- package/dist/index.js.map +3 -3
- package/dist/pagination.d.ts +1 -1
- package/dist/pagination.d.ts.map +1 -1
- package/dist/store/brain-sqlite.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/pagination.ts +4 -1
- package/src/store/brain-sqlite.ts +26 -0
package/dist/index.js
CHANGED
|
@@ -10666,6 +10666,25 @@ function runBrainMigrations(nativeDb, db) {
|
|
|
10666
10666
|
);
|
|
10667
10667
|
}
|
|
10668
10668
|
}
|
|
10669
|
+
if (tableExists(nativeDb, "__drizzle_migrations") && tableExists(nativeDb, "brain_decisions")) {
|
|
10670
|
+
const localMigrations = readMigrationFiles({ migrationsFolder });
|
|
10671
|
+
const localHashes = new Set(localMigrations.map((m) => m.hash));
|
|
10672
|
+
const dbEntries = nativeDb.prepare('SELECT hash FROM "__drizzle_migrations"').all();
|
|
10673
|
+
const hasOrphanedEntries = dbEntries.some((e) => !localHashes.has(e.hash));
|
|
10674
|
+
if (hasOrphanedEntries) {
|
|
10675
|
+
const log9 = getLogger("brain");
|
|
10676
|
+
log9.warn(
|
|
10677
|
+
{ orphaned: dbEntries.filter((e) => !localHashes.has(e.hash)).length },
|
|
10678
|
+
"Detected stale migration journal entries from a previous CLEO version. Reconciling brain.db."
|
|
10679
|
+
);
|
|
10680
|
+
nativeDb.exec('DELETE FROM "__drizzle_migrations"');
|
|
10681
|
+
for (const m of localMigrations) {
|
|
10682
|
+
nativeDb.exec(
|
|
10683
|
+
`INSERT INTO "__drizzle_migrations" ("hash", "created_at") VALUES ('${m.hash}', ${m.folderMillis})`
|
|
10684
|
+
);
|
|
10685
|
+
}
|
|
10686
|
+
}
|
|
10687
|
+
}
|
|
10669
10688
|
const MAX_RETRIES = 5;
|
|
10670
10689
|
const BASE_DELAY_MS = 100;
|
|
10671
10690
|
const MAX_DELAY_MS = 2e3;
|
|
@@ -10773,6 +10792,7 @@ var init_brain_sqlite = __esm({
|
|
|
10773
10792
|
init_migrator();
|
|
10774
10793
|
init_node_sqlite();
|
|
10775
10794
|
init_migrator2();
|
|
10795
|
+
init_logger();
|
|
10776
10796
|
init_paths();
|
|
10777
10797
|
init_brain_schema();
|
|
10778
10798
|
init_sqlite2();
|
|
@@ -26396,6 +26416,9 @@ function createPage(input) {
|
|
|
26396
26416
|
};
|
|
26397
26417
|
}
|
|
26398
26418
|
function paginate(items, limit, offset) {
|
|
26419
|
+
if (!items || items.length === 0) {
|
|
26420
|
+
return { items: [], page: { mode: "none" } };
|
|
26421
|
+
}
|
|
26399
26422
|
const total = items.length;
|
|
26400
26423
|
if (limit === void 0 && offset === void 0) {
|
|
26401
26424
|
return { items, page: { mode: "none" } };
|