@remnic/core 9.3.716 → 9.3.718

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 (257) hide show
  1. package/dist/access-boundary.d.ts +5 -5
  2. package/dist/access-boundary.js +10 -9
  3. package/dist/access-cli.js +26 -25
  4. package/dist/access-cli.js.map +1 -1
  5. package/dist/access-http.d.ts +5 -5
  6. package/dist/access-http.js +14 -13
  7. package/dist/access-mcp.d.ts +5 -5
  8. package/dist/access-mcp.js +13 -12
  9. package/dist/access-operations-batch.js +11 -10
  10. package/dist/access-operations.d.ts +5 -5
  11. package/dist/access-operations.js +12 -11
  12. package/dist/{access-service-BW8cm_uU.d.ts → access-service-CZbnt0t2.d.ts} +4 -4
  13. package/dist/access-service.d.ts +5 -5
  14. package/dist/access-service.js +9 -8
  15. package/dist/access-surface-catalog.d.ts +5 -5
  16. package/dist/action-confidence.d.ts +1 -1
  17. package/dist/active-memory-bridge.d.ts +1 -1
  18. package/dist/active-recall.d.ts +1 -1
  19. package/dist/active-recall.js +1 -1
  20. package/dist/behavior-learner.d.ts +1 -1
  21. package/dist/behavior-signals.d.ts +1 -1
  22. package/dist/bootstrap.d.ts +4 -4
  23. package/dist/briefing.d.ts +3 -1
  24. package/dist/briefing.js +3 -3
  25. package/dist/buffer-surprise-report.d.ts +1 -1
  26. package/dist/buffer.d.ts +1 -1
  27. package/dist/calibration.d.ts +1 -1
  28. package/dist/capabilities.d.ts +1 -1
  29. package/dist/{catalog-CbR0CsUw.d.ts → catalog-CEYlMs9X.d.ts} +1 -1
  30. package/dist/causal-behavior.d.ts +1 -1
  31. package/dist/causal-consolidation.d.ts +1 -1
  32. package/dist/causal-consolidation.js +4 -4
  33. package/dist/{chunk-JEIROMLX.js → chunk-2COL35PK.js} +95 -9
  34. package/dist/chunk-2COL35PK.js.map +1 -0
  35. package/dist/{chunk-XZTUMWKQ.js → chunk-2PTBLS2S.js} +2 -2
  36. package/dist/{chunk-2Y6LMOQQ.js → chunk-2VHMVWPU.js} +2 -2
  37. package/dist/{chunk-6UU43ZGD.js → chunk-4KZGLDJJ.js} +2 -2
  38. package/dist/{chunk-K44MIN6D.js → chunk-5RHM43BJ.js} +3 -3
  39. package/dist/{chunk-MECU6WSH.js → chunk-72VDBALG.js} +18 -18
  40. package/dist/{chunk-UY4JMEAK.js → chunk-7EEVXW7X.js} +2 -2
  41. package/dist/{chunk-XCTDHF7U.js → chunk-A5TUPZ3N.js} +33 -1
  42. package/dist/chunk-A5TUPZ3N.js.map +1 -0
  43. package/dist/{chunk-WI4QX7GH.js → chunk-A66YRSOS.js} +2 -2
  44. package/dist/{chunk-CTAHKIG6.js → chunk-ANI5DUAE.js} +10 -8
  45. package/dist/{chunk-CTAHKIG6.js.map → chunk-ANI5DUAE.js.map} +1 -1
  46. package/dist/{chunk-O62P2LFL.js → chunk-APUJIMDM.js} +2 -2
  47. package/dist/{chunk-MPHDVHIB.js → chunk-DIFU33GU.js} +2 -2
  48. package/dist/{chunk-DXGS5YOQ.js → chunk-EH27LHML.js} +2 -2
  49. package/dist/{chunk-BNOAB5HH.js → chunk-F3PVXKHP.js} +78 -1442
  50. package/dist/chunk-F3PVXKHP.js.map +1 -0
  51. package/dist/{chunk-6QUPUTT7.js → chunk-HLIR3RJ7.js} +6 -10
  52. package/dist/{chunk-6QUPUTT7.js.map → chunk-HLIR3RJ7.js.map} +1 -1
  53. package/dist/{chunk-SHRRWOVY.js → chunk-J6BH2OBA.js} +64 -21
  54. package/dist/chunk-J6BH2OBA.js.map +1 -0
  55. package/dist/{chunk-6FUJ2VYY.js → chunk-JAKYZGV4.js} +3 -3
  56. package/dist/{chunk-3VUPWDSE.js → chunk-JIZGYQYH.js} +4 -4
  57. package/dist/{chunk-QOIONSOI.js → chunk-KRGC4EDX.js} +2 -2
  58. package/dist/{chunk-AJOIM6UR.js → chunk-L5ASZA2F.js} +2 -2
  59. package/dist/{chunk-I56LKMF7.js → chunk-LXSG4L55.js} +2 -2
  60. package/dist/{chunk-MSVSP5VO.js → chunk-N3DUH6OO.js} +1 -1
  61. package/dist/chunk-N3DUH6OO.js.map +1 -0
  62. package/dist/{chunk-SQ4LU27I.js → chunk-NFRBADNR.js} +195 -80
  63. package/dist/chunk-NFRBADNR.js.map +1 -0
  64. package/dist/chunk-OJU73BUX.js +1688 -0
  65. package/dist/chunk-OJU73BUX.js.map +1 -0
  66. package/dist/{chunk-JVEMUX6L.js → chunk-OZ2KQ7HF.js} +2 -2
  67. package/dist/{chunk-SYDHFFAW.js → chunk-P5IPFZVH.js} +5 -5
  68. package/dist/{chunk-GM3BMWKR.js → chunk-REWQAFSA.js} +2 -2
  69. package/dist/{chunk-V7GDTQ6I.js → chunk-S35FX6MU.js} +2 -2
  70. package/dist/{chunk-MTHNJCOJ.js → chunk-S3OPGGZB.js} +2 -2
  71. package/dist/{chunk-IHMT6XTY.js → chunk-U5H7WHTS.js} +6 -4
  72. package/dist/{chunk-IHMT6XTY.js.map → chunk-U5H7WHTS.js.map} +1 -1
  73. package/dist/{chunk-RBHANGVX.js → chunk-UCJ5CDTK.js} +6 -6
  74. package/dist/{chunk-HHLWSWWF.js → chunk-URM3HW2R.js} +2 -2
  75. package/dist/{chunk-VO4UICII.js → chunk-YTZLBBEB.js} +2 -2
  76. package/dist/{chunk-OC56UWV5.js → chunk-YYOK4GVF.js} +2 -2
  77. package/dist/{cli-Dpivy32W.d.ts → cli-1orcdXOY.d.ts} +3 -3
  78. package/dist/cli.d.ts +6 -6
  79. package/dist/cli.js +28 -27
  80. package/dist/compounding/engine.d.ts +1 -1
  81. package/dist/compounding/engine.js +3 -3
  82. package/dist/compounding/preference-consolidator.d.ts +1 -1
  83. package/dist/compression-optimizer.d.ts +1 -1
  84. package/dist/config.d.ts +1 -1
  85. package/dist/config.js +1 -1
  86. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  87. package/dist/connectors/codex-materialize-runner.js +3 -3
  88. package/dist/connectors/codex-materialize.d.ts +1 -1
  89. package/dist/connectors/index.d.ts +1 -1
  90. package/dist/connectors/index.js +3 -3
  91. package/dist/consolidation-provenance-check.d.ts +1 -1
  92. package/dist/consolidation-undo.d.ts +1 -1
  93. package/dist/contradiction/index.d.ts +1 -1
  94. package/dist/conversation-index/backend.d.ts +1 -1
  95. package/dist/conversation-index/chunker.d.ts +1 -1
  96. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  97. package/dist/conversation-index/indexer.d.ts +1 -1
  98. package/dist/conversation-index/search.d.ts +1 -1
  99. package/dist/day-summary.d.ts +1 -1
  100. package/dist/delinearize.d.ts +1 -1
  101. package/dist/direct-answer-wiring.d.ts +1 -1
  102. package/dist/direct-answer.d.ts +1 -1
  103. package/dist/embedding-fallback.d.ts +1 -1
  104. package/dist/enrichment/index.d.ts +1 -1
  105. package/dist/entity-retrieval.d.ts +1 -1
  106. package/dist/entity-retrieval.js +3 -3
  107. package/dist/entity-schema.d.ts +1 -1
  108. package/dist/explicit-capture.d.ts +4 -4
  109. package/dist/extraction-faithfulness.d.ts +1 -1
  110. package/dist/extraction-judge-telemetry.d.ts +1 -1
  111. package/dist/extraction-judge-training.d.ts +1 -1
  112. package/dist/extraction-judge.d.ts +1 -1
  113. package/dist/extraction.d.ts +1 -1
  114. package/dist/fallback-llm.d.ts +1 -1
  115. package/dist/identity-continuity.d.ts +1 -1
  116. package/dist/importance.d.ts +1 -1
  117. package/dist/index.d.ts +9 -9
  118. package/dist/index.js +42 -41
  119. package/dist/index.js.map +1 -1
  120. package/dist/intent.d.ts +1 -1
  121. package/dist/lcm/engine.d.ts +1 -1
  122. package/dist/lcm/index.d.ts +1 -1
  123. package/dist/lcm/tools.d.ts +1 -1
  124. package/dist/lifecycle.d.ts +1 -1
  125. package/dist/live-connectors-runner.d.ts +1 -1
  126. package/dist/local-llm.d.ts +1 -1
  127. package/dist/maintenance/memory-governance.d.ts +1 -1
  128. package/dist/maintenance/memory-governance.js +3 -3
  129. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +3 -3
  130. package/dist/maintenance/rebuild-memory-projection.js +4 -4
  131. package/dist/mcp-memory-inspector-app.d.ts +5 -5
  132. package/dist/memory-action-policy.d.ts +1 -1
  133. package/dist/memory-cache.d.ts +1 -1
  134. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  135. package/dist/memory-projection-store.d.ts +1 -1
  136. package/dist/memory-provenance.d.ts +1 -1
  137. package/dist/memory-worth-outcomes.d.ts +1 -1
  138. package/dist/models-json.d.ts +1 -1
  139. package/dist/namespaces/migrate.d.ts +2 -2
  140. package/dist/namespaces/migrate.js +4 -4
  141. package/dist/namespaces/principal.d.ts +1 -1
  142. package/dist/namespaces/search.d.ts +1 -1
  143. package/dist/namespaces/storage.d.ts +2 -2
  144. package/dist/namespaces/storage.js +3 -3
  145. package/dist/native-knowledge.d.ts +1 -1
  146. package/dist/operator-toolkit.d.ts +1 -1
  147. package/dist/operator-toolkit.js +11 -9
  148. package/dist/orchestration/maintenance.d.ts +2 -2
  149. package/dist/orchestration/maintenance.js +8 -5
  150. package/dist/{orchestrator-vygo2YIM.d.ts → orchestrator-kOxredSr.d.ts} +22 -5
  151. package/dist/orchestrator.d.ts +4 -4
  152. package/dist/orchestrator.js +17 -16
  153. package/dist/patterns-cli.d.ts +1 -1
  154. package/dist/policy-runtime.d.ts +1 -1
  155. package/dist/provenance.d.ts +1 -1
  156. package/dist/qmd-recall-cache.d.ts +1 -1
  157. package/dist/qmd.d.ts +1 -1
  158. package/dist/recall-disclosure-escalation.d.ts +1 -1
  159. package/dist/recall-explain-renderer.d.ts +1 -1
  160. package/dist/recall-explain-renderer.js +3 -3
  161. package/dist/recall-planner-llm.d.ts +1 -1
  162. package/dist/recall-state.d.ts +1 -1
  163. package/dist/recall-tag-filter.d.ts +1 -1
  164. package/dist/recall-xray-cli.d.ts +1 -1
  165. package/dist/recall-xray-cli.js +4 -4
  166. package/dist/recall-xray-renderer.d.ts +1 -1
  167. package/dist/recall-xray-renderer.js +3 -3
  168. package/dist/recall-xray.d.ts +1 -1
  169. package/dist/recall-xray.js +2 -2
  170. package/dist/resolve-auth-token.d.ts +1 -1
  171. package/dist/resume-bundles.js +2 -2
  172. package/dist/retrieval-agents.d.ts +1 -1
  173. package/dist/retrieval-tiers.d.ts +1 -1
  174. package/dist/routing/engine.d.ts +1 -1
  175. package/dist/routing/store.d.ts +1 -1
  176. package/dist/schemas.d.ts +22 -22
  177. package/dist/search/embed-helper.d.ts +1 -1
  178. package/dist/search/factory.d.ts +1 -1
  179. package/dist/search/index.d.ts +1 -1
  180. package/dist/search/lancedb-backend.d.ts +1 -1
  181. package/dist/search/meilisearch-backend.d.ts +1 -1
  182. package/dist/search/noop-backend.d.ts +1 -1
  183. package/dist/search/orama-backend.d.ts +1 -1
  184. package/dist/search/port.d.ts +1 -1
  185. package/dist/search/remote-backend.d.ts +1 -1
  186. package/dist/{semantic-consolidation-DSjMDZ1u.d.ts → semantic-consolidation-B58v3S-a.d.ts} +1 -1
  187. package/dist/semantic-consolidation.d.ts +2 -2
  188. package/dist/semantic-consolidation.js +4 -4
  189. package/dist/semantic-rule-promotion.js +3 -3
  190. package/dist/semantic-rule-verifier.d.ts +1 -1
  191. package/dist/semantic-rule-verifier.js +3 -3
  192. package/dist/session-observer-bands.d.ts +1 -1
  193. package/dist/session-observer-state.d.ts +1 -1
  194. package/dist/shared-context/manager.d.ts +1 -1
  195. package/dist/signal.d.ts +1 -1
  196. package/dist/storage.d.ts +1 -1
  197. package/dist/storage.js +2 -2
  198. package/dist/summarizer.d.ts +1 -1
  199. package/dist/summary-snapshot.d.ts +1 -1
  200. package/dist/temporal-supersession.d.ts +1 -1
  201. package/dist/temporal-validity.d.ts +1 -1
  202. package/dist/threading.d.ts +1 -1
  203. package/dist/tier-migration.d.ts +1 -1
  204. package/dist/tier-routing.d.ts +1 -1
  205. package/dist/topics.d.ts +1 -1
  206. package/dist/transcript.d.ts +1 -1
  207. package/dist/transfer/types.d.ts +12 -12
  208. package/dist/{types-D9dwzU_x.d.ts → types-ACmDOScJ.d.ts} +36 -0
  209. package/dist/types.d.ts +1 -1
  210. package/dist/types.js +1 -1
  211. package/dist/utility-runtime.d.ts +1 -1
  212. package/dist/verified-recall.js +3 -3
  213. package/package.json +2 -2
  214. package/src/access-service.ts +56 -41
  215. package/src/briefing.ts +32 -0
  216. package/src/config.ts +32 -0
  217. package/src/correction/index.ts +24 -0
  218. package/src/correction/passive-capture.test.ts +500 -0
  219. package/src/correction/passive-capture.ts +335 -0
  220. package/src/correction/passive-correction-detector.test.ts +263 -0
  221. package/src/correction/passive-correction-detector.ts +325 -0
  222. package/src/correction/passive-correction-notifications.ts +123 -0
  223. package/src/maintenance/namespace-planner.ts +3 -10
  224. package/src/orchestrator.ts +231 -73
  225. package/src/scopes/scope-plan.test.ts +168 -1
  226. package/src/scopes/scope-plan.ts +163 -0
  227. package/src/types.ts +36 -0
  228. package/dist/chunk-BNOAB5HH.js.map +0 -1
  229. package/dist/chunk-JEIROMLX.js.map +0 -1
  230. package/dist/chunk-MSVSP5VO.js.map +0 -1
  231. package/dist/chunk-SHRRWOVY.js.map +0 -1
  232. package/dist/chunk-SQ4LU27I.js.map +0 -1
  233. package/dist/chunk-XCTDHF7U.js.map +0 -1
  234. /package/dist/{chunk-XZTUMWKQ.js.map → chunk-2PTBLS2S.js.map} +0 -0
  235. /package/dist/{chunk-2Y6LMOQQ.js.map → chunk-2VHMVWPU.js.map} +0 -0
  236. /package/dist/{chunk-6UU43ZGD.js.map → chunk-4KZGLDJJ.js.map} +0 -0
  237. /package/dist/{chunk-K44MIN6D.js.map → chunk-5RHM43BJ.js.map} +0 -0
  238. /package/dist/{chunk-MECU6WSH.js.map → chunk-72VDBALG.js.map} +0 -0
  239. /package/dist/{chunk-UY4JMEAK.js.map → chunk-7EEVXW7X.js.map} +0 -0
  240. /package/dist/{chunk-WI4QX7GH.js.map → chunk-A66YRSOS.js.map} +0 -0
  241. /package/dist/{chunk-O62P2LFL.js.map → chunk-APUJIMDM.js.map} +0 -0
  242. /package/dist/{chunk-MPHDVHIB.js.map → chunk-DIFU33GU.js.map} +0 -0
  243. /package/dist/{chunk-DXGS5YOQ.js.map → chunk-EH27LHML.js.map} +0 -0
  244. /package/dist/{chunk-6FUJ2VYY.js.map → chunk-JAKYZGV4.js.map} +0 -0
  245. /package/dist/{chunk-3VUPWDSE.js.map → chunk-JIZGYQYH.js.map} +0 -0
  246. /package/dist/{chunk-QOIONSOI.js.map → chunk-KRGC4EDX.js.map} +0 -0
  247. /package/dist/{chunk-AJOIM6UR.js.map → chunk-L5ASZA2F.js.map} +0 -0
  248. /package/dist/{chunk-I56LKMF7.js.map → chunk-LXSG4L55.js.map} +0 -0
  249. /package/dist/{chunk-JVEMUX6L.js.map → chunk-OZ2KQ7HF.js.map} +0 -0
  250. /package/dist/{chunk-SYDHFFAW.js.map → chunk-P5IPFZVH.js.map} +0 -0
  251. /package/dist/{chunk-GM3BMWKR.js.map → chunk-REWQAFSA.js.map} +0 -0
  252. /package/dist/{chunk-V7GDTQ6I.js.map → chunk-S35FX6MU.js.map} +0 -0
  253. /package/dist/{chunk-MTHNJCOJ.js.map → chunk-S3OPGGZB.js.map} +0 -0
  254. /package/dist/{chunk-RBHANGVX.js.map → chunk-UCJ5CDTK.js.map} +0 -0
  255. /package/dist/{chunk-HHLWSWWF.js.map → chunk-URM3HW2R.js.map} +0 -0
  256. /package/dist/{chunk-VO4UICII.js.map → chunk-YTZLBBEB.js.map} +0 -0
  257. /package/dist/{chunk-OC56UWV5.js.map → chunk-YYOK4GVF.js.map} +0 -0
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-DGTDRIUO.js";
8
8
  import {
9
9
  MaintenanceScheduler
10
- } from "./chunk-O62P2LFL.js";
10
+ } from "./chunk-APUJIMDM.js";
11
11
  import {
12
12
  migrateFromEngram
13
13
  } from "./chunk-7HYPN2GC.js";
