@remnic/core 9.69.56 → 9.69.57

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 (2714) hide show
  1. package/dist/abort-error.d.ts +5 -6
  2. package/dist/abort-error.d.ts.map +1 -0
  3. package/dist/abstraction-nodes.d.ts +12 -13
  4. package/dist/abstraction-nodes.d.ts.map +1 -0
  5. package/dist/access-admin-ops-surface.d.ts +20 -153
  6. package/dist/access-admin-ops-surface.d.ts.map +1 -0
  7. package/dist/access-admin-ops-surface.js +65 -60
  8. package/dist/access-audit.d.ts +6 -10
  9. package/dist/access-audit.d.ts.map +1 -0
  10. package/dist/access-audit.js +2 -2
  11. package/dist/access-authorization-probe.d.ts +7 -152
  12. package/dist/access-authorization-probe.d.ts.map +1 -0
  13. package/dist/access-authorization-probe.js +66 -61
  14. package/dist/access-boundary.d.ts +156 -145
  15. package/dist/access-boundary.d.ts.map +1 -0
  16. package/dist/access-boundary.js +65 -60
  17. package/dist/access-citation-namespace.d.ts +3 -3
  18. package/dist/access-citation-namespace.d.ts.map +1 -0
  19. package/dist/access-citation.d.ts +6 -7
  20. package/dist/access-citation.d.ts.map +1 -0
  21. package/dist/access-cli.d.ts +7 -7
  22. package/dist/access-cli.d.ts.map +1 -0
  23. package/dist/access-cli.js +157 -152
  24. package/dist/access-cli.js.map +1 -1
  25. package/dist/access-coding-context-resolution.d.ts +4 -23
  26. package/dist/access-coding-context-resolution.d.ts.map +1 -0
  27. package/dist/access-errors.d.ts +57 -5
  28. package/dist/access-errors.d.ts.map +1 -0
  29. package/dist/access-errors.js +13 -3
  30. package/dist/access-extraction-force-flush.d.ts +5 -150
  31. package/dist/access-extraction-force-flush.d.ts.map +1 -0
  32. package/dist/access-extraction-force-flush.js +65 -60
  33. package/dist/access-health-types.d.ts +7 -30
  34. package/dist/access-health-types.d.ts.map +1 -0
  35. package/dist/access-http-briefing.d.ts +5 -150
  36. package/dist/access-http-briefing.d.ts.map +1 -0
  37. package/dist/access-http-briefing.js +66 -61
  38. package/dist/access-http-lcm-compaction.d.ts +12 -156
  39. package/dist/access-http-lcm-compaction.d.ts.map +1 -0
  40. package/dist/access-http-lifecycle-flush.d.ts +6 -150
  41. package/dist/access-http-lifecycle-flush.d.ts.map +1 -0
  42. package/dist/access-http-offline-stream.d.ts +6 -151
  43. package/dist/access-http-offline-stream.d.ts.map +1 -0
  44. package/dist/access-http-query.d.ts +6 -26
  45. package/dist/access-http-query.d.ts.map +1 -0
  46. package/dist/access-http-query.js +67 -62
  47. package/dist/access-http.d.ts +22 -189
  48. package/dist/access-http.d.ts.map +1 -0
  49. package/dist/access-http.js +93 -89
  50. package/dist/access-idempotency.d.ts +5 -5
  51. package/dist/access-idempotency.d.ts.map +1 -0
  52. package/dist/access-identity-continuity-surface.d.ts +4 -115
  53. package/dist/access-identity-continuity-surface.d.ts.map +1 -0
  54. package/dist/access-identity-continuity-surface.js +65 -60
  55. package/dist/access-lcm-surface.d.ts +5 -151
  56. package/dist/access-lcm-surface.d.ts.map +1 -0
  57. package/dist/access-lcm-surface.js +65 -60
  58. package/dist/access-mcp-admin-tools.d.ts +4 -5
  59. package/dist/access-mcp-admin-tools.d.ts.map +1 -0
  60. package/dist/access-mcp-output-schemas.d.ts +2 -3
  61. package/dist/access-mcp-output-schemas.d.ts.map +1 -0
  62. package/dist/access-mcp-output-schemas.js +1 -1
  63. package/dist/access-mcp-shared-context-tools.d.ts +3 -150
  64. package/dist/access-mcp-shared-context-tools.d.ts.map +1 -0
  65. package/dist/access-mcp-sse.d.ts +3 -5
  66. package/dist/access-mcp-sse.d.ts.map +1 -0
  67. package/dist/access-mcp-tool-names.d.ts +9 -10
  68. package/dist/access-mcp-tool-names.d.ts.map +1 -0
  69. package/dist/access-mcp.d.ts +178 -145
  70. package/dist/access-mcp.d.ts.map +1 -0
  71. package/dist/access-mcp.js +80 -76
  72. package/dist/access-memory-search-fanout.d.ts +18 -37
  73. package/dist/access-memory-search-fanout.d.ts.map +1 -0
  74. package/dist/access-memory-search-fanout.js +2 -2
  75. package/dist/access-namespace-preflight.d.ts +18 -22
  76. package/dist/access-namespace-preflight.d.ts.map +1 -0
  77. package/dist/access-namespace-preflight.js +65 -60
  78. package/dist/access-observe-helpers.d.ts +4 -5
  79. package/dist/access-observe-helpers.d.ts.map +1 -0
  80. package/dist/access-observe-transcript.d.ts +5 -115
  81. package/dist/access-observe-transcript.d.ts.map +1 -0
  82. package/dist/access-observe-write-category.d.ts +5 -42
  83. package/dist/access-observe-write-category.d.ts.map +1 -0
  84. package/dist/access-observe-write-category.js +7 -7
  85. package/dist/access-observe-write-surface.d.ts +6 -151
  86. package/dist/access-observe-write-surface.d.ts.map +1 -0
  87. package/dist/access-observe-write-surface.js +65 -60
  88. package/dist/access-offline-manifest.d.ts +10 -124
  89. package/dist/access-offline-manifest.d.ts.map +1 -0
  90. package/dist/access-offline-manifest.js +7 -7
  91. package/dist/access-operations-batch.d.ts +12 -2
  92. package/dist/access-operations-batch.d.ts.map +1 -0
  93. package/dist/access-operations-batch.js +69 -66
  94. package/dist/access-operations.d.ts +66 -188
  95. package/dist/access-operations.d.ts.map +1 -0
  96. package/dist/access-operations.js +76 -73
  97. package/dist/access-recall-concurrency.d.ts +11 -156
  98. package/dist/access-recall-concurrency.d.ts.map +1 -0
  99. package/dist/access-recall-concurrency.js +65 -60
  100. package/dist/access-recall-diagnostics.d.ts +64 -0
  101. package/dist/access-recall-diagnostics.d.ts.map +1 -0
  102. package/dist/access-recall-diagnostics.js +26 -0
  103. package/dist/access-recall-response.d.ts +7 -151
  104. package/dist/access-recall-response.d.ts.map +1 -0
  105. package/dist/access-recall-response.js +65 -60
  106. package/dist/access-recall-surface.d.ts +11 -152
  107. package/dist/access-recall-surface.d.ts.map +1 -0
  108. package/dist/access-recall-surface.js +65 -60
  109. package/dist/access-schema.d.ts +203 -221
  110. package/dist/access-schema.d.ts.map +1 -0
  111. package/dist/access-schema.js +3 -3
  112. package/dist/access-service-helpers.d.ts +33 -145
  113. package/dist/access-service-helpers.d.ts.map +1 -0
  114. package/dist/access-service.d.ts +1825 -145
  115. package/dist/access-service.d.ts.map +1 -0
  116. package/dist/access-service.js +65 -60
  117. package/dist/access-surface-catalog.d.ts +7 -154
  118. package/dist/access-surface-catalog.d.ts.map +1 -0
  119. package/dist/access-surface-catalog.js +69 -62
  120. package/dist/access-surface-catalog.js.map +1 -1
  121. package/dist/access-token-capabilities.d.ts +19 -22
  122. package/dist/access-token-capabilities.d.ts.map +1 -0
  123. package/dist/access-token-capabilities.js +2 -2
  124. package/dist/access-wearables-meetings-surface.d.ts +14 -54
  125. package/dist/access-wearables-meetings-surface.d.ts.map +1 -0
  126. package/dist/action-confidence.d.ts +19 -40
  127. package/dist/action-confidence.d.ts.map +1 -0
  128. package/dist/active-context-config.d.ts +7 -8
  129. package/dist/active-context-config.d.ts.map +1 -0
  130. package/dist/active-context-transform.d.ts +31 -33
  131. package/dist/active-context-transform.d.ts.map +1 -0
  132. package/dist/active-memory-bridge.d.ts +10 -28
  133. package/dist/active-memory-bridge.d.ts.map +1 -0
  134. package/dist/active-recall.d.ts +11 -30
  135. package/dist/active-recall.d.ts.map +1 -0
  136. package/dist/active-recall.js +23 -23
  137. package/dist/activity/config.d.ts +24 -0
  138. package/dist/activity/config.d.ts.map +1 -0
  139. package/dist/activity/digest.d.ts +15 -35
  140. package/dist/activity/digest.d.ts.map +1 -0
  141. package/dist/activity/dwell.d.ts +14 -0
  142. package/dist/activity/dwell.d.ts.map +1 -0
  143. package/dist/activity/from-ms.d.ts +7 -0
  144. package/dist/activity/from-ms.d.ts.map +1 -0
  145. package/dist/activity/heading-level.d.ts +15 -0
  146. package/dist/activity/heading-level.d.ts.map +1 -0
  147. package/dist/activity/heading-title.d.ts +15 -0
  148. package/dist/activity/heading-title.d.ts.map +1 -0
  149. package/dist/activity/index.d.ts +46 -0
  150. package/dist/activity/index.d.ts.map +1 -0
  151. package/dist/activity/journal-extract.d.ts +68 -0
  152. package/dist/activity/journal-extract.d.ts.map +1 -0
  153. package/dist/activity/journal-heading.d.ts +26 -0
  154. package/dist/activity/journal-heading.d.ts.map +1 -0
  155. package/dist/activity/journal-path.d.ts +9 -0
  156. package/dist/activity/journal-path.d.ts.map +1 -0
  157. package/dist/activity/journal-read.d.ts +31 -0
  158. package/dist/activity/journal-read.d.ts.map +1 -0
  159. package/dist/activity/journal-section.d.ts +17 -0
  160. package/dist/activity/journal-section.d.ts.map +1 -0
  161. package/dist/activity/journal-source.d.ts +25 -0
  162. package/dist/activity/journal-source.d.ts.map +1 -0
  163. package/dist/activity/journal-state.d.ts +21 -0
  164. package/dist/activity/journal-state.d.ts.map +1 -0
  165. package/dist/activity/journal-state.lock-worker.d.ts +2 -0
  166. package/dist/activity/journal-state.lock-worker.d.ts.map +1 -0
  167. package/dist/activity/journal-strip.d.ts +6 -0
  168. package/dist/activity/journal-strip.d.ts.map +1 -0
  169. package/dist/activity/journal-vault-prereq.d.ts +23 -0
  170. package/dist/activity/journal-vault-prereq.d.ts.map +1 -0
  171. package/dist/activity/journal-vault-provenance.d.ts +12 -0
  172. package/dist/activity/journal-vault-provenance.d.ts.map +1 -0
  173. package/dist/activity/journal-vault-read.d.ts +32 -0
  174. package/dist/activity/journal-vault-read.d.ts.map +1 -0
  175. package/dist/activity/journal.d.ts +29 -0
  176. package/dist/activity/journal.d.ts.map +1 -0
  177. package/dist/activity/memory-gen.d.ts +71 -0
  178. package/dist/activity/memory-gen.d.ts.map +1 -0
  179. package/dist/activity/pipeline.d.ts +44 -0
  180. package/dist/activity/pipeline.d.ts.map +1 -0
  181. package/dist/activity/privacy-delete-plan.d.ts +22 -0
  182. package/dist/activity/privacy-delete-plan.d.ts.map +1 -0
  183. package/dist/activity/privacy-enabled.d.ts +16 -0
  184. package/dist/activity/privacy-enabled.d.ts.map +1 -0
  185. package/dist/activity/privacy-gate-resolve.d.ts +17 -0
  186. package/dist/activity/privacy-gate-resolve.d.ts.map +1 -0
  187. package/dist/activity/privacy-keys.d.ts +8 -0
  188. package/dist/activity/privacy-keys.d.ts.map +1 -0
  189. package/dist/activity/privacy-redact.d.ts +13 -0
  190. package/dist/activity/privacy-redact.d.ts.map +1 -0
  191. package/dist/activity/privacy-status.d.ts +30 -0
  192. package/dist/activity/privacy-status.d.ts.map +1 -0
  193. package/dist/activity/privacy-window.d.ts +15 -0
  194. package/dist/activity/privacy-window.d.ts.map +1 -0
  195. package/dist/activity/privacy.d.ts +17 -0
  196. package/dist/activity/privacy.d.ts.map +1 -0
  197. package/dist/activity/reindex.d.ts +23 -0
  198. package/dist/activity/reindex.d.ts.map +1 -0
  199. package/dist/activity/retain-days.d.ts +8 -0
  200. package/dist/activity/retain-days.d.ts.map +1 -0
  201. package/dist/activity/runner.d.ts +100 -0
  202. package/dist/activity/runner.d.ts.map +1 -0
  203. package/dist/activity/scheduler.d.ts +90 -0
  204. package/dist/activity/scheduler.d.ts.map +1 -0
  205. package/dist/activity/source-client.d.ts +24 -0
  206. package/dist/activity/source-client.d.ts.map +1 -0
  207. package/dist/activity/store.d.ts +53 -0
  208. package/dist/activity/store.d.ts.map +1 -0
  209. package/dist/activity/sync-registration.d.ts +83 -0
  210. package/dist/activity/sync-registration.d.ts.map +1 -0
  211. package/dist/activity/timeline/analysis-batch-empty.d.ts +8 -0
  212. package/dist/activity/timeline/analysis-batch-empty.d.ts.map +1 -0
  213. package/dist/activity/timeline/analysis-batch.d.ts +12 -0
  214. package/dist/activity/timeline/analysis-batch.d.ts.map +1 -0
  215. package/dist/activity/timeline/analysis-claim.d.ts +14 -0
  216. package/dist/activity/timeline/analysis-claim.d.ts.map +1 -0
  217. package/dist/activity/timeline/analysis-dup.d.ts +8 -0
  218. package/dist/activity/timeline/analysis-dup.d.ts.map +1 -0
  219. package/dist/activity/timeline/analysis-empty.d.ts +8 -0
  220. package/dist/activity/timeline/analysis-empty.d.ts.map +1 -0
  221. package/dist/activity/timeline/analysis-evidence.d.ts +12 -0
  222. package/dist/activity/timeline/analysis-evidence.d.ts.map +1 -0
  223. package/dist/activity/timeline/analysis-failure.d.ts +19 -0
  224. package/dist/activity/timeline/analysis-failure.d.ts.map +1 -0
  225. package/dist/activity/timeline/analysis-max.d.ts +8 -0
  226. package/dist/activity/timeline/analysis-max.d.ts.map +1 -0
  227. package/dist/activity/timeline/analysis-metadata.d.ts +30 -0
  228. package/dist/activity/timeline/analysis-metadata.d.ts.map +1 -0
  229. package/dist/activity/timeline/analysis-order.d.ts +8 -0
  230. package/dist/activity/timeline/analysis-order.d.ts.map +1 -0
  231. package/dist/activity/timeline/analysis-overlap.d.ts +8 -0
  232. package/dist/activity/timeline/analysis-overlap.d.ts.map +1 -0
  233. package/dist/activity/timeline/analysis-prompt.d.ts +13 -0
  234. package/dist/activity/timeline/analysis-prompt.d.ts.map +1 -0
  235. package/dist/activity/timeline/analysis-provider.d.ts +84 -0
  236. package/dist/activity/timeline/analysis-provider.d.ts.map +1 -0
  237. package/dist/activity/timeline/analysis-run.d.ts +40 -0
  238. package/dist/activity/timeline/analysis-run.d.ts.map +1 -0
  239. package/dist/activity/timeline/analysis.d.ts +63 -0
  240. package/dist/activity/timeline/analysis.d.ts.map +1 -0
  241. package/dist/activity/timeline/build.d.ts +50 -0
  242. package/dist/activity/timeline/build.d.ts.map +1 -0
  243. package/dist/activity/timeline/categories.d.ts +27 -0
  244. package/dist/activity/timeline/categories.d.ts.map +1 -0
  245. package/dist/activity/timeline/classify.d.ts +20 -0
  246. package/dist/activity/timeline/classify.d.ts.map +1 -0
  247. package/dist/activity/timeline/corrections.d.ts +37 -0
  248. package/dist/activity/timeline/corrections.d.ts.map +1 -0
  249. package/dist/activity/timeline/index.d.ts +35 -0
  250. package/dist/activity/timeline/index.d.ts.map +1 -0
  251. package/dist/activity/timeline/journal-recap-persist.d.ts +14 -0
  252. package/dist/activity/timeline/journal-recap-persist.d.ts.map +1 -0
  253. package/dist/activity/timeline/journal-recap.d.ts +21 -0
  254. package/dist/activity/timeline/journal-recap.d.ts.map +1 -0
  255. package/dist/activity/timeline/publish-cli.d.ts +17 -0
  256. package/dist/activity/timeline/publish-cli.d.ts.map +1 -0
  257. package/dist/activity/timeline/query.d.ts +86 -0
  258. package/dist/activity/timeline/query.d.ts.map +1 -0
  259. package/dist/activity/timeline/recap-card-count.d.ts +7 -0
  260. package/dist/activity/timeline/recap-card-count.d.ts.map +1 -0
  261. package/dist/activity/timeline/recap-card-id.d.ts +14 -0
  262. package/dist/activity/timeline/recap-card-id.d.ts.map +1 -0
  263. package/dist/activity/timeline/recap-date.d.ts +15 -0
  264. package/dist/activity/timeline/recap-date.d.ts.map +1 -0
  265. package/dist/activity/timeline/recap-empty.d.ts +8 -0
  266. package/dist/activity/timeline/recap-empty.d.ts.map +1 -0
  267. package/dist/activity/timeline/recap-export-range.d.ts +55 -0
  268. package/dist/activity/timeline/recap-export-range.d.ts.map +1 -0
  269. package/dist/activity/timeline/recap-export.d.ts +48 -0
  270. package/dist/activity/timeline/recap-export.d.ts.map +1 -0
  271. package/dist/activity/timeline/recap-fallback.d.ts +47 -0
  272. package/dist/activity/timeline/recap-fallback.d.ts.map +1 -0
  273. package/dist/activity/timeline/recap-id.d.ts +8 -0
  274. package/dist/activity/timeline/recap-id.d.ts.map +1 -0
  275. package/dist/activity/timeline/recap-markdown.d.ts +15 -0
  276. package/dist/activity/timeline/recap-markdown.d.ts.map +1 -0
  277. package/dist/activity/timeline/recap-merge-edits.d.ts +24 -0
  278. package/dist/activity/timeline/recap-merge-edits.d.ts.map +1 -0
  279. package/dist/activity/timeline/recap-sort-key.d.ts +9 -0
  280. package/dist/activity/timeline/recap-sort-key.d.ts.map +1 -0
  281. package/dist/activity/timeline/recap-tz.d.ts +15 -0
  282. package/dist/activity/timeline/recap-tz.d.ts.map +1 -0
  283. package/dist/activity/timeline/recap-window.d.ts +19 -0
  284. package/dist/activity/timeline/recap-window.d.ts.map +1 -0
  285. package/dist/activity/timeline/regenerate.d.ts +84 -0
  286. package/dist/activity/timeline/regenerate.d.ts.map +1 -0
  287. package/dist/activity/timeline/types.d.ts +98 -0
  288. package/dist/activity/timeline/types.d.ts.map +1 -0
  289. package/dist/activity/timeline/week-config-hash.d.ts +13 -0
  290. package/dist/activity/timeline/week-config-hash.d.ts.map +1 -0
  291. package/dist/activity/timeline/week-count.d.ts +7 -0
  292. package/dist/activity/timeline/week-count.d.ts.map +1 -0
  293. package/dist/activity/timeline/week-dashboard.d.ts +79 -0
  294. package/dist/activity/timeline/week-dashboard.d.ts.map +1 -0
  295. package/dist/activity/timeline/week-days.d.ts +6 -0
  296. package/dist/activity/timeline/week-days.d.ts.map +1 -0
  297. package/dist/activity/timeline/week-export.d.ts +27 -0
  298. package/dist/activity/timeline/week-export.d.ts.map +1 -0
  299. package/dist/activity/timeline/week-iso.d.ts +16 -0
  300. package/dist/activity/timeline/week-iso.d.ts.map +1 -0
  301. package/dist/activity/timeline/week-monday.d.ts +3 -0
  302. package/dist/activity/timeline/week-monday.d.ts.map +1 -0
  303. package/dist/activity/timeline/week-previous.d.ts +39 -0
  304. package/dist/activity/timeline/week-previous.d.ts.map +1 -0
  305. package/dist/activity/timeline/week-range.d.ts +10 -0
  306. package/dist/activity/timeline/week-range.d.ts.map +1 -0
  307. package/dist/activity/timeline/week-recurring.d.ts +21 -0
  308. package/dist/activity/timeline/week-recurring.d.ts.map +1 -0
  309. package/dist/activity/timeline/week-snapshot.d.ts +17 -0
  310. package/dist/activity/timeline/week-snapshot.d.ts.map +1 -0
  311. package/dist/activity/timeline/week-span.d.ts +2 -0
  312. package/dist/activity/timeline/week-span.d.ts.map +1 -0
  313. package/dist/activity/timeline/week-sunday.d.ts +3 -0
  314. package/dist/activity/timeline/week-sunday.d.ts.map +1 -0
  315. package/dist/activity/timeline/weekly-persist.d.ts +18 -0
  316. package/dist/activity/timeline/weekly-persist.d.ts.map +1 -0
  317. package/dist/activity/timeline/weekly.d.ts +42 -0
  318. package/dist/activity/timeline/weekly.d.ts.map +1 -0
  319. package/dist/activity/to-ms.d.ts +7 -0
  320. package/dist/activity/to-ms.d.ts.map +1 -0
  321. package/dist/activity/types.d.ts +208 -0
  322. package/dist/activity/types.d.ts.map +1 -0
  323. package/dist/activity/vault-begin.d.ts +8 -0
  324. package/dist/activity/vault-begin.d.ts.map +1 -0
  325. package/dist/activity/vault-body-trim.d.ts +7 -0
  326. package/dist/activity/vault-body-trim.d.ts.map +1 -0
  327. package/dist/activity/vault-dry-run.d.ts +13 -0
  328. package/dist/activity/vault-dry-run.d.ts.map +1 -0
  329. package/dist/activity/vault-end.d.ts +8 -0
  330. package/dist/activity/vault-end.d.ts.map +1 -0
  331. package/dist/activity/vault-frontmatter.d.ts +41 -0
  332. package/dist/activity/vault-frontmatter.d.ts.map +1 -0
  333. package/dist/activity/vault-insert.d.ts +24 -0
  334. package/dist/activity/vault-insert.d.ts.map +1 -0
  335. package/dist/activity/vault-join.d.ts +2 -0
  336. package/dist/activity/vault-join.d.ts.map +1 -0
  337. package/dist/activity/vault-marker.d.ts +12 -0
  338. package/dist/activity/vault-marker.d.ts.map +1 -0
  339. package/dist/activity/vault-name-trim.d.ts +7 -0
  340. package/dist/activity/vault-name-trim.d.ts.map +1 -0
  341. package/dist/activity/vault-path.d.ts +20 -0
  342. package/dist/activity/vault-path.d.ts.map +1 -0
  343. package/dist/activity/vault-publish.d.ts +71 -0
  344. package/dist/activity/vault-publish.d.ts.map +1 -0
  345. package/dist/activity/vault-publisher.d.ts +58 -0
  346. package/dist/activity/vault-publisher.d.ts.map +1 -0
  347. package/dist/activity/vault-region-pair.d.ts +17 -0
  348. package/dist/activity/vault-region-pair.d.ts.map +1 -0
  349. package/dist/activity/vault-region.d.ts +24 -0
  350. package/dist/activity/vault-region.d.ts.map +1 -0
  351. package/dist/activity/vault-status.d.ts +32 -0
  352. package/dist/activity/vault-status.d.ts.map +1 -0
  353. package/dist/activity/vault-suffix.d.ts +7 -0
  354. package/dist/activity/vault-suffix.d.ts.map +1 -0
  355. package/dist/activity/vault-wikilink.d.ts +2 -0
  356. package/dist/activity/vault-wikilink.d.ts.map +1 -0
  357. package/dist/activity/window-order.d.ts +17 -0
  358. package/dist/activity/window-order.d.ts.map +1 -0
  359. package/dist/adapters/claude-code.d.ts +3 -5
  360. package/dist/adapters/claude-code.d.ts.map +1 -0
  361. package/dist/adapters/codex.d.ts +3 -5
  362. package/dist/adapters/codex.d.ts.map +1 -0
  363. package/dist/adapters/grok.d.ts +23 -0
  364. package/dist/adapters/grok.d.ts.map +1 -0
  365. package/dist/adapters/hermes.d.ts +3 -5
  366. package/dist/adapters/hermes.d.ts.map +1 -0
  367. package/dist/adapters/index.d.ts +9 -51
  368. package/dist/adapters/index.d.ts.map +1 -0
  369. package/dist/adapters/index.js +4 -4
  370. package/dist/adapters/opencode.d.ts +22 -0
  371. package/dist/adapters/opencode.d.ts.map +1 -0
  372. package/dist/adapters/registry.d.ts +3 -5
  373. package/dist/adapters/registry.d.ts.map +1 -0
  374. package/dist/adapters/registry.js +2 -2
  375. package/dist/adapters/replit.d.ts +3 -5
  376. package/dist/adapters/replit.d.ts.map +1 -0
  377. package/dist/adapters/types.d.ts +5 -6
  378. package/dist/adapters/types.d.ts.map +1 -0
  379. package/dist/admin/admin-surfaces.d.ts +362 -0
  380. package/dist/admin/admin-surfaces.d.ts.map +1 -0
  381. package/dist/ambient-provenance.d.ts +10 -30
  382. package/dist/ambient-provenance.d.ts.map +1 -0
  383. package/dist/archive-mutation-version.d.ts +8 -9
  384. package/dist/archive-mutation-version.d.ts.map +1 -0
  385. package/dist/artifact-search.d.ts +5 -25
  386. package/dist/artifact-search.d.ts.map +1 -0
  387. package/dist/auto-sync-CWSZDLLW.js +1 -1
  388. package/dist/background-generation-config.d.ts +3 -4
  389. package/dist/background-generation-config.d.ts.map +1 -0
  390. package/dist/background-generation.d.ts +5 -24
  391. package/dist/background-generation.d.ts.map +1 -0
  392. package/dist/behavior-learner.d.ts +6 -25
  393. package/dist/behavior-learner.d.ts.map +1 -0
  394. package/dist/behavior-signals.d.ts +5 -24
  395. package/dist/behavior-signals.d.ts.map +1 -0
  396. package/dist/binary-lifecycle/backend.d.ts +46 -0
  397. package/dist/binary-lifecycle/backend.d.ts.map +1 -0
  398. package/dist/binary-lifecycle/index.d.ts +13 -0
  399. package/dist/binary-lifecycle/index.d.ts.map +1 -0
  400. package/dist/binary-lifecycle/manifest.d.ts +22 -0
  401. package/dist/binary-lifecycle/manifest.d.ts.map +1 -0
  402. package/dist/binary-lifecycle/pipeline.d.ts +33 -0
  403. package/dist/binary-lifecycle/pipeline.d.ts.map +1 -0
  404. package/dist/binary-lifecycle/scanner.d.ts +21 -0
  405. package/dist/binary-lifecycle/scanner.d.ts.map +1 -0
  406. package/dist/binary-lifecycle/types.d.ts +70 -0
  407. package/dist/binary-lifecycle/types.d.ts.map +1 -0
  408. package/dist/bootstrap.d.ts +6 -115
  409. package/dist/bootstrap.d.ts.map +1 -0
  410. package/dist/bounded-jsonl-state.d.ts +5 -5
  411. package/dist/bounded-jsonl-state.d.ts.map +1 -0
  412. package/dist/boxes.d.ts +9 -9
  413. package/dist/boxes.d.ts.map +1 -0
  414. package/dist/briefing-window.d.ts +8 -40
  415. package/dist/briefing-window.d.ts.map +1 -0
  416. package/dist/briefing.d.ts +28 -61
  417. package/dist/briefing.d.ts.map +1 -0
  418. package/dist/briefing.js +14 -14
  419. package/dist/buffer-surprise-report.d.ts +6 -26
  420. package/dist/buffer-surprise-report.d.ts.map +1 -0
  421. package/dist/buffer-surprise.d.ts +5 -6
  422. package/dist/buffer-surprise.d.ts.map +1 -0
  423. package/dist/buffer-turn-helpers.d.ts +32 -18
  424. package/dist/buffer-turn-helpers.d.ts.map +1 -0
  425. package/dist/buffer.d.ts +9 -41
  426. package/dist/buffer.d.ts.map +1 -0
  427. package/dist/buffer.js +3 -3
  428. package/dist/bulk-import/index.d.ts +4 -44
  429. package/dist/bulk-import/index.d.ts.map +1 -0
  430. package/dist/bulk-import/pipeline.d.ts +30 -0
  431. package/dist/bulk-import/pipeline.d.ts.map +1 -0
  432. package/dist/bulk-import/registry.d.ts +23 -0
  433. package/dist/bulk-import/registry.d.ts.map +1 -0
  434. package/dist/bulk-import/types.d.ts +83 -0
  435. package/dist/bulk-import/types.d.ts.map +1 -0
  436. package/dist/calibration.d.ts +14 -37
  437. package/dist/calibration.d.ts.map +1 -0
  438. package/dist/capabilities.d.ts +64 -84
  439. package/dist/capabilities.d.ts.map +1 -0
  440. package/dist/capsule-cli.d.ts +23 -24
  441. package/dist/capsule-cli.d.ts.map +1 -0
  442. package/dist/capsule-crypto-7FJQINUR.js +18 -0
  443. package/dist/causal-behavior.d.ts +9 -38
  444. package/dist/causal-behavior.d.ts.map +1 -0
  445. package/dist/causal-behavior.js +2 -2
  446. package/dist/causal-chain.d.ts +13 -17
  447. package/dist/causal-chain.d.ts.map +1 -0
  448. package/dist/causal-chain.js +2 -2
  449. package/dist/causal-consolidation.d.ts +10 -29
  450. package/dist/causal-consolidation.d.ts.map +1 -0
  451. package/dist/causal-consolidation.js +17 -17
  452. package/dist/causal-retrieval.d.ts +6 -11
  453. package/dist/causal-retrieval.d.ts.map +1 -0
  454. package/dist/causal-retrieval.js +2 -2
  455. package/dist/causal-trajectory-graph.d.ts +7 -29
  456. package/dist/causal-trajectory-graph.d.ts.map +1 -0
  457. package/dist/causal-trajectory-graph.js +2 -2
  458. package/dist/causal-trajectory.d.ts +23 -25
  459. package/dist/causal-trajectory.d.ts.map +1 -0
  460. package/dist/causal-trajectory.js +1 -1
  461. package/dist/census-validation.d.ts +5 -6
  462. package/dist/census-validation.d.ts.map +1 -0
  463. package/dist/chat/chat-cli.d.ts +38 -0
  464. package/dist/chat/chat-cli.d.ts.map +1 -0
  465. package/dist/chat/chat-config.d.ts +25 -0
  466. package/dist/chat/chat-config.d.ts.map +1 -0
  467. package/dist/chat/chat-engine.d.ts +82 -0
  468. package/dist/chat/chat-engine.d.ts.map +1 -0
  469. package/dist/chat/chat-executor.d.ts +26 -0
  470. package/dist/chat/chat-executor.d.ts.map +1 -0
  471. package/dist/chat/chat-factory.d.ts +46 -0
  472. package/dist/chat/chat-factory.d.ts.map +1 -0
  473. package/dist/chat/chat-http.d.ts +83 -0
  474. package/dist/chat/chat-http.d.ts.map +1 -0
  475. package/dist/chat/chat-llm.d.ts +77 -0
  476. package/dist/chat/chat-llm.d.ts.map +1 -0
  477. package/dist/chat/chat-session.d.ts +118 -0
  478. package/dist/chat/chat-session.d.ts.map +1 -0
  479. package/dist/chat/chat-system-prompt.d.ts +23 -0
  480. package/dist/chat/chat-system-prompt.d.ts.map +1 -0
  481. package/dist/chat/chat-tools.d.ts +22 -0
  482. package/dist/chat/chat-tools.d.ts.map +1 -0
  483. package/dist/chat/chat-types.d.ts +134 -0
  484. package/dist/chat/chat-types.d.ts.map +1 -0
  485. package/dist/chunk-2CBWEIS4.js +1286 -0
  486. package/dist/chunk-2JQZSQXI.js +81 -0
  487. package/dist/chunk-2KHIBLO5.js +33 -0
  488. package/dist/chunk-2KHIBLO5.js.map +1 -0
  489. package/dist/chunk-2NLLXCJG.js +112 -0
  490. package/dist/chunk-2WMXZYMS.js +25 -0
  491. package/dist/chunk-34ZGBAGE.js +61 -0
  492. package/dist/chunk-36S7UHAW.js +623 -0
  493. package/dist/chunk-3JLWSFTV.js +801 -0
  494. package/dist/chunk-3MUKQQ7A.js +157 -0
  495. package/dist/chunk-3MUKQQ7A.js.map +1 -0
  496. package/dist/chunk-3RZOLUZT.js +140 -0
  497. package/dist/chunk-3SL52JKD.js +160 -0
  498. package/dist/chunk-4ALOINQ4.js +18512 -0
  499. package/dist/chunk-4ALOINQ4.js.map +1 -0
  500. package/dist/chunk-4QEZS7PK.js +502 -0
  501. package/dist/chunk-52VL6LCY.js +648 -0
  502. package/dist/chunk-52VL6LCY.js.map +1 -0
  503. package/dist/chunk-5HFVWYHL.js +111 -0
  504. package/dist/chunk-5HFVWYHL.js.map +1 -0
  505. package/dist/chunk-5QRYGLZN.js +35 -0
  506. package/dist/chunk-5R3C5LEZ.js +263 -0
  507. package/dist/chunk-634UKELB.js +77 -0
  508. package/dist/chunk-64JK4TL7.js +801 -0
  509. package/dist/chunk-6E5GYDIE.js +141 -0
  510. package/dist/chunk-6ISP2EN2.js +51 -0
  511. package/dist/chunk-6RD7MSIO.js +212 -0
  512. package/dist/chunk-6UDLN4IA.js +70 -0
  513. package/dist/chunk-754XN6LX.js +256 -0
  514. package/dist/chunk-7H2LEYYJ.js +256 -0
  515. package/dist/chunk-A7AISUJI.js +103 -0
  516. package/dist/chunk-AULKCNZW.js +727 -0
  517. package/dist/chunk-B7SSU55V.js +1686 -0
  518. package/dist/chunk-BICNRVEC.js +224 -0
  519. package/dist/chunk-BJI2D4SU.js +53 -0
  520. package/dist/chunk-BQB5ZMYO.js +28 -0
  521. package/dist/chunk-BSDBDFKZ.js +168 -0
  522. package/dist/chunk-BSDBDFKZ.js.map +1 -0
  523. package/dist/chunk-C5CPYMLX.js +315 -0
  524. package/dist/chunk-C6LRFPZL.js +4007 -0
  525. package/dist/chunk-C6LRFPZL.js.map +1 -0
  526. package/dist/chunk-CS2JO77A.js +95 -0
  527. package/dist/chunk-DTABICJ3.js +549 -0
  528. package/dist/chunk-DXODYQ7J.js +319 -0
  529. package/dist/chunk-DXODYQ7J.js.map +1 -0
  530. package/dist/chunk-E6UNM67F.js +432 -0
  531. package/dist/chunk-ENUI3IO7.js +271 -0
  532. package/dist/chunk-FF2XYADH.js +1084 -0
  533. package/dist/chunk-FF6N7BXC.js +389 -0
  534. package/dist/chunk-FNQEXI3D.js +22 -0
  535. package/dist/chunk-FNQEXI3D.js.map +1 -0
  536. package/dist/chunk-FSXD6Y4H.js +203 -0
  537. package/dist/chunk-GK6NOQE6.js +3400 -0
  538. package/dist/chunk-GRSFFLUY.js +43 -0
  539. package/dist/chunk-GWK7FEUL.js +761 -0
  540. package/dist/chunk-GWQVMKUJ.js +218 -0
  541. package/dist/chunk-H7O5L2IQ.js +3560 -0
  542. package/dist/chunk-H7O5L2IQ.js.map +1 -0
  543. package/dist/chunk-HKHZWJ3E.js +63 -0
  544. package/dist/chunk-IAZPYX6W.js +182 -0
  545. package/dist/chunk-IG747LRN.js +189 -0
  546. package/dist/chunk-IK63WA5A.js +30 -0
  547. package/dist/chunk-IRGQYQQ7.js +143 -0
  548. package/dist/chunk-IRGQYQQ7.js.map +1 -0
  549. package/dist/chunk-IUD6NLNM.js +24 -0
  550. package/dist/chunk-JSJZ2NXS.js +9782 -0
  551. package/dist/chunk-JUOJGZPV.js +566 -0
  552. package/dist/chunk-KA4U5GQN.js +960 -0
  553. package/dist/chunk-KQAFEZQX.js +264 -0
  554. package/dist/chunk-L4WBADKG.js +72 -0
  555. package/dist/chunk-LAL4B37X.js +275 -0
  556. package/dist/chunk-LELJRLPY.js +253 -0
  557. package/dist/chunk-LMMQKZK3.js +403 -0
  558. package/dist/chunk-LQ23DMTT.js +74 -0
  559. package/dist/chunk-LV6ZB6CA.js +285 -0
  560. package/dist/chunk-M5IJP3YW.js +5505 -0
  561. package/dist/chunk-MMMYRC7Q.js +606 -0
  562. package/dist/chunk-MMMYRC7Q.js.map +1 -0
  563. package/dist/chunk-MWZMVLXL.js +415 -0
  564. package/dist/chunk-MZUQVWVC.js +72 -0
  565. package/dist/chunk-MZUQVWVC.js.map +1 -0
  566. package/dist/chunk-N4VCHRLD.js +29 -0
  567. package/dist/chunk-NKXHCCLB.js +879 -0
  568. package/dist/chunk-NVCWA4QC.js +112 -0
  569. package/dist/chunk-ONWVMYHX.js +122 -0
  570. package/dist/chunk-P6P35FY4.js +54 -0
  571. package/dist/chunk-P7M22CYB.js +346 -0
  572. package/dist/chunk-QMWKENNK.js +111 -0
  573. package/dist/chunk-QOPB6KE3.js +1530 -0
  574. package/dist/chunk-RBULO7DO.js +223 -0
  575. package/dist/chunk-RDESQOEE.js +1008 -0
  576. package/dist/chunk-RMF763SX.js +115 -0
  577. package/dist/chunk-RN6ZCNM5.js +321 -0
  578. package/dist/chunk-S2OBXHMN.js +11341 -0
  579. package/dist/chunk-S3JPD4N7.js +216 -0
  580. package/dist/chunk-SF6RFI5Z.js +165 -0
  581. package/dist/chunk-SJV3AOZ2.js +2453 -0
  582. package/dist/chunk-SLULR4GC.js +202 -0
  583. package/dist/chunk-TFXXMTHV.js +1476 -0
  584. package/dist/chunk-TYP7GYRI.js +216 -0
  585. package/dist/chunk-TYZK56OA.js +2440 -0
  586. package/dist/chunk-VLDVNZQE.js +921 -0
  587. package/dist/chunk-W6YK672C.js +511 -0
  588. package/dist/chunk-X2NFFBTO.js +576 -0
  589. package/dist/chunk-X45KZOT2.js +1917 -0
  590. package/dist/chunk-X7Y7WX73.js +249 -0
  591. package/dist/chunk-XIXM6G7I.js +43 -0
  592. package/dist/chunk-XLXYARWC.js +210 -0
  593. package/dist/chunk-XVW52M6I.js +223 -0
  594. package/dist/chunk-YHU5XUF4.js +342 -0
  595. package/dist/chunk-YRH3C2OJ.js +73 -0
  596. package/dist/chunk-YXQE67A7.js +137 -0
  597. package/dist/chunk-ZHUVMSHI.js +731 -0
  598. package/dist/chunk-ZHXSOMYH.js +297 -0
  599. package/dist/chunk-ZIEZJMFW.js +768 -0
  600. package/dist/chunk-ZMT4ZVJU.js +31013 -0
  601. package/dist/chunk-ZMT4ZVJU.js.map +1 -0
  602. package/dist/chunk-ZOASYXBS.js +629 -0
  603. package/dist/chunk-ZOASYXBS.js.map +1 -0
  604. package/dist/chunk-ZSEFGDCI.js +98 -0
  605. package/dist/chunk-ZX5N5D6M.js +65 -0
  606. package/dist/chunking.d.ts +9 -10
  607. package/dist/chunking.d.ts.map +1 -0
  608. package/dist/citations.d.ts +8 -9
  609. package/dist/citations.d.ts.map +1 -0
  610. package/dist/cli/creation-ledger-commands.d.ts +24 -0
  611. package/dist/cli/creation-ledger-commands.d.ts.map +1 -0
  612. package/dist/cli/deep-recall-commands.d.ts +19 -0
  613. package/dist/cli/deep-recall-commands.d.ts.map +1 -0
  614. package/dist/cli/harmonic-search.d.ts +12 -0
  615. package/dist/cli/harmonic-search.d.ts.map +1 -0
  616. package/dist/cli/meetings-commands.d.ts +16 -0
  617. package/dist/cli/meetings-commands.d.ts.map +1 -0
  618. package/dist/cli/memory-browse-commands.d.ts +11 -0
  619. package/dist/cli/memory-browse-commands.d.ts.map +1 -0
  620. package/dist/cli/okf-commands.d.ts +5 -0
  621. package/dist/cli/okf-commands.d.ts.map +1 -0
  622. package/dist/cli/recall-navigation-commands.d.ts +11 -0
  623. package/dist/cli/recall-navigation-commands.d.ts.map +1 -0
  624. package/dist/cli/research-status-commands.d.ts +26 -0
  625. package/dist/cli/research-status-commands.d.ts.map +1 -0
  626. package/dist/cli/skills-commands.d.ts +14 -0
  627. package/dist/cli/skills-commands.d.ts.map +1 -0
  628. package/dist/cli/timeline-publish-commands.d.ts +11 -0
  629. package/dist/cli/timeline-publish-commands.d.ts.map +1 -0
  630. package/dist/cli-fallback.d.ts +13 -14
  631. package/dist/cli-fallback.d.ts.map +1 -0
  632. package/dist/cli.d.ts +1036 -165
  633. package/dist/cli.d.ts.map +1 -0
  634. package/dist/cli.js +120 -116
  635. package/dist/coding/action-gate.d.ts +176 -0
  636. package/dist/coding/action-gate.d.ts.map +1 -0
  637. package/dist/coding/architecture-card.d.ts +135 -0
  638. package/dist/coding/architecture-card.d.ts.map +1 -0
  639. package/dist/coding/architecture-surfaces.d.ts +166 -0
  640. package/dist/coding/architecture-surfaces.d.ts.map +1 -0
  641. package/dist/coding/codegraph-runtime.d.ts +321 -0
  642. package/dist/coding/codegraph-runtime.d.ts.map +1 -0
  643. package/dist/coding/codegraph-surfaces.d.ts +191 -0
  644. package/dist/coding/codegraph-surfaces.d.ts.map +1 -0
  645. package/dist/coding/coding-graph-types.d.ts +16 -17
  646. package/dist/coding/coding-graph-types.d.ts.map +1 -0
  647. package/dist/coding/coding-knowledge-config.d.ts +69 -0
  648. package/dist/coding/coding-knowledge-config.d.ts.map +1 -0
  649. package/dist/coding/coding-namespace.d.ts +214 -0
  650. package/dist/coding/coding-namespace.d.ts.map +1 -0
  651. package/dist/coding/decision-records.d.ts +120 -0
  652. package/dist/coding/decision-records.d.ts.map +1 -0
  653. package/dist/coding/decision-surfaces.d.ts +143 -0
  654. package/dist/coding/decision-surfaces.d.ts.map +1 -0
  655. package/dist/coding/export-okf-codegraph.d.ts +9 -28
  656. package/dist/coding/export-okf-codegraph.d.ts.map +1 -0
  657. package/dist/coding/export-okf-codegraph.js +13 -13
  658. package/dist/coding/git-context.d.ts +92 -0
  659. package/dist/coding/git-context.d.ts.map +1 -0
  660. package/dist/coding/optional-coding-graph.d.ts +9 -10
  661. package/dist/coding/optional-coding-graph.d.ts.map +1 -0
  662. package/dist/coding/pre-action-gate.d.ts +58 -18
  663. package/dist/coding/pre-action-gate.d.ts.map +1 -0
  664. package/dist/coding/pre-action-gate.js +2 -2
  665. package/dist/coding/review-context.d.ts +147 -0
  666. package/dist/coding/review-context.d.ts.map +1 -0
  667. package/dist/coding/session-delta-surfaces.d.ts +138 -0
  668. package/dist/coding/session-delta-surfaces.d.ts.map +1 -0
  669. package/dist/coding/session-delta.d.ts +201 -0
  670. package/dist/coding/session-delta.d.ts.map +1 -0
  671. package/dist/coding/structural-context.d.ts +194 -0
  672. package/dist/coding/structural-context.d.ts.map +1 -0
  673. package/dist/coding/structural-subprocess-provider.d.ts +50 -0
  674. package/dist/coding/structural-subprocess-provider.d.ts.map +1 -0
  675. package/dist/commitment-ledger.d.ts +13 -14
  676. package/dist/commitment-ledger.d.ts.map +1 -0
  677. package/dist/compat/checks.d.ts +3 -5
  678. package/dist/compat/checks.d.ts.map +1 -0
  679. package/dist/compat/codex-cli-fallback.d.ts +15 -1
  680. package/dist/compat/codex-cli-fallback.d.ts.map +1 -0
  681. package/dist/compat/codex-thread-key.d.ts +15 -1
  682. package/dist/compat/codex-thread-key.d.ts.map +1 -0
  683. package/dist/compat/types.d.ts +7 -8
  684. package/dist/compat/types.d.ts.map +1 -0
  685. package/dist/compounding/engine.d.ts +11 -44
  686. package/dist/compounding/engine.d.ts.map +1 -0
  687. package/dist/compounding/engine.js +14 -14
  688. package/dist/compounding/preference-consolidator.d.ts +10 -37
  689. package/dist/compounding/preference-consolidator.d.ts.map +1 -0
  690. package/dist/compression-optimizer.d.ts +10 -29
  691. package/dist/compression-optimizer.d.ts.map +1 -0
  692. package/dist/config-discovery.d.ts +4 -5
  693. package/dist/config-discovery.d.ts.map +1 -0
  694. package/dist/config-qmd.d.ts +7 -8
  695. package/dist/config-qmd.d.ts.map +1 -0
  696. package/dist/config-record.d.ts +2 -3
  697. package/dist/config-record.d.ts.map +1 -0
  698. package/dist/config-security.d.ts +2 -3
  699. package/dist/config-security.d.ts.map +1 -0
  700. package/dist/config.d.ts +7 -26
  701. package/dist/config.d.ts.map +1 -0
  702. package/dist/config.js +23 -23
  703. package/dist/connectors/codex-marketplace.d.ts +124 -0
  704. package/dist/connectors/codex-marketplace.d.ts.map +1 -0
  705. package/dist/connectors/codex-materialize-runner.d.ts +7 -27
  706. package/dist/connectors/codex-materialize-runner.d.ts.map +1 -0
  707. package/dist/connectors/codex-materialize-runner.js +14 -14
  708. package/dist/connectors/codex-materialize.d.ts +23 -41
  709. package/dist/connectors/codex-materialize.d.ts.map +1 -0
  710. package/dist/connectors/coerce.d.ts +73 -0
  711. package/dist/connectors/coerce.d.ts.map +1 -0
  712. package/dist/connectors/droid-mcp.d.ts +122 -0
  713. package/dist/connectors/droid-mcp.d.ts.map +1 -0
  714. package/dist/connectors/hermes-shim.d.ts +135 -0
  715. package/dist/connectors/hermes-shim.d.ts.map +1 -0
  716. package/dist/connectors/index.d.ts +42 -247
  717. package/dist/connectors/index.d.ts.map +1 -0
  718. package/dist/connectors/index.js +20 -20
  719. package/dist/connectors/label.d.ts +19 -0
  720. package/dist/connectors/label.d.ts.map +1 -0
  721. package/dist/connectors/live/framework.d.ts +169 -0
  722. package/dist/connectors/live/framework.d.ts.map +1 -0
  723. package/dist/connectors/live/github.d.ts +156 -0
  724. package/dist/connectors/live/github.d.ts.map +1 -0
  725. package/dist/connectors/live/gmail.d.ts +253 -0
  726. package/dist/connectors/live/gmail.d.ts.map +1 -0
  727. package/dist/connectors/live/google-drive.d.ts +198 -0
  728. package/dist/connectors/live/google-drive.d.ts.map +1 -0
  729. package/dist/connectors/live/index.d.ts +20 -0
  730. package/dist/connectors/live/index.d.ts.map +1 -0
  731. package/dist/connectors/live/notion.d.ts +146 -0
  732. package/dist/connectors/live/notion.d.ts.map +1 -0
  733. package/dist/connectors/live/registry.d.ts +53 -0
  734. package/dist/connectors/live/registry.d.ts.map +1 -0
  735. package/dist/connectors/live/state-store.d.ts +120 -0
  736. package/dist/connectors/live/state-store.d.ts.map +1 -0
  737. package/dist/connectors/live/transient-errors.d.ts +45 -0
  738. package/dist/connectors/live/transient-errors.d.ts.map +1 -0
  739. package/dist/connectors/materialize-paths.d.ts +15 -0
  740. package/dist/connectors/materialize-paths.d.ts.map +1 -0
  741. package/dist/connectors/materialize-skills.d.ts +52 -0
  742. package/dist/connectors/materialize-skills.d.ts.map +1 -0
  743. package/dist/connectors/paths.d.ts +78 -0
  744. package/dist/connectors/paths.d.ts.map +1 -0
  745. package/dist/connectors/prime-agent.d.ts +13 -0
  746. package/dist/connectors/prime-agent.d.ts.map +1 -0
  747. package/dist/connectors-cli.d.ts +170 -2
  748. package/dist/connectors-cli.d.ts.map +1 -0
  749. package/dist/console/state.d.ts +154 -0
  750. package/dist/console/state.d.ts.map +1 -0
  751. package/dist/console/trace.d.ts +199 -0
  752. package/dist/console/trace.d.ts.map +1 -0
  753. package/dist/console/tui.d.ts +106 -0
  754. package/dist/console/tui.d.ts.map +1 -0
  755. package/dist/consolidation-operator.d.ts +8 -9
  756. package/dist/consolidation-operator.d.ts.map +1 -0
  757. package/dist/consolidation-provenance-check.d.ts +5 -40
  758. package/dist/consolidation-provenance-check.d.ts.map +1 -0
  759. package/dist/consolidation-undo.d.ts +10 -44
  760. package/dist/consolidation-undo.d.ts.map +1 -0
  761. package/dist/content-hash.d.ts +6 -7
  762. package/dist/content-hash.d.ts.map +1 -0
  763. package/dist/context-summary.d.ts +8 -9
  764. package/dist/context-summary.d.ts.map +1 -0
  765. package/dist/contradiction/contradiction-judge.d.ts +65 -0
  766. package/dist/contradiction/contradiction-judge.d.ts.map +1 -0
  767. package/dist/contradiction/contradiction-review.d.ts +117 -0
  768. package/dist/contradiction/contradiction-review.d.ts.map +1 -0
  769. package/dist/contradiction/contradiction-scan.d.ts +74 -0
  770. package/dist/contradiction/contradiction-scan.d.ts.map +1 -0
  771. package/dist/contradiction/index.d.ts +12 -41
  772. package/dist/contradiction/index.d.ts.map +1 -0
  773. package/dist/contradiction/index.js +11 -11
  774. package/dist/contradiction/resolution.d.ts +57 -0
  775. package/dist/contradiction/resolution.d.ts.map +1 -0
  776. package/dist/contradiction-config.d.ts +5 -6
  777. package/dist/contradiction-config.d.ts.map +1 -0
  778. package/dist/converge-config.d.ts +9 -28
  779. package/dist/converge-config.d.ts.map +1 -0
  780. package/dist/convergence-refresh.d.ts +5 -40
  781. package/dist/convergence-refresh.d.ts.map +1 -0
  782. package/dist/convergence-refresh.js +16 -16
  783. package/dist/conversation-index/backend.d.ts +12 -31
  784. package/dist/conversation-index/backend.d.ts.map +1 -0
  785. package/dist/conversation-index/chunker.d.ts +4 -23
  786. package/dist/conversation-index/chunker.d.ts.map +1 -0
  787. package/dist/conversation-index/cleanup.d.ts +2 -3
  788. package/dist/conversation-index/cleanup.d.ts.map +1 -0
  789. package/dist/conversation-index/faiss-adapter.d.ts +63 -22
  790. package/dist/conversation-index/faiss-adapter.d.ts.map +1 -0
  791. package/dist/conversation-index/indexer.d.ts +9 -31
  792. package/dist/conversation-index/indexer.d.ts.map +1 -0
  793. package/dist/conversation-index/search.d.ts +10 -22
  794. package/dist/conversation-index/search.d.ts.map +1 -0
  795. package/dist/corpus-read-cancellation.d.ts +3 -4
  796. package/dist/corpus-read-cancellation.d.ts.map +1 -0
  797. package/dist/corpus-watermark.d.ts +19 -40
  798. package/dist/corpus-watermark.d.ts.map +1 -0
  799. package/dist/corpus-watermark.js +18 -18
  800. package/dist/correction/correction-access-wiring.d.ts +129 -0
  801. package/dist/correction/correction-access-wiring.d.ts.map +1 -0
  802. package/dist/correction/correction-contract.d.ts +220 -0
  803. package/dist/correction/correction-contract.d.ts.map +1 -0
  804. package/dist/correction/correction-executor.d.ts +174 -0
  805. package/dist/correction/correction-executor.d.ts.map +1 -0
  806. package/dist/correction/correction-planner.d.ts +162 -0
  807. package/dist/correction/correction-planner.d.ts.map +1 -0
  808. package/dist/correction/correction-service.d.ts +124 -0
  809. package/dist/correction/correction-service.d.ts.map +1 -0
  810. package/dist/correction/index.d.ts +23 -0
  811. package/dist/correction/index.d.ts.map +1 -0
  812. package/dist/correction/passive-capture.d.ts +107 -0
  813. package/dist/correction/passive-capture.d.ts.map +1 -0
  814. package/dist/correction/passive-correction-detector.d.ts +60 -0
  815. package/dist/correction/passive-correction-detector.d.ts.map +1 -0
  816. package/dist/correction/passive-correction-notifications.d.ts +36 -0
  817. package/dist/correction/passive-correction-notifications.d.ts.map +1 -0
  818. package/dist/cross-lingual-recall.d.ts +10 -29
  819. package/dist/cross-lingual-recall.d.ts.map +1 -0
  820. package/dist/cross-namespace-budget.d.ts +9 -10
  821. package/dist/cross-namespace-budget.d.ts.map +1 -0
  822. package/dist/cue-anchors.d.ts +11 -12
  823. package/dist/cue-anchors.d.ts.map +1 -0
  824. package/dist/curation/index.d.ts +98 -0
  825. package/dist/curation/index.d.ts.map +1 -0
  826. package/dist/dashboard-runtime.d.ts +4 -5
  827. package/dist/dashboard-runtime.d.ts.map +1 -0
  828. package/dist/day-summary.d.ts +5 -24
  829. package/dist/day-summary.d.ts.map +1 -0
  830. package/dist/dedup/connector-scope.d.ts +28 -0
  831. package/dist/dedup/connector-scope.d.ts.map +1 -0
  832. package/dist/dedup/index.d.ts +78 -0
  833. package/dist/dedup/index.d.ts.map +1 -0
  834. package/dist/dedup/merge-content.d.ts +24 -0
  835. package/dist/dedup/merge-content.d.ts.map +1 -0
  836. package/dist/dedup/merge-count.d.ts +7 -0
  837. package/dist/dedup/merge-count.d.ts.map +1 -0
  838. package/dist/dedup/merge-decision.d.ts +26 -0
  839. package/dist/dedup/merge-decision.d.ts.map +1 -0
  840. package/dist/dedup/merge-dup.d.ts +8 -0
  841. package/dist/dedup/merge-dup.d.ts.map +1 -0
  842. package/dist/dedup/merge-empty.d.ts +15 -0
  843. package/dist/dedup/merge-empty.d.ts.map +1 -0
  844. package/dist/dedup/merge-id.d.ts +8 -0
  845. package/dist/dedup/merge-id.d.ts.map +1 -0
  846. package/dist/dedup/merge-judge.d.ts +33 -0
  847. package/dist/dedup/merge-judge.d.ts.map +1 -0
  848. package/dist/dedup/merge-min-score.d.ts +2 -0
  849. package/dist/dedup/merge-min-score.d.ts.map +1 -0
  850. package/dist/dedup/merge-on-write-wire.d.ts +17 -0
  851. package/dist/dedup/merge-on-write-wire.d.ts.map +1 -0
  852. package/dist/dedup/merge-on-write.d.ts +32 -0
  853. package/dist/dedup/merge-on-write.d.ts.map +1 -0
  854. package/dist/dedup/merge-pair.d.ts +8 -0
  855. package/dist/dedup/merge-pair.d.ts.map +1 -0
  856. package/dist/dedup/merge-provenance.d.ts +43 -0
  857. package/dist/dedup/merge-provenance.d.ts.map +1 -0
  858. package/dist/dedup/merge-score.d.ts +7 -0
  859. package/dist/dedup/merge-score.d.ts.map +1 -0
  860. package/dist/dedup/merge-self.d.ts +13 -0
  861. package/dist/dedup/merge-self.d.ts.map +1 -0
  862. package/dist/dedup/merge-threshold.d.ts +13 -0
  863. package/dist/dedup/merge-threshold.d.ts.map +1 -0
  864. package/dist/dedup/merge-tie.d.ts +8 -0
  865. package/dist/dedup/merge-tie.d.ts.map +1 -0
  866. package/dist/dedup/merge-unique.d.ts +7 -0
  867. package/dist/dedup/merge-unique.d.ts.map +1 -0
  868. package/dist/dedup/merge-verdict.d.ts +19 -0
  869. package/dist/dedup/merge-verdict.d.ts.map +1 -0
  870. package/dist/dedup/merge.d.ts +122 -0
  871. package/dist/dedup/merge.d.ts.map +1 -0
  872. package/dist/dedup/novelty-gate.d.ts +60 -0
  873. package/dist/dedup/novelty-gate.d.ts.map +1 -0
  874. package/dist/dedup/semantic.d.ts +86 -0
  875. package/dist/dedup/semantic.d.ts.map +1 -0
  876. package/dist/deep-recall-config.d.ts +7 -8
  877. package/dist/deep-recall-config.d.ts.map +1 -0
  878. package/dist/deep-recall-config.js +2 -2
  879. package/dist/deep-recall-http-glue.d.ts +5 -151
  880. package/dist/deep-recall-http-glue.d.ts.map +1 -0
  881. package/dist/deep-recall-http-glue.js +6 -6
  882. package/dist/deep-recall-mcp-tools.d.ts +3 -150
  883. package/dist/deep-recall-mcp-tools.d.ts.map +1 -0
  884. package/dist/deep-recall-policy-llm.d.ts +6 -30
  885. package/dist/deep-recall-policy-llm.d.ts.map +1 -0
  886. package/dist/deep-recall-renderer.d.ts +3 -9
  887. package/dist/deep-recall-renderer.d.ts.map +1 -0
  888. package/dist/deep-recall-seeds.d.ts +7 -30
  889. package/dist/deep-recall-seeds.d.ts.map +1 -0
  890. package/dist/deep-recall.d.ts +15 -17
  891. package/dist/deep-recall.d.ts.map +1 -0
  892. package/dist/delinearize.d.ts +5 -25
  893. package/dist/delinearize.d.ts.map +1 -0
  894. package/dist/dependency-propagation-config.d.ts +3 -22
  895. package/dist/dependency-propagation-config.d.ts.map +1 -0
  896. package/dist/deterministic-order.d.ts +3 -4
  897. package/dist/deterministic-order.d.ts.map +1 -0
  898. package/dist/direct-answer-wiring.d.ts +8 -28
  899. package/dist/direct-answer-wiring.d.ts.map +1 -0
  900. package/dist/direct-answer.d.ts +10 -30
  901. package/dist/direct-answer.d.ts.map +1 -0
  902. package/dist/directory-sidecars.d.ts +17 -18
  903. package/dist/directory-sidecars.d.ts.map +1 -0
  904. package/dist/embedding-fallback.d.ts +6 -25
  905. package/dist/embedding-fallback.d.ts.map +1 -0
  906. package/dist/emit-legacy-tools.d.ts +3 -4
  907. package/dist/emit-legacy-tools.d.ts.map +1 -0
  908. package/dist/enrichment/audit.d.ts +27 -0
  909. package/dist/enrichment/audit.d.ts.map +1 -0
  910. package/dist/enrichment/index.d.ts +8 -177
  911. package/dist/enrichment/index.d.ts.map +1 -0
  912. package/dist/enrichment/pipeline.d.ts +15 -0
  913. package/dist/enrichment/pipeline.d.ts.map +1 -0
  914. package/dist/enrichment/provider-registry.d.ts +28 -0
  915. package/dist/enrichment/provider-registry.d.ts.map +1 -0
  916. package/dist/enrichment/types.d.ts +65 -0
  917. package/dist/enrichment/types.d.ts.map +1 -0
  918. package/dist/enrichment/web-search-provider.d.ts +26 -0
  919. package/dist/enrichment/web-search-provider.d.ts.map +1 -0
  920. package/dist/entity-id-normalization.d.ts +3 -4
  921. package/dist/entity-id-normalization.d.ts.map +1 -0
  922. package/dist/entity-origin-fields.d.ts +6 -24
  923. package/dist/entity-origin-fields.d.ts.map +1 -0
  924. package/dist/entity-recall-cancellation.d.ts +6 -7
  925. package/dist/entity-recall-cancellation.d.ts.map +1 -0
  926. package/dist/entity-retrieval-boundaries.d.ts +2 -3
  927. package/dist/entity-retrieval-boundaries.d.ts.map +1 -0
  928. package/dist/entity-retrieval-i18n.d.ts +5 -6
  929. package/dist/entity-retrieval-i18n.d.ts.map +1 -0
  930. package/dist/entity-retrieval.d.ts +8 -41
  931. package/dist/entity-retrieval.d.ts.map +1 -0
  932. package/dist/entity-retrieval.js +14 -14
  933. package/dist/entity-schema.d.ts +9 -28
  934. package/dist/entity-schema.d.ts.map +1 -0
  935. package/dist/episodic-context.d.ts +10 -30
  936. package/dist/episodic-context.d.ts.map +1 -0
  937. package/dist/eval-trajectory-contracts.d.ts +48 -68
  938. package/dist/eval-trajectory-contracts.d.ts.map +1 -0
  939. package/dist/eval-trajectory-store.d.ts +7 -28
  940. package/dist/eval-trajectory-store.d.ts.map +1 -0
  941. package/dist/eval-trajectory.d.ts +9 -30
  942. package/dist/eval-trajectory.d.ts.map +1 -0
  943. package/dist/evals.d.ts +29 -30
  944. package/dist/evals.d.ts.map +1 -0
  945. package/dist/event-order-query.d.ts +2 -3
  946. package/dist/event-order-query.d.ts.map +1 -0
  947. package/dist/event-order-recall.d.ts +6 -8
  948. package/dist/event-order-recall.d.ts.map +1 -0
  949. package/dist/event-time.d.ts +7 -8
  950. package/dist/event-time.d.ts.map +1 -0
  951. package/dist/evidence-pack.d.ts +7 -8
  952. package/dist/evidence-pack.d.ts.map +1 -0
  953. package/dist/experience/session-experience-config.d.ts +19 -0
  954. package/dist/experience/session-experience-config.d.ts.map +1 -0
  955. package/dist/experience/session-experience-mining.d.ts +31 -0
  956. package/dist/experience/session-experience-mining.d.ts.map +1 -0
  957. package/dist/experience/session-experience-recall.d.ts +19 -0
  958. package/dist/experience/session-experience-recall.d.ts.map +1 -0
  959. package/dist/experience/session-experience.d.ts +74 -0
  960. package/dist/experience/session-experience.d.ts.map +1 -0
  961. package/dist/explicit-capture.d.ts +20 -128
  962. package/dist/explicit-capture.d.ts.map +1 -0
  963. package/dist/explicit-capture.js +1 -1
  964. package/dist/explicit-cue-recall.d.ts +17 -19
  965. package/dist/explicit-cue-recall.d.ts.map +1 -0
  966. package/dist/external-wiki-access.d.ts +4 -152
  967. package/dist/external-wiki-access.d.ts.map +1 -0
  968. package/dist/external-wiki-access.js +66 -61
  969. package/dist/external-wiki-cli.d.ts +4 -5
  970. package/dist/external-wiki-cli.d.ts.map +1 -0
  971. package/dist/external-wiki-collection-registration.d.ts +7 -27
  972. package/dist/external-wiki-collection-registration.d.ts.map +1 -0
  973. package/dist/external-wiki-collection.d.ts +9 -29
  974. package/dist/external-wiki-collection.d.ts.map +1 -0
  975. package/dist/external-wiki-config.d.ts +3 -4
  976. package/dist/external-wiki-config.d.ts.map +1 -0
  977. package/dist/external-wiki-guard.d.ts +6 -7
  978. package/dist/external-wiki-guard.d.ts.map +1 -0
  979. package/dist/external-wiki-mcp-tools.d.ts +3 -149
  980. package/dist/external-wiki-mcp-tools.d.ts.map +1 -0
  981. package/dist/external-wiki-search.d.ts +12 -13
  982. package/dist/external-wiki-search.d.ts.map +1 -0
  983. package/dist/external-wiki.d.ts +12 -13
  984. package/dist/external-wiki.d.ts.map +1 -0
  985. package/dist/extraction-error-classification.d.ts +5 -24
  986. package/dist/extraction-error-classification.d.ts.map +1 -0
  987. package/dist/extraction-evidence-class.d.ts +13 -33
  988. package/dist/extraction-evidence-class.d.ts.map +1 -0
  989. package/dist/extraction-evidence-class.js +2 -2
  990. package/dist/extraction-faithfulness.d.ts +23 -46
  991. package/dist/extraction-faithfulness.d.ts.map +1 -0
  992. package/dist/extraction-judge-telemetry.d.ts +9 -36
  993. package/dist/extraction-judge-telemetry.d.ts.map +1 -0
  994. package/dist/extraction-judge-training.d.ts +9 -36
  995. package/dist/extraction-judge-training.d.ts.map +1 -0
  996. package/dist/extraction-judge.d.ts +20 -44
  997. package/dist/extraction-judge.d.ts.map +1 -0
  998. package/dist/extraction-liveness.d.ts +161 -18
  999. package/dist/extraction-liveness.d.ts.map +1 -0
  1000. package/dist/extraction-normalization.d.ts +7 -26
  1001. package/dist/extraction-normalization.d.ts.map +1 -0
  1002. package/dist/extraction-prompt.d.ts +14 -34
  1003. package/dist/extraction-prompt.d.ts.map +1 -0
  1004. package/dist/extraction-redaction-rules.d.ts +6 -7
  1005. package/dist/extraction-redaction-rules.d.ts.map +1 -0
  1006. package/dist/extraction-source-grounding-helpers.d.ts +31 -32
  1007. package/dist/extraction-source-grounding-helpers.d.ts.map +1 -0
  1008. package/dist/extraction-source-grounding-rules.d.ts +6 -25
  1009. package/dist/extraction-source-grounding-rules.d.ts.map +1 -0
  1010. package/dist/extraction-source-grounding.d.ts +7 -25
  1011. package/dist/extraction-source-grounding.d.ts.map +1 -0
  1012. package/dist/extraction-source-grounding.js +3 -3
  1013. package/dist/extraction-span-bench.d.ts +3 -4
  1014. package/dist/extraction-span-bench.d.ts.map +1 -0
  1015. package/dist/extraction-span-clip.d.ts +5 -6
  1016. package/dist/extraction-span-clip.d.ts.map +1 -0
  1017. package/dist/extraction-span-config.d.ts +40 -18
  1018. package/dist/extraction-span-config.d.ts.map +1 -0
  1019. package/dist/extraction-span-contains.d.ts +2 -3
  1020. package/dist/extraction-span-contains.d.ts.map +1 -0
  1021. package/dist/extraction-span-fallback.d.ts +5 -6
  1022. package/dist/extraction-span-fallback.d.ts.map +1 -0
  1023. package/dist/extraction-span-gap.d.ts +2 -3
  1024. package/dist/extraction-span-gap.d.ts.map +1 -0
  1025. package/dist/extraction-span-gate.d.ts +7 -8
  1026. package/dist/extraction-span-gate.d.ts.map +1 -0
  1027. package/dist/extraction-span-join.d.ts +5 -6
  1028. package/dist/extraction-span-join.d.ts.map +1 -0
  1029. package/dist/extraction-span-length.d.ts +2 -3
  1030. package/dist/extraction-span-length.d.ts.map +1 -0
  1031. package/dist/extraction-span-materialize.d.ts +18 -37
  1032. package/dist/extraction-span-materialize.d.ts.map +1 -0
  1033. package/dist/extraction-span-materialize.js +2 -2
  1034. package/dist/extraction-span-overlap.d.ts +2 -3
  1035. package/dist/extraction-span-overlap.d.ts.map +1 -0
  1036. package/dist/extraction-span-provenance.d.ts +4 -5
  1037. package/dist/extraction-span-provenance.d.ts.map +1 -0
  1038. package/dist/extraction-span-shift.d.ts +2 -3
  1039. package/dist/extraction-span-shift.d.ts.map +1 -0
  1040. package/dist/extraction-span-slice.d.ts +2 -3
  1041. package/dist/extraction-span-slice.d.ts.map +1 -0
  1042. package/dist/extraction-span-source-hash.d.ts +5 -6
  1043. package/dist/extraction-span-source-hash.d.ts.map +1 -0
  1044. package/dist/extraction-span-tokens.d.ts +4 -5
  1045. package/dist/extraction-span-tokens.d.ts.map +1 -0
  1046. package/dist/extraction-span-validate.d.ts +5 -6
  1047. package/dist/extraction-span-validate.d.ts.map +1 -0
  1048. package/dist/extraction-span-wire.d.ts +5 -25
  1049. package/dist/extraction-span-wire.d.ts.map +1 -0
  1050. package/dist/extraction-span.d.ts +4 -5
  1051. package/dist/extraction-span.d.ts.map +1 -0
  1052. package/dist/extraction.d.ts +11 -44
  1053. package/dist/extraction.d.ts.map +1 -0
  1054. package/dist/extraction.js +26 -26
  1055. package/dist/faithfulness-config.d.ts +3 -4
  1056. package/dist/faithfulness-config.d.ts.map +1 -0
  1057. package/dist/fallback-llm-codex-subscription.d.ts +23 -42
  1058. package/dist/fallback-llm-codex-subscription.d.ts.map +1 -0
  1059. package/dist/fallback-llm.d.ts +9 -30
  1060. package/dist/fallback-llm.d.ts.map +1 -0
  1061. package/dist/focused-list-recall.d.ts +5 -8
  1062. package/dist/focused-list-recall.d.ts.map +1 -0
  1063. package/dist/graph-append-error.d.ts +3 -27
  1064. package/dist/graph-append-error.d.ts.map +1 -0
  1065. package/dist/graph-dashboard-diff.d.ts +5 -28
  1066. package/dist/graph-dashboard-diff.d.ts.map +1 -0
  1067. package/dist/graph-dashboard-key.d.ts +3 -26
  1068. package/dist/graph-dashboard-key.d.ts.map +1 -0
  1069. package/dist/graph-dashboard-parser.d.ts +6 -29
  1070. package/dist/graph-dashboard-parser.d.ts.map +1 -0
  1071. package/dist/graph-edge-decay-ROSUPDX3.js +30 -0
  1072. package/dist/graph-edge-reinforcement.d.ts +12 -36
  1073. package/dist/graph-edge-reinforcement.d.ts.map +1 -0
  1074. package/dist/graph-events.d.ts +13 -16
  1075. package/dist/graph-events.d.ts.map +1 -0
  1076. package/dist/graph-jsonl.d.ts +8 -31
  1077. package/dist/graph-jsonl.d.ts.map +1 -0
  1078. package/dist/graph-jsonl.js +3 -3
  1079. package/dist/graph-path-reconstruction.d.ts +22 -22
  1080. package/dist/graph-path-reconstruction.d.ts.map +1 -0
  1081. package/dist/graph-path-scoring-config.d.ts +3 -4
  1082. package/dist/graph-path-scoring-config.d.ts.map +1 -0
  1083. package/dist/graph-path-scoring.d.ts +8 -30
  1084. package/dist/graph-path-scoring.d.ts.map +1 -0
  1085. package/dist/graph-recall.d.ts +7 -10
  1086. package/dist/graph-recall.d.ts.map +1 -0
  1087. package/dist/graph-retrieval.d.ts +19 -20
  1088. package/dist/graph-retrieval.d.ts.map +1 -0
  1089. package/dist/graph-snapshot.d.ts +14 -38
  1090. package/dist/graph-snapshot.d.ts.map +1 -0
  1091. package/dist/graph-snapshot.js +3 -3
  1092. package/dist/graph-write-lock.d.ts +7 -10
  1093. package/dist/graph-write-lock.d.ts.map +1 -0
  1094. package/dist/graph.d.ts +325 -22
  1095. package/dist/graph.d.ts.map +1 -0
  1096. package/dist/graph.js +2 -2
  1097. package/dist/harmonic-construction.d.ts +11 -13
  1098. package/dist/harmonic-construction.d.ts.map +1 -0
  1099. package/dist/harmonic-retrieval.d.ts +10 -12
  1100. package/dist/harmonic-retrieval.d.ts.map +1 -0
  1101. package/dist/harmonic-retrieval.js +1 -1
  1102. package/dist/himem.d.ts +3 -4
  1103. package/dist/himem.d.ts.map +1 -0
  1104. package/dist/host-embedding-provider.d.ts +7 -8
  1105. package/dist/host-embedding-provider.d.ts.map +1 -0
  1106. package/dist/http-retry.d.ts +9 -10
  1107. package/dist/http-retry.d.ts.map +1 -0
  1108. package/dist/hygiene.d.ts +4 -5
  1109. package/dist/hygiene.d.ts.map +1 -0
  1110. package/dist/identity-continuity.d.ts +9 -11
  1111. package/dist/identity-continuity.d.ts.map +1 -0
  1112. package/dist/importance.d.ts +6 -26
  1113. package/dist/importance.d.ts.map +1 -0
  1114. package/dist/importers/base.d.ts +261 -0
  1115. package/dist/importers/base.d.ts.map +1 -0
  1116. package/dist/importers/index.d.ts +3 -280
  1117. package/dist/importers/index.d.ts.map +1 -0
  1118. package/dist/importers/test-utils.d.ts +5 -24
  1119. package/dist/importers/test-utils.d.ts.map +1 -0
  1120. package/dist/in-flight-reads.d.ts +10 -29
  1121. package/dist/in-flight-reads.d.ts.map +1 -0
  1122. package/dist/included-memories.d.ts +6 -7
  1123. package/dist/included-memories.d.ts.map +1 -0
  1124. package/dist/index.d.ts +185 -9836
  1125. package/dist/index.d.ts.map +1 -0
  1126. package/dist/index.js +275 -229
  1127. package/dist/inline-script.d.ts +2 -3
  1128. package/dist/inline-script.d.ts.map +1 -0
  1129. package/dist/intent.d.ts +7 -26
  1130. package/dist/intent.d.ts.map +1 -0
  1131. package/dist/json-extract.d.ts +3 -4
  1132. package/dist/json-extract.d.ts.map +1 -0
  1133. package/dist/json-store.d.ts +9 -9
  1134. package/dist/json-store.d.ts.map +1 -0
  1135. package/dist/lcm/archive.d.ts +11 -13
  1136. package/dist/lcm/archive.d.ts.map +1 -0
  1137. package/dist/lcm/dag.d.ts +5 -7
  1138. package/dist/lcm/dag.d.ts.map +1 -0
  1139. package/dist/lcm/engine.d.ts +10 -32
  1140. package/dist/lcm/engine.d.ts.map +1 -0
  1141. package/dist/lcm/engine.js +4 -4
  1142. package/dist/lcm/evidence-identity.d.ts +20 -0
  1143. package/dist/lcm/evidence-identity.d.ts.map +1 -0
  1144. package/dist/lcm/index.d.ts +9 -52
  1145. package/dist/lcm/index.d.ts.map +1 -0
  1146. package/dist/lcm/index.js +13 -13
  1147. package/dist/lcm/queue.d.ts +7 -10
  1148. package/dist/lcm/queue.d.ts.map +1 -0
  1149. package/dist/lcm/recall.d.ts +8 -13
  1150. package/dist/lcm/recall.d.ts.map +1 -0
  1151. package/dist/lcm/schema.d.ts +5 -8
  1152. package/dist/lcm/schema.d.ts.map +1 -0
  1153. package/dist/lcm/summarizer.d.ts +7 -11
  1154. package/dist/lcm/summarizer.d.ts.map +1 -0
  1155. package/dist/lcm/tools.d.ts +4 -30
  1156. package/dist/lcm/tools.d.ts.map +1 -0
  1157. package/dist/lcm-fallback-read.d.ts +4 -5
  1158. package/dist/lcm-fallback-read.d.ts.map +1 -0
  1159. package/dist/lifecycle/seed-graduation-config-types.d.ts +21 -0
  1160. package/dist/lifecycle/seed-graduation-config-types.d.ts.map +1 -0
  1161. package/dist/lifecycle/seed-graduation.d.ts +97 -0
  1162. package/dist/lifecycle/seed-graduation.d.ts.map +1 -0
  1163. package/dist/lifecycle/tombstones.d.ts +389 -0
  1164. package/dist/lifecycle/tombstones.d.ts.map +1 -0
  1165. package/dist/lifecycle.d.ts +14 -33
  1166. package/dist/lifecycle.d.ts.map +1 -0
  1167. package/dist/live-connectors-runner.d.ts +11 -29
  1168. package/dist/live-connectors-runner.d.ts.map +1 -0
  1169. package/dist/local-llm-config.d.ts +5 -7
  1170. package/dist/local-llm-config.d.ts.map +1 -0
  1171. package/dist/local-llm-config.js +1 -1
  1172. package/dist/local-llm-helpers.d.ts +102 -20
  1173. package/dist/local-llm-helpers.d.ts.map +1 -0
  1174. package/dist/local-llm-transport.d.ts +4 -6
  1175. package/dist/local-llm-transport.d.ts.map +1 -0
  1176. package/dist/local-llm.d.ts +145 -20
  1177. package/dist/local-llm.d.ts.map +1 -0
  1178. package/dist/local-model-endpoint.d.ts +10 -29
  1179. package/dist/local-model-endpoint.d.ts.map +1 -0
  1180. package/dist/location/access-operations.d.ts +9 -0
  1181. package/dist/location/access-operations.d.ts.map +1 -0
  1182. package/dist/location/backfill.d.ts +57 -0
  1183. package/dist/location/backfill.d.ts.map +1 -0
  1184. package/dist/location/cli.d.ts +67 -0
  1185. package/dist/location/cli.d.ts.map +1 -0
  1186. package/dist/location/config.d.ts +11 -0
  1187. package/dist/location/config.d.ts.map +1 -0
  1188. package/dist/location/http-glue.d.ts +20 -0
  1189. package/dist/location/http-glue.d.ts.map +1 -0
  1190. package/dist/location/index.d.ts +21 -534
  1191. package/dist/location/index.d.ts.map +1 -0
  1192. package/dist/location/index.js +17 -17
  1193. package/dist/location/intervals.d.ts +61 -0
  1194. package/dist/location/intervals.d.ts.map +1 -0
  1195. package/dist/location/matching.d.ts +124 -0
  1196. package/dist/location/matching.d.ts.map +1 -0
  1197. package/dist/location/mcp-tools.d.ts +12 -0
  1198. package/dist/location/mcp-tools.d.ts.map +1 -0
  1199. package/dist/location/parse-companions.d.ts +7 -0
  1200. package/dist/location/parse-companions.d.ts.map +1 -0
  1201. package/dist/location/pipeline.d.ts +44 -0
  1202. package/dist/location/pipeline.d.ts.map +1 -0
  1203. package/dist/location/provider-setup.d.ts +33 -0
  1204. package/dist/location/provider-setup.d.ts.map +1 -0
  1205. package/dist/location/registry.d.ts +15 -0
  1206. package/dist/location/registry.d.ts.map +1 -0
  1207. package/dist/location/scheduler.d.ts +48 -0
  1208. package/dist/location/scheduler.d.ts.map +1 -0
  1209. package/dist/location/store.d.ts +95 -0
  1210. package/dist/location/store.d.ts.map +1 -0
  1211. package/dist/location/surfaces.d.ts +76 -0
  1212. package/dist/location/surfaces.d.ts.map +1 -0
  1213. package/dist/location/tagging.d.ts +116 -0
  1214. package/dist/location/tagging.d.ts.map +1 -0
  1215. package/dist/location/types.d.ts +109 -0
  1216. package/dist/location/types.d.ts.map +1 -0
  1217. package/dist/logger.d.ts +7 -8
  1218. package/dist/logger.d.ts.map +1 -0
  1219. package/dist/maintenance/archive-observations.d.ts +5 -5
  1220. package/dist/maintenance/archive-observations.d.ts.map +1 -0
  1221. package/dist/maintenance/atomic-file.d.ts +4 -5
  1222. package/dist/maintenance/atomic-file.d.ts.map +1 -0
  1223. package/dist/maintenance/backup-stamp.d.ts +2 -3
  1224. package/dist/maintenance/backup-stamp.d.ts.map +1 -0
  1225. package/dist/maintenance/day-summary-cron.d.ts +20 -0
  1226. package/dist/maintenance/day-summary-cron.d.ts.map +1 -0
  1227. package/dist/maintenance/dreams-ledger.d.ts +172 -0
  1228. package/dist/maintenance/dreams-ledger.d.ts.map +1 -0
  1229. package/dist/maintenance/first-start-migration.d.ts +61 -0
  1230. package/dist/maintenance/first-start-migration.d.ts.map +1 -0
  1231. package/dist/maintenance/forget.d.ts +59 -0
  1232. package/dist/maintenance/forget.d.ts.map +1 -0
  1233. package/dist/maintenance/graph-edge-decay.d.ts +122 -0
  1234. package/dist/maintenance/graph-edge-decay.d.ts.map +1 -0
  1235. package/dist/maintenance/memory-governance-cron.d.ts +9 -10
  1236. package/dist/maintenance/memory-governance-cron.d.ts.map +1 -0
  1237. package/dist/maintenance/memory-governance.d.ts +25 -43
  1238. package/dist/maintenance/memory-governance.d.ts.map +1 -0
  1239. package/dist/maintenance/memory-governance.js +14 -14
  1240. package/dist/maintenance/migrate-observations.d.ts +4 -5
  1241. package/dist/maintenance/migrate-observations.d.ts.map +1 -0
  1242. package/dist/maintenance/namespace-maintenance-fanout.d.ts +132 -0
  1243. package/dist/maintenance/namespace-maintenance-fanout.d.ts.map +1 -0
  1244. package/dist/maintenance/namespace-planner.d.ts +96 -0
  1245. package/dist/maintenance/namespace-planner.d.ts.map +1 -0
  1246. package/dist/maintenance/observation-ledger-utils.d.ts +5 -6
  1247. package/dist/maintenance/observation-ledger-utils.d.ts.map +1 -0
  1248. package/dist/maintenance/pattern-reinforcement.d.ts +129 -0
  1249. package/dist/maintenance/pattern-reinforcement.d.ts.map +1 -0
  1250. package/dist/maintenance/projection-support.d.ts +76 -0
  1251. package/dist/maintenance/projection-support.d.ts.map +1 -0
  1252. package/dist/maintenance/purge.d.ts +85 -0
  1253. package/dist/maintenance/purge.d.ts.map +1 -0
  1254. package/dist/maintenance/rebuild-memory-lifecycle-ledger-cli.d.ts +24 -0
  1255. package/dist/maintenance/rebuild-memory-lifecycle-ledger-cli.d.ts.map +1 -0
  1256. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +11 -43
  1257. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts.map +1 -0
  1258. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +14 -14
  1259. package/dist/maintenance/rebuild-memory-projection.d.ts +14 -72
  1260. package/dist/maintenance/rebuild-memory-projection.d.ts.map +1 -0
  1261. package/dist/maintenance/rebuild-memory-projection.js +15 -15
  1262. package/dist/maintenance/rebuild-observations.d.ts +4 -5
  1263. package/dist/maintenance/rebuild-observations.d.ts.map +1 -0
  1264. package/dist/maintenance/tier-stats.d.ts +59 -0
  1265. package/dist/maintenance/tier-stats.d.ts.map +1 -0
  1266. package/dist/mcp-memory-inspector-app.d.ts +15 -158
  1267. package/dist/mcp-memory-inspector-app.d.ts.map +1 -0
  1268. package/dist/mcp-read-only-tools.d.ts +2 -3
  1269. package/dist/mcp-read-only-tools.d.ts.map +1 -0
  1270. package/dist/mcp-read-only-tools.js +1 -1
  1271. package/dist/meetings/build-scheduler.d.ts +43 -0
  1272. package/dist/meetings/build-scheduler.d.ts.map +1 -0
  1273. package/dist/meetings/build.d.ts +137 -0
  1274. package/dist/meetings/build.d.ts.map +1 -0
  1275. package/dist/meetings/cli.d.ts +37 -0
  1276. package/dist/meetings/cli.d.ts.map +1 -0
  1277. package/dist/meetings/config.d.ts +18 -0
  1278. package/dist/meetings/config.d.ts.map +1 -0
  1279. package/dist/meetings/day-source.d.ts +103 -0
  1280. package/dist/meetings/day-source.d.ts.map +1 -0
  1281. package/dist/meetings/detect.d.ts +33 -0
  1282. package/dist/meetings/detect.d.ts.map +1 -0
  1283. package/dist/meetings/errors.d.ts +10 -0
  1284. package/dist/meetings/errors.d.ts.map +1 -0
  1285. package/dist/meetings/fuse.d.ts +30 -0
  1286. package/dist/meetings/fuse.d.ts.map +1 -0
  1287. package/dist/meetings/http-glue.d.ts +37 -0
  1288. package/dist/meetings/http-glue.d.ts.map +1 -0
  1289. package/dist/meetings/index.d.ts +20 -0
  1290. package/dist/meetings/index.d.ts.map +1 -0
  1291. package/dist/meetings/mcp-tools.d.ts +10 -0
  1292. package/dist/meetings/mcp-tools.d.ts.map +1 -0
  1293. package/dist/meetings/memory-gen.d.ts +157 -0
  1294. package/dist/meetings/memory-gen.d.ts.map +1 -0
  1295. package/dist/meetings/memory-generator.d.ts +113 -0
  1296. package/dist/meetings/memory-generator.d.ts.map +1 -0
  1297. package/dist/meetings/service.d.ts +80 -0
  1298. package/dist/meetings/service.d.ts.map +1 -0
  1299. package/dist/meetings/store.d.ts +121 -0
  1300. package/dist/meetings/store.d.ts.map +1 -0
  1301. package/dist/meetings/summary-extractor.d.ts +96 -0
  1302. package/dist/meetings/summary-extractor.d.ts.map +1 -0
  1303. package/dist/meetings/types.d.ts +155 -0
  1304. package/dist/meetings/types.d.ts.map +1 -0
  1305. package/dist/memory-action-policy.d.ts +6 -25
  1306. package/dist/memory-action-policy.d.ts.map +1 -0
  1307. package/dist/memory-age.d.ts +16 -17
  1308. package/dist/memory-age.d.ts.map +1 -0
  1309. package/dist/memory-browse-http-glue.d.ts +5 -151
  1310. package/dist/memory-browse-http-glue.d.ts.map +1 -0
  1311. package/dist/memory-browse-http-glue.js +2 -2
  1312. package/dist/memory-browse-mcp-tools.d.ts +3 -150
  1313. package/dist/memory-browse-mcp-tools.d.ts.map +1 -0
  1314. package/dist/memory-browse-operations.d.ts +11 -2
  1315. package/dist/memory-browse-operations.d.ts.map +1 -0
  1316. package/dist/memory-browse-operations.js +66 -61
  1317. package/dist/memory-browse.d.ts +16 -36
  1318. package/dist/memory-browse.d.ts.map +1 -0
  1319. package/dist/memory-browse.js +4 -4
  1320. package/dist/memory-cache.d.ts +27 -46
  1321. package/dist/memory-cache.d.ts.map +1 -0
  1322. package/dist/memory-controller.d.ts +29 -50
  1323. package/dist/memory-controller.d.ts.map +1 -0
  1324. package/dist/memory-corpus-version.d.ts +3 -4
  1325. package/dist/memory-corpus-version.d.ts.map +1 -0
  1326. package/dist/memory-extension/claude-code-publisher.d.ts +18 -0
  1327. package/dist/memory-extension/claude-code-publisher.d.ts.map +1 -0
  1328. package/dist/memory-extension/codex-publisher.d.ts +22 -0
  1329. package/dist/memory-extension/codex-publisher.d.ts.map +1 -0
  1330. package/dist/memory-extension/hermes-publisher.d.ts +18 -0
  1331. package/dist/memory-extension/hermes-publisher.d.ts.map +1 -0
  1332. package/dist/memory-extension/index.d.ts +57 -0
  1333. package/dist/memory-extension/index.d.ts.map +1 -0
  1334. package/dist/memory-extension/shared-instructions.d.ts +30 -0
  1335. package/dist/memory-extension/shared-instructions.d.ts.map +1 -0
  1336. package/dist/memory-extension/types.d.ts +88 -0
  1337. package/dist/memory-extension/types.d.ts.map +1 -0
  1338. package/dist/memory-extension-host/host-discovery.d.ts +38 -0
  1339. package/dist/memory-extension-host/host-discovery.d.ts.map +1 -0
  1340. package/dist/memory-extension-host/index.d.ts +7 -0
  1341. package/dist/memory-extension-host/index.d.ts.map +1 -0
  1342. package/dist/memory-extension-host/render-extensions-block.d.ts +23 -0
  1343. package/dist/memory-extension-host/render-extensions-block.d.ts.map +1 -0
  1344. package/dist/memory-extension-host/types.d.ts +20 -0
  1345. package/dist/memory-extension-host/types.d.ts.map +1 -0
  1346. package/dist/memory-lifecycle-ledger-utils.d.ts +19 -38
  1347. package/dist/memory-lifecycle-ledger-utils.d.ts.map +1 -0
  1348. package/dist/memory-projection-format.d.ts +3 -4
  1349. package/dist/memory-projection-format.d.ts.map +1 -0
  1350. package/dist/memory-projection-mutations.d.ts +3 -4
  1351. package/dist/memory-projection-mutations.d.ts.map +1 -0
  1352. package/dist/memory-projection-store.d.ts +35 -54
  1353. package/dist/memory-projection-store.d.ts.map +1 -0
  1354. package/dist/memory-provenance.d.ts +10 -29
  1355. package/dist/memory-provenance.d.ts.map +1 -0
  1356. package/dist/memory-snapshot.d.ts +3 -22
  1357. package/dist/memory-snapshot.d.ts.map +1 -0
  1358. package/dist/memory-subject-cli.d.ts +9 -156
  1359. package/dist/memory-subject-cli.d.ts.map +1 -0
  1360. package/dist/memory-subject.d.ts +132 -145
  1361. package/dist/memory-subject.d.ts.map +1 -0
  1362. package/dist/memory-worth-bench.d.ts +4 -5
  1363. package/dist/memory-worth-bench.d.ts.map +1 -0
  1364. package/dist/memory-worth-filter.d.ts +8 -11
  1365. package/dist/memory-worth-filter.d.ts.map +1 -0
  1366. package/dist/memory-worth-outcomes.d.ts +11 -45
  1367. package/dist/memory-worth-outcomes.d.ts.map +1 -0
  1368. package/dist/memory-worth.d.ts +4 -5
  1369. package/dist/memory-worth.d.ts.map +1 -0
  1370. package/dist/message-parts/index.d.ts +15 -16
  1371. package/dist/message-parts/index.d.ts.map +1 -0
  1372. package/dist/migrate/from-engram.d.ts +6 -7
  1373. package/dist/migrate/from-engram.d.ts.map +1 -0
  1374. package/dist/model-registry.d.ts +3 -4
  1375. package/dist/model-registry.d.ts.map +1 -0
  1376. package/dist/models-json.d.ts +5 -24
  1377. package/dist/models-json.d.ts.map +1 -0
  1378. package/dist/namespaces/catalog.d.ts +473 -0
  1379. package/dist/namespaces/catalog.d.ts.map +1 -0
  1380. package/dist/namespaces/identity.d.ts +5 -0
  1381. package/dist/namespaces/identity.d.ts.map +1 -0
  1382. package/dist/namespaces/migrate.d.ts +11 -46
  1383. package/dist/namespaces/migrate.d.ts.map +1 -0
  1384. package/dist/namespaces/migrate.js +15 -15
  1385. package/dist/namespaces/path.d.ts +3 -0
  1386. package/dist/namespaces/path.d.ts.map +1 -0
  1387. package/dist/namespaces/principal.d.ts +9 -28
  1388. package/dist/namespaces/principal.d.ts.map +1 -0
  1389. package/dist/namespaces/scope-profile-config.d.ts +5 -0
  1390. package/dist/namespaces/scope-profile-config.d.ts.map +1 -0
  1391. package/dist/namespaces/scope-profiles.d.ts +46 -0
  1392. package/dist/namespaces/scope-profiles.d.ts.map +1 -0
  1393. package/dist/namespaces/search.d.ts +10 -28
  1394. package/dist/namespaces/search.d.ts.map +1 -0
  1395. package/dist/namespaces/search.js +5 -5
  1396. package/dist/namespaces/storage.d.ts +8 -41
  1397. package/dist/namespaces/storage.d.ts.map +1 -0
  1398. package/dist/namespaces/storage.js +14 -14
  1399. package/dist/native-binding-hint.d.ts +3 -4
  1400. package/dist/native-binding-hint.d.ts.map +1 -0
  1401. package/dist/native-knowledge.d.ts +15 -34
  1402. package/dist/native-knowledge.d.ts.map +1 -0
  1403. package/dist/negative.d.ts +3 -4
  1404. package/dist/negative.d.ts.map +1 -0
  1405. package/dist/network/tailscale.d.ts +7 -8
  1406. package/dist/network/tailscale.d.ts.map +1 -0
  1407. package/dist/network/webdav.d.ts +9 -10
  1408. package/dist/network/webdav.d.ts.map +1 -0
  1409. package/dist/objective-state-writers.d.ts +8 -9
  1410. package/dist/objective-state-writers.d.ts.map +1 -0
  1411. package/dist/objective-state.d.ts +15 -16
  1412. package/dist/objective-state.d.ts.map +1 -0
  1413. package/dist/offline-sync-exclude-globs.d.ts +3 -4
  1414. package/dist/offline-sync-exclude-globs.d.ts.map +1 -0
  1415. package/dist/offline-sync-file-io.d.ts +8 -9
  1416. package/dist/offline-sync-file-io.d.ts.map +1 -0
  1417. package/dist/offline-sync-impression-drain.d.ts +8 -26
  1418. package/dist/offline-sync-impression-drain.d.ts.map +1 -0
  1419. package/dist/offline-sync-impression-drain.js +2 -2
  1420. package/dist/offline-sync.d.ts +57 -58
  1421. package/dist/offline-sync.d.ts.map +1 -0
  1422. package/dist/okf/cli.d.ts +10 -0
  1423. package/dist/okf/cli.d.ts.map +1 -0
  1424. package/dist/okf/config.d.ts +11 -0
  1425. package/dist/okf/config.d.ts.map +1 -0
  1426. package/dist/okf/index-files.d.ts +7 -0
  1427. package/dist/okf/index-files.d.ts.map +1 -0
  1428. package/dist/okf/lint.d.ts +12 -0
  1429. package/dist/okf/lint.d.ts.map +1 -0
  1430. package/dist/okf/render.d.ts +29 -0
  1431. package/dist/okf/render.d.ts.map +1 -0
  1432. package/dist/okf/sweep.d.ts +9 -0
  1433. package/dist/okf/sweep.d.ts.map +1 -0
  1434. package/dist/okf/type-mapping.d.ts +30 -0
  1435. package/dist/okf/type-mapping.d.ts.map +1 -0
  1436. package/dist/onboarding/index.d.ts +63 -0
  1437. package/dist/onboarding/index.d.ts.map +1 -0
  1438. package/dist/openai-chat-compat.d.ts +6 -7
  1439. package/dist/openai-chat-compat.d.ts.map +1 -0
  1440. package/dist/operator-doctor-corpus.d.ts +8 -29
  1441. package/dist/operator-doctor-corpus.d.ts.map +1 -0
  1442. package/dist/operator-doctor-corpus.js +21 -21
  1443. package/dist/operator-doctor-replica.d.ts +8 -29
  1444. package/dist/operator-doctor-replica.d.ts.map +1 -0
  1445. package/dist/operator-doctor-replica.js +4 -4
  1446. package/dist/operator-doctor-types.d.ts +2 -3
  1447. package/dist/operator-doctor-types.d.ts.map +1 -0
  1448. package/dist/operator-toolkit.d.ts +43 -75
  1449. package/dist/operator-toolkit.d.ts.map +1 -0
  1450. package/dist/operator-toolkit.js +37 -37
  1451. package/dist/opik-exporter.d.ts +6 -8
  1452. package/dist/opik-exporter.d.ts.map +1 -0
  1453. package/dist/orchestration/compression-guideline-coordinator.d.ts +6 -40
  1454. package/dist/orchestration/compression-guideline-coordinator.d.ts.map +1 -0
  1455. package/dist/orchestration/consolidation-run.d.ts +93 -0
  1456. package/dist/orchestration/consolidation-run.d.ts.map +1 -0
  1457. package/dist/orchestration/contradiction-linking-coordinator.d.ts +102 -0
  1458. package/dist/orchestration/contradiction-linking-coordinator.d.ts.map +1 -0
  1459. package/dist/orchestration/conversation-index-coordinator.d.ts +99 -0
  1460. package/dist/orchestration/conversation-index-coordinator.d.ts.map +1 -0
  1461. package/dist/orchestration/dependency-propagation-delivery.d.ts +129 -0
  1462. package/dist/orchestration/dependency-propagation-delivery.d.ts.map +1 -0
  1463. package/dist/orchestration/dependency-propagation-queue-state.d.ts +15 -0
  1464. package/dist/orchestration/dependency-propagation-queue-state.d.ts.map +1 -0
  1465. package/dist/orchestration/dependency-propagation-recovery-replay.d.ts +49 -0
  1466. package/dist/orchestration/dependency-propagation-recovery-replay.d.ts.map +1 -0
  1467. package/dist/orchestration/dependency-propagation-replay-reconciliation.d.ts +25 -0
  1468. package/dist/orchestration/dependency-propagation-replay-reconciliation.d.ts.map +1 -0
  1469. package/dist/orchestration/dependency-propagation.d.ts +64 -0
  1470. package/dist/orchestration/dependency-propagation.d.ts.map +1 -0
  1471. package/dist/orchestration/dependency-revalidation.d.ts +45 -0
  1472. package/dist/orchestration/dependency-revalidation.d.ts.map +1 -0
  1473. package/dist/orchestration/entity-synthesis-coordinator.d.ts +64 -0
  1474. package/dist/orchestration/entity-synthesis-coordinator.d.ts.map +1 -0
  1475. package/dist/orchestration/episodic-context-section.d.ts +30 -0
  1476. package/dist/orchestration/episodic-context-section.d.ts.map +1 -0
  1477. package/dist/orchestration/extraction-anchor-snapshot.d.ts +20 -0
  1478. package/dist/orchestration/extraction-anchor-snapshot.d.ts.map +1 -0
  1479. package/dist/orchestration/extraction-envelope.d.ts +40 -0
  1480. package/dist/orchestration/extraction-envelope.d.ts.map +1 -0
  1481. package/dist/orchestration/extraction-injection-gate.d.ts +51 -0
  1482. package/dist/orchestration/extraction-injection-gate.d.ts.map +1 -0
  1483. package/dist/orchestration/extraction-origin-context.d.ts +19 -0
  1484. package/dist/orchestration/extraction-origin-context.d.ts.map +1 -0
  1485. package/dist/orchestration/extraction-persist-deps.d.ts +76 -0
  1486. package/dist/orchestration/extraction-persist-deps.d.ts.map +1 -0
  1487. package/dist/orchestration/extraction-persist-promotion.d.ts +203 -0
  1488. package/dist/orchestration/extraction-persist-promotion.d.ts.map +1 -0
  1489. package/dist/orchestration/extraction-persist.d.ts +19 -0
  1490. package/dist/orchestration/extraction-persist.d.ts.map +1 -0
  1491. package/dist/orchestration/extraction-queue-coordinator.d.ts +103 -0
  1492. package/dist/orchestration/extraction-queue-coordinator.d.ts.map +1 -0
  1493. package/dist/orchestration/extraction-run-helpers.d.ts +123 -0
  1494. package/dist/orchestration/extraction-run-helpers.d.ts.map +1 -0
  1495. package/dist/orchestration/extraction-run.d.ts +174 -0
  1496. package/dist/orchestration/extraction-run.d.ts.map +1 -0
  1497. package/dist/orchestration/extraction-shutdown.d.ts +6 -0
  1498. package/dist/orchestration/extraction-shutdown.d.ts.map +1 -0
  1499. package/dist/orchestration/extraction-watermark.d.ts +28 -0
  1500. package/dist/orchestration/extraction-watermark.d.ts.map +1 -0
  1501. package/dist/orchestration/generic-recall-paths.d.ts +36 -0
  1502. package/dist/orchestration/generic-recall-paths.d.ts.map +1 -0
  1503. package/dist/orchestration/graph-path-state-loader.d.ts +15 -0
  1504. package/dist/orchestration/graph-path-state-loader.d.ts.map +1 -0
  1505. package/dist/orchestration/graph-recall-coordinator.d.ts +107 -0
  1506. package/dist/orchestration/graph-recall-coordinator.d.ts.map +1 -0
  1507. package/dist/orchestration/harmonic-construction-persist.d.ts +58 -0
  1508. package/dist/orchestration/harmonic-construction-persist.d.ts.map +1 -0
  1509. package/dist/orchestration/lifecycle-policy-coordinator.d.ts +81 -0
  1510. package/dist/orchestration/lifecycle-policy-coordinator.d.ts.map +1 -0
  1511. package/dist/orchestration/maintenance.d.ts +229 -37
  1512. package/dist/orchestration/maintenance.d.ts.map +1 -0
  1513. package/dist/orchestration/maintenance.js +25 -25
  1514. package/dist/orchestration/namespace-read-fanout.d.ts +95 -0
  1515. package/dist/orchestration/namespace-read-fanout.d.ts.map +1 -0
  1516. package/dist/orchestration/orchestrator-helpers.d.ts +408 -0
  1517. package/dist/orchestration/orchestrator-helpers.d.ts.map +1 -0
  1518. package/dist/orchestration/orchestrator-init.d.ts +124 -0
  1519. package/dist/orchestration/orchestrator-init.d.ts.map +1 -0
  1520. package/dist/orchestration/orchestrator-namespace-scope.d.ts +19 -0
  1521. package/dist/orchestration/orchestrator-namespace-scope.d.ts.map +1 -0
  1522. package/dist/orchestration/persistence-index.d.ts +141 -0
  1523. package/dist/orchestration/persistence-index.d.ts.map +1 -0
  1524. package/dist/orchestration/projection-rebuild-schedule.d.ts +21 -0
  1525. package/dist/orchestration/projection-rebuild-schedule.d.ts.map +1 -0
  1526. package/dist/orchestration/qmd-result-resolver.d.ts +75 -0
  1527. package/dist/orchestration/qmd-result-resolver.d.ts.map +1 -0
  1528. package/dist/orchestration/recall-background-writes.d.ts +3 -0
  1529. package/dist/orchestration/recall-background-writes.d.ts.map +1 -0
  1530. package/dist/orchestration/recall-entry.d.ts +78 -0
  1531. package/dist/orchestration/recall-entry.d.ts.map +1 -0
  1532. package/dist/orchestration/recall-internal-deps.d.ts +311 -0
  1533. package/dist/orchestration/recall-internal-deps.d.ts.map +1 -0
  1534. package/dist/orchestration/recall-internal.d.ts +30 -0
  1535. package/dist/orchestration/recall-internal.d.ts.map +1 -0
  1536. package/dist/orchestration/recall-introspection.d.ts +108 -0
  1537. package/dist/orchestration/recall-introspection.d.ts.map +1 -0
  1538. package/dist/orchestration/recall-profile-storage.d.ts +20 -0
  1539. package/dist/orchestration/recall-profile-storage.d.ts.map +1 -0
  1540. package/dist/orchestration/recall-recognition-index.d.ts +23 -0
  1541. package/dist/orchestration/recall-recognition-index.d.ts.map +1 -0
  1542. package/dist/orchestration/recall-recognition-search.d.ts +7 -0
  1543. package/dist/orchestration/recall-recognition-search.d.ts.map +1 -0
  1544. package/dist/orchestration/recall-rerank-coordinator.d.ts +126 -0
  1545. package/dist/orchestration/recall-rerank-coordinator.d.ts.map +1 -0
  1546. package/dist/orchestration/recall-result-formatter.d.ts +128 -0
  1547. package/dist/orchestration/recall-result-formatter.d.ts.map +1 -0
  1548. package/dist/orchestration/recall-search-pipeline.d.ts +284 -0
  1549. package/dist/orchestration/recall-search-pipeline.d.ts.map +1 -0
  1550. package/dist/orchestration/recall-search-prefilter.d.ts +31 -0
  1551. package/dist/orchestration/recall-search-prefilter.d.ts.map +1 -0
  1552. package/dist/orchestration/recall-section-coordinator.d.ts +92 -0
  1553. package/dist/orchestration/recall-section-coordinator.d.ts.map +1 -0
  1554. package/dist/orchestration/self-deps.d.ts +27 -0
  1555. package/dist/orchestration/self-deps.d.ts.map +1 -0
  1556. package/dist/orchestration/semantic-consolidation-coordinator.d.ts +64 -0
  1557. package/dist/orchestration/semantic-consolidation-coordinator.d.ts.map +1 -0
  1558. package/dist/orchestration/semantic-merge-commit-effects.d.ts +193 -0
  1559. package/dist/orchestration/semantic-merge-commit-effects.d.ts.map +1 -0
  1560. package/dist/orchestration/semantic-merge-persist.d.ts +318 -0
  1561. package/dist/orchestration/semantic-merge-persist.d.ts.map +1 -0
  1562. package/dist/orchestration/semantic-merge-promotion-payload.d.ts +132 -0
  1563. package/dist/orchestration/semantic-merge-promotion-payload.d.ts.map +1 -0
  1564. package/dist/orchestration/session-context.d.ts +225 -0
  1565. package/dist/orchestration/session-context.d.ts.map +1 -0
  1566. package/dist/orchestration/startup-collection-checks.d.ts +23 -0
  1567. package/dist/orchestration/startup-collection-checks.d.ts.map +1 -0
  1568. package/dist/orchestration/tier-migration-coordinator.d.ts +65 -0
  1569. package/dist/orchestration/tier-migration-coordinator.d.ts.map +1 -0
  1570. package/dist/orchestration/turn-ingestion.d.ts +227 -0
  1571. package/dist/orchestration/turn-ingestion.d.ts.map +1 -0
  1572. package/dist/orchestration/update-localization.d.ts +37 -0
  1573. package/dist/orchestration/update-localization.d.ts.map +1 -0
  1574. package/dist/orchestration/workspace-ops.d.ts +154 -0
  1575. package/dist/orchestration/workspace-ops.d.ts.map +1 -0
  1576. package/dist/orchestration/xray-capture-queue.d.ts +17 -0
  1577. package/dist/orchestration/xray-capture-queue.d.ts.map +1 -0
  1578. package/dist/orchestrator.d.ts +867 -109
  1579. package/dist/orchestrator.d.ts.map +1 -0
  1580. package/dist/orchestrator.js +157 -152
  1581. package/dist/page-versioning.d.ts +16 -17
  1582. package/dist/page-versioning.d.ts.map +1 -0
  1583. package/dist/patterns-cli.d.ts +20 -40
  1584. package/dist/patterns-cli.d.ts.map +1 -0
  1585. package/dist/peers/index.d.ts +17 -327
  1586. package/dist/peers/index.d.ts.map +1 -0
  1587. package/dist/peers/migrate-from-identity-anchor.d.ts +119 -0
  1588. package/dist/peers/migrate-from-identity-anchor.d.ts.map +1 -0
  1589. package/dist/peers/profile-reasoner.d.ts +204 -0
  1590. package/dist/peers/profile-reasoner.d.ts.map +1 -0
  1591. package/dist/peers/storage.d.ts +163 -0
  1592. package/dist/peers/storage.d.ts.map +1 -0
  1593. package/dist/peers/types.d.ts +125 -0
  1594. package/dist/peers/types.d.ts.map +1 -0
  1595. package/dist/plugin-entry-resolver.d.ts +3 -4
  1596. package/dist/plugin-entry-resolver.d.ts.map +1 -0
  1597. package/dist/plugin-id.d.ts +4 -5
  1598. package/dist/plugin-id.d.ts.map +1 -0
  1599. package/dist/policy-runtime.d.ts +7 -26
  1600. package/dist/policy-runtime.d.ts.map +1 -0
  1601. package/dist/preferences/drift-config.d.ts +27 -0
  1602. package/dist/preferences/drift-config.d.ts.map +1 -0
  1603. package/dist/preferences/drift-recall.d.ts +74 -0
  1604. package/dist/preferences/drift-recall.d.ts.map +1 -0
  1605. package/dist/preferences/drift-types.d.ts +59 -0
  1606. package/dist/preferences/drift-types.d.ts.map +1 -0
  1607. package/dist/preferences/index.d.ts +12 -0
  1608. package/dist/preferences/index.d.ts.map +1 -0
  1609. package/dist/preferences/preference-drift.d.ts +144 -0
  1610. package/dist/preferences/preference-drift.d.ts.map +1 -0
  1611. package/dist/prioritized-embed.d.ts +3 -4
  1612. package/dist/prioritized-embed.d.ts.map +1 -0
  1613. package/dist/proactive-contention.d.ts +4 -24
  1614. package/dist/proactive-contention.d.ts.map +1 -0
  1615. package/dist/procedural/library-maintenance.d.ts +102 -0
  1616. package/dist/procedural/library-maintenance.d.ts.map +1 -0
  1617. package/dist/procedural/maintenance-config.d.ts +9 -0
  1618. package/dist/procedural/maintenance-config.d.ts.map +1 -0
  1619. package/dist/procedural/procedure-miner.d.ts +20 -0
  1620. package/dist/procedural/procedure-miner.d.ts.map +1 -0
  1621. package/dist/procedural/procedure-recall.d.ts +30 -0
  1622. package/dist/procedural/procedure-recall.d.ts.map +1 -0
  1623. package/dist/procedural/procedure-stats.d.ts +68 -0
  1624. package/dist/procedural/procedure-stats.d.ts.map +1 -0
  1625. package/dist/procedural/procedure-types.d.ts +26 -0
  1626. package/dist/procedural/procedure-types.d.ts.map +1 -0
  1627. package/dist/procedural/reinforcement-core.d.ts +39 -0
  1628. package/dist/procedural/reinforcement-core.d.ts.map +1 -0
  1629. package/dist/procedural/skill-io.d.ts +70 -0
  1630. package/dist/procedural/skill-io.d.ts.map +1 -0
  1631. package/dist/procedural/skill-projection.d.ts +98 -0
  1632. package/dist/procedural/skill-projection.d.ts.map +1 -0
  1633. package/dist/profiling.d.ts +10 -11
  1634. package/dist/profiling.d.ts.map +1 -0
  1635. package/dist/projection/index.d.ts +62 -0
  1636. package/dist/projection/index.d.ts.map +1 -0
  1637. package/dist/provenance.d.ts +13 -33
  1638. package/dist/provenance.d.ts.map +1 -0
  1639. package/dist/provenance.js +2 -2
  1640. package/dist/providers/codex-subscription.d.ts +115 -0
  1641. package/dist/providers/codex-subscription.d.ts.map +1 -0
  1642. package/dist/qmd-preflight.d.ts +31 -21
  1643. package/dist/qmd-preflight.d.ts.map +1 -0
  1644. package/dist/qmd-recall-cache.d.ts +11 -30
  1645. package/dist/qmd-recall-cache.d.ts.map +1 -0
  1646. package/dist/qmd-status.d.ts +10 -11
  1647. package/dist/qmd-status.d.ts.map +1 -0
  1648. package/dist/qmd.d.ts +325 -21
  1649. package/dist/qmd.d.ts.map +1 -0
  1650. package/dist/reasoning-trace-recall.d.ts +7 -8
  1651. package/dist/reasoning-trace-recall.d.ts.map +1 -0
  1652. package/dist/reasoning-trace-types.d.ts +9 -10
  1653. package/dist/reasoning-trace-types.d.ts.map +1 -0
  1654. package/dist/recall-audit-anomaly.d.ts +11 -15
  1655. package/dist/recall-audit-anomaly.d.ts.map +1 -0
  1656. package/dist/recall-audit.d.ts +6 -8
  1657. package/dist/recall-audit.d.ts.map +1 -0
  1658. package/dist/recall-composition-decision.d.ts +9 -12
  1659. package/dist/recall-composition-decision.d.ts.map +1 -0
  1660. package/dist/recall-concurrency-config.d.ts +3 -22
  1661. package/dist/recall-concurrency-config.d.ts.map +1 -0
  1662. package/dist/recall-context-composition.d.ts +21 -22
  1663. package/dist/recall-context-composition.d.ts.map +1 -0
  1664. package/dist/recall-deep-access.d.ts +9 -12
  1665. package/dist/recall-deep-access.d.ts.map +1 -0
  1666. package/dist/recall-deep-budget-left.d.ts +2 -3
  1667. package/dist/recall-deep-budget-left.d.ts.map +1 -0
  1668. package/dist/recall-deep-budget.d.ts +2 -3
  1669. package/dist/recall-deep-budget.d.ts.map +1 -0
  1670. package/dist/recall-deep-expand-select.d.ts +4 -5
  1671. package/dist/recall-deep-expand-select.d.ts.map +1 -0
  1672. package/dist/recall-deep-expand.d.ts +2 -3
  1673. package/dist/recall-deep-expand.d.ts.map +1 -0
  1674. package/dist/recall-deep-frontier.d.ts +4 -5
  1675. package/dist/recall-deep-frontier.d.ts.map +1 -0
  1676. package/dist/recall-deep-policy.d.ts +5 -6
  1677. package/dist/recall-deep-policy.d.ts.map +1 -0
  1678. package/dist/recall-deep-query.d.ts +3 -4
  1679. package/dist/recall-deep-query.d.ts.map +1 -0
  1680. package/dist/recall-deep-refine.d.ts +2 -3
  1681. package/dist/recall-deep-refine.d.ts.map +1 -0
  1682. package/dist/recall-deep-render.d.ts +3 -6
  1683. package/dist/recall-deep-render.d.ts.map +1 -0
  1684. package/dist/recall-deep-rewrite.d.ts +4 -5
  1685. package/dist/recall-deep-rewrite.d.ts.map +1 -0
  1686. package/dist/recall-deep-step-count.d.ts +2 -3
  1687. package/dist/recall-deep-step-count.d.ts.map +1 -0
  1688. package/dist/recall-deep-stop-reason.d.ts +5 -6
  1689. package/dist/recall-deep-stop-reason.d.ts.map +1 -0
  1690. package/dist/recall-deep-stop.d.ts +6 -7
  1691. package/dist/recall-deep-stop.d.ts.map +1 -0
  1692. package/dist/recall-deep-trace-empty.d.ts +2 -3
  1693. package/dist/recall-deep-trace-empty.d.ts.map +1 -0
  1694. package/dist/recall-deep-working-set.d.ts +2 -3
  1695. package/dist/recall-deep-working-set.d.ts.map +1 -0
  1696. package/dist/recall-deep.d.ts +11 -12
  1697. package/dist/recall-deep.d.ts.map +1 -0
  1698. package/dist/recall-disclosure-escalation.d.ts +9 -29
  1699. package/dist/recall-disclosure-escalation.d.ts.map +1 -0
  1700. package/dist/recall-explain-renderer.d.ts +12 -38
  1701. package/dist/recall-explain-renderer.d.ts.map +1 -0
  1702. package/dist/recall-explain-renderer.js +3 -3
  1703. package/dist/recall-handles.d.ts +23 -24
  1704. package/dist/recall-handles.d.ts.map +1 -0
  1705. package/dist/recall-memory-map.d.ts +8 -27
  1706. package/dist/recall-memory-map.d.ts.map +1 -0
  1707. package/dist/recall-mmr.d.ts +13 -14
  1708. package/dist/recall-mmr.d.ts.map +1 -0
  1709. package/dist/recall-navigate-access.d.ts +6 -27
  1710. package/dist/recall-navigate-access.d.ts.map +1 -0
  1711. package/dist/recall-navigate-access.js +2 -2
  1712. package/dist/recall-navigate-action.d.ts +5 -5
  1713. package/dist/recall-navigate-action.d.ts.map +1 -0
  1714. package/dist/recall-navigate-budget.d.ts +3 -4
  1715. package/dist/recall-navigate-budget.d.ts.map +1 -0
  1716. package/dist/recall-navigate-cost.d.ts +2 -3
  1717. package/dist/recall-navigate-cost.d.ts.map +1 -0
  1718. package/dist/recall-navigate-depth.d.ts +2 -3
  1719. package/dist/recall-navigate-depth.d.ts.map +1 -0
  1720. package/dist/recall-navigate-disclosure.d.ts +5 -25
  1721. package/dist/recall-navigate-disclosure.d.ts.map +1 -0
  1722. package/dist/recall-navigate-disclosure.js +2 -2
  1723. package/dist/recall-navigate-link.d.ts +5 -5
  1724. package/dist/recall-navigate-link.d.ts.map +1 -0
  1725. package/dist/recall-navigate-max-children.d.ts +2 -3
  1726. package/dist/recall-navigate-max-children.d.ts.map +1 -0
  1727. package/dist/recall-navigate-node.d.ts +3 -4
  1728. package/dist/recall-navigate-node.d.ts.map +1 -0
  1729. package/dist/recall-navigate-path.d.ts +2 -3
  1730. package/dist/recall-navigate-path.d.ts.map +1 -0
  1731. package/dist/recall-navigate-render.d.ts +3 -4
  1732. package/dist/recall-navigate-render.d.ts.map +1 -0
  1733. package/dist/recall-navigate-traverse.d.ts +5 -6
  1734. package/dist/recall-navigate-traverse.d.ts.map +1 -0
  1735. package/dist/recall-navigate-window.d.ts +5 -6
  1736. package/dist/recall-navigate-window.d.ts.map +1 -0
  1737. package/dist/recall-navigate.d.ts +13 -33
  1738. package/dist/recall-navigate.d.ts.map +1 -0
  1739. package/dist/recall-navigate.js +2 -2
  1740. package/dist/recall-navigation-config.d.ts +7 -8
  1741. package/dist/recall-navigation-config.d.ts.map +1 -0
  1742. package/dist/recall-navigation-http-glue.d.ts +5 -151
  1743. package/dist/recall-navigation-http-glue.d.ts.map +1 -0
  1744. package/dist/recall-navigation-http-glue.js +2 -2
  1745. package/dist/recall-navigation-mcp-tools.d.ts +3 -150
  1746. package/dist/recall-navigation-mcp-tools.d.ts.map +1 -0
  1747. package/dist/recall-navigation-operations.d.ts +11 -2
  1748. package/dist/recall-navigation-operations.d.ts.map +1 -0
  1749. package/dist/recall-navigation-operations.js +66 -61
  1750. package/dist/recall-navigation-renderer.d.ts +4 -28
  1751. package/dist/recall-navigation-renderer.d.ts.map +1 -0
  1752. package/dist/recall-navigation.d.ts +13 -34
  1753. package/dist/recall-navigation.d.ts.map +1 -0
  1754. package/dist/recall-navigation.js +65 -60
  1755. package/dist/recall-pipeline-stages.d.ts +6 -9
  1756. package/dist/recall-pipeline-stages.d.ts.map +1 -0
  1757. package/dist/recall-planner-i18n.d.ts +13 -14
  1758. package/dist/recall-planner-i18n.d.ts.map +1 -0
  1759. package/dist/recall-planner-llm.d.ts +8 -30
  1760. package/dist/recall-planner-llm.d.ts.map +1 -0
  1761. package/dist/recall-qos.d.ts +13 -15
  1762. package/dist/recall-qos.d.ts.map +1 -0
  1763. package/dist/recall-query-policy.d.ts +9 -10
  1764. package/dist/recall-query-policy.d.ts.map +1 -0
  1765. package/dist/recall-recognition-tier.d.ts +27 -28
  1766. package/dist/recall-recognition-tier.d.ts.map +1 -0
  1767. package/dist/recall-state-view-admission.d.ts +7 -26
  1768. package/dist/recall-state-view-admission.d.ts.map +1 -0
  1769. package/dist/recall-state-view-admission.js +3 -3
  1770. package/dist/recall-state-view-anchors.d.ts +10 -29
  1771. package/dist/recall-state-view-anchors.d.ts.map +1 -0
  1772. package/dist/recall-state-view-current.d.ts +4 -5
  1773. package/dist/recall-state-view-current.d.ts.map +1 -0
  1774. package/dist/recall-state-view-inject.d.ts +3 -7
  1775. package/dist/recall-state-view-inject.d.ts.map +1 -0
  1776. package/dist/recall-state-view-kind.d.ts +5 -5
  1777. package/dist/recall-state-view-kind.d.ts.map +1 -0
  1778. package/dist/recall-state-view-label.d.ts +3 -6
  1779. package/dist/recall-state-view-label.d.ts.map +1 -0
  1780. package/dist/recall-state-view-packet.d.ts +7 -9
  1781. package/dist/recall-state-view-packet.d.ts.map +1 -0
  1782. package/dist/recall-state-view-render.d.ts +4 -7
  1783. package/dist/recall-state-view-render.d.ts.map +1 -0
  1784. package/dist/recall-state-view-successor.d.ts +3 -4
  1785. package/dist/recall-state-view-successor.d.ts.map +1 -0
  1786. package/dist/recall-state-view-superseded.d.ts +3 -4
  1787. package/dist/recall-state-view-superseded.d.ts.map +1 -0
  1788. package/dist/recall-state-view-transition.d.ts +4 -5
  1789. package/dist/recall-state-view-transition.d.ts.map +1 -0
  1790. package/dist/recall-state-view-widen.d.ts +3 -6
  1791. package/dist/recall-state-view-widen.d.ts.map +1 -0
  1792. package/dist/recall-state-view-wire.d.ts +3 -6
  1793. package/dist/recall-state-view-wire.d.ts.map +1 -0
  1794. package/dist/recall-state-view-zero-diff.d.ts +4 -5
  1795. package/dist/recall-state-view-zero-diff.d.ts.map +1 -0
  1796. package/dist/recall-state-view.d.ts +16 -17
  1797. package/dist/recall-state-view.d.ts.map +1 -0
  1798. package/dist/recall-state.d.ts +17 -35
  1799. package/dist/recall-state.d.ts.map +1 -0
  1800. package/dist/recall-tag-filter.d.ts +10 -33
  1801. package/dist/recall-tag-filter.d.ts.map +1 -0
  1802. package/dist/recall-timings.d.ts +10 -29
  1803. package/dist/recall-timings.d.ts.map +1 -0
  1804. package/dist/recall-tokenization.d.ts +7 -8
  1805. package/dist/recall-tokenization.d.ts.map +1 -0
  1806. package/dist/recall-why-cli.d.ts +25 -0
  1807. package/dist/recall-why-cli.d.ts.map +1 -0
  1808. package/dist/recall-why-cli.js +9 -0
  1809. package/dist/recall-why-cli.js.map +1 -0
  1810. package/dist/recall-why-renderer.d.ts +25 -0
  1811. package/dist/recall-why-renderer.d.ts.map +1 -0
  1812. package/dist/recall-why-renderer.js +18 -0
  1813. package/dist/recall-why-renderer.js.map +1 -0
  1814. package/dist/recall-why-service.d.ts +49 -0
  1815. package/dist/recall-why-service.d.ts.map +1 -0
  1816. package/dist/recall-why-service.js +46 -0
  1817. package/dist/recall-why-service.js.map +1 -0
  1818. package/dist/recall-why.d.ts +175 -0
  1819. package/dist/recall-why.d.ts.map +1 -0
  1820. package/dist/recall-why.js +25 -0
  1821. package/dist/recall-why.js.map +1 -0
  1822. package/dist/recall-xray-cli.d.ts +7 -31
  1823. package/dist/recall-xray-cli.d.ts.map +1 -0
  1824. package/dist/recall-xray-cli.js +4 -4
  1825. package/dist/recall-xray-renderer.d.ts +9 -33
  1826. package/dist/recall-xray-renderer.d.ts.map +1 -0
  1827. package/dist/recall-xray-renderer.js +3 -3
  1828. package/dist/recall-xray.d.ts +19 -39
  1829. package/dist/recall-xray.d.ts.map +1 -0
  1830. package/dist/recall-xray.js +2 -2
  1831. package/dist/reconcile/cursor.d.ts +15 -37
  1832. package/dist/reconcile/cursor.d.ts.map +1 -0
  1833. package/dist/reconcile/manifest.d.ts +19 -40
  1834. package/dist/reconcile/manifest.d.ts.map +1 -0
  1835. package/dist/reconcile/manifest.js +2 -2
  1836. package/dist/reconcile/plan.d.ts +22 -42
  1837. package/dist/reconcile/plan.d.ts.map +1 -0
  1838. package/dist/reconstruct.d.ts +2 -3
  1839. package/dist/reconstruct.d.ts.map +1 -0
  1840. package/dist/relay/mission-access.d.ts +28 -0
  1841. package/dist/relay/mission-access.d.ts.map +1 -0
  1842. package/dist/relay/mission-fixture.d.ts +11 -0
  1843. package/dist/relay/mission-fixture.d.ts.map +1 -0
  1844. package/dist/relay/mission.d.ts +3952 -0
  1845. package/dist/relay/mission.d.ts.map +1 -0
  1846. package/dist/release-changelog.d.ts +3 -4
  1847. package/dist/release-changelog.d.ts.map +1 -0
  1848. package/dist/relevance.d.ts +3 -3
  1849. package/dist/relevance.d.ts.map +1 -0
  1850. package/dist/replay/normalizers/chatgpt.d.ts +3 -23
  1851. package/dist/replay/normalizers/chatgpt.d.ts.map +1 -0
  1852. package/dist/replay/normalizers/claude.d.ts +3 -23
  1853. package/dist/replay/normalizers/claude.d.ts.map +1 -0
  1854. package/dist/replay/normalizers/openclaw.d.ts +3 -23
  1855. package/dist/replay/normalizers/openclaw.d.ts.map +1 -0
  1856. package/dist/replay/normalizers/shared.d.ts +6 -25
  1857. package/dist/replay/normalizers/shared.d.ts.map +1 -0
  1858. package/dist/replay/runner.d.ts +10 -30
  1859. package/dist/replay/runner.d.ts.map +1 -0
  1860. package/dist/replay/types.d.ts +18 -37
  1861. package/dist/replay/types.d.ts.map +1 -0
  1862. package/dist/replica-divergence.d.ts +24 -45
  1863. package/dist/replica-divergence.d.ts.map +1 -0
  1864. package/dist/replica-divergence.js +3 -3
  1865. package/dist/replica-peers-config.d.ts +50 -18
  1866. package/dist/replica-peers-config.d.ts.map +1 -0
  1867. package/dist/rerank.d.ts +8 -9
  1868. package/dist/rerank.d.ts.map +1 -0
  1869. package/dist/resolution-CHNISQJB.js +36 -0
  1870. package/dist/resolution-CHNISQJB.js.map +1 -0
  1871. package/dist/resolve-auth-token.d.ts +9 -27
  1872. package/dist/resolve-auth-token.d.ts.map +1 -0
  1873. package/dist/resolve-provider-secret.d.ts +10 -11
  1874. package/dist/resolve-provider-secret.d.ts.map +1 -0
  1875. package/dist/response-guidance-recall.d.ts +5 -8
  1876. package/dist/response-guidance-recall.d.ts.map +1 -0
  1877. package/dist/resume-bundles.d.ts +9 -10
  1878. package/dist/resume-bundles.d.ts.map +1 -0
  1879. package/dist/resume-bundles.js +24 -24
  1880. package/dist/retrieval-agents.d.ts +14 -36
  1881. package/dist/retrieval-agents.d.ts.map +1 -0
  1882. package/dist/retrieval-tiers.d.ts +4 -24
  1883. package/dist/retrieval-tiers.d.ts.map +1 -0
  1884. package/dist/retrieval.d.ts +5 -6
  1885. package/dist/retrieval.d.ts.map +1 -0
  1886. package/dist/review/frontmatter.d.ts +6 -0
  1887. package/dist/review/frontmatter.d.ts.map +1 -0
  1888. package/dist/review/index.d.ts +81 -0
  1889. package/dist/review/index.d.ts.map +1 -0
  1890. package/dist/review/review-deck-http-base.d.ts +10 -0
  1891. package/dist/review/review-deck-http-base.d.ts.map +1 -0
  1892. package/dist/review/review-deck-mutation.d.ts +51 -0
  1893. package/dist/review/review-deck-mutation.d.ts.map +1 -0
  1894. package/dist/review/review-deck-snapshot.d.ts +10 -0
  1895. package/dist/review/review-deck-snapshot.d.ts.map +1 -0
  1896. package/dist/review/review-deck-surface.d.ts +33 -0
  1897. package/dist/review/review-deck-surface.d.ts.map +1 -0
  1898. package/dist/review/review-deck.d.ts +107 -0
  1899. package/dist/review/review-deck.d.ts.map +1 -0
  1900. package/dist/routing/engine.d.ts +12 -31
  1901. package/dist/routing/engine.d.ts.map +1 -0
  1902. package/dist/routing/store.d.ts +3 -23
  1903. package/dist/routing/store.d.ts.map +1 -0
  1904. package/dist/runtime/better-sqlite.d.ts +9 -10
  1905. package/dist/runtime/better-sqlite.d.ts.map +1 -0
  1906. package/dist/runtime/child-process.d.ts +5 -5
  1907. package/dist/runtime/child-process.d.ts.map +1 -0
  1908. package/dist/runtime/daemon-health.d.ts +2 -0
  1909. package/dist/runtime/daemon-health.d.ts.map +1 -0
  1910. package/dist/runtime/env.d.ts +5 -6
  1911. package/dist/runtime/env.d.ts.map +1 -0
  1912. package/dist/runtime/http-transport.d.ts +3 -4
  1913. package/dist/runtime/http-transport.d.ts.map +1 -0
  1914. package/dist/salvage-envelope.d.ts +3 -23
  1915. package/dist/salvage-envelope.d.ts.map +1 -0
  1916. package/dist/sanitize.d.ts +5 -7
  1917. package/dist/sanitize.d.ts.map +1 -0
  1918. package/dist/schemas.d.ts +205 -207
  1919. package/dist/schemas.d.ts.map +1 -0
  1920. package/dist/scopes/scope-plan.d.ts +258 -0
  1921. package/dist/scopes/scope-plan.d.ts.map +1 -0
  1922. package/dist/sdk-compat.d.ts +4 -5
  1923. package/dist/sdk-compat.d.ts.map +1 -0
  1924. package/dist/search/abort.d.ts +5 -0
  1925. package/dist/search/abort.d.ts.map +1 -0
  1926. package/dist/search/document-scanner.d.ts +3 -4
  1927. package/dist/search/document-scanner.d.ts.map +1 -0
  1928. package/dist/search/embed-helper.d.ts +8 -26
  1929. package/dist/search/embed-helper.d.ts.map +1 -0
  1930. package/dist/search/factory.d.ts +10 -31
  1931. package/dist/search/factory.d.ts.map +1 -0
  1932. package/dist/search/factory.js +4 -4
  1933. package/dist/search/index.d.ts +11 -32
  1934. package/dist/search/index.d.ts.map +1 -0
  1935. package/dist/search/index.js +10 -10
  1936. package/dist/search/lancedb-backend.d.ts +5 -26
  1937. package/dist/search/lancedb-backend.d.ts.map +1 -0
  1938. package/dist/search/meilisearch-backend.d.ts +4 -24
  1939. package/dist/search/meilisearch-backend.d.ts.map +1 -0
  1940. package/dist/search/noop-backend.d.ts +3 -23
  1941. package/dist/search/noop-backend.d.ts.map +1 -0
  1942. package/dist/search/orama-backend.d.ts +6 -27
  1943. package/dist/search/orama-backend.d.ts.map +1 -0
  1944. package/dist/search/orama-cjk-tokenizer.d.ts +53 -0
  1945. package/dist/search/orama-cjk-tokenizer.d.ts.map +1 -0
  1946. package/dist/search/port.d.ts +10 -29
  1947. package/dist/search/port.d.ts.map +1 -0
  1948. package/dist/search/remote-backend.d.ts +4 -24
  1949. package/dist/search/remote-backend.d.ts.map +1 -0
  1950. package/dist/secure-store/cipher.d.ts +127 -0
  1951. package/dist/secure-store/cipher.d.ts.map +1 -0
  1952. package/dist/secure-store/cli-handlers.d.ts +134 -0
  1953. package/dist/secure-store/cli-handlers.d.ts.map +1 -0
  1954. package/dist/secure-store/cli-renderer.d.ts +16 -0
  1955. package/dist/secure-store/cli-renderer.d.ts.map +1 -0
  1956. package/dist/secure-store/header.d.ts +137 -0
  1957. package/dist/secure-store/header.d.ts.map +1 -0
  1958. package/dist/secure-store/index.d.ts +23 -899
  1959. package/dist/secure-store/index.d.ts.map +1 -0
  1960. package/dist/secure-store/kdf.d.ts +101 -0
  1961. package/dist/secure-store/kdf.d.ts.map +1 -0
  1962. package/dist/secure-store/keyring.d.ts +58 -0
  1963. package/dist/secure-store/keyring.d.ts.map +1 -0
  1964. package/dist/secure-store/metadata.d.ts +104 -0
  1965. package/dist/secure-store/metadata.d.ts.map +1 -0
  1966. package/dist/secure-store/passphrase-reader.d.ts +40 -0
  1967. package/dist/secure-store/passphrase-reader.d.ts.map +1 -0
  1968. package/dist/secure-store/secure-fs.d.ts +227 -0
  1969. package/dist/secure-store/secure-fs.d.ts.map +1 -0
  1970. package/dist/security/audit-memory-cli.d.ts +9 -0
  1971. package/dist/security/audit-memory-cli.d.ts.map +1 -0
  1972. package/dist/security/audit-memory.d.ts +48 -0
  1973. package/dist/security/audit-memory.d.ts.map +1 -0
  1974. package/dist/security/injection-screen.d.ts +19 -0
  1975. package/dist/security/injection-screen.d.ts.map +1 -0
  1976. package/dist/security/origin-authority.d.ts +30 -0
  1977. package/dist/security/origin-authority.d.ts.map +1 -0
  1978. package/dist/security/types.d.ts +13 -0
  1979. package/dist/security/types.d.ts.map +1 -0
  1980. package/dist/semantic-chunking.d.ts +13 -16
  1981. package/dist/semantic-chunking.d.ts.map +1 -0
  1982. package/dist/semantic-consolidation.d.ts +126 -22
  1983. package/dist/semantic-consolidation.d.ts.map +1 -0
  1984. package/dist/semantic-consolidation.js +15 -15
  1985. package/dist/semantic-merge-config.d.ts +2 -3
  1986. package/dist/semantic-merge-config.d.ts.map +1 -0
  1987. package/dist/semantic-rule-promotion.d.ts +7 -7
  1988. package/dist/semantic-rule-promotion.d.ts.map +1 -0
  1989. package/dist/semantic-rule-promotion.js +14 -14
  1990. package/dist/semantic-rule-verifier.d.ts +6 -25
  1991. package/dist/semantic-rule-verifier.d.ts.map +1 -0
  1992. package/dist/semantic-rule-verifier.js +14 -14
  1993. package/dist/session-identity.d.ts +10 -11
  1994. package/dist/session-identity.d.ts.map +1 -0
  1995. package/dist/session-integrity.d.ts +14 -15
  1996. package/dist/session-integrity.d.ts.map +1 -0
  1997. package/dist/session-namespace-bindings.d.ts +10 -11
  1998. package/dist/session-namespace-bindings.d.ts.map +1 -0
  1999. package/dist/session-observer-bands.d.ts +4 -23
  2000. package/dist/session-observer-bands.d.ts.map +1 -0
  2001. package/dist/session-observer-state.d.ts +6 -25
  2002. package/dist/session-observer-state.d.ts.map +1 -0
  2003. package/dist/session-summaries/adapters.d.ts +5 -0
  2004. package/dist/session-summaries/adapters.d.ts.map +1 -0
  2005. package/dist/session-summaries/index.d.ts +7 -0
  2006. package/dist/session-summaries/index.d.ts.map +1 -0
  2007. package/dist/session-summaries/redaction.d.ts +8 -0
  2008. package/dist/session-summaries/redaction.d.ts.map +1 -0
  2009. package/dist/session-summaries/types.d.ts +113 -0
  2010. package/dist/session-summaries/types.d.ts.map +1 -0
  2011. package/dist/session-toggles.d.ts +4 -4
  2012. package/dist/session-toggles.d.ts.map +1 -0
  2013. package/dist/session-transcript-migration.d.ts +9 -10
  2014. package/dist/session-transcript-migration.d.ts.map +1 -0
  2015. package/dist/shared-context/authority-precedence.d.ts +22 -0
  2016. package/dist/shared-context/authority-precedence.d.ts.map +1 -0
  2017. package/dist/shared-context/authority.d.ts +18 -0
  2018. package/dist/shared-context/authority.d.ts.map +1 -0
  2019. package/dist/shared-context/claim-key.d.ts +14 -0
  2020. package/dist/shared-context/claim-key.d.ts.map +1 -0
  2021. package/dist/shared-context/contradictions.d.ts +20 -0
  2022. package/dist/shared-context/contradictions.d.ts.map +1 -0
  2023. package/dist/shared-context/curation-lint.d.ts +23 -0
  2024. package/dist/shared-context/curation-lint.d.ts.map +1 -0
  2025. package/dist/shared-context/envelope-actor.d.ts +14 -0
  2026. package/dist/shared-context/envelope-actor.d.ts.map +1 -0
  2027. package/dist/shared-context/envelope-at.d.ts +19 -0
  2028. package/dist/shared-context/envelope-at.d.ts.map +1 -0
  2029. package/dist/shared-context/envelope-id.d.ts +14 -0
  2030. package/dist/shared-context/envelope-id.d.ts.map +1 -0
  2031. package/dist/shared-context/envelope-io.d.ts +100 -0
  2032. package/dist/shared-context/envelope-io.d.ts.map +1 -0
  2033. package/dist/shared-context/envelope-required.d.ts +14 -0
  2034. package/dist/shared-context/envelope-required.d.ts.map +1 -0
  2035. package/dist/shared-context/envelope-ttl.d.ts +12 -0
  2036. package/dist/shared-context/envelope-ttl.d.ts.map +1 -0
  2037. package/dist/shared-context/governance.d.ts +28 -0
  2038. package/dist/shared-context/governance.d.ts.map +1 -0
  2039. package/dist/shared-context/iso-instant.d.ts +19 -0
  2040. package/dist/shared-context/iso-instant.d.ts.map +1 -0
  2041. package/dist/shared-context/manager.d.ts +21 -48
  2042. package/dist/shared-context/manager.d.ts.map +1 -0
  2043. package/dist/shared-context/provenance.d.ts +18 -0
  2044. package/dist/shared-context/provenance.d.ts.map +1 -0
  2045. package/dist/shared-context/staleness.d.ts +18 -0
  2046. package/dist/shared-context/staleness.d.ts.map +1 -0
  2047. package/dist/shared-context/supersession-chain.d.ts +41 -0
  2048. package/dist/shared-context/supersession-chain.d.ts.map +1 -0
  2049. package/dist/shared-context/trajectories.d.ts +24 -0
  2050. package/dist/shared-context/trajectories.d.ts.map +1 -0
  2051. package/dist/shared-context/write-output-controls.d.ts +4 -5
  2052. package/dist/shared-context/write-output-controls.d.ts.map +1 -0
  2053. package/dist/signal.d.ts +4 -23
  2054. package/dist/signal.d.ts.map +1 -0
  2055. package/dist/skills-registry.d.ts +4 -5
  2056. package/dist/skills-registry.d.ts.map +1 -0
  2057. package/dist/source-agent-qualifier.d.ts +8 -27
  2058. package/dist/source-agent-qualifier.d.ts.map +1 -0
  2059. package/dist/source-agent-qualifier.js +23 -23
  2060. package/dist/source-attribution.d.ts +20 -21
  2061. package/dist/source-attribution.d.ts.map +1 -0
  2062. package/dist/spaces/index.d.ts +148 -0
  2063. package/dist/spaces/index.d.ts.map +1 -0
  2064. package/dist/standing-memory-block.d.ts +25 -26
  2065. package/dist/standing-memory-block.d.ts.map +1 -0
  2066. package/dist/standup/access-operations.d.ts +2 -0
  2067. package/dist/standup/access-operations.d.ts.map +1 -0
  2068. package/dist/standup/build.d.ts +6 -7
  2069. package/dist/standup/build.d.ts.map +1 -0
  2070. package/dist/standup/build.js +15 -15
  2071. package/dist/standup/http-glue.d.ts +4 -0
  2072. package/dist/standup/http-glue.d.ts.map +1 -0
  2073. package/dist/standup/mcp-tools.d.ts +3 -0
  2074. package/dist/standup/mcp-tools.d.ts.map +1 -0
  2075. package/dist/storage/cas-revision-host.d.ts +34 -0
  2076. package/dist/storage/cas-revision-host.d.ts.map +1 -0
  2077. package/dist/storage/cas-revision-store.d.ts +176 -0
  2078. package/dist/storage/cas-revision-store.d.ts.map +1 -0
  2079. package/dist/storage/citation-hash-source.d.ts +3 -0
  2080. package/dist/storage/citation-hash-source.d.ts.map +1 -0
  2081. package/dist/storage/committed-invalidation.d.ts +9 -0
  2082. package/dist/storage/committed-invalidation.d.ts.map +1 -0
  2083. package/dist/storage/content-hash-index.d.ts +269 -0
  2084. package/dist/storage/content-hash-index.d.ts.map +1 -0
  2085. package/dist/storage/context-transform-ledger.d.ts +10 -0
  2086. package/dist/storage/context-transform-ledger.d.ts.map +1 -0
  2087. package/dist/storage/deletion-revision-store.d.ts +79 -0
  2088. package/dist/storage/deletion-revision-store.d.ts.map +1 -0
  2089. package/dist/storage/entity-alias-config.d.ts +2 -0
  2090. package/dist/storage/entity-alias-config.d.ts.map +1 -0
  2091. package/dist/storage/entity-canonical-id-lock.d.ts +4 -0
  2092. package/dist/storage/entity-canonical-id-lock.d.ts.map +1 -0
  2093. package/dist/storage/entity-canonical-id-migration-adapter.d.ts +24 -0
  2094. package/dist/storage/entity-canonical-id-migration-adapter.d.ts.map +1 -0
  2095. package/dist/storage/entity-canonical-id-migration-runner.d.ts +16 -0
  2096. package/dist/storage/entity-canonical-id-migration-runner.d.ts.map +1 -0
  2097. package/dist/storage/entity-canonical-id-migration.d.ts +44 -0
  2098. package/dist/storage/entity-canonical-id-migration.d.ts.map +1 -0
  2099. package/dist/storage/entity-canonical-id-references.d.ts +173 -0
  2100. package/dist/storage/entity-canonical-id-references.d.ts.map +1 -0
  2101. package/dist/storage/entity-id-safety.d.ts +2 -0
  2102. package/dist/storage/entity-id-safety.d.ts.map +1 -0
  2103. package/dist/storage/entity-ref-repair.d.ts +45 -0
  2104. package/dist/storage/entity-ref-repair.d.ts.map +1 -0
  2105. package/dist/storage/entity-store.d.ts +131 -0
  2106. package/dist/storage/entity-store.d.ts.map +1 -0
  2107. package/dist/storage/entity-timeline.d.ts +34 -0
  2108. package/dist/storage/entity-timeline.d.ts.map +1 -0
  2109. package/dist/storage/identity-continuity-store.d.ts +40 -0
  2110. package/dist/storage/identity-continuity-store.d.ts.map +1 -0
  2111. package/dist/storage/memory-frontmatter-metadata.d.ts +4 -0
  2112. package/dist/storage/memory-frontmatter-metadata.d.ts.map +1 -0
  2113. package/dist/storage/memory-lifecycle-ledger-access.d.ts +194 -0
  2114. package/dist/storage/memory-lifecycle-ledger-access.d.ts.map +1 -0
  2115. package/dist/storage/memory-migration-serialization.d.ts +5 -0
  2116. package/dist/storage/memory-migration-serialization.d.ts.map +1 -0
  2117. package/dist/storage/memory-read-store.d.ts +193 -0
  2118. package/dist/storage/memory-read-store.d.ts.map +1 -0
  2119. package/dist/storage/profile-header.d.ts +16 -0
  2120. package/dist/storage/profile-header.d.ts.map +1 -0
  2121. package/dist/storage/questions-file.d.ts +11 -0
  2122. package/dist/storage/questions-file.d.ts.map +1 -0
  2123. package/dist/storage/secure-line-reader.d.ts +53 -0
  2124. package/dist/storage/secure-line-reader.d.ts.map +1 -0
  2125. package/dist/storage/supersession-audit.d.ts +7 -0
  2126. package/dist/storage/supersession-audit.d.ts.map +1 -0
  2127. package/dist/storage/supersession-side-effects.d.ts +51 -0
  2128. package/dist/storage/supersession-side-effects.d.ts.map +1 -0
  2129. package/dist/storage/tombstone-blocked-capture-index.d.ts +93 -0
  2130. package/dist/storage/tombstone-blocked-capture-index.d.ts.map +1 -0
  2131. package/dist/storage/tombstone-blocked-capture-mutation.d.ts +53 -0
  2132. package/dist/storage/tombstone-blocked-capture-mutation.d.ts.map +1 -0
  2133. package/dist/storage/tombstone-blocked-capture-sync.d.ts +96 -0
  2134. package/dist/storage/tombstone-blocked-capture-sync.d.ts.map +1 -0
  2135. package/dist/storage/tombstone-migration-sources.d.ts +24 -0
  2136. package/dist/storage/tombstone-migration-sources.d.ts.map +1 -0
  2137. package/dist/storage/windowed-memory-read.d.ts +28 -0
  2138. package/dist/storage/windowed-memory-read.d.ts.map +1 -0
  2139. package/dist/storage-contract/harness.d.ts +59 -0
  2140. package/dist/storage-contract/harness.d.ts.map +1 -0
  2141. package/dist/storage-guards.d.ts +6 -7
  2142. package/dist/storage-guards.d.ts.map +1 -0
  2143. package/dist/storage-paths.d.ts +8 -9
  2144. package/dist/storage-paths.d.ts.map +1 -0
  2145. package/dist/storage.d.ts +1362 -33
  2146. package/dist/storage.d.ts.map +1 -0
  2147. package/dist/storage.js +15 -15
  2148. package/dist/store-contract.d.ts +9 -10
  2149. package/dist/store-contract.d.ts.map +1 -0
  2150. package/dist/structured-attributes.d.ts +6 -7
  2151. package/dist/structured-attributes.d.ts.map +1 -0
  2152. package/dist/subject-config.d.ts +4 -24
  2153. package/dist/subject-config.d.ts.map +1 -0
  2154. package/dist/summarizer.d.ts +7 -27
  2155. package/dist/summarizer.d.ts.map +1 -0
  2156. package/dist/summarizer.js +3 -3
  2157. package/dist/summary-snapshot.d.ts +6 -25
  2158. package/dist/summary-snapshot.d.ts.map +1 -0
  2159. package/dist/support-passport/access-http-base.d.ts +20 -0
  2160. package/dist/support-passport/access-http-base.d.ts.map +1 -0
  2161. package/dist/support-passport/access-http.d.ts +64 -0
  2162. package/dist/support-passport/access-http.d.ts.map +1 -0
  2163. package/dist/support-passport/access-operations.d.ts +197 -0
  2164. package/dist/support-passport/access-operations.d.ts.map +1 -0
  2165. package/dist/support-passport/access-service-base.d.ts +86 -0
  2166. package/dist/support-passport/access-service-base.d.ts.map +1 -0
  2167. package/dist/support-passport/access-surface.d.ts +118 -0
  2168. package/dist/support-passport/access-surface.d.ts.map +1 -0
  2169. package/dist/support-passport/card-projection.d.ts +83 -0
  2170. package/dist/support-passport/card-projection.d.ts.map +1 -0
  2171. package/dist/support-passport/card-replacement.d.ts +21 -0
  2172. package/dist/support-passport/card-replacement.d.ts.map +1 -0
  2173. package/dist/support-passport/card-service.d.ts +65 -0
  2174. package/dist/support-passport/card-service.d.ts.map +1 -0
  2175. package/dist/support-passport/card-state.d.ts +28 -0
  2176. package/dist/support-passport/card-state.d.ts.map +1 -0
  2177. package/dist/support-passport/config.d.ts +4 -0
  2178. package/dist/support-passport/config.d.ts.map +1 -0
  2179. package/dist/support-passport/contracts.d.ts +165 -0
  2180. package/dist/support-passport/contracts.d.ts.map +1 -0
  2181. package/dist/support-passport/errors.d.ts +7 -0
  2182. package/dist/support-passport/errors.d.ts.map +1 -0
  2183. package/dist/support-passport/generated-batch.d.ts +47 -0
  2184. package/dist/support-passport/generated-batch.d.ts.map +1 -0
  2185. package/dist/support-passport/grant-contracts.d.ts +443 -0
  2186. package/dist/support-passport/grant-contracts.d.ts.map +1 -0
  2187. package/dist/support-passport/grant-service.d.ts +48 -0
  2188. package/dist/support-passport/grant-service.d.ts.map +1 -0
  2189. package/dist/support-passport/grant-store.d.ts +84 -0
  2190. package/dist/support-passport/grant-store.d.ts.map +1 -0
  2191. package/dist/support-passport/index.d.ts +17 -571
  2192. package/dist/support-passport/index.d.ts.map +1 -0
  2193. package/dist/support-passport/index.js +75 -70
  2194. package/dist/support-passport/mcp-tools.d.ts +16 -0
  2195. package/dist/support-passport/mcp-tools.d.ts.map +1 -0
  2196. package/dist/support-passport/model-adapter.d.ts +90 -0
  2197. package/dist/support-passport/model-adapter.d.ts.map +1 -0
  2198. package/dist/support-passport/model-audit.d.ts +115 -0
  2199. package/dist/support-passport/model-audit.d.ts.map +1 -0
  2200. package/dist/support-passport/model-bridge.d.ts +105 -0
  2201. package/dist/support-passport/model-bridge.d.ts.map +1 -0
  2202. package/dist/support-passport/model-contracts.d.ts +219 -0
  2203. package/dist/support-passport/model-contracts.d.ts.map +1 -0
  2204. package/dist/support-passport/model-service.d.ts +58 -0
  2205. package/dist/support-passport/model-service.d.ts.map +1 -0
  2206. package/dist/support-passport/offline-sync-guard.d.ts +46 -0
  2207. package/dist/support-passport/offline-sync-guard.d.ts.map +1 -0
  2208. package/dist/support-passport/owner-lock.d.ts +16 -0
  2209. package/dist/support-passport/owner-lock.d.ts.map +1 -0
  2210. package/dist/support-passport/private-file.d.ts +16 -0
  2211. package/dist/support-passport/private-file.d.ts.map +1 -0
  2212. package/dist/support-passport/public-http.d.ts +23 -0
  2213. package/dist/support-passport/public-http.d.ts.map +1 -0
  2214. package/dist/surfaces/dreams.d.ts +4 -5
  2215. package/dist/surfaces/dreams.d.ts.map +1 -0
  2216. package/dist/surfaces/heartbeat.d.ts +4 -5
  2217. package/dist/surfaces/heartbeat.d.ts.map +1 -0
  2218. package/dist/sync/index.d.ts +69 -0
  2219. package/dist/sync/index.d.ts.map +1 -0
  2220. package/dist/targeted-fact-recall.d.ts +5 -8
  2221. package/dist/targeted-fact-recall.d.ts.map +1 -0
  2222. package/dist/task-llm-config.d.ts +4 -5
  2223. package/dist/task-llm-config.d.ts.map +1 -0
  2224. package/dist/taxonomy/default-taxonomy.d.ts +7 -0
  2225. package/dist/taxonomy/default-taxonomy.d.ts.map +1 -0
  2226. package/dist/taxonomy/index.d.ts +11 -0
  2227. package/dist/taxonomy/index.d.ts.map +1 -0
  2228. package/dist/taxonomy/resolver-doc-generator.d.ts +17 -0
  2229. package/dist/taxonomy/resolver-doc-generator.d.ts.map +1 -0
  2230. package/dist/taxonomy/resolver.d.ts +25 -0
  2231. package/dist/taxonomy/resolver.d.ts.map +1 -0
  2232. package/dist/taxonomy/taxonomy-loader.d.ts +38 -0
  2233. package/dist/taxonomy/taxonomy-loader.d.ts.map +1 -0
  2234. package/dist/taxonomy/types.d.ts +49 -0
  2235. package/dist/taxonomy/types.d.ts.map +1 -0
  2236. package/dist/telemetry-transcript.d.ts +6 -7
  2237. package/dist/telemetry-transcript.d.ts.map +1 -0
  2238. package/dist/temporal-index-batch.d.ts +30 -1
  2239. package/dist/temporal-index-batch.d.ts.map +1 -0
  2240. package/dist/temporal-index-compat.d.ts +7 -267
  2241. package/dist/temporal-index-compat.d.ts.map +1 -0
  2242. package/dist/temporal-index.d.ts +230 -1
  2243. package/dist/temporal-index.d.ts.map +1 -0
  2244. package/dist/temporal-supersession.d.ts +14 -34
  2245. package/dist/temporal-supersession.d.ts.map +1 -0
  2246. package/dist/temporal-timeline-recall.d.ts +5 -24
  2247. package/dist/temporal-timeline-recall.d.ts.map +1 -0
  2248. package/dist/temporal-validity.d.ts +7 -27
  2249. package/dist/temporal-validity.d.ts.map +1 -0
  2250. package/dist/testing/lifecycle-matrix.d.ts +11 -12
  2251. package/dist/testing/lifecycle-matrix.d.ts.map +1 -0
  2252. package/dist/testing/orchestrator-lite.d.ts +80 -0
  2253. package/dist/testing/orchestrator-lite.d.ts.map +1 -0
  2254. package/dist/testing/subjects/meetings-namespace-harness.d.ts +32 -0
  2255. package/dist/testing/subjects/meetings-namespace-harness.d.ts.map +1 -0
  2256. package/dist/testing/tmp-dir.d.ts +9 -0
  2257. package/dist/testing/tmp-dir.d.ts.map +1 -0
  2258. package/dist/thread-key.d.ts +2 -3
  2259. package/dist/thread-key.d.ts.map +1 -0
  2260. package/dist/threading.d.ts +3 -23
  2261. package/dist/threading.d.ts.map +1 -0
  2262. package/dist/tier-migration.d.ts +10 -43
  2263. package/dist/tier-migration.d.ts.map +1 -0
  2264. package/dist/tier-routing.d.ts +8 -27
  2265. package/dist/tier-routing.d.ts.map +1 -0
  2266. package/dist/tmt.d.ts +18 -19
  2267. package/dist/tmt.d.ts.map +1 -0
  2268. package/dist/token-estimate.d.ts +2 -3
  2269. package/dist/token-estimate.d.ts.map +1 -0
  2270. package/dist/tokens.d.ts +15 -19
  2271. package/dist/tokens.d.ts.map +1 -0
  2272. package/dist/tokens.js +3 -3
  2273. package/dist/tool-scoped-memory.d.ts +7 -8
  2274. package/dist/tool-scoped-memory.d.ts.map +1 -0
  2275. package/dist/topics.d.ts +4 -24
  2276. package/dist/topics.d.ts.map +1 -0
  2277. package/dist/training-export/converter.d.ts +18 -0
  2278. package/dist/training-export/converter.d.ts.map +1 -0
  2279. package/dist/training-export/date-parse.d.ts +38 -0
  2280. package/dist/training-export/date-parse.d.ts.map +1 -0
  2281. package/dist/training-export/index.d.ts +10 -0
  2282. package/dist/training-export/index.d.ts.map +1 -0
  2283. package/dist/training-export/registry.d.ts +27 -0
  2284. package/dist/training-export/registry.d.ts.map +1 -0
  2285. package/dist/training-export/types.d.ts +29 -0
  2286. package/dist/training-export/types.d.ts.map +1 -0
  2287. package/dist/transcript.d.ts +5 -24
  2288. package/dist/transcript.d.ts.map +1 -0
  2289. package/dist/transfer/autodetect.d.ts +3 -4
  2290. package/dist/transfer/autodetect.d.ts.map +1 -0
  2291. package/dist/transfer/backup.d.ts +3 -4
  2292. package/dist/transfer/backup.d.ts.map +1 -0
  2293. package/dist/transfer/backup.js +2 -2
  2294. package/dist/transfer/capsule-crypto.d.ts +168 -0
  2295. package/dist/transfer/capsule-crypto.d.ts.map +1 -0
  2296. package/dist/transfer/capsule-export.d.ts +6 -9
  2297. package/dist/transfer/capsule-export.d.ts.map +1 -0
  2298. package/dist/transfer/capsule-export.js +2 -2
  2299. package/dist/transfer/capsule-fork.d.ts +117 -0
  2300. package/dist/transfer/capsule-fork.d.ts.map +1 -0
  2301. package/dist/transfer/capsule-import.d.ts +10 -13
  2302. package/dist/transfer/capsule-import.d.ts.map +1 -0
  2303. package/dist/transfer/capsule-import.js +2 -2
  2304. package/dist/transfer/capsule-merge.d.ts +124 -0
  2305. package/dist/transfer/capsule-merge.d.ts.map +1 -0
  2306. package/dist/transfer/conflict-policy.d.ts +5 -0
  2307. package/dist/transfer/conflict-policy.d.ts.map +1 -0
  2308. package/dist/transfer/constants.d.ts +4 -5
  2309. package/dist/transfer/constants.d.ts.map +1 -0
  2310. package/dist/transfer/exclusions.d.ts +8 -0
  2311. package/dist/transfer/exclusions.d.ts.map +1 -0
  2312. package/dist/transfer/export-json.d.ts +3 -4
  2313. package/dist/transfer/export-json.d.ts.map +1 -0
  2314. package/dist/transfer/export-md.d.ts +4 -5
  2315. package/dist/transfer/export-md.d.ts.map +1 -0
  2316. package/dist/transfer/export-okf.d.ts +11 -31
  2317. package/dist/transfer/export-okf.d.ts.map +1 -0
  2318. package/dist/transfer/export-okf.js +14 -14
  2319. package/dist/transfer/export-sqlite.d.ts +3 -4
  2320. package/dist/transfer/export-sqlite.d.ts.map +1 -0
  2321. package/dist/transfer/fs-utils.d.ts +20 -21
  2322. package/dist/transfer/fs-utils.d.ts.map +1 -0
  2323. package/dist/transfer/import-json.d.ts +6 -7
  2324. package/dist/transfer/import-json.d.ts.map +1 -0
  2325. package/dist/transfer/import-md.d.ts +5 -6
  2326. package/dist/transfer/import-md.d.ts.map +1 -0
  2327. package/dist/transfer/import-sqlite.d.ts +5 -6
  2328. package/dist/transfer/import-sqlite.d.ts.map +1 -0
  2329. package/dist/transfer/integrity.d.ts +8 -0
  2330. package/dist/transfer/integrity.d.ts.map +1 -0
  2331. package/dist/transfer/sqlite-schema.d.ts +3 -4
  2332. package/dist/transfer/sqlite-schema.d.ts.map +1 -0
  2333. package/dist/transfer/types.d.ts +114 -116
  2334. package/dist/transfer/types.d.ts.map +1 -0
  2335. package/dist/trust-score-stage.d.ts +21 -40
  2336. package/dist/trust-score-stage.d.ts.map +1 -0
  2337. package/dist/trust-score.d.ts +15 -34
  2338. package/dist/trust-score.d.ts.map +1 -0
  2339. package/dist/trust-zones.d.ts +29 -30
  2340. package/dist/trust-zones.d.ts.map +1 -0
  2341. package/dist/types-continuity.d.ts +10 -11
  2342. package/dist/types-continuity.d.ts.map +1 -0
  2343. package/dist/types.d.ts +3500 -18
  2344. package/dist/types.d.ts.map +1 -0
  2345. package/dist/types.js +1 -1
  2346. package/dist/user-message-cleaning.d.ts +3 -4
  2347. package/dist/user-message-cleaning.d.ts.map +1 -0
  2348. package/dist/user-model.d.ts +17 -18
  2349. package/dist/user-model.d.ts.map +1 -0
  2350. package/dist/utility-learner.d.ts +10 -12
  2351. package/dist/utility-learner.d.ts.map +1 -0
  2352. package/dist/utility-runtime.d.ts +6 -27
  2353. package/dist/utility-runtime.d.ts.map +1 -0
  2354. package/dist/utility-telemetry.d.ts +12 -13
  2355. package/dist/utility-telemetry.d.ts.map +1 -0
  2356. package/dist/utils/category-dir.d.ts +45 -0
  2357. package/dist/utils/category-dir.d.ts.map +1 -0
  2358. package/dist/utils/errno.d.ts +4 -0
  2359. package/dist/utils/errno.d.ts.map +1 -0
  2360. package/dist/utils/iso-timestamp.d.ts +18 -0
  2361. package/dist/utils/iso-timestamp.d.ts.map +1 -0
  2362. package/dist/utils/path-containment.d.ts +50 -0
  2363. package/dist/utils/path-containment.d.ts.map +1 -0
  2364. package/dist/utils/path.d.ts +2 -3
  2365. package/dist/utils/path.d.ts.map +1 -0
  2366. package/dist/utils/script-aware-text.d.ts +27 -0
  2367. package/dist/utils/script-aware-text.d.ts.map +1 -0
  2368. package/dist/utils/serialize-mutations.d.ts +6 -7
  2369. package/dist/utils/serialize-mutations.d.ts.map +1 -0
  2370. package/dist/utils/yaml-scalar.d.ts +9 -0
  2371. package/dist/utils/yaml-scalar.d.ts.map +1 -0
  2372. package/dist/verified-recall.d.ts +5 -7
  2373. package/dist/verified-recall.d.ts.map +1 -0
  2374. package/dist/verified-recall.js +14 -14
  2375. package/dist/version-utils.d.ts +3 -4
  2376. package/dist/version-utils.d.ts.map +1 -0
  2377. package/dist/wearables/auto-sync.d.ts +63 -0
  2378. package/dist/wearables/auto-sync.d.ts.map +1 -0
  2379. package/dist/wearables/cleanup.d.ts +39 -0
  2380. package/dist/wearables/cleanup.d.ts.map +1 -0
  2381. package/dist/wearables/cli.d.ts +24 -0
  2382. package/dist/wearables/cli.d.ts.map +1 -0
  2383. package/dist/wearables/config.d.ts +22 -0
  2384. package/dist/wearables/config.d.ts.map +1 -0
  2385. package/dist/wearables/corrections.d.ts +46 -0
  2386. package/dist/wearables/corrections.d.ts.map +1 -0
  2387. package/dist/wearables/day-store.d.ts +152 -0
  2388. package/dist/wearables/day-store.d.ts.map +1 -0
  2389. package/dist/wearables/errors.d.ts +19 -0
  2390. package/dist/wearables/errors.d.ts.map +1 -0
  2391. package/dist/wearables/fusion/cluster.d.ts +70 -0
  2392. package/dist/wearables/fusion/cluster.d.ts.map +1 -0
  2393. package/dist/wearables/fusion/fuse.d.ts +40 -0
  2394. package/dist/wearables/fusion/fuse.d.ts.map +1 -0
  2395. package/dist/wearables/fusion/index.d.ts +16 -0
  2396. package/dist/wearables/fusion/index.d.ts.map +1 -0
  2397. package/dist/wearables/fusion/reconcile.d.ts +52 -0
  2398. package/dist/wearables/fusion/reconcile.d.ts.map +1 -0
  2399. package/dist/wearables/fusion/reconstruct.d.ts +37 -0
  2400. package/dist/wearables/fusion/reconstruct.d.ts.map +1 -0
  2401. package/dist/wearables/fusion/store.d.ts +131 -0
  2402. package/dist/wearables/fusion/store.d.ts.map +1 -0
  2403. package/dist/wearables/fusion/types.d.ts +219 -0
  2404. package/dist/wearables/fusion/types.d.ts.map +1 -0
  2405. package/dist/wearables/http-glue.d.ts +12 -0
  2406. package/dist/wearables/http-glue.d.ts.map +1 -0
  2407. package/dist/wearables/index.d.ts +23 -0
  2408. package/dist/wearables/index.d.ts.map +1 -0
  2409. package/dist/wearables/mcp-tools.d.ts +12 -0
  2410. package/dist/wearables/mcp-tools.d.ts.map +1 -0
  2411. package/dist/wearables/memory-gen.d.ts +139 -0
  2412. package/dist/wearables/memory-gen.d.ts.map +1 -0
  2413. package/dist/wearables/pipeline.d.ts +81 -0
  2414. package/dist/wearables/pipeline.d.ts.map +1 -0
  2415. package/dist/wearables/redaction.d.ts +75 -0
  2416. package/dist/wearables/redaction.d.ts.map +1 -0
  2417. package/dist/wearables/registry.d.ts +47 -0
  2418. package/dist/wearables/registry.d.ts.map +1 -0
  2419. package/dist/wearables/service.d.ts +225 -0
  2420. package/dist/wearables/service.d.ts.map +1 -0
  2421. package/dist/wearables/speakers.d.ts +83 -0
  2422. package/dist/wearables/speakers.d.ts.map +1 -0
  2423. package/dist/wearables/sync-state.d.ts +52 -0
  2424. package/dist/wearables/sync-state.d.ts.map +1 -0
  2425. package/dist/wearables/text-language.d.ts +41 -0
  2426. package/dist/wearables/text-language.d.ts.map +1 -0
  2427. package/dist/wearables/trust.d.ts +93 -0
  2428. package/dist/wearables/trust.d.ts.map +1 -0
  2429. package/dist/wearables/types.d.ts +389 -0
  2430. package/dist/wearables/types.d.ts.map +1 -0
  2431. package/dist/whitespace.d.ts +7 -8
  2432. package/dist/whitespace.d.ts.map +1 -0
  2433. package/dist/who-knows-cli.d.ts +8 -155
  2434. package/dist/who-knows-cli.d.ts.map +1 -0
  2435. package/dist/who-knows-cli.js +16 -16
  2436. package/dist/who-knows.d.ts +97 -145
  2437. package/dist/who-knows.d.ts.map +1 -0
  2438. package/dist/who-knows.js +15 -15
  2439. package/dist/work/board.d.ts +8 -10
  2440. package/dist/work/board.d.ts.map +1 -0
  2441. package/dist/work/boundary.d.ts +5 -6
  2442. package/dist/work/boundary.d.ts.map +1 -0
  2443. package/dist/work/storage.d.ts +4 -6
  2444. package/dist/work/storage.d.ts.map +1 -0
  2445. package/dist/work/types.d.ts +11 -12
  2446. package/dist/work/types.d.ts.map +1 -0
  2447. package/dist/work-product-ledger.d.ts +12 -13
  2448. package/dist/work-product-ledger.d.ts.map +1 -0
  2449. package/dist/write-envelope.d.ts +23 -42
  2450. package/dist/write-envelope.d.ts.map +1 -0
  2451. package/dist/write-quarantine.d.ts +8 -9
  2452. package/dist/write-quarantine.d.ts.map +1 -0
  2453. package/dist/write-rate-limiter.d.ts +4 -4
  2454. package/dist/write-rate-limiter.d.ts.map +1 -0
  2455. package/package.json +2 -2
  2456. package/scripts/build-with-heap.mjs +40 -19
  2457. package/src/access-boundary.ts +1 -0
  2458. package/src/access-errors.test.ts +182 -0
  2459. package/src/access-errors.ts +252 -1
  2460. package/src/access-http.ts +36 -103
  2461. package/src/access-mcp-output-schemas.ts +1 -0
  2462. package/src/access-mcp.ts +21 -2
  2463. package/src/access-operations-batch.ts +8 -0
  2464. package/src/access-recall-diagnostics.ts +236 -0
  2465. package/src/access-service.ts +6 -0
  2466. package/src/access-surface-catalog.ts +2 -0
  2467. package/src/index.ts +11 -0
  2468. package/src/mcp-read-only-tools.ts +1 -0
  2469. package/src/orchestration/orchestrator-helpers.ts +7 -0
  2470. package/src/orchestration/recall-internal.ts +1 -1
  2471. package/src/recall-degradation-sink.test.ts +144 -0
  2472. package/src/recall-why-cli.ts +59 -0
  2473. package/src/recall-why-renderer.ts +142 -0
  2474. package/src/recall-why-service.test.ts +306 -0
  2475. package/src/recall-why-service.ts +218 -0
  2476. package/src/recall-why.test.ts +511 -0
  2477. package/src/recall-why.ts +568 -0
  2478. package/src/types.ts +1 -0
  2479. package/dist/access-namespace-preflight-U9RAdxqZ.d.ts +0 -146
  2480. package/dist/access-service-CUNM5RfA.d.ts +0 -4700
  2481. package/dist/capsule-crypto-YO5QJ6L3.js +0 -18
  2482. package/dist/catalog-BuMyYPUn.d.ts +0 -473
  2483. package/dist/chunk-27MKMTBY.js +0 -342
  2484. package/dist/chunk-2HJKAVAS.js +0 -216
  2485. package/dist/chunk-2QZJ4P27.js +0 -203
  2486. package/dist/chunk-2SIKTXWX.js +0 -502
  2487. package/dist/chunk-2Z24E5W2.js +0 -22
  2488. package/dist/chunk-2Z24E5W2.js.map +0 -1
  2489. package/dist/chunk-3R23DDD3.js +0 -9782
  2490. package/dist/chunk-3S6URXEH.js +0 -63
  2491. package/dist/chunk-43IQRLEF.js +0 -256
  2492. package/dist/chunk-4UVJ6EIT.js +0 -22
  2493. package/dist/chunk-4UVJ6EIT.js.map +0 -1
  2494. package/dist/chunk-5FAGCOZD.js +0 -761
  2495. package/dist/chunk-75YZ5VAI.js +0 -140
  2496. package/dist/chunk-7IRZK6MM.js +0 -256
  2497. package/dist/chunk-7QVYVSEH.js +0 -285
  2498. package/dist/chunk-7RGX7BMF.js +0 -103
  2499. package/dist/chunk-7RKAE6Y4.js +0 -727
  2500. package/dist/chunk-AH44WTLJ.js +0 -415
  2501. package/dist/chunk-AHVJ6GLL.js +0 -95
  2502. package/dist/chunk-AIVRD66I.js +0 -511
  2503. package/dist/chunk-AQ55YKEV.js +0 -29
  2504. package/dist/chunk-AQWGCHIV.js +0 -263
  2505. package/dist/chunk-ARRKSBQU.js +0 -72
  2506. package/dist/chunk-AYHNTYVG.js +0 -43
  2507. package/dist/chunk-BSCNBIF4.js +0 -24
  2508. package/dist/chunk-BXLOS5AJ.js +0 -112
  2509. package/dist/chunk-BXOPUJ3W.js +0 -801
  2510. package/dist/chunk-CEO4DONG.js +0 -28
  2511. package/dist/chunk-CVILPI77.js +0 -432
  2512. package/dist/chunk-D2N3PMAE.js +0 -51
  2513. package/dist/chunk-D7VT2LED.js +0 -253
  2514. package/dist/chunk-DAOMWGO2.js +0 -65
  2515. package/dist/chunk-DGS34QSY.js +0 -141
  2516. package/dist/chunk-DI52XAKG.js +0 -223
  2517. package/dist/chunk-DQEMWVMT.js +0 -249
  2518. package/dist/chunk-DZP2XMZC.js +0 -1084
  2519. package/dist/chunk-EVQ33D3N.js +0 -731
  2520. package/dist/chunk-FPB5LQWW.js +0 -71
  2521. package/dist/chunk-FPB5LQWW.js.map +0 -1
  2522. package/dist/chunk-FROKVQQY.js +0 -3997
  2523. package/dist/chunk-FROKVQQY.js.map +0 -1
  2524. package/dist/chunk-G7S37WD4.js +0 -801
  2525. package/dist/chunk-GRDRVYXJ.js +0 -1917
  2526. package/dist/chunk-H6WOFMOV.js +0 -346
  2527. package/dist/chunk-HMDYSGY6.js +0 -54
  2528. package/dist/chunk-HNHIHXSD.js +0 -879
  2529. package/dist/chunk-HWLIMQE2.js +0 -165
  2530. package/dist/chunk-IWO6QXWJ.js +0 -224
  2531. package/dist/chunk-IYNCJKBM.js +0 -3602
  2532. package/dist/chunk-IYNCJKBM.js.map +0 -1
  2533. package/dist/chunk-J54B5DGD.js +0 -1530
  2534. package/dist/chunk-JMZQS6OS.js +0 -81
  2535. package/dist/chunk-K4KE5MYE.js +0 -648
  2536. package/dist/chunk-K4KE5MYE.js.map +0 -1
  2537. package/dist/chunk-KH2D26LQ.js +0 -2440
  2538. package/dist/chunk-KIGC55FQ.js +0 -5505
  2539. package/dist/chunk-KQVBR7BC.js +0 -1286
  2540. package/dist/chunk-L63GFNKL.js +0 -403
  2541. package/dist/chunk-LIAKZGOY.js +0 -25
  2542. package/dist/chunk-LVFI5LG7.js +0 -576
  2543. package/dist/chunk-MTWD4KMM.js +0 -223
  2544. package/dist/chunk-MWVYHNSU.js +0 -623
  2545. package/dist/chunk-MZWSOLMT.js +0 -189
  2546. package/dist/chunk-NNEWBRUL.js +0 -271
  2547. package/dist/chunk-NPX6WMFJ.js +0 -1686
  2548. package/dist/chunk-O7OVWKT4.js +0 -768
  2549. package/dist/chunk-PLJ2MQFT.js +0 -182
  2550. package/dist/chunk-Q4AUIFUA.js +0 -111
  2551. package/dist/chunk-QWQB7TOB.js +0 -11341
  2552. package/dist/chunk-QZ4U67KO.js +0 -98
  2553. package/dist/chunk-RMMVQQA6.js +0 -70
  2554. package/dist/chunk-RSMNPYBM.js +0 -61
  2555. package/dist/chunk-RUUJXAGT.js +0 -122
  2556. package/dist/chunk-S45INSV3.js +0 -389
  2557. package/dist/chunk-SCXURCVT.js +0 -218
  2558. package/dist/chunk-SGUDMW2K.js +0 -3400
  2559. package/dist/chunk-SLGD36MM.js +0 -53
  2560. package/dist/chunk-SMBWBEE7.js +0 -73
  2561. package/dist/chunk-SPFNGHHP.js +0 -115
  2562. package/dist/chunk-SPWNCGSM.js +0 -77
  2563. package/dist/chunk-SZ7IVZGD.js +0 -112
  2564. package/dist/chunk-TJNDFNCU.js +0 -597
  2565. package/dist/chunk-TJNDFNCU.js.map +0 -1
  2566. package/dist/chunk-TQT4AOPO.js +0 -321
  2567. package/dist/chunk-TTFJQ5B5.js +0 -43
  2568. package/dist/chunk-U2SK45U3.js +0 -1476
  2569. package/dist/chunk-UCH2RWFX.js +0 -216
  2570. package/dist/chunk-UDJMJNBK.js +0 -549
  2571. package/dist/chunk-UJBIWY5M.js +0 -212
  2572. package/dist/chunk-ULQVG6G3.js +0 -275
  2573. package/dist/chunk-VDX2J7OX.js +0 -264
  2574. package/dist/chunk-VGO57TU7.js +0 -960
  2575. package/dist/chunk-VUV472VH.js +0 -1008
  2576. package/dist/chunk-VVX5PZFS.js +0 -297
  2577. package/dist/chunk-WH7RINGG.js +0 -315
  2578. package/dist/chunk-WUJD4CHZ.js +0 -137
  2579. package/dist/chunk-X7WAM3IY.js +0 -30
  2580. package/dist/chunk-XPFJSUOR.js +0 -921
  2581. package/dist/chunk-XVZA6VXC.js +0 -160
  2582. package/dist/chunk-XZRZJHBW.js +0 -31013
  2583. package/dist/chunk-XZRZJHBW.js.map +0 -1
  2584. package/dist/chunk-Y4G6LHJW.js +0 -35
  2585. package/dist/chunk-Y7LZ5V7N.js +0 -202
  2586. package/dist/chunk-YEIKOBOW.js +0 -628
  2587. package/dist/chunk-YEIKOBOW.js.map +0 -1
  2588. package/dist/chunk-YIIW2OH2.js +0 -566
  2589. package/dist/chunk-ZBYVR5W4.js +0 -18504
  2590. package/dist/chunk-ZBYVR5W4.js.map +0 -1
  2591. package/dist/chunk-ZN7SMKAK.js +0 -210
  2592. package/dist/chunk-ZP73EM2X.js +0 -74
  2593. package/dist/chunk-ZXQPAYCS.js +0 -2453
  2594. package/dist/cli-CCc34xV7.d.ts +0 -1136
  2595. package/dist/conflict-policy-DyJ2wd-h.d.ts +0 -4
  2596. package/dist/connectors-cli-2iaQ5tX2.d.ts +0 -263
  2597. package/dist/dependency-propagation-delivery-BrhPjAHQ.d.ts +0 -41
  2598. package/dist/faiss-adapter-BHecI1fF.d.ts +0 -73
  2599. package/dist/framework-CNDn2164.d.ts +0 -170
  2600. package/dist/generic-recall-paths-C0J1Oxb7.d.ts +0 -23
  2601. package/dist/graph-DRkl22KE.d.ts +0 -347
  2602. package/dist/graph-edge-decay-MKIRZ762.js +0 -30
  2603. package/dist/index-B735x-tK.d.ts +0 -284
  2604. package/dist/local-llm-BkkEK9rn.d.ts +0 -247
  2605. package/dist/maintenance-CLBIvVxg.d.ts +0 -749
  2606. package/dist/orchestrator-iexgVLow.d.ts +0 -2701
  2607. package/dist/pipeline-DvtDtyo9.d.ts +0 -32
  2608. package/dist/public-http-UWVcqMcb.d.ts +0 -25
  2609. package/dist/qmd-CBYBJ6HW.d.ts +0 -353
  2610. package/dist/resolution-LXFQQ4AE.js +0 -36
  2611. package/dist/scope-profiles-BN1Dgfha.d.ts +0 -30
  2612. package/dist/semantic-BalR6EXU.d.ts +0 -87
  2613. package/dist/semantic-consolidation-D--qe0eE.d.ts +0 -180
  2614. package/dist/service-VealHeqO.d.ts +0 -846
  2615. package/dist/storage-BhS9gUx3.d.ts +0 -166
  2616. package/dist/storage-CMm-3aD3.d.ts +0 -2421
  2617. package/dist/tagging-BjsNFKWz.d.ts +0 -240
  2618. package/dist/types-B1VHaf2w.d.ts +0 -126
  2619. package/dist/types-DJhqDJUV.d.ts +0 -50
  2620. package/dist/types-Du6VdoAg.d.ts +0 -5482
  2621. /package/dist/{capsule-crypto-YO5QJ6L3.js.map → access-recall-diagnostics.js.map} +0 -0
  2622. /package/dist/{graph-edge-decay-MKIRZ762.js.map → capsule-crypto-7FJQINUR.js.map} +0 -0
  2623. /package/dist/{chunk-KQVBR7BC.js.map → chunk-2CBWEIS4.js.map} +0 -0
  2624. /package/dist/{chunk-JMZQS6OS.js.map → chunk-2JQZSQXI.js.map} +0 -0
  2625. /package/dist/{chunk-BXLOS5AJ.js.map → chunk-2NLLXCJG.js.map} +0 -0
  2626. /package/dist/{chunk-LIAKZGOY.js.map → chunk-2WMXZYMS.js.map} +0 -0
  2627. /package/dist/{chunk-RSMNPYBM.js.map → chunk-34ZGBAGE.js.map} +0 -0
  2628. /package/dist/{chunk-MWVYHNSU.js.map → chunk-36S7UHAW.js.map} +0 -0
  2629. /package/dist/{chunk-G7S37WD4.js.map → chunk-3JLWSFTV.js.map} +0 -0
  2630. /package/dist/{chunk-75YZ5VAI.js.map → chunk-3RZOLUZT.js.map} +0 -0
  2631. /package/dist/{chunk-XVZA6VXC.js.map → chunk-3SL52JKD.js.map} +0 -0
  2632. /package/dist/{chunk-2SIKTXWX.js.map → chunk-4QEZS7PK.js.map} +0 -0
  2633. /package/dist/{chunk-Y4G6LHJW.js.map → chunk-5QRYGLZN.js.map} +0 -0
  2634. /package/dist/{chunk-AQWGCHIV.js.map → chunk-5R3C5LEZ.js.map} +0 -0
  2635. /package/dist/{chunk-SPWNCGSM.js.map → chunk-634UKELB.js.map} +0 -0
  2636. /package/dist/{chunk-BXOPUJ3W.js.map → chunk-64JK4TL7.js.map} +0 -0
  2637. /package/dist/{chunk-DGS34QSY.js.map → chunk-6E5GYDIE.js.map} +0 -0
  2638. /package/dist/{chunk-D2N3PMAE.js.map → chunk-6ISP2EN2.js.map} +0 -0
  2639. /package/dist/{chunk-UJBIWY5M.js.map → chunk-6RD7MSIO.js.map} +0 -0
  2640. /package/dist/{chunk-RMMVQQA6.js.map → chunk-6UDLN4IA.js.map} +0 -0
  2641. /package/dist/{chunk-7IRZK6MM.js.map → chunk-754XN6LX.js.map} +0 -0
  2642. /package/dist/{chunk-43IQRLEF.js.map → chunk-7H2LEYYJ.js.map} +0 -0
  2643. /package/dist/{chunk-7RGX7BMF.js.map → chunk-A7AISUJI.js.map} +0 -0
  2644. /package/dist/{chunk-7RKAE6Y4.js.map → chunk-AULKCNZW.js.map} +0 -0
  2645. /package/dist/{chunk-NPX6WMFJ.js.map → chunk-B7SSU55V.js.map} +0 -0
  2646. /package/dist/{chunk-IWO6QXWJ.js.map → chunk-BICNRVEC.js.map} +0 -0
  2647. /package/dist/{chunk-SLGD36MM.js.map → chunk-BJI2D4SU.js.map} +0 -0
  2648. /package/dist/{chunk-CEO4DONG.js.map → chunk-BQB5ZMYO.js.map} +0 -0
  2649. /package/dist/{chunk-WH7RINGG.js.map → chunk-C5CPYMLX.js.map} +0 -0
  2650. /package/dist/{chunk-AHVJ6GLL.js.map → chunk-CS2JO77A.js.map} +0 -0
  2651. /package/dist/{chunk-UDJMJNBK.js.map → chunk-DTABICJ3.js.map} +0 -0
  2652. /package/dist/{chunk-CVILPI77.js.map → chunk-E6UNM67F.js.map} +0 -0
  2653. /package/dist/{chunk-NNEWBRUL.js.map → chunk-ENUI3IO7.js.map} +0 -0
  2654. /package/dist/{chunk-DZP2XMZC.js.map → chunk-FF2XYADH.js.map} +0 -0
  2655. /package/dist/{chunk-S45INSV3.js.map → chunk-FF6N7BXC.js.map} +0 -0
  2656. /package/dist/{chunk-2QZJ4P27.js.map → chunk-FSXD6Y4H.js.map} +0 -0
  2657. /package/dist/{chunk-SGUDMW2K.js.map → chunk-GK6NOQE6.js.map} +0 -0
  2658. /package/dist/{chunk-TTFJQ5B5.js.map → chunk-GRSFFLUY.js.map} +0 -0
  2659. /package/dist/{chunk-5FAGCOZD.js.map → chunk-GWK7FEUL.js.map} +0 -0
  2660. /package/dist/{chunk-SCXURCVT.js.map → chunk-GWQVMKUJ.js.map} +0 -0
  2661. /package/dist/{chunk-3S6URXEH.js.map → chunk-HKHZWJ3E.js.map} +0 -0
  2662. /package/dist/{chunk-PLJ2MQFT.js.map → chunk-IAZPYX6W.js.map} +0 -0
  2663. /package/dist/{chunk-MZWSOLMT.js.map → chunk-IG747LRN.js.map} +0 -0
  2664. /package/dist/{chunk-X7WAM3IY.js.map → chunk-IK63WA5A.js.map} +0 -0
  2665. /package/dist/{chunk-BSCNBIF4.js.map → chunk-IUD6NLNM.js.map} +0 -0
  2666. /package/dist/{chunk-3R23DDD3.js.map → chunk-JSJZ2NXS.js.map} +0 -0
  2667. /package/dist/{chunk-YIIW2OH2.js.map → chunk-JUOJGZPV.js.map} +0 -0
  2668. /package/dist/{chunk-VGO57TU7.js.map → chunk-KA4U5GQN.js.map} +0 -0
  2669. /package/dist/{chunk-VDX2J7OX.js.map → chunk-KQAFEZQX.js.map} +0 -0
  2670. /package/dist/{chunk-ARRKSBQU.js.map → chunk-L4WBADKG.js.map} +0 -0
  2671. /package/dist/{chunk-ULQVG6G3.js.map → chunk-LAL4B37X.js.map} +0 -0
  2672. /package/dist/{chunk-D7VT2LED.js.map → chunk-LELJRLPY.js.map} +0 -0
  2673. /package/dist/{chunk-L63GFNKL.js.map → chunk-LMMQKZK3.js.map} +0 -0
  2674. /package/dist/{chunk-ZP73EM2X.js.map → chunk-LQ23DMTT.js.map} +0 -0
  2675. /package/dist/{chunk-7QVYVSEH.js.map → chunk-LV6ZB6CA.js.map} +0 -0
  2676. /package/dist/{chunk-KIGC55FQ.js.map → chunk-M5IJP3YW.js.map} +0 -0
  2677. /package/dist/{chunk-AH44WTLJ.js.map → chunk-MWZMVLXL.js.map} +0 -0
  2678. /package/dist/{chunk-AQ55YKEV.js.map → chunk-N4VCHRLD.js.map} +0 -0
  2679. /package/dist/{chunk-HNHIHXSD.js.map → chunk-NKXHCCLB.js.map} +0 -0
  2680. /package/dist/{chunk-SZ7IVZGD.js.map → chunk-NVCWA4QC.js.map} +0 -0
  2681. /package/dist/{chunk-RUUJXAGT.js.map → chunk-ONWVMYHX.js.map} +0 -0
  2682. /package/dist/{chunk-HMDYSGY6.js.map → chunk-P6P35FY4.js.map} +0 -0
  2683. /package/dist/{chunk-H6WOFMOV.js.map → chunk-P7M22CYB.js.map} +0 -0
  2684. /package/dist/{chunk-Q4AUIFUA.js.map → chunk-QMWKENNK.js.map} +0 -0
  2685. /package/dist/{chunk-J54B5DGD.js.map → chunk-QOPB6KE3.js.map} +0 -0
  2686. /package/dist/{chunk-DI52XAKG.js.map → chunk-RBULO7DO.js.map} +0 -0
  2687. /package/dist/{chunk-VUV472VH.js.map → chunk-RDESQOEE.js.map} +0 -0
  2688. /package/dist/{chunk-SPFNGHHP.js.map → chunk-RMF763SX.js.map} +0 -0
  2689. /package/dist/{chunk-TQT4AOPO.js.map → chunk-RN6ZCNM5.js.map} +0 -0
  2690. /package/dist/{chunk-QWQB7TOB.js.map → chunk-S2OBXHMN.js.map} +0 -0
  2691. /package/dist/{chunk-UCH2RWFX.js.map → chunk-S3JPD4N7.js.map} +0 -0
  2692. /package/dist/{chunk-HWLIMQE2.js.map → chunk-SF6RFI5Z.js.map} +0 -0
  2693. /package/dist/{chunk-ZXQPAYCS.js.map → chunk-SJV3AOZ2.js.map} +0 -0
  2694. /package/dist/{chunk-Y7LZ5V7N.js.map → chunk-SLULR4GC.js.map} +0 -0
  2695. /package/dist/{chunk-U2SK45U3.js.map → chunk-TFXXMTHV.js.map} +0 -0
  2696. /package/dist/{chunk-2HJKAVAS.js.map → chunk-TYP7GYRI.js.map} +0 -0
  2697. /package/dist/{chunk-KH2D26LQ.js.map → chunk-TYZK56OA.js.map} +0 -0
  2698. /package/dist/{chunk-XPFJSUOR.js.map → chunk-VLDVNZQE.js.map} +0 -0
  2699. /package/dist/{chunk-AIVRD66I.js.map → chunk-W6YK672C.js.map} +0 -0
  2700. /package/dist/{chunk-LVFI5LG7.js.map → chunk-X2NFFBTO.js.map} +0 -0
  2701. /package/dist/{chunk-GRDRVYXJ.js.map → chunk-X45KZOT2.js.map} +0 -0
  2702. /package/dist/{chunk-DQEMWVMT.js.map → chunk-X7Y7WX73.js.map} +0 -0
  2703. /package/dist/{chunk-AYHNTYVG.js.map → chunk-XIXM6G7I.js.map} +0 -0
  2704. /package/dist/{chunk-ZN7SMKAK.js.map → chunk-XLXYARWC.js.map} +0 -0
  2705. /package/dist/{chunk-MTWD4KMM.js.map → chunk-XVW52M6I.js.map} +0 -0
  2706. /package/dist/{chunk-27MKMTBY.js.map → chunk-YHU5XUF4.js.map} +0 -0
  2707. /package/dist/{chunk-SMBWBEE7.js.map → chunk-YRH3C2OJ.js.map} +0 -0
  2708. /package/dist/{chunk-WUJD4CHZ.js.map → chunk-YXQE67A7.js.map} +0 -0
  2709. /package/dist/{chunk-EVQ33D3N.js.map → chunk-ZHUVMSHI.js.map} +0 -0
  2710. /package/dist/{chunk-VVX5PZFS.js.map → chunk-ZHXSOMYH.js.map} +0 -0
  2711. /package/dist/{chunk-O7OVWKT4.js.map → chunk-ZIEZJMFW.js.map} +0 -0
  2712. /package/dist/{chunk-QZ4U67KO.js.map → chunk-ZSEFGDCI.js.map} +0 -0
  2713. /package/dist/{chunk-DAOMWGO2.js.map → chunk-ZX5N5D6M.js.map} +0 -0
  2714. /package/dist/{resolution-LXFQQ4AE.js.map → graph-edge-decay-ROSUPDX3.js.map} +0 -0
@@ -0,0 +1,3560 @@
1
+ import {
2
+ WearablesInputError
3
+ } from "./chunk-V7IZKJI3.js";
4
+ import {
5
+ AdapterRegistry
6
+ } from "./chunk-QMWKENNK.js";
7
+ import {
8
+ WriteRateLimiter
9
+ } from "./chunk-TB6CBZ5V.js";
10
+ import {
11
+ maybeRespondRecallNavigation
12
+ } from "./chunk-ZSEFGDCI.js";
13
+ import {
14
+ maybeRespondMemoryBrowse
15
+ } from "./chunk-P6P35FY4.js";
16
+ import {
17
+ serializeInlineScriptValue
18
+ } from "./chunk-3HSRWJTC.js";
19
+ import {
20
+ respondDeepRecall
21
+ } from "./chunk-GRSFFLUY.js";
22
+ import {
23
+ handleSupportPassportOwnerHttp
24
+ } from "./chunk-3RZOLUZT.js";
25
+ import {
26
+ buildSupportPassportPublicRequestHandler
27
+ } from "./chunk-4QEZS7PK.js";
28
+ import {
29
+ handleMcpGetSse
30
+ } from "./chunk-SRT6SHVZ.js";
31
+ import {
32
+ EngramMcpServer,
33
+ MCP_SUPPORTED_PROTOCOL_VERSIONS,
34
+ cleanupExpiredChatSessions,
35
+ enforceChatSessionNamespace,
36
+ loadChatSession,
37
+ processChatMessage,
38
+ sessionBelongsToPrincipal,
39
+ subscribeChatTranscript
40
+ } from "./chunk-C6LRFPZL.js";
41
+ import {
42
+ RelayMissionStoreError
43
+ } from "./chunk-X45KZOT2.js";
44
+ import {
45
+ executeResolution,
46
+ isValidResolutionVerb
47
+ } from "./chunk-NKXHCCLB.js";
48
+ import {
49
+ handleRecallWhyHttpQuery,
50
+ handleRecallXrayHttpQuery
51
+ } from "./chunk-BSDBDFKZ.js";
52
+ import {
53
+ toDottedRemnicName
54
+ } from "./chunk-ZQUVBZI4.js";
55
+ import {
56
+ respondOfflineManifestStream,
57
+ respondOfflineSnapshotStream
58
+ } from "./chunk-CK5KOVHW.js";
59
+ import {
60
+ nonEmptyQueryParam,
61
+ optionalNamespaceKindQueryParam,
62
+ optionalQueryString,
63
+ positiveIntQueryParam
64
+ } from "./chunk-XIXM6G7I.js";
65
+ import {
66
+ respondBriefingHttp
67
+ } from "./chunk-IUD6NLNM.js";
68
+ import {
69
+ maybeHandleLifecycleFlush
70
+ } from "./chunk-TIDEL77O.js";
71
+ import {
72
+ respondAccessCapabilitiesHttp
73
+ } from "./chunk-GZ3R6XOE.js";
74
+ import {
75
+ authorizationProbeNamespaces,
76
+ authorizationProbeRequiresPrincipalNamespace,
77
+ probeOperationAuthorization
78
+ } from "./chunk-HKHZWJ3E.js";
79
+ import {
80
+ getOperation,
81
+ resolveQueryNamespaceWritablePreflight
82
+ } from "./chunk-4ALOINQ4.js";
83
+ import {
84
+ handleWhoKnowsHttpQuery
85
+ } from "./chunk-7H2LEYYJ.js";
86
+ import {
87
+ isTrustZoneName
88
+ } from "./chunk-ROBHL3GL.js";
89
+ import {
90
+ subscribeGraphEvents
91
+ } from "./chunk-DEUNUKTD.js";
92
+ import {
93
+ CorrectionContractError
94
+ } from "./chunk-QLK3SL7Q.js";
95
+ import {
96
+ validateRequest
97
+ } from "./chunk-JUOJGZPV.js";
98
+ import {
99
+ peerManifestRevision
100
+ } from "./chunk-S3YM4SZQ.js";
101
+ import {
102
+ assertOperationAllowed,
103
+ capabilityAllowsOp,
104
+ enforceNamespaceAllowList,
105
+ isCapabilityRestricted,
106
+ tokenCapabilityStore
107
+ } from "./chunk-IG747LRN.js";
108
+ import {
109
+ OFFLINE_SYNC_APPLY_MAX_BODY_BYTES,
110
+ OFFLINE_SYNC_FILE_CONTENT_MAX_CHUNK_BYTES,
111
+ OFFLINE_SYNC_SNAPSHOT_BASE_MAX_BODY_BYTES
112
+ } from "./chunk-WQZZDN5M.js";
113
+ import {
114
+ isDefaultReviewNamespace,
115
+ listPairs,
116
+ readPair
117
+ } from "./chunk-CTVWELNK.js";
118
+ import {
119
+ isRecallDisclosure
120
+ } from "./chunk-FNQEXI3D.js";
121
+ import {
122
+ projectTagProjectId
123
+ } from "./chunk-3Q3N35W7.js";
124
+ import {
125
+ expandTildePath
126
+ } from "./chunk-6KH5NLQS.js";
127
+ import {
128
+ EngramAccessForbiddenError,
129
+ EngramAccessInputError
130
+ } from "./chunk-3MUKQQ7A.js";
131
+ import {
132
+ abortError,
133
+ isAbortError
134
+ } from "./chunk-BTTPKDIL.js";
135
+ import {
136
+ log
137
+ } from "./chunk-3WCASNQZ.js";
138
+
139
+ // src/access-http.ts
140
+ import { createServer } from "http";
141
+ import { randomUUID, timingSafeEqual } from "crypto";
142
+ import { AsyncLocalStorage } from "async_hooks";
143
+ import { existsSync } from "fs";
144
+ import { readFile } from "fs/promises";
145
+ import path2 from "path";
146
+ import { fileURLToPath, URL as URL2 } from "url";
147
+ import { gunzipSync } from "zlib";
148
+
149
+ // src/wearables/http-glue.ts
150
+ function respondWearablesErrorGlue(respondJson2, res, err) {
151
+ if (err instanceof WearablesInputError) {
152
+ respondJson2(res, 400, {
153
+ error: "invalid_request",
154
+ code: "invalid_request",
155
+ message: err.message
156
+ });
157
+ return true;
158
+ }
159
+ return false;
160
+ }
161
+
162
+ // src/meetings/errors.ts
163
+ var MeetingsInputError = class extends Error {
164
+ constructor(message) {
165
+ super(message);
166
+ this.name = "MeetingsInputError";
167
+ }
168
+ };
169
+
170
+ // src/meetings/http-glue.ts
171
+ function respondMeetingsError(respondJson2, res, err) {
172
+ if (err instanceof MeetingsInputError) {
173
+ respondJson2(res, 400, { error: "invalid_request", code: "invalid_request", message: err.message });
174
+ return true;
175
+ }
176
+ return false;
177
+ }
178
+ function decodeMeetingIdSegment(raw) {
179
+ try {
180
+ return decodeURIComponent(raw);
181
+ } catch {
182
+ throw new MeetingsInputError("meeting id path segment is not valid percent-encoded input");
183
+ }
184
+ }
185
+ async function respondMeetingsList(res, respondJson2, service, date, scope) {
186
+ try {
187
+ respondJson2(res, 200, await service.meetingsList(date, scope));
188
+ } catch (err) {
189
+ if (respondMeetingsError(respondJson2, res, err)) return;
190
+ throw err;
191
+ }
192
+ }
193
+ async function respondMeetingsGet(res, respondJson2, service, rawId, scope) {
194
+ try {
195
+ respondJson2(res, 200, await service.meetingsGet(decodeMeetingIdSegment(rawId), scope));
196
+ } catch (err) {
197
+ if (respondMeetingsError(respondJson2, res, err)) return;
198
+ throw err;
199
+ }
200
+ }
201
+ async function respondMeetingsBuild(req, res, respondJson2, readJsonBody, service, quota, scopeFor) {
202
+ const body = await readJsonBody(req);
203
+ const raw = body.date;
204
+ if (raw !== void 0 && raw !== null && raw !== "" && typeof raw !== "string") {
205
+ throw new EngramAccessInputError(`date must be a string (got ${JSON.stringify(raw)})`);
206
+ }
207
+ const date = raw === void 0 || raw === null || raw === "" ? void 0 : raw;
208
+ if (date === void 0) {
209
+ throw new EngramAccessInputError("date is required (YYYY-MM-DD)");
210
+ }
211
+ quota.enforceQuota();
212
+ const scope = scopeFor?.(
213
+ typeof body.namespace === "string" ? body.namespace : void 0,
214
+ typeof body.sessionKey === "string" ? body.sessionKey : void 0
215
+ );
216
+ try {
217
+ const result = await service.meetingsBuild(date, scope);
218
+ quota.recordHit();
219
+ respondJson2(res, 200, result);
220
+ } catch (err) {
221
+ if (respondMeetingsError(respondJson2, res, err)) return;
222
+ throw err;
223
+ }
224
+ }
225
+
226
+ // src/location/http-glue.ts
227
+ function requireLocationOperation(name) {
228
+ const op = getOperation(name);
229
+ if (!op) {
230
+ throw new Error(`access-boundary: operation not registered: ${name}`);
231
+ }
232
+ return op;
233
+ }
234
+ async function respondLocationStatus(res, respondJson2, service) {
235
+ const output = await requireLocationOperation("location_status").run({}, { service });
236
+ respondJson2(res, 200, output.result);
237
+ }
238
+ async function respondLocationCheck(res, respondJson2, service) {
239
+ const output = await requireLocationOperation("location_check").run({}, { service });
240
+ respondJson2(res, 200, { results: output.result });
241
+ }
242
+ async function respondLocationSync(body, res, respondJson2, service) {
243
+ const output = await requireLocationOperation("location_sync").run(
244
+ { date: body.date ?? null, days: body.days ?? null },
245
+ { service }
246
+ );
247
+ respondJson2(res, 200, output.result);
248
+ }
249
+ async function respondLocationBackfill(body, res, respondJson2, service) {
250
+ const output = await requireLocationOperation("location_backfill").run(
251
+ { from: body.from ?? null, to: body.to ?? null, dryRun: body.dryRun === true },
252
+ { service }
253
+ );
254
+ respondJson2(res, 200, output.result);
255
+ }
256
+ async function respondLocationDay(date, res, respondJson2, service) {
257
+ const output = await requireLocationOperation("location_day").run(
258
+ { date: date ?? null },
259
+ { service }
260
+ );
261
+ respondJson2(res, output.result.found ? 200 : 404, output.result);
262
+ }
263
+
264
+ // src/standup/http-glue.ts
265
+ async function respondStandup(date, res, respondJson2, service) {
266
+ const op = getOperation("standup");
267
+ if (!op) throw new Error("access-boundary: operation not registered: standup");
268
+ const output = await op.run({ ...date === null ? {} : { date } }, { service });
269
+ respondJson2(res, 200, output.result);
270
+ }
271
+
272
+ // src/chat/chat-http.ts
273
+ import { createHash } from "crypto";
274
+ var chatInFlight = /* @__PURE__ */ new Map();
275
+ function principalFingerprintComponent(principal) {
276
+ return principal === void 0 ? "\0absent" : `${principal}`;
277
+ }
278
+ function chatDedupFingerprint(memoryDir, chatSessionId, principal, message) {
279
+ const messageHash = createHash("sha256").update(message, "utf8").digest("hex").slice(0, 32);
280
+ return `${memoryDir}:${chatSessionId}:${principalFingerprintComponent(principal)}:${messageHash}`;
281
+ }
282
+ function processChatMessageDedup(opts) {
283
+ if (!opts.chatSessionId) {
284
+ return processChatMessage(opts);
285
+ }
286
+ const fp = chatDedupFingerprint(opts.memoryDir, opts.chatSessionId, opts.principal, opts.message);
287
+ const existing = chatInFlight.get(fp);
288
+ if (existing) return existing;
289
+ const pending = processChatMessage(opts).finally(() => {
290
+ chatInFlight.delete(fp);
291
+ });
292
+ chatInFlight.set(fp, pending);
293
+ return pending;
294
+ }
295
+ async function handleChatMessage(req, res, body, opts, principal) {
296
+ if (!opts.config?.enabled) {
297
+ respondJson(res, 404, { error: "chat_disabled", code: "chat_disabled" });
298
+ return;
299
+ }
300
+ const message = typeof body.message === "string" ? body.message : "";
301
+ if (!message) {
302
+ respondJson(res, 400, { error: "message is required", code: "input_error" });
303
+ return;
304
+ }
305
+ if (!opts.service.fallbackLlmRef && !opts.service.localLlmRef) {
306
+ respondJson(res, 503, {
307
+ error: "No LLM model is available. Configure a local or cloud model.",
308
+ code: "no_llm"
309
+ });
310
+ return;
311
+ }
312
+ const chatSessionId = typeof body.chatSessionId === "string" ? body.chatSessionId : void 0;
313
+ let result;
314
+ try {
315
+ result = await processChatMessageDedup({
316
+ service: opts.service,
317
+ config: opts.config,
318
+ memoryDir: opts.memoryDir,
319
+ message,
320
+ ...chatSessionId ? { chatSessionId } : {},
321
+ ...principal ? { principal } : {}
322
+ });
323
+ } catch (err) {
324
+ const code = err instanceof Error ? err.message : String(err);
325
+ if (code === "chat_session_not_found") {
326
+ respondJson(res, 404, { error: "chat_session_not_found", code: "chat_session_not_found" });
327
+ } else if (code === "access_denied") {
328
+ respondJson(res, 403, { error: "access_denied", code: "access_denied" });
329
+ } else if (code === "chat_session_expired") {
330
+ respondJson(res, 410, { error: "chat_session_expired", code: "chat_session_expired" });
331
+ } else if (code === "chat_disabled") {
332
+ respondJson(res, 404, { error: "chat_disabled", code: "chat_disabled" });
333
+ } else if (code === "no_llm_available" || code === "engine_unavailable") {
334
+ respondJson(res, 503, {
335
+ error: "No LLM model is available. Configure a local or cloud model.",
336
+ code: "no_llm"
337
+ });
338
+ } else {
339
+ respondJson(res, 500, { error: "internal_error", code: "internal_error" });
340
+ }
341
+ return;
342
+ }
343
+ const wireResult = {
344
+ reply: result.reply,
345
+ chatSessionId: result.chatSessionId,
346
+ ...result.pendingPlan ? {
347
+ pendingPlan: {
348
+ planId: result.pendingPlan.planId,
349
+ preview: result.pendingPlan.preview
350
+ }
351
+ } : {},
352
+ ...result.skippedTools ? { skippedTools: result.skippedTools.filter((name) => typeof name === "string") } : {}
353
+ };
354
+ respondJson(res, 200, wireResult);
355
+ }
356
+ async function handleChatEventsSSE(req, res, chatSessionId, opts, principal) {
357
+ if (!opts.config?.enabled) {
358
+ respondJson(res, 404, { error: "chat_disabled", code: "chat_disabled" });
359
+ return;
360
+ }
361
+ let heartbeat;
362
+ let closed = false;
363
+ const writeSse = (chunk) => {
364
+ if (closed) return false;
365
+ try {
366
+ res.write(chunk);
367
+ return true;
368
+ } catch {
369
+ return false;
370
+ }
371
+ };
372
+ const pending = [];
373
+ let bursting = true;
374
+ const unsubscribe = subscribeChatTranscript(opts.memoryDir, chatSessionId, (entry) => {
375
+ if (closed) return;
376
+ if (bursting) {
377
+ pending.push(entry);
378
+ return;
379
+ }
380
+ writeSse(`data: ${JSON.stringify(entry)}
381
+
382
+ `);
383
+ });
384
+ const doCleanup = () => {
385
+ closed = true;
386
+ clearInterval(heartbeat);
387
+ unsubscribe();
388
+ try {
389
+ res.end();
390
+ } catch {
391
+ }
392
+ };
393
+ const unregisterServerCleanup = opts.registerSseCleanup?.(doCleanup) ?? (() => {
394
+ });
395
+ req.on("close", () => {
396
+ doCleanup();
397
+ unregisterServerCleanup();
398
+ });
399
+ const session = await loadChatSession(opts.memoryDir, chatSessionId);
400
+ if (closed) return;
401
+ if (!session) {
402
+ unsubscribe();
403
+ unregisterServerCleanup();
404
+ respondJson(res, 404, { error: "chat_session_not_found", code: "chat_session_not_found" });
405
+ return;
406
+ }
407
+ if (!sessionBelongsToPrincipal(session, principal)) {
408
+ unsubscribe();
409
+ unregisterServerCleanup();
410
+ respondJson(res, 403, { error: "access_denied", code: "access_denied" });
411
+ return;
412
+ }
413
+ res.writeHead(200, {
414
+ "content-type": "text/event-stream",
415
+ "cache-control": "no-cache",
416
+ connection: "keep-alive"
417
+ });
418
+ writeSse("retry: 5000\n\n");
419
+ const deliveredSeqs = /* @__PURE__ */ new Set();
420
+ for (const entry of session.transcript) {
421
+ writeSse(`data: ${JSON.stringify(entry)}
422
+
423
+ `);
424
+ deliveredSeqs.add(entry.seq);
425
+ }
426
+ bursting = false;
427
+ for (const entry of pending) {
428
+ if (!deliveredSeqs.has(entry.seq)) {
429
+ writeSse(`data: ${JSON.stringify(entry)}
430
+
431
+ `);
432
+ }
433
+ }
434
+ if (closed) return;
435
+ heartbeat = setInterval(() => {
436
+ writeSse(`data: ${JSON.stringify({ type: "heartbeat" })}
437
+
438
+ `);
439
+ }, 25e3);
440
+ heartbeat.unref?.();
441
+ }
442
+ function respondJson(res, status, body) {
443
+ const json = JSON.stringify(body);
444
+ res.writeHead(status, {
445
+ "content-type": "application/json; charset=utf-8",
446
+ "content-length": Buffer.byteLength(json, "utf8")
447
+ });
448
+ res.end(json);
449
+ }
450
+
451
+ // src/support-passport/access-http-base.ts
452
+ import path from "path";
453
+ var SUPPORT_PASSPORT_QUOTA_LIMITED_WRITE_TOOLS = /* @__PURE__ */ new Set([
454
+ "engram.support_passport_draft_create",
455
+ "remnic.support_passport_draft_create",
456
+ "engram.support_passport_drafts_generate",
457
+ "remnic.support_passport_drafts_generate",
458
+ "engram.support_passport_card_replace",
459
+ "remnic.support_passport_card_replace",
460
+ "engram.support_passport_card_approve",
461
+ "remnic.support_passport_card_approve",
462
+ "engram.support_passport_card_reject",
463
+ "remnic.support_passport_card_reject",
464
+ "engram.support_passport_card_withdraw",
465
+ "remnic.support_passport_card_withdraw",
466
+ "engram.support_passport_grant_create",
467
+ "remnic.support_passport_grant_create",
468
+ "engram.support_passport_grant_revoke",
469
+ "remnic.support_passport_grant_revoke"
470
+ ]);
471
+ var SUPPORT_PASSPORT_ADMIN_CONSOLE_ASSETS = /* @__PURE__ */ new Map([
472
+ ["what-helps-me.css", "text/css; charset=utf-8"],
473
+ ["model.js", "application/javascript; charset=utf-8"],
474
+ ["app.js", "application/javascript; charset=utf-8"]
475
+ ]);
476
+ var SupportPassportAccessHttpBase = class {
477
+ supportPassportPublicHandler;
478
+ handleSupportPassportOwnerRequest(req, res, pathname, hasQuery, abortSignal) {
479
+ return handleSupportPassportOwnerHttp({
480
+ req,
481
+ res,
482
+ pathname,
483
+ hasQuery,
484
+ service: this.service,
485
+ principal: this.resolveRequestPrincipal(req),
486
+ abortSignal,
487
+ readJsonBody: () => this.readJsonBody(req),
488
+ respondJson: (status, payload) => {
489
+ res.setHeader("cache-control", "private, no-store");
490
+ res.setHeader("vary", "Authorization");
491
+ this.respondJson(res, status, payload);
492
+ },
493
+ reserveWriteRateLimitSlot: () => this.reserveWriteRateLimitSlot(req)
494
+ });
495
+ }
496
+ handleSupportPassportPublicRequest(req, res) {
497
+ this.supportPassportPublicHandler ??= buildSupportPassportPublicRequestHandler(this.service, {
498
+ trustedProxyAddresses: this.service.configRef?.supportPassport?.trustedProxyAddresses ?? []
499
+ });
500
+ return this.supportPassportPublicHandler(req, res, {
501
+ authorized: false,
502
+ tokenAuthorized: false
503
+ });
504
+ }
505
+ async enforceSupportPassportAuthorizationProbe(req) {
506
+ const principal = this.resolveRequestPrincipal(req)?.trim();
507
+ if (!principal) {
508
+ throw new EngramAccessForbiddenError("A trusted principal is required for support passport access.");
509
+ }
510
+ const owner = await this.service.getWritableStorageForNamespace(void 0, principal);
511
+ enforceNamespaceAllowList(
512
+ tokenCapabilityStore.getStore(),
513
+ owner.namespace,
514
+ this.service.configRef.defaultNamespace
515
+ );
516
+ }
517
+ isSupportPassportQuotaLimitedWriteTool(toolName) {
518
+ return SUPPORT_PASSPORT_QUOTA_LIMITED_WRITE_TOOLS.has(toolName);
519
+ }
520
+ async handleSupportPassportUi(req, res, pathname) {
521
+ if (req.method !== "GET") return false;
522
+ const isSupportPassportPath = pathname === "/remnic/ui/what-helps-me" || pathname === "/engram/ui/what-helps-me" || pathname.startsWith("/remnic/ui/what-helps-me/") || pathname.startsWith("/engram/ui/what-helps-me/");
523
+ if (!isSupportPassportPath) return false;
524
+ if (!this.service.supportPassportEnabled) {
525
+ this.respondJson(res, 404, { error: "not_found" });
526
+ return true;
527
+ }
528
+ if (pathname === "/remnic/ui/what-helps-me" || pathname === "/engram/ui/what-helps-me") {
529
+ const search = new URL(req.url ?? pathname, "http://placeholder").search;
530
+ res.statusCode = 301;
531
+ res.setHeader("location", `${pathname}/${search}`);
532
+ res.end();
533
+ return true;
534
+ }
535
+ if (pathname === "/remnic/ui/what-helps-me/" || pathname === "/engram/ui/what-helps-me/") {
536
+ const helperRequest = new URL(req.url ?? pathname, "http://placeholder").searchParams.has("grant");
537
+ res.setHeader("content-security-policy", "frame-ancestors 'none'");
538
+ res.setHeader("x-frame-options", "DENY");
539
+ await this.respondAdminConsoleShell(req, res, pathname, "what-helps-me/index.html", !helperRequest);
540
+ return true;
541
+ }
542
+ const fileName = pathname.split("/").at(-1) ?? "";
543
+ const assetType = SUPPORT_PASSPORT_ADMIN_CONSOLE_ASSETS.get(fileName);
544
+ if (assetType && pathname.split("/").length === 5) {
545
+ await this.respondStatic(res, path.join(this.adminConsolePublicDir, "what-helps-me", fileName), assetType);
546
+ return true;
547
+ }
548
+ this.respondJson(res, 404, { error: "not_found" });
549
+ return true;
550
+ }
551
+ };
552
+
553
+ // src/review/review-deck-http-base.ts
554
+ var LIST_PATHS = ["/remnic/v1/review/deck", "/engram/v1/review/deck"];
555
+ var ACTION_PATHS = ["/remnic/v1/review/deck/action", "/engram/v1/review/deck/action"];
556
+ var UNDO_PATHS = ["/remnic/v1/review/deck/undo", "/engram/v1/review/deck/undo"];
557
+ var LIMIT_MIN = 1;
558
+ var LIMIT_MAX = 100;
559
+ var CURSOR_RE = /^[^\s%]{1,2048}$/;
560
+ function requiredString(body, field) {
561
+ const value = body[field];
562
+ if (typeof value !== "string" || value.trim().length === 0) {
563
+ throw new EngramAccessInputError(`${field} is required`);
564
+ }
565
+ return value.trim();
566
+ }
567
+ function parseLimit(raw) {
568
+ if (raw === null || raw.length === 0) {
569
+ throw new EngramAccessInputError("limit is required and must be an integer");
570
+ }
571
+ if (!/^(?:0|[1-9]\d*)$/.test(raw)) {
572
+ throw new EngramAccessInputError("limit must be an integer");
573
+ }
574
+ const value = Number(raw);
575
+ if (!Number.isInteger(value) || value < LIMIT_MIN || value > LIMIT_MAX) {
576
+ throw new EngramAccessInputError(`limit must be an integer from ${LIMIT_MIN} to ${LIMIT_MAX}`);
577
+ }
578
+ return value;
579
+ }
580
+ function parseCursor(raw) {
581
+ if (raw === null) return void 0;
582
+ if (!CURSOR_RE.test(raw)) {
583
+ throw new EngramAccessInputError("cursor is malformed");
584
+ }
585
+ return raw;
586
+ }
587
+ function parseActionBody(body) {
588
+ const action = body.action;
589
+ if (action !== "keep" && action !== "not_true" && action !== "prepare_fix") {
590
+ throw new EngramAccessInputError("action must be one of: keep, not_true, prepare_fix");
591
+ }
592
+ const itemId = requiredString(body, "itemId");
593
+ const revision = requiredString(body, "revision");
594
+ const idempotencyKey = requiredString(body, "idempotencyKey");
595
+ if (action === "prepare_fix") {
596
+ const correctionText = requiredString(body, "correctionText");
597
+ return { schemaVersion: 1, itemId, revision, action, correctionText, idempotencyKey };
598
+ }
599
+ return { schemaVersion: 1, itemId, revision, action, idempotencyKey };
600
+ }
601
+ function parseUndoBody(body) {
602
+ return {
603
+ schemaVersion: 1,
604
+ receiptId: requiredString(body, "receiptId"),
605
+ expectedRevision: requiredString(body, "expectedRevision"),
606
+ idempotencyKey: requiredString(body, "idempotencyKey")
607
+ };
608
+ }
609
+ var ReviewDeckAccessHttpBase = class extends SupportPassportAccessHttpBase {
610
+ async handleReviewDeckRequest(req, res, pathname, abortSignal) {
611
+ const method = req.method;
612
+ const isList = method === "GET" && (pathname === LIST_PATHS[0] || pathname === LIST_PATHS[1]);
613
+ const isAction = method === "POST" && (pathname === ACTION_PATHS[0] || pathname === ACTION_PATHS[1]);
614
+ const isUndo = method === "POST" && (pathname === UNDO_PATHS[0] || pathname === UNDO_PATHS[1]);
615
+ if (!isList && !isAction && !isUndo) return false;
616
+ if (!this.service.reviewDeckEnabled) {
617
+ this.respondJson(res, 404, { error: "not_found", code: "not_found" });
618
+ return true;
619
+ }
620
+ const parsed = new URL(req.url ?? "/", "http://127.0.0.1");
621
+ const namespace = this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0);
622
+ const principal = this.resolveRequestPrincipal(req);
623
+ if (isList) {
624
+ this.enforceTokenOp("review_deck_list");
625
+ const page = await this.service.reviewDeckList({
626
+ namespace,
627
+ principal,
628
+ cursor: parseCursor(parsed.searchParams.get("cursor")),
629
+ limit: parseLimit(parsed.searchParams.get("limit"))
630
+ });
631
+ this.respondJson(res, 200, page);
632
+ return true;
633
+ }
634
+ if (isAction) this.enforceTokenOp("review_deck_action");
635
+ else this.enforceTokenOp("review_deck_undo");
636
+ const writeQuota = this.reserveWriteRateLimitSlot(req);
637
+ try {
638
+ const body = await this.readJsonBody(req, this.maxBodyBytes);
639
+ const result = isAction ? await this.service.reviewDeckAction(parseActionBody(body), {
640
+ namespace,
641
+ principal,
642
+ signal: abortSignal
643
+ }) : await this.service.reviewDeckUndo(parseUndoBody(body), {
644
+ namespace,
645
+ principal,
646
+ signal: abortSignal
647
+ });
648
+ writeQuota.commit();
649
+ this.respondJson(res, 200, result);
650
+ } catch (error) {
651
+ writeQuota.release();
652
+ throw error;
653
+ }
654
+ return true;
655
+ }
656
+ };
657
+
658
+ // src/access-http.ts
659
+ function resolveDefaultAdminConsolePublicDir(sourceUrl = import.meta.url) {
660
+ const thisDir = path2.dirname(fileURLToPath(sourceUrl));
661
+ const candidates = [
662
+ path2.resolve(thisDir, "../../../admin-console/public"),
663
+ path2.resolve(thisDir, "../dist/admin-console/public"),
664
+ path2.resolve(thisDir, "./admin-console/public"),
665
+ path2.resolve(thisDir, "../../admin-console/public")
666
+ ];
667
+ return candidates.find((candidate) => existsSync(candidate)) ?? candidates[0];
668
+ }
669
+ var defaultAdminConsolePublicDir = resolveDefaultAdminConsolePublicDir();
670
+ var correlationIdStore = new AsyncLocalStorage();
671
+ var RELAY_ADMIN_CONSOLE_ASSETS = /* @__PURE__ */ new Map([
672
+ ["relay.css", "text/css; charset=utf-8"],
673
+ ["relay-model.js", "application/javascript; charset=utf-8"],
674
+ ["relay.js", "application/javascript; charset=utf-8"],
675
+ ["replay.json", "application/json; charset=utf-8"]
676
+ ]);
677
+ var TRUST_ZONE_RECORD_KINDS = ["memory", "artifact", "state", "trajectory", "external"];
678
+ var TRUST_ZONE_SOURCE_CLASSES = ["tool_output", "web_content", "subagent_trace", "system_memory", "user_input", "manual"];
679
+ var HttpError = class extends Error {
680
+ constructor(status, message, code, details) {
681
+ super(message);
682
+ this.status = status;
683
+ this.code = code ?? `http_${status}`;
684
+ this.details = details;
685
+ }
686
+ status;
687
+ code;
688
+ details;
689
+ };
690
+ function hostToUrlAuthority(host) {
691
+ if (host.includes(":") && !host.startsWith("[") && !host.endsWith("]")) {
692
+ return `[${host}]`;
693
+ }
694
+ return host;
695
+ }
696
+ function parseHttpServerPort(port) {
697
+ if (port === void 0) return 0;
698
+ if (!Number.isInteger(port) || port < 0 || port > 65535) {
699
+ throw new Error("access HTTP port must be an integer from 0 to 65535");
700
+ }
701
+ return port;
702
+ }
703
+ function assertResourceMetadataUrl(value) {
704
+ if (value === void 0) return void 0;
705
+ let parsed;
706
+ try {
707
+ parsed = new URL2(value);
708
+ } catch {
709
+ throw new Error(
710
+ `access HTTP resourceMetadataUrl must be an absolute http(s) URL, got: ${value}`
711
+ );
712
+ }
713
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
714
+ throw new Error(
715
+ `access HTTP resourceMetadataUrl must use http or https, got: ${parsed.protocol}`
716
+ );
717
+ }
718
+ return value;
719
+ }
720
+ function parseTrustZoneKindFilter(raw) {
721
+ if (raw === null) return void 0;
722
+ if (TRUST_ZONE_RECORD_KINDS.includes(raw)) {
723
+ return raw;
724
+ }
725
+ throw new HttpError(400, `kind must be one of ${TRUST_ZONE_RECORD_KINDS.join("|")}`, "invalid_kind_filter");
726
+ }
727
+ function parseTrustZoneSourceClassFilter(raw) {
728
+ if (raw === null) return void 0;
729
+ if (TRUST_ZONE_SOURCE_CLASSES.includes(raw)) {
730
+ return raw;
731
+ }
732
+ throw new HttpError(400, `sourceClass must be one of ${TRUST_ZONE_SOURCE_CLASSES.join("|")}`, "invalid_source_class_filter");
733
+ }
734
+ function parseTrustZoneFilter(raw) {
735
+ if (raw === null) return void 0;
736
+ if (isTrustZoneName(raw)) {
737
+ return raw;
738
+ }
739
+ throw new HttpError(400, "zone must be one of quarantine|working|trusted", "invalid_zone_filter");
740
+ }
741
+ function summarizeHttpRequest(req) {
742
+ const method = req.method ?? "UNKNOWN";
743
+ try {
744
+ const parsed = new URL2(req.url ?? "/", "http://localhost");
745
+ return `${method} ${parsed.pathname}`;
746
+ } catch {
747
+ return `${method} ${(req.url ?? "/").split("?")[0]}`;
748
+ }
749
+ }
750
+ function parseStrictIntegerQuery(raw, field, defaultValue, minValue) {
751
+ if (raw === null) return defaultValue;
752
+ if (!/^(?:0|[1-9]\d*)$/.test(raw)) {
753
+ throw new HttpError(400, `${field} must be an integer`, `invalid_${field}`);
754
+ }
755
+ const value = Number(raw);
756
+ if (!Number.isInteger(value) || value < minValue) {
757
+ throw new HttpError(400, `${field} must be an integer >= ${minValue}`, `invalid_${field}`);
758
+ }
759
+ return value;
760
+ }
761
+ function parseMemorySort(raw) {
762
+ if (raw === null) return void 0;
763
+ if (raw === "updated_desc" || raw === "updated_asc" || raw === "created_desc" || raw === "created_asc") {
764
+ return raw;
765
+ }
766
+ throw new HttpError(400, "sort must be one of updated_desc|updated_asc|created_desc|created_asc", "invalid_sort");
767
+ }
768
+ function decodePeerIdSegment(raw) {
769
+ try {
770
+ return decodeURIComponent(raw);
771
+ } catch {
772
+ throw new EngramAccessInputError("peerId path segment is not valid percent-encoded input");
773
+ }
774
+ }
775
+ function decodeRelayMissionIdSegment(raw) {
776
+ try {
777
+ return decodeURIComponent(raw);
778
+ } catch {
779
+ throw new EngramAccessInputError("missionId path segment is not valid percent-encoded input");
780
+ }
781
+ }
782
+ function rejectBlankRelayNamespace(value) {
783
+ if (value !== void 0 && value !== null && value.trim().length === 0) {
784
+ throw new EngramAccessInputError("Relay namespace must not be blank when provided");
785
+ }
786
+ }
787
+ function codingContextFromProjectTag(projectTag) {
788
+ const projectId = projectTagProjectId(projectTag);
789
+ return {
790
+ projectId,
791
+ branch: null,
792
+ rootPath: projectId,
793
+ defaultBranch: null
794
+ };
795
+ }
796
+ var EngramAccessHttpServer = class extends ReviewDeckAccessHttpBase {
797
+ service;
798
+ host;
799
+ requestedPort;
800
+ authToken;
801
+ authTokens;
802
+ authTokensGetter;
803
+ authTokenEntriesGetter;
804
+ tokenPathPolicy;
805
+ authenticatedPrincipal;
806
+ maxBodyBytes;
807
+ adminConsoleEnabled;
808
+ adminConsolePublicDir;
809
+ adminConsolePrefillToken;
810
+ adminControls;
811
+ trustPrincipalHeader;
812
+ adapterRegistry;
813
+ readiness;
814
+ resourceMetadataUrl;
815
+ externalRequestHandler;
816
+ writeLimiter;
817
+ mcpServer;
818
+ server = null;
819
+ boundPort = 0;
820
+ /** Active SSE response objects for /engram/v1/graph/events. */
821
+ sseClients = /* @__PURE__ */ new Set();
822
+ /** Throttle batch: pending SSE event batches per client. */
823
+ sseBatchTimers = /* @__PURE__ */ new Map();
824
+ ssePendingBatches = /* @__PURE__ */ new Map();
825
+ /**
826
+ * Per-client cleanup callbacks: clear heartbeat interval, flush timer,
827
+ * unsubscribe from bus, and end the response. Stored here so `stop()`
828
+ * can invoke them even when the client hasn't disconnected yet
829
+ * (Cursor review thread `access-http.ts:232`).
830
+ */
831
+ sseCleanupFns = /* @__PURE__ */ new Set();
832
+ /**
833
+ * Periodic chat-session TTL sweep handle (issue #1685 item 1 /
834
+ * #1687 Thread 21). unref'd so it never blocks process exit
835
+ * (rule 47); cleared in `stop()`.
836
+ */
837
+ chatTtlTimer = null;
838
+ constructor(options) {
839
+ super();
840
+ this.service = options.service;
841
+ this.host = options.host?.trim() || "127.0.0.1";
842
+ this.requestedPort = parseHttpServerPort(options.port);
843
+ this.authToken = options.authToken?.trim() || void 0;
844
+ this.authTokens = (options.authTokens ?? []).map((t) => t.trim()).filter(Boolean);
845
+ this.authTokensGetter = options.authTokensGetter;
846
+ this.authTokenEntriesGetter = options.authTokenEntriesGetter;
847
+ this.tokenPathPolicy = options.tokenPathPolicy;
848
+ this.authenticatedPrincipal = options.principal?.trim() || void 0;
849
+ this.maxBodyBytes = Number.isFinite(options.maxBodyBytes) ? Math.max(1, Math.floor(options.maxBodyBytes ?? 131072)) : 131072;
850
+ this.writeLimiter = new WriteRateLimiter(
851
+ options.writeRateLimitMaxRequests,
852
+ options.writeRateLimitWindowMs
853
+ );
854
+ this.adminConsoleEnabled = options.adminConsoleEnabled !== false;
855
+ this.adminConsolePublicDir = options.adminConsolePublicDir ?? defaultAdminConsolePublicDir;
856
+ this.adminConsolePrefillToken = options.adminConsolePrefillToken === true ? this.authToken : void 0;
857
+ this.adminControls = options.adminControls;
858
+ this.trustPrincipalHeader = options.trustPrincipalHeader === true;
859
+ this.readiness = options.readiness ?? (() => ({ ready: true, warmupAttempts: 0 }));
860
+ this.resourceMetadataUrl = assertResourceMetadataUrl(options.resourceMetadataUrl);
861
+ this.externalRequestHandler = options.externalRequestHandler;
862
+ this.adapterRegistry = options.enableAdapters !== false ? options.adapterRegistry ?? new AdapterRegistry() : null;
863
+ this.mcpServer = new EngramMcpServer(this.service, {
864
+ principal: options.principal,
865
+ citationsEnabled: options.citationsEnabled,
866
+ citationsAutoDetect: options.citationsAutoDetect,
867
+ emitLegacyTools: options.emitLegacyTools,
868
+ codingDecisionVisible: this.service.decisionRecordSurfaceVisible,
869
+ architectureCardVisible: this.service.architectureCardSurfaceVisible,
870
+ codegraphVisible: this.service.codegraphSurfaceVisible,
871
+ sessionDeltaVisible: this.service.sessionDeltaSurfaceVisible,
872
+ chatVisible: this.service.configRef?.chat?.enabled === true,
873
+ correctionVisible: this.service.correctionSurfaceVisible
874
+ });
875
+ }
876
+ async start() {
877
+ if (!this.authToken && this.authTokens.length === 0 && !this.authTokensGetter && !this.authTokenEntriesGetter) {
878
+ throw new Error("engram access HTTP requires authToken or authTokens");
879
+ }
880
+ if (this.server) return this.status();
881
+ const server = createServer((req, res) => {
882
+ const correlationId = randomUUID();
883
+ const abortController = new AbortController();
884
+ const abortDisconnectedRequest = () => {
885
+ if (!res.writableFinished && !abortController.signal.aborted) {
886
+ abortController.abort(abortError("HTTP client disconnected"));
887
+ }
888
+ };
889
+ req.once("aborted", abortDisconnectedRequest);
890
+ res.once("close", abortDisconnectedRequest);
891
+ correlationIdStore.run(correlationId, () => {
892
+ void this.handle(req, res, correlationId, abortController.signal).catch((err) => {
893
+ if (isAbortError(err)) {
894
+ if (!res.destroyed && !res.writableEnded) {
895
+ res.end();
896
+ }
897
+ return;
898
+ }
899
+ log.debug(`engram access HTTP request failed [${correlationId}]: ${err}`);
900
+ if (err instanceof HttpError) {
901
+ const payload = { error: err.message, code: err.code };
902
+ if (err.details) payload.details = err.details;
903
+ this.respondJson(res, err.status, payload);
904
+ return;
905
+ }
906
+ if (err instanceof EngramAccessInputError) {
907
+ this.respondJson(res, 400, { error: err.message, code: "input_error" });
908
+ return;
909
+ }
910
+ if (err instanceof EngramAccessForbiddenError) {
911
+ this.respondJson(res, 403, { error: err.message, code: "forbidden" });
912
+ return;
913
+ }
914
+ if (err instanceof CorrectionContractError) {
915
+ this.respondJson(res, 400, { error: err.message, code: "correction_contract_error" });
916
+ return;
917
+ }
918
+ if (err instanceof RelayMissionStoreError) {
919
+ const status = err.code === "idempotency_conflict" ? 409 : err.code === "limit_exceeded" ? 413 : err.code === "lock_unavailable" ? 503 : 500;
920
+ this.respondJson(res, status, {
921
+ error: status >= 500 ? "relay_backend_unavailable" : err.message,
922
+ code: `relay_${err.code}`
923
+ });
924
+ return;
925
+ }
926
+ if (res.headersSent) {
927
+ res.destroy(err);
928
+ return;
929
+ }
930
+ log.error(
931
+ `engram access HTTP internal error [${correlationId}] ${summarizeHttpRequest(req)}`,
932
+ err
933
+ );
934
+ this.respondJson(res, 500, { error: "internal_error", code: "internal_error" });
935
+ }).finally(() => {
936
+ req.off("aborted", abortDisconnectedRequest);
937
+ res.off("close", abortDisconnectedRequest);
938
+ });
939
+ });
940
+ });
941
+ try {
942
+ await new Promise((resolve, reject) => {
943
+ const onError = (err) => {
944
+ server.off("listening", onListening);
945
+ reject(err);
946
+ };
947
+ const onListening = () => {
948
+ server.off("error", onError);
949
+ resolve();
950
+ };
951
+ server.once("error", onError);
952
+ server.once("listening", onListening);
953
+ server.listen(this.requestedPort, this.host);
954
+ });
955
+ } catch (err) {
956
+ server.close();
957
+ throw err;
958
+ }
959
+ this.server = server;
960
+ const address = server.address();
961
+ this.boundPort = typeof address === "object" && address ? address.port : this.requestedPort;
962
+ this.scheduleChatSessionTtlSweep();
963
+ return this.status();
964
+ }
965
+ async stop() {
966
+ if (!this.server) return;
967
+ if (this.chatTtlTimer) {
968
+ clearInterval(this.chatTtlTimer);
969
+ this.chatTtlTimer = null;
970
+ }
971
+ const server = this.server;
972
+ this.server = null;
973
+ this.boundPort = 0;
974
+ for (const cleanup of this.sseCleanupFns) {
975
+ try {
976
+ cleanup();
977
+ } catch {
978
+ }
979
+ }
980
+ this.sseCleanupFns.clear();
981
+ for (const [res, timer] of this.sseBatchTimers.entries()) {
982
+ clearTimeout(timer);
983
+ this.sseBatchTimers.delete(res);
984
+ }
985
+ this.ssePendingBatches.clear();
986
+ for (const res of this.sseClients) {
987
+ try {
988
+ res.end();
989
+ } catch {
990
+ }
991
+ }
992
+ this.sseClients.clear();
993
+ await new Promise((resolve, reject) => {
994
+ server.close((err) => err ? reject(err) : resolve());
995
+ });
996
+ }
997
+ /**
998
+ * Schedule the chat-session TTL sweep: one immediate pass plus a
999
+ * recurring hourly pass (issue #1685 item 1 / #1687 Thread 21). Both
1000
+ * are skipped when chat is disabled. The recurring timer is unref'd
1001
+ * so it never keeps the event loop alive on its own (rule 47). The
1002
+ * sweep itself is best-effort — cleanup failures are swallowed inside
1003
+ * `cleanupExpiredChatSessions`.
1004
+ */
1005
+ scheduleChatSessionTtlSweep() {
1006
+ if (this.chatTtlTimer) {
1007
+ clearInterval(this.chatTtlTimer);
1008
+ this.chatTtlTimer = null;
1009
+ }
1010
+ const chat = this.service.configRef?.chat;
1011
+ if (!chat?.enabled) return;
1012
+ const ttlHours = typeof chat.sessionTtlHours === "number" && chat.sessionTtlHours > 0 ? chat.sessionTtlHours : 72;
1013
+ void cleanupExpiredChatSessions(this.service.memoryDir, ttlHours).catch(() => {
1014
+ });
1015
+ const SWEEP_INTERVAL_MS = 60 * 60 * 1e3;
1016
+ this.chatTtlTimer = setInterval(() => {
1017
+ void cleanupExpiredChatSessions(this.service.memoryDir, ttlHours).catch(() => {
1018
+ });
1019
+ }, SWEEP_INTERVAL_MS);
1020
+ this.chatTtlTimer.unref?.();
1021
+ }
1022
+ status() {
1023
+ return {
1024
+ running: this.server !== null,
1025
+ host: this.host,
1026
+ port: this.boundPort,
1027
+ maxBodyBytes: this.maxBodyBytes
1028
+ };
1029
+ }
1030
+ /**
1031
+ * Resolve the adapter identity for the incoming request.
1032
+ * Includes MCP clientInfo from the last initialize handshake if available.
1033
+ * Returns null if no adapter matches or adapters are disabled.
1034
+ */
1035
+ resolveAdapterIdentity(req) {
1036
+ if (!this.adapterRegistry) return null;
1037
+ const sessionId = (() => {
1038
+ const raw = req.headers["mcp-session-id"];
1039
+ return typeof raw === "string" ? raw.trim() : void 0;
1040
+ })();
1041
+ return this.adapterRegistry.resolve({
1042
+ headers: req.headers,
1043
+ clientInfo: this.mcpServer.getClientInfo(sessionId)
1044
+ });
1045
+ }
1046
+ /** Cache for per-request identity resolution (avoids double adapter resolution) */
1047
+ identityCache = /* @__PURE__ */ new WeakMap();
1048
+ /** Resolve principal, namespace, and session key from request headers and adapter identity */
1049
+ resolveRequestIdentity(req) {
1050
+ const cached = this.identityCache.get(req);
1051
+ if (cached) return cached;
1052
+ let principal;
1053
+ let namespace;
1054
+ let sessionKey;
1055
+ if (this.trustPrincipalHeader) {
1056
+ const headerVal = req.headers["x-engram-principal"];
1057
+ const raw = Array.isArray(headerVal) ? headerVal[0] : headerVal;
1058
+ if (typeof raw === "string") {
1059
+ const trimmed = raw.trim();
1060
+ if (trimmed.length > 0) {
1061
+ principal = trimmed;
1062
+ }
1063
+ }
1064
+ }
1065
+ if (!principal) {
1066
+ principal = this.authenticatedPrincipal;
1067
+ }
1068
+ const adapterIdentity = this.resolveAdapterIdentity(req);
1069
+ if (adapterIdentity) {
1070
+ if (!principal) {
1071
+ principal = adapterIdentity.principal;
1072
+ }
1073
+ namespace = adapterIdentity.namespace;
1074
+ sessionKey = adapterIdentity.sessionKey;
1075
+ }
1076
+ const result = { principal, namespace, sessionKey };
1077
+ this.identityCache.set(req, result);
1078
+ return result;
1079
+ }
1080
+ resolveRequestPrincipal(req) {
1081
+ return this.resolveRequestIdentity(req).principal;
1082
+ }
1083
+ /** Caller scope for wearables/meetings ops (issue #2123): request principal +
1084
+ * gated namespace + optional sessionKey, so reads/writes resolve to the caller
1085
+ * namespace instead of the machine default. */
1086
+ wearablesScope(req, namespace, sessionKey) {
1087
+ return { authenticatedPrincipal: this.resolveRequestPrincipal(req), namespace: this.resolveNamespace(req, namespace), ...sessionKey ? { sessionKey } : {} };
1088
+ }
1089
+ /** Resolve namespace: only use the explicit body value. Adapter-inferred namespace
1090
+ * is intentionally NOT used as a fallback for REST requests — omitting namespace
1091
+ * should default to the server's global namespace, not silently scope to an adapter. */
1092
+ resolveNamespace(_req, bodyNamespace) {
1093
+ const namespace = bodyNamespace || void 0;
1094
+ enforceNamespaceAllowList(tokenCapabilityStore.getStore(), namespace, this.service.configRef?.defaultNamespace);
1095
+ return namespace;
1096
+ }
1097
+ /**
1098
+ * Resolve + enforce the `namespace` field carried in a POST request body,
1099
+ * returning a shallow-copied envelope with the gated namespace stamped on.
1100
+ * Used by the coding/correction POST routes that pass `body` straight to
1101
+ * `op.run`: the body `namespace` is a user-controlled field that MUST flow
1102
+ * through the same effective-namespace allow-list gate as the query-param
1103
+ * routes, otherwise a scoped bearer can scope its call to another tenant
1104
+ * by setting `body.namespace` (issue #1850 finding 2). Throws 403 for a
1105
+ * scoped token whose allow-list does not cover the effective namespace.
1106
+ *
1107
+ * A `namespace` that is neither a string nor `null` is REJECTED here rather
1108
+ * than coerced to `undefined`: silently reinterpreting it would default the
1109
+ * request to the principal's namespace set and answer 200, hiding the
1110
+ * caller's mistake behind a plausible result (AGENTS.md pattern 39). `null`
1111
+ * and an absent field keep their documented "no explicit namespace" meaning.
1112
+ */
1113
+ gatedBodyNamespace(req, body) {
1114
+ const requested = body.namespace;
1115
+ if (requested !== void 0 && requested !== null && typeof requested !== "string") {
1116
+ throw new EngramAccessInputError(
1117
+ `namespace must be a string or null (got: ${typeof requested})`
1118
+ );
1119
+ }
1120
+ const trimmed = typeof requested === "string" ? requested.trim() : void 0;
1121
+ const namespace = this.resolveNamespace(req, trimmed || void 0);
1122
+ return { ...body, namespace };
1123
+ }
1124
+ /**
1125
+ * Resolve the recall disclosure depth from the request (issue #677 PR
1126
+ * 2/4). Explicit body value wins; otherwise we accept a
1127
+ * `?disclosure=...` query parameter so curl/browser tooling can use the
1128
+ * three-tier surface without rewriting JSON. Invalid query values
1129
+ * throw `EngramAccessInputError` (CLAUDE.md rule 51 — no silent
1130
+ * fallback). An absent body field AND an absent query param yields
1131
+ * `undefined`, which the service maps to `DEFAULT_RECALL_DISCLOSURE`.
1132
+ */
1133
+ resolveRecallDisclosure(bodyDisclosure, parsed) {
1134
+ if (bodyDisclosure !== void 0) {
1135
+ return bodyDisclosure;
1136
+ }
1137
+ const queryDisclosure = parsed.searchParams.get("disclosure");
1138
+ if (queryDisclosure === null) {
1139
+ return void 0;
1140
+ }
1141
+ if (!isRecallDisclosure(queryDisclosure)) {
1142
+ throw new EngramAccessInputError(
1143
+ `disclosure must be one of: chunk, section, raw (got: ${queryDisclosure})`
1144
+ );
1145
+ }
1146
+ return queryDisclosure;
1147
+ }
1148
+ async handle(req, res, correlationId, abortSignal) {
1149
+ const parsed = new URL2(req.url ?? "/", `http://${hostToUrlAuthority(this.host)}`);
1150
+ const pathname = parsed.pathname;
1151
+ if (await this.handleSupportPassportUi(req, res, pathname)) return;
1152
+ if (this.adminConsoleEnabled && await this.handleAdminConsole(req, res, pathname)) return;
1153
+ if (req.method === "GET" && (pathname === "/engram/v1/live" || pathname === "/engram/v1/health")) {
1154
+ const { ready, warmupAttempts, lastError } = this.readiness();
1155
+ if (!ready) {
1156
+ this.respondJson(res, 503, {
1157
+ ok: false,
1158
+ ready: false,
1159
+ warmupAttempts,
1160
+ lastError: lastError ?? null,
1161
+ code: "not_ready"
1162
+ });
1163
+ return;
1164
+ }
1165
+ }
1166
+ if (await this.handleSupportPassportPublicRequest(req, res)) return;
1167
+ if (this.externalRequestHandler) {
1168
+ const tokenAuthorized = this.isAuthorized(req, pathname);
1169
+ const capabilities = this.resolveTokenCapabilities(req, pathname);
1170
+ const authorized = tokenAuthorized && !isCapabilityRestricted(capabilities);
1171
+ if (await this.externalRequestHandler(req, res, {
1172
+ authorized,
1173
+ tokenAuthorized
1174
+ })) return;
1175
+ }
1176
+ if (!this.isAuthorized(req, pathname)) {
1177
+ const body = JSON.stringify({ error: "unauthorized", code: "unauthorized" });
1178
+ res.writeHead(401, {
1179
+ "content-type": "application/json; charset=utf-8",
1180
+ "www-authenticate": this.bearerChallenge(),
1181
+ "x-request-id": correlationId
1182
+ });
1183
+ res.end(body);
1184
+ return;
1185
+ }
1186
+ const caps = this.resolveTokenCapabilities(req, pathname);
1187
+ await tokenCapabilityStore.run(caps, async () => {
1188
+ await this.dispatchAuthorizedRequest(req, res, parsed, pathname, correlationId, abortSignal);
1189
+ });
1190
+ }
1191
+ async dispatchAuthorizedRequest(req, res, parsed, pathname, correlationId, abortSignal) {
1192
+ if (pathname === "/mcp" && req.method === "DELETE") {
1193
+ res.writeHead(204);
1194
+ res.end();
1195
+ return;
1196
+ }
1197
+ if (pathname === "/mcp" && req.method === "GET") {
1198
+ if ((req.headers.accept ?? "").includes("text/event-stream"))
1199
+ return handleMcpGetSse(req, res, this.sseCleanupFns);
1200
+ const body = JSON.stringify({ error: "method_not_allowed", code: "method_not_allowed" });
1201
+ res.writeHead(405, { "content-type": "application/json; charset=utf-8", allow: "GET, POST, DELETE", "x-request-id": correlationId });
1202
+ res.end(body);
1203
+ return;
1204
+ }
1205
+ if (req.method === "POST" && pathname === "/mcp") return this.handleMcpRequest(req, res, abortSignal);
1206
+ if (await this.handleSupportPassportOwnerRequest(req, res, pathname, parsed.search.length > 0, abortSignal)) return;
1207
+ if (await this.handleReviewDeckRequest(req, res, pathname, abortSignal)) return;
1208
+ if (req.method === "GET" && pathname === "/engram/v1/live") return this.respondJson(res, 200, { ok: true, ready: true });
1209
+ if (req.method === "GET" && pathname === "/engram/v1/health") {
1210
+ const { degraded, warmupAttempts, lastError } = this.readiness();
1211
+ const health = await this.service.health();
1212
+ this.respondJson(res, 200, degraded !== true ? health : {
1213
+ ...health,
1214
+ degraded: true,
1215
+ warmupAttempts,
1216
+ lastError: lastError ?? null
1217
+ });
1218
+ return;
1219
+ }
1220
+ if (req.method === "GET" && pathname === "/engram/v1/capabilities") return respondAccessCapabilitiesHttp(res);
1221
+ if (req.method === "GET" && pathname === "/engram/v1/authorization") {
1222
+ res.setHeader("cache-control", "no-store");
1223
+ const probe = probeOperationAuthorization(tokenCapabilityStore.getStore(), parsed.searchParams.getAll("op"));
1224
+ for (const namespace of authorizationProbeNamespaces(probe.operations, parsed.searchParams.get("namespace") ?? void 0))
1225
+ this.resolveNamespace(req, namespace);
1226
+ if (authorizationProbeRequiresPrincipalNamespace(probe.operations))
1227
+ await this.enforceSupportPassportAuthorizationProbe(req);
1228
+ this.respondJson(res, 200, probe);
1229
+ return;
1230
+ }
1231
+ if (req.method === "GET" && pathname === "/engram/v1/adapters") {
1232
+ this.enforceTokenOp("adapters_status");
1233
+ const identity = this.resolveAdapterIdentity(req);
1234
+ this.respondJson(res, 200, {
1235
+ adaptersEnabled: this.adapterRegistry !== null,
1236
+ registered: this.adapterRegistry?.list() ?? [],
1237
+ resolved: identity
1238
+ });
1239
+ return;
1240
+ }
1241
+ if (req.method === "GET" && (pathname === "/engram/v1/admin/dashboard" || pathname === "/remnic/v1/admin/dashboard")) {
1242
+ this.requireOperatorToken();
1243
+ if (!this.adminControls) {
1244
+ this.respondJson(res, 404, { error: "admin_controls_unavailable", code: "admin_controls_unavailable" });
1245
+ return;
1246
+ }
1247
+ this.respondJson(res, 200, await this.adminControls.status());
1248
+ return;
1249
+ }
1250
+ if (req.method === "PATCH" && (pathname === "/engram/v1/admin/config" || pathname === "/remnic/v1/admin/config")) {
1251
+ this.requireOperatorToken();
1252
+ if (!this.adminControls?.update) {
1253
+ this.respondJson(res, 404, { error: "admin_controls_unavailable", code: "admin_controls_unavailable" });
1254
+ return;
1255
+ }
1256
+ try {
1257
+ this.respondJson(res, 200, await this.adminControls.update(await this.readJsonBody(req)));
1258
+ } catch (error) {
1259
+ throw new HttpError(
1260
+ 400,
1261
+ error instanceof Error ? error.message : "invalid_admin_config_patch",
1262
+ "invalid_admin_config_patch"
1263
+ );
1264
+ }
1265
+ return;
1266
+ }
1267
+ if (req.method === "POST" && (pathname === "/engram/v1/external-wikis/search" || pathname === "/remnic/v1/external-wikis/search")) {
1268
+ this.enforceTokenOp("external_wiki_search");
1269
+ const operation = getOperation("external_wiki_search");
1270
+ if (!operation) throw new EngramAccessInputError("external_wiki_search operation is not registered");
1271
+ const output = await operation.run(await this.readJsonBody(req), { service: this.service });
1272
+ if (!output || typeof output !== "object" || !("result" in output)) {
1273
+ throw new Error("external_wiki_search returned an invalid operation result");
1274
+ }
1275
+ this.respondJson(res, 200, output.result);
1276
+ return;
1277
+ }
1278
+ if (req.method === "POST" && (pathname === "/engram/v1/memories/search" || pathname === "/remnic/v1/memories/search")) {
1279
+ this.enforceTokenOp("memory_search");
1280
+ const operation = getOperation("memory_search");
1281
+ if (!operation) throw new EngramAccessInputError("access-boundary: operation not registered: memory_search");
1282
+ const body = this.gatedBodyNamespace(req, await this.readJsonBody(req));
1283
+ if (body.namespace === void 0 && tokenCapabilityStore.getStore()?.namespaces !== void 0) {
1284
+ body.namespace = this.service.configRef?.defaultNamespace ?? "";
1285
+ }
1286
+ const output = await operation.run(body, {
1287
+ service: this.service,
1288
+ authenticatedPrincipal: this.resolveRequestPrincipal(req)
1289
+ });
1290
+ this.respondJson(res, 200, output.result);
1291
+ return;
1292
+ }
1293
+ if (req.method === "POST" && pathname === "/engram/v1/recall") {
1294
+ this.enforceTokenOp("recall");
1295
+ const body = await this.readValidatedBody(req, "recall");
1296
+ const disclosure = this.resolveRecallDisclosure(body.disclosure, parsed);
1297
+ const asOfQueryRaw = parsed.searchParams.get("as_of");
1298
+ const bodyHasAsOf = typeof body.asOf === "string" && body.asOf.length > 0;
1299
+ if (!bodyHasAsOf && asOfQueryRaw !== null && asOfQueryRaw.length === 0) {
1300
+ throw new EngramAccessInputError(
1301
+ "as_of must be a non-empty timestamp (got empty value)"
1302
+ );
1303
+ }
1304
+ const asOf = body.asOf ?? (asOfQueryRaw !== null && asOfQueryRaw.length > 0 ? asOfQueryRaw : void 0);
1305
+ const bodyHasTagsField = body !== null && typeof body === "object" && "tags" in body;
1306
+ const bodyTagsValue = bodyHasTagsField ? body.tags : void 0;
1307
+ const bodyTags = Array.isArray(bodyTagsValue) ? bodyTagsValue : void 0;
1308
+ const queryTags = parsed.searchParams.getAll("tag");
1309
+ const tags = bodyHasTagsField ? bodyTags : queryTags.length > 0 ? queryTags : void 0;
1310
+ const bodyTagMatch = body.tagMatch;
1311
+ let tagMatch;
1312
+ if (bodyTagMatch !== void 0) {
1313
+ if (bodyTagMatch === "any" || bodyTagMatch === "all") {
1314
+ tagMatch = bodyTagMatch;
1315
+ }
1316
+ } else {
1317
+ const queryTagMatch = parsed.searchParams.get("tag_match");
1318
+ if (queryTagMatch !== null) {
1319
+ if (queryTagMatch !== "any" && queryTagMatch !== "all") {
1320
+ throw new EngramAccessInputError(
1321
+ `tag_match must be one of: any, all (got: ${queryTagMatch})`
1322
+ );
1323
+ }
1324
+ tagMatch = queryTagMatch;
1325
+ }
1326
+ }
1327
+ const bodyIncludeLowConfidence = body.includeLowConfidence;
1328
+ const queryIncludeLowConfidence = parsed.searchParams.get("include_low_confidence");
1329
+ if (bodyIncludeLowConfidence === void 0 && queryIncludeLowConfidence !== null && queryIncludeLowConfidence !== "true" && queryIncludeLowConfidence !== "false") {
1330
+ throw new EngramAccessInputError(
1331
+ `include_low_confidence must be one of: true, false (got: ${queryIncludeLowConfidence})`
1332
+ );
1333
+ }
1334
+ const includeLowConfidence = bodyIncludeLowConfidence === true || bodyIncludeLowConfidence === void 0 && queryIncludeLowConfidence === "true";
1335
+ const op = getOperation("recall");
1336
+ if (!op) {
1337
+ throw new EngramAccessInputError("access-boundary: operation not registered: recall");
1338
+ }
1339
+ const output = await op.run(
1340
+ {
1341
+ ...body,
1342
+ namespace: this.resolveNamespace(req, body.namespace),
1343
+ ...disclosure !== void 0 ? { disclosure } : {},
1344
+ ...asOf !== void 0 ? { asOf } : {},
1345
+ ...tags !== void 0 ? { tags } : {},
1346
+ ...tagMatch !== void 0 ? { tagMatch } : {},
1347
+ ...includeLowConfidence ? { includeLowConfidence: true } : {}
1348
+ },
1349
+ {
1350
+ service: this.service,
1351
+ authenticatedPrincipal: this.resolveRequestPrincipal(req),
1352
+ sourceConnector: this.resolveConnector(req),
1353
+ ...abortSignal ? { abortSignal } : {}
1354
+ }
1355
+ );
1356
+ this.respondJson(res, 200, output.result);
1357
+ return;
1358
+ }
1359
+ if (req.method === "POST" && pathname === "/engram/v1/coding-context") {
1360
+ this.enforceTokenOp("set_coding_context");
1361
+ const body = await this.readValidatedBody(req, "setCodingContext");
1362
+ const codingContext = body.codingContext !== void 0 ? body.codingContext : typeof body.projectTag === "string" ? codingContextFromProjectTag(body.projectTag) : (() => {
1363
+ throw new EngramAccessInputError("codingContext or projectTag is required");
1364
+ })();
1365
+ this.service.setCodingContext({
1366
+ sessionKey: body.sessionKey,
1367
+ codingContext
1368
+ });
1369
+ this.respondJson(res, 200, { ok: true });
1370
+ return;
1371
+ }
1372
+ if (req.method === "POST" && (pathname === "/engram/v1/capsules/export" || pathname === "/remnic/v1/capsules/export")) {
1373
+ this.enforceTokenOp("capsule_export");
1374
+ const body = await this.readValidatedBody(req, "capsuleExport");
1375
+ this.ensureWriteRateLimitAvailable(req);
1376
+ const result = await this.service.capsuleExport({
1377
+ name: body.name,
1378
+ namespace: this.resolveNamespace(req, body.namespace),
1379
+ principal: this.resolveRequestPrincipal(req),
1380
+ since: body.since,
1381
+ includeKinds: body.includeKinds,
1382
+ peerIds: body.peerIds,
1383
+ includeTranscripts: body.includeTranscripts,
1384
+ encrypt: body.encrypt
1385
+ });
1386
+ this.recordWriteRateLimitHit(req);
1387
+ this.respondJson(res, 200, result);
1388
+ return;
1389
+ }
1390
+ if (req.method === "POST" && (pathname === "/engram/v1/capsules/import" || pathname === "/remnic/v1/capsules/import")) {
1391
+ this.enforceTokenOp("capsule_import");
1392
+ const body = await this.readValidatedBody(req, "capsuleImport");
1393
+ this.ensureWriteRateLimitAvailable(req);
1394
+ const result = await this.service.capsuleImport({
1395
+ archivePath: expandTildePath(body.archivePath),
1396
+ namespace: this.resolveNamespace(req, body.namespace),
1397
+ principal: this.resolveRequestPrincipal(req),
1398
+ mode: body.mode,
1399
+ passphrase: body.passphrase
1400
+ });
1401
+ this.recordWriteRateLimitHit(req);
1402
+ this.respondJson(res, 200, result);
1403
+ return;
1404
+ }
1405
+ if (req.method === "GET" && (pathname === "/engram/v1/offline-sync/capabilities" || pathname === "/remnic/v1/offline-sync/capabilities")) {
1406
+ this.enforceTokenOp("offline_sync_snapshot");
1407
+ this.respondJson(res, 200, {
1408
+ version: 1,
1409
+ convergenceFinalization: true,
1410
+ manifestStream: true,
1411
+ manifestRevision: peerManifestRevision(this.service.configRef?.inlineSourceAttributionFormat)
1412
+ });
1413
+ return;
1414
+ }
1415
+ if (req.method === "GET" && (pathname === "/engram/v1/offline-sync/snapshot" || pathname === "/remnic/v1/offline-sync/snapshot")) {
1416
+ this.enforceTokenOp("offline_sync_snapshot");
1417
+ const includeTranscriptsRaw = parsed.searchParams.get("include_transcripts");
1418
+ const includeContentRaw = parsed.searchParams.get("content");
1419
+ if (includeTranscriptsRaw !== null && includeTranscriptsRaw !== "true" && includeTranscriptsRaw !== "false") {
1420
+ throw new EngramAccessInputError(
1421
+ `include_transcripts must be one of: true, false (got: ${includeTranscriptsRaw})`
1422
+ );
1423
+ }
1424
+ if (includeContentRaw !== null && includeContentRaw !== "true" && includeContentRaw !== "false") {
1425
+ throw new EngramAccessInputError(
1426
+ `content must be one of: true, false (got: ${includeContentRaw})`
1427
+ );
1428
+ }
1429
+ const namespaceParam = parsed.searchParams.get("namespace");
1430
+ const result = await this.service.offlineSyncSnapshot({
1431
+ namespace: this.resolveNamespace(
1432
+ req,
1433
+ namespaceParam && namespaceParam.length > 0 ? namespaceParam : void 0
1434
+ ),
1435
+ principal: this.resolveRequestPrincipal(req),
1436
+ includeTranscripts: includeTranscriptsRaw !== "false",
1437
+ includeContent: includeContentRaw !== "false"
1438
+ });
1439
+ this.respondJson(res, 200, result);
1440
+ return;
1441
+ }
1442
+ if (req.method === "GET" && (pathname === "/engram/v1/offline-sync/snapshot-stream" || pathname === "/remnic/v1/offline-sync/snapshot-stream")) {
1443
+ this.enforceTokenOp("offline_sync_snapshot_stream");
1444
+ const includeTranscriptsRaw = parsed.searchParams.get("include_transcripts");
1445
+ const includeContentRaw = parsed.searchParams.get("content");
1446
+ if (includeTranscriptsRaw !== null && includeTranscriptsRaw !== "true" && includeTranscriptsRaw !== "false") {
1447
+ throw new EngramAccessInputError(
1448
+ `include_transcripts must be one of: true, false (got: ${includeTranscriptsRaw})`
1449
+ );
1450
+ }
1451
+ if (includeContentRaw !== null && includeContentRaw !== "false") {
1452
+ throw new EngramAccessInputError("snapshot-stream content must be false");
1453
+ }
1454
+ const namespaceParam = parsed.searchParams.get("namespace");
1455
+ const result = await this.service.offlineSyncSnapshotStream({
1456
+ namespace: this.resolveNamespace(
1457
+ req,
1458
+ namespaceParam && namespaceParam.length > 0 ? namespaceParam : void 0
1459
+ ),
1460
+ principal: this.resolveRequestPrincipal(req),
1461
+ includeTranscripts: includeTranscriptsRaw !== "false",
1462
+ includeContent: false,
1463
+ signal: this.createRequestAbortSignal(req, res)
1464
+ });
1465
+ await respondOfflineSnapshotStream(res, result, correlationIdStore.getStore());
1466
+ return;
1467
+ }
1468
+ if (req.method === "GET" && (pathname === "/engram/v1/offline-sync/manifest-stream" || pathname === "/remnic/v1/offline-sync/manifest-stream")) {
1469
+ this.enforceTokenOp("offline_sync_snapshot_stream");
1470
+ const includeTranscriptsRaw = parsed.searchParams.get("include_transcripts");
1471
+ const includeContentRaw = parsed.searchParams.get("content");
1472
+ if (includeTranscriptsRaw !== null && includeTranscriptsRaw !== "true" && includeTranscriptsRaw !== "false") {
1473
+ throw new EngramAccessInputError(
1474
+ `include_transcripts must be one of: true, false (got: ${includeTranscriptsRaw})`
1475
+ );
1476
+ }
1477
+ if (includeContentRaw !== null && includeContentRaw !== "false") {
1478
+ throw new EngramAccessInputError("manifest-stream content must be false");
1479
+ }
1480
+ const namespaceParam = parsed.searchParams.get("namespace");
1481
+ const result = await this.service.offlineSyncManifestStream({
1482
+ namespace: this.resolveNamespace(
1483
+ req,
1484
+ namespaceParam && namespaceParam.length > 0 ? namespaceParam : void 0
1485
+ ),
1486
+ principal: this.resolveRequestPrincipal(req),
1487
+ includeTranscripts: includeTranscriptsRaw !== "false",
1488
+ signal: this.createRequestAbortSignal(req, res)
1489
+ });
1490
+ await respondOfflineManifestStream(res, result, correlationIdStore.getStore());
1491
+ return;
1492
+ }
1493
+ if (req.method === "POST" && (pathname === "/engram/v1/offline-sync/snapshot" || pathname === "/remnic/v1/offline-sync/snapshot")) {
1494
+ this.enforceTokenOp("offline_sync_snapshot");
1495
+ const body = await this.readValidatedBody(
1496
+ req,
1497
+ "offlineSyncSnapshot",
1498
+ OFFLINE_SYNC_SNAPSHOT_BASE_MAX_BODY_BYTES
1499
+ );
1500
+ const result = await this.service.offlineSyncSnapshot({
1501
+ namespace: this.resolveNamespace(req, body.namespace),
1502
+ principal: this.resolveRequestPrincipal(req),
1503
+ includeTranscripts: body.includeTranscripts,
1504
+ includeContent: body.includeContent,
1505
+ baseFiles: body.baseFiles,
1506
+ ...body.baseCapturedAt ? { baseCapturedAt: new Date(body.baseCapturedAt) } : {},
1507
+ signal: this.createRequestAbortSignal(req, res)
1508
+ });
1509
+ this.respondJson(res, 200, result);
1510
+ return;
1511
+ }
1512
+ if (req.method === "POST" && (pathname === "/engram/v1/offline-sync/files" || pathname === "/remnic/v1/offline-sync/files")) {
1513
+ this.enforceTokenOp("offline_sync_files");
1514
+ const body = await this.readValidatedBody(req, "offlineSyncFiles");
1515
+ const result = await this.service.offlineSyncFiles({
1516
+ namespace: this.resolveNamespace(req, body.namespace),
1517
+ principal: this.resolveRequestPrincipal(req),
1518
+ includeTranscripts: body.includeTranscripts,
1519
+ paths: body.paths
1520
+ });
1521
+ this.respondJson(res, 200, result);
1522
+ return;
1523
+ }
1524
+ if (req.method === "POST" && (pathname === "/engram/v1/offline-sync/file-content" || pathname === "/remnic/v1/offline-sync/file-content")) {
1525
+ this.enforceTokenOp("offline_sync_file_content");
1526
+ const body = await this.readValidatedBody(req, "offlineSyncFileContent");
1527
+ const result = await this.service.offlineSyncFileContent({
1528
+ namespace: this.resolveNamespace(req, body.namespace),
1529
+ principal: this.resolveRequestPrincipal(req),
1530
+ includeTranscripts: body.includeTranscripts,
1531
+ path: body.path,
1532
+ offset: body.offset,
1533
+ length: body.length
1534
+ });
1535
+ this.respondBinary(res, 200, result.content, {
1536
+ "x-remnic-namespace": encodeURIComponent(result.namespace),
1537
+ "x-remnic-file-path": encodeURIComponent(result.path),
1538
+ "x-remnic-file-bytes": String(result.bytes),
1539
+ "x-remnic-file-mtime-ms": String(result.mtimeMs),
1540
+ "x-remnic-chunk-offset": String(result.offset),
1541
+ "x-remnic-chunk-bytes": String(result.chunkBytes),
1542
+ ...result.sha256 ? { "x-remnic-file-sha256": result.sha256 } : {}
1543
+ });
1544
+ return;
1545
+ }
1546
+ if (req.method === "POST" && (pathname === "/engram/v1/offline-sync/apply-file-content" || pathname === "/remnic/v1/offline-sync/apply-file-content")) {
1547
+ this.enforceTokenOp("offline_sync_apply_file_content");
1548
+ const namespaceParam = parsed.searchParams.get("namespace");
1549
+ const bytes = this.readRequiredIntegerHeader(req, "x-remnic-file-bytes");
1550
+ const offset = this.readOptionalIntegerHeader(req, "x-remnic-chunk-offset") ?? 0;
1551
+ const content = await this.readBinaryBody(req, OFFLINE_SYNC_FILE_CONTENT_MAX_CHUNK_BYTES);
1552
+ const result = await this.service.offlineSyncApplyFileContent({
1553
+ namespace: this.resolveNamespace(
1554
+ req,
1555
+ namespaceParam && namespaceParam.length > 0 ? namespaceParam : void 0
1556
+ ),
1557
+ principal: this.resolveRequestPrincipal(req),
1558
+ includeTranscripts: this.parseOptionalBooleanHeader(
1559
+ req,
1560
+ "x-remnic-include-transcripts",
1561
+ true
1562
+ ),
1563
+ sourceId: this.readRequiredDecodedHeader(req, "x-remnic-source-id"),
1564
+ path: this.readRequiredDecodedHeader(req, "x-remnic-file-path"),
1565
+ sha256: this.readRequiredHeader(req, "x-remnic-file-sha256"),
1566
+ bytes,
1567
+ mtimeMs: this.readRequiredNumberHeader(req, "x-remnic-file-mtime-ms"),
1568
+ offset,
1569
+ baseSha256: this.readOptionalHeader(req, "x-remnic-base-sha256"),
1570
+ content
1571
+ });
1572
+ this.respondJson(res, 200, result);
1573
+ return;
1574
+ }
1575
+ if (req.method === "POST" && (pathname === "/engram/v1/offline-sync/convergence-complete" || pathname === "/remnic/v1/offline-sync/convergence-complete")) {
1576
+ void getOperation("offline_sync_apply_file_content");
1577
+ this.enforceTokenAnyOf(["offline_sync_apply_file_content", "offline_sync_apply"]);
1578
+ const namespaceParams = parsed.searchParams.getAll("namespace").filter(Boolean);
1579
+ const requestedNamespaces = namespaceParams.length > 0 ? namespaceParams : [void 0];
1580
+ const namespaces = requestedNamespaces.map((namespace) => this.resolveNamespace(req, namespace)).filter((namespace) => namespace !== void 0);
1581
+ this.ensureWriteRateLimitAvailable(req);
1582
+ const result = await this.service.offlineSyncFinalizeConvergence({
1583
+ ...namespaces.length > 0 ? { namespaces } : {},
1584
+ principal: this.resolveRequestPrincipal(req),
1585
+ sourceId: this.readRequiredDecodedHeader(req, "x-remnic-source-id")
1586
+ });
1587
+ this.recordWriteRateLimitHit(req);
1588
+ this.respondJson(res, 200, result);
1589
+ return;
1590
+ }
1591
+ if (req.method === "POST" && (pathname === "/engram/v1/offline-sync/apply" || pathname === "/remnic/v1/offline-sync/apply")) {
1592
+ this.enforceTokenOp("offline_sync_apply");
1593
+ const body = await this.readValidatedBody(req, "offlineSyncApply", OFFLINE_SYNC_APPLY_MAX_BODY_BYTES);
1594
+ const result = await this.service.offlineSyncApply({
1595
+ namespace: this.resolveNamespace(req, body.namespace),
1596
+ principal: this.resolveRequestPrincipal(req),
1597
+ changeset: body.changeset,
1598
+ returnCurrentFiles: body.returnCurrentFiles
1599
+ });
1600
+ this.respondJson(res, 200, result);
1601
+ return;
1602
+ }
1603
+ if (req.method === "POST" && pathname === "/engram/v1/recall/explain") {
1604
+ this.enforceTokenOp("recall_explain");
1605
+ const body = await this.readValidatedBody(req, "recallExplain");
1606
+ const response = await this.service.recallExplain({
1607
+ sessionKey: body.sessionKey,
1608
+ namespace: this.resolveNamespace(req, body.namespace),
1609
+ authenticatedPrincipal: this.resolveRequestPrincipal(req)
1610
+ });
1611
+ this.respondJson(res, 200, response);
1612
+ return;
1613
+ }
1614
+ if (req.method === "POST" && (pathname === "/engram/v1/action-confidence" || pathname === "/remnic/v1/action-confidence")) {
1615
+ this.enforceTokenOp("action_confidence");
1616
+ const body = await this.readValidatedBody(req, "actionConfidence");
1617
+ this.respondJson(res, 200, await this.service.actionConfidence(body));
1618
+ return;
1619
+ }
1620
+ if (req.method === "GET" && pathname === "/engram/v1/recall/tier-explain") {
1621
+ this.enforceTokenOp("recall_tier_explain");
1622
+ const sessionParam = parsed.searchParams.get("session");
1623
+ const sessionKey = sessionParam && sessionParam.length > 0 ? sessionParam : void 0;
1624
+ const namespaceParam = parsed.searchParams.get("namespace");
1625
+ const namespace = this.resolveNamespace(
1626
+ req,
1627
+ namespaceParam && namespaceParam.length > 0 ? namespaceParam : void 0
1628
+ );
1629
+ const payload = await this.service.recallTierExplain(sessionKey, namespace, this.resolveRequestPrincipal(req));
1630
+ this.respondJson(res, 200, payload);
1631
+ return;
1632
+ }
1633
+ if (req.method === "GET" && pathname === "/engram/v1/recall/xray") {
1634
+ this.enforceTokenOp("recall_xray");
1635
+ const outcome = await handleRecallXrayHttpQuery({
1636
+ getParam: (name) => parsed.searchParams.get(name),
1637
+ resolveNamespace: (namespace) => this.resolveNamespace(req, namespace),
1638
+ principal: this.resolveRequestPrincipal(req),
1639
+ connector: this.resolveConnector(req),
1640
+ run: (request) => this.service.recallXray(request)
1641
+ });
1642
+ this.respondJson(res, outcome.status, outcome.body);
1643
+ return;
1644
+ }
1645
+ if (req.method === "GET" && (pathname === "/engram/v1/recall/why" || pathname === "/remnic/v1/recall/why")) {
1646
+ this.enforceTokenOp("recall_why");
1647
+ const outcome = await handleRecallWhyHttpQuery({
1648
+ getParam: (name) => parsed.searchParams.get(name),
1649
+ resolveNamespace: (namespace) => this.resolveNamespace(req, namespace),
1650
+ principal: this.resolveRequestPrincipal(req),
1651
+ connector: this.resolveConnector(req),
1652
+ run: (request) => this.service.recallWhy(request)
1653
+ });
1654
+ this.respondJson(res, outcome.status, outcome.body);
1655
+ return;
1656
+ }
1657
+ if (req.method === "GET" && (pathname === "/engram/v1/who-knows" || pathname === "/remnic/v1/who-knows")) {
1658
+ this.enforceTokenOp("who_knows");
1659
+ const outcome = await handleWhoKnowsHttpQuery({
1660
+ getParam: (name) => parsed.searchParams.get(name),
1661
+ resolveNamespace: (namespace) => this.resolveNamespace(req, namespace),
1662
+ principal: this.resolveRequestPrincipal(req),
1663
+ run: (request) => this.service.whoKnows(request)
1664
+ });
1665
+ this.respondJson(res, outcome.status, outcome.body);
1666
+ return;
1667
+ }
1668
+ if (req.method === "GET" && pathname === "/engram/v1/namespace/writable") {
1669
+ if (!getOperation("namespace_writable")) throw new Error("namespace_writable operation is not registered");
1670
+ this.respondJson(
1671
+ res,
1672
+ 200,
1673
+ await resolveQueryNamespaceWritablePreflight(
1674
+ tokenCapabilityStore.getStore(),
1675
+ parsed.searchParams,
1676
+ this.resolveRequestPrincipal(req),
1677
+ this.service.configRef.defaultNamespace,
1678
+ (request) => this.service.namespaceWritablePreflight(request)
1679
+ )
1680
+ );
1681
+ return;
1682
+ }
1683
+ if (req.method === "GET" && (pathname === "/engram/v1/wearables/status" || pathname === "/remnic/v1/wearables/status")) {
1684
+ this.enforceTokenOp("wearables_status");
1685
+ this.respondJson(res, 200, await this.service.wearablesStatus(this.wearablesScope(req, parsed.searchParams.get("namespace") ?? void 0, parsed.searchParams.get("sessionKey") ?? void 0)));
1686
+ return;
1687
+ }
1688
+ if (req.method === "POST" && (pathname === "/engram/v1/wearables/sync" || pathname === "/remnic/v1/wearables/sync")) {
1689
+ this.enforceTokenOp("wearables_sync");
1690
+ const body = await this.readJsonBody(req);
1691
+ const source = optionalQueryString(body.source, "source");
1692
+ const date = optionalQueryString(body.date, "date");
1693
+ let days;
1694
+ if (body.days !== void 0 && body.days !== null) {
1695
+ if (typeof body.days !== "number" || !Number.isInteger(body.days) || body.days < 1) {
1696
+ throw new EngramAccessInputError(
1697
+ `days must be a positive integer (got ${JSON.stringify(body.days)})`
1698
+ );
1699
+ }
1700
+ days = body.days;
1701
+ }
1702
+ if (body.forceMemories !== void 0 && typeof body.forceMemories !== "boolean") {
1703
+ throw new EngramAccessInputError(
1704
+ `forceMemories must be a boolean (got ${JSON.stringify(body.forceMemories)})`
1705
+ );
1706
+ }
1707
+ try {
1708
+ const summaries = await this.service.wearablesSync({ source, date, days, forceMemories: body.forceMemories === true, ...this.wearablesScope(req, optionalQueryString(body.namespace, "namespace"), optionalQueryString(body.sessionKey, "sessionKey")) });
1709
+ this.respondJson(res, 200, { summaries });
1710
+ } catch (err) {
1711
+ if (this.respondWearablesError(res, err)) return;
1712
+ throw err;
1713
+ }
1714
+ return;
1715
+ }
1716
+ if (req.method === "GET" && (pathname === "/engram/v1/wearables/transcript" || pathname === "/remnic/v1/wearables/transcript")) {
1717
+ this.enforceTokenOp("transcript_day");
1718
+ const date = parsed.searchParams.get("date");
1719
+ if (!date || date.trim().length === 0) {
1720
+ throw new EngramAccessInputError(
1721
+ "date query parameter is required (YYYY-MM-DD)"
1722
+ );
1723
+ }
1724
+ const sourceParam = parsed.searchParams.get("source");
1725
+ try {
1726
+ const transcripts = await this.service.wearablesTranscriptDay({ date, source: sourceParam && sourceParam.length > 0 ? sourceParam : void 0, ...this.wearablesScope(req, parsed.searchParams.get("namespace") ?? void 0, parsed.searchParams.get("sessionKey") ?? void 0) });
1727
+ this.respondJson(res, 200, { transcripts });
1728
+ } catch (err) {
1729
+ if (this.respondWearablesError(res, err)) return;
1730
+ throw err;
1731
+ }
1732
+ return;
1733
+ }
1734
+ if (req.method === "GET" && (pathname === "/engram/v1/wearables/transcripts/search" || pathname === "/remnic/v1/wearables/transcripts/search")) {
1735
+ this.enforceTokenOp("transcript_search");
1736
+ const queryParam = parsed.searchParams.get("q");
1737
+ if (!queryParam || queryParam.trim().length === 0) {
1738
+ throw new EngramAccessInputError(
1739
+ "q query parameter is required and must be non-empty"
1740
+ );
1741
+ }
1742
+ try {
1743
+ const results = await this.service.wearablesTranscriptSearch({ query: queryParam, source: nonEmptyQueryParam(parsed.searchParams.get("source")), from: nonEmptyQueryParam(parsed.searchParams.get("from")), to: nonEmptyQueryParam(parsed.searchParams.get("to")), limit: positiveIntQueryParam(parsed.searchParams.get("limit"), "limit"), ...this.wearablesScope(req, parsed.searchParams.get("namespace") ?? void 0, parsed.searchParams.get("sessionKey") ?? void 0) });
1744
+ this.respondJson(res, 200, { results });
1745
+ } catch (err) {
1746
+ if (this.respondWearablesError(res, err)) return;
1747
+ throw err;
1748
+ }
1749
+ return;
1750
+ }
1751
+ if (req.method === "GET" && (pathname === "/engram/v1/wearables/memories" || pathname === "/remnic/v1/wearables/memories")) {
1752
+ this.enforceTokenOp("transcript_memories");
1753
+ try {
1754
+ const memories = await this.service.wearablesTranscriptMemories({ source: nonEmptyQueryParam(parsed.searchParams.get("source")), date: nonEmptyQueryParam(parsed.searchParams.get("date")), limit: positiveIntQueryParam(parsed.searchParams.get("limit"), "limit"), ...this.wearablesScope(req, parsed.searchParams.get("namespace") ?? void 0, parsed.searchParams.get("sessionKey") ?? void 0) });
1755
+ this.respondJson(res, 200, { memories });
1756
+ } catch (err) {
1757
+ if (this.respondWearablesError(res, err)) return;
1758
+ throw err;
1759
+ }
1760
+ return;
1761
+ }
1762
+ if (req.method === "GET" && (pathname === "/engram/v1/meetings" || pathname === "/remnic/v1/meetings")) {
1763
+ this.enforceTokenOp("meetings_list");
1764
+ await respondMeetingsList(res, this.respondJson.bind(this), this.service, nonEmptyQueryParam(parsed.searchParams.get("date")), this.wearablesScope(req, parsed.searchParams.get("namespace") ?? void 0, parsed.searchParams.get("sessionKey") ?? void 0));
1765
+ return;
1766
+ }
1767
+ if (req.method === "POST" && (pathname === "/engram/v1/meetings/build" || pathname === "/remnic/v1/meetings/build")) {
1768
+ this.enforceTokenOp("meetings_build");
1769
+ await respondMeetingsBuild(req, res, this.respondJson.bind(this), this.readJsonBody.bind(this), this.service, { enforceQuota: () => this.ensureWriteRateLimitAvailable(req), recordHit: () => this.recordWriteRateLimitHit(req) }, (ns, sk) => this.wearablesScope(req, ns, sk));
1770
+ return;
1771
+ }
1772
+ const meetingGetEngram = /^\/engram\/v1\/meetings\/([^/]+)$/.exec(pathname);
1773
+ if (req.method === "GET" && meetingGetEngram) {
1774
+ this.enforceTokenOp("meetings_get");
1775
+ await respondMeetingsGet(res, this.respondJson.bind(this), this.service, meetingGetEngram[1] ?? "", this.wearablesScope(req, parsed.searchParams.get("namespace") ?? void 0, parsed.searchParams.get("sessionKey") ?? void 0));
1776
+ return;
1777
+ }
1778
+ const meetingGetRemnic = /^\/remnic\/v1\/meetings\/([^/]+)$/.exec(pathname);
1779
+ if (req.method === "GET" && meetingGetRemnic) {
1780
+ this.enforceTokenOp("meetings_get");
1781
+ await respondMeetingsGet(res, this.respondJson.bind(this), this.service, meetingGetRemnic[1] ?? "", this.wearablesScope(req, parsed.searchParams.get("namespace") ?? void 0, parsed.searchParams.get("sessionKey") ?? void 0));
1782
+ return;
1783
+ }
1784
+ if (req.method === "POST" && (pathname === "/engram/v1/recall/deep" || pathname === "/remnic/v1/recall/deep")) {
1785
+ this.enforceTokenOp("deep_recall");
1786
+ await respondDeepRecall(req, res, this.respondJson.bind(this), this.readJsonBody.bind(this), this.service, (ns, sk) => this.wearablesScope(req, ns ?? parsed.searchParams.get("namespace") ?? void 0, sk ?? parsed.searchParams.get("sessionKey") ?? void 0), abortSignal);
1787
+ return;
1788
+ }
1789
+ if (await maybeRespondRecallNavigation(req, res, pathname, req.method, (op) => this.enforceTokenOp(op), this.respondJson.bind(this), this.readJsonBody.bind(this), this.service, (ns, sk) => this.wearablesScope(req, ns ?? parsed.searchParams.get("namespace") ?? void 0, sk ?? parsed.searchParams.get("sessionKey") ?? void 0))) return;
1790
+ if (await maybeRespondMemoryBrowse(req, res, pathname, req.method, (op) => this.enforceTokenOp(op), this.respondJson.bind(this), this.readJsonBody.bind(this), this.service, (ns) => this.wearablesScope(req, ns ?? parsed.searchParams.get("namespace") ?? void 0))) return;
1791
+ if (req.method === "GET" && (pathname === "/engram/v1/location/status" || pathname === "/remnic/v1/location/status")) {
1792
+ this.enforceTokenOp("location_status");
1793
+ await respondLocationStatus(res, this.respondJson.bind(this), this.service);
1794
+ return;
1795
+ }
1796
+ if (req.method === "GET" && (pathname === "/engram/v1/location/check" || pathname === "/remnic/v1/location/check")) {
1797
+ this.enforceTokenOp("location_check");
1798
+ await respondLocationCheck(res, this.respondJson.bind(this), this.service);
1799
+ return;
1800
+ }
1801
+ if (req.method === "POST" && (pathname === "/engram/v1/location/sync" || pathname === "/remnic/v1/location/sync")) {
1802
+ this.enforceTokenOp("location_sync");
1803
+ await respondLocationSync(await this.readJsonBody(req), res, this.respondJson.bind(this), this.service);
1804
+ return;
1805
+ }
1806
+ if (req.method === "POST" && (pathname === "/engram/v1/location/backfill" || pathname === "/remnic/v1/location/backfill")) {
1807
+ this.enforceTokenOp("location_backfill");
1808
+ await respondLocationBackfill(await this.readJsonBody(req), res, this.respondJson.bind(this), this.service);
1809
+ return;
1810
+ }
1811
+ if (req.method === "GET" && (pathname === "/engram/v1/location/day" || pathname === "/remnic/v1/location/day")) {
1812
+ this.enforceTokenOp("location_day");
1813
+ await respondLocationDay(parsed.searchParams.get("date"), res, this.respondJson.bind(this), this.service);
1814
+ return;
1815
+ }
1816
+ if (req.method === "GET" && (pathname === "/engram/v1/standup" || pathname === "/remnic/v1/standup")) {
1817
+ this.enforceTokenOp("standup");
1818
+ await respondStandup(parsed.searchParams.get("date"), res, this.respondJson.bind(this), this.service);
1819
+ return;
1820
+ }
1821
+ if (req.method === "POST" && pathname === "/engram/v1/observe") {
1822
+ this.enforceTokenOp("observe");
1823
+ const body = await this.readValidatedBody(req, "observe");
1824
+ const op = getOperation("observe");
1825
+ if (!op) {
1826
+ throw new EngramAccessInputError("access-boundary: operation not registered: observe");
1827
+ }
1828
+ const output = await op.run(
1829
+ { ...body, namespace: this.resolveNamespace(req, body.namespace) },
1830
+ {
1831
+ service: this.service,
1832
+ authenticatedPrincipal: this.resolveRequestPrincipal(req),
1833
+ hooks: { enforceWriteQuota: () => this.ensureWriteRateLimitAvailable(req) },
1834
+ // Phase 1 provenance: server-resolved connector identity from the
1835
+ // bearer token (REST path, mirroring the MCP tools/call dispatch).
1836
+ sourceConnector: this.resolveConnector(req)
1837
+ }
1838
+ );
1839
+ if (this.shouldCountWriteRateLimit(output.result)) {
1840
+ this.recordWriteRateLimitHit(req);
1841
+ }
1842
+ this.respondJson(res, 202, output.result);
1843
+ return;
1844
+ }
1845
+ if (req.method === "POST" && pathname === "/engram/v1/lcm/search") {
1846
+ this.enforceTokenOp("lcm_search");
1847
+ const body = await this.readValidatedBody(req, "lcmSearch");
1848
+ const response = await this.service.lcmSearch({
1849
+ query: body.query,
1850
+ sessionKey: body.sessionKey,
1851
+ sessionPrefix: body.sessionPrefix,
1852
+ namespace: this.resolveNamespace(req, body.namespace),
1853
+ authenticatedPrincipal: this.resolveRequestPrincipal(req),
1854
+ limit: body.limit
1855
+ });
1856
+ this.respondJson(res, 200, response);
1857
+ return;
1858
+ }
1859
+ if (await maybeHandleLifecycleFlush(
1860
+ this.lifecycleFlushDeps(req, res),
1861
+ req.method,
1862
+ pathname,
1863
+ abortSignal
1864
+ )) return;
1865
+ if (req.method === "GET" && pathname === "/engram/v1/lcm/status") {
1866
+ this.enforceTokenOp("lcm_status");
1867
+ this.respondJson(res, 200, await this.service.lcmStatus());
1868
+ return;
1869
+ }
1870
+ const relayEventMatch = /^\/engram\/v1\/relay\/missions\/([^/]+)\/events$/.exec(pathname);
1871
+ if (req.method === "POST" && relayEventMatch) {
1872
+ const missionId = decodeRelayMissionIdSegment(relayEventMatch[1] ?? "");
1873
+ const body = await this.readJsonBody(req);
1874
+ const unexpectedFields = Object.keys(body).filter(
1875
+ (key) => key !== "namespace" && key !== "event"
1876
+ );
1877
+ if (unexpectedFields.length > 0) {
1878
+ throw new EngramAccessInputError(
1879
+ `Relay append body contains unexpected field(s): ${unexpectedFields.sort().join(", ")}`
1880
+ );
1881
+ }
1882
+ if (!Object.prototype.hasOwnProperty.call(body, "event")) {
1883
+ throw new EngramAccessInputError("Relay append body must contain an event object");
1884
+ }
1885
+ if (Object.prototype.hasOwnProperty.call(body, "namespace") && body.namespace !== void 0 && body.namespace !== null && typeof body.namespace !== "string") {
1886
+ throw new EngramAccessInputError("namespace must be a string when provided");
1887
+ }
1888
+ rejectBlankRelayNamespace(
1889
+ typeof body.namespace === "string" ? body.namespace : void 0
1890
+ );
1891
+ const namespace = this.resolveNamespace(
1892
+ req,
1893
+ typeof body.namespace === "string" ? body.namespace : void 0
1894
+ );
1895
+ const op = getOperation("relay_mission_append");
1896
+ if (!op) {
1897
+ throw new Error("access-boundary: operation not registered: relay_mission_append");
1898
+ }
1899
+ let writeQuota;
1900
+ try {
1901
+ const output = await op.run(
1902
+ { missionId, namespace, event: body.event },
1903
+ {
1904
+ service: this.service,
1905
+ authenticatedPrincipal: this.resolveRequestPrincipal(req),
1906
+ hooks: {
1907
+ enforceWriteQuota: () => {
1908
+ writeQuota ??= this.reserveWriteRateLimitSlot(req);
1909
+ }
1910
+ }
1911
+ }
1912
+ );
1913
+ if (output.result.appended) {
1914
+ writeQuota?.commit();
1915
+ writeQuota = void 0;
1916
+ }
1917
+ this.respondJson(res, output.result.appended ? 201 : 200, output.result);
1918
+ } finally {
1919
+ writeQuota?.release();
1920
+ }
1921
+ return;
1922
+ }
1923
+ const relayMissionMatch = /^\/engram\/v1\/relay\/missions\/([^/]+)$/.exec(pathname);
1924
+ if (req.method === "GET" && relayMissionMatch) {
1925
+ const missionId = decodeRelayMissionIdSegment(relayMissionMatch[1] ?? "");
1926
+ rejectBlankRelayNamespace(parsed.searchParams.get("namespace"));
1927
+ const namespace = this.resolveNamespace(
1928
+ req,
1929
+ parsed.searchParams.get("namespace") ?? void 0
1930
+ );
1931
+ const op = getOperation("relay_mission_read");
1932
+ if (!op) {
1933
+ throw new Error("access-boundary: operation not registered: relay_mission_read");
1934
+ }
1935
+ const authenticatedPrincipal = this.resolveRequestPrincipal(req)?.trim() || void 0;
1936
+ const output = await op.run(
1937
+ {
1938
+ missionId,
1939
+ namespace,
1940
+ since: parsed.searchParams.get("since") ?? void 0,
1941
+ until: parsed.searchParams.get("until") ?? void 0,
1942
+ limit: parsed.searchParams.get("limit") ?? void 0
1943
+ },
1944
+ {
1945
+ service: this.service,
1946
+ authenticatedPrincipal
1947
+ }
1948
+ );
1949
+ res.setHeader("cache-control", "no-store");
1950
+ if (authenticatedPrincipal !== void 0) {
1951
+ try {
1952
+ res.setHeader("x-remnic-authenticated-principal", encodeURIComponent(authenticatedPrincipal));
1953
+ } catch {
1954
+ }
1955
+ }
1956
+ this.respondJson(res, 200, output.result);
1957
+ return;
1958
+ }
1959
+ if (req.method === "POST" && pathname === "/engram/v1/memories") {
1960
+ const body = await this.readValidatedBody(req, "memoryStore");
1961
+ const envelope = {
1962
+ ...body,
1963
+ namespace: this.resolveNamespace(req, body.namespace)
1964
+ };
1965
+ const op = getOperation("memory_store");
1966
+ if (!op) throw new EngramAccessInputError("access-boundary: operation not registered: memory_store");
1967
+ const output = await op.run(envelope, {
1968
+ service: this.service,
1969
+ authenticatedPrincipal: this.resolveRequestPrincipal(req),
1970
+ hooks: { enforceWriteQuota: () => this.ensureWriteRateLimitAvailable(req) },
1971
+ // Phase 1 provenance: server-resolved connector identity from the
1972
+ // bearer token (REST path, mirroring the MCP tools/call dispatch).
1973
+ sourceConnector: this.resolveConnector(req)
1974
+ });
1975
+ const response = output.result;
1976
+ if (this.shouldCountWriteRateLimit(response)) {
1977
+ this.recordWriteRateLimitHit(req);
1978
+ }
1979
+ this.respondJson(res, this.writeResponseStatus(response), response);
1980
+ return;
1981
+ }
1982
+ if (req.method === "POST" && pathname === "/engram/v1/coding/decisions") {
1983
+ const body = await this.readJsonBody(req);
1984
+ const isWriteSubcommand = body.subcommand === "record" || body.subcommand === "supersede";
1985
+ if (isWriteSubcommand) {
1986
+ this.ensureWriteRateLimitAvailable(req);
1987
+ }
1988
+ const op = getOperation("coding_decision");
1989
+ if (!op) throw new EngramAccessInputError("access-boundary: operation not registered: coding_decision");
1990
+ const output = await op.run(this.gatedBodyNamespace(req, body), {
1991
+ service: this.service,
1992
+ authenticatedPrincipal: this.resolveRequestPrincipal(req),
1993
+ sourceConnector: this.resolveConnector(req)
1994
+ });
1995
+ if (isWriteSubcommand) {
1996
+ this.recordWriteRateLimitHit(req);
1997
+ }
1998
+ this.respondJson(res, 200, output.result);
1999
+ return;
2000
+ }
2001
+ if (req.method === "POST" && pathname === "/engram/v1/coding/architecture") {
2002
+ const body = await this.readJsonBody(req);
2003
+ const isWriteSubcommand = body.subcommand === "refresh";
2004
+ if (isWriteSubcommand) {
2005
+ this.ensureWriteRateLimitAvailable(req);
2006
+ }
2007
+ const op = getOperation("coding_architecture");
2008
+ if (!op) throw new EngramAccessInputError("access-boundary: operation not registered: coding_architecture");
2009
+ const output = await op.run(this.gatedBodyNamespace(req, body), {
2010
+ service: this.service,
2011
+ authenticatedPrincipal: this.resolveRequestPrincipal(req),
2012
+ sourceConnector: this.resolveConnector(req)
2013
+ });
2014
+ if (isWriteSubcommand) {
2015
+ this.recordWriteRateLimitHit(req);
2016
+ }
2017
+ this.respondJson(res, 200, output.result);
2018
+ return;
2019
+ }
2020
+ if (req.method === "POST" && pathname === "/engram/v1/coding/delta") {
2021
+ const body = await this.readJsonBody(req);
2022
+ const op = getOperation("coding_delta");
2023
+ if (!op) throw new EngramAccessInputError("access-boundary: operation not registered: coding_delta");
2024
+ const output = await op.run(this.gatedBodyNamespace(req, body), {
2025
+ service: this.service,
2026
+ authenticatedPrincipal: this.resolveRequestPrincipal(req)
2027
+ });
2028
+ this.respondJson(res, 200, output.result);
2029
+ return;
2030
+ }
2031
+ if (req.method === "POST" && pathname === "/engram/v1/briefing") {
2032
+ await respondBriefingHttp({
2033
+ gatedBody: this.gatedBodyNamespace(req, await this.readJsonBody(req)),
2034
+ service: this.service,
2035
+ principal: this.resolveRequestPrincipal(req),
2036
+ respondJson: (status, payload) => this.respondJson(res, status, payload)
2037
+ });
2038
+ return;
2039
+ }
2040
+ if (req.method === "POST" && pathname === "/engram/v1/correction/plan") {
2041
+ this.ensureWriteRateLimitAvailable(req);
2042
+ const body = await this.readJsonBody(req);
2043
+ const op = getOperation("memory_correct_plan");
2044
+ if (!op) throw new EngramAccessInputError("access-boundary: operation not registered: memory_correct_plan");
2045
+ const output = await op.run(this.gatedBodyNamespace(req, body), {
2046
+ service: this.service,
2047
+ authenticatedPrincipal: this.resolveRequestPrincipal(req)
2048
+ });
2049
+ this.recordWriteRateLimitHit(req);
2050
+ this.respondJson(res, 200, output.result);
2051
+ return;
2052
+ }
2053
+ if (req.method === "POST" && pathname === "/engram/v1/correction/apply") {
2054
+ this.ensureWriteRateLimitAvailable(req);
2055
+ const body = await this.readJsonBody(req);
2056
+ const op = getOperation("memory_correct_apply");
2057
+ if (!op) throw new EngramAccessInputError("access-boundary: operation not registered: memory_correct_apply");
2058
+ const output = await op.run(this.gatedBodyNamespace(req, body), {
2059
+ service: this.service,
2060
+ authenticatedPrincipal: this.resolveRequestPrincipal(req)
2061
+ });
2062
+ this.recordWriteRateLimitHit(req);
2063
+ this.respondJson(res, 200, output.result);
2064
+ return;
2065
+ }
2066
+ if (req.method === "GET" && pathname === "/engram/v1/correction/pending") {
2067
+ const op = getOperation("correction_pending");
2068
+ if (op) {
2069
+ const output = await op.run(
2070
+ { namespace: this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0), sessionKey: parsed.searchParams.get("sessionKey") ?? void 0 },
2071
+ { service: this.service, authenticatedPrincipal: this.resolveRequestPrincipal(req) }
2072
+ );
2073
+ this.respondJson(res, 200, output.result);
2074
+ } else {
2075
+ const namespace = this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0);
2076
+ const sessionKey = parsed.searchParams.get("sessionKey") ?? void 0;
2077
+ const plans = await this.service.correctionListPending({
2078
+ ...namespace ? { namespace } : {},
2079
+ ...sessionKey ? { sessionKey } : {},
2080
+ principal: this.resolveRequestPrincipal(req)
2081
+ });
2082
+ this.respondJson(res, 200, plans);
2083
+ }
2084
+ return;
2085
+ }
2086
+ if (req.method === "POST" && pathname === "/engram/v1/suggestions") {
2087
+ this.enforceTokenOp("suggestion_submit");
2088
+ const body = await this.readValidatedBody(req, "suggestionSubmit");
2089
+ const request = {
2090
+ schemaVersion: body.schemaVersion,
2091
+ idempotencyKey: body.idempotencyKey,
2092
+ dryRun: body.dryRun === true,
2093
+ sessionKey: body.sessionKey,
2094
+ authenticatedPrincipal: this.resolveRequestPrincipal(req),
2095
+ content: body.content,
2096
+ category: body.category,
2097
+ confidence: body.confidence,
2098
+ namespace: this.resolveNamespace(req, body.namespace),
2099
+ tags: body.tags,
2100
+ entityRef: body.entityRef,
2101
+ ttl: body.ttl,
2102
+ sourceReason: body.sourceReason,
2103
+ cwd: body.cwd,
2104
+ projectTag: body.projectTag,
2105
+ // #2829: raw alias spelling retained by the schema transform.
2106
+ ...body.rawCategory !== void 0 ? { rawCategory: body.rawCategory } : {},
2107
+ // Phase 1 provenance: server-resolved connector identity from the
2108
+ // bearer token (REST path, mirroring the MCP tools/call dispatch).
2109
+ sourceConnector: this.resolveConnector(req)
2110
+ };
2111
+ const response = await this.service.suggestionSubmit(request, {
2112
+ enforceWriteQuota: () => this.ensureWriteRateLimitAvailable(req)
2113
+ });
2114
+ if (this.shouldCountWriteRateLimit(response)) {
2115
+ this.recordWriteRateLimitHit(req);
2116
+ }
2117
+ this.respondJson(res, this.writeResponseStatus(response), response);
2118
+ return;
2119
+ }
2120
+ if (req.method === "GET" && pathname === "/engram/v1/memories") {
2121
+ this.enforceTokenOp("memory_list");
2122
+ const limit = parseStrictIntegerQuery(parsed.searchParams.get("limit"), "limit", 50, 1);
2123
+ const offset = parseStrictIntegerQuery(parsed.searchParams.get("offset"), "offset", 0, 0);
2124
+ const sort = parseMemorySort(parsed.searchParams.get("sort"));
2125
+ const response = await this.service.memoryBrowse({
2126
+ query: parsed.searchParams.get("q") ?? void 0,
2127
+ status: parsed.searchParams.get("status") ?? void 0,
2128
+ category: parsed.searchParams.get("category") ?? void 0,
2129
+ namespace: this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0),
2130
+ authenticatedPrincipal: this.resolveRequestPrincipal(req),
2131
+ sort,
2132
+ limit,
2133
+ offset
2134
+ });
2135
+ this.respondJson(res, 200, response);
2136
+ return;
2137
+ }
2138
+ if (req.method === "GET" && pathname === "/engram/v1/recall/timings") {
2139
+ const op = getOperation("recall_timings");
2140
+ if (!op) {
2141
+ throw new Error("access-boundary: operation not registered: recall_timings");
2142
+ }
2143
+ res.setHeader("cache-control", "no-store");
2144
+ const output = await op.run({}, {
2145
+ service: this.service,
2146
+ authenticatedPrincipal: this.resolveRequestPrincipal(req),
2147
+ operatorPrincipal: this.authenticatedPrincipal
2148
+ });
2149
+ this.respondJson(res, 200, output.result);
2150
+ return;
2151
+ }
2152
+ const memoryMatch = pathname.match(/^\/engram\/v1\/memories\/([^/]+)$/);
2153
+ if (req.method === "GET" && memoryMatch) {
2154
+ const memoryId = decodeURIComponent(memoryMatch[1] ?? "");
2155
+ const namespace = this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0);
2156
+ const sessionKey = this.resolveRequestIdentity(req).sessionKey ?? parsed.searchParams.get("session") ?? parsed.searchParams.get("sessionKey") ?? void 0;
2157
+ const op = getOperation("memory_get");
2158
+ if (!op) {
2159
+ throw new EngramAccessInputError("access-boundary: operation not registered: memory_get");
2160
+ }
2161
+ const output = await op.run(
2162
+ { memoryId, namespace: namespace ?? null, sessionKey: sessionKey ?? null },
2163
+ { service: this.service, authenticatedPrincipal: this.resolveRequestPrincipal(req) }
2164
+ );
2165
+ const response = output.result;
2166
+ this.respondJson(res, response.found ? 200 : 404, response);
2167
+ return;
2168
+ }
2169
+ const timelineMatch = pathname.match(/^\/engram\/v1\/memories\/([^/]+)\/timeline$/);
2170
+ if (req.method === "GET" && timelineMatch) {
2171
+ this.enforceTokenOp("memory_timeline");
2172
+ const memoryId = decodeURIComponent(timelineMatch[1] ?? "");
2173
+ const namespace = this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0);
2174
+ const limit = parseStrictIntegerQuery(parsed.searchParams.get("limit"), "limit", 200, 1);
2175
+ const response = await this.service.memoryTimeline(memoryId, namespace, limit, this.resolveRequestPrincipal(req));
2176
+ this.respondJson(res, response.found ? 200 : 404, response);
2177
+ return;
2178
+ }
2179
+ if (req.method === "GET" && pathname === "/engram/v1/entities") {
2180
+ this.enforceTokenOp("entity_list");
2181
+ const limit = parseStrictIntegerQuery(parsed.searchParams.get("limit"), "limit", 50, 1);
2182
+ const offset = parseStrictIntegerQuery(parsed.searchParams.get("offset"), "offset", 0, 0);
2183
+ const response = await this.service.entityList({
2184
+ namespace: this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0),
2185
+ query: parsed.searchParams.get("q") ?? void 0,
2186
+ limit,
2187
+ offset
2188
+ });
2189
+ this.respondJson(res, 200, response);
2190
+ return;
2191
+ }
2192
+ const entityMatch = pathname.match(/^\/engram\/v1\/entities\/([^/]+)$/);
2193
+ if (req.method === "GET" && entityMatch) {
2194
+ this.enforceTokenOp("entity_get");
2195
+ const entityName = decodeURIComponent(entityMatch[1] ?? "");
2196
+ const namespace = this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0);
2197
+ const response = await this.service.entityGet(entityName, namespace);
2198
+ this.respondJson(res, response.found ? 200 : 404, response);
2199
+ return;
2200
+ }
2201
+ if (req.method === "GET" && pathname === "/engram/v1/review-queue") {
2202
+ this.enforceTokenOp("review_queue_list");
2203
+ const response = await this.service.reviewQueue(
2204
+ parsed.searchParams.get("runId") ?? void 0,
2205
+ this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0),
2206
+ this.resolveRequestPrincipal(req)
2207
+ );
2208
+ this.respondJson(res, 200, response);
2209
+ return;
2210
+ }
2211
+ if (req.method === "GET" && pathname === "/engram/v1/maintenance") {
2212
+ this.enforceTokenOp("maintenance_status");
2213
+ const namespace = this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0);
2214
+ this.respondJson(res, 200, await this.service.maintenance(namespace, this.resolveRequestPrincipal(req)));
2215
+ return;
2216
+ }
2217
+ if (req.method === "GET" && pathname === "/engram/v1/quality") {
2218
+ this.enforceTokenOp("quality_status");
2219
+ const namespace = this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0);
2220
+ this.respondJson(res, 200, await this.service.quality(namespace, this.resolveRequestPrincipal(req)));
2221
+ return;
2222
+ }
2223
+ if (req.method === "GET" && pathname === "/engram/v1/trust-zones/status") {
2224
+ this.enforceTokenOp("trust_zones_status");
2225
+ this.respondJson(
2226
+ res,
2227
+ 200,
2228
+ await this.service.trustZoneStatus(this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0), this.resolveRequestPrincipal(req))
2229
+ );
2230
+ return;
2231
+ }
2232
+ if (req.method === "GET" && pathname === "/engram/v1/procedural/stats") {
2233
+ this.enforceTokenOp("procedural_stats");
2234
+ const namespaceParam = parsed.searchParams.get("namespace");
2235
+ this.respondJson(
2236
+ res,
2237
+ 200,
2238
+ await this.service.procedureStats(
2239
+ {
2240
+ namespace: this.resolveNamespace(
2241
+ req,
2242
+ namespaceParam && namespaceParam.length > 0 ? namespaceParam : void 0
2243
+ )
2244
+ },
2245
+ this.resolveRequestPrincipal(req)
2246
+ )
2247
+ );
2248
+ return;
2249
+ }
2250
+ if (req.method === "GET" && pathname === "/engram/v1/trust-zones/records") {
2251
+ this.enforceTokenOp("trust_zones_records");
2252
+ const limit = parseStrictIntegerQuery(parsed.searchParams.get("limit"), "limit", 25, 1);
2253
+ const offset = parseStrictIntegerQuery(parsed.searchParams.get("offset"), "offset", 0, 0);
2254
+ const response = await this.service.trustZoneBrowse({
2255
+ query: parsed.searchParams.get("q") ?? void 0,
2256
+ zone: parseTrustZoneFilter(parsed.searchParams.get("zone")),
2257
+ kind: parseTrustZoneKindFilter(parsed.searchParams.get("kind")),
2258
+ sourceClass: parseTrustZoneSourceClassFilter(parsed.searchParams.get("sourceClass")),
2259
+ namespace: this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0),
2260
+ limit,
2261
+ offset
2262
+ }, this.resolveRequestPrincipal(req));
2263
+ this.respondJson(res, 200, response);
2264
+ return;
2265
+ }
2266
+ if (req.method === "POST" && pathname === "/engram/v1/review-disposition") {
2267
+ this.enforceTokenOp("review_disposition");
2268
+ const body = await this.readValidatedBody(req, "reviewDisposition");
2269
+ this.ensureWriteRateLimitAvailable(req);
2270
+ const response = await this.service.reviewDisposition({
2271
+ memoryId: body.memoryId,
2272
+ status: body.status,
2273
+ reasonCode: body.reasonCode,
2274
+ namespace: this.resolveNamespace(req, body.namespace),
2275
+ authenticatedPrincipal: this.resolveRequestPrincipal(req)
2276
+ });
2277
+ if (this.shouldCountWriteRateLimit(response)) {
2278
+ this.recordWriteRateLimitHit(req);
2279
+ }
2280
+ this.respondJson(res, 200, response);
2281
+ return;
2282
+ }
2283
+ if (req.method === "POST" && pathname === "/engram/v1/trust-zones/promote") {
2284
+ this.enforceTokenOp("trust_zones_promote");
2285
+ const body = await this.readValidatedBody(req, "trustZonePromote");
2286
+ const dryRun = body.dryRun === true;
2287
+ if (!dryRun) {
2288
+ this.ensureWriteRateLimitAvailable(req);
2289
+ }
2290
+ const response = await this.service.trustZonePromote({
2291
+ recordId: body.recordId,
2292
+ targetZone: body.targetZone,
2293
+ promotionReason: body.promotionReason,
2294
+ recordedAt: body.recordedAt,
2295
+ summary: body.summary,
2296
+ dryRun,
2297
+ namespace: this.resolveNamespace(req, body.namespace),
2298
+ authenticatedPrincipal: this.resolveRequestPrincipal(req)
2299
+ });
2300
+ if (this.shouldCountWriteRateLimit(response)) {
2301
+ this.recordWriteRateLimitHit(req);
2302
+ }
2303
+ this.respondJson(res, response.dryRun ? 200 : 201, response);
2304
+ return;
2305
+ }
2306
+ if (req.method === "POST" && pathname === "/engram/v1/trust-zones/demo-seed") {
2307
+ this.enforceTokenOp("trust_zones_demo_seed");
2308
+ const body = await this.readValidatedBody(req, "trustZoneDemoSeed");
2309
+ const dryRun = body.dryRun === true;
2310
+ if (!dryRun) {
2311
+ this.ensureWriteRateLimitAvailable(req);
2312
+ }
2313
+ const response = await this.service.trustZoneDemoSeed({
2314
+ scenario: body.scenario,
2315
+ recordedAt: body.recordedAt,
2316
+ dryRun,
2317
+ namespace: this.resolveNamespace(req, body.namespace),
2318
+ authenticatedPrincipal: this.resolveRequestPrincipal(req)
2319
+ });
2320
+ if (this.shouldCountWriteRateLimit(response)) {
2321
+ this.recordWriteRateLimitHit(req);
2322
+ }
2323
+ this.respondJson(res, response.dryRun ? 200 : 201, response);
2324
+ return;
2325
+ }
2326
+ if (req.method === "POST" && pathname === "/v1/citations/observed") {
2327
+ this.enforceTokenOp("citations_observed");
2328
+ const body = await this.readJsonBody(req);
2329
+ if (!body || typeof body !== "object" || Array.isArray(body)) {
2330
+ throw new HttpError(400, "request body must be a JSON object", "invalid_body");
2331
+ }
2332
+ const payload = body;
2333
+ const sessionId = typeof payload.sessionId === "string" ? payload.sessionId : void 0;
2334
+ const namespace = typeof payload.namespace === "string" ? payload.namespace : void 0;
2335
+ const citationsRaw = payload.citations;
2336
+ if (!citationsRaw || typeof citationsRaw !== "object" || Array.isArray(citationsRaw)) {
2337
+ throw new HttpError(400, "citations must be a JSON object with entries and rolloutIds", "invalid_citations");
2338
+ }
2339
+ const citObj = citationsRaw;
2340
+ const entries = [];
2341
+ if (Array.isArray(citObj.entries)) {
2342
+ for (const raw of citObj.entries) {
2343
+ if (raw && typeof raw === "object" && !Array.isArray(raw)) {
2344
+ const e = raw;
2345
+ if (typeof e.path === "string" && typeof e.lineStart === "number" && typeof e.lineEnd === "number") {
2346
+ entries.push({
2347
+ path: e.path,
2348
+ lineStart: e.lineStart,
2349
+ lineEnd: e.lineEnd,
2350
+ note: typeof e.note === "string" ? e.note : ""
2351
+ });
2352
+ }
2353
+ }
2354
+ }
2355
+ }
2356
+ const rolloutIds = [];
2357
+ if (Array.isArray(citObj.rolloutIds)) {
2358
+ for (const id of citObj.rolloutIds) {
2359
+ if (typeof id === "string" && id.length > 0) {
2360
+ rolloutIds.push(id);
2361
+ }
2362
+ }
2363
+ }
2364
+ let matched = 0;
2365
+ let submitted = 0;
2366
+ if (typeof this.service.recordCitationUsage === "function") {
2367
+ const result = await this.service.recordCitationUsage({
2368
+ sessionId,
2369
+ namespace: this.resolveNamespace(req, namespace),
2370
+ authenticatedPrincipal: this.resolveRequestPrincipal(req),
2371
+ entries,
2372
+ rolloutIds
2373
+ });
2374
+ submitted = result.submitted;
2375
+ matched = result.matched;
2376
+ }
2377
+ this.respondJson(res, 200, {
2378
+ ok: true,
2379
+ submitted,
2380
+ matched,
2381
+ entriesReceived: entries.length,
2382
+ rolloutIdsReceived: rolloutIds.length
2383
+ });
2384
+ return;
2385
+ }
2386
+ if (req.method === "GET" && pathname === "/engram/v1/review/contradictions") {
2387
+ this.enforceTokenOp("review_list");
2388
+ const VALID_FILTERS = /* @__PURE__ */ new Set(["all", "unresolved", "contradicts", "independent", "duplicates", "needs-user"]);
2389
+ const rawFilter = parsed.searchParams.get("filter") ?? "unresolved";
2390
+ if (!VALID_FILTERS.has(rawFilter)) {
2391
+ this.respondJson(res, 400, { error: `Invalid filter '${rawFilter}'. Valid: ${[...VALID_FILTERS].join(", ")}` });
2392
+ return;
2393
+ }
2394
+ const namespace = this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0);
2395
+ const limit = parseStrictIntegerQuery(parsed.searchParams.get("limit"), "limit", 50, 1);
2396
+ const principal = this.resolveRequestPrincipal(req);
2397
+ const resolved = await this.service.getReadableStorageForNamespace(namespace, principal);
2398
+ const reviewNamespace = this.service.configRef.namespacesEnabled ? resolved.namespace : void 0;
2399
+ const includeUnscopedForNamespace = Boolean(
2400
+ reviewNamespace && isDefaultReviewNamespace(this.service.configRef.defaultNamespace, namespace, reviewNamespace)
2401
+ );
2402
+ const result = listPairs(this.service.memoryDir, {
2403
+ filter: rawFilter,
2404
+ namespace: reviewNamespace,
2405
+ includeUnscopedForNamespace,
2406
+ limit
2407
+ });
2408
+ this.respondJson(res, 200, result);
2409
+ return;
2410
+ }
2411
+ if (req.method === "GET" && pathname.startsWith("/engram/v1/review/contradictions/")) {
2412
+ this.enforceTokenOp("contradiction_detail");
2413
+ const pairId = pathname.split("/").pop() ?? "";
2414
+ const pair = readPair(this.service.memoryDir, pairId);
2415
+ if (!pair) {
2416
+ this.respondJson(res, 404, { error: "pair_not_found" });
2417
+ return;
2418
+ }
2419
+ enforceNamespaceAllowList(
2420
+ tokenCapabilityStore.getStore(),
2421
+ pair.namespace,
2422
+ this.service.configRef?.defaultNamespace
2423
+ );
2424
+ try {
2425
+ await this.service.getReadableStorageForNamespace(pair.namespace, this.resolveRequestPrincipal(req));
2426
+ } catch {
2427
+ this.respondJson(res, 404, { error: "pair_not_found" });
2428
+ return;
2429
+ }
2430
+ this.respondJson(res, 200, pair);
2431
+ return;
2432
+ }
2433
+ if (req.method === "POST" && pathname === "/engram/v1/review/resolve") {
2434
+ this.enforceTokenOp("review_resolve");
2435
+ const body = await this.readJsonBody(req);
2436
+ const pairId = typeof body.pairId === "string" ? body.pairId : "";
2437
+ const verb = typeof body.verb === "string" ? body.verb : "";
2438
+ if (!pairId || !verb) {
2439
+ this.respondJson(res, 400, { error: "pairId and verb are required" });
2440
+ return;
2441
+ }
2442
+ if (!isValidResolutionVerb(verb)) {
2443
+ this.respondJson(res, 400, { error: `Invalid verb: ${verb}. Must be one of: keep-a, keep-b, merge, both-valid, needs-more-context` });
2444
+ return;
2445
+ }
2446
+ const targetPair = readPair(this.service.memoryDir, pairId);
2447
+ if (targetPair) {
2448
+ enforceNamespaceAllowList(
2449
+ tokenCapabilityStore.getStore(),
2450
+ targetPair.namespace,
2451
+ this.service.configRef?.defaultNamespace
2452
+ );
2453
+ }
2454
+ const principal = this.resolveRequestPrincipal(req);
2455
+ const result = await executeResolution(this.service.memoryDir, this.service.storageRef, pairId, verb, {
2456
+ mergedMemoryId: typeof body.mergedMemoryId === "string" ? body.mergedMemoryId : void 0,
2457
+ mergedContent: typeof body.mergedContent === "string" ? body.mergedContent : void 0,
2458
+ storageForNamespace: async (namespace) => {
2459
+ const resolved = await this.service.getWritableStorageForNamespace(namespace, principal);
2460
+ return resolved.storage;
2461
+ },
2462
+ // Catalog write touch (issue #1499 sweep): a contradiction merge writes a
2463
+ // new memory directly to the resolved namespace storage, bypassing the
2464
+ // extraction write path. Record it so QMD maintenance / writtenSince
2465
+ // don't miss the write. Best-effort and failure-tolerant.
2466
+ onMergedMemoryWritten: (namespace, storageDir) => {
2467
+ }
2468
+ });
2469
+ this.respondJson(res, 200, result);
2470
+ return;
2471
+ }
2472
+ if (req.method === "GET" && pathname === "/engram/v1/graph/snapshot") {
2473
+ this.enforceTokenOp("graph_snapshot");
2474
+ const limitRaw = parsed.searchParams.get("limit");
2475
+ let limit;
2476
+ if (limitRaw !== null && limitRaw.length > 0) {
2477
+ const parsedLimit = Number(limitRaw);
2478
+ if (!Number.isFinite(parsedLimit) || !Number.isInteger(parsedLimit) || parsedLimit <= 0) {
2479
+ this.respondJson(res, 400, {
2480
+ error: "invalid_limit",
2481
+ code: "invalid_limit",
2482
+ message: "limit must be a positive integer"
2483
+ });
2484
+ return;
2485
+ }
2486
+ limit = parsedLimit;
2487
+ }
2488
+ const sinceRaw = parsed.searchParams.get("since");
2489
+ let since;
2490
+ if (sinceRaw !== null && sinceRaw.length > 0) {
2491
+ if (!Number.isFinite(Date.parse(sinceRaw))) {
2492
+ this.respondJson(res, 400, {
2493
+ error: "invalid_since",
2494
+ code: "invalid_since",
2495
+ message: "since must be a parseable ISO timestamp"
2496
+ });
2497
+ return;
2498
+ }
2499
+ since = sinceRaw;
2500
+ }
2501
+ const focusNodeIdRaw = parsed.searchParams.get("focusNodeId");
2502
+ const focusNodeId = focusNodeIdRaw && focusNodeIdRaw.length > 0 ? focusNodeIdRaw : void 0;
2503
+ const categoriesRaw = parsed.searchParams.get("categories");
2504
+ let categories;
2505
+ if (categoriesRaw !== null && categoriesRaw.length > 0) {
2506
+ categories = categoriesRaw.split(",").map((value) => value.trim()).filter((value) => value.length > 0);
2507
+ if (categories.length === 0) {
2508
+ this.respondJson(res, 400, {
2509
+ error: "invalid_categories",
2510
+ code: "invalid_categories",
2511
+ message: "categories must be a comma-separated list with at least one non-empty value"
2512
+ });
2513
+ return;
2514
+ }
2515
+ }
2516
+ const namespaceParam = parsed.searchParams.get("namespace");
2517
+ const namespace = this.resolveNamespace(
2518
+ req,
2519
+ namespaceParam && namespaceParam.length > 0 ? namespaceParam : void 0
2520
+ );
2521
+ try {
2522
+ const snapshot = await this.service.graphSnapshot(
2523
+ {
2524
+ namespace,
2525
+ ...limit !== void 0 ? { limit } : {},
2526
+ ...since !== void 0 ? { since } : {},
2527
+ ...focusNodeId !== void 0 ? { focusNodeId } : {},
2528
+ ...categories !== void 0 ? { categories } : {}
2529
+ },
2530
+ this.resolveRequestPrincipal(req)
2531
+ );
2532
+ this.respondJson(res, 200, snapshot);
2533
+ } catch (err) {
2534
+ if (err instanceof Error && err.message.startsWith("graphSnapshot:")) {
2535
+ this.respondJson(res, 400, {
2536
+ error: "invalid_request",
2537
+ code: "invalid_request",
2538
+ message: err.message
2539
+ });
2540
+ return;
2541
+ }
2542
+ throw err;
2543
+ }
2544
+ return;
2545
+ }
2546
+ if (req.method === "POST" && pathname === "/engram/v1/contradiction-scan") {
2547
+ this.enforceTokenOp("contradiction_scan_run");
2548
+ const body = await this.readJsonBody(req);
2549
+ const { runContradictionScan } = await import("./contradiction-scan-GVD4JJ7B.js");
2550
+ const principal = this.resolveRequestPrincipal(req);
2551
+ const result = await runContradictionScan({
2552
+ storage: this.service.storageRef,
2553
+ config: this.service.configRef,
2554
+ memoryDir: this.service.memoryDir,
2555
+ embeddingLookupFactory: this.service.embeddingLookupFactoryRef,
2556
+ storageForNamespace: (namespace) => this.service.getWritableStorageForNamespace(namespace, principal),
2557
+ localLlm: this.service.localLlmRef,
2558
+ fallbackLlm: this.service.fallbackLlmRef,
2559
+ namespace: this.resolveNamespace(req, typeof body.namespace === "string" ? body.namespace : void 0)
2560
+ });
2561
+ this.respondJson(res, 200, result);
2562
+ return;
2563
+ }
2564
+ if (req.method === "GET" && pathname === "/engram/v1/graph/events") {
2565
+ this.enforceTokenOp("graph_events");
2566
+ await this.handleGraphEventsSSE(req, res);
2567
+ return;
2568
+ }
2569
+ if (req.method === "POST" && pathname === "/engram/v1/chat/message") {
2570
+ this.enforceTokenOp("chat_message");
2571
+ const body = await this.readJsonBody(req);
2572
+ const resumeChatSessionId = typeof body.chatSessionId === "string" ? body.chatSessionId : void 0;
2573
+ if (resumeChatSessionId) {
2574
+ await enforceChatSessionNamespace(this.service, resumeChatSessionId);
2575
+ } else {
2576
+ enforceNamespaceAllowList(
2577
+ tokenCapabilityStore.getStore(),
2578
+ void 0,
2579
+ this.service.configRef?.defaultNamespace
2580
+ );
2581
+ }
2582
+ await handleChatMessage(
2583
+ req,
2584
+ res,
2585
+ body,
2586
+ { service: this.service, config: this.service.configRef?.chat, memoryDir: this.service.memoryDir },
2587
+ this.resolveRequestPrincipal(req)
2588
+ );
2589
+ return;
2590
+ }
2591
+ const chatEventsMatch = /^\/engram\/v1\/chat\/events\/([^/]+)$/.exec(pathname);
2592
+ if (req.method === "GET" && chatEventsMatch) {
2593
+ this.enforceTokenOp("chat_events");
2594
+ await enforceChatSessionNamespace(this.service, chatEventsMatch[1] ?? "");
2595
+ await handleChatEventsSSE(
2596
+ req,
2597
+ res,
2598
+ chatEventsMatch[1] ?? "",
2599
+ {
2600
+ service: this.service,
2601
+ config: this.service.configRef?.chat,
2602
+ memoryDir: this.service.memoryDir,
2603
+ // Register the chat-SSE disconnect cleanup with this server's
2604
+ // stop() set so an HTTP shutdown forcibly releases the heartbeat
2605
+ // and transcript subscription even when a lingering client never
2606
+ // emits 'close' (cursor Medium review; mirrors handleGraphEventsSSE
2607
+ // which registers in sseCleanupFns at access-http.ts:2604).
2608
+ registerSseCleanup: (cleanup) => {
2609
+ this.sseCleanupFns.add(cleanup);
2610
+ return () => {
2611
+ this.sseCleanupFns.delete(cleanup);
2612
+ };
2613
+ }
2614
+ },
2615
+ this.resolveRequestPrincipal(req)
2616
+ );
2617
+ return;
2618
+ }
2619
+ if (req.method === "GET" && pathname === "/engram/v1/console/state") {
2620
+ this.enforceTokenOp("console_state");
2621
+ const namespace = this.resolveNamespace(req, parsed.searchParams.get("namespace") ?? void 0);
2622
+ const snapshot = await this.service.consoleState(namespace, this.resolveRequestPrincipal(req));
2623
+ this.respondJson(res, 200, snapshot);
2624
+ return;
2625
+ }
2626
+ if (req.method === "GET" && pathname === "/engram/v1/peers") {
2627
+ this.enforceTokenOp("peer_list");
2628
+ const result = await this.service.peerList();
2629
+ this.respondJson(res, 200, result);
2630
+ return;
2631
+ }
2632
+ const peerProfileMatch = /^\/engram\/v1\/peers\/([^/]+)\/profile$/.exec(pathname);
2633
+ if (peerProfileMatch) {
2634
+ this.enforceTokenOp("peer_profile_get");
2635
+ if (req.method !== "GET") {
2636
+ this.respondJson(res, 405, { error: "method_not_allowed", code: "method_not_allowed" });
2637
+ return;
2638
+ }
2639
+ const peerId = decodePeerIdSegment(peerProfileMatch[1] ?? "");
2640
+ const result = await this.service.peerProfileGet(peerId);
2641
+ if (!result.found) {
2642
+ this.respondJson(res, 404, { error: "peer_profile_not_found", code: "peer_profile_not_found" });
2643
+ return;
2644
+ }
2645
+ this.respondJson(res, 200, result);
2646
+ return;
2647
+ }
2648
+ const peerIdMatch = /^\/engram\/v1\/peers\/([^/]+)$/.exec(pathname);
2649
+ if (peerIdMatch) {
2650
+ const peerId = decodePeerIdSegment(peerIdMatch[1] ?? "");
2651
+ if (req.method === "GET") {
2652
+ this.enforceTokenOp("peer_get");
2653
+ const result = await this.service.peerGet(peerId);
2654
+ if (!result.found) {
2655
+ this.respondJson(res, 404, { error: "peer_not_found", code: "peer_not_found" });
2656
+ return;
2657
+ }
2658
+ this.respondJson(res, 200, result);
2659
+ return;
2660
+ }
2661
+ if (req.method === "PUT") {
2662
+ this.enforceTokenOp("peer_set");
2663
+ const body = await this.readJsonBody(req);
2664
+ if ("kind" in body && body.kind !== void 0 && typeof body.kind !== "string") {
2665
+ throw new EngramAccessInputError("kind must be a string when provided");
2666
+ }
2667
+ if ("displayName" in body && body.displayName !== void 0 && typeof body.displayName !== "string") {
2668
+ throw new EngramAccessInputError("displayName must be a string when provided");
2669
+ }
2670
+ if ("notes" in body && body.notes !== void 0 && typeof body.notes !== "string") {
2671
+ throw new EngramAccessInputError("notes must be a string when provided");
2672
+ }
2673
+ const result = await this.service.peerSet({
2674
+ id: peerId,
2675
+ kind: typeof body.kind === "string" ? body.kind : void 0,
2676
+ displayName: typeof body.displayName === "string" ? body.displayName : void 0,
2677
+ notes: typeof body.notes === "string" ? body.notes : void 0
2678
+ });
2679
+ this.respondJson(res, result.created ? 201 : 200, result);
2680
+ return;
2681
+ }
2682
+ if (req.method === "DELETE") {
2683
+ this.enforceTokenOp("peer_delete");
2684
+ const forgetParam = parsed.searchParams.get("forget");
2685
+ if (forgetParam === "true") {
2686
+ const body = await this.readJsonBody(req);
2687
+ const confirm = typeof body.confirm === "string" ? body.confirm : "";
2688
+ if (confirm !== "yes") {
2689
+ this.respondJson(res, 400, {
2690
+ error: "confirm_required",
2691
+ code: "confirm_required",
2692
+ message: "DELETE ?forget=true requires { confirm: 'yes' } in the request body"
2693
+ });
2694
+ return;
2695
+ }
2696
+ const result2 = await this.service.peerForget(peerId, { confirm: "yes" });
2697
+ this.respondJson(res, 200, result2);
2698
+ return;
2699
+ }
2700
+ const result = await this.service.peerDelete(peerId);
2701
+ this.respondJson(res, 200, result);
2702
+ return;
2703
+ }
2704
+ this.respondJson(res, 405, { error: "method_not_allowed", code: "method_not_allowed" });
2705
+ return;
2706
+ }
2707
+ if (req.method === "GET" && pathname === "/engram/v1/dreams/status") {
2708
+ this.enforceTokenOp("dreams_status");
2709
+ const { normalizeDreamsStatusWindowHours } = await import("./dreams-ledger-567VKVOU.js");
2710
+ const windowHoursRaw = parsed.searchParams.get("windowHours");
2711
+ let windowHours;
2712
+ try {
2713
+ windowHours = normalizeDreamsStatusWindowHours(
2714
+ windowHoursRaw !== null ? Number(windowHoursRaw) : void 0
2715
+ );
2716
+ } catch {
2717
+ this.respondJson(res, 400, { error: "windowHours must be a positive integer" });
2718
+ return;
2719
+ }
2720
+ const namespaceParam = parsed.searchParams.get("namespace");
2721
+ const namespace = this.resolveNamespace(req, namespaceParam && namespaceParam.length > 0 ? namespaceParam : void 0);
2722
+ const result = await this.service.dreamsStatus({
2723
+ windowHours,
2724
+ namespace,
2725
+ principal: this.resolveRequestPrincipal(req)
2726
+ });
2727
+ this.respondJson(res, 200, result);
2728
+ return;
2729
+ }
2730
+ if (req.method === "POST" && pathname === "/engram/v1/dreams/run") {
2731
+ this.enforceTokenOp("dreams_run");
2732
+ const body = await this.readJsonBody(req);
2733
+ const VALID_PHASES = ["lightSleep", "rem", "deepSleep"];
2734
+ const phase = typeof body.phase === "string" ? body.phase : void 0;
2735
+ if (!phase || !VALID_PHASES.includes(phase)) {
2736
+ this.respondJson(res, 400, {
2737
+ error: `phase is required and must be one of: ${VALID_PHASES.join(", ")}`
2738
+ });
2739
+ return;
2740
+ }
2741
+ if ("dryRun" in body && body.dryRun !== void 0 && typeof body.dryRun !== "boolean") {
2742
+ this.respondJson(res, 400, {
2743
+ error: "dryRun must be a boolean when provided"
2744
+ });
2745
+ return;
2746
+ }
2747
+ if ("namespace" in body && body.namespace !== void 0 && typeof body.namespace !== "string") {
2748
+ this.respondJson(res, 400, {
2749
+ error: "namespace must be a string when provided"
2750
+ });
2751
+ return;
2752
+ }
2753
+ const dryRun = body.dryRun === true;
2754
+ const namespace = this.resolveNamespace(req, typeof body.namespace === "string" ? body.namespace : void 0);
2755
+ if (!dryRun) {
2756
+ this.ensureWriteRateLimitAvailable(req);
2757
+ }
2758
+ const result = await this.service.dreamsRun({
2759
+ phase,
2760
+ dryRun,
2761
+ namespace,
2762
+ authenticatedPrincipal: this.resolveRequestPrincipal(req)
2763
+ });
2764
+ if (this.shouldCountWriteRateLimit(result)) {
2765
+ this.recordWriteRateLimitHit(req);
2766
+ }
2767
+ this.respondJson(res, 200, result);
2768
+ return;
2769
+ }
2770
+ if (pathname.startsWith("/engram/v1/admin/scope/inspect")) {
2771
+ if (req.method !== "GET" && req.method !== "POST") {
2772
+ this.respondJson(res, 405, { error: "method_not_allowed", code: "method_not_allowed" });
2773
+ return;
2774
+ }
2775
+ this.requireOperatorToken();
2776
+ const principal = this.resolveRequestPrincipal(req);
2777
+ let sessionKey;
2778
+ let namespaceOverride;
2779
+ let operation;
2780
+ if (req.method === "GET") {
2781
+ sessionKey = parsed.searchParams.get("session") ?? void 0;
2782
+ namespaceOverride = parsed.searchParams.get("namespace") ?? void 0;
2783
+ operation = parsed.searchParams.get("operation") ?? void 0;
2784
+ } else {
2785
+ const body = await this.readJsonBody(req);
2786
+ sessionKey = typeof body.sessionKey === "string" ? body.sessionKey : void 0;
2787
+ namespaceOverride = typeof body.namespace === "string" ? body.namespace : void 0;
2788
+ operation = typeof body.operation === "string" ? body.operation : void 0;
2789
+ }
2790
+ const inspection = await this.service.adminInspectScope({
2791
+ sessionKey: sessionKey && sessionKey.length > 0 ? sessionKey : void 0,
2792
+ namespace: namespaceOverride && namespaceOverride.length > 0 ? namespaceOverride : void 0,
2793
+ principalOverride: principal,
2794
+ operation
2795
+ });
2796
+ this.respondJson(res, 200, inspection);
2797
+ return;
2798
+ }
2799
+ if (pathname === "/engram/v1/admin/namespaces") {
2800
+ if (req.method !== "GET") {
2801
+ this.respondJson(res, 405, { error: "method_not_allowed", code: "method_not_allowed" });
2802
+ return;
2803
+ }
2804
+ this.requireOperatorToken();
2805
+ const kind = optionalNamespaceKindQueryParam(parsed.searchParams.get("kind"));
2806
+ const discoveredBy = parsed.searchParams.get("discoveredBy");
2807
+ const result = await this.service.adminListNamespaces({
2808
+ ...kind ? { kind } : {},
2809
+ ...discoveredBy ? { discoveredBy } : {}
2810
+ });
2811
+ this.respondJson(res, 200, result);
2812
+ return;
2813
+ }
2814
+ if (pathname === "/engram/v1/admin/maintenance-health") {
2815
+ if (req.method !== "GET") {
2816
+ this.respondJson(res, 405, { error: "method_not_allowed", code: "method_not_allowed" });
2817
+ return;
2818
+ }
2819
+ this.requireOperatorToken();
2820
+ const report = await this.service.adminMaintenanceHealth();
2821
+ this.respondJson(res, 200, report);
2822
+ return;
2823
+ }
2824
+ if (pathname === "/engram/v1/admin/transcript-audit") {
2825
+ if (req.method !== "GET") {
2826
+ this.respondJson(res, 405, { error: "method_not_allowed", code: "method_not_allowed" });
2827
+ return;
2828
+ }
2829
+ this.requireOperatorToken();
2830
+ const report = await this.service.adminTranscriptAudit();
2831
+ this.respondJson(res, 200, report);
2832
+ return;
2833
+ }
2834
+ if (pathname === "/engram/v1/admin/promote") {
2835
+ if (req.method !== "POST") {
2836
+ this.respondJson(res, 405, { error: "method_not_allowed", code: "method_not_allowed" });
2837
+ return;
2838
+ }
2839
+ this.requireOperatorToken();
2840
+ const body = await this.readJsonBody(req);
2841
+ if (typeof body.sourceMemoryId !== "string" || body.sourceMemoryId.trim().length === 0) {
2842
+ this.respondJson(res, 400, {
2843
+ error: "invalid_request",
2844
+ code: "invalid_request",
2845
+ message: "sourceMemoryId is required"
2846
+ });
2847
+ return;
2848
+ }
2849
+ if (typeof body.reason !== "string" || body.reason.trim().length === 0) {
2850
+ this.respondJson(res, 400, {
2851
+ error: "invalid_request",
2852
+ code: "invalid_request",
2853
+ message: "reason is required for promotion"
2854
+ });
2855
+ return;
2856
+ }
2857
+ if (!Array.isArray(body.targets) || body.targets.length === 0) {
2858
+ this.respondJson(res, 400, {
2859
+ error: "invalid_request",
2860
+ code: "invalid_request",
2861
+ message: "targets must be a non-empty array"
2862
+ });
2863
+ return;
2864
+ }
2865
+ const VALID_TARGETS = ["teamProject", "serverShared", "userProject", "userGlobal", "explicit"];
2866
+ const targets = [];
2867
+ for (const entry of body.targets) {
2868
+ if (typeof entry !== "object" || entry === null || typeof entry.kind !== "string") {
2869
+ this.respondJson(res, 400, {
2870
+ error: "invalid_request",
2871
+ code: "invalid_request",
2872
+ message: "each target must be an object with a 'kind' string"
2873
+ });
2874
+ return;
2875
+ }
2876
+ if (!VALID_TARGETS.includes(entry.kind)) {
2877
+ this.respondJson(res, 400, {
2878
+ error: "invalid_request",
2879
+ code: "invalid_request",
2880
+ message: `target.kind must be one of: ${VALID_TARGETS.join(", ")}`
2881
+ });
2882
+ return;
2883
+ }
2884
+ targets.push({
2885
+ kind: entry.kind,
2886
+ namespace: typeof entry.namespace === "string" ? entry.namespace : void 0
2887
+ });
2888
+ }
2889
+ try {
2890
+ this.ensureWriteRateLimitAvailable(req);
2891
+ const result = await this.service.adminPromoteMemory({
2892
+ sourceMemoryId: body.sourceMemoryId,
2893
+ namespace: typeof body.namespace === "string" ? body.namespace : void 0,
2894
+ principal: this.resolveRequestPrincipal(req),
2895
+ sessionKey: typeof body.sessionKey === "string" ? body.sessionKey : void 0,
2896
+ targets,
2897
+ reason: body.reason
2898
+ });
2899
+ this.recordWriteRateLimitHit(req);
2900
+ this.respondJson(res, 200, result);
2901
+ } catch (err) {
2902
+ if (err instanceof EngramAccessInputError) {
2903
+ this.respondJson(res, 400, {
2904
+ error: "invalid_request",
2905
+ code: "invalid_request",
2906
+ message: err.message
2907
+ });
2908
+ return;
2909
+ }
2910
+ throw err;
2911
+ }
2912
+ return;
2913
+ }
2914
+ this.respondJson(res, 404, { error: "not_found", code: "not_found" });
2915
+ }
2916
+ createRequestAbortSignal(req, res) {
2917
+ const controller = new AbortController();
2918
+ const abort = () => {
2919
+ if (!controller.signal.aborted) controller.abort();
2920
+ };
2921
+ req.once("aborted", abort);
2922
+ res.once("close", () => {
2923
+ if (!res.writableEnded) abort();
2924
+ });
2925
+ return controller.signal;
2926
+ }
2927
+ /**
2928
+ * SSE handler for /engram/v1/graph/events.
2929
+ *
2930
+ * Lifecycle:
2931
+ * 1. Write SSE headers (Content-Type: text/event-stream).
2932
+ * 2. Register this response in `sseClients`.
2933
+ * 3. Resolve the namespace from the request and subscribe to THAT
2934
+ * namespace's graph event bus (Codex P1: in multi-namespace
2935
+ * deployments each namespace has its own bus keyed by its storage
2936
+ * dir — subscribing to the global root leaks events across tenants).
2937
+ * 4. On each event, add to a 200 ms batch; flush batch as a single SSE frame.
2938
+ * 5. Send heartbeat every 25 s.
2939
+ * 6. On client disconnect (req "close"), clean up timers and unsubscribe.
2940
+ * 7. Register the cleanup callback in `sseCleanupFns` so `stop()` can
2941
+ * release the heartbeat interval and bus subscription even when the
2942
+ * client never disconnects (Cursor review thread `access-http.ts:232`).
2943
+ */
2944
+ async handleGraphEventsSSE(req, res) {
2945
+ const parsed = new URL2(req.url ?? "/", `http://${hostToUrlAuthority(this.host)}`);
2946
+ const namespaceParam = parsed.searchParams.get("namespace");
2947
+ const namespace = this.resolveNamespace(req, namespaceParam && namespaceParam.length > 0 ? namespaceParam : void 0);
2948
+ const principal = this.resolveRequestPrincipal(req);
2949
+ const memoryDir = await this.service.getMemoryDirForNamespace(namespace, principal);
2950
+ res.writeHead(200, {
2951
+ "content-type": "text/event-stream; charset=utf-8",
2952
+ "cache-control": "no-cache, no-store, must-revalidate",
2953
+ "connection": "keep-alive",
2954
+ "x-accel-buffering": "no",
2955
+ // prevent nginx buffering
2956
+ "transfer-encoding": "chunked"
2957
+ });
2958
+ const writeSSE = (payload) => {
2959
+ try {
2960
+ res.write(`data: ${JSON.stringify(payload)}
2961
+
2962
+ `);
2963
+ } catch {
2964
+ }
2965
+ };
2966
+ writeSSE({ type: "connected" });
2967
+ this.sseClients.add(res);
2968
+ const flushBatch = () => {
2969
+ const batch = this.ssePendingBatches.get(res);
2970
+ if (!batch || batch.length === 0) return;
2971
+ this.ssePendingBatches.delete(res);
2972
+ this.sseBatchTimers.delete(res);
2973
+ writeSSE({ type: "batch", events: batch });
2974
+ };
2975
+ const unsubscribe = subscribeGraphEvents(memoryDir, (event) => {
2976
+ let batch = this.ssePendingBatches.get(res);
2977
+ if (!batch) {
2978
+ batch = [];
2979
+ this.ssePendingBatches.set(res, batch);
2980
+ }
2981
+ batch.push(event);
2982
+ if (!this.sseBatchTimers.has(res)) {
2983
+ this.sseBatchTimers.set(res, setTimeout(flushBatch, 200));
2984
+ }
2985
+ });
2986
+ const heartbeatInterval = setInterval(() => {
2987
+ writeSSE({ type: "heartbeat" });
2988
+ }, 25e3);
2989
+ const cleanup = () => {
2990
+ clearInterval(heartbeatInterval);
2991
+ const timer = this.sseBatchTimers.get(res);
2992
+ if (timer !== void 0) {
2993
+ clearTimeout(timer);
2994
+ this.sseBatchTimers.delete(res);
2995
+ }
2996
+ this.ssePendingBatches.delete(res);
2997
+ unsubscribe();
2998
+ this.sseClients.delete(res);
2999
+ this.sseCleanupFns.delete(cleanup);
3000
+ try {
3001
+ res.end();
3002
+ } catch {
3003
+ }
3004
+ };
3005
+ this.sseCleanupFns.add(cleanup);
3006
+ req.once("close", cleanup);
3007
+ req.once("error", cleanup);
3008
+ }
3009
+ async handleMcpRequest(req, res, abortSignal) {
3010
+ const headerVersion = req.headers["mcp-protocol-version"];
3011
+ if (typeof headerVersion === "string" && headerVersion.length > 0) {
3012
+ if (!MCP_SUPPORTED_PROTOCOL_VERSIONS.includes(headerVersion)) {
3013
+ this.respondJson(res, 400, {
3014
+ jsonrpc: "2.0",
3015
+ id: null,
3016
+ error: {
3017
+ code: -32e3,
3018
+ message: `unsupported MCP-Protocol-Version: ${headerVersion}; supported: ${MCP_SUPPORTED_PROTOCOL_VERSIONS.join(", ")}`
3019
+ }
3020
+ });
3021
+ return;
3022
+ }
3023
+ }
3024
+ const body = await this.readJsonBody(req);
3025
+ const request = body;
3026
+ const toolName = toDottedRemnicName(typeof request.params?.name === "string" ? request.params.name : "");
3027
+ const toolArgs = request.params?.arguments;
3028
+ const dreamsRunDryRun = (toolName === "engram.dreams_run" || toolName === "remnic.dreams_run") && toolArgs !== null && typeof toolArgs === "object" && !Array.isArray(toolArgs) && toolArgs.dryRun === true;
3029
+ const memoryActionApplyDryRun = (toolName === "engram.memory_action_apply" || toolName === "remnic.memory_action_apply") && toolArgs !== null && typeof toolArgs === "object" && !Array.isArray(toolArgs) && toolArgs.dryRun === true;
3030
+ const toolArgsSubcommand = toolArgs !== null && typeof toolArgs === "object" && !Array.isArray(toolArgs) && "subcommand" in toolArgs ? toolArgs.subcommand : void 0;
3031
+ const codingDecisionWrite = (toolName === "engram.coding_decision" || toolName === "remnic.coding_decision") && (toolArgsSubcommand === "record" || toolArgsSubcommand === "supersede");
3032
+ const codingArchitectureWrite = (toolName === "engram.coding_architecture" || toolName === "remnic.coding_architecture") && toolArgsSubcommand === "refresh";
3033
+ const CODEGRAPH_WRITE_TOOLS = /* @__PURE__ */ new Set([
3034
+ "engram.codegraph_index",
3035
+ "remnic.codegraph_index",
3036
+ "engram.codegraph_delete_project",
3037
+ "remnic.codegraph_delete_project",
3038
+ "engram.codegraph_ingest_traces",
3039
+ "remnic.codegraph_ingest_traces"
3040
+ ]);
3041
+ const isCodegraphManageAdr = toolName === "engram.codegraph_manage_adr" || toolName === "remnic.codegraph_manage_adr";
3042
+ const codegraphWrite = CODEGRAPH_WRITE_TOOLS.has(toolName) || isCodegraphManageAdr && (toolArgsSubcommand === "record" || toolArgsSubcommand === "supersede");
3043
+ const supportPassportQuotaLimitedWrite = this.isSupportPassportQuotaLimitedWriteTool(toolName);
3044
+ const isMcpWrite = request.method === "tools/call" && (toolName === "engram.memory_store" || toolName === "remnic.memory_store" || toolName === "engram.suggestion_submit" || toolName === "remnic.suggestion_submit" || toolName === "engram.observe" || toolName === "remnic.observe" || toolName === "engram.lcm_compaction_flush" || toolName === "remnic.lcm_compaction_flush" || toolName === "engram.extraction_force_flush" || toolName === "remnic.extraction_force_flush" || toolName === "engram.lcm_compaction_record" || toolName === "remnic.lcm_compaction_record" || toolName === "engram.capsule_export" || toolName === "remnic.capsule_export" || toolName === "engram.capsule_import" || toolName === "remnic.capsule_import" || toolName === "engram.entity_synthesis_run" || toolName === "remnic.entity_synthesis_run" || !dreamsRunDryRun && (toolName === "engram.dreams_run" || toolName === "remnic.dreams_run") || !memoryActionApplyDryRun && (toolName === "engram.memory_action_apply" || toolName === "remnic.memory_action_apply") || (toolName === "engram.memory_correct_apply" || toolName === "remnic.memory_correct_apply" || toolName === "engram.memory_correct_plan" || toolName === "remnic.memory_correct_plan") || codingDecisionWrite || codingArchitectureWrite || codegraphWrite || supportPassportQuotaLimitedWrite);
3045
+ const observeSelfEnforcesQuota = toolName === "engram.observe" || toolName === "remnic.observe";
3046
+ const extractionForceFlushWrite = toolName === "engram.extraction_force_flush" || toolName === "remnic.extraction_force_flush";
3047
+ let writeRateLimitRecorded = false;
3048
+ let supportPassportQuota;
3049
+ const recordCommittedMcpWrite = extractionForceFlushWrite ? () => {
3050
+ if (writeRateLimitRecorded) return;
3051
+ writeRateLimitRecorded = true;
3052
+ this.recordWriteRateLimitHit(req);
3053
+ } : supportPassportQuotaLimitedWrite ? () => {
3054
+ if (writeRateLimitRecorded) return;
3055
+ writeRateLimitRecorded = true;
3056
+ supportPassportQuota?.commit();
3057
+ supportPassportQuota = void 0;
3058
+ } : void 0;
3059
+ if (isMcpWrite && !observeSelfEnforcesQuota) {
3060
+ if (supportPassportQuotaLimitedWrite) supportPassportQuota = this.reserveWriteRateLimitSlot(req);
3061
+ else this.ensureWriteRateLimitAvailable(req);
3062
+ }
3063
+ const sessionId = (() => {
3064
+ const raw = req.headers["mcp-session-id"];
3065
+ return typeof raw === "string" ? raw.trim() : void 0;
3066
+ })();
3067
+ const mcpCorrelationId = correlationIdStore.getStore() ?? randomUUID();
3068
+ const requestIdentity = this.resolveRequestIdentity(req);
3069
+ if (request.method === "tools/call" && this.mcpServer.toolAcceptsNamespace(toolName)) {
3070
+ const mcpExplicitNamespace = toolArgs !== null && typeof toolArgs === "object" && !Array.isArray(toolArgs) && typeof toolArgs.namespace === "string" && toolArgs.namespace.length > 0 ? toolArgs.namespace : void 0;
3071
+ enforceNamespaceAllowList(
3072
+ tokenCapabilityStore.getStore(),
3073
+ mcpExplicitNamespace ?? requestIdentity.namespace,
3074
+ this.service.configRef?.defaultNamespace
3075
+ );
3076
+ }
3077
+ const response = await this.mcpServer.handleRequest(request, {
3078
+ principalOverride: requestIdentity.principal,
3079
+ namespaceOverride: requestIdentity.namespace,
3080
+ sessionKeyOverride: requestIdentity.sessionKey,
3081
+ sessionId,
3082
+ correlationId: mcpCorrelationId,
3083
+ enforceWriteQuota: observeSelfEnforcesQuota ? () => this.ensureWriteRateLimitAvailable(req) : void 0,
3084
+ recordWriteCommit: recordCommittedMcpWrite,
3085
+ sourceConnector: this.resolveConnector(req),
3086
+ abortSignal
3087
+ }).catch((error) => {
3088
+ supportPassportQuota?.release();
3089
+ throw error;
3090
+ });
3091
+ if (isMcpWrite && response !== null) {
3092
+ const result = response.result;
3093
+ const isError = result?.isError === true;
3094
+ const structured = result?.structuredContent;
3095
+ const isRejectedCodegraph = structured?.ok === false;
3096
+ const counts = structured ? this.shouldCountWriteRateLimit(structured) : true;
3097
+ if (!writeRateLimitRecorded && !isError && !isRejectedCodegraph && counts) {
3098
+ if (supportPassportQuota) {
3099
+ supportPassportQuota.commit();
3100
+ supportPassportQuota = void 0;
3101
+ } else {
3102
+ this.recordWriteRateLimitHit(req);
3103
+ }
3104
+ writeRateLimitRecorded = true;
3105
+ }
3106
+ }
3107
+ supportPassportQuota?.release();
3108
+ if (abortSignal.aborted) {
3109
+ throw isAbortError(abortSignal.reason) ? abortSignal.reason : abortError("HTTP client disconnected");
3110
+ }
3111
+ if (response === null) {
3112
+ res.statusCode = 202;
3113
+ res.end();
3114
+ return;
3115
+ }
3116
+ const assignedSessionId = this.mcpServer.popInitSessionId(mcpCorrelationId);
3117
+ if (assignedSessionId) {
3118
+ res.setHeader("mcp-session-id", assignedSessionId);
3119
+ }
3120
+ this.respondJson(res, 200, response);
3121
+ }
3122
+ respondJson(res, status, payload) {
3123
+ const body = JSON.stringify(payload, null, 2);
3124
+ res.statusCode = status;
3125
+ res.setHeader("content-type", "application/json; charset=utf-8");
3126
+ res.setHeader("content-length", String(Buffer.byteLength(body)));
3127
+ const cid = correlationIdStore.getStore();
3128
+ if (cid) {
3129
+ res.setHeader("x-request-id", cid);
3130
+ }
3131
+ res.end(body);
3132
+ }
3133
+ respondBinary(res, status, body, headers = {}) {
3134
+ res.statusCode = status;
3135
+ res.setHeader("content-type", "application/octet-stream");
3136
+ res.setHeader("content-length", String(body.length));
3137
+ for (const [key, value] of Object.entries(headers)) {
3138
+ res.setHeader(key, value);
3139
+ }
3140
+ const cid = correlationIdStore.getStore();
3141
+ if (cid) {
3142
+ res.setHeader("x-request-id", cid);
3143
+ }
3144
+ res.end(body);
3145
+ }
3146
+ async handleAdminConsole(req, res, pathname) {
3147
+ if (req.method !== "GET") return false;
3148
+ if (pathname === "/remnic/ui" || pathname === "/engram/ui") {
3149
+ res.statusCode = 301;
3150
+ res.setHeader("location", pathname + "/");
3151
+ res.end();
3152
+ return true;
3153
+ }
3154
+ if (pathname === "/remnic/ui/relay" || pathname === "/engram/ui/relay") {
3155
+ res.statusCode = 301;
3156
+ res.setHeader("location", pathname + "/");
3157
+ res.end();
3158
+ return true;
3159
+ }
3160
+ if (pathname === "/remnic/ui/" || pathname === "/engram/ui/") {
3161
+ await this.respondAdminConsoleShell(req, res, pathname);
3162
+ return true;
3163
+ }
3164
+ if (pathname === "/remnic/ui/relay/" || pathname === "/engram/ui/relay/") {
3165
+ await this.respondAdminConsoleShell(req, res, pathname, "relay/index.html");
3166
+ return true;
3167
+ }
3168
+ if (pathname === "/remnic/ui/app.js" || pathname === "/engram/ui/app.js") {
3169
+ await this.respondStatic(res, path2.join(this.adminConsolePublicDir, "app.js"), "application/javascript; charset=utf-8");
3170
+ return true;
3171
+ }
3172
+ const relayAsset = RELAY_ADMIN_CONSOLE_ASSETS.get(pathname.split("/").at(-1) ?? "");
3173
+ const isRelayAsset = pathname.startsWith("/remnic/ui/relay/") || pathname.startsWith("/engram/ui/relay/");
3174
+ if (isRelayAsset && relayAsset && pathname.split("/").length === 5) {
3175
+ const fileName = pathname.split("/").at(-1);
3176
+ if (fileName) {
3177
+ await this.respondStatic(res, path2.join(this.adminConsolePublicDir, "relay", fileName), relayAsset);
3178
+ return true;
3179
+ }
3180
+ }
3181
+ return false;
3182
+ }
3183
+ async respondAdminConsoleShell(req, res, pathname, relativePath = "index.html", allowPrefill = true) {
3184
+ try {
3185
+ let body = await readFile(path2.join(this.adminConsolePublicDir, relativePath), "utf-8");
3186
+ const matched = this.resolveAuthorizedEntry(req, pathname);
3187
+ const canPrefillToken = allowPrefill && this.adminConsolePrefillToken && matched !== null && matched.capabilities === void 0 && this.timingSafeStringEqual(matched.token, this.adminConsolePrefillToken);
3188
+ if (canPrefillToken) {
3189
+ const serializedToken = serializeInlineScriptValue(this.adminConsolePrefillToken);
3190
+ const script = `<script>(function(token,script){const key="__REMNIC_ADMIN_CONSOLE_PREFILL_TOKEN__";const clear=function(){token="";try{delete window[key]}catch{window[key]=""}};window.addEventListener("pagehide",clear,{once:true});window.addEventListener("beforeunload",clear,{once:true});try{if(new URLSearchParams(location.hash.slice(1)).has("secret")){clear();return}Object.defineProperty(window,key,{configurable:true,get:function(){const value=token;clear();return value}})}finally{if(script){script.textContent="";script.remove()}}})(${serializedToken},document.currentScript);</script>`;
3191
+ body = body.includes("</head>") ? body.replace("</head>", `${script}</head>`) : `${script}${body}`;
3192
+ res.setHeader("cache-control", "private, no-store");
3193
+ }
3194
+ res.setHeader("vary", "authorization");
3195
+ res.statusCode = 200;
3196
+ res.setHeader("content-type", "text/html; charset=utf-8");
3197
+ res.setHeader("content-length", String(Buffer.byteLength(body)));
3198
+ res.end(body);
3199
+ } catch {
3200
+ this.respondJson(res, 404, { error: "not_found" });
3201
+ }
3202
+ }
3203
+ async respondStatic(res, filePath, contentType) {
3204
+ try {
3205
+ const body = await readFile(filePath, "utf-8");
3206
+ res.statusCode = 200;
3207
+ res.setHeader("content-type", contentType);
3208
+ res.setHeader("content-length", String(Buffer.byteLength(body)));
3209
+ res.end(body);
3210
+ } catch {
3211
+ this.respondJson(res, 404, { error: "not_found" });
3212
+ }
3213
+ }
3214
+ async readJsonBody(req, maxBodyBytes = this.maxBodyBytes) {
3215
+ const encoding = (this.readOptionalHeader(req, "content-encoding") ?? "identity").toLowerCase();
3216
+ if (encoding !== "identity" && encoding !== "gzip") {
3217
+ throw new HttpError(415, "unsupported_content_encoding", "unsupported_content_encoding");
3218
+ }
3219
+ const chunks = [];
3220
+ let total = 0;
3221
+ for await (const chunk of req) {
3222
+ const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
3223
+ total += buffer.length;
3224
+ if (total > maxBodyBytes) {
3225
+ throw new HttpError(413, "request_body_too_large", "request_body_too_large");
3226
+ }
3227
+ chunks.push(buffer);
3228
+ }
3229
+ if (chunks.length === 0) return {};
3230
+ let body = Buffer.concat(chunks, total);
3231
+ if (encoding === "gzip") {
3232
+ try {
3233
+ body = gunzipSync(body, { maxOutputLength: maxBodyBytes });
3234
+ } catch (error) {
3235
+ if (error.code === "ERR_BUFFER_TOO_LARGE") {
3236
+ throw new HttpError(413, "request_body_too_large", "request_body_too_large");
3237
+ }
3238
+ throw new HttpError(400, "invalid_gzip_body", "invalid_gzip_body");
3239
+ }
3240
+ if (body.byteLength > maxBodyBytes) {
3241
+ throw new HttpError(413, "request_body_too_large", "request_body_too_large");
3242
+ }
3243
+ }
3244
+ const raw = body.toString("utf-8").trim();
3245
+ if (raw.length === 0) return {};
3246
+ let parsed;
3247
+ try {
3248
+ parsed = JSON.parse(raw);
3249
+ } catch {
3250
+ throw new HttpError(400, "invalid_json", "invalid_json");
3251
+ }
3252
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
3253
+ throw new HttpError(400, "invalid_json_object", "invalid_json_object");
3254
+ }
3255
+ return parsed;
3256
+ }
3257
+ async readBinaryBody(req, maxBytes) {
3258
+ const chunks = [];
3259
+ let total = 0;
3260
+ for await (const chunk of req) {
3261
+ const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
3262
+ total += buffer.length;
3263
+ if (total > maxBytes) {
3264
+ throw new HttpError(413, "request_body_too_large", "request_body_too_large");
3265
+ }
3266
+ chunks.push(buffer);
3267
+ }
3268
+ return Buffer.concat(chunks, total);
3269
+ }
3270
+ readRequiredHeader(req, name) {
3271
+ const value = this.readOptionalHeader(req, name);
3272
+ if (value === void 0 || value.length === 0) {
3273
+ throw new EngramAccessInputError(`${name} header is required`);
3274
+ }
3275
+ return value;
3276
+ }
3277
+ readOptionalHeader(req, name) {
3278
+ const raw = req.headers[name.toLowerCase()];
3279
+ if (Array.isArray(raw)) return raw[0]?.trim() || void 0;
3280
+ return raw?.trim() || void 0;
3281
+ }
3282
+ readRequiredDecodedHeader(req, name) {
3283
+ const raw = this.readRequiredHeader(req, name);
3284
+ try {
3285
+ return decodeURIComponent(raw);
3286
+ } catch {
3287
+ throw new EngramAccessInputError(`${name} header is not valid percent-encoded input`);
3288
+ }
3289
+ }
3290
+ readRequiredIntegerHeader(req, name) {
3291
+ const raw = this.readRequiredHeader(req, name);
3292
+ const parsed = Number(raw);
3293
+ if (!Number.isInteger(parsed) || parsed < 0) {
3294
+ throw new EngramAccessInputError(`${name} header must be a non-negative integer`);
3295
+ }
3296
+ return parsed;
3297
+ }
3298
+ readOptionalIntegerHeader(req, name) {
3299
+ const raw = this.readOptionalHeader(req, name);
3300
+ if (raw === void 0) return void 0;
3301
+ const parsed = Number(raw);
3302
+ if (!Number.isInteger(parsed) || parsed < 0) {
3303
+ throw new EngramAccessInputError(`${name} header must be a non-negative integer`);
3304
+ }
3305
+ return parsed;
3306
+ }
3307
+ readRequiredNumberHeader(req, name) {
3308
+ const raw = this.readRequiredHeader(req, name);
3309
+ const parsed = Number(raw);
3310
+ if (!Number.isFinite(parsed) || parsed < 0) {
3311
+ throw new EngramAccessInputError(`${name} header must be a non-negative finite number`);
3312
+ }
3313
+ return parsed;
3314
+ }
3315
+ parseOptionalBooleanHeader(req, name, defaultValue) {
3316
+ const raw = this.readOptionalHeader(req, name);
3317
+ if (raw === void 0) return defaultValue;
3318
+ if (raw === "true") return true;
3319
+ if (raw === "false") return false;
3320
+ throw new EngramAccessInputError(`${name} header must be one of: true, false`);
3321
+ }
3322
+ lifecycleFlushDeps(req, res) {
3323
+ const readValidatedBody = ((schemaName) => this.readValidatedBody(req, schemaName));
3324
+ return {
3325
+ service: this.service,
3326
+ defaultNamespace: this.service.configRef?.defaultNamespace,
3327
+ enforceTokenOp: (op) => this.enforceTokenOp(op),
3328
+ readValidatedBody,
3329
+ ensureWriteRateLimitAvailable: () => this.ensureWriteRateLimitAvailable(req),
3330
+ resolveNamespace: (namespace) => this.resolveNamespace(req, namespace),
3331
+ resolveRequestPrincipal: () => this.resolveRequestPrincipal(req),
3332
+ recordWriteRateLimitHit: () => this.recordWriteRateLimitHit(req),
3333
+ respondJson: (payload) => this.respondJson(res, 200, payload)
3334
+ };
3335
+ }
3336
+ async readValidatedBody(req, schemaName, maxBodyBytes) {
3337
+ const raw = await this.readJsonBody(req, maxBodyBytes);
3338
+ const result = validateRequest(schemaName, raw);
3339
+ if (!result.success) {
3340
+ throw new HttpError(400, result.error.error, "validation_error", result.error.details);
3341
+ }
3342
+ return result.data;
3343
+ }
3344
+ /**
3345
+ * Build the WWW-Authenticate challenge string for 401 responses.
3346
+ * When `resourceMetadataUrl` is configured, includes the RFC 9728
3347
+ * `resource_metadata` parameter so MCP clients (e.g. ChatGPT) can
3348
+ * discover the OAuth 2.0 protected-resource metadata document.
3349
+ * Otherwise the bare `Bearer` challenge is returned (unchanged).
3350
+ */
3351
+ bearerChallenge() {
3352
+ if (this.resourceMetadataUrl) {
3353
+ return `Bearer resource_metadata="${this.resourceMetadataUrl}"`;
3354
+ }
3355
+ return "Bearer";
3356
+ }
3357
+ isAuthorized(req, pathname) {
3358
+ return this.resolveAuthorizedEntry(req, pathname) !== null;
3359
+ }
3360
+ /**
3361
+ * Per-request cache of the matched token entry (the entry whose token
3362
+ * matched the bearer credential, BEFORE any path-policy check). Pinning
3363
+ * the entry to the first read means authorization, capability
3364
+ * enforcement, and connector provenance all observe the SAME token-store
3365
+ * snapshot — a rotation between the auth check and the write handler can
3366
+ * no longer stamp the wrong connector (PR #1852 race).
3367
+ */
3368
+ matchedEntryCache = /* @__PURE__ */ new WeakMap();
3369
+ /**
3370
+ * Resolve the matched token entry for this request, caching the result so
3371
+ * every downstream consumer (authorization, capability enforcement,
3372
+ * connector provenance) sees the same snapshot entry (PR #1852).
3373
+ */
3374
+ resolveMatchedEntry(req, pathname) {
3375
+ if (this.matchedEntryCache.has(req)) {
3376
+ return this.matchedEntryCache.get(req) ?? null;
3377
+ }
3378
+ const entry = this.computeMatchedEntry(req, pathname);
3379
+ this.matchedEntryCache.set(req, entry);
3380
+ return entry;
3381
+ }
3382
+ /**
3383
+ * Find the entry whose token matches the request's bearer credential.
3384
+ * Static operator tokens (`authToken`/`authTokens`) and the string-token
3385
+ * getter carry no capabilities ⇒ unrestricted. Dynamic entry-based tokens
3386
+ * capture connector identity and capabilities. A corrupt or unreadable
3387
+ * token store returns null rather than propagating an error — provenance
3388
+ * must never block an already-authenticated request.
3389
+ */
3390
+ computeMatchedEntry(req, pathname) {
3391
+ if (!this.authToken && this.authTokens.length === 0 && !this.authTokensGetter && !this.authTokenEntriesGetter) {
3392
+ return null;
3393
+ }
3394
+ const raw = req.headers.authorization;
3395
+ let candidate = null;
3396
+ if (raw) {
3397
+ const separator = raw.indexOf(" ");
3398
+ if (separator > 0) {
3399
+ const scheme = raw.slice(0, separator).toLowerCase();
3400
+ if (scheme === "bearer") {
3401
+ candidate = raw.slice(separator + 1).trim();
3402
+ }
3403
+ }
3404
+ }
3405
+ if (!candidate && pathname === "/engram/v1/graph/events") {
3406
+ try {
3407
+ const parsed = new URL2(req.url ?? "/", `http://${hostToUrlAuthority(this.host)}`);
3408
+ const queryToken = parsed.searchParams.get("token");
3409
+ if (queryToken && queryToken.length > 0) {
3410
+ candidate = queryToken;
3411
+ }
3412
+ } catch {
3413
+ }
3414
+ }
3415
+ if (!candidate) return null;
3416
+ const token = candidate;
3417
+ if (this.authToken && this.timingSafeStringEqual(token, this.authToken)) {
3418
+ return { token };
3419
+ }
3420
+ for (const valid of this.authTokens) {
3421
+ if (this.timingSafeStringEqual(token, valid)) return { token: valid };
3422
+ }
3423
+ if (this.authTokenEntriesGetter) {
3424
+ try {
3425
+ for (const entry of this.authTokenEntriesGetter()) {
3426
+ if (!this.timingSafeStringEqual(token, entry.token)) continue;
3427
+ return { token: entry.token, connector: entry.connector, capabilities: entry.capabilities };
3428
+ }
3429
+ } catch {
3430
+ }
3431
+ return null;
3432
+ }
3433
+ if (this.authTokensGetter) {
3434
+ for (const valid of this.authTokensGetter()) {
3435
+ if (this.timingSafeStringEqual(token, valid)) return { token: valid };
3436
+ }
3437
+ }
3438
+ return null;
3439
+ }
3440
+ /**
3441
+ * Resolve the presenting token's entry for an authorized request, or null.
3442
+ * Applies the path-policy gate (if configured) on top of the per-request
3443
+ * cached matched entry so the identity that is authorized is the same one
3444
+ * whose connector later stamps frontmatter. Static operator tokens and the
3445
+ * string-token getter carry no capabilities ⇒ unrestricted.
3446
+ */
3447
+ resolveAuthorizedEntry(req, pathname) {
3448
+ const matched = this.resolveMatchedEntry(req, pathname);
3449
+ if (!matched) return null;
3450
+ if ("connector" in matched && this.tokenPathPolicy) {
3451
+ if (typeof matched.connector !== "string" || matched.connector.length === 0) return null;
3452
+ return this.tokenPathPolicy(matched.connector, pathname) ? matched : null;
3453
+ }
3454
+ return matched;
3455
+ }
3456
+ /**
3457
+ * Resolve the presenting token's capabilities for this request, or
3458
+ * undefined when the token is unrestricted (legacy / static operator /
3459
+ * explicit-unrestricted record). Reads from the per-request cached matched
3460
+ * entry so capabilities come from the same snapshot as authorization and
3461
+ * connector provenance (PR #1852).
3462
+ */
3463
+ resolveTokenCapabilities(req, pathname) {
3464
+ return this.resolveMatchedEntry(req, pathname)?.capabilities;
3465
+ }
3466
+ /**
3467
+ * Enforce the presenting token's ops allow-list for an HTTP route that
3468
+ * dispatches directly to the service (not through the boundary). Reads the
3469
+ * per-request capability context set in `handle`; unrestricted tokens
3470
+ * pass. Throws {@link EngramAccessForbiddenError} (→ 403) when a scoped
3471
+ * token calls a non-permitted op (issue #1837).
3472
+ */
3473
+ enforceTokenOp(op) {
3474
+ void getOperation(op);
3475
+ assertOperationAllowed(tokenCapabilityStore.getStore(), op);
3476
+ }
3477
+ enforceTokenAnyOf(ops) {
3478
+ for (const op of ops) void getOperation(op);
3479
+ const capabilities = tokenCapabilityStore.getStore();
3480
+ if (ops.some((op) => capabilityAllowsOp(capabilities, op))) return;
3481
+ throw new EngramAccessForbiddenError(
3482
+ `token is not permitted to call any required operation: ${ops.join(", ")}`
3483
+ );
3484
+ }
3485
+ /**
3486
+ * Operator/admin routes are unrestricted-only surfaces: a scoped
3487
+ * (least-privileged) token must NOT reach them (issue #1837). Legacy and
3488
+ * explicit-unrestricted tokens pass. Throws EngramAccessForbiddenError (→403).
3489
+ */
3490
+ requireOperatorToken() {
3491
+ if (isCapabilityRestricted(tokenCapabilityStore.getStore())) {
3492
+ throw new EngramAccessForbiddenError(
3493
+ "token is scoped and may not access operator/admin routes"
3494
+ );
3495
+ }
3496
+ }
3497
+ /**
3498
+ * Resolve the connector identity for the request's bearer token (Phase 1
3499
+ * provenance). Reuses the per-request cached matched entry so a token
3500
+ * rotation between the auth check and the write handler cannot stamp the
3501
+ * wrong connector (PR #1852 race). Returns `undefined` for operator-
3502
+ * supplied static tokens or when no entry getter is configured — those
3503
+ * writes are operator-initiated.
3504
+ */
3505
+ resolveConnector(req) {
3506
+ return this.resolveMatchedEntry(req)?.connector;
3507
+ }
3508
+ timingSafeStringEqual(a, b) {
3509
+ const left = this.encodeSecret(a);
3510
+ const right = this.encodeSecret(b);
3511
+ if (!left || !right) return false;
3512
+ return timingSafeEqual(left, right);
3513
+ }
3514
+ encodeSecret(value) {
3515
+ const encoded = Buffer.from(value, "utf-8");
3516
+ if (encoded.length > 1024) return null;
3517
+ const out = Buffer.alloc(2 + 1024);
3518
+ out.writeUInt16BE(encoded.length, 0);
3519
+ encoded.copy(out, 2);
3520
+ return out;
3521
+ }
3522
+ writeResponseStatus(response) {
3523
+ if (response.dryRun === true) return 200;
3524
+ if (response.status === "stored" || response.status === "queued_for_review") return 201;
3525
+ return 200;
3526
+ }
3527
+ ensureWriteRateLimitAvailable(req) {
3528
+ if (!this.writeLimiter.hasCapacity(this.principalForRateLimit(req))) {
3529
+ throw new HttpError(429, "write_rate_limited", "write_rate_limited");
3530
+ }
3531
+ }
3532
+ recordWriteRateLimitHit(req) {
3533
+ this.writeLimiter.record(this.principalForRateLimit(req));
3534
+ }
3535
+ reserveWriteRateLimitSlot(req) {
3536
+ const reservation = this.writeLimiter.reserve(this.principalForRateLimit(req));
3537
+ if (!reservation) {
3538
+ throw new HttpError(429, "write_rate_limited", "write_rate_limited");
3539
+ }
3540
+ return reservation;
3541
+ }
3542
+ principalForRateLimit(req) {
3543
+ if (!req) return void 0;
3544
+ return this.resolveRequestPrincipal(req) ?? this.resolveConnector(req);
3545
+ }
3546
+ shouldCountWriteRateLimit(response) {
3547
+ return response.dryRun !== true && response.idempotencyReplay !== true;
3548
+ }
3549
+ /** Map wearables validation errors to 400 (body lives in wearables/http-glue.ts). */
3550
+ respondWearablesError(res, err) {
3551
+ return respondWearablesErrorGlue(this.respondJson.bind(this), res, err);
3552
+ }
3553
+ };
3554
+
3555
+ export {
3556
+ MeetingsInputError,
3557
+ resolveDefaultAdminConsolePublicDir,
3558
+ EngramAccessHttpServer
3559
+ };
3560
+ //# sourceMappingURL=chunk-H7O5L2IQ.js.map