@north-light/cli 0.3.668 → 0.3.669

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 (1130) hide show
  1. package/dist/api/client.d.ts +8 -0
  2. package/dist/api/client.js +3 -3
  3. package/dist/api/contract.d.ts +1 -1
  4. package/dist/api/contract.js +1 -1
  5. package/dist/api/dto/docs.d.ts +1 -1
  6. package/dist/api/dto/imports.d.ts +5 -1
  7. package/dist/api/dto/objects.d.ts +2 -2
  8. package/dist/api/dto/profiles.d.ts +6 -2
  9. package/dist/api/dto/profiles.js +1 -1
  10. package/dist/api/dto/repo-import.d.ts +25 -0
  11. package/dist/api/dto/repo-import.js +0 -0
  12. package/dist/api/routes.d.ts +2 -0
  13. package/dist/api/routes.js +1 -1
  14. package/dist/builtin-memory/crouter-concepts/documents.md +1 -1
  15. package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/claude-plugin-commands.ts +2 -1
  16. package/dist/clients/attach/session/profile-files.js +1 -1
  17. package/dist/clients/attach/viewer.js +479 -479
  18. package/dist/clients/dashboard/app.js +2 -2
  19. package/dist/commands/canvas/share.js +2 -2
  20. package/dist/commands/doc/shared.d.ts +1 -1
  21. package/dist/commands/doc/shared.js +1 -1
  22. package/dist/commands/node-lifecycle-revive.d.ts +10 -0
  23. package/dist/commands/node-lifecycle-revive.js +1 -1
  24. package/dist/commands/pkg/plugin-inspect.js +1 -1
  25. package/dist/commands/profile/list.js +1 -1
  26. package/dist/commands/profile/project.js +1 -1
  27. package/dist/commands/profile/show.js +1 -1
  28. package/dist/commands/sys/panels/profiles-panel.js +1 -1
  29. package/dist/commands/sys/repo-docs.d.ts +1 -0
  30. package/dist/commands/sys/repo-docs.js +2 -0
  31. package/dist/commands/sys/sync-project-guidance.js +5 -5
  32. package/dist/commands/sys.js +1 -1
  33. package/dist/core/broker-client/transport-relay.d.ts +3 -0
  34. package/dist/core/broker-client/transport-relay.js +1 -1
  35. package/dist/core/canvas/db.js +4 -4
  36. package/dist/core/canvas/export-sqlite.js +1 -1
  37. package/dist/core/canvas/schema-pg/021-repo-docs.sql +38 -0
  38. package/dist/core/canvas/schema-version.d.ts +1 -1
  39. package/dist/core/canvas/schema-version.js +1 -1
  40. package/dist/core/checkout-identities.d.ts +15 -0
  41. package/dist/core/checkout-identities.js +3 -0
  42. package/dist/core/graph/bodies-boot-copy.d.ts +1 -1
  43. package/dist/core/graph/bodies-boot-copy.js +1 -1
  44. package/dist/core/graph/custom.js +9 -9
  45. package/dist/core/graph/documents.d.ts +1 -1
  46. package/dist/core/graph/documents.js +11 -11
  47. package/dist/core/graph/events.js +1 -1
  48. package/dist/core/graph/group-invites.d.ts +10 -0
  49. package/dist/core/graph/group-invites.js +1 -0
  50. package/dist/core/graph/groups.d.ts +27 -0
  51. package/dist/core/graph/groups.js +3 -0
  52. package/dist/core/graph/kinds/owner.js +2 -2
  53. package/dist/core/graph/names.d.ts +2 -2
  54. package/dist/core/graph/names.js +10 -10
  55. package/dist/core/graph/objects.d.ts +4 -1
  56. package/dist/core/graph/objects.js +10 -10
  57. package/dist/core/graph/package-publish.js +3 -3
  58. package/dist/core/graph/package-reconcile.js +2 -2
  59. package/dist/core/graph/reader.d.ts +19 -8
  60. package/dist/core/graph/reader.js +3 -3
  61. package/dist/core/graph/repo-sync/exchange.d.ts +0 -11
  62. package/dist/core/graph/repo-sync/exchange.js +1 -2
  63. package/dist/core/graph/repo-sync/identity.d.ts +4 -0
  64. package/dist/core/graph/repo-sync/ref-format.d.ts +0 -29
  65. package/dist/core/graph/repo-sync/ref-format.js +1 -2
  66. package/dist/core/graph/repo-sync/repos.d.ts +12 -2
  67. package/dist/core/graph/repo-sync/repos.js +4 -3
  68. package/dist/core/graph/types.d.ts +2 -2
  69. package/dist/core/human/page-schema.d.ts +1 -1
  70. package/dist/core/import/export/stores.js +4 -1
  71. package/dist/core/import/load/stores.js +2 -2
  72. package/dist/core/peer/stubs.d.ts +1 -1
  73. package/dist/core/peer/stubs.js +1 -1
  74. package/dist/core/permissions/builtin.d.ts +1 -1
  75. package/dist/core/permissions/builtin.js +4 -2
  76. package/dist/core/permissions/ceiling.js +9 -9
  77. package/dist/core/profiles/manifest.d.ts +7 -2
  78. package/dist/core/profiles/manifest.js +1 -1
  79. package/dist/core/profiles/select.js +21 -21
  80. package/dist/core/runtime/bearings-render.js +8 -8
  81. package/dist/core/runtime/deliver-live.js +1 -1
  82. package/dist/core/runtime/resume-root.d.ts +1 -0
  83. package/dist/core/runtime/resume-root.js +7 -7
  84. package/dist/core/runtime/runner/machine/call.js +2 -2
  85. package/dist/core/runtime/runner/machine/executor.d.ts +1 -1
  86. package/dist/core/runtime/runner/machine/ops.d.ts +11 -1
  87. package/dist/core/runtime/runner/machine/ops.js +1 -1
  88. package/dist/core/scope.js +1 -1
  89. package/dist/core/scoped-state/db.js +2 -2
  90. package/dist/core/scoped-state/legacy-profiles.js +2 -1
  91. package/dist/core/scoped-state/person-rows.js +6 -3
  92. package/dist/core/scoped-state/schema.d.ts +4 -0
  93. package/dist/core/scoped-state/schema.js +5 -4
  94. package/dist/core/substrate/delivery/deliver.js +2 -2
  95. package/dist/core/substrate/delivery/plan.js +2 -3
  96. package/dist/core/substrate/subject.js +1 -1
  97. package/dist/daemon/api/canvas-host.d.ts +1 -0
  98. package/dist/daemon/api/canvas-host.js +1 -1
  99. package/dist/daemon/api/document-page.js +5 -5
  100. package/dist/daemon/api/handlers/broker-ops.js +1 -1
  101. package/dist/daemon/api/handlers/delivery.js +1 -1
  102. package/dist/daemon/api/handlers/docs.d.ts +1 -12
  103. package/dist/daemon/api/handlers/docs.js +2 -2
  104. package/dist/daemon/api/handlers/memory.js +1 -1
  105. package/dist/daemon/api/handlers/objects.js +1 -1
  106. package/dist/daemon/api/handlers/profiles.d.ts +1 -1
  107. package/dist/daemon/api/handlers/profiles.js +1 -1
  108. package/dist/daemon/api/handlers/repo-import.d.ts +2 -0
  109. package/dist/daemon/api/handlers/repo-import.js +2 -0
  110. package/dist/daemon/api/handlers/reviews.js +1 -1
  111. package/dist/daemon/api/handlers/shares.js +1 -1
  112. package/dist/daemon/api/operations.js +1 -1
  113. package/dist/daemon/api/reader.js +1 -1
  114. package/dist/daemon/api/repo-plugin.d.ts +12 -0
  115. package/dist/daemon/api/repo-plugin.js +1 -0
  116. package/dist/daemon/api/server.js +1 -1
  117. package/dist/daemon/boot-migrations.js +1 -1
  118. package/dist/daemon/crtrd.js +13 -13
  119. package/dist/daemon/due-sources.d.ts +1 -1
  120. package/dist/daemon/due-sources.js +1 -1
  121. package/dist/daemon/due.js +7 -7
  122. package/dist/daemon/machine-daemon.js +1 -1
  123. package/dist/daemon/reconcilers/group-invite-expiry.d.ts +9 -0
  124. package/dist/daemon/reconcilers/group-invite-expiry.js +1 -0
  125. package/dist/daemon/review/finish.js +1 -1
  126. package/dist/migrations/004-canvas-documents/index.js +2 -2
  127. package/dist/pi-extensions/canvas-structured-output.js +6 -6
  128. package/docs/concepts/documents.md +1 -1
  129. package/package.json +10 -2
  130. package/packages/crouter-api/dist/api/client.js +1585 -0
  131. package/packages/crouter-api/dist/api/command-manifest/index.js +4 -0
  132. package/packages/crouter-api/dist/api/command-manifest/manifest.js +332 -0
  133. package/packages/crouter-api/dist/api/command-manifest/object-kinds.js +100 -0
  134. package/packages/crouter-api/dist/api/command-manifest/result.js +166 -0
  135. package/packages/crouter-api/dist/api/command-manifest/schema.js +934 -0
  136. package/packages/crouter-api/dist/api/contract.js +57 -0
  137. package/packages/crouter-api/dist/api/dto/analytics.js +3 -0
  138. package/packages/crouter-api/dist/api/dto/attach.js +13 -0
  139. package/packages/crouter-api/dist/api/dto/bash-jobs.js +11 -0
  140. package/packages/crouter-api/dist/api/dto/bash.js +1 -0
  141. package/packages/crouter-api/dist/api/dto/broker-ops.js +6 -0
  142. package/packages/crouter-api/dist/api/dto/broker-signals.js +1 -0
  143. package/packages/crouter-api/dist/api/dto/broker.js +20 -0
  144. package/packages/crouter-api/dist/api/dto/canvas.js +2 -0
  145. package/packages/crouter-api/dist/api/dto/charges.js +4 -0
  146. package/packages/crouter-api/dist/api/dto/chat-inventory.js +11 -0
  147. package/packages/crouter-api/dist/api/dto/common.js +15 -0
  148. package/packages/crouter-api/dist/api/dto/config.js +3 -0
  149. package/packages/crouter-api/dist/api/dto/crons.js +10 -0
  150. package/packages/crouter-api/dist/api/dto/custom-objects.js +1 -0
  151. package/packages/crouter-api/dist/api/dto/delivery.js +7 -0
  152. package/packages/crouter-api/dist/api/dto/docs.js +8 -0
  153. package/packages/crouter-api/dist/api/dto/environments.js +2 -0
  154. package/packages/crouter-api/dist/api/dto/exec.js +1 -0
  155. package/packages/crouter-api/dist/api/dto/execution-start.js +2 -0
  156. package/packages/crouter-api/dist/api/dto/files.js +1 -0
  157. package/packages/crouter-api/dist/api/dto/focus.js +10 -0
  158. package/packages/crouter-api/dist/api/dto/grants.js +1 -0
  159. package/packages/crouter-api/dist/api/dto/health.js +2 -0
  160. package/packages/crouter-api/dist/api/dto/human-requests.js +4 -0
  161. package/packages/crouter-api/dist/api/dto/human.js +4 -0
  162. package/packages/crouter-api/dist/api/dto/imports.js +2 -0
  163. package/packages/crouter-api/dist/api/dto/inbox.js +4 -0
  164. package/packages/crouter-api/dist/api/dto/lifecycle.js +3 -0
  165. package/packages/crouter-api/dist/api/dto/limits.js +2 -0
  166. package/packages/crouter-api/dist/api/dto/mail.js +1 -0
  167. package/packages/crouter-api/dist/api/dto/messages.js +2 -0
  168. package/packages/crouter-api/dist/api/dto/model-config.js +1 -0
  169. package/packages/crouter-api/dist/api/dto/modelauth.js +4 -0
  170. package/packages/crouter-api/dist/api/dto/node-events.js +4 -0
  171. package/packages/crouter-api/dist/api/dto/node-outcomes.js +2 -0
  172. package/packages/crouter-api/dist/api/dto/node-records.js +5 -0
  173. package/packages/crouter-api/dist/api/dto/nodes.js +3 -0
  174. package/packages/crouter-api/dist/api/dto/objects.js +5 -0
  175. package/packages/crouter-api/dist/api/dto/permissions.js +5 -0
  176. package/packages/crouter-api/dist/api/dto/plugins.js +5 -0
  177. package/packages/crouter-api/dist/api/dto/profiles.js +8 -0
  178. package/packages/crouter-api/dist/api/dto/recovery.js +1 -0
  179. package/packages/crouter-api/dist/api/dto/repo-import.js +5 -0
  180. package/packages/crouter-api/dist/api/dto/reports.js +2 -0
  181. package/packages/crouter-api/dist/api/dto/review-comments.js +5 -0
  182. package/packages/crouter-api/dist/api/dto/reviews.js +5 -0
  183. package/packages/crouter-api/dist/api/dto/run-events.js +6 -0
  184. package/packages/crouter-api/dist/api/dto/settings.js +4 -0
  185. package/packages/crouter-api/dist/api/dto/structured-requests.js +5 -0
  186. package/packages/crouter-api/dist/api/dto/subscriptions.js +2 -0
  187. package/packages/crouter-api/dist/api/dto/usage.js +1 -0
  188. package/packages/crouter-api/dist/api/dto/worktree.js +6 -0
  189. package/packages/crouter-api/dist/api/error-codes.js +86 -0
  190. package/packages/crouter-api/dist/api/errors.js +72 -0
  191. package/packages/crouter-api/dist/api/index.js +55 -0
  192. package/packages/crouter-api/dist/api/long-poll.js +67 -0
  193. package/packages/crouter-api/dist/api/node-transport.js +105 -0
  194. package/packages/crouter-api/dist/api/plugin-manifest-schema.js +23 -0
  195. package/packages/crouter-api/dist/api/routes.js +233 -0
  196. package/packages/crouter-api/dist/api/runtime-version.js +50 -0
  197. package/packages/crouter-api/dist/build-root.js +411 -0
  198. package/packages/crouter-api/dist/clients/attach/ansi-cells.js +137 -0
  199. package/packages/crouter-api/dist/clients/attach/chrome/bash-jobs.js +34 -0
  200. package/packages/crouter-api/dist/clients/attach/chrome/canvas-panels.js +267 -0
  201. package/packages/crouter-api/dist/clients/attach/chrome/completion-bell.js +89 -0
  202. package/packages/crouter-api/dist/clients/attach/chrome/cron-wait.js +34 -0
  203. package/packages/crouter-api/dist/clients/attach/chrome/git-info.js +44 -0
  204. package/packages/crouter-api/dist/clients/attach/chrome/header.js +30 -0
  205. package/packages/crouter-api/dist/clients/attach/chrome/inbox-strip.js +219 -0
  206. package/packages/crouter-api/dist/clients/attach/chrome/key-hint.js +16 -0
  207. package/packages/crouter-api/dist/clients/attach/chrome/object-wait.js +24 -0
  208. package/packages/crouter-api/dist/clients/attach/chrome/recap.js +19 -0
  209. package/packages/crouter-api/dist/clients/attach/chrome/review-wait.js +22 -0
  210. package/packages/crouter-api/dist/clients/attach/chrome/roster.js +293 -0
  211. package/packages/crouter-api/dist/clients/attach/chrome/status-line.js +127 -0
  212. package/packages/crouter-api/dist/clients/attach/chrome/ticket-panel.js +261 -0
  213. package/packages/crouter-api/dist/clients/attach/chrome/widgets.js +51 -0
  214. package/packages/crouter-api/dist/clients/attach/command.js +107 -0
  215. package/packages/crouter-api/dist/clients/attach/config.js +275 -0
  216. package/packages/crouter-api/dist/clients/attach/input/capabilities.js +112 -0
  217. package/packages/crouter-api/dist/clients/attach/input/clipboard-image.js +237 -0
  218. package/packages/crouter-api/dist/clients/attach/input/completion-frecency.js +141 -0
  219. package/packages/crouter-api/dist/clients/attach/input/controller.js +383 -0
  220. package/packages/crouter-api/dist/clients/attach/input/overlay-owner.js +199 -0
  221. package/packages/crouter-api/dist/clients/attach/input/ref-autocomplete.js +176 -0
  222. package/packages/crouter-api/dist/clients/attach/input/titled-editor.js +859 -0
  223. package/packages/crouter-api/dist/clients/attach/overlays/auth.js +247 -0
  224. package/packages/crouter-api/dist/clients/attach/overlays/dialogs.js +102 -0
  225. package/packages/crouter-api/dist/clients/attach/overlays/file-review.js +146 -0
  226. package/packages/crouter-api/dist/clients/attach/overlays/graph.js +725 -0
  227. package/packages/crouter-api/dist/clients/attach/overlays/help.js +214 -0
  228. package/packages/crouter-api/dist/clients/attach/overlays/mcp.js +302 -0
  229. package/packages/crouter-api/dist/clients/attach/overlays/pickers.js +163 -0
  230. package/packages/crouter-api/dist/clients/attach/render/activity-slot.js +13 -0
  231. package/packages/crouter-api/dist/clients/attach/render/assistant-message.js +56 -0
  232. package/packages/crouter-api/dist/clients/attach/render/card-presentation.js +232 -0
  233. package/packages/crouter-api/dist/clients/attach/render/chat-view.js +2091 -0
  234. package/packages/crouter-api/dist/clients/attach/render/condensed-history.js +60 -0
  235. package/packages/crouter-api/dist/clients/attach/render/context-message.js +63 -0
  236. package/packages/crouter-api/dist/clients/attach/render/crtr-output.js +721 -0
  237. package/packages/crouter-api/dist/clients/attach/render/diagram.js +111 -0
  238. package/packages/crouter-api/dist/clients/attach/render/doc-links.js +78 -0
  239. package/packages/crouter-api/dist/clients/attach/render/edit-diff.js +304 -0
  240. package/packages/crouter-api/dist/clients/attach/render/glyph-codepoints.js +42 -0
  241. package/packages/crouter-api/dist/clients/attach/render/group-activity.js +276 -0
  242. package/packages/crouter-api/dist/clients/attach/render/group-recap.js +146 -0
  243. package/packages/crouter-api/dist/clients/attach/render/markdown-source.js +279 -0
  244. package/packages/crouter-api/dist/clients/attach/render/measured-container.js +322 -0
  245. package/packages/crouter-api/dist/clients/attach/render/page-block.js +187 -0
  246. package/packages/crouter-api/dist/clients/attach/render/scroll-animation.js +80 -0
  247. package/packages/crouter-api/dist/clients/attach/render/tool-calls.js +350 -0
  248. package/packages/crouter-api/dist/clients/attach/render/transcript-copy.js +81 -0
  249. package/packages/crouter-api/dist/clients/attach/render/transcript-search.js +152 -0
  250. package/packages/crouter-api/dist/clients/attach/render/viewport.js +184 -0
  251. package/packages/crouter-api/dist/clients/attach/session/banner.js +33 -0
  252. package/packages/crouter-api/dist/clients/attach/session/bindings.js +72 -0
  253. package/packages/crouter-api/dist/clients/attach/session/chrome-refresh.js +154 -0
  254. package/packages/crouter-api/dist/clients/attach/session/connection.js +204 -0
  255. package/packages/crouter-api/dist/clients/attach/session/context.js +16 -0
  256. package/packages/crouter-api/dist/clients/attach/session/document-links.js +48 -0
  257. package/packages/crouter-api/dist/clients/attach/session/editor-frame.js +142 -0
  258. package/packages/crouter-api/dist/clients/attach/session/editor-inventory.js +156 -0
  259. package/packages/crouter-api/dist/clients/attach/session/file-links.js +73 -0
  260. package/packages/crouter-api/dist/clients/attach/session/focus-events.js +12 -0
  261. package/packages/crouter-api/dist/clients/attach/session/frame.js +214 -0
  262. package/packages/crouter-api/dist/clients/attach/session/frames.js +203 -0
  263. package/packages/crouter-api/dist/clients/attach/session/identity.js +26 -0
  264. package/packages/crouter-api/dist/clients/attach/session/input-wiring.js +150 -0
  265. package/packages/crouter-api/dist/clients/attach/session/invariant.js +15 -0
  266. package/packages/crouter-api/dist/clients/attach/session/keys.js +77 -0
  267. package/packages/crouter-api/dist/clients/attach/session/layout.js +59 -0
  268. package/packages/crouter-api/dist/clients/attach/session/mouse.js +78 -0
  269. package/packages/crouter-api/dist/clients/attach/session/pane-focus.js +42 -0
  270. package/packages/crouter-api/dist/clients/attach/session/pane-tag.js +112 -0
  271. package/packages/crouter-api/dist/clients/attach/session/pi-assets.js +24 -0
  272. package/packages/crouter-api/dist/clients/attach/session/pi-oauth-flows.js +21 -0
  273. package/packages/crouter-api/dist/clients/attach/session/profile-files.js +208 -0
  274. package/packages/crouter-api/dist/clients/attach/session/readonly-popup.js +25 -0
  275. package/packages/crouter-api/dist/clients/attach/session/reconnect.js +195 -0
  276. package/packages/crouter-api/dist/clients/attach/session/selection.js +108 -0
  277. package/packages/crouter-api/dist/clients/attach/session/state-sync.js +67 -0
  278. package/packages/crouter-api/dist/clients/attach/session/surface-frame.js +73 -0
  279. package/packages/crouter-api/dist/clients/attach/session/surface-host.js +256 -0
  280. package/packages/crouter-api/dist/clients/attach/session/teardown.js +94 -0
  281. package/packages/crouter-api/dist/clients/attach/session/transcript-search.js +151 -0
  282. package/packages/crouter-api/dist/clients/attach/session/whip-achievements.js +145 -0
  283. package/packages/crouter-api/dist/clients/attach/session/whip.js +362 -0
  284. package/packages/crouter-api/dist/clients/attach/slash/dispatch.js +747 -0
  285. package/packages/crouter-api/dist/clients/attach/slash/prompt-preview.js +121 -0
  286. package/packages/crouter-api/dist/clients/attach/viewer.js +881 -0
  287. package/packages/crouter-api/dist/clients/conversation/projection.js +324 -0
  288. package/packages/crouter-api/dist/clients/conversation/submit.js +51 -0
  289. package/packages/crouter-api/dist/clients/dashboard/app.js +439 -0
  290. package/packages/crouter-api/dist/clients/dashboard/model.js +77 -0
  291. package/packages/crouter-api/dist/clients/dashboard/render.js +148 -0
  292. package/packages/crouter-api/dist/clients/inbox/controller.js +791 -0
  293. package/packages/crouter-api/dist/clients/inbox/dto-adapt.js +93 -0
  294. package/packages/crouter-api/dist/clients/inbox/layout.js +9 -0
  295. package/packages/crouter-api/dist/clients/inbox/page-adapter.js +56 -0
  296. package/packages/crouter-api/dist/clients/inbox/resolve.js +35 -0
  297. package/packages/crouter-api/dist/clients/inbox/review/anchors.js +89 -0
  298. package/packages/crouter-api/dist/clients/inbox/review/comments-client.js +103 -0
  299. package/packages/crouter-api/dist/clients/inbox/review/companion-pane.js +109 -0
  300. package/packages/crouter-api/dist/clients/inbox/review/document-surface.js +1268 -0
  301. package/packages/crouter-api/dist/clients/inbox/review/frame.js +309 -0
  302. package/packages/crouter-api/dist/clients/inbox/review/keys.js +133 -0
  303. package/packages/crouter-api/dist/clients/inbox/review/launch.js +170 -0
  304. package/packages/crouter-api/dist/clients/inbox/review/live-source.js +160 -0
  305. package/packages/crouter-api/dist/clients/inbox/review/nvim.js +43 -0
  306. package/packages/crouter-api/dist/clients/inbox/review/remap.js +157 -0
  307. package/packages/crouter-api/dist/clients/inbox/review/review-client.js +123 -0
  308. package/packages/crouter-api/dist/clients/inbox/review/roundtrip.js +41 -0
  309. package/packages/crouter-api/dist/clients/inbox/review/state.js +315 -0
  310. package/packages/crouter-api/dist/clients/inbox/review-adapter.js +43 -0
  311. package/packages/crouter-api/dist/clients/inbox/surface.js +190 -0
  312. package/packages/crouter-api/dist/clients/inbox/tui/ansi.js +321 -0
  313. package/packages/crouter-api/dist/clients/inbox/tui/input.js +392 -0
  314. package/packages/crouter-api/dist/clients/inbox/tui/keys.js +104 -0
  315. package/packages/crouter-api/dist/clients/inbox/tui/page-body.js +69 -0
  316. package/packages/crouter-api/dist/clients/inbox/tui/panel.js +92 -0
  317. package/packages/crouter-api/dist/clients/inbox/tui/render.js +389 -0
  318. package/packages/crouter-api/dist/clients/inbox/tui/slots.js +134 -0
  319. package/packages/crouter-api/dist/clients/inbox/tui/types.js +1 -0
  320. package/packages/crouter-api/dist/clients/inbox/tui.js +91 -0
  321. package/packages/crouter-api/dist/clients/surfaces/host.js +1 -0
  322. package/packages/crouter-api/dist/commands/api-client.js +438 -0
  323. package/packages/crouter-api/dist/commands/attention.js +215 -0
  324. package/packages/crouter-api/dist/commands/canvas/edges.js +41 -0
  325. package/packages/crouter-api/dist/commands/canvas/list.js +79 -0
  326. package/packages/crouter-api/dist/commands/canvas/read.js +95 -0
  327. package/packages/crouter-api/dist/commands/canvas/search.js +49 -0
  328. package/packages/crouter-api/dist/commands/canvas/share.js +80 -0
  329. package/packages/crouter-api/dist/commands/canvas/unwatch.js +42 -0
  330. package/packages/crouter-api/dist/commands/canvas/watch.js +63 -0
  331. package/packages/crouter-api/dist/commands/canvas-analytics/chart.js +124 -0
  332. package/packages/crouter-api/dist/commands/canvas-analytics/drilldown.js +96 -0
  333. package/packages/crouter-api/dist/commands/canvas-analytics/format.js +106 -0
  334. package/packages/crouter-api/dist/commands/canvas-analytics/graph-detail.js +307 -0
  335. package/packages/crouter-api/dist/commands/canvas-analytics/graphs.js +365 -0
  336. package/packages/crouter-api/dist/commands/canvas-analytics/memory.js +211 -0
  337. package/packages/crouter-api/dist/commands/canvas-analytics/overview.js +189 -0
  338. package/packages/crouter-api/dist/commands/canvas-analytics/shell.js +416 -0
  339. package/packages/crouter-api/dist/commands/canvas-analytics/time.js +228 -0
  340. package/packages/crouter-api/dist/commands/canvas-analytics/usage.js +305 -0
  341. package/packages/crouter-api/dist/commands/canvas-analytics/view.js +102 -0
  342. package/packages/crouter-api/dist/commands/canvas-analytics.js +28 -0
  343. package/packages/crouter-api/dist/commands/canvas-browse.js +71 -0
  344. package/packages/crouter-api/dist/commands/canvas-config.js +192 -0
  345. package/packages/crouter-api/dist/commands/canvas-history/grep.js +85 -0
  346. package/packages/crouter-api/dist/commands/canvas-history/read.js +48 -0
  347. package/packages/crouter-api/dist/commands/canvas-history/search.js +99 -0
  348. package/packages/crouter-api/dist/commands/canvas-history/shared.js +135 -0
  349. package/packages/crouter-api/dist/commands/canvas-history/stats.js +68 -0
  350. package/packages/crouter-api/dist/commands/canvas-history.js +29 -0
  351. package/packages/crouter-api/dist/commands/canvas-issue.js +148 -0
  352. package/packages/crouter-api/dist/commands/canvas-prune.js +111 -0
  353. package/packages/crouter-api/dist/commands/canvas-roster.js +69 -0
  354. package/packages/crouter-api/dist/commands/canvas-snapshot.js +34 -0
  355. package/packages/crouter-api/dist/commands/canvas-use.js +61 -0
  356. package/packages/crouter-api/dist/commands/canvas.js +57 -0
  357. package/packages/crouter-api/dist/commands/chord.js +242 -0
  358. package/packages/crouter-api/dist/commands/cron.js +541 -0
  359. package/packages/crouter-api/dist/commands/custom-object/ack.js +30 -0
  360. package/packages/crouter-api/dist/commands/custom-object/publish.js +39 -0
  361. package/packages/crouter-api/dist/commands/custom-object/receive.js +69 -0
  362. package/packages/crouter-api/dist/commands/custom-object/register.js +69 -0
  363. package/packages/crouter-api/dist/commands/custom-object/shared.js +14 -0
  364. package/packages/crouter-api/dist/commands/custom-object/unregister.js +26 -0
  365. package/packages/crouter-api/dist/commands/custom-object.js +21 -0
  366. package/packages/crouter-api/dist/commands/dashboard.js +86 -0
  367. package/packages/crouter-api/dist/commands/doc/delete.js +30 -0
  368. package/packages/crouter-api/dist/commands/doc/edit.js +83 -0
  369. package/packages/crouter-api/dist/commands/doc/history.js +38 -0
  370. package/packages/crouter-api/dist/commands/doc/lint.js +36 -0
  371. package/packages/crouter-api/dist/commands/doc/list.js +19 -0
  372. package/packages/crouter-api/dist/commands/doc/move.js +37 -0
  373. package/packages/crouter-api/dist/commands/doc/read.js +19 -0
  374. package/packages/crouter-api/dist/commands/doc/replace-blocks.js +40 -0
  375. package/packages/crouter-api/dist/commands/doc/shared.js +156 -0
  376. package/packages/crouter-api/dist/commands/doc/write.js +53 -0
  377. package/packages/crouter-api/dist/commands/doc.js +27 -0
  378. package/packages/crouter-api/dist/commands/human/components.js +78 -0
  379. package/packages/crouter-api/dist/commands/human/feedback.js +112 -0
  380. package/packages/crouter-api/dist/commands/human/prompts.js +326 -0
  381. package/packages/crouter-api/dist/commands/human/queue.js +191 -0
  382. package/packages/crouter-api/dist/commands/human/request.js +266 -0
  383. package/packages/crouter-api/dist/commands/human/review.js +288 -0
  384. package/packages/crouter-api/dist/commands/human/shared.js +67 -0
  385. package/packages/crouter-api/dist/commands/human.js +63 -0
  386. package/packages/crouter-api/dist/commands/node/bash.js +395 -0
  387. package/packages/crouter-api/dist/commands/node/create.js +363 -0
  388. package/packages/crouter-api/dist/commands/node/inspect.js +288 -0
  389. package/packages/crouter-api/dist/commands/node/lifecycle.js +577 -0
  390. package/packages/crouter-api/dist/commands/node/message.js +170 -0
  391. package/packages/crouter-api/dist/commands/node/outcome.js +133 -0
  392. package/packages/crouter-api/dist/commands/node/pyramid.js +79 -0
  393. package/packages/crouter-api/dist/commands/node/subscription.js +78 -0
  394. package/packages/crouter-api/dist/commands/node/wait.js +165 -0
  395. package/packages/crouter-api/dist/commands/node-context.js +145 -0
  396. package/packages/crouter-api/dist/commands/node-lifecycle-revive.js +224 -0
  397. package/packages/crouter-api/dist/commands/node-snapshot.js +37 -0
  398. package/packages/crouter-api/dist/commands/node-transcript.js +59 -0
  399. package/packages/crouter-api/dist/commands/node-worktree.js +138 -0
  400. package/packages/crouter-api/dist/commands/node.js +29 -0
  401. package/packages/crouter-api/dist/commands/person-settings.js +23 -0
  402. package/packages/crouter-api/dist/commands/pkg/app-installs.js +125 -0
  403. package/packages/crouter-api/dist/commands/pkg/browse/actions.js +198 -0
  404. package/packages/crouter-api/dist/commands/pkg/browse/catalog.js +461 -0
  405. package/packages/crouter-api/dist/commands/pkg/browse/command-view.js +217 -0
  406. package/packages/crouter-api/dist/commands/pkg/browse/detail-panel.js +402 -0
  407. package/packages/crouter-api/dist/commands/pkg/browse/doc-view.js +84 -0
  408. package/packages/crouter-api/dist/commands/pkg/browse/list-panel.js +168 -0
  409. package/packages/crouter-api/dist/commands/pkg/browse/model.js +36 -0
  410. package/packages/crouter-api/dist/commands/pkg/browse/shell.js +640 -0
  411. package/packages/crouter-api/dist/commands/pkg/browse.js +27 -0
  412. package/packages/crouter-api/dist/commands/pkg/market-inspect.js +145 -0
  413. package/packages/crouter-api/dist/commands/pkg/market-manage.js +340 -0
  414. package/packages/crouter-api/dist/commands/pkg/market.js +14 -0
  415. package/packages/crouter-api/dist/commands/pkg/plugin-env.js +65 -0
  416. package/packages/crouter-api/dist/commands/pkg/plugin-inspect.js +178 -0
  417. package/packages/crouter-api/dist/commands/pkg/plugin-manage.js +1039 -0
  418. package/packages/crouter-api/dist/commands/pkg/plugin.js +14 -0
  419. package/packages/crouter-api/dist/commands/pkg/shared.js +62 -0
  420. package/packages/crouter-api/dist/commands/pkg.js +21 -0
  421. package/packages/crouter-api/dist/commands/profile/daemon-profiles.js +38 -0
  422. package/packages/crouter-api/dist/commands/profile/default.js +183 -0
  423. package/packages/crouter-api/dist/commands/profile/delete.js +66 -0
  424. package/packages/crouter-api/dist/commands/profile/env.js +188 -0
  425. package/packages/crouter-api/dist/commands/profile/environment.js +88 -0
  426. package/packages/crouter-api/dist/commands/profile/kind.js +27 -0
  427. package/packages/crouter-api/dist/commands/profile/list.js +45 -0
  428. package/packages/crouter-api/dist/commands/profile/meta.js +65 -0
  429. package/packages/crouter-api/dist/commands/profile/new.js +107 -0
  430. package/packages/crouter-api/dist/commands/profile/pause.js +59 -0
  431. package/packages/crouter-api/dist/commands/profile/project.js +146 -0
  432. package/packages/crouter-api/dist/commands/profile/rename.js +41 -0
  433. package/packages/crouter-api/dist/commands/profile/show.js +55 -0
  434. package/packages/crouter-api/dist/commands/profile.js +36 -0
  435. package/packages/crouter-api/dist/commands/push.js +357 -0
  436. package/packages/crouter-api/dist/commands/revive.js +183 -0
  437. package/packages/crouter-api/dist/commands/surface/node/cycle.js +83 -0
  438. package/packages/crouter-api/dist/commands/surface/node/focus.js +60 -0
  439. package/packages/crouter-api/dist/commands/surface/node/id.js +38 -0
  440. package/packages/crouter-api/dist/commands/surface/node/pin.js +42 -0
  441. package/packages/crouter-api/dist/commands/surface/node/placement.js +49 -0
  442. package/packages/crouter-api/dist/commands/surface-dashboard.js +138 -0
  443. package/packages/crouter-api/dist/commands/surface-edit.js +157 -0
  444. package/packages/crouter-api/dist/commands/surface-inbox.js +98 -0
  445. package/packages/crouter-api/dist/commands/surface-inspect.js +41 -0
  446. package/packages/crouter-api/dist/commands/surface-node.js +19 -0
  447. package/packages/crouter-api/dist/commands/surface-reload.js +129 -0
  448. package/packages/crouter-api/dist/commands/surface-tmux-spread.js +214 -0
  449. package/packages/crouter-api/dist/commands/surface.js +29 -0
  450. package/packages/crouter-api/dist/commands/sys/branch.js +19 -0
  451. package/packages/crouter-api/dist/commands/sys/config.js +353 -0
  452. package/packages/crouter-api/dist/commands/sys/connect.js +185 -0
  453. package/packages/crouter-api/dist/commands/sys/context/admin/actions.js +89 -0
  454. package/packages/crouter-api/dist/commands/sys/context/admin/detail-panel.js +233 -0
  455. package/packages/crouter-api/dist/commands/sys/context/admin/docs-panel.js +185 -0
  456. package/packages/crouter-api/dist/commands/sys/context/admin/list-view.js +170 -0
  457. package/packages/crouter-api/dist/commands/sys/context/admin/model.js +179 -0
  458. package/packages/crouter-api/dist/commands/sys/context/admin/rail-panel.js +229 -0
  459. package/packages/crouter-api/dist/commands/sys/context/admin/read-view.js +172 -0
  460. package/packages/crouter-api/dist/commands/sys/context/admin/shell.js +870 -0
  461. package/packages/crouter-api/dist/commands/sys/context/admin.js +148 -0
  462. package/packages/crouter-api/dist/commands/sys/context/doc.js +126 -0
  463. package/packages/crouter-api/dist/commands/sys/context/expose.js +66 -0
  464. package/packages/crouter-api/dist/commands/sys/context/prompt-review.js +244 -0
  465. package/packages/crouter-api/dist/commands/sys/context/resolve.js +326 -0
  466. package/packages/crouter-api/dist/commands/sys/context/sysprompt.js +95 -0
  467. package/packages/crouter-api/dist/commands/sys/context.js +21 -0
  468. package/packages/crouter-api/dist/commands/sys/daemon.js +351 -0
  469. package/packages/crouter-api/dist/commands/sys/db.js +69 -0
  470. package/packages/crouter-api/dist/commands/sys/desktop.js +201 -0
  471. package/packages/crouter-api/dist/commands/sys/doctor.js +633 -0
  472. package/packages/crouter-api/dist/commands/sys/env.js +39 -0
  473. package/packages/crouter-api/dist/commands/sys/feedback.js +228 -0
  474. package/packages/crouter-api/dist/commands/sys/import/move.js +393 -0
  475. package/packages/crouter-api/dist/commands/sys/import/resume.js +23 -0
  476. package/packages/crouter-api/dist/commands/sys/import/start.js +92 -0
  477. package/packages/crouter-api/dist/commands/sys/join.js +85 -0
  478. package/packages/crouter-api/dist/commands/sys/limits.js +133 -0
  479. package/packages/crouter-api/dist/commands/sys/logs.js +129 -0
  480. package/packages/crouter-api/dist/commands/sys/machine/rotate.js +49 -0
  481. package/packages/crouter-api/dist/commands/sys/migrate.js +79 -0
  482. package/packages/crouter-api/dist/commands/sys/panels/broker-limits-panel.js +110 -0
  483. package/packages/crouter-api/dist/commands/sys/panels/dependencies-panel.js +80 -0
  484. package/packages/crouter-api/dist/commands/sys/panels/keybindings-panel.js +703 -0
  485. package/packages/crouter-api/dist/commands/sys/panels/models-panel.js +1160 -0
  486. package/packages/crouter-api/dist/commands/sys/panels/plugin-env-panel.js +70 -0
  487. package/packages/crouter-api/dist/commands/sys/panels/plugins-panel.js +87 -0
  488. package/packages/crouter-api/dist/commands/sys/panels/prefs-panel.js +97 -0
  489. package/packages/crouter-api/dist/commands/sys/panels/profiles-panel.js +656 -0
  490. package/packages/crouter-api/dist/commands/sys/panels/provider-panel.js +534 -0
  491. package/packages/crouter-api/dist/commands/sys/panels/terminal-panel.js +67 -0
  492. package/packages/crouter-api/dist/commands/sys/provider-login.js +99 -0
  493. package/packages/crouter-api/dist/commands/sys/repo-docs.js +96 -0
  494. package/packages/crouter-api/dist/commands/sys/retry-delivery.js +33 -0
  495. package/packages/crouter-api/dist/commands/sys/settings-shell.js +400 -0
  496. package/packages/crouter-api/dist/commands/sys/settings.js +46 -0
  497. package/packages/crouter-api/dist/commands/sys/setup-core.js +890 -0
  498. package/packages/crouter-api/dist/commands/sys/setup-settings-runner.js +15 -0
  499. package/packages/crouter-api/dist/commands/sys/setup-wizard.js +351 -0
  500. package/packages/crouter-api/dist/commands/sys/setup.js +41 -0
  501. package/packages/crouter-api/dist/commands/sys/shared.js +81 -0
  502. package/packages/crouter-api/dist/commands/sys/signin.js +149 -0
  503. package/packages/crouter-api/dist/commands/sys/spaces.js +22 -0
  504. package/packages/crouter-api/dist/commands/sys/spend.js +144 -0
  505. package/packages/crouter-api/dist/commands/sys/support/prepare.js +239 -0
  506. package/packages/crouter-api/dist/commands/sys/support/submit.js +524 -0
  507. package/packages/crouter-api/dist/commands/sys/support.js +18 -0
  508. package/packages/crouter-api/dist/commands/sys/sync-deps.js +445 -0
  509. package/packages/crouter-api/dist/commands/sys/sync-project-guidance.js +320 -0
  510. package/packages/crouter-api/dist/commands/sys/sync-shared.js +139 -0
  511. package/packages/crouter-api/dist/commands/sys/sync-skills.js +297 -0
  512. package/packages/crouter-api/dist/commands/sys/sync.js +17 -0
  513. package/packages/crouter-api/dist/commands/sys/terminal-option.js +542 -0
  514. package/packages/crouter-api/dist/commands/sys/tutorial/branch.js +15 -0
  515. package/packages/crouter-api/dist/commands/sys/tutorial/lessons.js +107 -0
  516. package/packages/crouter-api/dist/commands/sys/tutorial/scenario.js +431 -0
  517. package/packages/crouter-api/dist/commands/sys/tutorial/tracks.js +96 -0
  518. package/packages/crouter-api/dist/commands/sys/update.js +157 -0
  519. package/packages/crouter-api/dist/commands/sys/worktrees.js +53 -0
  520. package/packages/crouter-api/dist/commands/sys.js +32 -0
  521. package/packages/crouter-api/dist/core/activity-signal.js +38 -0
  522. package/packages/crouter-api/dist/core/asset-root.js +18 -0
  523. package/packages/crouter-api/dist/core/async-array.js +48 -0
  524. package/packages/crouter-api/dist/core/auth-file.js +89 -0
  525. package/packages/crouter-api/dist/core/auth-interaction.js +94 -0
  526. package/packages/crouter-api/dist/core/bash-guard.js +527 -0
  527. package/packages/crouter-api/dist/core/bash-job-supervisor.js +157 -0
  528. package/packages/crouter-api/dist/core/bash-jobs.js +460 -0
  529. package/packages/crouter-api/dist/core/blobs/directory.js +264 -0
  530. package/packages/crouter-api/dist/core/blobs/fault.js +6 -0
  531. package/packages/crouter-api/dist/core/blobs/index.js +30 -0
  532. package/packages/crouter-api/dist/core/blobs/r2.js +169 -0
  533. package/packages/crouter-api/dist/core/broker-client/client.js +184 -0
  534. package/packages/crouter-api/dist/core/broker-client/index.js +14 -0
  535. package/packages/crouter-api/dist/core/broker-client/transport-relay.js +186 -0
  536. package/packages/crouter-api/dist/core/broker-client/transport-socket.js +187 -0
  537. package/packages/crouter-api/dist/core/broker-client/transport.js +40 -0
  538. package/packages/crouter-api/dist/core/canvas/app-run.js +4 -0
  539. package/packages/crouter-api/dist/core/canvas/attention.js +47 -0
  540. package/packages/crouter-api/dist/core/canvas/boot-id.js +26 -0
  541. package/packages/crouter-api/dist/core/canvas/browse/app.js +1050 -0
  542. package/packages/crouter-api/dist/core/canvas/browse/model.js +477 -0
  543. package/packages/crouter-api/dist/core/canvas/browse/pins.js +29 -0
  544. package/packages/crouter-api/dist/core/canvas/browse/render.js +1058 -0
  545. package/packages/crouter-api/dist/core/canvas/canvas.js +1225 -0
  546. package/packages/crouter-api/dist/core/canvas/crons.js +541 -0
  547. package/packages/crouter-api/dist/core/canvas/daemon-actions.js +98 -0
  548. package/packages/crouter-api/dist/core/canvas/db.js +429 -0
  549. package/packages/crouter-api/dist/core/canvas/deliveries.js +398 -0
  550. package/packages/crouter-api/dist/core/canvas/delivery-contract.js +30 -0
  551. package/packages/crouter-api/dist/core/canvas/executions.js +279 -0
  552. package/packages/crouter-api/dist/core/canvas/extensions.js +90 -0
  553. package/packages/crouter-api/dist/core/canvas/focuses.js +82 -0
  554. package/packages/crouter-api/dist/core/canvas/history.js +480 -0
  555. package/packages/crouter-api/dist/core/canvas/index.js +16 -0
  556. package/packages/crouter-api/dist/core/canvas/install-id.js +64 -0
  557. package/packages/crouter-api/dist/core/canvas/labels.js +43 -0
  558. package/packages/crouter-api/dist/core/canvas/legacy-person.js +4 -0
  559. package/packages/crouter-api/dist/core/canvas/memory-reads.js +37 -0
  560. package/packages/crouter-api/dist/core/canvas/meta-file.js +89 -0
  561. package/packages/crouter-api/dist/core/canvas/nav-render.js +224 -0
  562. package/packages/crouter-api/dist/core/canvas/node-agent-paths.js +30 -0
  563. package/packages/crouter-api/dist/core/canvas/node-order.js +37 -0
  564. package/packages/crouter-api/dist/core/canvas/node-recap.js +62 -0
  565. package/packages/crouter-api/dist/core/canvas/node-tokens.js +53 -0
  566. package/packages/crouter-api/dist/core/canvas/outcome-actions.js +71 -0
  567. package/packages/crouter-api/dist/core/canvas/paths.js +167 -0
  568. package/packages/crouter-api/dist/core/canvas/person-state.js +41 -0
  569. package/packages/crouter-api/dist/core/canvas/person.js +251 -0
  570. package/packages/crouter-api/dist/core/canvas/pid.js +977 -0
  571. package/packages/crouter-api/dist/core/canvas/reconciler-leases.js +40 -0
  572. package/packages/crouter-api/dist/core/canvas/recovery.js +715 -0
  573. package/packages/crouter-api/dist/core/canvas/remote-canvas-source.js +290 -0
  574. package/packages/crouter-api/dist/core/canvas/remote-transport.js +57 -0
  575. package/packages/crouter-api/dist/core/canvas/render-source.js +518 -0
  576. package/packages/crouter-api/dist/core/canvas/schema-chain.js +110 -0
  577. package/packages/crouter-api/dist/core/canvas/schema-version.js +58 -0
  578. package/packages/crouter-api/dist/core/canvas/sessions.js +128 -0
  579. package/packages/crouter-api/dist/core/canvas/source.js +57 -0
  580. package/packages/crouter-api/dist/core/canvas/status-glyph.js +132 -0
  581. package/packages/crouter-api/dist/core/canvas/structured-requests.js +176 -0
  582. package/packages/crouter-api/dist/core/canvas/telemetry.js +35 -0
  583. package/packages/crouter-api/dist/core/canvas/tree.js +128 -0
  584. package/packages/crouter-api/dist/core/canvas/types.js +6 -0
  585. package/packages/crouter-api/dist/core/canvas/waits.js +113 -0
  586. package/packages/crouter-api/dist/core/canvas/worktrees.js +97 -0
  587. package/packages/crouter-api/dist/core/checkout-identities.js +88 -0
  588. package/packages/crouter-api/dist/core/clipboard-text.js +57 -0
  589. package/packages/crouter-api/dist/core/command-hooks/artifact.js +145 -0
  590. package/packages/crouter-api/dist/core/command-hooks/catalog.js +38 -0
  591. package/packages/crouter-api/dist/core/command-hooks/compose.js +101 -0
  592. package/packages/crouter-api/dist/core/command-hooks/discovery.js +246 -0
  593. package/packages/crouter-api/dist/core/command-hooks/help.js +18 -0
  594. package/packages/crouter-api/dist/core/command-hooks/lifecycle-catalog.js +9 -0
  595. package/packages/crouter-api/dist/core/command-hooks/lifecycle-create.js +51 -0
  596. package/packages/crouter-api/dist/core/command-hooks/report.js +28 -0
  597. package/packages/crouter-api/dist/core/command-hooks/schema.js +157 -0
  598. package/packages/crouter-api/dist/core/command-hooks/transport/exec-invoke.js +315 -0
  599. package/packages/crouter-api/dist/core/command-hooks/transport/exec-lifecycle.js +248 -0
  600. package/packages/crouter-api/dist/core/command-hooks/transport/plan.js +30 -0
  601. package/packages/crouter-api/dist/core/command-manifests/registry.js +118 -0
  602. package/packages/crouter-api/dist/core/command-plugins/bundle.js +604 -0
  603. package/packages/crouter-api/dist/core/command-plugins/caller-header.js +15 -0
  604. package/packages/crouter-api/dist/core/command-plugins/compose.js +243 -0
  605. package/packages/crouter-api/dist/core/command-plugins/discovery.js +240 -0
  606. package/packages/crouter-api/dist/core/command-plugins/endpoint.js +60 -0
  607. package/packages/crouter-api/dist/core/command-plugins/extensions.js +166 -0
  608. package/packages/crouter-api/dist/core/command-plugins/help-addenda.js +55 -0
  609. package/packages/crouter-api/dist/core/command-plugins/presence.js +36 -0
  610. package/packages/crouter-api/dist/core/command-plugins/transport/exec-invoke.js +138 -0
  611. package/packages/crouter-api/dist/core/command-plugins/transport/http-fetch.js +68 -0
  612. package/packages/crouter-api/dist/core/command-plugins/transport/http-invoke.js +333 -0
  613. package/packages/crouter-api/dist/core/command-plugins/transport/http-plan.js +349 -0
  614. package/packages/crouter-api/dist/core/command-plugins/transport/sign.js +115 -0
  615. package/packages/crouter-api/dist/core/command.js +848 -0
  616. package/packages/crouter-api/dist/core/config.js +1154 -0
  617. package/packages/crouter-api/dist/core/conversation-store/client.js +111 -0
  618. package/packages/crouter-api/dist/core/conversation-store/index.js +62 -0
  619. package/packages/crouter-api/dist/core/conversation-store/patch.js +192 -0
  620. package/packages/crouter-api/dist/core/conversation-store/repair.js +84 -0
  621. package/packages/crouter-api/dist/core/conversation-store/row-store.js +365 -0
  622. package/packages/crouter-api/dist/core/directory/issuer.js +15 -0
  623. package/packages/crouter-api/dist/core/directory/join-lock.js +61 -0
  624. package/packages/crouter-api/dist/core/directory/join.js +218 -0
  625. package/packages/crouter-api/dist/core/directory/person-credential.js +220 -0
  626. package/packages/crouter-api/dist/core/directory/reach.js +19 -0
  627. package/packages/crouter-api/dist/core/document-lines.js +6 -0
  628. package/packages/crouter-api/dist/core/editor-resolver.js +77 -0
  629. package/packages/crouter-api/dist/core/env-name.js +25 -0
  630. package/packages/crouter-api/dist/core/environment-recipe.js +59 -0
  631. package/packages/crouter-api/dist/core/environments.js +59 -0
  632. package/packages/crouter-api/dist/core/errors.js +90 -0
  633. package/packages/crouter-api/dist/core/events/emit.js +44 -0
  634. package/packages/crouter-api/dist/core/events/envelope.js +84 -0
  635. package/packages/crouter-api/dist/core/events/errors.js +69 -0
  636. package/packages/crouter-api/dist/core/events/operation-id.js +24 -0
  637. package/packages/crouter-api/dist/core/events/outbound.js +92 -0
  638. package/packages/crouter-api/dist/core/events/read.js +625 -0
  639. package/packages/crouter-api/dist/core/events/serialize.js +199 -0
  640. package/packages/crouter-api/dist/core/events/source.js +31 -0
  641. package/packages/crouter-api/dist/core/events/types.js +11 -0
  642. package/packages/crouter-api/dist/core/exclusive-lock.js +197 -0
  643. package/packages/crouter-api/dist/core/fault-classifier.js +101 -0
  644. package/packages/crouter-api/dist/core/feed/feed.js +190 -0
  645. package/packages/crouter-api/dist/core/feed/inbox.js +93 -0
  646. package/packages/crouter-api/dist/core/feed/messages.js +219 -0
  647. package/packages/crouter-api/dist/core/feed/reports.js +58 -0
  648. package/packages/crouter-api/dist/core/frontmatter.js +35 -0
  649. package/packages/crouter-api/dist/core/fs-utils.js +263 -0
  650. package/packages/crouter-api/dist/core/git.js +103 -0
  651. package/packages/crouter-api/dist/core/grants/cover.js +66 -0
  652. package/packages/crouter-api/dist/core/grants/hosted-endpoint.js +70 -0
  653. package/packages/crouter-api/dist/core/grants/local.js +26 -0
  654. package/packages/crouter-api/dist/core/grants/mirror.js +464 -0
  655. package/packages/crouter-api/dist/core/grants/on-sync.js +163 -0
  656. package/packages/crouter-api/dist/core/grants/sandboxes.js +24 -0
  657. package/packages/crouter-api/dist/core/grants/sync.js +216 -0
  658. package/packages/crouter-api/dist/core/grants/terminal.js +25 -0
  659. package/packages/crouter-api/dist/core/graph/access.js +37 -0
  660. package/packages/crouter-api/dist/core/graph/bodies.js +68 -0
  661. package/packages/crouter-api/dist/core/graph/custom.js +298 -0
  662. package/packages/crouter-api/dist/core/graph/deletion.js +115 -0
  663. package/packages/crouter-api/dist/core/graph/documents.js +675 -0
  664. package/packages/crouter-api/dist/core/graph/edges.js +83 -0
  665. package/packages/crouter-api/dist/core/graph/events.js +432 -0
  666. package/packages/crouter-api/dist/core/graph/exposures.js +164 -0
  667. package/packages/crouter-api/dist/core/graph/jobs.js +184 -0
  668. package/packages/crouter-api/dist/core/graph/kinds/action.js +20 -0
  669. package/packages/crouter-api/dist/core/graph/kinds/custom.js +25 -0
  670. package/packages/crouter-api/dist/core/graph/kinds/document.js +132 -0
  671. package/packages/crouter-api/dist/core/graph/kinds/dto.js +20 -0
  672. package/packages/crouter-api/dist/core/graph/kinds/environment.js +21 -0
  673. package/packages/crouter-api/dist/core/graph/kinds/job.js +24 -0
  674. package/packages/crouter-api/dist/core/graph/kinds/kind.js +15 -0
  675. package/packages/crouter-api/dist/core/graph/kinds/live-read.js +11 -0
  676. package/packages/crouter-api/dist/core/graph/kinds/node.js +87 -0
  677. package/packages/crouter-api/dist/core/graph/kinds/owner.js +26 -0
  678. package/packages/crouter-api/dist/core/graph/kinds/registry.js +58 -0
  679. package/packages/crouter-api/dist/core/graph/kinds/render.js +17 -0
  680. package/packages/crouter-api/dist/core/graph/names.js +239 -0
  681. package/packages/crouter-api/dist/core/graph/objects.js +292 -0
  682. package/packages/crouter-api/dist/core/graph/package-docs.js +148 -0
  683. package/packages/crouter-api/dist/core/graph/package-files.js +146 -0
  684. package/packages/crouter-api/dist/core/graph/package-publish.js +158 -0
  685. package/packages/crouter-api/dist/core/graph/package-reconcile.js +99 -0
  686. package/packages/crouter-api/dist/core/graph/reader.js +284 -0
  687. package/packages/crouter-api/dist/core/graph/receiver-url.js +83 -0
  688. package/packages/crouter-api/dist/core/graph/receivers.js +66 -0
  689. package/packages/crouter-api/dist/core/graph/repo-sync/identity.js +147 -0
  690. package/packages/crouter-api/dist/core/graph/repo-sync/repos.js +94 -0
  691. package/packages/crouter-api/dist/core/graph/rules.js +144 -0
  692. package/packages/crouter-api/dist/core/graph/types.js +10 -0
  693. package/packages/crouter-api/dist/core/graph/watches.js +223 -0
  694. package/packages/crouter-api/dist/core/help.js +445 -0
  695. package/packages/crouter-api/dist/core/human/action-binding.js +41 -0
  696. package/packages/crouter-api/dist/core/human/answer-text.js +100 -0
  697. package/packages/crouter-api/dist/core/human/answer.js +119 -0
  698. package/packages/crouter-api/dist/core/human/completion.js +27 -0
  699. package/packages/crouter-api/dist/core/human/component-docs.js +442 -0
  700. package/packages/crouter-api/dist/core/human/convention.js +75 -0
  701. package/packages/crouter-api/dist/core/human/feedback-companion.js +92 -0
  702. package/packages/crouter-api/dist/core/human/feedback.js +88 -0
  703. package/packages/crouter-api/dist/core/human/page-authoring.js +19 -0
  704. package/packages/crouter-api/dist/core/human/page-catalog.js +172 -0
  705. package/packages/crouter-api/dist/core/human/page-errors.js +14 -0
  706. package/packages/crouter-api/dist/core/human/page-eval.js +125 -0
  707. package/packages/crouter-api/dist/core/human/page-html-markdown.js +260 -0
  708. package/packages/crouter-api/dist/core/human/page-markdown.js +295 -0
  709. package/packages/crouter-api/dist/core/human/page-schema.js +381 -0
  710. package/packages/crouter-api/dist/core/human/page.js +251 -0
  711. package/packages/crouter-api/dist/core/human/request-files.js +54 -0
  712. package/packages/crouter-api/dist/core/human/requests.js +647 -0
  713. package/packages/crouter-api/dist/core/human/root.js +11 -0
  714. package/packages/crouter-api/dist/core/human/summary.js +5 -0
  715. package/packages/crouter-api/dist/core/human/tickets.js +175 -0
  716. package/packages/crouter-api/dist/core/human/types.js +1 -0
  717. package/packages/crouter-api/dist/core/human/visible-paths.js +74 -0
  718. package/packages/crouter-api/dist/core/human-actions.js +101 -0
  719. package/packages/crouter-api/dist/core/import/bundle/blob-keys.js +25 -0
  720. package/packages/crouter-api/dist/core/import/bundle/layout.js +111 -0
  721. package/packages/crouter-api/dist/core/import/export/archive.js +22 -0
  722. package/packages/crouter-api/dist/core/import/export/cloud.js +164 -0
  723. package/packages/crouter-api/dist/core/import/export/dump.js +245 -0
  724. package/packages/crouter-api/dist/core/import/export/files.js +169 -0
  725. package/packages/crouter-api/dist/core/import/export/inline.js +15 -0
  726. package/packages/crouter-api/dist/core/import/export/source.js +5 -0
  727. package/packages/crouter-api/dist/core/import/export/stores.js +73 -0
  728. package/packages/crouter-api/dist/core/import/load/catalog.js +70 -0
  729. package/packages/crouter-api/dist/core/import/load/copy.js +132 -0
  730. package/packages/crouter-api/dist/core/import/load/prepare.js +211 -0
  731. package/packages/crouter-api/dist/core/import/load/rewrite.js +310 -0
  732. package/packages/crouter-api/dist/core/import/load/stage.js +99 -0
  733. package/packages/crouter-api/dist/core/inspector/chrome.js +14 -0
  734. package/packages/crouter-api/dist/core/inspector/contract.js +1 -0
  735. package/packages/crouter-api/dist/core/inspector/core.js +296 -0
  736. package/packages/crouter-api/dist/core/inspector/host.js +538 -0
  737. package/packages/crouter-api/dist/core/inspector/model.js +225 -0
  738. package/packages/crouter-api/dist/core/inspector/text.js +45 -0
  739. package/packages/crouter-api/dist/core/inspector/transport.js +36 -0
  740. package/packages/crouter-api/dist/core/inspector/tui.js +295 -0
  741. package/packages/crouter-api/dist/core/installed-plugins.js +82 -0
  742. package/packages/crouter-api/dist/core/io.js +470 -0
  743. package/packages/crouter-api/dist/core/keybindings/attach-control.js +42 -0
  744. package/packages/crouter-api/dist/core/keybindings/background-bash.js +33 -0
  745. package/packages/crouter-api/dist/core/keybindings/catalog.js +288 -0
  746. package/packages/crouter-api/dist/core/keybindings/inbox.js +25 -0
  747. package/packages/crouter-api/dist/core/keybindings/index.js +7 -0
  748. package/packages/crouter-api/dist/core/keybindings/match.js +146 -0
  749. package/packages/crouter-api/dist/core/keybindings/persistence.js +49 -0
  750. package/packages/crouter-api/dist/core/keybindings/resolve.js +348 -0
  751. package/packages/crouter-api/dist/core/keybindings/types.js +1 -0
  752. package/packages/crouter-api/dist/core/layout-migrate/index.js +523 -0
  753. package/packages/crouter-api/dist/core/layout-migrate/paths.js +118 -0
  754. package/packages/crouter-api/dist/core/layout-migrate/stored-paths.js +424 -0
  755. package/packages/crouter-api/dist/core/layout-migrate/stores.js +543 -0
  756. package/packages/crouter-api/dist/core/layout.js +143 -0
  757. package/packages/crouter-api/dist/core/ledger/account.js +13 -0
  758. package/packages/crouter-api/dist/core/ledger/charges.js +44 -0
  759. package/packages/crouter-api/dist/core/ledger/check.js +40 -0
  760. package/packages/crouter-api/dist/core/ledger/chunks.js +43 -0
  761. package/packages/crouter-api/dist/core/ledger/index.js +10 -0
  762. package/packages/crouter-api/dist/core/ledger/infra-allowance.js +31 -0
  763. package/packages/crouter-api/dist/core/ledger/limits.js +35 -0
  764. package/packages/crouter-api/dist/core/ledger/months.js +19 -0
  765. package/packages/crouter-api/dist/core/ledger/payer.js +14 -0
  766. package/packages/crouter-api/dist/core/ledger/rates.js +64 -0
  767. package/packages/crouter-api/dist/core/ledger/read.js +194 -0
  768. package/packages/crouter-api/dist/core/ledger/totals.js +34 -0
  769. package/packages/crouter-api/dist/core/ledger/types.js +2 -0
  770. package/packages/crouter-api/dist/core/llm/app-rungs.js +64 -0
  771. package/packages/crouter-api/dist/core/llm/body-limits.js +7 -0
  772. package/packages/crouter-api/dist/core/llm/owner-candidates.js +79 -0
  773. package/packages/crouter-api/dist/core/llm/refusal.js +22 -0
  774. package/packages/crouter-api/dist/core/llm/run.js +558 -0
  775. package/packages/crouter-api/dist/core/locked-file.js +121 -0
  776. package/packages/crouter-api/dist/core/log.js +91 -0
  777. package/packages/crouter-api/dist/core/managed-providers.js +61 -0
  778. package/packages/crouter-api/dist/core/manifest-stale.js +39 -0
  779. package/packages/crouter-api/dist/core/manifest.js +37 -0
  780. package/packages/crouter-api/dist/core/model-auth/api-credential-store.js +49 -0
  781. package/packages/crouter-api/dist/core/model-auth/daemon-login.js +156 -0
  782. package/packages/crouter-api/dist/core/model-auth/readiness.js +83 -0
  783. package/packages/crouter-api/dist/core/model-routes-pool.js +57 -0
  784. package/packages/crouter-api/dist/core/model-routes.js +212 -0
  785. package/packages/crouter-api/dist/core/northlight/previews.js +87 -0
  786. package/packages/crouter-api/dist/core/nvim-launch.js +45 -0
  787. package/packages/crouter-api/dist/core/output.js +99 -0
  788. package/packages/crouter-api/dist/core/packages/eligibility.js +34 -0
  789. package/packages/crouter-api/dist/core/packages/launch-kinds.js +20 -0
  790. package/packages/crouter-api/dist/core/packages/source-url.js +17 -0
  791. package/packages/crouter-api/dist/core/pagination.js +88 -0
  792. package/packages/crouter-api/dist/core/peer/client.js +168 -0
  793. package/packages/crouter-api/dist/core/peer/directory.js +193 -0
  794. package/packages/crouter-api/dist/core/peer/envelope.js +98 -0
  795. package/packages/crouter-api/dist/core/peer/names.js +8 -0
  796. package/packages/crouter-api/dist/core/peer/outbox-store.js +84 -0
  797. package/packages/crouter-api/dist/core/peer/receiver.js +54 -0
  798. package/packages/crouter-api/dist/core/peer/stubs.js +208 -0
  799. package/packages/crouter-api/dist/core/peer/token.js +30 -0
  800. package/packages/crouter-api/dist/core/peer/version.js +23 -0
  801. package/packages/crouter-api/dist/core/permissions/builtin.js +29 -0
  802. package/packages/crouter-api/dist/core/permissions/ceiling.js +332 -0
  803. package/packages/crouter-api/dist/core/permissions/compile.js +175 -0
  804. package/packages/crouter-api/dist/core/permissions/errors.js +13 -0
  805. package/packages/crouter-api/dist/core/permissions/evaluator.js +98 -0
  806. package/packages/crouter-api/dist/core/permissions/facts.js +102 -0
  807. package/packages/crouter-api/dist/core/permissions/schema-parser.js +151 -0
  808. package/packages/crouter-api/dist/core/permissions/schemas.js +83 -0
  809. package/packages/crouter-api/dist/core/permissions/sql.js +31 -0
  810. package/packages/crouter-api/dist/core/plugin-app.js +58 -0
  811. package/packages/crouter-api/dist/core/plugin-env.js +30 -0
  812. package/packages/crouter-api/dist/core/plugin-extensions.js +191 -0
  813. package/packages/crouter-api/dist/core/plugin-objects-manifest.js +86 -0
  814. package/packages/crouter-api/dist/core/plugin-quarantine.js +70 -0
  815. package/packages/crouter-api/dist/core/plugin-swap-lock.js +31 -0
  816. package/packages/crouter-api/dist/core/pool-credential-store.js +116 -0
  817. package/packages/crouter-api/dist/core/predicate.js +191 -0
  818. package/packages/crouter-api/dist/core/preview-registry.js +403 -0
  819. package/packages/crouter-api/dist/core/preview-result-path.js +26 -0
  820. package/packages/crouter-api/dist/core/profiles/default-binding.js +29 -0
  821. package/packages/crouter-api/dist/core/profiles/deletion-reservation.js +42 -0
  822. package/packages/crouter-api/dist/core/profiles/fuzzy-match.js +92 -0
  823. package/packages/crouter-api/dist/core/profiles/manifest.js +574 -0
  824. package/packages/crouter-api/dist/core/profiles/select.js +740 -0
  825. package/packages/crouter-api/dist/core/provider-credential.js +17 -0
  826. package/packages/crouter-api/dist/core/provider-error-recognition.js +82 -0
  827. package/packages/crouter-api/dist/core/provider-failure.js +157 -0
  828. package/packages/crouter-api/dist/core/provider-management.js +9 -0
  829. package/packages/crouter-api/dist/core/providers/approval.js +146 -0
  830. package/packages/crouter-api/dist/core/providers/audit.js +52 -0
  831. package/packages/crouter-api/dist/core/providers/bundles.js +643 -0
  832. package/packages/crouter-api/dist/core/providers/call.js +497 -0
  833. package/packages/crouter-api/dist/core/providers/description.js +1 -0
  834. package/packages/crouter-api/dist/core/providers/device-libs.js +202 -0
  835. package/packages/crouter-api/dist/core/providers/device.js +95 -0
  836. package/packages/crouter-api/dist/core/providers/errors.js +136 -0
  837. package/packages/crouter-api/dist/core/providers/files.js +390 -0
  838. package/packages/crouter-api/dist/core/providers/inflight.js +14 -0
  839. package/packages/crouter-api/dist/core/providers/mint.js +219 -0
  840. package/packages/crouter-api/dist/core/providers/receipts.js +61 -0
  841. package/packages/crouter-api/dist/core/providers/request.js +173 -0
  842. package/packages/crouter-api/dist/core/providers/roots.js +118 -0
  843. package/packages/crouter-api/dist/core/providers/token-cache.js +203 -0
  844. package/packages/crouter-api/dist/core/rate-limit-scope.js +64 -0
  845. package/packages/crouter-api/dist/core/remote-canvas-target.js +30 -0
  846. package/packages/crouter-api/dist/core/render.js +146 -0
  847. package/packages/crouter-api/dist/core/resolver.js +111 -0
  848. package/packages/crouter-api/dist/core/review/comments.js +296 -0
  849. package/packages/crouter-api/dist/core/review/companion.js +211 -0
  850. package/packages/crouter-api/dist/core/review/signal.js +12 -0
  851. package/packages/crouter-api/dist/core/review/store.js +178 -0
  852. package/packages/crouter-api/dist/core/review/types.js +23 -0
  853. package/packages/crouter-api/dist/core/runs/activity.js +57 -0
  854. package/packages/crouter-api/dist/core/runs/events.js +179 -0
  855. package/packages/crouter-api/dist/core/runs/initial-input.js +27 -0
  856. package/packages/crouter-api/dist/core/runs/operations.js +793 -0
  857. package/packages/crouter-api/dist/core/runs/questions.js +151 -0
  858. package/packages/crouter-api/dist/core/runtime/banner.js +53 -0
  859. package/packages/crouter-api/dist/core/runtime/bearings-render.js +273 -0
  860. package/packages/crouter-api/dist/core/runtime/bearings.js +199 -0
  861. package/packages/crouter-api/dist/core/runtime/bin-contributions.js +186 -0
  862. package/packages/crouter-api/dist/core/runtime/blaxel-environment.js +17 -0
  863. package/packages/crouter-api/dist/core/runtime/branded-host.js +485 -0
  864. package/packages/crouter-api/dist/core/runtime/broker/attachments-fetch.js +20 -0
  865. package/packages/crouter-api/dist/core/runtime/broker/bash-job-launch.js +66 -0
  866. package/packages/crouter-api/dist/core/runtime/broker/daemon-ops.js +232 -0
  867. package/packages/crouter-api/dist/core/runtime/broker/model-adapter.js +431 -0
  868. package/packages/crouter-api/dist/core/runtime/broker/node-token.js +16 -0
  869. package/packages/crouter-api/dist/core/runtime/broker/read-ops.js +173 -0
  870. package/packages/crouter-api/dist/core/runtime/broker/signal-stream.js +149 -0
  871. package/packages/crouter-api/dist/core/runtime/broker/turn-cause.js +44 -0
  872. package/packages/crouter-api/dist/core/runtime/broker-protocol.js +152 -0
  873. package/packages/crouter-api/dist/core/runtime/broker-request.js +86 -0
  874. package/packages/crouter-api/dist/core/runtime/broker-sdk.js +130 -0
  875. package/packages/crouter-api/dist/core/runtime/canvas-extensions.js +100 -0
  876. package/packages/crouter-api/dist/core/runtime/close.js +266 -0
  877. package/packages/crouter-api/dist/core/runtime/command-expansion.js +104 -0
  878. package/packages/crouter-api/dist/core/runtime/command-surface.js +117 -0
  879. package/packages/crouter-api/dist/core/runtime/crtr-theme.js +146 -0
  880. package/packages/crouter-api/dist/core/runtime/deliver-live.js +84 -0
  881. package/packages/crouter-api/dist/core/runtime/fault-recovery.js +83 -0
  882. package/packages/crouter-api/dist/core/runtime/fault.js +17 -0
  883. package/packages/crouter-api/dist/core/runtime/fleet.js +75 -0
  884. package/packages/crouter-api/dist/core/runtime/focus-viewer.js +151 -0
  885. package/packages/crouter-api/dist/core/runtime/front-door-env.js +16 -0
  886. package/packages/crouter-api/dist/core/runtime/headless-pi.js +176 -0
  887. package/packages/crouter-api/dist/core/runtime/host.js +701 -0
  888. package/packages/crouter-api/dist/core/runtime/interactive-deliver.js +51 -0
  889. package/packages/crouter-api/dist/core/runtime/invocation.js +10 -0
  890. package/packages/crouter-api/dist/core/runtime/kickoff.js +263 -0
  891. package/packages/crouter-api/dist/core/runtime/launch-prompt.js +13 -0
  892. package/packages/crouter-api/dist/core/runtime/launch-target.js +87 -0
  893. package/packages/crouter-api/dist/core/runtime/launch.js +505 -0
  894. package/packages/crouter-api/dist/core/runtime/ledger.js +55 -0
  895. package/packages/crouter-api/dist/core/runtime/lifecycle.js +283 -0
  896. package/packages/crouter-api/dist/core/runtime/managed-provider-cooling.js +62 -0
  897. package/packages/crouter-api/dist/core/runtime/memory-admission.js +68 -0
  898. package/packages/crouter-api/dist/core/runtime/model-registry.js +13 -0
  899. package/packages/crouter-api/dist/core/runtime/model-selection.js +135 -0
  900. package/packages/crouter-api/dist/core/runtime/model-swap.js +75 -0
  901. package/packages/crouter-api/dist/core/runtime/naming.js +300 -0
  902. package/packages/crouter-api/dist/core/runtime/nerd-font.js +162 -0
  903. package/packages/crouter-api/dist/core/runtime/nodes.js +506 -0
  904. package/packages/crouter-api/dist/core/runtime/outcome-document.js +86 -0
  905. package/packages/crouter-api/dist/core/runtime/output-result.js +32 -0
  906. package/packages/crouter-api/dist/core/runtime/output-schema-refs.js +100 -0
  907. package/packages/crouter-api/dist/core/runtime/package-health.js +100 -0
  908. package/packages/crouter-api/dist/core/runtime/persona.js +54 -0
  909. package/packages/crouter-api/dist/core/runtime/pi-cli.js +65 -0
  910. package/packages/crouter-api/dist/core/runtime/pi-vendored.js +63 -0
  911. package/packages/crouter-api/dist/core/runtime/placement-tmux.js +81 -0
  912. package/packages/crouter-api/dist/core/runtime/placement.js +418 -0
  913. package/packages/crouter-api/dist/core/runtime/progress-bar.js +50 -0
  914. package/packages/crouter-api/dist/core/runtime/provider-credential-gate.js +48 -0
  915. package/packages/crouter-api/dist/core/runtime/recovery-hold.js +46 -0
  916. package/packages/crouter-api/dist/core/runtime/reopen.js +160 -0
  917. package/packages/crouter-api/dist/core/runtime/revive.js +748 -0
  918. package/packages/crouter-api/dist/core/runtime/roadmap.js +86 -0
  919. package/packages/crouter-api/dist/core/runtime/runner/blaxel/client.js +140 -0
  920. package/packages/crouter-api/dist/core/runtime/runner/blaxel/image-build.js +233 -0
  921. package/packages/crouter-api/dist/core/runtime/runner/delete-sandboxes.js +24 -0
  922. package/packages/crouter-api/dist/core/runtime/runner/index.js +37 -0
  923. package/packages/crouter-api/dist/core/runtime/runner/machine/call.js +94 -0
  924. package/packages/crouter-api/dist/core/runtime/runner/machine/environment.js +7 -0
  925. package/packages/crouter-api/dist/core/runtime/runner/machine/ops.js +42 -0
  926. package/packages/crouter-api/dist/core/runtime/runner/machine/runner.js +90 -0
  927. package/packages/crouter-api/dist/core/runtime/runner/process.js +70 -0
  928. package/packages/crouter-api/dist/core/runtime/runner/types.js +16 -0
  929. package/packages/crouter-api/dist/core/runtime/session-branch.js +16 -0
  930. package/packages/crouter-api/dist/core/runtime/session-cycles.js +110 -0
  931. package/packages/crouter-api/dist/core/runtime/session-list-cache.js +302 -0
  932. package/packages/crouter-api/dist/core/runtime/session-visibility.js +99 -0
  933. package/packages/crouter-api/dist/core/runtime/setup-marker.js +46 -0
  934. package/packages/crouter-api/dist/core/runtime/situational-context.js +54 -0
  935. package/packages/crouter-api/dist/core/runtime/situational-live.js +41 -0
  936. package/packages/crouter-api/dist/core/runtime/spawn-env-rows.js +15 -0
  937. package/packages/crouter-api/dist/core/runtime/spawn-env.js +260 -0
  938. package/packages/crouter-api/dist/core/runtime/spawn.js +717 -0
  939. package/packages/crouter-api/dist/core/runtime/stamp/protocol.js +113 -0
  940. package/packages/crouter-api/dist/core/runtime/start-check.js +43 -0
  941. package/packages/crouter-api/dist/core/runtime/stop-guard.js +150 -0
  942. package/packages/crouter-api/dist/core/runtime/structured-output.js +112 -0
  943. package/packages/crouter-api/dist/core/runtime/surface-bg.js +85 -0
  944. package/packages/crouter-api/dist/core/runtime/tmux-bindings.js +743 -0
  945. package/packages/crouter-api/dist/core/runtime/tmux-chrome.js +5 -0
  946. package/packages/crouter-api/dist/core/runtime/tmux-driver.js +713 -0
  947. package/packages/crouter-api/dist/core/runtime/unsandboxed.js +18 -0
  948. package/packages/crouter-api/dist/core/runtime/view-socket.js +195 -0
  949. package/packages/crouter-api/dist/core/runtime/warm-pool.js +479 -0
  950. package/packages/crouter-api/dist/core/scope.js +184 -0
  951. package/packages/crouter-api/dist/core/scoped-state/db.js +271 -0
  952. package/packages/crouter-api/dist/core/scoped-state/legacy-profiles.js +65 -0
  953. package/packages/crouter-api/dist/core/scoped-state/migrate.js +332 -0
  954. package/packages/crouter-api/dist/core/scoped-state/paths.js +27 -0
  955. package/packages/crouter-api/dist/core/scoped-state/person-rows.js +185 -0
  956. package/packages/crouter-api/dist/core/scoped-state/person-store.js +116 -0
  957. package/packages/crouter-api/dist/core/scoped-state/schema.js +52 -0
  958. package/packages/crouter-api/dist/core/scopes.js +48 -0
  959. package/packages/crouter-api/dist/core/secrets/env-rows.js +40 -0
  960. package/packages/crouter-api/dist/core/secrets/environment-owner.js +31 -0
  961. package/packages/crouter-api/dist/core/secrets/environment-secrets.js +14 -0
  962. package/packages/crouter-api/dist/core/secrets/index.js +2 -0
  963. package/packages/crouter-api/dist/core/secrets/key.js +33 -0
  964. package/packages/crouter-api/dist/core/secrets/seal.js +43 -0
  965. package/packages/crouter-api/dist/core/secrets.js +147 -0
  966. package/packages/crouter-api/dist/core/self-update.js +77 -0
  967. package/packages/crouter-api/dist/core/session-model/session-state.js +180 -0
  968. package/packages/crouter-api/dist/core/shell-segments.js +169 -0
  969. package/packages/crouter-api/dist/core/spaces/cache-env.js +15 -0
  970. package/packages/crouter-api/dist/core/spaces/file-root.js +68 -0
  971. package/packages/crouter-api/dist/core/spaces/mounts.js +126 -0
  972. package/packages/crouter-api/dist/core/spaces/open-beneath.js +581 -0
  973. package/packages/crouter-api/dist/core/spaces/permissions.js +77 -0
  974. package/packages/crouter-api/dist/core/spaces/process.js +172 -0
  975. package/packages/crouter-api/dist/core/spaces/runtime-home.js +8 -0
  976. package/packages/crouter-api/dist/core/spaces/space.js +58 -0
  977. package/packages/crouter-api/dist/core/spaces/stop.js +138 -0
  978. package/packages/crouter-api/dist/core/spaces/users.js +43 -0
  979. package/packages/crouter-api/dist/core/sqlite-statements.js +17 -0
  980. package/packages/crouter-api/dist/core/statements.js +81 -0
  981. package/packages/crouter-api/dist/core/storage/attachments.js +141 -0
  982. package/packages/crouter-api/dist/core/storage/caller-file.js +84 -0
  983. package/packages/crouter-api/dist/core/storage/client.js +220 -0
  984. package/packages/crouter-api/dist/core/storage/media-types.js +22 -0
  985. package/packages/crouter-api/dist/core/storage/purge.js +55 -0
  986. package/packages/crouter-api/dist/core/storage/tables.js +129 -0
  987. package/packages/crouter-api/dist/core/subscription-state.js +449 -0
  988. package/packages/crouter-api/dist/core/substrate/delivery/corpus.js +206 -0
  989. package/packages/crouter-api/dist/core/substrate/delivery/deliver.js +336 -0
  990. package/packages/crouter-api/dist/core/substrate/delivery/listings.js +75 -0
  991. package/packages/crouter-api/dist/core/substrate/delivery/match.js +146 -0
  992. package/packages/crouter-api/dist/core/substrate/delivery/plan.js +130 -0
  993. package/packages/crouter-api/dist/core/substrate/delivery/render-boot.js +330 -0
  994. package/packages/crouter-api/dist/core/substrate/delivery/render-event.js +186 -0
  995. package/packages/crouter-api/dist/core/substrate/delivery/sub-persona-menu.js +24 -0
  996. package/packages/crouter-api/dist/core/substrate/delivery/types.js +1 -0
  997. package/packages/crouter-api/dist/core/substrate/gate-explain.js +397 -0
  998. package/packages/crouter-api/dist/core/substrate/schema.js +81 -0
  999. package/packages/crouter-api/dist/core/substrate/subject-fields.js +39 -0
  1000. package/packages/crouter-api/dist/core/substrate/subject.js +60 -0
  1001. package/packages/crouter-api/dist/core/termrender/code-doc.js +92 -0
  1002. package/packages/crouter-api/dist/core/termrender/display.js +56 -0
  1003. package/packages/crouter-api/dist/core/termrender/termrender.js +719 -0
  1004. package/packages/crouter-api/dist/core/termrender/version.js +1 -0
  1005. package/packages/crouter-api/dist/core/timing.js +94 -0
  1006. package/packages/crouter-api/dist/core/tui/draw.js +378 -0
  1007. package/packages/crouter-api/dist/core/tui/fuzzy.js +38 -0
  1008. package/packages/crouter-api/dist/core/tui/markdown.js +407 -0
  1009. package/packages/crouter-api/dist/core/tui/page-host.js +74 -0
  1010. package/packages/crouter-api/dist/core/tui/panel.js +142 -0
  1011. package/packages/crouter-api/dist/core/tui/terminal.js +100 -0
  1012. package/packages/crouter-api/dist/core/user-settings.js +478 -0
  1013. package/packages/crouter-api/dist/core/wake.js +296 -0
  1014. package/packages/crouter-api/dist/core/worktree-close.js +251 -0
  1015. package/packages/crouter-api/dist/core/worktree-containment.js +48 -0
  1016. package/packages/crouter-api/dist/core/worktree-landing.js +56 -0
  1017. package/packages/crouter-api/dist/core/worktree-machine.js +92 -0
  1018. package/packages/crouter-api/dist/core/worktree-mutation-async.js +385 -0
  1019. package/packages/crouter-api/dist/core/worktree-remove.js +84 -0
  1020. package/packages/crouter-api/dist/core/worktree.js +909 -0
  1021. package/packages/crouter-api/dist/daemon/api/deferred-head.js +117 -0
  1022. package/packages/crouter-api/dist/daemon/api/environment-of.js +64 -0
  1023. package/packages/crouter-api/dist/daemon/api/handlers/bash-jobs.js +341 -0
  1024. package/packages/crouter-api/dist/daemon/api/handlers/broker-recovery.js +266 -0
  1025. package/packages/crouter-api/dist/daemon/api/handlers/git-credential.js +64 -0
  1026. package/packages/crouter-api/dist/daemon/api/handlers/providers.js +284 -0
  1027. package/packages/crouter-api/dist/daemon/api/handlers/validate.js +58 -0
  1028. package/packages/crouter-api/dist/daemon/api/map.js +768 -0
  1029. package/packages/crouter-api/dist/daemon/api/operations.js +316 -0
  1030. package/packages/crouter-api/dist/daemon/api/principal.js +147 -0
  1031. package/packages/crouter-api/dist/daemon/api/reader.js +125 -0
  1032. package/packages/crouter-api/dist/daemon/api/router.js +542 -0
  1033. package/packages/crouter-api/dist/daemon/api/sync-notice.js +46 -0
  1034. package/packages/crouter-api/dist/daemon/api/viewer-presence.js +100 -0
  1035. package/packages/crouter-api/dist/daemon/broker-signals/bus.js +203 -0
  1036. package/packages/crouter-api/dist/daemon/companion-retire.js +44 -0
  1037. package/packages/crouter-api/dist/daemon/control.js +22 -0
  1038. package/packages/crouter-api/dist/daemon/cron/authority.js +101 -0
  1039. package/packages/crouter-api/dist/daemon/cron/live-runs.js +66 -0
  1040. package/packages/crouter-api/dist/daemon/cron/run-socket.js +170 -0
  1041. package/packages/crouter-api/dist/daemon/drain.js +76 -0
  1042. package/packages/crouter-api/dist/daemon/http-dispatcher.js +37 -0
  1043. package/packages/crouter-api/dist/daemon/human/finish.js +178 -0
  1044. package/packages/crouter-api/dist/daemon/human/settle.js +103 -0
  1045. package/packages/crouter-api/dist/daemon/machine-link/config.js +63 -0
  1046. package/packages/crouter-api/dist/daemon/machine-link/credential.js +24 -0
  1047. package/packages/crouter-api/dist/daemon/machine-link/forward.js +181 -0
  1048. package/packages/crouter-api/dist/daemon/machine-link/frames.js +29 -0
  1049. package/packages/crouter-api/dist/daemon/machine-link/holder.js +317 -0
  1050. package/packages/crouter-api/dist/daemon/machine-link/move-notify.js +15 -0
  1051. package/packages/crouter-api/dist/daemon/manage.js +736 -0
  1052. package/packages/crouter-api/dist/daemon/park-activity.js +33 -0
  1053. package/packages/crouter-api/dist/daemon/park-pending.js +76 -0
  1054. package/packages/crouter-api/dist/daemon/pidfile.js +37 -0
  1055. package/packages/crouter-api/dist/daemon/postgres/binary.js +193 -0
  1056. package/packages/crouter-api/dist/daemon/postgres/cluster.js +111 -0
  1057. package/packages/crouter-api/dist/daemon/postgres/pins.js +16 -0
  1058. package/packages/crouter-api/dist/daemon/postgres/supervisor.js +177 -0
  1059. package/packages/crouter-api/dist/daemon/readiness.js +37 -0
  1060. package/packages/crouter-api/dist/daemon/reconcilers/broker-supervision.js +846 -0
  1061. package/packages/crouter-api/dist/daemon/reconcilers/ledger-sandbox.js +249 -0
  1062. package/packages/crouter-api/dist/daemon/reconcilers/live-obligation.js +125 -0
  1063. package/packages/crouter-api/dist/daemon/reconcilers/node-lifecycle/launch-failure.js +8 -0
  1064. package/packages/crouter-api/dist/daemon/reconcilers/node-lifecycle/node-person.js +40 -0
  1065. package/packages/crouter-api/dist/daemon/reconcilers/node-lifecycle/remote-wake.js +151 -0
  1066. package/packages/crouter-api/dist/daemon/reconcilers/node-lifecycle/respawn-policy.js +59 -0
  1067. package/packages/crouter-api/dist/daemon/reconcilers/recipe-image.js +196 -0
  1068. package/packages/crouter-api/dist/daemon/reconcilers/throttled-lane.js +63 -0
  1069. package/packages/crouter-api/dist/daemon/runs/append-section.js +135 -0
  1070. package/packages/crouter-api/dist/daemon/runs/observer.js +441 -0
  1071. package/packages/crouter-api/dist/daemon/runs/view-transport.js +81 -0
  1072. package/packages/crouter-api/dist/daemon/startup-policy.js +1 -0
  1073. package/packages/crouter-api/dist/daemon/structured-requests/sidecar.js +5 -0
  1074. package/packages/crouter-api/dist/hook-authoring.js +447 -0
  1075. package/packages/crouter-api/dist/hook-process.js +34 -0
  1076. package/packages/crouter-api/dist/launcher/client.js +52 -0
  1077. package/packages/crouter-api/dist/launcher/limits/policy.js +142 -0
  1078. package/packages/crouter-api/dist/launcher/limits/settings.js +94 -0
  1079. package/packages/crouter-api/dist/launcher/spec.js +10 -0
  1080. package/packages/crouter-api/dist/migrations/004-canvas-documents/apply.js +113 -0
  1081. package/packages/crouter-api/dist/migrations/004-canvas-documents/fields.js +52 -0
  1082. package/packages/crouter-api/dist/migrations/004-canvas-documents/index.js +89 -0
  1083. package/packages/crouter-api/dist/migrations/004-canvas-documents/legacy/discover.js +251 -0
  1084. package/packages/crouter-api/dist/migrations/004-canvas-documents/legacy/history.js +37 -0
  1085. package/packages/crouter-api/dist/migrations/004-canvas-documents/legacy/nested.js +37 -0
  1086. package/packages/crouter-api/dist/migrations/004-canvas-documents/legacy/parse.js +24 -0
  1087. package/packages/crouter-api/dist/migrations/004-canvas-documents/legacy/types.js +3 -0
  1088. package/packages/crouter-api/dist/migrations/004-canvas-documents/plan.js +410 -0
  1089. package/packages/crouter-api/dist/migrations/004-canvas-documents/pointers.js +95 -0
  1090. package/packages/crouter-api/dist/migrations/activation.js +46 -0
  1091. package/packages/crouter-api/dist/native/linux.js +20 -0
  1092. package/packages/crouter-api/dist/shared/crtr-version.js +18 -0
  1093. package/packages/crouter-api/dist/shared/env.js +335 -0
  1094. package/packages/crouter-api/dist/shared/generated-context.js +240 -0
  1095. package/packages/crouter-api/dist/shared/inbox-entry-body.js +124 -0
  1096. package/packages/crouter-api/dist/shared/inline-ref-grammar.js +99 -0
  1097. package/packages/crouter-api/dist/shared/predicates.js +4 -0
  1098. package/packages/crouter-api/dist/shared/shell-quote.js +5 -0
  1099. package/packages/crouter-api/dist/shared/strip-cd-prefix.js +13 -0
  1100. package/packages/crouter-api/dist/shared/tool-groups.js +64 -0
  1101. package/packages/crouter-api/dist/shared/traceparent.js +28 -0
  1102. package/packages/crouter-api/dist/shared/turn-replies.js +71 -0
  1103. package/packages/crouter-api/dist/shared/working-activity.js +27 -0
  1104. package/packages/crouter-api/dist/types.js +193 -0
  1105. package/packages/crouter-api/package.json +49 -0
  1106. package/packages/crouter-identity/package.json +1 -1
  1107. package/packages/crouter-plugin/dist/approval.js +12 -0
  1108. package/packages/crouter-plugin/dist/bundle.js +203 -0
  1109. package/packages/crouter-plugin/dist/caller.js +23 -0
  1110. package/packages/crouter-plugin/dist/client/index.js +338 -0
  1111. package/packages/crouter-plugin/dist/compare.js +314 -0
  1112. package/packages/crouter-plugin/dist/define.js +531 -0
  1113. package/packages/crouter-plugin/dist/errors.js +150 -0
  1114. package/packages/crouter-plugin/dist/fields.js +83 -0
  1115. package/packages/crouter-plugin/dist/index.js +15 -0
  1116. package/packages/crouter-plugin/dist/manifest.js +111 -0
  1117. package/packages/crouter-plugin/dist/node.js +153 -0
  1118. package/packages/crouter-plugin/dist/params.js +85 -0
  1119. package/packages/crouter-plugin/dist/receipts.js +234 -0
  1120. package/packages/crouter-plugin/dist/serve.js +630 -0
  1121. package/packages/crouter-plugin/dist/verify.js +84 -0
  1122. package/packages/crouter-plugin/dist/watchable.js +14 -0
  1123. package/packages/crouter-plugin/package.json +42 -0
  1124. package/runtime.lock.json +14 -13
  1125. package/dist/core/graph/repo-sync/index.d.ts +0 -4
  1126. package/dist/core/graph/repo-sync/index.js +0 -1
  1127. package/dist/core/graph/repo-sync/mirror.d.ts +0 -30
  1128. package/dist/core/graph/repo-sync/mirror.js +0 -6
  1129. package/dist/core/graph/repo-sync/sync.d.ts +0 -40
  1130. package/dist/core/graph/repo-sync/sync.js +0 -2
