@remnic/core 9.6.1 → 9.6.3

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 (332) hide show
  1. package/dist/access-admin-ops-surface.d.ts +7 -8
  2. package/dist/access-admin-ops-surface.js +8 -8
  3. package/dist/access-boundary.d.ts +9 -8
  4. package/dist/access-boundary.js +9 -9
  5. package/dist/access-cli.js +40 -40
  6. package/dist/access-http.d.ts +47 -16
  7. package/dist/access-http.js +13 -13
  8. package/dist/access-identity-continuity-surface.d.ts +6 -7
  9. package/dist/access-identity-continuity-surface.js +8 -8
  10. package/dist/access-lcm-surface.d.ts +7 -8
  11. package/dist/access-lcm-surface.js +8 -8
  12. package/dist/access-mcp.d.ts +13 -8
  13. package/dist/access-mcp.js +12 -12
  14. package/dist/access-observe-write-surface.d.ts +7 -8
  15. package/dist/access-observe-write-surface.js +8 -8
  16. package/dist/access-operations-batch.js +10 -10
  17. package/dist/access-operations.d.ts +8 -9
  18. package/dist/access-operations.js +11 -11
  19. package/dist/access-recall-surface.d.ts +7 -8
  20. package/dist/access-recall-surface.js +8 -8
  21. package/dist/access-schema.d.ts +6 -6
  22. package/dist/{access-service-CXJaql3A.d.ts → access-service-Bps_9G1t.d.ts} +9 -9
  23. package/dist/access-service.d.ts +7 -8
  24. package/dist/access-service.js +8 -8
  25. package/dist/access-surface-catalog.d.ts +7 -8
  26. package/dist/action-confidence.d.ts +1 -2
  27. package/dist/active-memory-bridge.d.ts +1 -2
  28. package/dist/active-recall.d.ts +1 -2
  29. package/dist/behavior-learner.d.ts +1 -2
  30. package/dist/behavior-signals.d.ts +1 -2
  31. package/dist/bootstrap.d.ts +6 -7
  32. package/dist/briefing.d.ts +2 -3
  33. package/dist/briefing.js +3 -3
  34. package/dist/buffer-surprise-report.d.ts +1 -2
  35. package/dist/buffer.d.ts +2 -3
  36. package/dist/buffer.js +1 -1
  37. package/dist/bulk-import/index.d.ts +3 -3
  38. package/dist/bulk-import/index.js +2 -2
  39. package/dist/calibration.d.ts +1 -2
  40. package/dist/capabilities.d.ts +1 -2
  41. package/dist/{catalog-C9cu67Ig.d.ts → catalog-9WanSGtt.d.ts} +1 -1
  42. package/dist/causal-behavior.d.ts +1 -2
  43. package/dist/causal-consolidation.d.ts +1 -2
  44. package/dist/causal-consolidation.js +4 -4
  45. package/dist/causal-trajectory-graph.d.ts +1 -2
  46. package/dist/{chunk-PNLFN2PZ.js → chunk-23G3T2Q5.js} +2 -2
  47. package/dist/{chunk-SIRPLF54.js → chunk-2K3OSLHE.js} +2 -2
  48. package/dist/{chunk-JS2HKKOK.js → chunk-3AC5UYKI.js} +1 -1
  49. package/dist/{chunk-JS2HKKOK.js.map → chunk-3AC5UYKI.js.map} +1 -1
  50. package/dist/{chunk-LQHDIS7L.js → chunk-54BGIBCR.js} +2 -2
  51. package/dist/{chunk-PVUJ6WVV.js → chunk-5MH5NF3U.js} +5 -5
  52. package/dist/{chunk-Y7UNNAZD.js → chunk-7ZYBDQ7V.js} +2 -2
  53. package/dist/{chunk-2PRQG7PV.js → chunk-AJVLDJU6.js} +1 -1
  54. package/dist/chunk-AJVLDJU6.js.map +1 -0
  55. package/dist/{chunk-LR5DZ56F.js → chunk-AXALUFAH.js} +2 -2
  56. package/dist/{chunk-AYZJID4S.js → chunk-B5GBWBCZ.js} +2 -2
  57. package/dist/{chunk-H2DXDQCQ.js → chunk-BT3PTVYZ.js} +48 -44
  58. package/dist/chunk-BT3PTVYZ.js.map +1 -0
  59. package/dist/{chunk-TLUDFPZL.js → chunk-CAZ3Z5M6.js} +2 -2
  60. package/dist/{chunk-P454KXD6.js → chunk-CJPVWAJF.js} +21 -21
  61. package/dist/{chunk-RGK27ELN.js → chunk-DEKIXXIG.js} +2 -2
  62. package/dist/{chunk-XCL57M6Q.js → chunk-DPZKMGEP.js} +21 -20
  63. package/dist/chunk-DPZKMGEP.js.map +1 -0
  64. package/dist/{chunk-2KK5WNQB.js → chunk-DQ42IQSK.js} +2 -2
  65. package/dist/{chunk-UFUKHGZD.js → chunk-EIGE4IMQ.js} +89 -33
  66. package/dist/chunk-EIGE4IMQ.js.map +1 -0
  67. package/dist/{chunk-HOJZMQ4J.js → chunk-FGDKJJZS.js} +2 -2
  68. package/dist/{chunk-ABP6QMVM.js → chunk-FQ7HAWWC.js} +2 -2
  69. package/dist/{chunk-CYWA2CXR.js → chunk-FVTLSFWU.js} +2 -2
  70. package/dist/{chunk-JJEJJ7RK.js → chunk-FXZTL7F7.js} +2 -2
  71. package/dist/{chunk-DANV2HTH.js → chunk-GQGDRLDM.js} +3 -3
  72. package/dist/{chunk-7F7Z6MOS.js → chunk-H4CKS5B2.js} +2 -2
  73. package/dist/{chunk-SVOHGUMI.js → chunk-H4FHR4UM.js} +174 -197
  74. package/dist/chunk-H4FHR4UM.js.map +1 -0
  75. package/dist/{chunk-CKITWVWJ.js → chunk-HSSERO3E.js} +2 -2
  76. package/dist/{chunk-23JFRB73.js → chunk-JODHPNLN.js} +2 -2
  77. package/dist/{chunk-DS7MM2ES.js → chunk-JZKR6ZAV.js} +2 -2
  78. package/dist/{chunk-BEM4D2QG.js → chunk-KJIJNLXT.js} +3 -3
  79. package/dist/{chunk-JSNVWNGX.js → chunk-KVSVVKHA.js} +2 -2
  80. package/dist/{chunk-MC4FJXPA.js → chunk-MMACM5G2.js} +2 -2
  81. package/dist/{chunk-PCLIWBGD.js → chunk-N2RP4K5Q.js} +8 -6
  82. package/dist/chunk-N2RP4K5Q.js.map +1 -0
  83. package/dist/{chunk-OUELRE5E.js → chunk-NOUJNHWG.js} +1 -1
  84. package/dist/chunk-NOUJNHWG.js.map +1 -0
  85. package/dist/{chunk-3XIY7MDQ.js → chunk-O6YI4CVI.js} +2 -2
  86. package/dist/{chunk-F53UF7CI.js → chunk-QLVLW7UD.js} +6 -2
  87. package/dist/{chunk-F53UF7CI.js.map → chunk-QLVLW7UD.js.map} +1 -1
  88. package/dist/{chunk-LADFWYHY.js → chunk-QMC3BI3K.js} +6 -6
  89. package/dist/chunk-QMC3BI3K.js.map +1 -0
  90. package/dist/{chunk-72WG5QKN.js → chunk-SDAXPXER.js} +2 -2
  91. package/dist/{chunk-FKCRGLRD.js → chunk-T43VKQU3.js} +269 -167
  92. package/dist/chunk-T43VKQU3.js.map +1 -0
  93. package/dist/{chunk-4LV23CHK.js → chunk-VHJARF5R.js} +2 -2
  94. package/dist/{chunk-6MMONPHM.js → chunk-W2AHSCKY.js} +2 -2
  95. package/dist/{chunk-4GNEDXDI.js → chunk-WULTHJRU.js} +2 -2
  96. package/dist/chunk-WULTHJRU.js.map +1 -0
  97. package/dist/{chunk-K5LLP4CY.js → chunk-ZGPDSEKG.js} +20 -9
  98. package/dist/chunk-ZGPDSEKG.js.map +1 -0
  99. package/dist/{cli-CqdPA6z9.d.ts → cli-SBWBw_eK.d.ts} +4 -5
  100. package/dist/cli.d.ts +9 -10
  101. package/dist/cli.js +32 -32
  102. package/dist/compounding/engine.d.ts +2 -3
  103. package/dist/compounding/engine.js +3 -3
  104. package/dist/compounding/preference-consolidator.d.ts +1 -2
  105. package/dist/compression-optimizer.d.ts +1 -2
  106. package/dist/config.d.ts +1 -2
  107. package/dist/connectors/codex-materialize-runner.d.ts +1 -2
  108. package/dist/connectors/codex-materialize-runner.js +3 -3
  109. package/dist/connectors/codex-materialize.d.ts +1 -2
  110. package/dist/connectors/index.d.ts +1 -2
  111. package/dist/connectors/index.js +3 -3
  112. package/dist/consolidation-provenance-check.d.ts +2 -3
  113. package/dist/consolidation-undo.d.ts +2 -3
  114. package/dist/contradiction/index.d.ts +3 -4
  115. package/dist/conversation-index/backend.d.ts +1 -2
  116. package/dist/conversation-index/chunker.d.ts +1 -2
  117. package/dist/conversation-index/faiss-adapter.d.ts +1 -2
  118. package/dist/conversation-index/indexer.d.ts +1 -2
  119. package/dist/conversation-index/search.d.ts +1 -2
  120. package/dist/day-summary.d.ts +1 -2
  121. package/dist/delinearize.d.ts +1 -2
  122. package/dist/direct-answer-wiring.d.ts +1 -2
  123. package/dist/direct-answer.d.ts +1 -2
  124. package/dist/embedding-fallback.d.ts +1 -2
  125. package/dist/enrichment/index.d.ts +1 -2
  126. package/dist/entity-retrieval.d.ts +2 -3
  127. package/dist/entity-retrieval.js +3 -3
  128. package/dist/entity-schema.d.ts +1 -2
  129. package/dist/explicit-capture.d.ts +8 -7
  130. package/dist/explicit-capture.js +1 -1
  131. package/dist/extraction-faithfulness.d.ts +1 -2
  132. package/dist/extraction-judge-telemetry.d.ts +1 -2
  133. package/dist/extraction-judge-training.d.ts +1 -2
  134. package/dist/extraction-judge.d.ts +1 -2
  135. package/dist/extraction.d.ts +1 -2
  136. package/dist/fallback-llm.d.ts +1 -2
  137. package/dist/graph-dashboard-diff.d.ts +1 -2
  138. package/dist/graph-dashboard-key.d.ts +1 -2
  139. package/dist/graph-dashboard-parser.d.ts +1 -2
  140. package/dist/graph-edge-reinforcement.d.ts +1 -2
  141. package/dist/graph-snapshot.d.ts +1 -2
  142. package/dist/graph.d.ts +1 -2
  143. package/dist/identity-continuity.d.ts +1 -2
  144. package/dist/importance.d.ts +1 -2
  145. package/dist/importers/index.d.ts +1 -1
  146. package/dist/importers/index.js +2 -2
  147. package/dist/index.d.ts +14 -15
  148. package/dist/index.js +40 -40
  149. package/dist/intent.d.ts +1 -2
  150. package/dist/lcm/engine.d.ts +1 -2
  151. package/dist/lcm/index.d.ts +1 -2
  152. package/dist/lcm/tools.d.ts +1 -2
  153. package/dist/lifecycle.d.ts +1 -2
  154. package/dist/live-connectors-runner.d.ts +1 -2
  155. package/dist/local-llm.d.ts +1 -2
  156. package/dist/local-model-endpoint.d.ts +1 -2
  157. package/dist/maintenance/memory-governance.d.ts +1 -2
  158. package/dist/maintenance/memory-governance.js +3 -3
  159. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +3 -3
  160. package/dist/maintenance/rebuild-memory-projection.js +4 -4
  161. package/dist/mcp-memory-inspector-app.d.ts +7 -8
  162. package/dist/memory-action-policy.d.ts +1 -2
  163. package/dist/memory-cache.d.ts +1 -2
  164. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -2
  165. package/dist/memory-projection-store.d.ts +1 -2
  166. package/dist/memory-provenance.d.ts +1 -2
  167. package/dist/memory-worth-outcomes.d.ts +2 -3
  168. package/dist/models-json.d.ts +1 -2
  169. package/dist/namespaces/migrate.d.ts +3 -4
  170. package/dist/namespaces/migrate.js +4 -4
  171. package/dist/namespaces/principal.d.ts +1 -2
  172. package/dist/namespaces/search.d.ts +1 -2
  173. package/dist/namespaces/storage.d.ts +3 -4
  174. package/dist/namespaces/storage.js +3 -3
  175. package/dist/native-knowledge.d.ts +1 -2
  176. package/dist/operator-toolkit.d.ts +2 -3
  177. package/dist/operator-toolkit.js +7 -7
  178. package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -3
  179. package/dist/orchestration/maintenance.d.ts +2 -3
  180. package/dist/orchestration/maintenance.js +5 -5
  181. package/dist/{orchestrator-CWFrT8AF.d.ts → orchestrator-B0YrUl2H.d.ts} +40 -38
  182. package/dist/orchestrator.d.ts +6 -7
  183. package/dist/orchestrator.js +40 -40
  184. package/dist/patterns-cli.d.ts +1 -2
  185. package/dist/{pipeline-DmqtvION.d.ts → pipeline-CiD86zIk.d.ts} +1 -1
  186. package/dist/policy-runtime.d.ts +1 -2
  187. package/dist/provenance.d.ts +1 -2
  188. package/dist/{qmd--fnPMK60.d.ts → qmd-Bef7DDuQ.d.ts} +1 -1
  189. package/dist/qmd-preflight.d.ts +2 -3
  190. package/dist/qmd-recall-cache.d.ts +1 -2
  191. package/dist/qmd.d.ts +2 -3
  192. package/dist/recall-disclosure-escalation.d.ts +1 -2
  193. package/dist/recall-explain-renderer.d.ts +1 -2
  194. package/dist/recall-explain-renderer.js +3 -3
  195. package/dist/recall-planner-llm.d.ts +1 -2
  196. package/dist/recall-state.d.ts +1 -2
  197. package/dist/recall-tag-filter.d.ts +1 -2
  198. package/dist/recall-timings.d.ts +1 -2
  199. package/dist/recall-xray-cli.d.ts +1 -2
  200. package/dist/recall-xray-cli.js +4 -4
  201. package/dist/recall-xray-renderer.d.ts +1 -2
  202. package/dist/recall-xray-renderer.js +3 -3
  203. package/dist/recall-xray.d.ts +1 -2
  204. package/dist/recall-xray.js +2 -2
  205. package/dist/replay/normalizers/chatgpt.d.ts +1 -0
  206. package/dist/replay/normalizers/chatgpt.js +3 -3
  207. package/dist/replay/normalizers/claude.d.ts +1 -0
  208. package/dist/replay/normalizers/claude.js +3 -3
  209. package/dist/replay/normalizers/openclaw.d.ts +1 -0
  210. package/dist/replay/normalizers/openclaw.js +3 -3
  211. package/dist/replay/normalizers/shared.d.ts +1 -0
  212. package/dist/replay/normalizers/shared.js +2 -2
  213. package/dist/replay/runner.d.ts +1 -0
  214. package/dist/replay/runner.js +2 -2
  215. package/dist/replay/types.d.ts +2 -1
  216. package/dist/replay/types.js +1 -1
  217. package/dist/resolve-auth-token.d.ts +1 -2
  218. package/dist/retrieval-agents.d.ts +2 -3
  219. package/dist/retrieval-tiers.d.ts +1 -2
  220. package/dist/routing/engine.d.ts +1 -2
  221. package/dist/routing/store.d.ts +1 -2
  222. package/dist/schemas.d.ts +22 -22
  223. package/dist/search/embed-helper.d.ts +1 -2
  224. package/dist/search/factory.d.ts +1 -2
  225. package/dist/search/index.d.ts +1 -2
  226. package/dist/search/lancedb-backend.d.ts +1 -2
  227. package/dist/search/meilisearch-backend.d.ts +1 -2
  228. package/dist/search/noop-backend.d.ts +1 -2
  229. package/dist/search/orama-backend.d.ts +1 -2
  230. package/dist/search/port.d.ts +1 -2
  231. package/dist/search/remote-backend.d.ts +1 -2
  232. package/dist/{semantic-DJR8_DMQ.d.ts → semantic-TddhF0y7.d.ts} +17 -1
  233. package/dist/{semantic-consolidation-O5lMZ4LG.d.ts → semantic-consolidation-BTShF2Fo.d.ts} +1 -1
  234. package/dist/semantic-consolidation.d.ts +2 -3
  235. package/dist/semantic-consolidation.js +4 -4
  236. package/dist/semantic-rule-promotion.js +3 -3
  237. package/dist/semantic-rule-verifier.d.ts +1 -2
  238. package/dist/semantic-rule-verifier.js +3 -3
  239. package/dist/session-observer-bands.d.ts +1 -2
  240. package/dist/session-observer-state.d.ts +1 -2
  241. package/dist/shared-context/manager.d.ts +3 -4
  242. package/dist/signal.d.ts +1 -2
  243. package/dist/{storage-C1maCNbc.d.ts → storage-DxPDAiU9.d.ts} +5 -1
  244. package/dist/storage.d.ts +2 -3
  245. package/dist/storage.js +2 -2
  246. package/dist/summarizer.d.ts +1 -2
  247. package/dist/summary-snapshot.d.ts +1 -2
  248. package/dist/temporal-supersession.d.ts +2 -3
  249. package/dist/temporal-validity.d.ts +1 -2
  250. package/dist/threading.d.ts +1 -2
  251. package/dist/tier-migration.d.ts +2 -3
  252. package/dist/tier-routing.d.ts +1 -2
  253. package/dist/topics.d.ts +1 -2
  254. package/dist/transcript.d.ts +1 -2
  255. package/dist/trust-score-stage.d.ts +1 -2
  256. package/dist/trust-score.d.ts +1 -2
  257. package/dist/{types-CGgcNWCG.d.ts → types-DDUDgd7T.d.ts} +93 -4
  258. package/dist/types.d.ts +1 -2
  259. package/dist/types.js +1 -1
  260. package/dist/utility-runtime.d.ts +1 -2
  261. package/dist/verified-recall.js +3 -3
  262. package/package.json +2 -2
  263. package/src/access-admin-ops-surface.ts +1 -0
  264. package/src/access-boundary.ts +2 -0
  265. package/src/access-http.test.ts +129 -0
  266. package/src/access-http.ts +92 -23
  267. package/src/access-mcp.ts +11 -2
  268. package/src/access-observe-write-surface.ts +87 -113
  269. package/src/access-operations-batch.ts +2 -2
  270. package/src/access-operations.ts +17 -16
  271. package/src/access-service.ts +13 -5
  272. package/src/admin/admin-surfaces.ts +2 -0
  273. package/src/buffer.ts +6 -1
  274. package/src/bulk-import/types.ts +2 -1
  275. package/src/coding/architecture-surfaces.test.ts +79 -5
  276. package/src/coding/architecture-surfaces.ts +7 -1
  277. package/src/coding/decision-surfaces.test.ts +1 -0
  278. package/src/coding/decision-surfaces.ts +4 -0
  279. package/src/connector-provenance-lifecycle.test.ts +618 -0
  280. package/src/connector-provenance.test.ts +219 -0
  281. package/src/dedup/semantic.test.ts +105 -0
  282. package/src/dedup/semantic.ts +69 -1
  283. package/src/explicit-capture.ts +21 -4
  284. package/src/orchestration/extraction-persist.ts +154 -6
  285. package/src/orchestration/extraction-run.ts +138 -228
  286. package/src/orchestration/persistence-index.ts +40 -5
  287. package/src/orchestration/turn-ingestion.ts +16 -9
  288. package/src/orchestrator-connector-dedup.test.ts +1082 -0
  289. package/src/orchestrator.ts +10 -26
  290. package/src/replay/types.ts +2 -1
  291. package/src/storage.ts +426 -553
  292. package/src/types.ts +11 -2
  293. package/src/utils/yaml-scalar.ts +20 -0
  294. package/dist/chunk-2PRQG7PV.js.map +0 -1
  295. package/dist/chunk-4GNEDXDI.js.map +0 -1
  296. package/dist/chunk-FKCRGLRD.js.map +0 -1
  297. package/dist/chunk-H2DXDQCQ.js.map +0 -1
  298. package/dist/chunk-K5LLP4CY.js.map +0 -1
  299. package/dist/chunk-LADFWYHY.js.map +0 -1
  300. package/dist/chunk-OUELRE5E.js.map +0 -1
  301. package/dist/chunk-PCLIWBGD.js.map +0 -1
  302. package/dist/chunk-SVOHGUMI.js.map +0 -1
  303. package/dist/chunk-UFUKHGZD.js.map +0 -1
  304. package/dist/chunk-XCL57M6Q.js.map +0 -1
  305. package/dist/types-gb_SNtjR.d.ts +0 -85
  306. /package/dist/{chunk-PNLFN2PZ.js.map → chunk-23G3T2Q5.js.map} +0 -0
  307. /package/dist/{chunk-SIRPLF54.js.map → chunk-2K3OSLHE.js.map} +0 -0
  308. /package/dist/{chunk-LQHDIS7L.js.map → chunk-54BGIBCR.js.map} +0 -0
  309. /package/dist/{chunk-PVUJ6WVV.js.map → chunk-5MH5NF3U.js.map} +0 -0
  310. /package/dist/{chunk-Y7UNNAZD.js.map → chunk-7ZYBDQ7V.js.map} +0 -0
  311. /package/dist/{chunk-LR5DZ56F.js.map → chunk-AXALUFAH.js.map} +0 -0
  312. /package/dist/{chunk-AYZJID4S.js.map → chunk-B5GBWBCZ.js.map} +0 -0
  313. /package/dist/{chunk-TLUDFPZL.js.map → chunk-CAZ3Z5M6.js.map} +0 -0
  314. /package/dist/{chunk-P454KXD6.js.map → chunk-CJPVWAJF.js.map} +0 -0
  315. /package/dist/{chunk-RGK27ELN.js.map → chunk-DEKIXXIG.js.map} +0 -0
  316. /package/dist/{chunk-2KK5WNQB.js.map → chunk-DQ42IQSK.js.map} +0 -0
  317. /package/dist/{chunk-HOJZMQ4J.js.map → chunk-FGDKJJZS.js.map} +0 -0
  318. /package/dist/{chunk-ABP6QMVM.js.map → chunk-FQ7HAWWC.js.map} +0 -0
  319. /package/dist/{chunk-CYWA2CXR.js.map → chunk-FVTLSFWU.js.map} +0 -0
  320. /package/dist/{chunk-JJEJJ7RK.js.map → chunk-FXZTL7F7.js.map} +0 -0
  321. /package/dist/{chunk-DANV2HTH.js.map → chunk-GQGDRLDM.js.map} +0 -0
  322. /package/dist/{chunk-7F7Z6MOS.js.map → chunk-H4CKS5B2.js.map} +0 -0
  323. /package/dist/{chunk-CKITWVWJ.js.map → chunk-HSSERO3E.js.map} +0 -0
  324. /package/dist/{chunk-23JFRB73.js.map → chunk-JODHPNLN.js.map} +0 -0
  325. /package/dist/{chunk-DS7MM2ES.js.map → chunk-JZKR6ZAV.js.map} +0 -0
  326. /package/dist/{chunk-BEM4D2QG.js.map → chunk-KJIJNLXT.js.map} +0 -0
  327. /package/dist/{chunk-JSNVWNGX.js.map → chunk-KVSVVKHA.js.map} +0 -0
  328. /package/dist/{chunk-MC4FJXPA.js.map → chunk-MMACM5G2.js.map} +0 -0
  329. /package/dist/{chunk-3XIY7MDQ.js.map → chunk-O6YI4CVI.js.map} +0 -0
  330. /package/dist/{chunk-72WG5QKN.js.map → chunk-SDAXPXER.js.map} +0 -0
  331. /package/dist/{chunk-4LV23CHK.js.map → chunk-VHJARF5R.js.map} +0 -0
  332. /package/dist/{chunk-6MMONPHM.js.map → chunk-W2AHSCKY.js.map} +0 -0
