dsh-memu-memory 1.3.7 → 1.3.9

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 (63) hide show
  1. package/AGENTS.md +1 -1
  2. package/CHANGELOG.md +70 -0
  3. package/README.md +7 -7
  4. package/README.zh.md +7 -7
  5. package/docs/client-conventions.md +1 -0
  6. package/docs/contributing.md +2 -2
  7. package/docs/host-adaptation.md +1 -1
  8. package/docs/memory-semantics.md +7 -6
  9. package/docs/troubleshooting.md +74 -7
  10. package/lib/auto-link/decide.js +0 -4
  11. package/lib/binding-diagnostics.js +2 -2
  12. package/lib/client.js +150 -81
  13. package/lib/consolidation-ledger.js +6 -2
  14. package/lib/curator.js +42 -10
  15. package/lib/cycle.js +28 -3
  16. package/lib/inbound.js +24 -9
  17. package/lib/inject.js +379 -215
  18. package/lib/local-vector-service.js +1 -10
  19. package/lib/memory.js +704 -181
  20. package/lib/paths.js +24 -0
  21. package/lib/private.js +294 -134
  22. package/lib/rpc.js +53 -6
  23. package/lib/snippet.js +49 -28
  24. package/lib/state.js +185 -26
  25. package/lib/tools.js +137 -28
  26. package/lib/webui.js +25 -1
  27. package/lib/worker-pool.js +260 -26
  28. package/package.json +1 -1
  29. package/scripts/check-i18n.mjs +19 -0
  30. package/scripts/recall-bench.mjs +4 -4
  31. package/scripts/simulate-injection.mjs +3 -0
  32. package/tests/activity-wiring.test.mjs +52 -0
  33. package/tests/client-render.test.mjs +207 -0
  34. package/tests/consolidation-feed.test.mjs +26 -0
  35. package/tests/consolidation-fork.test.mjs +587 -26
  36. package/tests/cross-library-recall.test.mjs +156 -0
  37. package/tests/cue.test.mjs +15 -2
  38. package/tests/curator-contract.test.mjs +191 -0
  39. package/tests/curator-probe.test.mjs +5 -5
  40. package/tests/curator.test.mjs +3 -1
  41. package/tests/hybrid-recall.test.mjs +488 -0
  42. package/tests/inbound.test.mjs +49 -4
  43. package/tests/inject-conflict.test.mjs +70 -9
  44. package/tests/inject-guide.test.mjs +13 -1
  45. package/tests/inject.test.mjs +10 -0
  46. package/tests/injection-budget.test.mjs +101 -0
  47. package/tests/injection-chain.test.mjs +37 -0
  48. package/tests/injection-rollback.test.mjs +172 -9
  49. package/tests/issue2-chain.test.mjs +169 -0
  50. package/tests/lexicon-inject.test.mjs +33 -5
  51. package/tests/managed-memory.test.mjs +625 -1
  52. package/tests/media.test.mjs +1 -1
  53. package/tests/new-session-gate.test.mjs +280 -25
  54. package/tests/open-loop-date.test.mjs +11 -1
  55. package/tests/recall-intent.test.mjs +52 -3
  56. package/tests/regression-sweep.test.mjs +281 -0
  57. package/tests/simulate-injection.test.mjs +4 -4
  58. package/tests/snippet.test.mjs +33 -1
  59. package/tests/state.test.mjs +8 -3
  60. package/tests/tool-schema.test.mjs +52 -0
  61. package/tests/tools.test.mjs +394 -0
  62. package/tests/webui.test.mjs +16 -2
  63. package/tests/worker-lifecycle.test.mjs +419 -36
package/lib/paths.js CHANGED
@@ -69,6 +69,30 @@ export function redactSecrets(value, secrets = []) {
69
69
  .replace(/(https?:\/\/)[^/@\s]+:[^/@\s]+@/g, '$1[REDACTED]@')
70
70
  }
71
71
 
72
+ export function memoryRefKey({ scope, libraryId = null, id }) {
73
+ return JSON.stringify([scope, libraryId, id])
74
+ }
75
+
76
+ export function memoryContentRevision(entry) {
77
+ const content = {
78
+ title: redactSecrets(entry?.title || ''),
79
+ body: redactSecrets(entry?.content || ''),
80
+ source: entry?.source || 'inferred', sourceKind: entry?.source_kind || null,
81
+ disclosure: entry?.disclosure || 'can_tell', visibility: entry?.visibility || 'shared',
82
+ owner: entry?.owner || null, layer: entry?.layer || 'long_term',
83
+ speakerId: entry?.speaker_id || null, absoluteDate: entry?.absolute_date || null,
84
+ confidence: entry?.confidence ?? null, conflictsWith: entry?.conflicts_with || null,
85
+ context: entry?.context || null, knownBy: entry?.known_by || null,
86
+ links: entry?.links || [],
87
+ attachments: (entry?.attachments || []).map(item => [item.sha256 || null, redactSecrets(item.caption || ''), item.kind || null]),
88
+ }
89
+ return crypto.createHash('sha256').update(JSON.stringify(content)).digest('hex')
90
+ }
91
+
92
+ export function memoryRef({ scope, libraryId = null, id, entry }) {
93
+ return { scope, libraryId: scope === 'global' ? null : libraryId, id, revision: memoryContentRevision(entry) }
94
+ }
95
+
72
96
  export function readJsonStrict(file) {
73
97
  let raw
74
98
  try {