@@ -23,7 +23,7 @@ import {
23
23
  import {
24
24
  CompoundingEngine,
25
25
  defaultTierMigrationCycleBudget
26
- } from "./chunk-WI4QX7GH.js";
26
+ } from "./chunk-A66YRSOS.js";
27
27
  import {
28
28
  SharedContextManager
29
29
  } from "./chunk-UFS7OXGL.js";
@@ -176,7 +176,7 @@ import {
176
176
  buildEntityRecallSection,
177
177
  entityRecentTranscriptLookbackHours,
178
178
  readRecentEntityTranscriptEntries
179
- } from "./chunk-DXGS5YOQ.js";
179
+ } from "./chunk-EH27LHML.js";
180
180
  import {
181
181
  formatDaySummaryMemories
182
182
  } from "./chunk-EO5QWINU.js";
@@ -189,14 +189,14 @@ import {
189
189
  import {
190
190
  compareVerifiedEpisodeResults,
191
191
  searchVerifiedEpisodes
192
- } from "./chunk-V7GDTQ6I.js";
192
+ } from "./chunk-S35FX6MU.js";
193
193
  import {
194
194
  ThreadingManager
195
195
  } from "./chunk-QRDOSYOR.js";
196
196
  import {
197
197
  compareVerifiedSemanticRuleResults,
198
198
  searchVerifiedSemanticRules
199
- } from "./chunk-JVEMUX6L.js";
199
+ } from "./chunk-OZ2KQ7HF.js";
200
200
  import {
201
201
  searchWorkProductLedgerEntries
202
202
  } from "./chunk-ZRWB5D4H.js";
