@fgv/ts-agent-memory 5.1.0-46 → 5.1.0-47
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/.rush/temp/{6e1299d1cebb080772163a532c221cd181b54f9f.tar.log → 5667e36f1c0cc503a5c20a3ebff76e7b9a702d41.tar.log} +8 -2
- package/.rush/temp/chunked-rush-logs/ts-agent-memory.build.chunks.jsonl +2 -2
- package/.rush/temp/operation/build/all.log +2 -2
- package/.rush/temp/operation/build/log-chunks.jsonl +2 -2
- package/.rush/temp/operation/build/state.json +1 -1
- package/README.md +55 -0
- package/dist/packlets/ingest/orchestrator.js +104 -19
- package/dist/packlets/ingest/orchestrator.js.map +1 -1
- package/dist/packlets/store/fileTreeMemoryStore.js +11 -4
- package/dist/packlets/store/fileTreeMemoryStore.js.map +1 -1
- package/dist/test/unit/ingest/dedupScope.test.js +434 -0
- package/dist/test/unit/ingest/dedupScope.test.js.map +1 -0
- package/dist/test/unit/ingest/orchestrator.test.js +7 -4
- package/dist/test/unit/ingest/orchestrator.test.js.map +1 -1
- package/dist/test/unit/tools/memoryTools.test.js +1 -0
- package/dist/test/unit/tools/memoryTools.test.js.map +1 -1
- package/dist/ts-agent-memory.d.ts +92 -5
- package/etc/ts-agent-memory.api.md +2 -0
- package/lib/packlets/ingest/orchestrator.d.ts +62 -5
- package/lib/packlets/ingest/orchestrator.d.ts.map +1 -1
- package/lib/packlets/ingest/orchestrator.js +104 -19
- package/lib/packlets/ingest/orchestrator.js.map +1 -1
- package/lib/packlets/store/fileTreeMemoryStore.d.ts +31 -1
- package/lib/packlets/store/fileTreeMemoryStore.d.ts.map +1 -1
- package/lib/packlets/store/fileTreeMemoryStore.js +11 -4
- package/lib/packlets/store/fileTreeMemoryStore.js.map +1 -1
- package/lib/test/unit/ingest/dedupScope.test.d.ts +2 -0
- package/lib/test/unit/ingest/dedupScope.test.d.ts.map +1 -0
- package/lib/test/unit/ingest/dedupScope.test.js +436 -0
- package/lib/test/unit/ingest/dedupScope.test.js.map +1 -0
- package/lib/test/unit/ingest/orchestrator.test.js +7 -4
- package/lib/test/unit/ingest/orchestrator.test.js.map +1 -1
- package/lib/test/unit/tools/memoryTools.test.js +1 -0
- package/lib/test/unit/tools/memoryTools.test.js.map +1 -1
- package/package.json +7 -7
- package/rush-logs/ts-agent-memory.build.cache.log +1 -1
- package/rush-logs/ts-agent-memory.build.log +2 -2
- package/src/packlets/ingest/orchestrator.ts +116 -21
- package/src/packlets/store/fileTreeMemoryStore.ts +40 -2
- package/src/test/unit/ingest/dedupScope.test.ts +542 -0
- package/src/test/unit/ingest/orchestrator.test.ts +4 -0
- package/src/test/unit/tools/memoryTools.test.ts +1 -0
- package/temp/build/lint/_eslint-5eVG3S6w.json +9 -5
- package/temp/build/typescript/ts_8nwakTlr.json +1 -1
- package/temp/ts-agent-memory.api.json +97 -0
- package/temp/ts-agent-memory.api.md +2 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Logging, Result } from '@fgv/ts-utils';
|
|
2
2
|
import { FileTree } from '@fgv/ts-json-base';
|
|
3
|
-
import { EntityId, IIdentityCodec, IMemoryRecord, IWritePolicy, Kind, MemoryId, MemoryScopeKey, RankProjector, Tag } from '../types';
|
|
3
|
+
import { DedupScope, EntityId, IIdentityCodec, IMemoryRecord, IWritePolicy, Kind, MemoryId, MemoryScopeKey, RankProjector, Tag } from '../types';
|
|
4
4
|
import { IBodyConverterRegistry as IRegistry } from '../converters';
|
|
5
5
|
import { IMemoryIndex } from '../index';
|
|
6
6
|
import { IMemoryObserver } from '../observe';
|
|
@@ -93,6 +93,34 @@ export interface IMemoryStore {
|
|
|
93
93
|
* seam's `list()` returns scope-qualified records.
|
|
94
94
|
*/
|
|
95
95
|
asRecordSource(): IMemoryRecordSource;
|
|
96
|
+
/**
|
|
97
|
+
* The EFFECTIVE {@link DedupScope} for `kind` — the granularity at which a
|
|
98
|
+
* write for this kind deduplicates against the existing vault.
|
|
99
|
+
*
|
|
100
|
+
* @remarks
|
|
101
|
+
* This is a **read accessor over the store's already-injected write policies**,
|
|
102
|
+
* and it is the single place any caller — the store's own write path included —
|
|
103
|
+
* asks what a kind's dedup granularity is. It resolves the full chain the store
|
|
104
|
+
* applies on write: the kind's registered {@link IWritePolicy}, falling back to
|
|
105
|
+
* the store's default policy, then that policy's
|
|
106
|
+
* {@link IWritePolicy.dedupScope | dedupScope}, falling back to
|
|
107
|
+
* {@link DEFAULT_DEDUP_SCOPE}. Note the store's default policy is a
|
|
108
|
+
* {@link KnowledgeLwwPolicy}, which declares `'content'` — so a kind with NO
|
|
109
|
+
* registered policy resolves to `'content'`, not to `DEFAULT_DEDUP_SCOPE`.
|
|
110
|
+
*
|
|
111
|
+
* It exists so a caller that must agree with the store about dedup granularity
|
|
112
|
+
* — notably the ingest orchestrator's stage-4 layer-1 exact match — can read the
|
|
113
|
+
* declaration through this seam instead of being handed a second copy of the
|
|
114
|
+
* policy map. A second declaration site is precisely the defect this accessor
|
|
115
|
+
* was added to remove.
|
|
116
|
+
*
|
|
117
|
+
* Deliberately synchronous, total, and NOT `Result`-returning: it reads
|
|
118
|
+
* constructor-injected configuration, touches no I/O, and cannot fail (every
|
|
119
|
+
* link in the fallback chain has a total default). It exposes only the scope,
|
|
120
|
+
* never the {@link IWritePolicy} itself, so it can never become a back door for
|
|
121
|
+
* invoking admission or merge logic out of band.
|
|
122
|
+
*/
|
|
123
|
+
dedupScopeFor(kind: Kind): DedupScope;
|
|
96
124
|
/**
|
|
97
125
|
* Write a record. Validates the body, computes a content hash, deduplicates
|
|
98
126
|
* (scope-wide, before policy), applies the kind's {@link IWritePolicy}, stamps
|
|
@@ -610,6 +638,8 @@ export declare class FileTreeMemoryStore implements IMemoryStore {
|
|
|
610
638
|
private _stampRank;
|
|
611
639
|
private _codecFor;
|
|
612
640
|
private _policyFor;
|
|
641
|
+
/** {@inheritDoc IMemoryStore.dedupScopeFor} */
|
|
642
|
+
dedupScopeFor(kind: Kind): DedupScope;
|
|
613
643
|
/**
|
|
614
644
|
* Read and validate the record at `<scope>/<idStem>.md`, returning `undefined`
|
|
615
645
|
* when the scope directory or file is absent. Verifies the on-disk id ↔
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileTreeMemoryStore.d.ts","sourceRoot":"","sources":["../../../src/packlets/store/fileTreeMemoryStore.ts"],"names":[],"mappings":"AAKA,OAAO,EAAQ,OAAO,EAAE,MAAM,EAAyC,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,
|
|
1
|
+
{"version":3,"file":"fileTreeMemoryStore.d.ts","sourceRoot":"","sources":["../../../src/packlets/store/fileTreeMemoryStore.ts"],"names":[],"mappings":"AAKA,OAAO,EAAQ,OAAO,EAAE,MAAM,EAAyC,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAGL,UAAU,EACV,QAAQ,EAER,cAAc,EAEd,aAAa,EAGb,YAAY,EACZ,IAAI,EAEJ,QAAQ,EACR,cAAc,EACd,aAAa,EACb,GAAG,EAMJ,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,sBAAsB,IAAI,SAAS,EAAwC,MAAM,eAAe,CAAC;AAC1G,OAAO,EAAwB,YAAY,EAAe,MAAM,UAAU,CAAC;AAC3E,OAAO,EAEL,eAAe,EAGhB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,gBAAgB,EAEhB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,cAAc,EACf,MAAM,WAAW,CAAC;AAMnB;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,yCAAyC;IACzC,QAAQ,CAAC,KAAK,CAAC,EAAE,cAAc,CAAC;IAChC,wCAAwC;IACxC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;IACrB,2DAA2D;IAC3D,QAAQ,CAAC,G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1B;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,2BAA2B;IAYnC,OAAO,CAAC,YAAY;IAIpB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,UAAU;IAqBlB,OAAO,CAAC,SAAS;IAQjB,OAAO,CAAC,UAAU;IAIlB,+CAA+C;IACxC,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,UAAU;IAI5C;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAqBnB;;;;;;;;OAQG;IACH,OAAO,CAAC,aAAa;IAyBrB;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAwBxB,sEAAsE;IACtE,OAAO,CAAC,eAAe;IAyBvB,oEAAoE;IACpE,OAAO,CAAC,UAAU;IAmBlB;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAwBnB;;;;;;;OAOG;IACH,OAAO,CAAC,aAAa;IAarB,kFAAkF;IAClF,OAAO,CAAC,eAAe;IAiCvB;;;;;;OAMG;IACH,OAAO,CAAC,eAAe;CAoBxB"}
|
|
@@ -351,9 +351,11 @@ class FileTreeMemoryStore {
|
|
|
351
351
|
* vector index, the on-disk file, and the derived index never interleave.
|
|
352
352
|
*/
|
|
353
353
|
async _writeResolved(record, body, scope, idStem, hash) {
|
|
354
|
-
var _a;
|
|
355
354
|
const policy = this._policyFor(record.envelope.kind);
|
|
356
|
-
|
|
355
|
+
// Read through the public accessor so the write path and every external
|
|
356
|
+
// caller (the ingest orchestrator's layer-1) resolve dedup granularity from
|
|
357
|
+
// ONE place — there is no second declaration site.
|
|
358
|
+
const dedupScope = this.dedupScopeFor(record.envelope.kind);
|
|
357
359
|
// Content-hash dedup runs BEFORE policy. Its granularity is the kind's
|
|
358
360
|
// `dedupScope`:
|
|
359
361
|
// - 'content': an identical { kind, body, links } triple ANYWHERE in the
|
|
@@ -677,7 +679,6 @@ class FileTreeMemoryStore {
|
|
|
677
679
|
* version's `valid_at` lower-bounds its interval.
|
|
678
680
|
*/
|
|
679
681
|
async _putVersioned(record, body, codec, scope) {
|
|
680
|
-
var _a;
|
|
681
682
|
const envelope = record.envelope;
|
|
682
683
|
const entityId = envelope.entityId;
|
|
683
684
|
const kind = envelope.kind;
|
|
@@ -689,7 +690,8 @@ class FileTreeMemoryStore {
|
|
|
689
690
|
const priorCurrents = versions.filter(types_1.isVersionCurrent);
|
|
690
691
|
const current = (0, types_1.selectCurrentVersion)(versions);
|
|
691
692
|
const policy = this._policyFor(kind);
|
|
692
|
-
|
|
693
|
+
// Same single-owner read as the flat path (see `_writeResolved`).
|
|
694
|
+
const dedupScope = this.dedupScopeFor(kind);
|
|
693
695
|
return this._contentHash(kind, body, envelope.links).thenOnSuccess((hash) => {
|
|
694
696
|
// Entity-scoped dedup: a re-put is a no-op only when the CURRENT content AND
|
|
695
697
|
// its mutable metadata are unchanged (does not spawn a redundant version).
|
|
@@ -937,6 +939,11 @@ class FileTreeMemoryStore {
|
|
|
937
939
|
var _a;
|
|
938
940
|
return (_a = this._writePolicies.get(kind)) !== null && _a !== void 0 ? _a : this._defaultPolicy;
|
|
939
941
|
}
|
|
942
|
+
/** {@inheritDoc IMemoryStore.dedupScopeFor} */
|
|
943
|
+
dedupScopeFor(kind) {
|
|
944
|
+
var _a;
|
|
945
|
+
return (_a = this._policyFor(kind).dedupScope) !== null && _a !== void 0 ? _a : types_1.DEFAULT_DEDUP_SCOPE;
|
|
946
|
+
}
|
|
940
947
|
/**
|
|
941
948
|
* Read and validate the record at `<scope>/<idStem>.md`, returning `undefined`
|
|
942
949
|
* when the scope directory or file is absent. Verifies the on-disk id ↔
|