@@ -12,9 +12,17 @@
12
12
 
13
13
  import { createHash } from "node:crypto";
14
14
  import { FileCalendarSource, buildBriefing, parseBriefingFocus, parseBriefingWindow } from "./briefing.js";
15
- import { resolveCompressionCapabilities, resolveNamespaceCapabilities, resolveObjectiveStateCapabilities } from "./capabilities.js";
15
+ import {
16
+ resolveCompressionCapabilities,
17
+ resolveNamespaceCapabilities,
18
+ resolveObjectiveStateCapabilities,
19
+ } from "./capabilities.js";
16
20
  import { lcmSessionKeyForNamespace } from "./coding/coding-namespace.js";
17
- import { type ValidExplicitCapture, persistExplicitCapture, queueExplicitCaptureForReview } from "./explicit-capture.js";
21
+ import {
22
+ type ValidExplicitCapture,
23
+ persistExplicitCapture,
24
+ queueExplicitCaptureForReview,
25
+ } from "./explicit-capture.js";
18
26
  import { log } from "./logger.js";
19
27
  import { recordObjectiveStateSnapshotsFromObservedMessages } from "./objective-state-writers.js";
20
28
  import type { Orchestrator } from "./orchestrator.js";
@@ -41,7 +49,7 @@ import {
41
49
 
42
50
  export interface AccessObserveWriteSurfaceDeps {
43
51
  attachCodingContextAfterScopedWrite(
44
- request: CodingScopedWriteInput & { namespace?: string; sessionKey?: string },
52
+ request: CodingScopedWriteInput & { namespace?: string; sessionKey?: string }
45
53
  ): Promise<void>;
46
54
  handleIdempotentWrite<T extends { idempotencyReplay?: boolean }>(options: {
47
55
  operation: string;
@@ -63,13 +71,13 @@ export interface AccessObserveWriteSurfaceDeps {
63
71
  legacyResponseNamespaceForScope(scope: MemoryScopePlan): string;
64
72
  maybeAttachCodingContext(
65
73
  sessionKey: string | undefined,
66
- options: { cwd?: string; projectTag?: string },
74
+ options: { cwd?: string; projectTag?: string }
67
75
  ): Promise<void>;
68
76
  namespaceQmdHealth(
69
77
  searchBackend: string,
70
78
  qmdEnabled: boolean,
71
79
  namespace: string,
72
- fallbackCollection: string,
80
+ fallbackCollection: string
73
81
  ): Promise<EngramAccessQmdHealthResponse | null>;
74
82
  objectiveStateStoreLocationForNamespace(namespace: string): Promise<{
75
83
  memoryDir: string;
@@ -79,48 +87,43 @@ export interface AccessObserveWriteSurfaceDeps {
79
87
  qmdCollectionState(
80
88
  searchBackend: string,
81
89
  qmdEnabled: boolean,
82
- collection: string,
90
+ collection: string
83
91
  ): Promise<EngramAccessQmdCollectionState>;
84
- qmdProbeAvailable(
85
- searchBackend: string,
86
- qmdEnabled: boolean,
87
- ): Promise<boolean>;
92
+ qmdProbeAvailable(searchBackend: string, qmdEnabled: boolean): Promise<boolean>;
88
93
  resolveCodingScopedWriteNamespace(
89
94
  request: CodingScopedWriteInput & {
90
95
  namespace?: string;
91
96
  sessionKey?: string;
92
97
  authenticatedPrincipal?: string;
93
- },
98
+ }
94
99
  ): Promise<string>;
95
100
  resolveMemoryScopePlan(
96
101
  request: CodingScopedWriteInput & {
97
102
  namespace?: string;
98
103
  sessionKey?: string;
99
104
  authenticatedPrincipal?: string;
100
- },
105
+ }
101
106
  ): Promise<MemoryScopePlan>;
102
107
  resolveReadableNamespace(namespace: string | undefined, principal?: string): string;
103
108
  validateWriteCandidate(
104
109
  request: EngramAccessMemoryStoreRequest | EngramAccessSuggestionSubmitRequest,
105
- namespace: string,
110
+ namespace: string
106
111
  ): ValidExplicitCapture;
107
112
  writableNamespaceFor(
108
113
  namespace: string | undefined,
109
114
  sessionKey: string | undefined,
110
- authenticatedPrincipal?: string,
115
+ authenticatedPrincipal?: string
111
116
  ): string;
112
117
  }
113
118
 
114
119
  export class AccessObserveWriteSurface {
115
- constructor(
116
- private readonly deps: AccessObserveWriteSurfaceDeps,
117
- ) {}
120
+ constructor(private readonly deps: AccessObserveWriteSurfaceDeps) {}
118
121
 
119
122
  async qmdHealth(
120
123
  searchBackend: string,
121
124
  qmdEnabled: boolean,
122
125
  namespace: string,
123
- collection: string,
126
+ collection: string
124
127
  ): Promise<EngramAccessQmdHealthResponse> {
125
128
  if (searchBackend !== "qmd" || !qmdEnabled) {
126
129
  return {
@@ -168,28 +171,22 @@ export class AccessObserveWriteSurface {
168
171
  : "unknown";
169
172
  const active = operationalAvailable && collectionState !== "missing";
170
173
  const degraded =
171
- searchBackend === "qmd" &&
172
- qmdEnabled &&
173
- (!active || !diagnosticAvailable || collectionState === "unknown");
174
+ searchBackend === "qmd" && qmdEnabled && (!active || !diagnosticAvailable || collectionState === "unknown");
174
175
  const debugStatus = qmd.debugStatus();
175
176
  const versionStatus =
176
- "getVersionStatus" in qmd && typeof qmd.getVersionStatus === "function"
177
- ? qmd.getVersionStatus()
178
- : null;
177
+ "getVersionStatus" in qmd && typeof qmd.getVersionStatus === "function" ? qmd.getVersionStatus() : null;
179
178
  const daemonMode =
180
- "isDaemonMode" in qmd && typeof qmd.isDaemonMode === "function"
181
- ? qmd.isDaemonMode() === true
182
- : false;
179
+ "isDaemonMode" in qmd && typeof qmd.isDaemonMode === "function" ? qmd.isDaemonMode() === true : false;
183
180
  const mode =
184
181
  searchBackend !== "qmd"
185
182
  ? "not-selected"
186
183
  : !qmdEnabled
187
- ? "disabled"
188
- : !active
189
- ? "fallback"
190
- : daemonMode
191
- ? "daemon"
192
- : "cli";
184
+ ? "disabled"
185
+ : !active
186
+ ? "fallback"
187
+ : daemonMode
188
+ ? "daemon"
189
+ : "cli";
193
190
 
194
191
  return {
195
192
  enabled: qmdEnabled,
@@ -211,14 +208,14 @@ export class AccessObserveWriteSurface {
211
208
  searchBackend: string,
212
209
  qmdEnabled: boolean,
213
210
  namespace: string,
214
- fallbackCollection: string,
211
+ fallbackCollection: string
215
212
  ): Promise<EngramAccessQmdHealthResponse | null> {
216
213
  if (searchBackend !== "qmd" || !qmdEnabled) return null;
217
214
  const searchHealthForNamespace = (
218
215
  this.deps.orchestrator as Orchestrator & {
219
216
  searchHealthForNamespace?: (
220
217
  namespace: string,
221
- execution?: { signal?: AbortSignal },
218
+ execution?: { signal?: AbortSignal }
222
219
  ) => Promise<{
223
220
  collection: string;
224
221
  available: boolean;
@@ -244,12 +241,7 @@ export class AccessObserveWriteSurface {
244
241
  });
245
242
  const active = health.available && health.collectionState !== "missing";
246
243
  const degraded = !active || health.collectionState === "unknown";
247
- const mode =
248
- !active
249
- ? "fallback"
250
- : health.daemonMode === true
251
- ? "daemon"
252
- : "cli";
244
+ const mode = !active ? "fallback" : health.daemonMode === true ? "daemon" : "cli";
253
245
 
254
246
  return {
255
247
  enabled: true,
@@ -290,9 +282,7 @@ export class AccessObserveWriteSurface {
290
282
  * Build a daily context briefing. Gracefully degrades when the OpenAI key
291
283
  * or Responses API is unavailable — never throws for LLM-related problems.
292
284
  */
293
- async briefing(
294
- request: EngramAccessBriefingRequest,
295
- ): Promise<EngramAccessBriefingResponse> {
285
+ async briefing(request: EngramAccessBriefingRequest): Promise<EngramAccessBriefingResponse> {
296
286
  const config = this.deps.orchestrator.config;
297
287
  if (!config.briefing.enabled) {
298
288
  throw new EngramAccessInputError("briefing is disabled");
@@ -301,9 +291,10 @@ export class AccessObserveWriteSurface {
301
291
  const namespace = this.deps.resolveReadableNamespace(request.namespace, request.principal);
302
292
  const storage = await this.deps.orchestrator.getStorage(namespace);
303
293
 
304
- const token = typeof request.since === "string" && request.since.trim().length > 0
305
- ? request.since.trim()
306
- : config.briefing.defaultWindow;
294
+ const token =
295
+ typeof request.since === "string" && request.since.trim().length > 0
296
+ ? request.since.trim()
297
+ : config.briefing.defaultWindow;
307
298
  const window = parseBriefingWindow(token);
308
299
  if (!window) {
309
300
  throw new EngramAccessInputError(`invalid briefing window: ${token}`);
@@ -318,9 +309,7 @@ export class AccessObserveWriteSurface {
318
309
  if (rawFocus.length > 0) {
319
310
  focus = parseBriefingFocus(rawFocus);
320
311
  if (!focus) {
321
- throw new EngramAccessInputError(
322
- `invalid briefing focus filter: ${request.focus}`,
323
- );
312
+ throw new EngramAccessInputError(`invalid briefing focus filter: ${request.focus}`);
324
313
  }
325
314
  }
326
315
 
@@ -330,23 +319,18 @@ export class AccessObserveWriteSurface {
330
319
  // in the default format, masking the client bug and breaking format-dependent
331
320
  // automation. Only undefined / absent format falls through to the default.
332
321
  const SUPPORTED_FORMATS = ["markdown", "json"] as const;
333
- if (
334
- typeof request.format === "string" &&
335
- !(SUPPORTED_FORMATS as readonly string[]).includes(request.format)
336
- ) {
322
+ if (typeof request.format === "string" && !(SUPPORTED_FORMATS as readonly string[]).includes(request.format)) {
337
323
  throw new EngramAccessInputError(
338
- `unsupported briefing format: "${request.format}". Accepted: ${SUPPORTED_FORMATS.join(", ")}.`,
324
+ `unsupported briefing format: "${request.format}". Accepted: ${SUPPORTED_FORMATS.join(", ")}.`
339
325
  );
340
326
  }
341
- const format: "markdown" | "json" = request.format === "json"
342
- ? "json"
343
- : request.format === "markdown"
344
- ? "markdown"
345
- : config.briefing.defaultFormat;
327
+ const format: "markdown" | "json" =
328
+ request.format === "json" ? "json" : request.format === "markdown" ? "markdown" : config.briefing.defaultFormat;
346
329
 
347
- const maxFollowups = typeof request.maxFollowups === "number" && Number.isFinite(request.maxFollowups)
348
- ? Math.max(0, Math.min(10, Math.floor(request.maxFollowups)))
349
- : config.briefing.maxFollowups;
330
+ const maxFollowups =
331
+ typeof request.maxFollowups === "number" && Number.isFinite(request.maxFollowups)
332
+ ? Math.max(0, Math.min(10, Math.floor(request.maxFollowups)))
333
+ : config.briefing.maxFollowups;
350
334
 
351
335
  const calendarSource = config.briefing.calendarSource
352
336
  ? new FileCalendarSource(config.briefing.calendarSource)
@@ -367,9 +351,7 @@ export class AccessObserveWriteSurface {
367
351
  // LLM chain (gateway model source or local LLM) — same fallback every
368
352
  // other LLM feature uses. A configured key keeps its precedence so
369
353
  // existing deployments are unchanged.
370
- followupGenerator: config.openaiApiKey
371
- ? undefined
372
- : this.deps.orchestrator.briefingChainFollowupGenerator,
354
+ followupGenerator: config.openaiApiKey ? undefined : this.deps.orchestrator.briefingChainFollowupGenerator,
373
355
  });
374
356
 
375
357
  return {
@@ -384,7 +366,7 @@ export class AccessObserveWriteSurface {
384
366
 
385
367
  async memoryStore(
386
368
  request: EngramAccessMemoryStoreRequest,
387
- hooks?: { enforceWriteQuota?: () => void | Promise<void> },
369
+ hooks?: { enforceWriteQuota?: () => void | Promise<void> }
388
370
  ): Promise<EngramAccessWriteResponse> {
389
371
  const namespace = await this.deps.resolveCodingScopedWriteNamespace(request);
390
372
  const schemaVersion = request.schemaVersion ?? ENGRAM_ACCESS_WRITE_SCHEMA_VERSION;
@@ -431,7 +413,7 @@ export class AccessObserveWriteSurface {
431
413
  idempotencyKey: request.idempotencyKey?.trim() || undefined,
432
414
  };
433
415
  log.info(
434
- `access-write op=memory_store namespace=${namespace} dryRun=false status=${response.status} memoryId=${response.memoryId ?? "-"} idempotency=${response.idempotencyKey ? "yes" : "no"}`,
416
+ `access-write op=memory_store namespace=${namespace} dryRun=false status=${response.status} memoryId=${response.memoryId ?? "-"} idempotency=${response.idempotencyKey ? "yes" : "no"}`
435
417
  );
436
418
  return response;
437
419
  };
@@ -448,6 +430,7 @@ export class AccessObserveWriteSurface {
448
430
  entityRef: request.entityRef,
449
431
  ttl: request.ttl,
450
432
  sourceReason: request.sourceReason,
433
+ sourceConnector: request.sourceConnector,
451
434
  },
452
435
  skip: request.dryRun === true,
453
436
  beforeExecute: hooks?.enforceWriteQuota,
@@ -457,7 +440,7 @@ export class AccessObserveWriteSurface {
457
440
 
458
441
  async suggestionSubmit(
459
442
  request: EngramAccessSuggestionSubmitRequest,
460
- hooks?: { enforceWriteQuota?: () => void | Promise<void> },
443
+ hooks?: { enforceWriteQuota?: () => void | Promise<void> }
461
444
  ): Promise<EngramAccessWriteResponse> {
462
445
  const namespace = await this.deps.resolveCodingScopedWriteNamespace(request);
463
446
  const schemaVersion = request.schemaVersion ?? ENGRAM_ACCESS_WRITE_SCHEMA_VERSION;
@@ -482,7 +465,7 @@ export class AccessObserveWriteSurface {
482
465
  this.deps.orchestrator,
483
466
  candidate,
484
467
  "suggestion_submit",
485
- new Error(request.sourceReason?.trim() || "submitted via engram suggestion_submit"),
468
+ new Error(request.sourceReason?.trim() || "submitted via engram suggestion_submit")
486
469
  );
487
470
  // Seed the session binding only after a real, project-scoped submit commits
488
471
  // (mirrors memory_store / recall; skips dryRun, replay, quota-reject, and
@@ -501,7 +484,7 @@ export class AccessObserveWriteSurface {
501
484
  idempotencyKey: request.idempotencyKey?.trim() || undefined,
502
485
  };
503
486
  log.info(
504
- `access-write op=suggestion_submit namespace=${namespace} dryRun=false status=${response.status} memoryId=${response.memoryId ?? "-"} idempotency=${response.idempotencyKey ? "yes" : "no"}`,
487
+ `access-write op=suggestion_submit namespace=${namespace} dryRun=false status=${response.status} memoryId=${response.memoryId ?? "-"} idempotency=${response.idempotencyKey ? "yes" : "no"}`
505
488
  );
506
489
  return response;
507
490
  };
@@ -518,6 +501,7 @@ export class AccessObserveWriteSurface {
518
501
  entityRef: request.entityRef,
519
502
  ttl: request.ttl,
520
503
  sourceReason: request.sourceReason,
504
+ sourceConnector: request.sourceConnector,
521
505
  },
522
506
  skip: request.dryRun === true,
523
507
  beforeExecute: hooks?.enforceWriteQuota,
@@ -596,11 +580,8 @@ export class AccessObserveWriteSurface {
596
580
  // when the namespace diverges from the default store; a single-store
597
581
  // deployment keeps the raw sessionKey unchanged.
598
582
  const lcmSessionKey =
599
- lcmSessionKeyForNamespace(
600
- writeNamespace,
601
- request.sessionKey,
602
- this.deps.orchestrator.config.defaultNamespace,
603
- ) ?? request.sessionKey;
583
+ lcmSessionKeyForNamespace(writeNamespace, request.sessionKey, this.deps.orchestrator.config.defaultNamespace) ??
584
+ request.sessionKey;
604
585
 
605
586
  // 4. Objective-state snapshots → the scope plan's objective-state namespace.
606
587
  // For explicit-namespace and coding-overlay writes this equals
@@ -609,16 +590,16 @@ export class AccessObserveWriteSurface {
609
590
  // general default-store write namespace.
610
591
  if (shouldWriteObjectiveState) {
611
592
  try {
612
- const objectiveStateLocation =
613
- await this.deps.objectiveStateStoreLocationForNamespace(
614
- scope.objectiveStateNamespace,
615
- );
593
+ const objectiveStateLocation = await this.deps.objectiveStateStoreLocationForNamespace(
594
+ scope.objectiveStateNamespace
595
+ );
616
596
  await recordObjectiveStateSnapshotsFromObservedMessages({
617
597
  memoryDir: objectiveStateLocation.memoryDir,
618
598
  objectiveStateStoreDir: objectiveStateLocation.objectiveStateStoreDir,
619
- objectiveStateMemoryEnabled: resolveObjectiveStateCapabilities(this.deps.orchestrator.config).objectiveStateMemory,
620
- objectiveStateSnapshotWritesEnabled:
621
- resolveObjectiveStateCapabilities(this.deps.orchestrator.config).objectiveStateSnapshotWrites,
599
+ objectiveStateMemoryEnabled: resolveObjectiveStateCapabilities(this.deps.orchestrator.config)
600
+ .objectiveStateMemory,
601
+ objectiveStateSnapshotWritesEnabled: resolveObjectiveStateCapabilities(this.deps.orchestrator.config)
602
+ .objectiveStateSnapshotWrites,
622
603
  sessionKey: request.sessionKey,
623
604
  recordedAt: new Date().toISOString(),
624
605
  messages: request.messages,
@@ -666,6 +647,7 @@ export class AccessObserveWriteSurface {
666
647
  rawContent: m.rawContent,
667
648
  sourceFormat: m.sourceFormat,
668
649
  timestamp: new Date().toISOString(),
650
+ ...(request.sourceConnector ? { sourceConnector: request.sourceConnector } : {}),
669
651
  }));
670
652
  // Pin extraction STORAGE to the effective namespace rather than letting the
671
653
  // orchestrator re-derive one from the session key + coding overlay — that
@@ -685,9 +667,7 @@ export class AccessObserveWriteSurface {
685
667
  // namespace to one store, so leaving the override undefined preserves the
686
668
  // existing single-store routing byte-for-byte.
687
669
  const writeNamespaceOverride =
688
- resolveNamespaceCapabilities(this.deps.orchestrator.config).namespaces === true
689
- ? writeNamespace
690
- : undefined;
670
+ resolveNamespaceCapabilities(this.deps.orchestrator.config).namespaces === true ? writeNamespace : undefined;
691
671
  // Pin provenance PRINCIPAL to the scope plan's resolved principal (#1505
692
672
  // thread 1). The scope plan already applied auth precedence
693
673
  // (authenticatedPrincipal/principalOverride > resolvePrincipal(original
@@ -696,9 +676,7 @@ export class AccessObserveWriteSurface {
696
676
  // resolved (namespaces-disabled / unauthenticated single-store), preserving
697
677
  // existing behavior.
698
678
  const principalOverride =
699
- typeof scope.principal === "string" && scope.principal.length > 0
700
- ? scope.principal
701
- : undefined;
679
+ typeof scope.principal === "string" && scope.principal.length > 0 ? scope.principal : undefined;
702
680
  // Fire-and-forget: queue extraction in the background so the HTTP
703
681
  // response returns immediately. LCM archival (above) is also
704
682
  // enqueue-only; extraction involves LLM calls that can take
@@ -725,7 +703,7 @@ export class AccessObserveWriteSurface {
725
703
  }
726
704
 
727
705
  log.info(
728
- `access-observe namespace=${namespace} effectiveNamespace=${writeNamespace} sessionKey=${request.sessionKey} messages=${request.messages.length} lcm=${lcmArchived} extraction=${extractionQueued}`,
706
+ `access-observe namespace=${namespace} effectiveNamespace=${writeNamespace} sessionKey=${request.sessionKey} messages=${request.messages.length} lcm=${lcmArchived} extraction=${extractionQueued}`
729
707
  );
730
708
 
731
709
  return {
@@ -765,8 +743,9 @@ export class AccessObserveWriteSurface {
765
743
  }): Promise<unknown> {
766
744
  const STATUSES = new Set(["todo", "in_progress", "blocked", "done", "cancelled"]);
767
745
  const PRIORITIES = new Set(["low", "medium", "high"]);
768
- const asStatus = (v?: string) => (v && STATUSES.has(v) ? v as "todo" | "in_progress" | "blocked" | "done" | "cancelled" : undefined);
769
- const asPriority = (v?: string) => (v && PRIORITIES.has(v) ? v as "low" | "medium" | "high" : undefined);
746
+ const asStatus = (v?: string) =>
747
+ v && STATUSES.has(v) ? (v as "todo" | "in_progress" | "blocked" | "done" | "cancelled") : undefined;
748
+ const asPriority = (v?: string) => (v && PRIORITIES.has(v) ? (v as "low" | "medium" | "high") : undefined);
770
749
 
771
750
  const storage = new WorkStorage(this.deps.orchestrator.config.memoryDir);
772
751
  await storage.ensureDirectories();
@@ -805,8 +784,10 @@ export class AccessObserveWriteSurface {
805
784
  const patch: Record<string, unknown> = {};
806
785
  if (request.title !== undefined) patch.title = request.title;
807
786
  if (request.description !== undefined) patch.description = request.description;
808
- const st = asStatus(request.status); if (st) patch.status = st;
809
- const pr = asPriority(request.priority); if (pr) patch.priority = pr;
787
+ const st = asStatus(request.status);
788
+ if (st) patch.status = st;
789
+ const pr = asPriority(request.priority);
790
+ if (pr) patch.priority = pr;
810
791
  if (request.owner !== undefined) patch.owner = request.owner || null;
811
792
  if (request.assignee !== undefined) patch.assignee = request.assignee || null;
812
793
  if (request.projectId !== undefined) patch.projectId = request.projectId || null;
@@ -839,7 +820,8 @@ export class AccessObserveWriteSurface {
839
820
  projectId?: string;
840
821
  }): Promise<unknown> {
841
822
  const STATUSES = new Set(["active", "on_hold", "completed", "archived"]);
842
- const asStatus = (v?: string) => (v && STATUSES.has(v) ? v as "active" | "on_hold" | "completed" | "archived" : undefined);
823
+ const asStatus = (v?: string) =>
824
+ v && STATUSES.has(v) ? (v as "active" | "on_hold" | "completed" | "archived") : undefined;
843
825
 
844
826
  const storage = new WorkStorage(this.deps.orchestrator.config.memoryDir);
845
827
  await storage.ensureDirectories();
@@ -869,7 +851,8 @@ export class AccessObserveWriteSurface {
869
851
  const patch: Record<string, unknown> = {};
870
852
  if (request.name !== undefined) patch.name = request.name;
871
853
  if (request.description !== undefined) patch.description = request.description;
872
- const st = asStatus(request.status); if (st) patch.status = st;
854
+ const st = asStatus(request.status);
855
+ if (st) patch.status = st;
873
856
  if (request.owner !== undefined) patch.owner = request.owner || null;
874
857
  if (request.tags) patch.tags = request.tags;
875
858
  return { action, project: await storage.updateProject(request.id, patch as any) };
@@ -907,7 +890,8 @@ export class AccessObserveWriteSurface {
907
890
  return { action, snapshot };
908
891
  }
909
892
  if (action === "import_snapshot") {
910
- if (!request.snapshotJson?.trim()) throw new EngramAccessInputError("snapshotJson is required for import_snapshot");
893
+ if (!request.snapshotJson?.trim())
894
+ throw new EngramAccessInputError("snapshotJson is required for import_snapshot");
911
895
  const snapshot = JSON.parse(request.snapshotJson);
912
896
  const result = await importWorkBoardSnapshot({ memoryDir, snapshot, projectId });
913
897
  return { action, result };
@@ -943,37 +927,29 @@ export class AccessObserveWriteSurface {
943
927
  "link_graph",
944
928
  ]);
945
929
  if (!actionTypes.has(request.action as MemoryActionType)) {
946
- throw new EngramAccessInputError(
947
- `memory_action_apply: invalid action ${JSON.stringify(request.action)}`,
948
- );
930
+ throw new EngramAccessInputError(`memory_action_apply: invalid action ${JSON.stringify(request.action)}`);
949
931
  }
950
932
 
951
933
  if (resolveCompressionCapabilities(this.deps.orchestrator.config).contextCompressionActions !== true) {
952
934
  throw new EngramAccessInputError(
953
- "memory_action_apply is disabled; enable contextCompressionActionsEnabled to use this tool",
935
+ "memory_action_apply is disabled; enable contextCompressionActionsEnabled to use this tool"
954
936
  );
955
937
  }
956
938
 
957
939
  const outcome = request.outcome ?? "skipped";
958
940
  if (outcome !== "applied" && outcome !== "skipped" && outcome !== "failed") {
959
941
  throw new EngramAccessInputError(
960
- `memory_action_apply: outcome must be "applied", "skipped", or "failed"; got ${JSON.stringify(outcome)}`,
942
+ `memory_action_apply: outcome must be "applied", "skipped", or "failed"; got ${JSON.stringify(outcome)}`
961
943
  );
962
944
  }
963
945
 
964
- const resolvedNs = this.deps.writableNamespaceFor(
965
- request.namespace,
966
- request.sessionKey,
967
- request.principal,
968
- );
946
+ const resolvedNs = this.deps.writableNamespaceFor(request.namespace, request.sessionKey, request.principal);
969
947
  const inputSummaryParts = [
970
948
  request.content,
971
949
  request.category ? `category=${request.category}` : undefined,
972
950
  request.linkTargetId ? `linkTargetId=${request.linkTargetId}` : undefined,
973
951
  request.linkType ? `linkType=${request.linkType}` : undefined,
974
- typeof request.linkStrength === "number"
975
- ? `linkStrength=${request.linkStrength}`
976
- : undefined,
952
+ typeof request.linkStrength === "number" ? `linkStrength=${request.linkStrength}` : undefined,
977
953
  request.artifactType ? `artifactType=${request.artifactType}` : undefined,
978
954
  typeof request.execute === "boolean" ? `execute=${request.execute}` : undefined,
979
955
  ].filter((part): part is string => typeof part === "string" && part.length > 0);
@@ -987,9 +963,7 @@ export class AccessObserveWriteSurface {
987
963
  reason: request.reason,
988
964
  memoryId: request.memoryId,
989
965
  sourceSessionKey: request.sessionKey,
990
- inputSummary: inputSummaryParts.length > 0
991
- ? inputSummaryParts.join(" | ").slice(0, 500)
992
- : undefined,
966
+ inputSummary: inputSummaryParts.length > 0 ? inputSummaryParts.join(" | ").slice(0, 500) : undefined,
993
967
  dryRun: request.dryRun === true,
994
968
  promptHash:
995
969
  typeof request.sourcePrompt === "string" && request.sourcePrompt.length > 0
@@ -156,11 +156,11 @@ defineOperation({ name: "procedural_stats", description: "Procedural stats.", sc
156
156
 
157
157
  // === MEMORY/ENTITY/OBSERVE/LCM ===
158
158
  defineOperation({ name: "memory_timeline", description: "Memory timeline.", schema: strictSchema({ memoryId: S.str, namespace: S.str, limit: S.num }), handler: async (input, ctx) => ({ result: await ctx.service.memoryTimeline(optStr(input.memoryId) ?? "", optStr(input.namespace), optNum(input.limit) ?? 200, ctx.authenticatedPrincipal) }) });
159
- defineOperation({ name: "suggestion_submit", description: "Submit suggestion.", schema: strictSchema({ schemaVersion: S.num, idempotencyKey: S.str, dryRun: S.bool, sessionKey: S.str, content: S.str, category: S.str, confidence: S.num, namespace: S.str, tags: S.strArr, entityRef: S.str, ttl: S.str, sourceReason: S.str, cwd: S.str, projectTag: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.suggestionSubmit({ schemaVersion: optNum(input.schemaVersion), idempotencyKey: optStr(input.idempotencyKey), dryRun: input.dryRun === true, sessionKey: optStr(input.sessionKey), authenticatedPrincipal: ctx.authenticatedPrincipal, content: optStr(input.content) ?? "", category: optStr(input.category), confidence: optNum(input.confidence), namespace: optStr(input.namespace), tags: optStrArr(input.tags), entityRef: optStr(input.entityRef), ttl: optStr(input.ttl), sourceReason: optStr(input.sourceReason), cwd: optStr(input.cwd), projectTag: optStr(input.projectTag) }) }) });
159
+ defineOperation({ name: "suggestion_submit", description: "Submit suggestion.", schema: strictSchema({ schemaVersion: S.num, idempotencyKey: S.str, dryRun: S.bool, sessionKey: S.str, content: S.str, category: S.str, confidence: S.num, namespace: S.str, tags: S.strArr, entityRef: S.str, ttl: S.str, sourceReason: S.str, cwd: S.str, projectTag: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.suggestionSubmit({ schemaVersion: optNum(input.schemaVersion), idempotencyKey: optStr(input.idempotencyKey), dryRun: input.dryRun === true, sessionKey: optStr(input.sessionKey), authenticatedPrincipal: ctx.authenticatedPrincipal, ...(ctx.sourceConnector ? { sourceConnector: ctx.sourceConnector } : {}), content: optStr(input.content) ?? "", category: optStr(input.category), confidence: optNum(input.confidence), namespace: optStr(input.namespace), tags: optStrArr(input.tags), entityRef: optStr(input.entityRef), ttl: optStr(input.ttl), sourceReason: optStr(input.sourceReason), cwd: optStr(input.cwd), projectTag: optStr(input.projectTag) }) }) });
160
160
  defineOperation({ name: "entity_get", description: "Get entity.", schema: strictSchema({ name: S.str, namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.entityGet(optStr(input.name) ?? "", optStr(input.namespace)) }) });
161
161
  defineOperation({ name: "review_queue_list", description: "List review queue.", schema: strictSchema({ runId: S.str, namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.reviewQueue(optStr(input.runId) ?? "", optStr(input.namespace), ctx.authenticatedPrincipal) }) });
162
162
  defineOperation({ name: "observe", description: "Observe messages.", schema: strictSchema({ sessionKey: S.str, messages: z.array(z.object({ role: z.string(), content: z.string(), parts: z.array(z.unknown()).optional(), rawContent: z.unknown().optional(), sourceFormat: z.string().optional() }).passthrough()), skipExtraction: S.bool, idempotencyKey: S.str, namespace: S.str, cwd: S.str, projectTag: S.str }),
163
- handler: async (input, ctx) => ({ result: await ctx.service.observe({ sessionKey: defStr(input.sessionKey, ""), messages: (input.messages as unknown[]).map((m: unknown) => { const r = m as Record<string, unknown>; return { role: String(r.role), content: String(r.content), parts: r.parts as unknown[], rawContent: r.rawContent as string | undefined, sourceFormat: r.sourceFormat as string | undefined }; }) as never, skipExtraction: input.skipExtraction === true, idempotencyKey: optStr(input.idempotencyKey), namespace: optStr(input.namespace), authenticatedPrincipal: ctx.authenticatedPrincipal, cwd: optStr(input.cwd), projectTag: optStr(input.projectTag) }, ctx.hooks?.enforceWriteQuota ? { enforceWriteQuota: ctx.hooks.enforceWriteQuota } : undefined) }),
163
+ handler: async (input, ctx) => ({ result: await ctx.service.observe({ sessionKey: defStr(input.sessionKey, ""), messages: (input.messages as unknown[]).map((m: unknown) => { const r = m as Record<string, unknown>; return { role: String(r.role), content: String(r.content), parts: r.parts as unknown[], rawContent: r.rawContent as string | undefined, sourceFormat: r.sourceFormat as string | undefined }; }) as never, skipExtraction: input.skipExtraction === true, idempotencyKey: optStr(input.idempotencyKey), namespace: optStr(input.namespace), authenticatedPrincipal: ctx.authenticatedPrincipal, cwd: optStr(input.cwd), projectTag: optStr(input.projectTag), ...(ctx.sourceConnector ? { sourceConnector: ctx.sourceConnector } : {}) }, ctx.hooks?.enforceWriteQuota ? { enforceWriteQuota: ctx.hooks.enforceWriteQuota } : undefined) }),
164
164
  });
165
165
  defineOperation({ name: "lcm_search", description: "Search LCM.", schema: strictSchema({ query: S.str, sessionKey: S.str, sessionPrefix: S.str, namespace: S.str, limit: S.num }), handler: async (input, ctx) => ({ result: await ctx.service.lcmSearch({ query: defStr(input.query, ""), sessionKey: optStr(input.sessionKey), sessionPrefix: optStr(input.sessionPrefix), namespace: optStr(input.namespace), limit: optNum(input.limit), authenticatedPrincipal: ctx.authenticatedPrincipal }) }) });
166
166
  defineOperation({ name: "lcm_compaction_flush", description: "Flush LCM compaction.", schema: strictSchema({ sessionKey: S.str, namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.lcmCompactionFlush({ sessionKey: optStr(input.sessionKey) ?? "", namespace: optStr(input.namespace), authenticatedPrincipal: ctx.authenticatedPrincipal }) }) });
@@ -156,6 +156,7 @@ export const memoryStoreOperation = defineOperation<MemoryStoreInput, MemoryStor
156
156
  {
157
157
  ...input,
158
158
  authenticatedPrincipal: ctx.authenticatedPrincipal,
159
+ ...(ctx.sourceConnector ? { sourceConnector: ctx.sourceConnector } : {}),
159
160
  },
160
161
  // Forward transport-level hooks (e.g. HTTP's atomic write-quota gate)
161
162
  // so the hook still fires inside the service's idempotent-write lock —
@@ -222,7 +223,7 @@ export const codingDecisionOperation = defineOperation<
222
223
  "List, get, record, or supersede decision records in the session's coding namespace (issue #1548 Track A).",
223
224
  schema: codingDecisionSchema as z.ZodType<CodingDecisionInput>,
224
225
  handler: async (input, ctx) => {
225
- const result = await ctx.service.codingDecision(input, ctx.authenticatedPrincipal);
226
+ const result = await ctx.service.codingDecision(input, ctx.authenticatedPrincipal, ctx.sourceConnector);
226
227
  return { result };
227
228
  },
228
229
  });
@@ -262,7 +263,7 @@ export const codingArchitectureOperation = defineOperation<
262
263
  "Get or refresh the architecture card for the session's coding namespace (issue #1548 Track A PR 3).",
263
264
  schema: codingArchitectureSchema as z.ZodType<CodingArchitectureInput>,
264
265
  handler: async (input, ctx) => {
265
- const result = await ctx.service.codingArchitecture(input, ctx.authenticatedPrincipal);
266
+ const result = await ctx.service.codingArchitecture(input, ctx.authenticatedPrincipal, ctx.sourceConnector);
266
267
  return { result };
267
268
  },
268
269
  });
@@ -487,7 +488,7 @@ export const codegraphIndexOperation = defineOperation<
487
488
  "Codegraph parity tool (issue #1554): index. Delegates to the shared codegraph surface handler.",
488
489
  schema: codegraphSurfaceSchema,
489
490
  handler: async (input, ctx) => {
490
- const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal);
491
+ const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal, ctx.sourceConnector);
491
492
  return { result };
492
493
  },
493
494
  });
@@ -501,7 +502,7 @@ export const codegraphListProjectsOperation = defineOperation<
501
502
  "Codegraph parity tool (issue #1554): list_projects. Delegates to the shared codegraph surface handler.",
502
503
  schema: codegraphSurfaceSchema,
503
504
  handler: async (input, ctx) => {
504
- const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal);
505
+ const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal, ctx.sourceConnector);
505
506
  return { result };
506
507
  },
507
508
  });
@@ -515,7 +516,7 @@ export const codegraphDeleteProjectOperation = defineOperation<
515
516
  "Codegraph parity tool (issue #1554): delete_project. Delegates to the shared codegraph surface handler.",
516
517
  schema: codegraphSurfaceSchema,
517
518
  handler: async (input, ctx) => {
518
- const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal);
519
+ const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal, ctx.sourceConnector);
519
520
  return { result };
520
521
  },
521
522
  });
@@ -529,7 +530,7 @@ export const codegraphIndexStatusOperation = defineOperation<
529
530
  "Codegraph parity tool (issue #1554): index_status. Delegates to the shared codegraph surface handler.",
530
531
  schema: codegraphSurfaceSchema,
531
532
  handler: async (input, ctx) => {
532
- const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal);
533
+ const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal, ctx.sourceConnector);
533
534
  return { result };
534
535
  },
535
536
  });
@@ -543,7 +544,7 @@ export const codegraphSearchGraphOperation = defineOperation<
543
544
  "Codegraph parity tool (issue #1554): search_graph. Delegates to the shared codegraph surface handler.",
544
545
  schema: codegraphSurfaceSchema,
545
546
  handler: async (input, ctx) => {
546
- const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal);
547
+ const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal, ctx.sourceConnector);
547
548
  return { result };
548
549
  },
549
550
  });
@@ -557,7 +558,7 @@ export const codegraphTracePathOperation = defineOperation<
557
558
  "Codegraph parity tool (issue #1554): trace_path. Delegates to the shared codegraph surface handler.",
558
559
  schema: codegraphSurfaceSchema,
559
560
  handler: async (input, ctx) => {
560
- const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal);
561
+ const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal, ctx.sourceConnector);
561
562
  return { result };
562
563
  },
563
564
  });
@@ -571,7 +572,7 @@ export const codegraphDetectChangesOperation = defineOperation<
571
572
  "Codegraph parity tool (issue #1554): detect_changes. Delegates to the shared codegraph surface handler.",
572
573
  schema: codegraphSurfaceSchema,
573
574
  handler: async (input, ctx) => {
574
- const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal);
575
+ const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal, ctx.sourceConnector);
575
576
  return { result };
576
577
  },
577
578
  });
@@ -585,7 +586,7 @@ export const codegraphQueryGraphOperation = defineOperation<
585
586
  "Codegraph parity tool (issue #1554): query_graph. Delegates to the shared codegraph surface handler.",
586
587
  schema: codegraphSurfaceSchema,
587
588
  handler: async (input, ctx) => {
588
- const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal);
589
+ const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal, ctx.sourceConnector);
589
590
  return { result };
590
591
  },
591
592
  });
@@ -599,7 +600,7 @@ export const codegraphGetSchemaOperation = defineOperation<
599
600
  "Codegraph parity tool (issue #1554): get_schema. Delegates to the shared codegraph surface handler.",
600
601
  schema: codegraphSurfaceSchema,
601
602
  handler: async (input, ctx) => {
602
- const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal);
603
+ const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal, ctx.sourceConnector);
603
604
  return { result };