@@ -206,14 +206,14 @@ import {
206
206
  import {
207
207
  runNamespaceMaintenanceFanout,
208
208
  summarizeNamespaceMaintenanceHealth
209
- } from "./chunk-GM3BMWKR.js";
209
+ } from "./chunk-REWQAFSA.js";
210
210
  import {
211
211
  NamespaceCatalog,
212
212
  planNamespaceMaintenance
213
- } from "./chunk-6QUPUTT7.js";
213
+ } from "./chunk-HLIR3RJ7.js";
214
214
  import {
215
215
  NamespaceStorageRouter
216
- } from "./chunk-MPHDVHIB.js";
216
+ } from "./chunk-DIFU33GU.js";
217
217
  import {
218
218
  PolicyRuntimeManager
219
219
  } from "./chunk-33JBK2XP.js";
@@ -258,7 +258,7 @@ import {
258
258
  materializeAfterSemanticConsolidation,
259
259
  parseConsolidationResponse,
260
260
  parseOperatorAwareConsolidationResponse
261
- } from "./chunk-2Y6LMOQQ.js";
261
+ } from "./chunk-2VHMVWPU.js";
262
262
  import {
263
263
  buildRecallQueryPolicy
264
264
  } from "./chunk-LBJBNWS2.js";
@@ -295,12 +295,11 @@ import {
295
295
  describeErrorForOperator
296
296
  } from "./chunk-7WV3F5DQ.js";