@@ -1,2 +1,2 @@
1
- var Q=Object.defineProperty;var d=(s,f)=>Q(s,"name",{value:f,configurable:!0});import{mkdtempSync as V,readFileSync as q,rmSync as E,existsSync as Y}from"node:fs";import{tmpdir as Z}from"node:os";import{join as F}from"node:path";import{cliClient as ee}from"../../commands/api-client.js";import{loadPins as re,savePins as ne}from"../../core/canvas/browse/pins.js";import{detectColorCaps as oe}from"../../core/tui/draw.js";import{getTerminalSize as ie,parseKeypress as te,restoreTerminal as se,setupTerminal as de}from"../../core/tui/terminal.js";import{getPaneOption as le,runShellInBackground as ce,setPaneOption as C,shellQuote as h}from"../../core/runtime/placement-tmux.js";import{matchesTerminalInput as ae,resolveUserKeybindings as fe}from"../../core/keybindings/index.js";import{VIEWER_OWNER_OPTION as S}from"../attach/session/pane-tag.js";import{buildLines as ue,nearestSelectable as M,placements as pe,rootOf as b,stepSelectable as D}from"./model.js";import{listHeight as me,renderDashboard as he}from"./render.js";const ge=2e3,we=250,be=6e3;function P(s){return s.kind==="heading"?null:s.kind==="root"?`root:${s.id}`:`child:${s.rootId}:${s.id}`}d(P,"lineKey");async function Oe(s){const f=process.env.TMUX_PANE;if(f===void 0||f==="")throw new Error("the dashboard runs in a tmux pane (TMUX_PANE is unset)");const m=ee(),R=fe(),j=oe(),c=d((r,n)=>ae(R,r,n),"matches"),k=String(process.pid);C(f,S,k);for(const r of["@crtr_node","@crtr_attach","@crtr_viewer_at"])C(f,r,"");const K=V(F(Z(),"crtr-dashboard-"));let x=!1;const L=d(()=>{if(!x){x=!0;try{se()}catch{}le(f,S)===k&&C(f,S,"");try{E(K,{recursive:!0,force:!0})}catch{}}},"cleanup");process.once("exit",L);for(const r of["SIGTERM","SIGHUP"])process.once(r,()=>{L(),process.exit(0)});const e={rows:[],placed:new Map,pinned:re(),expanded:new Set,lines:[],cursorKey:null,cursor:0,scroll:0,scope:s.profileId===void 0?"all":"profile",profileLabel:s.profileId??"",loaded:!1,help:!1,inputFocused:!1,inputText:"",dirs:[s.cwd],dirIndex:0,dirsLoaded:!1,rename:null,renameTarget:null,confirmClose:null,notice:null,opening:null},I=new Set;let v;const u=d(r=>{e.notice=r,v!==void 0&&clearTimeout(v),v=setTimeout(()=>{e.notice=null,l()},be)},"notify"),g=d(()=>{const r=e.rows.filter(t=>!I.has(t.node_id));e.lines=ue(r,e.placed,e.pinned,e.expanded);const n=e.cursorKey===null?-1:e.lines.findIndex(t=>P(t)===e.cursorKey);e.cursor=n>=0?n:M(e.lines,e.cursor),e.cursor<0&&(e.cursor=0);const o=e.lines[e.cursor];e.cursorKey=o===void 0?null:P(o)},"rebuild"),l=d(()=>{if(x)return;const r=ie(),n=me(r.rows)-1;e.cursor<e.scroll&&(e.scroll=e.cursor),e.cursor>=e.scroll+n&&(e.scroll=e.cursor-n+1),e.scroll<0&&(e.scroll=0),process.stdout.write(he({lines:e.lines,cursor:e.cursor,scroll:e.scroll,pinned:e.pinned,scope:e.scope,profileLabel:e.profileLabel,rename:e.rename,inputText:e.inputText,inputFocused:e.inputFocused,chipDir:e.dirs[e.dirIndex]??s.cwd,confirmName:e.confirmClose===null?null:e.rows.find(o=>o.node_id===e.confirmClose)?.name??e.confirmClose,notice:e.notice,opening:e.opening!==null,help:e.help,loaded:e.loaded},r,j))},"paint");let $=!1,y=!1;const p=d(async()=>{if($){y=!0;return}$=!0;try{const r=await m.liveRoots(e.scope==="profile"&&s.profileId!==void 0?{profile:s.profileId}:{});e.rows=r.rows,e.placed=pe(r.rows,e.placed),e.loaded=!0,g()}catch(r){u(`refresh failed: ${r.message}`)}finally{$=!1}l(),y&&(y=!1,p())},"poll");s.profileId!==void 0&&m.getProfile(s.profileId).then(r=>{e.profileLabel=r.name,l()}).catch(()=>{});const U=d(()=>e.lines[e.cursor],"current"),z=d(r=>{if(e.opening!==null||r.kind==="heading")return;const o=(r.kind==="root"?r.row:e.rows.find(_=>_.node_id===r.rootId)?.children.find(_=>_.node_id===r.id))?.name??r.id,t=r.kind==="root"&&r.row.asks>0?r.row.first_ask_ticket_id:null,i=F(K,`open-${Date.now()}`),T=`{ ${["crtr","surface","node","focus",r.id,"--pane",f,"--in-place","--keep-other-viewers",...t===null?[]:["--open-ticket",t],"--json"].map(h).join(" ")} >${h(`${i}.out`)} 2>${h(`${i}.err`)}; echo $? >${h(`${i}.code`)} && mv ${h(`${i}.code`)} ${h(i)}; } 2>/dev/null; exit 0`;if(!ce(T)){u(`could not open ${o}`),l();return}e.opening={file:i,name:o},l()},"open"),A=d(()=>{const r=e.opening;if(r===null||!Y(r.file))return;const n=d(a=>{try{return q(a,"utf8").trim()}catch{return""}},"read"),o=n(r.file),t=n(`${r.file}.out`),i=n(`${r.file}.err`);for(const a of[r.file,`${r.file}.out`,`${r.file}.err`])E(a,{force:!0});if(e.opening=null,o!=="0")u(i===""?`could not open ${r.name}`:i.split(`
2
- `)[0]);else{let a=!1;try{a=JSON.parse(t).focused===!0}catch{a=!1}a||u(`could not open ${r.name}`)}l(),p()},"finishOpen"),G=d(async()=>{const r=e.inputText.trim();if(r!==""){try{await m.createNode({root:!0,prompt:r,cwd:e.dirs[e.dirIndex]??s.cwd,...s.profileId===void 0?{}:{profile:s.profileId}}),e.inputText="",e.inputFocused=!1,p()}catch(n){u(`could not start: ${n.message}`)}l()}},"startConversation"),H=d(()=>{e.dirsLoaded||s.profileId===void 0||(e.dirsLoaded=!0,m.getProfile(s.profileId).then(r=>{e.dirs=[s.cwd,...r.projects.map(n=>n.path).filter(n=>n!==s.cwd)],l()}).catch(r=>{u(`could not list directories: ${r.message}`),l()}))},"loadDirs"),O=d(async r=>{e.confirmClose=null,I.add(r),g(),l();try{await m.closeNode(r,{finish:!0})}catch(n){u(`could not close: ${n.message}`)}finally{I.delete(r)}p(),l()},"doClose"),W=d(async()=>{const r=e.renameTarget,n=(e.rename??"").trim();if(e.rename=null,e.renameTarget=null,r!==null&&n!==""){try{await m.patchConfig(r,{name:n})}catch(o){u(`could not rename: ${o.message}`)}p()}l()},"commitRename"),X=d(r=>{e.pinned.has(r)?e.pinned.delete(r):e.pinned.add(r),ne(e.pinned),g()},"togglePin"),w=d(r=>{const n=M(e.lines,r);n<0||(e.cursor=n,e.cursorKey=P(e.lines[n]))},"moveTo"),B=d(r=>[...r].filter(n=>n>=" "&&n!=="\x7F").join(""),"printable"),N=d((r,n,o,t)=>{if(n.backspace)return t(o().slice(0,-1)),!0;if(n.ctrl||n.meta)return!0;const i=B(r);return i!==""&&t(o()+i),!0},"onText"),J=d((r,n)=>{const o={input:r,...n};if(e.help){e.help=!1,l();return}if(e.rename!==null){if(n.escape)e.rename=null,e.renameTarget=null;else if(n.return){W();return}else N(r,n,()=>e.rename??"",i=>{e.rename=i});l();return}if(e.inputFocused){if(c("crtr.dashboard.input-cancel",o))e.inputFocused=!1;else if(c("crtr.dashboard.input-submit",o)){G();return}else c("crtr.dashboard.directory-next",o)?e.dirIndex=(e.dirIndex+1)%e.dirs.length:c("crtr.dashboard.directory-previous",o)?e.dirIndex=(e.dirIndex-1+e.dirs.length)%e.dirs.length:N(r,n,()=>e.inputText,i=>{e.inputText=i});l();return}if(e.confirmClose!==null){const i=e.confirmClose;if(c("crtr.dashboard.confirm-close",o)){O(i);return}c("crtr.dashboard.cancel-close",o)&&(e.confirmClose=null,l());return}const t=U();if(c("crtr.dashboard.down",o))w(D(e.lines,e.cursor,1));else if(c("crtr.dashboard.up",o))w(D(e.lines,e.cursor,-1));else if(c("crtr.dashboard.first",o))w(0);else if(c("crtr.dashboard.last",o))w(e.lines.length-1);else if(c("crtr.dashboard.expand",o))t?.kind==="root"&&t.row.children.length>0&&(e.expanded.add(t.id),g());else if(c("crtr.dashboard.collapse",o)){if(t!==void 0&&t.kind!=="heading"){const i=b(t);e.expanded.delete(i),e.cursorKey=`root:${i}`,g()}}else if(c("crtr.dashboard.open",o)){t!==void 0&&z(t);return}else if(c("crtr.dashboard.pin",o)){const i=t===void 0?null:b(t);i!==null&&X(i)}else if(c("crtr.dashboard.rename",o)){const i=t===void 0?null:b(t);i!==null&&(e.renameTarget=i,e.rename=e.rows.find(a=>a.node_id===i)?.name??"")}else if(c("crtr.dashboard.close",o)){const i=t===void 0?null:b(t),a=i===null?void 0:e.rows.find(T=>T.node_id===i);if(a!==void 0)if(a.running_count>0)e.confirmClose=a.node_id;else{O(a.node_id);return}}else c("crtr.dashboard.profile",o)?s.profileId!==void 0&&(e.scope=e.scope==="profile"?"all":"profile",p()):c("crtr.dashboard.input",o)?(e.inputFocused=!0,H()):c("crtr.dashboard.help",o)&&(e.help=!0);l()},"onKey");de(),l(),p(),setInterval(()=>{p()},ge),setInterval(A,we),process.stdout.on("resize",l),await new Promise(()=>{process.stdin.on("data",r=>{try{const{input:n,key:o}=te(r);J(n,o)}catch(n){u(`internal error: ${n.message}`),l()}})})}d(Oe,"runDashboard");export{Oe as runDashboard};
1
+ var Q=Object.defineProperty;var d=(s,f)=>Q(s,"name",{value:f,configurable:!0});import{projectPaths as V}from"../../api/dto/profiles.js";import{mkdtempSync as q,readFileSync as Y,rmSync as E,existsSync as Z}from"node:fs";import{tmpdir as ee}from"node:os";import{join as F}from"node:path";import{cliClient as re}from"../../commands/api-client.js";import{loadPins as ne,savePins as oe}from"../../core/canvas/browse/pins.js";import{detectColorCaps as ie}from"../../core/tui/draw.js";import{getTerminalSize as te,parseKeypress as se,restoreTerminal as de,setupTerminal as le}from"../../core/tui/terminal.js";import{getPaneOption as ce,runShellInBackground as ae,setPaneOption as C,shellQuote as h}from"../../core/runtime/placement-tmux.js";import{matchesTerminalInput as fe,resolveUserKeybindings as ue}from"../../core/keybindings/index.js";import{VIEWER_OWNER_OPTION as S}from"../attach/session/pane-tag.js";import{buildLines as pe,nearestSelectable as M,placements as me,rootOf as b,stepSelectable as j}from"./model.js";import{listHeight as he,renderDashboard as ge}from"./render.js";const we=2e3,be=250,xe=6e3;function P(s){return s.kind==="heading"?null:s.kind==="root"?`root:${s.id}`:`child:${s.rootId}:${s.id}`}d(P,"lineKey");async function Ee(s){const f=process.env.TMUX_PANE;if(f===void 0||f==="")throw new Error("the dashboard runs in a tmux pane (TMUX_PANE is unset)");const m=re(),D=ue(),R=ie(),c=d((r,n)=>fe(D,r,n),"matches"),k=String(process.pid);C(f,S,k);for(const r of["@crtr_node","@crtr_attach","@crtr_viewer_at"])C(f,r,"");const K=q(F(ee(),"crtr-dashboard-"));let x=!1;const L=d(()=>{if(!x){x=!0;try{de()}catch{}ce(f,S)===k&&C(f,S,"");try{E(K,{recursive:!0,force:!0})}catch{}}},"cleanup");process.once("exit",L);for(const r of["SIGTERM","SIGHUP"])process.once(r,()=>{L(),process.exit(0)});const e={rows:[],placed:new Map,pinned:ne(),expanded:new Set,lines:[],cursorKey:null,cursor:0,scroll:0,scope:s.profileId===void 0?"all":"profile",profileLabel:s.profileId??"",loaded:!1,help:!1,inputFocused:!1,inputText:"",dirs:[s.cwd],dirIndex:0,dirsLoaded:!1,rename:null,renameTarget:null,confirmClose:null,notice:null,opening:null},I=new Set;let v;const u=d(r=>{e.notice=r,v!==void 0&&clearTimeout(v),v=setTimeout(()=>{e.notice=null,l()},xe)},"notify"),g=d(()=>{const r=e.rows.filter(t=>!I.has(t.node_id));e.lines=pe(r,e.placed,e.pinned,e.expanded);const n=e.cursorKey===null?-1:e.lines.findIndex(t=>P(t)===e.cursorKey);e.cursor=n>=0?n:M(e.lines,e.cursor),e.cursor<0&&(e.cursor=0);const o=e.lines[e.cursor];e.cursorKey=o===void 0?null:P(o)},"rebuild"),l=d(()=>{if(x)return;const r=te(),n=he(r.rows)-1;e.cursor<e.scroll&&(e.scroll=e.cursor),e.cursor>=e.scroll+n&&(e.scroll=e.cursor-n+1),e.scroll<0&&(e.scroll=0),process.stdout.write(ge({lines:e.lines,cursor:e.cursor,scroll:e.scroll,pinned:e.pinned,scope:e.scope,profileLabel:e.profileLabel,rename:e.rename,inputText:e.inputText,inputFocused:e.inputFocused,chipDir:e.dirs[e.dirIndex]??s.cwd,confirmName:e.confirmClose===null?null:e.rows.find(o=>o.node_id===e.confirmClose)?.name??e.confirmClose,notice:e.notice,opening:e.opening!==null,help:e.help,loaded:e.loaded},r,R))},"paint");let $=!1,y=!1;const p=d(async()=>{if($){y=!0;return}$=!0;try{const r=await m.liveRoots(e.scope==="profile"&&s.profileId!==void 0?{profile:s.profileId}:{});e.rows=r.rows,e.placed=me(r.rows,e.placed),e.loaded=!0,g()}catch(r){u(`refresh failed: ${r.message}`)}finally{$=!1}l(),y&&(y=!1,p())},"poll");s.profileId!==void 0&&m.getProfile(s.profileId).then(r=>{e.profileLabel=r.name,l()}).catch(()=>{});const U=d(()=>e.lines[e.cursor],"current"),z=d(r=>{if(e.opening!==null||r.kind==="heading")return;const o=(r.kind==="root"?r.row:e.rows.find(_=>_.node_id===r.rootId)?.children.find(_=>_.node_id===r.id))?.name??r.id,t=r.kind==="root"&&r.row.asks>0?r.row.first_ask_ticket_id:null,i=F(K,`open-${Date.now()}`),T=`{ ${["crtr","surface","node","focus",r.id,"--pane",f,"--in-place","--keep-other-viewers",...t===null?[]:["--open-ticket",t],"--json"].map(h).join(" ")} >${h(`${i}.out`)} 2>${h(`${i}.err`)}; echo $? >${h(`${i}.code`)} && mv ${h(`${i}.code`)} ${h(i)}; } 2>/dev/null; exit 0`;if(!ae(T)){u(`could not open ${o}`),l();return}e.opening={file:i,name:o},l()},"open"),A=d(()=>{const r=e.opening;if(r===null||!Z(r.file))return;const n=d(a=>{try{return Y(a,"utf8").trim()}catch{return""}},"read"),o=n(r.file),t=n(`${r.file}.out`),i=n(`${r.file}.err`);for(const a of[r.file,`${r.file}.out`,`${r.file}.err`])E(a,{force:!0});if(e.opening=null,o!=="0")u(i===""?`could not open ${r.name}`:i.split(`
2
+ `)[0]);else{let a=!1;try{a=JSON.parse(t).focused===!0}catch{a=!1}a||u(`could not open ${r.name}`)}l(),p()},"finishOpen"),G=d(async()=>{const r=e.inputText.trim();if(r!==""){try{await m.createNode({root:!0,prompt:r,cwd:e.dirs[e.dirIndex]??s.cwd,...s.profileId===void 0?{}:{profile:s.profileId}}),e.inputText="",e.inputFocused=!1,p()}catch(n){u(`could not start: ${n.message}`)}l()}},"startConversation"),H=d(()=>{e.dirsLoaded||s.profileId===void 0||(e.dirsLoaded=!0,m.getProfile(s.profileId).then(r=>{e.dirs=[s.cwd,...V(r.projects).filter(n=>n!==s.cwd)],l()}).catch(r=>{u(`could not list directories: ${r.message}`),l()}))},"loadDirs"),O=d(async r=>{e.confirmClose=null,I.add(r),g(),l();try{await m.closeNode(r,{finish:!0})}catch(n){u(`could not close: ${n.message}`)}finally{I.delete(r)}p(),l()},"doClose"),W=d(async()=>{const r=e.renameTarget,n=(e.rename??"").trim();if(e.rename=null,e.renameTarget=null,r!==null&&n!==""){try{await m.patchConfig(r,{name:n})}catch(o){u(`could not rename: ${o.message}`)}p()}l()},"commitRename"),X=d(r=>{e.pinned.has(r)?e.pinned.delete(r):e.pinned.add(r),oe(e.pinned),g()},"togglePin"),w=d(r=>{const n=M(e.lines,r);n<0||(e.cursor=n,e.cursorKey=P(e.lines[n]))},"moveTo"),B=d(r=>[...r].filter(n=>n>=" "&&n!=="\x7F").join(""),"printable"),N=d((r,n,o,t)=>{if(n.backspace)return t(o().slice(0,-1)),!0;if(n.ctrl||n.meta)return!0;const i=B(r);return i!==""&&t(o()+i),!0},"onText"),J=d((r,n)=>{const o={input:r,...n};if(e.help){e.help=!1,l();return}if(e.rename!==null){if(n.escape)e.rename=null,e.renameTarget=null;else if(n.return){W();return}else N(r,n,()=>e.rename??"",i=>{e.rename=i});l();return}if(e.inputFocused){if(c("crtr.dashboard.input-cancel",o))e.inputFocused=!1;else if(c("crtr.dashboard.input-submit",o)){G();return}else c("crtr.dashboard.directory-next",o)?e.dirIndex=(e.dirIndex+1)%e.dirs.length:c("crtr.dashboard.directory-previous",o)?e.dirIndex=(e.dirIndex-1+e.dirs.length)%e.dirs.length:N(r,n,()=>e.inputText,i=>{e.inputText=i});l();return}if(e.confirmClose!==null){const i=e.confirmClose;if(c("crtr.dashboard.confirm-close",o)){O(i);return}c("crtr.dashboard.cancel-close",o)&&(e.confirmClose=null,l());return}const t=U();if(c("crtr.dashboard.down",o))w(j(e.lines,e.cursor,1));else if(c("crtr.dashboard.up",o))w(j(e.lines,e.cursor,-1));else if(c("crtr.dashboard.first",o))w(0);else if(c("crtr.dashboard.last",o))w(e.lines.length-1);else if(c("crtr.dashboard.expand",o))t?.kind==="root"&&t.row.children.length>0&&(e.expanded.add(t.id),g());else if(c("crtr.dashboard.collapse",o)){if(t!==void 0&&t.kind!=="heading"){const i=b(t);e.expanded.delete(i),e.cursorKey=`root:${i}`,g()}}else if(c("crtr.dashboard.open",o)){t!==void 0&&z(t);return}else if(c("crtr.dashboard.pin",o)){const i=t===void 0?null:b(t);i!==null&&X(i)}else if(c("crtr.dashboard.rename",o)){const i=t===void 0?null:b(t);i!==null&&(e.renameTarget=i,e.rename=e.rows.find(a=>a.node_id===i)?.name??"")}else if(c("crtr.dashboard.close",o)){const i=t===void 0?null:b(t),a=i===null?void 0:e.rows.find(T=>T.node_id===i);if(a!==void 0)if(a.running_count>0)e.confirmClose=a.node_id;else{O(a.node_id);return}}else c("crtr.dashboard.profile",o)?s.profileId!==void 0&&(e.scope=e.scope==="profile"?"all":"profile",p()):c("crtr.dashboard.input",o)?(e.inputFocused=!0,H()):c("crtr.dashboard.help",o)&&(e.help=!0);l()},"onKey");le(),l(),p(),setInterval(()=>{p()},we),setInterval(A,be),process.stdout.on("resize",l),await new Promise(()=>{process.stdin.on("data",r=>{try{const{input:n,key:o}=se(r);J(n,o)}catch(n){u(`internal error: ${n.message}`),l()}})})}d(Ee,"runDashboard");export{Ee as runDashboard};
@@ -1,2 +1,2 @@
1
- var l=Object.defineProperty;var a=(e,t)=>l(e,"name",{value:t,configurable:!0});import{defineLeaf as f}from"../../core/command.js";import{usage as i}from"../../core/errors.js";import{SHARE_VERBS as d}from"../../api/dto/permissions.js";import{routes as c}from"../../api/routes.js";import{cliClient as h,rethrowAsCliError as u}from"../api-client.js";import{REF_CONSTRAINT as v}from"./read.js";function j(e){if(e==="everyone")return"user:*";if(!/^(user|team):[^\s:*]+$/.test(e))throw i(`\`${e}\` is not a subject`,{field:"subject",received:e,next:"Use `user:<id>`, `team:<id>` or `everyone`."});return e}a(j,"subjectOf");const q=f({name:"share",description:"share an object you own with a person, a team or everyone, take the share back, or list who it is shared with",whenToUse:"another person (or a directory team, or everyone) should read, edit, message or use something you own \u2014 a document, a node, an environment. Only the owner and the owner\u2019s agents can share; someone a thing was shared with cannot pass it on.",help:{name:"canvas share",summary:"give a person, team or everyone one permission on an object; `--revoke` removes it; with only the object, lists its shares",params:[{kind:"positional",name:"object",required:!0,constraint:v},{kind:"positional",name:"verb",required:!1,constraint:"Omit with the subject to list the object\u2019s shares. `read` (any object), `edit` (documents), `message` (nodes and profiles: attach, drive, interrupt and read in full; the owner pays for the turns), `use` (environments)."},{kind:"positional",name:"subject",required:!1,constraint:"`user:<id>`, `team:<id>` (a directory team) or `everyone`. `everyone` takes only `read` and needs an install that has joined the directory."},{kind:"flag",name:"revoke",type:"bool",required:!1,constraint:"Remove the share instead of adding it. Takes effect on the next check: a connected viewer is closed and watchers stop receiving events."}],output:[{name:"result",type:"string",required:!0,constraint:"What was shared or revoked, or that it already held; or one line per share (verb, subject, who wrote it, when) for the list."}],outputKind:"object",effects:["With a verb and subject, writes or deletes one permission fact on the object; it applies to everything the object owns, and the object publishes `relation.written` or `relation.deleted`."]},run:a(async e=>{const t=e.object,r=e.verb,s=e.subject;if(r===void 0||s===void 0){if(r!==void 0||e.revoke===!0)throw i("`share` needs a verb and a subject",{field:"subject",next:"Give `<object> <verb> <subject>`, or only `<object>` to list its shares."});try{return{list:!0,...await h().request("GET",c.objectShares(t))}}catch(n){u(n)}}if(!d.includes(r))throw i(`\`${r}\` is not a share verb`,{field:"verb",received:r,next:`Use one of ${d.join(", ")}.`});const o=j(s);try{const n=h();if(e.revoke===!0){const b=new URLSearchParams({verb:r,subject:o});return{revoked:!0,...await n.request("DELETE",`${c.objectShares(t)}?${b}`)}}const m={verb:r,subject:o};return{revoked:!1,...await n.request("POST",c.objectShares(t),m)}}catch(n){u(n)}},"run"),render:a(e=>{if(e.list===!0){const o=e;return o.items.length===0?`[[${o.name}]] is shared with no one.`:[`[[${o.name}]] is shared with:`,...o.items.map(n=>`- ${n.subject==="user:*"?"everyone":n.subject} can ${n.verb} (written by ${n.written_by}, ${n.created_at})`)].join(`
2
- `)}const t=e,r=t.subject==="user:*"?"everyone":t.subject,s=Object.entries({reader:"read",editor:"edit",messenger:"message",user_of:"use"}).find(([o])=>o===t.relation)?.[1]??t.relation;return t.revoked?t.changed?`Revoked ${s} on [[${t.name}]] from ${r}.`:`${r} held no ${s} share on [[${t.name}]].`:t.changed?`Shared [[${t.name}]]: ${r} can ${s} it.`:`${r} could already ${s} [[${t.name}]].`},"render")});export{q as shareLeaf};
1
+ var b=Object.defineProperty;var a=(e,t)=>b(e,"name",{value:t,configurable:!0});import{defineLeaf as f}from"../../core/command.js";import{usage as i}from"../../core/errors.js";import{SHARE_VERBS as c}from"../../api/dto/permissions.js";import{routes as d}from"../../api/routes.js";import{cliClient as h,rethrowAsCliError as u}from"../api-client.js";import{REF_CONSTRAINT as v}from"./read.js";function j(e){if(e==="everyone")return"user:*";if(!/^(user|team|group):[^\s:*]+$/.test(e))throw i(`\`${e}\` is not a subject`,{field:"subject",received:e,next:"Use `user:<id>`, `team:<id>`, `group:<handle>` or `everyone`."});return e}a(j,"subjectOf");const q=f({name:"share",description:"share an object you own with a person, a team or everyone, take the share back, or list who it is shared with",whenToUse:"another person (or a directory team, or everyone) should read, edit, message or use something you own \u2014 a document, a node, an environment. Only the owner and the owner\u2019s agents can share; someone a thing was shared with cannot pass it on.",help:{name:"canvas share",summary:"give a person, team or everyone one permission on an object; `--revoke` removes it; with only the object, lists its shares",params:[{kind:"positional",name:"object",required:!0,constraint:v},{kind:"positional",name:"verb",required:!1,constraint:"Omit with the subject to list the object\u2019s shares. `read` (any object), `edit` (documents, and repos a group holds), `message` (nodes and profiles: attach, drive, interrupt and read in full; the owner pays for the turns), `use` (environments)."},{kind:"positional",name:"subject",required:!1,constraint:"`user:<id>`, `team:<id>` (a directory team), `group:<handle>` (a group you keep with `crtr repo group`) or `everyone`. `everyone` takes only `read` and needs an install that has joined the directory."},{kind:"flag",name:"revoke",type:"bool",required:!1,constraint:"Remove the share instead of adding it. Takes effect on the next check: a connected viewer is closed and watchers stop receiving events."}],output:[{name:"result",type:"string",required:!0,constraint:"What was shared or revoked, or that it already held; or one line per share (verb, subject, who wrote it, when) for the list."}],outputKind:"object",effects:["With a verb and subject, writes or deletes one permission fact on the object; it applies to everything the object owns, and the object publishes `relation.written` or `relation.deleted`."]},run:a(async e=>{const t=e.object,r=e.verb,s=e.subject;if(r===void 0||s===void 0){if(r!==void 0||e.revoke===!0)throw i("`share` needs a verb and a subject",{field:"subject",next:"Give `<object> <verb> <subject>`, or only `<object>` to list its shares."});try{return{list:!0,...await h().request("GET",d.objectShares(t))}}catch(o){u(o)}}if(!c.includes(r))throw i(`\`${r}\` is not a share verb`,{field:"verb",received:r,next:`Use one of ${c.join(", ")}.`});const n=j(s);try{const o=h();if(e.revoke===!0){const l=new URLSearchParams({verb:r,subject:n});return{revoked:!0,...await o.request("DELETE",`${d.objectShares(t)}?${l}`)}}const m={verb:r,subject:n};return{revoked:!1,...await o.request("POST",d.objectShares(t),m)}}catch(o){u(o)}},"run"),render:a(e=>{if(e.list===!0){const n=e;return n.items.length===0?`[[${n.name}]] is shared with no one.`:[`[[${n.name}]] is shared with:`,...n.items.map(o=>`- ${o.subject==="user:*"?"everyone":o.subject} can ${o.verb} (written by ${o.written_by}, ${o.created_at})`)].join(`
2
+ `)}const t=e,r=t.subject==="user:*"?"everyone":t.subject,s=Object.entries({reader:"read",editor:"edit",messenger:"message",user_of:"use"}).find(([n])=>n===t.relation)?.[1]??t.relation;return t.revoked?t.changed?`Revoked ${s} on [[${t.name}]] from ${r}.`:`${r} held no ${s} share on [[${t.name}]].`:t.changed?`Shared [[${t.name}]]: ${r} can ${s} it.`:`${r} could already ${s} [[${t.name}]].`},"render")});export{q as shareLeaf};
@@ -1,7 +1,7 @@
1
1
  import type { FlagParam } from '../../core/help.js';
