agent-cache-optimizer 0.5.1 → 0.5.2
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/package.json +1 -1
- package/src/index.ts +5 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-cache-optimizer",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Content-agnostic KV cache optimizer for LLM CLI agents — boosts prompt cache hit rate by 40-88% through automatic stability tracking and block reordering",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kv-cache",
|
package/src/index.ts
CHANGED
|
@@ -41,9 +41,10 @@ function loadDB(agent: string): StabilityDB {
|
|
|
41
41
|
const db = JSON.parse(raw) as StabilityDB
|
|
42
42
|
// Migrate from pre-0.5.0: rebuild contentIndex from position data
|
|
43
43
|
if (
|
|
44
|
-
(!db.contentIndex || Object.keys(db.contentIndex).length === 0) &&
|
|
45
44
|
db.positions &&
|
|
46
|
-
Object.keys(db.positions).length > 0
|
|
45
|
+
Object.keys(db.positions).length > 0 &&
|
|
46
|
+
((!db.contentIndex || Object.keys(db.contentIndex).length === 0) ||
|
|
47
|
+
db.contentObservations === undefined)
|
|
47
48
|
) {
|
|
48
49
|
db.contentIndex = {}
|
|
49
50
|
for (const fps of Object.values(db.positions)) {
|
|
@@ -214,8 +215,8 @@ export const CacheOptimizerPlugin: Plugin = async () => {
|
|
|
214
215
|
const warmCount = warmHashes?.size ?? 0
|
|
215
216
|
diag(
|
|
216
217
|
agent,
|
|
217
|
-
`
|
|
218
|
-
`warm
|
|
218
|
+
`v0.5.2 loaded agent=${agent} model=${input.model?.id ?? "?"} ` +
|
|
219
|
+
`warm=${warmCount}`,
|
|
219
220
|
)
|
|
220
221
|
}
|
|
221
222
|
},
|