@north-light/crouter 0.3.352 → 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 (616) 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/app-listener.js +11 -11
  382. package/dist/daemon/api/handlers/app-profiles.js +1 -1
  383. package/dist/daemon/api/handlers/bash-jobs.js +1 -2
  384. package/dist/daemon/api/handlers/broker-ops.js +1 -1
  385. package/dist/daemon/api/handlers/canvas.js +5 -5
  386. package/dist/daemon/api/handlers/daemon.js +1 -1
  387. package/dist/daemon/api/handlers/delivery.d.ts +2 -0
  388. package/dist/daemon/api/handlers/delivery.js +1 -0
  389. package/dist/daemon/api/handlers/{memory.d.ts → docs.d.ts} +1 -1
  390. package/dist/daemon/api/handlers/docs.js +1 -0
  391. package/dist/daemon/api/handlers/hook-exec.js +1 -1
  392. package/dist/daemon/api/handlers/messages.js +2 -2
  393. package/dist/daemon/api/handlers/modelauth.d.ts +3 -0
  394. package/dist/daemon/api/handlers/modelauth.js +1 -1
  395. package/dist/daemon/api/handlers/node-records.js +2 -2
  396. package/dist/daemon/api/handlers/nodes.js +1 -1
  397. package/dist/daemon/api/handlers/objects.d.ts +2 -0
  398. package/dist/daemon/api/handlers/objects.js +5 -0
  399. package/dist/daemon/api/handlers/package-docs.d.ts +2 -0
  400. package/dist/daemon/api/handlers/package-docs.js +1 -0
  401. package/dist/daemon/api/handlers/profiles.js +1 -1
  402. package/dist/daemon/api/handlers/reports.d.ts +2 -2
  403. package/dist/daemon/api/handlers/reports.js +4 -4
  404. package/dist/daemon/api/handlers/reviews.js +1 -1
  405. package/dist/daemon/api/handlers/vendor-status.d.ts +8 -0
  406. package/dist/daemon/api/handlers/vendor-status.js +1 -0
  407. package/dist/daemon/api/map.d.ts +2 -2
  408. package/dist/daemon/api/map.js +2 -2
  409. package/dist/daemon/api/operations.d.ts +1 -1
  410. package/dist/daemon/api/operations.js +1 -1
  411. package/dist/daemon/api/principal.d.ts +5 -0
  412. package/dist/daemon/api/principal.js +1 -1
  413. package/dist/daemon/api/reader.d.ts +17 -0
  414. package/dist/daemon/api/reader.js +1 -0
  415. package/dist/daemon/api/server.js +1 -1
  416. package/dist/daemon/control.d.ts +2 -3
  417. package/dist/daemon/crtrd.js +8 -6
  418. package/dist/daemon/fleet.js +4 -4
  419. package/dist/daemon/reconcilers/bash-deadline.d.ts +11 -1
  420. package/dist/daemon/reconcilers/bash-deadline.js +2 -1
  421. package/dist/daemon/reconcilers/broker-supervision.js +4 -4
  422. package/dist/daemon/reconcilers/live-obligation.js +1 -1
  423. package/dist/daemon/reconcilers/node-deadline.js +1 -1
  424. package/dist/daemon/reconcilers/node-lifecycle/freeze-lane.js +1 -1
  425. package/dist/daemon/reconcilers/storage-maintenance.d.ts +1 -0
  426. package/dist/daemon/reconcilers/storage-maintenance.js +1 -1
  427. package/dist/daemon/review/deliver.js +2 -2
  428. package/dist/daemon/review/finish.js +1 -1
  429. package/dist/hook-authoring.d.ts +0 -1
  430. package/dist/hook-authoring.js +3 -3
  431. package/dist/migrations/004-canvas-documents/apply.d.ts +10 -0
  432. package/dist/migrations/004-canvas-documents/apply.js +1 -0
  433. package/dist/migrations/004-canvas-documents/fields.d.ts +24 -0
  434. package/dist/migrations/004-canvas-documents/fields.js +2 -0
  435. package/dist/migrations/004-canvas-documents/index.d.ts +16 -0
  436. package/dist/migrations/004-canvas-documents/index.js +2 -0
  437. package/dist/migrations/004-canvas-documents/legacy/discover.d.ts +16 -0
  438. package/dist/migrations/004-canvas-documents/legacy/discover.js +1 -0
  439. package/dist/migrations/004-canvas-documents/legacy/history.d.ts +5 -0
  440. package/dist/migrations/004-canvas-documents/legacy/history.js +2 -0
  441. package/dist/migrations/004-canvas-documents/legacy/nested.d.ts +7 -0
  442. package/dist/migrations/004-canvas-documents/legacy/nested.js +1 -0
  443. package/dist/migrations/004-canvas-documents/legacy/parse.d.ts +14 -0
  444. package/dist/migrations/004-canvas-documents/legacy/parse.js +1 -0
  445. package/dist/migrations/004-canvas-documents/legacy/types.d.ts +91 -0
  446. package/dist/migrations/004-canvas-documents/legacy/types.js +0 -0
  447. package/dist/migrations/004-canvas-documents/legacy-edges.d.ts +6 -0
  448. package/dist/migrations/004-canvas-documents/legacy-edges.js +18 -0
  449. package/dist/migrations/004-canvas-documents/plan.d.ts +102 -0
  450. package/dist/migrations/004-canvas-documents/plan.js +3 -0
  451. package/dist/migrations/004-canvas-documents/pointers.d.ts +23 -0
  452. package/dist/migrations/004-canvas-documents/pointers.js +4 -0
  453. package/dist/migrations/activation.d.ts +9 -18
  454. package/dist/migrations/activation.js +2 -2
  455. package/dist/pi-extensions/broker-local.d.ts +2 -2
  456. package/dist/pi-extensions/broker-local.js +2 -2
  457. package/dist/pi-extensions/canvas-bash-valve.js +5 -4
  458. package/dist/pi-extensions/canvas-context-intro.js +2 -2
  459. package/dist/pi-extensions/canvas-doc-substrate.d.ts +0 -1
  460. package/dist/pi-extensions/canvas-doc-substrate.js +6 -6
  461. package/dist/pi-extensions/canvas-inbox-watcher.js +2 -2
  462. package/dist/pi-extensions/canvas-passive-context.js +1 -1
  463. package/dist/pi-extensions/canvas-recap.js +2 -2
  464. package/dist/pi-extensions/canvas-stophook.d.ts +1 -1
  465. package/dist/pi-extensions/canvas-stophook.js +1 -1
  466. package/dist/prompts/review.js +3 -3
  467. package/dist/shared/env.d.ts +5 -0
  468. package/dist/shared/env.js +1 -1
  469. package/dist/shared/generated-context.js +2 -10
  470. package/dist/shared/inbox-entry-body.d.ts +22 -0
  471. package/dist/shared/inbox-entry-body.js +10 -0
  472. package/dist/{core/memory → shared}/inline-ref-guidance.d.ts +2 -2
  473. package/dist/shared/inline-ref-guidance.js +2 -0
  474. package/dist/types.d.ts +3 -1
  475. package/docs/cli/memory-and-preferences.md +12 -14
  476. package/docs/concepts/README.md +1 -1
  477. package/docs/concepts/lifecycle-and-wakes.md +1 -1
  478. package/docs/concepts/memory.md +15 -15
  479. package/docs/concepts/nodes-and-the-canvas.md +1 -1
  480. package/docs/concepts/profiles-kinds-and-modes.md +5 -5
  481. package/docs/concepts/scopes-and-trust.md +1 -1
  482. package/docs/concepts/why-a-daemon.md +1 -1
  483. package/docs/sdk/README.md +5 -6
  484. package/docs/sdk/errors.md +0 -13
  485. package/docs/sdk/guides/README.md +0 -1
  486. package/docs/sdk/nodes.md +0 -2
  487. package/docs/sdk/resources.md +0 -1
  488. package/package.json +2 -2
  489. package/packages/crouter-identity/package.json +1 -1
  490. package/runtime.lock.json +11 -11
  491. package/dist/api/dto/memory.d.ts +0 -171
  492. package/dist/api/dto/memory.js +0 -1
  493. package/dist/builtin-memory/crouter-sdk/guides/app-memory.md +0 -73
  494. package/dist/builtin-memory/crouter-sdk/memory.md +0 -87
  495. package/dist/commands/broker-permissions.d.ts +0 -2
  496. package/dist/commands/broker-permissions.js +0 -1
  497. package/dist/commands/memory/client.d.ts +0 -11
  498. package/dist/commands/memory/client.js +0 -1
  499. package/dist/commands/memory/delete.d.ts +0 -1
  500. package/dist/commands/memory/delete.js +0 -1
  501. package/dist/commands/memory/edit.d.ts +0 -1
  502. package/dist/commands/memory/edit.js +0 -21
  503. package/dist/commands/memory/find.d.ts +0 -1
  504. package/dist/commands/memory/find.js +0 -1
  505. package/dist/commands/memory/history.d.ts +0 -1
  506. package/dist/commands/memory/history.js +0 -5
  507. package/dist/commands/memory/lint.d.ts +0 -1
  508. package/dist/commands/memory/lint.js +0 -1
  509. package/dist/commands/memory/list.d.ts +0 -1
  510. package/dist/commands/memory/list.js +0 -1
  511. package/dist/commands/memory/move.d.ts +0 -1
  512. package/dist/commands/memory/move.js +0 -1
  513. package/dist/commands/memory/origin.d.ts +0 -1
  514. package/dist/commands/memory/origin.js +0 -1
  515. package/dist/commands/memory/read.d.ts +0 -1
  516. package/dist/commands/memory/read.js +0 -6
  517. package/dist/commands/memory/shared.d.ts +0 -22
  518. package/dist/commands/memory/shared.js +0 -1
  519. package/dist/commands/memory/write.d.ts +0 -1
  520. package/dist/commands/memory/write.js +0 -13
  521. package/dist/commands/memory.js +0 -1
  522. package/dist/commands/node-inspect-artifacts.d.ts +0 -1
  523. package/dist/commands/node-inspect-artifacts.js +0 -8
  524. package/dist/core/help/memory-extensions.d.ts +0 -3
  525. package/dist/core/help/memory-extensions.js +0 -2
  526. package/dist/core/memory/cli-selector.d.ts +0 -13
  527. package/dist/core/memory/cli-selector.js +0 -1
  528. package/dist/core/memory/doc-link-grammar.d.ts +0 -20
  529. package/dist/core/memory/doc-link-grammar.js +0 -2
  530. package/dist/core/memory/extensions.js +0 -1
  531. package/dist/core/memory/history.d.ts +0 -87
  532. package/dist/core/memory/history.js +0 -6
  533. package/dist/core/memory/identity.d.ts +0 -65
  534. package/dist/core/memory/identity.js +0 -1
  535. package/dist/core/memory/inline-ref-guidance.js +0 -2
  536. package/dist/core/memory/inline-ref-inventory.d.ts +0 -9
  537. package/dist/core/memory/inline-ref-inventory.js +0 -1
  538. package/dist/core/memory/lint.d.ts +0 -163
  539. package/dist/core/memory/lint.js +0 -2
  540. package/dist/core/memory/mutation-domain.d.ts +0 -113
  541. package/dist/core/memory/mutation-domain.js +0 -12
  542. package/dist/core/memory/mutations.d.ts +0 -74
  543. package/dist/core/memory/mutations.js +0 -1
  544. package/dist/core/memory/project-namespace.d.ts +0 -31
  545. package/dist/core/memory/project-namespace.js +0 -2
  546. package/dist/core/memory/repository-association.d.ts +0 -31
  547. package/dist/core/memory/repository-association.js +0 -1
  548. package/dist/core/memory/service.d.ts +0 -145
  549. package/dist/core/memory/service.js +0 -2
  550. package/dist/core/memory/tree.d.ts +0 -39
  551. package/dist/core/memory/tree.js +0 -1
  552. package/dist/core/memory-resolver.d.ts +0 -280
  553. package/dist/core/memory-resolver.js +0 -2
  554. package/dist/core/nested-stores.d.ts +0 -18
  555. package/dist/core/nested-stores.js +0 -1
  556. package/dist/core/runtime/memory.d.ts +0 -3
  557. package/dist/core/runtime/memory.js +0 -1
  558. package/dist/core/substrate/frontmatter-validation.d.ts +0 -11
  559. package/dist/core/substrate/frontmatter-validation.js +0 -1
  560. package/dist/core/substrate/gate.d.ts +0 -16
  561. package/dist/core/substrate/gate.js +0 -1
  562. package/dist/core/substrate/index.d.ts +0 -18
  563. package/dist/core/substrate/index.js +0 -1
  564. package/dist/core/substrate/injected-store.d.ts +0 -75
  565. package/dist/core/substrate/injected-store.js +0 -2
  566. package/dist/core/substrate/listings.d.ts +0 -28
  567. package/dist/core/substrate/listings.js +0 -1
  568. package/dist/core/substrate/memory-events.d.ts +0 -6
  569. package/dist/core/substrate/memory-events.js +0 -1
  570. package/dist/core/substrate/on-read-node.d.ts +0 -6
  571. package/dist/core/substrate/on-read-node.js +0 -1
  572. package/dist/core/substrate/on-read.d.ts +0 -101
  573. package/dist/core/substrate/on-read.js +0 -9
  574. package/dist/core/substrate/plan.d.ts +0 -94
  575. package/dist/core/substrate/plan.js +0 -1
  576. package/dist/core/substrate/render-node.d.ts +0 -12
  577. package/dist/core/substrate/render-node.js +0 -1
  578. package/dist/core/substrate/render.d.ts +0 -41
  579. package/dist/core/substrate/render.js +0 -65
  580. package/dist/core/substrate/session-cache.d.ts +0 -27
  581. package/dist/core/substrate/session-cache.js +0 -1
  582. package/dist/core/substrate/surface-match.d.ts +0 -73
  583. package/dist/core/substrate/surface-match.js +0 -1
  584. package/dist/daemon/api/handlers/memory.js +0 -5
  585. package/dist/migrations/001-surfaces-frontmatter.d.ts +0 -2
  586. package/dist/migrations/001-surfaces-frontmatter.js +0 -1
  587. package/dist/migrations/002-profile-project-memory.d.ts +0 -2
  588. package/dist/migrations/002-profile-project-memory.js +0 -1
  589. package/dist/migrations/003-repository-root-memory-identity/front-door.d.ts +0 -26
  590. package/dist/migrations/003-repository-root-memory-identity/front-door.js +0 -11
  591. package/dist/migrations/003-repository-root-memory-identity/index.d.ts +0 -2
  592. package/dist/migrations/003-repository-root-memory-identity/index.js +0 -5
  593. package/dist/migrations/003-repository-root-memory-identity/references.d.ts +0 -95
  594. package/dist/migrations/003-repository-root-memory-identity/references.js +0 -5
  595. package/dist/migrations/003-repository-root-memory-identity/repository-facts.d.ts +0 -39
  596. package/dist/migrations/003-repository-root-memory-identity/repository-facts.js +0 -3
  597. package/dist/migrations/convergent.d.ts +0 -43
  598. package/dist/migrations/convergent.js +0 -2
  599. package/dist/migrations/corpus.d.ts +0 -75
  600. package/dist/migrations/corpus.js +0 -3
  601. package/dist/migrations/frontmatter-splice.d.ts +0 -15
  602. package/dist/migrations/frontmatter-splice.js +0 -8
  603. package/dist/migrations/profile-manifests.d.ts +0 -30
  604. package/dist/migrations/profile-manifests.js +0 -2
  605. package/dist/migrations/registry.d.ts +0 -7
  606. package/dist/migrations/registry.js +0 -1
  607. package/dist/migrations/runner.d.ts +0 -43
  608. package/dist/migrations/runner.js +0 -1
  609. package/dist/migrations/types.d.ts +0 -211
  610. package/dist/shared/birth-announcement.d.ts +0 -12
  611. package/dist/shared/birth-announcement.js +0 -1
  612. package/docs/sdk/guides/app-memory.md +0 -22
  613. package/docs/sdk/memory.md +0 -85
  614. /package/dist/{migrations/types.js → api/dto/delivery.js} +0 -0
  615. /package/dist/{core/memory → shared}/inline-ref-grammar.d.ts +0 -0
  616. /package/dist/{core/memory → shared}/inline-ref-grammar.js +0 -0
