@cleocode/core 2026.4.46 → 2026.4.48
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 +19 -20
- package/dist/index.js.map +2 -2
- package/dist/internal.d.ts +3 -3
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +31 -20
- package/dist/internal.js.map +2 -2
- package/dist/memory/brain-lifecycle.d.ts +13 -6
- package/dist/memory/brain-lifecycle.d.ts.map +1 -1
- package/dist/memory/brain-maintenance.d.ts +11 -0
- package/dist/memory/brain-maintenance.d.ts.map +1 -1
- package/package.json +18 -8
- package/src/internal.ts +16 -3
- package/src/memory/__tests__/brain-automation.test.ts +1 -0
- package/src/memory/__tests__/brain-lifecycle-tier-promotion.test.ts +367 -0
- package/src/memory/brain-lifecycle.ts +43 -32
- package/src/memory/brain-maintenance.ts +27 -2
package/dist/index.js
CHANGED
|
@@ -42975,13 +42975,16 @@ async function runTierPromotion(projectRoot) {
|
|
|
42975
42975
|
try {
|
|
42976
42976
|
shortToMedium = typedAll(
|
|
42977
42977
|
nativeDb.prepare(`
|
|
42978
|
-
SELECT id, citation_count, quality_score
|
|
42978
|
+
SELECT id, citation_count, quality_score, verified
|
|
42979
42979
|
FROM ${table}
|
|
42980
42980
|
WHERE memory_tier = 'short'
|
|
42981
42981
|
AND invalid_at IS NULL
|
|
42982
42982
|
AND ${dateCol} < ?
|
|
42983
|
-
AND
|
|
42984
|
-
|
|
42983
|
+
AND (
|
|
42984
|
+
citation_count >= 3
|
|
42985
|
+
OR quality_score >= 0.7
|
|
42986
|
+
OR verified = 1
|
|
42987
|
+
)
|
|
42985
42988
|
`),
|
|
42986
42989
|
age24h
|
|
42987
42990
|
);
|
|
@@ -42991,13 +42994,15 @@ async function runTierPromotion(projectRoot) {
|
|
|
42991
42994
|
for (const row of shortToMedium) {
|
|
42992
42995
|
try {
|
|
42993
42996
|
nativeDb.prepare(`UPDATE ${table} SET memory_tier = 'medium', updated_at = ? WHERE id = ?`).run(now, row.id);
|
|
42994
|
-
|
|
42995
|
-
|
|
42996
|
-
|
|
42997
|
-
|
|
42998
|
-
|
|
42999
|
-
|
|
43000
|
-
|
|
42997
|
+
let reason;
|
|
42998
|
+
if (row.citation_count >= 3) {
|
|
42999
|
+
reason = `citationCount=${row.citation_count} >= 3, age > 24h`;
|
|
43000
|
+
} else if ((row.quality_score ?? 0) >= 0.7) {
|
|
43001
|
+
reason = `qualityScore=${row.quality_score?.toFixed(2)} >= 0.70, age > 24h`;
|
|
43002
|
+
} else {
|
|
43003
|
+
reason = `verified=true, age > 24h`;
|
|
43004
|
+
}
|
|
43005
|
+
promoted.push({ id: row.id, table, fromTier: "short", toTier: "medium", reason });
|
|
43001
43006
|
} catch {
|
|
43002
43007
|
}
|
|
43003
43008
|
}
|
|
@@ -43005,13 +43010,12 @@ async function runTierPromotion(projectRoot) {
|
|
|
43005
43010
|
try {
|
|
43006
43011
|
mediumToLong = typedAll(
|
|
43007
43012
|
nativeDb.prepare(`
|
|
43008
|
-
SELECT id, citation_count, quality_score
|
|
43013
|
+
SELECT id, citation_count, quality_score, verified
|
|
43009
43014
|
FROM ${table}
|
|
43010
43015
|
WHERE memory_tier = 'medium'
|
|
43011
43016
|
AND invalid_at IS NULL
|
|
43012
43017
|
AND ${dateCol} < ?
|
|
43013
|
-
AND verified = 1
|
|
43014
|
-
AND citation_count >= 5
|
|
43018
|
+
AND (citation_count >= 5 OR verified = 1)
|
|
43015
43019
|
`),
|
|
43016
43020
|
age7d
|
|
43017
43021
|
);
|
|
@@ -43021,13 +43025,8 @@ async function runTierPromotion(projectRoot) {
|
|
|
43021
43025
|
for (const row of mediumToLong) {
|
|
43022
43026
|
try {
|
|
43023
43027
|
nativeDb.prepare(`UPDATE ${table} SET memory_tier = 'long', updated_at = ? WHERE id = ?`).run(now, row.id);
|
|
43024
|
-
|
|
43025
|
-
|
|
43026
|
-
table,
|
|
43027
|
-
fromTier: "medium",
|
|
43028
|
-
toTier: "long",
|
|
43029
|
-
reason: `citationCount=${row.citation_count} >= 5, verified, age > 7d`
|
|
43030
|
-
});
|
|
43028
|
+
const reason = row.citation_count >= 5 ? `citationCount=${row.citation_count} >= 5, age > 7d` : `verified=true, age > 7d`;
|
|
43029
|
+
promoted.push({ id: row.id, table, fromTier: "medium", toTier: "long", reason });
|
|
43031
43030
|
} catch {
|
|
43032
43031
|
}
|
|
43033
43032
|
}
|