2
2
  import type { DocOwnerFlag } from '../../api/dto/docs.js';
3
3
  export declare const REF_CONSTRAINT = "A document name (with or without [[ ]]) or a raw object id.";
4
- export declare const OWNER_VALUES = "node | user | profile | profile:<name> | app | repo | repo:<handle>";
4
+ export declare const OWNER_VALUES = "node | user | profile | profile:<name> | app | repo | repo:<handle> | group:<handle>";
5
5
  export declare function ownerParam(constraint: string): FlagParam;
6
6
  export declare function ruleParam(constraint: string): FlagParam;
7
7
  /** The `--preview` contract on write and edit: for most readers the line is all they see. */
@@ -1,2 +1,2 @@
1
- var w=Object.defineProperty;var o=(e,t)=>w(e,"name",{value:t,configurable:!0});import{usage as m}from"../../core/errors.js";import{ApiError as y}from"../../api/errors.js";import{rethrowAsCliError as l}from"../api-client.js";import{RULE_ON as g,RULE_DELIVER as v,DOC_KINDS as b}from"../../api/dto/docs.js";import{PRIVACY_LEVELS_DTO as k}from"../../api/dto/objects.js";const j="A document name (with or without [[ ]]) or a raw object id.",p="node | user | profile | profile:<name> | app | repo | repo:<handle>";function O(e){return{kind:"flag",name:"owner",type:"string",required:!1,constraint:e,focusedHelp:{whenToUse:"Omit it for a document only this node and the nodes it points at need: the writing node owns it and it is deleted with the node, unless a kept document links to it. Give another owner when the document must outlive this node or reach other nodes by itself. A document worth another owner carries reusable current truth: a non-obvious procedure, a gotcha, a lasting preference, a convention across repos. Task notes, conversation summaries and facts the repo already records stay with the node or are not written. Before writing one, search for a document that already covers it (`crtr canvas search`) and revise that one with `crtr doc edit` instead of adding a near copy. When one document grows long, keep the most important content in it and move separate subjects into documents named under it (`topic/part`), each pointed at with a `[[link]]`. Choose the narrowest owner that still reaches the next agent who needs it.",value:`One of ${p}. \`node\` \u2014 the writing node; only this node loads it by rule, other nodes read it when pointed at it; deleted with the node. \`profile\` \u2014 the node's profile, or \`profile:<name>\`; loads for nodes running in that profile; stays on this runtime. \`app\` \u2014 the app that runs the node; kept until deleted; readable by that app's nodes. \`repo\` \u2014 the repo the node works in (from its working directory), or \`repo:<handle>\` for another repo whose checkout the node's file permissions let it write (such as a project of its profile); every clone and worktree of the repo shares it, and it syncs to collaborators over the repo's \`refs/crtr/docs\`. A repo owns only public documents: a private document that should load in one repo is owned by \`user\` and carries a rule with \`if: {"repo": "<handle>"}\`. \`user\` \u2014 you, the person; loads for every node by its rules; readable by apps by privacy level. Default: the writing node; a person's own run (not a node) defaults to \`user\`. The owner becomes the start of the document's full name (\`<owner-handle>/<name>\`); \`crtr doc move --owner\` changes it later and keeps the id and every link.`,effects:["Decides who may read and change the document, where it syncs, and what deleting takes it with."]}}}o(O,"ownerParam");const x="`if` is a condition on the receiving node. Fields: `kind`, `mode`, `lifecycle`, `cwd`, `repo` (the handle of a repo the node is eligible for: those enclosing its cwd and those of its profile's projects; use `cwd` for where it works), `profile`, `depth`. A field map is ANDed across fields; dotted fields resolve nested values. A scalar matches by equality (a list value matches when any element is equal); a list matcher matches by membership or overlap; an object matcher takes `eq`, `ne`, `in`, `nin`, `exists`, `contains`, `containsAll`, `containsAny`, `matches`, `imatches`, `gt`, `gte`, `lt`, `lte`. `all`, `any` and `not` combine conditions; field matchers beside them are ANDed in. An empty condition always matches; an unknown operator never matches. `match_frontmatter` uses the same language against the read file's YAML frontmatter.",A=`One JSON object per occurrence: \`{"on": \u2026, "match"?: [globs], "match_frontmatter"?: {\u2026}, "if"?: {\u2026}, "deliver": \u2026}\`; the flag set replaces the document's whole rule list. Whether to give one follows the owner. A document the writing node owns (the default) takes none: its rules fire only in that node, and other nodes reach it through the \`[[link]]\` that carries it. A document under any other owner needs one unless a document that already loads links to it: with neither, it is found only by a search that happens to match it, and the result says so. Choose the narrowest trigger that reaches the next agent who needs it, because every rule costs context in every node it fires on: \`file-read\` with a real glob for knowledge about specific code, \`command\` or \`pre-command\` for knowledge about a command, \`boot\` only for a person, preference or process with no file or command boundary. Deliver \`preview\` by default; \`content\` when the whole document is about one sentence (a preview line would be longer than it) or must always be followed. \`on\` is the node's activity: ${g.join(" | ")}. \`boot\` \u2014 every session start of the node. \`workspace-open\` \u2014 the node's first message when it works in the document's repo. \`file-read\` \u2014 the node reads the content of a file whose absolute path or basename matches a \`match\` glob, or whose frontmatter matches \`match_frontmatter\`; through the Read tool, or a bash segment of \`cat\`, \`sed\` (not \`-i\`), \`head\`, \`tail\` (not \`-f\`), \`nl\` or \`awk\` on a literal path (resolved after the command's own \`cd\`s; \`rg\`, \`grep\`, \`find\`, \`ls\`, \`wc\`, \`stat\` are searches, not reads, and never fire it). \`document-read\` \u2014 another document whose name matches is delivered at content, including an explicit read. \`command\` \u2014 a shell segment of a bash command matches (segments split on \`&&\`, \`||\`, \`;\`, \`|\` and newlines outside quotes, leading \`VAR=value\` dropped; \`*\` spans whole whitespace-separated tokens, \`?\` one character, quoted text is opaque). \`pre-command\` \u2014 as \`command\`, but runs before the command: when the node has not read the document, the command does not run and the document is returned instead; the node re-issues the command. \`slash-command\` \u2014 the document is a \`/<name>\` slash command whose body is the injected prompt. \`match\` is required on \`file-read\` (unless \`match_frontmatter\` is given), \`document-read\`, \`command\` and \`pre-command\`, and not allowed on \`boot\`, \`workspace-open\` and \`slash-command\`. `+x+` \`deliver\` is ${v.join(" | ")}: the bare name, the preview line, or the whole body. When several rules deliver one document to a node, the highest wins, and content already in the node's context is not delivered again. A content delivery is a read: the node becomes a watcher and is pushed later edits. The profile's delivery limit per owner caps what \`boot\` and \`workspace-open\` rules deliver for that owner.`;function T(e){return{kind:"flag",name:"rule",type:"string",required:!1,repeatable:!0,constraint:`${e} ${A}`}}o(T,"ruleParam");const D="One line, shown wherever the document is listed or delivered without its body. For most readers it is all they see, so it alone decides whether the document is opened. Write it as \"When <situation in the reader's work>, read this because <what it prevents or what the reader gains>\". Name the situation in the words the reader's task will contain (the request, file, command or symptom), not the document's topic; when a neighbouring document covers a similar situation, say which one this is not for. A rule that delivers at `preview` requires this shape, and `crtr doc lint` checks it.",S={preview:o(e=>({kind:"flag",name:"preview",type:"string",required:!1,constraint:e}),"preview"),kind:{kind:"flag",name:"kind",type:"enum",choices:[...b],required:!1,constraint:"knowledge is consulted for facts or procedures; preference directs behavior. Default knowledge."},summary:{kind:"flag",name:"summary",type:"string",required:!1,constraint:"A very short version of the content, shown in `crtr canvas list`."},privacy:o(e=>({kind:"flag",name:"privacy",type:"enum",choices:[...k],required:!1,constraint:e}),"privacy"),whyItExists:{kind:"flag",name:"why-it-exists",type:"string",required:!1,constraint:"The observed failure this document exists to prevent; shown only with `crtr canvas read --fields`."},unlisted:o(e=>({kind:"flag",name:"unlisted",type:"bool",required:!1,constraint:e}),"unlisted"),lintIgnore:{kind:"flag",name:"lint-ignore",type:"string",required:!1,repeatable:!0,constraint:"A `crtr doc lint` rule name to skip for this document."},extension:{kind:"flag",name:"extension",type:"string",required:!1,repeatable:!0,constraint:"One declared plugin field as `<plugin>.<field>=<json value>`."}};function c(e){return e===void 0?[]:Array.isArray(e)?e.map(String):[String(e)]}o(c,"list");function I(e){const t=[],n={};for(const[r,a]of[["preview","preview"],["kind","kind"],["summary","summary"],["privacy","privacy"],["whyItExists","why_it_exists"]])typeof e[r]=="string"&&(n[a]=e[r]);typeof n.preview=="string"&&/[\r\n]/.test(n.preview)&&t.push("--preview must be one line"),e.unlisted===!0&&(n.unlisted=!0);const i=c(e.lintIgnore);i.length>0&&(n.lint_ignore=i);const s=c(e.rule);if(s.length>0){const r=[];s.forEach((a,u)=>{try{const d=JSON.parse(a);typeof d!="object"||d===null||Array.isArray(d)?t.push(`--rule #${u+1} must be a JSON object`):r.push(d)}catch{t.push(`--rule #${u+1} is not valid JSON: ${a}`)}}),n.rules=r}const h={};for(const r of c(e.extension)){const a=/^([^.=]+)\.([^=]+)=(.*)$/s.exec(r);if(!a){t.push(`--extension ${r} is not <plugin>.<field>=<json value>`);continue}try{(h[a[1]]??={})[a[2]]=JSON.parse(a[3])}catch{t.push(`--extension ${r}: the value after = is not valid JSON`)}}if(Object.keys(h).length>0&&(n.extensions=h),t.length>0)throw m(t.join("; "),{next:"Fix every value above and rerun; `-h` on this leaf gives the rule grammar."});return n}o(I,"fieldsFromInput");function L(e){const t=e.owner;if(t===void 0)return{};const n=String(t);if(!/^(node|user|profile|app|repo)$|^(profile|repo):.+$/.test(n))throw m(`invalid --owner ${n}`,{field:"owner",next:`Pass one of ${p}.`});return{owner:n}}o(L,"ownerFromInput");function C(e,t){e instanceof y&&(e.code==="read_first"&&l(e,`Read it first with \`crtr canvas read ${t}\`, then rerun the edit.`),e.code==="stale_revision"&&l(e,`Someone edited it after your read. Read it again with \`crtr canvas read ${t}\`, make your change on the current text, and rerun the edit.`)),l(e)}o(C,"rethrowDocError");const f="Give it a --rule with `crtr doc edit`, link it from a document that loads, or accept it with `--lint-ignore unreached`.",U=`Present and true when the document is owned by someone other than a node, has no rule, and no document with a rule links to it: no agent will be routed to it. ${f}`;function F(e){const t=[];e.unreached===!0&&t.push(`Unreached: this document has no rule and no document with a rule links to it, so no agent will be routed to it. ${f}`);const n=e.unresolved_links,i=e.remote_links;return n?.length&&t.push(`Unresolved links (no document by these names yet): ${n.map(s=>`[[${s}]]`).join(", ")}`),i?.length&&t.push(`Not on this runtime: ${i.map(s=>`[[${s}]]`).join(", ")} \u2014 each may be on another runtime, or the name may be misspelled.`),t.map(s=>`
1
+ var w=Object.defineProperty;var o=(e,t)=>w(e,"name",{value:t,configurable:!0});import{usage as m}from"../../core/errors.js";import{ApiError as g}from"../../api/errors.js";import{rethrowAsCliError as l}from"../api-client.js";import{RULE_ON as y,RULE_DELIVER as v,DOC_KINDS as b}from"../../api/dto/docs.js";import{PRIVACY_LEVELS_DTO as k}from"../../api/dto/objects.js";const j="A document name (with or without [[ ]]) or a raw object id.",p="node | user | profile | profile:<name> | app | repo | repo:<handle> | group:<handle>";function O(e){return{kind:"flag",name:"owner",type:"string",required:!1,constraint:e,focusedHelp:{whenToUse:"Omit it for a document only this node and the nodes it points at need: the writing node owns it and it is deleted with the node, unless a kept document links to it. Give another owner when the document must outlive this node or reach other nodes by itself. A document worth another owner carries reusable current truth: a non-obvious procedure, a gotcha, a lasting preference, a convention across repos. Task notes, conversation summaries and facts the repo already records stay with the node or are not written. Before writing one, search for a document that already covers it (`crtr canvas search`) and revise that one with `crtr doc edit` instead of adding a near copy. When one document grows long, keep the most important content in it and move separate subjects into documents named under it (`topic/part`), each pointed at with a `[[link]]`. Choose the narrowest owner that still reaches the next agent who needs it.",value:`One of ${p}. \`node\` \u2014 the writing node; only this node loads it by rule, other nodes read it when pointed at it; deleted with the node. \`profile\` \u2014 the node's profile, or \`profile:<name>\`; loads for nodes running in that profile; stays on this runtime. \`app\` \u2014 the app that runs the node; kept until deleted; readable by that app's nodes. \`repo\` \u2014 the repo the node works in (from its working directory), or \`repo:<handle>\` for another repo whose checkout the node's file permissions let it write (such as a project of its profile); every clone and worktree of the repo shares it, and it syncs to collaborators over the repo's \`refs/crtr/docs\`. A repo owns only public documents: a private document that should load in one repo is owned by \`user\` and carries a rule with \`if: {"repo": "<handle>"}\`. \`user\` \u2014 you, the person; loads for every node by its rules; readable by apps by privacy level. Default: the writing node; a person's own run (not a node) defaults to \`user\`. The owner becomes the start of the document's full name (\`<owner-handle>/<name>\`); \`crtr doc move --owner\` changes it later and keeps the id and every link.`,effects:["Decides who may read and change the document, where it syncs, and what deleting takes it with."]}}}o(O,"ownerParam");const x="`if` is a condition on the receiving node. Fields: `kind`, `mode`, `lifecycle`, `cwd`, `repo` (the handle of a repo the node is eligible for: those enclosing its cwd and those of its profile's projects; use `cwd` for where it works), `profile`, `depth`. A field map is ANDed across fields; dotted fields resolve nested values. A scalar matches by equality (a list value matches when any element is equal); a list matcher matches by membership or overlap; an object matcher takes `eq`, `ne`, `in`, `nin`, `exists`, `contains`, `containsAll`, `containsAny`, `matches`, `imatches`, `gt`, `gte`, `lt`, `lte`. `all`, `any` and `not` combine conditions; field matchers beside them are ANDed in. An empty condition always matches; an unknown operator never matches. `match_frontmatter` uses the same language against the read file's YAML frontmatter.",A=`One JSON object per occurrence: \`{"on": \u2026, "match"?: [globs], "match_frontmatter"?: {\u2026}, "if"?: {\u2026}, "deliver": \u2026}\`; the flag set replaces the document's whole rule list. Whether to give one follows the owner. A document the writing node owns (the default) takes none: its rules fire only in that node, and other nodes reach it through the \`[[link]]\` that carries it. A document under any other owner needs one unless a document that already loads links to it: with neither, it is found only by a search that happens to match it, and the result says so. Choose the narrowest trigger that reaches the next agent who needs it, because every rule costs context in every node it fires on: \`file-read\` with a real glob for knowledge about specific code, \`command\` or \`pre-command\` for knowledge about a command, \`boot\` only for a person, preference or process with no file or command boundary. Deliver \`preview\` by default; \`content\` when the whole document is about one sentence (a preview line would be longer than it) or must always be followed. \`on\` is the node's activity: ${y.join(" | ")}. \`boot\` \u2014 every session start of the node. \`workspace-open\` \u2014 the node's first message when it works in the document's repo. \`file-read\` \u2014 the node reads the content of a file whose absolute path or basename matches a \`match\` glob, or whose frontmatter matches \`match_frontmatter\`; through the Read tool, or a bash segment of \`cat\`, \`sed\` (not \`-i\`), \`head\`, \`tail\` (not \`-f\`), \`nl\` or \`awk\` on a literal path (resolved after the command's own \`cd\`s; \`rg\`, \`grep\`, \`find\`, \`ls\`, \`wc\`, \`stat\` are searches, not reads, and never fire it). \`document-read\` \u2014 another document whose name matches is delivered at content, including an explicit read. \`command\` \u2014 a shell segment of a bash command matches (segments split on \`&&\`, \`||\`, \`;\`, \`|\` and newlines outside quotes, leading \`VAR=value\` dropped; \`*\` spans whole whitespace-separated tokens, \`?\` one character, quoted text is opaque). \`pre-command\` \u2014 as \`command\`, but runs before the command: when the node has not read the document, the command does not run and the document is returned instead; the node re-issues the command. \`slash-command\` \u2014 the document is a \`/<name>\` slash command whose body is the injected prompt. \`match\` is required on \`file-read\` (unless \`match_frontmatter\` is given), \`document-read\`, \`command\` and \`pre-command\`, and not allowed on \`boot\`, \`workspace-open\` and \`slash-command\`. `+x+` \`deliver\` is ${v.join(" | ")}: the bare name, the preview line, or the whole body. When several rules deliver one document to a node, the highest wins, and content already in the node's context is not delivered again. A content delivery is a read: the node becomes a watcher and is pushed later edits. The profile's delivery limit per owner caps what \`boot\` and \`workspace-open\` rules deliver for that owner.`;function T(e){return{kind:"flag",name:"rule",type:"string",required:!1,repeatable:!0,constraint:`${e} ${A}`}}o(T,"ruleParam");const D="One line, shown wherever the document is listed or delivered without its body. For most readers it is all they see, so it alone decides whether the document is opened. Write it as \"When <situation in the reader's work>, read this because <what it prevents or what the reader gains>\". Name the situation in the words the reader's task will contain (the request, file, command or symptom), not the document's topic; when a neighbouring document covers a similar situation, say which one this is not for. A rule that delivers at `preview` requires this shape, and `crtr doc lint` checks it.",S={preview:o(e=>({kind:"flag",name:"preview",type:"string",required:!1,constraint:e}),"preview"),kind:{kind:"flag",name:"kind",type:"enum",choices:[...b],required:!1,constraint:"knowledge is consulted for facts or procedures; preference directs behavior. Default knowledge."},summary:{kind:"flag",name:"summary",type:"string",required:!1,constraint:"A very short version of the content, shown in `crtr canvas list`."},privacy:o(e=>({kind:"flag",name:"privacy",type:"enum",choices:[...k],required:!1,constraint:e}),"privacy"),whyItExists:{kind:"flag",name:"why-it-exists",type:"string",required:!1,constraint:"The observed failure this document exists to prevent; shown only with `crtr canvas read --fields`."},unlisted:o(e=>({kind:"flag",name:"unlisted",type:"bool",required:!1,constraint:e}),"unlisted"),lintIgnore:{kind:"flag",name:"lint-ignore",type:"string",required:!1,repeatable:!0,constraint:"A `crtr doc lint` rule name to skip for this document."},extension:{kind:"flag",name:"extension",type:"string",required:!1,repeatable:!0,constraint:"One declared plugin field as `<plugin>.<field>=<json value>`."}};function c(e){return e===void 0?[]:Array.isArray(e)?e.map(String):[String(e)]}o(c,"list");function I(e){const t=[],n={};for(const[r,a]of[["preview","preview"],["kind","kind"],["summary","summary"],["privacy","privacy"],["whyItExists","why_it_exists"]])typeof e[r]=="string"&&(n[a]=e[r]);typeof n.preview=="string"&&/[\r\n]/.test(n.preview)&&t.push("--preview must be one line"),e.unlisted===!0&&(n.unlisted=!0);const i=c(e.lintIgnore);i.length>0&&(n.lint_ignore=i);const s=c(e.rule);if(s.length>0){const r=[];s.forEach((a,u)=>{try{const d=JSON.parse(a);typeof d!="object"||d===null||Array.isArray(d)?t.push(`--rule #${u+1} must be a JSON object`):r.push(d)}catch{t.push(`--rule #${u+1} is not valid JSON: ${a}`)}}),n.rules=r}const h={};for(const r of c(e.extension)){const a=/^([^.=]+)\.([^=]+)=(.*)$/s.exec(r);if(!a){t.push(`--extension ${r} is not <plugin>.<field>=<json value>`);continue}try{(h[a[1]]??={})[a[2]]=JSON.parse(a[3])}catch{t.push(`--extension ${r}: the value after = is not valid JSON`)}}if(Object.keys(h).length>0&&(n.extensions=h),t.length>0)throw m(t.join("; "),{next:"Fix every value above and rerun; `-h` on this leaf gives the rule grammar."});return n}o(I,"fieldsFromInput");function L(e){const t=e.owner;if(t===void 0)return{};const n=String(t);if(!/^(node|user|profile|app|repo)$|^(profile|repo):.+$/.test(n))throw m(`invalid --owner ${n}`,{field:"owner",next:`Pass one of ${p}.`});return{owner:n}}o(L,"ownerFromInput");function C(e,t){e instanceof g&&(e.code==="read_first"&&l(e,`Read it first with \`crtr canvas read ${t}\`, then rerun the edit.`),e.code==="stale_revision"&&l(e,`Someone edited it after your read. Read it again with \`crtr canvas read ${t}\`, make your change on the current text, and rerun the edit.`)),l(e)}o(C,"rethrowDocError");const f="Give it a --rule with `crtr doc edit`, link it from a document that loads, or accept it with `--lint-ignore unreached`.",U=`Present and true when the document is owned by someone other than a node, has no rule, and no document with a rule links to it: no agent will be routed to it. ${f}`;function F(e){const t=[];e.unreached===!0&&t.push(`Unreached: this document has no rule and no document with a rule links to it, so no agent will be routed to it. ${f}`);const n=e.unresolved_links,i=e.remote_links;return n?.length&&t.push(`Unresolved links (no document by these names yet): ${n.map(s=>`[[${s}]]`).join(", ")}`),i?.length&&t.push(`Not on this runtime: ${i.map(s=>`[[${s}]]`).join(", ")} \u2014 each may be on another runtime, or the name may be misspelled.`),t.map(s=>`
2
2
  ${s}`).join("")}o(F,"renderLinkReport");export{S as FIELD_FLAGS,p as OWNER_VALUES,D as PREVIEW_TEXT,j as REF_CONSTRAINT,U as UNREACHED_CONSTRAINT,I as fieldsFromInput,L as ownerFromInput,O as ownerParam,F as renderLinkReport,C as rethrowDocError,T as ruleParam};