@@ -1,25 +1,14 @@
1
- var Y=Object.defineProperty;var a=(n,t)=>Y(n,"name",{value:t,configurable:!0});import{envNodeId as Q}from"../../shared/env.js";import{join as x,relative as U,sep as V}from"node:path";import{getNode as _,listNodes as B,view as X}from"./canvas.js";import{contextDir as Z,reportsDir as k,nodeAgentDir as $}from"./node-agent-paths.js";import{openDb as nn}from"./db.js";import{pathExists as C,readTextIfExists as en}from"../fs-utils.js";import{readdirBeneath as tn,readTextBeneathIfExists as v,statBeneath as E,walkFilesBeneath as on}from"../spaces/open-beneath.js";import{conversationIdFromPath as S,conversationStore as w,ConversationNotFoundError as sn}from"../conversation-store/index.js";import{parseFrontmatterGeneric as N}from"../frontmatter.js";import{warn as rn}from"../output.js";import{readStamps as dn}from"../runtime/stamp/protocol.js";const On=["human","inbox","wake","revive","restart-continuation","stop-guard","park","recovery","context-nudge","kickoff","unknown"],Rn=["user","assistant","toolResult"];function an(){const n=Q();if(n!==void 0&&n!==""){const t=_(n);if(t!==null)return t.cwd}return process.cwd()}a(an,"callerCwd");function A(n){const t=n.match(/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})$/);return t===null?n:`${t[1]}-${t[2]}-${t[3]}T${t[4]}:${t[5]}:${t[6]}`}a(A,"compactToIso");function g(n){const t=Date.parse(n);return Number.isNaN(t)?0:t}a(g,"toMs");function T(n){const t=n.split(`
2
- `);for(const e of t){const i=e.trim();if(i.startsWith("#"))return i.replace(/^#+\s*/,"").trim()}for(const e of t){const i=e.trim();if(i!=="")return i.length>120?i.slice(0,120):i}return""}a(T,"firstHeading");function F(n,t){let e=null;const i=a(()=>{if(e!==null)return e;const d=v(n,t);return e=d===null?"":N(d).body,e},"load"),o=v(n,t),s=o===null?"":o;return o!==null&&(e=N(o).body),{load:i,head:s}}a(F,"fileBodyLoader");function K(n,t,e){const i=$(n.node_id),o=x(k(n.node_id),e),s=e.match(/^([0-9]{8}T[0-9]{6})-(\w+)\.md$/),{load:d,head:c}=F(i,o),r=N(c).data,u=(typeof r?.kind=="string"?r.kind:void 0)??(s?s[2]:"report"),f=(typeof r?.ts=="string"?r.ts:void 0)??(s?A(s[1]):new Date(E(i,o).mtimeMs).toISOString()),m=d();return{ref:`${n.node_id}:reports/${e}`,nodeId:n.node_id,relpath:`reports/${e}`,source:"report",reportKind:u,ts:f,tsMs:g(f),title:T(m),nodeName:n.name,nodeKind:n.kind,nodeStatus:n.status,nodeCwd:n.cwd,nodeDesc:t,path:o,loadBody:d}}a(K,"reportArtifact");function W(n,t,e){const i=$(n.node_id),o=U(i,e).split(V).join("/"),s=o==="context/roadmap.md",{load:d}=F(i,e);let c;try{c=new Date(E(i,e).mtimeMs).toISOString()}catch{c=n.created}const r=d();return{ref:`${n.node_id}:${o}`,nodeId:n.node_id,relpath:o,source:s?"roadmap":"doc",ts:c,tsMs:g(c),title:T(r)||o.replace(/^context\//,""),nodeName:n.name,nodeKind:n.kind,nodeStatus:n.status,nodeCwd:n.cwd,nodeDesc:t,path:e,loadBody:d}}a(W,"docArtifact");function O(n){return nn().prepare(`SELECT m.created_at, m.sender_node_id, d.urgency, m.kind, m.label, m.body_ref, m.body_json
1
+ var S=Object.defineProperty;var d=(n,s)=>S(n,"name",{value:s,configurable:!0});import{envNodeId as M}from"../../shared/env.js";import{getNode as p,listNodes as v,view as j}from"./canvas.js";import{openDb as E}from"./db.js";import{readTextIfExists as O}from"../fs-utils.js";import{conversationIdFromPath as y,conversationStore as g,ConversationNotFoundError as I}from"../conversation-store/index.js";import{reportBodyByName as C}from"../feed/reports.js";import{readStamps as A}from"../runtime/stamp/protocol.js";const X=["human","inbox","wake","revive","restart-continuation","stop-guard","park","recovery","context-nudge","kickoff","unknown"],Z=["user","assistant","toolResult"];function B(){const n=M();if(n!==void 0&&n!==""){const s=p(n);if(s!==null)return s.cwd}return process.cwd()}d(B,"callerCwd");function k(n){const s=Date.parse(n);return Number.isNaN(s)?0:s}d(k,"toMs");function _(n){return E().prepare(`SELECT m.created_at, m.sender_node_id, d.urgency, m.kind, m.label, m.body_ref, m.body_json
3
2
  FROM deliveries d JOIN messages m ON m.message_id = d.message_id
4
3
  WHERE d.destination_kind = 'node_inbox' AND d.destination_id = ? AND d.wake = 1
5
- ORDER BY m.seq, d.created_at, d.delivery_id`).all(n).map(e=>({ts:e.created_at,from:e.sender_node_id,tier:e.urgency,kind:e.kind,label:e.label,ref:e.body_ref,data:e.body_json===null?null:JSON.parse(e.body_json)}))}a(O,"allInboxEntries");function cn(n){try{const t=bn(n);if(t?.source==="report")return t.body}catch{}return null}a(cn,"reportBodyFromRef");function L(n){const t=[`from: ${n.from??"system"}`,`tier: ${n.tier}`].join(`
6
- `),e=`[${n.kind}] ${n.label}`,i=typeof n.data=="object"&&n.data!==null&&!Array.isArray(n.data)?n.data.body:void 0,o=typeof i=="string"?i.trim():"",s=typeof i=="string",d=n.ref!==null?s?en(n.ref)??"":cn(n.ref)??"":o,c=d!==""&&d!==n.label,r=[t,e];return n.ref!==null&&r.push(`ref: ${n.ref}`),c&&r.push(d),r.join(`
4
+ ORDER BY m.seq, d.created_at, d.delivery_id`).all(n).map(e=>({ts:e.created_at,from:e.sender_node_id,tier:e.urgency,kind:e.kind,label:e.label,ref:e.body_ref,data:e.body_json===null?null:JSON.parse(e.body_json)}))}d(_,"allInboxEntries");function N(n){const s=[`from: ${n.from??"system"}`,`tier: ${n.tier}`].join(`
5
+ `),e=`[${n.kind}] ${n.label}`,t=typeof n.data=="object"&&n.data!==null&&!Array.isArray(n.data)?n.data.body:void 0,o=typeof t=="string"?t.trim():"",i=typeof t=="string",r=n.ref!==null?i?O(n.ref)??"":C(n.ref)??"":o,l=r!==""&&r!==n.label,u=[s,e];return n.ref!==null&&u.push(`ref: ${n.ref}`),l&&u.push(r),u.join(`
7
6
 
8
- `)}a(L,"inboxEntryBody");function J(n,t,e,i){const o=`inbox/${String(i).padStart(6,"0")}`,s=L(e),d={ref:`${n.node_id}:${o}`,nodeId:n.node_id,relpath:o,source:"inbox",ts:e.ts,tsMs:g(e.ts),title:`[${e.kind}] from ${e.from??"system"}: ${e.label}`,nodeName:n.name,nodeKind:n.kind,nodeStatus:n.status,nodeCwd:n.cwd,nodeDesc:t,path:null,loadBody:a(()=>s,"loadBody"),origin:"inbox"};return typeof e.from=="string"&&e.from!==""&&(d.from=e.from),d}a(J,"inboxArtifact");function G(n){const t=_(n)?.pi_session_file,e=typeof t=="string"?S(t):null;if(e===null)return null;try{return w().header(e).path}catch(i){if(i instanceof sn)return null;throw i}}a(G,"resolveSessionFile");function fn(n){if(typeof n=="string")return n;if(!Array.isArray(n))return"";const t=[];for(const e of n){if(e===null||typeof e!="object")continue;const i=e;i.type==="text"&&typeof i.text=="string"?t.push(i.text):i.type==="toolCall"&&t.push(`Tool: ${typeof i.name=="string"?i.name:"call"}`)}return t.join(`
9
- `)}a(fn,"textFromBlocks");function un(n){return n==null?"unknown":n.type==="human"?"human":n.kind}a(un,"originToken");function ln(n){if(n==null||n.type!=="runtime")return;const t=n.entries;if(t===void 0||t.length===0)return;const e=new Set;for(const i of t){const o=i.fromName??i.from;typeof o=="string"&&o!==""&&e.add(o)}return e.size===0?void 0:[...e].join(", ")}a(ln,"sendersOf");function R(n){const t=G(n);if(t===null)return[];const e=w().read(S(t)).entries,i=new Map;for(const s of dn(e)){if(s.kind!=="message")continue;const d=s.payload;typeof d.msgTs=="number"&&i.set(d.msgTs,d.origin)}const o=[];for(const s of e){if(s===null||typeof s!="object")continue;const d=s;if(d.type!=="message")continue;const c=d.message;if(c===null||typeof c!="object")continue;const r=c,u=typeof r.role=="string"?r.role:"";if(u==="")continue;const f=typeof r.timestamp=="number"?r.timestamp:void 0,m=typeof d.timestamp=="string"?d.timestamp:f!==void 0?new Date(f).toISOString():"",h=fn(r.content),l={index:o.length,role:u,text:h,ts:m,tsMs:f??g(m)};if(u==="user"){const p=f!==void 0&&i.has(f)?i.get(f):null;l.origin=un(p);const y=ln(p);y!==void 0&&(l.from=y)}o.push(l)}return o}a(R,"sessionMessages");function mn(n,t){const e=w().read(S(n)).entries;let i=0;for(const o of e){if(o.type!=="message")continue;const s=o.message;if(!(s===null||typeof s!="object"||typeof s.role!="string")){if(i===t)return JSON.stringify(o);i++}}return null}a(mn,"rawSessionLine");function H(n,t,e){const i=`session/${String(e.index).padStart(6,"0")}`,o=e.text.split(`
10
- `).map(d=>d.trim()).find(d=>d!=="")??"",s={ref:`${n.node_id}:${i}`,nodeId:n.node_id,relpath:i,source:"transcript",ts:e.ts,tsMs:e.tsMs,title:`[${e.role}] ${o.length>80?`${o.slice(0,80)}\u2026`:o}`,nodeName:n.name,nodeKind:n.kind,nodeStatus:n.status,nodeCwd:n.cwd,nodeDesc:t,path:null,loadBody:a(()=>e.text,"loadBody"),role:e.role};return e.origin!==void 0&&(s.origin=e.origin),e.from!==void 0&&(s.from=e.from),s}a(H,"transcriptArtifact");function pn(n,t){const e=`${n.name}
11
- ${t}
12
- ${n.kind}`;return{ref:`${n.node_id}:meta`,nodeId:n.node_id,relpath:"meta",source:"meta",ts:n.created,tsMs:g(n.created),title:n.name,nodeName:n.name,nodeKind:n.kind,nodeStatus:n.status,nodeCwd:n.cwd,nodeDesc:t,path:null,loadBody:a(()=>e,"loadBody")}}a(pn,"metaArtifact");function M(n){const t=k(n);if(!C(t))return[];try{return tn($(n),t).filter(e=>!e.isDirectory()&&e.name.endsWith(".md")).map(e=>e.name)}catch{return[]}}a(M,"listReportFiles");function jn(n){let t=null;for(const e of M(n))(t===null||e>t)&&(t=e);return t===null?null:`${n}:reports/${t}`}a(jn,"newestReportRef");function j(n){const t=Z(n);if(!C(t))return[];try{return on($(n),t,e=>e.endsWith(".md"))}catch{return[]}}a(j,"listDocFiles");function D(n,t){const e=(t instanceof Error?t.message:String(t)).split(`
13
- `)[0];rn(`invalid frontmatter in ${n}: ${e}`)}a(D,"warnInvalidFrontmatter");function hn(n){return _(n)?.description??""}a(hn,"nodeDescOf");function Bn(n,t){const e=gn(n),i=t.kinds,o=t.statuses,s=e.filter(f=>!(i!==void 0&&i.length>0&&!i.includes(f.kind)||o!==void 0&&o.length>0&&!o.includes(f.status))),d=t.reportKind,c=t.types!==void 0&&t.types.length>0?t.types:d!==void 0?["report"]:["report","doc","roadmap","meta"],r=new Set(c),u=[];for(const f of s){const m=r.has("meta")||r.has("report")||r.has("doc")||r.has("roadmap")||r.has("inbox")?hn(f.node_id):"";if(r.has("meta")&&u.push(pn(f,m)),r.has("report"))for(const h of M(f.node_id)){const l=x(k(f.node_id),h);let p;try{p=K(f,m,h)}catch(y){D(l,y);continue}p!==null&&(d!==void 0&&p.reportKind!==d||u.push(p))}if(r.has("doc")||r.has("roadmap"))for(const h of j(f.node_id)){let l;try{l=W(f,m,h)}catch(p){D(h,p);continue}l.source==="roadmap"&&!r.has("roadmap")||l.source==="doc"&&!r.has("doc")||u.push(l)}if(r.has("inbox")&&O(f.node_id).forEach((h,l)=>u.push(J(f,m,h,l))),r.has("transcript"))for(const h of R(f.node_id))u.push(H(f,m,h))}return u.filter(f=>t.sinceMs!==void 0&&f.tsMs<t.sinceMs||t.untilMs!==void 0&&f.tsMs>t.untilMs?!1:yn(f,t))}a(Bn,"buildCorpus");function yn(n,t){const{origins:e,roles:i,from:o}=t;return!(e!==void 0&&e.length>0&&(n.origin===void 0||!e.includes(n.origin))||i!==void 0&&i.length>0&&(n.role===void 0||!i.includes(n.role))||o!==void 0&&o!==""&&(n.from===void 0||!n.from.toLowerCase().includes(o.toLowerCase())))}a(yn,"matchesMessageFilters");function Cn(n,t){const e=new Map;for(const i of n){let o;switch(t){case"origin":o=i.origin;break;case"role":o=i.role;break;case"node":o=`${i.nodeName} (${i.nodeId})`;break;case"kind":o=i.nodeKind;break;case"type":o=i.source;break;case"day":o=i.ts.slice(0,10)||void 0;break}o===void 0||o===""||e.set(o,(e.get(o)??0)+1)}return[...e.entries()].map(([i,o])=>({key:i,count:o})).sort((i,o)=>o.count-i.count||i.key.localeCompare(o.key))}a(Cn,"groupCorpus");function gn(n){const t=B(),e=new Map(t.map(o=>[o.node_id,o]));if(n.nodes!==void 0&&n.nodes.length>0)return n.nodes.map(o=>e.get(o)).filter(o=>o!==void 0);if(n.under!==void 0&&n.under!=="")return[n.under,...X(n.under)].map(s=>e.get(s)).filter(s=>s!==void 0);if(n.allCwds===!0)return t;const i=n.cwd!==void 0&&n.cwd!==""?n.cwd:an();return t.filter(o=>o.cwd===i)}a(gn,"scopedRows");function bn(n){const t=n.indexOf(":");if(t===-1)return null;const e=n.slice(0,t),i=n.slice(t+1),o=_(e);if(o===null)return null;if(i==="meta"){const l=`# ${o.name}
7
+ `)}d(N,"inboxEntryBody");function D(n,s,e,t){const o=`inbox/${String(t).padStart(6,"0")}`,i=N(e),r={ref:`${n.node_id}:${o}`,nodeId:n.node_id,relpath:o,source:"inbox",ts:e.ts,tsMs:k(e.ts),title:`[${e.kind}] from ${e.from??"system"}: ${e.label}`,nodeName:n.name,nodeKind:n.kind,nodeStatus:n.status,nodeCwd:n.cwd,nodeDesc:s,loadBody:d(()=>i,"loadBody"),origin:"inbox"};return typeof e.from=="string"&&e.from!==""&&(r.from=e.from),r}d(D,"inboxArtifact");function $(n){const s=p(n)?.pi_session_file,e=typeof s=="string"?y(s):null;if(e===null)return null;try{return g().header(e).path}catch(t){if(t instanceof I)return null;throw t}}d($,"resolveSessionFile");function R(n){if(typeof n=="string")return n;if(!Array.isArray(n))return"";const s=[];for(const e of n){if(e===null||typeof e!="object")continue;const t=e;t.type==="text"&&typeof t.text=="string"?s.push(t.text):t.type==="toolCall"&&s.push(`Tool: ${typeof t.name=="string"?t.name:"call"}`)}return s.join(`
8
+ `)}d(R,"textFromBlocks");function T(n){return n==null?"unknown":n.type==="human"?"human":n.kind}d(T,"originToken");function F(n){if(n==null||n.type!=="runtime")return;const s=n.entries;if(s===void 0||s.length===0)return;const e=new Set;for(const t of s){const o=t.fromName??t.from;typeof o=="string"&&o!==""&&e.add(o)}return e.size===0?void 0:[...e].join(", ")}d(F,"sendersOf");function w(n){const s=$(n);if(s===null)return[];const e=g().read(y(s)).entries,t=new Map;for(const i of A(e)){if(i.kind!=="message")continue;const r=i.payload;typeof r.msgTs=="number"&&t.set(r.msgTs,r.origin)}const o=[];for(const i of e){if(i===null||typeof i!="object")continue;const r=i;if(r.type!=="message")continue;const l=r.message;if(l===null||typeof l!="object")continue;const u=l,f=typeof u.role=="string"?u.role:"";if(f==="")continue;const a=typeof u.timestamp=="number"?u.timestamp:void 0,c=typeof r.timestamp=="string"?r.timestamp:a!==void 0?new Date(a).toISOString():"",m=R(u.content),b={index:o.length,role:f,text:m,ts:c,tsMs:a??k(c)};if(f==="user"){const h=a!==void 0&&t.has(a)?t.get(a):null;b.origin=T(h);const x=F(h);x!==void 0&&(b.from=x)}o.push(b)}return o}d(w,"sessionMessages");function L(n,s){const e=g().read(y(n)).entries;let t=0;for(const o of e){if(o.type!=="message")continue;const i=o.message;if(!(i===null||typeof i!="object"||typeof i.role!="string")){if(t===s)return JSON.stringify(o);t++}}return null}d(L,"rawSessionLine");function J(n,s,e){const t=`session/${String(e.index).padStart(6,"0")}`,o=e.text.split(`
9
+ `).map(r=>r.trim()).find(r=>r!=="")??"",i={ref:`${n.node_id}:${t}`,nodeId:n.node_id,relpath:t,source:"transcript",ts:e.ts,tsMs:e.tsMs,title:`[${e.role}] ${o.length>80?`${o.slice(0,80)}\u2026`:o}`,nodeName:n.name,nodeKind:n.kind,nodeStatus:n.status,nodeCwd:n.cwd,nodeDesc:s,loadBody:d(()=>e.text,"loadBody"),role:e.role};return e.origin!==void 0&&(i.origin=e.origin),e.from!==void 0&&(i.from=e.from),i}d(J,"transcriptArtifact");function K(n){return p(n)?.description??""}d(K,"nodeDescOf");function nn(n,s){const e=G(n),t=s.kinds,o=s.statuses,i=e.filter(f=>!(t!==void 0&&t.length>0&&!t.includes(f.kind)||o!==void 0&&o.length>0&&!o.includes(f.status))),r=s.types!==void 0&&s.types.length>0?s.types:["inbox"],l=new Set(r),u=[];for(const f of i){const a=K(f.node_id);if(l.has("inbox")&&_(f.node_id).forEach((c,m)=>u.push(D(f,a,c,m))),l.has("transcript"))for(const c of w(f.node_id))u.push(J(f,a,c))}return u.filter(f=>s.sinceMs!==void 0&&f.tsMs<s.sinceMs||s.untilMs!==void 0&&f.tsMs>s.untilMs?!1:W(f,s))}d(nn,"buildCorpus");function W(n,s){const{origins:e,roles:t,from:o}=s;return!(e!==void 0&&e.length>0&&(n.origin===void 0||!e.includes(n.origin))||t!==void 0&&t.length>0&&(n.role===void 0||!t.includes(n.role))||o!==void 0&&o!==""&&(n.from===void 0||!n.from.toLowerCase().includes(o.toLowerCase())))}d(W,"matchesMessageFilters");function en(n,s){const e=new Map;for(const t of n){let o;switch(s){case"origin":o=t.origin;break;case"role":o=t.role;break;case"node":o=`${t.nodeName} (${t.nodeId})`;break;case"kind":o=t.nodeKind;break;case"type":o=t.source;break;case"day":o=t.ts.slice(0,10)||void 0;break}o===void 0||o===""||e.set(o,(e.get(o)??0)+1)}return[...e.entries()].map(([t,o])=>({key:t,count:o})).sort((t,o)=>o.count-t.count||t.key.localeCompare(o.key))}d(en,"groupCorpus");function G(n){const s=v(),e=new Map(s.map(o=>[o.node_id,o]));if(n.nodes!==void 0&&n.nodes.length>0)return n.nodes.map(o=>e.get(o)).filter(o=>o!==void 0);if(n.under!==void 0&&n.under!=="")return[n.under,...j(n.under)].map(i=>e.get(i)).filter(i=>i!==void 0);if(n.allCwds===!0)return s;const t=n.cwd!==void 0&&n.cwd!==""?n.cwd:B();return s.filter(o=>o.cwd===t)}d(G,"scopedRows");function tn(n){const s=n.indexOf(":");if(s===-1)return null;const e=n.slice(0,s),t=n.slice(s+1),o=p(e);if(o===null)return null;if(t.startsWith("inbox/")){const i=Number(t.slice(6)),r=_(e)[i];return r===void 0?null:{nodeId:e,relpath:t,source:"inbox",ts:r.ts,nodeName:o.name,body:N(r),raw:null,path:null}}if(t==="session"||t.startsWith("session/")){const i=$(e);if(i===null)return null;const r=w(e);if(t==="session"){const f=r.map(a=>`## ${a.role}${a.origin!==void 0?` (origin: ${a.origin})`:""}
14
10
 
15
- - kind: ${o.kind}
16
- - status: ${o.status}
17
- - cwd: ${o.cwd}
18
- - created: ${o.created}
11
+ ${a.text}`).join(`
19
12
 
20
- ${o.description??""}`;return{nodeId:e,relpath:i,source:"meta",ts:o.created,nodeName:o.name,body:l,raw:null,path:null}}if(i.startsWith("inbox/")){const l=Number(i.slice(6)),p=O(e)[l];return p===void 0?null:{nodeId:e,relpath:i,source:"inbox",ts:p.ts,nodeName:o.name,body:L(p),raw:null,path:null}}if(i==="session"||i.startsWith("session/")){const l=G(e);if(l===null)return null;const p=R(e);if(i==="session"){const q=p.map(b=>`## ${b.role}${b.origin!==void 0?` (origin: ${b.origin})`:""}
21
-
22
- ${b.text}`).join(`
23
-
24
- `);return{nodeId:e,relpath:i,source:"transcript",ts:p[p.length-1]?.ts??o.created,nodeName:o.name,body:q,raw:(()=>{const{header:b,entries:z}=w().read(S(l));return[b,...z].map(P=>`${JSON.stringify(P)}
25
- `).join("")})(),path:l}}const y=Number(i.slice(8)),I=p[y];return I===void 0?null:{nodeId:e,relpath:i,source:"transcript",ts:I.ts,nodeName:o.name,body:I.text,raw:mn(l,y),path:l}}if(i.includes("..")||i.startsWith("/"))throw new Error(`illegal relpath in ref: ${i}`);const s=$(e),d=x(s,i),c=v(s,d);if(c===null)return null;const{body:r,data:u}=N(c),f=i.startsWith("reports/"),m=i==="context/roadmap.md";let h;if(typeof u?.ts=="string")h=u.ts;else try{h=new Date(E(s,d).mtimeMs).toISOString()}catch{h=o.created}return{nodeId:e,relpath:i,source:f?"report":m?"roadmap":"doc",reportKind:f&&typeof u?.kind=="string"?u.kind:void 0,ts:h,nodeName:o.name,body:r,raw:c,path:d}}a(bn,"resolveRef");function An(n,t){const e=_(n);if(e===null)return[];const i={node_id:e.node_id,name:e.name,kind:e.kind,mode:e.mode,lifecycle:e.lifecycle,status:e.status,cwd:e.cwd,host_kind:e.host_kind??null,profile_id:e.profile_id??null,scopes:e.scopes??null,parent:e.parent??null,created:e.created,intent:e.intent??null,waiting_for:e.waiting_for??null,pi_pid:e.pi_pid??null,pi_pid_identity:e.pi_pid_identity??null,window:e.window??null,tmux_session:e.tmux_session??null,pane:e.pane??null},o=new Set(t!==void 0&&t.length>0?t:["report","doc","roadmap"]),s=e.description??"",d=[];if(o.has("report"))for(const c of M(n)){let r;try{r=K(i,s,c)}catch(u){D(x(k(n),c),u);continue}r!==null&&d.push(r)}if(o.has("doc")||o.has("roadmap"))for(const c of j(n)){let r;try{r=W(i,s,c)}catch(u){D(c,u);continue}r.source==="roadmap"&&!o.has("roadmap")||r.source==="doc"&&!o.has("doc")||d.push(r)}if(o.has("inbox")&&O(n).forEach((c,r)=>d.push(J(i,s,c,r))),o.has("transcript"))for(const c of R(n))d.push(H(i,s,c));return d}a(An,"nodeArtifacts");function Tn(n){const t=B().filter(c=>c.cwd===n);let e=0,i=0,o=1/0,s=-1/0;for(const c of t){const r=g(c.created);r>0&&(r<o&&(o=r),r>s&&(s=r));for(const u of M(c.node_id)){e++;const f=u.match(/^([0-9]{8}T[0-9]{6})-/);if(f!==null){const m=g(A(f[1]));m>0&&(m<o&&(o=m),m>s&&(s=m))}}i+=j(c.node_id).length}const d=o!==1/0&&s!==-1/0?{from:new Date(o).toISOString().slice(0,10),to:new Date(s).toISOString().slice(0,10)}:null;return{cwd:n,nodes:t.length,reports:e,docs:i,span:d}}a(Tn,"corpusStats");export{Rn as MESSAGE_ROLES,On as ORIGIN_TOKENS,Bn as buildCorpus,an as callerCwd,Tn as corpusStats,Cn as groupCorpus,jn as newestReportRef,An as nodeArtifacts,bn as resolveRef};
13
+ `);return{nodeId:e,relpath:t,source:"transcript",ts:r[r.length-1]?.ts??o.created,nodeName:o.name,body:f,raw:(()=>{const{header:a,entries:c}=g().read(y(i));return[a,...c].map(m=>`${JSON.stringify(m)}
14
+ `).join("")})(),path:i}}const l=Number(t.slice(8)),u=r[l];return u===void 0?null:{nodeId:e,relpath:t,source:"transcript",ts:u.ts,nodeName:o.name,body:u.text,raw:L(i,l),path:i}}return null}d(tn,"resolveRef");export{Z as MESSAGE_ROLES,X as ORIGIN_TOKENS,nn as buildCorpus,B as callerCwd,en as groupCorpus,tn as resolveRef};
@@ -4,6 +4,6 @@ export declare function isValidInstallId(id: string): boolean;
4
4
  /** Get-or-create the canvas-install id every minted node id embeds. Called
5
5
  * once at daemon boot (`crtrd.ts`) — a thrown error there fails boot loudly,
6
6
  * which is the intended behavior for both an invalid env value and a
7
- * stored/env mismatch. Single-writer transaction (mirrors
8
- * `reconcileBootLiveness` in boot.ts). `env` is injectable for tests. */
7
+ * stored/env mismatch. Runs in the caller's canvas write transaction when
8
+ * one is open, else its own. `env` is injectable for tests. */
9
9
  export declare function resolveInstallId(env?: NodeJS.ProcessEnv): string;
@@ -1 +1 @@
1
- var c=Object.defineProperty;var l=(t,e)=>c(t,"name",{value:e,configurable:!0});import{randomBytes as u}from"node:crypto";import{openDb as d}from"./db.js";const s="install_id",I=/^[a-z0-9]{4,16}$/,i="abcdefghijklmnopqrstuvwxyz0123456789";function h(t){return I.test(t)}l(h,"isValidInstallId");function T(){const t=u(8);let e="";for(let n=0;n<8;n++)e+=i[t[n]%i.length];return e}l(T,"mintInstallId");function f(t){return t.prepare("SELECT value FROM canvas_meta WHERE key = ?").get(s)?.value??null}l(f,"readInstallId");function p(t,e){t.prepare("INSERT INTO canvas_meta (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value").run(s,e)}l(p,"writeInstallId");function m(t=process.env){const e=d();e.exec("BEGIN IMMEDIATE");try{const n=f(e),o=t.CRTR_INSTALL_ID,r=o!==void 0&&o!==""?o:null;if(n!==null){if(r!==null&&r!==n)throw new Error(`CRTR_INSTALL_ID='${r}' conflicts with the install id already persisted in this canvas home ('${n}'). This canvas home was minted under a different install id \u2014 refusing to boot rather than silently mask what is usually a provisioning bug (this process pointed at the wrong volume/home).`);return e.exec("COMMIT"),n}let a;if(r!==null){if(!h(r))throw new Error(`CRTR_INSTALL_ID='${r}' is not a valid install id \u2014 expected 4-16 lowercase [a-z0-9] characters.`);a=r}else a=T();return p(e,a),e.exec("COMMIT"),a}catch(n){try{e.exec("ROLLBACK")}catch{}throw n}}l(m,"resolveInstallId");export{h as isValidInstallId,m as resolveInstallId};
1
+ var u=Object.defineProperty;var a=(e,t)=>u(e,"name",{value:t,configurable:!0});import{randomBytes as c}from"node:crypto";import{withCanvasWrite as d}from"./db.js";const o="install_id",I=/^[a-z0-9]{4,16}$/,i="abcdefghijklmnopqrstuvwxyz0123456789";function h(e){return I.test(e)}a(h,"isValidInstallId");function f(){const e=c(8);let t="";for(let n=0;n<8;n++)t+=i[e[n]%i.length];return t}a(f,"mintInstallId");function v(e){return e.prepare("SELECT value FROM canvas_meta WHERE key = ?").get(o)?.value??null}a(v,"readInstallId");function T(e,t){e.prepare("INSERT INTO canvas_meta (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value").run(o,t)}a(T,"writeInstallId");function L(e=process.env){return d(t=>{const n=v(t),s=e.CRTR_INSTALL_ID,r=s!==void 0&&s!==""?s:null;if(n!==null){if(r!==null&&r!==n)throw new Error(`CRTR_INSTALL_ID='${r}' conflicts with the install id already persisted in this canvas home ('${n}'). This canvas home was minted under a different install id \u2014 refusing to boot rather than silently mask what is usually a provisioning bug (this process pointed at the wrong volume/home).`);return n}if(r!==null&&!h(r))throw new Error(`CRTR_INSTALL_ID='${r}' is not a valid install id \u2014 expected 4-16 lowercase [a-z0-9] characters.`);const l=r??f();return T(t,l),l})}a(L,"resolveInstallId");export{h as isValidInstallId,L as resolveInstallId};
@@ -1,3 +1,4 @@
1
+ import type { DatabaseSync } from 'node:sqlite';
1
2
  import type { MemoryReadEventDTO } from '../../api/dto/analytics.js';
2
3
  /** Entries older than this are deleted by the hourly storage-maintenance pass. */
3
4
  export declare const MEMORY_READS_RETENTION_MS: number;
@@ -11,6 +12,10 @@ export interface MemoryReadRow {
11
12
  /** Insert every event for one node in one transaction. `at` must already be a
12
13
  * canonical ISO UTC string (`Date#toISOString`) so range reads compare as text. */
13
14
  export declare function insertMemoryReads(nodeId: string, events: MemoryReadEventDTO[]): void;
15
+ /** Record events inside the caller's write transaction: the canvas-model
16
+ * delivery (`loaded`) and explicit document read (`read`) sites call this so
17
+ * the log lands with the exposures and watches it describes. */
18
+ export declare function recordMemoryReadsIn(db: DatabaseSync, nodeId: string, events: readonly MemoryReadEventDTO[]): void;
14
19
  /** Entries with `fromIso <= at < toIso`, oldest first. */
15
20
  export declare function listMemoryReads(fromIso: string, toIso: string): MemoryReadRow[];
16
21
  /** Delete entries older than the retention window; returns the count deleted. */
@@ -1 +1 @@
1
- var m=Object.defineProperty;var t=(e,r)=>m(e,"name",{value:r,configurable:!0});import{openDb as o,withCanvasWrite as n}from"./db.js";const E=720*60*60*1e3;function u(e,r){n(p=>{const s=p.prepare("INSERT INTO memory_reads (node_id, name, scope, at, type) VALUES (?, ?, ?, ?, ?)");for(const a of r)s.run(e,a.name,a.scope,a.at,a.type)})}t(u,"insertMemoryReads");function c(e,r){return o().prepare("SELECT node_id, name, scope, at, type FROM memory_reads WHERE at >= ? AND at < ? ORDER BY at").all(e,r)}t(c,"listMemoryReads");function i(e){return n(r=>Number(r.prepare("DELETE FROM memory_reads WHERE at < ?").run(new Date(e-E).toISOString()).changes))}t(i,"pruneMemoryReads");function y(){return o().prepare("SELECT value FROM canvas_meta WHERE key = 'memory_reads.started_at'").get()?.value??null}t(y,"memoryReadsStartedAt");export{E as MEMORY_READS_RETENTION_MS,u as insertMemoryReads,c as listMemoryReads,y as memoryReadsStartedAt,i as pruneMemoryReads};
1
+ var m=Object.defineProperty;var o=(e,r)=>m(e,"name",{value:r,configurable:!0});import{openDb as p,withCanvasWrite as s}from"./db.js";const E=720*60*60*1e3;function R(e,r){s(n=>{const a=n.prepare("INSERT INTO memory_reads (node_id, name, scope, at, type) VALUES (?, ?, ?, ?, ?)");for(const t of r)a.run(e,t.name,t.scope,t.at,t.type)})}o(R,"insertMemoryReads");function i(e,r,n){if(n.length===0)return;const a=e.prepare("INSERT INTO memory_reads (node_id, name, scope, at, type) VALUES (?, ?, ?, ?, ?)");for(const t of n)a.run(r,t.name,t.scope,t.at,t.type)}o(i,"recordMemoryReadsIn");function u(e,r){return p().prepare("SELECT node_id, name, scope, at, type FROM memory_reads WHERE at >= ? AND at < ? ORDER BY at").all(e,r)}o(u,"listMemoryReads");function y(e){return s(r=>Number(r.prepare("DELETE FROM memory_reads WHERE at < ?").run(new Date(e-E).toISOString()).changes))}o(y,"pruneMemoryReads");function _(){return p().prepare("SELECT value FROM canvas_meta WHERE key = 'memory_reads.started_at'").get()?.value??null}o(_,"memoryReadsStartedAt");export{E as MEMORY_READS_RETENTION_MS,R as insertMemoryReads,u as listMemoryReads,_ as memoryReadsStartedAt,y as pruneMemoryReads,i as recordMemoryReadsIn};