@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,2 +1,2 @@
1
- var u=Object.defineProperty;var o=(i,t)=>u(i,"name",{value:t,configurable:!0});import{homedir as h}from"node:os";import{join as l,resolve as p}from"node:path";import{crtrPreviewRecords as y}from"../../../core/preview-registry.js";import{countDisplayDiffLines as w}from"./edit-diff.js";const v=3,g=Object.freeze({files:Object.freeze([]),memories:Object.freeze([]),nodes:Object.freeze([]),cards:Object.freeze([]),events:Object.freeze([]),eventsOmitted:0});function c(i){return typeof i=="object"&&i!==null?i:void 0}o(c,"object");function O(i){const t=c(i),e=t?.file_path??t?.path;return typeof e=="string"&&e!==""?e:void 0}o(O,"filePath");function z(i){return i.length===0?0:(i.match(/\n/g)?.length??0)+(i.endsWith(`
2
- `)?0:1)}o(z,"lineCount");function f(i){return typeof i=="string"&&i!==""?i:void 0}o(f,"text");const b={"memory read":"read","memory write":"write","memory edit":"edit","memory delete":"delete"};function j(i,t){const e=i==="~"?h():i.startsWith("~/")?l(h(),i.slice(2)):i;return p(t,e)}o(j,"canonicalPath");function k(i,t,e){if(i==="edit"){const n=c(c(e)?.details)?.diff;return typeof n=="string"?{kind:"edit",...w(n),known:!0}:{kind:"edit",added:0,removed:0,known:!1}}if(i==="write"){const n=c(t)?.content;return typeof n=="string"?{kind:"write",added:z(n),removed:0,known:!0}:{kind:"write",added:0,removed:0,known:!1}}}o(k,"fileChange");class I{static{o(this,"GroupActivityRecorder")}cwd;roster;calls=new Map;files=new Map;memories=[];memorySet=new Set;nodes=[];nodeSet=new Set;cards=[];cardSet=new Set;events=new Map;eventsOmitted=0;constructor(t,e=new Map){this.cwd=t,this.roster=e}noteCard(t,e){switch(e.groupFolded){case"omit":return;case"event":this.addEvent(e.summary(t));return;case"activity":this.addCard({summary:e.summary(t)});return;case"senders":this.addFinishedSenders(t);return}}noteCall(t,e,n){this.calls.get(t)?.settled||this.calls.set(t,{name:e,args:n,settled:!1})}settle(t,e,n){const s=this.calls.get(t);!s||s.settled||(s.settled=!0,!n&&c(e)?.isError!==!0&&this.extract(s,e),s.args=void 0)}resolveWithoutResult(t){const e=this.calls.get(t);!e||e.settled||(e.settled=!0,e.args=void 0)}activity(){if(this.files.size===0&&this.memories.length===0&&this.nodes.length===0&&this.cards.length===0&&this.events.size===0)return g;const t=[...this.files.values()].map(r=>Object.freeze({...r})),e=this.memories.map(r=>Object.freeze({...r})),n=this.nodes.map(r=>Object.freeze({...r})),s=this.cards.map(r=>Object.freeze({...r})),a=[...this.events].map(([r,d])=>Object.freeze({text:r,count:d}));return Object.freeze({files:Object.freeze(t),memories:Object.freeze(e),nodes:Object.freeze(n),cards:Object.freeze(s),events:Object.freeze(a),eventsOmitted:this.eventsOmitted})}addFinishedSenders(t){for(const e of t.senders){const n=e.entries.length>0&&e.entries.every(s=>s.disposition==="human-answer");!e.finished||n||this.addNode({action:"finished",name:this.roster.get(e.id)??e.id,id:e.id})}}addCard(t){const e=t.summary;this.cardSet.has(e)||(this.cardSet.add(e),this.cards.push(t))}addEvent(t){const e=t.trim();if(e==="")return;const n=this.events.get(e);if(n!==void 0){this.events.set(e,n+1);return}if(this.events.size>=v){this.eventsOmitted+=1;return}this.events.set(e,1)}addNode(t){const e=`${t.action}:${t.id}`;this.nodeSet.has(e)||(this.nodeSet.add(e),this.nodes.push(t),t.action==="spawned"&&this.roster.set(t.id,t.name))}noteCrtrInvocation(t){if(t.error!==void 0||t.result===void 0)return;const e=t.result;switch(t.path){case"memory read":case"memory write":case"memory edit":case"memory delete":{const n=f(e.name);if(n===void 0)return;const s=b[t.path],a=s==="delete"?void 0:f(e.path);this.addMemory(a===void 0?{action:s,name:n}:{action:s,name:n,path:a});return}case"node new":{if(e.frozen_at!==void 0&&e.frozen_at!==null)return;const n=f(e.node_id),s=f(e.name);n!==void 0&&s!==void 0&&this.addNode({action:"spawned",name:s,id:n});return}default:return}}addMemory(t){const e=`${t.action}:${t.path??t.name}`;this.memorySet.has(e)||(this.memorySet.add(e),this.memories.push(t))}extract(t,e){if(t.name==="bash"){for(const m of y(e))this.noteCrtrInvocation(m);return}const n=O(t.args),s=k(t.name,t.args,e);if(!n||!s)return;const a=j(n,this.cwd),r=`${s.kind}:${a}`;let d=this.files.get(r);d||(d={key:a,displayPath:n,kind:s.kind,added:0,removed:0,hasKnownCounts:!1,countsIncomplete:!1},this.files.set(r,d)),d.added+=s.added,d.removed+=s.removed,d.hasKnownCounts||=s.known,d.countsIncomplete||=!s.known}}export{I as GroupActivityRecorder};
1
+ var l=Object.defineProperty;var o=(s,t)=>l(s,"name",{value:t,configurable:!0});import{homedir as u}from"node:os";import{join as m,resolve as p}from"node:path";import{crtrPreviewRecords as w}from"../../../core/preview-registry.js";import{countDisplayDiffLines as v}from"./edit-diff.js";const g=3,O=Object.freeze({files:Object.freeze([]),documents:Object.freeze([]),nodes:Object.freeze([]),cards:Object.freeze([]),events:Object.freeze([]),eventsOmitted:0});function c(s){return typeof s=="object"&&s!==null?s:void 0}o(c,"object");function z(s){const t=c(s),e=t?.file_path??t?.path;return typeof e=="string"&&e!==""?e:void 0}o(z,"filePath");function y(s){return s.length===0?0:(s.match(/\n/g)?.length??0)+(s.endsWith(`
2
+ `)?0:1)}o(y,"lineCount");function a(s){return typeof s=="string"&&s!==""?s:void 0}o(a,"text");const b={"doc write":"write","doc edit":"edit","doc delete":"delete"};function j(s){if(s.type!=="document")return;const t=c(s.object),e=t===void 0?void 0:a(t.name);if(e===void 0)return;const n=a(c(t?.owner)?.handle);return n===void 0?e:`${n}/${e}`}o(j,"readDocumentName");function k(s,t){const e=s==="~"?u():s.startsWith("~/")?m(u(),s.slice(2)):s;return p(t,e)}o(k,"canonicalPath");function S(s,t,e){if(s==="edit"){const n=c(c(e)?.details)?.diff;return typeof n=="string"?{kind:"edit",...v(n),known:!0}:{kind:"edit",added:0,removed:0,known:!1}}if(s==="write"){const n=c(t)?.content;return typeof n=="string"?{kind:"write",added:y(n),removed:0,known:!0}:{kind:"write",added:0,removed:0,known:!1}}}o(S,"fileChange");class I{static{o(this,"GroupActivityRecorder")}cwd;roster;calls=new Map;files=new Map;documents=[];documentSet=new Set;nodes=[];nodeSet=new Set;cards=[];cardSet=new Set;events=new Map;eventsOmitted=0;constructor(t,e=new Map){this.cwd=t,this.roster=e}noteCard(t,e){switch(e.groupFolded){case"omit":return;case"event":this.addEvent(e.summary(t));return;case"activity":this.addCard({summary:e.summary(t)});return;case"senders":this.addFinishedSenders(t);return}}noteCall(t,e,n){this.calls.get(t)?.settled||this.calls.set(t,{name:e,args:n,settled:!1})}settle(t,e,n){const i=this.calls.get(t);!i||i.settled||(i.settled=!0,!n&&c(e)?.isError!==!0&&this.extract(i,e),i.args=void 0)}resolveWithoutResult(t){const e=this.calls.get(t);!e||e.settled||(e.settled=!0,e.args=void 0)}activity(){if(this.files.size===0&&this.documents.length===0&&this.nodes.length===0&&this.cards.length===0&&this.events.size===0)return O;const t=[...this.files.values()].map(d=>Object.freeze({...d})),e=this.documents.map(d=>Object.freeze({...d})),n=this.nodes.map(d=>Object.freeze({...d})),i=this.cards.map(d=>Object.freeze({...d})),f=[...this.events].map(([d,r])=>Object.freeze({text:d,count:r}));return Object.freeze({files:Object.freeze(t),documents:Object.freeze(e),nodes:Object.freeze(n),cards:Object.freeze(i),events:Object.freeze(f),eventsOmitted:this.eventsOmitted})}addFinishedSenders(t){for(const e of t.senders){const n=e.entries.length>0&&e.entries.every(i=>i.disposition==="human-answer");!e.finished||n||this.addNode({action:"finished",name:this.roster.get(e.id)??e.id,id:e.id})}}addCard(t){const e=t.summary;this.cardSet.has(e)||(this.cardSet.add(e),this.cards.push(t))}addEvent(t){const e=t.trim();if(e==="")return;const n=this.events.get(e);if(n!==void 0){this.events.set(e,n+1);return}if(this.events.size>=g){this.eventsOmitted+=1;return}this.events.set(e,1)}addNode(t){const e=`${t.action}:${t.id}`;this.nodeSet.has(e)||(this.nodeSet.add(e),this.nodes.push(t),t.action==="spawned"&&this.roster.set(t.id,t.name))}noteCrtrInvocation(t){if(t.error!==void 0||t.result===void 0)return;const e=t.result;switch(t.path){case"canvas read":{const n=j(e);n!==void 0&&this.addDocument({action:"read",name:n});return}case"doc write":case"doc edit":case"doc delete":{const n=a(e.name);if(n===void 0)return;this.addDocument({action:b[t.path],name:n});return}case"node new":{if(e.frozen_at!==void 0&&e.frozen_at!==null)return;const n=a(e.node_id),i=a(e.name);n!==void 0&&i!==void 0&&this.addNode({action:"spawned",name:i,id:n});return}default:return}}addDocument(t){const e=`${t.action}:${t.name}`;this.documentSet.has(e)||(this.documentSet.add(e),this.documents.push(t))}extract(t,e){if(t.name==="bash"){for(const h of w(e))this.noteCrtrInvocation(h);return}const n=z(t.args),i=S(t.name,t.args,e);if(!n||!i)return;const f=k(n,this.cwd),d=`${i.kind}:${f}`;let r=this.files.get(d);r||(r={key:f,displayPath:n,kind:i.kind,added:0,removed:0,hasKnownCounts:!1,countsIncomplete:!1},this.files.set(d,r)),r.added+=i.added,r.removed+=i.removed,r.hasKnownCounts||=i.known,r.countsIncomplete||=!i.known}}export{I as GroupActivityRecorder};
@@ -1 +1 @@
1
- var _=Object.defineProperty;var t=(d,e)=>_(d,"name",{value:e,configurable:!0});import{Container as F,Spacer as g,Text as c,getCapabilities as x,hyperlink as O,truncateToWidth as R,visibleWidth as v}from"@earendil-works/pi-tui";import{homedir as D}from"node:os";import{pathToFileURL as N}from"node:url";import{ICON as $}from"../../../core/inspector/model.js";import{TOOL_ICON as h}from"../../../core/preview-registry.js";const P=String.fromCodePoint(61485),E=String.fromCodePoint(61944),I=String.fromCodePoint(61530);function f(d,e,n){return`${d} ${d===1?e:n}`}t(f,"count");function A(d){const e=D();return d.startsWith(e)?`~${d.slice(e.length)}`:d}t(A,"shortened");function L(d){const e=A(d.displayPath);return x().hyperlinks?O(e,N(d.key).href):e}t(L,"filePath");function W(d,e){const n=e.muted(d.name);return d.path&&x().hyperlinks?O(n,N(d.path).href):n}t(W,"memoryName");function Y(d,e){return d.filter(n=>n.action===e).length}t(Y,"countMemories");const M={read:P,write:h.write,edit:h.edit,delete:E},K=[["read","memory read","memory reads"],["write","memory saved","memories saved"],["edit","memory revised","memories revised"],["delete","memory deleted","memories deleted"]];function j(d){return new Set(d.map(e=>e.key)).size}t(j,"distinctFileCount");function S(d,e){return d.filter(n=>n.action===e).length}t(S,"countNodes");class C{static{t(this,"RecapDetailLine")}prefix;path;suffix;constructor(e,n,i){this.prefix=e,this.path=n,this.suffix=i}invalidate(){}render(e){const n=Math.max(1,e-v(this.prefix)-v(this.suffix)),i=R(this.path,n,"\u2026");return[R(`${this.prefix}${i}${this.suffix}`,e,"")]}}class H extends F{static{t(this,"GroupRecapComponent")}setRecap(e,n,i,r,o){if(this.clear(),!e)return;if(this.addChild(new g(1)),r){for(const s of i.nodes)this.addChild(new C(`${o.accent($.graph)} `,o.muted(s.name),o.muted(s.action==="spawned"?" spawned":" finished")));for(const s of i.memories){const u=M[s.action],a=s.action==="delete"?o.diffRemoved:o.info;this.addChild(new C(`${a(u)} `,W(s,o),""))}for(const s of i.files)this.addFile(s,o)}const m=`${o.active(h.bash)} ${o.muted(f(n,"tool call","tool calls"))}`;if(r)this.addChild(new c(m,0,0));else{const s=[m],u=S(i.nodes,"spawned");u>=1&&s.push(`${o.accent($.graph)} ${o.muted(f(u,"node spawned","nodes spawned"))}`);const a=S(i.nodes,"finished");a>=1&&s.push(`${o.accent($.graph)} ${o.muted(f(a,"node finished","nodes finished"))}`);const w=j(i.files);w>=1&&s.push(`${o.warning(h.edit)} ${o.muted(f(w,"file changed","files changed"))}`),e.filesDeleted>=1&&s.push(`${o.diffRemoved(E)} ${o.muted(f(e.filesDeleted,"file deleted","files deleted"))}`);for(const[l,T,b]of K){const p=Y(i.memories,l);if(p<1)continue;const k=l==="delete"?o.diffRemoved:o.info;s.push(`${k(M[l])} ${o.muted(f(p,T,b))}`)}this.addChild(new c(s.join(o.muted(" \xB7 ")),0,0))}this.addCardEvidence(i,o);for(const s of e.bullets)this.addChild(new c(o.muted(` \u2022 ${s.trim()}`),0,0));this.addChild(new g(1))}addCardEvidence(e,n){for(const i of e.cards)this.addChild(new c(`${n.info(I)} ${n.muted(i.summary)}`,0,0));for(const i of e.events){const r=i.count>1?` \xD7${i.count}`:"";this.addChild(new c(`${n.info(I)} ${n.muted(`${i.text}${r}`)}`,0,0))}e.eventsOmitted>0&&this.addChild(new c(n.muted(` ${f(e.eventsOmitted,"more runtime event","more runtime events")}`),0,0))}addFile(e,n){const i=e.hasKnownCounts?`${n.diffAdded(`+${e.added}`)}${e.kind==="edit"?` ${n.diffRemoved(`-${e.removed}`)}`:""}`:"",r=e.countsIncomplete?n.muted(e.hasKnownCounts?" \xB7 counts incomplete":"counts unavailable"):"",o=i||r?` ${i}${r}`:"",m=e.kind==="write"?h.write:h.edit;this.addChild(new C(`${n.warning(m)} `,L(e),o))}}export{H as GroupRecapComponent};
1
+ var S=Object.defineProperty;var t=(i,n)=>S(i,"name",{value:n,configurable:!0});import{Container as b,Spacer as x,Text as f,getCapabilities as _,hyperlink as k,truncateToWidth as p,visibleWidth as O}from"@earendil-works/pi-tui";import{homedir as F}from"node:os";import{pathToFileURL as P}from"node:url";import{ICON as l}from"../../../core/inspector/model.js";import{TOOL_ICON as h}from"../../../core/preview-registry.js";const A=String.fromCodePoint(61485),v=String.fromCodePoint(61944),N=String.fromCodePoint(61530);function c(i,n,d){return`${i} ${i===1?n:d}`}t(c,"count");function L(i){const n=F();return i.startsWith(n)?`~${i.slice(n.length)}`:i}t(L,"shortened");function M(i){const n=L(i.displayPath);return _().hyperlinks?k(n,P(i.key).href):n}t(M,"filePath");function U(i,n){return i.filter(d=>d.action===n).length}t(U,"countDocuments");const T={read:A,write:h.write,edit:h.edit,delete:v},W=[["read","document read","documents read"],["write","document saved","documents saved"],["edit","document revised","documents revised"],["delete","document deleted","documents deleted"]];function K(i){return new Set(i.map(n=>n.key)).size}t(K,"distinctFileCount");function D(i,n){return i.filter(d=>d.action===n).length}t(D,"countNodes");class C{static{t(this,"RecapDetailLine")}prefix;path;suffix;constructor(n,d,o){this.prefix=n,this.path=d,this.suffix=o}invalidate(){}render(n){const d=Math.max(1,n-O(this.prefix)-O(this.suffix)),o=p(this.path,d,"\u2026");return[p(`${this.prefix}${o}${this.suffix}`,n,"")]}}class J extends b{static{t(this,"GroupRecapComponent")}setRecap(n,d,o,r,e){if(this.clear(),!n)return;if(this.addChild(new x(1)),r){for(const s of o.nodes)this.addChild(new C(`${e.accent(l.graph)} `,e.muted(s.name),e.muted(s.action==="spawned"?" spawned":" finished")));for(const s of o.documents){const m=T[s.action],a=s.action==="delete"?e.diffRemoved:e.info;this.addChild(new C(`${a(m)} `,e.muted(s.name),""))}for(const s of o.files)this.addFile(s,e)}const u=`${e.active(h.bash)} ${e.muted(c(d,"tool call","tool calls"))}`;if(r)this.addChild(new f(u,0,0));else{const s=[u],m=D(o.nodes,"spawned");m>=1&&s.push(`${e.accent(l.graph)} ${e.muted(c(m,"node spawned","nodes spawned"))}`);const a=D(o.nodes,"finished");a>=1&&s.push(`${e.accent(l.graph)} ${e.muted(c(a,"node finished","nodes finished"))}`);const w=K(o.files);w>=1&&s.push(`${e.warning(h.edit)} ${e.muted(c(w,"file changed","files changed"))}`),n.filesDeleted>=1&&s.push(`${e.diffRemoved(v)} ${e.muted(c(n.filesDeleted,"file deleted","files deleted"))}`);for(const[$,R,E]of W){const g=U(o.documents,$);if(g<1)continue;const I=$==="delete"?e.diffRemoved:e.info;s.push(`${I(T[$])} ${e.muted(c(g,R,E))}`)}this.addChild(new f(s.join(e.muted(" \xB7 ")),0,0))}this.addCardEvidence(o,e);for(const s of n.bullets)this.addChild(new f(e.muted(` \u2022 ${s.trim()}`),0,0));this.addChild(new x(1))}addCardEvidence(n,d){for(const o of n.cards)this.addChild(new f(`${d.info(N)} ${d.muted(o.summary)}`,0,0));for(const o of n.events){const r=o.count>1?` \xD7${o.count}`:"";this.addChild(new f(`${d.info(N)} ${d.muted(`${o.text}${r}`)}`,0,0))}n.eventsOmitted>0&&this.addChild(new f(d.muted(` ${c(n.eventsOmitted,"more runtime event","more runtime events")}`),0,0))}addFile(n,d){const o=n.hasKnownCounts?`${d.diffAdded(`+${n.added}`)}${n.kind==="edit"?` ${d.diffRemoved(`-${n.removed}`)}`:""}`:"",r=n.countsIncomplete?d.muted(n.hasKnownCounts?" \xB7 counts incomplete":"counts unavailable"):"",e=o||r?` ${o}${r}`:"",u=n.kind==="write"?h.write:h.edit;this.addChild(new C(`${d.warning(u)} `,M(n),e))}}export{J as GroupRecapComponent};
@@ -9,7 +9,7 @@ type Theme = {
9
9
  /** A settled tool result on its way to the transcript. `MinimizableToolComponent`
10
10
  * hands it to a definition's observer BEFORE the imported shell renders it, so a
11
11
  * definition whose folded call row states a fact from the result (an edit's
12
- * changed-line counts, a memory write's scope) still has that fact once the fold
12
+ * * changed-line counts) still has that fact once the fold
13
13
  * renders instead of the result record — on the live stream and on a rebuilt
14
14
  * transcript alike. */
15
15
  export type ObservedToolResult = {
@@ -1 +1 @@
1
- var j=Object.defineProperty;var l=(e,t)=>j(e,"name",{value:t,configurable:!0});import{constants as k,accessSync as P,existsSync as E,mkdtempSync as z,readFileSync as F,rmSync as p,statSync as C}from"node:fs";import{tmpdir as I}from"node:os";import{delimiter as M,dirname as T,join as a,resolve as g,sep as v}from"node:path";import{execFile as S,spawnSync as q}from"node:child_process";import{loadProfileManifest as O,profileMemoryDir as A}from"../../../core/profiles/manifest.js";import{contextDir as H,reportsDir as L}from"../../../core/canvas/node-agent-paths.js";import{shellQuote as c}from"../../../core/runtime/placement-tmux.js";import{surfaceTmuxStyleArgs as b}from"../../../core/runtime/surface-bg.js";function R(e,t){const r=new Map(e.map(o=>[o.node_id,o])),n=new Set([t]);for(let o=r.get(t);o?.parent!==null&&o?.parent!==void 0;){const f=o.parent;if(n.has(f))break;n.add(f),o=r.get(f)}const s=[t];for(;s.length>0;){const o=s.pop();for(const f of e)f.parent!==o||n.has(f.node_id)||(n.add(f.node_id),s.push(f.node_id))}return e.filter(o=>n.has(o.node_id)).map(o=>o.node_id)}l(R,"relatedNodeIds");function se(e,t){const r=new Set(R(e,t));return e.filter(n=>r.has(n.node_id)).map(n=>n.cwd)}l(se,"relatedNodeDirs");function W(e){const t=[];for(const r of e)try{t.push(H(r),L(r))}catch{continue}return m(t)}l(W,"familyDocumentDirs");function w(e){try{return C(e).isDirectory()}catch{return!1}}l(w,"isDirectory");function B(e,t){const r=[...t==null?[]:[t],...(process.env.PATH??"").split(M).filter(Boolean).map(n=>a(n,e))];return[...new Set(r)]}l(B,"executableCandidates");function y(e,t){for(const r of B(e,t)){try{P(r,k.X_OK)}catch{continue}if(q(r,["--version"],{stdio:"ignore"}).status===0)return r}return null}l(y,"workingExecutable");function K(e){if(e===null||e==="")return{projects:[],memory:null};try{const{profileId:t,manifest:r}=O(e);return{projects:r.projects.map(n=>n.path),memory:A(t)}}catch{return{projects:[],memory:null}}}l(K,"profileSearchRoots");function m(e){const t=new Set,r=[];for(const n of e){const s=g(n);t.has(s)||!w(s)||(t.add(s),r.push(s))}return r}l(m,"dedupeExistingDirs");function Q(e){return e.filter(t=>!e.some(r=>r!==t&&t.startsWith(r+v)))}l(Q,"outermostDirs");function X(e){const t=[];for(const r of e){let n=g(r);for(;;){const s=a(n,".crouter","memory");w(s)&&t.push(s);const o=T(n);if(o===n)break;n=o}}return m(t)}l(X,"ancestorMemoryDirs");const G=20;function J(e){try{const t=F(e);if(t.length===0)return null;const r=t[t.length-1]===0?t.length-1:t.length;return t.subarray(0,r).toString("utf8")||null}catch{return null}}l(J,"selectionPath");function le(e){const t=y("fd",e.fdPath);if(t===null){e.onNotice("fd is required for profile file search");return}const r=y("fzf");if(r===null){e.onNotice("fzf is required for profile file search");return}const n=y("nvim");if(n===null){e.onNotice("Neovim is required for profile file search");return}const s=K(e.profileId),o=m([e.cwd,...e.nodeDirs,...s.projects]);if(o.length===0){e.onNotice("No profile file-search directories exist");return}const f=Q(o),D=m([...s.memory===null?[]:[s.memory],...X(o)]),u=z(a(I(),"crtr-profile-files-")),x=a(u,"selection"),$=a(u,"candidates"),N=W(e.nodeIds).filter(i=>!f.some(d=>i===d||i.startsWith(d+v))),_=`{ ${[...f.map(i=>`${c(t)} --type f --hidden --exclude .git --exclude ${c("**/.crouter/memory/**")} . ${c(i)}`),...N.map(i=>`${c(t)} --type f --hidden --exclude .git --exclude ${c("/jobs")} . ${c(i)}`),...D.map(i=>`${c(t)} --type f --hidden --exclude .git --no-ignore . ${c(i)}`)].map(i=>`${i} &`).join(" ")} wait; } > ${c($)} && ${c(r)} --print0 --scheme=path --hscroll-off=${G} --header ${c("fuzzy path \u2022 ctrl-y yank file path")} --bind ${c("ctrl-y:execute-silent(printf '%s' {} | { if command -v pbcopy >/dev/null 2>&1; then pbcopy; elif command -v wl-copy >/dev/null 2>&1; then wl-copy; elif command -v xclip >/dev/null 2>&1; then xclip -selection clipboard; else cat >/dev/null; fi; }; printf '%s' {} | tmux load-buffer -w -)+abort")} --preview ${c("head -100 -- {}")} < ${c($)} > ${c(x)}`;try{S("tmux",["display-popup","-E","-T"," profile files ","-w","80%","-h","60%",...b(),_],()=>{const i=J(x);if(i===null||!E(i)){p(u,{recursive:!0,force:!0});return}const d=`exec ${c(n)} -- ${c(i)}`;try{S("tmux",["display-popup","-E","-T"," profile file ","-w","90%","-h","90%",...b(),d],()=>p(u,{recursive:!0,force:!0}))}catch(h){p(u,{recursive:!0,force:!0}),e.onNotice(`Could not open profile file: ${h instanceof Error?h.message:String(h)}`)}})}catch(i){p(u,{recursive:!0,force:!0}),e.onNotice(`Could not open profile file search: ${i instanceof Error?i.message:String(i)}`)}}l(le,"launchProfileFileSearch");export{le as launchProfileFileSearch,se as relatedNodeDirs,R as relatedNodeIds};
1
+ var N=Object.defineProperty;var l=(e,t)=>N(e,"name",{value:t,configurable:!0});import{constants as _,accessSync as j,existsSync as P,mkdtempSync as k,readFileSync as E,rmSync as d,statSync as z}from"node:fs";import{tmpdir as F}from"node:os";import{delimiter as C,join as p,resolve as I,sep as $}from"node:path";import{execFile as v,spawnSync as T}from"node:child_process";import{loadProfileManifest as q,profileMemoryDir as M}from"../../../core/profiles/manifest.js";import{contextDir as O}from"../../../core/canvas/node-agent-paths.js";import{shellQuote as c}from"../../../core/runtime/placement-tmux.js";import{surfaceTmuxStyleArgs as S}from"../../../core/runtime/surface-bg.js";function A(e,t){const n=new Map(e.map(i=>[i.node_id,i])),r=new Set([t]);for(let i=n.get(t);i?.parent!==null&&i?.parent!==void 0;){const f=i.parent;if(r.has(f))break;r.add(f),i=n.get(f)}const s=[t];for(;s.length>0;){const i=s.pop();for(const f of e)f.parent!==i||r.has(f.node_id)||(r.add(f.node_id),s.push(f.node_id))}return e.filter(i=>r.has(i.node_id)).map(i=>i.node_id)}l(A,"relatedNodeIds");function oe(e,t){const n=new Set(A(e,t));return e.filter(r=>n.has(r.node_id)).map(r=>r.cwd)}l(oe,"relatedNodeDirs");function H(e){const t=[];for(const n of e)try{t.push(O(n))}catch{continue}return y(t)}l(H,"familyDocumentDirs");function L(e){try{return z(e).isDirectory()}catch{return!1}}l(L,"isDirectory");function R(e,t){const n=[...t==null?[]:[t],...(process.env.PATH??"").split(C).filter(Boolean).map(r=>p(r,e))];return[...new Set(n)]}l(R,"executableCandidates");function h(e,t){for(const n of R(e,t)){try{j(n,_.X_OK)}catch{continue}if(T(n,["--version"],{stdio:"ignore"}).status===0)return n}return null}l(h,"workingExecutable");function W(e){if(e===null||e==="")return{projects:[],memory:null};try{const{profileId:t,manifest:n}=q(e);return{projects:n.projects.map(r=>r.path),memory:M(t)}}catch{return{projects:[],memory:null}}}l(W,"profileSearchRoots");function y(e){const t=new Set,n=[];for(const r of e){const s=I(r);t.has(s)||!L(s)||(t.add(s),n.push(s))}return n}l(y,"dedupeExistingDirs");function B(e){return e.filter(t=>!e.some(n=>n!==t&&t.startsWith(n+$)))}l(B,"outermostDirs");const K=20;function Q(e){try{const t=E(e);if(t.length===0)return null;const n=t[t.length-1]===0?t.length-1:t.length;return t.subarray(0,n).toString("utf8")||null}catch{return null}}l(Q,"selectionPath");function ie(e){const t=h("fd",e.fdPath);if(t===null){e.onNotice("fd is required for profile file search");return}const n=h("fzf");if(n===null){e.onNotice("fzf is required for profile file search");return}const r=h("nvim");if(r===null){e.onNotice("Neovim is required for profile file search");return}const s=W(e.profileId),i=y([e.cwd,...e.nodeDirs,...s.projects]);if(i.length===0){e.onNotice("No profile file-search directories exist");return}const f=B(i),w=y([...s.memory===null?[]:[s.memory]]),u=k(p(F(),"crtr-profile-files-")),g=p(u,"selection"),x=p(u,"candidates"),b=H(e.nodeIds).filter(o=>!f.some(a=>o===a||o.startsWith(a+$))),D=`{ ${[...f.map(o=>`${c(t)} --type f --hidden --exclude .git . ${c(o)}`),...b.map(o=>`${c(t)} --type f --hidden --exclude .git --exclude ${c("/jobs")} . ${c(o)}`),...w.map(o=>`${c(t)} --type f --hidden --exclude .git --no-ignore . ${c(o)}`)].map(o=>`${o} &`).join(" ")} wait; } > ${c(x)} && ${c(n)} --print0 --scheme=path --hscroll-off=${K} --header ${c("fuzzy path \u2022 ctrl-y yank file path")} --bind ${c("ctrl-y:execute-silent(printf '%s' {} | { if command -v pbcopy >/dev/null 2>&1; then pbcopy; elif command -v wl-copy >/dev/null 2>&1; then wl-copy; elif command -v xclip >/dev/null 2>&1; then xclip -selection clipboard; else cat >/dev/null; fi; }; printf '%s' {} | tmux load-buffer -w -)+abort")} --preview ${c("head -100 -- {}")} < ${c(x)} > ${c(g)}`;try{v("tmux",["display-popup","-E","-T"," profile files ","-w","80%","-h","60%",...S(),D],()=>{const o=Q(g);if(o===null||!P(o)){d(u,{recursive:!0,force:!0});return}const a=`exec ${c(r)} -- ${c(o)}`;try{v("tmux",["display-popup","-E","-T"," profile file ","-w","90%","-h","90%",...S(),a],()=>d(u,{recursive:!0,force:!0}))}catch(m){d(u,{recursive:!0,force:!0}),e.onNotice(`Could not open profile file: ${m instanceof Error?m.message:String(m)}`)}})}catch(o){d(u,{recursive:!0,force:!0}),e.onNotice(`Could not open profile file search: ${o instanceof Error?o.message:String(o)}`)}}l(ie,"launchProfileFileSearch");export{ie as launchProfileFileSearch,oe as relatedNodeDirs,A as relatedNodeIds};
@@ -1 +1 @@
1
- var E=Object.defineProperty;var i=(t,e)=>E(t,"name",{value:e,configurable:!0});import{execFile as p}from"node:child_process";import{BUILTIN_SLASH_COMMANDS as h}from"../../../core/runtime/pi-vendored.js";import{surfaceTmuxStyleArgs as O}from"../../../core/runtime/surface-bg.js";import{viewerOperationForSlash as _}from"../input/capabilities.js";import{shellQuote as y}from"../../../shared/shell-quote.js";const g=[{name:"tutorial",description:"The guided crouter tutorial \u2014 your agent teaches it, one lesson at a time"},{name:"clear",description:"Clear the conversation and free context \u2014 a fresh, empty session (like /new)"},{name:"graph",description:"Toggle the canvas GRAPH view (your local subscription tree)"},{name:"inbox",description:"Toggle the human inbox \u2014 pending asks and reviews for you"},{name:"promote",description:"Promote this node to an orchestrator \u2014 /promote, or /promote <kind> to specialize"},{name:"resume",description:"Open the canvas navigator and swap THIS pane onto the chosen node; parked residents wake only on submitted input"},{name:"resume-session",description:"Switch this node onto one of its saved pi sessions \u2014 picker, or /resume-session <session-path>"},{name:"context",description:"Browse this node + its subscriptions\u2019 context dirs in a read-only nvim popup"},{name:"plugins",description:"Open the interactive plugin browser for this machine"},{name:"node-metadata",description:"Inspect this node \u2014 identity, lifecycle, runtime, graph, artifacts, paths, and agent surfaces"},{name:"mcp",description:"MCP servers \u2014 status from the adapter\u2019s config/cache; Enter (or /mcp <server>) connects, reconnects, or re-auths"},{name:"rename",description:"Rename this node everywhere \u2014 node row, viewer window, session chip, tmux pane: /rename <name>"},{name:"color",description:"Color this node \u2014 tmux pane outline + name chip: /color <color> (red, blue, #rrggbb, \u2026) or /color none"},{name:"mouse",description:"Toggle mouse wheel scrolling and drag-select \u2014 off restores tmux drag-select and copy-mode mouse"},{name:"copy-message",description:"Copy the newest message visible in the transcript viewport"},{name:"copy-tool",description:"Copy the newest tool call output"},{name:"copy-transcript",description:"Copy every copyable transcript block"},{name:"fold-tools",description:"View setting \u2014 fold every FINISHED tool call to its single call line (Alt+C \u2192 z \u2192 f)"}],$=new Map([["resume-node","resume"]]),w=new Set([...g.map(t=>t.name),...$.keys()]),U=new Set(["black","red","green","yellow","blue","magenta","cyan","white","brightred","brightgreen","brightyellow","brightblue","brightmagenta","brightcyan","orange","grey","gray","default"]),T=new Set(["trust"]),N=new Set(Object.keys({off:!0,minimal:!0,low:!0,medium:!0,high:!0,xhigh:!0,max:!0})),v=new Set(h.map(t=>t.name));function b(t){return t.capabilities.nodeId}i(b,"nodeIdFor");function H(t){return t.capabilities.profileId}i(H,"profileIdFor");function P(t,e){const n=_(t,v.has(t),w.has(t));return n===void 0?void 0:e.capabilities.refusal(n,t)}i(P,"readOnlyRefusal");function te(){return new Set([...v,...w,...T])}i(te,"locallyConsumedCommandNames");function j(t){const e=/^\/(\S+)\s*([\s\S]*)$/.exec(t.trim());return e===null?void 0:{name:e[1],arg:e[2].trim()}}i(j,"parseSlashCommand");function oe(t){return t.trimStart().startsWith("/")}i(oe,"isSlashCommand");function re(t,e){const n=j(t);if(n===void 0)return!1;const{arg:o}=n,r=$.get(n.name)??n.name;if(T.has(r))return e.notify(`/${r} is not supported in attach (Phase 4)`),!0;if(w.has(r)){const s=P(r,e);return s!==void 0?(e.notify(s),!0):X(r,o,e)}if(!v.has(r))return!1;const u=P(r,e);if(u!==void 0)return e.notify(u),!0;switch(r){case"new":return e.send({type:"new_session"}),!0;case"reload":return e.send({type:"reload"}),!0;case"compact":return e.send({type:"compact",instructions:o||void 0}),!0;case"quit":return e.onQuit?(e.onQuit(),!0):(e.send({type:"bye"}),e.notify("Detaching \u2014 the engine keeps running"),!0);case"name":return o?(e.send({type:"set_session_name",name:o}),!0):m(e,"/name <display name>");case"export":{const{path:s,format:a}=W(o,e.cwd??process.cwd());return e.send({type:"export",path:s,format:a}),e.notify(`Exporting session \u2192 ${s}`),!0}case"import":return o?(e.send({type:"switch_session",path:o}),!0):m(e,"/import <path-to-session.jsonl>");case"model":return o?(e.send({type:"set_model",model:o}),!0):f(e.openModelPicker,e,"model","/model <provider/id>");case"fork":return o?(e.send({type:"fork",entryId:o}),!0):f(e.openForkPicker,e,"fork point","/fork <entryId>");case"tree":return o?(e.send({type:"navigate_tree",targetId:o}),!0):f(e.openTreePicker,e,"tree","/tree <entryId>");case"scoped-models":return e.openScopedModelsPicker?(e.openScopedModelsPicker(),!0):(e.notify("The scoped-models view needs the read-op channel, which this viewer has not wired"),!0);case"settings":return Q(o,e);case"session":return e.notify(Y(e.state)),!0;case"copy":return e.onCopy?(e.onCopy(),!0):(e.notify("/copy is not available in this viewer"),!0);case"login":return e.openLoginPicker?(e.openLoginPicker(),!0):(e.notify("/login is not available in this viewer"),!0);case"logout":return e.openLogoutPicker?(e.openLogoutPicker(),!0):(e.notify("/logout is not available in this viewer"),!0);case"share":return e.send({type:"share"}),e.notify("Sharing session\u2026"),!0;case"clone":return e.send({type:"clone"}),e.notify("Cloning session\u2026"),!0;case"changelog":return e.notify("/changelog: see https://github.com/earendil-works/pi for release notes (no bundled changelog in this build)"),!0;case"hotkeys":return e.onHelp?(e.onHelp(),!0):(e.notify("/hotkeys is not available in this viewer"),!0);default:return e.notify(`/${r} is not available in attach (Phase 4)`),!0}}i(re,"dispatchSlashCommand");function M(t,e){const n=i(a=>{const l=_(a,!1,!0);return l===void 0||e.permits(l)},"permitted"),o=g.filter(a=>n(a.name)),r=new Map(g.map(a=>[a.name,a])),u=t.flatMap(a=>{const l=r.get(a.name);return l===void 0?[a]:n(a.name)?[l]:[]}),s=new Set(t.map(a=>a.name));return[...u,...o.filter(a=>!s.has(a.name))]}i(M,"withCanvasCommands");function ie(t,e){return M(t??h,e).map(n=>({name:n.name,description:n.description}))}i(ie,"slashCommandList");function se(t,e){return M(t??h,e).map(n=>({value:`/${n.name}`,label:`/${n.name}`,description:n.description}))}i(se,"commandAutocompleteItems");function X(t,e,n){switch(t){case"clear":return n.send({type:"new_session"}),!0;case"graph":return n.onGraph?n.onGraph():n.notify("The GRAPH overlay is not wired into the viewer yet"),!0;case"inbox":return n.onInbox?n.onInbox():n.notify("The inbox surface is not wired into the viewer yet"),!0;case"tutorial":return n.send({type:"prompt",text:"The user asked for the crouter tutorial. Run `crtr sys tutorial -h`, pick the track that matches what they want to learn, and teach it one lesson per invocation \u2014 in your own words, letting them try each thing before you move on."}),!0;case"promote":return B(e,n),!0;case"resume":return e?m(n,"/resume \u2014 no argument; use /resume-session <path> to switch pi sessions"):G(n);case"resume-session":return e?(n.send({type:"switch_session",path:e}),!0):f(n.openSessionPicker,n,"session","/resume-session <session-path>");case"mcp":return n.openMcpPicker?n.openMcpPicker(e||void 0):n.notify("The MCP panel is not wired into this viewer"),!0;case"context":return V(n);case"plugins":return q(n);case"node-metadata":return n.onNodeMetadata?n.onNodeMetadata():n.notify("Node metadata is not wired into this viewer"),!0;case"rename":return F(e,n),!0;case"color":return R(e,n);case"fold-tools":return n.onFoldTools?n.onFoldTools():n.notify("The fold-tools view setting is not wired into this viewer"),!0;case"mouse":return n.onToggleMouse?n.onToggleMouse():n.notify("Mouse reporting is not wired into this viewer"),!0;case"copy-message":return n.onCopyTarget?n.onCopyTarget("message"):n.notify("/copy-message is not available in this viewer"),!0;case"copy-tool":return n.onCopyTarget?n.onCopyTarget("tool"):n.notify("/copy-tool is not available in this viewer"),!0;case"copy-transcript":return n.onCopyTarget?n.onCopyTarget("transcript"):n.notify("/copy-transcript is not available in this viewer"),!0;default:return n.notify(`/${t} is not available in attach`),!0}}i(X,"dispatchCanvasCommand");function B(t,e){const n=b(e).trim();if(n===""){e.notify("/promote: no node to promote (viewer has no node id)");return}const o=t.trim().toLowerCase();e.notify(o?`Promoting \u2192 ${o}\u2026`:"Promoting\u2026");const r=["node","promote","--node",n,"--json"];o!==""&&r.push("--kind",o),p("crtr",r,{timeout:15e3,maxBuffer:4*1024*1024},(s,a)=>{let l=null,d=null;try{l=JSON.parse(a)}catch{l=null}if(s&&l===null){const L=typeof s.stdout=="string"?s.stdout:"";try{const C=JSON.parse(L);d=typeof C.message=="string"?C.message:null}catch{d=null}d===null&&(d=s.message)}if(l===null){e.notify(`promote failed: ${d??"unknown error"}`);return}const S=(l.roadmap_path??"").trim();e.notify(`Promoted to ${l.kind??"orchestrator"} orchestrator \u2014 authoring roadmap${S!==""?` (${S})`:""}.`),e.send({type:"prompt",text:"You have just been promoted to an orchestrator. Your new-role guidance is arriving \u2014 read it, author your roadmap, and start delegating."})}).stdin?.end()}i(B,"promoteNode");function F(t,e){const n=b(e).trim();if(n===""){e.notify("/rename: no node to rename (viewer has no node id)");return}if(t===""){e.notify("Usage: /rename <name>");return}e.send({type:"set_session_name",name:t});const o=process.env.TMUX_PANE;process.env.TMUX!==void 0&&o!==void 0&&o!==""&&p("tmux",["select-pane","-t",o,"-T",t],()=>{}),p("crtr",["node","config","--node",n,"--name",t,"--json"],{timeout:15e3,maxBuffer:4*1024*1024},(r,u)=>{if(r){let s=null;try{const a=JSON.parse(u);s=typeof a.message=="string"?a.message:null}catch{s=null}e.notify(`rename failed: ${s??r.message}`);return}e.notify(`Renamed node \u2192 ${t}`)})}i(F,"renameNode");function c(t){return new Promise(e=>{p("tmux",t,{timeout:5e3},(n,o)=>e(n?"":o))})}i(c,"tmuxCall");async function D(t,e,n){if(n){await c(["set-option","-p","-u","-t",t,"@crtr_color"]);return}await c(["set-option","-p","-t",t,"@crtr_color",e]);for(const o of["pane-border-style","pane-active-border-style"]){const r=(await c(["show-options","-wqv","-t",t,o])).trim();if(r.includes("@crtr_color"))continue;let u=r!==""?r:(await c(["show-options","-gqv",o])).trim();u===""&&(u=o==="pane-active-border-style"?"fg=green":"default");const s=`#{?#{!=:#{@crtr_color},},fg=#{@crtr_color},${u.replace(/,/g,"#,")}}`;await c(["set-option","-w","-t",t,o,s])}}i(D,"paintPaneBorder");function R(t,e){const n=t.trim().toLowerCase();if(n==="")return e.notify("Usage: /color <color> \u2014 a name (red, blue, orange\u2026), colourN, or #rrggbb; /color none to clear"),!0;const o=n==="none"||n==="clear";if(!(o||U.has(n)||/^colour\d{1,3}$/.test(n)||/^#[0-9a-f]{6}$/.test(n)))return e.notify(`Invalid color "${n}" \u2014 use a tmux colour name (${["red","green","yellow","blue","magenta","cyan","orange"].join(", ")}, \u2026), colourN, or #rrggbb`),!0;const u=process.env.TMUX_PANE,s=process.env.TMUX!==void 0&&u!==void 0&&u!=="";return s&&D(u,n,o),e.onColor?.(o?null:n),e.notify(o?"Node color cleared":`Node colored ${n}${s?"":" (chip only \u2014 no tmux pane)"}`),!0}i(R,"colorNode");function G(t){const e=process.env.TMUX_PANE;if(process.env.TMUX===void 0||e===void 0||e==="")return t.notify("/resume needs tmux"),!0;const n=y(t.cwd??process.cwd()),o=H(t),r=o===void 0||o===""?"":` --profile-id ${y(o)}`,u=`crtr canvas browse --return-pane ${e} --cwd ${n}${r}`;return k(u,{w:"97%",h:"95%"}),!0}i(G,"resumeNode");function V(t){if(process.env.TMUX===void 0)return t.notify("/context needs tmux"),!0;const e=b(t).trim();return e===""?(t.notify("/context: no node to root on (viewer has no node id)"),!0):(k(`crtr node inspect context --node ${y(e)}`),!0)}i(V,"openContext");function q(t){return process.env.TMUX===void 0?(t.notify("/plugins needs tmux"),!0):(k("crtr pkg browse"),!0)}i(q,"openPlugins");function k(t,e={w:"90%",h:"85%"}){try{p("tmux",["display-popup","-E","-w",e.w,"-h",e.h,...O(),t],()=>{})}catch{}}i(k,"popup");function m(t,e){return t.notify(`Usage: ${e}`),!0}i(m,"usage");function J(t,e,n){return t.notify(`Interactive ${e} picker isn't available over view.sock yet \u2014 use ${n}`),!0}i(J,"pickerHint");function f(t,e,n,o){return t?(t(),!0):J(e,n,o)}i(f,"openOrHint");function Q(t,e){const[n,...o]=t.split(/\s+/),r=o.join(" ").trim();switch(n){case"thinking":return r?N.has(r)?(e.send({type:"set_thinking_level",level:r}),!0):(e.notify(`Invalid thinking level "${r}" \u2014 choose one of: ${[...N].join(", ")}`),!0):m(e,"/settings thinking <level>");case"auto-retry":return e.send({type:"set_auto_retry",enabled:A(r)}),!0;case"auto-compaction":return e.send({type:"set_auto_compaction",enabled:A(r)}),!0;case"":return e.openSettingsPicker?(e.openSettingsPicker(),!0):I(e);default:return I(e)}}i(Q,"handleSettings");function I(t){return t.notify("Settings: /settings thinking <level> | auto-retry on|off | auto-compaction on|off"),!0}i(I,"settingsSummary");function A(t){return/^(on|true|yes|1|enabled?)$/i.test(t.trim())}i(A,"parseBool");function W(t,e){const n=t||`${e}/pi-export-${Date.now()}.html`,o=n.endsWith(".jsonl")?"jsonl":"html";return{path:n,format:o}}i(W,"parseExport");function Y(t){return t?`Session ${t.sessionName?`"${t.sessionName}" `:""}${t.sessionId} \xB7 model ${t.model?.id??"unknown"} \xB7 thinking ${t.thinkingLevel}`:"Session info unavailable"}i(Y,"describeSession");export{g as CANVAS_SLASH_COMMANDS,se as commandAutocompleteItems,re as dispatchSlashCommand,oe as isSlashCommand,te as locallyConsumedCommandNames,ie as slashCommandList};
1
+ var E=Object.defineProperty;var i=(o,e)=>E(o,"name",{value:e,configurable:!0});import{execFile as p}from"node:child_process";import{BUILTIN_SLASH_COMMANDS as h}from"../../../core/runtime/pi-vendored.js";import{surfaceTmuxStyleArgs as O}from"../../../core/runtime/surface-bg.js";import{viewerOperationForSlash as _}from"../input/capabilities.js";import{shellQuote as y}from"../../../shared/shell-quote.js";const g=[{name:"tutorial",description:"The guided crouter tutorial \u2014 your agent teaches it, one lesson at a time"},{name:"clear",description:"Clear the conversation and free context \u2014 a fresh, empty session (like /new)"},{name:"graph",description:"Toggle the canvas GRAPH view (your local subscription tree)"},{name:"inbox",description:"Toggle the human inbox \u2014 pending asks and reviews for you"},{name:"promote",description:"Promote this node to an orchestrator \u2014 /promote, or /promote <kind> to specialize"},{name:"resume",description:"Open the canvas navigator and swap THIS pane onto the chosen node; parked residents wake only on submitted input"},{name:"resume-session",description:"Switch this node onto one of its saved pi sessions \u2014 picker, or /resume-session <session-path>"},{name:"context",description:"Browse this node + its subscriptions\u2019 context dirs in a read-only nvim popup"},{name:"plugins",description:"Open the interactive plugin browser for this machine"},{name:"node-metadata",description:"Inspect this node \u2014 identity, lifecycle, runtime, graph, artifacts, paths, and agent surfaces"},{name:"mcp",description:"MCP servers \u2014 status from the adapter\u2019s config/cache; Enter (or /mcp <server>) connects, reconnects, or re-auths"},{name:"rename",description:"Rename this node everywhere \u2014 node row, viewer window, session chip, tmux pane: /rename <name>"},{name:"color",description:"Color this node \u2014 tmux pane outline + name chip: /color <color> (red, blue, #rrggbb, \u2026) or /color none"},{name:"mouse",description:"Toggle mouse wheel scrolling and drag-select \u2014 off restores tmux drag-select and copy-mode mouse"},{name:"copy-message",description:"Copy the newest message visible in the transcript viewport"},{name:"copy-tool",description:"Copy the newest tool call output"},{name:"copy-transcript",description:"Copy every copyable transcript block"},{name:"fold-tools",description:"View setting \u2014 fold every FINISHED tool call to its single call line (Alt+C \u2192 z \u2192 f)"}],$=new Map([["resume-node","resume"]]),w=new Set([...g.map(o=>o.name),...$.keys()]),U=new Set(["black","red","green","yellow","blue","magenta","cyan","white","brightred","brightgreen","brightyellow","brightblue","brightmagenta","brightcyan","orange","grey","gray","default"]),T=new Set(["trust"]),N=new Set(Object.keys({off:!0,minimal:!0,low:!0,medium:!0,high:!0,xhigh:!0,max:!0})),v=new Set(h.map(o=>o.name));function b(o){return o.capabilities.nodeId}i(b,"nodeIdFor");function H(o){return o.capabilities.profileId}i(H,"profileIdFor");function M(o,e){const n=_(o,v.has(o),w.has(o));return n===void 0?void 0:e.capabilities.refusal(n,o)}i(M,"readOnlyRefusal");function oe(){return new Set([...v,...w,...T])}i(oe,"locallyConsumedCommandNames");function j(o){const e=/^\/(\S+)\s*([\s\S]*)$/.exec(o.trim());return e===null?void 0:{name:e[1],arg:e[2].trim()}}i(j,"parseSlashCommand");function te(o){return o.trimStart().startsWith("/")}i(te,"isSlashCommand");function re(o,e){const n=j(o);if(n===void 0)return!1;const{arg:t}=n,r=$.get(n.name)??n.name;if(T.has(r))return e.notify(`/${r} is not supported in attach (Phase 4)`),!0;if(w.has(r)){const s=M(r,e);return s!==void 0?(e.notify(s),!0):X(r,t,e)}if(!v.has(r))return!1;const u=M(r,e);if(u!==void 0)return e.notify(u),!0;switch(r){case"new":return e.send({type:"new_session"}),!0;case"reload":return e.send({type:"reload"}),!0;case"compact":return e.send({type:"compact",instructions:t||void 0}),!0;case"quit":return e.onQuit?(e.onQuit(),!0):(e.send({type:"bye"}),e.notify("Detaching \u2014 the engine keeps running"),!0);case"name":return t?(e.send({type:"set_session_name",name:t}),!0):f(e,"/name <display name>");case"export":{const{path:s,format:a}=W(t,e.cwd??process.cwd());return e.send({type:"export",path:s,format:a}),e.notify(`Exporting session \u2192 ${s}`),!0}case"import":return t?(e.send({type:"switch_session",path:t}),!0):f(e,"/import <path-to-session.jsonl>");case"model":return t?(e.send({type:"set_model",model:t}),!0):m(e.openModelPicker,e,"model","/model <provider/id>");case"fork":return t?(e.send({type:"fork",entryId:t}),!0):m(e.openForkPicker,e,"fork point","/fork <entryId>");case"tree":return t?(e.send({type:"navigate_tree",targetId:t}),!0):m(e.openTreePicker,e,"tree","/tree <entryId>");case"scoped-models":return e.openScopedModelsPicker?(e.openScopedModelsPicker(),!0):(e.notify("The scoped-models view needs the read-op channel, which this viewer has not wired"),!0);case"settings":return Q(t,e);case"session":return e.notify(Y(e.state)),!0;case"copy":return e.onCopy?(e.onCopy(),!0):(e.notify("/copy is not available in this viewer"),!0);case"login":return e.openLoginPicker?(e.openLoginPicker(),!0):(e.notify("/login is not available in this viewer"),!0);case"logout":return e.openLogoutPicker?(e.openLogoutPicker(),!0):(e.notify("/logout is not available in this viewer"),!0);case"share":return e.send({type:"share"}),e.notify("Sharing session\u2026"),!0;case"clone":return e.send({type:"clone"}),e.notify("Cloning session\u2026"),!0;case"changelog":return e.notify("/changelog: see https://github.com/earendil-works/pi for release notes (no bundled changelog in this build)"),!0;case"hotkeys":return e.onHelp?(e.onHelp(),!0):(e.notify("/hotkeys is not available in this viewer"),!0);default:return e.notify(`/${r} is not available in attach (Phase 4)`),!0}}i(re,"dispatchSlashCommand");function P(o,e){const n=i(a=>{const l=_(a,!1,!0);return l===void 0||e.permits(l)},"permitted"),t=g.filter(a=>n(a.name)),r=new Map(g.map(a=>[a.name,a])),u=o.flatMap(a=>{const l=r.get(a.name);return l===void 0?[a]:n(a.name)?[l]:[]}),s=new Set(o.map(a=>a.name));return[...u,...t.filter(a=>!s.has(a.name))]}i(P,"withCanvasCommands");function ie(o,e){return P(o??h,e).map(n=>({name:n.name,description:n.description}))}i(ie,"slashCommandList");function se(o,e){return P(o??h,e).map(n=>({value:`/${n.name}`,label:`/${n.name}`,description:n.description}))}i(se,"commandAutocompleteItems");function X(o,e,n){switch(o){case"clear":return n.send({type:"new_session"}),!0;case"graph":return n.onGraph?n.onGraph():n.notify("The GRAPH overlay is not wired into the viewer yet"),!0;case"inbox":return n.onInbox?n.onInbox():n.notify("The inbox surface is not wired into the viewer yet"),!0;case"tutorial":return n.send({type:"prompt",text:"The user asked for the crouter tutorial. Run `crtr sys tutorial -h`, pick the track that matches what they want to learn, and teach it one lesson per invocation \u2014 in your own words, letting them try each thing before you move on."}),!0;case"promote":return B(e,n),!0;case"resume":return e?f(n,"/resume \u2014 no argument; use /resume-session <path> to switch pi sessions"):G(n);case"resume-session":return e?(n.send({type:"switch_session",path:e}),!0):m(n.openSessionPicker,n,"session","/resume-session <session-path>");case"mcp":return n.openMcpPicker?n.openMcpPicker(e||void 0):n.notify("The MCP panel is not wired into this viewer"),!0;case"context":return V(n);case"plugins":return q(n);case"node-metadata":return n.onNodeMetadata?n.onNodeMetadata():n.notify("Node metadata is not wired into this viewer"),!0;case"rename":return F(e,n),!0;case"color":return D(e,n);case"fold-tools":return n.onFoldTools?n.onFoldTools():n.notify("The fold-tools view setting is not wired into this viewer"),!0;case"mouse":return n.onToggleMouse?n.onToggleMouse():n.notify("Mouse reporting is not wired into this viewer"),!0;case"copy-message":return n.onCopyTarget?n.onCopyTarget("message"):n.notify("/copy-message is not available in this viewer"),!0;case"copy-tool":return n.onCopyTarget?n.onCopyTarget("tool"):n.notify("/copy-tool is not available in this viewer"),!0;case"copy-transcript":return n.onCopyTarget?n.onCopyTarget("transcript"):n.notify("/copy-transcript is not available in this viewer"),!0;default:return n.notify(`/${o} is not available in attach`),!0}}i(X,"dispatchCanvasCommand");function B(o,e){const n=b(e).trim();if(n===""){e.notify("/promote: no node to promote (viewer has no node id)");return}const t=o.trim().toLowerCase();e.notify(t?`Promoting \u2192 ${t}\u2026`:"Promoting\u2026");const r=["node","promote","--node",n,"--json"];t!==""&&r.push("--kind",t),p("crtr",r,{timeout:15e3,maxBuffer:4*1024*1024},(s,a)=>{let l=null,d=null;try{l=JSON.parse(a)}catch{l=null}if(s&&l===null){const L=typeof s.stdout=="string"?s.stdout:"";try{const C=JSON.parse(L);d=typeof C.message=="string"?C.message:null}catch{d=null}d===null&&(d=s.message)}if(l===null){e.notify(`promote failed: ${d??"unknown error"}`);return}const S=(l.roadmap_ref??"").trim();e.notify(`Promoted to ${l.kind??"orchestrator"} orchestrator \u2014 authoring roadmap${S!==""?` (${S})`:""}.`),e.send({type:"prompt",text:"You have just been promoted to an orchestrator. Your new-role guidance is arriving \u2014 read it, author your roadmap, and start delegating."})}).stdin?.end()}i(B,"promoteNode");function F(o,e){const n=b(e).trim();if(n===""){e.notify("/rename: no node to rename (viewer has no node id)");return}if(o===""){e.notify("Usage: /rename <name>");return}e.send({type:"set_session_name",name:o});const t=process.env.TMUX_PANE;process.env.TMUX!==void 0&&t!==void 0&&t!==""&&p("tmux",["select-pane","-t",t,"-T",o],()=>{}),p("crtr",["node","config","--node",n,"--name",o,"--json"],{timeout:15e3,maxBuffer:4*1024*1024},(r,u)=>{if(r){let s=null;try{const a=JSON.parse(u);s=typeof a.message=="string"?a.message:null}catch{s=null}e.notify(`rename failed: ${s??r.message}`);return}e.notify(`Renamed node \u2192 ${o}`)})}i(F,"renameNode");function c(o){return new Promise(e=>{p("tmux",o,{timeout:5e3},(n,t)=>e(n?"":t))})}i(c,"tmuxCall");async function R(o,e,n){if(n){await c(["set-option","-p","-u","-t",o,"@crtr_color"]);return}await c(["set-option","-p","-t",o,"@crtr_color",e]);for(const t of["pane-border-style","pane-active-border-style"]){const r=(await c(["show-options","-wqv","-t",o,t])).trim();if(r.includes("@crtr_color"))continue;let u=r!==""?r:(await c(["show-options","-gqv",t])).trim();u===""&&(u=t==="pane-active-border-style"?"fg=green":"default");const s=`#{?#{!=:#{@crtr_color},},fg=#{@crtr_color},${u.replace(/,/g,"#,")}}`;await c(["set-option","-w","-t",o,t,s])}}i(R,"paintPaneBorder");function D(o,e){const n=o.trim().toLowerCase();if(n==="")return e.notify("Usage: /color <color> \u2014 a name (red, blue, orange\u2026), colourN, or #rrggbb; /color none to clear"),!0;const t=n==="none"||n==="clear";if(!(t||U.has(n)||/^colour\d{1,3}$/.test(n)||/^#[0-9a-f]{6}$/.test(n)))return e.notify(`Invalid color "${n}" \u2014 use a tmux colour name (${["red","green","yellow","blue","magenta","cyan","orange"].join(", ")}, \u2026), colourN, or #rrggbb`),!0;const u=process.env.TMUX_PANE,s=process.env.TMUX!==void 0&&u!==void 0&&u!=="";return s&&R(u,n,t),e.onColor?.(t?null:n),e.notify(t?"Node color cleared":`Node colored ${n}${s?"":" (chip only \u2014 no tmux pane)"}`),!0}i(D,"colorNode");function G(o){const e=process.env.TMUX_PANE;if(process.env.TMUX===void 0||e===void 0||e==="")return o.notify("/resume needs tmux"),!0;const n=y(o.cwd??process.cwd()),t=H(o),r=t===void 0||t===""?"":` --profile-id ${y(t)}`,u=`crtr canvas browse --return-pane ${e} --cwd ${n}${r}`;return k(u,{w:"97%",h:"95%"}),!0}i(G,"resumeNode");function V(o){if(process.env.TMUX===void 0)return o.notify("/context needs tmux"),!0;const e=b(o).trim();return e===""?(o.notify("/context: no node to root on (viewer has no node id)"),!0):(k(`crtr node inspect context --node ${y(e)}`),!0)}i(V,"openContext");function q(o){return process.env.TMUX===void 0?(o.notify("/plugins needs tmux"),!0):(k("crtr pkg browse"),!0)}i(q,"openPlugins");function k(o,e={w:"90%",h:"85%"}){try{p("tmux",["display-popup","-E","-w",e.w,"-h",e.h,...O(),o],()=>{})}catch{}}i(k,"popup");function f(o,e){return o.notify(`Usage: ${e}`),!0}i(f,"usage");function J(o,e,n){return o.notify(`Interactive ${e} picker isn't available over view.sock yet \u2014 use ${n}`),!0}i(J,"pickerHint");function m(o,e,n,t){return o?(o(),!0):J(e,n,t)}i(m,"openOrHint");function Q(o,e){const[n,...t]=o.split(/\s+/),r=t.join(" ").trim();switch(n){case"thinking":return r?N.has(r)?(e.send({type:"set_thinking_level",level:r}),!0):(e.notify(`Invalid thinking level "${r}" \u2014 choose one of: ${[...N].join(", ")}`),!0):f(e,"/settings thinking <level>");case"auto-retry":return e.send({type:"set_auto_retry",enabled:A(r)}),!0;case"auto-compaction":return e.send({type:"set_auto_compaction",enabled:A(r)}),!0;case"":return e.openSettingsPicker?(e.openSettingsPicker(),!0):I(e);default:return I(e)}}i(Q,"handleSettings");function I(o){return o.notify("Settings: /settings thinking <level> | auto-retry on|off | auto-compaction on|off"),!0}i(I,"settingsSummary");function A(o){return/^(on|true|yes|1|enabled?)$/i.test(o.trim())}i(A,"parseBool");function W(o,e){const n=o||`${e}/pi-export-${Date.now()}.html`,t=n.endsWith(".jsonl")?"jsonl":"html";return{path:n,format:t}}i(W,"parseExport");function Y(o){return o?`Session ${o.sessionName?`"${o.sessionName}" `:""}${o.sessionId} \xB7 model ${o.model?.id??"unknown"} \xB7 thinking ${o.thinkingLevel}`:"Session info unavailable"}i(Y,"describeSession");export{g as CANVAS_SLASH_COMMANDS,se as commandAutocompleteItems,re as dispatchSlashCommand,te as isSlashCommand,oe as locallyConsumedCommandNames,ie as slashCommandList};