@cleocode/core 2026.6.10 → 2026.6.11
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/docs/export-document.js +95 -10
- package/dist/docs/export-document.js.map +2 -2
- package/dist/llm/plugin-facade.js +74 -7
- package/dist/llm/plugin-facade.js.map +2 -2
- package/dist/store/agent-registry-store.d.ts.map +1 -1
- package/dist/store/agent-registry-store.js +4 -2
- package/dist/store/agent-registry-store.js.map +1 -1
- package/dist/store/conduit-sqlite.d.ts.map +1 -1
- package/dist/store/conduit-sqlite.js +4 -2
- package/dist/store/conduit-sqlite.js.map +1 -1
- package/dist/store/dual-scope-db.d.ts.map +1 -1
- package/dist/store/dual-scope-db.js +56 -6
- package/dist/store/dual-scope-db.js.map +1 -1
- package/dist/store/migration-manager.d.ts +26 -1
- package/dist/store/migration-manager.d.ts.map +1 -1
- package/dist/store/migration-manager.js +104 -4
- package/dist/store/migration-manager.js.map +1 -1
- package/dist/store/nexus-sqlite.d.ts.map +1 -1
- package/dist/store/nexus-sqlite.js +4 -2
- package/dist/store/nexus-sqlite.js.map +1 -1
- package/dist/store/resolve-migrations-folder.d.ts +41 -0
- package/dist/store/resolve-migrations-folder.d.ts.map +1 -1
- package/dist/store/resolve-migrations-folder.js +53 -0
- package/dist/store/resolve-migrations-folder.js.map +1 -1
- package/dist/store/sqlite.d.ts.map +1 -1
- package/dist/store/sqlite.js +5 -3
- package/dist/store/sqlite.js.map +1 -1
- package/package.json +12 -12
|
@@ -22773,7 +22773,26 @@ function probeAndMarkApplied(nativeDb, migration, logSubsystem, eliminatedTables
|
|
|
22773
22773
|
}
|
|
22774
22774
|
return false;
|
|
22775
22775
|
}
|
|
22776
|
-
function
|
|
22776
|
+
function readSiblingMigrationHashes(siblingFolder) {
|
|
22777
|
+
try {
|
|
22778
|
+
return new Set(readMigrationFiles({ migrationsFolder: siblingFolder }).map((m) => m.hash));
|
|
22779
|
+
} catch {
|
|
22780
|
+
return /* @__PURE__ */ new Set();
|
|
22781
|
+
}
|
|
22782
|
+
}
|
|
22783
|
+
function ensureJournalHashUnique(nativeDb) {
|
|
22784
|
+
if (!tableExists(nativeDb, "__drizzle_migrations")) return;
|
|
22785
|
+
try {
|
|
22786
|
+
nativeDb.exec(
|
|
22787
|
+
'DELETE FROM "__drizzle_migrations" WHERE id NOT IN (SELECT MIN(id) FROM "__drizzle_migrations" GROUP BY hash)'
|
|
22788
|
+
);
|
|
22789
|
+
nativeDb.exec(
|
|
22790
|
+
'CREATE UNIQUE INDEX IF NOT EXISTS "idx_drizzle_migrations_hash" ON "__drizzle_migrations" ("hash")'
|
|
22791
|
+
);
|
|
22792
|
+
} catch {
|
|
22793
|
+
}
|
|
22794
|
+
}
|
|
22795
|
+
function reconcileJournal(nativeDb, migrationsFolder, existenceTable2, logSubsystem, siblingMigrationsFolders = []) {
|
|
22777
22796
|
const eliminatedTables = computeEliminatedTables(readMigrationFiles({ migrationsFolder }));
|
|
22778
22797
|
const cutoverPrefix = resolveConsolidationCutoverPrefix(migrationsFolder);
|
|
22779
22798
|
if (tableExists(nativeDb, existenceTable2) && !tableExists(nativeDb, "__drizzle_migrations")) {
|
|
@@ -22792,11 +22811,19 @@ function reconcileJournal(nativeDb, migrationsFolder, existenceTable2, logSubsys
|
|
|
22792
22811
|
insertJournalEntry(nativeDb, baseline.hash, baseline.folderMillis, baseline.name ?? "");
|
|
22793
22812
|
}
|
|
22794
22813
|
}
|
|
22814
|
+
ensureJournalHashUnique(nativeDb);
|
|
22795
22815
|
if (tableExists(nativeDb, "__drizzle_migrations") && tableExists(nativeDb, existenceTable2)) {
|
|
22796
22816
|
const localMigrations = readMigrationFiles({ migrationsFolder });
|
|
22797
22817
|
const localHashes = new Set(localMigrations.map((m) => m.hash));
|
|
22818
|
+
const knownHashes = new Set(localHashes);
|
|
22819
|
+
for (const siblingFolder of siblingMigrationsFolders) {
|
|
22820
|
+
if (siblingFolder === migrationsFolder) continue;
|
|
22821
|
+
for (const m of readSiblingMigrationHashes(siblingFolder)) {
|
|
22822
|
+
knownHashes.add(m);
|
|
22823
|
+
}
|
|
22824
|
+
}
|
|
22798
22825
|
const dbEntries = nativeDb.prepare('SELECT id, hash FROM "__drizzle_migrations"').all();
|
|
22799
|
-
const orphanedEntries = dbEntries.filter((e) => !
|
|
22826
|
+
const orphanedEntries = dbEntries.filter((e) => !knownHashes.has(e.hash));
|
|
22800
22827
|
const hasOrphanedEntries = orphanedEntries.length > 0;
|
|
22801
22828
|
if (hasOrphanedEntries) {
|
|
22802
22829
|
const dbHashes = new Set(dbEntries.map((e) => e.hash));
|
|
@@ -23116,6 +23143,11 @@ import { fileURLToPath } from "node:url";
|
|
|
23116
23143
|
function coreRootFromEntry(entryPath) {
|
|
23117
23144
|
return dirname2(dirname2(entryPath));
|
|
23118
23145
|
}
|
|
23146
|
+
function resolveConsolidatedJournalSiblings(ownSetName) {
|
|
23147
|
+
return CONSOLIDATED_JOURNAL_LINEAGES.filter((name2) => name2 !== ownSetName).map(
|
|
23148
|
+
(name2) => resolveCorePackageMigrationsFolder(name2)
|
|
23149
|
+
);
|
|
23150
|
+
}
|
|
23119
23151
|
function resolveCorePackageMigrationsFolder(setName) {
|
|
23120
23152
|
try {
|
|
23121
23153
|
const resolved = import.meta.resolve("@cleocode/core", import.meta.url);
|
|
@@ -23133,9 +23165,21 @@ function resolveCorePackageMigrationsFolder(setName) {
|
|
|
23133
23165
|
);
|
|
23134
23166
|
}
|
|
23135
23167
|
}
|
|
23168
|
+
var CONSOLIDATED_JOURNAL_LINEAGES;
|
|
23136
23169
|
var init_resolve_migrations_folder = __esm({
|
|
23137
23170
|
"packages/core/src/store/resolve-migrations-folder.ts"() {
|
|
23138
23171
|
"use strict";
|
|
23172
|
+
CONSOLIDATED_JOURNAL_LINEAGES = [
|
|
23173
|
+
"drizzle-tasks",
|
|
23174
|
+
"drizzle-cleo-project",
|
|
23175
|
+
"drizzle-nexus",
|
|
23176
|
+
"drizzle-brain",
|
|
23177
|
+
"drizzle-conduit",
|
|
23178
|
+
"drizzle-cleo-global",
|
|
23179
|
+
"drizzle-agent-registry",
|
|
23180
|
+
"drizzle-skills",
|
|
23181
|
+
"drizzle-telemetry"
|
|
23182
|
+
];
|
|
23139
23183
|
}
|
|
23140
23184
|
});
|
|
23141
23185
|
|
|
@@ -34388,6 +34432,11 @@ async function loadGlobalSchema() {
|
|
|
34388
34432
|
function existenceTable(scope) {
|
|
34389
34433
|
return scope === "project" ? "tasks_tasks" : "nexus_project_registry";
|
|
34390
34434
|
}
|
|
34435
|
+
function memoryBoundedPragmaOverrides() {
|
|
34436
|
+
if (process.env.CLEO_SENTIENT_DAEMON === "1") return {};
|
|
34437
|
+
if (process.env.CLEO_DB_FULL_MEM === "1") return {};
|
|
34438
|
+
return { mmapSizeBytes: 0, cacheSizeKb: 8e3 };
|
|
34439
|
+
}
|
|
34391
34440
|
async function openDualScopeDb(scope, cwd) {
|
|
34392
34441
|
const dbPath = resolveDualScopeDbPath(scope, cwd);
|
|
34393
34442
|
return scope === "project" ? openDualScopeDbAtPath("project", dbPath, cwd) : openDualScopeDbAtPath("global", dbPath, cwd);
|
|
@@ -34400,12 +34449,18 @@ async function openDedicatedDualScopeDb(scope, dbPath, log10) {
|
|
|
34400
34449
|
}
|
|
34401
34450
|
const DatabaseSyncCtor = getDatabaseSyncCtor();
|
|
34402
34451
|
const nativeDb = new DatabaseSyncCtor(dbPath, { allowExtension: true });
|
|
34403
|
-
applyPerfPragmas(nativeDb);
|
|
34452
|
+
applyPerfPragmas(nativeDb, memoryBoundedPragmaOverrides());
|
|
34404
34453
|
const schema = scope === "project" ? await loadProjectSchema() : await loadGlobalSchema();
|
|
34405
34454
|
const drizzle2 = getDrizzle();
|
|
34406
34455
|
const db = drizzle2({ client: nativeDb, schema });
|
|
34407
34456
|
const migrationsFolder = resolveCorePackageMigrationsFolder(migrationsSetName(scope));
|
|
34408
|
-
reconcileJournal(
|
|
34457
|
+
reconcileJournal(
|
|
34458
|
+
nativeDb,
|
|
34459
|
+
migrationsFolder,
|
|
34460
|
+
existenceTable(scope),
|
|
34461
|
+
`dual-scope-db[${scope}]`,
|
|
34462
|
+
resolveConsolidatedJournalSiblings(migrationsSetName(scope))
|
|
34463
|
+
);
|
|
34409
34464
|
migrateWithRetry(
|
|
34410
34465
|
db,
|
|
34411
34466
|
migrationsFolder,
|
|
@@ -34450,12 +34505,18 @@ async function openDualScopeDbAtPath(scope, dbPath, exodusCwd, options) {
|
|
|
34450
34505
|
}
|
|
34451
34506
|
const DatabaseSyncCtor = getDatabaseSyncCtor();
|
|
34452
34507
|
const nativeDb = new DatabaseSyncCtor(dbPath, { allowExtension: true });
|
|
34453
|
-
applyPerfPragmas(nativeDb);
|
|
34508
|
+
applyPerfPragmas(nativeDb, memoryBoundedPragmaOverrides());
|
|
34454
34509
|
const schema = scope === "project" ? await loadProjectSchema() : await loadGlobalSchema();
|
|
34455
34510
|
const drizzle2 = getDrizzle();
|
|
34456
34511
|
const db = drizzle2({ client: nativeDb, schema });
|
|
34457
34512
|
const migrationsFolder = resolveCorePackageMigrationsFolder(migrationsSetName(scope));
|
|
34458
|
-
reconcileJournal(
|
|
34513
|
+
reconcileJournal(
|
|
34514
|
+
nativeDb,
|
|
34515
|
+
migrationsFolder,
|
|
34516
|
+
existenceTable(scope),
|
|
34517
|
+
`dual-scope-db[${scope}]`,
|
|
34518
|
+
resolveConsolidatedJournalSiblings(migrationsSetName(scope))
|
|
34519
|
+
);
|
|
34459
34520
|
migrateWithRetry(
|
|
34460
34521
|
db,
|
|
34461
34522
|
migrationsFolder,
|
|
@@ -35327,7 +35388,13 @@ function runNexusMigrations(nativeDb, db) {
|
|
|
35327
35388
|
}
|
|
35328
35389
|
}
|
|
35329
35390
|
}
|
|
35330
|
-
reconcileJournal(
|
|
35391
|
+
reconcileJournal(
|
|
35392
|
+
nativeDb,
|
|
35393
|
+
migrationsFolder,
|
|
35394
|
+
"_nexus_meta",
|
|
35395
|
+
"nexus",
|
|
35396
|
+
resolveConsolidatedJournalSiblings("drizzle-nexus")
|
|
35397
|
+
);
|
|
35331
35398
|
const MAX_RETRIES = 5;
|
|
35332
35399
|
const BASE_DELAY_MS = 100;
|
|
35333
35400
|
const MAX_DELAY_MS = 2e3;
|
|
@@ -37514,7 +37581,13 @@ function resolveAgentRegistryMigrationsFolder() {
|
|
|
37514
37581
|
}
|
|
37515
37582
|
function runAgentRegistryMigrations(nativeDb) {
|
|
37516
37583
|
const migrationsFolder = resolveAgentRegistryMigrationsFolder();
|
|
37517
|
-
reconcileJournal(
|
|
37584
|
+
reconcileJournal(
|
|
37585
|
+
nativeDb,
|
|
37586
|
+
migrationsFolder,
|
|
37587
|
+
"_agent_registry_meta",
|
|
37588
|
+
"agent-registry",
|
|
37589
|
+
resolveConsolidatedJournalSiblings("drizzle-agent-registry")
|
|
37590
|
+
);
|
|
37518
37591
|
const db = drizzle({ client: nativeDb, schema: agent_registry_exports });
|
|
37519
37592
|
migrateSanitized(db, { migrationsFolder });
|
|
37520
37593
|
}
|
|
@@ -37608,7 +37681,13 @@ function resolveConduitMigrationsFolder() {
|
|
|
37608
37681
|
}
|
|
37609
37682
|
function runConduitMigrations(nativeDb) {
|
|
37610
37683
|
const migrationsFolder = resolveConduitMigrationsFolder();
|
|
37611
|
-
reconcileJournal(
|
|
37684
|
+
reconcileJournal(
|
|
37685
|
+
nativeDb,
|
|
37686
|
+
migrationsFolder,
|
|
37687
|
+
"_conduit_meta",
|
|
37688
|
+
"conduit",
|
|
37689
|
+
resolveConsolidatedJournalSiblings("drizzle-conduit")
|
|
37690
|
+
);
|
|
37612
37691
|
const db = _getDrizzle2()({ client: nativeDb, schema: conduit_exports });
|
|
37613
37692
|
migrateSanitized(db, { migrationsFolder });
|
|
37614
37693
|
}
|
|
@@ -38472,7 +38551,13 @@ function runMigrations(nativeDb, db) {
|
|
|
38472
38551
|
if (tableExists(nativeDb, "tasks") && _dbPath3) {
|
|
38473
38552
|
createSafetyBackup(_dbPath3);
|
|
38474
38553
|
}
|
|
38475
|
-
reconcileJournal(
|
|
38554
|
+
reconcileJournal(
|
|
38555
|
+
nativeDb,
|
|
38556
|
+
migrationsFolder,
|
|
38557
|
+
"tasks",
|
|
38558
|
+
"sqlite",
|
|
38559
|
+
resolveConsolidatedJournalSiblings("drizzle-tasks")
|
|
38560
|
+
);
|
|
38476
38561
|
ensureColumns(nativeDb, "sessions", REQUIRED_SESSION_COLUMNS, "sqlite");
|
|
38477
38562
|
migrateWithRetry(db, migrationsFolder, nativeDb, "tasks", "sqlite");
|
|
38478
38563
|
ensureColumns(nativeDb, "tasks", REQUIRED_TASK_COLUMNS, "sqlite");
|