297
297
  import {
298
+ capturePassiveCorrections,
298
299
  clusterByKey,
299
- combineNamespaces,
300
- resolveCodingNamespaceOverlay,
301
- resolveScopePlan,
302
- resolveScopeProfilePlan
303
- } from "./chunk-SHRRWOVY.js";
300
+ createCorrectionService,
301
+ detectPassiveCorrections
302
+ } from "./chunk-OJU73BUX.js";
304
303
  import {
305
304
  listTrustZoneRecords,
306
305
  searchTrustZoneRecords
@@ -310,7 +309,15 @@ import {
310
309
  } from "./chunk-FF4KLI5W.js";
311
310
  import {
312
311
  buildXraySnapshot
313
- } from "./chunk-AJOIM6UR.js";
312
+ } from "./chunk-L5ASZA2F.js";
313
+ import {
314
+ combineNamespaces,
315
+ getConfiguredNamespaces,
316
+ resolveCodingNamespaceOverlay,
317
+ resolveNamespaceFromStorageDir,
318
+ resolveScopePlan,
319
+ resolveScopeProfilePlan
320
+ } from "./chunk-J6BH2OBA.js";
314
321
  import {
315
322
  NamespaceSearchRouter
316
323
  } from "./chunk-CTOQEZSN.js";
@@ -357,7 +364,7 @@ import {
357
364
  } from "./chunk-TBBDFYXW.js";
