@remnic/core 9.69.11 → 9.69.13

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 (360) hide show
  1. package/dist/access-admin-ops-surface.d.ts +11 -11
  2. package/dist/access-admin-ops-surface.js +4 -4
  3. package/dist/access-authorization-probe.d.ts +11 -11
  4. package/dist/access-authorization-probe.js +5 -5
  5. package/dist/access-boundary.d.ts +11 -11
  6. package/dist/access-boundary.js +4 -4
  7. package/dist/access-cli.js +28 -28
  8. package/dist/access-coding-context-resolution.d.ts +1 -1
  9. package/dist/access-extraction-force-flush.d.ts +11 -11
  10. package/dist/access-extraction-force-flush.js +4 -4
  11. package/dist/access-health-types.d.ts +1 -1
  12. package/dist/access-http-lcm-compaction.d.ts +11 -11
  13. package/dist/access-http-lifecycle-flush.d.ts +11 -11
  14. package/dist/access-http-offline-stream.d.ts +11 -11
  15. package/dist/access-http-query.d.ts +2 -2
  16. package/dist/access-http-query.js +4 -4
  17. package/dist/access-http.d.ts +12 -12
  18. package/dist/access-http.js +15 -15
  19. package/dist/access-identity-continuity-surface.d.ts +9 -9
  20. package/dist/access-identity-continuity-surface.js +4 -4
  21. package/dist/access-lcm-surface.d.ts +11 -11
  22. package/dist/access-lcm-surface.js +4 -4
  23. package/dist/access-mcp.d.ts +11 -11
  24. package/dist/access-mcp.js +11 -11
  25. package/dist/access-memory-search-fanout.d.ts +2 -2
  26. package/dist/{access-namespace-preflight-Cy0yPsaE.d.ts → access-namespace-preflight-Rzuo1nGR.d.ts} +1 -1
  27. package/dist/access-namespace-preflight.d.ts +3 -3
  28. package/dist/access-namespace-preflight.js +4 -4
  29. package/dist/access-observe-write-surface.d.ts +11 -11
  30. package/dist/access-observe-write-surface.js +4 -4
  31. package/dist/access-offline-manifest.d.ts +9 -9
  32. package/dist/access-operations-batch.js +5 -5
  33. package/dist/access-operations.d.ts +17 -17
  34. package/dist/access-operations.js +10 -10
  35. package/dist/access-recall-concurrency.d.ts +11 -11
  36. package/dist/access-recall-concurrency.js +4 -4
  37. package/dist/access-recall-response.d.ts +11 -11
  38. package/dist/access-recall-response.js +4 -4
  39. package/dist/access-recall-surface.d.ts +11 -11
  40. package/dist/access-recall-surface.js +4 -4
  41. package/dist/access-schema.d.ts +91 -91
  42. package/dist/{access-service-Cqfk3dD1.d.ts → access-service-Bb2Fykzc.d.ts} +71 -71
  43. package/dist/access-service-helpers.d.ts +11 -11
  44. package/dist/access-service.d.ts +11 -11
  45. package/dist/access-service.js +4 -4
  46. package/dist/access-surface-catalog.d.ts +11 -11
  47. package/dist/access-surface-catalog.js +6 -6
  48. package/dist/access-wearables-meetings-surface.d.ts +3 -3
  49. package/dist/action-confidence.d.ts +1 -1
  50. package/dist/active-memory-bridge.d.ts +1 -1
  51. package/dist/active-recall.d.ts +1 -1
  52. package/dist/active-recall.js +4 -4
  53. package/dist/ambient-provenance.d.ts +1 -1
  54. package/dist/artifact-search.d.ts +1 -1
  55. package/dist/behavior-learner.d.ts +1 -1
  56. package/dist/behavior-signals.d.ts +1 -1
  57. package/dist/bootstrap.d.ts +9 -9
  58. package/dist/briefing-window.d.ts +2 -2
  59. package/dist/briefing.d.ts +2 -2
  60. package/dist/buffer-surprise-report.d.ts +1 -1
  61. package/dist/buffer-turn-helpers.d.ts +1 -1
  62. package/dist/buffer.d.ts +2 -2
  63. package/dist/buffer.js +4 -4
  64. package/dist/bulk-import/index.d.ts +3 -3
  65. package/dist/calibration.d.ts +1 -1
  66. package/dist/capabilities.d.ts +1 -1
  67. package/dist/{catalog-9X8WpZNO.d.ts → catalog-DjTLVOYp.d.ts} +1 -1
  68. package/dist/causal-behavior.d.ts +1 -1
  69. package/dist/causal-consolidation.d.ts +1 -1
  70. package/dist/causal-trajectory-graph.d.ts +1 -1
  71. package/dist/{chunk-TEZ2HTC7.js → chunk-33JKYLPX.js} +2 -2
  72. package/dist/{chunk-MNH2GM4O.js → chunk-3BS2OGDT.js} +6 -19
  73. package/dist/{chunk-MNH2GM4O.js.map → chunk-3BS2OGDT.js.map} +1 -1
  74. package/dist/{chunk-5PTS43CH.js → chunk-4LG4CPOC.js} +2 -2
  75. package/dist/{chunk-Z33VUMKY.js → chunk-5H2G5X4R.js} +2 -2
  76. package/dist/{chunk-XFPHV65N.js → chunk-5JQV4T5Q.js} +2 -2
  77. package/dist/{chunk-OASGWNYL.js → chunk-63I7LMLG.js} +2 -2
  78. package/dist/{chunk-J3NGQ5SC.js → chunk-7GSSHAXC.js} +2 -2
  79. package/dist/{chunk-X4FIZAVQ.js → chunk-7JV4JST3.js} +854 -42
  80. package/dist/chunk-7JV4JST3.js.map +1 -0
  81. package/dist/{chunk-VHAKBUBD.js → chunk-B64IVEOH.js} +2 -2
  82. package/dist/{chunk-R7FXPG4T.js → chunk-C25N5HWX.js} +2 -2
  83. package/dist/{chunk-DH3V7RCQ.js → chunk-F2ERDKY2.js} +7 -7
  84. package/dist/{chunk-LJNLLNEM.js → chunk-HODFGQGT.js} +2 -2
  85. package/dist/{chunk-B75VCEX5.js → chunk-K2IJH4D3.js} +2 -2
  86. package/dist/{chunk-227WJVPY.js → chunk-KLSPKMIO.js} +2 -2
  87. package/dist/{chunk-5P2KNFJZ.js → chunk-MSDIETFC.js} +3 -3
  88. package/dist/{chunk-HFRGCNFY.js → chunk-OAKATRAN.js} +2 -2
  89. package/dist/chunk-OGUKSLYZ.js +560 -0
  90. package/dist/chunk-OGUKSLYZ.js.map +1 -0
  91. package/dist/{chunk-M6L7HI7R.js → chunk-P6FHFTZ7.js} +16 -1
  92. package/dist/chunk-P6FHFTZ7.js.map +1 -0
  93. package/dist/{chunk-LWBSEYW3.js → chunk-PAWIY5OQ.js} +5 -5
  94. package/dist/{chunk-3ITTF7YH.js → chunk-QVI63XSO.js} +90 -383
  95. package/dist/chunk-QVI63XSO.js.map +1 -0
  96. package/dist/{chunk-6TOWUN2R.js → chunk-RE3H6Y2X.js} +2 -2
  97. package/dist/{chunk-V3HUBF7T.js → chunk-S35IIP5P.js} +2 -2
  98. package/dist/{chunk-3YKOFCKP.js → chunk-SXHBZXHK.js} +2 -2
  99. package/dist/{chunk-7NCUHD5U.js → chunk-VAMZYOOV.js} +2 -2
  100. package/dist/{chunk-PGCZLHRB.js → chunk-W272SWN7.js} +3 -3
  101. package/dist/{chunk-5HO3QBAD.js → chunk-W6GEMUZM.js} +2 -2
  102. package/dist/{chunk-UCNQV43K.js → chunk-XQYTSZW3.js} +2 -2
  103. package/dist/{chunk-GR4C3FHT.js → chunk-ZKZCJRRO.js} +2 -2
  104. package/dist/{cli-Dk-lM_tI.d.ts → cli-DXXy60A4.d.ts} +5 -5
  105. package/dist/cli.d.ts +13 -13
  106. package/dist/cli.js +21 -21
  107. package/dist/coding/export-okf-codegraph.d.ts +1 -1
  108. package/dist/coding/pre-action-gate.d.ts +1 -1
  109. package/dist/compounding/engine.d.ts +2 -2
  110. package/dist/compounding/preference-consolidator.d.ts +1 -1
  111. package/dist/compression-optimizer.d.ts +1 -1
  112. package/dist/config.d.ts +1 -1
  113. package/dist/config.js +4 -4
  114. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  115. package/dist/connectors/codex-materialize.d.ts +1 -1
  116. package/dist/connectors/index.d.ts +1 -1
  117. package/dist/consolidation-provenance-check.d.ts +2 -2
  118. package/dist/consolidation-undo.d.ts +2 -2
  119. package/dist/contradiction/index.d.ts +3 -3
  120. package/dist/converge-config.d.ts +1 -1
  121. package/dist/convergence-refresh.d.ts +2 -2
  122. package/dist/conversation-index/backend.d.ts +1 -1
  123. package/dist/conversation-index/chunker.d.ts +1 -1
  124. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  125. package/dist/conversation-index/indexer.d.ts +1 -1
  126. package/dist/conversation-index/search.d.ts +1 -1
  127. package/dist/corpus-watermark.d.ts +1 -1
  128. package/dist/cross-lingual-recall.d.ts +1 -1
  129. package/dist/day-summary.d.ts +1 -1
  130. package/dist/deep-recall-http-glue.d.ts +11 -11
  131. package/dist/deep-recall-mcp-tools.d.ts +11 -11
  132. package/dist/deep-recall-policy-llm.d.ts +1 -1
  133. package/dist/deep-recall-seeds.d.ts +1 -1
  134. package/dist/delinearize.d.ts +1 -1
  135. package/dist/dependency-propagation-config.d.ts +1 -1
  136. package/dist/{dependency-propagation-delivery-BZGUecZf.d.ts → dependency-propagation-delivery-37JdQv_3.d.ts} +1 -1
  137. package/dist/direct-answer-wiring.d.ts +1 -1
  138. package/dist/direct-answer.d.ts +1 -1
  139. package/dist/embedding-fallback.d.ts +1 -1
  140. package/dist/enrichment/index.d.ts +1 -1
  141. package/dist/entity-origin-fields.d.ts +1 -1
  142. package/dist/entity-retrieval.d.ts +2 -2
  143. package/dist/entity-schema.d.ts +1 -1
  144. package/dist/episodic-context.d.ts +1 -1
  145. package/dist/eval-trajectory-contracts.d.ts +1 -1
  146. package/dist/eval-trajectory-store.d.ts +1 -1
  147. package/dist/eval-trajectory.d.ts +1 -1
  148. package/dist/explicit-capture.d.ts +9 -9
  149. package/dist/external-wiki-access.d.ts +11 -11
  150. package/dist/external-wiki-access.js +5 -5
  151. package/dist/external-wiki-collection-registration.d.ts +1 -1
  152. package/dist/external-wiki-collection.d.ts +1 -1
  153. package/dist/external-wiki-mcp-tools.d.ts +11 -11
  154. package/dist/extraction-error-classification.d.ts +1 -1
  155. package/dist/extraction-faithfulness.d.ts +1 -1
  156. package/dist/extraction-judge-telemetry.d.ts +1 -1
  157. package/dist/extraction-judge-training.d.ts +1 -1
  158. package/dist/extraction-judge.d.ts +1 -1
  159. package/dist/extraction-liveness.d.ts +1 -1
  160. package/dist/extraction-normalization.d.ts +1 -1
  161. package/dist/extraction-prompt.d.ts +1 -1
  162. package/dist/extraction-source-grounding-rules.d.ts +1 -1
  163. package/dist/extraction-source-grounding.d.ts +1 -1
  164. package/dist/extraction.d.ts +1 -1
  165. package/dist/extraction.js +5 -5
  166. package/dist/fallback-llm.d.ts +1 -1
  167. package/dist/graph-dashboard-diff.d.ts +1 -1
  168. package/dist/graph-dashboard-key.d.ts +1 -1
  169. package/dist/graph-dashboard-parser.d.ts +1 -1
  170. package/dist/graph-edge-reinforcement.d.ts +1 -1
  171. package/dist/graph-path-reconstruction.d.ts +1 -1
  172. package/dist/graph-path-scoring.d.ts +1 -1
  173. package/dist/graph-snapshot.d.ts +1 -1
  174. package/dist/graph.d.ts +1 -1
  175. package/dist/importance.d.ts +1 -1
  176. package/dist/importers/index.d.ts +1 -1
  177. package/dist/in-flight-reads.d.ts +1 -1
  178. package/dist/{index-B4iTvT-w.d.ts → index-DquhYqsc.d.ts} +2 -2
  179. package/dist/index.d.ts +876 -738
  180. package/dist/index.js +59 -37
  181. package/dist/intent.d.ts +1 -1
  182. package/dist/lcm/engine.d.ts +1 -1
  183. package/dist/lcm/index.d.ts +1 -1
  184. package/dist/lcm/tools.d.ts +1 -1
  185. package/dist/lifecycle.d.ts +1 -1
  186. package/dist/live-connectors-runner.d.ts +1 -1
  187. package/dist/local-llm.d.ts +1 -1
  188. package/dist/local-model-endpoint.d.ts +1 -1
  189. package/dist/location/index.d.ts +3 -3
  190. package/dist/location/index.js +5 -5
  191. package/dist/maintenance/memory-governance.d.ts +1 -1
  192. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
  193. package/dist/maintenance/rebuild-memory-projection.d.ts +2 -2
  194. package/dist/{maintenance-BBpNqEeJ.d.ts → maintenance-CizZOycr.d.ts} +3 -3
  195. package/dist/mcp-memory-inspector-app.d.ts +11 -11
  196. package/dist/memory-action-policy.d.ts +1 -1
  197. package/dist/memory-cache.d.ts +1 -1
  198. package/dist/memory-controller.d.ts +1 -1
  199. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  200. package/dist/memory-projection-store.d.ts +1 -1
  201. package/dist/memory-provenance.d.ts +1 -1
  202. package/dist/memory-snapshot.d.ts +1 -1
  203. package/dist/memory-subject-cli.d.ts +11 -11
  204. package/dist/memory-subject.d.ts +11 -11
  205. package/dist/memory-worth-outcomes.d.ts +2 -2
  206. package/dist/models-json.d.ts +1 -1
  207. package/dist/namespaces/migrate.d.ts +3 -3
  208. package/dist/namespaces/principal.d.ts +1 -1
  209. package/dist/namespaces/search.d.ts +1 -1
  210. package/dist/namespaces/storage.d.ts +3 -3
  211. package/dist/native-knowledge.d.ts +1 -1
  212. package/dist/offline-sync-impression-drain.d.ts +1 -1
  213. package/dist/operator-doctor-corpus.d.ts +1 -1
  214. package/dist/operator-doctor-replica.d.ts +1 -1
  215. package/dist/operator-toolkit.d.ts +3 -3
  216. package/dist/operator-toolkit.js +5 -5
  217. package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
  218. package/dist/orchestration/maintenance.d.ts +4 -4
  219. package/dist/orchestration/maintenance.js +6 -6
  220. package/dist/{orchestrator-DglY1H0w.d.ts → orchestrator-DqLcuNMP.d.ts} +8 -8
  221. package/dist/orchestrator.d.ts +9 -9
  222. package/dist/orchestrator.js +28 -28
  223. package/dist/patterns-cli.d.ts +1 -1
  224. package/dist/{pipeline-C7qRsy6g.d.ts → pipeline-DbJpmcRu.d.ts} +1 -1
  225. package/dist/policy-runtime.d.ts +1 -1
  226. package/dist/proactive-contention.d.ts +1 -1
  227. package/dist/provenance.d.ts +1 -1
  228. package/dist/{public-http-CPpCsi35.d.ts → public-http-NQ3UUp6W.d.ts} +1 -1
  229. package/dist/{qmd-YRLTa3AE.d.ts → qmd-DA_7fbSz.d.ts} +1 -1
  230. package/dist/qmd-preflight.d.ts +2 -2
  231. package/dist/qmd-recall-cache.d.ts +1 -1
  232. package/dist/qmd.d.ts +2 -2
  233. package/dist/recall-concurrency-config.d.ts +1 -1
  234. package/dist/recall-disclosure-escalation.d.ts +1 -1
  235. package/dist/recall-explain-renderer.d.ts +1 -1
  236. package/dist/recall-memory-map.d.ts +1 -1
  237. package/dist/recall-navigate-access.d.ts +1 -1
  238. package/dist/recall-navigate-disclosure.d.ts +1 -1
  239. package/dist/recall-navigate.d.ts +1 -1
  240. package/dist/recall-planner-llm.d.ts +1 -1
  241. package/dist/recall-state.d.ts +1 -1
  242. package/dist/recall-tag-filter.d.ts +1 -1
  243. package/dist/recall-timings.d.ts +1 -1
  244. package/dist/recall-xray-cli.d.ts +1 -1
  245. package/dist/recall-xray-renderer.d.ts +1 -1
  246. package/dist/recall-xray.d.ts +1 -1
  247. package/dist/reconcile/cursor.d.ts +1 -1
  248. package/dist/reconcile/manifest.d.ts +1 -1
  249. package/dist/reconcile/plan.d.ts +1 -1
  250. package/dist/replay/normalizers/chatgpt.d.ts +1 -1
  251. package/dist/replay/normalizers/claude.d.ts +1 -1
  252. package/dist/replay/normalizers/openclaw.d.ts +1 -1
  253. package/dist/replay/normalizers/shared.d.ts +1 -1
  254. package/dist/replay/runner.d.ts +1 -1
  255. package/dist/replay/types.d.ts +1 -1
  256. package/dist/replica-divergence.d.ts +1 -1
  257. package/dist/replica-peers-config.d.ts +1 -1
  258. package/dist/resolve-auth-token.d.ts +1 -1
  259. package/dist/resume-bundles.js +5 -5
  260. package/dist/retrieval-agents.d.ts +2 -2
  261. package/dist/retrieval-tiers.d.ts +1 -1
  262. package/dist/routing/engine.d.ts +1 -1
  263. package/dist/routing/store.d.ts +1 -1
  264. package/dist/salvage-envelope.d.ts +1 -1
  265. package/dist/schemas.d.ts +176 -176
  266. package/dist/{scope-profiles-BVvqVzJX.d.ts → scope-profiles-BpiWKZzx.d.ts} +1 -1
  267. package/dist/search/embed-helper.d.ts +1 -1
  268. package/dist/search/factory.d.ts +1 -1
  269. package/dist/search/index.d.ts +1 -1
  270. package/dist/search/lancedb-backend.d.ts +1 -1
  271. package/dist/search/meilisearch-backend.d.ts +1 -1
  272. package/dist/search/noop-backend.d.ts +1 -1
  273. package/dist/search/orama-backend.d.ts +1 -1
  274. package/dist/search/port.d.ts +1 -1
  275. package/dist/search/remote-backend.d.ts +1 -1
  276. package/dist/{semantic-consolidation-BzCI6Kuu.d.ts → semantic-consolidation-NJpaZpkY.d.ts} +1 -1
  277. package/dist/semantic-consolidation.d.ts +2 -2
  278. package/dist/semantic-rule-verifier.d.ts +1 -1
  279. package/dist/{service-DQ3Gscy5.d.ts → service-DdlZjX1D.d.ts} +2 -2
  280. package/dist/session-observer-bands.d.ts +1 -1
  281. package/dist/session-observer-state.d.ts +1 -1
  282. package/dist/shared-context/manager.d.ts +7 -7
  283. package/dist/signal.d.ts +1 -1
  284. package/dist/source-agent-qualifier.d.ts +1 -1
  285. package/dist/source-agent-qualifier.js +4 -4
  286. package/dist/standup/build.js +2 -2
  287. package/dist/{storage-DmTbQdD0.d.ts → storage-C7BWrpU9.d.ts} +1 -1
  288. package/dist/storage.d.ts +2 -2
  289. package/dist/subject-config.d.ts +1 -1
  290. package/dist/summarizer.d.ts +1 -1
  291. package/dist/summary-snapshot.d.ts +1 -1
  292. package/dist/support-passport/index.d.ts +14 -14
  293. package/dist/support-passport/index.js +7 -7
  294. package/dist/temporal-supersession.d.ts +2 -2
  295. package/dist/temporal-timeline-recall.d.ts +1 -1
  296. package/dist/temporal-validity.d.ts +1 -1
  297. package/dist/threading.d.ts +1 -1
  298. package/dist/tier-migration.d.ts +2 -2
  299. package/dist/tier-routing.d.ts +1 -1
  300. package/dist/topics.d.ts +1 -1
  301. package/dist/transcript.d.ts +1 -1
  302. package/dist/transfer/export-okf.d.ts +1 -1
  303. package/dist/transfer/types.d.ts +78 -78
  304. package/dist/trust-score-stage.d.ts +1 -1
  305. package/dist/trust-score.d.ts +1 -1
  306. package/dist/{types-CLRTESSD.d.ts → types-Cy1l6fzp.d.ts} +48 -1
  307. package/dist/types.d.ts +1 -1
  308. package/dist/utility-runtime.d.ts +1 -1
  309. package/dist/who-knows-cli.d.ts +11 -11
  310. package/dist/who-knows.d.ts +11 -11
  311. package/dist/write-envelope.d.ts +1 -1
  312. package/package.json +2 -2
  313. package/src/activity/config.test.ts +94 -1
  314. package/src/activity/config.ts +256 -3
  315. package/src/activity/digest.ts +21 -0
  316. package/src/activity/index.ts +2 -0
  317. package/src/activity/runner.ts +2 -17
  318. package/src/activity/timeline/publish-cli.test.ts +169 -0
  319. package/src/activity/timeline/publish-cli.ts +144 -0
  320. package/src/activity/timeline/query.ts +51 -15
  321. package/src/activity/types.ts +45 -0
  322. package/src/activity/vault-insert.ts +14 -33
  323. package/src/activity/vault-path.ts +100 -22
  324. package/src/activity/vault-publish.test.ts +51 -0
  325. package/src/activity/vault-publish.ts +157 -17
  326. package/src/activity/vault-publisher.test.ts +881 -0
  327. package/src/activity/vault-publisher.ts +597 -0
  328. package/src/activity/vault-region.test.ts +5 -0
  329. package/src/activity/vault-region.ts +7 -2
  330. package/src/cli/timeline-publish-commands.ts +34 -0
  331. package/src/cli.ts +2 -2
  332. package/src/config.test.ts +24 -1
  333. package/dist/chunk-3ITTF7YH.js.map +0 -1
  334. package/dist/chunk-KJUWWN3T.js +0 -237
  335. package/dist/chunk-KJUWWN3T.js.map +0 -1
  336. package/dist/chunk-M6L7HI7R.js.map +0 -1
  337. package/dist/chunk-X4FIZAVQ.js.map +0 -1
  338. /package/dist/{chunk-TEZ2HTC7.js.map → chunk-33JKYLPX.js.map} +0 -0
  339. /package/dist/{chunk-5PTS43CH.js.map → chunk-4LG4CPOC.js.map} +0 -0
  340. /package/dist/{chunk-Z33VUMKY.js.map → chunk-5H2G5X4R.js.map} +0 -0
  341. /package/dist/{chunk-XFPHV65N.js.map → chunk-5JQV4T5Q.js.map} +0 -0
  342. /package/dist/{chunk-OASGWNYL.js.map → chunk-63I7LMLG.js.map} +0 -0
  343. /package/dist/{chunk-J3NGQ5SC.js.map → chunk-7GSSHAXC.js.map} +0 -0
  344. /package/dist/{chunk-VHAKBUBD.js.map → chunk-B64IVEOH.js.map} +0 -0
  345. /package/dist/{chunk-R7FXPG4T.js.map → chunk-C25N5HWX.js.map} +0 -0
  346. /package/dist/{chunk-DH3V7RCQ.js.map → chunk-F2ERDKY2.js.map} +0 -0
  347. /package/dist/{chunk-LJNLLNEM.js.map → chunk-HODFGQGT.js.map} +0 -0
  348. /package/dist/{chunk-B75VCEX5.js.map → chunk-K2IJH4D3.js.map} +0 -0
  349. /package/dist/{chunk-227WJVPY.js.map → chunk-KLSPKMIO.js.map} +0 -0
  350. /package/dist/{chunk-5P2KNFJZ.js.map → chunk-MSDIETFC.js.map} +0 -0
  351. /package/dist/{chunk-HFRGCNFY.js.map → chunk-OAKATRAN.js.map} +0 -0
  352. /package/dist/{chunk-LWBSEYW3.js.map → chunk-PAWIY5OQ.js.map} +0 -0
  353. /package/dist/{chunk-6TOWUN2R.js.map → chunk-RE3H6Y2X.js.map} +0 -0
  354. /package/dist/{chunk-V3HUBF7T.js.map → chunk-S35IIP5P.js.map} +0 -0
  355. /package/dist/{chunk-3YKOFCKP.js.map → chunk-SXHBZXHK.js.map} +0 -0
  356. /package/dist/{chunk-7NCUHD5U.js.map → chunk-VAMZYOOV.js.map} +0 -0
  357. /package/dist/{chunk-PGCZLHRB.js.map → chunk-W272SWN7.js.map} +0 -0
  358. /package/dist/{chunk-5HO3QBAD.js.map → chunk-W6GEMUZM.js.map} +0 -0
  359. /package/dist/{chunk-UCNQV43K.js.map → chunk-XQYTSZW3.js.map} +0 -0
  360. /package/dist/{chunk-GR4C3FHT.js.map → chunk-ZKZCJRRO.js.map} +0 -0
