@north-light/crouter 0.3.353 → 0.3.354

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 (609) hide show
  1. package/dist/api/client.d.ts +35 -25
  2. package/dist/api/client.js +2 -2
  3. package/dist/api/dto/broker-ops.d.ts +2 -36
  4. package/dist/api/dto/canvas.d.ts +8 -13
  5. package/dist/api/dto/config.d.ts +4 -0
  6. package/dist/api/dto/delivery.d.ts +61 -0
  7. package/dist/api/dto/docs.d.ts +133 -0
  8. package/dist/api/dto/docs.js +1 -0
  9. package/dist/api/dto/health.d.ts +26 -79
  10. package/dist/api/dto/node-outcomes.d.ts +1 -3
  11. package/dist/api/dto/nodes.d.ts +5 -26
  12. package/dist/api/dto/objects.d.ts +167 -0
  13. package/dist/api/dto/objects.js +1 -0
  14. package/dist/api/dto/profiles.d.ts +14 -8
  15. package/dist/api/dto/reports.d.ts +9 -7
  16. package/dist/api/dto/reviews.d.ts +9 -3
  17. package/dist/api/dto/worktree.d.ts +1 -1
  18. package/dist/api/index.d.ts +0 -1
  19. package/dist/api/index.js +1 -1
  20. package/dist/api/routes.d.ts +14 -12
  21. package/dist/api/routes.js +1 -1
  22. package/dist/build-root.js +1 -1
  23. package/dist/builtin-memory/00-runtime-base/00-authoring.md +10 -5
  24. package/dist/builtin-memory/04-orchestration-kernel.md +7 -7
  25. package/dist/builtin-memory/05-kinds/advisor/01-orchestrator.md +1 -1
  26. package/dist/builtin-memory/05-kinds/explore/00-base.md +2 -2
  27. package/dist/builtin-memory/05-kinds/explore/01-orchestrator.md +2 -2
  28. package/dist/builtin-memory/crouter-concepts/INDEX.md +2 -2
  29. package/dist/builtin-memory/crouter-concepts/lifecycle-and-wakes.md +1 -1
  30. package/dist/builtin-memory/crouter-concepts/memory.md +15 -15
  31. package/dist/builtin-memory/crouter-concepts/nodes-and-the-canvas.md +1 -1
  32. package/dist/builtin-memory/crouter-concepts/profiles-kinds-and-modes.md +5 -5
  33. package/dist/builtin-memory/crouter-concepts/scopes-and-trust.md +1 -1
  34. package/dist/builtin-memory/crouter-concepts/why-a-daemon.md +1 -1
  35. package/dist/builtin-memory/crouter-sdk/INDEX.md +2 -2
  36. package/dist/builtin-memory/crouter-sdk/README.md +5 -6
  37. package/dist/builtin-memory/crouter-sdk/errors.md +0 -13
  38. package/dist/builtin-memory/crouter-sdk/guides/README.md +0 -1
  39. package/dist/builtin-memory/crouter-sdk/guides/event-driven-assistant.md +2 -2
  40. package/dist/builtin-memory/crouter-sdk/nodes.md +0 -2
  41. package/dist/builtin-memory/crouter-sdk/resources.md +0 -1
  42. package/dist/builtin-memory/explore/exploration-doc.md +4 -4
  43. package/dist/builtin-memory/insights/capture.md +6 -6
  44. package/dist/builtin-memory/insights/init.md +14 -14
  45. package/dist/builtin-memory/internal/INDEX.md +4 -4
  46. package/dist/builtin-memory/internal/agent-shaping.md +20 -20
  47. package/dist/builtin-memory/internal/examples/imessage-assistant.md +2 -2
  48. package/dist/builtin-memory/internal/marketplaces.md +2 -2
  49. package/dist/builtin-memory/internal/memory-loading.md +31 -30
  50. package/dist/builtin-memory/internal/nodes-and-canvas.md +1 -1
  51. package/dist/builtin-memory/internal/plugins.md +16 -14
  52. package/dist/builtin-memory/internal/storage-tiers.md +4 -4
  53. package/dist/builtin-memory/memory-read-orientation.md +1 -1
  54. package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/memory-slash-commands.ts +32 -40
  55. package/dist/clients/attach/input/controller.js +1 -1
  56. package/dist/clients/attach/input/ref-autocomplete.js +1 -1
  57. package/dist/clients/attach/input/titled-editor.js +1 -1
  58. package/dist/clients/attach/render/chat-view.js +1 -1
  59. package/dist/clients/attach/render/crtr-output.d.ts +1 -2
  60. package/dist/clients/attach/render/crtr-output.js +17 -17
  61. package/dist/clients/attach/render/group-activity.d.ts +8 -8
  62. package/dist/clients/attach/render/group-activity.js +2 -2
  63. package/dist/clients/attach/render/group-recap.js +1 -1
  64. package/dist/clients/attach/render/tool-calls.d.ts +1 -1
  65. package/dist/clients/attach/session/profile-files.js +1 -1
  66. package/dist/clients/attach/slash/dispatch.js +1 -1
  67. package/dist/clients/attach/viewer.js +806 -1553
  68. package/dist/commands/api-client.d.ts +2 -0
  69. package/dist/commands/api-client.js +3 -3
  70. package/dist/commands/canvas/edges.d.ts +2 -0
  71. package/dist/commands/canvas/edges.js +2 -0
  72. package/dist/commands/canvas/list.d.ts +4 -0
  73. package/dist/commands/canvas/list.js +3 -0
  74. package/dist/commands/canvas/read.d.ts +8 -0
  75. package/dist/commands/canvas/read.js +5 -0
  76. package/dist/commands/canvas/search.d.ts +2 -0
  77. package/dist/commands/canvas/search.js +3 -0
  78. package/dist/commands/canvas/unwatch.d.ts +2 -0
  79. package/dist/commands/canvas/unwatch.js +1 -0
  80. package/dist/commands/canvas/watch.d.ts +3 -0
  81. package/dist/commands/canvas/watch.js +1 -0
  82. package/dist/commands/canvas-analytics.js +1 -1
  83. package/dist/commands/canvas-history/grep.js +4 -4
  84. package/dist/commands/canvas-history/read.js +2 -2
  85. package/dist/commands/canvas-history/search.js +7 -7
  86. package/dist/commands/canvas-history/shared.d.ts +0 -1
  87. package/dist/commands/canvas-history/shared.js +1 -1
  88. package/dist/commands/canvas-history/stats.js +2 -2
  89. package/dist/commands/canvas-history.js +1 -1
  90. package/dist/commands/canvas.js +1 -1
  91. package/dist/commands/doc/delete.d.ts +2 -0
  92. package/dist/commands/doc/delete.js +1 -0
  93. package/dist/commands/doc/edit.d.ts +2 -0
  94. package/dist/commands/doc/edit.js +1 -0
  95. package/dist/commands/doc/history.d.ts +2 -0
  96. package/dist/commands/doc/history.js +2 -0
  97. package/dist/commands/doc/lint.d.ts +2 -0
  98. package/dist/commands/doc/lint.js +2 -0
  99. package/dist/commands/doc/list.d.ts +2 -0
  100. package/dist/commands/doc/list.js +1 -0
  101. package/dist/commands/doc/move.d.ts +2 -0
  102. package/dist/commands/doc/move.js +1 -0
  103. package/dist/commands/doc/read.d.ts +2 -0
  104. package/dist/commands/doc/read.js +1 -0
  105. package/dist/commands/doc/shared.d.ts +25 -0
  106. package/dist/commands/doc/shared.js +2 -0
  107. package/dist/commands/doc/write.d.ts +2 -0
  108. package/dist/commands/doc/write.js +1 -0
  109. package/dist/commands/{memory.d.ts → doc.d.ts} +1 -1
  110. package/dist/commands/doc.js +1 -0
  111. package/dist/commands/human/review.js +1 -1
  112. package/dist/commands/node/bash.js +2 -2
  113. package/dist/commands/node/create.js +1 -1
  114. package/dist/commands/node/inspect.js +10 -10
  115. package/dist/commands/node/lifecycle.js +2 -2
  116. package/dist/commands/node/outcome.js +1 -1
  117. package/dist/commands/node/subscription.js +1 -1
  118. package/dist/commands/node-context.js +2 -2
  119. package/dist/commands/pkg/browse/catalog.js +1 -1
  120. package/dist/commands/pkg/browse/doc-view.js +1 -1
  121. package/dist/commands/pkg/browse/model.d.ts +9 -17
  122. package/dist/commands/pkg/plugin-inspect.js +1 -1
  123. package/dist/commands/pkg/plugin-manage.d.ts +4 -8
  124. package/dist/commands/pkg/plugin-manage.js +15 -17
  125. package/dist/commands/profile/list.js +1 -1
  126. package/dist/commands/profile/new.js +1 -1
  127. package/dist/commands/profile/project.js +1 -1
  128. package/dist/commands/profile/show.js +1 -1
  129. package/dist/commands/push.js +3 -3
  130. package/dist/commands/sys/config.js +1 -1
  131. package/dist/commands/sys/context/admin/actions.d.ts +18 -43
  132. package/dist/commands/sys/context/admin/actions.js +1 -2
  133. package/dist/commands/sys/context/admin/detail-panel.d.ts +17 -25
  134. package/dist/commands/sys/context/admin/detail-panel.js +2 -1
  135. package/dist/commands/sys/context/admin/docs-panel.d.ts +7 -6
  136. package/dist/commands/sys/context/admin/docs-panel.js +1 -1
  137. package/dist/commands/sys/context/admin/list-view.d.ts +12 -12
  138. package/dist/commands/sys/context/admin/list-view.js +1 -1
  139. package/dist/commands/sys/context/admin/model.d.ts +96 -69
  140. package/dist/commands/sys/context/admin/model.js +1 -1
  141. package/dist/commands/sys/context/admin/rail-panel.d.ts +7 -5
  142. package/dist/commands/sys/context/admin/rail-panel.js +1 -1
  143. package/dist/commands/sys/context/admin/read-view.d.ts +10 -14
  144. package/dist/commands/sys/context/admin/read-view.js +1 -2
  145. package/dist/commands/sys/context/admin/shell.d.ts +26 -31
  146. package/dist/commands/sys/context/admin/shell.js +1 -1
  147. package/dist/commands/sys/context/admin.js +2 -2
  148. package/dist/commands/sys/context/doc.js +2 -3
  149. package/dist/commands/sys/context/expose.js +2 -2
  150. package/dist/commands/sys/context/prompt-review.js +4 -4
  151. package/dist/commands/sys/context/resolve.d.ts +92 -65
  152. package/dist/commands/sys/context/resolve.js +7 -9
  153. package/dist/commands/sys/context.js +1 -1
  154. package/dist/commands/sys/doctor.js +1 -1
  155. package/dist/commands/sys/migrate.js +1 -1
  156. package/dist/commands/sys/panels/profiles-panel.d.ts +3 -1
  157. package/dist/commands/sys/panels/profiles-panel.js +1 -1
  158. package/dist/commands/sys/sync-deps.d.ts +6 -11
  159. package/dist/commands/sys/sync-deps.js +7 -8
  160. package/dist/commands/sys/sync-project-guidance.js +5 -4
  161. package/dist/commands/sys/sync-shared.d.ts +41 -4
  162. package/dist/commands/sys/sync-shared.js +1 -1
  163. package/dist/commands/sys/sync-skills.js +2 -2
  164. package/dist/commands/sys/sync.js +1 -1
  165. package/dist/core/bash-job-supervisor.d.ts +2 -3
  166. package/dist/core/bash-job-supervisor.js +3 -3
  167. package/dist/core/bash-jobs.d.ts +0 -5
  168. package/dist/core/bash-jobs.js +7 -7
  169. package/dist/core/bootstrap.js +2 -2
  170. package/dist/core/canvas/canvas.d.ts +6 -50
  171. package/dist/core/canvas/canvas.js +16 -21
  172. package/dist/core/canvas/db.d.ts +4 -1
  173. package/dist/core/canvas/db.js +2 -2
  174. package/dist/core/canvas/history.d.ts +11 -39
  175. package/dist/core/canvas/history.js +9 -20
  176. package/dist/core/canvas/install-id.d.ts +2 -2
  177. package/dist/core/canvas/install-id.js +1 -1
  178. package/dist/core/canvas/memory-reads.d.ts +5 -0
  179. package/dist/core/canvas/memory-reads.js +1 -1
  180. package/dist/core/canvas/migrations.js +215 -41
  181. package/dist/core/canvas/node-agent-paths.js +1 -1
  182. package/dist/core/canvas/node-tokens.js +1 -1
  183. package/dist/core/canvas/paths.d.ts +0 -4
  184. package/dist/core/canvas/paths.js +1 -1
  185. package/dist/core/canvas/remote-canvas-source.d.ts +0 -1
  186. package/dist/core/canvas/remote-canvas-source.js +1 -1
  187. package/dist/core/canvas/render-source.d.ts +9 -6
  188. package/dist/core/canvas/render-source.js +6 -6
  189. package/dist/core/canvas/sessions.js +2 -2
  190. package/dist/core/canvas/source.d.ts +6 -0
  191. package/dist/core/canvas/tree.d.ts +29 -0
  192. package/dist/core/canvas/tree.js +12 -0
  193. package/dist/core/canvas/types.d.ts +0 -20
  194. package/dist/core/command-plugins/bundle.js +1 -1
  195. package/dist/core/config.d.ts +1 -1
  196. package/dist/core/conversation-store/listener.js +4 -2
  197. package/dist/core/feed/feed.d.ts +9 -7
  198. package/dist/core/feed/feed.js +3 -7
  199. package/dist/core/feed/inbox.d.ts +3 -5
  200. package/dist/core/feed/inbox.js +1 -10
  201. package/dist/core/feed/messages.d.ts +33 -6
  202. package/dist/core/feed/messages.js +10 -7
  203. package/dist/core/feed/reports.d.ts +10 -0
  204. package/dist/core/feed/reports.js +2 -0
  205. package/dist/core/grants/remove.js +1 -1
  206. package/dist/core/graph/access.d.ts +24 -0
  207. package/dist/core/graph/access.js +8 -0
  208. package/dist/core/graph/bodies.d.ts +6 -0
  209. package/dist/core/graph/bodies.js +1 -0
  210. package/dist/core/graph/deletion.d.ts +9 -0
  211. package/dist/core/graph/deletion.js +5 -0
  212. package/dist/core/graph/diff.d.ts +4 -0
  213. package/dist/core/graph/diff.js +4 -0
  214. package/dist/core/graph/documents.d.ts +160 -0
  215. package/dist/core/graph/documents.js +7 -0
  216. package/dist/core/graph/edges.d.ts +24 -0
  217. package/dist/core/graph/edges.js +1 -0
  218. package/dist/core/graph/events.d.ts +26 -0
  219. package/dist/core/graph/events.js +6 -0
  220. package/dist/core/graph/exposures.d.ts +53 -0
  221. package/dist/core/graph/exposures.js +4 -0
  222. package/dist/core/graph/jobs.d.ts +31 -0
  223. package/dist/core/graph/jobs.js +2 -0
  224. package/dist/core/graph/names.d.ts +28 -0
  225. package/dist/core/graph/names.js +3 -0
  226. package/dist/core/graph/objects.d.ts +55 -0
  227. package/dist/core/graph/objects.js +9 -0
  228. package/dist/core/graph/package-docs.d.ts +31 -0
  229. package/dist/core/graph/package-docs.js +5 -0
  230. package/dist/core/graph/package-files.d.ts +20 -0
  231. package/dist/core/graph/package-files.js +2 -0
  232. package/dist/core/graph/reader.d.ts +21 -0
  233. package/dist/core/graph/reader.js +3 -0
  234. package/dist/core/graph/repo-sync/exchange.d.ts +34 -0
  235. package/dist/core/graph/repo-sync/exchange.js +2 -0
  236. package/dist/core/graph/repo-sync/identity.d.ts +30 -0
  237. package/dist/core/graph/repo-sync/identity.js +1 -0
  238. package/dist/core/graph/repo-sync/index.d.ts +4 -0
  239. package/dist/core/graph/repo-sync/index.js +1 -0
  240. package/dist/core/graph/repo-sync/mirror.d.ts +30 -0
  241. package/dist/core/graph/repo-sync/mirror.js +6 -0
  242. package/dist/core/graph/repo-sync/ref-format.d.ts +76 -0
  243. package/dist/core/graph/repo-sync/ref-format.js +2 -0
  244. package/dist/core/graph/repo-sync/repos.d.ts +17 -0
  245. package/dist/core/graph/repo-sync/repos.js +3 -0
  246. package/dist/core/graph/repo-sync/sync.d.ts +42 -0
  247. package/dist/core/graph/repo-sync/sync.js +2 -0
  248. package/dist/core/graph/rules.d.ts +26 -0
  249. package/dist/core/graph/rules.js +3 -0
  250. package/dist/core/graph/spaces/app.d.ts +3 -0
  251. package/dist/core/graph/spaces/app.js +1 -0
  252. package/dist/core/graph/spaces/index.d.ts +19 -0
  253. package/dist/core/graph/spaces/index.js +1 -0
  254. package/dist/core/graph/spaces/person.d.ts +5 -0
  255. package/dist/core/graph/spaces/person.js +2 -0
  256. package/dist/core/graph/spaces/repo.d.ts +4 -0
  257. package/dist/core/graph/spaces/repo.js +1 -0
  258. package/dist/core/graph/types.d.ts +75 -0
  259. package/dist/core/graph/types.js +1 -0
  260. package/dist/core/graph/watches.d.ts +62 -0
  261. package/dist/core/graph/watches.js +18 -0
  262. package/dist/core/human/feedback-companion.js +1 -1
  263. package/dist/core/human/requests.d.ts +3 -1
  264. package/dist/core/human/requests.js +6 -6
  265. package/dist/core/inspector/model.js +2 -2
  266. package/dist/core/io.js +5 -5
  267. package/dist/core/layout-migrate/index.d.ts +24 -1
  268. package/dist/core/layout-migrate/index.js +4 -4
  269. package/dist/core/layout-migrate/paths.d.ts +4 -0
  270. package/dist/core/layout-migrate/paths.js +1 -1
  271. package/dist/core/layout-migrate/stored-paths.d.ts +7 -0
  272. package/dist/core/layout-migrate/stored-paths.js +11 -11
  273. package/dist/core/layout-migrate/stores.d.ts +19 -6
  274. package/dist/core/layout-migrate/stores.js +3 -4
  275. package/dist/core/manifest.d.ts +0 -2
  276. package/dist/core/manifest.js +1 -1
  277. package/dist/core/{memory/extensions.d.ts → plugin-extensions.d.ts} +9 -10
  278. package/dist/core/plugin-extensions.js +1 -0
  279. package/dist/core/preview-registry.d.ts +1 -1
  280. package/dist/core/preview-registry.js +3 -2
  281. package/dist/core/profiles/manifest.d.ts +7 -7
  282. package/dist/core/profiles/manifest.js +1 -1
  283. package/dist/core/profiles/select.js +3 -3
  284. package/dist/core/review/birth.js +1 -1
  285. package/dist/core/review/companion.js +1 -1
  286. package/dist/core/review/stage.d.ts +12 -1
  287. package/dist/core/review/stage.js +1 -1
  288. package/dist/core/review/store.d.ts +2 -0
  289. package/dist/core/review/store.js +1 -1
  290. package/dist/core/review/types.d.ts +7 -1
  291. package/dist/core/runs/events.js +1 -1
  292. package/dist/core/runs/operations.js +5 -5
  293. package/dist/core/runs/questions.js +2 -2
  294. package/dist/core/runtime/bearings-render.d.ts +13 -7
  295. package/dist/core/runtime/bearings-render.js +12 -12
  296. package/dist/core/runtime/bearings.d.ts +8 -18
  297. package/dist/core/runtime/bearings.js +7 -7
  298. package/dist/core/runtime/broker/daemon-ops.d.ts +7 -12
  299. package/dist/core/runtime/broker/daemon-ops.js +1 -1
  300. package/dist/core/runtime/broker/fault-retry.d.ts +2 -0
  301. package/dist/core/runtime/broker/fault-retry.js +1 -1
  302. package/dist/core/runtime/broker/frame-dispatch.d.ts +1 -1
  303. package/dist/core/runtime/broker/frame-memory-refs.d.ts +7 -2
  304. package/dist/core/runtime/broker/frame-memory-refs.js +1 -1
  305. package/dist/core/runtime/broker/inbox.d.ts +1 -4
  306. package/dist/core/runtime/broker/inbox.js +1 -10
  307. package/dist/core/runtime/broker/rebind.js +1 -1
  308. package/dist/core/runtime/broker/retry-card-elision.d.ts +7 -0
  309. package/dist/core/runtime/broker/retry-card-elision.js +1 -0
  310. package/dist/core/runtime/broker-extension-render.d.ts +0 -13
  311. package/dist/core/runtime/broker-extension-render.js +2 -4
  312. package/dist/core/runtime/broker-persona-guidance.js +3 -3
  313. package/dist/core/runtime/broker-protocol.d.ts +1 -1
  314. package/dist/core/runtime/broker.js +1 -1
  315. package/dist/core/runtime/close.d.ts +9 -4
  316. package/dist/core/runtime/close.js +1 -1
  317. package/dist/core/runtime/deliver-live.js +1 -1
  318. package/dist/core/runtime/kickoff.js +17 -19
  319. package/dist/core/runtime/launch-target.d.ts +7 -0
  320. package/dist/core/runtime/launch-target.js +1 -1
  321. package/dist/core/runtime/ledger.d.ts +10 -0
  322. package/dist/core/runtime/ledger.js +3 -0
  323. package/dist/core/runtime/lifecycle.js +2 -2
  324. package/dist/core/runtime/nodes.d.ts +10 -2
  325. package/dist/core/runtime/nodes.js +1 -1
  326. package/dist/core/runtime/outcome-document.d.ts +2 -2
  327. package/dist/core/runtime/outcome-document.js +1 -1
  328. package/dist/core/runtime/persona.js +2 -2
  329. package/dist/core/runtime/placement.js +1 -1
  330. package/dist/core/runtime/promote.d.ts +2 -2
  331. package/dist/core/runtime/promote.js +1 -1
  332. package/dist/core/runtime/prospective-inventory-cli.js +2 -2
  333. package/dist/core/runtime/recycle.js +1 -1
  334. package/dist/core/runtime/reopen.js +1 -1
  335. package/dist/core/runtime/revive.js +2 -2
  336. package/dist/core/runtime/roadmap.d.ts +17 -9
  337. package/dist/core/runtime/roadmap.js +4 -4
  338. package/dist/core/runtime/spawn-env.js +1 -1
  339. package/dist/core/runtime/spawn.d.ts +5 -3
  340. package/dist/core/runtime/spawn.js +2 -2
  341. package/dist/core/runtime/structured-output.d.ts +3 -1
  342. package/dist/core/runtime/structured-output.js +4 -4
  343. package/dist/core/scope.d.ts +1 -32
  344. package/dist/core/scope.js +1 -1
  345. package/dist/core/scoped-state/db.js +2 -1
  346. package/dist/core/scoped-state/migrate.js +2 -2
  347. package/dist/core/scoped-state/profiles.d.ts +11 -0
  348. package/dist/core/scoped-state/profiles.js +1 -1
  349. package/dist/core/scoped-state/schema.d.ts +1 -1
  350. package/dist/core/scoped-state/schema.js +7 -5
  351. package/dist/core/spaces/permissions.d.ts +0 -14
  352. package/dist/core/spaces/permissions.js +1 -1
  353. package/dist/core/spaces/stop.d.ts +13 -0
  354. package/dist/core/spaces/stop.js +2 -2
  355. package/dist/core/storage/tables.d.ts +1 -1
  356. package/dist/core/substrate/delivery/corpus.d.ts +21 -0
  357. package/dist/core/substrate/delivery/corpus.js +3 -0
  358. package/dist/core/substrate/delivery/deliver.d.ts +76 -0
  359. package/dist/core/substrate/delivery/deliver.js +6 -0
  360. package/dist/core/substrate/delivery/listings.d.ts +27 -0
  361. package/dist/core/substrate/delivery/listings.js +4 -0
  362. package/dist/core/substrate/delivery/match.d.ts +28 -0
  363. package/dist/core/substrate/delivery/match.js +1 -0
  364. package/dist/core/substrate/delivery/plan.d.ts +67 -0
  365. package/dist/core/substrate/delivery/plan.js +3 -0
  366. package/dist/core/substrate/delivery/render-boot.d.ts +20 -0
  367. package/dist/core/substrate/delivery/render-boot.js +54 -0
  368. package/dist/core/substrate/delivery/render-event.d.ts +47 -0
  369. package/dist/core/substrate/delivery/render-event.js +6 -0
  370. package/dist/core/substrate/delivery/sub-persona-menu.d.ts +2 -0
  371. package/dist/core/substrate/delivery/sub-persona-menu.js +6 -0
  372. package/dist/core/substrate/delivery/types.d.ts +30 -0
  373. package/dist/core/substrate/delivery/types.js +0 -0
  374. package/dist/core/substrate/gate-explain.d.ts +0 -13
  375. package/dist/core/substrate/gate-explain.js +1 -1
  376. package/dist/core/substrate/schema.d.ts +11 -139
  377. package/dist/core/substrate/schema.js +1 -1
  378. package/dist/core/substrate/subject-fields.d.ts +3 -0
  379. package/dist/core/substrate/subject.d.ts +2 -1
  380. package/dist/core/substrate/subject.js +1 -1
  381. package/dist/daemon/api/handlers/app-profiles.js +1 -1
  382. package/dist/daemon/api/handlers/bash-jobs.js +1 -2
  383. package/dist/daemon/api/handlers/broker-ops.js +1 -1
  384. package/dist/daemon/api/handlers/canvas.js +5 -5
  385. package/dist/daemon/api/handlers/daemon.js +1 -1
  386. package/dist/daemon/api/handlers/delivery.d.ts +2 -0
  387. package/dist/daemon/api/handlers/delivery.js +1 -0
  388. package/dist/daemon/api/handlers/{memory.d.ts → docs.d.ts} +1 -1
  389. package/dist/daemon/api/handlers/docs.js +1 -0
  390. package/dist/daemon/api/handlers/hook-exec.js +1 -1
  391. package/dist/daemon/api/handlers/messages.js +2 -2
  392. package/dist/daemon/api/handlers/node-records.js +2 -2
  393. package/dist/daemon/api/handlers/nodes.js +1 -1
  394. package/dist/daemon/api/handlers/objects.d.ts +2 -0
  395. package/dist/daemon/api/handlers/objects.js +5 -0
  396. package/dist/daemon/api/handlers/package-docs.d.ts +2 -0
  397. package/dist/daemon/api/handlers/package-docs.js +1 -0
  398. package/dist/daemon/api/handlers/profiles.js +1 -1
  399. package/dist/daemon/api/handlers/reports.d.ts +2 -2
  400. package/dist/daemon/api/handlers/reports.js +4 -4
  401. package/dist/daemon/api/handlers/reviews.js +1 -1
  402. package/dist/daemon/api/map.d.ts +2 -2
  403. package/dist/daemon/api/map.js +2 -2
  404. package/dist/daemon/api/operations.d.ts +1 -1
  405. package/dist/daemon/api/operations.js +1 -1
  406. package/dist/daemon/api/reader.d.ts +17 -0
  407. package/dist/daemon/api/reader.js +1 -0
  408. package/dist/daemon/api/server.js +1 -1
  409. package/dist/daemon/control.d.ts +2 -3
  410. package/dist/daemon/crtrd.js +8 -6
  411. package/dist/daemon/fleet.js +4 -4
  412. package/dist/daemon/reconcilers/bash-deadline.d.ts +11 -1
  413. package/dist/daemon/reconcilers/bash-deadline.js +2 -1
  414. package/dist/daemon/reconcilers/broker-supervision.js +4 -4
  415. package/dist/daemon/reconcilers/live-obligation.js +1 -1
  416. package/dist/daemon/reconcilers/node-deadline.js +1 -1
  417. package/dist/daemon/reconcilers/node-lifecycle/freeze-lane.js +1 -1
  418. package/dist/daemon/reconcilers/storage-maintenance.d.ts +1 -0
  419. package/dist/daemon/reconcilers/storage-maintenance.js +1 -1
  420. package/dist/daemon/review/deliver.js +2 -2
  421. package/dist/daemon/review/finish.js +1 -1
  422. package/dist/hook-authoring.d.ts +0 -1
  423. package/dist/hook-authoring.js +3 -3
  424. package/dist/migrations/004-canvas-documents/apply.d.ts +10 -0
  425. package/dist/migrations/004-canvas-documents/apply.js +1 -0
  426. package/dist/migrations/004-canvas-documents/fields.d.ts +24 -0
  427. package/dist/migrations/004-canvas-documents/fields.js +2 -0
  428. package/dist/migrations/004-canvas-documents/index.d.ts +16 -0
  429. package/dist/migrations/004-canvas-documents/index.js +2 -0
  430. package/dist/migrations/004-canvas-documents/legacy/discover.d.ts +16 -0
  431. package/dist/migrations/004-canvas-documents/legacy/discover.js +1 -0
  432. package/dist/migrations/004-canvas-documents/legacy/history.d.ts +5 -0
  433. package/dist/migrations/004-canvas-documents/legacy/history.js +2 -0
  434. package/dist/migrations/004-canvas-documents/legacy/nested.d.ts +7 -0
  435. package/dist/migrations/004-canvas-documents/legacy/nested.js +1 -0
  436. package/dist/migrations/004-canvas-documents/legacy/parse.d.ts +14 -0
  437. package/dist/migrations/004-canvas-documents/legacy/parse.js +1 -0
  438. package/dist/migrations/004-canvas-documents/legacy/types.d.ts +91 -0
  439. package/dist/migrations/004-canvas-documents/legacy/types.js +0 -0
  440. package/dist/migrations/004-canvas-documents/legacy-edges.d.ts +6 -0
  441. package/dist/migrations/004-canvas-documents/legacy-edges.js +18 -0
  442. package/dist/migrations/004-canvas-documents/plan.d.ts +102 -0
  443. package/dist/migrations/004-canvas-documents/plan.js +3 -0
  444. package/dist/migrations/004-canvas-documents/pointers.d.ts +23 -0
  445. package/dist/migrations/004-canvas-documents/pointers.js +4 -0
  446. package/dist/migrations/activation.d.ts +9 -18
  447. package/dist/migrations/activation.js +2 -2
  448. package/dist/pi-extensions/broker-local.d.ts +2 -2
  449. package/dist/pi-extensions/broker-local.js +2 -2
  450. package/dist/pi-extensions/canvas-bash-valve.js +5 -4
  451. package/dist/pi-extensions/canvas-context-intro.js +2 -2
  452. package/dist/pi-extensions/canvas-doc-substrate.d.ts +0 -1
  453. package/dist/pi-extensions/canvas-doc-substrate.js +6 -6
  454. package/dist/pi-extensions/canvas-inbox-watcher.js +2 -2
  455. package/dist/pi-extensions/canvas-passive-context.js +1 -1
  456. package/dist/pi-extensions/canvas-recap.js +2 -2
  457. package/dist/pi-extensions/canvas-stophook.d.ts +1 -1
  458. package/dist/pi-extensions/canvas-stophook.js +1 -1
  459. package/dist/prompts/review.js +3 -3
  460. package/dist/shared/env.d.ts +5 -0
  461. package/dist/shared/env.js +1 -1
  462. package/dist/shared/generated-context.js +2 -10
  463. package/dist/shared/inbox-entry-body.d.ts +22 -0
  464. package/dist/shared/inbox-entry-body.js +10 -0
  465. package/dist/{core/memory → shared}/inline-ref-guidance.d.ts +2 -2
  466. package/dist/shared/inline-ref-guidance.js +2 -0
  467. package/dist/types.d.ts +3 -1
  468. package/docs/cli/memory-and-preferences.md +12 -14
  469. package/docs/concepts/README.md +1 -1
  470. package/docs/concepts/lifecycle-and-wakes.md +1 -1
  471. package/docs/concepts/memory.md +15 -15
  472. package/docs/concepts/nodes-and-the-canvas.md +1 -1
  473. package/docs/concepts/profiles-kinds-and-modes.md +5 -5
  474. package/docs/concepts/scopes-and-trust.md +1 -1
  475. package/docs/concepts/why-a-daemon.md +1 -1
  476. package/docs/sdk/README.md +5 -6
  477. package/docs/sdk/errors.md +0 -13
  478. package/docs/sdk/guides/README.md +0 -1
  479. package/docs/sdk/nodes.md +0 -2
  480. package/docs/sdk/resources.md +0 -1
  481. package/package.json +2 -2
  482. package/packages/crouter-identity/package.json +1 -1
  483. package/runtime.lock.json +11 -11
  484. package/dist/api/dto/memory.d.ts +0 -171
  485. package/dist/api/dto/memory.js +0 -1
  486. package/dist/builtin-memory/crouter-sdk/guides/app-memory.md +0 -73
  487. package/dist/builtin-memory/crouter-sdk/memory.md +0 -87
  488. package/dist/commands/broker-permissions.d.ts +0 -2
  489. package/dist/commands/broker-permissions.js +0 -1
  490. package/dist/commands/memory/client.d.ts +0 -11
  491. package/dist/commands/memory/client.js +0 -1
  492. package/dist/commands/memory/delete.d.ts +0 -1
  493. package/dist/commands/memory/delete.js +0 -1
  494. package/dist/commands/memory/edit.d.ts +0 -1
  495. package/dist/commands/memory/edit.js +0 -21
  496. package/dist/commands/memory/find.d.ts +0 -1
  497. package/dist/commands/memory/find.js +0 -1
  498. package/dist/commands/memory/history.d.ts +0 -1
  499. package/dist/commands/memory/history.js +0 -5
  500. package/dist/commands/memory/lint.d.ts +0 -1
  501. package/dist/commands/memory/lint.js +0 -1
  502. package/dist/commands/memory/list.d.ts +0 -1
  503. package/dist/commands/memory/list.js +0 -1
  504. package/dist/commands/memory/move.d.ts +0 -1
  505. package/dist/commands/memory/move.js +0 -1
  506. package/dist/commands/memory/origin.d.ts +0 -1
  507. package/dist/commands/memory/origin.js +0 -1
  508. package/dist/commands/memory/read.d.ts +0 -1
  509. package/dist/commands/memory/read.js +0 -6
  510. package/dist/commands/memory/shared.d.ts +0 -22
  511. package/dist/commands/memory/shared.js +0 -1
  512. package/dist/commands/memory/write.d.ts +0 -1
  513. package/dist/commands/memory/write.js +0 -13
  514. package/dist/commands/memory.js +0 -1
  515. package/dist/commands/node-inspect-artifacts.d.ts +0 -1
  516. package/dist/commands/node-inspect-artifacts.js +0 -8
  517. package/dist/core/help/memory-extensions.d.ts +0 -3
  518. package/dist/core/help/memory-extensions.js +0 -2
  519. package/dist/core/memory/cli-selector.d.ts +0 -13
  520. package/dist/core/memory/cli-selector.js +0 -1
  521. package/dist/core/memory/doc-link-grammar.d.ts +0 -20
  522. package/dist/core/memory/doc-link-grammar.js +0 -2
  523. package/dist/core/memory/extensions.js +0 -1
  524. package/dist/core/memory/history.d.ts +0 -87
  525. package/dist/core/memory/history.js +0 -6
  526. package/dist/core/memory/identity.d.ts +0 -65
  527. package/dist/core/memory/identity.js +0 -1
  528. package/dist/core/memory/inline-ref-guidance.js +0 -2
  529. package/dist/core/memory/inline-ref-inventory.d.ts +0 -9
  530. package/dist/core/memory/inline-ref-inventory.js +0 -1
  531. package/dist/core/memory/lint.d.ts +0 -163
  532. package/dist/core/memory/lint.js +0 -2
  533. package/dist/core/memory/mutation-domain.d.ts +0 -113
  534. package/dist/core/memory/mutation-domain.js +0 -12
  535. package/dist/core/memory/mutations.d.ts +0 -74
  536. package/dist/core/memory/mutations.js +0 -1
  537. package/dist/core/memory/project-namespace.d.ts +0 -31
  538. package/dist/core/memory/project-namespace.js +0 -2
  539. package/dist/core/memory/repository-association.d.ts +0 -31
  540. package/dist/core/memory/repository-association.js +0 -1
  541. package/dist/core/memory/service.d.ts +0 -145
  542. package/dist/core/memory/service.js +0 -2
  543. package/dist/core/memory/tree.d.ts +0 -39
  544. package/dist/core/memory/tree.js +0 -1
  545. package/dist/core/memory-resolver.d.ts +0 -280
  546. package/dist/core/memory-resolver.js +0 -2
  547. package/dist/core/nested-stores.d.ts +0 -18
  548. package/dist/core/nested-stores.js +0 -1
  549. package/dist/core/runtime/memory.d.ts +0 -3
  550. package/dist/core/runtime/memory.js +0 -1
  551. package/dist/core/substrate/frontmatter-validation.d.ts +0 -11
  552. package/dist/core/substrate/frontmatter-validation.js +0 -1
  553. package/dist/core/substrate/gate.d.ts +0 -16
  554. package/dist/core/substrate/gate.js +0 -1
  555. package/dist/core/substrate/index.d.ts +0 -18
  556. package/dist/core/substrate/index.js +0 -1
  557. package/dist/core/substrate/injected-store.d.ts +0 -75
  558. package/dist/core/substrate/injected-store.js +0 -2
  559. package/dist/core/substrate/listings.d.ts +0 -28
  560. package/dist/core/substrate/listings.js +0 -1
  561. package/dist/core/substrate/memory-events.d.ts +0 -6
  562. package/dist/core/substrate/memory-events.js +0 -1
  563. package/dist/core/substrate/on-read-node.d.ts +0 -6
  564. package/dist/core/substrate/on-read-node.js +0 -1
  565. package/dist/core/substrate/on-read.d.ts +0 -101
  566. package/dist/core/substrate/on-read.js +0 -9
  567. package/dist/core/substrate/plan.d.ts +0 -94
  568. package/dist/core/substrate/plan.js +0 -1
  569. package/dist/core/substrate/render-node.d.ts +0 -12
  570. package/dist/core/substrate/render-node.js +0 -1
  571. package/dist/core/substrate/render.d.ts +0 -41
  572. package/dist/core/substrate/render.js +0 -65
  573. package/dist/core/substrate/session-cache.d.ts +0 -27
  574. package/dist/core/substrate/session-cache.js +0 -1
  575. package/dist/core/substrate/surface-match.d.ts +0 -73
  576. package/dist/core/substrate/surface-match.js +0 -1
  577. package/dist/daemon/api/handlers/memory.js +0 -5
  578. package/dist/migrations/001-surfaces-frontmatter.d.ts +0 -2
  579. package/dist/migrations/001-surfaces-frontmatter.js +0 -1
  580. package/dist/migrations/002-profile-project-memory.d.ts +0 -2
  581. package/dist/migrations/002-profile-project-memory.js +0 -1
  582. package/dist/migrations/003-repository-root-memory-identity/front-door.d.ts +0 -26
  583. package/dist/migrations/003-repository-root-memory-identity/front-door.js +0 -11
  584. package/dist/migrations/003-repository-root-memory-identity/index.d.ts +0 -2
  585. package/dist/migrations/003-repository-root-memory-identity/index.js +0 -5
  586. package/dist/migrations/003-repository-root-memory-identity/references.d.ts +0 -95
  587. package/dist/migrations/003-repository-root-memory-identity/references.js +0 -5
  588. package/dist/migrations/003-repository-root-memory-identity/repository-facts.d.ts +0 -39
  589. package/dist/migrations/003-repository-root-memory-identity/repository-facts.js +0 -3
  590. package/dist/migrations/convergent.d.ts +0 -43
  591. package/dist/migrations/convergent.js +0 -2
  592. package/dist/migrations/corpus.d.ts +0 -75
  593. package/dist/migrations/corpus.js +0 -3
  594. package/dist/migrations/frontmatter-splice.d.ts +0 -15
  595. package/dist/migrations/frontmatter-splice.js +0 -8
  596. package/dist/migrations/profile-manifests.d.ts +0 -30
  597. package/dist/migrations/profile-manifests.js +0 -2
  598. package/dist/migrations/registry.d.ts +0 -7
  599. package/dist/migrations/registry.js +0 -1
  600. package/dist/migrations/runner.d.ts +0 -43
  601. package/dist/migrations/runner.js +0 -1
  602. package/dist/migrations/types.d.ts +0 -211
  603. package/dist/shared/birth-announcement.d.ts +0 -12
  604. package/dist/shared/birth-announcement.js +0 -1
  605. package/docs/sdk/guides/app-memory.md +0 -22
  606. package/docs/sdk/memory.md +0 -85
  607. /package/dist/{migrations/types.js → api/dto/delivery.js} +0 -0
  608. /package/dist/{core/memory → shared}/inline-ref-grammar.d.ts +0 -0
  609. /package/dist/{core/memory → shared}/inline-ref-grammar.js +0 -0
