@cleocode/core 2026.3.62 → 2026.3.63
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 +20 -0
- package/dist/index.js.map +3 -3
- package/dist/store/brain-sqlite.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/store/brain-sqlite.ts +26 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brain-sqlite.d.ts","sourceRoot":"","sources":["../../src/store/brain-sqlite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"brain-sqlite.d.ts","sourceRoot":"","sources":["../../src/store/brain-sqlite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAKlE,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAC;AAQjD,gFAAgF;AAChF,eAAO,MAAM,oBAAoB,UAAU,CAAC;AAW5C;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,IAAI,MAAM,CAMrD;AA+ID;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C;AAED;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,OAAO,WAAW,CAAC,CAAC,CA0D9F;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,IAAI,CAcnC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAexC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,YAAY,GAAG,IAAI,CAEtD;AAED,YAAY,EAAE,kBAAkB,EAAE,CAAC;AACnC;;GAEG;AACH,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cleocode/core",
|
|
3
|
-
"version": "2026.3.
|
|
3
|
+
"version": "2026.3.63",
|
|
4
4
|
"description": "CLEO core business logic kernel — tasks, sessions, memory, orchestration, lifecycle, with bundled SQLite store",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"write-file-atomic": "^6.0.0",
|
|
37
37
|
"yaml": "^2.8.2",
|
|
38
38
|
"zod": "^3.25.76",
|
|
39
|
-
"@cleocode/
|
|
40
|
-
"@cleocode/
|
|
41
|
-
"@cleocode/
|
|
42
|
-
"@cleocode/
|
|
39
|
+
"@cleocode/agents": "2026.3.63",
|
|
40
|
+
"@cleocode/contracts": "2026.3.63",
|
|
41
|
+
"@cleocode/adapters": "2026.3.63",
|
|
42
|
+
"@cleocode/skills": "2026.3.63"
|
|
43
43
|
},
|
|
44
44
|
"engines": {
|
|
45
45
|
"node": ">=24.0.0"
|
|
@@ -20,6 +20,7 @@ import { readMigrationFiles } from 'drizzle-orm/migrator';
|
|
|
20
20
|
import type { NodeSQLiteDatabase } from 'drizzle-orm/node-sqlite';
|
|
21
21
|
import { drizzle } from 'drizzle-orm/node-sqlite';
|
|
22
22
|
import { migrate } from 'drizzle-orm/node-sqlite/migrator';
|
|
23
|
+
import { getLogger } from '../logger.js';
|
|
23
24
|
import { getCleoDirAbsolute } from '../paths.js';
|
|
24
25
|
import * as brainSchema from './brain-schema.js';
|
|
25
26
|
import { isSqliteBusy, openNativeDatabase } from './sqlite.js';
|
|
@@ -119,6 +120,31 @@ function runBrainMigrations(
|
|
|
119
120
|
}
|
|
120
121
|
}
|
|
121
122
|
|
|
123
|
+
// Fix #65: Reconcile stale migration journal entries from older CLEO versions.
|
|
124
|
+
// Same pattern as tasks.db fix in sqlite.ts — see #63 for details.
|
|
125
|
+
if (tableExists(nativeDb, '__drizzle_migrations') && tableExists(nativeDb, 'brain_decisions')) {
|
|
126
|
+
const localMigrations = readMigrationFiles({ migrationsFolder });
|
|
127
|
+
const localHashes = new Set(localMigrations.map((m) => m.hash));
|
|
128
|
+
const dbEntries = nativeDb.prepare('SELECT hash FROM "__drizzle_migrations"').all() as Array<{
|
|
129
|
+
hash: string;
|
|
130
|
+
}>;
|
|
131
|
+
const hasOrphanedEntries = dbEntries.some((e) => !localHashes.has(e.hash));
|
|
132
|
+
|
|
133
|
+
if (hasOrphanedEntries) {
|
|
134
|
+
const log = getLogger('brain');
|
|
135
|
+
log.warn(
|
|
136
|
+
{ orphaned: dbEntries.filter((e) => !localHashes.has(e.hash)).length },
|
|
137
|
+
'Detected stale migration journal entries from a previous CLEO version. Reconciling brain.db.',
|
|
138
|
+
);
|
|
139
|
+
nativeDb.exec('DELETE FROM "__drizzle_migrations"');
|
|
140
|
+
for (const m of localMigrations) {
|
|
141
|
+
nativeDb.exec(
|
|
142
|
+
`INSERT INTO "__drizzle_migrations" ("hash", "created_at") VALUES ('${m.hash}', ${m.folderMillis})`,
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
122
148
|
// Run pending migrations via drizzle-orm/node-sqlite/migrator (synchronous).
|
|
123
149
|
const MAX_RETRIES = 5;
|
|
124
150
|
const BASE_DELAY_MS = 100;
|