358
365
  import {
359
366
  buildChainFollowupGenerator
360
- } from "./chunk-JEIROMLX.js";
367
+ } from "./chunk-2COL35PK.js";
361
368
  import {
362
369
  ContentHashIndex,
363
370
  StorageManager,
@@ -365,7 +372,7 @@ import {
365
372
  fingerprintEntityStructuredFacts,
366
373
  normalizeAttributePairs,
367
374
  parseEntityFile
368
- } from "./chunk-OC56UWV5.js";
375
+ } from "./chunk-YYOK4GVF.js";
369
376
  import {
370
377
  buildRetiredFactTombstoneInputs
371
378
  } from "./chunk-3JJWNZTT.js";
@@ -399,7 +406,7 @@ import {
399
406
  } from "./chunk-SVOZFLIQ.js";
400
407
  import {
401
408
  confidenceTier
402
- } from "./chunk-MSVSP5VO.js";
409
+ } from "./chunk-N3DUH6OO.js";
403
410
  import {
404
411
  inferMemoryStatus,
405
412
  isActiveMemoryStatus
@@ -442,6 +449,7 @@ import {
442
449
  } from "./chunk-I4WBNM3M.js";
443
450
  import {
444
451
  canReadNamespace,
452
+ canWriteNamespace,
445
453
  defaultNamespaceForPrincipal,
446
454
  recallNamespacesForPrincipal,
447
455
  resolvePrincipal
@@ -2491,6 +2499,10 @@ var Orchestrator = class _Orchestrator {
2491
2499
  // Access tracking buffer (Phase 1A)
2492
2500
  // Maps memoryId -> {count, lastAccessed} for batched updates
2493
2501
  accessTrackingBuffer = /* @__PURE__ */ new Map();
2502
+ // Passive correction capture (issue #1581) — dedup state + lazy service.
2503
+ passiveCorrectionDedup = /* @__PURE__ */ new Set();
2504
+ _passiveCorrectionService = null;
2505
+ passiveCorrectionTelemetry = { detected: 0, queued: 0, autoApplied: 0, suppressedReasonCounts: {} };
2494
2506
  // Background serial queue for extractions (agent_end optimization)
2495
2507
  // Queue stores promises that resolve when extraction should run
2496
2508
  extractionQueue = [];
@@ -2779,16 +2791,8 @@ var Orchestrator = class _Orchestrator {
2779
2791
  const ns = typeof namespace === "string" && namespace.trim().length > 0 ? namespace.trim() : this.config.defaultNamespace;
2780
2792
  return this.storageRouter.storageFor(ns);
2781
2793
  }
2782
- configuredNamespaces() {
2783
- return Array.from(
2784
- new Set(
2785
- [
2786
- this.config.defaultNamespace,
2787
- this.config.sharedNamespace,
2788
- ...this.config.namespacePolicies.map((policy) => policy.name)
2789
- ].map((value) => value.trim()).filter(Boolean)
2790
- )
2791
- );
2794
+ configuredNamespaceList() {
2795
+ return getConfiguredNamespaces(this.config);
2792
2796
  }
2793
2797
  rememberNamespaceStorageDirHint(namespace, storageDir) {
2794
2798
  if (!this.config.namespacesEnabled || !storageDir) return;
@@ -2880,7 +2884,7 @@ var Orchestrator = class _Orchestrator {
2880
2884
  }
2881
2885
  }
2882
2886
  const configured = new Set(
2883
- this.configuredNamespaces().map((namespace) => normalizeNamespaceIdentity(namespace))
2887
+ this.configuredNamespaceList().map((namespace) => normalizeNamespaceIdentity(namespace))
2884
2888
  );
2885
2889
  const preferredByStorageDir = /* @__PURE__ */ new Map();
2886
2890
  for (const record of compactedByNamespace.values()) {
@@ -2959,7 +2963,7 @@ var Orchestrator = class _Orchestrator {
2959
2963
  }
2960
2964
  const namespaces = this.config.namespacesEnabled ? Array.from(
2961
2965
  new Set(
2962
- (options.namespaces?.length ? options.namespaces : this.configuredNamespaces()).map((value) => value.trim()).filter(Boolean)
2966
+ (options.namespaces?.length ? options.namespaces : this.configuredNamespaceList()).map((value) => value.trim()).filter(Boolean)
2963
2967
  )
2964
2968
  ) : [this.config.defaultNamespace];
2965
2969
  if (!this.config.namespacesEnabled) {
@@ -4089,7 +4093,7 @@ ${doc.content}` : doc.content,
4089
4093
  if (options?.dryRun !== true) {
4090
4094
  try {
4091
4095
  await this.processEntitySynthesisQueue(
4092
- this.namespaceFromStorageDir(targetStorage.dir),
4096
+ this.storageDirNamespace(targetStorage.dir),
4093
4097
  5
4094
4098
  );
4095
4099
  } catch (error) {
@@ -10617,6 +10621,120 @@ ${normalized}`).digest("hex");
10617
10621
  log.error(failed, err);
10618
10622
  }
10619
10623
  }
10624
+ /**
10625
+ * Passive correction capture (issue #1581) — detects corrections expressed
10626
+ * passively in conversation turns and routes them to the Correction Contract
10627
+ * (#1580). Called from `runExtraction` after persistence completes.
10628
+ *
10629
+ * Thin wiring: delegates ALL correction logic to the detector + capture
10630
+ * modules + the CorrectionService. This method only checks gates, calls the
10631
+ * detector, and routes results. Fail-open: capture errors never block the
10632
+ * extraction return path.
10633
+ */
10634
+ async maybeCapturePassiveCorrections(turns, opts) {
10635
+ const mode = this.config.correctionCaptureMode;
10636
+ if (mode === "off") return;
10637
+ if (!this.config.correctionEnabled) return;
10638
+ try {
10639
+ const corrections = detectPassiveCorrections(
10640
+ turns.map((t) => ({ role: t.role, content: t.content }))
10641
+ );
10642
+ if (corrections.length === 0) return;
10643
+ const effectiveMode = opts.isLiveSession ? mode : "queue";
10644
+ const captureConfig = {
10645
+ mode: effectiveMode,
10646
+ confidenceFloor: this.config.correctionCaptureConfidenceFloor,
10647
+ autoApplyMaxAffected: this.config.correctionCaptureAutoApplyMaxAffected
10648
+ };
10649
+ const service = this.passiveCorrectionService();
10650
+ const result = await capturePassiveCorrections(
10651
+ corrections,
10652
+ {
10653
+ correctionEnabled: this.config.correctionEnabled,
10654
+ isLiveSession: opts.isLiveSession,
10655
+ bufferKey: opts.bufferKey,
10656
+ sessionKey: opts.sessionKey,
10657
+ principal: opts.principal,
10658
+ namespace: opts.namespace
10659
+ },
10660
+ captureConfig,
10661
+ {
10662
+ planCorrection: (req) => service.plan(req),
10663
+ applyCorrection: (planId, applyOpts) => service.apply(planId, applyOpts),
10664
+ storageDir: async (ns) => (await this.getStorage(ns)).dir,
10665
+ // Resolve `[m:xxxx]` handles to concrete memory ids via the single
10666
+ // shared helper (#1582). Returns null on miss/ambiguity so the
10667
+ // capture loop drops the handle and the planner falls back to text
10668
+ // search (review: "memory handles not resolved").
10669
+ resolveHandle: (ref, sessionKey) => {
10670
+ try {
10671
+ return this.resolveMemoryIdOrHandle(ref, sessionKey);
10672
+ } catch {
10673
+ return null;
10674
+ }
10675
+ }
10676
+ },
10677
+ this.passiveCorrectionDedup
10678
+ );
10679
+ this.passiveCorrectionTelemetry.detected += result.telemetry.detected;
10680
+ this.passiveCorrectionTelemetry.queued += result.telemetry.queued;
10681
+ this.passiveCorrectionTelemetry.autoApplied += result.telemetry.autoApplied;
10682
+ for (const [reason, count] of Object.entries(result.telemetry.suppressedReasons)) {
10683
+ this.passiveCorrectionTelemetry.suppressedReasonCounts[reason] = (this.passiveCorrectionTelemetry.suppressedReasonCounts[reason] ?? 0) + count;
10684
+ }
10685
+ } catch (err) {
10686
+ log.debug(
10687
+ `passive-correction: capture failed (non-fatal): ${err instanceof Error ? err.message : String(err)}`
10688
+ );
10689
+ }
10690
+ }
10691
+ /** Lazily construct the CorrectionService for passive capture. Stateless
10692
+ * across requests (per #1580 design); cached for the orchestrator's life. */
10693
+ passiveCorrectionService() {
10694
+ if (this._passiveCorrectionService) return this._passiveCorrectionService;
10695
+ this._passiveCorrectionService = createCorrectionService({
10696
+ orchestrator: this,
10697
+ // Session-scoped write ACL (review: "passive capture bypasses write
10698
+ // ACL"). A correction detected in session S plans only against S readable
10699
+ // namespaces and applies only to writable ones (rule 42) — passive
10700
+ // capture never becomes a cross-tenant mutation vector. Mirrors the
10701
+ // access-service createCorrectionService wiring rather than bypassing it.
10702
+ resolveAuthorizedNamespace: async (req) => {
10703
+ const principal = req.principal || resolvePrincipal(req.sessionKey, this.config);
10704
+ const ns = req.namespace ?? defaultNamespaceForPrincipal(principal, this.config);
10705
+ if (!canWriteNamespace(principal, ns, this.config)) {
10706
+ throw new Error(
10707
+ `passive correction: namespace "${ns}" is not writable for principal ${principal ?? "(none)"}`
10708
+ );
10709
+ }
10710
+ return ns;
10711
+ },
10712
+ resolveReadableNamespaces: (req) => {
10713
+ const principal = req.principal || resolvePrincipal(req.sessionKey, this.config);
10714
+ return recallNamespacesForPrincipal(principal, this.config);
10715
+ },
10716
+ canWriteNamespace: async (req) => {
10717
+ const principal = req.principal || resolvePrincipal(req.sessionKey, this.config);
10718
+ return canWriteNamespace(principal, req.namespace, this.config);
10719
+ },
10720
+ llmComplete: async ({ system, user }) => {
10721
+ const llmResult = await this.localLlm.chatCompletion(
10722
+ [
10723
+ { role: "system", content: system },
10724
+ { role: "user", content: user }
10725
+ ],
10726
+ { operation: "correction-classify", priority: "background" }
10727
+ );
10728
+ if (!llmResult) {
10729
+ throw new Error(
10730
+ "passive correction classify+draft: local LLM unavailable (disabled or in cooldown)"
10731
+ );
10732
+ }
10733
+ return llmResult.content;
10734
+ }
10735
+ });
10736
+ return this._passiveCorrectionService;
10737
+ }
10620
10738
  async runExtraction(turns, options = {}) {
10621
10739
  log.debug(`running extraction on ${turns.length} turns`);
10622
10740
  const clearBufferAfterExtraction = options.clearBufferAfterExtraction ?? true;
@@ -10662,13 +10780,11 @@ ${normalized}`).digest("hex");
10662
10780
  );
10663
10781
  if (targetTurns.length === 0) {
10664
10782
  log.debug("skipping extraction: no non-context turns after normalization");
10783
+ if (normalizedTurns.length > 0) {
10784
+ await this.maybeCapturePassiveCorrections(normalizedTurns, { sessionKey, principal: resolvePrincipal(sessionKey, this.config), namespace: this.resolveSelfNamespace(sessionKey), bufferKey, isLiveSession: clearBufferAfterExtraction });
10785
+ }
10665
10786
  await clearBuffer();
10666
- return {
10667
- status: "skipped",
10668
- reason: "empty_normalized_turns",
10669
- persistedCount: 0,
10670
- durableOutputCount: 0
10671
- };
10787
+ return { status: "skipped", reason: "empty_normalized_turns", persistedCount: 0, durableOutputCount: 0 };
10672
10788
  }
10673
10789
  const sourceValidAt = latestSourceValidAtFromTurns(targetTurns);
10674
10790
  throwIfDeadlineExceeded("before_extract");
@@ -10685,6 +10801,21 @@ ${normalized}`).digest("hex");
10685
10801
  `skipping extraction: below threshold (totalChars=${totalChars}, userTurns=${userTurns.length})`
10686
10802
  );
10687
10803
  await clearBuffer();
10804
+ {
10805
+ const capturePrincipal = typeof options.principalOverride === "string" && options.principalOverride.length > 0 ? options.principalOverride : resolvePrincipal(sessionKey, this.config);
10806
+ const captureWO = typeof options.writeNamespaceOverride === "string" && options.writeNamespaceOverride.length > 0 ? options.writeNamespaceOverride : void 0;
10807
+ const captureCodingCtx = sessionKey ? this.getCodingContextForSession(sessionKey) : null;
10808
+ const captureCodingOv = resolveCodingNamespaceOverlay(captureCodingCtx, this.config.codingMode, this.config.defaultNamespace);
10809
+ const captureScopePlan = resolveScopeProfilePlan({ config: this.config, principal: capturePrincipal, codingContext: captureCodingCtx, codingOverlay: captureCodingOv });
10810
+ const captureNamespace = captureWO ?? captureScopePlan?.writeNamespace ?? this.resolveSelfNamespace(sessionKey);
10811
+ await this.maybeCapturePassiveCorrections(normalizedTurns, {
10812
+ sessionKey,
10813
+ principal: capturePrincipal,
10814
+ namespace: captureNamespace,
10815
+ bufferKey,
10816
+ isLiveSession: clearBufferAfterExtraction
10817
+ });
10818
+ }
10688
10819
  return {
10689
10820
  status: "skipped",
10690
10821
  reason: "below_threshold",
@@ -10828,13 +10959,9 @@ ${normalized}`).digest("hex");
10828
10959
  meta.lastExtractionAt = (/* @__PURE__ */ new Date()).toISOString();
10829
10960
  await storage.saveMeta(meta);
10830
10961
  }
10962
+ await this.maybeCapturePassiveCorrections(normalizedTurns, { sessionKey, principal, namespace: selfNamespace, bufferKey, isLiveSession: clearBufferAfterExtraction });
10831
10963
  await clearBuffer();
10832
- return {
10833
- status: "skipped",
10834
- reason: "empty_extraction_result",
10835
- persistedCount: 0,
10836
- durableOutputCount: 0
10837
- };
10964
+ return { status: "skipped", reason: "empty_extraction_result", persistedCount: 0, durableOutputCount: 0 };
10838
10965
  }
10839
10966
  let threadIdForExtraction = null;
10840
10967
  if (this.config.threadingEnabled && turns.length > 0) {
@@ -10911,6 +11038,13 @@ ${normalized}`).digest("hex");
10911
11038
  );
10912
11039
  }