@@ -10,3 +10,13 @@ import type { NodeFaultDTO } from '../api/dto/nodes.js';
10
10
  * the runaway subprocess; see `wedged-child-on-runaway-bash`). */
11
11
  export declare function isNowEligibleFault(fault: NodeFaultDTO | null): boolean;
12
12
  export declare const nodeReviveLeaf: LeafDef;
13
+ /** The leaf's output. `ready:false` after a launch is only the daemon's ~10 s wait running out, so say the broker was launched and is still starting. */
14
+ export declare function reviveReport(result: {
15
+ resumed: boolean;
16
+ revived: boolean;
17
+ ready?: boolean;
18
+ }): {
19
+ message?: string | undefined;
20
+ ready?: boolean | undefined;
21
+ resumed: boolean;
22
+ };
@@ -1 +1 @@
1
- var v=Object.defineProperty;var d=(e,r)=>v(e,"name",{value:r,configurable:!0});import{defineLeaf as w}from"../core/command.js";import{InputError as t}from"../core/io.js";import{requireScope as g}from"../core/errors.js";import{cliClient as p,rethrowAsCliError as u}from"./api-client.js";import{recordedPidLiveness as k}from"../core/canvas/pid.js";import{fullName as y}from"../core/canvas/labels.js";import{faultNeedsYou as b}from"../core/canvas/status-glyph.js";function x(e){return e===null||e.link!=="pi\u2192provider"?!1:b(e)?!0:e.retry.by==="daemon"}d(x,"isNowEligibleFault");const G=w({name:"revive",description:"reopen a window for a done/idle/dead/canceled node",whenToUse:"you want to bring a dormant node back yourself \u2014 reopen a window for one that is done, idle, dead, or canceled: resume a node you closed with `node lifecycle close`, reopen a finished worker for a follow-up, or restart a crashed one now instead of waiting. It resumes the saved conversation by default, or can restart the node clean. You rarely need this for crashes \u2014 the daemon auto-revives those; reach for it to bring a node back on demand, to revive a canceled node the daemon will never touch on its own, or to kick a hanging one early (--now). To mass-reconnect EVERY disconnected node at once (after a reboot, a killed login/tmux session, or the daemon being down a while), use `canvas revive --all` instead",help:{name:"node lifecycle revive",summary:"relaunch a node's broker engine (resuming its saved conversation), or kick a hanging one (--now)",params:[{kind:"positional",name:"node",required:!0,constraint:"Node id to revive."},{kind:"flag",name:"fresh",type:"bool",required:!1,default:!1,constraint:"When set, do NOT do a true resume. If the node already has a session `.jsonl`, this instead CYCLES it in place \u2014 reuses that SAME file, resets the tree leaf, and roots a fresh `crtr-cycle` branch (a clean-context restart that still carries the file's history, output `resumed:false`). Only when no `.jsonl` exists yet does this start a genuinely brand-new session (also `resumed:false`). Default (no --fresh): a true resume \u2014 replays the existing `.jsonl` as-is (`resumed:true`)."},{kind:"flag",name:"now",type:"bool",required:!1,default:!1,constraint:'On-demand kick of an active-fault node (parked on a `pi\u2192provider` fault, broker still alive). Its broker pid is alive, so an ordinary revive no-ops (double-launch guard) \u2014 --now SIGTERMs the live broker instead, so the daemon\'s crash\u2192grace\u2192resume path brings it back in ~20s. Valid for a live `pi\u2192provider` fault that is either a daemon-owned auto retry (kicks it early), or ANY fault the canvas dashboard flags "needs you" (e.g. exhausted retries, an auth fault you just fixed) \u2014 that disposition otherwise has no recovery verb. Mutually exclusive with --fresh.'},{kind:"flag",name:"reopen",type:"bool",required:!1,default:!1,constraint:"Clear a latched node's finalization latch (final_report/finalized_at only \u2014 the old report file and every delivered feed event are untouched) before reviving it. Rejected against a node that is not finalized. Mutually exclusive with --now."}],output:[{name:"resumed",type:"boolean",required:!1,constraint:"True ONLY for a true resume (the existing `.jsonl` replayed as-is). False for a --fresh revive, whether that landed as an in-place CYCLE (an existing `.jsonl` reused with a fresh `crtr-cycle` branch \u2014 pi is still told --session, but this is not a resume) or a genuinely fresh launch (no `.jsonl` existed). Absent for a --now kick."},{name:"ready",type:"boolean",required:!1,constraint:"True when the daemon saw the node's view.sock accept a connection within ~10s of the revive \u2014 the node is attachable. It does not show the task was delivered or the model is making progress. False when it did not (still starting, broker exited, or no free broker slot). Absent for a --now kick, and when the daemon predates this field (readiness unknown)."},{name:"kicked",type:"boolean",required:!1,constraint:"True when --now SIGTERM'd the hanging node's live broker (the daemon resumes it on the saved session within ~20s). Absent for an ordinary revive."},{name:"message",type:"string",required:!1,constraint:"Kick confirmation naming the signalled node, pid, and the daemon's ~20s resume handoff. Present only for --now."}],outputKind:"object",effects:["Launches the node's detached headless broker engine (no tmux window).","Updates the node's canvas record: status=active, intent=null.","Waits up to ~10s for the daemon to see the broker's view.sock accept a connection, so `ready:true` means a caller can attach on return.","--now: SIGTERMs the live broker instead of launching anything (the daemon's own crash-grace path resumes it)."]},run:d(async e=>{g("crtr:act","crtr node lifecycle revive");const r=e.now??!1,o=e.node,l=e.fresh??!1,c=e.reopen??!1;if(r&&c)throw new t({error:"conflicting_args",message:"`--now` kicks a LIVE broker (nothing to reopen \u2014 a finalized node has no live broker); `--reopen` is meaningless there.",next:"Run `crtr node lifecycle revive <node> --now` on a hanging node, or `crtr node lifecycle revive <node> --reopen` (no --now) to re-task a finalized one."});if(r&&l)throw new t({error:"conflicting_args",message:"`--now` kicks a live hanging broker (SIGTERM \u2192 daemon resumes the SAVED session); `--fresh` is meaningless there.",next:"Run `crtr node lifecycle revive <node> --now` (resumes), or `crtr node lifecycle revive <node> --fresh` (no --now) to relaunch clean."});const h=p();if(r){let n;try{n=await h.getNode(o)}catch(m){u(m)}const i=n.pi_pid,f=n.fault??null;if(i==null||k(i,n.pi_pid_identity??null)!=="alive")throw new t({error:"not_hanging",message:`${o} has no live broker \u2014 nothing to kick. --now is for a HANGING node (live broker parked on an active fault).`,next:"Revive a dormant node with `crtr node lifecycle revive "+o+"` (no --now)."});if(!x(f))throw new t({error:"not_hanging",message:`${o} is live but has no pi\u2192provider fault eligible for --now (either healthy, or a client-owned retry / non-provider fault already being handled elsewhere) \u2014 --now refuses to SIGTERM a node that isn't stuck on a kickable provider fault.`,next:"Use --now only on a node the canvas shows as hanging (\u26A0) with a `pi\u2192provider` fault. For a routine relaunch, omit --now."});if(n.streaming===!0)throw new t({error:"busy",message:`${o} is mid-turn right now (busy) \u2014 --now refuses to SIGTERM a working engine; it has recovered on its own.`,next:"Re-check the canvas \u2014 if it's no longer marked hanging (\u26A0), nothing to do."});try{process.kill(i,"SIGTERM")}catch{}return{kicked:!0,message:`Sent SIGTERM to ${y(n)} (${o}, pid ${i}). The daemon will resume it on the saved session within ~20s (crash\u2192grace\u2192resume).`}}const s=process.env.CRTR_CRON_ID;let a;try{a=await h.reviveNode(o,{resume:!l,reopen:c,...s!==void 0&&s!==""?{cron_id:s}:{}})}catch(n){u(n)}return{resumed:a.resumed,...a.ready!==void 0?{ready:a.ready}:{}}},"run")});export{x as isNowEligibleFault,G as nodeReviveLeaf};
1
+ var v=Object.defineProperty;var i=(e,r)=>v(e,"name",{value:r,configurable:!0});import{defineLeaf as w}from"../core/command.js";import{InputError as a}from"../core/io.js";import{requireScope as g}from"../core/errors.js";import{cliClient as p,rethrowAsCliError as u}from"./api-client.js";import{recordedPidLiveness as k}from"../core/canvas/pid.js";import{fullName as y}from"../core/canvas/labels.js";import{faultNeedsYou as b}from"../core/canvas/status-glyph.js";function x(e){return e===null||e.link!=="pi\u2192provider"?!1:b(e)?!0:e.retry.by==="daemon"}i(x,"isNowEligibleFault");const j=w({name:"revive",description:"reopen a window for a done/idle/dead/canceled node",whenToUse:"you want to bring a dormant node back yourself \u2014 reopen a window for one that is done, idle, dead, or canceled: resume a node you closed with `node lifecycle close`, reopen a finished worker for a follow-up, or restart a crashed one now instead of waiting. It resumes the saved conversation by default, or can restart the node clean. You rarely need this for crashes \u2014 the daemon auto-revives those; reach for it to bring a node back on demand, to revive a canceled node the daemon will never touch on its own, or to kick a hanging one early (--now). To mass-reconnect EVERY disconnected node at once (after a reboot, a killed login/tmux session, or the daemon being down a while), use `canvas revive --all` instead",help:{name:"node lifecycle revive",summary:"relaunch a node's broker engine (resuming its saved conversation), or kick a hanging one (--now)",params:[{kind:"positional",name:"node",required:!0,constraint:"Node id to revive."},{kind:"flag",name:"fresh",type:"bool",required:!1,default:!1,constraint:"When set, do NOT do a true resume. If the node already has a session `.jsonl`, this instead CYCLES it in place \u2014 reuses that SAME file, resets the tree leaf, and roots a fresh `crtr-cycle` branch (a clean-context restart that still carries the file's history, output `resumed:false`). Only when no `.jsonl` exists yet does this start a genuinely brand-new session (also `resumed:false`). Default (no --fresh): a true resume \u2014 replays the existing `.jsonl` as-is (`resumed:true`)."},{kind:"flag",name:"now",type:"bool",required:!1,default:!1,constraint:'On-demand kick of an active-fault node (parked on a `pi\u2192provider` fault, broker still alive). Its broker pid is alive, so an ordinary revive no-ops (double-launch guard) \u2014 --now SIGTERMs the live broker instead, so the daemon\'s crash\u2192grace\u2192resume path brings it back in ~20s. Valid for a live `pi\u2192provider` fault that is either a daemon-owned auto retry (kicks it early), or ANY fault the canvas dashboard flags "needs you" (e.g. exhausted retries, an auth fault you just fixed) \u2014 that disposition otherwise has no recovery verb. Mutually exclusive with --fresh.'},{kind:"flag",name:"reopen",type:"bool",required:!1,default:!1,constraint:"Clear a latched node's finalization latch (final_report/finalized_at only \u2014 the old report file and every delivered feed event are untouched) before reviving it. Rejected against a node that is not finalized. Mutually exclusive with --now."}],output:[{name:"resumed",type:"boolean",required:!1,constraint:"True ONLY for a true resume (the existing `.jsonl` replayed as-is). False for a --fresh revive, whether that landed as an in-place CYCLE (an existing `.jsonl` reused with a fresh `crtr-cycle` branch \u2014 pi is still told --session, but this is not a resume) or a genuinely fresh launch (no `.jsonl` existed). Absent for a --now kick."},{name:"ready",type:"boolean",required:!1,constraint:"True when the daemon saw the node's view.sock accept a connection within ~10s of the revive \u2014 the node is attachable. It does not show the task was delivered or the model is making progress. False when it did not (still starting \u2014 a launch with `ready:false` carries a `message` saying so \u2014 broker exited, or no free broker slot). Absent for a --now kick, and when the daemon predates this field (readiness unknown)."},{name:"kicked",type:"boolean",required:!1,constraint:"True when --now SIGTERM'd the hanging node's live broker (the daemon resumes it on the saved session within ~20s). Absent for an ordinary revive."},{name:"message",type:"string",required:!1,constraint:"Kick confirmation naming the signalled node, pid, and the daemon's ~20s resume handoff. Present for --now, and for a launch whose broker is still starting."}],outputKind:"object",effects:["Launches the node's detached headless broker engine (no tmux window).","Updates the node's canvas record: status=active, intent=null.","Waits up to ~10s for the daemon to see the broker's view.sock accept a connection, so `ready:true` means a caller can attach on return.","--now: SIGTERMs the live broker instead of launching anything (the daemon's own crash-grace path resumes it)."]},run:i(async e=>{g("crtr:act","crtr node lifecycle revive");const r=e.now??!1,o=e.node,d=e.fresh??!1,l=e.reopen??!1;if(r&&l)throw new a({error:"conflicting_args",message:"`--now` kicks a LIVE broker (nothing to reopen \u2014 a finalized node has no live broker); `--reopen` is meaningless there.",next:"Run `crtr node lifecycle revive <node> --now` on a hanging node, or `crtr node lifecycle revive <node> --reopen` (no --now) to re-task a finalized one."});if(r&&d)throw new a({error:"conflicting_args",message:"`--now` kicks a live hanging broker (SIGTERM \u2192 daemon resumes the SAVED session); `--fresh` is meaningless there.",next:"Run `crtr node lifecycle revive <node> --now` (resumes), or `crtr node lifecycle revive <node> --fresh` (no --now) to relaunch clean."});const c=p();if(r){let n;try{n=await c.getNode(o)}catch(m){u(m)}const t=n.pi_pid,f=n.fault??null;if(t==null||k(t,n.pi_pid_identity??null)!=="alive")throw new a({error:"not_hanging",message:`${o} has no live broker \u2014 nothing to kick. --now is for a HANGING node (live broker parked on an active fault).`,next:"Revive a dormant node with `crtr node lifecycle revive "+o+"` (no --now)."});if(!x(f))throw new a({error:"not_hanging",message:`${o} is live but has no pi\u2192provider fault eligible for --now (either healthy, or a client-owned retry / non-provider fault already being handled elsewhere) \u2014 --now refuses to SIGTERM a node that isn't stuck on a kickable provider fault.`,next:"Use --now only on a node the canvas shows as hanging (\u26A0) with a `pi\u2192provider` fault. For a routine relaunch, omit --now."});if(n.streaming===!0)throw new a({error:"busy",message:`${o} is mid-turn right now (busy) \u2014 --now refuses to SIGTERM a working engine; it has recovered on its own.`,next:"Re-check the canvas \u2014 if it's no longer marked hanging (\u26A0), nothing to do."});try{process.kill(t,"SIGTERM")}catch{}return{kicked:!0,message:`Sent SIGTERM to ${y(n)} (${o}, pid ${t}). The daemon will resume it on the saved session within ~20s (crash\u2192grace\u2192resume).`}}const s=process.env.CRTR_CRON_ID;let h;try{h=await c.reviveNode(o,{resume:!d,reopen:l,...s!==void 0&&s!==""?{cron_id:s}:{}})}catch(n){u(n)}return R(h)},"run")});function R(e){return{resumed:e.resumed,...e.ready!==void 0?{ready:e.ready}:{},...e.ready===!1&&e.revived?{message:"Launched; the broker is still starting (not failed). Attaching waits for it."}:{}}}i(R,"reviveReport");export{x as isNowEligibleFault,j as nodeReviveLeaf,R as reviveReport};
@@ -1 +1 @@
1
- var b=Object.defineProperty;var u=(t,a)=>b(t,"name",{value:a,configurable:!0});import{defineLeaf as f}from"../../core/command.js";import{notFound as k}from"../../core/errors.js";import{installsLiveInAppBlock as v}from"../../shared/env.js";import{listAppPlugins as x}from"./app-installs.js";import{paginate as j}from"../../core/pagination.js";import{listInstalledPlugins as w,findPluginByName as p}from"../../core/resolver.js";import{packageFiles as q}from"../../core/graph/package-files.js";import{validatePluginCommands as P,validateEffectiveCommandPlugins as S}from"../../core/command-plugins/discovery.js";import{compileHookRegistry as D,discoverHookRegistry as M}from"../../core/command-hooks/discovery.js";import{hasDeclaredHooks as R,hookReport as h}from"../../core/command-hooks/report.js";import{SUBTREE_NAMES as B,coreCommandPaths as C,coreHookCatalog as E,extensibleCoreBranches as _}from"../../build-root.js";import{pluginMemoryDir as I,resolveScopeArg as g,projectScopeRoot as y}from"../../core/scope.js";async function N(t){if(!R(t.manifest))return;const a=await E(),l=M(a),n=l.validations.find(i=>i.plugin.root===t.root);if(n===void 0){const i=D(a,[t]);return h(i.validations[0])}return h(n,l.issues.filter(i=>i.plugin===t.name&&i.scope===t.scope))}u(N,"hookInspectionReport");const J=f({name:"list",description:"paginated list of installed plugins",whenToUse:"enumerating installed plugins across user and project scope, optionally including disabled plugins",help:{name:"pkg plugin list",summary:"paginated list of installed plugins",params:[{kind:"flag",name:"scope",type:"enum",choices:["user","project","all"],required:!1,constraint:"Default: all."},{kind:"flag",name:"include-disabled",type:"bool",required:!1,constraint:"Include disabled plugins. Default: false."},{kind:"flag",name:"limit",type:"int",required:!1,default:50,constraint:"Default 50, max 200."},{kind:"flag",name:"cursor",type:"string",required:!1,constraint:"Opaque token from next_cursor. Omit on first call."}],output:[{name:"items",type:"object[]",required:!0,constraint:"Each: {name, scope, version?, enabled, transport, source_marketplace?, path, documents?}. documents, on a sandboxed node, says why an install has no documents. transport is exec or http for command plugins, null for docs-only plugins. Sorted by scope then name ascending."},{name:"next_cursor",type:"string | null",required:!0,constraint:"null means no more items."},{name:"total",type:"integer | null",required:!0,constraint:"Exact when cheap; null otherwise."}],outputKind:"object",effects:["None on a Mac. On a sandboxed node it asks the directory about each enabled install, which publishes what the directory serves."]},run:u(async t=>{const a=t.scope,l=t.includeDisabled??!1;if(v())return await x(l);const n=t.limit,i=n!==void 0?Math.min(Math.max(1,n),200):50,c=t.cursor;let d;if(a!==void 0){const e=g(a);d=e==="all"?["project","user"].filter(s=>s!=="project"||y()!==null):[e]}else d=["project","user"].filter(e=>e!=="project"||y()!==null);const o=d.flatMap(e=>w(e)).filter(e=>l||e.enabled).sort((e,s)=>e.scope==="project"&&s.scope!=="project"?-1:e.scope!=="project"&&s.scope==="project"?1:e.name.localeCompare(s.name)),m=j(o,{limit:i,cursor:c!==void 0?c:void 0},{defaultLimit:50,maxLimit:200,keyOf:u(e=>`${e.scope}:${e.name}`,"keyOf"),total:"count"});return{items:m.items.map(e=>({name:e.name,scope:e.scope,version:e.version,enabled:e.enabled,transport:e.manifest.transport?.kind??null,source_marketplace:e.sourceMarketplace,path:e.root})),next_cursor:m.next_cursor,total:m.total}},"run")}),Q=f({name:"show",description:"read plugin manifest and substrate inventory",whenToUse:"reading one installed plugin in detail: manifest, provided documents, scope, path, and enabled state",help:{name:"pkg plugin show",summary:"read plugin manifest and metadata by name",params:[{kind:"positional",name:"name",type:"string",required:!0,constraint:"Plugin name."},{kind:"flag",name:"scope",type:"enum",choices:["user","project"],required:!1,constraint:"Narrows resolution."}],output:[{name:"name",type:"string",required:!0,constraint:"Plugin name."},{name:"scope",type:"string",required:!0,constraint:"Scope the plugin is installed in."},{name:"path",type:"string",required:!0,constraint:"Absolute path to the plugin directory."},{name:"enabled",type:"boolean",required:!0,constraint:"Whether the plugin is active."},{name:"manifest",type:"object",required:!0,constraint:"Full plugin.json contents."},{name:"docs",type:"object[]",required:!0,constraint:"Each: {name, path}. Documents provided by the plugin (named under `<pluginName>/`)."},{name:"commands",type:"object",required:!1,constraint:"Present only when the plugin declares a command manifest (manifest.commands). {manifestPath: string, mounts: string[] (accepted command paths), extensibleBranches: string[] (plugin mount names accepting repository fragments), issues: object[] ({code, path?, message, received, expected, next})}. Validated statically; command execution never occurs."},{name:"hooks",type:"object",required:!1,constraint:"Present for every hook declaration, including hook-only plugins. {manifestPath?, executablePath?, declarations: {target, phase, op, description, effects}[], lifecycle?: {event, phase, op, description, effects}[], issues: object[] ({code, path?, message, received, expected, next}), trust: string}. Static only: no hook executable runs."}],outputKind:"object",effects:["None. Read-only. Command and lifecycle-hook manifests are validated statically; plugin executables are never executed."]},run:u(async t=>{const a=t.name,l=t.scope;let n;if(l!==void 0){const o=g(l);o==="all"||o==="builtin"?n=p(a):n=p(a,o)}else n=p(a);if(n===null)throw k(`plugin not found: ${a}`);const i=q(I(n)).files.map(o=>({name:`${n.name}/${o.name}`,path:o.path}));let c;if(typeof n.manifest.commands=="string"&&n.manifest.commands.length>0){const o=new Set(B),[m,e]=await Promise.all([C(),_()]),s=S(o,void 0,void 0,m,e).find(r=>r.plugin.root===n.root)??P(n,o,m,e);c={manifestPath:s.manifestPath,mounts:[...s.contributions.map(r=>r.node.name),...s.coreMounts.map(r=>[...r.parent,r.node.name].join(" "))],extensibleBranches:s.contributions.filter(r=>r.node.extensible===!0).map(r=>r.node.name),issues:s.issues}}const d=await N(n);return{name:n.name,scope:n.scope,path:n.root,enabled:n.enabled,manifest:n.manifest,docs:i.map(o=>({name:o.name,path:o.path})),...c!==void 0?{commands:c}:{},...d!==void 0?{hooks:d}:{}}},"run")});export{J as pluginList,Q as pluginShow};
1
+ var v=Object.defineProperty;var m=(a,o)=>v(a,"name",{value:o,configurable:!0});import{defineLeaf as f}from"../../core/command.js";import{notFound as g}from"../../core/errors.js";import{installsLiveInAppBlock as h}from"../../shared/env.js";import{listAppPlugins as b}from"./app-installs.js";import{paginate as j}from"../../core/pagination.js";import{listInstalledPlugins as w,findPluginByName as p}from"../../core/resolver.js";import{packageFiles as q}from"../../core/graph/package-files.js";import{validatePluginCommands as P,validateEffectiveCommandPlugins as S}from"../../core/command-plugins/discovery.js";import{compileHookRegistry as A,discoverHookRegistry as D}from"../../core/command-hooks/discovery.js";import{hasDeclaredHooks as M,hookReport as y}from"../../core/command-hooks/report.js";import{SUBTREE_NAMES as R,coreCommandPaths as B,coreHookCatalog as C,extensibleCoreBranches as E}from"../../build-root.js";import{pluginMemoryDir as _,resolveScopeArg as k,projectScopeRoot as x}from"../../core/scope.js";async function I(a){if(!M(a.manifest))return;const o=await C(),l=D(o),n=l.validations.find(i=>i.plugin.root===a.root);if(n===void 0){const i=A(o,[a]);return y(i.validations[0])}return y(n,l.issues.filter(i=>i.plugin===a.name&&i.scope===a.scope))}m(I,"hookInspectionReport");const J=f({name:"list",description:"paginated list of installed plugins",whenToUse:"enumerating installed plugins across user and project scope, optionally including disabled plugins",help:{name:"pkg plugin list",summary:"paginated list of installed plugins",params:[{kind:"flag",name:"scope",type:"enum",choices:["user","project","all"],required:!1,constraint:"Default: all."},{kind:"flag",name:"include-disabled",type:"bool",required:!1,constraint:"Include disabled plugins. Default: false."},{kind:"flag",name:"limit",type:"int",required:!1,default:50,constraint:"Default 50, max 200."},{kind:"flag",name:"cursor",type:"string",required:!1,constraint:"Opaque token from next_cursor. Omit on first call."}],output:[{name:"items",type:"object[]",required:!0,constraint:"Each: {name, scope, version?, enabled, transport, source_marketplace?, path, documents?}. documents, on a sandboxed node, says why an install has no documents. transport is exec or http for command plugins, null for docs-only plugins. Sorted by scope then name ascending."},{name:"next_cursor",type:"string | null",required:!0,constraint:"null means no more items."},{name:"total",type:"integer | null",required:!0,constraint:"Exact when cheap; null otherwise."}],outputKind:"object",effects:["None on a Mac. On a sandboxed node it asks the directory about each enabled install, which publishes what the directory serves."]},run:m(async a=>{const o=a.scope,l=a.includeDisabled??!1;if(h())return await b(l);const n=a.limit,i=n!==void 0?Math.min(Math.max(1,n),200):50,d=a.cursor;let u;if(o!==void 0){const e=k(o);u=e==="all"?["project","user"].filter(s=>s!=="project"||x()!==null):[e]}else u=["project","user"].filter(e=>e!=="project"||x()!==null);const t=u.flatMap(e=>w(e)).filter(e=>l||e.enabled).sort((e,s)=>e.scope==="project"&&s.scope!=="project"?-1:e.scope!=="project"&&s.scope==="project"?1:e.name.localeCompare(s.name)),c=j(t,{limit:i,cursor:d!==void 0?d:void 0},{defaultLimit:50,maxLimit:200,keyOf:m(e=>`${e.scope}:${e.name}`,"keyOf"),total:"count"});return{items:c.items.map(e=>({name:e.name,scope:e.scope,version:e.version,enabled:e.enabled,transport:e.manifest.transport?.kind??null,source_marketplace:e.sourceMarketplace,path:e.root})),next_cursor:c.next_cursor,total:c.total}},"run")}),Q=f({name:"show",description:"read plugin manifest and substrate inventory",whenToUse:"reading one installed plugin in detail: manifest, provided documents, scope, path, and enabled state",help:{name:"pkg plugin show",summary:"read plugin manifest and metadata by name",params:[{kind:"positional",name:"name",type:"string",required:!0,constraint:"Plugin name."},{kind:"flag",name:"scope",type:"enum",choices:["user","project"],required:!1,constraint:"Narrows resolution."}],output:[{name:"name",type:"string",required:!0,constraint:"Plugin name."},{name:"scope",type:"string",required:!0,constraint:"Scope the plugin is installed in."},{name:"path",type:"string",required:!1,constraint:"Absolute path to the plugin directory. Absent for a plugin installed in a fleet sandbox app block."},{name:"enabled",type:"boolean",required:!0,constraint:"Whether the plugin is active."},{name:"manifest",type:"object",required:!1,constraint:"Full plugin.json contents. Absent for a plugin installed in a fleet sandbox app block."},{name:"docs",type:"object[]",required:!1,constraint:"Absent for a plugin installed in a fleet sandbox app block. Each: {name, path}. Documents provided by the plugin (named under `<pluginName>/`)."},{name:"commands",type:"object",required:!1,constraint:"Present only when the plugin declares a command manifest (manifest.commands). {manifestPath: string, mounts: string[] (accepted command paths), extensibleBranches: string[] (plugin mount names accepting repository fragments), issues: object[] ({code, path?, message, received, expected, next})}. Validated statically; command execution never occurs."},{name:"hooks",type:"object",required:!1,constraint:"Present for every hook declaration, including hook-only plugins. {manifestPath?, executablePath?, declarations: {target, phase, op, description, effects}[], lifecycle?: {event, phase, op, description, effects}[], issues: object[] ({code, path?, message, received, expected, next}), trust: string}. Static only: no hook executable runs."}],outputKind:"object",effects:["None. Read-only. Command and lifecycle-hook manifests are validated statically; plugin executables are never executed."]},run:m(async a=>{const o=a.name,l=a.scope;if(h()){const t=(await b(!0)).items.find(c=>c.name===o);if(t===void 0)throw g(`plugin not found: ${o}`);return{...t}}let n;if(l!==void 0){const t=k(l);t==="all"||t==="builtin"?n=p(o):n=p(o,t)}else n=p(o);if(n===null)throw g(`plugin not found: ${o}`);const i=q(_(n)).files.map(t=>({name:`${n.name}/${t.name}`,path:t.path}));let d;if(typeof n.manifest.commands=="string"&&n.manifest.commands.length>0){const t=new Set(R),[c,e]=await Promise.all([B(),E()]),s=S(t,void 0,void 0,c,e).find(r=>r.plugin.root===n.root)??P(n,t,c,e);d={manifestPath:s.manifestPath,mounts:[...s.contributions.map(r=>r.node.name),...s.coreMounts.map(r=>[...r.parent,r.node.name].join(" "))],extensibleBranches:s.contributions.filter(r=>r.node.extensible===!0).map(r=>r.node.name),issues:s.issues}}const u=await I(n);return{name:n.name,scope:n.scope,path:n.root,enabled:n.enabled,manifest:n.manifest,docs:i.map(t=>({name:t.name,path:t.path})),...d!==void 0?{commands:d}:{},...u!==void 0?{hooks:u}:{}}},"run")});export{J as pluginList,Q as pluginShow};
@@ -1 +1 @@
1
- var a=Object.defineProperty;var r=(t,e)=>a(t,"name",{value:e,configurable:!0});import{defineLeaf as s}from"../../core/command.js";import{emitLine as o}from"../../core/io.js";import{cliClient as p}from"../api-client.js";const f=s({name:"list",description:"inventory every profile visible to you and its project relationships",whenToUse:"browse every profile that exists \u2014 one line each with its id, name, explicit project relationships, owning app, paused state, and last-used time. Reach for `profile show` once you have picked one, for its full manifest.",help:{name:"profile list",summary:"every profile the daemon shows the caller (its own app's, plus any another app shared) as JSONL, sorted by name then profile_id",output:[{name:"profile_id",type:"string",required:!0,constraint:"Stable directory id."},{name:"name",type:"string",required:!0,constraint:"Manifest name."},{name:"projects_count",type:"int",required:!0,constraint:"Number of `{path}` project relationships on the manifest."},{name:"projects",type:"ProfileProject[]",required:!0,constraint:"Explicit `{path}` relationships in manifest order. `path` defines profile purview; the repos enclosing each path are in the view of every node of the profile."},{name:"app",type:"string",required:!0,constraint:"The app that owns this profile."},{name:"paused_at",type:"string | null",required:!0,constraint:"ISO 8601 pause timestamp, or null when the profile is active."},{name:"default_kind",type:"string",required:!0,constraint:"Default node kind for creates that omit --kind; `general` when none is stored."},{name:"environment_id",type:"string",required:!0,constraint:"Object id of the environment the profile runs in; the machine environment when none is stored."},{name:"last_used_at",type:"string | null",required:!0,constraint:"ISO 8601 timestamp of the most recent selection, or null if never selected."}],outputKind:"jsonl",effects:["None. Read-only."]},run:r(async()=>{const t=(await p().listProfiles()).sort((e,n)=>{const i=e.name.localeCompare(n.name);return i!==0?i:e.id.localeCompare(n.id)});for(const e of t)o({profile_id:e.id,name:e.name,projects_count:e.projects.length,projects:e.projects,app:e.app,paused_at:e.paused_at,default_kind:e.default_kind,environment_id:e.environment_id,last_used_at:e.last_used_at});o({follow_up:"Show one in full with `crtr profile show <profile>`."})},"run")});export{f as listLeaf};
1
+ var a=Object.defineProperty;var i=(t,e)=>a(t,"name",{value:e,configurable:!0});import{defineLeaf as s}from"../../core/command.js";import{emitLine as o}from"../../core/io.js";import{cliClient as p}from"../api-client.js";const f=s({name:"list",description:"inventory every profile visible to you and its project relationships",whenToUse:"browse every profile that exists \u2014 one line each with its id, name, explicit project relationships, owning app, paused state, and last-used time. Reach for `profile show` once you have picked one, for its full manifest.",help:{name:"profile list",summary:"every profile the daemon shows the caller (its own app's, plus any another app shared) as JSONL, sorted by name then profile_id",output:[{name:"profile_id",type:"string",required:!0,constraint:"Stable directory id."},{name:"name",type:"string",required:!0,constraint:"Manifest name."},{name:"projects_count",type:"int",required:!0,constraint:"Number of project entries on the manifest."},{name:"projects",type:"ProfileProject[]",required:!0,constraint:"Project entries `{repo?, path?}` in manifest order. `path` defines profile purview; the repos enclosing each path, and the `repo` of each entry (a repo object id), are in the view of every node of the profile."},{name:"app",type:"string",required:!0,constraint:"The app that owns this profile."},{name:"paused_at",type:"string | null",required:!0,constraint:"ISO 8601 pause timestamp, or null when the profile is active."},{name:"default_kind",type:"string",required:!0,constraint:"Default node kind for creates that omit --kind; `general` when none is stored."},{name:"environment_id",type:"string",required:!0,constraint:"Object id of the environment the profile runs in; the machine environment when none is stored."},{name:"last_used_at",type:"string | null",required:!0,constraint:"ISO 8601 timestamp of the most recent selection, or null if never selected."}],outputKind:"jsonl",effects:["None. Read-only."]},run:i(async()=>{const t=(await p().listProfiles()).sort((e,n)=>{const r=e.name.localeCompare(n.name);return r!==0?r:e.id.localeCompare(n.id)});for(const e of t)o({profile_id:e.id,name:e.name,projects_count:e.projects.length,projects:e.projects,app:e.app,paused_at:e.paused_at,default_kind:e.default_kind,environment_id:e.environment_id,last_used_at:e.last_used_at});o({follow_up:"Show one in full with `crtr profile show <profile>`."})},"run")});export{f as listLeaf};
@@ -1 +1 @@
1
- var p=Object.defineProperty;var t=(e,o)=>p(e,"name",{value:o,configurable:!0});import{defineLeaf as i,defineBranch as d}from"../../core/command.js";import{resolve as s}from"node:path";import{cliClient as n}from"../api-client.js";import{resolveProfileViaDaemon as a}from"./daemon-profiles.js";import{PROFILE_PROJECT_MEMORY_VALUES as l}from"../../api/dto/profiles.js";const c=i({name:"add",description:"add a project to a profile's purview",whenToUse:"a profile needs purview over another project directory \u2014 extend it after creation.",help:{name:"profile project add",summary:"add a project relationship to a profile, deduped by real path",params:[{kind:"positional",name:"profile",required:!0,constraint:"Profile id or manifest name; a close-enough name resolves to the nearest profile, reported on stderr."},{kind:"flag",name:"dir",type:"path",required:!0,constraint:"Directory to add. Must exist and be a directory; resolved to its absolute real path before storing. A path already on the profile keeps its position and nothing changes."}],output:[{name:"profile_id",type:"string",required:!0,constraint:"Stable directory id."},{name:"projects",type:"ProfileProject[]",required:!0,constraint:"The updated `{path}` relationships in profile order. `path` defines purview."}],outputKind:"object",effects:["Appends a new project relationship to the profile row. Purview follows `path` for config, and every repo enclosing `path` joins the view of every node of the profile: its documents are readable, listed, and delivered at boot and workspace-open. Each such repo starts at a `preview` delivery limit unless the profile already limits that handle (change it with `profile project limit`). Running brokers discover the updated projects on their next scope read."]},run:t(async e=>{const{id:o}=await a(e.profile),r=await n().updateProfile(o,{add_project:{path:s(e.dir)}});return{profile_id:r.id,projects:r.projects}},"run")}),h=i({name:"remove",description:"remove a project relationship from a profile's purview",whenToUse:"a profile no longer needs purview over one of its listed project directories \u2014 narrow it back. Works even if the directory itself was since deleted.",help:{name:"profile project remove",summary:"remove a project directory from a profile's manifest",params:[{kind:"positional",name:"profile",required:!0,constraint:"Profile id or manifest name; a close-enough name resolves to the nearest profile, reported on stderr."},{kind:"flag",name:"dir",type:"path",required:!0,constraint:"Directory to remove, matched against the stored project `path`. Does not require the directory to still exist on disk. The profile's app home does not change."}],output:[{name:"profile_id",type:"string",required:!0,constraint:"Stable directory id."},{name:"projects",type:"ProfileProject[]",required:!0,constraint:"The updated `{path}` relationships in profile order."}],outputKind:"object",effects:["Removes a project relationship from the profile row. This narrows purview and drops the path's repos from the view of the profile's nodes (unless a node's cwd is inside them); delivery limits are left in place. Running brokers discover the updated projects on their next scope read."]},run:t(async e=>{const{id:o}=await a(e.profile),r=await n().updateProfile(o,{remove_project:s(e.dir)});return{profile_id:r.id,projects:r.projects}},"run")}),m=i({name:"limit",description:"set how much of one owner's documents automatic delivery may disclose",whenToUse:"a profile's nodes should get less of one owner's documents (a repo, `user`, an app, a plugin) at boot and workspace-open \u2014 or that limit should be lifted.",help:{name:"profile project limit",summary:"set a profile's automatic delivery limit for one owner handle",params:[{kind:"positional",name:"profile",required:!0,constraint:"Profile id or manifest name; a close-enough name resolves to the nearest profile, reported on stderr."},{kind:"flag",name:"owner",type:"string",required:!0,constraint:"Owner the limit applies to. A bare handle (`crouter`, `user`) matches an owner of any type holding that handle. `<type>:<handle>` names one owner exactly \u2014 `repo:crouter`, `profile:work`, `app:terminal`, `person:user` \u2014 and wins over a bare key; use it when a repo and another owner share a handle. A profile's own documents are never capped, whichever key matches."},{kind:"flag",name:"level",type:"enum",choices:[...l],required:!0,constraint:"Maximum automatic delivery of this owner's documents at boot and workspace-open: `none`, `name`, `preview`, or `content`. `content` is no limit and removes the entry. Does not change explicit `crtr canvas read` access."}],output:[{name:"profile_id",type:"string",required:!0,constraint:"Stable directory id."},{name:"delivery_limits",type:"object",required:!0,constraint:"The profile\u2019s limits after the change, keyed by owner handle or `<type>:<handle>`; an owner not listed is not limited."}],outputKind:"object",effects:["Sets or removes one entry in the profile's `delivery_limits`. It caps only automatic `boot` and `workspace-open` delivery; a node's own documents and its own profile's documents are never capped. A `<type>:<handle>` key (for example `repo:crouter`) names one owner exactly and wins over a bare handle key."]},run:t(async e=>{const{id:o}=await a(e.profile),r=await n().updateProfile(o,{set_delivery_limit:{owner:e.owner,level:e.level}});return{profile_id:r.id,delivery_limits:r.delivery_limits}},"run")}),g=d({name:"project",description:"manage a profile's project purview and automatic delivery limits",whenToUse:"changing a profile\u2019s project purview after creation, or limiting how much of one owner's documents its nodes get automatically.",help:{name:"profile project",summary:"manage project purview and per-owner automatic delivery limits",model:"Each `{path}` relationship widens purview: the profile resolves config from `path`, and every node of the profile sees the repos enclosing `path` in addition to the repos enclosing its own cwd (cwd repos first, then projects in manifest order). Rule `if: {repo}` conditions hold for any of those repos (cwd repos and project repos); `--owner repo` stays with the cwd's repos, while a node may change a project repo's documents when its file permissions allow writing that checkout. `add` appends a new real path and starts its repos at a `preview` limit; `remove` narrows purview. `limit` sets the profile's `delivery_limits` entry for one owner handle, which caps automatic boot and workspace-open delivery of that owner's documents, whether the repo is in view through the cwd or the project list; explicit reads are not capped. Purview and delivery limits are both independent of a per-cwd default pin (`crtr profile default`)."},children:[c,h,m]});export{g as projectBranch};
1
+ var l=Object.defineProperty;var t=(e,r)=>l(e,"name",{value:r,configurable:!0});import{defineLeaf as i,defineBranch as c}from"../../core/command.js";import{resolve as p}from"node:path";import{usage as h}from"../../core/errors.js";import{cliClient as n}from"../api-client.js";import{resolveProfileViaDaemon as a}from"./daemon-profiles.js";import{PROFILE_PROJECT_MEMORY_VALUES as f}from"../../api/dto/profiles.js";const m=i({name:"add",description:"add a project to a profile's purview",whenToUse:"a profile needs purview over another project directory \u2014 extend it after creation.",help:{name:"profile project add",summary:"add a project relationship to a profile, deduped by real path",params:[{kind:"positional",name:"profile",required:!0,constraint:"Profile id or manifest name; a close-enough name resolves to the nearest profile, reported on stderr."},{kind:"flag",name:"dir",type:"path",required:!1,constraint:"Directory to add; exactly one of `--dir` and `--repo`. Must exist and be a directory; resolved to its absolute real path before storing. The repo its checkout identifies as is stored with it; a folder no repo identifies keeps the path only. A path already on the profile keeps its position and nothing changes."},{kind:"flag",name:"repo",type:"string",required:!1,constraint:"Repo handle to add with no folder; exactly one of `--dir` and `--repo`. Must name a repo you may read. A node with no checkout (a sandbox) still gets that repo's documents."}],output:[{name:"profile_id",type:"string",required:!0,constraint:"Stable directory id."},{name:"projects",type:"ProfileProject[]",required:!0,constraint:"The updated `{repo?, path?}` entries in profile order. `path` defines purview for config; `repo` is the repo object id whose documents join the view."}],outputKind:"object",effects:["Appends a new project relationship (a folder, with the repo it identifies as, or a repo alone) to the profile row. Purview follows `path` for config, and every repo enclosing `path` joins the view of every node of the profile: its documents are readable, listed, and delivered at boot and workspace-open. Each such repo starts at a `preview` delivery limit unless the profile already limits that handle (change it with `profile project limit`). Running brokers discover the updated projects on their next scope read."]},run:t(async e=>{const{id:r}=await a(e.profile),o=e.dir,s=e.repo;if(o===void 0==(s===void 0))throw h("pass exactly one of --dir and --repo",{next:"Use --dir <directory> for a folder or --repo <handle> for a repo with no folder."});const d=await n().updateProfile(r,{add_project:o!==void 0?{path:p(o)}:{repo:s}});return{profile_id:d.id,projects:d.projects}},"run")}),u=i({name:"remove",description:"remove a project relationship from a profile's purview",whenToUse:"a profile no longer needs purview over one of its listed project directories \u2014 narrow it back. Works even if the directory itself was since deleted.",help:{name:"profile project remove",summary:"remove a project directory from a profile's manifest",params:[{kind:"positional",name:"profile",required:!0,constraint:"Profile id or manifest name; a close-enough name resolves to the nearest profile, reported on stderr."},{kind:"flag",name:"dir",type:"path",required:!0,constraint:"Directory to remove, matched against the stored project `path`. Does not require the directory to still exist on disk. The profile's app home does not change."}],output:[{name:"profile_id",type:"string",required:!0,constraint:"Stable directory id."},{name:"projects",type:"ProfileProject[]",required:!0,constraint:"The updated `{path}` relationships in profile order."}],outputKind:"object",effects:["Removes a project relationship from the profile row. This narrows purview and drops the path's repos from the view of the profile's nodes (unless a node's cwd is inside them); delivery limits are left in place. Running brokers discover the updated projects on their next scope read."]},run:t(async e=>{const{id:r}=await a(e.profile),o=await n().updateProfile(r,{remove_project:p(e.dir)});return{profile_id:o.id,projects:o.projects}},"run")}),w=i({name:"limit",description:"set how much of one owner's documents automatic delivery may disclose",whenToUse:"a profile's nodes should get less of one owner's documents (a repo, `user`, an app, a plugin) at boot and workspace-open \u2014 or that limit should be lifted.",help:{name:"profile project limit",summary:"set a profile's automatic delivery limit for one owner handle",params:[{kind:"positional",name:"profile",required:!0,constraint:"Profile id or manifest name; a close-enough name resolves to the nearest profile, reported on stderr."},{kind:"flag",name:"owner",type:"string",required:!0,constraint:"Owner the limit applies to. A bare handle (`crouter`, `user`) matches an owner of any type holding that handle. `<type>:<handle>` names one owner exactly \u2014 `repo:crouter`, `profile:work`, `app:terminal`, `person:user` \u2014 and wins over a bare key; use it when a repo and another owner share a handle. A profile's own documents are never capped, whichever key matches."},{kind:"flag",name:"level",type:"enum",choices:[...f],required:!0,constraint:"Maximum automatic delivery of this owner's documents at boot and workspace-open: `none`, `name`, `preview`, or `content`. `content` is no limit and removes the entry. Does not change explicit `crtr canvas read` access."}],output:[{name:"profile_id",type:"string",required:!0,constraint:"Stable directory id."},{name:"delivery_limits",type:"object",required:!0,constraint:"The profile\u2019s limits after the change, keyed by owner handle or `<type>:<handle>`; an owner not listed is not limited."}],outputKind:"object",effects:["Sets or removes one entry in the profile's `delivery_limits`. It caps only automatic `boot` and `workspace-open` delivery; a node's own documents and its own profile's documents are never capped. A `<type>:<handle>` key (for example `repo:crouter`) names one owner exactly and wins over a bare handle key."]},run:t(async e=>{const{id:r}=await a(e.profile),o=await n().updateProfile(r,{set_delivery_limit:{owner:e.owner,level:e.level}});return{profile_id:o.id,delivery_limits:o.delivery_limits}},"run")}),x=c({name:"project",description:"manage a profile's project purview and automatic delivery limits",whenToUse:"changing a profile\u2019s project purview after creation, or limiting how much of one owner's documents its nodes get automatically.",help:{name:"profile project",summary:"manage project purview and per-owner automatic delivery limits",model:"Each `{path}` relationship widens purview: the profile resolves config from `path`, and every node of the profile sees the repos enclosing `path` in addition to the repos enclosing its own cwd (cwd repos first, then projects in manifest order). Rule `if: {repo}` conditions hold for any of those repos (cwd repos and project repos); `--owner repo` stays with the cwd's repos, while a node may change a project repo's documents when its file permissions allow writing that checkout. `add` appends a new real path and starts its repos at a `preview` limit; `remove` narrows purview. `limit` sets the profile's `delivery_limits` entry for one owner handle, which caps automatic boot and workspace-open delivery of that owner's documents, whether the repo is in view through the cwd or the project list; explicit reads are not capped. Purview and delivery limits are both independent of a per-cwd default pin (`crtr profile default`)."},children:[m,u,w]});export{x as projectBranch};
@@ -1 +1 @@
1
- var n=Object.defineProperty;var i=(r,e)=>n(r,"name",{value:e,configurable:!0});import{defineLeaf as a}from"../../core/command.js";import{resolveProfileViaDaemon as o}from"./daemon-profiles.js";const l=a({name:"show",description:"one profile's manifest in full",whenToUse:"you need a profile's full project list, owning app, id, and timestamps \u2014 after `profile list` narrows to a name, to find where its nodes will run, or to inspect what a node's bearings named as its profile.",help:{name:"profile show",summary:"print one profile's settings and directory path",params:[{kind:"positional",name:"profile",required:!0,constraint:"Profile id or manifest name; a close-enough name resolves to the nearest profile, reported on stderr. A name shared by several profiles fails listing every matching id."}],output:[{name:"profile_id",type:"string",required:!0,constraint:"Stable directory id."},{name:"name",type:"string",required:!0,constraint:"Manifest name."},{name:"projects",type:"ProfileProject[]",required:!0,constraint:"Explicit `{path}` relationships in manifest order. `path` defines profile purview; the repos enclosing each path are in the view of every node of the profile."},{name:"app",type:"string",required:!0,constraint:"The app that owns this profile."},{name:"paused_at",type:"string | null",required:!0,constraint:"ISO 8601 pause timestamp, or null when the profile is active."},{name:"default_kind",type:"string",required:!0,constraint:"Default node kind for creates that omit --kind; `general` when none is stored."},{name:"metadata",type:"object",required:!0,constraint:"Stored metadata map \u2014 each entry reaches brokers launched under the profile as `CRTR_PROFILE_META_<KEY>` env. Empty when none."},{name:"environment_id",type:"string",required:!0,constraint:"Object id of the environment the profile runs in; the machine environment when none is stored."},{name:"created_at",type:"string",required:!0,constraint:"ISO 8601 creation timestamp."},{name:"last_used_at",type:"string | null",required:!0,constraint:"ISO 8601 timestamp of the most recent selection, or null if never selected."},{name:"profile_path",type:"string",required:!0,constraint:"Absolute path to the profile directory, `<app space>/profiles/<id>`: its settings root. Documents the profile owns are canvas documents, read with `crtr canvas read`, not files here."},{name:"follow_up",type:"string",required:!0,constraint:"Concrete next commands, including the SQL-backed raw settings surface."}],outputKind:"object",effects:["None. Read-only."]},run:i(async r=>{const e=await o(r.profile),t=e.id;return{profile_id:t,name:e.name,projects:e.projects,app:e.app,paused_at:e.paused_at,default_kind:e.default_kind,metadata:e.metadata,environment_id:e.environment_id,created_at:e.created_at,last_used_at:e.last_used_at,profile_path:e.profile_path,follow_up:e.paused_at===null?`Inspect its SQL-backed settings with \`crtr sys config get-raw --scope profile --profile ${t}\`; manage its purview with \`crtr profile project add ${t} --dir <path>\`, pause it with \`crtr profile pause ${t}\`, or set its default kind with \`crtr profile kind ${t} <kind>\`.`:`Inspect its SQL-backed settings with \`crtr sys config get-raw --scope profile --profile ${t}\`; manage its purview with \`crtr profile project add ${t} --dir <path>\`, or resume it with \`crtr profile resume ${t}\`.`}},"run")});export{l as showLeaf};
1
+ var n=Object.defineProperty;var i=(r,e)=>n(r,"name",{value:e,configurable:!0});import{defineLeaf as a}from"../../core/command.js";import{resolveProfileViaDaemon as o}from"./daemon-profiles.js";const l=a({name:"show",description:"one profile's manifest in full",whenToUse:"you need a profile's full project list, owning app, id, and timestamps \u2014 after `profile list` narrows to a name, to find where its nodes will run, or to inspect what a node's bearings named as its profile.",help:{name:"profile show",summary:"print one profile's settings and directory path",params:[{kind:"positional",name:"profile",required:!0,constraint:"Profile id or manifest name; a close-enough name resolves to the nearest profile, reported on stderr. A name shared by several profiles fails listing every matching id."}],output:[{name:"profile_id",type:"string",required:!0,constraint:"Stable directory id."},{name:"name",type:"string",required:!0,constraint:"Manifest name."},{name:"projects",type:"ProfileProject[]",required:!0,constraint:"Project entries `{repo?, path?}` in manifest order. `path` defines profile purview; the repos enclosing each path, and the `repo` of each entry (a repo object id), are in the view of every node of the profile."},{name:"app",type:"string",required:!0,constraint:"The app that owns this profile."},{name:"paused_at",type:"string | null",required:!0,constraint:"ISO 8601 pause timestamp, or null when the profile is active."},{name:"default_kind",type:"string",required:!0,constraint:"Default node kind for creates that omit --kind; `general` when none is stored."},{name:"metadata",type:"object",required:!0,constraint:"Stored metadata map \u2014 each entry reaches brokers launched under the profile as `CRTR_PROFILE_META_<KEY>` env. Empty when none."},{name:"environment_id",type:"string",required:!0,constraint:"Object id of the environment the profile runs in; the machine environment when none is stored."},{name:"created_at",type:"string",required:!0,constraint:"ISO 8601 creation timestamp."},{name:"last_used_at",type:"string | null",required:!0,constraint:"ISO 8601 timestamp of the most recent selection, or null if never selected."},{name:"profile_path",type:"string",required:!0,constraint:"Absolute path to the profile directory, `<app space>/profiles/<id>`: its settings root. Documents the profile owns are canvas documents, read with `crtr canvas read`, not files here."},{name:"follow_up",type:"string",required:!0,constraint:"Concrete next commands, including the SQL-backed raw settings surface."}],outputKind:"object",effects:["None. Read-only."]},run:i(async r=>{const e=await o(r.profile),t=e.id;return{profile_id:t,name:e.name,projects:e.projects,app:e.app,paused_at:e.paused_at,default_kind:e.default_kind,metadata:e.metadata,environment_id:e.environment_id,created_at:e.created_at,last_used_at:e.last_used_at,profile_path:e.profile_path,follow_up:e.paused_at===null?`Inspect its SQL-backed settings with \`crtr sys config get-raw --scope profile --profile ${t}\`; manage its purview with \`crtr profile project add ${t} --dir <path>\`, pause it with \`crtr profile pause ${t}\`, or set its default kind with \`crtr profile kind ${t} <kind>\`.`:`Inspect its SQL-backed settings with \`crtr sys config get-raw --scope profile --profile ${t}\`; manage its purview with \`crtr profile project add ${t} --dir <path>\`, or resume it with \`crtr profile resume ${t}\`.`}},"run")});export{l as showLeaf};
@@ -1 +1 @@
1
- var O=Object.defineProperty;var g=(m,e)=>O(m,"name",{value:e,configurable:!0});import{envNodeId as E}from"../../../shared/env.js";import{Input as D,matchesKey as I,truncateToWidth as a}from"@earendil-works/pi-tui";import{basename as F}from"node:path";import{PROFILE_PROJECT_MEMORY_VALUES as _}from"../../../api/dto/profiles.js";import{cliClient as x}from"../../api-client.js";import{clearDefaultProfile as N,defaultProfileDirs as S,getDefaultProfileId as H,setDefaultProfileId as V}from"../../../core/profiles/default-binding.js";import{ROOT_PROFILE_ID as j,addProfileProject as M,createProfile as A,listProfiles as U,removeProfileProject as W,setProfileDeliveryLimit as B}from"../../../core/profiles/manifest.js";import{tildify as c}from"../../../core/fs-utils.js";import{profileCoversCwd as T}from"../../../core/profiles/select.js";import{padAnsi as f,theme as o,visibleRange as k,wrapText as L}from"../../../core/tui/panel.js";function C(m){if(m===null)return"never used";const e=Date.parse(m);if(Number.isNaN(e))return"used recently";const t=Math.max(0,Math.floor((Date.now()-e)/1e3));if(t<60)return"used just now";const i=Math.floor(t/60);if(i<60)return`used ${i}m ago`;const n=Math.floor(i/60);if(n<24)return`used ${n}h ago`;const r=Math.floor(n/24);if(r<30)return`used ${r}d ago`;const s=Math.floor(r/30);return s<12?`used ${s}mo ago`:`used ${Math.floor(s/12)}y ago`}g(C,"relativeUsed");function b(m){return m instanceof Error?m.message:String(m)}g(b,"messageOf");class ie{static{g(this,"ProfilesPanel")}cwd;onChange;nameInput=new D;dirInput=new D;limitInput=new D;entries=[];listIndex=0;dirIndex=0;mode="list";openId=null;notice;noticeTone="success";mutating=!1;constructor(e,t){this.cwd=e,this.onChange=t,this.nameInput.onSubmit=()=>{this.submitName(),this.onChange()},this.nameInput.onEscape=()=>{this.mode=this.openId!==null?"detail":"list",this.leaveField(),this.onChange()},this.dirInput.onSubmit=()=>{this.submitDir(),this.onChange()},this.dirInput.onEscape=()=>{this.mode="detail",this.leaveField(),this.onChange()},this.limitInput.onSubmit=()=>{this.submitLimit(),this.onChange()},this.limitInput.onEscape=()=>{this.mode="detail",this.leaveField(),this.onChange()},this.reload()}badge(){return String(this.entries.length)}ownsInput(e){return this.mode==="list"?!1:this.mode==="detail"?I(e,"escape")||I(e,"left"):!0}reload(){const e=g(n=>n.profileId===j?2:T(n,this.cwd)?0:1,"rank"),t=g(n=>n.manifest.last_used_at??"","used");this.entries=U().sort((n,r)=>{const s=e(n)-e(r);if(s!==0)return s;const h=t(r).localeCompare(t(n));return h!==0?h:n.manifest.name.localeCompare(r.manifest.name)}),this.listIndex>=this.entries.length&&(this.listIndex=Math.max(0,this.entries.length-1));const i=this.open();i===null?(this.mode!=="list"&&(this.mode="list"),this.openId=null):this.dirIndex>=i.manifest.projects.length&&(this.dirIndex=Math.max(0,i.manifest.projects.length-1))}selected(){return this.entries[this.listIndex]??null}open(){return this.openId===null?null:this.entries.find(e=>e.profileId===this.openId)??null}currentDir(){return this.open()?.manifest.projects[this.dirIndex]??null}pinnedHere(){return H(this.cwd)}say(e,t="success"){this.notice=e,this.noticeTone=t}attempt(e,t){this.mutating||(this.mutating=!0,(async()=>{try{await e(),this.reload(),this.say(t)}catch(i){this.say(b(i),"warning")}finally{this.mutating=!1,this.onChange()}})())}handleInput(e,t){const i=this.route(e,t);return i&&this.onChange(),i}route(e,t){switch(this.mode){case"new-name":case"rename":return this.routeText(this.nameInput,e);case"add-dir":return this.routeText(this.dirInput,e);case"set-limit":return this.routeText(this.limitInput,e);case"confirm-delete":return this.routeConfirm(e,()=>{this.deleteOpen()});case"confirm-remove-dir":return this.routeConfirm(e,()=>this.removeDir());case"detail":return this.routeDetail(e,t);case"list":return this.routeList(e,t)}}routeText(e,t){return e.handleInput(t),!0}routeConfirm(e,t){const i=e.toLowerCase();return i==="y"?t():(i==="n"||I(e,"escape")||I(e,"return"))&&(this.mode=this.openId!==null?"detail":"list",this.say("Cancelled.")),!0}routeList(e,t){if(t?.("crtr.setup.list-down",e)===!0)return this.move(1),!0;if(t?.("crtr.setup.list-up",e)===!0)return this.move(-1),!0;if(t?.("crtr.setup.advance",e)===!0){const i=this.selected();return i!==null&&(this.openId=i.profileId,this.dirIndex=0,this.mode="detail",this.notice=void 0),!0}switch(e.toLowerCase()){case"a":return this.addCwdTo(this.selected());case"d":return this.togglePin();case"n":return this.mode="new-name",this.edit(this.nameInput,F(this.cwd)||"profile"),!0;case"x":return this.askDelete();default:return!1}}routeDetail(e,t){const i=this.open();if(i===null)return this.mode="list",!0;if(I(e,"escape")||I(e,"left"))return this.mode="list",this.notice=void 0,!0;if(t?.("crtr.setup.list-down",e)===!0)return this.moveDir(1),!0;if(t?.("crtr.setup.list-up",e)===!0)return this.moveDir(-1),!0;switch(e.toLowerCase()){case"a":return this.mode="add-dir",this.edit(this.dirInput,this.cwd),!0;case"l":return this.mode="set-limit",this.edit(this.limitInput,""),!0;case"x":return this.askRemoveDir();case"r":return this.mode="rename",this.edit(this.nameInput,i.manifest.name),!0;case"p":return this.togglePause();default:return!1}}edit(e,t){e.setValue(t),e.handleInput(""),e.focused=!0,this.notice=void 0}leaveField(){this.nameInput.focused=!1,this.dirInput.focused=!1,this.limitInput.focused=!1}move(e){this.entries.length!==0&&(this.listIndex=(this.listIndex+e+this.entries.length)%this.entries.length,this.notice=void 0)}moveDir(e){const t=this.open()?.manifest.projects.length??0;t!==0&&(this.dirIndex=(this.dirIndex+e+t)%t,this.notice=void 0)}addCwdTo(e){return e===null||this.attempt(()=>M(e.profileId,this.cwd),`${c(this.cwd)} now belongs to "${e.manifest.name}".`),!0}togglePin(){const e=this.selected();return e===null||(this.pinnedHere()===e.profileId?this.attempt(()=>N(this.cwd),`${c(this.cwd)} no longer defaults to any profile.`):this.attempt(()=>V(this.cwd,e.profileId),`${c(this.cwd)} now starts as "${e.manifest.name}" without asking.`)),!0}submitName(){const e=this.nameInput.getValue().trim(),t=this.mode==="new-name";if(this.mode=t?"list":"detail",this.leaveField(),e===""){this.say("A profile name cannot be empty.","warning");return}if(t){this.attempt(async()=>{const n=(await A(e,[{path:this.cwd}])).profileId;this.reload();const r=this.entries.findIndex(s=>s.profileId===n);r>=0&&(this.listIndex=r)},`Created "${e}", owning ${c(this.cwd)}.`);return}const i=this.open();i!==null&&this.rename(i.profileId,e)}async rename(e,t){if(!this.mutating){this.mutating=!0;try{await x().updateProfile(e,{name:t}),this.reload(),this.say(`Renamed to "${t}".`)}catch(i){this.say(b(i),"warning")}finally{this.mutating=!1,this.onChange()}}}submitDir(){const e=this.dirInput.getValue().trim(),t=this.open();if(this.mode="detail",this.leaveField(),t!==null){if(e===""){this.say("Type the directory to add.","warning");return}this.attempt(()=>M(t.profileId,e),`${c(e)} added to "${t.manifest.name}".`)}}submitLimit(){const e=this.limitInput.getValue().trim().split(/\s+/),t=this.open();if(this.mode="detail",this.leaveField(),t===null)return;const[i,n]=e;if(e.length!==2||i===void 0||n===void 0||!_.includes(n)){this.say(`Type an owner handle and a level (${_.join(", ")}), e.g. "crouter preview".`,"warning");return}this.attempt(()=>B(t.profileId,i,n),n==="content"?`${i} is no longer limited.`:`${i} is delivered automatically up to "${n}".`)}askRemoveDir(){return this.currentDir()===null?(this.say("This profile owns no directories.","warning"),!0):(this.mode="confirm-remove-dir",this.notice=void 0,!0)}removeDir(){const e=this.open(),t=this.currentDir();this.mode="detail",!(e===null||t===null)&&this.attempt(()=>W(e.profileId,t.path),`${c(t.path)} removed from "${e.manifest.name}".`)}togglePause(){const e=this.open();return e!==null&&!this.mutating&&this.changePause(e),!0}async changePause(e){this.mutating=!0;const t=e.manifest.paused_at!==null;try{t?await x().resumeProfile(e.profileId):await x().pauseProfile(e.profileId),this.reload(),this.say(t?`"${e.manifest.name}" is active again.`:`"${e.manifest.name}" is paused \u2014 no new nodes start under it.`)}catch(i){this.say(b(i),"warning")}finally{this.mutating=!1,this.onChange()}}askDelete(){const e=this.selected();return e===null?!0:e.profileId===j?(this.say("The root profile is the fallback identity for uncovered directories and cannot be deleted.","warning"),!0):(this.openId=e.profileId,this.mode="confirm-delete",this.notice=void 0,!0)}async deleteOpen(){const e=this.open();if(this.mode="list",!(e===null||this.mutating)){this.mutating=!0,this.say(`Deleting "${e.manifest.name}"\u2026`),this.onChange();try{const t=await x().deleteProfile(e.profileId,{force:!0,caller_node_id:E()??null});this.openId=null,this.reload(),this.say(`Deleted "${t.name}" \u2014 ${t.nodes} nodes, ${t.crons} crons, ${t.default_pins} pins.`)}catch(t){this.say(b(t),"warning")}finally{this.mutating=!1,this.onChange()}}}footerHint(){switch(this.mode){case"new-name":return"type a name \xB7 enter create \xB7 esc cancel";case"rename":return"type a name \xB7 enter save \xB7 esc cancel";case"add-dir":return"type a directory \xB7 enter add \xB7 esc cancel";case"set-limit":return"type <owner> <level> \xB7 enter save \xB7 esc cancel";case"confirm-delete":case"confirm-remove-dir":return"y confirm \xB7 n cancel";case"detail":return"\u2191\u2193 dir \xB7 a add \xB7 l limit \xB7 x remove \xB7 r rename \xB7 p pause \xB7 esc back";case"list":return"\u2191\u2193 move \xB7 enter open \xB7 a add this dir \xB7 d pin here \xB7 n new \xB7 x delete"}}render(e,t){const n=this.mode==="list"||this.mode==="new-name"||this.mode==="confirm-delete"?this.renderList(e,t):this.renderDetail(e,t);if(this.notice!==void 0){n.push("");for(const r of L(this.notice,e))n.push(a(o.fg(this.noticeTone,r),e))}return n}header(e,t,i){const n=o.fg("accent",o.bold(t)),r=o.fg("dim",i);return a(`${n} ${r}`,e)}renderList(e,t){const i=[this.header(e,"Profiles",`${this.entries.length} profile${this.entries.length===1?"":"s"}`),a(o.fg("dim",`Identities your sessions run under. Here: ${c(this.cwd)}`),e),""];if(this.mode==="new-name")return[...i,...this.field(e,"New profile name",this.nameInput)];if(this.mode==="confirm-delete")return[...i,...this.deletePrompt(e)];if(this.entries.length===0)return i.push(a(o.fg("dim"," No profiles yet \u2014 press n to create one here."),e)),i;const n=this.pinnedHere(),r=Math.min(22,Math.max(...this.entries.map(u=>u.manifest.name.length))),s=Math.max(1,t-8),h=k(this.entries.length,this.listIndex,s);for(let u=h.start;u<h.end;u+=1){const d=this.entries[u],y=d.manifest.projects.length,v=y===0?"\u2014":`${y} dir${y===1?"":"s"}`,p=[];T(d,this.cwd)&&p.push("covers here"),n===d.profileId&&p.push("pinned"),d.manifest.paused_at!==null&&p.push("paused");const l=`${f(d.manifest.name,r)} ${f(v,8)} ${f(C(d.manifest.last_used_at),14)} ${p.join(" \xB7 ")}`;u===this.listIndex?i.push(o.bg("selectedBg",f(`\u25B8 ${l}`,e))):i.push(a(` ${f(d.manifest.name,r)} ${o.fg("dim",`${f(v,8)} ${f(C(d.manifest.last_used_at),14)}`)} ${o.fg("muted",p.join(" \xB7 "))}`,e))}return(h.start>0||h.end<this.entries.length)&&i.push(a(o.fg("dim",` ${this.listIndex+1}/${this.entries.length}`),e)),i}renderDetail(e,t){const i=this.open();if(i===null)return this.renderList(e,t);const n=i.manifest,r=[`app ${n.grantee??"app:terminal"}`,`kind ${n.default_kind??"general"}`,C(n.last_used_at),...n.paused_at!==null?["paused"]:[]],s=[this.header(e,n.name,i.profileId),a(o.fg("dim",r.join(" \xB7 ")),e),""];if(this.mode==="rename")return[...s,...this.field(e,"Rename profile",this.nameInput)];if(this.mode==="add-dir")return[...s,...this.field(e,"Directory to add to this profile",this.dirInput)];if(this.mode==="set-limit")return[...s,...this.field(e,"Delivery limit: owner handle and level (content removes it)",this.limitInput)];const h=Object.entries(n.delivery_limits??{});h.length>0&&(s.push(a(o.fg("dim",`limits ${h.map(([l,$])=>`${l} ${$}`).join(" \xB7 ")}`),e)),s.push(""));const u=n.projects;if(u.length===0)return s.push(a(o.fg("dim"," Owns no directories \u2014 press a to add one."),e)),s;const d=new Set(S(i.profileId)),y=Math.min(Math.max(20,e-16),Math.max(...u.map(l=>c(l.path).length))),v=Math.max(1,t-8),p=k(u.length,this.dirIndex,v);for(let l=p.start;l<p.end;l+=1){const $=u[l],w=[];d.has($.path)&&w.push("pinned"),$.path===this.cwd&&w.push("\u2190 here");const P=f(c($.path),y),R=`${P} ${w.join(" \xB7 ")}`;l===this.dirIndex?s.push(o.bg("selectedBg",f(`\u25B8 ${R}`,e))):s.push(a(` ${P} ${o.fg("muted",w.join(" \xB7 "))}`,e))}if(this.mode==="confirm-remove-dir"){const l=this.currentDir();s.push(""),s.push(a(o.fg("warning",`Remove ${l!==null?c(l.path):"this directory"} from "${n.name}"? Its files are untouched. y / n`),e))}return s}field(e,t,i){return[a(o.fg("accent",t),e),a(` ${i.render(Math.max(8,e-2))[0]??""}`,e)]}deletePrompt(e){const i=this.open()?.manifest.name??"",n=[];for(const r of L(`Delete "${i}" and everything it owns \u2014 every node, cron, inbox ticket and review under it, plus its documents (one that another document links to is kept until that link goes) and directory pins? This cannot be undone.`,e))n.push(a(o.fg("warning",r),e));return n.push(""),n.push(a(o.fg("dim"," y delete n cancel"),e)),n}}export{ie as ProfilesPanel};
1
+ var E=Object.defineProperty;var g=(m,e)=>E(m,"name",{value:e,configurable:!0});import{envNodeId as F}from"../../../shared/env.js";import{Input as C,matchesKey as I,truncateToWidth as l}from"@earendil-works/pi-tui";import{basename as N}from"node:path";import{PROFILE_PROJECT_MEMORY_VALUES as j,projectPaths as v}from"../../../api/dto/profiles.js";import{cliClient as b}from"../../api-client.js";import{clearDefaultProfile as S,defaultProfileDirs as H,getDefaultProfileId as V,setDefaultProfileId as A}from"../../../core/profiles/default-binding.js";import{ROOT_PROFILE_ID as M,addProfileProject as T,createProfile as U,listProfiles as W,removeProfileProject as B,setProfileDeliveryLimit as J}from"../../../core/profiles/manifest.js";import{tildify as c}from"../../../core/fs-utils.js";import{profileCoversCwd as k}from"../../../core/profiles/select.js";import{padAnsi as f,theme as o,visibleRange as L,wrapText as R}from"../../../core/tui/panel.js";function P(m){if(m===null)return"never used";const e=Date.parse(m);if(Number.isNaN(e))return"used recently";const t=Math.max(0,Math.floor((Date.now()-e)/1e3));if(t<60)return"used just now";const i=Math.floor(t/60);if(i<60)return`used ${i}m ago`;const n=Math.floor(i/60);if(n<24)return`used ${n}h ago`;const r=Math.floor(n/24);if(r<30)return`used ${r}d ago`;const s=Math.floor(r/30);return s<12?`used ${s}mo ago`:`used ${Math.floor(s/12)}y ago`}g(P,"relativeUsed");function D(m){return m instanceof Error?m.message:String(m)}g(D,"messageOf");class ne{static{g(this,"ProfilesPanel")}cwd;onChange;nameInput=new C;dirInput=new C;limitInput=new C;entries=[];listIndex=0;dirIndex=0;mode="list";openId=null;notice;noticeTone="success";mutating=!1;constructor(e,t){this.cwd=e,this.onChange=t,this.nameInput.onSubmit=()=>{this.submitName(),this.onChange()},this.nameInput.onEscape=()=>{this.mode=this.openId!==null?"detail":"list",this.leaveField(),this.onChange()},this.dirInput.onSubmit=()=>{this.submitDir(),this.onChange()},this.dirInput.onEscape=()=>{this.mode="detail",this.leaveField(),this.onChange()},this.limitInput.onSubmit=()=>{this.submitLimit(),this.onChange()},this.limitInput.onEscape=()=>{this.mode="detail",this.leaveField(),this.onChange()},this.reload()}badge(){return String(this.entries.length)}ownsInput(e){return this.mode==="list"?!1:this.mode==="detail"?I(e,"escape")||I(e,"left"):!0}reload(){const e=g(n=>n.profileId===M?2:k(n,this.cwd)?0:1,"rank"),t=g(n=>n.manifest.last_used_at??"","used");this.entries=W().sort((n,r)=>{const s=e(n)-e(r);if(s!==0)return s;const h=t(r).localeCompare(t(n));return h!==0?h:n.manifest.name.localeCompare(r.manifest.name)}),this.listIndex>=this.entries.length&&(this.listIndex=Math.max(0,this.entries.length-1));const i=this.open();i===null?(this.mode!=="list"&&(this.mode="list"),this.openId=null):this.dirIndex>=v(i.manifest.projects).length&&(this.dirIndex=Math.max(0,v(i.manifest.projects).length-1))}selected(){return this.entries[this.listIndex]??null}open(){return this.openId===null?null:this.entries.find(e=>e.profileId===this.openId)??null}currentDir(){const e=v(this.open()?.manifest.projects??[])[this.dirIndex];return e===void 0?null:{path:e}}pinnedHere(){return V(this.cwd)}say(e,t="success"){this.notice=e,this.noticeTone=t}attempt(e,t){this.mutating||(this.mutating=!0,(async()=>{try{await e(),this.reload(),this.say(t)}catch(i){this.say(D(i),"warning")}finally{this.mutating=!1,this.onChange()}})())}handleInput(e,t){const i=this.route(e,t);return i&&this.onChange(),i}route(e,t){switch(this.mode){case"new-name":case"rename":return this.routeText(this.nameInput,e);case"add-dir":return this.routeText(this.dirInput,e);case"set-limit":return this.routeText(this.limitInput,e);case"confirm-delete":return this.routeConfirm(e,()=>{this.deleteOpen()});case"confirm-remove-dir":return this.routeConfirm(e,()=>this.removeDir());case"detail":return this.routeDetail(e,t);case"list":return this.routeList(e,t)}}routeText(e,t){return e.handleInput(t),!0}routeConfirm(e,t){const i=e.toLowerCase();return i==="y"?t():(i==="n"||I(e,"escape")||I(e,"return"))&&(this.mode=this.openId!==null?"detail":"list",this.say("Cancelled.")),!0}routeList(e,t){if(t?.("crtr.setup.list-down",e)===!0)return this.move(1),!0;if(t?.("crtr.setup.list-up",e)===!0)return this.move(-1),!0;if(t?.("crtr.setup.advance",e)===!0){const i=this.selected();return i!==null&&(this.openId=i.profileId,this.dirIndex=0,this.mode="detail",this.notice=void 0),!0}switch(e.toLowerCase()){case"a":return this.addCwdTo(this.selected());case"d":return this.togglePin();case"n":return this.mode="new-name",this.edit(this.nameInput,N(this.cwd)||"profile"),!0;case"x":return this.askDelete();default:return!1}}routeDetail(e,t){const i=this.open();if(i===null)return this.mode="list",!0;if(I(e,"escape")||I(e,"left"))return this.mode="list",this.notice=void 0,!0;if(t?.("crtr.setup.list-down",e)===!0)return this.moveDir(1),!0;if(t?.("crtr.setup.list-up",e)===!0)return this.moveDir(-1),!0;switch(e.toLowerCase()){case"a":return this.mode="add-dir",this.edit(this.dirInput,this.cwd),!0;case"l":return this.mode="set-limit",this.edit(this.limitInput,""),!0;case"x":return this.askRemoveDir();case"r":return this.mode="rename",this.edit(this.nameInput,i.manifest.name),!0;case"p":return this.togglePause();default:return!1}}edit(e,t){e.setValue(t),e.handleInput(""),e.focused=!0,this.notice=void 0}leaveField(){this.nameInput.focused=!1,this.dirInput.focused=!1,this.limitInput.focused=!1}move(e){this.entries.length!==0&&(this.listIndex=(this.listIndex+e+this.entries.length)%this.entries.length,this.notice=void 0)}moveDir(e){const t=v(this.open()?.manifest.projects??[]).length;t!==0&&(this.dirIndex=(this.dirIndex+e+t)%t,this.notice=void 0)}addCwdTo(e){return e===null||this.attempt(()=>T(e.profileId,this.cwd),`${c(this.cwd)} now belongs to "${e.manifest.name}".`),!0}togglePin(){const e=this.selected();return e===null||(this.pinnedHere()===e.profileId?this.attempt(()=>S(this.cwd),`${c(this.cwd)} no longer defaults to any profile.`):this.attempt(()=>A(this.cwd,e.profileId),`${c(this.cwd)} now starts as "${e.manifest.name}" without asking.`)),!0}submitName(){const e=this.nameInput.getValue().trim(),t=this.mode==="new-name";if(this.mode=t?"list":"detail",this.leaveField(),e===""){this.say("A profile name cannot be empty.","warning");return}if(t){this.attempt(async()=>{const n=(await U(e,[{path:this.cwd}])).profileId;this.reload();const r=this.entries.findIndex(s=>s.profileId===n);r>=0&&(this.listIndex=r)},`Created "${e}", owning ${c(this.cwd)}.`);return}const i=this.open();i!==null&&this.rename(i.profileId,e)}async rename(e,t){if(!this.mutating){this.mutating=!0;try{await b().updateProfile(e,{name:t}),this.reload(),this.say(`Renamed to "${t}".`)}catch(i){this.say(D(i),"warning")}finally{this.mutating=!1,this.onChange()}}}submitDir(){const e=this.dirInput.getValue().trim(),t=this.open();if(this.mode="detail",this.leaveField(),t!==null){if(e===""){this.say("Type the directory to add.","warning");return}this.attempt(()=>T(t.profileId,e),`${c(e)} added to "${t.manifest.name}".`)}}submitLimit(){const e=this.limitInput.getValue().trim().split(/\s+/),t=this.open();if(this.mode="detail",this.leaveField(),t===null)return;const[i,n]=e;if(e.length!==2||i===void 0||n===void 0||!j.includes(n)){this.say(`Type an owner handle and a level (${j.join(", ")}), e.g. "crouter preview".`,"warning");return}this.attempt(()=>J(t.profileId,i,n),n==="content"?`${i} is no longer limited.`:`${i} is delivered automatically up to "${n}".`)}askRemoveDir(){return this.currentDir()===null?(this.say("This profile owns no directories.","warning"),!0):(this.mode="confirm-remove-dir",this.notice=void 0,!0)}removeDir(){const e=this.open(),t=this.currentDir();this.mode="detail",!(e===null||t===null)&&this.attempt(()=>B(e.profileId,t.path),`${c(t.path)} removed from "${e.manifest.name}".`)}togglePause(){const e=this.open();return e!==null&&!this.mutating&&this.changePause(e),!0}async changePause(e){this.mutating=!0;const t=e.manifest.paused_at!==null;try{t?await b().resumeProfile(e.profileId):await b().pauseProfile(e.profileId),this.reload(),this.say(t?`"${e.manifest.name}" is active again.`:`"${e.manifest.name}" is paused \u2014 no new nodes start under it.`)}catch(i){this.say(D(i),"warning")}finally{this.mutating=!1,this.onChange()}}askDelete(){const e=this.selected();return e===null?!0:e.profileId===M?(this.say("The root profile is the fallback identity for uncovered directories and cannot be deleted.","warning"),!0):(this.openId=e.profileId,this.mode="confirm-delete",this.notice=void 0,!0)}async deleteOpen(){const e=this.open();if(this.mode="list",!(e===null||this.mutating)){this.mutating=!0,this.say(`Deleting "${e.manifest.name}"\u2026`),this.onChange();try{const t=await b().deleteProfile(e.profileId,{force:!0,caller_node_id:F()??null});this.openId=null,this.reload(),this.say(`Deleted "${t.name}" \u2014 ${t.nodes} nodes, ${t.crons} crons, ${t.default_pins} pins.`)}catch(t){this.say(D(t),"warning")}finally{this.mutating=!1,this.onChange()}}}footerHint(){switch(this.mode){case"new-name":return"type a name \xB7 enter create \xB7 esc cancel";case"rename":return"type a name \xB7 enter save \xB7 esc cancel";case"add-dir":return"type a directory \xB7 enter add \xB7 esc cancel";case"set-limit":return"type <owner> <level> \xB7 enter save \xB7 esc cancel";case"confirm-delete":case"confirm-remove-dir":return"y confirm \xB7 n cancel";case"detail":return"\u2191\u2193 dir \xB7 a add \xB7 l limit \xB7 x remove \xB7 r rename \xB7 p pause \xB7 esc back";case"list":return"\u2191\u2193 move \xB7 enter open \xB7 a add this dir \xB7 d pin here \xB7 n new \xB7 x delete"}}render(e,t){const n=this.mode==="list"||this.mode==="new-name"||this.mode==="confirm-delete"?this.renderList(e,t):this.renderDetail(e,t);if(this.notice!==void 0){n.push("");for(const r of R(this.notice,e))n.push(l(o.fg(this.noticeTone,r),e))}return n}header(e,t,i){const n=o.fg("accent",o.bold(t)),r=o.fg("dim",i);return l(`${n} ${r}`,e)}renderList(e,t){const i=[this.header(e,"Profiles",`${this.entries.length} profile${this.entries.length===1?"":"s"}`),l(o.fg("dim",`Identities your sessions run under. Here: ${c(this.cwd)}`),e),""];if(this.mode==="new-name")return[...i,...this.field(e,"New profile name",this.nameInput)];if(this.mode==="confirm-delete")return[...i,...this.deletePrompt(e)];if(this.entries.length===0)return i.push(l(o.fg("dim"," No profiles yet \u2014 press n to create one here."),e)),i;const n=this.pinnedHere(),r=Math.min(22,Math.max(...this.entries.map(u=>u.manifest.name.length))),s=Math.max(1,t-8),h=L(this.entries.length,this.listIndex,s);for(let u=h.start;u<h.end;u+=1){const d=this.entries[u],y=d.manifest.projects.length,w=y===0?"\u2014":`${y} dir${y===1?"":"s"}`,p=[];k(d,this.cwd)&&p.push("covers here"),n===d.profileId&&p.push("pinned"),d.manifest.paused_at!==null&&p.push("paused");const a=`${f(d.manifest.name,r)} ${f(w,8)} ${f(P(d.manifest.last_used_at),14)} ${p.join(" \xB7 ")}`;u===this.listIndex?i.push(o.bg("selectedBg",f(`\u25B8 ${a}`,e))):i.push(l(` ${f(d.manifest.name,r)} ${o.fg("dim",`${f(w,8)} ${f(P(d.manifest.last_used_at),14)}`)} ${o.fg("muted",p.join(" \xB7 "))}`,e))}return(h.start>0||h.end<this.entries.length)&&i.push(l(o.fg("dim",` ${this.listIndex+1}/${this.entries.length}`),e)),i}renderDetail(e,t){const i=this.open();if(i===null)return this.renderList(e,t);const n=i.manifest,r=[`app ${n.grantee??"app:terminal"}`,`kind ${n.default_kind??"general"}`,P(n.last_used_at),...n.paused_at!==null?["paused"]:[]],s=[this.header(e,n.name,i.profileId),l(o.fg("dim",r.join(" \xB7 ")),e),""];if(this.mode==="rename")return[...s,...this.field(e,"Rename profile",this.nameInput)];if(this.mode==="add-dir")return[...s,...this.field(e,"Directory to add to this profile",this.dirInput)];if(this.mode==="set-limit")return[...s,...this.field(e,"Delivery limit: owner handle and level (content removes it)",this.limitInput)];const h=Object.entries(n.delivery_limits??{});h.length>0&&(s.push(l(o.fg("dim",`limits ${h.map(([a,$])=>`${a} ${$}`).join(" \xB7 ")}`),e)),s.push(""));const u=v(n.projects).map(a=>({path:a}));if(u.length===0)return s.push(l(o.fg("dim"," Owns no directories \u2014 press a to add one."),e)),s;const d=new Set(H(i.profileId)),y=Math.min(Math.max(20,e-16),Math.max(...u.map(a=>c(a.path).length))),w=Math.max(1,t-8),p=L(u.length,this.dirIndex,w);for(let a=p.start;a<p.end;a+=1){const $=u[a],x=[];d.has($.path)&&x.push("pinned"),$.path===this.cwd&&x.push("\u2190 here");const _=f(c($.path),y),O=`${_} ${x.join(" \xB7 ")}`;a===this.dirIndex?s.push(o.bg("selectedBg",f(`\u25B8 ${O}`,e))):s.push(l(` ${_} ${o.fg("muted",x.join(" \xB7 "))}`,e))}if(this.mode==="confirm-remove-dir"){const a=this.currentDir();s.push(""),s.push(l(o.fg("warning",`Remove ${a!==null?c(a.path):"this directory"} from "${n.name}"? Its files are untouched. y / n`),e))}return s}field(e,t,i){return[l(o.fg("accent",t),e),l(` ${i.render(Math.max(8,e-2))[0]??""}`,e)]}deletePrompt(e){const i=this.open()?.manifest.name??"",n=[];for(const r of R(`Delete "${i}" and everything it owns \u2014 every node, cron, inbox ticket and review under it, plus its documents (one that another document links to is kept until that link goes) and directory pins? This cannot be undone.`,e))n.push(l(o.fg("warning",r),e));return n.push(""),n.push(l(o.fg("dim"," y delete n cancel"),e)),n}}export{ne as ProfilesPanel};
@@ -0,0 +1 @@
1
+ export declare const sysRepoDocsBranch: import("../../core/command.js").BranchDef;
@@ -0,0 +1,2 @@
1
+ var u=Object.defineProperty;var n=(e,r)=>u(e,"name",{value:r,configurable:!0});import{execFileSync as g}from"node:child_process";import{readdirSync as y,readFileSync as w,statSync as $}from"node:fs";import{join as S,relative as k}from"node:path";import{defineBranch as v,defineLeaf as p}from"../../core/command.js";import{general as j,usage as b}from"../../core/errors.js";import{cliClient as m,rethrowAsCliError as l}from"../api-client.js";const f="refs/crtr/docs",d=n((e,r)=>g("git",r,{cwd:e,encoding:"utf8",maxBuffer:512*1024*1024,stdio:["ignore","pipe","pipe"]}),"git");function h(e,r=[]){for(const i of y(e)){const o=S(e,i);$(o).isDirectory()?h(o,r):i.endsWith(".md")&&r.push(o)}return r}n(h,"walk");const q=p({name:"import",tier:"hidden",description:"one-time: upload refs/crtr/docs (and legacy files) into a repo object",help:{name:"sys repo-docs import",summary:"fetch `refs/crtr/docs` from this checkout's origin and upload it into the repo object, keeping document ids and revision history",params:[{kind:"flag",name:"repo",type:"string",required:!0,constraint:"The repo object handle to import into (you need edit on it)."},{kind:"flag",name:"legacy-dir",type:"string",required:!1,constraint:"A directory of legacy markdown files (e.g. the old memory folder); files whose name is neither on the ref nor in the canvas are uploaded too."}],output:[{name:"summary",type:"string",required:!0,constraint:"Counts of what landed and what was refused."}],outputKind:"object",effects:["Runs `git fetch origin refs/crtr/docs` in the current directory, posts the tree to `POST /v1/repos/:repo/import`; re-running changes nothing already imported."]},run:n(async e=>{const r=typeof e.repo=="string"?e.repo:"";if(r==="")throw b("--repo <handle> is required");const i=process.cwd();try{d(i,["fetch","--quiet","origin",`+${f}:refs/crtr/import-tip`])}catch(t){throw j(`could not fetch ${f} from origin: ${t.message.slice(0,300)}`)}const o={};for(const t of d(i,["ls-tree","-r","--name-only","refs/crtr/import-tip"]).split(`
2
+ `).filter(c=>c.startsWith("docs/")&&c.endsWith(".json")))o[t]=d(i,["show",`refs/crtr/import-tip:${t}`]);const s=typeof e.legacyDir=="string"?e.legacyDir:void 0,a=s===void 0?void 0:h(s).map(t=>({name:k(s,t).replace(/\.md$/,"").replace(/\/INDEX$/,"/index"),text:w(t,"utf8")}));try{return{...await m().importRepoDocs(r,{tree:o,...a!==void 0?{legacy:a}:{}}),files:Object.keys(o).length}}catch(t){l(t)}},"run"),render:n(e=>`<repo-docs-import repo="${String(e.repo)}" files="${String(e.files)}" created="${String(e.created)}" revisions="${String(e.revisions)}" deleted="${String(e.deleted)}" refused="${e.refused.length}" legacy-imported="${e.legacy_imported.length}" legacy-skipped="${e.legacy_skipped.length}">${JSON.stringify({refused:e.refused,legacy_skipped:e.legacy_skipped})}</repo-docs-import>`,"render")}),D=p({name:"rename",tier:"hidden",description:"one-time: change a repo object's handle",help:{name:"sys repo-docs rename",summary:"give the repo object `<old>` the handle `<new>`; its id and documents are unchanged",params:[{kind:"positional",name:"old",required:!0,constraint:"The current repo handle."},{kind:"positional",name:"new",required:!0,constraint:"The new handle; refused when another live repo holds it."}],output:[{name:"id",type:"string",required:!0,constraint:"The repo object id."},{name:"name",type:"string",required:!0,constraint:"Its handle now."}],outputKind:"object",effects:["Renames the repo object. Links are edges to ids, so they keep resolving."]},run:n(async e=>{try{return{...await m().renameRepo(String(e.old),String(e.new))}}catch(r){l(r)}},"run"),render:n(e=>`<repo id="${String(e.id)}" name="${String(e.name)}" renamed="${String(e.renamed)}"/>`,"render")}),E=v({name:"repo-docs",tier:"hidden",description:"one-time repo-document cutover",whenToUse:"the production cutover of repo documents from the git ref into the canvas",help:{name:"sys repo-docs",summary:"import `refs/crtr/docs` into a repo object, or rename a repo handle (removed after the cutover)",model:"Hidden, temporary commands."},children:[q,D]});export{E as sysRepoDocsBranch};
@@ -1,5 +1,5 @@
1
- var N=Object.defineProperty;var c=(r,t)=>N(r,"name",{value:t,configurable:!0});import{envProfileId as x}from"../../shared/env.js";import{existsSync as y,readdirSync as T,statSync as v}from"node:fs";import{basename as L,join as g,relative as F,resolve as f}from"node:path";import{defineLeaf as W}from"../../core/command.js";import{parseFrontmatterGeneric as $}from"../../core/frontmatter.js";import{readText as D,realpathOrSelf as S,walkFiles as G}from"../../core/fs-utils.js";import{identifyCheckout as M}from"../../core/graph/repo-sync/identity.js";import{loadProfileManifest as O}from"../../core/profiles/manifest.js";import{CRTR_DIR_NAME as P}from"../../types.js";import{cliClient as _}from"../api-client.js";import{normalizedName as j,putDoc as U,repoOwner as I,routeFromDescription as q,rulesFromLegacyFrontmatter as z,scalarString as w,writeFailure as J}from"./sync-shared.js";const K=new Set(["node_modules",".git",".venv","venv","dist","build",".next",".cache",".yalc",".sisyphus",P]),B=["AGENTS.md","CLAUDE.md"];function H(r){if(r!==void 0)return[f(r)];const t=[f(process.cwd())],e=x();if(e!==void 0&&e!=="")try{const{manifest:s}=O(e);for(const o of s.projects){const n=f(o.path);t.includes(n)||t.push(n)}}catch{}return t}c(H,"projectDocRoots");function Q(r){const t=[];if(!y(r)||!v(r).isDirectory())return t;const e=f(r),s=[e];for(;s.length>0;){const o=s.pop();for(const a of B){const d=g(o,a);if(y(d)&&v(d).isFile()){t.push({kind:"agents",path:d,sourceDir:o,walkRoot:e});break}}const n=g(o,".claude","rules");if(y(n))for(const a of G(n,d=>d.endsWith(".md")))t.push({kind:"rule",path:a,sourceDir:o,walkRoot:e});let i;try{i=T(o,{withFileTypes:!0})}catch{continue}for(const a of i)a.isDirectory()&&!K.has(a.name)&&s.push(g(o,a.name))}return t}c(Q,"collectProjectDocCandidates");function me(r){for(const t of r.split(`
2
- `)){const e=t.replace(/^#+\s*/,"").replace(/\s+/g," ").trim();if(e!=="")return e.length>200?`${e.slice(0,197)}...`:e}return"Migrated project guidance."}c(me,"synthesizeShortForm");function E(r){const t=[];let e=0,s="";for(const o of r){if(o==="{"?e+=1:o==="}"&&(e=Math.max(0,e-1)),o===","&&e===0){t.push(s),s="";continue}s+=o}return t.push(s),t.map(o=>o.trim()).filter(o=>o!=="")}c(E,"splitTopLevelCommas");function V(r){return typeof r=="string"?E(r):Array.isArray(r)?r.filter(t=>typeof t=="string").flatMap(E):[]}c(V,"normalizeRulePaths");function R(r,t){let e=r.trim();return e.includes("/")&&!e.startsWith("/")&&!e.startsWith("**")&&!e.startsWith("./")&&(e=`./${e}`),!e.startsWith("./")||t===""?e:`./${t}/${e.slice(2)}`}c(R,"anchorReadGlob");function k(r){for(const t of r.split(`
3
- `)){const e=t.replace(/^#+\s*/,"").replace(/\s+/g," ").trim();if(e!=="")return e.length>200?`${e.slice(0,197)}...`:e}return"Migrated project guidance."}c(k,"firstNonEmptyLine");function C(r,t){return j(F(S(r.cwd),S(t)))}c(C,"folderName");function X(r,t){const e=$(D(r.path)),s=e.data??{},o=C(t,r.sourceDir);if(o==="")return{candidate:r,owner:t,doc:{name:"index",kind:"knowledge",preview:`When working in ${t.handle}, read this because it is the project's operating guide.`,summary:k(e.body),rules:[{on:"workspace-open",deliver:"content"},{on:"file-read",match:["./**"],deliver:"content"}],body:e.body}};const n=z(s).filter(a=>a.on==="file-read"),i=w(s["when-and-why-to-read"])?.trim();return{candidate:r,owner:t,doc:{name:o,kind:"knowledge",preview:i!==void 0&&i!==""?i:`When working under ${o} in ${t.handle}, read this because it carries that folder's guidance.`,summary:k(e.body),rules:n.length>0?n.map(a=>a.match?{...a,match:a.match.map(d=>R(d,o))}:a):[{on:"file-read",match:[`./${o}/**`],deliver:"content"}],body:e.body}}}c(X,"prepareAgents");function Y(r,t){const e=$(D(r.path)),s=e.data??{},o=C(t,r.sourceDir),n=w(s.name),i=j(n!==void 0&&n.trim()!==""?n:L(r.path)),a=o===""?i:`${o}/${i}`,d=w(s.description)??"",p=V(s.paths).map(l=>R(l,o)),u={on:"file-read",match:p.length>0?p:[o===""?"./**":`./${o}/**`],deliver:"content"};return{candidate:r,owner:t,doc:{name:a,kind:"knowledge",preview:d!==""?q(d,"knowledge"):`When working under ${o===""?t.handle:`${o} in ${t.handle}`}, read this because it is migrated project rule guidance.`,summary:d!==""?d.replace(/\s+/g," ").trim():k(e.body),rules:[u],body:e.body}}}c(Y,"prepareRule");async function Z(r,t,e){const{owner:s,doc:o}=t,n={source:t.candidate.path,name:`${s.handle}/${o.name}`};if(s.existing.has(o.name)&&!e.overwrite)return{...n,status:"skipped",reason:"a document with this name already exists; re-run with --overwrite to replace it"};if(e.dryRun)return{...n,status:"would-import"};try{const i=await U(r,s,o,"migrated by crtr sys sync project-guidance");return{...n,name:i.name,status:i.changed?"imported":"unchanged"}}catch(i){return{...n,status:"skipped",reason:J(i)}}}c(Z,"convertProjectDoc");function ee(r){const t=c(n=>r.filter(i=>i.status===n).length,"count"),e=t("would-import")>0?`crtr sys sync project-guidance \u2014 dry run: ${t("would-import")} would import, ${t("skipped")} skipped`:`crtr sys sync project-guidance \u2014 ${t("imported")} imported, ${t("unchanged")} unchanged, ${t("skipped")} skipped`,s=r.map(n=>{const i=n.reason?` (${n.reason})`:"";return`| ${n.status} | ${n.name||"\u2014"} | ${n.source}${i} |`}),o=s.length===0?["No sync candidates."]:["| status | document | source |","| --- | --- | --- |",...s];return[e,"",...o].join(`
4
- `)}c(ee,"renderSummary");const fe=W({name:"project-guidance",description:"migrate repository guidance into documents owned by the repo",whenToUse:"migrating a repository's CLAUDE.md/AGENTS.md/.claude/rules into documents owned by that repo: one-way copy. Only the repository-root guide becomes the workspace front door (`<repo>/index`); nested guides and rules load when files under their folder are read. Never exports documents back to these source files.",help:{name:"sys sync project-guidance",summary:"one-way migration: CLAUDE.md/AGENTS.md/.claude/rules \u2192 documents owned by the repo",params:[{kind:"flag",name:"source",type:"string",required:!1,constraint:"The root to walk recursively for CLAUDE.md/AGENTS.md/.claude/rules files. Default: cwd plus every project in the current profile's purview (when one is selected)."},{kind:"flag",name:"dry-run",type:"bool",required:!1,constraint:"Show what would be migrated without writing documents."},{kind:"flag",name:"overwrite",type:"bool",required:!1,constraint:"Replace the body and fields of an existing document of the same name (a new revision). Default: skip it."}],output:[{name:"results",type:"object[]",required:!0,constraint:"Each: {source,name,status,reason?}; status is one of imported, unchanged, skipped, would-import. `name` is the document's full name."}],outputKind:"object",effects:["Copies the repository-root CLAUDE.md/AGENTS.md into `<repo>/index` with a workspace-open rule and a file-read rule over the whole repo, both at content. Copies a nested guide into `<repo>/<folder>` with a file-read rule over that folder. Copies each .claude/rules/*.md into `<repo>/<folder>/<rule name>` with a file-read rule over its `paths` (placed under the folder when relative), or over the folder when it declares none. Originals are left untouched; a source outside any repo is skipped. Repo documents sync to everyone working in the repo.","Skips existing documents unless --overwrite is present.","With --dry-run: read-only; writes nothing."]},run:c(async r=>{const t=r.source,e=r.dryRun??!1,s=r.overwrite??!1,o=_(),n=[],i=new Set,a=new Map,d=[];for(const p of H(t))for(const u of Q(p)){if(i.has(u.path))continue;i.add(u.path);const l=M(u.sourceDir);if(!l.ok){n.push({source:u.path,name:"",status:"skipped",reason:`not inside a repo: ${l.reason}`});continue}let m=a.get(l.root);m===void 0&&(m=I(o,l.root),a.set(l.root,m));const b=await m;try{d.push(u.kind==="agents"?X(u,b):Y(u,b))}catch(h){const A=(h instanceof Error?h.message:String(h)).split(`
5
- `)[0];n.push({source:u.path,name:"",status:"skipped",reason:`unparseable source frontmatter: ${A} \u2014 fix the source file and re-run`})}}for(const p of d)n.push(await Z(o,p,{dryRun:e,overwrite:s}));return{results:n}},"run"),render:c(r=>ee(r.results),"render")});export{fe as sysSyncProjectGuidanceLeaf};
1
+ var N=Object.defineProperty;var c=(r,t)=>N(r,"name",{value:t,configurable:!0});import{projectPaths as x}from"../../api/dto/profiles.js";import{envProfileId as T}from"../../shared/env.js";import{existsSync as y,readdirSync as L,statSync as v}from"node:fs";import{basename as F,join as g,relative as P,resolve as f}from"node:path";import{defineLeaf as W}from"../../core/command.js";import{parseFrontmatterGeneric as $}from"../../core/frontmatter.js";import{readText as D,realpathOrSelf as S,walkFiles as G}from"../../core/fs-utils.js";import{identifyCheckout as M}from"../../core/graph/repo-sync/identity.js";import{loadProfileManifest as O}from"../../core/profiles/manifest.js";import{CRTR_DIR_NAME as _}from"../../types.js";import{cliClient as U}from"../api-client.js";import{normalizedName as j,putDoc as I,repoOwner as q,routeFromDescription as z,rulesFromLegacyFrontmatter as J,scalarString as w,writeFailure as K}from"./sync-shared.js";const B=new Set(["node_modules",".git",".venv","venv","dist","build",".next",".cache",".yalc",".sisyphus",_]),H=["AGENTS.md","CLAUDE.md"];function Q(r){if(r!==void 0)return[f(r)];const t=[f(process.cwd())],e=T();if(e!==void 0&&e!=="")try{const{manifest:s}=O(e);for(const o of x(s.projects)){const n=f(o);t.includes(n)||t.push(n)}}catch{}return t}c(Q,"projectDocRoots");function V(r){const t=[];if(!y(r)||!v(r).isDirectory())return t;const e=f(r),s=[e];for(;s.length>0;){const o=s.pop();for(const a of H){const d=g(o,a);if(y(d)&&v(d).isFile()){t.push({kind:"agents",path:d,sourceDir:o,walkRoot:e});break}}const n=g(o,".claude","rules");if(y(n))for(const a of G(n,d=>d.endsWith(".md")))t.push({kind:"rule",path:a,sourceDir:o,walkRoot:e});let i;try{i=L(o,{withFileTypes:!0})}catch{continue}for(const a of i)a.isDirectory()&&!B.has(a.name)&&s.push(g(o,a.name))}return t}c(V,"collectProjectDocCandidates");function he(r){for(const t of r.split(`
2
+ `)){const e=t.replace(/^#+\s*/,"").replace(/\s+/g," ").trim();if(e!=="")return e.length>200?`${e.slice(0,197)}...`:e}return"Migrated project guidance."}c(he,"synthesizeShortForm");function E(r){const t=[];let e=0,s="";for(const o of r){if(o==="{"?e+=1:o==="}"&&(e=Math.max(0,e-1)),o===","&&e===0){t.push(s),s="";continue}s+=o}return t.push(s),t.map(o=>o.trim()).filter(o=>o!=="")}c(E,"splitTopLevelCommas");function X(r){return typeof r=="string"?E(r):Array.isArray(r)?r.filter(t=>typeof t=="string").flatMap(E):[]}c(X,"normalizeRulePaths");function R(r,t){let e=r.trim();return e.includes("/")&&!e.startsWith("/")&&!e.startsWith("**")&&!e.startsWith("./")&&(e=`./${e}`),!e.startsWith("./")||t===""?e:`./${t}/${e.slice(2)}`}c(R,"anchorReadGlob");function k(r){for(const t of r.split(`
3
+ `)){const e=t.replace(/^#+\s*/,"").replace(/\s+/g," ").trim();if(e!=="")return e.length>200?`${e.slice(0,197)}...`:e}return"Migrated project guidance."}c(k,"firstNonEmptyLine");function C(r,t){return j(P(S(r.cwd),S(t)))}c(C,"folderName");function Y(r,t){const e=$(D(r.path)),s=e.data??{},o=C(t,r.sourceDir);if(o==="")return{candidate:r,owner:t,doc:{name:"index",kind:"knowledge",preview:`When working in ${t.handle}, read this because it is the project's operating guide.`,summary:k(e.body),rules:[{on:"workspace-open",deliver:"content"},{on:"file-read",match:["./**"],deliver:"content"}],body:e.body}};const n=J(s).filter(a=>a.on==="file-read"),i=w(s["when-and-why-to-read"])?.trim();return{candidate:r,owner:t,doc:{name:o,kind:"knowledge",preview:i!==void 0&&i!==""?i:`When working under ${o} in ${t.handle}, read this because it carries that folder's guidance.`,summary:k(e.body),rules:n.length>0?n.map(a=>a.match?{...a,match:a.match.map(d=>R(d,o))}:a):[{on:"file-read",match:[`./${o}/**`],deliver:"content"}],body:e.body}}}c(Y,"prepareAgents");function Z(r,t){const e=$(D(r.path)),s=e.data??{},o=C(t,r.sourceDir),n=w(s.name),i=j(n!==void 0&&n.trim()!==""?n:F(r.path)),a=o===""?i:`${o}/${i}`,d=w(s.description)??"",p=X(s.paths).map(l=>R(l,o)),u={on:"file-read",match:p.length>0?p:[o===""?"./**":`./${o}/**`],deliver:"content"};return{candidate:r,owner:t,doc:{name:a,kind:"knowledge",preview:d!==""?z(d,"knowledge"):`When working under ${o===""?t.handle:`${o} in ${t.handle}`}, read this because it is migrated project rule guidance.`,summary:d!==""?d.replace(/\s+/g," ").trim():k(e.body),rules:[u],body:e.body}}}c(Z,"prepareRule");async function ee(r,t,e){const{owner:s,doc:o}=t,n={source:t.candidate.path,name:`${s.handle}/${o.name}`};if(s.existing.has(o.name)&&!e.overwrite)return{...n,status:"skipped",reason:"a document with this name already exists; re-run with --overwrite to replace it"};if(e.dryRun)return{...n,status:"would-import"};try{const i=await I(r,s,o,"migrated by crtr sys sync project-guidance");return{...n,name:i.name,status:i.changed?"imported":"unchanged"}}catch(i){return{...n,status:"skipped",reason:K(i)}}}c(ee,"convertProjectDoc");function te(r){const t=c(n=>r.filter(i=>i.status===n).length,"count"),e=t("would-import")>0?`crtr sys sync project-guidance \u2014 dry run: ${t("would-import")} would import, ${t("skipped")} skipped`:`crtr sys sync project-guidance \u2014 ${t("imported")} imported, ${t("unchanged")} unchanged, ${t("skipped")} skipped`,s=r.map(n=>{const i=n.reason?` (${n.reason})`:"";return`| ${n.status} | ${n.name||"\u2014"} | ${n.source}${i} |`}),o=s.length===0?["No sync candidates."]:["| status | document | source |","| --- | --- | --- |",...s];return[e,"",...o].join(`
4
+ `)}c(te,"renderSummary");const ye=W({name:"project-guidance",description:"migrate repository guidance into documents owned by the repo",whenToUse:"migrating a repository's CLAUDE.md/AGENTS.md/.claude/rules into documents owned by that repo: one-way copy. Only the repository-root guide becomes the workspace front door (`<repo>/index`); nested guides and rules load when files under their folder are read. Never exports documents back to these source files.",help:{name:"sys sync project-guidance",summary:"one-way migration: CLAUDE.md/AGENTS.md/.claude/rules \u2192 documents owned by the repo",params:[{kind:"flag",name:"source",type:"string",required:!1,constraint:"The root to walk recursively for CLAUDE.md/AGENTS.md/.claude/rules files. Default: cwd plus every project in the current profile's purview (when one is selected)."},{kind:"flag",name:"dry-run",type:"bool",required:!1,constraint:"Show what would be migrated without writing documents."},{kind:"flag",name:"overwrite",type:"bool",required:!1,constraint:"Replace the body and fields of an existing document of the same name (a new revision). Default: skip it."}],output:[{name:"results",type:"object[]",required:!0,constraint:"Each: {source,name,status,reason?}; status is one of imported, unchanged, skipped, would-import. `name` is the document's full name."}],outputKind:"object",effects:["Copies the repository-root CLAUDE.md/AGENTS.md into `<repo>/index` with a workspace-open rule and a file-read rule over the whole repo, both at content. Copies a nested guide into `<repo>/<folder>` with a file-read rule over that folder. Copies each .claude/rules/*.md into `<repo>/<folder>/<rule name>` with a file-read rule over its `paths` (placed under the folder when relative), or over the folder when it declares none. Originals are left untouched; a source outside any repo is skipped. Repo documents sync to everyone working in the repo.","Skips existing documents unless --overwrite is present.","With --dry-run: read-only; writes nothing."]},run:c(async r=>{const t=r.source,e=r.dryRun??!1,s=r.overwrite??!1,o=U(),n=[],i=new Set,a=new Map,d=[];for(const p of Q(t))for(const u of V(p)){if(i.has(u.path))continue;i.add(u.path);const l=M(u.sourceDir);if(!l.ok){n.push({source:u.path,name:"",status:"skipped",reason:`not inside a repo: ${l.reason}`});continue}let m=a.get(l.root);m===void 0&&(m=q(o,l.root),a.set(l.root,m));const b=await m;try{d.push(u.kind==="agents"?Y(u,b):Z(u,b))}catch(h){const A=(h instanceof Error?h.message:String(h)).split(`
5
+ `)[0];n.push({source:u.path,name:"",status:"skipped",reason:`unparseable source frontmatter: ${A} \u2014 fix the source file and re-run`})}}for(const p of d)n.push(await ee(o,p,{dryRun:e,overwrite:s}));return{results:n}},"run"),render:c(r=>te(r.results),"render")});export{ye as sysSyncProjectGuidanceLeaf};
@@ -1 +1 @@
1
- var s=Object.defineProperty;var r=(o,m)=>s(o,"name",{value:m,configurable:!0});import{defineSysBranch as t}from"./sys/branch.js";import{configBranch as f}from"./sys/config.js";import{sysEnvBranch as i}from"./sys/env.js";import{daemonBranch as e}from"./sys/daemon.js";import{sysDoctorLeaf as a}from"./sys/doctor.js";import{sysFeedbackLeaf as p}from"./sys/feedback.js";import{sysLogsLeaf as n}from"./sys/logs.js";import{sysRetryDeliveryLeaf as y}from"./sys/retry-delivery.js";import{sysWorktreesLeaf as c}from"./sys/worktrees.js";import{sysSpacesLeaf as L}from"./sys/spaces.js";import{sysLimitsBranch as h}from"./sys/limits.js";import{sysSpendBranch as B}from"./sys/spend.js";import{sysSettingsLeaf as S}from"./sys/settings.js";import{sysConnectLeaf as g}from"./sys/connect.js";import{sysSetupLeaf as u}from"./sys/setup.js";import{tutorialBranch as d}from"./sys/tutorial/branch.js";import{supportBranch as D}from"./sys/support.js";import{contextBranch as k}from"./sys/context.js";import{sysSyncBranch as b}from"./sys/sync.js";import{sysMigrateLeaf as l}from"./sys/migrate.js";import{sysJoinLeaf as v}from"./sys/join.js";import{sysDbBranch as x}from"./sys/db.js";import{sysImportBranch as M}from"./sys/import/start.js";import{sysMachineBranch as C}from"./sys/machine/rotate.js";import{sysDesktopBranch as E}from"./sys/desktop.js";import{sysSigninLeaf as F,sysSignoutLeaf as I}from"./sys/signin.js";import{sysUpdateLeaf as J,sysVersionLeaf as R}from"./sys/update.js";function er(){return t([S,f,i,g,u,d,a,k,p,n,c,y,L,h,B,D,J,R,l,v,b,x,M,C,F,I,E,e])}r(er,"registerSys");export{er as registerSys};
1
+ var m=Object.defineProperty;var r=(o,s)=>m(o,"name",{value:s,configurable:!0});import{defineSysBranch as t}from"./sys/branch.js";import{configBranch as f}from"./sys/config.js";import{sysEnvBranch as i}from"./sys/env.js";import{daemonBranch as e}from"./sys/daemon.js";import{sysDoctorLeaf as p}from"./sys/doctor.js";import{sysFeedbackLeaf as a}from"./sys/feedback.js";import{sysLogsLeaf as n}from"./sys/logs.js";import{sysRetryDeliveryLeaf as y}from"./sys/retry-delivery.js";import{sysWorktreesLeaf as c}from"./sys/worktrees.js";import{sysSpacesLeaf as L}from"./sys/spaces.js";import{sysLimitsBranch as h}from"./sys/limits.js";import{sysSpendBranch as B}from"./sys/spend.js";import{sysSettingsLeaf as S}from"./sys/settings.js";import{sysConnectLeaf as g}from"./sys/connect.js";import{sysSetupLeaf as u}from"./sys/setup.js";import{tutorialBranch as d}from"./sys/tutorial/branch.js";import{supportBranch as D}from"./sys/support.js";import{contextBranch as k}from"./sys/context.js";import{sysSyncBranch as b}from"./sys/sync.js";import{sysMigrateLeaf as l}from"./sys/migrate.js";import{sysJoinLeaf as v}from"./sys/join.js";import{sysDbBranch as x}from"./sys/db.js";import{sysImportBranch as M}from"./sys/import/start.js";import{sysRepoDocsBranch as R}from"./sys/repo-docs.js";import{sysMachineBranch as C}from"./sys/machine/rotate.js";import{sysDesktopBranch as E}from"./sys/desktop.js";import{sysSigninLeaf as F,sysSignoutLeaf as I}from"./sys/signin.js";import{sysUpdateLeaf as J,sysVersionLeaf as U}from"./sys/update.js";function ar(){return t([S,f,i,g,u,d,p,k,a,n,c,y,L,h,B,D,J,U,l,v,b,x,M,C,R,F,I,E,e])}r(ar,"registerSys");export{ar as registerSys};
@@ -23,6 +23,7 @@ export declare class RelayTransport extends EventEmitter implements Transport {
23
23
  private ws;
24
24
  private closeEmitted;
25
25
  constructor(nodeId: string, target: RelayTarget | LocalRelayTarget);
26
+ private refusal;
26
27
  private get url();
27
28
  private dial;
28
29
  connect(): void;
@@ -45,3 +46,5 @@ export declare class RelayTransport extends EventEmitter implements Transport {
45
46
  * with no listener throws, and this transport must never throw uncaught. */
46
47
  private emitError;
47
48
  }
49
+ /** `409 broker_not_ready: <message>` from a refused upgrade's `{error:{code,message}}` body. */
50
+ export declare function refusalMessage(status: number | undefined, body: string): string;
@@ -1 +1 @@
1
- var l=Object.defineProperty;var a=(s,t)=>l(s,"name",{value:t,configurable:!0});import{EventEmitter as d}from"node:events";import{WebSocket as h}from"ws";import{classify as m}from"../fault-classifier.js";import{AttachRefusedError as f,BrokerUnavailableError as u}from"./transport.js";function p(s,t){if("socketPath"in s)return`ws+unix://${s.socketPath}:/v1/nodes/${encodeURIComponent(t)}/attach?revive=0`;const e=new URL(s.previewEndpoint);return e.protocol=e.protocol==="http:"?"ws:":"wss:",e.pathname=`/v1/nodes/${encodeURIComponent(t)}/attach`,e.search="?wakeParked=1",e.hash="",e.toString()}a(p,"relayUrl");class S extends d{static{a(this,"RelayTransport")}nodeId;target;ws;closeEmitted=!1;constructor(t,e){super(),this.nodeId=t,this.target=e}get url(){return p(this.target,this.nodeId)}dial(){const t=new h(this.url,{..."relayToken"in this.target?{headers:{authorization:`Bearer ${this.target.relayToken}`}}:{},perMessageDeflate:!1});return this.ws=t,t}connect(){const t=this.dial();t.on("open",()=>{this.emit("connect")}),t.on("message",e=>this.onMessage(e)),t.on("error",e=>this.onError(e)),t.on("close",(e,n)=>this.onClose(e,n.toString()))}redial(t){return this.destroy(),this.closeEmitted=!1,new Promise((e,n)=>{const r=this.dial();let i=!1;r.on("open",()=>{i||(i=!0,this.emit("connect"),e())}),r.on("message",o=>this.onMessage(o)),r.on("error",o=>{if(i){this.onError(o);return}i=!0;try{r.terminate()}catch{}n(o)}),r.on("close",(o,c)=>{i&&this.onClose(o,c.toString())})})}send(t){const e=this.ws;if(!(e===void 0||e.readyState!==h.OPEN))try{e.send(JSON.stringify(t))}catch{}}destroy(){const t=this.ws;if(t!==void 0&&t.readyState<=h.OPEN)try{t.close(1e3)}catch{}}onMessage(t){let e;try{e=JSON.parse(t.toString())}catch{return}this.emit("frame",e)}onError(t){this.emitError(new Error(`relay transport error: ${t.message}`))}onClose(t,e){if(this.closeEmitted)return;this.closeEmitted=!0;const n=m("viewer\u2194broker",{code:t,reason:e}),r=t===1008||n.kind==="protocol"||t===1011&&(/^no running broker/.test(e)||/^no node /.test(e));t===1008?this.emitError(new f(this.nodeId,e)):r&&this.emitError(new u(this.nodeId)),this.emit("close")}emitError(t){this.listenerCount("error")>0&&this.emit("error",t)}}export{S as RelayTransport};
1
+ var l=Object.defineProperty;var a=(s,e)=>l(s,"name",{value:e,configurable:!0});import{EventEmitter as d}from"node:events";import{WebSocket as h}from"ws";import{classify as f}from"../fault-classifier.js";import{AttachRefusedError as u,BrokerUnavailableError as m}from"./transport.js";function p(s,e){if("socketPath"in s)return`ws+unix://${s.socketPath}:/v1/nodes/${encodeURIComponent(e)}/attach?revive=0`;const t=new URL(s.previewEndpoint);return t.protocol=t.protocol==="http:"?"ws:":"wss:",t.pathname=`/v1/nodes/${encodeURIComponent(e)}/attach`,t.search="?wakeParked=1",t.hash="",t.toString()}a(p,"relayUrl");class $ extends d{static{a(this,"RelayTransport")}nodeId;target;ws;closeEmitted=!1;constructor(e,t){super(),this.nodeId=e,this.target=t}refusal;get url(){return p(this.target,this.nodeId)}dial(){const e=new h(this.url,{..."relayToken"in this.target?{headers:{authorization:`Bearer ${this.target.relayToken}`}}:{},perMessageDeflate:!1});return e.on("unexpected-response",(t,o)=>{let r="";o.on("data",n=>{r.length<2048&&(r+=n.toString())}),o.on("end",()=>{this.refusal=g(o.statusCode,r),e.terminate()})}),this.ws=e,e}connect(){const e=this.dial();e.on("open",()=>{this.emit("connect")}),e.on("message",t=>this.onMessage(t)),e.on("error",t=>this.onError(t)),e.on("close",(t,o)=>this.onClose(t,o.toString()))}redial(e){return this.destroy(),this.closeEmitted=!1,new Promise((t,o)=>{const r=this.dial();let n=!1;r.on("open",()=>{n||(n=!0,this.emit("connect"),t())}),r.on("message",i=>this.onMessage(i)),r.on("error",i=>{if(n){this.onError(i);return}n=!0;try{r.terminate()}catch{}o(this.refusal===void 0?i:new Error(this.refusal))}),r.on("close",(i,c)=>{n&&this.onClose(i,c.toString())})})}send(e){const t=this.ws;if(!(t===void 0||t.readyState!==h.OPEN))try{t.send(JSON.stringify(e))}catch{}}destroy(){const e=this.ws;if(e!==void 0&&e.readyState<=h.OPEN)try{e.close(1e3)}catch{}}onMessage(e){let t;try{t=JSON.parse(e.toString())}catch{return}this.emit("frame",t)}onError(e){this.emitError(new Error(`relay transport error: ${this.refusal??e.message}`))}onClose(e,t){if(this.closeEmitted)return;this.closeEmitted=!0;const o=f("viewer\u2194broker",{code:e,reason:t}),r=e===1008||o.kind==="protocol"||e===1011&&(/^no running broker/.test(t)||/^no node /.test(t));e===1008?this.emitError(new u(this.nodeId,t)):r&&this.emitError(new m(this.nodeId)),this.emit("close")}emitError(e){this.listenerCount("error")>0&&this.emit("error",e)}}function g(s,e){try{const t=JSON.parse(e).error;if(typeof t?.code=="string")return`attach refused (${s??"?"} ${t.code}): ${typeof t.message=="string"?t.message:""}`}catch{}return`attach refused (${s??"?"})`}a(g,"refusalMessage");export{$ as RelayTransport,g as refusalMessage};