@@ -2,34 +2,56 @@
2
2
  * Vault note path templates (issue #1985).
3
3
  *
4
4
  * Expands date tokens on a YYYY-MM-DD day. Returns a vault-relative path.
5
- * Rejects `..` segments and absolute templates.
5
+ * Rejects `..` segments, absolute templates, and unknown `{...}` tokens —
6
+ * naming the token and the full valid set (never a silent pass-through).
6
7
  */
7
8
  import path from "node:path";
8
9
 
9
10
  import { assertValidTimezone, isValidActivityDate } from "./digest.js";
10
11
 
11
- const TOKEN_RE = /\{yyyy\}|\{yy\}|\{MM\}|\{dd\}|\{M\}|\{d\}|\{ww\}/g;
12
+ /** Every token a vault template accepts (English names in v1). */
13
+ export const VAULT_TEMPLATE_TOKENS = [
14
+ "{yyyy}",
15
+ "{yy}",
16
+ "{M}",
17
+ "{MM}",
18
+ "{d}",
19
+ "{dd}",
20
+ "{ww}",
21
+ "{MMM}",
22
+ "{MMMM}",
23
+ "{ddd}",
24
+ "{dddd}",
25
+ ] as const;
12
26
 
13
- export function resolveVaultNotePath(
14
- template: string,
15
- date: string,
16
- options?: { timezone?: string },
17
- ): string {
18
- if (!isValidActivityDate(date)) {
19
- throw new RangeError(`Invalid vault date "${date}"; expected YYYY-MM-DD.`);
20
- }
21
- if (options?.timezone !== undefined) {
22
- assertValidTimezone(options.timezone);
23
- }
24
- if (typeof template !== "string" || template.length === 0) {
25
- throw new RangeError("Vault note path template must be a non-empty relative path.");
26
- }
27
- if (path.posix.isAbsolute(template) || path.win32.isAbsolute(template)) {
28
- throw new RangeError("Vault note path template must be relative; absolute templates are rejected.");
29
- }
27
+ export type VaultTemplateToken = (typeof VAULT_TEMPLATE_TOKENS)[number];
28
+
29
+ const TOKEN_LOOKUP: Record<string, true> = Object.fromEntries(VAULT_TEMPLATE_TOKENS.map((t) => [t, true]));
30
+
31
+ const ANY_BRACED_RE = /\{[^{}]*\}/g;
32
+
33
+ const MONTH_NAMES = [
34
+ "January",
35
+ "February",
36
+ "March",
37
+ "April",
38
+ "May",
39
+ "June",
40
+ "July",
41
+ "August",
42
+ "September",
43
+ "October",
44
+ "November",
45
+ "December",
46
+ ] as const;
47
+
48
+ const WEEKDAY_NAMES = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] as const;
30
49
 
50
+ function templateValues(date: string): Record<string, string> {
31
51
  const [yyyy, mm, dd] = date.split("-");
32
- const tokens: Record<string, string> = {
52
+ const monthIndex = Number(mm) - 1;
53
+ const weekday = new Date(Date.UTC(Number(yyyy), monthIndex, Number(dd))).getUTCDay();
54
+ return {
33
55
  "{yyyy}": yyyy,
34
56
  "{yy}": yyyy.slice(2),
35
57
  "{MM}": mm,
@@ -37,11 +59,67 @@ export function resolveVaultNotePath(
37
59
  "{M}": String(Number(mm)),
38
60
  "{d}": String(Number(dd)),
39
61
  "{ww}": isoWeekNumber(date),
62
+ "{MMM}": MONTH_NAMES[monthIndex]!.slice(0, 3),
63
+ "{MMMM}": MONTH_NAMES[monthIndex]!,
64
+ "{ddd}": WEEKDAY_NAMES[weekday]!.slice(0, 3),
65
+ "{dddd}": WEEKDAY_NAMES[weekday]!,
40
66
  };
41
- const expanded = template.replace(TOKEN_RE, (token) => tokens[token] ?? token);
42
- if (expanded.split(/[\\/]/).some((segment) => segment === "..")) {
67
+ }
68
+
69
+ /**
70
+ * Expand vault date tokens in any template text (a note path or a note
71
+ * template body). Unknown `{...}` tokens are rejected naming the token and
72
+ * the full valid set; an unreplaced token in a path would silently publish
73
+ * to the wrong file.
74
+ */
75
+ export function expandVaultTemplateTokens(text: string, date: string): string {
76
+ if (!isValidActivityDate(date)) {
77
+ throw new RangeError(`Invalid vault date "${date}"; expected YYYY-MM-DD.`);
78
+ }
79
+ if (typeof text !== "string" || text.length === 0) {
80
+ throw new RangeError("Vault template must be a non-empty string.");
81
+ }
82
+ const values = templateValues(date);
83
+ return text.replace(ANY_BRACED_RE, (token) => {
84
+ if (TOKEN_LOOKUP[token] === true) return values[token]!;
85
+ throw new RangeError(
86
+ `Unknown vault template token ${token}; valid tokens are ${VAULT_TEMPLATE_TOKENS.join(" ")}.`,
87
+ );
88
+ });
89
+ }
90
+
91
+ /**
92
+ * Validate a vault note path template without resolving it to a date:
93
+ * token allow-list plus the relative/no-`..` shape checks shared with
94
+ * `resolveVaultNotePath`.
95
+ */
96
+ export function validateVaultNoteTemplate(template: string): void {
97
+ if (typeof template !== "string" || template.length === 0) {
98
+ throw new RangeError("Vault note path template must be a non-empty relative path.");
99
+ }
100
+ if (path.posix.isAbsolute(template) || path.win32.isAbsolute(template)) {
101
+ throw new RangeError("Vault note path template must be relative; absolute templates are rejected.");
102
+ }
103
+ if (template.split(/[\\/]/).some((segment) => segment === "..")) {
43
104
  throw new RangeError("Vault note path template must not contain `..` segments.");
44
105
  }
106
+ expandVaultTemplateTokens(template, "2026-01-04");
107
+ }
108
+
109
+ export function resolveVaultNotePath(
110
+ template: string,
111
+ date: string,
112
+ options?: { timezone?: string },
113
+ ): string {
114
+ if (!isValidActivityDate(date)) {
115
+ throw new RangeError(`Invalid vault date "${date}"; expected YYYY-MM-DD.`);
116
+ }
117
+ if (options?.timezone !== undefined) {
118
+ assertValidTimezone(options.timezone);
119
+ }
120
+ validateVaultNoteTemplate(template);
121
+
122
+ const expanded = expandVaultTemplateTokens(template, date);
45
123
  if (path.posix.isAbsolute(expanded) || path.win32.isAbsolute(expanded)) {
46
124
  throw new RangeError("Vault note path template must be relative; absolute templates are rejected.");
47
125
  }
@@ -266,3 +266,54 @@ test("applyManagedRegion heading refuses duplicate headings and lists line numbe
266
266
  });
267
267
  assert.deepEqual(result, { ok: false, reason: "duplicate_heading", lines: [3, 6], text: fileText });
268
268
  });
269
+
270
+ test("applyManagedRegion heading demotes owned headings below the owning heading, clamped at six", () => {
271
+ const first = applyManagedRegion("## Timeline\nold\n\n## Notes\nkeep\n", {
272
+ strategy: "heading",
273
+ name: "Timeline",
274
+ content: "# Journal\n\n## Cards\n\n- a",
275
+ });
276
+ assert.equal(first.ok, true);
277
+ if (!first.ok) return;
278
+ assert.equal(first.text, "## Timeline\n### Journal\n\n#### Cards\n\n- a\n## Notes\nkeep\n");
279
+
280
+ const second = applyManagedRegion(first.text, {
281
+ strategy: "heading",
282
+ name: "Timeline",
283
+ content: "# Journal\n\n## Cards\n\n- a",
284
+ });
285
+ assert.equal(second.ok, true);
286
+ if (!second.ok) return;
287
+ assert.equal(second.text, first.text);
288
+
289
+ // A recap heading already at six stays six — still strictly deeper than
290
+ // a level-2 owning heading, so it cannot terminate the region either.
291
+ const clamped = applyManagedRegion("## Timeline\nold\n", {
292
+ strategy: "heading",
293
+ name: "Timeline",
294
+ content: "###### deep",
295
+ });
296
+ assert.equal(clamped.ok, true);
297
+ if (!clamped.ok) return;
298
+ assert.equal(clamped.text, "## Timeline\n###### deep\n");
299
+ });
300
+
301
+ test("applyManagedRegion heading under a level-6 owner flattens owned headings to bold text", () => {
302
+ const first = applyManagedRegion("###### Timeline\nold\n", {
303
+ strategy: "heading",
304
+ name: "Timeline",
305
+ content: "# Journal\nbody",
306
+ });
307
+ assert.equal(first.ok, true);
308
+ if (!first.ok) return;
309
+ assert.equal(first.text, "###### Timeline\n**Journal**\nbody\n");
310
+
311
+ const second = applyManagedRegion(first.text, {
312
+ strategy: "heading",
313
+ name: "Timeline",
314
+ content: "# Journal\nbody",
315
+ });
316
+ assert.equal(second.ok, true);
317
+ if (!second.ok) return;
318
+ assert.equal(second.text, first.text);
319
+ });
@@ -29,22 +29,40 @@ export function applyManagedRegion(
29
29
 
30
30
  const startMarker = `<!-- remnic:${opts.name}:start -->`;
31
31
  const endMarker = `<!-- remnic:${opts.name}:end -->`;
32
- const startIdx = fileText.indexOf(startMarker);
33
- if (startIdx === -1) return { ok: false, reason: "no_marker", text: fileText };
34
- const endIdx = fileText.indexOf(endMarker, startIdx + startMarker.length);
35
- if (endIdx === -1) return { ok: false, reason: "no_marker", text: fileText };
32
+ // Markers are owned only outside a code block — fenced or indented: a
33
+ // complete pair inside a ``` or four-space-indented example is sample
34
+ // text the user wrote, and replacing between it would overwrite their
35
+ // bytes (issue #1985).
36
+ const rows = fileLines(fileText);
37
+ let startRow: FileLine | undefined;
38
+ let endRow: FileLine | undefined;
39
+ for (const row of rows) {
40
+ if (row.fenced) continue;
41
+ const trimmed = row.line.trim();
42
+ if (startRow === undefined) {
43
+ if (trimmed === startMarker) startRow = row;
44
+ } else if (endRow === undefined && trimmed === endMarker) {
45
+ endRow = row;
46
+ break;
47
+ }
48
+ }
49
+ if (startRow === undefined || endRow === undefined) {
50
+ return { ok: false, reason: "no_marker", text: fileText };
51
+ }
36
52
 
37
53
  const { body, eol } = ownedBody(fileText, opts.content);
38
54
  return {
39
55
  ok: true,
40
- text: `${fileText.slice(0, startIdx + startMarker.length)}${eol}${body}${eol}${fileText.slice(endIdx)}`,
56
+ text: `${fileText.slice(0, startRow.start + startRow.line.length)}${eol}${body}${eol}${fileText.slice(endRow.start)}`,
41
57
  };
42
58
  }
43
59
 
44
60
  function applyHeadingRegion(fileText: string, name: string, content: string): ApplyManagedRegionResult {
45
61
  const wanted = name.trim();
62
+ const rows = fileLines(fileText);
46
63
  const hits: Array<{ line: number; level: number; next: number }> = [];
47
- for (const row of fileLines(fileText)) {
64
+ for (const row of rows) {
65
+ if (row.fenced) continue;
48
66
  const heading = parseAtxHeading(row.line);
49
67
  if (heading && heading.text === wanted) {
50
68
  hits.push({ line: row.number, level: heading.level, next: row.next });
@@ -57,8 +75,8 @@ function applyHeadingRegion(fileText: string, name: string, content: string): Ap
57
75
 
58
76
  const hit = hits[0]!;
59
77
  let sectionEnd = fileText.length;
60
- for (const row of fileLines(fileText)) {
61
- if (row.start < hit.next) continue;
78
+ for (const row of rows) {
79
+ if (row.start < hit.next || row.fenced) continue;
62
80
  const heading = parseAtxHeading(row.line);
63
81
  if (heading && heading.level <= hit.level) {
64
82
  sectionEnd = row.start;
@@ -66,7 +84,7 @@ function applyHeadingRegion(fileText: string, name: string, content: string): Ap
66
84
  }
67
85
  }
68
86
 
69
- const { body, eol } = ownedBody(fileText, content);
87
+ const { body, eol } = ownedBody(fileText, demoteOwnedHeadings(content, hit.level));
70
88
  const prefix =
71
89
  hit.next === fileText.length && !fileText.endsWith("\n") && !fileText.endsWith("\r")
72
90
  ? `${fileText}${eol}`
@@ -74,6 +92,32 @@ function applyHeadingRegion(fileText: string, name: string, content: string): Ap
74
92
  return { ok: true, text: `${prefix}${body}${eol}${fileText.slice(sectionEnd)}` };
75
93
  }
76
94
 
95
+ /**
96
+ * Re-level every ATX heading in the owned content so it sits strictly
97
+ * below the owning heading (issue #1985 review). A published recap that
98
+ * itself starts with `#`/`##` headings would otherwise terminate its own
99
+ * managed region on the NEXT publish — the new copy lands before the old
100
+ * heading and each republish leaves a stale duplicate behind. New level is
101
+ * owning + original, clamped at six. A level-6 owning heading has no
102
+ * deeper ATX level, so its owned headings flatten to bold text — still
103
+ * rendered, never a terminator. Headings inside fenced or indented code
104
+ * are content, not structure, and pass through untouched.
105
+ */
106
+ function demoteOwnedHeadings(content: string, owningLevel: number): string {
107
+ const rows = fileLines(content);
108
+ let out = "";
109
+ let cursor = 0;
110
+ for (const row of rows) {
111
+ const heading = row.fenced ? null : parseAtxHeading(row.line);
112
+ if (heading === null) continue;
113
+ const level = Math.min(owningLevel + heading.level, 6);
114
+ const replacement = level > owningLevel ? `${"#".repeat(level)} ${heading.text}` : `**${heading.text}**`;
115
+ out += content.slice(cursor, row.start) + replacement;
116
+ cursor = row.start + row.line.length;
117
+ }
118
+ return out + content.slice(cursor);
119
+ }
120
+
77
121
  function ownedBody(fileText: string, content: string): { body: string; eol: string } {
78
122
  const eol = fileText.includes("\r\n") ? "\r\n" : "\n";
79
123
  let body = content.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
@@ -82,10 +126,44 @@ function ownedBody(fileText: string, content: string): { body: string; eol: stri
82
126
  return { body, eol };
83
127
  }
84
128
 
85
- function fileLines(fileText: string): Array<{ line: string; start: number; next: number; number: number }> {
86
- const rows: Array<{ line: string; start: number; next: number; number: number }> = [];
129
+ export interface FileLine {
130
+ line: string;
131
+ start: number;
132
+ next: number;
133
+ number: number;
134
+ /** True inside a fenced or indented code block, delimiter lines included. */
135
+ fenced: boolean;
136
+ }
137
+
138
+ /**
139
+ * The one shared code-aware line scanner (issue #1985): marker discovery,
140
+ * marker replacement, mismatch scanning, and heading insertion all classify
141
+ * lines through it, so code examples are invisible to every scan.
142
+ *
143
+ * A line is code when a fence is open, or when its own indentation reaches
144
+ * four columns (CommonMark indented code block; one tab covers all four).
145
+ * Classification reads the RAW line — no consumer trims first — so the
146
+ * indentation cannot be erased before it is seen.
147
+ *
148
+ * Two deliberate simplifications, both resolving toward "code" (skip):
149
+ * - CommonMark lets an indented line lazily continue an open paragraph
150
+ * instead of opening a code block; we still call it code.
151
+ * - CommonMark measures indentation relative to the containing block, so
152
+ * a marker indented under a list item can be live content; we call it
153
+ * code. Distinguishing either case needs full block tracking.
154
+ * Skipping a line refuses a publish; mis-reading one as live overwrites the
155
+ * user's bytes. The refusal is recoverable, the overwrite is not.
156
+ *
157
+ * A fence delimiter run is only live at indent < 4: deeper, the run is
158
+ * literal text inside an indented code block (and inside an open fence a
159
+ * 4+-indented closing run is content, not a closer), so `fenceRun` never
160
+ * sees an indented line.
161
+ */
162
+ export function fileLines(fileText: string): FileLine[] {
163
+ const rows: FileLine[] = [];
87
164
  let start = 0;
88
165
  let number = 1;
166
+ let fence: { char: string; len: number } | null = null;
89
167
  while (start < fileText.length) {
90
168
  let i = start;
91
169
  while (i < fileText.length && fileText[i] !== "\n" && fileText[i] !== "\r") i++;
@@ -93,28 +171,90 @@ function fileLines(fileText: string): Array<{ line: string; start: number; next:
93
171
  if (fileText[i] === "\r" && fileText[i + 1] === "\n") next = i + 2;
94
172
  else if (fileText[i] === "\n" || fileText[i] === "\r") next = i + 1;
95
173
  else next = fileText.length;
96
- rows.push({ line: fileText.slice(start, i), start, next, number });
174
+ const line = fileText.slice(start, i);
175
+
176
+ const indentedCode = indentColumn(line) >= 4;
177
+ const run = indentedCode ? null : fenceRun(line);
178
+ let fenced: boolean;
179
+ if (fence === null) {
180
+ // A backtick fence's info string may not contain a backtick, so a
181
+ // ``` ` ``` run with one is not an opening delimiter.
182
+ if (run !== null && !(run.char === "`" && run.info.includes("`"))) {
183
+ fence = { char: run.char, len: run.len };
184
+ }
185
+ fenced = fence !== null || indentedCode;
186
+ } else {
187
+ fenced = true;
188
+ if (run !== null && run.char === fence.char && run.len >= fence.len && run.info.length === 0) {
189
+ fence = null;
190
+ }
191
+ }
192
+
193
+ rows.push({ line, start, next, number, fenced });
97
194
  number += 1;
98
195
  start = next;
99
196
  }
100
197
  return rows;
101
198
  }
102
199
 
103
- function parseAtxHeading(line: string): { level: number; text: string } | null {
200
+ /**
201
+ * The column a line's first non-whitespace character sits at: spaces count
202
+ * one, a tab advances to the next multiple of four (CommonMark tab handling).
203
+ */
204
+ function indentColumn(line: string): number {
205
+ let col = 0;
206
+ for (let i = 0; i < line.length; i += 1) {
207
+ const ch = line[i];
208
+ if (ch === " ") col += 1;
209
+ else if (ch === "\t") col += 4 - (col % 4);
210
+ else break;
211
+ }
212
+ return col;
213
+ }
214
+
215
+ /**
216
+ * A fence delimiter run: three or more backticks or tildes at the line's
217
+ * start (leading whitespace allowed), plus the trailing info string. An
218
+ * unterminated fence therefore keeps every following line fenced, which
219
+ * makes a malformed note refuse to publish instead of overwriting bytes.
220
+ */
221
+ function fenceRun(line: string): { char: string; len: number; info: string } | null {
222
+ const body = line.trimStart();
223
+ const char = body[0];
224
+ if (char !== "`" && char !== "~") return null;
225
+ let len = 0;
226
+ while (len < body.length && body[len] === char) len++;
227
+ if (len < 3) return null;
228
+ return { char, len, info: body.slice(len).trim() };
229
+ }
230
+
231
+ export function parseAtxHeading(line: string): { level: number; text: string } | null {
232
+ // CommonMark permits up to three columns of indentation before the
233
+ // hashes; the fourth column is an indented code block, which
234
+ // `fileLines` already classifies as fenced (a tab advances to the
235
+ // next multiple of four, matching `indentColumn`). Replacement and
236
+ // insertion both scan headings through this one parser.
237
+ let at = 0;
238
+ let indent = 0;
239
+ while (at < line.length && (line[at] === " " || line[at] === "\t")) {
240
+ indent += line[at] === " " ? 1 : 4 - (indent % 4);
241
+ if (indent >= 4) return null;
242
+ at += 1;
243
+ }
104
244
  let level = 0;
105
- while (level < line.length && level < 6 && line[level] === "#") level++;
245
+ while (level < 6 && line[at + level] === "#") level++;
106
246
  if (level === 0) return null;
107
- const after = line[level];
247
+ const after = line[at + level];
108
248
  if (after !== " " && after !== "\t") return null;
109
249
 
110
- let start = level + 1;
250
+ let start = at + level + 1;
111
251
  let end = line.length;
112
252
  while (start < end && (line[start] === " " || line[start] === "\t")) start++;
113
253
  while (end > start && (line[end - 1] === " " || line[end - 1] === "\t")) end--;
114
254
 
115
255
  let hashEnd = end;
116
256
  while (hashEnd > start && line[hashEnd - 1] === "#") hashEnd--;
117
- if (hashEnd < end && hashEnd > start && (line[hashEnd - 1] === " " || line[hashEnd - 1] === "\t")) {
257
+ if (hashEnd < end && hashEnd > start && (line[hashEnd - 1] === " " || line[end - 1] === "\t")) {
118
258
  end = hashEnd;
119
259
  while (end > start && (line[end - 1] === " " || line[end - 1] === "\t")) end--;
120
260
  }