10913
11040
  await clearBuffer({ ignoreAbort: true });
11041
+ await this.maybeCapturePassiveCorrections(normalizedTurns, {
11042
+ sessionKey,
11043
+ principal,
11044
+ namespace: selfNamespace,
11045
+ bufferKey,
11046
+ isLiveSession: clearBufferAfterExtraction
11047
+ });
10914
11048
  if (this.config.memoryBoxesEnabled && persistedIds.length > 0) {
10915
11049
  const extractionTopics = deriveTopicsFromExtraction(result);
10916
11050
  const firstUserTurn = turns.find((t) => t.role === "user");
@@ -11274,7 +11408,7 @@ ${normalized}`).digest("hex");
11274
11408
  const shouldPromoteToShared = (targetStorage, category, confidence) => {
11275
11409
  if (!this.config.namespacesEnabled || !profileAllowsSharedWrites || !sharedAutoPromotionAllows(category, confidence))
11276
11410
  return false;
11277
- if (this.namespaceFromStorageDir(targetStorage.dir) === this.config.sharedNamespace)
11411
+ if (this.storageDirNamespace(targetStorage.dir) === this.config.sharedNamespace)
11278
11412
  return false;
11279
11413
  return true;
11280
11414
  };
@@ -11714,7 +11848,7 @@ ${normalized}`).digest("hex");
11714
11848
  const biTemporal = this.config.temporalBiTemporal && sourceContext?.validAt ? resolveFactEventTime(fact.eventTime, sourceContext.validAt) : void 0;
