goldenmatch 0.3.1 → 0.4.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.
Files changed (88) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/LICENSE +21 -0
  3. package/dist/cli.cjs +1410 -37
  4. package/dist/cli.cjs.map +1 -1
  5. package/dist/cli.js +1408 -35
  6. package/dist/cli.js.map +1 -1
  7. package/dist/core/index.cjs +837 -297
  8. package/dist/core/index.cjs.map +1 -1
  9. package/dist/core/index.d.cts +236 -139
  10. package/dist/core/index.d.ts +236 -139
  11. package/dist/core/index.js +827 -296
  12. package/dist/core/index.js.map +1 -1
  13. package/dist/index.cjs +837 -297
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +2 -2
  16. package/dist/index.d.ts +2 -2
  17. package/dist/index.js +827 -296
  18. package/dist/index.js.map +1 -1
  19. package/dist/node/backends/score-worker.cjs.map +1 -1
  20. package/dist/node/backends/score-worker.d.cts +1 -1
  21. package/dist/node/backends/score-worker.d.ts +1 -1
  22. package/dist/node/backends/score-worker.js.map +1 -1
  23. package/dist/node/index.cjs +1379 -316
  24. package/dist/node/index.cjs.map +1 -1
  25. package/dist/node/index.d.cts +110 -27
  26. package/dist/node/index.d.ts +110 -27
  27. package/dist/node/index.js +1363 -312
  28. package/dist/node/index.js.map +1 -1
  29. package/dist/{types-C-JSr4mQ.d.cts → types-DlzBTOit.d.cts} +130 -3
  30. package/dist/{types-C-JSr4mQ.d.ts → types-DlzBTOit.d.ts} +130 -3
  31. package/package.json +79 -29
  32. package/src/cli.ts +314 -4
  33. package/src/core/api.ts +85 -7
  34. package/src/core/autoconfigVerify.ts +67 -0
  35. package/src/core/cluster.ts +58 -4
  36. package/src/core/config/loader.ts +22 -2
  37. package/src/core/index.ts +3 -7
  38. package/src/core/llm/explain.ts +181 -0
  39. package/src/core/llm/scorer.ts +73 -2
  40. package/src/core/memory/corrections.ts +258 -129
  41. package/src/core/memory/hash.ts +81 -0
  42. package/src/core/memory/index.ts +14 -0
  43. package/src/core/memory/learner.ts +108 -190
  44. package/src/core/memory/store.ts +0 -0
  45. package/src/core/memory/types.ts +215 -0
  46. package/src/core/pipeline.ts +162 -9
  47. package/src/core/review-queue.ts +86 -3
  48. package/src/core/sensitivity.ts +5 -5
  49. package/src/core/types.ts +10 -2
  50. package/src/node/a2a/server.ts +2 -2
  51. package/src/node/api/server.ts +49 -3
  52. package/src/node/db/sync.ts +1 -1
  53. package/src/node/dedupe-file.ts +9 -5
  54. package/src/node/index.ts +3 -0
  55. package/src/node/mcp/memory-tools.ts +402 -0
  56. package/src/node/mcp/server.ts +28 -8
  57. package/src/node/memory/api.ts +134 -0
  58. package/src/node/memory/index.ts +18 -0
  59. package/src/node/memory/sqlite-store.ts +294 -0
  60. package/src/node/tui/app.ts +1 -1
  61. package/tests/parity/fixtures/memory.db +0 -0
  62. package/tests/parity/fixtures/memory_apply_inputs.json +116 -0
  63. package/tests/parity/fixtures/memory_corrections.json +182 -0
  64. package/tests/parity/memory_apply.parity.test.ts +117 -0
  65. package/tests/parity/memory_json.parity.test.ts +125 -0
  66. package/tests/parity/memory_sqlite.parity.test.ts +96 -0
  67. package/tests/smoke.test.ts +4 -4
  68. package/tests/unit/api.test.ts +12 -12
  69. package/tests/unit/autoconfigVerify-postflight.test.ts +11 -11
  70. package/tests/unit/cli-memory.test.ts +169 -0
  71. package/tests/unit/cluster.test.ts +19 -19
  72. package/tests/unit/explain-why.test.ts +114 -0
  73. package/tests/unit/lineage.test.ts +19 -19
  74. package/tests/unit/mcp-memory-tools.test.ts +184 -0
  75. package/tests/unit/memory-api.test.ts +155 -0
  76. package/tests/unit/memory-collection.test.ts +257 -0
  77. package/tests/unit/memory-e2e.test.ts +246 -0
  78. package/tests/unit/memory-hash.test.ts +93 -0
  79. package/tests/unit/memory-learner.test.ts +185 -0
  80. package/tests/unit/memory-pipeline.test.ts +177 -0
  81. package/tests/unit/memory-postflight.test.ts +112 -0
  82. package/tests/unit/memory-reanchor.test.ts +325 -0
  83. package/tests/unit/memory-sqlite.test.ts +348 -0
  84. package/tests/unit/memory.test.ts +146 -95
  85. package/tests/unit/pipeline.test.ts +14 -14
  86. package/tests/unit/pprl-protocol.test.ts +8 -2
  87. package/tests/unit/sensitivity.test.ts +10 -10
  88. package/tsconfig.json +1 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,31 @@
1
+ # Changelog
2
+
3
+ All notable changes to goldenmatch-js are documented in this file.
4
+
5
+ Format follows [Keep a Changelog](https://keepachangelog.com/). Versioning follows [Semantic Versioning](https://semver.org/) (strict after v1.0.0).
6
+
7
+ ## [0.4.0] - 2026-05-05
8
+
9
+ ### BREAKING
10
+
11
+ - `Correction.verdict` renamed to `Correction.decision` (`"approve" | "reject"`)
12
+ - `Correction.feature` renamed to `Correction.matchkeyName`
13
+ - `MemoryStore` interface methods are now async (return `Promise<...>`)
14
+ - `runDedupePipeline` and `runMatchPipeline` are now async
15
+ - `dedupe`, `match`, `dedupeFile`, `matchFile` API functions are now async
16
+ - Hash algorithm changed from FNV-1a to SHA-256 (cross-language storage parity with Python goldenmatch v1.6.0)
17
+ - `MemoryConfig.backend` enum: `"sqlite" | "postgres"` -> `"memory" | "sqlite"`
18
+ - `MemoryConfig.trust`: `number` -> `{ human: number; agent: number }` (matches Python)
19
+
20
+ ### Added
21
+
22
+ - Pipeline integration for Learning Memory (`config.memory.enabled = true`)
23
+ - Five MCP tools: `list_corrections`, `add_correction`, `learn_thresholds`, `memory_stats`, `memory_export`
24
+ - CLI subgroup: `goldenmatch-js memory <stats|learn|export|import|show>`
25
+ - Python API mirror: `getMemory`, `addCorrection`, `learn`, `memoryStats`
26
+ - `SqliteMemoryStore` (Node only; requires `better-sqlite3` peer dep)
27
+ - Cross-language parity tests (JSON, SQLite, apply-outcome) -- Python and TS both run against the same fixtures
28
+ - Postflight rendering: `Memory: N applied, M stale, K stale-ambiguous, J unanchorable`
29
+ - Re-anchoring: corrections survive row reordering across runs (collision-safe; `record_hash` excludes `__row_id__`)
30
+ - `CorrectionStats.staleAmbiguous` and `staleUnanchorable` counters
31
+ - Explainer integration: `ReviewItem` carries a one-sentence `why`, deterministic by default with LLM upgrade when API key is set
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-2026 Ben Severn
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.