@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,5 +0,0 @@
1
- var l=Object.defineProperty;var s=(n,o)=>l(n,"name",{value:o,configurable:!0});import{defineLeaf as f}from"../../core/command.js";import{memoryQuery as m,memoryRequest as h,memorySelection as u}from"./client.js";import{renderResult as p}from"../../core/render.js";import{selectorParam as d}from"./shared.js";const y=f({name:"history",description:"read a memory document\u2019s revision history",whenToUse:"you want to know how a document reached its current state \u2014 who revised it, when, why, and what changed per revision. Works for a deleted document too: the log outlives the doc. A diagnostics read; it advances nothing and changes nothing.",help:{name:"memory history",summary:"list a document\u2019s revisions newest-first, with diffs or one full record on demand",guide:"Every mutation through `crtr memory write`, `edit`, `move`, and `delete` appends one self-contained record \u2014 complete document text before and after, plus who, when, and (on an edit) why. Diffs and revision numbers are derived here at read time, never stored.\n\nA record whose `before` differs from the previous record\u2019s `after` is the evidence of an out-of-band direct file edit; nothing prevents those, and nothing detects them beyond this.\n\nThe log is a plain JSONL file at `log_path`, one JSON object per line \u2014 an external consumer reads it directly rather than through this command.",params:[{kind:"positional",name:"name",required:!0,constraint:"Full canonical memory name (a project document includes its namespace), resolved exactly. Deleted history uses the same canonical name and the selected store\u2019s physical sidecars; there is no leaf or scope-prefix fallback. Builtin and installed-plugin docs are read-only corpora and carry no history."},d("scope-read"),d("dir"),d("profile"),{kind:"flag",name:"limit",type:"int",required:!1,default:10,constraint:"How many revisions to return, newest first. Default 10."},{kind:"flag",name:"diff",type:"bool",required:!1,constraint:"Include a unified diff per listed revision, computed from that record\u2019s own before/after texts."},{kind:"flag",name:"revision",type:"int",required:!1,constraint:"Show ONE revision in full \u2014 its metadata plus the complete before and after document texts. 1-based position in the log: the number `crtr memory edit` reports. Overrides --limit and --diff."}],output:[{name:"name",type:"string",required:!0,constraint:"Resolved document name."},{name:"scope",type:"string",required:!0,constraint:"Scope whose store holds the log: node, project, profile, or user."},{name:"log_path",type:"string",required:!0,constraint:"Absolute path to the append-only JSONL log \u2014 the direct-consumption pointer, one self-contained record per line."},{name:"history_candidates",type:"object[]",required:!1,constraint:"Deleted-history physical candidates: {path, representation, winner}. The directory-index form is listed first and wins deterministically."},{name:"history_collision",type:"object",required:!1,constraint:"Present when deleted history has both physical forms: {paths, winner}."},{name:"total",type:"number",required:!0,constraint:"Total revisions in the log."},{name:"revisions",type:"object[]",required:!1,constraint:"Newest-first, capped by --limit. Each: {revision, op, at, node, rationale, body_changed, frontmatter_changed, diff}. `node` and `rationale` are present only when recorded; `diff` only with --diff. Absent when --revision selects one record."},{name:"record",type:"object",required:!1,constraint:"Present only with --revision: {revision, op, at, node, cwd, rationale, verbatim, before, after} \u2014 the full record including both complete document texts."},{name:"follow_up",type:"string",required:!0,constraint:"Concrete next commands \u2014 the flag variants and the doc read, or, for a deleted document, the revision carrying its retained final text."}],outputKind:"object",effects:["None. Read-only."]},render:s(n=>{const o=n.revisions;if(o===void 0||!o.some(t=>typeof t.diff=="string"))return p(n,y.help);const a=o.map(t=>{const i=[`op: ${String(t.op)}`,`at: ${String(t.at)}`];t.node!==void 0&&i.push(`node: ${String(t.node)}`),t.verbatim===!0&&i.push("verbatim");const e=t.frontmatter_changed??[],r=[...t.body_changed===!0?["body"]:[],...e.length>0?[`frontmatter: ${e.join(", ")}`]:[]],c=String(t.diff??"");return[`## revision ${String(t.revision)} \u2014 ${i.join(" \xB7 ")}`,...t.rationale!==void 0?[`rationale: ${String(t.rationale)}`]:[],`changed: ${r.length>0?r.join("; "):"nothing"}`,...c===""?[]:["","```diff",c,"```"]].join(`
2
- `)});return[`- name: ${String(n.name)}`,`- scope: ${String(n.scope)}`,`- log_path: ${String(n.log_path)}`,`- total: ${String(n.total)}`,...(n.diagnostics??[]).map(t=>`- diagnostic: ${t}`),"",a.join(`
3
-
4
- `),"",String(n.follow_up)].join(`
5
- `)},"render"),run:s(async n=>{const o=n.name,a=n.limit??10,t=n.diff===!0,i=n.revision,e=await h("GET",`/v1/memory/docs/${encodeURIComponent(o)}/history?${m({...u(n),mode:"cli",limit:a,diff:t,revision:i})}`),r=e.deleted===void 0?{}:{history_candidates:e.deleted.candidates,...e.deleted.collision===void 0?{}:{history_collision:e.deleted.collision}};return"record"in e?{name:e.name,scope:e.scope,log_path:e.logPath,...r,total:e.total,...e.diagnostics===void 0?{}:{diagnostics:e.diagnostics},record:e.record,follow_up:e.deleted===void 0?`Read the document as it stands with \`crtr memory read ${e.name}\`, or list the revisions with \`crtr memory history ${e.name} --diff\`.`:`${e.name} is deleted \u2014 no read answers to it. This record's \`before\` is its text at that revision; the last revision (${e.total}) carries the text it was deleted with. List the revisions with \`crtr memory history ${e.name} --diff\`.`}:{name:e.name,scope:e.scope,log_path:e.logPath,...r,total:e.total,...e.diagnostics===void 0?{}:{diagnostics:e.diagnostics},revisions:e.revisions,follow_up:e.deleted===void 0?`Add --diff for per-revision unified diffs, --revision N for one record's full before/after text, or read the document as it stands with \`crtr memory read ${e.name}\`.`:`${e.name} is deleted and only this log survives \u2014 no read answers to it. Add --diff for per-revision unified diffs, or recover its final text with \`crtr memory history ${e.name} --revision ${e.total}\`, whose \`before\` is the document as it stood when deleted.`}},"run")});export{y as historyLeaf};
@@ -1 +0,0 @@
1
- export declare const lintLeaf: import("../../core/command.js").LeafDef;
@@ -1 +0,0 @@
1
- var m=Object.defineProperty;var a=(r,o)=>m(r,"name",{value:o,configurable:!0});import{memoryRequest as l,memorySelection as h}from"./client.js";import{defineLeaf as p}from"../../core/command.js";import{warn as u}from"../../core/output.js";import{ExitCode as f}from"../../types.js";import{selectorParam as i}from"./shared.js";const j=p({name:"lint",description:"validate memory identity, frontmatter, and references across a target view or one exact store",whenToUse:"you authored, moved, or migrated documents and want the authoring-time gate before shipping them. It strict-parses every doc the selection covers and fails on: invalid YAML or substrate schema, a repository whose root store declares no valid `namespace:` (so the runtime refuses to mount it), a `namespace:` outside the repository-root store\u2019s root INDEX.md, two directories in one repository whose paths normalize to the same prefix, a `name:` on a root INDEX.md or a non-root `name:` that is not a valid store-LOCAL name, two files in one store owning one canonical identity, a `[[link]]` or literal `memory-read` route naming no document or directory in the view (a directory\u2019s own document answers at the directory name, never at `<dir>/INDEX`), a body longer than its delivery entries earn, and a repository whose root store\u2019s workspace front door is missing or sits anywhere but its root INDEX.md. One canonical identity held by SEVERAL stores is legitimate (a linked worktree sharing its main checkout\u2019s namespace), so it is reported as a notice with the view\u2019s winner and every candidate, never failed. CI-friendly: non-zero exit on any error, warnings and notices stay non-fatal.",help:{name:"memory lint",summary:"validate canonical identity, frontmatter, and references across the memory corpus",params:[i("scope-read",{},"Lints only that source class. Cross-store candidate notices and project front-door coverage need the unfiltered view, so a scope filter suppresses them."),i("dir",{},"Lints that one store even when the runtime refuses to mount it \u2014 the only way to check a project store before its repository namespace is declared. Its links and routes are resolved against the target view that project\u2019s own directory sees, and an unmounted store defers those reference checks (its identities are undetermined until the namespace exists).")],output:[{name:"checked",type:"number",required:!0,constraint:"Markdown files examined."},{name:"stores",type:"number",required:!0,constraint:"Physical memory stores linted."},{name:"profile_projects",type:"number",required:!1,constraint:"Projects the selected profile manages that were checked for a workspace front door \u2014 zero under a scope filter excluding project stores. Absent under --dir."},{name:"findings",type:"object[]",required:!0,constraint:"One row per ERROR: {rule, path, message, name?, scope?, store_root?, paths?}. `rule` names the violated rule (yaml, schema, extension, length, store-namespace, namespace-placement, root-name, root-index-unaddressable, local-name, canonical-collision, dangling-link, memory-read-route, front-door, owner-path-collision). `paths` carries every file sharing a collided identity, read winner first. Empty when green."},{name:"warnings",type:"object[]",required:!0,constraint:"Same row shape, non-fatal authoring smells: short-preview, broad-memory-read, nested-store-boot, an advisory missing front door, a wildcard memory-read glob matching nothing, and orphan (a doc no reachability path routes an agent to \u2014 unfiltered target/--dir view only, never under --scope)."},{name:"notices",type:"object[]",required:!0,constraint:"Same row shape, inspection data rather than faults: cross-store-candidates (one canonical name held by several stores, winner first) and reference-check-deferred."},{name:"follow_up",type:"string",required:!0,constraint:"Concrete next command."}],outputKind:"object",effects:["None. Read-only. Exits non-zero when any error finding exists."]},run:a(async r=>{const o=r.scope;if(r.dir!==void 0&&o!==void 0)throw new Error("--dir cannot combine with --scope");const e=await l("POST","/v1/memory/lint",{...h(r),mode:"cli"}),t=e.findings,n=e.warnings,c=e.notices,d={checked:e.checked,stores:e.stores,...e.profile_projects===void 0?{}:{profile_projects:e.profile_projects}};for(const s of[...n,...t])u(`memory lint: ${s.rule}: ${s.path}: ${s.message}`);return t.length>0&&(process.exitCode=f.GENERAL),{...d,findings:t,warnings:n,notices:c,follow_up:t.length>0?`${t.length} error(s) across ${e.checked} files in ${e.stores} store(s) \u2014 fix each, then re-run. A repository store that does not mount is repaired with \`crtr sys migrate --dir <repository-root>\`; an owner-path collision is fixed by renaming one of the directories named in the finding; a canonical collision is recovered with \`crtr memory move <name> --to <new-free-name>\` (it selects the first physical path in stable lexical order); a dangling link or route is retargeted with the name \`crtr memory find <leaf>\` reports, or dropped; an over-length body splits into [[linked]] surface-less reference docs.`:n.length>0?'No errors \u2014 review the warnings above, then revise with `crtr memory edit <name> --rationale "<why>"`.':"No errors. Notices are inspection data, not faults: a canonical name held by several stores is reachable per-store with `crtr memory read <name> --dir <project>`."}},"run")});export{j as lintLeaf};
@@ -1 +0,0 @@
1
- export declare const listLeaf: import("../../core/command.js").LeafDef;
@@ -1 +0,0 @@
1
- var c=Object.defineProperty;var s=(t,r)=>c(t,"name",{value:r,configurable:!0});import{defineLeaf as d}from"../../core/command.js";import{memoryQuery as p,memoryRequest as u,memorySelection as y}from"./client.js";import{renderResult as f}from"../../core/render.js";import{MEMORY_KINDS as w,selectorParam as l}from"./shared.js";const v=d({name:"list",description:"inventory of stored memory documents",whenToUse:"browse everything stored \u2014 one row per canonical name with its short-form hook, kind, and scope. Every name is readable as-is with `crtr memory read`. This is the one surface that shows short-form. Reach for `crtr memory find` instead when you already have a topic or keyword in mind rather than wanting the whole inventory.",help:{name:"memory list",summary:"inventory every memory document across the resolved scopes, one row per canonical name",params:[{kind:"flag",name:"kind",type:"enum",choices:[...w],required:!1,constraint:"Filter to a single kind. Default: all kinds."},l("scope-read",{},"Default: every resolved scope."),l("dir",{},"Lists that store alone, and lists it physically: two documents sharing one canonical name both appear, where the default view shows only the winner."),{kind:"flag",name:"paths",type:"bool",required:!1,default:!1,constraint:"Include each row's physical location \u2014 absolute path, store root, store-relative path, and every other physical document sharing its canonical name. Off by default."},{kind:"flag",name:"limit",type:"int",required:!1,default:50,constraint:"Default 50, max 200."},{kind:"flag",name:"cursor",type:"string",required:!1,constraint:"Opaque token from next_cursor. Omit on first call."}],output:[{name:"items",type:"object[]",required:!0,constraint:"One row per canonical name: {name, short_form, kind, privacy, scope, extensions}. extensions carries effective valid plugin-owned metadata; enabled defaults appear here without becoming frontmatter, while disabled and unresolved namespaces are omitted. With --paths each row also carries path, store_root, physical_relative_path, and \u2014 only when several physical documents share the name \u2014 candidates, one {winner, scope, store_root, physical_relative_path, path} row each in source order. Every name is readable as-is with `crtr memory read` (a name that carries members answers with its own document plus that directory listing). short_form is the abbreviated hook \u2014 shown here and nowhere else. Sorted by scope then kind then name ascending."},{name:"next_cursor",type:"string | null",required:!0,constraint:"Opaque token for the next page; null means no more items."},{name:"total",type:"integer | null",required:!0,constraint:"Exact total across all pages when cheap to compute (always cheap here); never null in practice for this leaf."},{name:"follow_up",type:"string",required:!0,constraint:"Concrete next commands \u2014 read a document in full or narrow the inventory."}],outputKind:"object",effects:["Records this inventory page as listing context for the current node without marking any listed document as loaded."]},run:s(async t=>{const r=t.kind,i=t.paths??!1,o=t.limit,m=o!==void 0?Math.min(Math.max(1,o),200):50,h=t.cursor,n=await u("GET",`/v1/memory/docs?${p({...y(t),mode:"cli",kind:r,limit:m,cursor:h})}`);return{items:n.items.map(e=>({name:e.name,short_form:e.shortForm,kind:e.kind,privacy:e.privacy,scope:e.scope,extensions:e.extensions,...i?{path:e.path,store_root:e.storeRoot,physical_relative_path:e.physicalRelativePath,...e.candidates.length>1?{candidates:e.candidates.map(a=>({winner:a.path===e.path,scope:a.scope,store_root:a.root,physical_relative_path:a.physicalRelativePath,path:a.path}))}:{}}:{}})),next_cursor:n.next_cursor,total:n.total,follow_up:'Read one in full with `crtr memory read <name>`, or revise one with `crtr memory edit <name> --rationale "<why>"` (body and frontmatter go through that one verb, and it records the change). Narrow with --kind / --scope, page with --cursor, or search a topic with `crtr memory find <query>`.'}},"run"),render:s(t=>{const r=t.items.map(({extensions:i,...o})=>o);return f({...t,items:r},v.help)},"render")});export{v as listLeaf};
@@ -1 +0,0 @@
1
- export declare const moveLeaf: import("../../core/command.js").LeafDef;
@@ -1 +0,0 @@
1
- var r=Object.defineProperty;var t=(e,n)=>r(e,"name",{value:n,configurable:!0});import{defineLeaf as a}from"../../core/command.js";import{memoryRequest as i,memorySelection as s}from"./client.js";import{MEMORY_WRITE_SCOPES as c,selectorParam as o}from"./shared.js";const u=a({name:"move",description:"rename or relocate a memory document, rewriting inbound links",whenToUse:"a stored document should answer to a different canonical name \u2014 renamed in place or relocated under another directory. The sanctioned way to move one, so you never mv the markdown off disk: this verb carries the document\u2019s revision history along and rewrites every inbound `[[ref]]` across writable stores, so authored links break loudly or not at all. Source and destination are both full canonical names in the SAME store, so a move never changes which repository-relative prefix the document composes under. The repository-root document is immutable, but a nested store\u2019s optional root guide is an ordinary document that may move. One document per move: moving a directory\u2019s own document leaves its members where they are, so relocate a whole directory member by member. If two physical files in that store share the source identity, this verb selects the first physical path in stable lexical order and recovers the collision.",help:{name:"memory move",summary:"move one document to a new canonical name inside its own store, rewriting inbound [[refs]]",params:[{kind:"positional",name:"name",required:!0,constraint:"Full canonical name of the document to move \u2014 a project document is `<namespace>/<local name>`. Resolution is exact, as `read` resolves it: a file path, a bare leaf, a `<scope>/<name>` spelling, and a trailing `/INDEX` all fail. If two physical files in the selected store own the name, move selects the first path in stable lexical order and recovers the collision. Builtin and installed-plugin documents are read-only and refuse to move, as does the repository-root document, which declares the immutable namespace for every document in the repository; a nested store\u2019s root guide is ordinary and may move."},{kind:"flag",name:"to",type:"string",required:!0,constraint:"The new full canonical name, in the SAME store \u2014 the repository namespace and store path included, since a move never crosses stores. `/`-joined segments of [A-Za-z0-9_-], no trailing `INDEX` (a directory\u2019s document answers at the directory name). A nested store\u2019s effective prefix is a legal destination for its optional root guide. Rejected when a document in that store already answers to it, or when either `<local name>.md` or `<local name>/INDEX.md` already exists there."},o("scope-read",{choices:[...c]},"Package-shipped documents cannot move through this writable-scope selector."),o("dir",{},"Source, destination, and inbound-link rewriting all stay inside that one store, so moving a non-winning duplicate leaves every other store untouched \u2014 and rewrites no link at all, because the name still resolves to the candidate that outranks it here.")],output:[{name:"name",type:"string",required:!0,constraint:"The document\u2019s new canonical name \u2014 `--to` after canonicalization, so it can differ from what you passed."},{name:"previous_name",type:"string",required:!0,constraint:"The canonical name it answered to before the move."},{name:"scope",type:"string",required:!0,constraint:"Scope of the store the document moved within: node, user, project, or profile."},{name:"path",type:"string",required:!0,constraint:"Absolute path of the document at its new location \u2014 `<local name>/INDEX.md` when that canonical directory already has members in the store, else `<local name>.md`."},{name:"log_path",type:"string",required:!0,constraint:"Absolute path to the revision log at its new location, ending in a `move` record that names the previous canonical name."},{name:"refs_rewritten",type:"object[]",required:!0,constraint:"Documents whose bodies were rewritten from `[[<previous_name>]]` to `[[<name>]]`. Each: {name, scope, path, refs}. Empty when nothing linked to the document \u2014 or when the moved file is not what that name resolves to here (another store\u2019s candidate wins the address), in which case inbound refs keep resolving to that winner and are left alone."},{name:"follow_up",type:"string",required:!0,constraint:"Outcome-dependent collision recovery and inbound-reference rewriting signal."}],outputKind:"object",effects:["Moves the document to the physical form its new local name takes in that store (creating parent directories, pruning any it leaves empty) and moves its `.history/<physical path>.jsonl` log with it, appending a `move` record naming the previous canonical name.","Drops an explicit `name:` frontmatter pin, so the moved document answers to its path-derived identity \u2014 the name you asked for.","Rewrites every inbound `[[<name>]]` doc link to `[[<new-name>]]` \u2014 across the target view\u2019s writable stores, or inside the one store `--dir` selected \u2014 appending an `edit` record to each rewritten document\u2019s revision log. Aborts before any write when a read-only (builtin or installed-plugin) document carries such a link."]},run:t(async e=>i("POST",`/v1/memory/docs/${encodeURIComponent(e.name)}/move`,{...s(e),mode:"cli",fields:e}),"run")});export{u as moveLeaf};
@@ -1 +0,0 @@
1
- export declare const originLeaf: import("../../core/command.js").LeafDef;
@@ -1 +0,0 @@
1
- var f=Object.defineProperty;var d=(a,s)=>f(a,"name",{value:s,configurable:!0});import{defineLeaf as y}from"../../core/command.js";import{memoryQuery as g,memoryRequest as _,memorySelection as w}from"./client.js";import{ApiError as u}from"../../api/index.js";import{cliClient as h}from"../api-client.js";import{conversationIdFromPath as v}from"../../core/conversation-store/index.js";import{selectorParam as c}from"./shared.js";const I=y({name:"origin",description:"deref a memory document back to the node + conversation that created it",whenToUse:"you are looking at a stored memory and want to know WHERE it came from \u2014 which node authored it, in what conversation, when, and in which project. Reads the `origin` provenance block the runtime stamps at creation and derefs the node pointer to its live session conversation, context dir, and current state. Docs hand-authored or created before provenance capture carry no origin \u2014 the command says so rather than guessing.",help:{name:"memory origin",summary:"resolve a doc name to its creation provenance and deref the originating node",params:[{kind:"positional",name:"name",required:!0,constraint:"Full canonical memory name (a project document includes its namespace). Resolved exactly across the selected target view; a same-store physical collision is refused."},c("scope-read"),c("dir"),c("profile")],output:[{name:"name",type:"string",required:!0,constraint:"Resolved document name."},{name:"path",type:"string",required:!0,constraint:"Absolute path to the document on disk."},{name:"scope",type:"string",required:!0,constraint:"Scope whose ordered store view supplied the document."},{name:"local_name",type:"string",required:!0,constraint:"Store-local identity, before project namespace composition."},{name:"store_root",type:"string",required:!0,constraint:"Absolute memory store root containing the document."},{name:"physical_relative_path",type:"string",required:!0,constraint:"Store-relative physical markdown path; sidecars preserve this shape."},{name:"representation",type:"string",required:!0,constraint:"Physical representation: leaf-file or directory-index."},{name:"origin_recorded",type:"boolean",required:!0,constraint:"true when the doc carries an `origin` provenance block; false for hand-authored or pre-provenance docs."},{name:"created",type:"string",required:!1,constraint:"ISO timestamp the doc was created. Absent when origin_recorded is false."},{name:"cwd",type:"string",required:!1,constraint:"Working directory the authoring conversation ran in."},{name:"node",type:"string",required:!1,constraint:"Node id that authored the doc, or null when written by the user at the CLI (no node)."},{name:"node_present",type:"boolean",required:!1,constraint:"true when that node still exists on the canvas (deref below is live); false when it has been pruned."},{name:"node_kind",type:"string",required:!1,constraint:"Kind of the authoring node (only when node_present)."},{name:"node_mode",type:"string",required:!1,constraint:"Mode of the authoring node (only when node_present)."},{name:"node_status",type:"string",required:!1,constraint:"Current lifecycle status of the authoring node (only when node_present)."},{name:"node_description",type:"string",required:!1,constraint:"The authoring node\u2019s description (only when node_present)."},{name:"session_file",type:"string",required:!1,constraint:"Store path of the originating conversation when the node and conversation still exist. Use `crtr node transcript` to read it."},{name:"context_dir",type:"string",required:!1,constraint:"Absolute path to the authoring node\u2019s context dir (its shared document store)."},{name:"follow_up",type:"string",required:!0,constraint:"Concrete next commands to inspect the origin."}],outputKind:"object",effects:["None. Read-only."]},run:d(async a=>{const s=a.name,e=await _("GET",`/v1/memory/resolve?${g({...w(a),mode:"cli",name:s})}`),r=e.origin;if(r===null||typeof r!="object")return{name:e.name,path:e.path,scope:e.scope,local_name:e.local_name,store_root:e.store_root,physical_relative_path:e.physical_relative_path,representation:e.representation,origin_recorded:!1,follow_up:"No provenance recorded \u2014 this doc was hand-authored or created before provenance capture. Read its body with `crtr memory read "+e.name+"`."};const i=d(n=>typeof n=="string"?n:null,"str"),o=i(r.node);let t=null;if(o!==null)try{t=await h().getNode(o)}catch(n){if(!(n instanceof u&&n.status===404))throw n}const l=v(i(t?.pi_session_file)??"");let p=null;if(l!==null)try{p=(await h().getMemoryOriginConversation(l)).session_file}catch(n){if(!(n instanceof u&&n.status===404))throw n}const m=t!==null?`Read the originating conversation with \`crtr node transcript ${o}\`, browse its shared docs at \`${t.paths.context_dir}\`, or attach live with \`crtr surface attach ${o}\`.`:o!==null?`The authoring node \`${o}\` has been pruned from the canvas; its app and context path are no longer available from the daemon.`:"Authored by the user at the CLI \u2014 no node conversation to deref.";return{name:e.name,path:e.path,scope:e.scope,local_name:e.local_name,store_root:e.store_root,physical_relative_path:e.physical_relative_path,representation:e.representation,origin_recorded:!0,created:i(r.created)??void 0,cwd:i(r.cwd)??void 0,node:o??void 0,node_present:o!==null?t!==null:void 0,node_kind:t?.kind??void 0,node_mode:t?.mode??void 0,node_status:t?.status??void 0,node_description:t?.description??void 0,session_file:p??void 0,context_dir:t?.paths.context_dir,follow_up:m}},"run")});export{I as originLeaf};
@@ -1 +0,0 @@
1
- export declare const readLeaf: import("../../core/command.js").LeafDef;
@@ -1,6 +0,0 @@
1
- var c=Object.defineProperty;var r=(e,t)=>c(e,"name",{value:t,configurable:!0});import{defineLeaf as l}from"../../core/command.js";import{expandShellBlocks as m,hasShellBlocks as h,makeNodeShellRunner as u}from"../../core/runtime/shell-expansion.js";import{renderResult as y}from"../../core/render.js";import{memoryQuery as p,memoryRequest as f,memorySelection as b}from"./client.js";import{MEMORY_KINDS as w,selectorParam as i}from"./shared.js";const g=l({name:"read",description:"load a memory document body by name",whenToUse:"a task in front of you matches a stored document and you already know its canonical name \u2014 read it before improvising. Resolution is exact and takes the full canonical name (a project document is `<namespace>/<local name>`); among documents sharing one name the winner is the nearest scope (node > project stack > profile > user > builtin). A directory name is a valid target too: it answers with that directory\u2019s own document, when it has one, together with its immediate listing, and walking directories is the sanctioned browse move. You name the document by its crtr identifier, never a file path \u2014 do not cat or find the markdown off disk. Reach for `crtr memory find` first when you do not yet know which document applies.",help:{name:"memory read",summary:"resolve an exact canonical name to its document body (frontmatter stripped unless --frontmatter), plus the directory listing when that name has members",params:[{kind:"positional",name:"name",required:!0,constraint:"Full canonical memory name \u2014 a project document is `<namespace>/<local name>`, every other store\u2019s local names are already canonical, where a nested store's namespace includes its path under the repository root. Resolution is exact: a file path, a bare leaf, a `<scope>/<name>` spelling, and a trailing `/INDEX` all fail. A name that carries members returns its listing alongside its body; a name that is only a directory returns the listing alone."},{kind:"flag",name:"kind",type:"enum",choices:[...w],required:!1,constraint:"Narrows resolution when the name is ambiguous across kinds."},{kind:"flag",name:"frontmatter",type:"bool",required:!1,constraint:"When present, includes the YAML frontmatter in the returned body. Off by default \u2014 only the body is returned."},i("scope-read"),i("dir",{},"Reads that store alone: the name resolves against its documents only, and the listing shows its members only.")],output:[{name:"name",type:"string",required:!0,constraint:"Resolved canonical document name, or the directory name on a directory read."},{name:"local_name",type:"string",required:!1,constraint:"Store-local identity, before the store namespace composed the canonical name. Absent on a directory read."},{name:"kind",type:"string",required:!1,constraint:"Resolved kind: knowledge or preference. Absent on a directory read."},{name:"privacy",type:"string",required:!1,constraint:"App access level: public, friends, or private. Missing legacy frontmatter resolves to private. Absent on a directory read."},{name:"scope",type:"string",required:!1,constraint:"Scope the document was resolved from: node, project, profile, user, or builtin. Absent on a directory read."},{name:"path",type:"string",required:!1,constraint:"Absolute path to the document on disk. Revise it with `crtr memory edit`, never by editing this file \u2014 an edit records why the change happened and lands in the doc\u2019s revision history. Absent on a directory read."},{name:"store_root",type:"string",required:!1,constraint:"Absolute memory store root the document loaded from. Absent on a directory read."},{name:"physical_relative_path",type:"string",required:!1,constraint:"Store-relative physical markdown path, ordering prefixes and any `INDEX.md` kept. Absent on a directory read."},{name:"representation",type:"string",required:!1,constraint:"Physical representation of this identity: leaf-file or directory-index. Absent on a directory read."},{name:"candidates",type:"object[]",required:!1,constraint:"Present only when several physical documents share this canonical name: one row per candidate in source order, {winner, scope, store_root, physical_relative_path, path}. The winner is what this read returned; reach a non-winning one with `--dir <its project>`."},{name:"content",type:"string",required:!1,constraint:"Document body. Frontmatter stripped unless --frontmatter is set. A document may embed shell as `!`cmd`` or a ```! fenced block; each runs once per read, in the current working directory, and is replaced by its output. Read `path` off disk when you need the literal unexecuted text. May be preceded by one `<auto-loaded-context>` block carrying the doc\u2019s neighborhood listings and any docs routed to this read. Absent on a directory read."},{name:"listing",type:"string[]",required:!1,constraint:"Present when the name has members \u2014 a directory document returns its body AND this listing, a bare directory returns the listing alone: one `[[name]]: <when-and-why>` line per member doc, one bare `[[name]]` per subdirectory. Follow any line with `crtr memory read <name>`."},{name:"extensions",type:"object",required:!1,constraint:"Effective valid plugin-owned metadata, keyed by plugin namespace then field. Includes enabled declaration defaults without writing them to frontmatter; disabled and unresolved namespaces are omitted. Present only on a document read."},{name:"links",type:"string[]",required:!1,constraint:"Canonical names this document links to via `[[name]]` that resolve in the current corpus \u2014 further reading, loaded only on demand with `crtr memory read <name>`. A directory link returns that directory\u2019s listing. Omitted when the body carries no resolvable links."},{name:"follow_up",type:"string",required:!1,constraint:"Present whenever the read returned a listing or resolvable body links."}],outputKind:"object",effects:["Reads the document. A document that embeds shell (`!`cmd`` or a ```! block) runs those commands once, in the current working directory.","Records a content delivery for this node: a document whose profile project caps automatic boot and workspace-open disclosure below content is still returned whole here, and unsolicited channels stay quiet about it afterwards."]},run:r(async e=>{const t=await f("GET",`/v1/memory/docs/${encodeURIComponent(e.name)}?${p({...b(e),mode:"cli",kind:e.kind,frontmatter:e.frontmatter})}`);if(typeof t.content!="string")return t;const n=t.content,o=h(n)?await m(n,u({cwd:process.cwd()})):n,{attachment_blocks:s,...d}=t,a=s;return{...d,content:a.length===0?o:`<auto-loaded-context>
2
- ${a.join(`
3
- `)}
4
- </auto-loaded-context>
5
-
6
- ${o}`}},"run"),render:r(e=>{const{extensions:t,...n}=e;return y(n,g.help)},"render")});export{g as readLeaf};
@@ -1,22 +0,0 @@
1
- import { type FlagParam } from '../../core/help.js';
2
- export declare const MEMORY_KINDS: readonly ["knowledge", "preference"];
3
- export declare const MEMORY_READ_SCOPES: readonly ["user", "project", "profile", "node", "builtin"];
4
- export declare const MEMORY_WRITE_SCOPES: readonly ["user", "project", "profile", "node"];
5
- export declare const SELECTOR_PARAMS: Record<string, FlagParam>;
6
- /** One selector flag, with leaf-specific prose appended to the shared
7
- * constraint and any leaf-specific schema override applied. */
8
- export declare function selectorParam(name: string, overrides?: Partial<FlagParam>, extraConstraint?: string): FlagParam;
9
- export declare const FRONTMATTER_OVERLAY_PARAMS: Record<string, FlagParam>;
10
- /** One overlay flag, with leaf-specific prose appended to the shared
11
- * constraint and any leaf-specific schema override applied. */
12
- export declare function overlayParam(name: string, overrides?: Partial<FlagParam>, extraConstraint?: string): FlagParam;
13
- /** The doc's standing `rationale` frontmatter field \u2014 the observed gap the doc
14
- * exists to close. `write` takes it as `--rationale`; `edit` takes it as
15
- * `--doc-rationale`, because `--rationale` there means why THIS REVISION is
16
- * happening. Same field, same prose, two flag names that cannot be confused. */
17
- export declare const DOC_RATIONALE_CONSTRAINT = "Frontmatter rationale \u2014 the observed agent failure that made this doc necessary. Maintainer-facing only: never ships in any delivered surface (boot render, on-read injection, `memory read` content), visible only via `memory read --frontmatter`. Omitting the flag preserves an existing rationale unchanged.";
18
- export declare const GUIDE_SURFACES = "Every doc appears in its directory\u2019s listing by default (suppress with --unlisted); everything beyond the listing is explicit `surfaces` routing \u2014 entries declaring WHEN the doc delivers and how much. Events: `boot` delivers in the boot catalog every agent sees; `workspace-open` delivers in first-message context when cwd/profile mounts the doc\u2019s project store (project stores only); `read` fires when the agent reads a matching file (globs vs the file\u2019s absolute path and basename, `./`-anchored globs vs its path relative to the store\u2019s owning repo dir, `match-frontmatter` predicates over the read file\u2019s own YAML frontmatter); `memory-read` fires when another memory doc\u2019s full body is delivered, including an explicit read (globs vs that doc\u2019s canonical name, `./` anchored to this doc\u2019s routing anchor \u2014 its own canonical name when it is its directory\u2019s document, otherwise the canonical directory it sits in); `command` fires when a matching shell command runs (globs vs each shell segment of the command line \u2014 split on `&&`/`||`/`;`/`|`/newlines outside quotes, leading `VAR=value` assignments dropped \u2014 where `*` spans whole whitespace-separated tokens and never part of one, `?` is one character inside a token, and quoted argument text is opaque, so `*git commit*` fires for `cd x && git commit -m \"\u2026\"` but not for `git commit-tree` or an `echo` that merely mentions it); `pre-command` fires BEFORE a matching bash command runs (same matching): when the memory has not been read yet, the command does not execute \u2014 the memory comes back as the tool result instead, and the agent re-issues the command, which then runs. Use it to guarantee a memory is seen before a sensitive action is taken. Requires `match`. An entry may also carry `gate`, a node-config predicate using the same vocabulary as the document-level `gate`: event constraints and entry gate both must match, then all participating entries fold to the highest `at` (`content` > `preview` > `name`), with no cross-entry deny precedence. The document-level `gate` remains the hard eligibility check: when it fails, no automatic surface can deliver the document. `at` sets how much delivers: `name` the bare tag, `preview` the routing line, `content` the whole body. Explicit `memory read` and listings remain deliberate access and ignore gates/rungs; only companion docs routed by their `memory-read` entries use entry gates. Each entry is paid by every future agent it fires on, so default down: no surfaces at all is correct for reference depth reached through listings and [[links]], and when a doc fits in a single sentence, deliver `content` directly \u2014 a `preview` routing line would run longer than the doc itself. Sentence-length `content` docs are correct; never pad a memory to be more verbose than the rule or fact it carries.";
19
- export declare const GUIDE_ROUTING_LINE = "The routing line (--when-and-why-to-read) is the only text an agent reads before deciding to load the doc. The test for its when-clause: it names an observable circumstance in the reader\u2019s current work, not the doc\u2019s topic reworded as an activity. If the WHEN can be inferred from the title alone, it is not a real trigger. Bad on a todo list: \"When planning or prioritizing work across this profile.\" Good: \"When the user mentions something from their todos, or asks what is still outstanding across this profile.\" The test for its because-clause: if it can be derived by paraphrasing the doc\u2019s advice, it is a restatement, not a payoff \u2014 a real payoff names a consequence in the reader\u2019s world that the document itself never asserts. Bad: \"because only genuine first principles belong in taste memory.\" Bad: \"because keeping the test loop fast and free of speculative tests protects the development pace\" \u2014 the doc\u2019s rule as an outcome, derivable straight from its advice. Good: \"because identifying throughlines in user taste lets future decisions be made faster and with less re-litigation.\" Someone mid-task who has not read the doc must be able to decide from this line alone whether the read is worth it. If you cannot name the concrete situation that triggers it, you do not yet understand the memory \u2014 ask the user one sharp question instead of improvising.";
20
- export declare const GUIDE_PREDICATE_VOCABULARY = "Document gates, surface-entry gates, and match-frontmatter share the same predicate language: a field map is AND-ed across fields; dotted fields resolve nested values; field matchers may be scalar, array, or object. Scalar matchers do exact equality, with arrays matching any element. Array matchers do membership or intersection. Object matchers accept `eq`, `ne`, `in`, `nin`, `exists`, `contains`, `containsAll`, `containsAny`, `matches`, `imatches`, `gt`, `gte`, `lt`, and `lte`. Combinators are `all`, `any`, and `not`; sibling field matchers next to them are AND-ed in. An empty condition is inert. An unknown op never matches.";
21
- export declare const GUIDE_DOC_LINKS = "Link related docs with `[[canonical/name]]`. A doc link in any body is a first-class cross-reference to another memory document by its exact canonical name \u2014 the same identifier `crtr memory read` takes, namespace included for a project document. A bare directory name is a valid link too: following it returns that directory\u2019s own document when it has one, plus the directory listing. Links are pointers, never transclusion: the linked body is loaded only when a reader follows it, so a link costs nothing until needed. `crtr memory lint` fails on a link that resolves to no document or directory, and `crtr memory read` lists a doc\u2019s resolvable links alongside its body. There is no alias, label, or old-name form \u2014 a renamed target needs its links rewritten.";
22
- export declare const GUIDE_CANONICAL_NAMES = "A document has exactly one address: its canonical name, the store\u2019s namespace composed with the document\u2019s store-local name. A repository declares its namespace once, as `namespace:` on the root `INDEX.md` of `<repository root>/.crouter/memory/`; a store nested inside that repository composes under the repository namespace plus its own directory path relative to the repository root, and declares nothing itself. An installed plugin\u2019s store mounts under the plugin\u2019s own name; user, profile, node, and builtin stores have no namespace, so their local names are already canonical. A local doc `unit-tests` in a store that declares `namespace: acme/core` therefore answers only at `acme/core/unit-tests`, and the store\u2019s root document answers at `acme/core`; a store at `packages/api/.crouter/memory/` in a repository declaring `namespace: acme` answers under `acme/packages/api`. A non-root explicit `name:` in frontmatter is store-LOCAL \u2014 it never carries the namespace, and composition is unconditional, so a name that merely looks prefixed is prefixed again. The namespace itself is immutable through the memory commands: `crtr memory write <namespace> --dir <repository root>` declares it once in an empty repository-root store, `crtr sys migrate --dir <repository root>` converts a legacy one, and nothing else rewrites it. A trailing `INDEX` is never part of an address in any store: `area/INDEX.md` is the document attached to directory `area`, so it answers at `area` and reading `area` returns that body together with the directory\u2019s immediate listing. Resolution is exact \u2014 a file path, a bare leaf, a `<scope>/<name>` spelling, and a trailing `/INDEX` all fail \u2014 so run `crtr memory find <leaf>` when you do not know the canonical name.";
@@ -1 +0,0 @@
1
- var s=Object.defineProperty;var o=(t,r)=>s(t,"name",{value:r,configurable:!0});import{PRIVACY_LEVELS as i}from"../../core/substrate/schema.js";import{SUPPRESSIBLE_RULES as c}from"../../core/substrate/frontmatter-validation.js";const d=["knowledge","preference"],l=["user","project","profile","node","builtin"],h=["user","project","profile","node"],m={"scope-read":{kind:"flag",name:"scope",type:"enum",choices:[...l],required:!1,constraint:"Restrict resolution to one source class. A source filter only: the name stays the full canonical name, and project scope keeps its nearest-first precedence. Conflicts with --dir, which selects one exact store instead."},"scope-write":{kind:"flag",name:"scope",type:"enum",choices:[...h],required:!1,constraint:"Store to write to (package-shipped documents and installed-plugin documents are managed outside this command, so neither is writable). Default: project when cwd sits in a project, else user. `project` resolves to the NEAREST ancestor `.crouter/` walking up from cwd \u2014 in a nested workspace that can be a parent\u2019s store, not the dir you are standing in; pass --dir to pin the exact project. `profile` requires a selected profile (CRTR_PROFILE_ID) or an explicit --profile. `node` writes the this-node store (`nodes/<CRTR_NODE_ID>/context/memory/`), the nearest scope, seen only by this running node. Conflicts with --dir."},dir:{kind:"flag",name:"dir",type:"string",required:!1,constraint:"Exact project directory to operate in \u2014 selects `<dir>/.crouter/memory/` by realpath, regardless of cwd, ancestor stores, or which store a target view would pick. THE way to reach one specific project store: another project in your profile\u2019s purview, a store shadowed by an ancestor, or a non-winning duplicate such as a linked worktree that declares the same namespace as its main checkout. The name is still the FULL canonical name \u2014 the repository namespace plus that store\u2019s path under the repository root, plus the store-local name. It selects the store itself, so it conflicts with any explicit --scope and with --profile."},profile:{kind:"flag",name:"profile",type:"string",required:!1,constraint:"Profile id or name to target, for --scope profile. Names that profile\u2019s store exactly, whichever profile this process runs under. Default: the process CRTR_PROFILE_ID (the node\u2019s selected profile). Resolved through the same profile lookup as `crtr profile show`. Rejected (usage error) unless --scope profile is also selected \u2014 never silently ignored for another scope \u2014 and rejected with --dir."}};function y(t,r={},n){const e=m[t];if(e===void 0)throw new Error(`unknown selector param: ${t}`);const a=n===void 0?e.constraint:`${e.constraint} ${n}`;return{...e,...r,constraint:a}}o(y,"selectorParam");const u={kind:{kind:"flag",name:"kind",type:"enum",choices:[...d],required:!1,constraint:"Document kind."},privacy:{kind:"flag",name:"privacy",type:"enum",choices:[...i],required:!1,constraint:"App access level. Write defaults to public and persists it; edit preserves the current level unless set. A legacy document without the field is read as private."},"when-and-why-to-read":{kind:"flag",name:"when-and-why-to-read",type:"string",required:!1,constraint:'ONE routing sentence: "When <circumstance>, this <kind> should be read because <broader downstream payoff>." WHY is the reader\u2019s payoff \u2014 the consequence they secure for their task by reading \u2014 NEVER the doc summary, its rule, or that rule reworded as an outcome (a benefit-shaped restatement still fails). Rendered verbatim as the preview.'},"short-form":{kind:"flag",name:"short-form",type:"string",required:!1,constraint:"Frontmatter short-form \u2014 a very abbreviated version of the content, the hook shown in `crtr memory list`."},unlisted:{kind:"flag",name:"unlisted",type:"bool",required:!1,default:!1,constraint:"Suppress this doc from directory listings. Suppression only \u2014 explicit reads, [[links]], and surfaces entries still work."},surface:{kind:"flag",name:"surface",type:"string",required:!1,repeatable:!0,constraint:"One routing entry per occurrence, as a YAML/JSON object `{on, at, match?, match-frontmatter?, gate?}`; the flag set replaces the document\u2019s whole surfaces list. `on` is boot|workspace-open|read|memory-read|command|pre-command; `at` is name|preview|content. `match` holds the event\u2019s globs \u2014 required on read/memory-read/command/pre-command (a read entry may carry `match-frontmatter`, a predicate over the read file\u2019s own frontmatter, instead), meaningless on boot/workspace-open. Optional entry `gate` is a node-config predicate using the same vocabulary as the document gate; its event constraints and gate both match before it participates. A `./`-anchored glob is relative: for `read` to the store\u2019s owning repo dir, for `memory-read` to this doc\u2019s routing anchor \u2014 its own canonical name when the doc is its directory\u2019s document (`<dir>/INDEX.md`), otherwise the canonical directory it sits in. Participating entries fold to their highest `at`; there is no cross-entry deny precedence."},gate:{kind:"flag",name:"gate",type:"string",required:!1,constraint:"Frontmatter gate \u2014 YAML/JSON object predicate over node config using the same field/matcher vocabulary described in the guide."},"lint-ignore":{kind:"flag",name:"lint-ignore",type:"enum",choices:[...c],required:!1,repeatable:!0,constraint:"Suppress one authoring lint rule for this document. Repeat for a list; valid rules: length, broad-memory-read, orphan."},slash:{kind:"flag",name:"slash",type:"bool",required:!1,default:!1,constraint:"Presence flags this doc invocable as a pi slash command (`/<name>`, `/` in a nested name rendered as `:`) \u2014 the doc body becomes the command\u2019s injected prompt. Default false: most docs are consulted, not invoked."}};function w(t,r={},n){const e=u[t];if(e===void 0)throw new Error(`unknown frontmatter overlay param: ${t}`);const a=n===void 0?e.constraint:`${e.constraint} ${n}`;return{...e,...r,constraint:a}}o(w,"overlayParam");const b="Frontmatter rationale \u2014 the observed agent failure that made this doc necessary. Maintainer-facing only: never ships in any delivered surface (boot render, on-read injection, `memory read` content), visible only via `memory read --frontmatter`. Omitting the flag preserves an existing rationale unchanged.",v='Every doc appears in its directory\u2019s listing by default (suppress with --unlisted); everything beyond the listing is explicit `surfaces` routing \u2014 entries declaring WHEN the doc delivers and how much. Events: `boot` delivers in the boot catalog every agent sees; `workspace-open` delivers in first-message context when cwd/profile mounts the doc\u2019s project store (project stores only); `read` fires when the agent reads a matching file (globs vs the file\u2019s absolute path and basename, `./`-anchored globs vs its path relative to the store\u2019s owning repo dir, `match-frontmatter` predicates over the read file\u2019s own YAML frontmatter); `memory-read` fires when another memory doc\u2019s full body is delivered, including an explicit read (globs vs that doc\u2019s canonical name, `./` anchored to this doc\u2019s routing anchor \u2014 its own canonical name when it is its directory\u2019s document, otherwise the canonical directory it sits in); `command` fires when a matching shell command runs (globs vs each shell segment of the command line \u2014 split on `&&`/`||`/`;`/`|`/newlines outside quotes, leading `VAR=value` assignments dropped \u2014 where `*` spans whole whitespace-separated tokens and never part of one, `?` is one character inside a token, and quoted argument text is opaque, so `*git commit*` fires for `cd x && git commit -m "\u2026"` but not for `git commit-tree` or an `echo` that merely mentions it); `pre-command` fires BEFORE a matching bash command runs (same matching): when the memory has not been read yet, the command does not execute \u2014 the memory comes back as the tool result instead, and the agent re-issues the command, which then runs. Use it to guarantee a memory is seen before a sensitive action is taken. Requires `match`. An entry may also carry `gate`, a node-config predicate using the same vocabulary as the document-level `gate`: event constraints and entry gate both must match, then all participating entries fold to the highest `at` (`content` > `preview` > `name`), with no cross-entry deny precedence. The document-level `gate` remains the hard eligibility check: when it fails, no automatic surface can deliver the document. `at` sets how much delivers: `name` the bare tag, `preview` the routing line, `content` the whole body. Explicit `memory read` and listings remain deliberate access and ignore gates/rungs; only companion docs routed by their `memory-read` entries use entry gates. Each entry is paid by every future agent it fires on, so default down: no surfaces at all is correct for reference depth reached through listings and [[links]], and when a doc fits in a single sentence, deliver `content` directly \u2014 a `preview` routing line would run longer than the doc itself. Sentence-length `content` docs are correct; never pad a memory to be more verbose than the rule or fact it carries.',k='The routing line (--when-and-why-to-read) is the only text an agent reads before deciding to load the doc. The test for its when-clause: it names an observable circumstance in the reader\u2019s current work, not the doc\u2019s topic reworded as an activity. If the WHEN can be inferred from the title alone, it is not a real trigger. Bad on a todo list: "When planning or prioritizing work across this profile." Good: "When the user mentions something from their todos, or asks what is still outstanding across this profile." The test for its because-clause: if it can be derived by paraphrasing the doc\u2019s advice, it is a restatement, not a payoff \u2014 a real payoff names a consequence in the reader\u2019s world that the document itself never asserts. Bad: "because only genuine first principles belong in taste memory." Bad: "because keeping the test loop fast and free of speculative tests protects the development pace" \u2014 the doc\u2019s rule as an outcome, derivable straight from its advice. Good: "because identifying throughlines in user taste lets future decisions be made faster and with less re-litigation." Someone mid-task who has not read the doc must be able to decide from this line alone whether the read is worth it. If you cannot name the concrete situation that triggers it, you do not yet understand the memory \u2014 ask the user one sharp question instead of improvising.',E="Document gates, surface-entry gates, and match-frontmatter share the same predicate language: a field map is AND-ed across fields; dotted fields resolve nested values; field matchers may be scalar, array, or object. Scalar matchers do exact equality, with arrays matching any element. Array matchers do membership or intersection. Object matchers accept `eq`, `ne`, `in`, `nin`, `exists`, `contains`, `containsAll`, `containsAny`, `matches`, `imatches`, `gt`, `gte`, `lt`, and `lte`. Combinators are `all`, `any`, and `not`; sibling field matchers next to them are AND-ed in. An empty condition is inert. An unknown op never matches.",A="Link related docs with `[[canonical/name]]`. A doc link in any body is a first-class cross-reference to another memory document by its exact canonical name \u2014 the same identifier `crtr memory read` takes, namespace included for a project document. A bare directory name is a valid link too: following it returns that directory\u2019s own document when it has one, plus the directory listing. Links are pointers, never transclusion: the linked body is loaded only when a reader follows it, so a link costs nothing until needed. `crtr memory lint` fails on a link that resolves to no document or directory, and `crtr memory read` lists a doc\u2019s resolvable links alongside its body. There is no alias, label, or old-name form \u2014 a renamed target needs its links rewritten.",R="A document has exactly one address: its canonical name, the store\u2019s namespace composed with the document\u2019s store-local name. A repository declares its namespace once, as `namespace:` on the root `INDEX.md` of `<repository root>/.crouter/memory/`; a store nested inside that repository composes under the repository namespace plus its own directory path relative to the repository root, and declares nothing itself. An installed plugin\u2019s store mounts under the plugin\u2019s own name; user, profile, node, and builtin stores have no namespace, so their local names are already canonical. A local doc `unit-tests` in a store that declares `namespace: acme/core` therefore answers only at `acme/core/unit-tests`, and the store\u2019s root document answers at `acme/core`; a store at `packages/api/.crouter/memory/` in a repository declaring `namespace: acme` answers under `acme/packages/api`. A non-root explicit `name:` in frontmatter is store-LOCAL \u2014 it never carries the namespace, and composition is unconditional, so a name that merely looks prefixed is prefixed again. The namespace itself is immutable through the memory commands: `crtr memory write <namespace> --dir <repository root>` declares it once in an empty repository-root store, `crtr sys migrate --dir <repository root>` converts a legacy one, and nothing else rewrites it. A trailing `INDEX` is never part of an address in any store: `area/INDEX.md` is the document attached to directory `area`, so it answers at `area` and reading `area` returns that body together with the directory\u2019s immediate listing. Resolution is exact \u2014 a file path, a bare leaf, a `<scope>/<name>` spelling, and a trailing `/INDEX` all fail \u2014 so run `crtr memory find <leaf>` when you do not know the canonical name.";export{b as DOC_RATIONALE_CONSTRAINT,u as FRONTMATTER_OVERLAY_PARAMS,R as GUIDE_CANONICAL_NAMES,A as GUIDE_DOC_LINKS,E as GUIDE_PREDICATE_VOCABULARY,k as GUIDE_ROUTING_LINE,v as GUIDE_SURFACES,d as MEMORY_KINDS,l as MEMORY_READ_SCOPES,h as MEMORY_WRITE_SCOPES,m as SELECTOR_PARAMS,w as overlayParam,y as selectorParam};
@@ -1 +0,0 @@
1
- export declare const writeLeaf: import("../../core/command.js").LeafDef;
@@ -1,13 +0,0 @@
1
- var a=Object.defineProperty;var r=(t,o)=>a(t,"name",{value:o,configurable:!0});import{defineLeaf as s}from"../../core/command.js";import{memoryExtensionHelp as d,memoryRequest as c,memorySelection as h}from"./client.js";import{DOC_RATIONALE_CONSTRAINT as l,GUIDE_CANONICAL_NAMES as u,GUIDE_DOC_LINKS as m,GUIDE_PREDICATE_VOCABULARY as p,GUIDE_ROUTING_LINE as f,GUIDE_SURFACES as y,overlayParam as e,selectorParam as n}from"./shared.js";const g=s({name:"write",description:"create a memory document",whenToUse:"you are recording a new knowledge document or preference that does not exist yet. Creation only \u2014 a name already taken at the resolved scope is an error, because revising a stored document goes through `crtr memory edit`, which requires a rationale and records the revision.",help:{name:"memory write",summary:"create a memory document at the resolved store from frontmatter flags + a stdin body",guide:`Every frontmatter flag decides who sees this doc, when, and at what context cost. Each rung up is paid by every future agent at every boot or read, so default each rung down.
2
-
3
- Pick the kind. knowledge is consulted for facts or procedures; preference directs behavior. The kind choice is about how the doc is used, not about how long it is.
4
-
5
- Store reusable current truth, not session notes. Useful memories are non-obvious procedures, gotchas, durable preferences, and cross-repo conventions. Do not store chat summaries, implementation history, or facts already recorded in the repo.
6
-
7
- `+y+'\n\nChoose the scope. `project` is for facts any agent in one repo needs. `user` is for person-wide facts and preferences that should follow the user everywhere. `profile` is for the profile\u2019s bundle of dirs: cross-repo conventions, how the pieces relate, or the user\u2019s stance toward that body of work. `node` is scratch memory only this running node sees; it rides into this node\u2019s knowledge block and dies with the node. When unsure, choose the narrowest scope that will still reach the next agent who needs it.\n\nA workspace front door is an ordinary doc carrying the entry pair {on: workspace-open, at: content} plus {on: read, match: "./**", at: content}: it enters first-message context when cwd/profile mounts its project store and fires on any file read beneath the store\u2019s owning dir. Target the exact project with --dir. Keep only the project constraints, key commands, architecture orientation, and conventions that differ from defaults. `crtr memory lint` requires this front door on the repository-root guide for a repository managed by the selected profile; nested stores may carry ordinary guides without a missing-door finding.\n\nChoose the hook \u2014 boot vs read. A boot entry rides the boot catalog every agent sees; a read entry fires only when a matching file is actually read. Put code-specific knowledge in the owning project store, give it the narrowest real file glob, and keep it off boot when the file read is the useful trigger. Knowledge about a person or process usually has no file boundary, so skip read entries and route it through boot instead.\n\nWrite the routing line (--when-and-why-to-read) first, before storing anything. '+f+`
8
-
9
- `+p+`
10
-
11
- `+u+`
12
-
13
- `+m+"\n\nWhen a doc grows long or information-rich, nest it into a graph instead of letting it become a scroll. The main doc at the topic\u2019s path keeps the high-level, most load-bearing information, most important first; depth splits into reference docs under the topic\u2019s directory (`area/topic/...`), each pointed at with a `[[link]]`. Split by subject: a leaf earns its link by covering a different subject a task might need on its own; a leaf of offloaded \u201Cfurther evidence\u201D, examples, or references is never followed, so supporting material either sits in the main doc next to the point it supports or gets cut. The main doc is the entry point a reader can act from alone; a reference leaf is loaded only when the task needs that depth. Give reference leaves no surfaces at all \u2014 the directory listing and the link from the main doc are how they are found, so any routing entry just double-charges every boot or read for depth the graph already routes. State each fact once. Keep facts that affect action or judgment, including constraints, exceptions, numbers, and exact names. Remove known context, inferable conclusions, filler transitions, and examples that resolve no ambiguity. `crtr memory lint` caps body length by delivery rung and its findings carry the split guidance.\n\nA directory needs no index doc: reading a directory name returns its listing \u2014 each member\u2019s routing line \u2014 so never author a doc that merely lists, fronts, or paraphrases its siblings. Write a directory-level doc only for synthesis: an operating guide or the cluster\u2019s mechanics, ordering, conditions, and relationships, content no single member can carry. Guided entrance into a topic is an ordinary member doc, found through the listing like any other.\n\nFind before write. Prefer slightly expanding an existing document with `crtr memory edit`, nesting genuinely separate depth under its topic, and updating the existing `when-and-why-to-read` (plus its INDEX router when present) over creating another similar memory. A new document earns its own identity only when it has a distinct read trigger and a coherent body whose merge into the existing document would make it harder to route or use. Group related docs with path names (area/topic). Provenance is stamped here and preserved by every later revision.\n\nThis leaf validates the document it just wrote and reports any finding; a silent result means it is clean, so there is nothing to run afterwards. The check is scoped to this one document \u2014 `crtr memory lint` remains the corpus-wide sweep, and only it catches store-level faults such as a canonical collision or a missing workspace front door.\n\n--rationale is the gap this doc exists to close \u2014 the observed agent failure that prompted it, captured from user signal (a correction, a mistake you watched happen) rather than inferred from the doc\u2019s own content. If the rationale is guessable from reading the doc, it is not the real one \u2014 a guessable gap is one agents do not actually fall into. Omit the flag when you have no observed gap to record.\n\nRevise an existing doc with `crtr memory edit`.",params:[{kind:"positional",name:"name",required:!0,constraint:"Full canonical identity. Project writes require `<namespace>/<local name>`; writing the namespace itself targets the repository-root document. A trailing `/INDEX` is invalid because directory documents answer at the directory name. The identity must be free in the selected exact store."},e("kind",{required:!0}),e("privacy",{default:"public"}),e("when-and-why-to-read",{required:!0}),e("short-form"),e("unlisted"),e("surface"),e("gate"),e("lint-ignore"),e("slash"),{kind:"flag",name:"rationale",type:"string",required:!1,constraint:l},{kind:"flag",name:"extension",type:"string",required:!1,repeatable:!0,constraint:"Set one declared plugin field as `extensions.<plugin>.<field>=VALUE`. The path is required in full; booleans accept only true or false, numbers require finite numeric syntax, and strings/enums preserve the literal text after the first =. Every requested field validates before the document is written."},n("scope-write"),n("dir"),n("profile"),{kind:"stdin",name:"body",required:!0,constraint:"Document body (markdown, no frontmatter). Piped on stdin only \u2014 this leaf already claims the one positional for NAME, so a second bare argv token is rejected, not silently accepted as the body."}],output:[{name:"name",type:"string",required:!0,constraint:"The full canonical document name written \u2014 the resolved identity, which composes a namespace onto the name you passed when the store declares one."},{name:"scope",type:"string",required:!0,constraint:"Scope the document was written to: user, project, profile, or node. The selector rules decide this, so it is the one placement fact the invocation does not already state."},{name:"path",type:"string",required:!0,constraint:"Absolute path to the written document."},{name:"findings",type:"object[]",required:!1,constraint:"Authoring problems in the document just written, each {severity, rule, message}. ABSENT when the document is clean, which is the normal case \u2014 a silent result means it validated. Covers every rule that reads one document: yaml, schema, extension, length, short-preview, local-name, namespace-placement, root-name, nested-store-boot, broad-memory-read, and a workspace front door on a non-root doc. Reference rules (dangling-link, memory-read-route) run only when the document actually carries a `[[link]]` or a memory-read route. The document is written either way: a finding reports what to revise with `crtr memory edit`, it does not mean the write failed."}],outputKind:"object",effects:["Creates the selected physical memory document with the given frontmatter fields + stdin body, and opens its mirrored `.history` sidecar with a `create` record. An empty repository-root store is initialized at its root namespace only when the ordinary workspace front door surfaces are supplied."]},effectiveHelp:r(async()=>{const t=await d("write");return{...g.help,dynamicState:r(()=>t,"dynamicState")}},"effectiveHelp"),run:r(async t=>{const{scope:o,dir:w,profile:b,...i}=t;return c("POST","/v1/memory/docs",{...h(t),mode:"cli",fields:i})},"run")});export{g as writeLeaf};
@@ -1 +0,0 @@
1
- var i=Object.defineProperty;var o=(r,a)=>i(r,"name",{value:a,configurable:!0});import{defineBranch as s}from"../core/command.js";import{requireScope as d}from"../core/errors.js";import{listLeaf as m}from"./memory/list.js";import{readLeaf as c}from"./memory/read.js";import{findLeaf as p}from"./memory/find.js";import{writeLeaf as h}from"./memory/write.js";import{editLeaf as l}from"./memory/edit.js";import{moveLeaf as u}from"./memory/move.js";import{historyLeaf as f}from"./memory/history.js";import{deleteLeaf as y}from"./memory/delete.js";import{originLeaf as w}from"./memory/origin.js";import{lintLeaf as v}from"./memory/lint.js";function e(r,a){return{...r,run:o(async(t,n)=>(d(a,`crtr memory ${r.name}`),await r.run(t,n)),"run")}}o(e,"scoped");function B(){return s({name:"memory",rootEntry:{concept:"a memory document you read on demand \u2014 knowledge or a preference",desc:"list, read, search, and write memory documents",useWhen:"durable knowledge and preferences shared across nodes and sessions \u2014 use when prior guidance may apply to the current task, or when a non-obvious reusable truth should outlive this conversation. Every document has one canonical name, a crtr identifier rather than a file path \u2014 read docs through the command surface, never cat or find the markdown off disk. Slash commands are authored here too \u2014 one is a document flagged invocable."},help:{name:"memory",summary:"list, read, search, and write memory documents \u2014 knowledge and preferences",model:"One address per document: its canonical name, the store\u2019s namespace composed with its store-local name. A repository declares that namespace once, as `namespace:` on the root `INDEX.md` of `<repository root>/.crouter/memory/`, and a store nested inside the repository composes under that namespace plus its own path from the repository root; user, profile, node, and builtin names carry no namespace, and an installed plugin\u2019s documents mount under the plugin\u2019s own name. Resolution is exact \u2014 a file path, a bare leaf, a `<scope>/<name>` spelling, and a trailing `/INDEX` all fail \u2014 so `find` is the discovery surface when you do not know a name and `list` browses the whole inventory. A trailing `INDEX` is never part of an address, so a directory may carry its own document: reading the directory name returns that body together with the directory\u2019s immediate listing. Precedence \u2014 node > project stack > profile > user > builtin \u2014 picks the winner among documents sharing ONE canonical name; `--paths` reports every physical candidate behind a name, and `--dir <project>` reaches one exact store. One verb per operation: `write` creates, `edit` revises (every revision carries a rationale and is recorded), `move` relocates or renames a doc and rewrites inbound `[[refs]]` corpus-wide, `delete` removes, and `history` reads how a document reached its current state. Beyond listings, delivery is explicit `surfaces` routing: each entry names the event that fires it (boot, workspace-open, read, memory-read, command) and how much delivers (name, preview, content). A selected profile widens the project stack to every project in its purview, and each of those relationships caps what its stores deliver to the boot and workspace-open events; `read`, find, listings, and file- and command-routed delivery see the full corpus regardless."},children:[e(m,"memory:read"),e(c,"memory:read"),e(p,"memory:read"),e(h,"memory:write"),e(l,"memory:write"),e(u,"memory:write"),e(f,"memory:read"),e(y,"memory:write"),e(w,"memory:read"),e(v,"memory:read")]})}o(B,"registerMemory");export{B as registerMemory};
@@ -1 +0,0 @@
1
- export declare const nodeArtifactsLeaf: import("../core/command.js").LeafDef;
@@ -1,8 +0,0 @@
1
- var p=Object.defineProperty;var f=(o,t)=>p(o,"name",{value:t,configurable:!0});import{defineLeaf as u}from"../core/command.js";import{cliClient as m,rethrowAsCliError as h}from"./api-client.js";const y=["report","doc","roadmap","inbox"],$=u({name:"artifacts",description:"enumerate one node's artifacts as refs",whenToUse:'you have a node id and want to see everything it left behind \u2014 its reports and context docs as refs ready for `canvas history read`. The bridge from "found the node" to "read its artifacts". Use `node inspect show` instead for the node\'s topology/neighbors, not its content.',help:{name:"node inspect artifacts",summary:"list one node's artifacts (reports + context docs) as refs ready for `canvas history read`",params:[{kind:"positional",name:"node-id",required:!0,constraint:"The node whose artifacts to list."},{kind:"flag",name:"type",type:"enum",choices:[...y],required:!1,constraint:"Narrow to one corpus: report | doc | roadmap | inbox. Default: report, doc, roadmap (inbox is opt-in only \u2014 the node's inbox history including full un-clipped direct-message bodies; a diagnostic surface, not curated past work)."},{kind:"flag",name:"sort",type:"enum",choices:["recency","oldest"],required:!1,constraint:"Order by artifact timestamp. Default recency."}],output:[{name:"node",type:"string",required:!0,constraint:"Node name + id."},{name:"artifacts",type:"object[]",required:!0,constraint:"Each: {ref, source, ts, detail}. source = report:<kind> | doc | roadmap | inbox. detail = report title / doc heading + size (inbox: `[kind] label`, no size). ref passes verbatim to `canvas history read`."},{name:"follow_up",type:"string",required:!0,constraint:"Concrete next commands."}],outputKind:"object",effects:["None. Read-only."]},run:f(async o=>{const t=o.nodeId.trim(),r=o.type,s=o.sort??"recency",c=m();let d,a;try{const[e,i]=await Promise.all([c.getNode(t),c.getArtifacts(t,r!==void 0?{type:r}:void 0)]);d=e.name,a=i.artifacts}catch(e){h(e,"List nodes with `crtr node inspect list`, or find one with `crtr canvas history search`.")}const n=f(e=>Date.parse(e)||0,"ms");a.sort((e,i)=>(s==="oldest"?n(e.ts)-n(i.ts):n(i.ts)-n(e.ts))||e.ref.localeCompare(i.ref));const l=a.map(e=>({ref:e.ref,source:e.source,ts:e.ts,detail:e.title+(e.size>0?` (${e.size}B)`:"")}));return{node:`${d} (${t})`,artifacts:l,follow_up:"Read one with `crtr canvas history read <ref>`; reopen the node with `crtr node lifecycle revive "+t+"`."}},"run"),render:f(o=>{const t=o.artifacts,r=[`node: ${o.node}`];if(t.length===0)r.push("0 artifacts.");else{const s=Object.keys(t[0]),c=`| ${s.join(" | ")} |`,d=`| ${s.map(()=>"---").join(" | ")} |`,a=t.map(n=>`| ${s.map(l=>String(n[l]??"").replace(/\|/g,"\\|").replace(/\n/g," ")).join(" | ")} |`).join(`
2
- `);r.push(`${t.length} artifacts:
3
-
4
- ${c}
5
- ${d}
6
- ${a}`)}return r.push(String(o.follow_up)),r.join(`
7
-
8
- `)},"render")});export{$ as nodeArtifactsLeaf};
@@ -1,3 +0,0 @@
1
- import type { MemoryExtensionDeclaration } from '../../types.js';
2
- /** Render the daemon's bounded declaration catalog without opening a memory store in the CLI. */
3
- export declare function memoryExtensionFieldCatalogHelp(operation: 'write' | 'edit', catalog: Record<string, Record<string, MemoryExtensionDeclaration>>): string | null;
@@ -1,2 +0,0 @@
1
- var m=Object.defineProperty;var s=(e,l)=>m(e,"name",{value:l,configurable:!0});import{stateBlock as a}from"../help.js";function c(e){return e.type!=="enum"?e.type:`enum (${e.values.join("|")})`}s(c,"declarationValueDescription");function d(e){return typeof e=="string"?JSON.stringify(e):String(e)}s(d,"extensionHelpValue");function g(e,l){const o=Object.entries(l).flatMap(([n,i])=>Object.entries(i).map(([t,u])=>({namespace:n,field:t,declaration:u}))).sort((n,i)=>`${n.namespace}.${n.field}`.localeCompare(`${i.namespace}.${i.field}`));if(o.length===0)return null;const r=50,f=o.slice(0,r).map(({namespace:n,field:i,declaration:t})=>{const u=t.default===void 0?"":`; default ${d(t.default)}`,p=e==="write"?t.write_help:t.edit_help;return`- \`extensions.${n}.${i}\` \u2014 ${c(t)}${u}. ${p}`});return o.length>r&&f.push(`- ${o.length-r} additional declared fields omitted from help.`),a("memory-extension-fields",{count:o.length},f.join(`
2
- `))}s(g,"memoryExtensionFieldCatalogHelp");export{g as memoryExtensionFieldCatalogHelp};
@@ -1,13 +0,0 @@
1
- import { type MemoryScope, type MemoryStoreDescriptor } from '../memory-resolver.js';
2
- interface MemorySelectorInput {
3
- scope?: string | undefined;
4
- dir?: string | undefined;
5
- profile?: string | undefined;
6
- }
7
- /** Legacy sys guidance migration needs this local selector; memory leaves resolve in the daemon. */
8
- export declare function resolveWriteSelector(input: MemorySelectorInput): {
9
- scope: MemoryScope;
10
- memoryDir: string;
11
- store: MemoryStoreDescriptor;
12
- };
13
- export {};
@@ -1 +0,0 @@
1
- var y=Object.defineProperty;var c=(e,o)=>y(e,"name",{value:o,configurable:!0});import{existsSync as u,realpathSync as h,statSync as D}from"node:fs";import{dirname as d,join as l,resolve as j}from"node:path";import{envNodeId as v,envProfileId as w}from"../../shared/env.js";import{usage as t}from"../errors.js";import{pathExists as x}from"../fs-utils.js";import{openProjectMemoryStore as m}from"../memory-resolver.js";import{NEUTRAL_PROJECT_MEMORY as R,scopeMemoryDir as S,projectScopeRoot as M,ensureProjectScopeRoot as P,resetScopeCache as $}from"../scope.js";import{loadProfileManifest as I,resolveProfileOperand as E,profileMemoryDir as _}from"../profiles/manifest.js";import{memoryDir as C}from"../runtime/memory.js";import{CRTR_DIR_NAME as N}from"../../types.js";function O(e){if(e.scope!==void 0&&e.scope!=="")throw t(`--dir selects the project store itself and cannot combine with --scope ${e.scope}`,{received:`--dir ${e.dir} --scope ${e.scope}`,next:"Drop --scope: --dir already pins the exact project store."});if(e.profile!==void 0&&e.profile!=="")throw t("--profile only applies to --scope profile; --dir selects a project store",{received:e.profile,next:"Drop --profile when using --dir."})}c(O,"rejectDirConflicts");function b(e){const o=j(e);if(!u(o)||!D(o).isDirectory())throw t(`--dir does not exist or is not a directory: ${e}`,{received:e,next:"Pass an existing project directory."});try{return h(o)}catch{return o}}c(b,"ownerDirFromArg");function q(e,o){if(!(e===void 0||e==="")){if(!o.includes(e))throw t(`invalid --scope: ${e} (expected ${o.join("|")})`);return e}}c(q,"parseScope");function f(e,o){return{scope:e,storeRoot:o,namespace:"",mountStatus:x(o)?"ready":"absent",projectMemory:R}}c(f,"nativeStoreDescriptor");function G(e){if(e.dir!==void 0&&e.dir!==""){O(e);const i=b(e.dir);return $(),{scope:"project",memoryDir:l(i,N,"memory"),store:m(i)}}const r=q(e.scope,["user","project","profile","node"])??(M()!==null?"project":"user");if(e.profile!==void 0&&e.profile!==""&&r!=="profile")throw t(`--profile only applies to --scope profile (resolved scope: ${r})`,{received:e.profile,next:"Drop --profile, or pass --scope profile to target a specific profile store."});if(r==="node"){const i=v()||"";if(i==="")throw t("node scope requires a running node (CRTR_NODE_ID unset); rerun inside a node");const n=C(i);return{scope:r,memoryDir:n,store:f(r,n)}}if(r==="profile"){const i=e.profile!==void 0&&e.profile!=="",n=i?e.profile:w()||"";if(n==="")throw t("profile scope requires a selected profile; rerun inside a profiled node or pass --profile");const{profileId:a}=i?E(n):I(n),p=_(a);return{scope:r,memoryDir:p,store:f(r,p)}}let s=S(r);if(!s&&r==="project"&&(s=l(P(),"memory")),!s)throw t(`no ${r} scope available for writing memory documents`);return r==="project"?{scope:r,memoryDir:s,store:m(d(d(s)))}:{scope:r,memoryDir:s,store:f(r,s)}}c(G,"resolveWriteSelector");export{G as resolveWriteSelector};
@@ -1,20 +0,0 @@
1
- /** One `[[name]]` link occurrence found in a document body. */
2
- export interface DocLink {
3
- /** Character index of the first `[` of `[[`. */
4
- start: number;
5
- /** Character index just past the closing `]]`. */
6
- end: number;
7
- /** The canonical document name between the brackets. */
8
- name: string;
9
- }
10
- /** Is `name` a well-formed canonical doc-link name? */
11
- export declare function isDocLinkName(name: string): boolean;
12
- /**
13
- * Find every `[[name]]` doc link in a markdown body, in order of appearance,
14
- * skipping fenced code blocks and inline code spans (a link mentioned inside
15
- * code is an example, not a reference). Occurrences are NOT deduplicated —
16
- * callers collapse as needed.
17
- */
18
- export declare function findDocLinks(body: string): DocLink[];
19
- /** The distinct link names in a body, first-appearance order. */
20
- export declare function docLinkNames(body: string): string[];
@@ -1,2 +0,0 @@
1
- var u=Object.defineProperty;var i=(e,o)=>u(e,"name",{value:o,configurable:!0});const r=/^[A-Za-z0-9._-]+(?:\/[A-Za-z0-9._-]+)*$/,l=/\[\[([^\[\]\n]+)\]\]/g;function a(e){return r.test(e)}i(a,"isDocLinkName");function d(e){const o=[];for(const n of x(e)){l.lastIndex=0;let t;for(;(t=l.exec(n.text))!==null;){const s=t[1];a(s)&&o.push({start:n.offset+t.index,end:n.offset+t.index+t[0].length,name:s})}}return o}i(d,"findDocLinks");function p(e){const o=new Set,n=[];for(const t of d(e))o.has(t.name)||(o.add(t.name),n.push(t.name));return n}i(p,"docLinkNames");const h=/^ {0,3}(`{3,}|~{3,})/;function*x(e){let o=0,n=null;for(const t of e.split(`
2
- `)){const s=t.length+1,c=t.match(h);if(n!==null){c&&c[1][0]===n[0]&&c[1].length>=n.length&&(n=null),o+=s;continue}if(c){n=c[1],o+=s;continue}yield*g(t,o),o+=s}}i(x,"proseSegments");function*g(e,o){let n=0;for(;n<e.length;){const t=e.indexOf("`",n);if(t===-1){yield{offset:o+n,text:e.slice(n)};return}let s=t;for(;s<e.length&&e[s]==="`";)s++;const c=e.slice(t,s),f=e.indexOf(c,s);if(f===-1){yield{offset:o+n,text:e.slice(n,t)},n=s;continue}yield{offset:o+n,text:e.slice(n,t)},n=f+c.length}}i(g,"proseParts");export{p as docLinkNames,d as findDocLinks,a as isDocLinkName};
@@ -1 +0,0 @@
1
- var j=Object.defineProperty;var f=(e,n)=>j(e,"name",{value:n,configurable:!0});import{sep as h}from"node:path";import{listInstalledPlugins as x,listInstalledPluginsInRoot as E}from"../resolver.js";const O=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,k=new Set(["type","values","default","write_help","edit_help"]);function p(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}f(p,"isRecord");function y(e){return typeof e=="string"||typeof e=="boolean"||typeof e=="number"&&Number.isFinite(e)}f(y,"isMemoryExtensionScalar");function c(e,n){return new Error(`invalid memory_extensions declaration at ${e}: ${n}`)}f(c,"declarationError");function g(e){return typeof e=="string"&&e.trim()!==""&&!/[\r\n]/.test(e)}f(g,"validHelp");function m(e,n){return y(n)?e.type==="enum"?typeof n=="string"&&e.values.includes(n):typeof n===e.type:!1}f(m,"validDefault");function b(e){if(!p(e))throw c("memory_extensions","expected a non-empty object");const n={},o=Object.entries(e);if(o.length===0)throw c("memory_extensions","must not be empty");for(const[a,t]of o){const i=`memory_extensions.${a}`;if(!O.test(a))throw c(i,"field names must be lowercase kebab-case");if(!p(t))throw c(i,"expected a declaration object");for(const s of Object.keys(t))if(!k.has(s))throw c(i,`unknown key \`${s}\``);const r=t.type;if(r!=="boolean"&&r!=="string"&&r!=="number"&&r!=="enum")throw c(`${i}.type`,"expected boolean, string, number, or enum");if(!g(t.write_help))throw c(`${i}.write_help`,"expected a nonblank single-line string");if(!g(t.edit_help))throw c(`${i}.edit_help`,"expected a nonblank single-line string");if(r==="enum"){const s=t.values;if(!Array.isArray(s)||s.length===0||!s.every(d=>typeof d=="string"&&d!==""))throw c(`${i}.values`,"expected a non-empty string list");if(new Set(s).size!==s.length)throw c(`${i}.values`,"values must be unique");const l={type:r,values:[...s],write_help:t.write_help,edit_help:t.edit_help};if("default"in t){if(!m(l,t.default))throw c(`${i}.default`,"must be one of the declared enum values");l.default=t.default}n[a]=l;continue}if("values"in t)throw c(`${i}.values`,"is allowed only for enum declarations");const u={type:r,write_help:t.write_help,edit_help:t.edit_help};if("default"in t){if(!m(u,t.default))throw c(`${i}.default`,`must be a ${r}`);u.default=t.default}n[a]=u}return n}f(b,"validateMemoryExtensionDeclarations");function D(e){e.memory_extensions!==void 0&&b(e.memory_extensions)}f(D,"validatePluginMemoryExtensions");function w(e,n){if(e.memory_extensions!==void 0)try{return b(e.memory_extensions)}catch(o){if(n)throw o;return}}f(w,"declarationsFromManifest");function _(e,n,o){const a={},t=new Set;if(o!==void 0){t.add(o.name);const i=w(o,!0);i!==void 0&&(a[o.name]=i)}for(const i of e)for(const r of i){if(n&&!r.enabled)continue;const u=r.manifest.name;if(t.has(u)||a[u]!==void 0)continue;const s=w(r.manifest,!1);s!==void 0&&(a[u]=s)}return a}f(_,"catalogForPlugins");function $(e){if(e.scope==="builtin")return[];if(e.scope==="project"){const n=`${h}.crouter${h}`,o=e.path.lastIndexOf(n);if(o>=0){const a=e.path.slice(0,o+`${h}.crouter`.length);return[E("project",a),x("user")]}}return[x("user")]}f($,"pluginGroupsForDocument");function F(e,n={}){return _($(e),!1,n.candidate)}f(F,"memoryExtensionValidationCatalog");function P(e){return _($(e),!0)}f(P,"memoryExtensionEffectiveCatalog");function S(e,n){if(e===void 0)return[];if(!p(e))return[{path:"extensions",message:"expected a mapping"}];const o=[];for(const[a,t]of Object.entries(e)){const i=`extensions.${a}`;if(!p(t)){o.push({path:i,message:"expected a mapping"});continue}const r=n[a];if(r===void 0){o.push({path:i,message:"unresolved extension namespace"});for(const[u,s]of Object.entries(t))y(s)||o.push({path:`${i}.${u}`,message:"expected a string, boolean, or finite number"});continue}for(const[u,s]of Object.entries(t)){const l=`${i}.${u}`;if(!y(s)){o.push({path:l,message:"expected a string, boolean, or finite number"});continue}const d=r[u];if(d===void 0){o.push({path:l,message:"undeclared extension field"});continue}if(!m(d,s)){const v=d.type==="enum"?`one of ${d.values.join("|")}`:d.type;o.push({path:l,message:`expected ${v}`})}}}return o}f(S,"validateMemoryExtensionValues");function z(e,n){const o=p(e)?e:{},a={};for(const[t,i]of Object.entries(n)){const r={},u=p(o[t])?o[t]:{};for(const[s,l]of Object.entries(i)){l.default!==void 0&&(r[s]=l.default);const d=u[s];m(l,d)&&(r[s]=d)}Object.keys(r).length>0&&(a[t]=r)}return a}f(z,"projectEffectiveMemoryExtensions");export{y as isMemoryExtensionScalar,P as memoryExtensionEffectiveCatalog,F as memoryExtensionValidationCatalog,z as projectEffectiveMemoryExtensions,b as validateMemoryExtensionDeclarations,S as validateMemoryExtensionValues,D as validatePluginMemoryExtensions};
@@ -1,87 +0,0 @@
1
- import type { MemoryDoc } from '../memory-resolver.js';
2
- /** Sidecar tree name under a store's `memory/` dir. Dot-prefixed and holding
3
- * only `.jsonl`, so every substrate scan (which filters to `*.md`, and in
4
- * `lint`'s case skips dot-dirs outright) passes it over without an exclusion
5
- * rule of its own. */
6
- export declare const HISTORY_DIR = ".history";
7
- /** File operations only — deliberately not a review lifecycle. */
8
- export type HistoryOp = 'create' | 'edit' | 'delete' | 'move';
9
- export interface HistoryActor {
10
- cwd: string;
11
- node?: string;
12
- }
13
- export interface HistoryRecord {
14
- op: HistoryOp;
15
- at: string;
16
- /** Authoring node id; absent for a human at a bare CLI. */
17
- node?: string;
18
- cwd: string;
19
- /** The canonical name this document answered to before a `move`; absent otherwise. */
20
- from?: string;
21
- /** Why this revision happened. Required on `edit`, absent otherwise. */
22
- rationale?: string;
23
- /** True when the body was declared a verbatim payload from the principal. */
24
- verbatim?: boolean;
25
- /** Complete document text before the mutation; empty for `create`. */
26
- before: string;
27
- /** Complete document text after the mutation; empty for `delete`. */
28
- after: string;
29
- }
30
- /** The log path for a document, derived from its PHYSICAL path so the history
31
- * tree mirrors the doc tree exactly (`memory/area/topic.md` →
32
- * `memory/.history/area/topic.jsonl`). `memoryRoot` is the store's `memory/`
33
- * dir the doc lives under. */
34
- export declare function historyLogPathFor(memoryRoot: string, docPath: string): string;
35
- /** Stamp the runtime-owned fields of a record. Field insertion order IS the
36
- * serialized key order — the on-disk shape consumers read. */
37
- export declare function buildHistoryRecord(input: {
38
- op: HistoryOp;
39
- actor?: HistoryActor;
40
- from?: string;
41
- rationale?: string;
42
- verbatim?: boolean;
43
- before: string;
44
- after: string;
45
- }): HistoryRecord;
46
- /** Derive a live document's sidecar from its descriptor. The descriptor's
47
- * physical path is authoritative: canonical names carry a project namespace,
48
- * while sidecars remain in the owning store's physical tree. */
49
- export declare function historyLogPathForDoc(doc: Pick<MemoryDoc, 'root' | 'path'>): string;
50
- export interface DeletedHistoryCandidate {
51
- path: string;
52
- representation: 'directory-index' | 'leaf-file';
53
- winner: boolean;
54
- }
55
- export interface DeletedHistoryResolution {
56
- logPath: string;
57
- candidates: readonly DeletedHistoryCandidate[];
58
- collision?: {
59
- paths: readonly string[];
60
- winner: string;
61
- };
62
- }
63
- /** Resolve a deleted document's physical history without reintroducing a
64
- * canonical-name fallback. `localName` is already stripped of the selected
65
- * project's exact namespace. The directory-index sidecar is deliberately
66
- * probed first, and therefore wins deterministically if both physical forms
67
- * survive; callers can expose `candidates`/`collision` for diagnostics. */
68
- export declare function resolveDeletedHistoryLogPath(storeRoot: string, localName: string): DeletedHistoryResolution | null;
69
- /** Append one record. Single write of one line — concurrent appends interleave
70
- * whole records, and every record stands alone, so no lock is needed. */
71
- /** Append beneath `root`, the store root the log mirrors. */
72
- export declare function appendHistoryRecord(root: string, logPath: string, record: HistoryRecord): void;
73
- /** Every record in a log beneath `root` (the store root it mirrors), oldest
74
- * first (append order). Revision numbers are 1-based positions in this array. */
75
- export declare function readHistoryRecords(root: string, logPath: string): HistoryRecord[];
76
- export interface ChangeSummary {
77
- body_changed: boolean;
78
- /** Frontmatter field names whose values differ between the two texts. */
79
- frontmatter_changed: string[];
80
- }
81
- /** What one record changed, derived from its own two texts. `last-updated` is
82
- * excluded: the runtime stamps it on every edit, so listing it says nothing. */
83
- export declare function summarizeChange(before: string, after: string): ChangeSummary;
84
- /** Unified diff between two document texts, computed at read time. Dependency
85
- * free (an LCS over lines) — memory docs are lint-capped small, so the
86
- * quadratic table is never a cost. */
87
- export declare function unifiedDiff(before: string, after: string, context?: number): string;
@@ -1,6 +0,0 @@
1
- var M=Object.defineProperty;var l=(t,o)=>M(t,"name",{value:o,configurable:!0});import{readdirSync as j}from"node:fs";import{join as x,relative as _}from"node:path";import{appendFileBeneath as A,readTextBeneathIfExists as T}from"../spaces/open-beneath.js";import{envNodeCwd as H,envNodeId as J}from"../../shared/env.js";import{general as D}from"../errors.js";import{parseFrontmatterGeneric as $}from"../frontmatter.js";import{normalizeNameSegment as N}from"./identity.js";const F=".history";function R(t,o){const e=_(t,o);if(e===""||e.startsWith(".."))throw D(`memory document ${o} is not inside its store root ${t}`);return x(t,F,e.replace(/\.md$/i,"")+".jsonl")}l(R,"historyLogPathFor");function Z(t){const o=J(),e=t.actor??{cwd:H()??process.cwd(),...o===void 0?{}:{node:o}};return{op:t.op,at:new Date().toISOString(),...e.node!==void 0?{node:e.node}:{},cwd:e.cwd,...t.from!==void 0?{from:t.from}:{},...t.rationale!==void 0?{rationale:t.rationale}:{},...t.verbatim===!0?{verbatim:!0}:{},before:t.before,after:t.after}}l(Z,"buildHistoryRecord");function tt(t){return R(t.root,t.path)}l(tt,"historyLogPathForDoc");function W(t,o){let e;try{e=j(t,{withFileTypes:!0})}catch{return[]}return e.filter(n=>n.isDirectory()&&N(n.name)===o).sort((n,i)=>n.name===o?-1:i.name===o?1:n.name.localeCompare(i.name)).map(n=>x(t,n.name))}l(W,"matchingDirs");function P(t,o){let e;try{e=j(t,{withFileTypes:!0})}catch{return[]}return e.filter(n=>n.isFile()&&n.name.endsWith(".jsonl")&&N(n.name.slice(0,-6))===o).sort((n,i)=>n.name===`${o}.jsonl`?-1:i.name===`${o}.jsonl`?1:n.name.localeCompare(i.name)).map(n=>x(t,n.name))}l(P,"matchingFiles");function I(t,o,e){let n=[t];for(const i of o)if(n=n.flatMap(a=>W(a,i)),n.length===0)return[];return n.flatMap(i=>P(i,e))}l(I,"historyFilesForSegments");function et(t,o){const e=o.split("/").filter(s=>s!=="").map(N),n=x(t,F),i=I(n,e,"INDEX"),a=e.length===0?[]:I(n,e.slice(0,-1),e[e.length-1]),r=[...i.map(s=>({path:s,representation:"directory-index",winner:!1})),...a.map(s=>({path:s,representation:"leaf-file",winner:!1}))];return r.length===0?null:(r[0].winner=!0,{logPath:r[0].path,candidates:r,...r.length>1?{collision:{paths:r.map(s=>s.path),winner:r[0].path}}:{}})}l(et,"resolveDeletedHistoryLogPath");function nt(t,o,e){A(t,o,JSON.stringify(e)+`
2
- `)}l(nt,"appendHistoryRecord");function ot(t,o){const e=T(t,o);if(e===null)return[];const n=e.split(`
3
- `),i=[];for(let a=0;a<n.length;a+=1){const r=n[a];if(r.trim()!=="")try{i.push(JSON.parse(r))}catch{throw D(`corrupt history record at ${o}:${a+1} \u2014 the line is not valid JSON`,{next:"Inspect that line directly; the surrounding records are self-contained and still readable."})}}return i}l(ot,"readHistoryRecords");function rt(t,o){const e=$(t),n=$(o),i=e.data??{},a=n.data??{},r=new Set([...Object.keys(i),...Object.keys(a)]);r.delete("last-updated");const s=[...r].filter(c=>JSON.stringify(i[c])!==JSON.stringify(a[c])).sort((c,f)=>c.localeCompare(f));return{body_changed:e.body!==n.body,frontmatter_changed:s}}l(rt,"summarizeChange");function it(t,o,e=3){const{lines:n,terminated:i}=L(t),{lines:a,terminated:r}=L(o),s=k(E(n,i),E(a,r)),c=[];for(let d=0;d<s.length;d+=1){if(s[d].tag===" ")continue;const p=Math.max(0,d-e),g=Math.min(s.length,d+e+1),u=c[c.length-1];u!==void 0&&p<=u.to?u.to=Math.max(u.to,g):c.push({from:p,to:g})}if(c.length===0)return"";const f=[],w=[];let b=0,O=0;for(const d of s)f.push(b),w.push(O),d.tag!=="+"&&(b+=1),d.tag!=="-"&&(O+=1);const y=[];for(const{from:d,to:p}of c){const g=s.slice(d,p),u=g.filter(h=>h.tag!=="+").length,S=g.filter(h=>h.tag!=="-").length;y.push(`@@ -${u===0?0:f[d]+1},${u} +${S===0?0:w[d]+1},${S} @@`);for(let h=d;h<p;h+=1){const m=s[h];y.push(m.tag+(m.tag==="+"?a[m.index]:n[m.index]));const v=m.tag!=="+"&&!i&&f[h]===n.length-1,C=m.tag!=="-"&&!r&&w[h]===a.length-1;(v||C)&&y.push(B)}}return y.join(`
4
- `)}l(it,"unifiedDiff");const B="\",K="\0no-newline-at-eof";function E(t,o){return o||t.length===0?t:t.map((e,n)=>n===t.length-1?e+K:e)}l(E,"diffKeys");function L(t){if(t==="")return{lines:[],terminated:!0};const o=t.endsWith(`
5
- `),e=t.split(`
6
- `);return o&&e.pop(),{lines:e,terminated:o}}l(L,"toLines");function k(t,o){const e=t.length,n=o.length,i=Array.from({length:e+1},()=>new Array(n+1).fill(0));for(let c=e-1;c>=0;c-=1)for(let f=n-1;f>=0;f-=1)i[c][f]=t[c]===o[f]?i[c+1][f+1]+1:Math.max(i[c+1][f],i[c][f+1]);const a=[];let r=0,s=0;for(;r<e&&s<n;)t[r]===o[s]?(a.push({tag:" ",index:r}),r+=1,s+=1):i[r+1][s]>=i[r][s+1]?(a.push({tag:"-",index:r}),r+=1):(a.push({tag:"+",index:s}),s+=1);for(;r<e;r+=1)a.push({tag:"-",index:r});for(;s<n;s+=1)a.push({tag:"+",index:s});return a}l(k,"diffOps");export{F as HISTORY_DIR,nt as appendHistoryRecord,Z as buildHistoryRecord,R as historyLogPathFor,tt as historyLogPathForDoc,ot as readHistoryRecords,et as resolveDeletedHistoryLogPath,rt as summarizeChange,it as unifiedDiff};
@@ -1,65 +0,0 @@
1
- /** The filename (and path segment) whose document fronts its directory. */
2
- export declare const INDEX_SEGMENT = "INDEX";
3
- /** Strip an optional `NN-` ordering prefix from ONE segment. */
4
- export declare function normalizeNameSegment(segment: string): string;
5
- /** Slugify one authored or filesystem label into a canonical segment. */
6
- export declare function slugCanonicalSegment(raw: string): string;
7
- /** Slugify a derived label into canonical path segments. Empty segments are
8
- * intentionally dropped; owner paths use slugCanonicalSegment directly. */
9
- export declare function slugCanonicalPath(raw: string): string;
10
- /** Strip the ordering prefix from EVERY segment of a slash-separated name:
11
- * `01-spine/00-has-manager` -> `spine/has-manager`. */
12
- export declare function normalizeDocName(name: string): string;
13
- /** Split a name into segments, dropping empties from `//`, a leading `/`, or an
14
- * empty name. */
15
- export declare function canonicalSegments(name: string): string[];
16
- /** The canonical directory containing `name`, or `''` at the top. */
17
- export declare function canonicalParent(name: string): string;
18
- /** Remove EXACTLY ONE trailing `INDEX` segment. `a/INDEX` -> `a`; `INDEX` ->
19
- * `''` (a store root); `a/INDEX/INDEX` -> `a/INDEX` (the inner segment is an
20
- * ordinary directory name). */
21
- export declare function collapseTrailingIndex(name: string): string;
22
- export type DocRepresentation = 'leaf-file' | 'directory-index';
23
- /** Which form a store-relative markdown path takes. */
24
- export declare function representationForPath(physicalRelativePath: string): DocRepresentation;
25
- /** Store-local name derived from a store-relative markdown path: ordering
26
- * prefixes stripped from every segment and one trailing `INDEX` collapsed.
27
- * Empty only for a store root `INDEX.md`. */
28
- export declare function localNameFromPath(physicalRelativePath: string): string;
29
- /** The store-relative markdown path a local name occupies in a given form.
30
- * Both forms are checked before any create or move, so occupancy never depends
31
- * on which one a store happens to use. */
32
- export declare function physicalRelativePathFor(localName: string, representation: DocRepresentation): string;
33
- /** A document's explicit frontmatter `name` as a local name — normalized with
34
- * one trailing `INDEX` collapsed — or `null` when it carries none. */
35
- export declare function explicitLocalName(fm: Record<string, unknown> | null | undefined): string | null;
36
- /** A document's store-local name: its explicit frontmatter `name` when present,
37
- * else the path-derived local name. Explicit names are local to their store —
38
- * they never carry the store's namespace. */
39
- export declare function resolveLocalName(fm: Record<string, unknown> | null | undefined, pathDerivedLocalName: string): string;
40
- /** namespace ⊕ local — the only address. Composition is unconditional: a local
41
- * name that already looks namespace-prefixed is composed anyway, so identity
42
- * never depends on string coincidence. An empty result means a namespace-less
43
- * store root, which has no valid canonical identity. */
44
- export declare function composeCanonicalName(namespace: string, localName: string): string;
45
- /** The canonical directory a document's `./` memory-read entries match against:
46
- * a directory document anchors at its own name, an ordinary leaf at its
47
- * canonical parent. */
48
- export declare function routingAnchorFor(canonicalName: string, representation: DocRepresentation): string;
49
- /** The local name a canonical name has inside `namespace`, or `null` when it
50
- * falls outside it. Exact on segment boundaries: `a/bc` is not inside `a/b`.
51
- * The namespace itself yields `''` — the store root document. */
52
- export declare function stripNamespace(canonicalName: string, namespace: string): string | null;
53
- export type IdentityValidation = {
54
- ok: true;
55
- } | {
56
- ok: false;
57
- reason: string;
58
- };
59
- /** A project store's declared namespace, or an installed plugin's mount prefix:
60
- * one or more normalized segments, never ending in `INDEX`. */
61
- export declare function validateNamespace(namespace: string): IdentityValidation;
62
- /** An explicit non-root `name:`: a non-empty local name, never ending in
63
- * `INDEX` (its directory name is the identity) and never carrying its own
64
- * store's namespace. */
65
- export declare function validateExplicitLocalName(localName: string, namespace?: string): IdentityValidation;
@@ -1 +0,0 @@
1
- var m=Object.defineProperty;var t=(e,n)=>m(e,"name",{value:n,configurable:!0});const c=/^\d{2}-/,g=/^[A-Za-z0-9._-]+$/,s="INDEX";function u(e){return e.replace(c,"")}t(u,"normalizeNameSegment");function d(e){return u(e.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,""))}t(d,"slugCanonicalSegment");function k(e){return e.replace(/\\/g,"/").replace(/\.md$/i,"").split("/").map(d).filter(Boolean).join("/")}t(k,"slugCanonicalPath");function x(e){return e.split("/").map(u).join("/")}t(x,"normalizeDocName");function o(e){return e.split("/").filter(n=>n!=="")}t(o,"canonicalSegments");function h(e){return o(e).slice(0,-1).join("/")}t(h,"canonicalParent");function l(e){const n=o(e);return n[n.length-1]===s&&n.pop(),n.join("/")}t(l,"collapseTrailingIndex");function f(e){return o(e.replace(/\\/g,"/").replace(/\.md$/i,"")).map(u)}t(f,"pathIdentitySegments");function j(e){const n=f(e);return n[n.length-1]===s?"directory-index":"leaf-file"}t(j,"representationForPath");function N(e){return l(f(e).join("/"))}t(N,"localNameFromPath");function S(e,n){const r=o(e).join("/");if(r===""){if(n==="leaf-file")throw new Error("a store root document has no leaf-file representation");return`${s}.md`}return n==="directory-index"?`${r}/${s}.md`:`${r}.md`}t(S,"physicalRelativePathFor");function $(e){const n=e?.name;return typeof n!="string"||n.trim()===""?null:l(x(n.trim()))}t($,"explicitLocalName");function w(e,n){return $(e)??n}t(w,"resolveLocalName");function _(e,n){const r=o(e).join("/"),i=o(n).join("/");return r===""?i:i===""?r:`${r}/${i}`}t(_,"composeCanonicalName");function v(e,n){return n==="directory-index"?o(e).join("/"):h(e)}t(v,"routingAnchorFor");function y(e,n){const r=o(e),i=o(n);for(let a=0;a<i.length;a++)if(r[a]!==i[a])return null;return r.slice(i.length).join("/")}t(y,"stripNamespace");function p(e){for(const n of e.split("/")){if(n==="")return`empty segment in \`${e}\``;if(n==="."||n==="..")return`relative segment \`${n}\` in \`${e}\``;if(!g.test(n))return`segment \`${n}\` is not [A-Za-z0-9._-]`;if(c.test(n))return`segment \`${n}\` carries an \`NN-\` ordering prefix, which is physical-path-only \u2014 use \`${u(n)}\``}return null}t(p,"invalidSegmentReason");function I(e){if(e.trim()!==e)return{ok:!1,reason:"namespace has surrounding whitespace"};if(e==="")return{ok:!1,reason:"namespace is empty"};const n=p(e);return n!==null?{ok:!1,reason:n}:o(e).pop()===s?{ok:!1,reason:`namespace ends in \`${s}\``}:{ok:!0}}t(I,"validateNamespace");function P(e,n=""){if(e.trim()!==e)return{ok:!1,reason:"name has surrounding whitespace"};if(e==="")return{ok:!1,reason:"name is empty"};const r=p(e);if(r!==null)return{ok:!1,reason:r};if(o(e).pop()===s){const i=l(e);return{ok:!1,reason:`name ends in \`${s}\` \u2014 a directory document answers at its directory name${i===""?"":`, so use \`${i}\``}`}}return n!==""&&y(e,n)!==null?{ok:!1,reason:`name repeats its store's namespace \`${n}\` \u2014 explicit names are store-local`}:{ok:!0}}t(P,"validateExplicitLocalName");export{s as INDEX_SEGMENT,h as canonicalParent,o as canonicalSegments,l as collapseTrailingIndex,_ as composeCanonicalName,$ as explicitLocalName,N as localNameFromPath,x as normalizeDocName,u as normalizeNameSegment,S as physicalRelativePathFor,j as representationForPath,w as resolveLocalName,v as routingAnchorFor,k as slugCanonicalPath,d as slugCanonicalSegment,y as stripNamespace,P as validateExplicitLocalName,I as validateNamespace};
@@ -1,2 +0,0 @@
1
- var a=Object.defineProperty;var c=(n,t)=>a(n,"name",{value:t,configurable:!0});import{findRefTokens as r}from"./inline-ref-grammar.js";const s="The user explicitly called out specific memories. Read the relevant mentioned memory files:";function u(n,t){const o=new Set,i=[];for(const e of r(n))o.has(e.candidate)||t.has(e.candidate)&&(o.add(e.candidate),i.push(e.candidate));if(i.length===0)return null;const d=i.map(e=>`- crtr memory read ${e}`);return[s,...d].join(`
2
- `)}c(u,"buildGuidance");export{u as buildGuidance};
@@ -1,9 +0,0 @@
1
- import { type MemoryTarget } from '../memory-resolver.js';
2
- import type { RefMeta } from '../runtime/broker-protocol.js';
3
- /** Build the inline inventory from exact target-view winners. `refs` carries
4
- * metadata rows; `names` adds only canonical directory nodes with members for
5
- * browse links. Gates, rungs, and `slash` do not affect referenceability. */
6
- export declare function buildRefInventory(target?: MemoryTarget): {
7
- refs: RefMeta[];
8
- names: Set<string>;
9
- };
@@ -1 +0,0 @@
1
- var d=Object.defineProperty;var c=(n,i)=>d(n,"name",{value:i,configurable:!0});import{ambientMemoryTarget as u,loadMemoryTargetView as h}from"../memory-resolver.js";import{buildMemoryTree as y}from"./tree.js";import{memoryExtensionEffectiveCatalog as D,projectEffectiveMemoryExtensions as b}from"./extensions.js";import{parseSubstrateDoc as g}from"../substrate/schema.js";const f={node:0,project:1,profile:2,user:3,builtin:4};function x(n=u()){const i=h(n,{quiet:!0}),s=new Map;for(const e of i.candidateSets()){const o=e.winner,t=g(o);t!==null&&s.set(e.name,{doc:t,memoryDoc:o})}const r=[];for(const[e,{doc:o,memoryDoc:t}]of s){const p=o.scope!=="builtin"&&b(t.frontmatter?.extensions,D(t)).northlight?.visibility!==!1;r.push({name:e,kind:o.kind,scope:o.scope,shortForm:o.shortForm,gatewayVisible:p})}r.sort((e,o)=>{const t=f[e.scope]-f[o.scope];return t!==0?t:e.name.localeCompare(o.name)});const m=new Set(r.map(e=>e.name)),l=y([...s.values()].map(({memoryDoc:e})=>e)),a=c(e=>{e.name!==""&&(e.childDirectories.length>0||e.childDocuments.length>0)&&m.add(e.name);for(const o of e.childDirectories)a(o)},"addDirectoryNames");return a(l.root),{refs:r,names:m}}c(x,"buildRefInventory");export{x as buildRefInventory};