goldenmatch 0.3.1 → 0.5.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 (101) hide show
  1. package/CHANGELOG.md +65 -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 +7176 -5407
  8. package/dist/core/index.cjs.map +1 -1
  9. package/dist/core/index.d.cts +594 -143
  10. package/dist/core/index.d.ts +594 -143
  11. package/dist/core/index.js +7155 -5399
  12. package/dist/core/index.js.map +1 -1
  13. package/dist/index.cjs +7176 -5407
  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 +7155 -5399
  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 +6136 -3997
  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 +6105 -3993
  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/autoconfig.ts +30 -0
  35. package/src/core/autoconfigController.ts +496 -0
  36. package/src/core/autoconfigHistory.ts +163 -0
  37. package/src/core/autoconfigPolicy.ts +103 -0
  38. package/src/core/autoconfigRules.ts +384 -0
  39. package/src/core/autoconfigVerify.ts +67 -0
  40. package/src/core/cluster.ts +58 -4
  41. package/src/core/complexityProfile.ts +411 -0
  42. package/src/core/config/loader.ts +22 -2
  43. package/src/core/index.ts +73 -8
  44. package/src/core/llm/explain.ts +181 -0
  45. package/src/core/llm/scorer.ts +73 -2
  46. package/src/core/memory/corrections.ts +258 -129
  47. package/src/core/memory/hash.ts +81 -0
  48. package/src/core/memory/index.ts +14 -0
  49. package/src/core/memory/learner.ts +108 -190
  50. package/src/core/memory/store.ts +0 -0
  51. package/src/core/memory/types.ts +215 -0
  52. package/src/core/pipeline.ts +162 -9
  53. package/src/core/review-queue.ts +86 -3
  54. package/src/core/sensitivity.ts +5 -5
  55. package/src/core/types.ts +10 -2
  56. package/src/node/a2a/server.ts +2 -2
  57. package/src/node/api/server.ts +49 -3
  58. package/src/node/db/sync.ts +1 -1
  59. package/src/node/dedupe-file.ts +9 -5
  60. package/src/node/index.ts +3 -0
  61. package/src/node/mcp/memory-tools.ts +402 -0
  62. package/src/node/mcp/server.ts +28 -8
  63. package/src/node/memory/api.ts +134 -0
  64. package/src/node/memory/index.ts +18 -0
  65. package/src/node/memory/sqlite-store.ts +294 -0
  66. package/src/node/tui/app.ts +1 -1
  67. package/tests/parity/controller-stoppoint-fixtures.json +857 -0
  68. package/tests/parity/controller-stoppoint.parity.test.ts +99 -0
  69. package/tests/parity/fixtures/memory.db +0 -0
  70. package/tests/parity/fixtures/memory_apply_inputs.json +116 -0
  71. package/tests/parity/fixtures/memory_corrections.json +182 -0
  72. package/tests/parity/memory_apply.parity.test.ts +117 -0
  73. package/tests/parity/memory_json.parity.test.ts +125 -0
  74. package/tests/parity/memory_sqlite.parity.test.ts +96 -0
  75. package/tests/smoke.test.ts +4 -4
  76. package/tests/unit/api.test.ts +12 -12
  77. package/tests/unit/autoconfigController.test.ts +98 -0
  78. package/tests/unit/autoconfigHistory.test.ts +183 -0
  79. package/tests/unit/autoconfigPolicy.test.ts +113 -0
  80. package/tests/unit/autoconfigRules.test.ts +281 -0
  81. package/tests/unit/autoconfigVerify-postflight.test.ts +11 -11
  82. package/tests/unit/cli-memory.test.ts +169 -0
  83. package/tests/unit/cluster.test.ts +19 -19
  84. package/tests/unit/complexityProfile.test.ts +240 -0
  85. package/tests/unit/explain-why.test.ts +114 -0
  86. package/tests/unit/lineage.test.ts +19 -19
  87. package/tests/unit/mcp-memory-tools.test.ts +184 -0
  88. package/tests/unit/memory-api.test.ts +155 -0
  89. package/tests/unit/memory-collection.test.ts +257 -0
  90. package/tests/unit/memory-e2e.test.ts +246 -0
  91. package/tests/unit/memory-hash.test.ts +93 -0
  92. package/tests/unit/memory-learner.test.ts +185 -0
  93. package/tests/unit/memory-pipeline.test.ts +177 -0
  94. package/tests/unit/memory-postflight.test.ts +112 -0
  95. package/tests/unit/memory-reanchor.test.ts +325 -0
  96. package/tests/unit/memory-sqlite.test.ts +348 -0
  97. package/tests/unit/memory.test.ts +146 -95
  98. package/tests/unit/pipeline.test.ts +14 -14
  99. package/tests/unit/pprl-protocol.test.ts +8 -2
  100. package/tests/unit/sensitivity.test.ts +10 -10
  101. package/tsconfig.json +1 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,65 @@
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.5.0] - 2026-05-10
8
+
9
+ Auto-config controller parity with Python `goldenmatch` v1.7 + v1.8.
10
+
11
+ ### Added
12
+
13
+ - `AutoConfigController` (async `.run()`) — iterative auto-config with
14
+ pathological-input gates, deterministic sampling, policy-driven refit loop,
15
+ and best-effort commit via `RunHistory.pickCommitted`.
16
+ - `ComplexityProfile` + sub-profiles (`DataProfile`, `DomainProfile`,
17
+ `MatchkeyProfile`, `BlockingProfile`, `ScoringProfile`, `ClusterProfile`,
18
+ `ProfileMeta`, `IndicatorsProfile`) with `HealthVerdict` rollup.
19
+ - `RunHistory` audit trail with `PolicyDecision` / `ErrorRecord` / `HistoryEntry`
20
+ and `pickCommitted(precisionCollapseFloor)` lexicographic commit selection.
21
+ - `HeuristicRefitPolicy` rule dispatcher + 7 base v1.7/v1.8 rules:
22
+ `ruleBlockingSingletonTrap`, `ruleBlockingTooCoarse`, `ruleBlockingKeySwap`,
23
+ `ruleLowReductionRatio`, `ruleLowTransitivity`, `ruleNoMatches`,
24
+ `ruleUnimodalScoring`.
25
+ - `StopReason` telemetry (8 variants matching Python).
26
+ - `autoConfigureRowsIterate(rows)` async iterative entry point.
27
+ - `AutoconfigOptions.iterate` field (default `false`; preserves pre-0.5.0
28
+ behavior).
29
+ - `getLastControllerRun()` debug accessor mirroring Python's
30
+ `_LAST_CONTROLLER_RUN` ContextVar.
31
+ - Parity test suite: 6 dataset fixtures generated from the Python sibling
32
+ via `packages/python/goldenmatch/scripts/emit_ts_parity_fixtures.py`.
33
+
34
+ ### Deferred to v0.6.0 (Wave 2)
35
+
36
+ - 5 complexity indicators + `IndicatorContext` memoization.
37
+ - Indicator-aware refit rules (`ruleCorruptionNormalize`,
38
+ `ruleCrossBlockingDisagreement`, `ruleSparseMatchExpand`).
39
+ - Indicator-aware extensions to `ruleBlockingKeySwap` and `ruleNoMatches`.
40
+
41
+ ## [0.4.0] - 2026-05-05
42
+
43
+ ### BREAKING
44
+
45
+ - `Correction.verdict` renamed to `Correction.decision` (`"approve" | "reject"`)
46
+ - `Correction.feature` renamed to `Correction.matchkeyName`
47
+ - `MemoryStore` interface methods are now async (return `Promise<...>`)
48
+ - `runDedupePipeline` and `runMatchPipeline` are now async
49
+ - `dedupe`, `match`, `dedupeFile`, `matchFile` API functions are now async
50
+ - Hash algorithm changed from FNV-1a to SHA-256 (cross-language storage parity with Python goldenmatch v1.6.0)
51
+ - `MemoryConfig.backend` enum: `"sqlite" | "postgres"` -> `"memory" | "sqlite"`
52
+ - `MemoryConfig.trust`: `number` -> `{ human: number; agent: number }` (matches Python)
53
+
54
+ ### Added
55
+
56
+ - Pipeline integration for Learning Memory (`config.memory.enabled = true`)
57
+ - Five MCP tools: `list_corrections`, `add_correction`, `learn_thresholds`, `memory_stats`, `memory_export`
58
+ - CLI subgroup: `goldenmatch-js memory <stats|learn|export|import|show>`
59
+ - Python API mirror: `getMemory`, `addCorrection`, `learn`, `memoryStats`
60
+ - `SqliteMemoryStore` (Node only; requires `better-sqlite3` peer dep)
61
+ - Cross-language parity tests (JSON, SQLite, apply-outcome) -- Python and TS both run against the same fixtures
62
+ - Postflight rendering: `Memory: N applied, M stale, K stale-ambiguous, J unanchorable`
63
+ - Re-anchoring: corrections survive row reordering across runs (collision-safe; `record_hash` excludes `__row_id__`)
64
+ - `CorrectionStats.staleAmbiguous` and `staleUnanchorable` counters
65
+ - 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.