@@ -1,145 +0,0 @@
1
- import { type MemoryDoc, type MemoryScope, type MemoryStoreDescriptor, type MemoryTarget } from '../memory-resolver.js';
2
- import { type DeletedHistoryResolution, type HistoryRecord } from './history.js';
3
- import { type PrivacyLevel } from '../substrate/schema.js';
4
- export { createDoc, deleteDoc, moveDoc, updateDoc, type CreateDocInput, type DeleteDocInput, type MoveDocInput, type UpdateDocInput, } from './mutations.js';
5
- export interface MemoryServiceSelection {
6
- /** Resolution identity is always supplied by the caller; this service never uses ambient process state. */
7
- target: MemoryTarget;
8
- /** Restrict a target view to one source tier. Ignored when an exact store is supplied. */
9
- scope?: MemoryScope;
10
- /** An exact store already selected by the CLI or API boundary. */
11
- store?: MemoryStoreDescriptor | null;
12
- }
13
- export interface MemoryCandidateLocation {
14
- winner: boolean;
15
- scope: MemoryScope;
16
- store_root: string;
17
- physical_relative_path: string;
18
- path: string;
19
- }
20
- export declare function candidateLocation(doc: MemoryDoc, winner: MemoryDoc): MemoryCandidateLocation;
21
- /** Refuse an exact project store that normal resolution would not mount. */
22
- export declare function requireMountedStore(store: MemoryStoreDescriptor): MemoryStoreDescriptor;
23
- /** Normalize and validate the public canonical memory address. */
24
- export declare function requireCanonicalName(rawName: string): string;
25
- /** Return the name local to an exact store, rejecting a name outside its namespace. */
26
- export declare function requireLocalNameInStore(store: MemoryStoreDescriptor, rawName: string): string;
27
- /** Resolution precedence rank used for stable inventory ordering. */
28
- export declare function memoryScopeRank(scope: MemoryScope): number;
29
- export interface ListedMemoryDoc {
30
- name: string;
31
- kind: string;
32
- privacy: PrivacyLevel;
33
- scope: MemoryScope;
34
- path: string;
35
- storeRoot: string;
36
- physicalRelativePath: string;
37
- shortForm: string;
38
- slash: boolean;
39
- extensions: Record<string, Record<string, string | boolean | number>>;
40
- candidates: readonly MemoryDoc[];
41
- }
42
- /** Stable key used by inventory ordering and cursor resumption. */
43
- export declare function memoryListKey(doc: Pick<ListedMemoryDoc, 'scope' | 'kind' | 'name' | 'physicalRelativePath'>): string;
44
- /** Locale-aware total order for memory inventory keys. */
45
- export declare function compareMemoryListKeys(left: string, right: string): number;
46
- /** List the selected corpus. Target views deduplicate canonical names; exact stores retain physical collisions. */
47
- export declare function listDocs(selection: MemoryServiceSelection & {
48
- kind?: string;
49
- }): ListedMemoryDoc[];
50
- export interface MemorySearchPath {
51
- path: string;
52
- store_root: string;
53
- physical_relative_path: string;
54
- candidates?: readonly MemoryCandidateLocation[];
55
- }
56
- export interface MemoryRankedSearchHit extends MemorySearchPath {
57
- name: string;
58
- kind: string;
59
- privacy: PrivacyLevel;
60
- scope: MemoryScope;
61
- score: number;
62
- short_form: string;
63
- }
64
- export interface MemoryGrepSearchHit extends MemorySearchPath {
65
- name: string;
66
- privacy: PrivacyLevel;
67
- scope: MemoryScope;
68
- line: number;
69
- text: string;
70
- }
71
- export type MemorySearchResult = {
72
- mode: 'ranked';
73
- matches: number;
74
- hits: readonly MemoryRankedSearchHit[];
75
- } | {
76
- mode: 'grep';
77
- matches: number;
78
- hits: readonly MemoryGrepSearchHit[];
79
- };
80
- export interface SearchDocsInput extends MemoryServiceSelection {
81
- query: string;
82
- kind?: string;
83
- grep?: boolean;
84
- body?: boolean;
85
- minScore?: number;
86
- }
87
- /** Search the selected corpus using either ranked relevance or body-line regex matching. */
88
- export declare function searchDocs(input: SearchDocsInput): MemorySearchResult;
89
- export interface ReadDocInput extends MemoryServiceSelection {
90
- name: string;
91
- kind?: string;
92
- frontmatter?: boolean;
93
- interpolateNodePaths?: boolean;
94
- grantee?: string;
95
- }
96
- export type ReadDocResult = {
97
- kind: 'document';
98
- doc: MemoryDoc;
99
- candidates: readonly MemoryDoc[];
100
- content: string;
101
- links: readonly string[];
102
- listingByName: ReadonlyMap<string, MemoryDoc>;
103
- } | {
104
- kind: 'directory';
105
- name: string;
106
- listingByName: ReadonlyMap<string, MemoryDoc>;
107
- };
108
- /** Resolve a document or directory and return unexpanded source plus listing/link data. */
109
- export declare function readDoc(input: ReadDocInput): ReadDocResult;
110
- export interface HistoryRevision {
111
- revision: number;
112
- op: HistoryRecord['op'];
113
- at: string;
114
- node?: string;
115
- rationale?: string;
116
- verbatim?: true;
117
- body_changed: boolean;
118
- frontmatter_changed: string[];
119
- diff?: string;
120
- }
121
- export type ReadHistoryResult = {
122
- name: string;
123
- scope: MemoryScope;
124
- logPath: string;
125
- deleted?: DeletedHistoryResolution;
126
- total: number;
127
- record: {
128
- revision: number;
129
- } & HistoryRecord;
130
- } | {
131
- name: string;
132
- scope: MemoryScope;
133
- logPath: string;
134
- deleted?: DeletedHistoryResolution;
135
- total: number;
136
- revisions: readonly HistoryRevision[];
137
- };
138
- export interface ReadHistoryInput extends MemoryServiceSelection {
139
- name: string;
140
- limit: number;
141
- diff?: boolean;
142
- revision?: number;
143
- }
144
- /** Read one complete revision or a newest-first history summary from the selected corpus. */
145
- export declare function readHistory(input: ReadHistoryInput): ReadHistoryResult;
@@ -1,2 +0,0 @@
1
- var P=Object.defineProperty;var l=(e,n)=>P(e,"name",{value:n,configurable:!0});import{readFileBeneath as v}from"../spaces/open-beneath.js";import{notFound as w,usage as d}from"../errors.js";import{interpolateNodePaths as L}from"../canvas/paths.js";import{loadMemoryStoreView as q,loadMemoryTargetView as x,memoryStoresInPrecedence as M}from"../memory-resolver.js";import{canonicalSegments as k,stripNamespace as b,validateExplicitLocalName as F}from"./identity.js";import{memoryExtensionEffectiveCatalog as j,projectEffectiveMemoryExtensions as E}from"./extensions.js";import{historyLogPathForDoc as I,readHistoryRecords as B,resolveDeletedHistoryLogPath as K,summarizeChange as z,unifiedDiff as A}from"./history.js";import{docsByName as $,isDirName as S}from"../substrate/listings.js";import{effectivePrivacy as H,parseSubstrateDoc as _}from"../substrate/schema.js";import{literalBodySegment as T,serializeMemoryDocLiteral as V}from"./mutation-domain.js";import{createDoc as ue,deleteDoc as pe,moveDoc as ye,updateDoc as ge}from"./mutations.js";function O(e,n){return{winner:e===n,scope:e.scope,store_root:e.root,physical_relative_path:e.physicalRelativePath,path:e.path}}l(O,"candidateLocation");function y(e){if(e.scope!=="project"||e.mountStatus==="ready")return e;const n=e.ownerDir??e.storeRoot;if(e.mountStatus==="absent")throw d(`no memory store at ${e.storeRoot}`,{next:`Initialize it with \`crtr memory write <namespace> --dir ${n}\`, which declares the repository namespace.`});const a=e.repositoryRoot??n;throw d(e.diagnostic??`project memory store at ${e.storeRoot} does not declare a namespace`,{next:`Run \`crtr sys migrate --dir ${a}\`.`})}l(y,"requireMountedStore");function R(e){const n=k(e.trim()).join("/");if(n==="")throw d("memory document name required");const a=F(n);if(!a.ok)throw d(`invalid memory document name \`${e}\`: ${a.reason}`,{received:e,next:"Pass the full canonical name (a project document is <namespace>/<local name>); run `crtr memory find <leaf>` to look one up."});return n}l(R,"requireCanonicalName");function U(e,n){y(e);const a=R(n);if(e.namespace==="")return a;const s=b(a,e.namespace);if(s===null)throw d(`\`${a}\` is not in the namespace of the store at ${e.storeRoot} (\`${e.namespace}\`)`,{memory:a,next:`Every document there answers at \`${e.namespace}/<local name>\`; the store's own document answers at \`${e.namespace}\`.`});return s}l(U,"requireLocalNameInStore");function W(e){return e==="node"?-1:e==="project"?0:e==="profile"?1:e==="user"?2:3}l(W,"memoryScopeRank");function g(e){return e.store!=null?q(y(e.store),!0,e.target):x(e.target,{...e.scope===void 0?{}:{scope:e.scope},includeDescendants:!0,quiet:!0,reportDiscovery:!1})}l(g,"selectedView");function N(e){return g(e).docs}l(N,"selectedDocs");function C(e){return`${String(W(e.scope)+10).padStart(2,"0")}:${e.kind}:${e.name}:${e.physicalRelativePath}`}l(C,"memoryListKey");function G(e,n){const[a,s,i,...o]=e.split(":"),[r,t,c,...h]=n.split(":"),f=Number(a)-Number(r);if(f!==0)return f;const m=s.localeCompare(t);if(m!==0)return m;const u=i.localeCompare(c);return u!==0?u:o.join(":").localeCompare(h.join(":"))}l(G,"compareMemoryListKeys");function ce(e){const n=N(e),a=e.store==null,s=new Map;for(const r of n){const t=s.get(r.name);t!==void 0?t.push(r):s.set(r.name,[r])}const i=new Set,o=[];for(const r of n){const t=_(r);if(!(t===null||e.kind!==void 0&&t.kind!==e.kind)){if(a){if(i.has(t.name))continue;i.add(t.name)}o.push({name:t.name,kind:t.kind,privacy:t.privacy,scope:t.scope,path:t.path,storeRoot:r.root,physicalRelativePath:r.physicalRelativePath,shortForm:t.shortForm,slash:t.slash,extensions:E(r.frontmatter?.extensions,j(r)),candidates:s.get(r.name)??[r]})}}return o.sort((r,t)=>G(C(r),C(t))),o}l(ce,"listDocs");function J(e){const n=N(e),a=e.store==null,s=new Map;for(const r of n){const t=s.get(r.name);t!==void 0?t.push(r):s.set(r.name,[r])}const i=new Set,o=[];for(const r of n){const t=_(r);if(!(t===null||e.kind!==void 0&&t.kind!==e.kind)){if(a){if(i.has(t.name))continue;i.add(t.name)}o.push({name:t.name,localName:r.localName,kind:t.kind,privacy:t.privacy,scope:t.scope,path:t.path,store_root:r.root,physical_relative_path:r.physicalRelativePath,routing:t.whenAndWhyToRead,shortForm:t.shortForm,candidates:s.get(r.name)??[r],body:t.body})}}return o}l(J,"searchUnits");function D(e){return{path:e.path,store_root:e.store_root,physical_relative_path:e.physical_relative_path,...e.candidates.length>1?{candidates:e.candidates.map(n=>O(n,e.candidates[0]))}:{}}}l(D,"searchPath");function me(e){if(e.grep===!0&&e.body===!0)throw d("--grep and --body are mutually exclusive (--grep always scans bodies).");if(e.grep===!0&&e.minScore!==void 0)throw d("--min-score is only available in ranked mode.");if(e.minScore!==void 0&&e.minScore<1)throw d("--min-score must be at least 1.");const n=J(e);if(e.grep===!0){let o;try{o=new RegExp(e.query)}catch{throw d(`invalid regex pattern: ${e.query}`)}const r=[];for(const t of n)t.body.split(`
2
- `).forEach((c,h)=>{o.test(c)&&r.push({name:t.name,privacy:t.privacy,scope:t.scope,line:h+1,text:c,...D(t)})});return r.sort((t,c)=>{const h=t.name.localeCompare(c.name);if(h!==0)return h;const f=t.scope.localeCompare(c.scope);if(f!==0)return f;const m=t.physical_relative_path.localeCompare(c.physical_relative_path);return m!==0?m:t.line-c.line}),{mode:"grep",matches:r.length,hits:r}}const a=e.query.toLowerCase().split(/\s+/).filter(o=>o.length>0);if(a.length===0)throw d("query must contain at least one non-whitespace term");const s=[];for(const o of n){const r=o.name.toLowerCase(),t=o.localName.toLowerCase(),c=o.physical_relative_path.toLowerCase(),h=o.routing.toLowerCase(),f=o.shortForm.toLowerCase(),m=e.body===!0?o.body.toLowerCase():null;let u=0;for(const p of a)(r.includes(p)||t.includes(p)||c.includes(p))&&(u+=10),h.includes(p)&&(u+=5),f.includes(p)&&(u+=3),m!==null&&m.includes(p)&&(u+=1);u>0&&s.push({unit:o,score:u})}s.sort((o,r)=>{if(r.score!==o.score)return r.score-o.score;const t=o.unit.scope.localeCompare(r.unit.scope);if(t!==0)return t;const c=o.unit.name.localeCompare(r.unit.name);return c!==0?c:o.unit.physical_relative_path.localeCompare(r.unit.physical_relative_path)});const i=e.minScore??(s.length===0?1:Math.max(1,Math.ceil(s[0].score/2)));return{mode:"ranked",matches:s.length,hits:s.filter(o=>o.score>=i).map(({unit:o,score:r})=>({name:o.name,kind:o.kind,privacy:o.privacy,scope:o.scope,score:r,short_form:o.shortForm,...D(o)}))}}l(me,"searchDocs");function le(e){const n=g(e),a=e.kind===void 0?{}:{kind:e.kind},s=n.candidates(e.name,a),i=$(n.docs);if(s===null){const m=k(e.name.trim()).join("/");if(m!==""&&S(i,m))return{kind:"directory",name:m,listingByName:i};n.resolve(e.name,a)}const o=s,r=e.store==null?i:$([...n.docs,...x(e.target,{includeDescendants:!0,quiet:!0,reportDiscovery:!1}).docs]),t=o.winner,c=e.frontmatter===!0?t.frontmatter!==null&&!("privacy"in t.frontmatter)?V({...t.frontmatter,privacy:H(t.frontmatter)},T(v(t.root,t.path).toString("utf8"))):v(t.root,t.path).toString("utf8"):t.body,h=e.interpolateNodePaths===!1||e.target.nodeId===null?c:L(c,e.target.nodeId,e.grantee??e.target.grantee),f=[...o.winner.body.matchAll(/\[\[([^\]]+)\]\]/g)].map(m=>m[1].trim()).filter(m=>r.has(m)||S(r,m));return{kind:"document",doc:o.winner,candidates:o.candidates,content:h,links:f,listingByName:i}}l(le,"readDoc");function Q(e){const a=g(e).candidates(e.name);if(a!==null){const o=a.winner;if(o.plugin!==void 0)throw d(`${o.name} belongs to the installed plugin "${o.plugin}" \u2014 a read-only corpus with no revision history.`,{memory:o.name,plugin:o.plugin});if(o.scope==="builtin")throw d(`${o.name} is a builtin document shipped with the package \u2014 a read-only corpus with no revision history.`,{memory:o.name,scope:"builtin"});return{name:o.name,scope:o.scope,root:o.root,logPath:I(o)}}const s=R(e.name),i=e.store!=null?[y(e.store)]:M(e.target,e.scope,!0,!1).filter(o=>o.mountStatus==="ready"&&o.scope!=="builtin"&&o.plugin===void 0);for(const o of i){if(o.namespace!==""&&b(s,o.namespace)===null||e.target.allowsStore?.(o,s)===!1)continue;const r=U(o,s),t=K(o.storeRoot,r);if(t!==null)return{name:s,scope:o.scope,root:o.storeRoot,logPath:t.logPath,deleted:t}}throw w(`no memory document or revision history found: ${e.name}`,{memory:e.name,next:"Run `crtr memory find <query>` to locate the document. A document that exists but has no history predates this surface or has never been mutated through it."})}l(Q,"historyLocation");function de(e){const n=Q(e),a=B(n.root,n.logPath);if(a.length===0)throw w(`no revision history recorded for ${n.name}`,{memory:n.name,next:"The document predates this surface or has never been mutated through `crtr memory write`/`edit`/`delete`. Its first edit records the pre-existing content in full."});if(e.revision!==void 0){if(e.revision<1||e.revision>a.length)throw d(`revision ${e.revision} is out of range for ${n.name} (1..${a.length})`,{memory:n.name,next:`Run \`crtr memory history ${n.name}\` to see which revisions exist.`});return{...n,total:a.length,record:{revision:e.revision,...a[e.revision-1]}}}const s=a.map((i,o)=>{const r=z(i.before,i.after);return{revision:o+1,op:i.op,at:i.at,...i.node===void 0?{}:{node:i.node},...i.rationale===void 0?{}:{rationale:i.rationale},...i.verbatim===!0?{verbatim:!0}:{},...r,...e.diff===!0?{diff:A(i.before,i.after)}:{}}}).reverse().slice(0,Math.max(0,e.limit));return{...n,total:a.length,revisions:s}}l(de,"readHistory");export{O as candidateLocation,G as compareMemoryListKeys,ue as createDoc,pe as deleteDoc,ce as listDocs,C as memoryListKey,W as memoryScopeRank,ye as moveDoc,le as readDoc,de as readHistory,R as requireCanonicalName,U as requireLocalNameInStore,y as requireMountedStore,me as searchDocs,ge as updateDoc};
@@ -1,39 +0,0 @@
1
- import type { MemoryDoc } from '../memory-resolver.js';
2
- /** One canonical directory row: its own document (when it has one) plus its
3
- * immediate members. */
4
- export interface MemoryTreeNode {
5
- /** Exact canonical identity. `''` is the corpus root, which holds no
6
- * document — every store's documents merge beneath it. */
7
- name: string;
8
- /** Sort key among siblings: the stored physical path segment, `NN-` ordering
9
- * prefix retained, or this node's canonical segment when no physical
10
- * segment aligns. */
11
- order: string;
12
- /** The winning document attached to this row, or null for a directory that
13
- * carries none. */
14
- document: MemoryDoc | null;
15
- /** Every physical document sharing this identity, in source order. */
16
- documentCandidates: readonly MemoryDoc[];
17
- /** Immediate children that have members of their own, ordered. Each may also
18
- * carry its own `document`. */
19
- childDirectories: readonly MemoryTreeNode[];
20
- /** Immediate childless members, ordered. A node's own document never appears
21
- * among its children. */
22
- childDocuments: readonly MemoryTreeDocumentNode[];
23
- }
24
- /** A childless node: it exists only because a document landed on it. */
25
- export interface MemoryTreeDocumentNode extends MemoryTreeNode {
26
- document: MemoryDoc;
27
- }
28
- export interface MemoryTree {
29
- root: MemoryTreeNode;
30
- /** The node at an exact canonical name, or null when nothing lives there. */
31
- node(name: string): MemoryTreeNode | null;
32
- /** Does this canonical name have members? True for the corpus root when the
33
- * corpus is non-empty. */
34
- isDirectory(name: string): boolean;
35
- }
36
- /** Merge a precedence-ordered corpus into the canonical tree. Documents sharing
37
- * one identity stay in source order behind that node, so its `document` is the
38
- * address winner. */
39
- export declare function buildMemoryTree(docs: readonly MemoryDoc[]): MemoryTree;
@@ -1 +0,0 @@
1
- var g=Object.defineProperty;var s=(e,n)=>g(e,"name",{value:n,configurable:!0});import{canonicalSegments as a,normalizeNameSegment as y}from"./identity.js";function w(e){const n=a(e.name),o=a(e.physicalRelativePath.replace(/\.md$/i,""));e.representation==="directory-index"&&o.pop();const i=[];for(let c=n.length-1,r=o.length-1;c>=0&&r>=0;c--,r--){const t=o[r];if(y(t)!==n[c])break;i.push([n.slice(0,c+1).join("/"),t])}return i}s(w,"physicalOrderSegments");function f(e){return e.childDirectories.length>0||e.childDocuments.length>0}s(f,"hasMembers");function D(e,n){return e.order.localeCompare(n.order)||e.name.localeCompare(n.name)}s(D,"compareNodes");function M(e){if(e.document===null)throw new Error(`memory tree: ${e.name} has neither a document nor members`);return e}s(M,"asDocumentNode");function p(e,n,o){const i=[...e.children.values()].map(t=>p(t,n,o)).sort(D),c=a(e.name),r={name:e.name,order:n.get(e.name)??c[c.length-1]??"",document:e.documents[0]??null,documentCandidates:e.documents,childDirectories:i.filter(f),childDocuments:i.filter(t=>!f(t)).map(M)};return o.set(r.name,r),r}s(p,"finalize");function b(e){const n={name:"",documents:[],children:new Map},o=new Map;for(const t of e){const l=a(t.name);if(l.length===0)continue;let u=n;for(let m=0;m<l.length;m++){const d=l[m];let h=u.children.get(d);h===void 0&&(h={name:l.slice(0,m+1).join("/"),documents:[],children:new Map},u.children.set(d,h)),u=h}u.documents.push(t);for(const[m,d]of w(t))o.has(m)||o.set(m,d)}const i=new Map,c=p(n,o,i),r=s(t=>i.get(a(t).join("/"))??null,"lookup");return{root:c,node:r,isDirectory:s(t=>{const l=r(t);return l!==null&&f(l)},"isDirectory")}}s(b,"buildMemoryTree");export{b as buildMemoryTree};
@@ -1,280 +0,0 @@
1
- import { type InstalledPlugin, type Scope } from '../types.js';
2
- import type { ProfileProjectMemory } from '../api/dto/profiles.js';
3
- import { type DocRepresentation } from './memory/identity.js';
4
- /**
5
- * Memory-document loading and resolution for the document substrate.
6
- *
7
- * Every document belongs to exactly one physical STORE. A store declares a
8
- * namespace — a project's `namespace:` on its root `INDEX.md`, an installed
9
- * plugin's mount prefix, or empty for user/profile/node/builtin — and every
10
- * document's CANONICAL name is that namespace composed with the document's
11
- * store-local name (see memory/identity.ts). The canonical name is the only
12
- * address: resolution compares the normalized query with canonical identities
13
- * and nothing else. There is no physical-path pass, no bare-leaf pass, no
14
- * scope-prefixed spelling, and no `<dir>/INDEX` address — a trailing `INDEX`
15
- * segment collapses, so a directory's own document answers at the directory
16
- * name and `memory find` is the discovery surface when the name is unknown.
17
- *
18
- * A project store whose repository root carries no valid `namespace:` does not mount: its
19
- * documents are absent from every target view, and its descriptor carries the
20
- * `crtr sys migrate --dir <repository root>` remedy. Exact-store inspection
21
- * (`openProjectMemoryStore` + `loadMemoryStoreView`) still loads it, which is
22
- * what lint and migration diagnose an unmounted store through.
23
- *
24
- * Two views exist over the same loader:
25
- * - a TARGET view — the ordered source stack of one cwd/profile/node
26
- * (node > project stores nearest-first > profile > user > builtin, native
27
- * documents before enabled-plugin documents within each source). Alternate
28
- * physical stores legitimately expose the same canonical identity (a linked
29
- * worktree, a generated copy), so a name yields an ordered CANDIDATE set:
30
- * source order picks the address winner, every later candidate stays
31
- * inspectable.
32
- * - an exact STORE view — one physical project store selected by owner
33
- * directory, which still requires the full canonical query.
34
- *
35
- * Resolution never consults a project store's profile memory ceiling
36
- * (`projectMemory`); the full corpus resolves and lists regardless, and only
37
- * automatic delivery clamps against it.
38
- */
39
- /** The memory-only scope union: the global `Scope` (`user|project|builtin`)
40
- * plus `profile` and `node`. Confined to the memory resolver/list/read/write/
41
- * render paths — deliberately NOT folded into the global `Scope` union, because
42
- * that would leak these into config, plugin, marketplace, and sys-config
43
- * surfaces the spec does not extend. `node` is the this-node store
44
- * (`nodes/<id>/context/memory/`), available only inside a running node
45
- * (`CRTR_NODE_ID`), and it is the NEAREST scope — a node doc overrides a
46
- * same-named doc at any wider scope. */
47
- export type MemoryScope = Scope | 'profile' | 'node';
48
- /** Whether a store contributes to target views.
49
- * `absent` — no `memory/` dir on disk (silent, the ordinary case).
50
- * `undeclared`/`invalid` — a project store the runtime refuses to mount until
51
- * its namespace is declared; `diagnostic` carries the migration remedy. */
52
- export type MemoryStoreMountStatus = 'ready' | 'absent' | 'undeclared' | 'invalid';
53
- /** One physical memory store: where its documents live, what namespace their
54
- * canonical names compose under, and whether it mounts. */
55
- export interface MemoryStoreDescriptor {
56
- scope: MemoryScope;
57
- /** App holding a profile store; absent for legacy local profiles. */
58
- ownerApp?: string;
59
- profileId?: string;
60
- /** Absolute path of the physical `memory/` dir. Store identity (and the
61
- * dedup of one real store reached twice) uses its realpath. */
62
- storeRoot: string;
63
- /** The project directory containing `.crouter/`, for project stores only. */
64
- ownerDir?: string;
65
- /** Effective project prefix, repository-root namespace composed with the
66
- * owner-relative path; installed-plugin mount prefix, or `''`. */
67
- namespace: string;
68
- /** The repository-root `INDEX.md` a project namespace is declared on, when
69
- * association succeeds — present even for an undeclared/invalid store so
70
- * lint and migration can point at it. */
71
- namespacePath?: string;
72
- /** Absolute realpath of the associated repository root, for project stores. */
73
- repositoryRoot?: string;
74
- /** Linked-worktree/non-Git grouping key, for project stores. */
75
- repositoryKey?: string;
76
- /** Valid namespace read from the repository-root declaration. */
77
- repositoryNamespace?: string;
78
- /** Canonical owner path relative to the repository root, empty at the root. */
79
- ownerRelativePath?: string;
80
- /** Structured cause for a project store that does not mount. */
81
- mountFailure?: 'association' | 'collision' | 'undeclared-root' | 'invalid-root' | 'symlink';
82
- /** The owning plugin's name for a plugin-mounted store. Plugin docs surface
83
- * within a source scope but live under the plugins dir and are managed by
84
- * `crtr pkg`, so consumers that mutate the store gate on this. */
85
- plugin?: string;
86
- mountStatus: MemoryStoreMountStatus;
87
- /** Why a non-`ready` store does not mount, with its actionable remedy. */
88
- diagnostic?: string;
89
- /** The selected profile relationship's ceiling for this store: the maximum
90
- * rung AUTOMATIC boot and workspace-open delivery may disclose it at.
91
- * Neutral (`content`) for every non-project store. */
92
- projectMemory: ProfileProjectMemory;
93
- }
94
- export interface MemoryDoc {
95
- /** Canonical identity — the store's namespace composed with `localName`, and
96
- * the only address resolution accepts. */
97
- name: string;
98
- /** Store-local identity: the explicit frontmatter `name` when present, else
99
- * derived from the store-relative path with ordering prefixes stripped and
100
- * one trailing `INDEX` collapsed. Empty for a store's root document. */
101
- localName: string;
102
- scope: MemoryScope;
103
- /** Absolute path to the resolved .md file. */
104
- path: string;
105
- /** Absolute path of the `memory/` dir this doc loaded from — the store root
106
- * its physical path is relative to. Sidecar trees that mirror the doc tree
107
- * (the revision-history log) are derived from `path` relative to this. */
108
- root: string;
109
- /** Store-relative markdown path, kept exactly: placement, ordering, origin,
110
- * and history depend on the physical form, never on segment counts of the
111
- * canonical name. */
112
- physicalRelativePath: string;
113
- /** Which physical form owns this identity — `foo.md` or `foo/INDEX.md`. */
114
- representation: DocRepresentation;
115
- /** The canonical directory this doc's `./` memory-read entries match against:
116
- * its own name for a directory document, its parent for a leaf. */
117
- routingAnchor: string;
118
- store: MemoryStoreDescriptor;
119
- /** Raw, uncoerced frontmatter record (null when the doc has no frontmatter). */
120
- frontmatter: Record<string, unknown> | null;
121
- /** Document body, with the frontmatter block stripped. */
122
- body: string;
123
- plugin?: string;
124
- projectMemory: ProfileProjectMemory;
125
- }
126
- /** Every physical document sharing one canonical identity in a view, in source
127
- * order. `winner` is the address a deliberate read resolves to; automatic
128
- * delivery filters the ordered candidates for its own event eligibility. */
129
- export interface MemoryCandidateSet {
130
- name: string;
131
- winner: MemoryDoc;
132
- candidates: readonly MemoryDoc[];
133
- }
134
- /** Restrict resolution to docs whose resolved kind matches. Threaded INTO
135
- * candidate selection, not applied as a post-filter: a wrong-kind candidate is
136
- * skipped so a nearer one cannot shadow a farther matching-kind document into
137
- * a false not_found. */
138
- export interface MemoryCandidateOpts {
139
- kind?: string;
140
- }
141
- export interface MemoryResolutionOpts extends MemoryCandidateOpts {
142
- /** Restrict resolution to a single scope. Narrows the source stack only — the
143
- * query is still the full canonical name. */
144
- scope?: MemoryScope;
145
- /** Also consult `.crouter/memory` stores discovered BELOW the mounted
146
- * project roots (bounded discovery — see nested-stores.ts). Opt-in for the
147
- * addressing surfaces (`memory read/list/find/lint/delete/origin`); OFF for
148
- * boot render, on-read resolvedDocs, the slash-command snapshot, and
149
- * persona resolution, which stay on the flat ancestor+profile stack. */
150
- includeDescendants?: boolean;
151
- /** Report when bounded descendant discovery omits an owner. Defaults to the inverse of `quiet`, so callers can preserve quiet malformed-document handling while still making an incomplete corpus visible to their caller. */
152
- reportDiscovery?: boolean;
153
- }
154
- /** A loaded corpus and the exact-identity queries over it. */
155
- export interface MemoryView {
156
- /** Every store the view discovered, mounted or not, in precedence order. */
157
- stores: readonly MemoryStoreDescriptor[];
158
- /** Every document of every MOUNTED store, in source order — candidates
159
- * included, so a first-wins dedup by name yields the winners. */
160
- docs: readonly MemoryDoc[];
161
- /** The ordered candidate set for one exact canonical name, or null. */
162
- candidates(name: string, opts?: MemoryCandidateOpts): MemoryCandidateSet | null;
163
- /** One entry per canonical identity, sorted by name. */
164
- candidateSets(opts?: MemoryCandidateOpts): MemoryCandidateSet[];
165
- /** The address winner for one exact canonical name; throws not_found. */
166
- resolve(name: string, opts?: MemoryCandidateOpts): MemoryDoc;
167
- }
168
- export interface MemoryTargetView extends MemoryView {
169
- target: MemoryTarget;
170
- }
171
- export interface MemoryStoreView extends MemoryView {
172
- store: MemoryStoreDescriptor;
173
- }
174
- /** Whose memory view is being resolved: the workspace dir, profile, and node
175
- * id that decide which stores exist and in what order. Ambient resolution
176
- * builds this from the process (`process.cwd()`, `CRTR_PROFILE_ID`,
177
- * `CRTR_NODE_ID`); a TARGET-ADDRESSED caller passes another node's, which is
178
- * what one process serving several nodes needs — crtrd resolving a link on
179
- * behalf of a node, or a warm-spare claim building a node's first-message
180
- * context. The same name can name different documents for different nodes, so
181
- * every scope in the chain (node-local, project stack, profile, user, builtin)
182
- * reads from the target rather than the host process. */
183
- export interface MemoryTarget {
184
- /** The workspace dir the project-scope stack walks up from. */
185
- cwd: string;
186
- /** The selected profile id, or null when none. */
187
- profileId: string | null;
188
- /** The node whose `nodes/<id>/context/memory/` store is the nearest scope,
189
- * or null outside a node. */
190
- nodeId: string | null;
191
- /** App assignment from the selected node's row when outside its broker. */
192
- grantee?: string;
193
- /** Daemon authorization applied before exposing any candidate or store. */
194
- allowsStore?: (store: MemoryStoreDescriptor, name?: string) => boolean;
195
- /** Project roots whose repository is readable in the run's mount set. */
196
- allowsProject?: (repositoryRoot: string) => boolean;
197
- }
198
- /** The target the ambient process describes: cwd + the two env seams every
199
- * profile/node-aware memory path reads through (`CRTR_PROFILE_ID`,
200
- * `CRTR_NODE_ID`). */
201
- export declare function ambientMemoryTarget(): MemoryTarget;
202
- /** The exact project store owned by `ownerDir` — the `--dir` selector's store,
203
- * loaded whatever its mount status so lint and migration can inspect a store
204
- * the runtime refuses to mount. */
205
- export declare function openProjectMemoryStore(ownerDir: string): MemoryStoreDescriptor;
206
- /** Every store a target sees, in precedence order: node, each project store
207
- * nearest-first (its enabled plugins after it), then profile, user, builtin.
208
- * One real store reached twice contributes once, at its first position. */
209
- export declare function memoryStoresInPrecedence(target: MemoryTarget, scope?: MemoryScope, includeDescendants?: boolean, reportDiscovery?: boolean): MemoryStoreDescriptor[];
210
- /** The native (non-plugin) MOUNTED store dirs in resolution precedence.
211
- * Addresses a store directly when the document itself may be absent, which is
212
- * how a DELETED doc's revision log is still found: history outlives the doc,
213
- * so its lookup cannot go through document resolution. */
214
- export declare function nativeMemoryStoresInPrecedence(scope?: MemoryScope, includeDescendants?: boolean): {
215
- scope: MemoryScope;
216
- memoryDir: string;
217
- store: MemoryStoreDescriptor;
218
- }[];
219
- /** Every document in one store, sorted by canonical identity. SKILL.md bundles
220
- * are Agent Skills, not memory docs. Enumeration stops at a nested `.crouter/`:
221
- * that is another store's mount point, never this store's content. */
222
- export declare function loadStoreMemoryDocs(store: MemoryStoreDescriptor, quiet?: boolean): MemoryDoc[];
223
- /** All of one plugin's substrate docs, mounted under the plugin's own name:
224
- * each doc's store-local name (explicit or path-derived) composes under that
225
- * mount prefix. */
226
- export declare function listPluginMemoryDocs(plugin: InstalledPlugin, scope: MemoryScope, quiet?: boolean, projectMemory?: ProfileProjectMemory): MemoryDoc[];
227
- /** Load one target's whole corpus: every mounted store's documents in source
228
- * order. A project store that does not mount is reported once (unless quiet)
229
- * with its migration remedy and contributes nothing. */
230
- export declare function loadMemoryTargetView(target: MemoryTarget, opts?: MemoryResolutionOpts & {
231
- quiet?: boolean;
232
- }): MemoryTargetView;
233
- /** Load ONE exact physical store. An undeclared/invalid project store loads
234
- * under the empty namespace so lint and migration can inspect what it holds;
235
- * no target view ever sees those documents. */
236
- export declare function loadMemoryStoreView(store: MemoryStoreDescriptor, quiet?: boolean, target?: MemoryTarget): MemoryStoreView;
237
- /** All project-scoped docs visible from an explicit node workspace/profile — the
238
- * project-only slice of a `MemoryTarget` view, used where only workspace docs
239
- * are wanted (a workspace-open render). For a full-precedence target-addressed
240
- * lookup, use `resolveMemoryDocForTarget`. */
241
- export declare function listProjectMemoryDocs(startDir?: string, profileId?: string | null, quiet?: boolean): MemoryDoc[];
242
- /** All memory docs across the resolved sources, in precedence order: each
243
- * ancestor project `.crouter/` from nearest to farthest, then the selected
244
- * profile's memory (if any), then user, then builtin. Within each source,
245
- * native docs are emitted before enabled-plugin docs, and equal-canonical
246
- * candidates stay in source order, so a caller's first-wins dedup yields the
247
- * address winners. */
248
- export declare function listAllMemoryDocs(scope?: MemoryScope, quiet?: boolean, includeDescendants?: boolean): MemoryDoc[];
249
- export interface MemoryDocSnapshot {
250
- /** Every document in default scope precedence order, loaded once. */
251
- docs: readonly MemoryDoc[];
252
- /** Resolve names against that source snapshot; failures are omitted so
253
- * callers can retain their own per-document error behavior. */
254
- resolve(names: readonly string[]): Map<string, MemoryDoc>;
255
- }
256
- export declare function createMemoryDocSnapshot(target?: MemoryTarget): MemoryDocSnapshot;
257
- /** Resolve several canonical names over one memory-source snapshot. Failed
258
- * names are omitted so callers can preserve their per-document error behavior. */
259
- export declare function resolveMemoryDocs(names: readonly string[]): Map<string, MemoryDoc>;
260
- /** The address winner for an exact canonical name in the ambient target. */
261
- export declare function resolveMemoryDoc(rawName: string, opts?: MemoryResolutionOpts): MemoryDoc;
262
- /** Resolve a memory document as ANOTHER node would see it — the same precedence
263
- * chain (node-local > project stack > profile > user > builtin), read from the
264
- * target's cwd/profile/node rather than the host process's. This is what crtrd
265
- * resolves a `[[name]]` link through: the daemon's own cwd and env name no
266
- * node, and the same name can be a different document for two nodes. */
267
- export declare function resolveMemoryDocForTarget(rawName: string, target: MemoryTarget, opts?: MemoryResolutionOpts): MemoryDoc;
268
- /** Every physical candidate for an exact canonical name in the ambient target,
269
- * in source order — what path-aware inventory, diagnostics, and automatic
270
- * event eligibility consume instead of the winner alone. */
271
- export declare function resolveMemoryCandidates(rawName: string, opts?: MemoryResolutionOpts): MemoryCandidateSet;
272
- export declare function resolveMemoryCandidatesForTarget(rawName: string, target: MemoryTarget, opts?: MemoryResolutionOpts): MemoryCandidateSet;
273
- /** The address winner for an exact canonical name inside ONE project store —
274
- * the `--dir` selector's resolution. The query is still the full canonical
275
- * name, including that store's namespace. */
276
- export declare function resolveMemoryDocInStore(rawName: string, store: MemoryStoreDescriptor, opts?: MemoryCandidateOpts): MemoryDoc;
277
- /** Resolve PHYSICAL path segments against a `.history` tree, which mirrors the
278
- * doc tree segment for segment with `.jsonl` in place of `.md`. A log outlives
279
- * its document, so this lookup cannot go through document resolution. */
280
- export declare function resolveHistoryLogPath(historyDir: string, segments: string[]): string | null;
@@ -1,2 +0,0 @@
1
- var W=Object.defineProperty;var c=(e,o)=>W(e,"name",{value:o,configurable:!0});import{envGrantee as G,envNodeId as V,envProfileId as H}from"../shared/env.js";import{dirname as x,join as y,relative as J,sep as Q}from"node:path";import{readdirSync as U}from"node:fs";import{CRTR_DIR_NAME as F}from"../types.js";import{realpathOrSelf as $}from"./fs-utils.js";import{existsBeneath as X,isBeneathRefusal as Y,readFileBeneath as Z,readTextBeneathIfExists as ee,walkFilesBeneath as oe}from"./spaces/open-beneath.js";import{parseFrontmatterGeneric as k}from"./frontmatter.js";import{listInstalledPlugins as ne,listInstalledPluginsInRoot as te}from"./resolver.js";import{notFound as re,usage as N}from"./errors.js";import{warn as j}from"./output.js";import{NEUTRAL_PROJECT_MEMORY as h,pluginMemoryDir as ie,projectScopeRoots as ae,projectScopeRootsWithMemory as se,scopeMemoryDir as ce}from"./scope.js";import{effectiveDocKind as b}from"./substrate/schema.js";import{INDEX_SEGMENT as w,canonicalSegments as E,composeCanonicalName as T,localNameFromPath as ue,normalizeNameSegment as C,representationForPath as le,resolveLocalName as me,routingAnchorFor as de,validateNamespace as fe}from"./memory/identity.js";import{loadProfileManifest as A,profileMemoryDir as pe}from"./profiles/manifest.js";import{memoryDir as ye}from"./runtime/memory.js";import{descendantStoreRoots as he}from"./nested-stores.js";import{associateRepository as ge}from"./memory/repository-association.js";import{appSpace as we}from"./layout.js";function g(){return{cwd:process.cwd(),profileId:H()||null,nodeId:V()||null,grantee:G()||void 0}}c(g,"ambientMemoryTarget");function ve(){return g().profileId??""}c(ve,"selectedProfileId");function Se(e,o){if(o)return[o];const n=[];return e.nodeId&&n.push("node"),ae(e.cwd,e.profileId).length>0&&n.push("project"),e.profileId&&n.push("profile"),n.push("user"),n.push("builtin"),n}c(Se,"scopesInPrecedence");function L(e,o,n){const t={scope:"project",storeRoot:o,ownerDir:e,projectMemory:n},r=R(o);if(r.mountStatus!=="ready")return{...t,namespace:"",...r};const i=ge(e);if(!i.ok){const p=`run \`crtr sys migrate --dir ${e}\``;return i.code==="no-project-root"?{...t,namespace:"",mountStatus:"undeclared",mountFailure:"association",diagnostic:`project memory store at ${o} has no repository root declaring \`namespace:\` \u2014 ${p}`}:{...t,namespace:"",mountStatus:"invalid",mountFailure:"association",diagnostic:`project memory store at ${o} cannot be associated: ${i.reason} \u2014 ${p}`}}const{association:s}=i,u={namespacePath:s.declarationPath,repositoryRoot:s.repositoryRoot,repositoryKey:s.repositoryKey,ownerRelativePath:s.ownerRelativePath},m=s.declarationPath,a=s.ownerRelativePath!=="",l=`run \`crtr sys migrate --dir ${s.repositoryRoot}\``,f=a?`nested project memory store at ${o} takes its identity from ${m}, which is missing root ${w}.md declaring \`namespace:\` \u2014 ${l}`:`project memory store has no root ${w}.md declaring \`namespace:\` \u2014 ${l}`;let d;try{const p=ee(x(m),m);if(p===null)return{...t,...u,namespace:"",mountStatus:"undeclared",mountFailure:"undeclared-root",diagnostic:f};d=k(p).data?.namespace}catch(p){return{...t,...u,namespace:"",mountStatus:"invalid",mountFailure:"invalid-root",diagnostic:`project memory store's ${m} does not parse (${z(p)}) \u2014 ${l}`}}if(d==null||d===""){const p=a?`nested project memory store at ${o} takes its identity from ${m}, which declares no \`namespace:\` \u2014 ${l}`:`project memory store's ${m} declares no \`namespace:\` \u2014 ${l}`;return{...t,...u,namespace:"",mountStatus:"undeclared",mountFailure:"undeclared-root",diagnostic:p}}if(typeof d!="string")return{...t,...u,namespace:"",mountStatus:"invalid",mountFailure:"invalid-root",diagnostic:`project memory store declares a non-string \`namespace:\` (${JSON.stringify(d)}) \u2014 quote it in ${m}, or ${l}`};const v=fe(d);return v.ok?{...t,...u,repositoryNamespace:d,namespace:T(d,s.ownerRelativePath),mountStatus:"ready"}:{...t,...u,namespace:"",mountStatus:"invalid",mountFailure:"invalid-root",diagnostic:`project memory store declares an invalid namespace \`${d}\` (${v.reason}) \u2014 ${l}`}}c(L,"projectStoreDescriptor");function R(e){try{return{mountStatus:X(e,e)?"ready":"absent"}}catch(o){if(!Y(o))throw o;return{mountStatus:"invalid",mountFailure:"symlink",diagnostic:`memory store at ${e} is reached through a symlink, which never mounts`}}}c(R,"storeRootMount");function M(e,o){return o===null?{scope:e,storeRoot:"",namespace:"",mountStatus:"absent",projectMemory:h}:{scope:e,storeRoot:o,namespace:"",...R(o),projectMemory:h}}c(M,"plainStoreDescriptor");function I(e,o,n){const t=$(ie(e));return{scope:o,storeRoot:t,namespace:e.name,plugin:e.name,...R(t),projectMemory:n}}c(I,"pluginStoreDescriptor");function Ve(e){const o=$(e);return L(o,y(o,F,"memory"),h)}c(Ve,"openProjectMemoryStore");function q(e,o,n=!1,t=!0){const r=[],i=c((a,l)=>{r.push(L(x(a),y(a,"memory"),l));for(const f of te("project",a).filter(d=>d.enabled))r.push(I(f,"project",l))},"projectStores");for(const a of Se(e,o))if(a==="project"){const l=se(e.cwd,e.profileId);for(const{root:f,memory:d}of l)i(f,d);if(n)for(const f of he(l.map(({root:d})=>d),t))i(f,h)}else if(a==="profile"){const l=e.profileId??"";if(l!=="")try{const{profileId:f}=A(l),{manifest:d}=A(f),v=d.grantee?.startsWith("app:")?y(we(d.grantee).memory,"profiles",f):pe(f);r.push({...M("profile",v),profileId:f,ownerApp:d.grantee})}catch{}}else if(a==="node"){const l=e.nodeId??"";l!==""&&r.push({...M("node",ye(l,e.grantee)),ownerApp:e.grantee})}else{r.push(M(a,ce(a)));for(const l of ne(a).filter(f=>f.enabled))r.push(I(l,a,h))}const s=new Set,u=r.filter(a=>{if(a.storeRoot==="")return!1;const l=$(a.storeRoot);return s.has(l)?!1:(s.add(l),!0)}),m=new Map;for(const a of u){if(a.scope!=="project"||a.mountStatus!=="ready"||a.repositoryRoot===void 0||a.ownerRelativePath===void 0)continue;const l=`${a.repositoryRoot}\0${a.ownerRelativePath}`,f=m.get(l);f?f.push(a):m.set(l,[a])}return u.filter(a=>(a.scope!=="project"||a.repositoryRoot===void 0||e.allowsProject?.(a.repositoryRoot)!==!1)&&e.allowsStore?.(a)!==!1).map(a=>{if(a.scope!=="project"||a.mountStatus!=="ready"||a.repositoryRoot===void 0||a.ownerRelativePath===void 0)return a;const l=m.get(`${a.repositoryRoot}\0${a.ownerRelativePath}`);if(l===void 0||l.length<2)return a;const f=l.map(d=>d.ownerDir??d.storeRoot).join(", ");return{...a,mountStatus:"invalid",mountFailure:"collision",diagnostic:`project memory stores at ${f} normalize to the same effective prefix \`${a.namespace}\` \u2014 rename one owner directory`}})}c(q,"memoryStoresInPrecedence");function He(e,o=!1){return q(g(),e,o).filter(n=>n.mountStatus==="ready"&&n.scope!=="builtin"&&n.plugin===void 0).map(n=>({scope:n.scope,memoryDir:n.storeRoot,store:n}))}c(He,"nativeMemoryStoresInPrecedence");function z(e){return(e instanceof Error?e.message:String(e)).split(`
2
- `)[0]??""}c(z,"firstLine");function $e(e,o,n){const{data:t,body:r}=k(Z(e.storeRoot,o).toString("utf8")),i=ue(n),s=le(n),u=i===""?"":me(t,i),m=T(e.namespace,u);return m===""?null:{name:m,localName:u,scope:e.scope,path:o,root:e.storeRoot,physicalRelativePath:n,representation:s,routingAnchor:de(m,s),store:e,frontmatter:t,body:r,projectMemory:e.projectMemory,...e.plugin===void 0?{}:{plugin:e.plugin}}}c($e,"loadMemoryDoc");function je(e,o){const n=e.name.localeCompare(o.name);return n!==0?n:e.representation!==o.representation?e.representation==="directory-index"?-1:1:e.physicalRelativePath.localeCompare(o.physicalRelativePath)}c(je,"compareDocs");function P(e,o=!1){if(e.storeRoot===""||e.mountFailure==="symlink")return[];const n=[];for(const t of oe(e.storeRoot,e.storeRoot,r=>r.endsWith(".md")&&r!=="SKILL.md",r=>r===F)){const r=J(e.storeRoot,t).split(Q).join("/");try{const i=$e(e,t,r);if(i===null){o||j(`${t}: a root ${w}.md has no canonical name in a store without a namespace`);continue}n.push(i)}catch(i){o||j(`invalid frontmatter in ${t}: ${z(i)}`)}}return n.sort(je)}c(P,"loadStoreMemoryDocs");function Je(e,o,n=!1,t=h){return P(I(e,o,t),n)}c(Je,"listPluginMemoryDocs");function D(e){return E(e.trim()).join("/")}c(D,"normalizeQuery");function B(e,o,n){const t=E(o),r=t[t.length-1]===w;r&&t.pop();const i=t[t.length-1]??o,s=r?`A directory's own document answers at the directory name \u2014 drop the trailing /${w}. Run \`crtr memory find ${i}\` to find the canonical name.`:`Resolution takes the full canonical name (a project doc is <namespace>/<local name>). Run \`crtr memory find ${i}\` to find it.`;return re(`memory document not found: ${e}`,{memory:o,...n?{scope:n}:{},next:s})}c(B,"notFoundError");function _(e,o,n){const t=c((r,i)=>{const s=D(r);if(s==="")return null;const u=i?.kind,m=o.filter(a=>a.name===s&&(u===void 0||b(a)===u));return m.length===0?null:{name:s,winner:m[0],candidates:m}},"candidatesFor");return{stores:e,docs:o,candidates:t,candidateSets(r){const i=r?.kind,s=new Map;for(const u of o){if(i!==void 0&&b(u)!==i)continue;const m=s.get(u.name);m?m.push(u):s.set(u.name,[u])}return[...s.entries()].sort(([u],[m])=>u.localeCompare(m)).map(([u,m])=>({name:u,winner:m[0],candidates:m}))},resolve(r,i){const s=D(r);if(s==="")throw N("memory document name required");const u=t(s,i);if(u===null)throw B(r,s,n);return u.winner}}}c(_,"makeView");function S(e,o={}){const n=o.quiet??!1,t=q(e,o.scope,o.includeDescendants??!1,o.reportDiscovery??!n),r=[];for(const i of t)if(i.mountStatus!=="absent"){if(i.mountStatus!=="ready"){!n&&i.diagnostic!==void 0&&j(`memory store not mounted: ${i.diagnostic}`);continue}r.push(...P(i,n).filter(s=>e.allowsStore?.(i,s.name)!==!1))}return{target:e,..._(t,r,o.scope)}}c(S,"loadMemoryTargetView");function Re(e,o=!1,n){const t=P(e,o).filter(r=>n?.allowsStore?.(e,r.name)!==!1);return{store:e,..._([e],t)}}c(Re,"loadMemoryStoreView");function Qe(e=process.cwd(),o=ve()||null,n=!1){return[...S({cwd:e,profileId:o,nodeId:null},{scope:"project",quiet:n}).docs]}c(Qe,"listProjectMemoryDocs");function Ue(e,o=!1,n=!1){return[...S(g(),{...e?{scope:e}:{},quiet:o,includeDescendants:n}).docs]}c(Ue,"listAllMemoryDocs");function Me(e=g()){const o=S(e,{quiet:!0});return{docs:o.docs,resolve:c(n=>{const t=new Map;for(const r of n){const i=o.candidates(r);i!==null&&t.set(r,i.winner)}return t},"resolve")}}c(Me,"createMemoryDocSnapshot");function Xe(e){return Me().resolve(e)}c(Xe,"resolveMemoryDocs");function Ye(e,o={}){return Ie(e,g(),o)}c(Ye,"resolveMemoryDoc");function Ie(e,o,n={}){return K(e,o,n).winner}c(Ie,"resolveMemoryDocForTarget");function Ze(e,o={}){return K(e,g(),o)}c(Ze,"resolveMemoryCandidates");function K(e,o,n={}){const t=S(o,{...n,quiet:!0}),r=D(e);if(r==="")throw N("memory document name required");const i=t.candidates(r,n);if(i===null)throw B(e,r,n.scope);return i}c(K,"resolveMemoryCandidatesForTarget");function eo(e,o,n={}){return Re(o,!0).resolve(e,n)}c(eo,"resolveMemoryDocInStore");function O(e,o,n,t=".md"){let r;try{r=U(e,{withFileTypes:!0})}catch{return null}let i=null;for(const s of r)if(n==="dir"){if(!s.isDirectory())continue;if(s.name===o)return y(e,s.name);i===null&&C(s.name)===o&&(i=y(e,s.name))}else{if(!(s.isFile()&&s.name.endsWith(t)))continue;const u=s.name.slice(0,-t.length);if(u===o)return y(e,s.name);i===null&&C(u)===o&&(i=y(e,s.name))}return i}c(O,"matchNormalizedChild");function Pe(e,o,n){let t=e;for(let r=0;r<o.length-1;r++){const i=O(t,o[r],"dir",n);if(!i)return null;t=i}return O(t,o[o.length-1],"file",n)}c(Pe,"resolveNormalizedFile");function oo(e,o){return o.length===0?null:Pe(e,o,".jsonl")}c(oo,"resolveHistoryLogPath");export{g as ambientMemoryTarget,Me as createMemoryDocSnapshot,Ue as listAllMemoryDocs,Je as listPluginMemoryDocs,Qe as listProjectMemoryDocs,Re as loadMemoryStoreView,S as loadMemoryTargetView,P as loadStoreMemoryDocs,q as memoryStoresInPrecedence,He as nativeMemoryStoresInPrecedence,Ve as openProjectMemoryStore,oo as resolveHistoryLogPath,Ze as resolveMemoryCandidates,K as resolveMemoryCandidatesForTarget,Ye as resolveMemoryDoc,Ie as resolveMemoryDocForTarget,eo as resolveMemoryDocInStore,Xe as resolveMemoryDocs};
@@ -1,18 +0,0 @@
1
- export declare function descendantStoreDiscoveryWarnings(ancestorRoots: string[]): string[];
2
- /**
3
- * Every `.crouter` store root strictly BELOW the given ancestor roots' owning
4
- * dirs, in owner order then discovery order. Takes the `projectScopeRoots()`
5
- * entries themselves (`.crouter` dir paths) and derives owner dirs internally.
6
- *
7
- * Any discovered root whose realpath matches an INPUT root is excluded here,
8
- * inside the function: a profile can manage both `/a` and `/a/b`, making
9
- * `/a/b/.crouter` simultaneously an ancestor root and a descendant of `/a` —
10
- * excluding centrally gives the resolver and lint the identical call with no
11
- * duplicated dedupe logic.
12
- */
13
- export declare function descendantStoreRoots(ancestorRoots: string[], reportBudgetExceeded?: boolean, warnings?: string[]): string[];
14
- /** Complete descendant-store discovery for state migrations. Unlike the
15
- * interactive addressing lane, this filesystem walk has no time or depth
16
- * budget, crosses embedded repositories, admits plugin-only `.crouter` roots,
17
- * and does not cache. */
18
- export declare function descendantStoreRootsExhaustive(ancestorRoots: string[]): string[];
@@ -1 +0,0 @@
1
- var D=Object.defineProperty;var a=(t,r)=>D(t,"name",{value:r,configurable:!0});import{readdirSync as E}from"node:fs";import{dirname as x,join as f,sep as R}from"node:path";import{CRTR_DIR_NAME as l}from"../types.js";import{pathExists as p,realpathOrSelf as m}from"./fs-utils.js";import{gitSync as _}from"./git.js";import{warn as v}from"./output.js";const O=new Set(["node_modules",".git","dist","build",".next",".cache",".yalc",".venv"]),T=6,h=500;function C(t){const r=[];return b(t,!1,r),r}a(C,"descendantStoreDiscoveryWarnings");function b(t,r=!0,o=[]){const i=new Set(t.map(s=>m(s))),c=[],d=new Set;for(const s of t){const u=x(s),y=m(u);d.has(y)||(d.add(y),c.push(u))}const e=a(s=>{const u=`memory: nested-store discovery under ${s} exceeded its ${h}ms budget \u2014 this result may omit nested stores. To read a document from a known nested store, pass its owner as \`--dir <owner>\`; that exact-store read bypasses discovery.`;o.push(u),r&&v(u)},"tripBudget"),n=[],w=new Set,S=a(s=>{const u=m(s);w.has(u)||i.has(u)||(w.add(u),n.push(s))},"add");for(const s of c)p(f(s,".git"))?k(s,S,h,()=>e(s)):M(s,S,Date.now()+h,()=>e(s));return n}a(b,"descendantStoreRoots");function k(t,r,o,i){const c=`/${l}/memory/`,d=_(["-C",t,"ls-files","-z","-co","--exclude-standard","--",`*/${l}/memory/*`],void 0,void 0,{timeoutMs:o});if(d.timedOut===!0){i();return}if(d.status===0)for(const e of d.stdout.split("\0")){if(e==="")continue;const n=e.indexOf(c);n<=0||r(f(t,e.slice(0,n).split("/").join(R),l))}}a(k,"collectGitStores");function M(t,r,o,i){g(t,r,{deadline:o,maxDepth:T,trip:i})}a(M,"collectWalkStores");function g(t,r,o={}){const i=[{dir:t,depth:0}];for(;i.length>0;){if(o.deadline!==void 0&&Date.now()>o.deadline){o.trip?.();return}const{dir:c,depth:d}=i.pop();if(c!==t){if(o.crossEmbeddedRepos!==!0&&p(f(c,".git")))continue;const n=f(c,l);p(o.includePluginOnly===!0?n:f(n,"memory"))&&r(n)}if(o.maxDepth!==void 0&&d>=o.maxDepth)continue;let e;try{e=E(c,{withFileTypes:!0})}catch{continue}for(const n of e)n.isDirectory()&&(O.has(n.name)||n.name===l||i.push({dir:f(c,n.name),depth:d+1}))}}a(g,"collectWalkStoresFromOwner");function F(t){const r=new Set(t.map(e=>m(e))),o=[],i=new Set,c=a(e=>{const n=m(e);i.has(n)||r.has(n)||(i.add(n),o.push(e))},"add"),d=new Set(t.map(e=>m(x(e))));for(const e of d)g(e,c,{includePluginOnly:!0,crossEmbeddedRepos:!0});return o}a(F,"descendantStoreRootsExhaustive");export{C as descendantStoreDiscoveryWarnings,b as descendantStoreRoots,F as descendantStoreRootsExhaustive};
@@ -1,3 +0,0 @@
1
- /** The node-local memory directory in a node's context dir — holds substrate
2
- * docs (.md files with kind/when/why frontmatter). */
3
- export declare function memoryDir(nodeId: string, grantee?: string): string;
@@ -1 +0,0 @@
1
- var e=Object.defineProperty;var m=(r,o)=>e(r,"name",{value:o,configurable:!0});import{join as p}from"node:path";import{appSpace as i}from"../layout.js";function a(r,o){if(!o)throw new Error(`memory store for ${r} requires an app`);return p(i(o).memory,"nodes",r)}m(a,"memoryDir");export{a as memoryDir};
@@ -1,11 +0,0 @@
1
- import { type SurfaceEntry } from './schema.js';
2
- export declare const SUPPRESSIBLE_RULES: readonly string[];
3
- /** Strict validation of one raw routing entry. Runtime parsing deliberately
4
- * tolerates malformed docs; this authoring/preflight contract does not. */
5
- export declare function lintSubstrateSurfaces(value: unknown): string | null;
6
- /** Strict substrate frontmatter checker shared by lint and package preflight. */
7
- export declare function lintSubstrateFrontmatter(fm: Record<string, unknown> | null): string | null;
8
- /** Compatibility name for consumers that adopted lint's former export. */
9
- export declare const lintSubstrateSchema: typeof lintSubstrateFrontmatter;
10
- /** Parsed routing entries for checks that run after strict validation. */
11
- export declare function parsedSubstrateSurfaces(fm: Record<string, unknown>): SurfaceEntry[];
@@ -1 +0,0 @@
1
- var g=Object.defineProperty;var s=(e,n)=>g(e,"name",{value:n,configurable:!0});import{isDocKind as m,parseSubstrateFrontmatter as b,PRIVACY_LEVELS as y,SURFACE_EVENTS as f,SURFACE_RUNGS as h}from"./schema.js";const S=["system-prompt-visibility","file-read-visibility","applies-to","read-when"],v=["on","match","match-frontmatter","gate","at"],p=["length","broad-memory-read","orphan"];function $(e){if(e===void 0)return null;if(!Array.isArray(e))return`invalid surfaces: ${JSON.stringify(e)} (expected a list of {on, at, match?, match-frontmatter?, gate?} entries)`;for(const n of e){if(n===null||typeof n!="object"||Array.isArray(n))return`invalid surfaces entry: ${JSON.stringify(n)} (expected an {on, at, match?, match-frontmatter?, gate?} object)`;const r=n;for(const i of Object.keys(r))if(!v.includes(i))return`invalid surfaces entry: unknown key \`${i}\` (an entry carries only on, match, match-frontmatter, gate, at)`;const t=r.on;if(typeof t!="string"||!f.includes(t))return`invalid surfaces entry \`on\`: ${JSON.stringify(t)} (expected ${f.join("|")})`;const c=r.at;if(typeof c!="string"||!h.includes(c))return`invalid surfaces entry \`at\`: ${JSON.stringify(c)} (expected ${h.join("|")})`;let u=!1;if(r.match!==void 0){if(t==="boot"||t==="workspace-open")return`invalid surfaces entry: \`match\` is meaningless on \`${t}\` \u2014 the entry's presence is the match; drop it`;const i=r.match,d=typeof i=="string"?[i]:Array.isArray(i)&&i.every(l=>typeof l=="string")?i:null;if(d===null||d.length===0||d.some(l=>l.trim()===""))return`invalid surfaces entry \`match\`: ${JSON.stringify(i)} (expected a non-empty glob or non-empty glob list)`;u=!0}const a=r["match-frontmatter"];if(a!==void 0){if(t!=="read")return"invalid surfaces entry: `match-frontmatter` is a `read`-event predicate only";if(a===null||typeof a!="object"||Array.isArray(a))return`invalid surfaces entry \`match-frontmatter\`: ${JSON.stringify(a)} (expected a field\u2192matcher object)`}if((t==="read"||t==="memory-read"||t==="command"||t==="pre-command")&&!u&&a===void 0)return`invalid surfaces entry: a \`${t}\` entry requires \`match\`${t==="read"?" or `match-frontmatter`":""}`;const o=r.gate;if(o!==void 0&&(o===null||typeof o!="object"||Array.isArray(o)))return`invalid surfaces entry \`gate\`: ${JSON.stringify(o)} (expected a field\u2192matcher object)`}return null}s($,"lintSubstrateSurfaces");function w(e){if(e===null)return"missing frontmatter: a memory store doc requires `kind: knowledge|preference`";if(!m(e.kind))return`invalid kind: ${JSON.stringify(e.kind)} (expected knowledge|preference)`;if("when"in e||"why"in e)return'retired `when`/`why` keys: merge them into one `when-and-why-to-read` line \u2014 "When <circumstance>, this <kind> should be read because <broader downstream payoff>." WHY is the benefit unlocked by reading, not the document summary, rule, or obedience rationale.';if(typeof e["when-and-why-to-read"]!="string"||e["when-and-why-to-read"].trim()==="")return'missing `when-and-why-to-read`: one routing line \u2014 "When <circumstance>, this <kind> should be read because <broader downstream payoff>." WHY is the benefit unlocked by reading, not the document summary, rule, or obedience rationale.';for(const r of S)if(r in e)return`retired \`${r}\` key: the visibility axes were replaced by \`surfaces\` event routing \u2014 run \`crtr sys migrate\` to convert old-format docs, or author \`surfaces\` entries by hand (\`crtr memory write -h\`)`;if("privacy"in e&&!y.includes(e.privacy))return`invalid privacy: ${JSON.stringify(e.privacy)} (expected ${y.join("|")})`;if(e.unlisted!==void 0&&typeof e.unlisted!="boolean")return`invalid unlisted: ${JSON.stringify(e.unlisted)} (expected a boolean)`;const n=$(e.surfaces);if(n!==null)return n;if(e.gate!==void 0&&(e.gate===null||typeof e.gate!="object"||Array.isArray(e.gate)))return`invalid gate: ${JSON.stringify(e.gate)} (expected a field\u2192matcher object)`;if(e.slash!==void 0&&typeof e.slash!="boolean")return`invalid slash: ${JSON.stringify(e.slash)} (expected a boolean)`;if(e.rationale!==void 0&&typeof e.rationale!="string")return`invalid rationale: ${JSON.stringify(e.rationale)} (expected a string)`;if(e["lint-ignore"]!==void 0){const r=Array.isArray(e["lint-ignore"])?e["lint-ignore"]:[e["lint-ignore"]];if(r.length===0||!r.every(t=>typeof t=="string"&&p.includes(t)))return`invalid lint-ignore: ${JSON.stringify(e["lint-ignore"])} (suppressible rules: ${p.map(t=>`\`${t}\``).join(", ")})`}return null}s(w,"lintSubstrateFrontmatter");const k=w;function N(e){return b(e)?.surfaces??[]}s(N,"parsedSubstrateSurfaces");export{p as SUPPRESSIBLE_RULES,w as lintSubstrateFrontmatter,k as lintSubstrateSchema,$ as lintSubstrateSurfaces,N as parsedSubstrateSurfaces};
@@ -1,16 +0,0 @@
1
- import type { SubstrateDoc, SurfaceEntry } from './schema.js';
2
- import type { NodeConfigSubject } from './subject-fields.js';
3
- /** Does `doc` pass its gate for `subject`?
4
- *
5
- * - No gate (field absent) ⇒ `true`: always eligible (the common case).
6
- * - A gate present ⇒ the matcher engine's verdict. An empty `gate: {}` is inert
7
- * and returns `false` (never matches) per design §4 — so an author cannot
8
- * write an always-eligible-via-empty-predicate doc.
9
- *
10
- * Eligibility only. A failing gate excludes the doc from BOTH automatic hooks
11
- * for this node; it remains findable by `crtr memory find` (search ignores
12
- * gate + rung). */
13
- export declare function gatePasses(doc: SubstrateDoc, subject: NodeConfigSubject): boolean;
14
- /** Does a surface entry participate for `subject`? A missing subject cannot
15
- * satisfy an entry gate; entries without one remain eligible. */
16
- export declare function surfaceEntryGatePasses(entry: Pick<SurfaceEntry, 'gate'>, subject: NodeConfigSubject | null): boolean;
@@ -1 +0,0 @@
1
- var a=Object.defineProperty;var n=(e,t)=>a(e,"name",{value:t,configurable:!0});import{evalCondition as r}from"../predicate.js";function f(e,t){return e.gate===void 0?!0:r(e.gate,t)}n(f,"gatePasses");function o(e,t){return e.gate===void 0||t!==null&&r(e.gate,t)}n(o,"surfaceEntryGatePasses");export{f as gatePasses,o as surfaceEntryGatePasses};
@@ -1,18 +0,0 @@
1
- export { KINDS, isDocKind, RUNGS, rungRank, rungAtLeast, SURFACE_EVENTS, SURFACE_RUNGS, parseSubstrateFrontmatter, parseSubstrateDoc, previewLine, normalizeNameSegment, normalizeDocName, resolveDocName, } from './schema.js';
2
- export type { DocKind, Rung, GatePredicate, SubstrateSchema, SubstrateDoc, SurfaceEntry, SurfaceEvent, SurfaceRung } from './schema.js';
3
- export { lintSubstrateFrontmatter, lintSubstrateSchema, lintSubstrateSurfaces, parsedSubstrateSurfaces } from './frontmatter-validation.js';
4
- export { matchesReadEntry, matchesMemoryReadEntry, matchesCommandEntry, readDeliveryRung, workspaceOpenRung, memoryReadDeliveryRung, commandDeliveryRung, matchingSurfaceEntry, surfaceEntryParticipates, owningRootOf, underOwningRoot } from './surface-match.js';
5
- export type { SurfaceMatchPayload } from './surface-match.js';
6
- export { planDelivery, bootPartitionOf } from './plan.js';
7
- export type { DeliveryPlan, DeliveryRecord, DeliveryPayload, EntryDecision, GateOutcome } from './plan.js';
8
- export { dirDedupKey, docsByName, isDirName, ancestorDirsOf, renderDirListing } from './listings.js';
9
- export { clearContextExposureState, cloneContextExposureState, cloneTranscriptExposureState, contentExposureIdentity, contextExposureStatesEqual, documentExposedAtOrAbove, emptyContextExposureState, exposedAtOrAbove, exposureTarget, freezePreferenceSnapshot, hasTranscriptExposure, initializeForkContextExposure, loadContextExposureState, mergeContextExposureState, registerDocumentExposure, registerExposure, replaceContextExposureState, saveContextExposureState, sharedContextExposureState, } from './injected-store.js';
10
- export type { ContextExposureState, ExposureSource, ExposureTarget } from './injected-store.js';
11
- export { scopeForCwd, profileNameFor } from './subject-fields.js';
12
- export type { NodeConfigSubject } from './subject-fields.js';
13
- export { spineDepth, assembleNodeSubject } from './subject.js';
14
- export { gatePasses } from './gate.js';
15
- export { renderPreferencesForSubject, renderKnowledgeForSubject } from './render.js';
16
- export { renderPreferencesSection, renderKnowledgeBlock } from './render-node.js';
17
- export { renderOnReadDocsForSubject, renderWorkspaceOpenDocsForSubject, renderOnCommandDocsForSubject, memoryReadDocBlocks } from './on-read.js';
18
- export { renderOnReadDocs, renderWorkspaceOpenDocs } from './on-read-node.js';