agent-working-memory 0.13.0 → 0.14.0
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/README.md +200 -238
- package/dist/adapters/common.d.ts +6 -0
- package/dist/adapters/common.d.ts.map +1 -1
- package/dist/adapters/common.js +457 -362
- package/dist/adapters/common.js.map +1 -1
- package/dist/api/routes.d.ts.map +1 -1
- package/dist/api/routes.js +24 -8
- package/dist/api/routes.js.map +1 -1
- package/dist/core/alias-map.d.ts +16 -0
- package/dist/core/alias-map.d.ts.map +1 -0
- package/dist/core/alias-map.js +102 -0
- package/dist/core/alias-map.js.map +1 -0
- package/dist/core/embeddings.d.ts +17 -0
- package/dist/core/embeddings.d.ts.map +1 -1
- package/dist/core/embeddings.js +52 -1
- package/dist/core/embeddings.js.map +1 -1
- package/dist/core/model-cache.d.ts +28 -0
- package/dist/core/model-cache.d.ts.map +1 -0
- package/dist/core/model-cache.js +50 -0
- package/dist/core/model-cache.js.map +1 -0
- package/dist/core/query-expander.d.ts.map +1 -1
- package/dist/core/query-expander.js +2 -0
- package/dist/core/query-expander.js.map +1 -1
- package/dist/core/recall-config.d.ts +52 -0
- package/dist/core/recall-config.d.ts.map +1 -0
- package/dist/core/recall-config.js +110 -0
- package/dist/core/recall-config.js.map +1 -0
- package/dist/core/rerank-window.d.ts +61 -0
- package/dist/core/rerank-window.d.ts.map +1 -0
- package/dist/core/rerank-window.js +153 -0
- package/dist/core/rerank-window.js.map +1 -0
- package/dist/core/rerank2.d.ts +62 -0
- package/dist/core/rerank2.d.ts.map +1 -0
- package/dist/core/rerank2.js +75 -0
- package/dist/core/rerank2.js.map +1 -0
- package/dist/core/reranker.d.ts.map +1 -1
- package/dist/core/reranker.js +2 -0
- package/dist/core/reranker.js.map +1 -1
- package/dist/core/retrieval-text.d.ts +55 -0
- package/dist/core/retrieval-text.d.ts.map +1 -0
- package/dist/core/retrieval-text.js +87 -0
- package/dist/core/retrieval-text.js.map +1 -0
- package/dist/core/temporal-query.d.ts +61 -0
- package/dist/core/temporal-query.d.ts.map +1 -0
- package/dist/core/temporal-query.js +168 -0
- package/dist/core/temporal-query.js.map +1 -0
- package/dist/core/token-budget.d.ts +75 -0
- package/dist/core/token-budget.d.ts.map +1 -0
- package/dist/core/token-budget.js +136 -0
- package/dist/core/token-budget.js.map +1 -0
- package/dist/core/whoami.d.ts +11 -0
- package/dist/core/whoami.d.ts.map +1 -1
- package/dist/core/whoami.js +10 -0
- package/dist/core/whoami.js.map +1 -1
- package/dist/core/write-pipeline.d.ts.map +1 -1
- package/dist/core/write-pipeline.js +6 -3
- package/dist/core/write-pipeline.js.map +1 -1
- package/dist/engine/activation.d.ts.map +1 -1
- package/dist/engine/activation.js +135 -32
- package/dist/engine/activation.js.map +1 -1
- package/dist/hooks/prime.d.ts +77 -0
- package/dist/hooks/prime.d.ts.map +1 -0
- package/dist/hooks/prime.js +92 -0
- package/dist/hooks/prime.js.map +1 -0
- package/dist/hooks/sidecar.d.ts.map +1 -1
- package/dist/hooks/sidecar.js +39 -0
- package/dist/hooks/sidecar.js.map +1 -1
- package/dist/mcp.js +134 -102
- package/dist/mcp.js.map +1 -1
- package/dist/storage/pglite.d.ts.map +1 -1
- package/dist/storage/pglite.js +10 -2
- package/dist/storage/pglite.js.map +1 -1
- package/dist/storage/postgres.d.ts.map +1 -1
- package/dist/storage/postgres.js +10 -2
- package/dist/storage/postgres.js.map +1 -1
- package/dist/storage/sqlite.d.ts.map +1 -1
- package/dist/storage/sqlite.js +12 -2
- package/dist/storage/sqlite.js.map +1 -1
- package/dist/types/engram.d.ts +7 -0
- package/dist/types/engram.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/adapters/common.ts +666 -567
- package/src/api/routes.ts +1015 -999
- package/src/core/alias-map.ts +97 -0
- package/src/core/embeddings.ts +172 -113
- package/src/core/model-cache.ts +51 -0
- package/src/core/query-expander.ts +2 -0
- package/src/core/recall-config.ts +115 -0
- package/src/core/rerank-window.ts +158 -0
- package/src/core/rerank2.ts +82 -0
- package/src/core/reranker.ts +2 -0
- package/src/core/retrieval-text.ts +82 -0
- package/src/core/temporal-query.ts +193 -0
- package/src/core/token-budget.ts +160 -0
- package/src/core/whoami.ts +110 -92
- package/src/core/write-pipeline.ts +6 -3
- package/src/engine/activation.ts +1568 -1468
- package/src/hooks/prime.ts +136 -0
- package/src/hooks/sidecar.ts +43 -0
- package/src/mcp.ts +1422 -1387
- package/src/storage/pglite.ts +10 -2
- package/src/storage/postgres.ts +10 -2
- package/src/storage/sqlite.ts +12 -2
- package/src/types/engram.ts +7 -0
package/src/storage/pglite.ts
CHANGED
|
@@ -512,7 +512,11 @@ export class PGliteEngramStore {
|
|
|
512
512
|
sql += ` AND id != $${params.length + 1}`;
|
|
513
513
|
params.push(excludeId);
|
|
514
514
|
}
|
|
515
|
-
|
|
515
|
+
// FIX 2026-08-23: created_at is millisecond-resolution, so two engrams written in
|
|
516
|
+
// the same millisecond TIE and "most recent" became whichever row the engine
|
|
517
|
+
// happened to return. Postgres has no stable insert-order column (ctid moves on
|
|
518
|
+
// update/vacuum), so id is the tiebreak: deterministic, though not chronological.
|
|
519
|
+
sql += ` ORDER BY created_at DESC, id DESC LIMIT 1`;
|
|
516
520
|
const result = await this.db.query<any>(sql, params);
|
|
517
521
|
return result.rows.length > 0 ? rowToEngram(result.rows[0]) : null;
|
|
518
522
|
}
|
|
@@ -734,7 +738,11 @@ export class PGliteEngramStore {
|
|
|
734
738
|
params.push(tagLike(tag));
|
|
735
739
|
}
|
|
736
740
|
}
|
|
737
|
-
|
|
741
|
+
// FIX 2026-08-23: created_at is millisecond-resolution, so two engrams written in
|
|
742
|
+
// the same millisecond TIE and "most recent" became whichever row the engine
|
|
743
|
+
// happened to return. Postgres has no stable insert-order column (ctid moves on
|
|
744
|
+
// update/vacuum), so id is the tiebreak: deterministic, though not chronological.
|
|
745
|
+
sql += ` ORDER BY created_at DESC, id DESC LIMIT 1`;
|
|
738
746
|
const result = await this.db.query<any>(sql, params);
|
|
739
747
|
return result.rows.length > 0 ? rowToEngram(result.rows[0]) : null;
|
|
740
748
|
}
|
package/src/storage/postgres.ts
CHANGED
|
@@ -611,7 +611,11 @@ export class PostgresEngramStore {
|
|
|
611
611
|
sql += ` AND id != $${params.length + 1}`;
|
|
612
612
|
params.push(excludeId);
|
|
613
613
|
}
|
|
614
|
-
|
|
614
|
+
// FIX 2026-08-23: created_at is millisecond-resolution, so two engrams written in
|
|
615
|
+
// the same millisecond TIE and "most recent" became whichever row the engine
|
|
616
|
+
// happened to return. Postgres has no stable insert-order column (ctid moves on
|
|
617
|
+
// update/vacuum), so id is the tiebreak: deterministic, though not chronological.
|
|
618
|
+
sql += ` ORDER BY created_at DESC, id DESC LIMIT 1`;
|
|
615
619
|
const result = await this.q<any>(sql, params);
|
|
616
620
|
return result.rows.length > 0 ? rowToEngram(result.rows[0]) : null;
|
|
617
621
|
}
|
|
@@ -833,7 +837,11 @@ export class PostgresEngramStore {
|
|
|
833
837
|
params.push(tagLike(tag));
|
|
834
838
|
}
|
|
835
839
|
}
|
|
836
|
-
|
|
840
|
+
// FIX 2026-08-23: created_at is millisecond-resolution, so two engrams written in
|
|
841
|
+
// the same millisecond TIE and "most recent" became whichever row the engine
|
|
842
|
+
// happened to return. Postgres has no stable insert-order column (ctid moves on
|
|
843
|
+
// update/vacuum), so id is the tiebreak: deterministic, though not chronological.
|
|
844
|
+
sql += ` ORDER BY created_at DESC, id DESC LIMIT 1`;
|
|
837
845
|
const result = await this.q<any>(sql, params);
|
|
838
846
|
return result.rows.length > 0 ? rowToEngram(result.rows[0]) : null;
|
|
839
847
|
}
|
package/src/storage/sqlite.ts
CHANGED
|
@@ -956,7 +956,12 @@ export class EngramStore {
|
|
|
956
956
|
sql += ' AND id != ?';
|
|
957
957
|
params.push(excludeId);
|
|
958
958
|
}
|
|
959
|
-
|
|
959
|
+
// FIX 2026-08-23: created_at is millisecond-resolution ISO text, so two engrams
|
|
960
|
+
// written in the same millisecond TIE and "most recent" became whichever row the
|
|
961
|
+
// engine happened to return. Surfaced on Linux (same-ms writes) while passing on
|
|
962
|
+
// Windows, whose coarser timer separated them. rowid is monotonic with insert
|
|
963
|
+
// order, so it is both deterministic AND chronologically correct as a tiebreak.
|
|
964
|
+
sql += ' ORDER BY created_at DESC, rowid DESC LIMIT 1';
|
|
960
965
|
const row = this.db.prepare(sql).get(...params) as any;
|
|
961
966
|
return row ? this.rowToEngram(row) : null;
|
|
962
967
|
}
|
|
@@ -1058,7 +1063,12 @@ export class EngramStore {
|
|
|
1058
1063
|
params.push(`%"${tag}"%`);
|
|
1059
1064
|
}
|
|
1060
1065
|
}
|
|
1061
|
-
|
|
1066
|
+
// FIX 2026-08-23: created_at is millisecond-resolution ISO text, so two engrams
|
|
1067
|
+
// written in the same millisecond TIE and "most recent" became whichever row the
|
|
1068
|
+
// engine happened to return. Surfaced on Linux (same-ms writes) while passing on
|
|
1069
|
+
// Windows, whose coarser timer separated them. rowid is monotonic with insert
|
|
1070
|
+
// order, so it is both deterministic AND chronologically correct as a tiebreak.
|
|
1071
|
+
sql += ' ORDER BY created_at DESC, rowid DESC LIMIT 1';
|
|
1062
1072
|
const row = this.db.prepare(sql).get(...params) as any;
|
|
1063
1073
|
return row ? this.rowToEngram(row) : null;
|
|
1064
1074
|
}
|
package/src/types/engram.ts
CHANGED
|
@@ -278,6 +278,13 @@ export interface ActivationQuery {
|
|
|
278
278
|
memoryType?: MemoryType; // Filter by memory type (episodic, semantic, procedural)
|
|
279
279
|
mode?: QueryMode; // Pipeline mode — 'auto' by default
|
|
280
280
|
workspace?: string; // Search across all agents in this workspace (hive mode). If unset, agent-scoped only.
|
|
281
|
+
/**
|
|
282
|
+
* Anchor for relative temporal expressions ("last Friday", "last week").
|
|
283
|
+
* Defaults to now. Passed explicitly by evals so a fixture stays
|
|
284
|
+
* reproducible — with the wall clock, "last week" would silently mean
|
|
285
|
+
* something different on every run.
|
|
286
|
+
*/
|
|
287
|
+
asOf?: number;
|
|
281
288
|
bm25Only?: boolean; // Skip embedding — fast text-only retrieval for bulk/benchmark scenarios
|
|
282
289
|
/**
|
|
283
290
|
* Output granularity (Paper 3: cognitive teaming, Brill 2018 ACT-R collaboration).
|