11715
11849
  let writeCategory = fact.category;
11716
11850
  let targetStorage = storage;
11717
- let targetNamespaceName = baseNamespace && baseNamespace.length > 0 ? baseNamespace : this.namespaceFromStorageDir(targetStorage.dir);
11851
+ let targetNamespaceName = baseNamespace && baseNamespace.length > 0 ? baseNamespace : this.storageDirNamespace(targetStorage.dir);
11718
11852
  let routedRuleId;
11719
11853
  let routedNamespaceExplicit = false;
11720
11854
  if (routeRules.length > 0) {
@@ -11741,7 +11875,7 @@ ${normalized}`).digest("hex");
11741
11875
  }
11742
11876
  }
11743
11877
  if (this.config.extractionScopeClassificationEnabled && this.config.namespacesEnabled && fact.scope === "global" && !routedNamespaceExplicit) {
11744
- const currentNs = this.namespaceFromStorageDir(targetStorage.dir);
11878
+ const currentNs = this.storageDirNamespace(targetStorage.dir);
11745
11879
  if (currentNs !== this.config.sharedNamespace && profileAllowsSharedWrites) {
11746
11880
  try {
11747
11881
  targetStorage = await this.storageRouter.storageFor(
@@ -11889,7 +12023,7 @@ ${normalized}`).digest("hex");
11889
12023
  let links = [];
11890
12024
  let contradictionDetected = false;
11891
12025
  if (this.config.contradictionDetectionEnabled && this.qmd.isAvailable() && faithfulnessEnforceStatus !== "pending_review") {
11892
- const targetNamespace = this.namespaceFromStorageDir(targetStorage.dir);
12026
+ const targetNamespace = this.storageDirNamespace(targetStorage.dir);
11893
12027
  const contradiction = await this.checkForContradiction(
11894
12028
  fact.content,
11895
12029
  writeCategory,
@@ -12154,7 +12288,7 @@ ${normalized}`).digest("hex");
12154
12288
  memoryId: parentId,
12155
12289
  category: writeCategory,
12156
12290
  content: fact.content,
12157
- namespace: this.namespaceFromStorageDir(targetStorage.dir),
12291
+ namespace: this.storageDirNamespace(targetStorage.dir),
12158
12292
  confidence: fact.confidence,
12159
12293
  source: "extraction"
12160
12294
  })
@@ -12163,7 +12297,7 @@ ${normalized}`).digest("hex");
12163
12297
  }
