@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.
Files changed (46) hide show
  1. package/.rush/temp/{6e1299d1cebb080772163a532c221cd181b54f9f.tar.log → 5667e36f1c0cc503a5c20a3ebff76e7b9a702d41.tar.log} +8 -2
  2. package/.rush/temp/chunked-rush-logs/ts-agent-memory.build.chunks.jsonl +2 -2
  3. package/.rush/temp/operation/build/all.log +2 -2
  4. package/.rush/temp/operation/build/log-chunks.jsonl +2 -2
  5. package/.rush/temp/operation/build/state.json +1 -1
  6. package/README.md +55 -0
  7. package/dist/packlets/ingest/orchestrator.js +104 -19
  8. package/dist/packlets/ingest/orchestrator.js.map +1 -1
  9. package/dist/packlets/store/fileTreeMemoryStore.js +11 -4
  10. package/dist/packlets/store/fileTreeMemoryStore.js.map +1 -1
  11. package/dist/test/unit/ingest/dedupScope.test.js +434 -0
  12. package/dist/test/unit/ingest/dedupScope.test.js.map +1 -0
  13. package/dist/test/unit/ingest/orchestrator.test.js +7 -4
  14. package/dist/test/unit/ingest/orchestrator.test.js.map +1 -1
  15. package/dist/test/unit/tools/memoryTools.test.js +1 -0
  16. package/dist/test/unit/tools/memoryTools.test.js.map +1 -1
  17. package/dist/ts-agent-memory.d.ts +92 -5
  18. package/etc/ts-agent-memory.api.md +2 -0
  19. package/lib/packlets/ingest/orchestrator.d.ts +62 -5
  20. package/lib/packlets/ingest/orchestrator.d.ts.map +1 -1
  21. package/lib/packlets/ingest/orchestrator.js +104 -19
  22. package/lib/packlets/ingest/orchestrator.js.map +1 -1
  23. package/lib/packlets/store/fileTreeMemoryStore.d.ts +31 -1
  24. package/lib/packlets/store/fileTreeMemoryStore.d.ts.map +1 -1
  25. package/lib/packlets/store/fileTreeMemoryStore.js +11 -4
  26. package/lib/packlets/store/fileTreeMemoryStore.js.map +1 -1
  27. package/lib/test/unit/ingest/dedupScope.test.d.ts +2 -0
  28. package/lib/test/unit/ingest/dedupScope.test.d.ts.map +1 -0
  29. package/lib/test/unit/ingest/dedupScope.test.js +436 -0
  30. package/lib/test/unit/ingest/dedupScope.test.js.map +1 -0
  31. package/lib/test/unit/ingest/orchestrator.test.js +7 -4
  32. package/lib/test/unit/ingest/orchestrator.test.js.map +1 -1
  33. package/lib/test/unit/tools/memoryTools.test.js +1 -0
  34. package/lib/test/unit/tools/memoryTools.test.js.map +1 -1
  35. package/package.json +7 -7
  36. package/rush-logs/ts-agent-memory.build.cache.log +1 -1
  37. package/rush-logs/ts-agent-memory.build.log +2 -2
  38. package/src/packlets/ingest/orchestrator.ts +116 -21
  39. package/src/packlets/store/fileTreeMemoryStore.ts +40 -2
  40. package/src/test/unit/ingest/dedupScope.test.ts +542 -0
  41. package/src/test/unit/ingest/orchestrator.test.ts +4 -0
  42. package/src/test/unit/tools/memoryTools.test.ts +1 -0
  43. package/temp/build/lint/_eslint-5eVG3S6w.json +9 -5
  44. package/temp/build/typescript/ts_8nwakTlr.json +1 -1
  45. package/temp/ts-agent-memory.api.json +97 -0
  46. package/temp/ts-agent-memory.api.md +2 -0
@@ -348,9 +348,11 @@ export class FileTreeMemoryStore {
348
348
  * vector index, the on-disk file, and the derived index never interleave.
349
349
  */
350
350
  async _writeResolved(record, body, scope, idStem, hash) {
351
- var _a;
352
351
  const policy = this._policyFor(record.envelope.kind);
353
- const dedupScope = (_a = policy.dedupScope) !== null && _a !== void 0 ? _a : DEFAULT_DEDUP_SCOPE;
352
+ // Read through the public accessor so the write path and every external
353
+ // caller (the ingest orchestrator's layer-1) resolve dedup granularity from
354
+ // ONE place — there is no second declaration site.
355
+ const dedupScope = this.dedupScopeFor(record.envelope.kind);
354
356
  // Content-hash dedup runs BEFORE policy. Its granularity is the kind's
355
357
  // `dedupScope`:
356
358
  // - 'content': an identical { kind, body, links } triple ANYWHERE in the
@@ -674,7 +676,6 @@ export class FileTreeMemoryStore {
674
676
  * version's `valid_at` lower-bounds its interval.
675
677
  */
676
678
  async _putVersioned(record, body, codec, scope) {
677
- var _a;
678
679
  const envelope = record.envelope;
679
680
  const entityId = envelope.entityId;
680
681
  const kind = envelope.kind;
@@ -686,7 +687,8 @@ export class FileTreeMemoryStore {
686
687
  const priorCurrents = versions.filter(isVersionCurrent);
687
688
  const current = selectCurrentVersion(versions);
688
689
  const policy = this._policyFor(kind);
689
- const dedupScope = (_a = policy.dedupScope) !== null && _a !== void 0 ? _a : DEFAULT_DEDUP_SCOPE;
690
+ // Same single-owner read as the flat path (see `_writeResolved`).
691
+ const dedupScope = this.dedupScopeFor(kind);
690
692
  return this._contentHash(kind, body, envelope.links).thenOnSuccess((hash) => {
691
693
  // Entity-scoped dedup: a re-put is a no-op only when the CURRENT content AND
692
694
  // its mutable metadata are unchanged (does not spawn a redundant version).
@@ -934,6 +936,11 @@ export class FileTreeMemoryStore {
934
936
  var _a;
935
937
  return (_a = this._writePolicies.get(kind)) !== null && _a !== void 0 ? _a : this._defaultPolicy;
936
938
  }
939
+ /** {@inheritDoc IMemoryStore.dedupScopeFor} */
940
+ dedupScopeFor(kind) {
941
+ var _a;
942
+ return (_a = this._policyFor(kind).dedupScope) !== null && _a !== void 0 ? _a : DEFAULT_DEDUP_SCOPE;
943
+ }
937
944
  /**
938
945
  * Read and validate the record at `<scope>/<idStem>.md`, returning `undefined`
939
946
  * when the scope directory or file is absent. Verifies the on-disk id ↔