604
605
  },
605
606
  });
@@ -613,7 +614,7 @@ export const codegraphGetSnippetOperation = defineOperation<
613
614
  "Codegraph parity tool (issue #1554): get_snippet. Delegates to the shared codegraph surface handler.",
614
615
  schema: codegraphSurfaceSchema,
615
616
  handler: async (input, ctx) => {
616
- const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal);
617
+ const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal, ctx.sourceConnector);
617
618
  return { result };
618
619
  },
619
620
  });
@@ -627,7 +628,7 @@ export const codegraphGetArchitectureOperation = defineOperation<
627
628
  "Codegraph parity tool (issue #1554): get_architecture. Delegates to the shared codegraph surface handler.",
628
629
  schema: codegraphSurfaceSchema,
629
630
  handler: async (input, ctx) => {
630
- const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal);
631
+ const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal, ctx.sourceConnector);
631
632
  return { result };
632
633
  },
633
634
  });
@@ -641,7 +642,7 @@ export const codegraphSearchCodeOperation = defineOperation<
641
642
  "Codegraph parity tool (issue #1554): search_code. Delegates to the shared codegraph surface handler.",
642
643
  schema: codegraphSurfaceSchema,
643
644
  handler: async (input, ctx) => {
644
- const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal);
645
+ const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal, ctx.sourceConnector);
645
646
  return { result };
646
647
  },
647
648
  });
@@ -655,7 +656,7 @@ export const codegraphManageAdrOperation = defineOperation<
655
656
  "Codegraph parity tool (issue #1554): manage_adr. Delegates to the shared codegraph surface handler.",
656
657
  schema: codegraphSurfaceSchema,
657
658
  handler: async (input, ctx) => {
658
- const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal);
659
+ const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal, ctx.sourceConnector);
659
660
  return { result };
660
661
  },
661
662
  });
@@ -669,7 +670,7 @@ export const codegraphIngestTracesOperation = defineOperation<
669
670
  "Codegraph parity tool (issue #1554): ingest_traces. Delegates to the shared codegraph surface handler.",
670
671
  schema: codegraphSurfaceSchema,
671
672
  handler: async (input, ctx) => {
672
- const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal);
673
+ const result = await ctx.service.codegraphTool(input, ctx.authenticatedPrincipal, ctx.sourceConnector);
673
674
  return { result };
674
675
  },
675
676
  });