12164
12298
  }
12165
12299
  if (this.config.memoryLinkingEnabled && this.qmd.isAvailable()) {
12166
- const targetNamespace = this.namespaceFromStorageDir(targetStorage.dir);
12300
+ const targetNamespace = this.storageDirNamespace(targetStorage.dir);
12167
12301
  const suggestedLinks = await this.suggestLinksForMemory(
12168
12302
  fact.content,
12169
12303
  writeCategory,
@@ -12232,7 +12366,7 @@ ${normalized}`).digest("hex");
12232
12366
  memoryId,
12233
12367
  category: writeCategory,
12234
12368
  content: fact.content,
12235
- namespace: this.namespaceFromStorageDir(targetStorage.dir),
12369
+ namespace: this.storageDirNamespace(targetStorage.dir),
12236
12370
  confidence: fact.confidence,
12237
12371
  source: "extraction"
12238
12372
  })
@@ -12330,7 +12464,7 @@ ${normalized}`).digest("hex");
12330
12464
  let durableNonFactWritten = false;
12331
12465
  let durableNonFactTouchRecorded = false;
12332
12466
  const touchBaseNonFactNamespace = () => {
12333
- const baseTouchNamespace = baseNamespace && baseNamespace.length > 0 ? baseNamespace : this.namespaceFromStorageDir(storage.dir);
12467
+ const baseTouchNamespace = baseNamespace && baseNamespace.length > 0 ? baseNamespace : this.storageDirNamespace(storage.dir);
12334
12468
  };
12335
12469
  const recordDurableNonFactWrite = () => {
12336
12470
  durableNonFactWritten = true;
@@ -13905,7 +14039,7 @@ ${lines.join("\n\n")}`;
13905
14039
  seenStorageDirs.add(storageKey);
13906
14040
  storages.push(storage);
13907
14041
  };
13908
- const fallbackNamespace = fallbackStorageDir !== null ? this.namespaceFromStorageDir(fallbackStorageDir) : this.config.defaultNamespace;
14042
+ const fallbackNamespace = fallbackStorageDir !== null ? this.storageDirNamespace(fallbackStorageDir) : this.config.defaultNamespace;
13909
14043
  if (recallNamespaces.length === 0 || !this.config.namespacesEnabled || recallNamespaces.includes(fallbackNamespace)) {
13910
14044
  addStorage(fallbackStorage);
13911
14045
  }
@@ -14052,7 +14186,7 @@ ${lines.join("\n\n")}`;
14052
14186
  seenDirs.add(candidateRoot);
14053
14187
  matches.push({ storage, dir: candidateRoot, namespace });
14054
14188
  };
14055
- const fallbackNamespace = fallbackStorageDir !== null ? this.namespaceFromStorageDir(fallbackStorageDir) : this.config.defaultNamespace;
14189
+ const fallbackNamespace = fallbackStorageDir !== null ? this.storageDirNamespace(fallbackStorageDir) : this.config.defaultNamespace;
14056
14190
  maybeAddStorage(fallbackStorage, fallbackNamespace);
14057
14191
  const candidateNamespaces = /* @__PURE__ */ new Set();
14058
14192
  candidateNamespaces.add(this.config.defaultNamespace);
@@ -15324,32 +15458,13 @@ ${lines.join("\n\n")}`;
15324
15458
  if (!m?.[1]) return this.config.defaultNamespace;
15325
15459
  return namespaceIdentityFromToken(m[1]) ?? m[1];
15326
15460
  }
15327
- namespaceFromStorageDir(storageDir) {
15328
- if (!this.config.namespacesEnabled) return this.config.defaultNamespace;
15329
- const resolvedStorageDir = path2.resolve(storageDir);
15330
- const resolvedMemoryDir = path2.resolve(this.config.memoryDir);
15331
- if (resolvedStorageDir === resolvedMemoryDir)
15332
- return this.config.defaultNamespace;
15333
- const m = resolvedStorageDir.match(/[\\/]namespaces[\\/]([^\\/]+)$/);
15334
- if (!m?.[1]) return this.config.defaultNamespace;
15335
- const dirName = m[1];
15336
- if (this.configuredNamespaces().includes(dirName)) {
15337
- return dirName;
15338
- }
15339
- this.loadNamespaceStorageDirHintsFromCatalog();
15340
- const hintedNamespaces = this.namespaceStorageDirHints.get(resolvedStorageDir);
15341
- if (hintedNamespaces?.has(dirName)) {
15342
- return dirName;
15343
- }
15344
- if (hintedNamespaces?.size === 1) {
15345
- const [hintedNamespace] = hintedNamespaces;
15346
- if (hintedNamespace) return hintedNamespace;
15347
- }
15348
- const decoded = namespaceIdentityFromToken(dirName);
15349
- if (decoded && namespaceIdentityToken(decoded) === dirName) {
15350
- return decoded;
15351
- }
15352
- return dirName;
15461
+ storageDirNamespace(storageDir) {
15462
+ return resolveNamespaceFromStorageDir(storageDir, {
15463
+ config: this.config,
15464
+ configuredNamespaces: this.configuredNamespaceList(),
15465
+ hints: this.namespaceStorageDirHints,
15466
+ loadHints: () => this.loadNamespaceStorageDirHintsFromCatalog()
15467
+ });
15353
15468
  }
15354
15469
  // #1522: catalog touch methods removed — touches now happen at the storage chokepoint.
15355
15470
  /**
@@ -15437,4 +15552,4 @@ export {
15437
15552
  resolvePersistedMemoryRelativePath,
15438
15553
  Orchestrator
15439
15554
  };
15440
- //# sourceMappingURL=chunk-SQ4LU27I.js.map
15555
+ //# sourceMappingURL=chunk-NFRBADNR.js.map